Archive for November, 2008

Google Analytics API coming soon?

Friday, November 21st, 2008

Google announced on their blog that a data export API is currently in private beta. Hopefully it will be public soon. This will boost a lot of new applications which will help to analyse the GA data.

To get an impression what can be done with an API, look at Nicolas Lierman’s pictures showing the traffic on his site. I can imagine that based on the new API, more and especially interactive visualisation like this will occur.

Using checkstyle with bitten

Tuesday, November 18th, 2008

Bitten is a trac plugin for continuous integration which I use for the antdiff project and it does a good job in getting the daily builds organized. One nice feature is the summary for unit tests and code coverage tools (I use corbertura). But what I was missing was a similar summary for my checkstyle reports.

But thanks to XSLT, there is a simple solution: Bitten is able to include test and coverage reports from xml files. And since checkstyle generates a xml file for the results, it was straight-forward to translate the checkstyle xml file to a xml file for bitten. The only problem is that bitten only knows the two mentioned types of reports, so I decided to use the test report. 

And this is the (extremely simple) stylesheet:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

  <xsl:template match="file">
    <xsl:choose>
      <xsl:when test="count(error) = 0">
        <test status="success" fixture="{@name}" name="No checkstyle errors" file="{@name}" />
      </xsl:when>
      <xsl:otherwise>
        <xsl:for-each select="error">
          <test status="error" fixture="{../@name}" name="{@message}" file="{../@name}" />
        </xsl:for-each>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="checkstyle">
    <report category="test">
      <xsl:apply-templates/>
    </report>
  </xsl:template>   

</xsl:stylesheet>

Translating the checkstyle xml report using this stylesheet allows you to treat checkstyle results in the same way as unit test failures.

But there is one slight problem: the file names in the checkstyle xml are absolute file names. Hence also the file names in the bitten build summary are absolute. In my setup this means having something like “/tmp/bittenFpQXrh/build_Trunk_22″ in front of the name, which doesn’t look good and it also breaks the link to the source code. The simple solution was to remove the path name from the checkstyle report using the following ant task:

<replace file=“${dir.reports}/checkstyle_report.xml” token=“${basedir}” value=“”/>

Maybe it would be nice not to link the checkstyle results to the source code, but rather to the html reports which give more information about the details of the problem.

Please see on of the antdiff build status pages as an example (click on “Test results” in the checkstyle section).

Haynes catalogue of music

Saturday, November 8th, 2008

Today I have installed a very first version of a complete relaunch of the old homepage of ‘Music for Oboe’ on Beauty of Code: the Haynes catalogue. ‘Music for Oboe’ is a quite complete listing of compositions for the oboe in the 18th century, which has been collected and published as a book by Bruce Haynes. Several years ago, this data has been made available on music for oboe using a simple Perl application by Peter Wuttke.

Since then, a lot of musicians all over the world contributed to this list, so that Peter and I decided to completely rewrite the application using Ruby on Rails. Well, actually I wrote the application while Peter checked lots and lots of libraries all over Europe to find new works or to validate the information given by others.

Needless to say, there are still a lot of things to do until the final version will go live.