Wednesday, 14 October 2009

Software as an Enabler

Over my long, somewhat protracted software development career, I have come across many situations of what I like to call "software as a disabler". Situations in which the software seems to work against the end user using arbitrary constraints or limitations that, to the developer, make perfect technical sense. This phenomenon is perfectly summerised by Little Britain's famous catchphrase "Computer says no".

How many times have you used software that just wouldn't quite let you do what you want to do? A lot, I would wager. Problems such as these often occur due to over-ambitious implementation of requirements, usually at a very technical level. Consider a simple calendar application for scheduling meetings. It makes logical sense that users would not want to be double booked, so a naive developer may put in a constraint that prevents such a situation from occurring.

The hapless end user comes to the software. They have a meeting scheduled with a client on Thursday between 2pm and 3pm. Another meeting opportunity then comes up with another client that can only be between 2:30pm and 3:30pm on the same Thursday. Clearly there is an overlap, and the user would be double booked during that time. The user attempts to enter that meeting, and the system refuses. No matter what the user does, they cannot enter two meetings that have conflicting time slots. The developer has "helped" the user by preventing the situation from occurring.

The end user now has a problem. He knows three facts:
  • He has a meeting between 2pm and 3pm that he cannot reschedule right now
  • He has a meeting between 2:30pm and 3:30pm that he cannot reschedule right now
  • The system won't let him do this, even though he is capable of fixing the problem if he were just allowed to
What often happens in situations like this is that the end user is forced to work around the software. Maybe he sets the meeting to run from 3pm to 3:30pm, and makes a note that it should really be 2:30pm. Maybe he arbitrarily deletes the old meeting and has to make a note elsewhere to contact the first client. Anything he does at this point would be purely for the sake of the system, and not help his real situation in any way. He cannot cancel either one of them at the time because it requires speaking to each of the clients, so he just wants to get the info there and have the time conflict visible. He just wants to put his data into the system the way he wants to. But the computer says no.

The right way for the developer to handle this would be to simply allow it, and have the user interface reflect the double booking. Maybe it would just show a message before adding the data. Maybe it could show the two events occurring side by side (Outlook does this), or it might show the overlap period in a highlighted colour to indicate that a conflict occurs. Anything, in fact, that lets the end user input the data he wants to and see it again later.

This is software as a disabler. Software that projects the developer's assumptions about the "right" way to use the software and forces the end user to conform. Sometimes this is necessary. For example, highly sensitive banking systems or insurance systems might need to put a stop to invalid situations before they occur. Even then there needs to be a system to handle the possibility that the real world might not represent the ideal held inside the computer. This is what software as an enabler is all about. Enabling the user to reconcile reality with what's stored inside the system.

So next time you're building an interface to a system, and you come across a constraint that you think would make sense to protect the end user from themselves, stop and think. Would your change actually provide any solid benefit, or would it just be there to make your life easier by ignoring the possibility that reality is not as perfect as your system requires?

It is a lot more work to allow invalid data to be entered and reconciled, but in the end, that's what the system is for. If the user has to perform all reconciliation work before entering the data in the first place, then your system will be viewed by your users as a waste of time. It would just be an extra step of manual labour to get the data into storage, with no added benefit. It has failed to provide the user with an efficient, possibly automated way to achieve a goal. And if your software is preventing users achieving their goals, it will be consigned to the Recycle Bin.

Monday, 12 October 2009

Hints for X11 on Mac OS X

One of the lovely features of Mac OS X, being based on Unix technology, is that it's possible to run X11 based applications with an almost native look and feel. Unfortunately this doesn't translate completely due to the way the X11 server is implemented. It is a single app, and all X11 windows are considered children of it, so the OS X window manager treats all X11 windows as a large group. This does mean, however, that those of us used to working with X11 apps in a different way to OS X native apps can do so, as long as you don't mind the slight mismatch of behaviour.

One of the first things folk notice about the OS X window manager for X11, quartzwm, is that the mouse focus model is completely unintuitive. Focussing a window requires clicking within it, but then activating controls requires another click. You can't just move the mouse over to a window and click, and expect anything to happen. This is usually resolved in one of two ways; turning on "focus follows mouse", or enabling "click through" to allow the window to respond to the focussing click as if it were already focussed.

When I'm using a linux window manager, I am happy working in either of these modes. For Gnome, I like to have click-to-focus, and for more lightweight WMs like Fluxbox, I prefer focus-follows-mouse. Fortunately, enabling either of these options for quartzwm (for Snow Leopard, anyway) is as simple as opening the preferences pane and clicking a checkbox. For OS X, I find that click-to-focus matches the rest of the OS best, so I enable click-throughs.

When using X11 on OS X, it is usually to use the Gimp. This is bundled as a self-contained application, and will launch the X11 server on demand. Of course, all the Gimp's windows are still considered a part of the X11 app, but the Gimp dock icon responds to drag-and-drop and other OS X features. It's a bit weird, but easy to get used to.

Enabling click-through makes working with the Gimp a lot more fluid. The multi-window interface is a pain to work with otherwise, because even something as simple as changing which tool you're using requires clicking the toolbox window, then clicking again to select the tool. It is very frustrating to click a tool and then try to use it, only to realise that a) the tool never got selected, because the WM swallowed the click before the Gimp could respond, and b) the tool window is now focussed, so trying to use the tool on the image will not work until you refocus it with yet another click.

For those of you who don't like using nasty, icky GUIs for something like changing WM preferences (why are you using OS X again?) there is a command line way to do it. In a terminal (or Xterm if you're so inclined), type one of the following to enable focus-follows-mouse (ffm) or click-throughs:
defaults write org.x.X11 wm_ffm -bool true
defaults write org.x.X11 wm_click_through -bool true
Another useful feature built into quartzwm is the ability to shut down the X server automatically when no windows are left. For those of use who only use the occassional X11 program, and are somewhat obsessive about not leaving programs running in the Dock that aren't actually in use, this is very useful indeed. To enable it, enter the following command into a terminal:
defaults write org.x.X11 wm_auto_quit -bool true
A secondary option allows you to specify a short timeout, in which the WM will wait for a few seconds to see if you start any more windows. If you do, quartzwm doesn't shut down and continues until all windows really have gone. It is very important to use this option if you use the Gimp. With a 0 second timeout, the X11 server will close as soon as the Gimp splash screen disappears, because it takes a moment for the main image window to appear. This fraction of a second delay is enough to make the X11 server disappear and take the Gimp with it, making it impossible to start up. I would recommend a 5 second timeout to make sure that all windows really are closed, and more importantly, no more are on the way before shutting down the X11 server.

To enable this feature, enter this command in the terminal:
defaults write org.x.X11 wm_auto_quit_timeout -int 5

Note that all this options are available in earlier versions of Mac OS X than Snow Leopard. For Leopard users, they are identical. For Tiger users, replace all references to org.x.x11 with This is because versions of OS X prior to Leopard used the now mostly defunct XFree86, while Leopard and Snow Leopard have moved to the much sexier

Wednesday, 7 October 2009

NAS Replacement Tat

I have purchased a couple of bits to replace the now defunct Iomega NAS that once graced the shelf next to my battered Compaq laptop and somewhat eccentric router. This should hopefully allow me to rescue and reuse the 500GB SATA drive, while I cheerfully throw the NAS enclosure out of the nearest sixth floor window.

This is the caddy:

This is the interface card:

Hot from Hong Kong, don't you know. They should arrive sometime within the next 5 to 28 days. About right for Parcel Force. I've had my fill of £100+ drive enclosures. This little lot set me back a grand total of 16 quid, including international postage.

Of ActiveX, and service packs, and firewalls, and things ...

I have recently had cause to reinstall a Windows XP Pro machine after a serious virus infection. Not a big job, really. I'm sure I could go on about how installing $linux_distribution only takes 20 minutes, but all in I reckon a full XP Pro install, including drivers, should only take about an hour.

Or so I thought. What actually happened was a comedy of errors lasting almost 20 hours filled with grief, annoyance, frustration and a large amount of tea. The basic installation worked fine, the drivers all went on perfectly, and even the PCI wireless card was no problem. All was looking well, until I tried to update to the latest service pack.

Upon launching the Windows Update site, I was presented with the usual "checking version" message that precedes every scan for updates. So far so good, but a couple of minutes later it all went badly wrong. Rather than the nice list of service packs and hotfixes I was expecting, all I got was an error message: 0x8DDD0004. Nice and cryptic.

A quick google for this error indicates that there are quite a few KB articles about it. The problems that cause it range from a wrongly installed service to bad registry entries, missing ActiveX controls to invalid root CA certificates. I tried them all. Twice. I reinstalled the entire machine. Twice. I manually upgraded to the next service pack through wails and gnashing of teeth, and I even got hold of a streamlined install CD with SP3 already on it to see if it made an ounce of difference.

Nothing. Still the same error, 0x8DDD0004.

So I start digging on my own. Clearly the knowledge base articles cover a great many causes for this problem, but not the one I am seeing. During this digging, I discovered a nasty little problem that had been plaguing me. One of the DIMMs was bad, so half the memory didn't work. Removing that actually sped up the machine and made the rather irritating lock-ups go away. Having sorted that, looking at the Windows Update log gave me a different error code, related to it failing to download a file named Another avenue of investigation!

Once again deep in the Microsoft knowledge base, I found another five articles explaining the new error code. Some of the fixes were the same as previous ones I'd found, and some were new. Again, I tried them all to no avail. At this point, I was fed up, and it occurred to me to check that the Windows Update service was working at all. I couldn't find any service affecting issues listed on the MS KnowledgeBase, but I did have a second Windows XP virtual machine that had previous installed updates without a hitch. I gave it at try.

Aha! Exactly the same error. So the problem, it turns out, wasn't with the other machine. Well, apart from the bad memory module and the multitude of viruses. Still, the problem was reproducible. An excellent start in any debugging exercise. I also now had the full URL of the file that was failing to download, so out of interest I tried downloading it directly from my browser on a variety of other machines. They all failed, Windows, Linux and Mac OS alike, in exactly the same way. Headers received, timeout waiting for content.

It then occurred to me to check if the URL was the problem, or if there were other network conditions causing the problem to manifest only for me. I had a poke around, got on another machine not connected to my home internet connection, and tried to access the URL. It worked. A good thing, I suppose, because it means that once I figure the problem, the service is up. A bad thing because it means that the problem is still mine to fix.

Armed with the knowledge that the service was at least responding, I figured the problem had to be somewhere between my router and Microsoft's server. Not the greatest leap of intuition, admittedly, but I was very tired by this point and not firing on all, if any, cylinders. I checked the router log.
CP Packet - Source:1xx.1xx.1xx.2xx,60349 Destination:2xx.4xx.1xx.9xx,80 - [Firewall Log-Filter ActiveX]
I looked at it, then looked at it again.
CP Packet - Source:1xx.1xx.1xx.2xx,60349 Destination:2xx.4xx.1xx.9xx,80 - [Firewall Log-Filter ActiveX]

How and why was my router filtering ActiveX? I checked the firewall settings, and sure enough, there it was. Filter ActiveX, ticked and dropping packets like nobody's business. I unchecked it, saved the configuration, and tried the URL again. It worked like a charm. I sank back in my seat, closed my eyes and muttered a number of exotic curses under my breath.

So the root of this entire issue was that my router was dropping any and all packets deemed to have a payload of an ActiveX control. I don't remember ever turning that on. Why would I? I very rarely use Windows machines on my network, and when I do I'm likely to just be installing them for someone else. Having working ActiveX would be something of a necessity. In fact, my Windows VM ran successful updates only a couple of months ago.

The only thing I can think is that either:
  1. I was reconfiguring my firewall while drunk, or
  2. Something had happened to the router to make it turn that option on
A couple of weeks ago, the router did get overheated after being put in close proximity to an Iomega NAS (which you may remember from previous rantings, and is thankfully now deceased). After that, I had to fiddle with some settings to get my ADSL and WiFi connections working again. I can only assume that, either by accident or design, this fritzing of the router caused the firewall settings to be modified. As far as I know the ActiveX blocker isn't on by default, so it must have been switched on post-install.

So if you're having problems with Windows Update, and nobody else can help, and if you can find it, maybe you will find that the fault has nothing to do with Windows after all. Granted, it usually does, but on this one rare occassion, it was something else entirely.

Of course, if Microsoft didn't use ActiveX to push updates at all, this problem wouldn't have existed. ActiveX is a known security risk. So well known that router manufacturers put special firewall rules into their consumer products specifically to block it. In the end, this whole fisaco essentially boiled down to an overzealous firewall and a lot of wasted time.

Where does the blame lie? Nowhere really. Microsoft's update service was working properly the whole time, and the router (after being subject to some hardware abuse) was just doing what it thought I had told it to do. And I, having never specifically configured content filtering in the firewall, went through all this to find that toggling a single checkbox fixed the whole issue.

Computers, eh? Can't work with 'em, can't work without 'em.

Monday, 5 October 2009

Sheffield CAMRA 35th Steel City Beer Festival!

The first weekend of October has rolled around, so once again it is time for the Sheffield CAMRA Steel City Beer Festival. Now in its 35th year, the festival has seen a lot of change in the recent past. After the terrifying ordeal that was the Darnall Liberal Club, standing out in a field with beer seems like a much nicer proposition. Unfortunately, reviews of the 34th festival were tainted with dissatisfaction, both with the venue and the organisation as a whole.

I didn't attend last year, but I attended this year with some trepidation. Thankfully, the whole event was better run than I had been led to believe, but not without its fair share of hiccups. Two marquees provided more indoor space, the place didn't smell like a donkey sanctuary, and the beer tasted great. There were around a hundred beers to try, and thirty ciders, so even more than some previous years.

After a couple of false starts, our little troop of merry drinkers (myself, Emma and Chris) finally arrived at the gates of the festival around 8pm. A very strange 15 minute wait in a queue of 10 people then followed. It seems that the people handing out glasses and tokens weren't coping well, which was odd since actually getting aforementioned items took seconds once we finally were allowed into the marquee. Annoyingly, my CAMRA membership only went as far as a single extra token, so, almost half a pint. Disappointing.

First impressions were of puzzlement and a little of dismay. After being wowed by the Oakwood festival earlier in the year, the presentation of the Sheffield festival left something to be desired. The glasses were actually plastic, although still stamped with the festival logo, and the programme didn't actually include any beer; just cider. The beer was on a little printed slip of paper inserted into the programme, and had little or no room for ticking.

Just to add confusion into the mix, gone was the usual token system, where you pay for beers with "token + extra", whether that extra be 10p, 20p, or even money back on some brews. Instead, tokens had two possible values, £1 or 10p, and you had to make up the value using these. Makes sense in some ways, but still managed to confuse us for a little while.

Still, we were there, and there was beer to be had. I somehow managed to end up designated "beer chooser" for the evening, so I lined up a few nice starters. I had a half of Abbeydale Absolution, a familiar taste to sip while perusing the rest of the available brews. Emma had a Spalt IPA from Acorn brewery and Chris had a Ginger Daze from The Brew Company. All were thoroughly enjoyed, and everyone had a taster of the others to ensure a fair and even experience.

Time, then, for a few more beers, including Brewdog's dangerously drinkable 7.1% ale Chaos Theory, Allgates' Porteresque (a very aptly named beer) and Brass Monkey's Tamarind Mild. All the beers were excellent and went down a treat. Unfortunately, I did my usual trick and managed to carefully note every beer tried ... then lose my copy of the programme. Thankfully a replacement copy and a reasonable memory for beer provided a workable solution!

We met up with a few of my colleagues at this point, and shared opinions of the festival and the beers. Got an excellent recommendation for The Brew Company's Raisin To Live, a lovely 7% raisin stout brewed especially for the festival. Also on the recommendations list was the Proper Pasty Co's sausage rolls and scotch eggs. I tried a new delicacy ... A scotch egg made with black pudding instead of sausage meat. Delicious! Emma and Chris chickened out and had boring old sausage rolls.

One of the trips to the bar resulted in Emma ending up with possibly the worst smelling beer I've ever experienced. It was, apparently, a lemon beer, but it smelled like a cow had already eaten and passed the lemon. After trying to trick someone else into drinking it without success, another of my colleagues happened by. He'd tried the "Power Hour", in which you drink the 6 strongest beers at the festival (7.5% to 12%) in one hour. He was steaming, and drank the awful concoction with the single comment "mmm, it's lovely." Suffice to say, a lesson in always sampling ales that aren't on the official list was learned!

A trip to the toilets, then, and just about the only reason to go outside. There were further food stalls, including a German sausage grill like those on Fargate during the continental markets, and "Stuff in Oatcakes", the van that provides butties for Emma at work. I passed on all that, preferring to stay with my beer. The toilets were standard festival fair, portaloos with no lights in. Thankfully they were at least clean! Somebody had put up a sign on the fence: "Toilet Out Of Order". Whether this was a deliberate joke or not, it made my drunken self chortle.

Once we'd put away a fair few of the beers, we decided to give the cider stall a try. This always marks a descent into madness, and this time was no exception. After acquiring a Hucknall dry cider from Nottingham for myself, and a Hunt medium sweet cider from Devon for Emma, we sat in the patio furniture provided for our comfort.

A couple of lads sat near us pointed out the hilarity that could be had with the broken chairs that would recline all the way back when pushed. Of course, we just had to have a go (well, Emma didn't, but we of the dafter sex did). It was during this little escapade that Chris decided to push my feet up and I performed what I hope was a graceful backward roll off the chair, under the edge of the marque, and ended up upside-down, halfway outside. Sadly, I fear that "graceful" was not the word, and "ridiculous" may in fact have been more fitting.

At this point we decided that it was probably time to head home. Of course, one major contributing factor to this was time being called, so a hurried round was got in first. I got a full pint of Raisin To Live, and Emma got an Erdinger. Unfortunately they'd run out of Weissbier, so I ended up fetching a Pikante instead. Apparently it's not nearly as good as the usual Weissbier. Ah well.

It was a fun evening, overall. Had some good beer, some good laughs, and a good time was had by all. I drank much less than previous years, it seems, but that just meant I could walk home in relative sobriety after a nice evening and still appreciate the taste of the beers I was trying. Hopefully my reconstructed-from-memory programme provided accurate information for this post! Looking forward to see what happens next year, and this year will have a positive tick by it, in spite of the issues.