Hiking the Kungsleden 2018

In late August to early September of 2018, I hiked Sweden’s 440km Kungsleden (Kings Trail) in the northbound direction.

My buddy Emma came along and hiked a good two thirds of it too.

I didn’t blog about it at the time but I did tweet each day as I went. Here are those tweets.

I left Emma at this point, with a plan to meet up later

Posted in Uncategorized | Leave a comment

Walking the West Highland Way (Yaw dnal hgih tsew)

The West Highland Way is a 96 mile walking route stretching from Milngavie in Glasgow to Fort William in the Highlands. In August of 2017 I walked this route, in reverse, starting with a bonus ascent of Ben Nevis.

Here’s a pretty complete summary of that week.
Continue reading

Posted in travel | Leave a comment

My very own twitter client.

Followers on Twitter may have noticed that I’m now posting using a client called alanjames. This is really just Spaz but now registered at Twitter under my own name.

Here’s the how and why I’ve done that.

For some months now I’ve been using the in development versions of Spaz pulled from the GitHub repository mostly cos I like to get all the new stuff first. Recently though they’ve changed all the login code to use xAuth as it looks like Twitter will be forcing all clients to go that way sometime soon.

So when I pulled the latest code on Tuesday it wouldn’t run. It just complained that the SPAZCORE_CONSUMERKEY_TWITTER and SPAZCORE_CONSUMERSECRET_TWITTER values were empty. These are the values an app uses to identify itself with Twitter (so when it misbehaves and causes a problem for Twitter they know who to contact), and they would normally be hard coded into the application.

When you’ve got an open source app though, anyone could look in the code and take your keys and then impersonate your application, potentially making you look bad when they somehow cause the fail whale to resurface. So until that problem is solved Spaz isn’t putting their key and secret in the source code.

Fair enough, I thought, I’ll just register it myself and get my own keys. Here’s what I did.

  • Go to http://dev.twitter.com/apps and register a new application. Call it what you like, set it to ‘client’ and ‘read & write’.
  • On the application detail page you’ll find your consumer key and secret.
  • In the Spaz source  you’ll find app/auth_config_sample.js copy this to app/auth_config.js and edit it.
  • Fill in the key and secret.
  • Run it and it still wont work. 🙁
  • Go back to your app page and notice the message at the bottom “Note: xAuth is not enabled for applications by default. Email api@twitter.com to request xAuth access.”
  • Send them a nice email :

    I have my own version of the twitter client Spaz and would like xAuth
    access for it. I’ve registered it here:

    I’ll keep it mostly in line with the cvs version from
    http://www.getspaz.com/ so any changes you require them to make I’ll
    quickly do the same.



  • Wait for 4 days.
  • Run it again and it works!

Posted in Geekery | 2 Comments


beerandnoodles posted a photo:


and that’s pretty much the last we saw of that one.

Posted in flickr | Leave a comment


beerandnoodles posted a photo:


Posted in flickr | Leave a comment


beerandnoodles posted a photo:


Posted in flickr | Leave a comment

Issues with the YouGov poll on LD policies

Sunday’s YouGov voting intention poll for the UK contained a number of questions on policies. Commisioned by the Sun newspaper it seeks to gauge support for Liberal Democrat policies.

Now as people (according to recent media reports) have been completely ignorant of the Liberal Democrat party for years and are only now becoming interested in them since the recent televised debate, we can’t expect them to know much about their policies. Terrible I know.

So in order to gauge people’s support for these policies you’re going to have to explain them to people too. Asking them to read the manifesto first just isn’t going to work.

Now I wasn’t (randomly) selected for this poll, I think typically only about 1000 people are for these things, I found it via the Guardian election blog here, where they wrote this:

“YouGov asked about 10 Lib Dem policies. Only three of them are popular (in the sense that more people support them than oppose them.) Six are unpopular, and opinion is evenly split on one other (replacing Trident with a cheaper nuclear deterrent).

The three popular policies are:

Raising the income tax threshold to £10,000 – 66% in favour
Limiting public sector pay rises for two years – 57% in favour
Changing the voting system – 54% in favour

The six unpopular ones are:

Giving more power to the EU – 65% against
Joining the euro eventually – 65% against
Scrapping short jail sentences – 50% against
Giving an amnesty to illegal immigrants after 10 years – 49% against
Increasing taxes to fund abolition of tuition fees – 48%
Not building new nuclear power stations – 41%

YouGov did not tell its respondents that these were Lib Dem policies.”

These are very short paraphrased policies and some are quite misleading, even more so that the actual questions that I’ll get to shortly. Now I think that’s bad reporting, but it is just a quick blog post, and you can follow the link they provided to the actual questions that were asked. You can find them here.

Now I’m not going to analyse each of the questions asked; a number of them dont fit with what’s written in the Lib Dem’s manifesto or use language that might be polarising, but I’m no expert on polling bias and such things. I’ll just pick up on the examples I’m more sure about. Here’s one:

Euro: scrap the Pound and join the Euro when the conditions are right.

That’s all it said, do you agree or disagree with this position. Never mind that the manifesto clearly says ‘Britain should join the euro only if that decision were supported by the people of Britain in a referendum.’ So despite how this 65% against result might be reported, a Liberal Democrat government does not neccessarily mean the loss of the pound.

Prisons: Allow 58,000 criminals a year to do community service instead of going to prison by banning jail terms of less than six months.

I checked and the manifesto talks about ‘reducing the number of short sentences’ and introducing  ‘a presumption against short-term sentences of less than six months’. Not a complete ban.

Higher education: scrap university tuition fees over six years, and increase taxes to pay for this

Again I checked. There’s a levy on bank profits and new taxes on commercial flights, but I doubt they’re so unpopular with the public. There are vast sums of money listed at the end of the manifesto that pay for this many times over, limiting public sector pay rises alone would be enough. If the question were phrased ‘..and limit public sector pay rises to pay for this’ would the result have been the same ?

Energy: Stop any new nuclear power stations from being built and attempt to solve the energy crisis by coal-fired power generation plants and wind turbines instead.

Now that’s probably somewhat disappointing to anyone environmentally aware. Coal powered generation is hardly a great way of saving the environment. But the manifesto says that they’ll block any new coal-fires power station unless they ‘are accompanied by the highest level of carbon capture and storage facilities’, which is quite different to what you’d expect if all your information came from the poll. The manifesto is full of green tabs at the side of enviromentally focussed policies like reinsulating homes and public buildings. It’s far more than turbines and coal.

I dont think this poll can really tell you whether people support Lib Dem policies as they aren’t well explained but I dont envy the job of writing one that does it well. As its results are reported in the press, I expect many people will get a rather skewed impression of Lib Dem policies as a result. If you’re interested in leaning about their policies, read their manifesto and dont rely on anyone to tell you what it says.

Comments are enabled, but moderated. I’ll aprove the non spammy ones later.

Posted in politics | Tagged | Leave a comment

Within-group aggregates with another wrinkle.

Recently when optimising an SQL query I needed to return a specific subset of records from a large table. The brilliant Common Queries Tree pointed me in the right direction, but the examples didn’t quite cover my specific case.

I needed the records with the maximal value of x and the minimal value of y for that x.

For example, suppose you had a table of second hand books and each book has a quality and price. There are many copies of each book but you’re only interested in the best examples of each book and at the lowest price for that quality.

CREATE TABLE Books( id int,
ISBN varchar(10),
Quality int,
price decimal(6,2)
( 1, '0618551050', 4, 5.00 ),
( 2, '0618551050', 4, 6.00 ),
( 3, '0618551050', 2, 3.00 ),
( 4, '0786884061', 1, 8.00 ),
( 5, '0786884061', 3, 8.00 );

Here we are only interested in records 1 and 5. The Common Queries Tree describes this as a within-group aggregates problem, and as it notes the correlated subquery is the most obvious solution but it was slow.

I started off with something like this
Select * from Books as b1
where b1.id = (SELECT id from Books where Books.ISBN = b1.ISBN order by Quality desc, Price limit 1);

But with almost a million records in the table, a select on each one was taking forever. After a bit of head scratching I managed to use a left self exclusion join to find the records I wanted.

select b1.* from Books as b1
left join Books as b2 on b1.ISBN = b2.ISBN and b1.Quality < b2.Quality left join Books as b3 on b1.ISBN = b3.ISBN and b1.Quality = b3.Quality and b1.Price > b3.Price
WHERE b2.id is NULL and b3.id is NULL;

Here the idea is to select as b1 the records from Books where its impossible to find a book, b2, that has a higher quality and impossible to find a book, b3 with the same quality as b1 but a lower price. If there was another book with a higher quality then b2.id would not be NULL so those records are excluded. Similarly if a book at the same quality had been found but with a lower price, b3.id would not be null.

This was much faster on my data set but it does produce a slightly different result when two items are indistinguishable.
insert into Books VALUES ( 6, '0786884061', 3, 8.00 );

With that my initial query would return either record 5 or 6 and the new query returns both. So group by b1.ISBN to restore the old behaviour. Once you’re happy, save your query into a view so you don’t have to look at it again.

Got a better solution ? If you can optimise my view you’ll make me very happy.


Posted in Geekery | Tagged | Leave a comment

Tethering Jolicloud with a Nokia 6500 Classic

Yesterday I plugged my Nokia 6500 Classic phone into my Jolicloud powered netbook, told the network manager I was on a Vodafone contract and bang, instant 3G internet access. It could hardly be simpler.

Once its set up, you can edit the configuration and see where it’s put the APN and other connection info, and edit to match your provider if its not on the list of presets.

Bluetooth is trickier, the GUI tool had a go at it but failed miserably just like it had on plain Ubuntu. Pairing and trasnferring files it’ll do but not dial up networking. For that you’ll have to use the guide I found here, which worked perfectly on Ubuntu and so should also work for Jolicloud.

I’m really happy with the cabled operation. My Netbook, a first generation EEE PC 701 (with a RAM upgrade) doesn’t have bluetooth built in so instead of carrying around a bluetooth dongle I can just carry the phones USB cable instead. I’ll be using less power too without the unnecessary radio chatter.

I might actually have to do some tech support from Glastonbury this year so I’m glad this is working so well now.

Posted in Geekery | 1 Comment


beerandnoodles posted a photo:


Up late at the computer again.

Posted in flickr | Leave a comment