Things Developers are and aren't Good at
…in my experience. ...
…in my experience. ...
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). ...
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. ...
I recently created a wonderful bug. ...
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. ...
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. ...
This example show how to write a reactive reader for the AWS Simple Queue Service, using Scala and alpakka (respective akka streams). ...
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: ...
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. ...
The PostgreSQL installation comes with a great tool, psql, to administer and inspect the database. pgcli extends this with syntax highlighting and autocompletion. ...
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. ...
Adding an ssh-file as a secret sounds easy, but there are pitfalls. ...
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. ...
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. ...
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. ...
“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. ...
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. ...
This is a quickstart for building something on Google Compute Engine without clicking any buttons (after you created the project). ...
#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. ...
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. The first question that is usually asked in the ticket is ...
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. ...
This post contains the absolut essence from the Terraform Getting Started Guide: https://www.terraform.io/intro/getting-started/install.html ...
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! ...
Some ideas seem great at first but turn out to be incredibly bad in hindsight. I reviewed such an idea today. ...
I tried to create a single image that contains all the most important git commands: ...
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. ...
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. ...
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. ...
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. ...
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. ...
#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. ...