A Ruby interface to the GatherContent API

GatherContent is an awesome tool for planning, structuring and collaborating on web content (they have a short video demo).

They have a read-only API, but only a couple of implementations, so here is mine, in Ruby.

The API is read-only and HTTP POST-based, and so I use HTTParty to manage that side of things, and method_missing to emulate the relevant API calls, and then Hashie to convert the returned Hash into an object. It’s very simple, so give it a try.

Hosting your own calendar and contacts directory

Apparently there is a thing called ownCloud which lets you run, amongst other things, a calendar server and a contact directory, both of which will sync with your android phone and here is a writeup of doing just that. I’ve not tried it yet, but any option to prise the data away from Google and to something I own has to at least an option worth trying.

Configuring get_iplayer

There are lots of ways of setting up get_iplayer. Here’s mine.

It means that filenames work across Windows and Linux, removes underscores from names, never deletes old episodes and downloads episodes into a directory named after the series and names the files with the series’ episode number.

Your own options file is in ~/.get_iplayer or c:usersusername.get_iplayer depending on your operating system.

The merits of a bug database

Ladybug lost in Echinops Ritro

I just realised that we no longer have a functional bug database at work, meaning we have gone down by a point in the Joel Test.

We don’t produce a single product (unless you count “the website and the quarter of a million pages it contains” as a product) and in the past have created standalone Trac installs for the larger pieces of software infrastructure we’ve written, and used the bug tracker in that to manage progress. Typically we then reached either a quality or time threshold and regardless of what bugs were there, and it was time for the next project.

We then never came back to those projects, and the collected bugs and issues would sit there for years, collecting mental dust as we moved onto other projects, or enhancing other bits of the site, all of which had their own bugs too. This is quite a depressing state to be in, and although on rare occassions we bundled up some of this work into “technical debt” projects, the mental weight would carry on, and eventually our rapid pace between projects, and an improved in-project process meant that we were meeting our goals on each project, and moving to the next without tracking known issues in any way at all because, y’know, it served no purpose other than to make us sad.

This has to change.

Clearly we’re at the point where a different bugtracker per backend software product won’t cut it. We’ve tried Jira in the past, and although it does a lot, it’s probably too much for us. So what should we do instead? My thinking is to use a tool which is set up to track a single project, and we use categorisation and tagging to differentiate what area of the site, what aspect of the site, and what backend tools are relevant – this should allow us to slice and dice across tens of thousands of lines of JS, Java and PHP and probably millions of lines of HTML, with impunity. Issues can be collated and then bundled into projects which we manage separately. I’m definitely not thinking about todo-list management software like Trello!

My gut call is to go to Lightouse – but I’ve been out of the game for a while, have you got a recommendation, free or not, which might help us out? Let me know!

(I should note that this all occured to me when looking at a job opening at BERG. If it’s not closed by now, go have a look and work for the lovely, lovely people there!)

Raspberry Pi, my media centre at last

my raspberry pi is here

My Raspberry Pi has arrived, and not only is it one of the nice new rev2 hardware revisions, it’s also been manufactured in the UK, which if you’ve followed their trials, you’ll realise is a big deal.

Anyway, mine is here, and one short hunt for a spare SD card later I’d got the installation of RaspBMC, a port of XBMC, started. It took probably about ten minutes to complete, with no intervention from me.

Then I SSHd in (the default username is ‘pi’ and the password ‘raspberry’), and set about installing get_iplayer using these instructions. I had to also install make and gcc before rtmpdump would build but other than that it all worked perfectly. I plugged in my 500GB hard drive and I now have something which:

  • is a BBC PVR
  • is a good household-friendly playback device for recorded tv, films and music
  • can act as an AirPlay server for our iPad, iPhone and iPod touch
  • uses HDMI-CEC and therefore responds to my normal TV remote
  • can join my local network and play back media from other devices
  • probably loads more, I’ve only had a couple of hours!

Next step will be to get a suitable case. Maybe something custom etched?

Logging database content changes in a Play Framework app

To do this we use Hibernate Envers.

There are 3 easy steps to adding change logging to the data in your existing Play Framework app (I am using 1.2.4 – version 2 may well be different):

  1. Add the library
  2. Add the standard configuration
  3. Add an annotation to each class where you want to track data changes

Add the library in conf/dependencies.yml

    - play
    - play -> crud
    - org.hibernate -> hibernate-envers 3.6.1.Final:
            - org.hibernate -> hibernate-tools 3.2.0.ga
            - org.beanshell -> bsh 2.0b4
            - freemarker -> freemarker 2.3.8
            - org.hibernate -> jtidy r8-20060801
            - ant -> ant 1.6.5

Add the Envers configuration to conf/application.conf

# Hibernate Envers Auditing Library conf

Add an annotation to each class you want to audit

import org.hibernate.envers.Audited;

public class Book extends Model {
  public String title;
  public String author;
  public String description;

If you run up your app and make a change to an entity you will see a new table appear in your database. If your entity table is BOOK your new table will be BOOK_AUD. It contains a version reference (a normalised reference to a new revinfo table containing the timestamp of that audit entry) and the values of all the fields on the entity after the changes were saved.

You can go wild on the config by auditing only particular fields on an entity (just add @Audited to those fields), or adding new fields to the audit log (like who made the change or what method was called to do it), and change the name of table suffix.

It’s also quite simple to retrieve the list of versions, and this has been written up quite clearly by Matthieu Guillermin (it’s in French but Google Translate does a good job, and you can read the code anyway).

All of this information had already been written in several places, but hopefully this has brought it together in a useful way.

My config changes are from https://gist.github.com/1148850 and https://gist.github.com/1148852 by Marc Deschamps.

Samsung TV SDK – setting your project path

I have a Samsung Smart TV which means I can write apps for it. The SDK you can download is really a visual editor and a shorcut to launching the emulator – the apps themselves are mostly written in HTML, JavaScript and CSS. It comes with jQuery, and all-in-all is surprisingly acceptable.

The biggest problem is that your projects must live in the “C:Program FilesSamsungSamsung TV SDK(3.1.1)apps” folder. After a brief moment of outrage at not being able to store my code where I want, I found this blog post by Peter Friese which reminded me that Windows does actually support symlinks via the mklink tool – so running up command as the local Administrator, going to the Samsung SDK folder, deleting the apps folder (after first moving my code where I wanted it to be!) and typing

mklink /D apps c:codesamsung_tv_apps

has fixed my problem!

Devices in my house running WebKit

  • Android phone
  • Android tablet
  • iPod touch
  • iPhone
  • iPad
  • 2 x laptop (Windows Vista)
  • desktop (Ubuntu)
  • TV (Samsung)

The browser in my Nintendo DSlite and 3DS is Opera.

I don’t use the desktop version of Google Talk, nor Windows Media Player so my most frequent exposure to Trident is probably via Skype. I almost feel sorry for the Microsoft IE team. Almost.

Punished for being a good boy

My son is 2.5 years old. Two of his favourite TV programmes are Timmy Time and Octonauts . There are 78 episodes of Timmy Time and 52 episodes of Octonauts.

There is one DVD of Octonauts, which contains eight episodes. Another DVD is due next month containing another eight episodes. This will mean that 31% of this programme is available to buy.

There are eight Timmy Time DVDs totalling around 65 episodes. This means that around 83% of this programme is available to buy.

To my knowledge, the BBC have aired 100% of both these series.

A very quick look on popular, er, file distribution sites reveals about 50 episodes of Octonauts (96%), and I think every episode of Timmy Time (100%).

I want to buy stuff, and it isn’t even possible; yet it is available for free if I download it illegally. It’s been, what, five years now? Have we really not moved on?