harriyott.com

31 December 2005

The Mythical Man Month and Other Essays on Software Engineering

I received the Mythical Man Month and Other Essays on Software Engineering for Christmas, which I've just started. The MMM is quite a short essay, just a couple of pages, I was expecting a chapter's worth. I've often encountered people referring to it as justification for decisions, so I'm glad I've finally read it.

22 December 2005

Numeric sorting in explorer

I was quite impressed with Windows Explorer today: sorting a load of files with numbers as filenames actually sorted them numerically, rather than alphanumerically.

As you can see in the screen shot, the leading zeroes are ignored. Brilliant.

Numeric Sorting

I'm sure loads of people know this one already, and if you're one of them, then you should feel really bad for not telling me sooner. If you didn't know, then have a look at my handy Send To tip. That's cool too.

8 December 2005

Christmas tip for bosses

Bosses, here's a tip to make your team happier. Buy them a big tin of chocolates.

[Please note: this is not an original idea, I was inspired by my boss, who just bought us a big tin of chocolates.]

8 December 2005

Car insurance software

A few people have asked me recently what I do for a living. In short, I write software (for EurotaxGlass's) that insurance companies and car repairers use. The software, Glassmatix, is used for sending estimates of repair costs between the repairer and the insurance company, with details of the exact parts and labour times needed to repair damaged car.

7 December 2005

TimeSnapper - curing Friday afternoon amnesia

I discovered TimeSnapper today, from Leon's site. It takes a screenshot every n seconds, and saves it with a timestamp to disk. At timesheet-filling-in-time, TimeSnapper can play back the whole week's screenshots so the correct times and tasks can be filled in. Brilliant. This could be so useful. I'll try it out on Friday.

7 December 2005

Easy screenshots with Cropper

I came across a great tool today, called Cropper. It makes screenshot creation so much easier. When launched, a translucent box appears that can be resized over the area of the screen that needs to be, er, "shot", and Cropper saves it as an image file on disk, all nicely cropped to the right size. The desired file format can be selected too, saving one more faff involved in the usual process.

Anyway, I highly recommend it - especially as it's free. Go try it out.

7 December 2005

It seems I've become a forum

I was very flattered this morning to find an email in my inbox from a stranger. Usually I'm annoyed when I receive an email from a stranger, because they generally want me to buy "body" drugs, degrees, logos or fake watches; but not this time. Someone emailed me with a question about MSBuild, with the implied assumption that I was brainy enough to be able to help them.

Fortunately I was. (It was an easy question.)

I'm sure some people get fed up with this kind of behaviour, but being my first time, I think I rather like it.

[Technorati Profile]

6 December 2005

Debugging a service in .NET

To debug a service in .NET, put

System.Diagnostics.Debugger.Break();

in the OnStart method. This will fire up a prompt when run, which is where the debugger can be selected.

2 December 2005

Build machine visibility

The build machine does many things, which I've previously listed. The whole process takes about 15 minutes, during which an plain orange HTML page is shown full screen. If the build passes, it turns green, and red if it fails, and then a look through the log file to find out what went wrong.

I decided to add some feedback to the orange screen so I know what's happening during the build. In each target, before each task, I added a WriteLinesToFile task that writes a brief description of the task to a file:

<target name="UnitTests">
<WriteLinesToFile
File="@(CurrentTaskFile)"
Lines="Running unit tests"
Overwrite="true"/>
<Exec Command="$(RunUnitTests)"/>
</target>

The HTML page refreshes every 5 seconds, and uses some JavaScript to insert the contents of this file into the page:



I made it horrendously big, because I sit the other side of the room to the build machine. After the final task has completed successfully, an empty string is written to the file, so a plain green screen is displayed on success. If the build fails, the "Currently:" becomes "Failed:", so the failing task is instantly visible.

2 December 2005

Google Maps

I've been looking for an excuse to do something with Google maps for a little while. I had a little play about with the API last week, and it's really pleasing. Tonight I knocked up a quick map for the contact page of my church's website. Simple, I know, but it's better than the existing text links that launched mulletmap in a new window.

To use the Google maps API, one must register a root URL to obtain an API key, and pass this to Google's JavaScript handler. Any pages using that key must have a URL starting with the one registered. Sounds fine, but there was an irritating side-effect. I had to register http://localhost to test my map on my local machine while developing and testing it, and then change the key to the church's one just before uploading. I couldn't even register file://, so I had to have a web server running to even start. It would be really useful if the API would allow those two prefixes with any valid key, so using the target site's key wouldn't prevent the map running locally.

1 December 2005

Send To

I use the "Send To" Explorer shortcuts regularly. I added to this a couple of directory shortcuts to common locations, such as my shared folder on the network, and our released development assemblies folder.

I always resent the hassle of actually navigating to the Send To folder to add a directory shortcut, so I rarely do so, unless I know that the directory will be used daily for a long time. Until today.

I cunningly added a "Send To" shortcut to "Send To". Now I can create a shortcut wherever I like, and send it to "Send to" by sending it to "Send To" from the "Send To" menu (right-click -> "Send To" -> "Send To").

The thing is, I can't be bothered to navigate to the "Send To" folder to delete unwanted shortcuts when I've finished with them.

1 December 2005

Installer setup project not registering COM DLLs

I'm current using Visual Studio 2005 beta to create an installer which contains both .NET assemblies and a Delphi COM DLL. Reading the documentation, the DLL can be registered during installation by setting its Register property to vsdrfCOM. Unfortunately, when building the installer, the following warning appears:

Unable to create registration information for file named 'Component.dll'

(As an aside, this should really be an error, as the component isn't registered when the installer runs.) I did what everyone does with an error message, and pasted it into the Google. There were only a few results, some of which were duplicates, and none of which were helpful.

So I did what everyone else does, and randomly tried the other settings: vsdrfCOMSelfReg caused the warning to disappear, but caused errors when the installer ran. So I set it back to vsdrfDoNotRegister, which (clearly) didn't register the DLL after installing it.

So, back to basics. I checked that the DLL would actually register with regsvr32, and it did. The next logical step would be to write a batch file to run regsvr32 on the component as a custom action in the installer. Upon adding a custom action, I found that the only actions that can be added are .exe, .dll, .vbs and .js files. VBScript seemed the easiest, so I wrote a script that called regsvr32 through a shell object:

Dim WshShell
Set WshShell = CreateObject("Wscript.Shell")
WshShell.run "regsvr32 /s Component.dll"
Set WshShell = nothing

and added this to the Install section of the of the custom actions. I did the reverse (using the /u regsvr32 flag) and added this to the Uninstall section. This works, but the .vbs files are deployed with the application. It's a bit messy, but it's the first thing that works. Ideally, Visual Studio would understand the DLL, and maybe it does it the RTM version.