JVM: As time goes by

I just want to parse a timestamp on the JVM If you are in a hurry and just want to know which JVM (Java/Kotlin) library can parse which date formats look –>here<– for an overview. Alternatively, read on when you want to know why this page exists… But Why? I have been developing software on the JVM platform roughly 20 years now. Every now and then, I need to parse a date from its text representation into the seconds since epoch or just to have it as an object to do some date arithmetics. [Read More]
jvm  java 

PostgreSQL performance debugging part 1

Solidblocks RDS PostgreSQL is a ready to use, all-batteries included Terraform module for deploying PostgreSQL databases to the Hetzner cloud. It is part of the Solidblocks library, which is a collection of reusable components for infrastructure operation, automation and developer experience. And it has a performance issue. The typical uses case until now was a simple and cheap PostgreSQL database for smaller workloads that do not see a lot of traffic and only need a single node database with reliable backup and restore. [Read More]

Infrastructure Testing with Testinfra

An often overlooked and admittedly cumbersome topic when developing infrastructure as code (IaC), is the testing of the resources that were created from said infrastructure code. Even a simple setup like a VM that is spun up in some cloud to serve HTTP requests, already confronts us with some obstacles to overcome. A pragmatic approach for testing such a setup could be to ensure that after deployment of the VM the HTTP port answers with a success HTTP code (2xx). [Read More]

SNippet EXtractor

Developer Experience

If you are part of a platform team or develop libraries or SDKs that are used by other people, a small detail from my previous post of the developer experience series might have caught your eye.

There may be a README.MD somewhere with information […], but this information tends to get outdated very fast

This problem gets increasingly worse when you use your documentation to provide code samples that illustrate how to use the platform, the library or the SDK that you provide.

Maintaining those code snippets is a tedious task, and they get outdated when the platform or library/SDK evolves. Also, it would be nice to be able to ensure, that the code in the documentation is always tested and guaranteed to run.

[Read More]

The do file

Developer Experience

This post is a part of my series about project developer experience, for the other posts have a look here. A fully functional example with all snippets from this post that can be used as a template is available here, more ready to use functions for writing do files are part of my open source project Solidblocks. Imagine you join a new project and are given your first task to fix a longstanding bug. [Read More]

Solidblocks Hetzner

After years of shifting workloads to the big cloud providers like AWS or Azure, I am now more often confronted with situations where the deployed cloud infrastructures become unmanageable cost and complexity wise. A nice, fast and inexpensive alternative for smaller projects is the Hetzner Cloud featuring all basic needed building blocks like VMs, block devices, networking, firewalls and load-balancers. One major drawback with Hetzner is though, that there is no pendant to the AWS RDS service family, meaning we have to start to self-manage our state (and backups) again. [Read More]

Compiling Ubuntu Kernel Packages

Although the situation greatly improved over the last 10 years, with very new hardware under Linux you sometimes may run into hardware compatibility issues. The following guide shows how to build an installable Ubuntu/Debian kernel package from a Linux kernel source tree. This post is based on a wakeup-from-sleep issue that I had with my new Lenovo ThinkPad T14s G3. The Wi-Fi card had trouble coming back from sleep and the system ran into IO issues after wakeup looking the whole system. [Read More]

Project Developer Experience

A personal pet peeve of mine when joining a new project or environment is the overall developer experience (DX). Under this rather wide umbrella term I summarize everything that is needed to get a project running, tested and deployed apart from the actual business code itself. Starting on the local development environment setup, over being able to build and test locally to finally being able to deploy and operate the project without any friction. [Read More]

Solidblocks RDS

Being a freelance consultant for some time now, I find myself frequently coming back to one of my older posts on how to run a PostgreSQL database in the cloud, where the cloud is not one of the big ones that already offer a dedicated managed database service. Although for example AWS RDS is an excellent and stable service, it can sometimes be a little too much (and to pricey as well). [Read More]

What's my age again? (PostgreSQL Edition)

One of the many fun aspects when taking over an existing codebase is that you inevitably learn something new - if you want or not ;-).

Today a user reported a bug, that some numbers that are derived from the diff of two dates produced incoherent results. Looking at the code, it turned out that the code in question uses PostgreSQLs AGE function to get the interval between two dates. The shortest reproduce I was able to come up with that shows the questionable behavior looks like this:

SELECT AGE('2021-06-30','2021-05-19') AS age1, AGE('2021-07-01','2021-05-20') AS age2;

and returns the following surprising results

|age1                                 |age2                                 |
|0 years 1 mons 11 days 0 hours 0 mins|0 years 1 mons 12 days 0 hours 0 mins|

The correct answer for both cases should be 0 years 1 mons 11 days but the period for age2 is off by one day. This post will try to shed some light on the AGE function, why it produces the unexpected results and show alternatives that produce a (maybe) better result.

[Read More]