Archive

Archive for the ‘code’ Category

NodeJS and MongoDB on Raspberry Pi

March 25th, 2013 Comments off

I was hoping that installing these would be as simple as apt-get install nodejs and apt-get install mongodb but it took a little more than that. NodeJS is straightforward but I needed this guide to build and install MongoDB. Even with this, the process took about a day to grind out on the Pi and left me with 75% of my SD card full.

Something they don’t really get into in the guide is that you need use raspi-config to knock the GPU memory down to 32mb in order for the build to succeed. Without that extra memory, the linker will fail with “ld terminated with signal 9 [killed]“.

The next step is to apt-get install npm and you can add express and mongoose to get your app started.

Categories: code

Hosting on a Raspberry Pi

March 22nd, 2013 Comments off

I bought a Raspberry Pi this week and used it to replace the server this blog is hosted on. There are plenty of guides to installing WordPress on the Pi but I was pleasantly surprised to find that none of them were necessary and the whole process took only a few hours.

The old radiation king server vs. the new multi-coloured contender.

I even managed to get Ampache up and running with little effort. Tomorrow I will add NodeJS and MongoDB and see how they run.

It is not as fast as the last server but the switch from a 250w power supply to the 3.5w that the Raspberry Pi consumes makes the whole effort worthwhile. I have overclocked the Pi, switched on Quick-Cache in WordPress and now I’m happy with the results.

Categories: code

Testing file uploading with curl

September 21st, 2012 Comments off

Today I spent some time adding user avatars to a NodeJS application. I’m using Formidable and Express to do it, but it’s finicky enough that I want to get the endpoint working before I start doing any forms.

If you want to upload an image with curl you can use

curl -d @avatar.jpg "http://localhost:3000/avatar/2"

but if you want to add some ancillary data, you’ll need something like;

curl -F "file=@a.jpg;type=image/jpg"-F "id=2" "http://localhost:3000/avatar/2"
Categories: code

Bletchley Park & The Syko Machine

August 23rd, 2012 Comments off

Whilst we were visiting Cambridge last month, we had an opportunity to take a trip to Bletchley Park. During the second world war the estate became the Government Code & Cypher School, where many of the brightest mathematicians and engineers of the time laid out the future of modern computing. Today the original buildings have been taken into a trust by volunteers and the large campus houses a number of museums, open to the public.

I have always wanted to visit but even more so since I found this passage in my Grandfather’s military record, from the Military Archive in Cathal Brugha barracks.

Syko Code Reportwhat

The entry is very cryptic; what is it referring to? He worked in G2, the Irish military intelligence organisation during the war (or ‘emergency’ as we like to call it). When I searched for the mysterious ‘Syko Code’ mentioned in the report, I was directed to the Park museum where they have one of the machines on display.

Bletchley Park is not pretty, it is a rather stuffy victorian house surrounded by dilapidated one-storey buildings of both brick and wood, painted white. The complex has a curiously anonymous understated air and does not look at all as if 9,000 people worked there.

The trust at Bletchley Park have restored the huts and equipment contained the Turing Bombes and Tommy Flower’s Colossus, but they have done so on a very small budget which has ensured that the complex is not over-restored and retains its original feel. Most of the important work was done in hastily-erected huts which were not intended to be permanent structures, you can see one being restored here.

Hut at Bletchley

 

We went on a tour with one of the volunteer guides which took us through from the construction of the first bombe to the electric relay machines that were necessary to decode the more complex ciphers that were in use towards the end of the war.

The staff made a really good job of illustrating the chronological progression of the code-breaking equipment as the cipher complexity ramped up. It is also possible to see how it ties in with Turing’s pre-war papers which are all presented in the museum.

bombe

Turing Bombe

 

Seeing the machines in situ conveys a very good sense of how cramped and gloomy the working conditions were. Once the Colossus machine starts running it also becomes very hot and noisy.

The guide painted a vivid depiction of the hut, blast walls over the windows, filled with cigarette smoke, hot in summer with the machine on and cold in winter when they pushed messages through a pipe connecting the decryption and descipherment huts.

Operating a bombe meant a full 8 hour shift on your feet and the Wrens only had a partial picture of the process. Communication between huts was forbidden and one Wren only discovered that the phone she used to deliver results connected to a neighbouring hut when she came back to visit the interpretive centre recently.

It seems the Bombe was a universal enigma machine. The intention was to “remove hay from a stack to find the needle” i.e. brute force the messages, and each 3 wheels on the bombe replicates one enigma machine. As you can see from the photographs, each bombe can attempt many parallel attacks.

Eventually this wasn’t enough. Although the Bletchley Park codebreakers made many optimisations and shortcuts, the Germans could exponentially increase the key size by adding wheels to their Enigma machines.

The Lorenz machines used towards the end of the war were invunerable to Bombe decryption but, with D-Day as a deadline, Tommy Flowers managed to deliver the first valve-driven electronic relay computer, Colossus.

Reconstruction of Colossus

Colossus was the real reason that the facility was shut down and dismantled after the war. Churchill wanted to make sure the Russians knew nothing of the decryption successes and there was a spy, John Cairncross, working in the facility.

The site also houses the National Museum of Computing, featuring an amazing array of familiar old machines. But the part I was really waiting for came at the end of the day when we visited the exhibition centre. Right at the back, behind the much more impressive Enigma and Lorenz machines, I found the Syko display case.

The Syko Display

 

There are two machines, each with a description. They have carry cases and metal trays for holding messages. Evidently they were intended to be portable and they required no power source. Even from looking at the layout of the machine, it is obvious that the cipher is not very complex and in fact the German B-Dienst service cracked it during the war.

This does not particularly detract from the usefulness of the cipher; with regular changes of key, it could be used safely for air and sea traffic. “80 percent of the intercepted radio messages were read. However, only 10 percent of them were decrypted in time to take effective action

Syko – Mark I

 

“A low-grade British mechanical cipher machine used for ground to air instructions by the RAF in World War Two. This cipher machine is very fiddly to use as the paper strips tear very easily.

This wooden-cased version dates from 1936 and is a prototype.”

Syko – Mark II


“This cipher machine is an improved version of the Syko Mark I British mechanical cipher machine used for ground to air instructions by the RAF during World War Two.

The Mark II Syko utilised sliding letters instead of paper strip and was more durable. The Mark II was used in the later stages of World War Two.”

I was delighted to finally get to look at the machine after chasing up the references but it did occur to me that it was unusual for the RAF to share encryption resources with the Irish intelligence service during the war when we were a neutral country. There was definitely a link between British and Irish intelligence at this time and some of the information collected in Ireland would have been of great interest to the RAF.

It appears that my Grandfather was also involved in collecting intelligence at Foynes airport and tracing bomber flight paths. The service was also involved in picking up and debriefing downed pilots from both sides. Maurice Walsh’s book on G2 describes the involvement of the head of signals at G2 (Richard Hayes) in the code-cracking effort; it details the contributions of G2 in breaking the Goertz cipher and a visit from ‘the head of their Cipher Department at Bletchley’.

Perhaps we were given the Syko machines in recognition of this collaboration or perhaps just so that British intelligence could monitor anything sent using the machines. There is a precedent for this; many former colonies were given Enigma machines by the British in the post-war period without being told that MI6 could read their messages. We also spent £1 million on a Crypto AG machines during the Anglo-Irish negotiations in the 1980s that later turned out to have a back-door for MI6.

 

 

Categories: code, personal

Happy St. Patrick’s Day!

March 16th, 2011 Comments off

I put a simple game together for a St. Patrick’s Day campaign for ammado – you can visit the campaign here or give them a donation . Shane McElveen supplied the graphics.

Categories: code

How do I fix broken tweens in Actionscript 3?

August 3rd, 2010 Comments off

You may have noticed your fades or other transitions lock up occasionally. Well, it turns out that this is down to over-enthusiastic garbage collection and can be fixed by simply declaring your tween object in a higher scope, as a private class member for example.

Categories: code

After Effects CS4

January 27th, 2010 Comments off

I spent some time today trying to diagnose a performance problem with Adobe Media Encoder CS4. One of the designers I work with had upgraded to Creative Suite 4 on an old PC and he quickly found that simple rendering tasks from Premiere Pro CS4 were now taking days to complete.

Most of the solutions on the web advise purchasing expensive hardware upgrades, but there is another workaround; the designer also had Adobe After Effects CS4 installed and it still uses its own render queue. All the Media Encoder render and compression options are available within this queue, but it performs much faster.

The clip we were trying to render took just two hours in After Effects, compared to an estimate of over 100 in Media Encoder. You can also send Premiere Pro projects to After Effects for rendering.

Categories: code

Note to self: can’t load AS2 Swfs into Flex 2.01

March 28th, 2007 Comments off

After looking around for somewhere to put these notes, I’ve decided that here is the place. Anything computer-related is in a seperate category but alas, I can’t be bothered to create a new template yet.

Anyway, yet again Flex produced a ‘An internal build error has occurred. Please check the Error Log.’ message and yet again it took me ages to track down. The log error looked like this;


java.lang.ClassCastException
at flex2.compiler.media.MovieTranscoder.extractDefineTag

and I eventually realised that Flash was exporting AS2.0 swfs by default. The compiler had choked up when it tried to link the swf to the Flex movie. Friendly error message guys!

Categories: code

Art of Decision

May 22nd, 2005 Comments off

The exhibit I’ve been working on for the Art of Decision exhibition in the Digital Hub is more or less finished. I took a couple of short clips at the launch;

DATAmap

Categories: code

Upgrade Finished

November 23rd, 2003 Comments off

It all looks the same, but I’ve finished moving the site to a new local server. The IARGallery dev server is still here too

Categories: code