Is it better to store files in books?

The lifespan of a floppy disk is 20 years, magnetic tape 10 years, and hard disks only 5 years.  The oldest books in the world are thousands of years old, as old as civilisation itself, coming from the ancient kingdoms of Sumeria and Egypt. Do we owe it to our future generations to start backing up our digital media as 1s and 0s in books?

A book.
This is a book.

A 10 pt page can fit approximately 5000 1s or 0s, or 5 Kb of information, hardly an impressive size. We can fit much more by reducing the font size and printing double sided. Let’s give a conservative estimate of 50’000 bits per sheet of paper (6.25 KB).

It’s quite obvious that this is not a good way of storing written words – language is a tad more dense than bits. However, there currently is no future-proof way to ensure our music today is heard as it should be. Is this the best way of recording music for future generations?

MP3s are typically 128 Kb/s. Applying that to our bits per paper means a book of 4’300 pages could hold Rick Astley’s Never Gonna Give You Up replacing the space taken up by your Song of Ice and Fire collection on your bookshelf. This is worth it.

Unity Fireworks

In the March Code Dojo, I was tasked with creating fireworks within the 2 hour time limit and, for a change, I decided to do this using Unity.

The scene consists of a fireworks spawner game object which randomly instantiates firework rockets around itself which move upwards and, after a random amount of time, explode. The firework sparkles explode outwards by the physics engine doing its thing since they are all spawned roughly in the same place.

Fireworks implemented in Unity
Fireworks implemented in Unity

Obviously, since everything is a cube, this Unity scene is a tad artistic.

Git Repository for this little program can be found here.

Top Five Reasons why Java is the WORST Programming Language OF ALL TIME

  1. Oracle doesn’t even like you any more. Its a fine language and all, but it seems as if everyone just wants Java to die. Oracle said a few time periods back that they had lost interest in Java so what the hell am I even doing learning it?
  2. I have to press shift a lot. OK Java. We get it. You like the curly braces. Well fuck you, Java. My pinky hurts from all those pairs of {these things} you force me to type. At least the semi colon is sympathetic to the shift key.
  3. It has a confusing name. Why the hell did the people who created Java not call it something distinctive? Why did they have to share their name with the first half of JavaScript? Even if they were both created in the same year, this is outrageous and ridiculous and incredibly confusing for anyone who has failed to look up the difference.
  4. You want me to install McAfee. Ok sure, Oracle, you are clearly in money problems and need to get stupid adverts in your installer but seriously, McAfee? Is that the same software that John McAfee described as one of the worst products on the fucking planet? Yea, thanks, but no thanks.
  5. Java-hate memes are overrated. Its okay to hate Java, but really, if that’s the only defining feature of your personality, something has gone horribly wrong.

Southampton Game Jam 2017

Over the past weekend, I participated in a Game Jam hosted at the University of Southampton during which I helped develop from scratch a game in Unity with four others. The game was called Jesticles and its basic premise was to walk around, stopping fights, and directing agents across the road onto a bus.  It was vaguely related to the jam’s theme of Revolution since if you didn’t act fast enough, a revolution would occur, ending the game.

Screenshot from Jesticles
Jesticles: Politicians are stumbling out of Jesters determined to start a revolution- get them safely across the road and onto the bus!

The game was my, and I suspect most of my team members’, first real experience with C# and the Unity engine and it was fun adding stuff and writing code to fix in-depth issues wherever it was needed. Though, I must confess, how Unity handles control flow and objects is quite confusing and there is no doubt that we did not follow best practices during this 48 hour project.

GitHub repository can be found here.

Southampton Game Jam page can be found here.

ASCII Art Converter

In the February Code Dojo, Jemma and I made an ASCII art converter in Java that takes an image as input and converts it into a text document which, when zoomed out far enough, imitates the original image.

The output text document, the input image, and the input image converted to greyscale.
From left to right, the output text document, the input image, and the input image converted to greyscale.

This was done by first iterating over every pixel in the image after it has been converted to greyscale. The luminance of every pixel was then calculated by using a formula found online:

// calc luminance in range 0.0 to 1.0; using SRGB luminance constants
float luminance = (red * 0.2126f + green * 0.7152f + blue * 0.0722f) / 255;

This luminance value was then stored in a very large 2D array. The array is then looped over and certain ASCII characters are chosen based on the luminance value selected.

diffLum is the difference between the largest value of luminance found (largeLum) and the smallest value of luminance found (smallLum), the addition of this as opposed to set values between 0 and 1.0 mean that the whole range of characters is still used even if there is not a great difference in the source image’s luminance values.

// choose brightness threshold as appropriate:
if (luminance <= (diffLum*0.1) + smallLum) {
    chars[x][y] = ' ';
} else if (luminance <= (diffLum*0.2) + smallLum) {
    chars[x][y] = '.';
} else if (luminance <= (diffLum*0.3) + smallLum) {
    chars[x][y] = ':';
} else if (luminance <= (diffLum*0.4) + smallLum) {
    chars[x][y] = '-';
} else if (luminance <= (diffLum*0.5) + smallLum) {
    chars[x][y] = '=';
} else if (luminance <= (diffLum*0.6) + smallLum) {
    chars[x][y] = '+';
} else if (luminance <=(diffLum*0.7) + smallLum) {
    chars[x][y] = '*';
} else if (luminance <= (diffLum*0.8) + smallLum) {
    chars[x][y] = '#';
} else if (luminance <= (diffLum*0.9) + smallLum) {
    chars[x][y] = '%';
} else {
    chars[x][y] = '@';

The chars array is then looped over and written into a text, .txt, file.

The solution works well however the output cannot be resized and so the source image must be downsized quite a bit before it is truly useful as an ASCII converter.

Global Game Jam 2016

At University of Southampton, I helped develop an isometric real time strategy town management game where you must balance resource management with your relationship to the gods. I joined a team which participated last year and used a game engine that was developed in last years game jam. The finished product was called Vikings vs Gods: Cheese fortress and was overall a quite good game.
Screenshot from Vikings vs Gods: Cheese Fortress

It the 48 hours, I helped develop the basic quests and gods outline and tried to overall polish the game through adding unique mouse cursor, splash/intro screen, win screen, death screen, as well as fixing some issues that were left over from when the game engine was used from last year.

Git repository can be found here: Click me

Global Game Jam page can be found here: Click me

How to extract images from a Word Document

After Googling this question and being disappointed at how much work was needed to find a good answer, the only useful post was this old post for Word 2007, here is a definitive blog post about the topic. This post assumes use of a Microsoft Word 2013 though the method would work on almost any word processor.

The by far simplest method is to save the document as a webpage. This is done by choosing the correct file type when saving as a new file. This is done as normal when saving the file but choosing a different “save as type”.

The save screen when saving the document.
The save screen when saving the document.

Next, simply navigate to the folder where you saved the document as a webpage and you should find a new folder called “Example_files” alongside the new .htm file. Inside the folder will be every photo within the document in a .jpg format along with some meta data and other stuff you dont need to worry about.


Are the Labour party secretly lizard monsters?

What is it about the politics of today that makes everyone just feel a little bit shit? It could be that politicians are simply out of touch with the modern day human being and that could be because MPs aren’t in fact human beings.

A typical Conservative MP.


I, for one, welcome our reptilian overlords. After all, lizards are well known for being intergalactic space conquerors: can humans say the same about their achievements? I would say no.

Therefore, the only solution is a complete destruction of the current system of politics. We should collectively envision a world where people directly participate in politics through constant Lizard-to-People interactions in forums, meetings, and comedy festivals.