Following the initial joy and elation at discovering we’ve got yet another chance to express our electoral opinions I’ve updated TweetYourMP.com to now include candidate information for the forthcoming 2017 snap General Election, and I’ve even managed to secure yet another dot com – TweetYourCandidate.com includes the details of over 3,000 candidates standing in the 650 constituencies across the UK.
Fortunately this time around I’ve been able to make use of the very useful candidate data from The Democracy Club which has saved a lot of time and made it possible to turn update the site in a very short space of time.
This time around there’s a new feature to play with: the campaign generator makes it possible to create your own pre-filled twitter campaigns to share.
As an example I created a very simple campaign – posing possibly the easiest question to people vying to be your Member of Parliament:
Sadly I’ve yet to receive replies from Kate Hoey (The former Labour MP) nor Dolly Theis who is the Conservative and Unionist Party candidate, although in the case of the latter I did tweet later as my initial candidate list didn’t include her twitter details. UKIP are not running in Vauxhall.
So far a number of campaigns have made use of the tool – which is provided free of charge, as a spare time project.
Rather excitingly my little side project tweetyourmp.com was mentioned by pukka chef Jamie Oliver as part of his campaign for healthy eating:
Big yellow sign
After my panic that I might not have enough bandwidth subsided, I thought it might be a good moment to give Tweety our MP a bit of love, so I’ve added the option to pre-fill tweets.
The tweet text is passed across using a custom URL – this can be done as follows:
Pre-filling in the postcode and tweet message:
Make sure you use the URL http://tweetyourmp.com/index.php
Passing values to tweetyourmp.com in this way works with spaces, but safer to encode the message and postcode parts using http://andrewu.co.uk/tools/uriencoder/ to replace characters with %20 for a space.
hello @ChukaUmunna your twitter message via @kimondo
as the tweet.
Important note on using hashtags
I had to use a bit of a hack to make it possible to have a pre-filled tweet with a hashtag. As # is used to denote an anchor link when you stick it in a URL the rest of the URL gets ignored by the bit of the code that reads the tweet from it.
To get round this use an asterisk * in place of a hash # – the code then puts the hash back in when it sends the tweet:
hello @ChukaUmunna your twitter message #hashtag via @kimondo
The salutation is fixed as ‘Hello’ but can be changed – is important not to begin the tweet with the @handle as it reduces its visibility and ‘Hi’ is a bit American sounding hence the hello.
Next on the list is building some sort of Raspberry Pi based tweet totaliser. You can download the (very simple) code that runs Tweet your MP on GitHub – a couple of interesting options are to use the code in a thankyou email after a supporter has completed an action to give it a bit more impact, or to sort through your data and merge in constituency contacts in an email.
Note that some MPs don’t consider twitter an ‘official’ communication format so this is best combined with an email or letter to an MP.
tweetyourmp.com is made possible thanks to the theyworkforyou.com API – this is free for charitable use up to 50,000 queries.
Update: I’ve now added a page that automates this process and builds a bit.ly link with the correct address!
In the UK it’s election time again and the BBC are preparing to wheel out the latest version of their Swingometer. The BBC Swingometer dates back to 1959, and was a visual device for displaying the balance in seats won by the two main political parties. The Swingometer coined a whole load of phrases along the lines of a ‘swing away’ or ‘swing towards’ a particular party or candidate, and was well suited towards the simple days of two party politics.
Here’s version 1.0 back in 1959:
There’s a chap with a pipe behind moving the arrow (photo BBC)
The BBC have more or less stuck to the same device for every election since, although sadly in the same way that CGI ruined the Star Wars films, Swingometers have recently become more and more complicated. This is perhaps also a consequence of the UK moving to multi-party politics where working out who exactly in power after polling day is getting a bit complicated.
Here’s version 14.0 from 2010:
There’s just a big green room (photo BBC)
In a tribute to the original, the charity I work for – Concern Worldwide have been using a Development Swingometer, which pays homage to the original 1959 version and tracks the number of candidates who have signed up to support Concern’s 5 pledges on fighting global poverty and protecting international aid (you can tweet them on that page with some code I mashed up using TheyWorkForYou.com and YourNextMP.com).
As our low-budget version is a bit simple, for a bit of fun I thought I’d build a slightly more technical version that updates itself automatically. My updated Swingometer uses a servo to move the arrow, and a Raspberry Pi to fetch the ‘swing value’ from a web page when you push the big friendly button. The code I’ve used can be edited to fetch more or less any numerical value from a web page and turn it into a ‘swing’ so It should be possible to repurpose this into a political swingometer, or something that displays anything with a value of 1-180 (the angle of swing possible with a servo).
Just push the button for the latest results
The back of the frame (£5 from Wilko) shows the Raspberry Pi model A and a little slice of Pi board I soldered up. There are two buttons – the big friendly update button for the front and a safe shutdown button on the back, so I can run this without a screen and keyboard.
Here’s the back with an arcade machine button (white wires) and the wiring to the servo (brown – red – yellow wires)
The method I’ve used to control the servo is similar to RaspiTV’s Raspberry Pi flag waving post – although I opted for the version detailed in the Raspberry Pi cookbook over Adafruit’s single servo control. For my power supply I used a D-link powered USB hub to supply both the Pi and the Servo via separate USB cables. This results in a slightly wobbly update of the Swingometer arrow, which suits me fine. For more precise control you can use a dedicated servo control hat which can control up to 16 separate servos.
For the code I modified the Raspberry Pi cookbook tutorial code to fetch a value from a web page using Beautiful Soup. You can install this on the pi using:
Here’s the code I’ve used to update the swingometer:
import RPi.GPIO as GPIO
import time
from BeautifulSoup import BeautifulSoup
import urllib2
#change this bit
url="http://www.kimondo.co.uk/swingometer-control/"
page=urllib2.urlopen(url)
soup = BeautifulSoup(page.read())
value = soup.find('span',{'style':'color: #99cc00;'})
value = value.next
value = float(value)
print value
GPIO.cleanup()
GPIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.OUT)
pwm = GPIO.PWM(18, 100)
pwm.start(5)
t_end = time.time() + 1
while time.time() < t_end:
print value
angle = value/100.0 * 180
print angle
duty = float(angle) / 10.0 + 2.5
pwm.ChangeDutyCycle(duty)
exit()
An alternative I considered was using the Sentiment 140 twitter sentiment tracker API – this tracks positive and negative sentiment towards keyword searches on twitter – although it seems to get fooled by ironic tweets.
If you’ve been inspired to build a Swingometer please share it in the comments! One day I’d quite like to build something like the Weasley clock.
Since I’ve upgraded my hosting, one thing I’ve been wanting to do was to find a proper home for my Tweet Your MP script.
This is a php based script that looks up a UK parliamentary constituency given a postcode, and then returns the details of the MP using it’s own database. It’s been a handy resource for a few work projects, and since being published on GitHub as an open source project has been downloaded and used by a few other organisations as well.
One of the projects I’ve been working on recently is producing an ebook version of a report for the ONE campaign. I thought I’d put together a simple guide to making ebooks which might be handy if you’re thinking of doing the same.
Campaigning organisations like to publish and produce a lot of reports about important stuff, and usually publish them in a variety of ways – sometimes resulting in stacks of out of date printed paper reports cluttering up the store cupboard.
Traditionally producing online versions of reports – particularly long ones – has been difficult as reading 130 pages of a report on a PC screen isn’t a particularly easy thing to do.
Oops I hit print by mistake
However with the popular rise of ereaders, it’s now possible to produce online copies of long reports which can be easily read offline anywhere. Consultants Deloitte estimate that a third of UK households now own an ereader – and sales are holding up (thanks to their low cost) compared to tablets. Ereaders are also more popular with those aged 45-54.
First to consider is the format – most organisations produce documents as pdfs since this is the format provided by graphic designers- these work well on iPads and android tablets – but work badly on Kindles and ereaders. Pdfs also often require a lot of zooming to read the text which can make them difficult to read on phones.
Fortunately it’s quite easy to convert between the different ebook formats used by kindles, kobos, ipads and other mobile readers – here we can use a very handy program called Calibre.
But first – here’s how to get your ebook ready:
Step 1: Preparing your files
Most ebooks will start life as a long Word document – you’ll need to convert this into a basic HTML format. Don’t worry about fonts, css, or any fancy formatting – just stick to as few HTML tags as possible.
You can cut and paste from Word into Dreamweaver and it’ll do most of the reformatting for you – or you can use a free program like Textwrangler to sort out your HTML code. Word often inserts it’s own bizarre brand of HTML into documents, so you need to make sure you clean this up before converting into an ebook.
To make the process as simple as possible use heading tags to divide up your ebook into a heirachy of chapters and sub headings –
<h1> for chapter titles
<h2> for subheadings
<h3> for figures and charts within each section
This part is important – the tool we’ll use later uses heading tags to generate the table of contents.
Divide up your text into paragraphs using <p></p> tags.
Ebook formats also work with most simple HTML tags so you can use things like table <table> tags to organise information, anchor tags, <strong> for emphasis and <a href=”> for links. For more info there’s a simple guide to HTML here.
Some tags like superscript <sup> and subscript <sub> don’t display reliably. If you’re not sure, test the html output in an ebook using the steps below.
Top tip: keep it as simple as possible.
For images bear in mind that most ereaders display in 16 shades of grey – stick to bold, high contrast images. You can use GIF (for diagrams) and JPEG (for more fuzzy images like photos). As a rule of thumb I make the longest side of each image 1000 pixels – some ebooks can display larger images, but this makes it easier to stick to a size that’s compact and resizes easily.
Link the images into your HTML page as you would normally and save them in a subfolder next to your HTML file.
Step 2: Generating the ebook
Next you need to import the HTML file you’ve created into an ebook tool. I use Sigil – it’s an open source tool that’s free to download and available for Mac and PC.
Open Sigil and import the HTML file. If you click generate table of contents Sigil will build a chapter list on the right hand side based on the <h1> <h2> <h3> heading tags in your document.
Another handy feature in Sigil is the split at cursor option – this splits the HTML file into 2 or more separate files, but has the effect of forcing a page break in your final ebook – this is handy if you want chapter headings or image titles to appear on a page on their own.
Step 3: Finishing up and testing
Once you’ve got your ebook finalised in Sigil, save it in epub format and then import the book into Calibre. Calibre is a really useful piece of free ebook management software which converts between the different formats and lets you take control of your ereader.
In Calibre select edit metadata individually – this lets you set the cover (with a useful crop function) and edit the author and publisher information.
Once you’ve got your ebook finished export as an ePub (for Apple and Kobo readers) and .mobi (for Kindle) and test. You can check for things like alignment of images, and any part of the book that uses tables or any HTML more advanced than headings and paragraphs.
Finally you can publish – Amazon don’t allow small publishers to create free ebooks (unless you agree to only publish on Amazon) so it’s generally best to publish directly on your site – an example is here with ONE’s first ereader report: The Beginning of the End of AIDS – with links to the PDF, Kindle (.mobi) and iPad (epub) versions.
This week I’ve been at the eCampaigning Forum 2013 (#ECF13) which is why I’ve been tweeting a lot. So here is my top ten list of interesting things I learned about running campaigns on the internet!
Check your ego at the door! the 2012 Obama campaign did a lot of testing of their emails – 4-6 different drafts and 12-18 different subject lines which they tested against a random sample of their email database. When they ran an email derby, the team of experienced staffers were less good than random chance at predicting the winning email. Testing was responsible for 1/5 to 2/5 of the Obama campaign’s online fundraising total.
The largest female image in the Sun is always page 3 (even in the olympics). Lego didn’t know what to make of Leanne 22 from Legoland, but they’ve stopped advertising in the Sun because of the brilliant ad-hoc no more page 3 campaign. Social media activists rule.
Open source campaign tools can look just as good as their closed source counterparts (when they’re finished). Can’t wait to download Campaignion – there’s also a list to try out the hosted version if you’re a campaigning organisation.
Something works on facebook? promote it. For 3 thousand euros one image got 47 thousand facebook likes for Greenpeace Hungary.
David v Goliath campaigning works. When EDF decided to attempt to sue the campaigners who blocked a gas power station, the interest from the public was far greater than that for the original campaign. Using triggers of freedom of expression, corporate bulling, and public outrage at the massive profits of gas companies, No Dash for Gas got a platform to talk about Climate Change, and inspired a spin off EDF*off.
Old Street has the biggest concentration of hipsters in Europe. Which makes it a good place to launch a spoof VW darkside campaign. Making sure you tweet on an event hashtag before it even starts helps dominate the conversation. And (other than trying to take the video off youtube) Lucasfilm took no action against Greenpeace, and VW backed down.
We still don’t know what the next big thing is. It might be lots of things, it might be mobile (again), GIFs (again), handwriting in dead tree format (again), kickstarter (again), gameification (again). Rolf think’s it’s 3d printing.
Bloggers are like fussy cats, and supporters are like loyal dogs. Cats are fickle and need lots of attention, or they’ll go away. Having a long term blogger strategy is a good idea, as is an excuse to show lots of cat pictures.
In 2022 the socialmediatization of politics will be complete. Twitter might allow A/B testing, and we’ll all have moved away from our computer screens. There might be a lot of competition in the campaigns space, and big charities might be using supporter-self-serve campaigning models. There might also be robot ninja drones and interesting new words. I probably won’t have my flying car, but I prefer bicycles anyway.
There are lots more worth mentioning – it is possible to create a campaigning website in 7 minutes, but harder still to convince someone to change their Twitter profile picture. Right Angle (the right wing competitor to 38 degrees) has an entertaining achievements page. And top ten lists of things are nice to share on blogs…
For more information check out the Fairsay eCampaigning Forum website where there’s a whole lot more about the conference, and the handy email discussion list that goes with it.
Sometimes it’s handy to be able to get people to tweet from a selection of messages – for instance on a thank you page after taking an action. Usually everyone just hits the tweet button and sends multiple versions of the same message out on twitter.
One thing that was interesting about the (I hate to mention it but..) Kony 2012 campaign was the splattergun approach to sharing multiple messages on twitter.
To make things a little bit more varied you can use this super-simple tweet rotator script – this picks a tweet at random from a list you provide in the javascript. It’s fairly easy just to come up with 10 or so different variations on your tweet and include them in the script – see the example below.
It’s also something that might work quite well with advocacy targets – anyone using tweetdeck to monitor their @mentions will see a varied response – particularly when you factor in that a few of your activists will change the tweet before they send it.
Ever wanted to send a tweet to your MP? not sure if your Member of Parliament has embraced social media? want to put a handy tool to do so on your website?
Tweet your MP
Here’s a little script I wrote to find your MP using a postcode (via the TheyWorkForYou.com API) and send them a tweet. Info, source and background below.
It’s possible to tweak this tool to return email address, postal address, phone number and facebook page (if they have one) – you can also add custom information to each MP as well. My data set includes 436 twitter accounts for MPs – slightly more than Tweetminster’s 409 but I have included auto twitter accounts (so people can see you’re tweeting your MP, even if they don’t respond). I’ve tried to avoid spoof accounts.
Bit of background about this tool
This tool works by converting the postcode into a constituency name on TheyWorkForYou.com, and then matching this constituency name with MP’s details on a local MySQL database table. If you don’t want to use TheyWorkForYou.com’s API it is possible to buy a constituency postcode database from Ordinance Survey for £350.
For a while I’ve been working on an open-source activism tool. It was born out of curiosity, an excuse to learn a bit more about php and as a way of proving email to MP actions courtesy of the very useful theyworkforyou.com API.
Unfortunately it became on of these projects that got more and more complicated – once I’d got round to adding a graphical user front end, SMS texting, and add on modules it started getting a bit too big for me to handle. Plus I started encountering problems with PHP’s send mail function getting blocked by outlook servers, experimented a bit with pop mail senders and then started looking at using online cloud services.
The past 2 organisations I’ve worked for have used off the shelf tools instead, making the aim of the project a little bit redundant.
I still have a copy of all the code (with lots of comments) if anyone would like it – it’s in an alpha sort of works if you’re prepared to spend a bit of time tinkering with it state. Just drop me a line. All I ask is that if you do improve on it, please make it publicly available (it is GPL licensed).
I’ve also been thinking about the effectiveness of email-your-mp actions with identikit emails embedded in them – I think using twitter or even printed out letters might be a better way forward to creatively attract attention, and avoid the boring accusations of ‘slacktivism’.
So in the meantime I’ve taken the bits of the tool that did work, and have reworked them into a much simpler ‘Tweet your MP’ toolkit. The idea of this is to provide a simple widget you can embed on your website – I’ve seen plenty of websites that just link to TheyWorkForYou.com, or refer people to google, so this provides a way of keeping activists on your page.
In the example above I’ve just gone for twitter and website information – but with a few tweaks to the code you can add email your MP (via a mailto link) phone your MP or write a paper letter to your MP functionality.
Requirements & the code
To get this to work you will need access to a MySQL database and PHP. This is currently running on my server which is a cheap-as-chips 123-reg setup. Check your ISP’s documentation for support on how to get these logins. I’ve labelled the code to show what it does.
If there are any corrections please get in touch with me and i’ll add them.
I’m updating this to fix problems and add enhancements. At the moment the code does contain a bit of stuff left over from the webtivist project. The GitHub version will always be the most up to date.
To make this work you’ll need to upload the MP data spreadsheet to your MySQL server (I used the import function on my 123reg hosting and it worked fine) this has every MP’s contact details – if you’d like access to this please drop me a line as I’d like to keep track of who’s using it!
Then you’ll need to edit the settings.php file to include the login for your MySQL database, the hostname and tablename for your MP database.
You’ll also need to apply for a theyworkforyou.com API key – there’s usually no charge to use this for small volumes. They prefer it if you ask them if you’re intending to use it a lot. Please Please don’t use this to send identical emails to MPs.
For the twitter part you’ll also need a Twitter API key I changed this to use the more simple @mention option on twitter.
Corrections / suggestions and contributions
Thanks to MPs being arrested for things, standing down or departing, this data may become out of date over time. If there is incorrect information please let me know and I’ll update it.
This script makes use of the TheyWorkForYou.com API and Ruben Arakelyan’s php script. Check the comments in the code for more information.
I’m a great fan of kitchen-tivism (kitchtivism?) – and by that I mean the engineers who tinker away in their kitchens to come up with solutions to various problems.
kitchen-tivism isn’t a particularly new concept – it’s been around since the dawn of modern science. One such early inventor is the astronomer Herschel who made reflecting telescope mirrors in his kitchen, and perfected a process which enabled him to measure the distance between stars, discover Uranus, and for his sister to become a celebrated hunter of comets and pioneer female scientist. You can visit the site of Herschel’s kitchen today and even see the cracked paving stones which resulted from an early failed attempt to cast mirrors in lead – the molten mixture poured over the floor and shattered the stone beneath.
Kitchtivism in action: Herschel’s mirror polisher
There are many stories of such kitchtivists – people like the Reverend Stirling, who out of concern for his parishioners developed a hot air steam engine which worked at a much lower (and safer pressure). Perhaps not all of them created their works in kitchens – some used sheds, but you get the idea.
What perhaps is different now from the past, is that where before kitchtivists worked in isolation, often replicating work or encountering problems which were insurmountable on their own, today kitchtivists have the wonderful invention that is the internet to connect them with other activists around the world. Part of the success of the world wide web is the sharing of ideas – at no cost – and without boundaries. Experts and amateurs alike can pool ideas, and create technological mashups which combine bits of experience from a wide field of people.
Take for instance Frontline SMS – a handy bit of software which connects mobile phones with the internet, which was written by Ken Banks over five weeks on the laptop in his kitchen. In keeping with the spirit of the internet he gave Frontline SMS away.
“I made it a generic communications platform that could be used for almost anything, and I made it free.”
Frontline SMS was originally developed to help help South Africa’s Kruger National Park communicate and engage with its neighbouring communities – but since it’s inception it’s been used from earthquake survival information to providing radio shows with feedback via text from their listeners. The most notable Frontline SMS mashup being the Kenyan based Ushahidi – originally created to map post election conflict in Kenya, now being used anywhere map based tracking is needed.
There are many other examples – from the open source Arduino, to the Raspberry Pi teaching computer (created in their spare time by concerned computer science lecturers) – all demonstrating that the spirit of entrepreneurial experimentation made famous by the victorian pioneers is alive and well today.
The potential for the web – still a relatively young invention to not only mobilise activists on a global scale – but to potentially provide new solutions, ideas and technologies that are just given away for free is truly mind-boggling.
I for one are looking forward to the new and exciting technologies that kitchtivists are working on – and am certain that the next revolution will probably be made on kitchen table somewhere.