A Big Month Ahead

As I sit here on a rainy day in Wales, wondering when the sun might come out again, I get to thinking about the month ahead, because it’s a big one!

Firstly, it’s my birthday, but we’ll get to that later. The weekend after, on the 18th and 19th I’ve got two big things happening. I’m involved in a top secret project, so secret that you’ve probably all heard about it already! Well that weekend is our build weekend, so hopefully after that we’ll be able to announce it to the world. I’ll also be playing poker for the first time in my life, so it’s likely to cost me a lot of money!

You have hopefully already heard that the weekend of the 31st is EMF camp, the UK’s first hacker camp. I’m looking forward to a long weekend of camping and geeking out! If you’re free that weekend you should join us!

So that brings us back to my birthday. My birthday is when I make new year’s resolutions, for two reasons – one, it’s the beginning of my year, and two, I like being contrary :) so what are my resolutions for this year? Just the one in fact – to actually get some projects started and completed at the Hackspace! The secret project has inspired me to find the time to do my own things, rather than just turning up and getting nothing done.

So, here is my todo list for the next 12 months. I don’t expect to get it all done, but I want to make a start on a large fraction of it.

  • Snackspace invoicing system
  • Open source weather station
  • Toy alphabet blocks for Joah
  • Big bubble machine
  • Escaping blocks
  • Maybe some pummers?

That should keep me busy! Hopefully you’ll see some posts about these projects in the near future.

Precious Little Time

A week or so ago I took nine days off work to do some DIY – Destroy It Yourself!

With the help of family and friends I ripped our two downstairs rooms to shreds, removing all the 70′s style decor and in-built furniture as well as a massive brick fireplace.

At least I thought it was brick, but that turned out to be a clever facade for a massive block of steel reinforced concrete! After we’d levered it from the wall we spent the best part of 3 hours breaking it up. I then found out the actual fireplace inside the chimney breast is structural, so my plan to remove it and make a nice plastered alcove went up in smoke.

I spent the rest of the week rebuilding the services, rewiring and moving the radiators. My house being my house, all the electrics were running off one socket, like having daisy chain of extension leads! I now have a nice new ring main, and lights that are earthed. With my Dad now decorating we will hopefully have the rooms finished this weekend.

All this needs paying for, so I have spent every spare minute I’ve had doing contract work to pay for it, which unfortunately means I have had little time for the Hackspace or anything else.

Tomorrow’s open hack night is a focus point for me to get myself sorted, and with the open board meeting it’s a good job too! I’ll be working with some Hackspace members to get the website up to scratch, and will hopefully find some time to work on my catapult – version 0.6. Oh yes, there has been two more versions since my last post and I’m hopeful that 0.6 will be the one, so stay tuned for an update soon!

Long overdue

I really need to update this blog more often, if only to remind myself of what I’m up to! So this is hopefully the first of a few posts over the next few weeks…

In December the newest member of my family will arrive, and preparing for the baby is taking up a fairly large portion of my life at the moment – who knew how much research I could do for a car seat or push chair?! And how much DIY actually needed doing? But at least this has focused me into not actually wasting my time at the hackspace!

I’ve been thinking about kits…  As many of you know, we are putting together a MiniPOV kit from Lady Ada for use for a couple of workshops in the next few weeks, more about that another day!  But that has got me thinking about other kits we could make, and not just electronic ones.

So over the last couple of weeks I have been building a catapult using the new laser cutter at the hackspace.  Now on version 0.3, I thought I would document the story so far…

Version 0.1

Catapult Version o.1I decided to base the catapult on an Onager, with aspects of a Mangonel. This is a basic frame with a throwing arm linked to the frame using rope.  This rope also stores the energy for the throw, torsionally.

But how to make it 3D?  I decided to use knock-down tenon joints throughout, so I need to make sure the laser is accurate enough to make this without leaving the whole thing loose.  Will I need to makes the holes 10mm and the tenons 11mm just to compensate?

No! As it turns out, the laser cutter is extremely accurate and I can make the tenons and holes the same size and everything fits nice and tight.  I built the basic frame as a proof of concept.

Version 0.2

Catapult Version 0.2So let’s add a throwing arm! We need it to be spoon-like, but if we just engrave a dip, it won’t be very deep. By cutting two slightly different spoons, one with a whole and one without we can join them to make a spoon-type throwing arm.

I also increased the length of the catapult slightly so the throwing arm won’t catch on the back crossmember.

We now have the torsional rope (string!) and the arm, so we can test it!  Using some altoids as ammunition, this version gets nearly 2 metres (around 6 feet), but the projectile is leaving the catapult fairly parallel to the ground, so some improvements need to be made.

Also, as you can see from the photo, the side sections have some severe bowing, which eventually led to a crack when tightened.

Version 0.3

Catapult Version 0.3First of all, I moved the torsion pivot further forward past the centre crossmember.  This means the throwing arm will hit the stop brace before the vertical rather than after.  I’ve also added in another crossmember just after the pivot and turned both this and the centre crossmember to be horizontal.

I’ve also added additional side bracing from the centre to the front to increase the strength.

During initial tests, the winders failed, so I re-cut these out of ply.

With two full turns I managed to get a small metal nut about 3.5 metres (12ish feet) across the workshop!  After a few more quarter turns (with my teeth, it was so tight!) it managed 4.5 metres (15ish feet)!  Another quarter turn snapped the forward crossmember.

I think Dominic has video of this test, so I will update when it becomes available!

This is as far as I’ve got so far, onto version 0.4.  Once I’ve got it sorted, I will release the DXF file on thingyverse and make a kit which will be available from Nottingham Hackspace.

Wifi on Trains! Worth it?

On Tuesday I had to go to London for a two day meeting – never a fun prospect.

On the East Midlands train from Derby, I noticed that my laptop connected to the on-train wifi and was intrigued, especially with a cost of £4 per journey!

On the main page, EMT advertise the “actual” strength of connection to the Internet – could I use this to work out if the cost of the wifi was worth it?

Looking at the code, we see some fairly simple Javascript (with some jQuery):

function setSignal() { 
  $.getScript('signal.js', function(data) {
    switch(true) {
    case ((signal>=1)&&(signal<=8)):
    case ((signal>=9)&&(signal<=16)):
    case ((signal>=17)&&(signal<=24)):
    case ((signal>=25)):

$(document).ready(function() {
  $.ajaxSetup({async: false});
  window.setInterval('setSignal()', 4000);

It’s obviously calling signal.js and getting some information from there, so let’s have a look at that:

var signal=16;

nice and simple!  After my first days meeting a knocked up a quick script:

while [ 1 ]; do
  echo "`date +%H:%M:%S`\t`curl -k \
    https://wifi.eastmidlandstrains.co.uk/signal.js`" >> wifi.log
  sleep 5

and ran it all the way home, collecting over 1300 data points. (\ represents line continuation).

So what did I get? Below is a graph of all data points, with the station stops highlighted in orange, but it’s a bit messy:

Using the code from above, we can normalise the data slightly:

Generally the data looks quite good – much better than my mifi hotspot on the way down to London, which lost signal over and over again.

If you need to do work on the train (or just access the Nottinghack Wiki), this seems like fairly good value.  Not something I’d pay for on every trip, but will definitely use it when I’ve got stuff to do.

Mini-duino, part one

On Wednesday, at the hackspace, I finally finished my first project – a bench power supply built out of an old ATX power supply (as per this wikihow).  The last few months have been taken up with joining the hackspace and helping out with that – as you probably know, we have just moved into a brand new massive space!

So, now onto my next little project.  The idea is inspired by (well, copied from) Michael E - a mini-duino.

Michael had found two small tins, and was planning on putting an Arduino clone into one of them.  He put the other tin in the enclosures box… So I “acquired” it to do the same!

The box is fairly small, but fits a 9V battery in it snugly, so we could actually have this entirely self-contained.

Looking at it, I’m not sure if we can have stripboard under the battery or not, so I’ve started with the assumption that I can – it’s a lot easier to cut a bit off than add a bit on!

As the internal dimensions of the box are square (55mm x 55mm), I don’t even need to worry about the orientation of the stripboard, I can change it around later on.

So after some cutting and filing, I end up with this.  Not including under the battery, I’ve got 21 x 15 holes (obviously the stripboard will have copper down in the final product!).

21 x 15 is not many holes!  I will probably have trouble fitting the arduino circuit on here, so I’m going to try moving the power regulation circuitry elsewhere, which I started today, and will hopefully finish Wednesday.

I’ll post the results of the power circuit on Wednesday…

Point in Polygon: the old problem

Calculating whether a point on a 2D plane is inside a polygon on the same plane is a computer science problem from the beginnings of time!
If you are building a desktop based program, it can be simple – set up a drawing canvas off screen and colour it white, draw the polygon and colour it black, then get the colour of the point – black for inside, white for outside.
But what about those of us without the luxury of a GPU to work it out for us?
Let’s define our problem, a complex polygon, with three points – which are inside it.
For now, we will deal with the case of solid polygons.  Later we’ll discuss polygons with holes, and look at methods of dealing with them.
We also want to do this as computationally simply as possible – we don’t want to be waiting for answers, even for extremely complex polygons.
A solution to this problem involves drawing a horizontal line from outside the polygon to the point.
We count the number of times the line intersects the polygon – if it is odd the point is inside the polygon, eve and it is outside.
This will give us the right answer every time, but is not as simple as it could be.  Luckily, we can do a pre-test to exclude some points which is simple – is the point inside the bounding box?
Finding the bounding box is relatively simple, and checking whether the point is inside the bounding box is also very simple.
If our point is inside our bounding box, we continue and work out the line intersections, but if it is outside it definitely can’t be in polygon!
So how do we work out the intersections? As we know the corners of the polygon
(an array of points defines the polygon) we can iterate clockwise over the points and look at each side – do the line segments intersect?
If these line segments were in fact lines, we could simply work out the equations and solve them simultaneously.  Actually, it turns out we can do this anyway, with certain additional conditions.
Let’s work out the equations first, and we could look at the conditions later.  The corner we are looking at is i, the corner before is j and the point is p.  So we define the co-ordinates as:
The horizontal line is easy:
For the polygon segment, we can use the general equation of a line, and substitute our variables:
We know the y co-ordinate where our lines intersect, so we just need to work out the x co-ordinate.  Let’s solve the equations simultaneously and re-arrange to find x:
We now know the co-ordinates of where the two lines intersect, but we really want to know if the line segments intersect.
We do this by limiting the co-ordinates on the end points of the line.  The y co-ordinate of the point must lie between the y co-ordinates of the polygon side – this test is the easiest, so we do this first.  As you can see from the diagram, if the y co-ordinate of the intersect is outside these boundaries, it is not on the polygon side.
Finally, the most complex calculation – we use the equation we worked out early and solve it for x.  If this is above 0 and below the x co-ordinate of the point, it lies on the horizontal line segment.
If our point has passed all these tests, it intersects with this side of the polygon.  After we have iterated over each side, we add up all the intersects and see if it is odd or even – we have our answer!
So what about the code?  Let’s look at an implementation in JavaScript.  Assuming that we have an array of corners for our polygon:

var aPolygon = new Array();
aPolygon[0] = new Object;
aPolygon[0].iX = 73;
aPolygon[0].iY = 81;
aPolygon[1] = new Object;
aPolygon[1].iX = 111;
aPolygon[1].iY = 48;

And so on…, we can define a general function that takes a point and the array that defines the polygon:

function inPolygon(oPoint, aPolygon) {
    // bounding box first
    var iXMin = aPolygon[0].iX;
    var iXMax = aPolygon[0].iX;
    var iYMin = aPolygon[0].iY;
    var iYMax = aPolygon[0].iY;
    for (var i = 1; i < aPolygon.length; i++) {
        if (aPolygon[i].iX > iXMax) {
            iXMax = aPolygon[i].iX;
        else if (aPolygon[i].iX < iXMin) {
            iXMin = aPolygon[i].iX
        if (aPolygon[i].iY > iYMax) {
            iYMax = aPolygon[i].iY;
        else if (aPolygon[i].iY < iYMin) {
            iYMin = aPolygon[i].iY;
    if ((oPoint.iX > iXMin && oPoint.iX < iXMax) && (oPoint.iY > iYMin && oPoint.iY < iYMax)) {
       /* line segments
          take each side of the polygon and see if line from 0,pY to pX,pY goes through it
          to simplify, we can work out if pY is within the lines vertical bounds, then
          see if the point on the line at pY is less than pX */
        // loop through the polygon, looking at this point, and the one before it
        j = aPolygon.length – 1;
        var iIntersects = 0;
        for (var i = 0; i < aPolygon.length; i++) {
            if ((oPoint.iY > aPolygon[i].iY && oPoint.iY <= aPolygon[j].iY) || (oPoint.iY <= aPolygon[i].iY && oPoint.iY > aPolygon[j].iY)) {
                if ((((oPoint.iY – aPolygon[i].iY)*((aPolygon[j].iX – aPolygon[i].iX)/(aPolygon[j].iY – aPolygon[i].iY))) + aPolygon[i].iX) < oPoint.iX) {
            j = i;
        if (iIntersects & 1 == 1) {
            return true;
        else {
            return false;
    else {
        return false;

Feel free to use this function is any of your projects.

By the way, the equations above were created using the excellent LaTeX equation editor at http://www.codecogs.com/latex/eqneditor.php- my thanks go out to Will Bateman and Steve Mayer!

Playing with SharePoint 2007 Volume 1 – Dealing Without Designer

SharePoint.  For me this is almost a dirty word!  I would be much happier playing around with FOSS solutions, but when you work for a multinational the rules of the game are a bit restrictive.

But we all still need to collaborate, and SharePoint is the “global solution”.  As you already know doing simple things in SharePoint is easy, but anything a little bit different requires SharePoint Designer – a problem if your IT department don’t want you to have it!

Luckily there are other solutions, and over a series of posts, I’ll explain some of the workarounds that I’ve used.  All this information is available somewhere on the web, but sometimes it took me hours to piece it all together, so I wanted to write it down.

For now, let’s look at how we can get some custom code into our pages.

You know you can customise the front page of any SharePoint site by adding and moving web parts, but you can also customise other pages, such as list and document library pages.

One of these web parts is very important – the Content Editor Web Part.  You have probably already used this for displaying a message on a page – it has a rich text editor to display messages.  It also has a source editor, and in here we can put Javascript and CSS to change the way our page is displayed.

Last but not least, we need to remove all the chrome from our web part, so change the “Chrome Type” property to none.

In Volume 2, we’ll look at a basic use of this method: getting rid of column headers in web parts, or an individual web part

Cookies Galore!

I’ve spent the better part of the day making cookies!   I tried a few interesting combos, which I’ll detail at the end of this post.  For those that are interested, the recipe is as follows…

  • 125g Unsalted butter
  • 100g Granulated sugar
  • 75g Soft brown sugar
  • 1 Egg
  • 2 tsp Vanilla extract
  • 150g Plain flour
  • 0.5tsp Baking powder
  • Pinch of salt
  • 100g Fillings

Preheat oven to 190°C and line some baking trays with parchment.
Melt the butter gently over a low heat
In a bowl, mix the sugars together, add the melted butter and beat together.
Add the egg and vanilla and beat again.
Sift in the flour, baking powder and salt and stir.
Add the fillings and stir again.  Leave to stand for 10 minutes to stiffen.
Dot ~1tsp balls on the baking sheet around 5 cm apart.  This will make ~4cm cookies.
Bake for 8-10 minutes, then leave on sheet for 10 minutes to cool and harden.


The fillings can be anything, today I tried:

  • Milk chocolate
  • White chocolate
  • Milk chocolate and candied orange peel (50/50)
  • Milk chocolate and glacé cherries (50/50)
  • Milk chocolate and red chilli (half a red chilli, deseeded and finely chopped)
  • Milk chocolate and hazelnuts (50/50)