<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>mySociety &#187; Technical</title>
	<atom:link href="http://www.mysociety.org/category/technical/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mysociety.org</link>
	<description>Relentless user-focus on civic websites</description>
	<lastBuildDate>Thu, 09 Feb 2012 18:07:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.5</generator>
		<item>
		<title>Own a piece of mySociety: servers to give away</title>
		<link>http://www.mysociety.org/2011/10/13/we-have-servers-to-give-away/</link>
		<comments>http://www.mysociety.org/2011/10/13/we-have-servers-to-give-away/#comments</comments>
		<pubDate>Thu, 13 Oct 2011 14:50:50 +0000</pubDate>
		<dc:creator>Abi Broom</dc:creator>
				<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://www.mysociety.org/?p=4792</guid>
		<description><![CDATA[After several years of hosting, mySociety has migrated out of Easynet&#8217;s Brick Lane Data Center, and we now live on virtual machines hosted at a top secret location in the north of England. Most of our old hardware is no longer in use. It’s redundant. We don’t need it any more. But we don’t want [...]]]></description>
			<content:encoded><![CDATA[<p>After several years of hosting, mySociety has migrated out of Easynet&#8217;s Brick Lane Data Center, and we now live on virtual machines hosted at a top secret location in the north of England. Most of our old hardware is no longer in use. It’s redundant. We don’t need it any more. But we don’t want to throw it all in a skip, that would be terrible.</p>
<p>Sooo&#8230; we’d like to find a lovely new home for it all. And this unique opportunity to own a piece of mySociety may be of interest to YOU.</p>
<p><s>Here are the technical details of the various machines we are getting rid of &#8211; check it out for what&#8217;s currently available.</s></p>
<h3><span style="color: #ff6600;">Update: all gone!</span></h3>
<p>The Rules:</p>
<p>1. The servers <strong>don’t come with disks</strong>: as part of our privacy procedures, all disks have been removed and destroyed to protect our and our users’ data.</p>
<p>2. You’ll need to be able to <strong>pick them up ASAP</strong> from a central London location <strong>(WC2)</strong>.</p>
<p>3. You&#8217;ll need to be available to do so <strong>during office hours</strong> or very shortly afterwards (evenings or weekends aren&#8217;t possible, sorry).</p>
<p>4. Note that they are <strong>large and heavy</strong> so you may well need a <strong>car</strong>.</p>
<p>For more information, or even better, if you&#8217;re thinking &#8220;Sold!  I&#8217;ll take the lot!&#8221;, then get in touch with Abi, our friendly office manager, on <a href="mailto:hello@mysociety.org">hello@mysociety.org</a>.</p>
<p>If you feel guilty about relieving a registered charity of its assets, you can even make us a <a href="http://www.mysociety.org/donate/">donation</a> (voluntary, but we’d be appropriately grateful).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mysociety.org/2011/10/13/we-have-servers-to-give-away/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Technical look at the new FixMyStreet maps</title>
		<link>http://www.mysociety.org/2011/07/08/technical-fixmystreet-maps/</link>
		<comments>http://www.mysociety.org/2011/07/08/technical-fixmystreet-maps/#comments</comments>
		<pubDate>Fri, 08 Jul 2011 00:37:08 +0000</pubDate>
		<dc:creator>Matthew Somerville</dc:creator>
				<category><![CDATA[FixMyStreet]]></category>
		<category><![CDATA[Free Data]]></category>
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://www.mysociety.org/?p=4297</guid>
		<description><![CDATA[This post explains how various aspects of the new FixMyStreet maps work, including how we supply our own OS StreetView tile server and how the maps work without JavaScript. Progressive enhancement During our work on FiksGataMi (the Norwegian version of FixMyStreet) with NUUG, we factored out the map code (for the Perlmongers among you, it&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>This post explains how various aspects of the <a href="http://www.mysociety.org/2011/07/07/fixmystreet-new-features/">new FixMyStreet maps</a> work, including how we supply our own OS StreetView tile server and how the maps work without JavaScript.</p>
<h2>Progressive enhancement</h2>
<p>During our work on <a href="http://www.fiksgatami.no/">FiksGataMi</a> (the Norwegian version of FixMyStreet) with <a href="http://www.nuug.no/">NUUG</a>, we factored out the map code (for the Perlmongers among you, it&#8217;s now using Module::Pluggable to pick the required map) as FiksGataMi was going to be using OpenStreetMap, and we had plans to improve our own mapping too. Moving to OpenLayers rather than continuing to use our own slippy map JavaScript dating from 2006 was an obvious decision for FiksGataMi (and then FixMyStreet), but FixMyStreet maps have always been usable without JavaScript, utilising the ancient HTML technology of image maps to provide the same functionality, and we wanted to maintain that level of universality with OpenLayers. Thankfully, this isn&#8217;t hard to do &#8211; simply outputting the relevant tiles and pins as part of the HTML, allowing latitude/longitude/zoom to be passed as query parameters, and a <a href="https://github.com/mysociety/fixmystreet/blob/e10df38e15cda1c4351eea7b260739cbd038b423/perllib/FixMyStreet/Map/OSM.pm#L196">bit of maths</a> to convert image map tile clicks to the actual latitude/longitude selected. So if you&#8217;re on a slow connection, or for whatever reason don&#8217;t get the OpenLayers JavaScript in some way, the maps on FixMyStreet should still work fine. I&#8217;m not really aware of many people who use OpenLayers that do this (or indeed any JavaScript mapping API), and I hope to encourage more to do so by this example.</p>
<h2>Zooming</h2>
<p>We investigated many different maps, and as I wrote in my <a href="http://www.mysociety.org/2011/07/07/fixmystreet-new-features/">previous blog post</a>, we decided upon a combination of OS StreetView and Bing Maps&#8217; OS layer as the best solution for the site. The specific OpenLayers code for this (which you can see in <a href="https://github.com/mysociety/fixmystreet/blob/e10df38e15cda1c4351eea7b260739cbd038b423/web/js/map-bing-ol.js">map-bing-ol.js</a> is not complicated (as long as you don&#8217;t leave in superfluous commas breaking the site in IE6!) &#8211; overriding the getURL function and returning appropriate tile URLs based upon the zoom level. OpenLayers 2.11 (due out soon) will make using Bing tiles even easier, with its own seamless handling of them, as opposed to my slight bodge with regard to attribution (I&#8217;m displaying all the relevant copyright statements, rather than just the one for the appropriate location and zoom level which the new OpenLayers will do for you). I also had to tweak bits of the OpenLayers map initialisation so that I could restrict the zoom levels of the reporting map, something which again I believe is made easier in 2.11.</p>
<h2>OpenStreetMap</h2>
<p>Having pluggable maps makes it easy to change them if necessary &#8211; and it also means that for those who wish to use it, we can provide an <a href="http://osm.fixmystreet.com/">OpenStreetMap version of FixMyStreet</a>. This works by noticing the hostname and overriding the map class being asked for; everything necessary to the map handling is contained within the module, so the rest of the site can just carry on without realising anything is different.</p>
<h2>OS StreetView tile server</h2>
<p>Things started to get a bit tricky when it came to being ready for production. In development, I had been using http://os.openstreetmap.org/ (a service hosted on OpenStreetMap&#8217;s development server) as my StreetView tile server, but I did not feel that I could use it for the live site &#8211; OpenStreetMap rightly make no reliability claims for it, it has a few rendering issues, and we would probably be having quite a bit of traffic which was not really fair to pass on to the service. I wanted my own version that I had control over, but then had a sinking feeling that I&#8217;d have to wait a month for something to process all the OS TIFF files (each one a 5km square) into millions and millions of PNG tiles. But after many diversions and dead ends, and with thanks to a variety of helpful web pages and people (<a href="http://andrewl.net/map/ordnance-survey-rasters-mapserver-tilecache">Andrew Larcombe&#8217;s guide</a> to his similar install was helpful), I came up with the following working on-demand set-up, with no pre-seeding necessary, which I&#8217;m documenting in case it might be useful to someone else.</p>
<p>Requests come in to our tile server at tilma.mysociety.org, in standard OSM/Google tile URL format (e.g. <a href="http://b.tilma.mysociety.org/sv/16/32422/21504.png">http://tilma.mysociety.org/sv/16/32422/21504.png</a>. Apache passes them on to TileCache, which is set up to cache as GoogleDisk (ie. in the same format as the URLs) and to pass on queries as WMS internally to MapServer using this layer:</p>
<pre>[sv]
type=WMS
url=path/to/mapserv.fcgi?map=os.map&#038;
layers=streetview
tms_type=google
spherical_mercator=true</pre>
<p>MapServer is set up with a Shapefile (generated by <a href="http://www.gdal.org/gdaltindex.html">gdaltindex</a>) pointing at the OS source TIFF and TFW files, meaning it can map tile requests to the relevant bits of the TIFF files quickly and return the correct tile (<a href="https://secure.mysociety.org/cvstrac/fileview?f=mysociety/services/TilMa/web/os.map">view MapServer&#8217;s configuration</a> &#8211; our tileserver is so old, this is still in CVS). The OUTPUTFORMAT section at the top is to make sure the tiles returned are anti-aliased (at one point, I thought I had a choice between waiting for tiles to be prerendered anti-aliased, or going live with working but jaggedy tiles &#8211; thankfully I persevered until it all worked :) ).</p>
<h2>Other benefits of OpenLayers</h2>
<p>As you drag the map around, you want the pins to update &#8211; the original OpenLayers code I wrote used the Markers layer to display the pins, which has the benefit of being simple, but doesn&#8217;t fit in with the more advanced OpenLayers concepts. Once this was switched to a Vector layer, it now has access to the BBOX strategy, which just needs a URL that can take in a bounding box and return the relevant data. I created a subclass of OpenLayers.Format.JSON, so that the server can return data for the left hand text columns, as well as the relevant pins for the map itself.</p>
<p>Lastly, using OpenLayers made adding KML overlays for wards trivial and made those pages of the site much nicer. The code for displaying an area from MaPit is as follows:</p>
<pre>    if ( fixmystreet.area ) {
        var area = new OpenLayers.Layer.Vector("KML", {
            strategies: [ new OpenLayers.Strategy.Fixed() ],
            protocol: new OpenLayers.Protocol.HTTP({
                url: "/mapit/area/" + fixmystreet.area + ".kml?simplify_tolerance=0.0001",
                format: new OpenLayers.Format.KML()
            })
        });
        fixmystreet.map.addLayer(area);
        area.events.register('loadend', null, function(a,b,c) {
            var bounds = area.getDataExtent();
            if (bounds) { fixmystreet.map.zoomToExtent( bounds ); }
        });
    }
</pre>
<p>Note that also shows a new feature of <a href="http://mapit.mysociety.org/">MaPit</a> &#8211; being able to ask for a simplified KML file, which will be smaller and quicker (though of course less accurate) than the full boundary.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mysociety.org/2011/07/08/technical-fixmystreet-maps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Job Advert: Developers &#8211; Deadline 21st Feb</title>
		<link>http://www.mysociety.org/2010/12/08/job-advert-developers/</link>
		<comments>http://www.mysociety.org/2010/12/08/job-advert-developers/#comments</comments>
		<pubDate>Wed, 08 Dec 2010 15:47:24 +0000</pubDate>
		<dc:creator>Tom Steinberg</dc:creator>
				<category><![CDATA[Developers]]></category>
		<category><![CDATA[Job adverts]]></category>
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://www.mysociety.org/?p=3774</guid>
		<description><![CDATA[How would you like to be a coder in an organisation that is as determined to make a difference in the world as it is to be a truly high quality, engineer-led software team? mySociety is that organisation. We’re a project of a registered charity, currently running award-winning civic and democratic websites like TheyWorkForYou.com and [...]]]></description>
			<content:encoded><![CDATA[<p>How would you like to be a coder in an organisation that is as determined to make a difference in the world as it is to be a truly high quality, engineer-led software team?</p>
<p>mySociety is that organisation. We’re a project of a registered charity, currently running award-winning civic and democratic websites like <a href="http://theyworkforyou.com">TheyWorkForYou.com</a> and <a href="http://fixmystreet.com">FixMyStreet.com</a>,  and we’re looking to grow our already-celebrated development team by several new members over the next six months.</p>
<p>We’re looking for people with at least two years experience (professional or keen amateur) in at least one of Python, Ruby, Perl, PHP, C++, Javascript or Adobe Flex, and who have ambitions to learn more languages in the future.</p>
<p>We’re looking for developers willing to commit to full or mostly-full time positions (no freelancers, sorry) and who are up for a career change that will see them stay with us for a little while. You’ll get to work with volunteers, mix commercial and charitable projects, and travel far and wide. Plus, you can work from wherever you live (in the UK), and we pay salaries from £28k to £50k depending on skills.</p>
<p>Most of all, we’re looking for coders who look at the services we have built so far and think “I wish I’d been on that project”. Projects you&#8217;ll likely be working on over the next few months include (but are not limited to):</p>
<ul>
<li>A/B testing and conversion tracking of our charitable sites</li>
<li>Commercial spinoffs from FixMyStreet</li>
<li>Mapumental</li>
<li>Enhancements to TheyWorkForYou and WhatDoTheyKnow</li>
<li>Commercial development for clients</li>
</ul>
<p>We’re looking to speak with possible candidates continually over the next few months, with a view to hiring two developers now and two more later in the year.  Please send us your CV if you&#8217;re interested &#8211; the address is <a href="mailto:hello@mysociety.org">hello@mysociety.org</a> and the subject line needs to be msjob6.  The first round closing date is 10am on Monday 21st February, but CVs received after this deadline will still be considered for the next round of hiring.</p>
<p>And if you’ve any questions, please post them in the comments below so we can share the answers.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mysociety.org/2010/12/08/job-advert-developers/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>New features on MaPit</title>
		<link>http://www.mysociety.org/2010/10/06/new-features-on-mapit/</link>
		<comments>http://www.mysociety.org/2010/10/06/new-features-on-mapit/#comments</comments>
		<pubDate>Wed, 06 Oct 2010 13:17:10 +0000</pubDate>
		<dc:creator>Matthew Somerville</dc:creator>
				<category><![CDATA[Developers]]></category>
		<category><![CDATA[Launches]]></category>
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://www.mysociety.org/?p=3715</guid>
		<description><![CDATA[li { margin-bottom: 1em; } We&#8217;ve added a variety of new features to our postcode and point administrative area database, MaPit, in the past month &#8211; new data (Super Output Areas and Crown dependency postcodes), new functionality (more geographic functions, council shortcuts, and JSONP callback), and most interestingly for most people, a way of browsing [...]]]></description>
			<content:encoded><![CDATA[<style type="text/css">li { margin-bottom: 1em; }</style>
<p>We&#8217;ve added a variety of new features to our postcode and point administrative area database, <a href="http://mapit.mysociety.org/">MaPit</a>, in the past month &#8211; new data (Super Output Areas and Crown dependency postcodes), new functionality (more geographic functions, council shortcuts, and JSONP callback), and most interestingly for most people, a way of browsing all the data on the site.</p>
<ul>
<li>Firstly, we have some <strong>new geographic functions</strong> to join touches &#8211; overlaps, covered, covers, and coverlaps. These do as you would expect, enabling you to see the areas that overlap, cover, or are covered by a particular area, optionally restricted to particular types of area. &#8216;coverlaps&#8217; returns the areas either overlapped or covered by a chosen area &#8211; this might be useful for questions such as &#8220;Tell me all the <a href="http://mapit.mysociety.org/area/2528/coverlaps.html?type=WMC">Parliamentary constituencies fully or partly within the boundary of Manchester City Council</a>&#8221; (three of those are entirely covered by the council, and two overlap another council, Salford or Trafford).</li>
<li>As you can see from that link, nearly everything on MaPit now has an <strong>HTML representation</strong> &#8211; just stick &#8220;.html&#8221; on the end of a JSON URI to see it. This makes it very easy to explore the data contained within MaPit, linking areas together and letting you view any area on Google Maps (e.g. <a href="http://mapit.mysociety.org/area/2600.html">Rutland Council</a> on <a href="http://maps.google.co.uk/maps?q=http://mapit.mysociety.org/area/2600.kml">a map</a>). It also means <a href="http://mapit.mysociety.org/postcode/SW1A1AA.html">every postcode has a page</a>.</li>
<li>From a discussion on our mailing list started by Paul Waring, we discovered that the NSPD &#8211; already used by us for Northern Ireland postcodes &#8211; also contains <strong>Crown dependency postcodes</strong> (the Channel Islands and the Isle of Man) &#8211; no location information is included, but it does mean that given something that looks like a Crown dependency postcode, we can now at least tell you if it&#8217;s a valid postcode or not for those areas.</li>
<li>Next, we now have all <strong>Lower and Middle Super Output Areas</strong> in the system; thanks go to our volunteer Anna for getting the CD and writing the import script. These are provided by ONS for small area statistics after the 2001 census, and it&#8217;s great that you can now trivially look up the SOA for a postcode, or see what SOAs are within a particular ward. Two areas are in MaPit for each LSOA and MSOA &#8211; one has a less accurate boundary than the other for quicker plotting, and we thought we might as well just load it all in. The licences on the CD (<a href="http://parlvid.mysociety.org:81/os/soa/Conditions_of_supply_of_Super_Output_Area_boundaries.pdf">Conditions of supply of SOA boundaries</a> and <a href="http://parlvid.mysociety.org:81/os/soa/Ordnance_Survey_Output_Area_Licence.pdf">Ordnance Survey Output Area Licence</a>) talk about a click-use licence, and a not very sraightforward OS licence covering only those SOAs that might share part of a boundary with Boundary-Line (whichever ones those are), but ONS now use the <a href="http://www.ons.gov.uk/copyright/">Open Government Licence</a>, Boundary-Line is included in <a href="http://www.ordnancesurvey.co.uk/oswebsite/opendata/">OS OpenData</a>, various councils have published their SOAs as open data (e.g. <a href="http://opendata.warwickshire.gov.uk/datasets/warwickshire-super-output-areas">Warwickshire</a>), and these areas should be publicly available under the same licences.</li>
<li>As the UK has a variety of different types of council, depending on where exactly you are, the postcode lookup now includes a <strong>shortcuts</strong> dictionary in its result, with two keys, &#8220;council&#8221; and &#8220;ward&#8221;. In one-tier areas, the values will simply by the IDs of that postcode&#8217;s council and ward (whether it&#8217;s a Metropolitan district, Unitary authority, London borough, or whatever); in two-tier areas, the values will again be dictionaries with keys &#8220;district&#8221; and &#8220;council&#8221;, pointing at the respective IDs. This should hopefully make lookups of councils easier.</li>
<li>Lastly, to enable use directly on other sites with JavaScript, MaPit now sends out an &#8220;Access-Control-Allow-Origin: *&#8221; header, and allows you to specify a <strong>JSON callback</strong> with a callback parameter (e.g. put &#8220;?callback=foo&#8221; at the end of your query to have the JSON results wrapped in a call to the foo() function). JSONP calls will always return a 200 response, to enable the JavaScript to access the contents &#8211; look for the &#8220;error&#8221; key to see if something went wrong.</li>
</ul>
<p>Phew! I hope you find this a useful resource for getting at administrative geographic data; please do let us know of any uses you make of the site.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mysociety.org/2010/10/06/new-features-on-mapit/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Embedding FixMyStreet Google map in a blog</title>
		<link>http://www.mysociety.org/2010/06/16/embedding-fixmystreet-google-map-in-a-blog/</link>
		<comments>http://www.mysociety.org/2010/06/16/embedding-fixmystreet-google-map-in-a-blog/#comments</comments>
		<pubDate>Wed, 16 Jun 2010 08:57:45 +0000</pubDate>
		<dc:creator>Matthew Somerville</dc:creator>
				<category><![CDATA[FixMyStreet]]></category>
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://www.mysociety.org/?p=3550</guid>
		<description><![CDATA[On Twitter about 15 minutes ago, @greenerleith asked: &#8220;Has anyone worked out how to display the most recent #fixmystreet reports on a local map widget that can be embedded? #hyperlocal&#8221; Like this? :) View Larger Map It&#8217;s very simple to do: Go to FixMyStreet, and locate any RSS feed of the latest reports you want [...]]]></description>
			<content:encoded><![CDATA[<p>On Twitter about <a href="http://twitter.com/greenerleith/status/16292138317">15 minutes ago</a>, <a href="http://twitter.com/greenerleith">@greenerleith</a> asked: &#8220;Has anyone worked out how to display the most recent #fixmystreet  reports on a local map widget that can be embedded? #hyperlocal&#8221;</p>
<p>Like this? :)</p>
<p><iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.co.uk/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=http:%2F%2Fwww.fixmystreet.com%2Frss%2F2019,4177&amp;sll=53.800651,-4.064941&amp;sspn=16.157221,37.924805&amp;ie=UTF8&amp;ll=55.953745,-3.202433&amp;spn=0.05201,0.17419&amp;output=embed"></iframe><br /><small><a href="http://maps.google.co.uk/maps?f=q&amp;source=embed&amp;hl=en&amp;geocode=&amp;q=http:%2F%2Fwww.fixmystreet.com%2Frss%2F2019,4177&amp;sll=53.800651,-4.064941&amp;sspn=16.157221,37.924805&amp;ie=UTF8&amp;ll=55.953745,-3.202433&amp;spn=0.05201,0.17419" style="color:#0000FF;text-align:left">View Larger Map</a></small></p>
<p>It&#8217;s very simple to do:</p>
<ol>
<li>Go to <a href="http://fixmystreet.com/">FixMyStreet</a>, and locate any RSS feed of the latest reports you want (for the above map, I used Edinburgh Waverley&#8217;s postcode of EH1 1BB; you could have used reports to a particular council, or ward, using the Local alerts section). Copy the URL of the RSS feed.
</li>
<li>Go to <a href="http://maps.google.co.uk/">Google Maps</a>, paste the RSS feed URL into its search box, and click Search Maps.
</li>
<li>Click the &#8220;Link&#8221; link to the top right of the map, and copy the &#8220;Paste HTML to embed in website&#8221; code.
</li>
<li>Paste that code into your blog post, sidebar, or wherever (you can alter the code to change its size etc.).
</li>
<li>Done. :-)
</li>
</ol>
<p>The latest reports from FixMyStreet, superimposed on a Google Map, embedded in your blog. Hope that&#8217;s helpful.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mysociety.org/2010/06/16/embedding-fixmystreet-google-map-in-a-blog/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Outlook attachments now viewable in WhatDoTheyKnow</title>
		<link>http://www.mysociety.org/2010/03/15/outlook-attachments-now-viewable-in-whatdotheyknow/</link>
		<comments>http://www.mysociety.org/2010/03/15/outlook-attachments-now-viewable-in-whatdotheyknow/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 11:24:54 +0000</pubDate>
		<dc:creator>Francis Irving</dc:creator>
				<category><![CDATA[Developers]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[WhatDoTheyKnow]]></category>

		<guid isPermaLink="false">http://www.mysociety.org/?p=3330</guid>
		<description><![CDATA[When a bit of government forwards or attaches emails using Outlook, they get sent using a special, strange Microsoft email format. Up until now, WhatDoTheyKnow couldn&#8217;t decode it. You&#8217;d just see a weird attachment on the response to your Freedom of Information request, and probably not be able to do anything with it. Peter Collingbourne [...]]]></description>
			<content:encoded><![CDATA[<p>When a bit of government forwards or attaches emails using Outlook, they get sent using a special, strange Microsoft email format. Up until now, WhatDoTheyKnow couldn&#8217;t decode it. You&#8217;d just see a weird attachment on the response to your Freedom of Information request, and probably not be able to do anything with it.</p>
<p><a href="http://www.pcc.me.uk/~peter/">Peter Collingbourne</a> got fed up with this, and luckily for us, he can code too. He <a href="http://github.com/mysociety/whatdotheyknow">forked our source code repository</a>, and <a href="http://git.pcc.me.uk/?p=~peter/whatdotheyknow.git;a=commit;h=9d1321cca685d4a25cdb615199ef464da3ba4d5d">made a nice patch</a> in his own copy of it.</p>
<p>He then told us about it, and I <a href="http://github.com/mysociety/whatdotheyknow/commit/7c5be5afbc8af5fa3ab504983e4f38c09c71e118">merged his changes</a> into the main WhatDoTheyKnow code, tested them out on my laptop, then made them live. It all work perfectly first time. Peter even added the new dependency on vpim to WhatDoTheyKnow <a href="http://github.com/mysociety/whatdotheyknow/commit/7c5be5afbc8af5fa3ab504983e4f38c09c71e118#diff-2">conf/packages</a>.</p>
<p>Now if you go to an Outlook attachment on WhatDoTheyKnow,<br />
<a href="http://www.whatdotheyknow.com/request/immediate_response_team_deployme#incoming-11901">such as this one</a> you&#8217;ll just see the files, and be able to download them, and view them as HTML as normal. They&#8217;ll also get indexed by the search (although I need to do a rebuild for that for it to work with old requests).</p>
<p>Thanks Peter!</p>
<p>If you want to have a go making an improvement to a mySociety site, you can get the code for most of them <a href="http://github.com/mysociety">from our github repositories</a>. For some sites, there&#8217;s an INSTALL.txt file explaining how to get a development environment set up. Let us know if you do anything &#8211; even incremental improvements to installation instructions are really useful. And new, useful, features like Peter&#8217;s are even more so.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mysociety.org/2010/03/15/outlook-attachments-now-viewable-in-whatdotheyknow/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What are the two sorts of Cloud infrastructure called?</title>
		<link>http://www.mysociety.org/2009/09/22/what-are-the-two-sorts-of-cloud-infrastructure-called/</link>
		<comments>http://www.mysociety.org/2009/09/22/what-are-the-two-sorts-of-cloud-infrastructure-called/#comments</comments>
		<pubDate>Tue, 22 Sep 2009 10:42:45 +0000</pubDate>
		<dc:creator>Francis Irving</dc:creator>
				<category><![CDATA[Developers]]></category>
		<category><![CDATA[Mapumental]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[Thoughts]]></category>

		<guid isPermaLink="false">http://www.mysociety.org/?p=3092</guid>
		<description><![CDATA[I&#8217;ve been doing lots of research around &#8220;cloud computing&#8221; recently, so we can change how Mapumental works and take it out of private beta. One thing that&#8217;s struck me is that there doesn&#8217;t seem to be a proper, industry standard name to distinguish what to me are two fundamentally different sorts of &#8220;cloud computing&#8221;. I&#8217;m [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been doing lots of research around &#8220;cloud computing&#8221; recently, so we can change how <a href="http://mapumental.channel4.com/">Mapumental</a> works and take it out of private beta.</p>
<p>One thing that&#8217;s struck me is that there doesn&#8217;t seem to be a proper, industry standard name to distinguish what to me are two fundamentally different sorts of &#8220;cloud computing&#8221;. I&#8217;m focusing here entirely on cloud services for programmers (let&#8217;s leave what it means to end users or businesses for another day).</p>
<p>Here are my own names and descriptions of them:</p>
<p><strong>1) Cloud hardware server provision (Cloud HSP)<br />
</strong> Low level APIs for making and destroying (virtual) servers, and loading machine images onto them. e.g. Amazon Elastic Compute Cloud, Rackspace Cloud Servers,  Eucalyptus&#8217;s EC2 bits. Basically, what <a href="http://open.eucalyptus.com/wiki/API_v1.5">Eucalyptus v 1.5 can do</a> and what <a href="http://libcloud.org/">libcloud</a> should do. (By analogy,  this is the assembly language of cloud computing)</p>
<p><strong>2) Cloud developer service provision (Cloud DSP)</strong> A service that a developer accesses with one name and a simple API, and behind the scenes it scales for him, automatically. e.g. Amazon Queue Service, Rackspace Cloud Files. (By analogy, this layer is the C programming language of cloud computing)</p>
<p>[as an aside, Google AppEngine is an interesting one. It is definitely in the Cloud DSP category, but I think it is larger than that - it is a whole set of APIs all in that category. Something like Google DataStore is a single Cloud DSP, albeit one apparently only accessible within AppEngine apps]</p>
<p>It&#8217;s possible to use a Cloud HSP (assembly language), along with a bunch of your own software or open source software, to build new Cloud DSPs (C code). Right now this is pretty hard &#8211; even quite well known open source distributed datasbases like CouchDB still need scripting to even make them replicate. The code that makes and destroys servers and gives the service one name, needs manually stringing with quite new bits of wire (things like <a href="http://code.google.com/p/scalr/">scalr</a> and <a href="http://www.backhand.org/wackamole/">Wackamole</a>).</p>
<p>For this reason, I&#8217;m reluctant for mySociety to get into the &#8220;making our own Cloud DSP out of Cloud HSP&#8221; game. It feels to me like a suck of time, and like we wouldn&#8217;t be able to guarantee without lots of careful and expensive testing that it would scale. I&#8217;m more tempted to use the commercial Cloud DSP services where possible, even though they are proprietary. But use them via our own abstraction layer, so we can change as we need to. Of course, we have some C++ code (the public transport route finder), so will have to use the Cloud HSP API to get that going, perhaps with <a href="http://aws.amazon.com/autoscaling/">Amazon&#8217;s Auto Scaling</a>. But it can jolly well use AQS and S3 to talk to other services.</p>
<p>So, what do you think about the names Cloud HSP/DSP? Are there already existing names for the distinction that I&#8217;m making? Is it a useful distinction for you? Can you think of better names?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mysociety.org/2009/09/22/what-are-the-two-sorts-of-cloud-infrastructure-called/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>WhatDoTheyKnow growing pains (and Ruby memory leaks)</title>
		<link>http://www.mysociety.org/2009/09/17/whatdotheyknow-growing-pains-and-ruby-memory-leaks/</link>
		<comments>http://www.mysociety.org/2009/09/17/whatdotheyknow-growing-pains-and-ruby-memory-leaks/#comments</comments>
		<pubDate>Thu, 17 Sep 2009 19:19:09 +0000</pubDate>
		<dc:creator>Francis Irving</dc:creator>
				<category><![CDATA[Developers]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[WhatDoTheyKnow]]></category>

		<guid isPermaLink="false">http://www.mysociety.org/?p=2982</guid>
		<description><![CDATA[WhatDoTheyKnow keeps growing and growing, sucking people in from Google as its archive of maybe 8.5% of Freedom of Information requests gets more and more detailed. (Graph of number of FOI requests made using WhatDoTheyKnow over time; click for larger version) There&#8217;s round about 8Gb of unfettered Government data in the core database, plus a [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.whatdotheyknow.com">WhatDoTheyKnow</a> keeps growing and growing, sucking people in from Google as its archive of <a href="http://www.mysociety.org/2009/07/16/what-percentage-of-foi-requests-are-made-using-whatdotheyknow/">maybe 8.5% of Freedom of Information requests</a> gets more and more detailed.</p>
<p><a href="http://www.whatdotheyknow.com/foi-live-creation.png"><img src="http://www.whatdotheyknow.com/foi-live-creation.png"alt="mapumental-early-architecture" title="mapumental-early-architecture" width="300" height="212" class="alignnone wp-image-2300" style="max-width: 36em; max-height: 25.67em" /></a><br />
<strong>(Graph of number of FOI requests made using WhatDoTheyKnow over time; click for larger version)</strong></p>
<p>There&#8217;s round about 8Gb of unfettered Government data in the core database, plus a whole bunch more for indexing and caching. For comparison, TheyWorkForYou  (which now <a href="http://www.google.co.uk/search?sourceid=chrome&#038;ie=UTF-8&#038;q=theyworkforyou+historic+hansard">goes back to 1935</a>) has 12Gb. And it&#8217;s catching up on traffic also &#8211; WhatDoTheyKnow has about half the number of visitors as TheyWorkForYou.</p>
<p>Unfortunately, this new found traffic has led to performance problems. You might have seen errors when using WhatDoTheyKnow in the last week or two. This post is firstly an apology for that. Thank you for your patience. Hopefully it is fixed now &#8211; do let us know if you get problems still. And secondly it is some techy stuff about debugging such problems in Ruby on Rails&#8230;</p>
<p>When WhatDoTheyKnow started failing, we did the obvious things to start with &#8211; moving the database to a separate server, and moving some other services off the same server, to give WDTK more room to breathe. It still kept breaking.</p>
<p>None of my server monitoring tools shed any very clear light as to the problem. I upgraded to the latest version of <a href="http://www.modrails.com/">Passenger</a>, the best Rails deployment tool I&#8217;ve seen yet. It&#8217;s pretty good, but still not mature enough for my liking. I was still getting the same problems with it, but reporting tools like passenger-memory-stats were really helpful.</p>
<p>Eventually I worked out that it was to do with memory use of the Rails processes. Individual ones would leap up to 1Gb, and never drop back down. If several did, the server (with 4Gb of RAM) would start swapping and grind to a halt. The world of Ruby and Rails memory monitoring software is patchwork at best, and in the end I found the simplest tools the most useful. Here&#8217;s some:</p>
<ul>
<li>I found some Rails processes were getting jammed, and not dieing even when I restarted Apache. I think in the end this was due to the Passenger spawning method, and our use of the <a href="http://xapian.org/">Xapian</a> Ruby module. Running Passenger in <tt>RailsSpawnMethod conservative</tt> mode made things much more robust.
</li>
<li><a href="http://mmonit.com/monit/">Monit</a>, which in a previous life had a job holding up vital structural pillars of buildings with duct tape, makes you feel dirty. Actually it is really useful. Given I couldn&#8217;t quickly fix the problem, Monit let me at least reduce the suffering for people trying to use the site meanwhile. Here&#8217;s the rule I used, which gives Apache a kick every time server memory use is too high. It was firing every 5 or 10 minutes&#8230;<br />
<blockquote><pre>check system localhost
    if memory > 3500 MB then exec "/usr/sbin/apache2ctl graceful"</pre>
</blockquote>
</li>
<li>I found <a href="https://secure.mysociety.org/cvstrac/rlog?f=mysociety/foi/lib/memory_profiler.rb">memory_profiler</a> on a <a href="http://scottstuff.net/blog/2006/08/17/memory-leak-profiling-with-rails">blog</a>. It helps you find the kind of memory leak where you unintentionally continue to reference an object you don&#8217;t use any more. With a specialist subject of string objects. This led to <a href="https://secure.mysociety.org/cvstrac/chngview?cn=16577">a fix</a> to do with declaring static arrays in classes vs. modules, which I still don&#8217;t really understand. But it wasn&#8217;t the cause of the big 1Gb memory munching, there were no large enough leaks of this sort.</li>
<li>The record_memory function in WDTK&#8217;s <a href="https://secure.mysociety.org/cvstrac/rlog?f=mysociety/foi/app/controllers/application.rb">application controller</a> came from <a href="http://www.codeweblog.com/rails-to-monitor-the-process-of-memory-leaks-skills/">another blog</a>. It&#8217;s handy as it shows you how much of the system memory in the Ruby process each request causes an increase by. With caveats, this was the best way for me to identify the most damaging requests (search results, and certain public body pages). And it also brought focus on the actual problem &#8211; the peak memory use <strong>during a request</strong>. That&#8217;s really important, because Ruby&#8217;s memory manager never returns memory to the operating system&#8230; The Gb leaps in memory use were because of temporary memory used during certain requests, which the Ruby memory manager then never frees later.</li>
<li>I made a <a href="https://secure.mysociety.org/cvstrac/rlog?f=mysociety/rblib/debug_helpers.rb">bunch of functions</a> culminating in <tt>allocated_string_size_around_gc</tt>. This was really useful in use with the &#8220;just add lots of print statements and fiddle&#8221; school of debugging. Not everyone&#8217;s favourite school, but if your test code can&#8217;t catch it, one I often end up using (it gets really involved rarely enough that it doesn&#8217;t seem worth setting up an interactive debugger). It led me to various peak memory savings, <a href="https://secure.mysociety.org/cvstrac/chngview?cn=16599">such as</a> calling &#8220;text.gsub!&#8221; rather than &#8220;text = text.gsub&#8221; while removing (email addresses and private information) from FOI request responses, which help quite a bit when dealing with multi-megabyte attachments.
</li>
<li>Finally, I used the overlooked debugging tool, and the one you should never rely on, being common sense. That is, common sense informed by days of careful use of all the other tools. In order to quickly show text extracts when searching, WDTK stores the extracted attachment text in the database. A few of these attachments are quite large, and led to 50Mb fields, often several of which were being loaded and processed in one page request. That this would cause a high peak of memory use all became just obvious to me some time yesterday. I checked that that was the case, and this morning, I <a href="https://secure.mysociety.org/cvstrac/chngview?cn=16618">changed it</a> to use the full text for indexing, but to at most keep 1Mb for use in snippets. So sometimes now you won&#8217;t get a good search extract for queries, but it is rare, and it will at least still return the right result.
</li>
</ul>
<p>I&#8217;ve more work to do, I think there are quite a few other quick wins, all of which are making the site faster too. I&#8217;m quite happy that WhatDoTheyKnow also has a bunch more test code as a result of all this.</p>
<p>On the other hand, what a disappointing disaster for open source languages beginning with P/R (as opposed to J). Yes, the help and tools were just about there to work it out, but would seem primitive if you&#8217;d used say Java&#8217;s <a href="http://www.eclipse.org/mat/about/screenshots.php">Memory Analyzer</a>. Indeed somebody over on StackOverflow <a href="http://stackoverflow.com/questions/161315/ruby-ruby-on-rails-memory-leak-detection">suggested</a> running your site in JRuby and using exactly that tool&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mysociety.org/2009/09/17/whatdotheyknow-growing-pains-and-ruby-memory-leaks/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Report submission edits</title>
		<link>http://www.mysociety.org/2009/08/10/report-submission-edits/</link>
		<comments>http://www.mysociety.org/2009/08/10/report-submission-edits/#comments</comments>
		<pubDate>Mon, 10 Aug 2009 16:20:30 +0000</pubDate>
		<dc:creator>Matthew Somerville</dc:creator>
				<category><![CDATA[FixMyStreet]]></category>
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://www.mysociety.org/?p=1475</guid>
		<description><![CDATA[A number of people report dog fouling through FixMyStreet, using slightly more&#8230; colloquial language. A number of councils have strict obscenity filters, blocking anything containing swearing. As I&#8217;m a pragmatist and not that interested in campaigning against councils blocking legitimate emails from their citizens (feel free!), FixMyStreet simply changes any &#8220;dog shit&#8221; reference to &#8220;dog [...]]]></description>
			<content:encoded><![CDATA[<p>A number of people report dog fouling through <a href="http://www.fixmystreet.com/">FixMyStreet</a>, using slightly more&#8230; colloquial language. A number of councils have strict obscenity filters, blocking anything containing swearing. As I&#8217;m a pragmatist and not that interested in campaigning against councils blocking legitimate emails from their citizens (feel free!), FixMyStreet simply changes any &#8220;dog shit&#8221; reference to &#8220;dog poo&#8221;. This works well for everyone.</p>
<p>Recently, the <a href="http://adammacqueen.blogspot.com/2007/09/portakabin.html">infamous</a> Intellectual Property Manager from Portakabin™ Limited got in touch to complain about a couple of reports on FixMyStreet containing the words &#8220;portacabin&#8221; or &#8220;portaloo&#8221;. Again, as a pragmatist, I&#8217;m not really interested in whether users using trade marks or trade mark variants in a generic way on a problem report actually constitutes trade mark infringment (actually, I&#8217;d guess not), I just want legal people to go away and not waste our precious resources. So from now on, any report containing portakabin or similar will become [portable cabin], and portaloo will become [portable loo].</p>
<p>For anyone who&#8217;s interested, this is accomplished through a simple <a href="http://en.wikipedia.org/wiki/Regular_expression">regular expression</a>, that looks for porta followed by 0 or more spaces, then cabin, kabin, or loo, and sticks &#8220;ble&#8221; in the middle.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mysociety.org/2009/08/10/report-submission-edits/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Register of Members&#8217; Financial Interests</title>
		<link>http://www.mysociety.org/2009/07/10/register-of-members-financial-interests/</link>
		<comments>http://www.mysociety.org/2009/07/10/register-of-members-financial-interests/#comments</comments>
		<pubDate>Fri, 10 Jul 2009 10:45:29 +0000</pubDate>
		<dc:creator>Matthew Somerville</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[TheyWorkForYou]]></category>

		<guid isPermaLink="false">http://www.mysociety.org/?p=1277</guid>
		<description><![CDATA[As a new edition has just been released, and I&#8217;ve had to tweak the parser to cope with the new highlighting, it&#8217;s a good time to write a brief article on TheyWorkForYou&#8217;s handling of the House of Commons Register of Members&#8217; Financial Interests (Register of Members&#8217; Interests as was before the current edition). Way back [...]]]></description>
			<content:encoded><![CDATA[<p>As a new edition has just been released, and I&#8217;ve had to tweak the parser to cope with the new highlighting, it&#8217;s a good time to write a brief article on TheyWorkForYou&#8217;s handling of the House of Commons Register of Members&#8217; Financial Interests (Register of Members&#8217; Interests as was before the current edition). Way back in the day, a scraper/parser was written (by either <a href="http://www.goatchurch.org.uk/">Julian</a> or <a href="http://www.flourish.org/">Francis</a>) that monitors the Register pages on www.parliament.uk for new editions, and downloads and broadly parses the HTML into machine-readable data. The XML produced can be found at <a href="http://ukparse.kforge.net/parldata/scrapedxml/regmem/">http://ukparse.kforge.net/parldata/scrapedxml/regmem/</a> &#8211; TheyWorkForYou then pulls in this XML into its database, and makes the latest data available on every MP&#8217;s page.</p>
<p>However, as it&#8217;s been scraping/parsing the Register since 2000, we can do more than that. Each MP&#8217;s page contains a link to a page giving the history of their entry in the Register &#8211; when things were added, removed, or changed. You can also view the differences between one edition of the Register and the next, or view a particular edition in a prettier form than the official site. There&#8217;s a central page containing everything Register-related at <a href="http://www.theyworkforyou.com/regmem/">http://www.theyworkforyou.com/regmem/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mysociety.org/2009/07/10/register-of-members-financial-interests/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

