Articles

These articles are a random selection of write-ups I've done usually with the aim of helping me understand a new topic. With any luck they may even be useful to innocent bystanders.

C Pre-Processor Magic

C Pre-Processor Magic Implementing if-statements and iterators in CPP

The C Pre-Processor (CPP) is the somewhat basic macro system used by the C programming language to implement features such as #include and #define which allow very simple text-substitutions to be carried out at compile time. In this article we abuse the humble #define to implement if-statements and iteration.
The Signal logo.

Decrypting Signal for Android's Backup Files

Signal is one of the better specimens of the 'private messaging app' genre providing end-to-end encrypted messaging between mobile phones. Unfortunately, Signal does not yet provide a way to bulk-export your messages and media (for example for archival purposes). The Android app does, however, come with a rudimentary backup and restore facility which produces an encrypted dump of the internal state of the app which we'll walk through the process of decrypting in this article.
An Interactive Introduction to Lightfield Images

An Interactive Introduction to Lightfield Images

Imagine being able to take a photograph and then change the angle from which it was taken years later. Lightfield imaging allows you to do just this (amongst other magic-seeming things) and better yet, its a remarkably simple idea at heart.
Finding Shortest Paths in Hexagonal Torus Topologies

Finding Shortest Paths in Hexagonal Torus Topologies

Numerous people working on packet routing in SpiNNaker have been faced with the problem of generating shortest paths in the hexagonal mesh and torus topologies of SpiNNaker networks. This article introduces the (widely known) method for calculating shortest paths in hexagonal meshes. For hexagonal toruses topologies, the solution is less obvious. Though a number of solutions have been produced, this article describes a new, cleaner method which is able to generate all possible routes unlike existing solutions. Finally, we conclude with a proof-of-principle Python implementation which demonstrates the technique.
The Tickysim SpiNNaker Model

The Tickysim SpiNNaker Model

Tickysim is a timing-based simulator of the inter-chip interconnection network of the SpiNNaker architecture. This article describes the configurations used by on-going work comparing the simulator with a Bluespec SystemVerilog simulator implemented on an FPGA and the actual SpiNNaker hardware.
A globe with latitude and longitude marked.

How to Convert from Latitude and Longitude to Ordnance Survey Grid References

I have often naively wondered how to "convert from latitude and longitude to Ordnance Survey grid references" and recently finally found out. Though this question sounds fairly reasonable, it actually hides a large degree of naivety. Not only is it not actually possible to make an exact conversion between the two, the question also fails to realise that 'latitude' and 'longitude' have many wildly differing yet very sensible definitions. This article aims to be a hand-wavy explanation of why everything can't just be nice and simple while also working towards answering my initial question.