Nesting Structures from Flat Indexes

I don't always use recursion; but when I do, I don't always use recursion.

Reading time: about 4 minutes (961 words).

SQL databases are still one of the best ways of storing relational data, but sometimes you hit a wall transferring your representation to or from a table based layout.

Say we have a table full of Foos, where some Foos may have other Foo parents. This can easily be represented in a table with some unique primary key id, a secondary key parent, which joins to the parent's id, and whatever data Foo may hold. Retrieving this table into a rust data structure, we'd find ourselves with something like Vec<Foo>, where Foo is defined as

struct Foo {
    id: i32,
    parent: Option<i32>,
    data: String,

This isn't really the best way to represent these data though, what you really want is more akin to

struct Bar {
    id: i32,
    data: String,
    children: Vec<Bar>,

Clustering Tangent Spheres

Make yourself a little nest of eggs. Where your eggs are perfectly round and magically float in free space.

Reading time: about 7 minutes (1430 words).

So you want to do some sphere packing to make your inflatable space habitats for deployment on the Moon and Mars snug and cozy. Perfectly straightforward you think to yourself; since one can start with a triplet of spheres tangent pairwise by placing one at some origin on a 2D plane, extending the second out in the \(x\) direction and completing the triangle by identifying the third sphere's position based on the radii of all three.

A sphere triplet
An initial sphere triplet located on the vertices of a triangle with side lengths constructed from sphere radii: \(a=r_B+r_C, b=r_A+r_C, c=r_A+r_B\)

Code Coverage in Rust

Productivity tools you employ to make yourself more efficient that actually take up most of your productive time.

Reading time: about 5 minutes (1038 words).

One side project that has been sitting by the wayside since completing my PhD has been to polish up and publish Wafer: my fancy 3D wavefunction solver. For reasons, one of which is mostly structured procratstination, this polishing ended up being a port/re-write in Rust. Delving into the Rust ecosystem has been fun and if you check Wafer's commit history you'll notice large rewrites again and again as I basically play around with things; having no real development schedule or design restrictions.

It may seem a little counter intuitive then, that I'm also trying at the same time to learn all the rigid structures of software development. Proper documentation, testing, error handling, data structures etc.