December 2002

Picky Picky Game: Tidying up the Python code

Having got the first working version of the Picky Picky Game, I have naturally now pulled it apart again. I decided that now it is in a state where it makes sense to try to package up a version for Adrian to try installing, I better think about getting the module and package names right, since it will be harder to change them later.

I have reorganized my Python classes in to their own package pdc (designed to prevent name collisions with WWW-oriented packages by other people). I also changed some of the file names—so that ‘import httputils’ becomes ‘from pdc import www’.

There is now a proper unit-test suite for the www module (which has functions like urlDecode, urlResolve, and xmlencode). This is easier to do for this odule than the others, which tend to involve creating scads of HTML text which will be hard to check for errors. For the URL-manipulating functions, the unit tests turned out to be invaluable—there are a lot of corner cases that I only sorted out because I had tests for all of them.

RSS changes

Up until today my RSS feed has had one link per day, even though there might be extra (supplementary) articles on that day. If you look at the HTML page, the first article of the day gets the big heading with the date and suchlike, and the subsequent articlettes get smaller headings. Up until now the smaller articles were omitted from the RSS.

I have now tweaked the program that generates it so that these smaller headings also get links in the RSS data. At the moment they link to their parent item; this will change once I add HTML anchors to the headings so that they can link direct to those. Sorry for any inconvenience.

RSS feed broken today, sorry

Last night I hacked the code that generates the archive web pages for my weblog (or whatever it is this site is) so that the headings of the supplementary articles also have link anchors. In the process I broke my RSS feed slightly—it got confused by the id tags. (while remaining technically valid according to the RSS validator). This has now been fixed, so that (a) all articles have an HTML link target and (b) all articles are linked to from the RSS feed.

Small objects of desire

I’have had a Palm 3 for some time (creaky old 2-MB model). I used to say that when I upgraded it, I wanted that to be next upgrade for my phone, as well. That product now exists in the form of the Handspring Treo, a compact palmtop with a phone built in, and Jo has one. Sadly Handspring don’t consider Grafitti an asset in a device aimed at non-Palm-users, so the 180g has already been air-brushed out of history in favour of its keyboard-sporting cousin. The problem is the Treo does cost rather a lot more than, say, Adrian’s entry-level Sony Clié, which is similarly compact and has a high-res screen. I really don’t know which I would prefer as the successor to my clunky old Palm 3.

Actually the fact is I don’t need to replace my disfunctional old Palm 3; I frankly don’t use very much, not the way Jo and Jeremy use theirs. Its main failing is not its memory size but its size—justa little bit bigger than pocket sized (unlike both the Clié and the Treo). I have admitedly upgraded my Alcatel Max DB phone (the same model that caused mpt so much confusion) for its smaller successor the 311, but that is still one of Virgin’s cheapest handsets and I only rarely use the thing. I have absolutely no need to upgrade either of them. Annoyingly.

PPG: Testing time

Spent another dollop of time on the Picky Picky Game, moving code in to my www module. This is a slow process because I have decided that this module is going to have a complete set of unit tests ( Writing tests after the fact can be a little depressing—it keeps digging up bugs (i.e., mistakes) you made when writing the function in the first place. The Extreme Programming gurus say this is why writing the tests first is psychologically important (as well as being important to their methodology) because you end the day successfully passing tests that failed earlier in the day, rather than not depressingly writing tests that either never get triggered or which show up flaws in your precious code.

Anyway, the upshot of today’s not particularly intensive work is that it does more or less what it did last week, but is maybe a bit more reliable than it was before.

Picky Picky Game: Refactoring the CGI scripts

In the process of getting the CGI scripts to work again after reorganizing the libraries, I have further refactored them my moving the request-processing code in to the Picky Picky Game library, leaving the CGI script to contain just a few configuration parameters and an invocation of the library routine. This style is not unlike that used by Joe Gregorio in his Well-Formed Web experiment.

There are various advantages to moving most of the code out of the CGIs themsevles—better information hiding, for example (which can be considered a security feature as well as good programming practice). It also allows the bulk of the code to be stored in byte-compiled form on disc, which might make processing requests a little faster.

Picky Picky Game release 0.1

I have created an experimental, pre-alpha, test-of-concept, categorically not finished or complete package that is a snapshot of the Picky Picky Game development so far (picky-0.1.tgz, An enthusiastic web master with a Python-compatible server should be able to install this and make it go. What’s more, if this version can be installed, then future versions should also be installable (since I don’t intend to require any additional features). But don’t hold me to that... Your mileage may vary.

There is one important unresolved issue, the ‘EAGAIN’ problem, which I decided to put to one side for now. I hope to use this snapshot to test the problem in different environments.

Let’s all do H. G. Wells!

For some reason there are a lot of comic-book adaptations of H.  G. Well’s War of the World:

Alan Moore and Kevin O’Neill, League of Extraordinary Gentlemen II
A retelling of Wells’s story in a Victorian-era world where every fantasy tale (set on Mars or otherwise) is true simultaneously. Incredibly baroque tripods.
Ian Edginton and D’Israeli D’Emon D’raftsman, ‘Scarlet Traces’, Judge Dredd Megazine issues 4.16 to 4.18 (September to November 2002).
Set a decade after the War of the Worlds, London has been rebuilt with Martian technology. The resulting hybrid tech has to be seen to be believed. The web site linked to above has all the DVD-style extras, including production sketches, deleted scenes, and making-of documentary. Since the strip was originally produced for on-line presentation, some of the cut scenes are animated!
Alan Davis and Mark Farmer, Killraven
The set-up is once again a decade or so after the Martian invasion, except this time the Martians won and humanity has been reduced to scavenging in the ruins and performing in the gladiator pits. Cue an escape of scantily-clad gladiator slaves. Some message-boards state this is a revival of an old Marvel character (and the name does sound familiar), but I cannot find an official Alan Davis, Mark Farmer, or Killraven web-site to link to.

I have a nagging feeling that there was another one I was going to put in this list, but if so its name escapes me for the moment... :-)

Consignia stole my Christmas

Yesterday (the 23rd) we made a point of waiting for the post to arrive before going in to work, but to no avail. When we returned home we found yet another of those cards telling us a parcel was waiting for us at the depot in Sandy Lane West. Since I was taking a day’s holiday on Christmas Eve, I set off to pick up the parcel.

Cycling to the depot would be straightforward enough if it had occurred to anyone to add a few directional signs along the route. You start by cycling up Cowley Road past Temple Cowley. This is a steeper climb than I remembered, and I soon got very hot. The intersection at Temple Cowley is a little intimidating—in order to get to the off-road cycle lane you have to move in to the middle lane (since the left lane is left-turn-only). The off-road path takes you to the Ring Road roundabout, and crossing the road on foot takes you to the cycle+dog path that parallels the Ring Road. This is an ideal shared cycle path: broad, flat, and only sparsely populated with pedestrians. The first left would be Tesco’s megamart. Skipping that you come to a confusing dip-under-the-road junction with something labelled Barns Road. You need to go up on to this main road and thereby cross the Ring Road. Another off-road cycle path now appears, but ignore it; it is leading you away from a mini-roundabout which you want to use to turn right on to Sandy Lane West. The home stretch! The trick here is to not look out for the Royal Mail Consignia sign, because all you will find at the Reception window there is a hand-written sign telling you to go back two places to the Nuffield Industrial Estate. Once you go down there the Enquiries office is reasonably well signposted. Annoyingly there is nowhere to park a bicycle. (This is Oxford, after all!)

Even more annoyingly, there was also a piece of paper in the window saying they were closing the office an hour an a half early today. So the journey was all for nothing.

Could they have prevented this? Yes, by telling me the modified office hours on the card they stuck through my letter box. This card is completely generic, probably printed in the millions at some central printers. Too bad they don’t produce a local version for each Post Town so they can have the address printed on them (we have received these cards with no address on at all in the past). Too bad they don’t have a special Xmas Season version of the card giving their reduced opening times. Given that December must account for a disproportionately large fraction of displaced domestic parcels (as opposed to parcels for business addresses), this would seem a logical measure to me.

On the other hand, is it worth fucking over people like me for the sake of a measly hour and a half extra holiday? Surely that office needs at most two people present (one customer-facing, one fetching parcels), so paying them enormous overtime would not break the bank, right?