Thoughts, news, and things that I've learned around location-based web and mobile applications. This blog will serve as my platform to share pieces of information that I found worth sharing, things that I found good to know working on location-based services. This is the very beginning of my blog and who knows, it might just turn into my own reference of location-based code and math.

GrayLog2 to HipChat Plugin – Improved Version

I have been using GrayLog2 (the old version, not the new one) in various projects. It is a favorite of mine to create more visibility into an app’s logs. By giving developers easy access to logs in one central place, it makes it more likely for developers to quickly check the logs, raising awareness of errors at an early stage. I have previously written about how to create a simple GrayLog2 Monitor page that can be used as a dashboard. Now, to make things even better, add HipChat. GrayLog2 has a few plugins, one of them providing functionality to send triggered alarms to HipChat. You can find the code on GitHub. Once configured and enabled for a stream, it sends alarm messages to […]

Basic NodeJs Example With Multiple Files

I finally tried out node.js. So far so good and I am liking it a lot. One thing, however, took me a while to figure out. A lot of references were talking about how everything is in one file and how that helps performance. I can see how that is the case but how am I going to write any complex application with everything in one file? Surely I must have missed something and, for whatever reason, it took me a while to learn how to reference code in other files. In case you are in the middle of the same experience, I am hoping this nodejs example will clear up a few things. The below code shows a very, very […]

Like Comments on Github

I was looking at a pull request on GitHub from one of my coworkers. Somebody else already looked at it and added a couple comments. This is great way to give feedback on code and work together towards better quality code. I agreed with that person’s comment and I wanted to just like it to give it some more weight. So, here is my suggestion to GitHub: add like buttons to pull request comments. Something like this:

Simple Application Monitor using Graylog2

This post describes a simple, low cost application monitor using Graylog2. Lets assume that you have a web application that writes error messages to an application log file (what app doesn’t, right?). Then further assume that you have setup Graylog2 to aggregate those application logs and provide a slick interface to drill into error messages. With these two assumptions met, you can setup a simple application monitor as the one shown in the picture. Each green bar is linked to a stream in Graylog2. Streams are a way to specify a subset of the log messages. E.g., you can specify that everything that contains the word “MySQL” to be in one stream. In the Java world, you could specify java […]

Mock Services using Spring Profile

I have recently been put on a project that the company had little faith in its quality, maintainability, and whether or not it will meet the business requirements once it goes live. My job was to analyze the project and provide recommendations on how we drive this project in the right direction. After diving into the code and tackling a couple features myself, it came very apparent that the team is wasting a lot of time struggling with testing their code. The application depended on a lot of external services that are flakey at best. Some code flows were only testable in a QA environment. After wasting a couple hours myself, I took it upon myself to mock all external services until I […]

OpenStreetMap Geocoder

This post is about a small project I worked on in 2009 and I am merely posting it here so that it doesn’t get forgotten. So this is more of a housekeeping post but interesting nevertheless. I created a reverse geocoding service based on the Open Street Map (OSM) data. At the time, there was no such web service available and I took it upon myself to correct that. There was, however, Cloudmade that provided mapping services based on OSM data. So I created a web service that, given latitude/longitude pairs, returned a street address or name of the areas if the latitude/longitude was within such areas. Here is a screencast that I took before taking down the site (more to that further […]

MongoDB Plugin for Quantum GIS

I recently had the need to plot geographic data stored in MongoDB on a map. The data are points (latitude and longitude) for a project at WHERE, Inc. I was using Quantum GIS and the “Delimited Text” plugin that lets you load CSV files (back in the day of ArcView this was called adding an “Event Theme”). So the process was to export the data from MongoDB into a CSV file, editing that file so that latitude and longitude are separate columns, and then loading this edited file into Quantum GIS. This was fine once, maybe twice, but after that I was looking for a more automated solution. The result of this motivation is my MongoDB plugin for Quantum GIS. […]

Java JSON Libraries Comparison

I work for the great company Where, Inc. where I keep the WHERE Ads platform humming. It is a Java backend, Spring framework, Jetty, etc. We use a lot of JSON in API calls and especially for logging. Every request, click, ad impression gets logged and with several millions of requests per hour that makes for a lot of allocated JSON objects. Recently I profiled our application and saw that the JSON library allocated tons of objects and lead to high garbage collector activity. So I started to look for alternative libraries and ran a test to compare memory allocation. Speed is less important in this application as most JSON objects contain less than a dozen attributes. I tested four […]

Degrees, Miles, Meters

Every now and then you will need to lookup some numbers. E.g., you might be writing code that searches places within a distance but you have to specify the distance in degrees or you need to calculate a minimum bounding rectangle. So you might need to know how many degrees are 1000 meters. You can, of course, do the math as described in the Distances post but if you just need to get some pointers, here are some commonly used values. Here some numbers that might be handy to have them within reach.


When you develop any type of application that deals with geographic data, you will most likely have to calculate distances between two points. Such calculations are fairly simple but nevertheless, I think it is worthwhile for me to list your options, especially if you are new to working with geographic data.