Using ReportNG with Gradle

Posted in Java by Dan on December 9th, 2009

Tomek Kaczanowski has written a blog post showing how to use ReportNG with Gradle (an alternative build system for Java/Groovy/Scala). I’ve never used Gradle but it seems to have two things in its favour.  Firstly, it uses Groovy syntax rather than the cumbersome XML employed by Ant. Secondly, it’s not Maven. Maybe I should try it out some day?

New Watchmaker Framework Website / Development Roadmap

Posted in Evolutionary Computation by Dan on December 2nd, 2009

The Watchmaker Framework for Evolutionary Computation has a new website at http://watchmaker.uncommons.org. The Java.net web hosting is slow and restrictive, so I’ve decided to self-host the project pages.

The project will continue to use the other Java.net tools such as Subversion, Issuezilla and the project forum for the foreseeable future, though I am weighing up the benefits and drawbacks of a possible relocation to GitHub.

I have no plans to move my other projects that are currently on Java.net (Uncommons Maths and ReportNG being the main ones).

Part of the new Watchmaker website is the development roadmap, which should answer some of the questions I’ve been asked about where the project is heading. Most of the work for version 0.7.0 is done and in Subversion, there are just a couple of rough edges to be worked out. I hope to do a release before the new year. Version 1.0 seems as far away as it did 3 and a half years ago.

Zeitgeist 1.0 – An Intelligent RSS News Aggregator

Posted in Java, Software Development by Dan on November 26th, 2009

I recently signed-up for GitHub. Compared to Java.net or Sourceforge, it provides a much lower barrier of entry for code hosting.  There’s no need to wait an indeterminate period of time for somebody to approve your project, you just upload it. And because it’s a DVCS, it’s easy for other people to fork your projects and submit patches. Open Source project hosting has become so straightforward, thanks to sites like GitHub and the Bazaar-based Launchpad, that it encourages developers to open up code that they might otherwise have kept to themselves. After all, why bother with local repositories and back-ups when you can get somebody else to do it for you and get free web-hosting and issue-tracking too?

I have a number of trivial and incomplete projects hosted in local Subversion repositories. I am slowly adding to GitHub those that have any worthwhile substance to them. I’m making no promises about the quality of this code, and I don’t intend to spend much time supporting it, but I’m putting it out there in case somebody might have a use for it.

First up is Zeitgeist. This is a small Java library/application for identifying common topics among a set of news articles downloaded from RSS feeds. It’s sort of like what Google News does. There is a basic HTML publisher included that generates a web page for displaying the current top news stories, including relevant pictures.

You give the program a list of RSS feeds that cover a certain topic (maybe world news, or music news, or a particular sport) and it uses non-negative matrix factorisation to detect similarities in the article contents and to group the articles by topic. The original idea comes from Programming Collective Intelligence.

The default HTML output looks a bit like the image below, but you could customise it with CSS or by hacking the default templates to modify what information is included (for example, you could add an excerpt instead of just displaying headlines).

The algorithm is not infallible and how well it works depends a lot on the feeds that you select. It’s also non-deterministic, so if you run it multiple times with the same input you will get variations in the output.  Perhaps Zeitgeist is not that useful in it’s current form but it could be used for adding on-topic news headlines to a website or as the basis for something more advanced.

ReportNG 1.0 Final Released

Posted in Java by Dan on November 2nd, 2009

When I released version 0.9.9 of ReportNG last week, I didn’t call it version 1.0 because I thought I’d probably have to fix some problem caused by the changes I’d made. I was right. It turns out that I broke the one tiny piece of JavaScript that the HTML reports use. Well that’s fixed now and, because none of the three people who downloaded 0.9.9 have complained about anything else, and because I’m not keen on double-figure components in version numbers (as in 0.9.10), I’ve decided that this can be version 1.0.  You can get it here (or from the Java.net Maven repository if that’s how you roll).

overview

ReportNG 0.9.9 – Improved HTML/XML reporting for TestNG

Posted in Java by Dan on October 28th, 2009

I’ve just released version 0.9.9 of ReportNG, the HTML/XML reporting plug-in for TestNG. This version incorporates several minor changes, mostly improvements to the HTML/CSS.

If you want to see what ReportNG does, it generates HTML test reports that look something like this. You can customise the appearance with your own stylesheets. ReportNG also generates XML reports for compatibility with tools that support JUnit XML files.

For those of you afflicted by Maven, you should be able to get ReportNG from the Java.net Maven 2 repository. Not being a Maven user, I haven’t actually tested that this works, but it should be less wrong than it was last time.

IntelliJ IDEA Goes Open Source

Posted in Java by Dan on October 15th, 2009

Big news from JetBrains.  Their IntelliJ IDEA Java IDE will be offered in a free Open Source edition from version 9.0.  The free version will include all the JavaSE features, version control integrations for CVS, Git and Subversion, support for unit testing with JUnit and TestNG, and language support for Groovy and Scala.  The full paid-for version will add the enterprise Java tools, UML diagrams, more version control integrations, and language support for SQL, PHP, JavaScript and more.

IntelliJ IDEA is, in my opinion, faster and more powerful than NetBeans and slicker and more intuitive than Eclipse.

As well as opening up the Java IDE, JetBrains are open-sourcing the IntelliJ platform, which is the foundation of all of their IDEs.  As a bonus, they’ve chosen to use the permissive Apache Licence rather than less commercial-friendly GPL.

At the time of writing, the JetBrains web server appears to have crumbled under the weight of the traffic that this announcement has prompted.

Attention to Detail

Posted in Software Development by Dan on September 23rd, 2009

A thought for the day, courtesy of Landon Dyer (no relation) a.k.a DadHacker.

“Good programs do not contain spelling errors or have grammatical mistakes. I think this is probably a result of fractal attention to detail; in great programs things are correct at all levels, down to the periods at the ends of sentences in comments.”

Evolutionary Computation in Java – ECJ, JGAP and Watchmaker Compared

Posted in Evolutionary Computation, Java by Dan on September 17th, 2009

In the days before the Watchmaker Framework the two most popular Java evolutionary computation libraries were probably ECJ (Evolutionary Computation [in/for] Java) and JGAP (Java Genetic Algorithms Package). Since the advent of Watchmaker the two most popular Java evolutionary computation libraries are probably ECJ and JGAP. So that worked out well then, but at least the Watchmaker Framework is now being mentioned alongside these established projects.

A recent series of posts over at the Hidden Clause blog compares the pros and cons of implementing the same genetic programming (GP) examples using each of the three frameworks. The article about the Watchmaker Framework is here. In the final analysis Watchmaker is ranked second, ahead of JGAP but behind ECJ, with mostly positive comments (particularly in respect to Watchmaker being the only one of the three frameworks that takes advantage of Java 5’s generics).

Ultimately it seems that the lack of specialist GP support is the main black mark against Watchmaker in this review. Watchmaker is, in its current incarnation, a more general-purpose evolutionary computation framework rather than a specialist system for genetic programming. There is proof-of-concept GP code included but the classes are not part of the core framework. Eventually I would like to include proper GP support, either as part of the core library or as an official add-on library.

I understand that there will be further articles on GP in Java (using ECJ, JGAP and Watchmaker) at Hidden Clause, so it might be worth subscribing if you are interested in this kind of stuff.

Watchmaker Framework for Evolutionary Computation – Version 0.6.2

Posted in Evolutionary Computation, Java by Dan on September 13th, 2009

This is a bug fix release that addresses a couple of issues with thread management. In version 0.6.1, if you were creating and discarding multiple ConcurrentEvolutionEngines, the threads from the discarded engines would not be cleared up properly.  This could eventually lead to OutOfMemoryErrors if you created a large number of evolution engines.

In version 0.6.2, all ConcurrentEvolutionEngines share a common thread pool so there is no need to create and destroy additional threads.

0.6.2 also reverts the switch to non-daemon threads in version 0.6.1. If you were having problems with the JVM not exiting when your program completed, this should fix it.

JDK7 Tackles Java Verbosity

Posted in Java by Dan on August 29th, 2009

The Java Language changes accepted for inclusion in JDK7 have been announced by Joseph Darcy. We already knew that closures were off the menu.  So too, unfortunately, is language support for arbitrary-precision arithmetic. The final list is pretty non-controversial and includes a number of changes that will reduce the verbosity of Java programs (one of the main criticisms of Java from proponents of other languages). Java will never be as terse as Perl or Haskell, but that’s no bad thing. One of the strengths of Java is its readability. There are however some areas where the language is needlessly verbose and that’s what these changes are addressing.

Simplified Generics

The last major revision of the Java language was Java 5.0, which introduced generics, auto-boxing, enums, varargs and annotations. Despite the compromises of type erasure, generics have been a major improvement to the language. They have also contributed to the verbosity of Java code. The necessity to specify, in full, both the reference type and value type of a field or variable has led to some very long declarations:

Map<String, List<BigDecimal>> numberMap = new TreeMap<String, List<BigDecimal>>();

JDK7’s proposed diamond notation allows the programmer to omit the generic parameters on the righthand side if they are the same as the left:

Map<String, List<BigDecimal>> numberMap = new TreeMap<>();

Collection Literals

The long overdue addition of collection literals will help to reduce the size of Java code and make it more readable. Lists, sets and maps can be created and populated without the need for cumbersome instance initialisers:

List<Integer> powersOf2 = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024};
Map<String, Integer> ages = {"John" : 35, "Mary" : 28, "Steve" : 42};

Automatic Resource Management

Josh Bloch’s proposal for automatic resource management gives Java an alternative to C++’s RAII and C#’s using. It eliminates much of the boiler-plate exception handling that surrounds the proper creation and disposal of resources, such as IO streams, in Java code. The proposal introduces a new interface, Disposable, that resources will implement. The syntax of try/catch/finally is extended to allow resources to be specified at the start. These resources are then automatically disposed upon completion. Here’s an example of the new syntax in action (taken from the proposal):

static String readFirstLineFromFile2(String path) throws IOException
{
    try (BufferedReader reader = new BufferedReader(new FileReader(path))
    {
        return reader.readLine();
    }
}

Other Changes

As well as the above changes to tackle verbosity, JDK7 adds binary integer literals and the ability use String literals in switch statements.  JDK7 will also fix the problem of mixing varargs parameters with generic types.

« Older Posts