Things Developers are and aren't Good at

…in my experience. ...

May 1, 2021 · Jannik Arndt

def and var in traits on Scala 2.12, 2.13 and 3.0.0

Scala traits should define defs, because “A val can override a def, but a def cannot override a val” (via Alvin Alexander via StackOverflow). But it’s interesting to look at how the compiler treats that. Alvin Alexander did that, but only for Scala 2.12.8. Let’s have a look at 2.12, 2.13 and the just released 3.0 (formerly known as dotty). ...

April 24, 2021 · Jannik Arndt

Using scalap, javap and the scala compiler to understand the journey from code to bytecode

Do you know what happens after you compile? Let’s take a look at what the Scala compiler tells us, and what scalap and javap can reveal about .class files. ...

March 25, 2021 · Jannik Arndt

Exception-Proof For-Comprehensions

I recently created a wonderful bug. ...

December 4, 2018 · Jannik Arndt

oAuth2 with Akka HTTP

This is a basic example how to implement oAuth2 using Akka HTTP and Scala. It provides three endpoints. From the clients point of view: / — publicly accessible, returns “Welcome!”, /auth — provide your username and password, receive an access_token in return, /api — secured by oAuth, send the access_token in a header to gain access. From the server’s point of view: / — publicly accessible, do nothing, /auth — receive basic auth credentials, verify they’re in the list of known credentials, create an access_token, return it, /api — receive authorization header, check if access_token is in list of valid tokens. Since oAuth tokens are short lived, the server also has to invalidate expired tokens. ...

October 28, 2018 · Jannik Arndt

Akka HTTP on Heroku

Getting a Akka HTTP-based backend up and running on Heroku for free can be done in less then 30 minutes — if you know the tricks. ...

October 27, 2018 · Jannik Arndt

How to Write and Test a Reactive Reader for AWS SQS Using akka, alpakka and Localstack

This example show how to write a reactive reader for the AWS Simple Queue Service, using Scala and alpakka (respective akka streams). ...

October 7, 2018 · Jannik Arndt

How Event Sourcing in Akka Persistent Actors Works

While the Akka documentation is incredibly well written, it has surprisingly few images. Since I visualize concepts to remember them, here is my take on how Event Sourcing in Akka Persistence works: ...

August 31, 2018 · Jannik Arndt

Rotating PostgreSQL Passwords with no downtime

Changing the password for a PostgreSQL database user involves two steps: The change in the database and the change in the application code. This blog post describes how to do this without any downtime or failed authentication tries. ...

August 22, 2018 · Jannik Arndt

Examining a PostgreSQL with psql or pgcli

The PostgreSQL installation comes with a great tool, psql, to administer and inspect the database. pgcli extends this with syntax highlighting and autocompletion. ...

August 16, 2018 · Jannik Arndt

3 Ways How Passwords Get Leaked

You don’t need to “get hacked” to have your security compromised. Often enough you’ll do it yourself. The best way to prevent this is knowing when to be cautious. ...

July 22, 2018 · Jannik Arndt

How to add an SSH Key as a Kubernetes Secret

Adding an ssh-file as a secret sounds easy, but there are pitfalls. ...

March 22, 2018 · Jannik Arndt

Lazy Aliases in my Shell

I reduced the startup time of my shell by one second. Here’s how: What I do I work a lot with the shell (or “Terminal” app on MacOS), mostly kubectl, git, terraform and docker. And of course I use the absolutely best shell of all, oh-my-zsh. The Problem I noticed that recently the startup time for a new shell (or new tab) has grown longer than a second. That’s annoying, because usually when I open a new tab, I want to quickly check on something, like the logs of a pod or if I have committed something in a different project....

March 13, 2018 · Jannik Arndt

How to use a Raspberry Pi for your Time Machine backups

Apples Time Machine is a great backup solution, you only have to do one thing: Connect your disk from time to time. Since that is way harder than it sounds, there’s a second option: Buy a 329€ Time Capsule and do backups over wifi! That’s too expensive? Here’s how to build your own Time Capsule with a Raspberry Pi 3 and an external hard drive. ...

January 13, 2018 · Jannik Arndt

How to install Tasmota on a Sonoff device without opening it

Sonoff takes the standard ESP8266 chip and adds two things: a casing with wifi and great connectors and a custom OS and an app to control the devices. Unfortunately, the second addition also means that all communication goes through Sonoff’s servers. Here’s how to get rid of that. Without soldering or connecting anything. ...

January 13, 2018 · Jannik Arndt

How to use a Raspberry Pi 3 with Apple Home

“Hey Siri, turn on the bedroom lights!” I want that. Here’s how I did it: I bought a bunch of Sonoff devices (5€ each, 10€ for a light switch). I bought a raspberry pi (33€). I installed an MQTT broker and homebridge on the pi. ...

January 13, 2018 · Jannik Arndt

How to setup a Raspberry Pi 3 headless, without monitor, mouse or keyboard

I bought a raspberry pi as a smart home automation server. Here’s how to set it up without connecting a monitor, mouse or keyboard. All you need is an ethernet cable. ...

January 13, 2018 · Jannik Arndt

Terraform on Google Cloud Engine Quickstart

This is a quickstart for building something on Google Compute Engine without clicking any buttons (after you created the project). ...

November 23, 2017 · Jannik Arndt

Lessons learned in 2017

#1 Conway’s Law “organizations which design systems … are constrained to produce designs which are copies of the communication structures of these organizations.” So true. ...

November 11, 2017 · Jannik Arndt

Releasing a Scala + Maven project to Maven Central (Sonatype OSS)

If you write Scala in a Java-centric environment, chances are you might wind up with a Maven project, defined in a pom.xml. While this can work, it brings a few extra caveats if you want to submit your project to Maven Central (aka Sonatype OSSRH). Step 1: Claim your Group ID When you first publish something to the Sonatype OSSRH, you have to create a JIRA account and then create a ticket for a new project....

September 10, 2017 · Jannik Arndt

Writing case classes to MongoDB in Scala

Storing case classes in a MongoDB database is incredibly easy, once you know how. The same goes for java.time classes such as ZonedDateTime, LocalDate or Duration. This example uses the official Mongo Scala Driver in version 2.x and the bsoncodec project by Ralph Schaer. ...

August 19, 2017 · Jannik Arndt

VERY Quick Start: Terraform

This post contains the absolut essence from the Terraform Getting Started Guide: https://www.terraform.io/intro/getting-started/install.html ...

August 6, 2017 · Jannik Arndt

Where bad code comes from

Ever wondered where bad code comes from? “This story is done” “Shouldn’t someone review it first?” “Oh, yeah … erm … I’ll do a quick refactoring first and then…” …when that other person is on holiday!

July 22, 2017 · Jannik Arndt

Storing sparse, key-value-like data in a relational database

Some ideas seem great at first but turn out to be incredibly bad in hindsight. I reviewed such an idea today. ...

July 21, 2017 · Jannik Arndt

Git in one Image

I tried to create a single image that contains all the most important git commands: ...

June 18, 2017 · Jannik Arndt

Two-speed IT

The Problem You’re a corporation. Your IT department is old, slow and can’t innovate. Your competitor however can. So you try what every corporation tries: Two-speed IT. ...

May 23, 2017 · Jannik Arndt

The real world doesn't care about encoding

Last week one of our programs failed looking up an airplane by its registration. That’s not a surprise, since ac regs are a horrible identifier. They change all the time. Also there is almost no naming rule at all. Wikipedia states When painted on the fuselage, the prefix and suffix are usually separated by a dash (for example, YR-BMA). When entered in a flight plan, the dash is omitted (for example, YRBMA). In some countries that use a number suffix rather than letters, like the United States (N), South Korea (HL), and Japan (JA), the prefix and suffix are connected without a dash. ...

May 1, 2017 · Jannik Arndt

Deploying Pentaho jobs into Production

TL;DR: You don’t. We eventually gave up on it. My personal lessons-learned: Pentaho Kettle (or “Community Edition”, CE, i.e. the open-source core) is a great product for one-time data transfer or on-demand data transfer, but not for resilient, scheduled jobs. The “Enterprise Edition” (EE) adds scheduling that doesn’t work reliably, and a very powerless server. Kerberos is a bitch. ...

March 5, 2017 · Jannik Arndt

Extracting Dimensions from an Oracle Database Table

Task You have a denormalized table and want to extract a column into a dimension table. Caveat You have to keep the ids. Extra-Caveat You use an Oracle database. ...

January 7, 2017 · Jannik Arndt

talend does not work

I cannot believe that googleing “talend does not work” does not find anything helpful. With this entry I try to fill that void in the internet. ...

January 7, 2017 · Jannik Arndt

Lessons learned in 2016

#1 Do not fix your code. Rather understand why nothing kept you from creating this bug. Make your code so easy that this bug would have been obvious the first time. ...

January 3, 2017 · Jannik Arndt