Skip navigation

  Help us to make more
useful things.
Donate to mySociety

Would you like to work with the team that built all these sites? We’re recruiting.

mySociety blog » archive for 2005

Drinks for Bloggers

Monday, December 19th, 2005 by Tom Steinberg

mySociety is really keen to know what we can build, modify or improve to make our services more useful to people who run blogs. We’ve not really done any work on things like banners, buttons, postcode boxes or interesting snippets of free HTML to make our work more attractive to stick down the side of blogs, and we’d like to hear what we could do.

So, if you’re in London, join us in the Dover Castle tomorrow night (Tuesday 20th December 2005) from 7.30PM, or simply drop us an email with suggestions. We’ll even take suggestions for our non-mySociety sister sites TheyWorkForYou.com and Publicwhip.org.uk too.

Debian archive

Friday, December 16th, 2005 by Francis Irving

(Shh, don’t tell anyone, but this post is really just so the bots find debian.mysociety.org, but I’m going to try and fill it with some other content so you don’t think I’m being too rude)

Debian’s software “packaging” system provides a big database of all the open source software in the world, and makes another smaller database of all the software installed on your computer. We’re using it on our new servers, which the sites are gradually migrating to now. When you’ve got security updates, multiple machines, and complex software dependencies, you need it.

Unfortunately, though it seems like the Debian people have packaged nearly all the software in the world, sometimes they miss things. Normally we’d just install them using the old Unix configure/make/make install. This time we’ve decided to do it properly, and make our own Debian packages. You can find them at debian.mysociety.org.

The advantage of this is that we can find out where any file on the system came from. We can easily upgrade multiple machines, and check that they all have the same software installed. This makes it much less likely that there’ll be bugs when you go to a corner of one of the websites, and get an error because a perl module wasn’t installed.

So far there are a few perl module .deb files in our repository, which the handy dh-make-perl builds easily from a perl module tarball. There’s also Xapian (a search engine library), which we use for quick lookups in Gaze (our gazeteer). That had already been packaged by the Xapian people, but for some reason I had to recompile it. Finally there’s one Python module, PyRTF, which makes Python modules, which I just packaged (probably badly).

Anyway, this post is here to make sure anybody searching for python2.3-pyrtf on Google will find something…

Make a New Years’ Resolution to Help mySociety

Friday, December 16th, 2005 by Tom Steinberg

As mySociety approaches the end of it’s first full year in operation, one of our volunteers, Sam, has created a pledge to encourage other people to volunteer for mySociety. It isn’t just for coders too – if you have a spine and opposable thumbs there’s always something to be done!

Now, I might be a bit biased, but I see mySociety as one big happy family of core developers, volunteers, friends and assorted hanger-on-ers who do what they do because it is both challenging and morally rewarding. If you want a new years’ resolution that you’ll be glad to keep, sign the pledge.

Ongoing gnuplot tutorial

Monday, December 12th, 2005 by Francis Irving

Next version, following more comments from Chris:

I had a couple of problems with this. Firstly I couldn’t make the ytics have “lt 1″ – they came out as black, whereas the plot line comes out as red. So I changed them to use “lt 2″ and “lt 3″ instead (green and blue).

Secondly, the marker for “official launch” looks a bit nasty. The ilne gets jammed up against the vertical spike of the event. I think it might look better if it was layered on top of the spike on the section where they overlap exactly, but I’m not sure.

Thirdly, what was the spike in late June? I completely can’t remember.

Help build WriteToThem in Ireland

Monday, December 12th, 2005 by Tom Steinberg

The lovely John Handelar is having a go at migrating WriteToThem.com to Ireland. See his latest blog update to find out how things are going, and lend him a hand!

A prettier graph

Saturday, December 10th, 2005 by Francis Irving

After following nearly all of Chris’s advice, I’ve ended up with a much prettier graph.

Ah gnuplot! Love of my life. Scourge of Excel. Well, OK, maybe I don’t feel exactly like that, but if you’re comfortable with the shell it’s much easier to make a graph than in Excel.

Esperanto

Friday, December 9th, 2005 by Matthew Somerville

PledgeBank is now available in Esperanto. Getting this translation up and running was very instructive. During the process, we found numerous strings missed from the translation file, a variety of interesting bugs, and had to make various improvements all over the place (things that are the same in English whether something is singular or plural are not so in other languages, and the fonts that we use for PDF posters don’t contain the glyphs needed, to name but two examples).

From a technical point of view, we now have a suite of scripts that bring our main .po file up to date with what’s currently on the site (including coping with oddities like email templates, JavaScript text), merge this in with the translations that already exist (so nothing is lost), and update everything on the site, giving stats of how much has been translated in a particular language. Very handy.

Many thanks go to Tim Morley, the translator, who now finds himself having to respond to any Esperanto contact emails we get (sorry!) :)

Spanish also went live recently (thanks Hugo!), Russian and Ukranian are both near completion, German is on its way, and there are others we’ve heard about too, like Greek and Polish.

And a graph…

Thursday, December 8th, 2005 by Francis Irving

Since no day is complete without a graph.

HearFromYourMP signups

(As you can see I’ve been learning gnuplot, although I’m not as good as Chris yet. gnuplot is actually quite good.)

Phew!

Thursday, December 8th, 2005 by Francis Irving

It’s very quiet today. I’ve been updating the projects page now that HearFromYourMP is truly launched. This means we’ve built all the original launch projects, except GiveItAway (more about what is happening with that another time). And it’s over a year since mySociety began. I feel exhausted, and definitely need to take some holiday – I was going to go to Egypt last month, but moved house instead.

This week was usability week. Or was that last week, I’ve got confused. Anyway, Tom made about a million tickets with little usability tweaks to all the sites. Most of these have been put in now, but there’s still lots to do. Good software is about polish polish polish polish, and more polish. I could spend another few years just polishing these sites without making any more.

I’ve also been doing a bit of work on “cobranding”. An ugly marketing term, but there you go. We’ve had a Cheltenham version of WriteToThem for some time. As well as local government, we’re also looking at campaigns groups. So we’ve done a version for AnimalAid, which they’ll be using from their website soon. Apart from the logo and colours, cobranding has some benefits for the user. It’ll make them think they haven’t changed website, and be less disconcerting. In particular, it’ll take them back to other campaigns actions when they’re done.

More on customary proximity

Thursday, December 1st, 2005 by Chris Lightfoot

And a follow-up to my last post: the population density and customary proximity APIs are now available in Gaze. The additional APIs are:

get_population_density
Parameters:

lat
WGS84 latitude, in decimal degrees
lon
WGS84 longitude, in decimal degrees

Return an estimate of the population density at (lat, lon), in persons per square kilometer, as a decimal number followed by a line feed.

get_radius_containing_population
Parameters:

lat
WGS84 latitude, in decimal degrees
lon
WGS84 longitude, in decimal degrees
number
number of persons
maximum
largest radius returned, in kilometers; optional; default 150

Return an estimate of the smallest radius around (lat, lon) containing at least number persons, or maximum, if that value is smaller, as a decimal number followed by a line feed.

For instance,

Enjoy! Questions and comments to chris@mysociety.org, please.

Population density and customary proximity

Wednesday, November 30th, 2005 by Chris Lightfoot

… or, “how near is ‘nearby’?”

On PledgeBank we offer search and local alert features which will tell users about pledges which have been set up near them, the idea being that if somebody’s organising a street party in the next street over, you might well want to hear about it, but if it’s somebody a thousand miles away, you probably don’t.

At the moment we do this by gathering location data from pledge creators (either using postcodes, or location names via Gaze), and comparing it to search / alert locations using a fixed distance threshold — presently 20km (or about 12 miles). This works moderately well, but leads to complaints from Londoners of the form “why have I been sent a pledge which is TEN MILES away from me?” — the point being that, within London, people’s idea of how far away “nearby” things is is quite different from that of people who live in the countryside — they mean one tube stop, or a few minutes’ walk, or whatever. If you live in the countryside, “nearby” might be the nearest village or even the nearest town.

So, ages ago we decided that the solution to this was to find some population density data and use it to produce an estimate for what is “nearby”, defined as, “the radius around a point which contains at least N people”. That should capture the difference between rural areas and small and large towns.

(In fairness, the London issue could be solved by having the code understand north vs south of the river as a special case, and never showing North-Londoners pledges in South London. But that’s just nasty.)

Unfortunately the better solution requires finding population density data for the whole world, which is troublesome. There seem to be two widely-used datasets with global coverage: NASA SEDAC’s Gridded Population of the World, and Oak Ridge National Laboratory’s Landscan database. GPW is built from census data and information about the boundaries of each administrative unit for which the census data is recorded, and Landscan improves on this by using remote-sensing data such as the distribution of night-time lights, transport networks and so forth.

(Why, you might wonder, is Oak Ridge National Laboratory interested in such a thing? It is, apparently, “for estimating ambient populations at risk” from natural disasters and whatnot. That’s very worthy, but I can’t help but wonder whether the original motivation for this sort of work may have been a touch more sinister. But what do I know?)

Anyway, licence terms seem to mean that we can use the GPW data and we can’t use the Landscan data, which is a pity, since the GPW data is only really very good in its coverage of rich western countries which produce very detailed census returns on, e.g., a per-municipality basis. Where census returns are only available on the level of regions, the results are less good. Anyway, subject to that caveat, it seems to solve the problem. Here’s a map showing a selection of points, and the circles around them which contain about 200,000 people (that seems to be about the right value for N):

Map showing example proximity circles

The API to access this will go into the Gaze interface, but it’s not live yet. I’ll document the RESTful API when it is.

One last note, which might be of use to people working with the GPW data in the future. GPW is a cell-based grid: each cell is a region lying between two lines of longitude and two lines of latitude, and within each cell three variables are defined: the population in the cell, the population density of the cell, and the land area of the cell. (This is one of those rare exceptions described in to Alvy Ray Smith’s rant, A Pixel Is Not A Little Square….) But note that the land area is not the surface area of the cell, and the population density is not the population divided by the surface area of the cell!

This becomes important in the case of small islands; for instance (a case I hit debugging the code) the Scilly Isles. The quoted population density for the Scilly Isles is rather high: somewhere between 100 and 200 persons/km2, but when integrating the population density to find the total population in an area, this is absolutely not the right value to use: the proper value there is the total population of a cell, divided by its total surface area. The reason for that is that when sampling from the grid to find the value of the integrand (the population density) you don’t know, a priori, whether the point you’re sampling at has landed on land or non-land, but the quoted population density assumes that you are always asking about the land. When integrating, the total population of each cell should be “smeared out” over the whole area of the cell. If you don’t do this then you will get very considerable overestimates of the population in regions which contain islands.

We launched HearFromYourMP.com

Tuesday, November 22nd, 2005 by Tom Steinberg

Best comment so far:

“Those terribly terribly clever MySociety chaps have been drinking their fortifyingly strong tea again. They’ve cogitated and coded, and come up with HearFromYourMP.com. Read the page – it’s so simple, one wonders how it can possibly be a new thing.

Dashed clever. Bravo!”

Thanks Jonathan!, such things make us happy. And when we are happy, we build more cool stuff.

HearFromYourMP.com

Monday, November 21st, 2005 by Tom Steinberg

Please give a warm welcome to our last major project of 2005 – HearFromYourMP.com. This one’s all about improving long term relationships between MPs and constituents by giving both an easy, trusted way of discussing local issues. For more info on how it works, see this explanation on the site, then stick down your details and get involved. Thanks must go not just to the ever hard-working developers, but also to the 8MPs who used the system whilst it was in testing.

Next up: HearFromYour Other Representatives!

Well, I’ve got a bit of time…

Friday, November 18th, 2005 by Matthew Somerville

…and I think I’ve ignored the last two or three “hassle”s I’ve received. :)

Over the last few weeks, I have been working on improving PledgeBank’s translations – Welsh has gone live, Russian is coming along very well, and German and Spanish too – and using feedback from the translators to help make the translation .po files complete (making sure they even include strings used in our JavaScript, and adding any strings accidentally missed out). I’ve also been working on HearFromYourMP, which though currently live and with initial MP messages, is having its “launch” on Monday in the Houses of Parliament – quite exciting. So today I’m watching out for anything going wrong (we moved the site to a brand new server yesterday), tweaking the text and emails, adding some more features, and making sure everything is generally ship-shape.

We’re all too busy…

Friday, November 18th, 2005 by Francis Irving

…testing stuff for the launch on Monday to post anything more!

Changing language twice with gettext

Tuesday, November 8th, 2005 by Francis Irving

PledgeBank is quite an unusual site. Many international websites simply need translation (e.g. Debian in Chinese), there aren’t any data items which vary between regions. Others have multiple international markets, with a special website tweaked for each one (for example Amazon in Canada, which has some French and English text on every page).

PledgeBank is slightly different. First of all the interface needs translating into other languages, like Debian. And we don’t quite have markets like Amazon. Partly this is because we don’t yet know what our markets are, so we just make sites for every country and language combination. We have pledges, which have both a local area and a language associated with them. We’ve also got global pledges.

All this means that sometimes pledges and text in multiple languages gets shown on one page. For example, if your browser is configured for the Brazilian language, and you are in Brazil, then www.pledgebank.com will look like this. At the time of writing there is only one Brazilian pledge, so below it we show some global pledges in English as examples.

We use some software called GNU gettext to do our translations. Obviously, I’m not telling the truth – people do the translation, gettext just substitutes the translations into the pages. It’s a great piece of software, simple, old, well used and supported, with good tools for translators to update translations with.

For some time there’s been a bug in PledgeBank. On certain pages the language can change back and forth several times, and gettext would start returning translations for earlier languages rather than the current one. I’m setting the LANG environment variable to tell it what language to use. After much debugging and an email to GNU, it turns out that this is to do with gettext’s cache. The cache was behaving differently on FreeBSD and Linux, which was confusing me even more.

To clear the cache you rebind the text domain, that is call textdomain(textdomain(NULL)), after changing the environment variable. This makes everything work happily everywhere. And the main point of this post is to get that nugget into search engines, so anybody else with the same problem has a hope of finding out..

How we learn to stop worrying and love statistics

Monday, October 31st, 2005 by Chris Lightfoot

Just a brief one today. MORI has recently done a poll chiefly on the subject of Britain’s nuclear deterrent. Now, here at mySociety we don’t have any political views, so no comments on The Bomb itself; but MORI did ask another question which intrigued me:

And which, if any of the things on this list have you done in the last two or three years?

What How many
Presented my views to a local councillor or MP 14
Written a letter to an editor 6
Urged someone outside my family to vote 16
Urged someone to get in touch with a local councillor or MP 12
Made a speech before an organised group 11
Been an officer of an organisation or club 8
Stood for public office 1
Taken an active part in a political campaign 3
Helped on fund raising drives 20
Voted in the last general election 68

So, 14% of British adults have “presented [their] views to” a councillor or MP in the past 2–3 years. I presume most people will have interpreted the question as including writing to their MPs; that gives us something like 6 million letter-writers over that period. On WriteToThem, about 75% of messages are for MPs, so if those 6 million people sent one letter each over the three years, that works out as about 2,000 messages/year/MP, or about ten per working day.

That’s a lot lower than typical estimates I’ve heard (~50/day/MP). Of course, the poll asked about people rather than letters, so doesn’t account for people sending several letters over the given time period. However, judging by the WriteToThem data, that’s not all that significant an effect:
Plot of number of letters per author in WriteToThem
– something like 90% of letters sent through WriteToThem to MPs and councillors are the only ones sent by that author. (Note that this measurement is quite crude; in particular, I have identified two letters as being from the same author if they share a common email address. Also, since we remove all personal data about authors from messages after a little while, it only shows a few weeks’ worth of data. A further complication is that if an MP or councillor responds by email and the constituent sends a further email, they’re likely to do it by replying to the email, so not showing up as a further communication on that plot.)

Anyway, if the crude data from WriteToThem are characteristic of all mail received by councillors and MPs, then MORI’s estimate of the number of people communicating with their MPs seems pretty low. Thoughts?

Working in Cambridge cafe CB2

Thursday, October 27th, 2005 by Francis Irving

Lots of stuff happening here.

Earlier in the week, I’ve been getting WriteToThem to update more of its data automaticaly. Two volunteers contributed useful screen scrapers. Richard George’s gathers data from the Welsh assembly, and Jonathan Hogg’s screen scrapes the Scottish Parliament. They both spit out CSV files with representatives, constituencies and contact emails/faxes. I’ve now updated the script that can load in those CSV files, and set it all running once a week on cron. Along with another London Assembly scraper Chris wrote earlier in the year, and some code to get MPs from parlpase.

Today I’ve been doing other bits, including improving the link from WriteToThem to HearFromYourMP. When somebody has confirmed a message to be sent with WriteToThem, we know their email address is valid. So, why if they follow the link to HearFromYourMP do they have to confirm again? It’s bad user interface, and is probably reducing our signups to HearFromYourMP a bit.

The fix is to pass a signed email address through from WTT, and check the signature on HFYMP. The magic of hashes and shared secrets does the job.

Starting on GiveItAway

Monday, October 17th, 2005 by Chris Lightfoot

So, right now I’m working on the first draft of mySociety’s fifth ODPM-funded project, GiveItAway. The site will let users tell local charities about stuff they want to get rid of but which might still be useful; in its first draft we’re going to aim for the simplest possible interface, partly because that’s the sort of interface we like, and partly because there are already other sites which address this sort of problem. There’s no point in pouring effort into the thing if we can’t do anything better than existing competitors, after all. More later in the week, anyway.

See you at the Headstar e-Democracy 05 conference?

Thursday, October 13th, 2005 by Tom Steinberg

We’ve been invited to appear at Headstar’s e-Democracy 05 Conference on 9th November. A quick look at the agenda suggests it’ll be a good chance to get up to date on the various government and non-government parts of the UK edemocracy scene. Watch out for us by the big green mySociety logo! more details here.


News & information:
Projects:
Keep in touch:
Technical:

mySociety is a project of UK Citizens Online Democracy (UKCOD). UKCOD is a registered charity in England and Wales, no. 1076346. Its company number is 03277032, and mySociety Ltd's is 05798215.