Apr 18 2015 Dr. Jekyll and Mr. XSLT

I’ve always been a big fan of static websites, for mainly two reasons: simplicity and security. Simplicity, because why have a complex software on the server when the content is updated at most once or twice a month? Security, because the most secure lines of code are the ones that have never been written.

In 2002, nothing was really existing to easily generate a static website, so I wrote an Eclipse plugin, Stylo Plume, to help me accomplish this. And since the year was 2002, and I was working a lot with XML and XSL, I used XSLT.

This site in 2002
This very web site in 2002. In Technicolor, baby!

Fast forward 13 years later. I still think a static website is what I need, but I’m getting tired of XSLT, and I really don’t feel like testing and potentially fixing my plugin with Java 8 and the Eclipse 4 branch. So I started looking at some static site generators, and I stumbled upon a post from Tom Preston-Werner that sums up nicely my feelings:

I already knew a lot about what I didn’t want. I was tired of complicated blogging engines like WordPress and Mephisto. I wanted to write great posts, not style a zillion template pages, moderate comments all day long, and constantly lag behind the latest software release. Something like Posterous looked attractive, but I wanted to style my blog, and it needed to be hosted at the domain of my choosing. For the same reason, other hosted sites (wordpress.com, blogger.com) were disqualified.

Tom Preston-Werner is the creator of Jekyll, and after 2 weeks to migrate the source of my site, I can say that I’m now a happy user.

Mar 30 2015 Feeling hungry?

Do you feel hungry? Do you speak French?

If the answer to both questions is “yes”, I’ve added a bunch of recipes: Tarte à la tomate, Egg in the basket and Encornets à ma façon.

Bon appétit !

Aug 31 2012 OpenStreetMap and Android

OSM logo

This summer, I went on vacation to a place that was not covered by OpenStreetMap, so I became a small OpenStreetMap contributer and mapped the surroundings. Here’s the list of software that I used on my Android devices.

To gather GPS data, I used OSM Tracker for Android, available both in Google Play and via F-Droid. It’s a nice GPS tracker with fast Points of Interest (POI) placement shortcuts. It should be able to upload traces directly to OSM, but this functionality always crashed with me; uploading the generated traces (.gpx) with the website worked once I renamed the files to remove non-ASCII characters.

To edit the map, I used Vespucci, which is also available both in Google Play and via F-Droid. It’s fine for relative small edits, but for larger one you’d better use the Flash-based Potlatch 2. Another useful application to edit details such as the name of roads or POIs is OSMapTuner (see update), available in Google Play.

OpenFixMap (in Google Play) was very helpful to flag errors on the map. You’ll have to use an editor to fix them.

A more comprehensive list can be found on OpenStreetMap’s wiki: Android software supporting OpenStreetMap. Happy hacking mapping!

Update: I’ve just found another editor for POIs, Mapzen POI Collector. It can add POIs and has a much nicer user interface. However, it is limited to the most common types of POI, so if you have very special needs, it’s not for you.

Dec 23 2011 Deploying to a maven repository via SCP with Gradle

Deploying your artifacts to a remote Maven repository with Gradle is possible, but the official documentation is rather thin at the time of this writing. Worse, it tells you to use a version of wagon-ssh that ignores the provided password and prompt for it at the command line (use gradle -i to see its message).

So, without further ado, here is a build.gradle that uploads its artifact via scp with a password. It has been tested with Gradle 1.0-milestone-6.

apply plugin: 'java'
apply plugin: 'maven'

configurations {
    deployerJars
}

repositories {
    mavenLocal()
    mavenCentral()
}

dependencies {
    //the one and only version that works
    deployerJars 'org.apache.maven.wagon:wagon-ssh:1.0-alpha-3'
}

uploadArchives {
    repositories.mavenDeployer {
        configuration = configurations.deployerJars
        uniqueVersion = false
        String username = 'me'
        String password = 'secret'
        repository(url: 'scp://repos.mycompany.com/releases') {
            authentication(userName: username, password: password)
        }
        snapshotRepository(url: 'scp://repos.mycompany.com/snapshots') {
            authentication(userName: username, password: password)
        }
    }
}

Of course, in a real world scenario, it would be wiser to get the username and password from your gradle.properties or any other non-public file.

Sep 21 2011 Book review: "Building and Testing with Gradle"

Gradle is a very flexible and powerful build tool, allowing an extremely concise build file for conventional projects and letting you do whatever crazy thing your project requires using a Groovy DSL. I’ve been following its development for the last two years, and I introduced it to replace a legacy Ant based build system at my work about a year ago.

Cover

As far as I know, Building and Testing with Gradle, written by Tim Berglund and Matthew McCullough and published by O’Reilly, is the first book published on this topic.

The first chapter will guide you through the installation process and the use of the Gradle from the command line. I’m not sure someone willing to use Gradle needs that kind of information. It will also show you the shorter build file possible for a Java project, containing only 18 non-whitespace characters: compare this with Maven…

The second chapter is were the serious stuff begins. It presents the basic unit of Gradle build files: tasks. The two lifecycle phases, configuration and execution, are explained. You’ll also learn how to use their rich API and how to simply write your own tasks. If you’re used to the complexity of Maven, be prepared for a shock as this is dead simple and way conciser.

The third chapter shows how Gradle can leverage your existing Ant files and custom tasks. This particularity of Gradle allows a step-by-step migration from Ant.

The fourth chapter compares Maven and Gradle. Gradle takes the best ideas from Maven (and others): convention over configuration, consistently named artifacts and a solid dependency management with the same central repositories. It drops what makes Maven so painful to use: tons of XML, a rigid lifecycle and more generally its lack of flexibility.

The fifth chapter is about testing. The integration of JUnit, TestNG, Spock, Geb and EasyB will be rapidly shown.

The sixth and last chapter is focused on multiproject (or multimodule) builds. Once again, the tremendous flexibility of Gradle makes it bend to your needs rather than imposing its standards on you.

This is a short book with fewer than a hundred pages, read in a couple of hours, and full of code samples. It is an introduction to Gradle, not a complete reference guide: it will show you the power and the simplicity of Gradle, and - I hope - will convince you to give Gradle a try.