RSSAmplifier

Blog

jotaen.net

Jan Heuermann’s blog

jotaen.netRSS feed ↗20 posts

Latest posts

Timer – Programmable timer web app – e.g. for gym workouts or stretching sessions

I have a mild habit of building my own version of things that surely already exist. This time it’s a timer web app – one that counts down, beeps, and reads activity names out loud. The main use-case is workout or stretching sessions that consist of repeatable sequences, e.g. where you are holding certain positions for a set time. The neat part is that the timers are “programmable”, so you can…

Ali Baba and the Forty Relying Parties – A tale from 1001 Nights, but with passkeys

This blog post is a silly adaptation of the tale of “Ali Baba and the Forty Thieves” and tells it as if the equivalent of passkeys were used instead of the (rather insecure) password “open sesame”.
I. The Word The thieves kept their cave shut with a word, and the word was “sesame”.
Behind the door they piled what they took off the caravan roads, which over the years amounted to a great…

How to write great PR descriptions

Have you ever reviewed a pull request (PR) with a diff of a few hundred lines of code, for which the PR description merely said something like: “Add CSV export for messages”?
I believe that a good PR description serves two main purposes: it documents a change for current and future reference, and it facilitates a swift and frictionless review process.
What I find important to appreciate is…

3 gripes about Go modules – (Number 4 will drive you crazy)

Do you remember $GOPATH? It’s from the era before Go modules came to be, where installing Go libraries used to be a manual, rather frustrating experience. (This also isn’t that long ago, actually.)
Say what you will about Go modules, but compared to the $GOPATH times, they have been a literal godsend: installing, publishing, and finding packages has since become a standardised and convenient…

Fun with overflowing integers

Today, I finally got around to fixing a fundamental issue with klog (my command line tool for time tracking): if someone were to use klog on a daily basis for a few trillion years, there would be an increased risk of incorrect computations due to integer overflow.
In particular, after precisely 9223372036854775807 minutes worth of time tracking, the total time amount would wrap around and…

Not all binary state is boolean

Boolean types represent binary state: true↔false, 1↔0, on↔off.
But just because boolean types are technically capable of expressing binary state, they may not always be an ideal choice from a semantic point of view.
Consider the following Java interface, which describes the view state of a graphical user interface by means of two boolean methods:
interface UserInterface { boolean…

Custom git subcommands

There are two ways to register custom subcommands for the git CLI tool. That allows you to define your own shortcuts and invoke them as if they were natively supported by git. For example, just like the built-in subcommands such as git checkout or git diff, you could come up with git mycrazycommand and define custom behaviour for it.
The following sections demonstrate two possible techniques…

Shortcut for “docker run”

Docker is one of my daily drivers in my local development toolchain. I mostly rely on it for spawning dedicated development environments, which are tailored to the specific project I’m working on.
I usually add a Dockerfile or docker-compose.yml file rather early to my projects. (Independent of whether I actually use Docker in production.) However, for initial prototyping, or for just briefly…

Keep track of migration state in SQlite

Keeping track of database migrations in SQlite DB files can generally be done in the same way as with any other database. The most common approach is to provide a separate database table for maintaining the history of all migrations that have already been applied.
In SQlite, there is a more subtle alternative to this, which is to use the user_version PRAGMA:
The user-version is an integer…

Inlining images in HTML

When using small icons on a web page, it sometimes can be convenient to embed the respective image into the HTML code directly, instead of providing it as static image file and then fetching it via its URL in a separate HTTP request.
For example, the following klog logo isn’t hosted as separate image file on the web server, but the image data is directly included in the HTML code. This can be…

Testing HTTP APIs with hurl

hurl is a command line tool for running HTTP requests. The clue is that the definitions of the HTTP requests are stored in plain text files, and that the CLI tool has some useful capabilities around working with HTTP requests and the corresponding responses. That allows for two main usages of the tool:
Maintaining an internal library of API calls for manual testing during development. Think…

Immediately invoked function expressions

IIFEs (immediately invoked function expressions) are a neat code pattern originally popularised by JavaScript, which, however, seem to be less common of in other languages.
An IIFE is basically an inlined function expression that is executed right away. You can use this technique not just in JavaScript, but in all languages where functions are first-class citizens.1
const theAnswer = (()…

Happy Anniversary! – Looking back on 10 years of blogging

10 years ago to the day, on 21st February 2014, I published my first article on this blog.
This anniversary feels special to me, because I’ve been running my blog for almost my entire career now. So looking back on how this website evolved throughout the years actually makes me realise the various ways in which things are linked to my professional journey.
Before this post turns into some…

snapdiff – CLI tool, written in Rust, to analyse the difference between two directory snapshots

I periodically create snapshots of large directory trees for backup purposes. The snapshotting procedure is basically cp -R, so each snapshot is a full copy of the directory tree in question.
I archive these snapshots either on my internal disk or on an external one. In any event, I end up with a whole bunch of snapshots – all representing the same directory tree, but at different points in…

Let’s self-host! – Get started with self-hosting, using Docker, HAProxy and Let’s Encrypt

Self-hosting is a fun and cost-efficient way to run web services, be it for some silly side-projects, or for miscellaneous third-party services that you want to host for personal usage.
Unless you are motivated to operate a physical machine off your own basement, the easiest option is to rent a (virtual) server at some hosting provider of your choice – say, Hetzner, DigitalOcean, or…

“Congrats!” – The future of AI-enhanced online networking for professionals

I love LinkedIn. I would even go as far to say: I am a downright LinkedIn maniac. I log into LinkedIn multiple times a day, to stay on top of what’s happening in my business network, and to engage in meaningful interactions with other professionals around the globe.
After logging in, LinkedIn displays a dashboard with an activity feed, where it summarises all the latest occurrences that are…

fail err – Musings about error handling syntax in Go (2/2)

Warning: the following post explores crazy ideas around error handling syntax in the Go programming language. Unlike normally on my blog, it’s considered okay to stop reading this post at any point. If you are sensitive to thought experiments around language design in Go, you are advised to take preliminary measures to leave this page promptly in case you feel sudden discomfort.
In a previous…

The fallacy of software development principles – Why SOLID, TDD, or Clean Code won’t make us good programmers

What is good code? To research this question, imagine we put 100 software developers into one room, give them 10 code bases to evaluate, and ask them to create a ranking based on code quality. In reality, this will probably take a good while, and also have significant risk of domestic violence. But since this is just a thought experiment, we can assume that it all goes smooth and civilised. While…

On “free” and “open-source” software – How language makes the people, and people make the language

Did you know that computers existed way before the mid 20th century? The first record of a computer dates back as early as 1613, and there is evidence that computers have been known and routinely utilised throughout the following centuries. Their probably most important field of application was for carrying out calculations in the context of astronomic research. (At times, a controversial and even…

Boost klog – Speeding up my Go CLI app tenfold

I recently got curious about the performance characteristics of klog (my CLI tool for time tracking), especially when it comes to evaluating larger amounts of data. Until then, I hadn’t bothered much about the speed of the Go implementation – at least not in the sense that I actively measured and optimised for execution performance. The tool feels really snappy in typical day-to-day scenarios, so…