JavaPolis Going Nuclear

Just when I was about to drive off to Antwerp for this year’s JavaPolis, I learned that a fire has started in Antwerp’s nuclear plant ‘Doel’. Apparently the fire is located in a side building and there’s no immediate danger to the public. Which is exactly what I would say to prevent complete chaos from breaking out…

2007-12-11. No responses.

Where To Marry In Paris (Part 3)

(This is part 3 of 3; part 1 is here, part 2 is here)

We returned from Paris late Sunday evening (March 25th).

What remained was images, shreds of memories, and many of them, in spite of the short time we were there:

The Nautilus-like decoration of the Arts & Métiers subway station.

The American girl in the brasserie too close to the Eiffel tower (but we were too tired to go any further), shouting, “Sir, you’re from Philly, sir?” at an unsuspecting Frenchman wearing an Eagles cap.

The closed doors of the Fashion museum that we had wanted to visit after the Eiffel tower and lunch; apparently, the museum is now closed for visits altogether. We were lured to it by an entry in the Lonely Planet guide, promising “some 100,000 outfits and accessories from the 18th century to the present day”. Instead, we kept walking along the Seine to the Museum of Discovery (Palais de la Découverte), hoping to find traces there of the turn of the 19th century world exhibition that took place there in 1937. However, besides the building itself, very little reminded of that historic fact. The museum houses several themed exhibitions, some very entertaining (animals, visual tricks), some extremely boring. In the animal exhibition, a little rat was showing how it had been trained to run around in a maze and get a tasty snack at certain intervals. Somehow, that reminded me of our own wanderings across Paris.
Continue Reading »

2007-05-11. 2 responses.

Where To Marry In Paris (part 2)

(This is part 2 of 3; part 1 is here, part 3 is here)

There’s a lot in Paris to be seen besides museums. Unfortunately, most of these things are outdoors and can best be visited with a bit of sunshine and a pleasant spring temperature. As we had neither of these on our short trip, we had to spend a lot more time inside the shops on the boulevard des Champs Elysées than we normally would have. We had to admire the view of the Eiffel tower from underneath it. And we had to extrapolate what it’s like to spend a day in the park from sitting on a bench in the tuileries for 10 minutes in the only rays of sunlight that we did get.

There is however another very important indoors activity to be done in Paris, as in every part of France: eating! At lunchtime, heavy rains were usually poring down on us, making it impossible to sit down in a park with nothing more than a baguette and some Coulommiers or other cheese. At dinnertime, we were forced to eat out as we stayed in a hotel room, so we really were unable to do some shopping at a nice Parisian market and have a go at the local ingredients ourselves. In short, we couldn’t help but eat out twice a day; and as we felt obliged to do as the Parisians do, we just had to eat a hot meal twice a day as well. What a punishment…
Continue Reading »

2007-04-01. One response.

Where To Marry In Paris (part 1)

Even though Paris is only a 6 hour drive from where we live, we never actually go to the trouble of finding a hotel and driving up there. Until now. It’s been 27 years since I last spent some time in Paris–more time than the average hour it takes to drive through it when we’re on our way to the south of France. 27 years, that’s more than anybody should have to wait to return to Paris. So we finally found a decent hotel (see map below: marker A) and arrived after a smooth enough ride through the streets of Paris (thanks to Eva, who for some reason wanted us to take a scenic route off the highroad when we entered France, but thankfully got herself back on track as soon as we reached the city).

Continue Reading »

2007-04-01. 3 responses.

Java Closure Examples

One thing I miss in the current BGGA proposal for closures in Java 7, is a good set of examples. There are some examples, but they don’t cover most situations. Also I feel that more examples might better show the advantages of having closures in Java. Of course, as long as the Java compiler has not been patched to work with closures, this remains “swimming on dry land” (as we say in Holland). Syntax errors will no doubt be abundant, and everything might change with the next version of the proposal. I hope this will still be useful to people wondering why there should be closures in Java in the first place. This is why: it makes your code cleaner and leaner.

So here goes, starting with some simple examples. Each example consists of the closure method usage (which will probably be used most) and the closure method definition (which will mostly be done by library developers).

Select objects from collection

This is an example of how the CollectionUtils utility methods could be rewritten using closures.

public Collection<Book> getPublishedBooks(Collection<Book> books) {
    return select(books, {Book book =>
        book.isPublished()
    });
}

/**
 * Returns the T objects from the source collection for which the
 * given predicate returns true.
 *
 * @param source
 *            a collection of T objects, not null
 * @param predicate
 *            returns true for a given T object that should be
 *            included in the result collection
 * @return a collection of T objects for which the predicate
 *         returns true
 */
public static <T> Collection<T> select(Collection<T> source,
        {T=>Boolean} predicate) {
    Collection<T> result = new ArrayList<T>();
    for (T o : source) {
        if (predicate.invoke(o)) {
            result.add(o);
        }
    }
    return result;
}

Continue Reading »

2007-02-05. 17 responses.

« Newer - Older »