Sonntag, 30. Mai 2010

Geospatial JDO queries on the Google AppEngine (+ GWT)

From time to time one might feel the urgent need to execute geospatial queries on the Google AppEngine. Thinking in common SQL this is pretty easy, just a combined WHERE clause:

SELECT * FROM t_spatialdata
WHERE latitude >= south AND latitude <= north AND longitude >= west AND longitude <= east

Unfortunately something like this is not possible, when using AppEngine, as you can only filter by one argument (i.e. only by latitude). I think the reason for this is that AppEngine internally sorts the table and then 'cuts' away what doesn't match the filter.

So this problem can basically be solved, by using a algorithm called Geohash, which unfortunately didn't want to return proper results, at least not the implementations I found. (The 'official' implementation uses the BitSet-Class which is not present when using AppEngine/GWT)

The solution I went for is the "javageomodel"-project which follows (afaik) a similar algorithm but worked.

The problem you will face, when trying to use this in your AppEngine project is that it will be missing (just at runtime!) two classes from the Apache Commons project: StringUtils and Validator. At least the latter one is over 1MByte in size. So I decided to replace the Validator lines with standard "assert"-calls, but adding the jars probably would have worked too.

For your convenience I uploaded the final jar that works fine:
A how to use this for actual queries is located here:

Samstag, 29. Mai 2010

Eurovision Song Contest 2010 prediction by Google

... I just found this prognosis chart for the Eurovision Song Contest 2010 in Oslo. The data is based on the amount of Google search queries from each country's artist relative to the artist of all other countries.
I think the predicting of future events by recent data is very interesting.
What I think this might influence is the complexity of the artists name, thinking of mistyped an accidental queries.

Who do you think will win?

Donnerstag, 20. Mai 2010

Google I/O 2010 - Day 1 ... and the Android day?

As an Android developer Day 1 of Google I/O was not that interesting. Of course the parts of HTML5 and the opensourced Video-Codec WebM (VP8 + Vorbis) were pretty killer but there hasn't been a single real word  about Android.

So I got the confirmation today May 20th, 2010 is going to be the Android day. Also there is going to be
... more than one surprise!
 What crazy amazing Android stuff can expect in today's keynote? This is the most probable stuff:

  1. Android Froyo 2.2
    1. JIT Compiler
    2. An Update to the Android Market?
    3. Solution to the Android Fragmentation
  2. Google/Android for TVs. Codename Dragonpoint
  3. Official Android Tablet
  4. so much more...
Google even made the keynote start 30 minutes earlier - an indicator to that all they want to show is going to make their timeframe pretty much explode.

If you are as excited as I am, stay tuned for a live stream of the day 2s keynote at:

HttpServlet doGet / doPost throwing unexpected Exception

Ever wondered why your HttpServlet on Google AppEngine didn't work, even if the code looks sooooo right?
You might have (accidentally) called super.doPost(...,...); or super.doGet(...,...); which calls the default implementation of HttpServlet, which throws an Exception!
package org.crazy.servlets;


import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class CrazyServlet extends HttpServlet {

 protected void doGet(final HttpServletRequest pReq, final HttpServletResponse pResp) throws ServletException, IOException {
  this.doPost(pReq, pResp);

 protected void doPost(final HttpServletRequest pReq, final HttpServletResponse pResp) throws ServletException, IOException {
   super.doPost(pReq, pResp); // <-- DON'T !!! Just delete this line
  // Insert actual work here...
Took me quite some to figure this out =D

Experiment - If 1000 people Flattr this I'm gonna shave my head (on video!)

This is an Experiment on how well the new Flattr service is working already.
I'm serious - I'm going to completely shave my head if 1000 people Flattr this!

See you soon =)

Mittwoch, 19. Mai 2010

Flattr - and its hardest nut to crack...

By the time you are reading this, you probably know about the new service Flattr ( Its pretty similar to the Facebook 'I Like'-button with a micropayment background. So its more like an 'I Care'-button that allows you to show appreciation for the content you have just consumed.

The idea is simple. People register, pay a monthly fee of: 2, 5, 10 or 20€ and can Flattr as many times as they like. At the end of the month that money is equally shared amongst all the owners of the Flattr buttons clicked. Thats it simple and genious.

Who profits in this system?
The people who obviously will profit are those content creators that in a way emotionalize others (or Flattr users as others can not (yet) Flattr) so that they click the button. I personally click all the buttons when the words 'Cool' or 'Wow' are in my head or I have a smile on my face after consuming the content.

I myself am using Flattr now in my development community ( so every single of the 13.000 users can add his/her Flattr-ID and a Flattr button will magically appera below every single post, so others can show their appreciation for the help they just received. I think that the use of Flattr in Forums is a area that has not yet received the attention it deserves. In the end its about people that Flattr other people.

 and its hardest nut to crack...
But wait, ....
In the end its about people that Flattr other people.
Who did sign up to Flattr up to now? I don't really know! But all I can assume that the vast majority were content creators and not consumers.

So what does this mean?
This means that the (currently) the money does not yet flow from consumers to content creators but from one content creator to another. The biggest nut to crack will be to actually get consumers to participate in the system. Would you take that hurdle to register to a service that requires you to pay 2€ per month to show your appreciation for an 'average' blog post? Probably not, at least I would not do so. When money enters the game, people start thinking about it at least twice.

In my opinion this is when emotion comes back into the game. For example:
If I'd help a user on my forum on a problem that he's been fighting for days, that he's probably doing his Happy-Dance in private, he might consider jumping over that hurdle!

So what are your ideas on how consumers can be induces to participate in the system?

Sonntag, 16. Mai 2010

Android controlling 6 legged robot!

Today I dusted off my closet and found my old robot 'AMSEL' (Autonomous Mobile Spider Electrical Locomotion) that I had built right before I ever had been taught anything about Computer Science.

Meanwhile I was missing my Android action figure - I found it in a symbiosis with my robot!!!

The only conclusion a rational thinking mind can make:
Androids are going to take control over the whole world!!!