Get to grips with your build, with Gradle

Last month, the Dutch Java Magazine published an article written by Hanno Embregts and myself. In it, we describe how we used Gradle in our project at the Dutch Railways.

Read more

1 minute read    gradle, java-magazine

Foobal, Moneyball

Ever since Moneyball came out, winning at sports using statistics has become more and more mainstream. As I’ve blogged before, I have also been getting in on some of that action: I’ve been competing in my family’s soccer match betting game, where we guess the results of NAC Breda, our favourite team. But instead of predicting the outcomes myself, I’m using Foobal, a little Scala program that I’ve written for this very purpose.

Read more

1 minute read    foobal, statistics

Hacking Java enums

The other day, I was debugging some enum related code in EqualsVerifier. I had this enum:

Read more

3 minute read    java, enum, equalsverifier, objenesis

Configuring my NAS

The other day, I had to re-install my NAS, and of course, I’d forgotten exactly how I had configured it. That meant finding back lots of websites, some of which apparently didn’t exist anymore. This time, I’ve written down all the steps I’ve taken, just in case, for some sad, unforeseen reason, I ever have to do it again.

Read more

4 minute read    synology, how-to


“It’s just test code”

“It’s just test code” is something I hear way too often, from people who really should know better. Somehow, there is a pervasive sentiment that unit test code does not need to be held to the same standards as production code. I’m not sure why, but it seems to be associated with the idea that the “customer” will never “see” that code.

Read more

8 minute read    unit-testing, java

The things we do for compatibility

For EqualsVerifier’s new 1.5 release, I faced a dilemma. EqualsVerifier should support Java 8, but it also should still run under Java 6 and 7. Preferably in a single code base, because maintaining multiple code bases is a hassle (even if it means I get to use lambdas in one of them). Also, there should be unit tests targeting Java 8-specific classes: does EqualsVerifier support classes that contain lambdas? does EqualsVerifier support classes with fields of type, say, java.time.ZonedDateTime? These tests should run on Java 8 but should not break on Java 6. Can this even be done?

Read more

7 minute read    compatibility, java, java8, equalsverifier

On profiling

Several times now, I’ve been in a situation where we would have some performance problem, and my team mates would “know” immediately what the problem was and set to work. “No, no,” I would say, “we must profile first. It could be something else than we think!” And then they’d ask me for an example, and I couldn’t come up with one, and they wouldn’t believe me, or they would believe me but think using a profiler is too much work, and they would go ahead with their original idea, and after some work, they would find out that they gained some improvement but not nearly enough. And they would be disappointed and then I would teach them to use the profiler, and profile for 15 minutes, and find something silly to fix, and get a 75% speed increase.

Read more

4 minute read    profiling, visualvm, foobal

Inconsistent equality in C#

Remember last month, when I was comparing ints with shorts in C#? I found a symmetry issue, and decided to ask Eric Lippert about it because, well, why not?

Read more

less than 1 minute read    c-sharp, equals


Comparing ints and shorts in C#

My colleague Ralph and I recently discovered an interesting bit of C# equality behaviour. Consider the following piece of code:

Read more

1 minute read    c-sharp, equals

A better way of typing

I’m happy! I’m happy because I just found out how to get a Compose key on my shiny MacBook. I want you to be happy too, so I’ll show you how you can get one, too. I’ll even show you how to do it on Windows and Ubuntu. But first, I will explain why this makes me so happy. (If you don’t care about the why, just click here and go straight to the how. But you’ll miss a perfectly good geek-out.)

Read more

4 minute read    compose-key, os-x, windows, linux, how-to

Foobal: A New Hope

This weekend, a new soccer season started! It’s way past time I told you all how I, or rather, how Foobal did last season.

Read more

1 minute read    foobal, bug

What happened to EqualsVerifier 1.3?

Last weekend, I released two versions of EqualsVerifier. On Sunday afternoon, version 1.3; then version 1.3.1 about an hour later. What happened?

Read more

3 minute read    equalsverifier, travis-ci, maven-central

On transitivity

Last time, I discussed a transitivity issue for equals methods that also affects EqualsVerifier. To recap, consider this class:

Read more

4 minute read    equals, equalsverifier, java

Switching blogging platform - again

Those of you who are subscribed to my blog (hi mom!) might have already noticed from the old posts that suddenly showed up again in Google Reader last night: I’ve switched blogging platforms. Again.

Read more

2 minute read    blog, telegram, octopress, piecrust


How to: make a Maven build script for Android

I’ve written before about writing Android apps in Scala. Sometimes, though, Scala isn’t the answer, and you need to fall back on Java. That doesn’t necessarily mean you should also fall all the way back to Ant, though. This post is about creating a Maven build script for an Android app written in Java.

Read more

3 minute read    maven, android, how-to

Crummy word processors

I haven’t been blogging much lately. Why is that?

Read more

4 minute read    telegram, posterous, wordpress, blogspot, blog, wordperfect

How to: Display the current Git branch in your prompt

Git is the best version control system I’ve worked with (so far). I started feeling this way once I got the hang of branching. But if you have a lot of branches lying around, it’s easy to get lost. Fortunately, it’s easy to fix that problem, by pimping your terminal prompt. Mine now looks like this:

Read more

2 minute read    bash, git, how-to, prompt

Configuration sharing with Dropbox, Part 0: Introduction

If you’re anything like me, you have more than one pc that you regularly use. One at home, one at work, maybe more. If you’re even more like me, there is software that you use on each of these pc’s. VIM, Eclipse, maybe more. And, exactly like me, you’ve configured these programs heavily to suit your every fancy. And you want to share these configurations across all your pc’s, with a minimum of hassle. And, of course, if you re-install your pc, you want to restore your configurations with no effort.

Read more

1 minute read    configuration, dropbox, how-to


How to: Release your Scala Android app to the Market

This post is a follow-up to my previous one, How to: Android development in Scala. I’m sure it has inspired you to write an awesome Android app in Scala. In this post, I’ll explain how to release your app to the Android Market.

Read more

3 minute read    android, code, how-to, scala

Devoxx 2011 post-mortem

So, Devoxx is over. And as always, it was awesome. I’ve attended many excellent talks, and also some not-so-excellent ones. I’ve met, talked with, and had dinner with some nice and smart people. Good times were had by all.

Read more

2 minute read    code, devoxx, java, scala, talk

On learning Arabic

The Pragmatic Programmers suggest one should learn a new language every year: it broadens your thinking. And it does. Few experiences in the past couple of years have been as mind-bending for me as learning Clojure and CLIPS. Of course, the Pragmatic Programmers were talking about programming languages, but I see no reason why this shouldn’t apply to natural languages as well.

Read more

5 minute read    arabic, language

How to: Android development in Scala

I recently decided to write an Android app, and I decided to do it in Scala. Android uses its own VM (Dalvik), but Dalvik bytecode is generated from Java bytecode, so it should be possible to write Android apps using any language that compiles to Java bytecode. However, the tooling that Google has provided is geared pretty much to Java, so you may have to jump through a couple of hoops to get things working for other languages. In this article, I describe the toolchain that I use for developing Android apps in Scala. I have only 3 disclaimers.

Read more

4 minute read    android, code, how-to, scala

Holy serafins!

Who would expect, while reading High Literature, to see a piece of BASIC code actually included in the text? Not me, that’s for sure. But if you read Umerto Eco’s novel Foucault’s Pendulum, it can happen to you too!

Read more

1 minute read    code, literature, references-in-popular-culture, umberto-eco