The X-Files: I want to believe…

…but unfortunately, I can’t.

We had to wait six years for that? Puh-lease.

Ah, the irony…

…of a Catholic Archbishop telling the Western world that it isn’t having enough babies:

The Catholic Archbishop of Sydney, Cardinal George Pell, today warned Western nations such as Australia to populate or perish … “There is a crisis in the Western world. No Western country is producing enough babies to keep the population stable, no Western country”.

You first, George.

Screen-scraping Melbourne’s TramTracker information.

Melbourne’s tram operator, Yarra Trams, provides a web and sms system called TramTracker, that can tell you the time of the next tram that will arrive at any given stop, using a combination of real-time information and scheduled timetables. It uses the same system that drives the passenger information displays that can be seen around inner-city tram stops.

The web-service is pretty nasty, however. It doesn’t render very well for me using Galeon, and worse, it doesn’t keep any state information, so you have to keep retyping the tram-stop code every time you want to look up the information on your tram. And having to launch a web-browser to just look up the time of the next tram is annoying; it would be nicer to have either a command line interface, or perhaps even a small application running in a docked window.

It also assumes that you only wish to catch a tram from one stop; if, like me, you’re within walking distance of two or more different tram lines that can take you to a particular destination, then you have to do multiple lookups, which is a waste of time.

So, with this in mind, I pulled out Wireshark and had a look at the HTTP traffic that was being passed when making a request to the service. The following was the most interesting part:

tkScriptManager=upnMain|btnPrediction&
tkScriptManager_HiddenField=%253B%253B
AjaxControlToolkit%252C%2520Version%253D1.0.10618.0
%252C%2520Culture%253Dneutral%252C%2520PublicKeyToken%25 [blah blah blah…]
&__EVENTTARGET=&__EVENTARGUMENT=&__LASTFOCUS=
&__VIEWSTATE= [blah blah blah…]
txtTrackerID=1919&ddlRouteNo=Any&btnPrediction=

The number 1919 was the tramstop code that I’d entered. So I quickly threw together a small web form, with hidden variables txtTrackerID, ddlRouteNo and btnPrediction, which sent a request to the tramtracker interface, but unfortunately this wasn’t enough and it kept returning to the start page.

After a bit of trial and error, I found that it also needed to be passed these variables: tkScriptManager, __EVENTTARGET, __EVENTARGUMENT, __LASTFOCUS and __VIEWSTATE. Fortunately it didn’t need any of the long-winded variables with public key tokens in them.

I was rather happy to find that the output from the service was XHTML, however this feeling soon dissipated when I discovered that whoever wrote this clearly didn’t have a clue that XML would only work if well-formed and that they hadn’t closed off any of their br or img tags. Sigh, so many useless “web programmers” out there, so few jail sentences. This ruled out using XML::Simple to parse it, and I had to settle for kludging it with HTML::TableExtract.

The upshot of all this is the NextTram perl script, which will return the times of the next trams arriving at multiple tram stops, sorted by time:

$ ./nexttram 1419 1259 1216
1:Sth Melb Beach:0
19:Flinders St City:6
8:Toorak:9
55:Domain Interchange:10
1:Sth Melb Beach:13
19:Flinders St City:18
55:Domain Interchange:26
19:Flinders St City:31
55:Domain Interchange:39

While I realise that it has a limited potential audience (Linux/Unix users in inner Melbourne suburbs who actually care about what times trams run, ie, probably just me), I’ve released it under the GPL in the hope that it might go onto bigger and better things. Of course, it will probably just break next time Yarra Trams upgrades their website…

Docbook 5.0 in 5.0 minutes

I quite like Docbook. The syntax is simple enough to pick up quickly, which means I can churn out documents without much effort, and more importantly, without having to fire up a bloated office suite. Furthermore, the documents that it produces look great, which is far more than I can say for anything I’ve put together with a wysiwyg word processor – I will freely admit that I have no artistic skills, whatsoever.

The biggest problem with Docbook, however, is the tools needed to convert it from xml to other formats (eg, pdf, html, etc) – or rather – the documentation of the tools, ironically enough. Most of the information out there seems to have been written to be so platform independent that it’s next to useless for any real-world situation.

So, in the interests of hopefully saving someone the hours that I’ve spent trying to get this working for my specific case, here’s a quick guide to writing and publishing a Docbook 5.0 document, on Debian sid.

Firstly, get the Debian package source to xmlto and apply the patch attached to Debian bug 416622; this gives xmlto support for dblatex, as it currently expects to use passivetex and it has been removed from Debian. Hopefully the patch will be applied upstream and this step won’t be needed in the future.

Install the following Debian packages: docbook, docbook-xml, docbook-dsssl, docbook-xsl, dblatex, xsltproc. Build and install the patched version of xmlto, and install any dependencies it requests.

Now, a simple docbook document. Write this to index.xml:

<?xml version=”1.0″ standalone=”no”?>

<!DOCTYPE book PUBLIC “-//OASIS//DTD DocBook XML V5.0//EN”
“http://www.oasis-open.org/docbook/xml/5.0b5/dtd/docbook.dtd”>

<book xmlns=”http://docbook.org/ns/docbook” version=”5.0″>

<info>
<title>My book</title>

<author>
<personname>
<firstname>Paul</firstname>
<surname>Dwerryhouse</surname>
</personname>
</author>
</info>

<chapter>
<title>Introduction</title>

<para>This is the first paragraph.</para>
</chapter>

<chapter>
<title>Stuff</title>

<section>
<title>Information</title>
<para>This is the first section.</para>
</section>
</chapter>

<chapter>
<title>Conclusion</title>

<para>This is the last paragraph.</para>
</chapter>

</book>

Note the DOCTYPE line. I can’t tell if Docbook 5.0 has been officially released or not. Wikipedia suggests that it is, but the 5.0 DTD is not available on the OASIS website, only a beta.

You can now convert this to html with:

xmlto html index.xml

…or pdf with:

xmlto –with-dblatex pdf index.xml

If you’re writing a huge document, and want to break it down into multiple files, then you can use XInclude:

<?xml version=”1.0″ standalone=”no”?>

<!DOCTYPE book PUBLIC “-//OASIS//DTD DocBook XML V5.0//EN”
“http://www.oasis-open.org/docbook/xml/5.0b5/dtd/docbook.dtd”>

<book xmlns=”http://docbook.org/ns/docbook” version=”5.0″>

<xi:include xmlns:xi=”http://www.w3.org/2001/XInclude” href=”info.xml” />
<xi:include xmlns:xi=”http://www.w3.org/2001/XInclude” href=”ch01.xml” />
<xi:include xmlns:xi=”http://www.w3.org/2001/XInclude” href=”ch02.xml” />
<xi:include xmlns:xi=”http://www.w3.org/2001/XInclude” href=”ch03.xml” />

</book>

The above example will then read in four files, info.xml, ch01.xml, ch02.xml and ch03.xml, which contain the information section and the three chapters from the first example.

What’s wrong with Melbourne’s public transport (part 1A)

I hadn’t planned on writing the second installment of this series just yet, but I’ve just spotted this:

MORE than $10 billion will be spent on infrastructure – including $2 billion rebuilding the state’s public transport by electrifying the city’s rail network, extending tram lines and buying new buses – in one of the biggest shake-ups contained in any State Budget.

The 10-year, $2 billion transport program outlined in Treasurer Kevin Foley’s seventh Budget will deliver 50 new electric trains, 58 converted electric trains, 15 hybrid tram/trains which can use both lines and 80 additional buses.

Where? Not Melbourne. Rather, it’s Adelaide, the capital of a state which – only a couple of years ago – was considered an economic basket case. Of course, there’s no doubt that the work needs to be done; Adelaide easily has the worst metropolitan rail system in the country. During the 2004 linux.conf.au conference, I took a short trip about four stations north along the Gawler line at about 7pm, and then was stuck there for almost an hour waiting for a return train. Frequencies that bad, even at night, simply aren’t going to get people out of their cars.

Kudos to the South Australian government, showing Victoria’s do-nothing-but-build-roads-and-sports-stadiums government just how infrastructure spending should be handled.

Rudd solves Australia’s unemployment problem.

Australia’s current unemployment rate is, according to the ABS, 4.2%25 – although in reality it’s higher, since this figure doesn’t include those people who are studying, those who have given up looking for work and those who would like to work more hours than they currently have (a person with one hour of work per week is counted as ’employed’).

Meanwhile, Australia’s public servants are currently being worked to the bone by the Prime Minister and are fed up with it.

Hmm. Well, that doesn’t look all that hard to fix, to me. Reduce the hours of those people who are putting in more than eight hours per day, and give the extra work to the unemployed. And the great bit is that it won’t cost us one cent more.

You are paying for all this overtime, aren’t you, Kev?

What’s wrong with Melbourne’s public transport (Part 1): Trains

Ok, enough. I am utterly over the whinging about petrol prices. Cutting tax on petrol is not going to make it cheaper, because it will merely encourage lazy people to use more of it, which will push up the price further.

And despite Rudd giving up on it all, there is one sure fire thing that would work: stop using it. How? Invest in public transport. Make it usable.

Melbourne has an efficient, well maintained public transport system with frequent services, which lets passengers travel from A to B quickly and cheaply. (Pause for laughs)

Of course, this is only true if:

  • You live in the inner city
  • You’re trying to commute only to or from the CBD
  • You only go out late on Friday and Saturday nights; and
  • “Quickly” is never actually quantified.

If you’re unfortunate enough to live outside that zone bounded by Coburg to the north, Camberwell to the east, Footscray to the west and St Kilda to the south, then you have my sympathy. I put up with the hour long bus-train-tram commute from Melbourne’s east to Melbourne Uni every weekday for most of the 1990s before I moved to Brunswick and swore I’d never move back.

The really sad part is, my commute at the time was one of the easier ones to make on Melbourne’s system, which is extremely skewed towards radial trips. If I’d have lived in a hellhole like Knox (ok, it’s not quite hell, but Satan has a quarter acre block there) the trip would have at least half an hour added to it, simply because there’s no railway station there.

Some of the problems with Melbourne’s railway system can be neatly summed up by this map:



(See here for Wikipedia’s larger version)

As you can see, there are vast areas of Melbourne, notably the north-east (Doncaster) and the south-east (Rowville, Knoxfield) that aren’t even remotely close to rail at all.

The proposed railway line to Doncaster has now become a running joke; successive governments have reneged on promises to build it, that they made while in opposition. The problem here is one of demographics: Doncaster is a blue-ribbon Liberal party seat. The Labor party won’t build the line, because they know that the residents won’t vote for them anyway; the Liberal party won’t build the line because they know they’re a shoe-in (let’s face it, the people of Doncaster weren’t even discerning enough to kick Kevin Andrews out, federally). Memo voters: make your seat marginal if you want things done.

The result is a hotch-potch of bus routes running from various areas around Doncaster and Templestowe, down the Eastern Freeway towards the city, which then come to a screeching halt in the Hoddle St or Alexandra Parade traffic. The government claims this is sufficient, but won’t even match the bus services with those provided on a regular railway line; you can get from the city to anywhere in Melbourne serviced by a railway line after 10pm on a Sunday night, but you can’t get to Templestowe or Warrandyte, because the buses have stopped long before then. It’s no wonder people drive.

The most ridiculous thing about this is that land was set aside for the railway line. The median strip running down the centre of the Eastern freeway is wide enough to accommodate two sets of railway tracks, and was designed for this purpose. Building this line – at least out to Doncaster Rd, is a no-brainer. From there to Shoppingtown is more difficult, especially given that the land earmarked for building it was sold off back in the 1980s. This problem, however, is certainly not insurmountable.

What is more difficult, however, is ramming home the need to build new railway lines into the thick skull of the Victorian government. They have noted their opposition to building new lines time and time again, preferring to repeat the tired old line that buses are adequate substitutes. Memo John Brumby: no-one wants to travel on buses. They are crowded, uncomfortable, noisy, smelly relics of a bygone era. If anyone wants to really see what’s wrong with relying on buses as a major mode of transport, just go and stand in Sydney’s George St, at almost any time of day. The noise is almost deafening. Then compare it to Flinders St, in Melbourne.

The map above doesn’t show the large growth areas to the north of Epping (South Morang, Mernda, Whittlesea) where there is no rail transport, or to the west, around Melton, where passengers are stuck using infrequent, crowded diesel services. The Labor party promised to start building a line to South Morang in 2001, before they were elected in 1999. This has now been put off until 2021, without adequate explanation. A recent study into Melbourne’s east-west traffic plan made no recommendations whatsoever for electrifying the line out to Melton; rather it advised the construction of yet-another whopping great freeway (and a rail tunnel, the need for which certainly isn’t a top priority).

Aside from the construction of the city-loop in the 1970s, there has been no new railway construction in Melbourne since the Glen Waverley line was finished in 1930, only the occasional electrification of existing lines. What I don’t understand – and maybe some economists within my readership could explain this to me – is why, in the past, Victoria (and Australia, more generally) was able to spend vast sums of money building extensive rail infrastructure, along with some very nice, aesthetically pleasing and very expensive looking railway stations; and yet today, in the middle of a mining boom, the state government can barely be convinced to string up a few wires above a pre-existing railway line and then build the cheapest possible concrete platform alongside it to act as a station, resulting in a construction that looks like it came straight from a Soviet architect’s nightmare:



I’m sorry, I don’t believe that we can’t afford to build these railway extensions. I don’t believe that it would cost almost $350 million to extend the Epping Line to South Morang, especially when the cutting from the previous line is still there. Forward looking cities like Amsterdam are tunnelling an entire friggen metro under the city, and we can’t even build a 5km extension before 2021?

OMFG! Australia might suck at sport!

“The Federal Government has been warned that Australia will slip out of the world’s top five Olympic nations if sports funding is not drastically increased.” — John Coates, president of the AOC, via the ABC.

I’m not sure I see a problem with this scenario.

Change management sucks.

Adding insult to injury:

It’s bad enough that due to “heightened change procedures“, I am required to submit a change request – with 14 days lead time – to compress a bunch of log files, on an 85%25 full filesystem. But for that change to then be rejected?

Fine, let it break. It’ll cost more to fix it, then. At least I now know why my phone bill is so expensive.

Managing changelogs with dch

A quick (and fairly obvious, now I think about it) tip for anyone who doesn’t have time or inclination to manually insert dates and version numbers into changelogs: Debian’s dch command (part of the devscripts package) can be used for more than just Debian package changelogs…

First, create a changelog file and edit it:

export EMAIL=your@email.address.com.zz
dch --create -c /path/to/CHANGELOG

Then, when you have a new release, either increment the version:

dch -i -c /path/to/CHANGELOG

…or give it a new version number:

dch -v 1.0.5 -c /path/to/CHANGELOG