Xanthe Doesn't Need Linker Hacking Now

Published

Tags: and

I finally got around to dusting off the code for Xanthe to test if it can work without linker hacking, now, too. Short answer: yes. I had to add an implementation of memcmp for the freestanding build, but other than that, all I had to do was throw away the linker hacking steps in the Makefile. Apart from the linker scripts for building the disk images, Xanthe now just compiles normally with -betterC.

Also, the old build was about twice as big as it needed to be because the media files were being packed into the binary twice for no good reason. That doesn’t seem to be a problem any more with the latest dmd.

How Inheritance and Polymorphism Work

Published

Tags: , , and

I’ve promised to write a blog post about the DIY polymorphic classes implementation in Xanthe, the experimental game I once wrote for bare-metal X86. But first, I decided to write a precursor post that explains how polymorphism and inheritance work in the first place.

The Seto Inland Sea Trip, Part 2

Published

Tags:

This is the second part of my backpacking trip through the Seto Inland Sea.

The Seto Inland Sea Trip, Part 1

Published

Tags:

I like exploring. A few months ago I finished a major contract, so I took the opportunity to do an adventure I’ve wanted to do for some time: backpacking across the Seto Inland Sea in Japan and exploring its tiny little rural islands.

(Warning: this post is image-heavy.)

Using the Bourne Shell as a Cheap and Nasty Templating Language

Published

Tags: , and

Sometimes you need a really simple way to generate parameterised text without pulling in a full-blown templating language as a dependency — for example, when writing an install script that needs to generate a simple configuration file. Using the classic *nix Bourne shell that’s installed on practically every *nix system is one option. To be honest, it can be a terrible option, but it often gets simple jobs done, so I think it’s a trick worth remembering.

Look, Ma! betterC Without Linker Hacking!

Published

Tags: and

Version 2.079 of the DMD compiler has just been released with improvements to the -betterC flag. I just gave it a try, and the D code I linked into a C executable with some horrible linker hacking in 2016 now works without any linker hacking at all. There’s still some more stuff to test out when I get around to it, but, hey, here’s some progress:

The Catch-22 of Risk-Averse Organisations

Published

Tags: and

Markets are supposed to make corporations efficient, so if you do consulting, you have to wonder why so many organisations (both private and government) are so absurdly dysfunctional. The way I see it, there’s no real paradox: organisations are pushed by both forces of efficiency (like market forces) and forces of dysfunction (like political drama). Corporations are only efficient if the forces of efficiency are stronger.

There are many forces of dysfunction that can affect an organisation, but there’s one that’s particularly important for risk-averse organisations (like banks and large government departments). Whenever I see people in an organisation doing something that doesn’t make any sense, I always ask if this catch-22 can explain it:

Every risk-averse organisation needs someone to take the initiative to eliminate risks. But in a risk-averse organisation, that’s exactly what no one does.

Popular Web Servers Compared

Published

Tags: , and

Here’s a comparison of the web servers I’ve used the most.

Making a Compile-time Brainfuck Compiler in D (translation)

Published

Tags: , and

NB: This post is just a translation (with some extra comments by me). Credit goes to the original and the C code generator that inspired it.

Relational Databases Considered Incredibly Useful

Published

Tags: , , and

A year ago I worked on a web service that had Postgres and Elasticsearch as backends. Postgres was doing most of the work and was the primary source of truth about all data, but some documents were replicated in Elasticsearch for querying. Elasticsearch was easy to get started with, but had an ongoing maintenance cost: it was one more moving part to break down, it occasionally went out of sync with the main database, it was another thing for new developers to install, and it added complexity to the deployment, as well as the integration tests. But most of the features of Elasticsearch weren’t needed because the documents were semi-structured, and the search queries were heavily keyword-based. Dropping Elasticsearch and just using Postgres turned out to work okay. No, I’m not talking about brute-force string matching using LIKE expressions (as implemented in certain popular CMSs); I’m talking about using the featureful text search indexes in good modern databases. Text search with Postgres took more work to implement, and couldn’t do all the things Elasticsearch could, but it was easier to deploy, and since then it’s been zero maintenance. Overall, it’s considered a net win (I talked to some of the developers again just recently).