While trying to write a custom Scalatest runner I discover this gem in the default Runner:

dada 🎶 dada 🎶 … ten out of ten points for style, but minus several million for good thinking and way too much complexity. Somehow I now have doubts about Scalatest and its coding style 🙈

Speaking of complexity it’s apparently also really hard to run Scalatest tests explicitly, without any of the built-in runners. Although Suite has a run method which looks like it helps you literally all built-in reporters and in particular HTML reporter I’d like to use are package-private… 😒


VisualVM to the rescue

Since a few days I frequently got a java.lang.OutOfMemoryError: Metaspace after a few tests in the SBT shell. I attached VisualVM to the SBT process and indeed Metaspace didn’t go down after test had finished:

metaspace up to 250MB and not going down

By the way with many SBT processes running the following SBT alias comes handy: It shows the PID of the running process which helps you pick the right SBT process to attach to in VisualVM:


I had a suspicion: The application runs on top of Akka, and perhaps I had forgotten to shutdown some actor systems in my tests? And indeed in the “Threads” tab I saw a couple of threads lingering even after test had finished:

lingering threads after test finished

Akka conveniently names threads after the Actor system they belong to, and since luckily I had named my Actor systems after the test suites that created them I immediately knew which test suites to look at.

Indeed these suites didn’t have the trait that implemented actor system shutdown mixed in. I fixed these test suites, and the OutOfMemory error was gone. The whole thing took less than half an hour. Never underestimate the power of monitoring tools!


Rust, Windows, Travis CI…

Travis recently announced early stage Windows support, and it already supports Rust. I couldn’t wait to try it—I don’t really enjoy AppVeyor—so I set it up for mdcat and it worked really well.

The change was really simple, and I just took me a few iterations to get almost everything—in particular deployments to Github releases—working just like on Linux and macOS. I could eventually remove AppVeyor entirely which makes me really happy. This post describes the change and also outlines what little’s still missing for me.

Read More…

sudo fish

Over the last week I setup a Linux VM alongside my current work—I needed decent docker support and also I got somewhat fed up with Windows as a development system.

Setting up a new system means I got to use sudo a lot, but often I typed a command line and only then realized I had to use sudo. So I added a new editor binding to my ~/.config/fish/functions/

function fish_user_key_bindings

    # Prepend sudo to the command line with M-s
    bind \es sudo-commandline

~/.config/fish/functions/ looks like this:

function sudo-commandline -d "Insert sudo at the beginning of the command line"
    set -l cmdline (commandline)
    commandline -r -- "sudo $cmdline"

Now I can just type Alt-S in Fish shell and I get sudo prepended to my current input. A small thing, but it already saved me a lot of frustration!


Git Gone

A few days ago Eugene Yokota published a git-gone script which deletes local branches left over from pull requests. I liked the idea; at work we use pull requests a lot and I already have many stale branches around.

We use Windows at work, tho. I know, folks frown about Windows as developer system, and I sure do miss my Mac at times, but it is what it is, and the job’s worth using Windows. And with a few tweaks, Powershell 6, ConEmu and VS Code it’s a decent system to my surprise. Anyhow, the one thing Windows can’t really do is run Bash scripts, and unfortunately Eugene’s tool is a bash script.

So I wrote git-gone in Rust with the git2 crate and published it to Enjoy.


Recursive Exceptions

A couple of weeks ago a former coworker send me this piece of code I had writtten:

private def getRootCause(throwable: Throwable): Throwable = {
  Option(throwable.getCause) match {
    case None => throwable
    case Some(cause) => getRootCause(throwable)

D’oh! A nice endless loop. It caused quite nice spikes in garbage collection metrics and peak response times, and it took them a few days to find the root cause.

Ironically I had explicitly added @tailrec to make this piece of code behave nicely. If I had omitted it, StackOverflowExceptions would have triggered alerts almost immediately after deployment.

I am sorry.


Bad Joke

Since a few releases the Akka documentation has this to say about persistent FSMs:

Persistent FSM is no longer actively developed.  Don't use it for new applications; it will be replaced by Typed Persistence.

Unfortunate since we use Persistent FSM quite a lot, but such is life, technologies come and go, and I generally appreciate adding more type safety to things, in particular Akka which has so far been an untyped mess.

Clicking on the link reveals that Typed Persistence doesn’t quite make the cut:

Akka Typed Persistence may change and is not recommended to use in production just yet.

That’s a bad joke, isn’t it?

Though I fully appreciate the irony of the entirely contradicting advises on both pages. New applications aren’t production-ready anyway, eh?



So I forgot my headphones at home today. A few months ago I’d have turned back and gone home to get them—it was impossible to work without something against the noise.

Today I didn’t even notice.

But I don’t work in an open space office anymore.


UTC is the Worst

Me as a web developer: UTC is awesome! All use UTC!!

Me today: FUUUUUUCK LEAP SECONDS. Can we pleeeease all use TAI?

UTC is the worst; and it’s going to get way worse:

Some time in the 22nd century, two leap seconds will be required every year. The current use of only the leap second opportunities in June and December will be insufficient, and the March and September options will have to be used. In the 25th century, four leap seconds will be required every year, so the current quarterly options will be insufficient. Thereafter there will need to be the possibility of leap seconds at the end of any month. In about two thousand years, even that will be insufficient, and there will have to be leap seconds that are not at the end of a month. In a few tens of thousands of years (the timing is uncertain), LOD will exceed 86,401 s, causing UTC to require more than one leap second per day.

In 40.000 years People will hate us for three things: Global warming, Nuclear waste, and UTC LEAP SECONDS!


A little dirty…

I’m a decade into programming but I never touched a SOAP interface before. So last week was a first: I saw my first WSDL ever.

There’s not much Scala tooling around SOAP so I went for Java. Now I know a lot of acronyms like JAXB or JAX-WS (I have no idea what these mean tho), and I generated code from WSDL like in the perfect wet dream of a 00s SOA consultant. Mutable Java classes of course, but you get what you pay for.

Although I didn’t really understand what I was doing everything worked well—I even wrote an SBT plugin to run wsimport and publish the generated code—and I spent no more time with this stuff that I should.

But I do feel a little dirty now…


Favorite posts

My favorite posts:
2018, Feb 24 Algebraic Data Types In Scala
2017, Jul 03 Maven Central Releases with SBT
2016, Nov 21 Bye Bye Emojis: Emacs Hates MacOS
2016, Nov 15 Read and write files in Emacs Lisp
2016, Jul 19 I wished GNU Emacs had…
2015, Nov 29 Reproduce bugs in emacs -Q
2014, Aug 12 Emacs script pitfalls
2014, Jul 02 Autoloads in Emacs Lisp
2014, Jun 16 Advanced syntactic fontification
2014, Apr 15 Calling Python from Haskell
2014, Mar 26 Search-based fontification with keywords
2014, Mar 12 Syntactic fontification in Emacs