23. November 2016

Make Test Inputs with Prolog

A while back I wrote a parser for R6RS Scheme numbers, or the string->number procedure. Numbers in Scheme are somewhat sophisticated and can be written in some surprising variations and I wanted some test inputs for verifying that the parser doesn’t crash on valid inputs. Luckily, the number syntax is specified in such a way that a Prolog program easily can be written that generates test inputs.

more

09. November 2016

Debugging PC Boot Sectors

Recently while working on Zabavno the emulation was going wrong somewhere in a boot sector and I needed to check what it was actually supposed to be doing. This is pretty easy to do with QEMU as a remote target in gdb, but it can be tricky to get started.

more

05. November 2016

AI Solver for Coded Crosswords

A certain type of crossword has been catching my attention ever since I was little. But it never interested me much to sit down and solve it on paper. What I wanted to do was to write a program that helps me solve it or, even better, one that finds the solution itself.

more

26. October 2016

Compact Encoding of Routing Prefixes

How many bits of information are contained in a routing prefix? When printed, a routing prefix commonly looks like an IP address followed by a slash and then a prefix length: 192.0.2.0/24 or 2001:db8::/32. That should mean a minimum of 32 + ceiling(log2(32 + 1)) = 38 bits for an IPv4 prefix and 128 + ceiling(log2(128 + 1)) = 136 bits for IPv6. However, it is possible to encode a prefix in just one extra bit (for a total of 33 or 129 bits).

more