Archive for April, 2010

WordPress Docs 29th Apr 10

With a couple of days between projects, I had a chance to work on my latest 20% project.

RailsAPI‘s sdoc format is very nice in that it allows searching over all methods and classes, and is generally an intuitive way of doing things.

WordPress is full of PHPDoc comments, the Codex is invaluable, and of course being able to read the source is absolutely necessary much of the time. All in all, WordPress is quite well documented, though there’s really no coherent place that brings that all together. So I am very happy to have this new tool available before my next WordPress jaunt: WordPress Docs.

Testimonial (DH, Peter Simmonds) 19th Apr 10

When I came across the Dextrous Web I was in a fix. My website needed migrating at the speed of light – and they saved my bacon. Throughout a hugely pressurised process, Dextrous Web remained constructive and good-humoured, offering sound advice and displaying reassuring mastery of their trade.

Peter Simmonds
Digital Project Manager
Department of Health

Posty – our new gem for geolocation in Ruby 13th Apr 10

Just last week Ordnance Survey released a tonne of data. This is of course a wonderful thing for everybody, and software making use of this data has only started appearing in the past week. This morning, in fact, we noticed a gem, pat by Stef Lewandowski which uses Pezholio/Stuart Harrison’s very useful UK Postcodes.

We took a look at it, and decided to make a gem that uses a local database (usually a bit faster than using a Web-based API), but which is similarly easy to use.

Three hours later, we present to you posty!

The data it provides from CodePoint Open is:

  • postcode
  • quality
  • latitude
  • longitude
  • country
  • nhs_region
  • nhs_health_authority
  • county
  • district
  • ward

In all these cases, rather than proving the name of the county/district/ward/etc, it only provides the identifier used in the data set. This is a case where UK Postcodes would be a better option.

To install it,

sudo gem install posty

To set up the database (which can be downloaded automatically from mySociety, or you can download the latest version yourself and use the -c option),

sudo posty-init -g

This should take about 8 minutes to load all the CSV into the database.

To use it,

require 'posty'
Posty.postcode('SE1 1EN')

If you’re going to be using it frequently from the same process, you should probably use the following instead,

require 'posty'
posty = Posty.new
postcode = posty.postcode('SE1 1EN')
postcode = posty.postcode('SE1 7PB')

The magick going on here is that the database is stored in the gem (in lib/posty/codepointopen.sqlite3), and then it’s available without having to connect manually.

Have a fiddle with posty and tell us what you think.

Testimonial: Consultation team (IPSA) 13th Apr 10

It’s not an exaggeration to say that we couldn’t have done this work without Dextrous Web, and it’s been a real pleasure working with you on both a professional and a personal level.

Consultation team
Independent Parliamentary Standards Authority

Finally: the new site is ready 12th Apr 10

It’s taken us a long time to get around to it, but we’ve finally managed to get our new site done. It’s strange, but as a web agency, your own site often seems to be the lowest priority. We’ve been busy with client work and short deadlines, and finding time for our own stuff has been pretty hard. We can thank Purdah for giving us a few days to finish it off!

There’s lots I didn’t like about the old site. It was never meant to last for long, but lingered for ages. It didn’t really describe us very well: we’ve been thinking about how and where we should fit into the UK’s digital landscape, but the site hasn’t been keeping pace with the ideas. We were overdue for a change.

This site isn’t finished: there’s more we want to add about us, our plans, our team and our ideas about building the kind of web supplier that Government needs and wants. But it’s better than what was here before, and hopefully introduces us a bit more clearly.

As always — if you have thoughts or ideas about the site, or us, or anything else, we’d love to hear them. Please do let us know what you think.

Migrating from Gitorious to Gitosis 12th Apr 10

Gitorious is very nice for social coding, and I thought it would be perfect for us at first. Apparently its git cloning is not quite adequate for us, as we need git pulling and git pushing and some of those cloning shouldn’t be able to write (such as deploy users).

Since we decided Gitorious wasn’t for us, we’ve just left it as it is (frequently restarting ActiveMQ and the poller, as they crash a lot). We just never had an excuse to spend the time to migrate until today when Gitorious broke completely for no apparent reason.

The process was fairly trivial, but I’ll share my code anyway as it was a somewhat interesting endeavour.

First of all then, Gitorious stores its repositories in quite an annoying way if you want to get at them outside of Rails. It stores them as some kind of hash, but split up to prevent the directories from containing trillions of entries. For instance, git@thedextrousweb.com:wordpress-plugins/wp-recaptcha is stored in /var/git/repositories/e27/004/48f5b0e17f3403aa15efd0ea8d47ce874a.git. The database then holds a mapping from the human-readable path to the actual path.

Gitosis, on the other hand, uses a mapping from wordpress-plugins/wp-recaptcha to ~/repositories/wordpress-plugins/wp-recaptcha.git, which is much more obvious.

So we need the mapping, for which we shall have to prod Rails’ database:

require File.dirname(__FILE__) + '/../config/environment'
Repository.all.each do |r|
  name = r.project.slug + '/' + r.name
  path = r.hashed_path
  puts "#{path} #{name}"
end

All that does is prints out the physical path to the repository, followed by the human-readable path, separated by a space. So redirect that to some file, and enter gitosis’ repository directory (possibly as the git user, or chown -R later). I’ll be using grep -v wiki here because we never used the wikis. So we first create the directories because git won’t mkdir -p:

grep -v wiki files | cut -d' ' -f2 | cut -d/ -f1 | sort | uniq | xargs mkdir

And rather than using cp -R or rsync, I thought it would be best to let git do the job:

grep -v wiki files | perl -pe 's/ /.git /;s/^/git clone --mirror \/var\/git\/repositories\//;s/$/.git/' | sh

Since we’ve only got a few users, we’re not going to bother importing all the users and groups, so we can just cut the list of repositories, remove the newlines, and append it to our writeable.

Testimonial: Emma Mulqueeny 10th Apr 10

From the moment I met Dextrous Web, I was delighted that people as talented and committed to agile web development had decided to brave the task of applying their talents to the public sector. To date, the Dextrous Web have perpetuated that delight by sponsoring and participating in events like Rewired State, contributing to government IT strategy and actively delivering against their promise.

Emma Mulqueeny
Rewired State

Categories

Recommended reading

  • A selection of interesting links. Refresh to see more
  • Digigov @ COI These guys set cross-government digital policy. Lots of interesting things.
  • Steph Gray Commissions, manages and deploys innovative tools within Government — and really understands what’s needed
  • Paul Clarke Insightful, sensible and useful.
More »