Monthly Archives: November 2010

1 Comment

Ever wanted Maven to print the test output to the terminal to save yourself from digging around in the surefire report directory to find out what happened with the failing tests? I have many times but have never invested the time to find out how until now.

It's pretty straightforward. Set the useFile flag to false in the surefire plug-in. To also skip the xml report output you can set the disableXmlReport to true. Then there will be no reports created when running the tests. Use the profile below to enable this in your pom.

Please note that for some odd reason my syntax highlighter lower case all tags. It should be groupId, artifactId, disableXmlReport and useFile in camel case.

To activate this profile you need to add -Pdev. You could have it active by default but then your CI server will not have any test reports. And whilst no reports are fine on the developer machine it's not very practical on the CI server.

I have been contemplating writing about cocktails for a while now. It is after all one of the things I'm most passionate about. To kick this subject and section of I would like to write about an old-fashioned cocktail introduced to me at Ruby in Copenhagen. The Tequila old-fashioned.

It is pretty simple to make. Take an old-fashioned glass and fill with a large chunk of ice. I prefer using a single block that just fits into the glass then using ice cubes. Add two spoons of agave syrup and two to three dashes of orange bitter. Pour two shots of good quality tequila and stir thoroughly.

Ingredients:
1-2 spoons agave syrup
2-3 dashes orange bitter
2 shots tequila

To vary this delicious drink use some Angostura bitters as well or instead of orange bitters.

My last entry walked through the Android application for the C2DM PoC. This one will look closer at the server side.

The web server is written in Python and sits on top of the tornado framework. To get started you will first need to check it out from github.

Then there are two things that needs changing for the serve to run. First of, tornado is included as a git sub module. In order to get the tornado server you need to run the below commands, when in the project folder, in the terminal:

This will pull down tornado from their github repository.

Secondly you will need to change the following two lines (lines 36 and 37) of code in c2dm/c2dm_service_facade.py:

Replace the Google account with the account you have registered to use with C2DM and the password with the password for said account.

You should now be ready to go. To launch the server on port 8888 execute the following terminal command:

There isn't much more to it. As I have said before not all requirements for C2DM is met by this application but it will work as a prof of concept.

3 Comments

To continue from my previous post, Google Cloud to device messaging for Android, I will walk through how to build and install the Android application.

First of all you will have to sign up for access to the service. You can do this from Googles sign-up page.

You will then have to enter the Google account id into the Constants class where you will find a constant called named C2DM_APPLICATION_SERVER_ID.

The application is using the Maven build system, utilising the maven-android plugin. This makes it very easy to build and install as long as you have Maven installed. You will need to connect your Android 2.2 device or start the emulator, then issue the following command in your shell:

For the device side this is pretty much it. When you have set up your server you can go ahead and start the application. You will be presented with a button which you click to register for receiving messages. When you then use the server to send a message you will see this being printed to the log.

1 Comment

I have been trying out Cloud to Device Messaging (C2DM). It is a technology from Google that makes it possible to send small messages to an Android Devices running Froyo, the latest Android 2.2 release with the Google API's enabled. The application is a very simple prof of concept that illustrates how the technology can be used. It is however not a full implementation and it is missing some required functions.

The PoC is composed by two different sub-systems, an Android application and a web application server. The servers is written in Python and is leveraging Tornado.

The system supports the message sequences depicted in the diagrams below:

Register a device for C2DM:
Register a device for C2DM

Sending a message to device:
Sending a message to device

In the two coming posts I will walk through how each of the sub-systems (device application and web server) works. If you are aching to get your hands on the code you will find it on github: Android application, Web server.

You will find the device side introduction here and the server side introduction here.