Making MIDI Music with my electric piano and iPad

2021-12-29 · 1 minute read

I've played piano for a long time, but only recently discovered that my electric piano has a MIDI port at the back! Using it is a lot of fun: By connecting the piano to my iPad, I can play music through the iPad. This allows me to change instruments, and record and arrange music.

Read more

Templating engine? No thanks.

2021-11-12 · 2 minute read

Here is the Rust code that produces the page you're currently reading (at least at the time of writing). Some time ago, a friend of mine asked me why I used this home-grown templating mechanism instead of a standard like mustache.

Admittedly, this might look very hacky on first impression:

async fn article_full(article: &Article, suggestion: &Article) -> String {
    fs::read_to_string("assets/article-full.html")
        .await
        .unwrap()
        .fill_in_article(&article)
        .replace("{{ suggestion-key }}", &suggestion.key)
        .replace("{{ suggestion-title }}", &suggestion.title)
}

It's just loading the template file and then replacing some strings! (If you wonder about fill_in_article(&article), that also does nothing more than replacing some strings.)

Read more

Hacking the Gira HomeServer

2021-10-05 · 8 minute read

Our home has an intelligent electric grid controllable using KNX. A Gira HomeServer connects to the physical KNX wires and our WiFi network and enables us to control all devices using an app. In my previous article, I looked at how the Gira HomeServer communicates with the app. As a reminder, this is how the authentication phase works:

Read more

Reverse Engineering the Gira HomeServer

2021-09-12 · 9 minute read

We have a pretty fancy home: There are extra wires in the walls used as a KNX bus – a system to control lights, thermostats, shades, and power outlets in our home. All devices and switches contain a microcontroller that can send and receive messages using the KNX bus wire. For example, light switches emit messages for turning a light on or off, and lamp sockets listen for those commands to turn the lamp's electricity on and off.

Compared to traditional cabling approaches, this is more flexible because switches can be added anywhere on the bus without requiring re-cabling – we could add a button that toggles lights on the other side of the house. Here's a comparison of how the cabling looks like:

Read more

On Developing This Blog

2021-08-14 · 1 minute read

I created the blogging server that hosts this page with my bare hands. Well, the HTTP request handling software at least. And I have to say; I thoroughly enjoyed it!

Read more

Why This Website Has No Dark-Mode Toggle

2021-07-18 · 3 minute read

Maybe you're wondering why there's no dark-mode toggle on this website.

Short answer: Misaligned incentives between layers of software result in an overall subpar experience. I want to put pressure on the browser offering to control the dark mode of individual websites.

Long answer: I recently streamed music from my laptop to a Bluetooth speaker and wanted to increase the volume. Naturally, I tried increasing the volume on the computer. Nope, it's already at the maximum. The Bluetooth speaker has volume buttons! Gotta try those! But except for the music being interrupted by one of these awful beeps, nothing happens. Oh, I know! Windows has an option to adjust the volume of individual programs that I use pretty frequently. I must have lowered the volume there. But nada. Finally, I checked in the music app itself, and fair enough, there's the volume slider, its knob almost on the left.

What happened here?

Read more

Chunky: A Database Layer

2020-10-09 · 5 minute read

Chest's lowest abstraction layer is called Chunky. In the end, Chest should somehow store all data in a file, something like 🌮.chest (yes, the taco emoji is a great name for a database). The Chunky framework will take care of managing access to that file.

A key question is how to deal with mutating data: If we need to insert some data "in the middle" of the database, we don't want to re-write everything that comes after it. Files are a linear stream of bytes, and that doesn't quite fit our use case. So, the Chunky layer offers an abstraction from that.

Read more

Chest: A New Database

2020-10-08 · 1 minute read

Databases are a fundamental part of most modern applications. Studying Hive interested me in database design, so I decided to implement a new database – called Chest.
I created it as a research project, but I'd also be happy to produce something worthwhile.

Read more