Trifork Blog

Category ‘Java’

Documenting your REST APIs

May 8th, 2015 by
(http://blog.trifork.com/2015/05/08/documenting-your-rest-apis/)

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 »

RUNNING CUSTOM “LINT” CHECKS ON YOUR ANDROID BUILDS

April 13th, 2015 by
(http://blog.trifork.com/2015/04/13/running-custom-lint-checks-on-your-android-builds/)

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.

What?
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.

Why?
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
(http://blog.trifork.com/2015/02/09/anwb-big-data-proof-of-concept/)

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
(http://blog.trifork.com/2014/12/09/integrating-flywaydb-in-a-spring-framework-application/)

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
(http://blog.trifork.com/2014/07/14/how-to-remotely-debug-application-running-on-tomcat-from-within-intellij-idea/)

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
(http://blog.trifork.com/2014/02/13/new-in-axon-2-1/)

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 »

Apportable (a much better alternative to Phonegap) and AFNetworking 2.0

October 22nd, 2013 by
(http://blog.trifork.com/2013/10/22/apportable-a-much-better-alternative-to-phonegap-and-afnetworking-2-0/)

cocoahead_sm2On October 16th I attended CocoaHeads, an iOS developer meetup that is organized every few months by Peter Robinett of Bubble Foundry and other volunteers. Every time it’s hosted at a different location. It was previously hosted at Spil Games, Xebia and NOS. This time it was hosted at eBuddy. The formula is simple: great speakers show up and talk about interesting frameworks, hacks, tricks and so on. During the presentations, attendees can enjoy some free drinks and food.

This was the fourth time I went and it was the best edition yet! That’s why I decided to blog about it this time. I believe this was the best edition because there were talks given by two speakers from San Fransisco: Matt Thompson and Zac Bowling and they talked about some pretty interesting and even mind blowing topics.

Read the rest of this entry »

Windows Phone 8 – C# vs. Java

September 17th, 2013 by
(http://blog.trifork.com/2013/09/17/windows-phone-8-c-vs-java/)

csharp-vs-java
Welcome back to another brand new Windows Phone 8 blog! After I explored the UI and checked out the IDE it is now time to take a look at the programming language: C# or “C sharp”. I want to focus purely on the language itself and compare it to the language I know best: Java. I was surprised how good C# was compared to Java. The syntax of both languages look a lot alike. I want to highlight some of the language features I discovered while writing my first app of which I thought: wow, I wish Java would have this!

Read the rest of this entry »

Hippo CMS Favorite Folders Plugin

July 17th, 2013 by
(http://blog.trifork.com/2013/07/17/hippo-cms-favorite-folders-plugin/)

hippo_logoAfter doing a number of big projects with Hippo CMS, I came up with the idea of creating a plugin. I’m always looking for ways to optimize the user experience as I think user experience is one of the most important parts of a product. Hippo allows you to store your content in a folder structure. In my projects I’ve noticed that most users only use a few folders to work in. Sometimes this folder is located on a deeper level in the folder structure, which makes the user need to click even more before he reaches his content. My plugin allows the user to mark a folder as a favorite folder. A link will be created on the dashboard (the first screen after log-in). Using this link, the user can quickly navigate to that folder. The favorite folders will also be available in the link picker as a separate section. Continue reading to find out how it works!

Download Hippo CMS plugin

Read the rest of this entry »

Checking return values in Java

July 2nd, 2013 by
(http://blog.trifork.com/2013/07/02/checking-return-values-in-java/)

The other day I made a stupid coding error. It took me the better part of an hour to track it down. We all have those moments. Blame it on a bad night’s sleep, a brain fart, or perhaps the fact that your colleague at the next desk has been whistling that tune from Gotye’s “Somebody I used to know” (you know the one) all day, completely driving you crazy and taking your focus off your code.
Read the rest of this entry »