DD18

What is the Dunwich Dynamo?

A turn-up-and-go challenging slightly-scary free-entry overnight on-tarmac just under 120 mile bicycle ride to the lovely lonely Suffolk sea at Dunwich.

It takes place in July each year on the Saturday nearest the full moon, which, this year, was last Saturday (24th).

I first heard of the Dunwich Dynamo a couple of years ago. I couldn’t make it last year. This year, I decided to take part, bought myself a ticket for the coach/bicycle transportation back, and told everyone I was going to do it.

And thus I left London Fields around 20:00 on Saturday evening, and arrived at Dunwich beach just before 07:00 on Sunday morning.

Me on Dunwich Beach at the end of the Dunwich Dynamo

  • 186 km travelled
  • 11 hours start to finish
  • 7 hours 55 minutes riding time
  • 22.5 km/h average speed
  • 48.5 km/h top speed

The sky was cloudy, but it didn’t rain. It wasn’t all that bad, really. Endurance is something that human beings have naturally evolved to be good at. For energy, we just need fuel and oxygen. Oxygen is readily available; for food, just keep eating, according to Velocio’s maxims:

Eat before you’re hungry, drink before you’re thirsty.

I took a couple of loaves of Soreen with me, and nibbled a chunk every hour or so, along with some dextrose tablets and two bananas.

A little less than halfway to Dunwich, there was a feeding station at Sible Hedingham village hall, where I had a 12” hummus sandwich, a cup of tea, and an hour’s break.

Around 04:30 (I think), as it was beginning to get light, the lane ahead was suddenly filled with parked cyclists. Someone had set up a small stall in their garden and was selling bacon sandwiches and cups of tea. As someone said, it was like an oasis in the desert. A bacon oasis.

The psychological benefits of a hot bacon sandwich and a cup of tea in the middle of Suffolk after you’ve been cycling all night cannot be overstated. It was wonderful.

At Dunwich, I pushed by bike onto the shingle, stripped to my shorts, and waded into the sea. It was comfortably mild, although whether that’s due to seasonal effects or just the outflow of Sizewell up the coast, I don’t know.

Speaking of shorts: yes. Apply something emollient (Savlon is a favourite) and wear some proper cycling shorts. I did, and after eight hours in the saddle, I was in no discomfort whatsoever. (I also wore a pair of thin baggy shorts over the top. I’m not that kind of cyclist.)

Lights were also essential. I had my regular flashing city lights, plus a head torch (very useful off the bike in the dark) and a seriously bright torch mounted on the handlebars. The torch only lasted an hour and a half on a set of batteries, but three sets were enough to get me through the dark part of the night.

I did the ride on a single speed bike (freewheel, not fixed), with a 74” gear. That was mostly fine. I didn’t need to go any faster, but a lower gear would have been useful on a couple of uphill stretches. Suffolk is mostly flat, but it’s still hillier than I remembered.

I tried to minimise the weight I carried. Next time, I’d take more clothing for the beach afterwards. I took a change of clothing, but I’d take more layers. There’s not much shelter around, and it’s either cold or baking in the sun. Or both. I’d take sunscreen, too. The part of my legs that was exposed to the sun for an hour or so wasn’t as conditioned to the sun, and I’ve got some red shins today.

Cylists on Dunwich Beach at the end of the Dunwich Dynamo

The coach back to London took about three hours. Driving is faster than cycling, but not by as much as you’d imagine. Riding to Dunwich has increased my sense of what can be achieved on two wheels under human power alone.

Flash: the new RealPlayer

Flash is just another legacy media player following the slow decline towards irrelevance.

Do you remember when everyone had to install RealPlayer to get streaming audio to work? And how Real abused their position by shovelling unwanted software and intrusive updates along with RealPlayer—to the extent that the BBC had negotiated their own less-invasive build of RealPlayer to avoid subjecting the innocent public to the regular version? And how we were all so happy not to have to use it any more?

Where’s RealPlayer now? I can’t remember the last time I used it or installed it. It’s just another piece of dead proprietary software. And good riddance!

Mo has written a provocative piece on the (shrinking) market penetration of Flash:

And so we’re beginning to arrive at a situation where Flash authors are, for the first time, confronted with a situation where Flash isn’t in a position of unanimous support: the proportion of users without Flash support is growing, and it’s growing quite quickly. From a business perspective, there is a tipping point at which you have to make a decision, based on the numbers.

I’d go further.

I’ve been using FlashBlock (on Firefox and, more recently, Chrome) for several months. This replaces embedded Flash with a placeholder; on clicking the placeholder, the Flash is restored to the page.

As a result, I’ve only seen Flash I really want to see. And this, it seems, is not very much at all.

Adobe’s Linux support for Flash has never been great—in fact, it’s seldom even reached basic competence—but when the plugin was recently revealed to be vulnerable yet again—this time, to remote code execution on every platform it runs on—they threw in the towel entirely, and withdrew the 64-bit Linux plugin.

This left me with three options:

  1. Continue to use the vulnerable plugin;
  2. Use a wrapper to get the 32-bit plugin working; or
  3. Uninstall Flash entirely.

The months of running with FlashBlock gave me the confidence to choose the third option.

And do you know what? I’m really happy not having Flash. Missing out on gaudy advertising or poorly-implemented ‘rich’ typography or flashturbated marketing sites is a bonus.

In fact, all Flash is really actually useful for is as a media player. But the major video hosting sites—such as YouTube and Vimeo—have HTML5 video versions of most content, and for the odd YouTube videos that isn’t available as HTML5, youtube-dl does a fine job. I’ve got my own solution for the iPlayer.

For ad-hoc video hosting, it’s often possible to grab the video filename out of the HTML and download it. And if not, well, it tends not to be that important.

I’ve been running without Flash at home for a month or so now, and I’m quite happy that way.

Now, if only the BBC would stop trying to extend life support to this dying patient (as they ended up doing for RealPlayer back in the day), we could get on with burying it.

Fish curry

This fish curry doesn’t belong to any particular regional cuisine. It’s just what I threw together tonight, and it came out rather well.

1t
cumin seeds
½t
coriander seeds
½t
black mustard seeds
3
allspice berries
5
cloves
1t
fennel seeds
1t
ground turmeric
1t
ground paprika
4
cardamom pods
1
piece cinnamon bark
1
bay leaf
1t
garam masala
1t
salt (approx)
6
garlic cloves
2cm
root ginger, peeled
6
finger chillis (more or less to taste)
splash
white wine vinegar
1T
tamarind block
1
stick celery, thinly sliced
2
red onions, chopped
400g
tinned chopped tomatoes
500g
white fish, cut into 4cm pieces
  • Soak tamarind block in a little freshly boiled water until it breaks up. Discard seeds, keeping as much of the pulp as possible.
  • Toast cumin, coriander, mustard, allspice, cloves, and fennel in a dry pan.

Toasting spices in a dry pan

  • Grind the spices; add turmeric and paprika.

Ground spices in mortar and pestle

  • Blend garlic, ginger, chillis, vinegar, and a little water to make a paste.
  • Fry celery and onions in a little oil (I use groundnut oil) over a high heat until they begin to brown.
  • Add fried onions to paste; add enough water to cover. Blend briefly to make a chunky paste.
  • Put everything except the fish in a pan, bring to boil, and simmer for 15 minutes.
  • Add the fish, and cook for a few minutes until done.

Fish curry with rice

An accessible timetable for Thames Clippers

I’ve been playing around with ways to obtain schedule information for the Thames Clippers service. As a side-effect, I’ve made a more accessible HTML version of their PDF timetable.

screenshot of accessible timetable

As I’ve probably mentioned before, the Thames Clippers river boat service serves a pier at the end of my street—I can see it from my window, in fact. It’s not the most convenient way to travel—it serves a limited number of destinations by definition—but it’s one of the most pleasant.

I’ve been looking at their timetable data because there are a few interesting things I want to do with it. I’d like to display the time of the next departure as a widget on my computer screen, for example. I’d also like to have a way to check the times from my mobile phone.

I’m limited in this by the fact that the timetable is published only as a PDF. All PDFs tell you is what the text looks like and where it is on the page. The semantic meaning of the text—of what it is, and how it relates to other text—is lost. (This is, incidentally, one of the reasons why it’s important that government data is released in better-structured formats than PDF.)

I did a bit of a feasibility study, and settled on using pdftotext to extract the tables. With the -layout option, it lines up the data more or less as it appears on the page. I also wrote a reusable library to handle reconstructing the tabular text back into columns.

The easiest way to be able to check my output was to transform it into HTML. And once I’d done that, I now had an accessible version of the timetable which was already a lot more useful than having the information locked in a PDF. So I gave it a lick of CSS, and stuck it on the internet:

Accessible Thames Clippers Timetable

It’s done in HTML5 with CSS3. If you’re using a rubbish browser, it should still look OK, but it won’t have the nice zebra stripes, for example.

I’ve put the code used to generate it on Github, along with a brief explanation of how to use it.

I fully expect someone to take umbrage. No good deed goes unpunished, and all that.

How to paint over a rotten badger carcass (BBC News tabloid outrage edition)

Executive summary: some road painters paint lines on the road as contracted.

You expect this kind of Elf’n’Safety Gone Mad nonsense from the tabloids, but it’s sad to see it in BBC News.

Hampshire workmen paint white lines around dead badger

Workmen painting white lines on a road left a gap for a dead badger because they said it was not their responsibility to move it.

How appalling! What lazy, feckless workmen!

Oh, but wait. There’s more:

The animal had been killed about a week before on the A338 near Downton, on the Hampshire-Wiltshire border.

And:

The badger has now been removed and the painting will be completed on Friday.

And:

The county council said there would be no extra cost to taxpayers because the company was being paid a fixed rate for the job.

Here’s the actual story:

  • A team of road painters is employed to paint lines on a road.
  • Whilst painting the road, they come across a week-old badger carcass rotting in the path of the lines.
  • Paint doesn’t stick to fetid badger remains, so they leave a gap and continue to paint the road.
  • People with the right equipment come along and clean the rotten badger off the tarmac.
  • The road painters go back and fill in the gap at no further cost.

But yeah, be outraged if you want.

SimpleScrobbler

This is the Unix philosophy: Write programs that do one thing and do it well. —— Douglas McIlroy

I was dissatisfied with the state of Last.fm API integration in Ruby, and I decided to do something about it.

The Last.fm API has a whole load of interesting functionality, but the most useful one is scrobbling: pushing information about the music you’re listening to to Last.fm. The point of doing this is that you can:

  1. go back and work out what that song was that you liked; and
  2. make a note of the tracks that you like; and
  3. use statistics about you listening habits to recommend more music, or just to pick out a playlist for your portable player.

I’ve been listening to a fair bit of internet radio recently, and I’m hearing a lot of new (to me) music that I like. I’ve written some code to help me keep track (for Shoutcast servers, for example). One problem that I found was that there doesn’t seem to be any simple, working implementation of the basic scrobbling protocol for Ruby. The available libraries, like scrobbler-ng, seem to do everything but. I mean, scrobbler-ng claims to do it, but I couldn’t get it to work at all, and the code behind the scenes doesn’t seem to be hooked up to support basic scrobbling.

So I asked James what he’d used for his vinyl/Shazam/Last.fm hack, and he pointed me at some rough-and-ready code that (almost!) did the job.

I’ve taken it and tidied it up—well, rewritten it, really: I wrote some high level tests around the existing code, refactored it, then made the tests a bit more granular, then refactored it some more. And so, I give you SimpleScrobbler:

Scrobble tracks to Last.fm without wanting to gnaw your own arm off.

It’s pretty easy to use. It doesn’t do much. And it actually works.

Making Korean pickles

Korean pickled food is amazing stuff. It’s a technique that can take something as boring as cabbage and turn it into a piquant, invigorating delicacy. And it’s easy to make at home.

homemade kaktugi

In fact, Korean food in general is delicious and yet, scandalously, it doesn’t seem to be very popular in the UK.

Kimchi (김치)—pickled Chinese cabbage—is probably the best-known Korean pickle, but there are many variants. One of my favourites is kaktugi (or kkakdugi, or whatever) (깍두기), which is made from giant radish.

You can buy kimchi and kaktugi in shops if you live somewhere with a measurable Korean population. Having lived in places where you can’t, I’ve learned to make it from scratch. Not only is it easy and satisfying, you’ll usually end up with something better than you could buy in a shop.

Here’s how I make it. I’m going to be vague about quantities; I’ll assume that you’re a competent chef and can figure it out yourself. In any case, the amount of chilli and such is a matter of personal taste.

First, take your main vegetable. For kaktugi, you want some giant radish (also called daikon or mooli depending on where you buy it). Chop it into 1.5 cm cubes. For kimchi, take some Chinese cabbage and chop across into 3 to 4 cm lengths.

Place the chopped vegetable in a zip-lock bag and salt generously (with sea salt: this is important). Work the salt in with your hands.

Seal the bag and leave to stand for 3 hours or so, manipulating occasionally to ensure that it’s evenly distributed. A large volume of water will be expelled (via osmosis) from the vegetables during this process.

Next, make the seasoning: blend garlic, ginger, dried red chillis, fish sauce (oysters are traditional, but I use Thai nam pla as a readily-available substitute), and a little water into a paste.

Take handfuls of the salted vegetable and squeeze out any excess water. Put in a bowl and work the paste all over the vegetable.

At this point, you can add any other ingredients if desired: finely chopped spring onion; carrot; etc.

Put the seasoned vegetable into a jar and pack down tightly.

For the first day or so, leave the jar open and apply a weight to the top of the vegetable—a beer bottle full of water works well. The idea here is to push the solid material down below the level of the liquid exuded. Pack the whole lot in a plastic bag—it will smell!

After a day, put a lid on the jar. Leave at room temperature for another day or two or three, according to preference. Then transfer to the fridge. I don’t know how long it lasts. It’s never been an issue!

Turning JSONP callbacks into a Ruby API with Johnson

It’s fairly simple to extract the data from a JSONP callback in a reliable, repeatable way once you know how. Here’s how.

I wanted to extract the playlist from an internet radio station. The server in question exposes currently playing information via a JSONP API, the intended purpose of which is to update an HTML element on a page with the details of the track currently playing.

JSONP, in case you’re not familiar with the concept, is a means of inserting data from a third-party service into a web page. The third-party server responds to a request with a fragment of JavaScript that calls a function in the originating page.

The service in question returns data like this:

var arr14b178d7 = { 'song': 'blah', 'listeners': 7 };

cc_streaminfo_get_callback(arr14b178d7)

How do we get this into a Ruby application? We could attempt to parse the JavaScript object itself, but that’s a bit ugly and error-prone. We can’t use a JSON parser, because it doesn’t conform to the (restrictive) rules of JSON. Much better to use something like Johnson to evaluate it.

Unfortunately, that doesn’t work all that well:

Johnson.evaluate(s)

# => Johnson::Error: cc_streaminfo_get_callback is not defined at (none):3

Well, let’s split on the blank line, then, and just evaluate the object:

Johnson.evaluate(s.split(/\n\n/).first)

# => nil

Still no good: variable assignment doesn’t return a value, so all we get is nil. And besides, that was a rather fragile attempt at parsing.

In fact, we can take advantage of the fact that the function call is the last statement in the JSONP. If we define the missing function as a stub that returns its argument, then that will be the final result of the JavaScript fragment:

callback = <<-END
  function cc_streaminfo_get_callback(details){
    return details;
  }
END
object = Johnson.evaluate(callback + s)

# => [object Object]

And that object is the thing we want:

object["song"]
# => "blah"

And there you go: a simple and reasonably reliable way of parsing the response from a JSONP API.

(Strictly speaking, I’m not sure if this API actually counts as JSONP as it doesn’t allow us to specify the function name. That doesn’t make any difference to the implementation.)

Cycle Superhighways

I ended up cycling on one of the new Cycle Superhighways last weekend. I’m not really convinced of how useful they actually are.

What is a Cycle Superhighway? It’s a metre and a half of blue tarmac along the edge of the road, with a route designation (e.g. CS7) marked at intervals.

That’s it, so far.

Are they any good? Well, no. Not really. There are two main problems:

  1. If you take a four-lane road and cover half of one lane in each direction with blue paint to designate it as a ‘Cycle Superhighway’ (as TfL have done), cars still use the entire lane. So the cyclist doesn’t gain any space. In fact, because the gutter is now nominated as the zone for cyclists, there’s now pressure on cyclists not to take any more of the lane than the blue paint allows.
  2. The blue paint is invisible at night under the yellow sodium lights. This is basic physics, but didn’t seem to occur to Boris and crew.

The only useful thing that the Cycle Superhighways provide, as far as I can tell, is that they allow a cyclist to decide to follow a nominated route for a long distance without getting lost. In that respect, however, it’s really no better than painting the route designation alone on the road, along with some clarifying markings at junctions. And, in fact, we already have such things: you might as well follow the A3 and A24 as CS7.

They do feel more like a rushed gimmick and less like a genuinely useful enhancement to cycling in the capital. Superficial Cycleways indeed.

Fortress Britain

These are the images that currently decorate the home page of the UK Border Agency website:

Someone being handcuffed:

UKBA website image of a person being handcuffed

And someone being fingerprinted:

UKBA website image of a person being fingerprinted

This is not acceptable. Border control does indeed entail arrests and enforcement and all that nasty stuff. Sometimes. But it is not and should not be the core business of the UK Border Agency.

This kind of imagery is horrible, authoritarian, and dehumanising, and I’m appalled at the kind of mentality that it implies. It’s not the way that we should be presenting ourselves to visitors.