Running IBM’s Really Small Message Broker on Windows

Since getting a CurrentCost CC128 “smart” electricity meter a few weeks ago the hacker in me has had a resurgence and I have started writing hobby-code again on top of my day job. There seems to be a small industry of software for interacting with these smart meters, and publishing and recording the data to various sources such as Pachube that allow you to share your electricity consumption data with others. At the consumer/home level things seem to still be targeting tinkerer’s like myself, rather than the general consumer. Most of the tools seem to be centered around the linux and java community, which is all well and good, but why can’t us Microsoft .Net folks get in on some of the action.

Microsoft’s Windows Home Server is a perfect platform to act as a hub for this type of stuff. It’s designed to be always on, with an add-in model that allows extensions, so I decided to embark on using my HP MediaSmart EX470 to publish the CC128 sensor data in a variety of ways.

As part of IBM’s work surrounding telemetry and sensor messaging they have made, freely available, what they are calling a “nano broker”, the Really Small Message Broker (RSMB). This broker talks the Message Queue Telemetry Transport (MQTT) protocol, designed again, by IBM (the brainchild of Andy Stanford-Clark, IBM Master Inventor and illustrious enough to have his own wikipedia page). The idea is that you can publish data on a specific Topic to the RSMB via MQTT, and the RSMB will then distribute that data to any “client” that is subscribed to that topic. Being IBM, the code is primarily targeted at the linux community, however they are also nice enough to provide a Windows console application binary.

Getting a console application to run when Windows Home Server boots is not as simple as putting it in the Start menu, or in one of the myriad of “Run” registry sections. Fortunately, Microsoft provides two executables, instsrv.exe (service installer) and srvany.exe (run any program as a service) as part of the Windows Server 2003 Resource Kit, and these can be used to run any program as a service, which means that you can get IBM’s RSMB running at server boot without having to have a user logon session.

The following steps will allow you to run the RSMB on Windows Home Server so that it starts up at server boot. These instructions assume you have installed the Windows Server 2003 Resource Kit in the standard location, and you have unzipped the RSMB to C:\RSMB. Alter the instructions for your paths if they vary. You’ll have to do all this by logging onto the server using the remote desktop client, not the standard windows home server console.

1. Use InstSvc.exe to install an SvrAny.exe based service.
32bit Windows Server (ie, HP MediaSmart EX470 etc)
“C:\Program Files\Windows Resource Kits\Tools\instsrv” RSMB “C:\program files\Windows Resource Kits\Tools\srvany.exe”

64bit Windows Server
“C:\Program Files (x86)\Windows Resource Kits\Tools\instsrv” RSMB “C:\program files (x86)\Windows Resource Kits\Tools\srvany.exe”

2. Alter the registry to let SrvAny.exe know that it should run the broker.
Note the important part here is setting the AppDirectory, without which the RSMB will mysteriously start and then immediately stop because it can’t find it’s Messages file.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\RSMB\Parameters]
“Application”=”C:\\rsmb\\broker.exe”
“AppDirectory”=”C:\\rsmb\\”

Registry File

That’s all there is to it. If you go into Computer Manager and the services browser, you should be able to start the RSMB service and the broker will be running silently in the background. You can check this out by looking at Task Manager, Processes Tab, where you will see both the SrvAny.exe and Broker.exe processes. You can also run netstat -an in a powershell or cmd.exe window to check that the server is listening on port 1883.

The only thing that you should do on top of this is to change the service to run with a non administrative account with locked down settings (read/write access to the RSMB folder and the ability to listen to connections on port 1883 should do the trick).

Updated to WP 2.7 in preparation for server move

Thats all :) Nothing fancy.

Looks like I messed up doing the upgrade by copying over old images etc.  So be it, I’ll be starting a-fresh on the new server.

Using GMail with Windows Mobile 6 IMAP

If you are a software engineer then most likely you subscribe to a number of email lists, or get regular daily / periodical email updates that can clog up your email inbox.  Also most likely you use Outlook, connected via POP to download your email, and have a myriad of rules that move messages into folders to keep everything as organized as possible.

Late last year I moved email hosting for @markallanson.net emails over to Google Apps For Your Domain in order to make use of GMails excellent online client, search ability and also to ensure reliable and *fast* email access both online and offline. When I switched to Google Apps I altered my Outlook client to use POP to download the mail, and kept all of my rules in Outlook. This has been working perfectly since, but a few weeks ago I got myself a HTC Touch Dual and wanted to get it to sync with my mail hosted on Google.

Ever since moving to Google Apps and using their online client the one thing that bugged me was that all mailing lists appeared in my main inbox. I switched outlook to connect via IMAP and sure enough the same thing happens, all emails were being synchronized to the single inbox folder. I synchronized Windows Mobile on the Touch Dual via IMAP and the same thing happens, as expected. The noise is too much to deal with on a mobile device so it’s time to start categorizing email – but on the server side in GMail – not using Outlook.

GMail supports filters and labels for categorizing email. You can tag an email with as many labels as you like and then view slice and dice via a labels. When tagging an email with a GMail label it appears in Outlook as a separate folder. The same thing happens on your windows mobile device. I tagged all emails from the WiX-Users mailing list and a WiX-Users folder appears in Outlook and Windows Mobile. Unfortunately however the same email also stays in your inbox and the noise is still there.

GMail also allows you to perform actions on arriving email in a similar way to Outlook rules so assigning labels automatically upon email arrival was trivial using the Filters functionality. Still this does not solve the noise problem.

In order to remove the noise, there is an option you must set on each incoming message filter. Once the filter criteria has been set up you must also check the box that tells GMail to archive the email once the filter has been applied.  Now archiving to me originally sounded like too much of a “Final” operation, so I ignored the option, but in effect ticking the archive box just removes it from your inbox. The labels applied via the filter are still usable, and the email can still be searched, but the noise is removed from the inbox.

So, to have a usable version of your email on WinMo6 via GMail you need to do the following.

  1. Switch to using IMAP to synchronize Windows Mobile and GMail.
  2. Move your Outlook rules into GMail, adding a Filter for each rule, and applying labels in order to categorize.
  3. Ensure that your filters archive all email that is labeled to remove it from the inbox as part of the filtering process

One final thing: When you set up a sync in Windows Mobile by default only the last N days of headers are synced from the server. I had some emails that I needed to have available at all times, such as all emails relating to my upcoming trip to Florida. The way I did this was to apply a Holiday_Orlando label to each of the emails that I needed to have on the phone always. At the next sync Windows Mobile created a new folder called Holiday_Orlando with no messages (none were newer than 3 days). I then had to modify the Holiday_Orlando folder synchronization options to add an override for that folder which told it to sync all messages in the folder.  Voila, all messages about the vacation are now available, with their attachments!

God knows how non-techies are supposed to ever figure this stuff out! (and apologies for the random rambling format of this post, I just *had* to write this down for others wanting to do the same thing.)

Hello world!

Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!

Your hard drive capacity has increase. This is NOT an error.

Helpfull, this.

Your hard drive capacity has increase. This is NOT an error.

So, why exactly are you bothering me with this dialog that I can only Cancel? I’m not going to even start to go into what is wrong with this error message and how it could confuse new computer users.

Hooray for leased computers and the junky software that is installed on them.

Priory Park, Southend-on-Sea

On Saturday morning I was lucky enough to spend some time walking around Priory Park, in Southend with my camera and tripod in tow. I only had an hour, and didn’t get to explore even close to half of the park so I will have to take a trip back there this spring and this time allow more time for the visit.


Here’s a sample of the photographs that came out of the cold morning. I can’t wait to revisit in spring!

Two of a Kind - Day 32

Aspire

Texturizer

The full set can be found @ Flickr in my Priory Park set.

I’ve gone Pro!

I decided that it was time to purchase a Pro account on Flickr. No, I’m not abandoning Zooomr. At least not yet. Thankfully, because jUploader can post to Zooomr and Flickr I will continue to cross-post to both sites, however I will not be doing things such as geotagging my photos on Zooomr.

What inspired me to go Pro on Flickr?

  1. The community features are brilliant, the more I have played with Flickr, the more I see just how valuable groups are.
  2. Geotagging in Flickr is an absolute pleasure – it’s such a slick implementation it blows Zooomr’s implementation to pieces and it’s fast fast fast which is an added bonus!
  3. In fact, the entire Organizer in Flickr is so slick its pleasurable to use.
  4. I have never, ever, ever received timeouts from Flickr. The site just works.
  5. Its so cheap its laughable, especially given the $-£ exchange rate at the moment.
  6. [Updated] Exposure. So many more people will see my photographs on Flickr.

The only thing I am absolutely dreading is moving all my images posted to Zooomr into Flickr. As far as I can tell there is no way to export metadata from Zooomr, and no way to import it into Flickr. This sounds similar to the comments that Thomas Hawk wrote way-back-when when he wanted to transition from Flickr to other photo sharing sites. This is the type of thing that photo sharing sites should be offering out of the box, now. Shame on both Zooomr and Flickr for not making this easier, especially Flickr as they are so big and have the resources available to solve this problem if they really wanted to.

Now, my first cross-posted image, a portrait of my gorgeous Sarah, taken during breakfast over the Christmas – New Year break, one of the first Photos with my new Fuji compact.

GI Jane

Project 365

I’ve decided to join Project 365. It’s a Flickr group. Each member of the group has to take one picture, every day, for one year.

Here’s Day 1.

Day 1

Photo’s will be taken with one of my cams, either the EOS 350D, FinePix F650 or a cameraphone. Lets see if I can keep this up for the year. Anyone want to start taking bets? :)

I probably won’t post the images every day, but I will definately take one every day, and might post them up every few days, or week. I definately won’t post all the photo’s here, so you’ll have to checker Flickr intermittantly to keep up to date.

The PhotoSet with all photo’s can be found here.

And we were waiting for aaaages

And we were waiting for aaaagesAnd we were waiting for aaaages Hosted on Zooomr

Remember to keep up to date with all of my photographs at my Zooomr Page, or subscribe to my Zooomr photostreams RSS feed.

Windows Vista on an Alienware Area-51 m5550

I have been using the RTM of Windows Vista on my Alienware since it was released to MSDN in November ‘06. Generally, everything has gone smoothly, however there are a few problems. As I find the solutions to these problems I will post them up here for the benefit of others.

The official Alienware support channels are pretty bad from experience so far, especially their drivers section, so generally don’t expect a solution from them.

Problem: The headphone jack doesn’t work when using a normal set of headphones with a phono plug.

Solution: You are correct, this did not work for me either with the out-of-the-box Vista drivers. The chipset seems to be a Realtek chipset, and Vista installs generic “High Definition Audio Device” drivers, which don’t work with headphones (The inbuilt speakers work fine, and I have not tested the S/PDIF output, so im unsure as to whether they work or not).

The Alienware website doesn’t have drivers for this Realtek chipset - so the way I got this working was to install the Realtek drivers supplied on the “m5550i – R3 Series Support CD Revision 1.1″ disk (the title of yours might vary). After the install of these drivers (and system reboot), you will get a warning about program compatibility of the Realtek control panel application that loads at startup. This program isn’t needed for operation of the soundcard, so you can just stop it from loading at startup using Windows Defender.

Question: Does the hardware Fan button (reduce performance to reduce fan noise) do anything in Vista?

Answer: I’m not entirely sure based on evidence I have seen so far about how much of an impact this button actually has. I specced my laptop with a 2Ghz Core  2 Duo processor, and when running normally the WCPIDCLK application reports the speed as circa 1995Mhz.

After pressing the Fan button, WCPUIDCLK reports a slight drop in CPU performance, circa 1932Mhz.

I also ran a few tests using CPU-Z and it comes up with the same results – so it seems like it does do something, but not a lot, and certainly not enough to make the laptop turn off the fan.  I haven’t run these tests on WindowsXP however, so am unsure as to whether it has more of an effect on that OS.