Archive for 2005

If this did happen…

Posted at 7:06am on Monday, December 5th, 2005 by

What would happen to all the 16 year old nicotine addicts?

Tags:

| Comments Off

Ligature

Posted at 8:04am on Sunday, December 4th, 2005 by

Lots of people have been linking to the rather marvellous site riffing on chat speak as typographic ligatures. And then of course there’s real ones as well.

Tags:

| Comments Off

Next year’s books

Posted at 7:50am on Sunday, December 4th, 2005 by

bookmunch is drooling over next year’s catalogue. Among the things to look forward to is confirmation of the new Coupland that we got wind of earlier this year, DBC Pierre’s follow up to Vernon God Little and Michael Chabon’s first full novel since the amazing Kavalier and Clay. Among the things to fear and avoid is donkey boy Nick McDonnell’s follow up to the atrocious Twelve.

Tags:

| Comments Off

Warning!

Posted at 7:29am on Sunday, December 4th, 2005 by

Warning.

Tags:

| Comments Off

Open Source

Posted at 3:29pm on Friday, December 2nd, 2005 by

While most people are keeping it under wraps some people are proud of their OSS implementations.

Tags:

| Comments Off

Ashes 2006 warm up matches: Round 1 – Pakistan

Posted at 7:36am on Saturday, November 26th, 2005 by

England haven’t lost a series since Sri Lanka in 2003 (almost exactly 2 years ago). Now they’re going to Lahore missing Strauss and Jones and with Giles in need of surgery. Suddenly we’ve got an inexperienced middle order, are unsure as to our best bowling attack and are one nil down with one to play in a difficult tour location playing a team that are playing well above their game (at least on recent form). Looks like that unbeaten run may be about to end.

This is made all the worse by the fact that our next stop on this Ashes warm up run is India, followed by Sri Lanka and Pakistan back in England. Suddenly it’s not looking so easy, particularly if key players keep being either injured or out of form.

Contrast that with the Australians. The introduction of Hussey (one of their finest batsmen and inexplicably ignored for the Ashes). The re-introduction of Symonds (Watson can say what he likes about being the Australian Flintoff, but we all know that Symonds has that honour if he can only stay off the sauce before matches).

Combine these very wise team changes with an uncompetitive series at home against the Windies and (bar the South Africans) a dolly run up to the Ashes and you get the strong feeling that the Aussies will be entering the next Ashes rebuilt and reinvigorated and probably without a loss to their name.

We however, if current form is anything to go by, may well have suffered some hard losses and are likely to have been reminded that we are only world beaters when the best 11 aren’t injured and are firing. It’s a pessimistic view and I hope it’s wrong, but unless Jimmy Anderson finds form (and actually gets to play a match or two) and Cook and others are tested (and found out) quickly there’s a horrible possibility that we’ll look more like the 2002/3 tourists than the 2005 victors.

Tags:

| Comments Off

Beer goggle explained

Posted at 3:34pm on Friday, November 25th, 2005 by

No, seriously – they’ve worked it out and everything. Now all I need is someone to work on the reliability of the beer scooter and my Friday nights are all but explained….

Tags:

| Comments Off

I, Cringely

Posted at 6:46am on Wednesday, November 23rd, 2005 by

Robert X. Cringely is on a real roll at the moment. The last 3 weeks’ columns are all well worth a read…

Nov. 3: It’s Deja Vu All Over Again

Nov. 10: Paper War

Nov. 17: Google-Mart

Tags:

| Comments Off

BeautifulSoup

Posted at 4:56pm on Tuesday, November 22nd, 2005 by

So then. The first of an ever increasing number of technical posts I fear… Having chucked in the world of Microsoft Office and mobile telephones for the more edifying (if rather brain melting) world of vim, python, zope and plone I am a) going to have less time to browse cack on the web and b) have considerably more of my brain consumed by technical issues, so it is a fair risk that offmessage will slowly turn into yet another python blog. Sorry about that.

Anyway, new job = new projects and the first was a real stinker. Taking a web site with some 16,000 pages all written in old school non-semantic, non CSS, non XHTML, tables-for-layout based HTML and migrating the content to sexy new fully CSS/XHTML compliant pages. Yeah. Nice. What a start. Particularly as I’ve never actually written python in anger before; a couple of CherryPy test sites and some scripts for stuff inside Plone, but nothing of any size or scale.

Luckily there is a thing called BeautifulSoup that is designed specifically to cope with poorly formed HTML and allow you to grab the content, regardless of the quality, as long as you can find some rule to traverse the mess. Very powerful, very robust and very clever (and with some very nice class names if that’s your cup of tea…)

Two gotchas I’ve found so far… Although a tag object has attributes in the form of dictionary keys they do not support the .has_key() method, so:

>>> from BeautifulSoup import BeautifulSoup
>>> foo = '<a href="thingy.html">linky linky</a>'
>>> bar = BeautifulSoup(foo)
>>> print bar.a['href']
thingy.html
>>> print bar.a.has_key('href')
Null

Took me a fair old while to work that one out, I can say… Patch for BeautifulSoup.py here if you so desire. It doesn’t handle the 'href' in bar.a scenario, but it does provide .has_key() and stop you resorting to KeyError exceptions or any other hacks

The second one is simpler to identify what’s going on, although I don’t have a patch for it (the work-arounds are too easy). In certain instances when it comes across & it will automatically convert the following text into an HTML special character (so in my example R&D turned into R&D;). I couldn’t work out exactly which cases caused this to happen, but it appears to be somewhere around assignment of a string to Tag.string.

Tags:

| Comments Off

You’ve got to admire his presence of mind

Posted at 7:42am on Tuesday, November 22nd, 2005 by

Pakistani all-rounder Shahid Afridi has been banned for one test and two ODIs for scuffing the pitch during the interruption caused by an explosion at the ground during England’s innings.

Everyone else was standing around worrying and trying to find out what had happened. Afridi however? He was busy doing a pirouette on a length to try and break up the surface. Like I said, you’ve got to admire his presence of mind.

Tags:

| Comments Off