Creating documents from a template using LibreOffice's 'mail merge' feature

I recently had a situation where I wanted to quickly export data from a database source to PDFs. I wanted to create a document for each volunteer where they could check their information and other details. I could have solved this with a Node.js script or using a JVM library, but I decided to try something new for me: the capabilities of a standard office suite. Preferring FOSS, LibreOffice was the logical choice. I was surprised by how easy and fluently everything went and I will definitely consider this for similar future projects.

A big advantage of using this over packages like pdfkit, html-pdf and lx-pdf is that you get the full capabilities of a word processor. Helps a lot if you have a standard template you need to adhere to: perfectly recreating such a template in HTML or instructions may take a lot of time.

The end result: individual PDFs with dynamically generated data from a PostgreSQL source

Read More

Dutch spell checking for IntelliJ IDEA

I got really annoyed by the spell checking feature of IntelliJ IDEA, since I’m a native Dutch speaker and I have a few projects where the main language is Dutch. I originally planned to just disable it after I noticed there was no Dutch dictionary available, but I decided to try and create one.

Read More

Continuous deployment for Play! Framework 2

In a previous blog post, I discussed setting up Jenkins for continuous integration with Play. But today will go one step further: we will contiously deploy our application.

A high-level overview

In this article, we will set up a Digital Ocean droplet with Dokku, a project that brings a Heroku-like PaaS server to your own systems. This means that you can just “push to deploy”: when you push a new commit, it gets deployed on the server.

After we set up Dokku, we will integrate Jenkins and Dokku, for a full pipeline: Jenkins will push to Dokku, which will deploy the application. This is continuous deployment (also known as continuous delivery). We will polish this a bit, so Dokku uses a persistant production database, add a CHECKS file so that instances that aren’t ready don’t go live, and discuss how to use different database types for testing and production.

The end result will be that a single commit starts a whole process: firstly, the code goes live on GitHub, then Jenkins builds and tests the application, then it goes live if the lights are green.

An example of Dokku at work

Read More

Slick 2.1 zero to hero

(Note: I do not plan to work any more on this post. I will probably rewrite it for Slick 3 when I find the time.)

As I wanted to get started with Slick, I faced a problem every Slick padawan faces: the almost complete lack of resources. There’s a rather confusing Activator tutorial, some docs, the generated ScalaDoc, and Adam Mackler’s Learning Slick. But that’s it. And I found neither of those to be particulary easy to read.

But the situation is improving, the official docs now mostly contain everything you should now, though there is no real “path” to follow, and you can’t possibly learn it all in one go. Play will probably bring an influx of new Slick users, which will help with the ecosystem.

Here’s my try at a easy to follow tutorial that will help you to get started with Slick. Be sure to leave any comments, remarks… Pull requests are also much appreciated!

There’s a number of links to the Slick source code. Since most of them refer to line numbers, I linked to the state of a specific commit on GitHub, so we’re both looking at the same thing, even when the code is updated.

This post focuses mainly on using Slick with Play!2.0

Read More