exo : blah

content

Wed, 28 Nov 2007

Like so many yammering baboons

This donations fuss really is beginning to get old very quickly indeed. I am fairly convinced that we have better and more important things to be devoting so much of our public discourse to.

Yes, we should expect a high level of probity from our public officials. We should expect that they follow the both the letter and the spirit of the law. However, I'd like to think that we could also expect better than name calling and the somewhat disingenuous accusations of incompetence. And more to the point we should expect that our politicians rise above cheap points scoring and either agree to sort out the problem with a set of clear, concise and workable laws or get in someone else to do it for them so that we can get back to talking about anything that might actually impact on people outwith politics.

posted at: 20:21 #

Tue, 07 Aug 2007

idiocy considered harmful

Version 0.21 of WebService::HTML::Validator::W3C should be hitting a CPAN mirror near you soonish.

Lets just say that if you're going to use skip and a variable number of tests you have to be careful.

posted at: 21:37 #

Sun, 05 Aug 2007

spurious failures considered harmful

Version 0.20 of WebService::HTML::Validator::W3C should be hitting a CPAN mirror near you soonish.

This release is just a refactoring of the tests to run less of them by default and also to not contact the validator by default. This was partly to stop tests failing if the error messages change and also as it makes the tests run quicker. The old tests that contact the validator can be run by setting an environment variable of TEST_AUTHOR to 1. I'm not sure if this is the best way to do this but it works for me.

There was also a slight internals refactoring to enable the test reorganisation.

posted at: 22:30 #

Sun, 29 Jul 2007

the trouble with cycling

Anyone that reads the news can't fail to have noticed that there's something of an image problem for pro cycling at the moment. Anyone who's a cyclist must by now be familiar with the "you're all on drugs" gags from your friends and workmates. It's a fairly depressing time to be a cyclist and a follower of pro cycling.

You'd have to be mad to deny that doping happens in cycling. It seems to be deeply ingrained in the ranks of the peleton despite the signs this is changing among the younger riders. So, part of the problem for cycling is cultural. But it's a two sided cultural problem. The second side of that is that cycling want to be clean in a way that other sports seem less bothered about -- c.f. Barry Bonds -- and at the moment these two side of the culture are clashing.

Money is partly the root. There is enough money in cycling that there is an incentive to cheat to win but there isn't enough money to be made from cycling by the surrounding circus that a blind eye is turned.

And yes, I am sad and annoyed that this is happening to my sport. I'm not altogether surprised as I recall the bad days of Festina. What I still don't understand is not so much why cycling, but why no other sport? Is it really that there is something about cyclists and cycling that makes then so much more prone to this sort of cheating? I like to think it's partly that cycling has more and better testing than other sports but it's a thin cloth to hide behind.

posted at: 11:45 #

Wed, 13 Jun 2007

favourite command of the day

apt-get install bum

posted at: 22:46 #

Wed, 30 May 2007

rss2mail2 v2.30

Not really anything much new in this other than some updated docs and a few bugfixes.

Under the hood the code's been reorganised quite a bit though which allows me to do better testing and so on. And should hopefully make it a bit easier to add new features.

It's available for download in the usual place.

posted at: 21:48 #

Mon, 28 May 2007

or you could just use a cloth

Every time I have to rattle around for the pliers in order to pull the irksome anti drip plastic widget thing from the mouth of an olive oil bottle prior to recycling I curse the people for whom learning how to pour or to wipe up is so much extra effort that the invention of such a widget was required.

posted at: 21:46 #

Sat, 19 May 2007

in new music we trust

For people who claim to trust in new music Radio 1 seem terribly frightened to play too much of it without someone talking over the top of it.

posted at: 22:30 #

Wed, 02 May 2007

friends reunited

Yesterday I suddenly remembered Friends Reunited. 5 or so years ago that would have been a foolish statement to write. The website was everywhere and seemed to constantly be in the papers. Now, you hear nothing about it and instead the news is all about myspace, bebo, facebook and so on.

Two things strike me about this. The obvious one is that the interwebs are fickle and things come and go.

The second is that Friends Reunited has largely disappeared as it was about reaching back into the past to reconnect and that this is something that isn't useful to the people leaving school and university now. They have no need for a service to reconnect them with their peers. This means that Friends Reunited relies on people who went to school or university before the current rush of social networking sites sprang up and this is a problem.

If you want to get in contact with people you used to know then this is largely a one time operation. Once you're back in contact with them then the tool you used to get back in contact is redundant. And this is the problem that Friends Reunited has -- built in redundancy.

However, in this there is also a hint of the problems likely to beset the current crop of social networks, that of only being relevant while their underlying technology is relevant. In a number of ways all of these sites are fairly conventional in structure. As a user you have a page where you can put stuff and people can look to see information about you. It's all fairly static. Compare this to twitter which is about now and is all about change. Or to dopplr or upcoming which are about the future. In this respect these three sites seem to me to be more in tune with how the web can be used to help people stay in contact and how it will be used by people. And also why while ITV was a bit foolish to blow 120 million GBP on Friends Reunited, News Corp was a lot more ill advised to pay more than twice that for MySpace. In five years the first was obsolete and in less than that it's as likely as not that the latter will be too.

You could also consider Second Life or WoW and their ilk but I like to think they involve too much immersion to ever gain serious traction outside the hard core of geeks and gamers.

posted at: 22:03 #

Fri, 27 Apr 2007

Dear spammers

There appears to be a bug in your mail generation software.

From redacted Thu Feb 22 12:04:09 2007
Return-path: <redacted>
Envelope-to: redacted
Delivery-date: Thu, 22 Feb 2007 12:04:09 +0000
Received: from 192.168.0.%RND_DIGIT (203-219-%DIGSTAT2-%STATDIG.%RND_FROM_DOMAIN [203.219.%DIGSTAT2.%STATDIG]) by mail%SINGSTAT.%RND_FROM_DOMAIN (envelope-from %FROM_EMAIL) (8.13.6/8.13.6) with SMTP id %STATWORD for <%TO_EMAIL>; %CURRENT_DATE_TIME
Message-Id: <%RND_DIGIT[10].%STATWORD@mail%SINGSTAT.%RND_FROM_DOMAIN> 
From: "%FROM_NAME" <%FROM_EMAIL>
Bcc:
Date: Thu, 22 Feb 2007 12:04:09 +0000
Status: RO
Content-Length: 159
Lines: 8

%TO_CC_DEFAULT_HANDLER
Subject: %SUBJECT
Sender: "%FROM_NAME" <%FROM_EMAIL>
Mime-Version: 1.0 
Content-Type: text/html
Date: %CURRENT_DATE_TIME

%MESSAGE_BODY

posted at: 19:15 #

Thu, 08 Mar 2007

traffic reports in three easy steps

The nice people at the BBC provide, among other things, travel information. As I commute via car it's handy to have this sort of information. However I can't be bothered to go and actually read a website and then pull out the information I require from it.

I can be bothered to write code that does that for me.

The first thing is the fetching of the webpage. There's many different ways to do this but for the sake of ease I always find lynx or w3m the least hassle way of getting the contents of a website:

w3m -dump_source http://www.bbc.co.uk/travelnews/local/scotland-tayside.shtml

This spews out the HTML of that page to STDOUT. I can then pipe this into something to filter it.

Originally I used the -dump argument to w3m to output formatted source and then a combination of grep and cut pulled out what I wanted. After a while though the rubbish formatting of that irked me. At this stage I did what any reasonable person does and applied some Perl to the problem. A quick look at the source of the page and you see there's a table with two columns: Location and Incident Report. Clearly I want to extract the contents of those two columns and then output only those that mention roads I travel on.

Handily the first part of this is easily solved by HTML::TableExtract which, assuming $html contains the source of my page does this sort of thing:

my $t = HTML::TableExtract->new( headers => [ "Location", "Incident Report" ] );
$t->parse( $html );
foreach my $table ( $t->table_states ) {                                        
    foreach my $row ( $table->rows ) { 
        if ($row->[0] =~ /m1/i) {
            print row->[0] . ": " . $row->[1] . "\n";
        }
    }
}

And I'll get exactly the information I want. Sadly the formatting will be rubbish. Fortunately we can just throw it at Text::Autoformat and all is well.

A bit of tidying up later and we have traffic_format. It grabs the HTML from STDIN and takes a comma separated list of roads as an argument and then prints out a neatly formatted list of incidents.

Now this is all well and good but clearly having to run w3m and pipe the results to traffic_format really isn't much of an improvement on visiting the page by hand. Ideally the information would get sent to me. I could have it emailed but then I'd have to remember to check my email. Clearly some sort of instant messaging is the solution.

In this case the sort is jabber and once again a little shim of Perl is all that's required. The shim in question is Jabber::SimpleSend which lets us do this:

send_jabber_message({
    user        =>  $user,
    password    =>  $pass,
    target      =>  $target,
    subject     =>  $subject,
    message     =>  $text,
});

Once more we add a bit of extra sugar round it and we end up with send_jabber which reads some configuration from $HOME/.send_jabber_rc and a message from STDIN and then punts off a jabber message.

Now we've got all the bits in one place all we need is a simple shell script to tie it all together:

#!/bin/sh

#config
URI='http://www.bbc.co.uk/travelnews/local/scotland-tayside.shtml'
ROADS='a92,a90,a914'
#end config

w3m -dump_source $URI | traffic_format $ROADS | send_jabber -

And then run it at the right times via the magic of cron and you have both a handy traffic report and a demonstration of the joys of unix.

And yes, the code samples in this do look bad in Internet Explorer but it's late and CSS wrestling does not appeal.

posted at: 22:03 #

all the usual copyright stuff... [ copyright struan donald 2002 - present ], plus license