Trifork Blog

Posts by Denis Tunović

Java Profiler Comparison

March 13th, 2012 by

While maintaining one of our client’s applications I noticed some performance problems under higher load. It seems logical to think when increasing the load on the application, that the performance will decrease. However, in my case the performance decreased at a rate much higher than when compared to the increased load. I did wonder, maybe the performance could be increased by altering the application’s logic or maybe the application had reached its limit and needed to be scaled up. In order to figure this out in more detail, I decided to do some profiling to see where the application was using most of its resources and how to tackle this problem.

Read the rest of this entry »

Boosting productivity using JRebel

September 13th, 2011 by

At JTeam I am involved in a number of projects. One of the more important projects at the moment is a Hippo project. During a Hippo training I was introduced to a tool that could speed up development time considerously. At Hippo they use JRebel to speed up CMS development. With JRebel you make changes to your code without the need to restart after every change. As I am always looking for tools that make me more productive, I wanted to try this out myself.

Read the rest of this entry »

Using Google Geocoding API with Geocoder

April 14th, 2011 by

I was looking for a way to retrieve latitude and longitude for a given address. I thought that Google could provide me with a solution and eventually it did. First I was looking at the Google Data API, but found that some parts were deprecated and not supported anymore. The Google Geocoding API, that is part of the Google Maps API, should be used. You can execute a request. The response will be in JSON or XML format. Next to that there is a nice Java API called the Geocoder. Through this API it is easy to obtain geographical information.

The following example shows how to retrieve latitude and longitude in a test:

public void testGetLocation() {
    final Geocoder geocoder = new Geocoder();
    GeocoderRequest geocoderRequest = new GeocoderRequestBuilder().setAddress("Rijnsburgstraat 9-11, Amsterdam, The Netherlands").getGeocoderRequest();
    GeocodeResponse geocoderResponse = geocoder.geocode(geocoderRequest);
    List<GeocoderResult> results = geocoderResponse.getResults();
    float latitude = results.get(0).getGeometry().getLocation().getLat().floatValue();
    float longitude = results.get(0).getGeometry().getLocation().getLng().floatValue();
    assertEquals(52.347797f, latitude);
    assertEquals(4.8507648f, longitude);

If you want to use this in your project, you can obtain the Java client from a Maven repository. The following code block shows the Maven configuration of the artifact:


Now you can determine the latitude and longitude of the place where you live!