Private in Public now available as a Chrome Extension

A few months ago I did a weekend project (Private In Public) making a tool that let you encrypt very short bits of text in a single web page. You can read about it a bit more here.

It is now available as a (very early beta) Chrome Extension here. Anyone who is interested in hiding things §e:U2FsdGVkX1/XEh72t/QGzIROohr6hRnTVqwYyxhSbQ4=§ might find it cool, and I’d be really interested in your comments.

For more details on the code: please see this GitHub page, and for more information on the process I took to make it into a Chrome Extension, please see this live process log.

I’ve got some plans for things I want to use it for, but I like the idea that it might be useful more generally.

Screen Shot 2017-04-22 at 21.33.10 Screen Shot 2017-04-22 at 21.32.53 Screen Shot 2017-04-22 at 21.32.40

Private in Public: a weekend project.

Last weekend I took a day to play around with code and make a small project happen.


I wanted a bookmarklet that allowed you to encrypt small sections of the content you write into webpages.  So it would convert

“I like [postmen]” into

“I like [e:U2FsdGVkX1/s5MdPIxsWMO0XvnZoWhcAM/76AWI6Y/I=]”

(obviously, when you are viewing the encrypted text, the bookmarklet will also let you view it).

All of the code and instructions are here, and below are some screenshots of it in action.

The next step is to make it into a Chrome Extension, which I’ve done, but which needs some polishing before it goes properly live on the store. Maybe that’s a thing for another weekend.



Mozfest: my second day.

Sunset seen thought the windows at the Mozfest venue.

Sunset seen thought the windows at the Mozfest venue.

I’m writing this on the train, and I suspect I’d only get a chance to edit after the whole thing has finished, so apologies for the slightly stream-of-conciousness approach.
I missed about half of the second day arriving just before lunch.  In the process I managed to miss the opening speeches.
Funnily enough I’m generally in two minds about opening speeches.  At most conference I avoid opening speeches and keynotes like the plague, but mozfest is subtlety different: spending an hour or two listening to words like ‘sharing’, ‘connecting’, and ‘openness’ is like a small massage for the soul even without the informational context.

Today I spent quite a lot of time on the topic of food

Regular readers will remember my rants on the topic of vegan events like ‘vegfest’ – it turns out that Mozfest, the technology conference, does vegan food and debate better than vegfest does.  That’s like finding out that Microsoft makes better cakes than Kipling.  Typically conference food for vegans is nice, but contains about 200 calories, which means that often pop out to a local pub during the session after lunch, but Mozfest provided a stonkingly good spread.
The hyperlocal low-carbon lunch.

The hyperlocal low-carbon lunch.

After lunch, wandering around without my glasses on (a random, but enjoyable way to explore) I found myself at a table sent for lunch. It turned out to be a separate lunch provided by some mozfest attendees to promote discussion – the food was ‘low-carbon’ sourced from near the conference venue (given we were near the O2 arena, this is nontrivial) and that was the topic of conversation for an hour.  It was a perfect example of the wide range of approaches and topic areas around Mozfest.
Then there was vegan cake from The Depressed Cake Shop, bought for a donation of £1, which will go to MIND.


It wasn’t all stomach oriented – I met Metod Beljec who was making a language of emoticons: this isn’t conceptually far away from communiKate and we had a lot to talk about. I met designers from Holland who were running workshops on what the future looked like using newspapers as prompts and chatted to some lovely 3d printing experts who gave me the keywords I need to put into Google to make a disability project happen.   I spend an hour working with a group in the ‘TV hacking’ session and enjoyed getting a wider view than the one I’d built up working on Supertitle.

The Language of Mozfest

One of my favourite things of the event is listening to the way people talk – there’s a real sense in some of these areas that people are developing a distinct set of terms and languages for working in the areas they are. I heard ‘onboarding’ used as a verb yesterday, and it got me thinking about the levels of language – there’s a language used by the programmers and developers (that I like to think I speak) but there is another one used by the designers and facilitators that is newer (and still evolving faster that a language normally does), deals with more social concepts, and is being used to map out an area that I’m slightly unsure of…

Sudden Sadness

One minor thing is, that though I was talking to a wide range of people about technologies would be really distributive in the disability space (Oh, hey, now I’ve started talking like Mozfest) I found I was generally the one bringing forward the disability space as the application.  Once I realised that late on, I started to look around and realise I hadn’t seen any wheelchair users at all at the conference, which for a 900 person technology event in a really accessible bit of London, is a bit odd. I’ll see if I can get some demographic information from the organisers but I worry that disability is a little underrepresented in the festival. (It’s very likely I just wandered past the relevant sessions without paying attention of course…)

Mozfest: Day 1

2015-11-06 20.44.42

I’m at my second Mozfest, and I’m loving every minute of it.

I didn’t blog at all for my first one, because I was basically overwhelmed, and I’m trying to make up for that this time.

Mozfest is all difficult to describe. It takes place over four or five floors of a building near the O2 arena with lots of space for conversation and collaboration. There are about 900 attendees. There are sessions arranged so it’s ‘kind of’ like a conference but it’s really not.

The easiest way of explaining Mozfest is this. There are 900 people there. You can ask any one of them ‘What’s the awesome thing you are doing?’ and they know the answer.

This evening was a display/demo evening – with lots of cool companies showing their wares. We’ll talk about those in a moment. What’s impressive is everybody else.

The first few random people I spoke to this evening where:

  • Producing language support tools in Tanzania.
  • Producing open journalism tools to improve reporting in Afghanistan.
  • A teacher who ran awesomely high level code clubs in Switzerland.
  • Setting up large-scale backspaces in Ghana
  • Teaching creative coding though art.

And those were the just the people who where visiting! They are such incredible humans to be around: it’s like giving your brain a hot bath.

So – the demos. I’m going a pick out a few, just because they stick in the mind, but so many were awesome (and I didn’t get near the particularly popular ones because of the crowds).

I was blown away by the work that cartoDB were showing. I have wrestled with visualising data on maps before and they showed off some applications that where just incredibly intuitive and usable. I’ll be playing with their tools.

It was nice to chat to the people from the Knight Foundation. I think their timeline tool is something that we might use in the TooManyCooks process. On that point, every time I see I get more and more convinced that they are the front end I should be using for TooManyCooks – certainly it’s already the first place I’m going to next time we work with a school that blocks Google Drive. 🙂

AzuleJoe Hacking

Table shot

The purpose of this post is to show you how easy it is for a hobbyist to retarget AzuleJoe with nothing but Paint and Notepad.


The injection of the Inclusive Technology Prize money has meant that I have been able to spend a lot of time recently developing on AzuleJoe – it’s moving forward on a variety of fronts and there will be a couple of proper announcement posts in a few weeks.

This is, obviously, fantastic.

On the other hand – it’s also making it a little less ‘hackable’. One of the joys of the original code was that it was easy to retarget – if you had a bunch of pictures of grids and a text editor, then you could retarget AzuleJoe to talk about anything you wanted.

In recent months the code has started to look a little more professional – we use JSON for the data rather than Javascript, and quite a lot of extra code has been added to do all sorts of other things.  Our next big push will probably obliterate most of the original code anyway.

I think this is a bit of a shame, because I’d like to keep that ‘hackability’ as available  as possible.

The code

In an effect to keep an easily ‘hackable’ version of the code around. I’ve released a ‘tagged’ version on the github repository: (at the time of writing there have been 69 commits to the repo since the release, so the code is moving on without it).

The Demo

To show how easy it was to retarget the software to any pageset, I prepared a three minute video (bits of it are sped up – it was about 10 minutes in real life)

The voiceover was recorded while I was sick with cold and the mouse movement and even the typing is difficult to follow at times, but the point is that it points the curious in the direction of the right files to play with. And I’m on the other end of email if anyone would like more info.


Project Update: Supertitle

Screenshot 2015-05-21 13.58.48

So the Supertitle Project is starting to rise up a little bit, and it’s time to talk about where it is right now.  As you know, the Project was funded by the National Lottery to expand it into a broader piloting/research stage.  This means three things for me:

  • We need to find a group of schools that are willing to get involved with a relatively untested project.
  • I need to write some code so that students can see how the subtitles are forming in the classroom, and show them off at home.  Some of this code was already written for the prototype of course, but it mostly needed me present to run it.
  • I need to work out a proper way of doing research to make sure that the project is genuinely having a positive effect.


To make this happen I’m doing a lot of school visits, talking to teachers, finding out the best ways of working with schools so that their needs are met. I’m only visiting schools in the N and NW areas of London at the moment, partly because I live in NW, but also because I have other projects running in other areas of London and I think it’s best not to be bombarding schools with quite so many unusual ideas.   There are three involved right now and I’m hoping to make it ten by Christmas. If you know a school that might be interested, please get in touch.


The code is coming around.  More and more of is is automatic and right now it can be used easily without me on site – but it does need a significant polish to make it pretty and friendly looking. On the other hand – the demos are pretty:

Screenshot 2015-09-29 10.25.22This one is in English, simply because I didn’t have a translation handy – but it demonstrates the use case- students are given a file to edit and another file that lets them bring up the subtitles on a device they can just place near the TV. Everything syncs up nicely.


This is in two parts – on the one hand I’ve got a excellent PhD student who has experience in this sort of work – he’s preparing me a couple of research tools to give to students that are involved.  There’s a bonus to this. While the point of having proper research done on a project is clearly to make sure it works, it is also nice to have a nicely formatted pdf file full of p-values and carefully checked statistics to give to both schools and potential funders.

I’m also, partly due to the Inclusive Technology Prize and partly due to having a NGO-working girlfriend – being encouraged to look at more formal project tools like theory of change models. Some of them I’m finding really useful, some of them I’m finding difficult to get my head around – if anyone has a book called something like ‘Theory of Change for programmers’ I’d be interested to hear.

Looking forward

I’m hoping that by next May, we’ve set up regular Supertitle groups in a range of schools, and released research that show the project makes a significant difference in terms of student outlook. I’m also hoping that the code will be tight, and perhaps we’ll have even attracted a couple of other developers to extend it.



New (kind of) repository on github: Excel2latex

Image from

Image from

Something that I thought I’d put online some time ago is excel2latex.This is a very nerdy post so please skip over if you’re haven’t been hooked by the name.

Excel2latex is a simple webapp, you paste cells from an excel worksheet into it, click convert, and it outputs that table converted into LaTeX.

It’s a simple but useful app, produced by retargeting Shawn Douglas’s excellent Excel2Wiki app for converting excel tables to wikiformat. I only realised it hadn’t migrated from my old computer science address when I had need of it in the last couple of weeks.

When I found it, I also found a bunch of bugs. A few days ago I sat down and redid it properly – cloned the Shawn’s github repo, did all the sensible things with the code and fixed the bugs in my previous version. The code is on github, and there is a working version here.

A politician went “to see” the sea, “to see” what he could see…

So a few weeks ago I produced a tongue-in-cheek-with-a-serious-point post where I ranked MPs by how likely they were to provide citations for facts. It was quite fun and gratifyingly meant I was known to some people before I met them.
Shortly afterwards I was phoned by someone I know who works in politics.  Part of his role was social media and he wanted to know if he was imagining the tendency of MPs to provide tweets of this form:



If you work in politics, you don’t know many people who understand regular expressions (link to labour list) so I got the call.  I used the same dataset as I did for the citations – there was no point re-spidering for this sort of ’non time critical’ task, plus it meant that I wouldn’t have to add a repo if something interesting turned up.
First of all, in many cases, my friend wasn’t imagining it.  Step forward Andrew Selous MP,  the Conservative MP for South West Bedfordshire. A staggering  18% of his tweets of the classic “to see” format.
Now – there’s nothing wrong with that formation – in fact I quite like it-  it’s a useful format to showcase (in most cases) good work being done in your area.  Here’s the interesting bit.
When I did the citation ranking it was clear that there was no difference between the parties.  All three where represented at both the top and the bottom.  In general MPs where equally bad at citing, you know, evidence.
On the other hand, when you look up the particular structure they use… this is what happens.  Here are the top 30 users of the “to see” tweet formation.
Rank TwitterId Name Tweets “To See” Percent to see
1 @Andrew_SelousMP Andrew Selous MP 651 117 18% Conservative
2 @JackLoprestiMP Jack Lopresti MP 192 32 17% Conservative
3 @RobinWalkerMP Robin Walker 339 41 12% Conservative
4 @CrockartMP Mike Crockart MP 588 59 10% Lib Dem
5 @edvaizey Ed Vaizey 424 42 10% Conservative
6 @MarkLancasterMP Mark Lancaster MP 696 60 9% Conservative
7 @DavidRutleyMP David Rutley 509 42 8% Conservative
8 @BrandonLewis Brandon Lewis MP 615 50 8% Conservative
9 @SarahNewtonMP Sarah Newton 420 34 8% Conservative
10 @JakeBerryMP Jake Berry 557 44 8% Conservative
11 @DLidington David Lidington MP 219 17 8% Conservative
12 @RobertBuckland Robert Buckland MP 288 21 7% Conservative
13 @sheryllmurray Sheryll Murray MP 733 52 7% Conservative
14 @NickyMorgan01 Nicky Morgan MP 564 40 7% Conservative
15 @SCrabbMP Stephen Crabb MP 452 30 7% Conservative
16 @ChrisWhite_MP Chris White MP 395 26 7% Conservative
17 @HelenGrantMP Helen Grant MP 699 45 6% Conservative
18 @karen__bradley Karen Bradley 406 26 6% Conservative
19 @nickhurdmp Nick Hurd MP 441 28 6% Conservative
20 @TobiasEllwoodMP Tobias Ellwood 474 30 6% Conservative
21 @StocktonNorth Alex Cunningham 166 10 6% Labour
22 @George_Osborne George Osborne 871 52 6% Conservative
23 @AlunCairns Alun Cairns 388 23 6% Conservative
24 @MingCampbellMP Ming Campbell 17 1 6% Lib Dem
25 @karlmccartney Karl McCartney 210 12 6% Conservative
26 @pauluppalmp Paul Uppal 623 35 6% Conservative
27 @PhilipDavies422 Philip Davies 109 6 6% Conservative
28 @GBirtwistle_MP Gordon Birtwistle 656 36 5% Lib Dem
29 @JustineGreening Justine Greening 604 33 5% Conservative
30 @cj_dinenage caroline dinenage mp 386 21 5% Conservative
Alex Cunningham looking a little lonely as literally the only Labour MP in the top 30.
Which is bizarre, improbable, and fascinating. I can’t imagine that anyone would change their vote on the basis of this but I have to wonder why it occurs?   The most obvious option is that this is the textbook example taught in Conservative Social Media Training, and what we are seeing in people tweeting the party line as hard as they can…
Any ideas?

AzuleJoe: behind the scenes of the CommuniKate 20 demo

One of the parts of CommuniKate 20 that turned out to be very popular is the live demo (you can view a video of it in action here).

It’s time to talk a little bit about that live demo and how it works. This is one of those posts that’s only focused on the technical reader. It will have very little value to the non-coders among you I’m afraid.

The live demo software is called AzuleJoe, it’s entirely open-source and, like almost all the code presented on this site, it’s available to download from github.

When you view the live demo, what you are actually looking at is the CommuniKate 20 pageset running on the AzuleJoe software. The software that became AzuleJoe dates back to 2009 when I built a system for my little brother. When we started to prepare CommuniKate 20 for public release in 2014, the software was significantly overhauled into something that developed it’s own identity

The name ‘AzuleJoe’…

In case you are wondering, the name ‘AzuleJoe is pronounced A-fo-lec-oy, AzuleJoe is a Basque word meaning Tiles.  I Apologise for the ‘out there’ nature of the word but when you are trying to find a word that sounds like it might be something to do with an AAC device and also includes “Joe” as the last three letters (“CommuniKate” rather painted me into a corner) you are pretty happy with a short word that means Tiles.

Why is it separate?

Of course, we could have folded AzuleJoe in with CommuniKate and left it as a simple online demo. The reason we that we separated out the projects should be obvious to anyone browsing the repository: AzuleJoe can demonstrate any pageset, not just CommuniKate 20.   CommuniKate 20 is the first openly licensed pageset, we have no intention that it should be the only. 

If you’ve got a pageset that you would like to see running online easily, then the AzuleJoe code will help out, and indeed, Joe will probably help out if you ask.



Some of AzuleJoe’s design features might be a little unexpected on first viewing, but they are generally part of a reasoned view.  Let’s look at one in particular.

Full page images

You might expect that the images that AzuleJoe works on to look like this:

Screenshot 2015-02-13 12.10.12

Instead they look like this:


There are sensible reasons for this. First of all it was useful for the development of the pageset. Kate put CommuniKate together as a PowerPoint file. I then exported that into images and put those images directly into the software. Each image has an accompanying JavaScript file that tells the software what do do when each zone on the screen is pressed. Currently I generate these JavaScript files by hand, but the next version of AzuleJoe should be able to generate them automatically from the PowerPoint files.

Here’s the JavaScript file that goes with the image above.

function breakfast(){
    utterances[0][0]="yes ";
    utterances[1][0]=" ";
    utterances[2][0]=" ";

    utterances[4][1]="bran flakes";


    utterances[0][3]="boiled egg";
    utterances[1][3]="fried egg";
    utterances[2][3]="scrambled egg";
    utterances[4][3]="full English";





You can see how simple this is to build, one image for every page and one very simple file to go with each one.


Why is this useful?

We think that pageset design should be as simple as possible for users. If it’s PowerPoint it can be a communication book as quickly as it can be a working AAC demo. We want to be able to say to people “Here is a PowerPoint Template, now you can build a pageset concentrating on the language rather than the buggy interface some programmer threw together. When you are finished. We’ll expand it out for you.”


I like open source things, how can I get involved?

We love the idea of people helping out with the code. Because AzuleJoe is currently such a simple project, it’s there are a lot of easy things that people can do to help. So if you’d like to fork the repo to, for example:

  • provide scanning
  • use native TTS on android (or any other format)
  • retarget AzuleJoe to a different pageset
  • import from (hard) or export to (medium) the openboardformat
  • precompute utterances

Then we’d love to see what you can do. I’d also love to hear from people who are used to working with the Microsoft Office file formats.









Open source…taking the step for a hobbyist.

A quick off topic post about open-source software and how, rather than why, I’ve got to the point where I’m happy to put all my code out there.

HeartbleedIt is not a co-incidence that I started doing a lot more open source stuff after the heartbleed bug came out. In principle this is strange: heartbleed was a major blow for the ‘security by openness’ doctrine and dispelled the myth that ‘it must be secure: it’s open source so someone would have noticed if it wasn’t’.

The, rather sad, reason that I hadn’t released any code openly on GitHub before is that I was, basically, afraid that people would make fun of my code. I’m a good designer of algorithms, and I like to think that I can hold my own, but there are a lot of impressive people prowling the Internet and I’m aware of the massive amount I don’t know. Plus the fact that the projects I have up in JavaScript and Python are (effectively) the only projects I’ve ever completed in those languages and the coding resembles a child’s fingerpainting.

The thing I learned from heartbleed is that “almost nobody is going to bother to read your code”. The second thing that follows up is this: if someone is reading your code: it’s to find out how you did something. The people who intimidate you aren’t reading your code because they already know how to do it: that’s what makes them intimidating.

Realising this meant that I’m now releasing almost all of the hobby/project code I do. It’s being forked and modified by people and I’m learning a lot from the process. Also because I do like to take pains to make things at least mildly pretty before I do l, it’s making me a better coder. And the more people that make the switch, the better we’ll be.

EDIT it’s been pointed out to be that another reason not to release code it that it’s embarrassing if your code turns out to be wrong. To which I say: yes it is but there are two ways you can find out code is wrong: either someone reads it and points it out, or it goes very very wrong link. So stop being me-me-me and suck it up.

Importing Oyster Card records into Google Calendar

This is a code post – I’m sharing some code I wrote for importing Oyster card information into Google calendar in case other people might enjoy it.  The github is here. As I’ve posted about before in various places, I’ve got an interest in self-tracking. I think that humans are adept at telling themselves lies about their lives and data is a good way of finding out the truth about yourself. I’d like to think I strive to be a better person, and collecting a small amount of data can do that, I’m in. Generally I like my tracking ‘set up once and look at periodically’. I’ve shared how I keep track of my inbox, and a few other bits of code, today we are going to look at transport. I live in centralish London – anywhere I’m going (with maybe three exceptions in the last year) involves me using my oyster card. Even when I’m leaving the city my oyster card is what gets me to places like Kings Cross and Euston where I generally collect my long distance tickets. This means that the records that Transport for London have are generally a pretty accurate record of where I am in the world.  I dislike the idea of TfL having that data without me being able to access it, so I wrote some code that converts the TfL format into a proper calendar format. Let me take you though the process. Once a month I download my Oyster Travel statement from the TfL website (I use contactless payment now because I can have one less thing to carry around – the code works with both the old and the new way of keeping records)

Screen Shot 2014-11-12 at 09.29.38
Using the java code that you will find at this git repository I run the command:
 java createcalendarevents/OysterProcessor
I select the file I downloaded:Screen Shot 2014-11-12 at 09.32.05
…save the output to a *.ics file and then open it with iCal on my mac. I get to choose the calendar I want to add it to:
Screen Shot 2014-11-12 at 09.33.09

This syncs up nicely with Google Calendar and ta-dah! I know where I was for a month.  Here, for an example, is the journeys I took for in a random week last year.  It might look like a diversion, but it’s a nice way of avoiding a bunch of the ways you might lie to yourself “I always leave in plenty of time”, “I go to the gym twice a week”, “I’m always home in time to see the kids before I they go to bed.  Worth finding out these things about yourself.

Screen Shot 2014-11-12 at 09.36.27

Eclipse Plugins

Screen Shot 2014-09-19 at 20.02.45

This is a code focused post for people who arrive here from Google – it’s a post I would have found extremely useful a couple of years ago. The next half dozen post in the queue are very disability-focused.

tl;dr you can get the code from github here.

Part of my work on the PLanCompS project recently was in building plugins.

When I started out I found there was relatively little in the way of useful stuff for me to learn from.   There were forum’s that didn’t answer questions – stackExchange sites that made an attempt but I never quite worked out, after months and months exactly how anything was really working under the hood.  And I found the only available book on the subject very very poor indeed.  

Almost all the work I produced was from copying and pasting code samples and trying them in effectively random permutations until something worked – the sort of coding I though I’d left behind at undergraduate level.  

What I really really needed, was just the odd example project.  Just a zip file that I could download, import, run – see the behaviour and *then* play with.  And now that I’ve got much further with Eclipse plugins – I can build such things for other people.

So this (github link) is a stripped down editor – all it does is performed syntax colouring on files with the extension *.example.  It highlights comments in two formats – either c-style “//” or within special tokens “(* like this *)”.  It also highlights a range of other tokens as will be clear in the code.  I should say that I’m nobody’s idea of a commercial coder, the code is ugly all over even to my rought-and-ready eyes – but it’s simple and it runs and people can edit it.

The payload file for syntax colouring is ExampleRuleScanner, and the particular lines to play with might be these:

rules.add(new EndOfLineRule("//", commentToken));
     rules.add(new EndOfLineRule("//", commentToken));
    rules.add(new EndOfLineRule("#", commentToken));

    rules.add(new WordPatternRule(iWordDetector, "foo", "", keyword));
    rules.add(new WordPatternRule(iWordDetector, "bar", "", keyword));
    rules.add(new WordPatternRule(iWordDetector, "`", "", backquoteToken));

    rules.add(new SingleLineRule("'", "'", stringToken));
    rules.add(new SingleLineRule("\"", "\"", darkStringToken));

    rules.add(new SingleLineRule("(*", "*)", commentToken));

Have a play! comment out things, follow the links and play – but this is exactly what I was looking for some time ago. 

To tell you a little bit more about each of the files in the project: 

ExampleEditor is the one that the Editor extension point points to – it’s the main class for editors – you’ll notice that it extends the textEditor class.  From your point of view there is relatively going on in the class itself – the main line is actually: 

 setSourceViewerConfiguration(new ExampleSourceViewerConfig(this));

…and almost all the work happens in the ExampleSourceViewerConfig.  Not just for syntax colouring either – when you are setting up things like formatting, hovering, setting and using markers and so on – all that will be put in ExampleSourceViewerConfig by means of methods overriding the superclass. 

In this case the code that allows the syntax colouring in ExampleRuleScanner to connect with the editor is in two places – first: 


public ExampleRuleScanner getTagScanner() {
    if (scanner == null) {
      scanner = new ExampleRuleScanner();
      scanner.setDefaultReturnToken(new Token(new TextAttribute(DEFAULT_TAG_COLOR)));
    return scanner;

and secondly:

  public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
    PresentationReconciler reconciler = new PresentationReconciler();
    DefaultDamagerRepairer dr = new DefaultDamagerRepairer(getTagScanner());
    reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
    reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
    return reconciler;

(both in ExampleSourceViewerConfig) 

The other class in the package, ExampleFormattingStratergy isn’t actually necessary for syntax colouring – it’s left there so that you can extend to formatting if you like.  If you wish you can fill in the following method: 

  public String format(String content, boolean isLineStart, String indentation, int[] positions) {

    //your code here
      return content;


In the very naive case – all you have to do is to take the string coming in, adjust the whitespace and return it.  Unfortunately one of the small surprises about formatting for your editor is that the triggering isn’t implicit – the normal Java shortcuts only work in the java editor – you’ll have to set up your own trigger – either a binding, a menu or a button.  Entirely up to you.  I did however leave a method in the ExampleEditor file for you to trigger for this: 

  public void reformat() {
    SourceViewer sourceViewer = (SourceViewer) getSourceViewer();

An atq script that might be useful

So as I mentioned in the last post – I’m in the process of leaving my job at Royal Holloway, this has obviously involved a bit of handover work and I took the time to make some of it more widely available.  If you are a regular reader this is NOT a post for you – this is a very specialist one that will probably only appeal to people arriving from Google.

I use ‘at’ to schedule jobs and ‘atq’ to display the scheduled jobs. But it mildly irritates me in that I have to look up each job individually.  I wrote a Python script to display the scheduled job under the scheduled time.

(In my world all the commands will begin ‘task’ – you would modify the script in the obvious way)

So instead of

 8 Mon Aug 18 09:00:00 2014 a joseph
 10 Tue Aug 19 09:00:00 2014 a joseph
 15 Thu Aug 21 09:00:00 2014 a joseph
 12 Fri Aug 22 09:00:00 2014 a joseph
 9 Thu Aug 21 09:00:00 2014 a joseph
 14 Sat Aug 30 09:00:00 2014 a joseph
 7 Sun Aug 17 09:00:00 2014 a joseph
 6 Mon Aug 18 09:00:00 2014 a joseph
 11 Sat Aug 30 09:00:00 2014 a joseph

My script produces

8  Mon Aug 18 09:00:00 2014 a joseph
task "buy a four-way plug adapter" 
task "see guy about meeting" 
10  Tue Aug 19 09:00:00 2014 a joseph
task "bring back personal effects from office" 
15  Thu Aug 21 09:00:00 2014 a joseph
task "book tickets for next week"

It sorts the output by date effectively (as in, it sorts by date that you expect things will be executed rather than the date things where added, which is the default).

The code looks like this, and I’m grateful to the stackoverflow guys for helping me to tighten it up considerably.

#!/usr/bin/env python

import subprocess
import re
import datetime
from operator import itemgetter

re_job_number = re.compile(r'\d+')
joblist =[]
for atq_line in subprocess.Popen(['atq'], stdout=subprocess.PIPE).stdout:
    job_number =
    date_string= atq_line[len(job_number):].strip()
    for at_line in subprocess.Popen(['at', '-c', job_number], stdout=subprocess.
        if at_line.startswith('task '):
    result=result+ '-' * 40
    item=(date_string,  result)
joblist.sort(key=lambda item: datetime.datetime.strptime(item[0], '%a %b %d %H:%
M:%S %Y a joseph'))

for x in joblist: 
   print x[0]
   print x[1]

Some Twitter code (Warning, coders only)

So in a previous post I promised to share the code that lets me keep track of the people that actively engage on Twitter – that reply or retweet. As I promised that six months ago I thought it was time to dig out the code. It’s relatively straightforward, mostly because I use the Twitter4J library to do most of the heavy lifting. Hope this is useful for someone.

If you are willing to do some coding, here is how it would work in java…

package twitone;

import java.util.ArrayList;
import java.util.Map;

import twitone.structure.BaseTwitterClass;
import twitone.structure.TwitApplicationFactory;
import twitter4j.Paging;
import twitter4j.RateLimitStatus;
import twitter4j.Status;
import twitter4j.Twitter;
import twitter4j.TwitterException;

public class MyRetweeters extends BaseTwitterClass {

  private Twitter twitter;

  public MyRetweeters(Twitter twitter) {
    this.twitter = twitter;

  public static void main(String[] args) throws TwitterException {

    Twitter twitter = TwitApplicationFactory.getjoereddingtonTwitter();
    MyRetweeters unit = new MyRetweeters(twitter);
    String temp[] = unit.get();
    for (String string : temp) {

  public String[] get() {
    ArrayList names = new ArrayList();
    try {
      for (Status status : twitter.getUserTimeline(new Paging(1, 200))) {
        if (status.getText().startsWith("RT")) {
          // skip
        } else if (status.getRetweetCount() > 0) {
          // Because I don't want to breach
          // Twitter's rate limits
          // okay the below has been added to keep within the rate
          // limited.
          // end keeping within rate limit code.
          for (Status rt : twitter.getRetweets(status.getId())) {
            System.out.println("---" + rt.getUser().getScreenName());
    } catch (TwitterException e) {
    } catch (InterruptedException e) {
    return names.toArray(new String[names.size()]);

   * @throws TwitterException
   * @throws InterruptedException
  protected void waitUntilICanMakeAnotherCall() throws TwitterException, InterruptedException {
      Map<String, RateLimitStatus> temp = twitter.getRateLimitStatus();

      RateLimitStatus temp2 = temp.get("/statuses/retweets/:id");
      if (temp2.getRemaining() == 0) {
        Thread.sleep((temp2.getSecondsUntilReset() + 5) * 1000);
      int secondstosleep = 1 + temp2.getSecondsUntilReset() / temp2.getRemaining();
      Thread.sleep(secondstosleep * 1000);

This code will print out every tweet you’ve made recently, along with the IDs of the people who retweeted it. A couple of quick things to note – mostly that this line:

Twitter twitter = TwitApplicationFactory.getjoereddingtonTwitter();

won’t work for you – that’s me getting my own API key and so on, you’ll have to write your own…

You should also know that this only works on the last 200 tweets, largely because that’s all I ever needed, it would be fairly simple to loop over the pages.

If you want replies rather than retweets, that’s actually much quicker and easier:

private String[] getReplies() {
		ArrayList names = new ArrayList();
		try {
			for (Status status : twitter.getMentionsTimeline(new Paging(1, 200))) {
				if (status.getInReplyToStatusId() == -1) {
					// skip, possibly/likely spam, I'll pick up the genuine
					// ones by hand
				} else {
		} catch (TwitterException e) {
		return names.toArray(new String[names.size()]);
	} // TODO Auto-generated method stub