John’s Adventures

Archive for November 2005

No More BMW

mynewclio.jpgWell, I finally got around to changing my car and it was an odd experience indeed. Trading in my BMW 325Ci Sport for a mere Renault Clio Sport 182 meant that the dealer actually gave me a large cheque when we swapped keys! It was a nice feeling.

You might think it’s a bit of a downgrade but I really don’t think it is. Sure, the BMW was nice and luxurious, the 6 cylinder engine sounded great and was very fast. But it cost a fortune to service and it used up petrol like a 747. I really didn’t think it was worth the money, it wasn’t that much better than a Ford Focus. The Clio, on the other hand, is much more economical, the servicing is cheaper and the tyres don’t cost £200 each. Oh, and it has all the toys and then some of the BMW - leather interior, climate control, cruise control, auto-lights and auto-wipers, xenon lights and much more besides. Plus it’s faster than the BMW too - lots faster!

It’s pretty quick up to 5000rpm but from then on it turns into an animal - in the wet it tries to take off! Anyway, I managed to get through the first day without crashing it which is always my aim with a new car. And I don’t miss the BMW so far - somebody actually let me out of a junction yesterday which never used to happen! Oh, and those wheels look much easier to clean than the spokey ones I used to have - should save a bit of time in my bi-annual car washing…

The Sign Of A Good Wedding

I went to the wedding of my girlfriend’s colleague on Saturday night and had a rather good time - and a bit too much to drink! I thought this photo summed it up:

weddingtable.jpg

I’m guessing that the empty glasses and bottles weren’t presents…

My Installer Fixation And NSIS

I love installers. I’ve found that wherever I work I end up writing one for the software and I wouldn’t have it any other way. There’s something that gives me that warm, fuzzy feeling inside when just a few buttons clicks can make the process of putting software on a machine seem trivial and just as easily remove it when in fact there’s a whole load of clever stuff going on underneath. Still waters run deep.

Take my last company. Before I wrote an installer it would take a person around a day to properly deploy the software. It consisted of C++ COM dlls, C++ COM+ components, an ASP.NET web site and a SQL Server backend. For anyone who’s had to deploy this type of software you’ll know that there are a great number of things that can go wrong and add time to an install. Never mind the fact that different operating systems (such as the different editions of Windows 2000 and 2003) all have their own little nuances…

I’ve seen in a lot of places a “deployment document” written consisting of a list of steps to perform when installing and you have to keep it up to date when you encounter problems as you go along. You end up with a numbered list where each item consists of a bullet pointed list and this is why an install takes a day. I find it surprising that companies seem to consider writing an installer as one of those “we’ll do it if we ever get time” projects that they never get around to. It’s surprising because the gains you get for such a small amount of work are immense.

At my last place I probably took a few weeks to write the installer and it dropped the time to install our software from a full day to around 10 minutes - and it always worked (once the bugs were ironed out!). Finally, instead of a customer install being a case of “okay, what’s going to go wrong this time?” it was a simple task that took no time at all. It was stress-free and made us look like a real bunch of pros to the customers.

If a glitch came up on a certain operating system, I didn’t go and append another “if this happens do this…” bullet point to some 50 page Word document, I fixed the installer and promptly forgot about it - the installer would deal with it.

I’ve used most of the tools out there including Windows Installer, InstallShield, Wise and the free and rather good Inno Setup which I’ve used more and more recently. I came to realise that you spend most of your time with installers writing code to do custom, tricky things like set up a COM+ application or configure a web site and despite products like Installshield supporting this, they aren’t flexible enough and I’d end up rolling my own code in VBScript or in a C++ dll I’d call. Inno Setup has been just fine for this.

However I’d been aware of another free tool out there called NSIS but had never actually sat down and learned how to use it. Until last week. And I must say, it’s amazing. I can see why companies like Google are using it - you can write a highly sophisticated installer in no time at all.

Installers consist of a bunch of tasks you need to do in sequence and you undo them in an uninstaller. You may want to create a bunch of shortcuts, copy some files, register some libraries, create a web site and configure some configuration files. Inno Setup was fine for things like that but if I needed to find some existing shortcuts and delete them, then add some new ones, then check to see if something was installed and if not download it from the internet and install it, then copy some files and so on it wouldn’t support it and I’d have to jump through hoops to do it. The steps weren’t fine-grained enough. NSIS lets me do whatever I want in any order I want, both installing and uninstalling.

Installer Page One

I’ve been writing the new installer for version 2 of my background switcher and I needed it to do things like check if MS.NET is installed and if not, download and install it. I wanted it to fix up an install of any previous versions of my app installed including removing shortcuts that were in the “All Users” start menu when they shouldn’t be (naughty Inno Setup). I also wanted more fine-grained control over the uninstall process which I couldn’t really do before but with NSIS it’s easy. I can control the order things happen (e.g. delete this shortcut, then copy these files, then launch this application, then copy another file) to a degree I couldn’t do before and it’s completely extensible - I can create custom pages and call the windows API or write my own custom dlls.

And I’ll tell you something else, you could spend £1000 on a commercial product like Installshield or Wise, or £0 on NSIS and believe it or not, there’s nothing Installshield or Wise can do that you can’t achieve with NSIS - and trust me you spend more time working around the weaknesses in the big products than you do writing code for an NSIS installer. Now, guess what product I’ll be using to write the installer at my new job? I’ll give you a clue - it’s a four-letter word. And it doesn’t start with “W”…

Return To Form

Three months ago I heavily sprained my ankle playing football and I’ve been trying to recover ever since. Everybody knows that once you sprain an ankle it’s easy to go over it again but what less people know is that if you rehabilitate it by strengthening around the ankle and work on the flexibility of the joint you should be able to get back to 100% fitness.

With this in mind I started moving it as soon as I could after injury and waited for the swelling to go down (which took weeks) before doing any heavier work on it. I was advised by a sports physio I know to work on strengthening my calf muscle and shin which I diligently did. I had to start gradually and gently build it up as the ankle was pathetically weak. I borrowed one of those big elastic band things to work on mobility and gradually strengthening the joint through it’s full range of motion. I even spent time sitting on a chair with my foot hooked around a door - pushing the door open - to strengthen the ankle (and boy did that hurt). I’d been assured that the ankle would often hurt like hell while exercising it but that while it would feel like something was going to snap I’d probably be alright!

Three months later and with much trepidation I decided to return to football on Wednesday not really sure if it would stand up to the punishment or not. Despite having done a lot of work on it along with plenty of running and weight training, there really is no preparation for actually playing football. You can’t simulate all the twisting and turning you do along with the fact that you get tackled, tripped up and pushed around so landing awkwardly is par for the course. I don’t think I’ve ever been that nervous before playing before!

Incredibly I got through the game fine. My touch was a little off, my passing wasn’t the best, my positional play wasn’t that good, my tackling was even worse than usual (if you can believe it) and my movement wasn’t as fluid as it should be. But it’s exactly what I’d expect after not playing for three months. I was subjected to a couple of hard tackles with no ill effects (aside from losing the ball on both occasions). The ankle was a bit sore the day after but to be honest so was the rest of me! It was great to play again although I need to keep up the work or, like my dodgy knee, it could go again. Now, I just have to avoid any new sprains or strains. I’m in danger of losing count of the number of old injuries I have to keep an eye on!

So Much For Eating My Bread Crusts

I knew I wouldn’t last long before posting about my hair, so I’ll try and get it over and done with as quickly as possible and then we can move on!

I remember the last time I grew my hair long. It was probably 10-15 years ago and from what I recall it was a neat short back and sides one day and long enough for me to tie up in a ponytail the next. There didn’t seem to be an in-between stage, or more likely I’ve blanked it out because it was so long ago. Okay, my memory may be hazy about that but what I distinctly remember was that my hair was completely straight.

I’d wash it in the morning, brush it and an hour later it would be dry and as straight as if I’d run it through some GHD straightening irons. So naturally when I decided a year ago to grow my hair long again and put the military crew-cut look to bed I thought it would be perfectly straight again. How wrong I was, as you can see below:

My mop of hair

At first I tried to deny it and pretend it was still straight. I must confess that I even stole my girlfriend’s straighteners and used them on more occasions than I’ll admit to. I learned how to blow-dry my hair straight and I’d get annoyed when I wouldn’t quite get it right and see a bit curling away of its own accord. But then I just thought “what the hell”. I’d get up, have a shower, wash my hair, towel dry it a bit, brush it and leave it to its own devices. And much to my surprise it dried completely straight!

Okay, that was a lie. It dried as curly as you see in the picture above, and I just accepted it for what it was and decided I liked it after all. Who wants straight hair anyway? But I still find it strange that it’s no longer as straight as it was in my younger days…

Okay, that’s the hair post out of the way, I can get back to more interesting topics! :)

John’s Background Switcher 1.3 Released

I forgot to mention that I just finished the latest version of John’s Background Switcher and have added a bunch of new features (thanks to those who suggested them).

If you haven’t seen it and wonder what I’m talking about, it’s a simple little application that sits in the system tray (down by the clock) of your Windows PC (sorry, I’m afraid it’s Windows-only) and changes the desktop background at specified intervals. You pick the pictures, when you want them to change and if you want them to be picked randomly and it just quietly goes about its business.

It’s completely free and I’m still surprised something like it doesn’t come as part of Windows! You can read the release notes here and download it from this page. Enjoy and if you have any suggestions or problems then let me know (I’m working on V2 at the moment).