[ Content | Sidebar ]

Archives for April, 2011

Hastings Castle

April 25th, 2011

I was back home in Hastings for the Easter weekend. My mum and I visited that often overlooked Hastings attraction: the castle! Granted, it’s not the most extensive or complete castle in the country, but it is historically significant and, well, local. Most of it has fallen into the sea or was demolished by over-enthusiastic Victorians although there are a few interesting bits left. It was also ridiculously hot and sunny for April. Here are some pictures I took:

Royal fact-say

April 24th, 2011

It’s less than a week to go until the most anticipated day of the year: the wedding of Kate and Wills. A momentous day in the history of our nation. And look, even the humble pound shops are joining the celebrations!

Here at doof.me.uk we’re marking the occasion with a release of a special royal themed script for xcowsay: royal-fact-say! Install xcowsay, unzip the file, then run ./royal-fact-say and xcowsay will spout a random wedding factoid alongside an adorable picture of the happy couple. Enjoy!

Filed in xcowsay - Comments closed

Conky BBC weather

April 17th, 2011

I’ve written a Ruby script called bbc-weather.rb that parses the BBC weather RSS for a particular location and formats the data for conky. Here’s an example:

To use it insert the following in your .conkyrc:

${execpi 600 ruby /path/to/bbc-weather.rb 4197}

This will refresh every hour. Replace 4197 with the number of your local weather station. You can find this by looking at the BBC weather URL which is of the form weather/forecast/XXXX. You also need to define two colours for the script to use, in the options section before TEXT, like so:

color1 white
color2 grey

You might also need the following, as conky limits the about of text it will read from a sub-process:

text_buffer_size 2048

UPDATE: apparently this script no longer works with recent BBC Weather updates. Check out the comments for an improved version.

More or Less

April 10th, 2011

I love More or Less on Radio 4. I did squee so much when it came back for a new series. It isn’t easy to make statistics both fun and intelligible.

Also, I got horribly sunburnt yesterday :-(. But only on the top of my arms and face and not where my watch goes so is both daft and painful. Grr.

Also, I have a TrainGame-derived maths problem: let’s say I have a three-dimensional Bezier curve (X(t), Y(t), Z(t)) defined for 0 <= t <= 1. In my case this defines a track segment and works admirably for rendering the track. However it also determines the position of the train on the track at some time t. The problem is, with the train travelling at a constant speed, it appears to speed up or slow down depending where it is on the curve. It turns out that most of the time this doesn’t really matter, but sometimes it does.

What I would like is for the t parameter to be linearly related to the distance travelled along the curve; so if A is the arc length between two points A(0, s) = s * A(0, 1). Unfortunately, Bezier curves don’t possess this property and there’s not even a closed-form solution to A. So I’ve had to write this crude and slow approximation to such a curve given a normal Bezier curve as input:


It works by assuming that (X(s), Y(s), Z(s)) should be sL units along the curve, where L is the length of this track segment. It then approximates the curve by lots of little straight lines and moves t along the curve summing lengths until it reaches sL. Then we evaluate the curve at (X(t), Y(t), Z(t)).

So the question is, mathematicians of the interwebs, is there a better way to do this??

Extended Adventure Up North

April 2nd, 2011

I was away in Yorkshire last week visiting some northern acquaintances and going for a walk on the moors. I walked along the first part of the Cleveland way, from Helmsley to Kildale, and then got the train back to Middlesbrough and civilisation. Around 45 miles over three and a half days so not very far but it was hilly! I had planned to take a short cut on the final day and get the train at Battersby but the nice people on the farm where I was staying gave me a lift back to where I’d left the path the previous day so I was able to do the whole route. On the way home I was stranded for 40 minutes in Middlesbrough so I paid a visit to my favourite attraction: the transporter bridge! Somehow my memory of Middlesbrough was pleasanter than the reality.

Weather was good and bad on alternate days but it only rained on Saturday when I was walking from Hambleton to Osmotherley so it could have been worse. Also, I managed to get sunburnt on Sunday! In March! In Yorkshire! The photos I took are a mixed bunch, which is a shame because the scenery was pretty awesome, but here they are: