Trifork Blog

Category ‘Java’

Controlling Java with the Leap Motion

November 17th, 2015 by

Leap Motion Controller

The Leap Motion Controller is a device that uses two cameras to track the hands and fingers. This makes it possible to use gestures for controlling the computer or applications. It is possible to buy or download applications through the Leap Motion app store, but there is also an SDK for different languages available to integrate the controller in your own application.

With this article I aim to give an insight in the usability of the Leap Motion Controller in combination with Java. For this I describe the controller and Java API itself and have written an example application which uses the controller. The application is written in Java and is available on github.

Functionality of the controller

The basic functionality for the controller and API is working without problems. This makes it possible to make the interaction with devices and computers more intuitive. In the next screenshot an example is shown from the supplied Visualizer application with the detected hands and fingers.
Read the rest of this entry »

City-wide crowd management in Amsterdam

November 10th, 2015 by

As most residents and visitors of Amsterdam know, every year more people are visiting Amsterdam, city wide events like GayPride, Koningsdag and MuseumNacht are getting bigger and more frequent, putting more strain on the city’s infrastructure and all people living in the city center.

That’s why this November 7th, Amsterdam Marketing organized the Museumn8 hackathon to allow developers to come up with creative and innovative solutions for improving improving mobility, navigation and crowd management in the city. Twenty teams eventually participated.

Trifork (Rienk Prinsen, Marleine van Kampen, Marijn van Zelst) and weCity (David Kat, Luc Deliance) teamed up and joined the hackathon to give their take on solving this problem. Their solution:


By transforming the advertisement billboards of JCDecaux into large information screens displaying real-time information, visitors can get informed about activities and interesting places in the vicinity of the billboard. They receive live crowd information, travel times to and queue lengths at museums and even recommendations where to go next. Read the rest of this entry »

Recognizing commercials using the Alphonso API

September 21st, 2015 by

Liberty Global organized the Hack & Play Appathon in Ziggo dome on September 15th and 16th. More than 20 teams of hackers, designers and programmers were invited to create an app or a game for the Liberty Global product Horizon set-top box. Team Trifork joined with Dennis de Goede (Design & Frontend), Tony Abidi (Devops) and myself (Front & Backend).

Alphonso added another challenge to the appathon: Create the best integration with the Alphonso platform. Integration challenge? Sounds like a Trifork challenge to me.



Read the rest of this entry »

A wrinkle in time

June 30th, 2015 by

Leap second

I clearly remember the morning of Sunday July 1, 2012, almost three years ago. I was at church, actually, when I got a call from one of our clients: “The website doesn’t seem to be working.” All I could check at that point was that, indeed, the website was not responding. So I called our sysadmin, who found that even SSH-ing into the machine running the site was taking much longer than usual. Finally, restarting everything solved the problem, but we were still unsure about what had happened.

As we found out later, it was related to the leap second, a phenomenon I had not even heard of until then. Read the rest of this entry »

Documenting your REST APIs

May 8th, 2015 by

Whenever you deliver some API that is to be consumed by another party, you will get the inevitable question of providing documentation. Probably every developer’s least favorite task.

In Java there is javadoc, but that doesn’t cut it if you are delivering a Web Service API. In that realm we already know WSDL for SOAP based Web Services. Then again, every developer seems to prefer REST based Web Services these days and those are not WSDL based… So what then? That is a question with multiple answers. In the last few years there have been three different open-source projects that have tried to give an answer to this: swagger, RAML and API BluePrint. Of those Swagger has been around the longest and arguably gained the largest following.

Based on the completely subjective criteria ‘it needs to support Java’, ‘what about Spring MVC?’ and ‘can you deliver it to the customer by Monday?’ I decided to take a stab at documenting an existing API using Swagger. It is written in something that can run on a JVM, has Spring MVC support (via third party libraries) and seemed to be the easiest to set up based on their examples and various other online resources.

Read the rest of this entry »


April 13th, 2015 by

In this post, I’ll share a very simple tip on how to add very simple custom checks of your Android source code to your Jenkins build server, but the tip should be very easily ported to other build servers too.

Most developers know of Lint checks as something which perform some kind of static analysis of their code and which complain heavily about stuff if you are enabling this check for the first time on an old project. Unfortunately, chances are rather high that you choose to disable the check due to time constraints not allowing you to fix all issues right now. Or maybe you actually enable running the checks as part of your build but choose not to make lint errors break it. Those two solutions are equally bad since none of them prevent you from adding bad code to the codebase.

I won’t go to great lengths to explain why you should perform lint checks, but I’ll say that there are many, many simple checks which can be checked at compile-time and which you (or your colleagues) might not have noticed when implementing a given feature. And why not let the lint tool weed out the stupid errors since it is so much better at detecting these things than you? For example, lint checks can prevent you from publishing an app which crashes on some devices due to code calling APIs, which are not available on devices with too low versions of Android running on them. Lint will compare the minimum API version supported by your app and the API version of every call performed in your app so you can ensure that you have carefully guarded these calls correctly and therefore won’t crash your app at run-time.

Read the rest of this entry »

ANWB Big data Proof of Concept

February 9th, 2015 by

At the ANWB people are constantly trying to improve the services they provide. One of these services is to provide traffic information. In the Netherlands the National Data Warehouse for Traffic Information (NDW) provides an enormous database of both real-time and historic traffic data.

This data comes from many different sources and is available as open data. Wouldn’t it be great if the ANWB could use this open data to provide more accurate traffic information, either in real-time or as a prediction for a certain period? In a proof of concept we have collected and analysed the real-time traffic information to calculate the traffic intensity on the roads using elasticsearch. We also used weather information to see if the weather has influence on the need of roadside assistance.

Read the rest of this entry »

Integrating Flyway In A Spring Framework Application

December 9th, 2014 by

flyway-logo-tmThis post is about how to integrate Flyway into a Spring/JPA application for database schema migration. To skip all the preambles and get straight to the instructions, jump to Project’s Dependencies Set-up

Flyway is a database migration tool which helps do to databases, what tools like git/svn/mercurial does for source code…which is versioning. With Flyway you can easily version your database: create, migrate and ascertain its state, structure, together with its contents. It basically allows you to take control of your database, and be able to recreate it across different environment or different versions of the application it runs with, while keeping track of the chronological changes made.
Read the rest of this entry »

How to Remotely Debug Application Running on Tomcat From Within Intellij IDEA

July 14th, 2014 by

Intellij IdeaThis post would look into how to tackle and debug issues in scenarios where they only occur in production (or other remote environment) but not in development environment. As anybody who has been in this kind of situation would acknowledge, trying to pinpoint the cause of these kind of “issues” might quickly end up being a practice at taking shots in the dark: a very time-consuming and inefficient process.

It was this kind of situation I recently found myself, where, I had to rectify certain issues that were occurring in the production environment but could not be reproduced on the development machine.

Fortunately enough, the said issues could be reproduced in the testing environments (which is as close to the production environment as possible). But having the issues reproducible in the test environment was good In that it confirms the issues needed to be fixed, but it was of little help in actually tracking the issues down, finding the cause and fixing it. Relying just on log outputs was not enough…What if I could debug the test environment from my machine?

Read the rest of this entry »

New features in Axon Framework 2.1

February 13th, 2014 by

Recently, Axon Framework 2.1 has been released. It comes packed with improvements and some exciting new features. In this post, I’ll briefly iterate of what’s new in this version.

Furthermore, we have also scheduled a few workshops and trainings.

Read the rest of this entry »