VHD Attach 1.50

Illustration

It has been a while since I released VHD Attach. It worked perfectly for me and, judging from comments on Internet, for quite a few other people.

One thing that gave me most grief was necessity of going through UAC prompts. This “feature” is gone now. VHD Attach will install itself as service during setup and thus all UAC prompts will be avoided.

Another feature long overdue is ability to work properly on Windows 7 that are not of English descent. Although most of features weren’t affected, this is definitely step forward.

You can download new version here.

How to Create Self-installing Service

Creating Windows Service quite often comes as natural choice when some long-term task needs to be done or, god forbid, you need something running while there is nobody to log on. Although services are useful, there are two things that annoy me and they are just too non-obvious to do. One is debugging services and another one is installing them.

For quite a while I’ve been using installutil.exe in order to install services. Since I am fan of being able to put things on system without actually installing them, that meant that I went through hoops to write C# code which will find installutil.exe in all it’s possible locations, under any combination of service packs and then to parse output once it gets executed.

I am not proud that it took me literally years to get idea to open installutil.exe in Reflector. And there, under whole glory, there was single function that does everything. And to make things even better parameters for this function are same as parameters for installutil.exe itself.

In order to install service, it is enough to pass name of executable (executing assembly in this example) and magic will happen:

ManagedInstallerClass.InstallHelper(new string[] { Assembly.GetExecutingAssembly().Location });

Uninstall is same story. Additional “unistall” (or “u”) flag is all it takes:

ManagedInstallerClass.InstallHelper(new string[] { "/u", Assembly.GetExecutingAssembly().Location });

Design of whole thing leaves lot to be desired. It just doesn’t feel like .NET - it feels like whole thing was pushed in after somebody noticed that there is no installer and there are only 2 hours before final version of .NET comes out.

One could get into refactoring whole thing out and making “proper” installer without too much effort. However, personally I will not do it. Although this function annoys me, I am also assured that Microsoft takes care of testing it and that it will work on every supported version of .NET Framework on every supported platform. Services are difficult enough without risking installation issues on some obscure combination.

Things that are not (badly) broken should not be fixed.

P.S. Not to forget, you need reference to System.Configuration.Install.dll in your program.

Kingdom for a Spoon

Illustration

I love Ben & Jerry’s ice cream. Since that particular brand is not available in Croatia where I live, I like to indulge myself when I am in Berlin.

Since tonight I was having sweet tooth decision was made, for the first time, to try big 500ml box. It came quite costly but I didn’t care. I was eager to go into my hotel room to be alone with it…

However, unlike small cones, big packaging does not include any spoon-like contraption. That presented quite a problem since there was no spoon in sight.

For benefit of those among you that cannot handle horror movies, I will not go into too much details. I will just say that I managed to eat it. And I will remember to pack a spoon on my next trip. :)

Yahoo Response Time

Everything started with me trying to enter my home town, Osijek, on stackoverflow careers. I was quite annoyed with auto change of Osijek to Esseg - name that my town had before year 1918 (during Habsburg Monarchy).

I got information that this is taken from geo.places Yahoo table and that this is place to complain. On contact page it was clearly said that all technical questions or bugs should be addressed in support forums (“Please use our developer forums for both issues so that other developers can benefit from the conversations.”). I did just that - I created new post in Yahoo developer forum. I tried to be as specific as possible and I avoided to be too annoying with constant repost.

It has been a month now and error remains. I am little bit disappointed since I haven’t seen any action at all. I would understand if somebody challenged my claim. I would understand if somebody said that independent verification is needed. I cannot understand that there is no answer at all. If you say that forums are your only official support, you better post some replies there.

Since original approach didn’t work, I will probably start to annoy everybody and repost this from time to time. I am quite sure that Jeff Atwood (meta stackoverflow moderator) will bother them too. Hopefully some time next year I will be able to have my city named correctly.