Mysterious IIS errors lead to Skype

Monday 30th June, 2008

IIS has been throwing some incomprehensible error codes at me recently: “Unexpected error 0x8ffe2740 occurred”. A quick search discovered that this happens when another service is running on port 80… something that really should not be “unexpected” and should have resulted in a more helpful error message.

Looking through the list of active ports using TCPView came up with nothing, so I returned to searching for people with similar problems, when I came across this gem.

Apparently someone at Skype decided that their client software should lock up port 80 if it’s not being used at start-up. This means anyone who starts IIS after they start Skype will get an error message.

Poor show from both Skype and Microsoft.

Politicians should be paid peanuts

Friday 27th June, 2008

The reliably interesting Simon Wardley wrote yesterday about his frustrations at mis-use of anti-terror powers, as well as the hypocritical behaviour by MPs, trying to award themselves 40% pay rises while asking everyone else to show restraint in the face of inflation.

I totally agree, and propose a solution. I propose that MP salaries should be reduced to the minimum wage, and have their finances made entirely public (as in published, in real time).

Sounds a bit extreme, doesn’t it. Hear me out though. I think it makes sense.

My hypothesis is that the effect of this would be to reduce the number of career politians. Career politians are afraid to disobey the party whips, or admit mistakes, since only a career of mediocrity is a safe bet. There are some exceptions (I’m in no way affiliated and have only voted Lib Dem once) but I’d be happy to make charitable donations to support the ones I choose.

My hope would be that the decrease in career politicians would be balanced out by an increase the number of politians who come to the field from successful careers in other disciplines… head teachers, scientists, doctors, soldiers, engineers, and leaders from business.

I think that would be a Parliament to be proud of.

The Internet Makes Us Faster

Thursday 26th June, 2008

There’s a lot of discussion at the moment as to whether the Internet makes us (more) stupid… or to be less sensationalist, whether our brains are adapting to fit new behaviours enabled by new technology, such as Google and Wikipedia.

I’ve certainly noticed my tolerance for reading long passages of text has decreased while I’ve been a regular internet user. I’ve also noticed that I can increase it again by changing my behaviour. If I spend less time online and more time reading books for example, the effect goes away.

I notice the inverse effect when observing people using websites. Obsessive web-heads skim read, only paying attention to functional elements and labels such as buttons, tabs, etc. When reading online, they tend to skip to bullet points, quotes, bold text, or specific words that they’re looking for. Less frequent web users can behave quite differently, reading the page from the start like a book.

This is all anecdotal so doesn’t prove anything, but it indicates to me that because we’re used to reading pages with plenty of irrelevent or redundant copy, we’ve taught our eyes to find what we need more quickly… just like we taught our eyes not to see banners adverts. When we go back to books, we just have to learn to relax that aggressive visual culling of copy and let the words flow more linearly.

It’ll be interesting to see whether other effects develop over the next few years due to the availability of new high-bandwidth content, social tools, and location-driven mobile services.

Outlook Team, Be Ashamed

Monday 23rd June, 2008

I’ve just spent 5 minutes (Update: And another 10 minutes the next day) trying in vain to tell my copy of Microsoft Outlook not to “correct” my spelling to US spellings. It keeps switching the language back to US English and ignoring my explicit instruction to leave my spelling alone.

Bizarre language behaviour in Outlook

What’s more, this PC is set to GMT, International English, and UK keyboard layout. Why would it think I wanted USian spellings?

Language settings set to UK only

Sadly this is representative of my experience using Outlook.

If any of the Outlook development team fancy popping out from behind the brick wall I’ve been banging my head against, please do. I’ve got some constructive feedback for you.

Making QA easier with Selenium

Friday 13th June, 2008

Earlier this week I wrote a summary of a few ways you can automate and test your Javascript, including the use of the Selenium platform by OpenQA. I say platform because there are several very different ways you can use the Selenium family of programs. In this post I’ll expand on the ones I’ve used.

Developer and Regression Testing

Lets face it, testing *that* screen for the 14th time in a row can get pretty tedious, especially if you have to start from a fresh session and go through half a dozen screens on the way there.

That’s where Selenium IDE comes in. SIDE is a Firefox extention that saves you time by allowing you to record a test once in your browser, and save it. You can then replay that test whenever you like, sitting back while Firefox speeds through your test for you. You can also build assertions into your test so that specific conditions will make it fail.

If you build up a library of tests you can run them all as a batch, while you get on with something else.

Continuous Integration Testing

SIDE is great for when you’ve got a developer or tester sitting in front of a browser, but what about automated tests? In a Continuous Integration environment, checking new code into source control triggers a automated build to happen, usually with associated unit tests. That’s all great for classes and modules that suit unit testing, but what about higher-level testing?

That’s where Selenium RC comes in. RC stands for Remote Control, which makes sense when you understand what it does. Selemium RC is a collection of APIs for most popular programming languages that allows your code to control an actual instance of a browser (it supports Safari, IE and Firefox) and run tests against it.

You can set up a build script that runs through your library of regression tests and reports the results back to you. This means that once you’ve recorded a few different runs through one of your website processes, you can then have those tests run automatically whenever someone checks code into source control.

Automating Javascript Testing

Tuesday 10th June, 2008

If you’re putting together a software application you probably want to think about setting up build environment, and applications that use a lot of Javascript are no different. A little time invested will probably save headaches down the line. Being able to perform single-click builds of your app is really useful, as explained by Joel Spolsky.

Back in 2005 I started putting together an app (Newsdesk) for Moreover that included what turned about to be about 6000 lines of Javascript. The build environment I came up with wasn’t perfect, and could never remove the need for actual human testing, but it saved an awful lot more work than it took to build. In this article I’ll outline a few ways you can achieve something similar.

Setting up a build

If you’re reading this you should know about encapsulation, the process of restricting outside knowledge of the inner workings of a component. In large systems this is a fundamental “Good Idea”. In compiled systems it’s simple to encapsulate classes and then have them compiled into more monolithic chunks to make them easier to distribute (DLLs, JARs, EXEs, whatever). Usually your IDE/compiler will take care of this for you.

In Javascript a self-disciplined coder can do the same thing. Rather than having one or two large files, you can split your code up into encapsulated components and have them concatenated together into your final files at build-time. This build script can also serve as a platform for code hygene, unit testing, and regression testing.

The core build script

I’d recommend using ANT, (or NANT if you’re using Dot Net). ANT is a flexible, modular, and powerful build program that you can configure to do just about whatever you want. It feels a little strange to write procedural instructions in XML, but once you get over that it’s simple. Using a basic ANT script you can get the latest code from source control, compile it, move it around, rename it, run tests, send an email with the build result to your team, FTP it to your server, or pretty much anything else you can think of.

My build script did roughly this to the Javascript:

  • Iterate the build number and add it to the code’s config file
  • Running unit tests
  • Concatenating code and language files into packages
  • Running code compression on packages (removing comments, whitespace, etc)
  • Generating Javascript code reference

…but you could also include

  • Regression testing
  • Code duplication analysis
  • GZip pre-compression
  • Deploying code to specified server

Build script configuration

If you’re writing a build script you probably ought to think about running it in a couple of modes, because you usually have more than one use case for your build.

Firstly you’re going to want a relatively quick dev build that does quick testing and spits out your compiled code to a local development environment. This might also run some analysis depending on your requirements.

Secondly you might want an occasional analysis build that runs code hygene analysis, runs more in-depth tests, that sort of thing.

Lastly, you might want a deployment build, that retrieves only a specific version (latest, codebase version X, or codebase as of date Z) and outputs a zip or tarball of the compiled codebase ready to be archived and/or copied to servers.

Testing your Javascript

This might seem a bit hard to automate until you discover Rhino. Mozilla’s Rhino engine (in Java) and SpiderMonkey (in C) are invaluable for running Javascript either under a shell or embedded in other applications. Putting Rhino’s JAR file into your classpath allows your build to execute Javascript.

If you want to run JSLint over your source, you can do that. If you want to write your own code analysis tool in JS you can do that too.

This is great for unit testing, but with a UI unit testing can only get you so far. If you want to be a bit more thorough you need regression testing. This can be achieved using Selenium. Selenium is a Javascript-based regression testing engine that allows you to trigger DOM events and test assertions against the resulting DOM. Although this engine is browser-based, you can also call it from code, or ANT, using secondary tools like Selenium RC (Remote Control). There’s also a Firefox plugin that allows you (or your QA team) to build up a library of regression tests that can be run automatically on each build.


I’ve tried not to get into too much detail this time. When I get round to it I might write up areas in more detail. Let me know if you’re interested in something particular.

The Economics of Paper Rounds

Friday 6th June, 2008

When I was a kid I had a paper round. I got up at 6.30, spent around an hour delivering the morning papers on my bike, then went to school.

It kept me fit, gave me unprecedented access to money, and gave me an early lesson in economics.

Paper rounds are not well paid. For the majority of my time as a paperboy I earned £10 per week for six days work. To earn that money I had to deliver papers to roughly 50 houses spread across an urban but hilly area. That works out to about 20p per household per week, or just over 3p per paper.

Some houses had modern, convenient, letterboxes which allow you to get the newspaper in quickly and safely. Others did not. Anyone who’s had a paper delivered through a letterbox that measures 1″ x 6″ knows that papers get torn. Generally the owner asks the newsagent to tell the paperboy to separate out the sections and post them through individually. Anyone who has tried to fit a newspaper full of sections and supplements into a letterbox like that knows that it takes time.

The longer the paperboy spends on a particular paper, the lower the return on time invested. If he delivers 50 papers in just under an hour, that’s roughly 3p per minute, or £1.80 per hour. Depending on the dimensions of paper and letterbox, spending time unpacking the paper and posting sections through carefully can sometimes take around 2 minutes, or more if wind, rain, or cold fingers add complications. Add in the travelling time between houses and that house is paying more like 60p per hour.

Add in the social incentive not to be late for school, and it seems understandable why paperboys sometimes let a paper get mangled rather than spend time “doing it properly”.

Looking at things from the other perspective, households who get a paper in the morning might have to fork out (for the sake of argument) £100 to replace their old letterbox with a larger modern one. Assuming that papers cost 50p, and 10% of the value of the paper is destroyed when the outer layers (usually with more important stories) get mangled by a letterbox, it’d take roughly 6 years to pay back the investment.

Unless the household values a nice clean paper more highly, or has other positive factors pushing them towards replacing their letterbox, going down to the newsagent to complain about yet another paper being torn by a lazy kid seems like the easy option.


Get every new post delivered to your Inbox.