Friday, October 12, 2007

Use == for Enum comparision

I was recently running FindBugs over some Java5 based code and found some places where FindBugs was complaining that two Objects compared with equals() are not of the same type.
Closer inspection showed that this have been Enums in most cases. The IDEs did not warn here and maunal code inspection also does not directly show the issue.
Luckily with enums, you can use == to compare them. And then it gets obvious:




Just a small little change in habits, but it helps a lot.

JIRAClient is cool

Recently we at JBoss® received licenses for JIRAClient. It is a cool desktop app (written in Java) that serves as a frontent to Atlassians JIRA bugtracking sytem. One of the nicest features here is offline mode: JIRAClient is ablw to download issues to its local database, so you can work offline and upload changes later on.
The staff at Almworks is very responsive in the forums and also open to suggestions.

If you are using JIRA on an daily basis, then you should definitively check out JIRAClient.

Thursday, October 11, 2007

pg_stat_activity is your friend

PgAdmin for postgres has a nice feature called "Server status". It is great if you sit in front of a GUI.
But if you want to do some remote work or tell a customer to report that server status, it is not quite the right thing.

But at the end, pgAdmin is only doing

select * from pg_stat_activity order by procpid;


This will show you all client connections together with the command they are currently executing.

Tuesday, September 11, 2007

NPE due to autoboxing

One of the nice features of Java 5 is autoboxing. I guess everyone remembers the hassle of calling Integer.intValue() to convert from Integer to int.

Now can you guess what the following code does when you call FB.foo()?

public class FB
{
public void foo()
{
int x;
x = bar();
System.out.println("X is " + x);
}

public Integer bar()
{
return null;
}
}


Yeah, it is throwing a NullPointerException in the assignment x = bar() because bar() is returning null and the implicit bar().intValue() is thus throwing the NPE. Without autoboxing, this is much more evident.

Unfortunately it seems like FindBugs and other tools are not (yet) able to detect this (actually in my test code, FindBugs was not even able to detect the NPE in teh explicit call).

Monday, August 13, 2007

x2svg new release 1.2beta1

Project x2svg just released a new version, 1.2-beta1

Changes are
* Documentation updates
* Changed handling of the property file. See properties.html.
* Fixed a bug where the directory path of the input was appended to the output if only a directory was given for output conversion (x2svg-Bugs-1770327)
* The gui no longer silently swallows errors (x2svg-Bugs-1771512)
* Comments can be added to a diagram e.g. stating the input file or user (x2svg-FR-1770604)
* Improved XSD handling. Recursions are handled and a big Schema from @work can now be parsed. Inheritance is honored.
* Fix for: "The DTDParser was going into an endless loop" (x2svg-Bugs-1766097).
* Added a test suite.


It can be downloaded from the sourceforge download pages at:
http://sourceforge.net/project/showfiles.php?group_id=199130&package_id=236217&release_id=531824

Saturday, August 11, 2007

Sleepless in Stuttgart - Part III

Over two month have now passed since my last post.
Both Kids are doing fine. Marlene is much more moving around (but still not crawling).

Around six weeks ago we've implemented the 8-o-clock rule for Orlando and since that time we have our evenings back to us.
The rule is very basic: "Orlando is in bed at 8pm and daddy and mommy are out until the next morning". Actually we have tried this several times in the past, but never really succeeded. The big difference now is that he has an analog clock in his room, so he can directly see if the big needle is already at the top and little one on the eight or not. When he is in bed before eight, we still have some time for reading. If he is in late, it is relatively easy to point him to the clock and tell him that it is late now. That system really works well for us.

End of June we did a short trip to the Bodensee (Lake of Constance) where we had a good time altogether. We were staying at a farm with lots of toys for children. Unfortunately Orlando was the only German kid at his age (there was a French girl), so we still were his major friends for playing). Next time we do such a trip, we will try to convince friends to come with us, so that the kids can go playing on their own.

I am having my second month of Elternzeit and am currently discussing the implementation of that with the regional agency, as the law seems to allow to take the Elternzeit only on the n-th month of birth of the child. So if the child is born on 15th of a month, you can only take Elternzeit from a 15th to a 14th on the next month, but not e.g. from 1st to 31th. Unfortunately I didn't know that :-/ Well lets see, what comes ...

XO review by a 12 year old

This blog entry contains a review of the XO (the One Laptop Per Child, OLPC) machine.
Interesting read. I wish I could get my hands onto one as well

Must sees in Stuttgart (?)

As you know I am a regular qyper since end of last year. Recently I got asked by another qyper from outside Germany what are the must sees in Stuttgart.
Well, the first solution to this would be to just select the entries with 5 stars. But this still leaves a big chunk of things.

So this is a very subjective list of must sees from my point of view. All urls refer to qype entries:

- TV-Tower: This is located on the top of one of the surrounding hills and was the first all concrete TV-tower in the world. You have a great view from up there. You can get there with Subway U7 from main station.

- Killesberg (+ tower) it is a nice parc with a cool tower there as well. You can get there via U7 as well (in the other direction). When you are up there and are into architecture, then you should also go and see the Weissenhofsiedlung or on Qype

- The Zacke also gives nice views over Stuttgart. Tickets for public transport are vaid here as well.

- The Königsstraße is the main shopping mile and starts at the main station. When you walk this pedestrian zone, you pass by at the châteaus , the new Kunstmuseum (this entry only describes the bar, but the picture shows what to expect) This link is better: http://www.kunstmuseum-stuttgart.de/de/index2.php

Then of course as the City of Mercedes and Porsche there are museums as well:
- Porsche Museum (currently in construction, but the old one is not far away.
- Mercedes Benz Museum


There are plenty more things to see. Check out the Qype listing for Stuttgart

Monday, July 30, 2007

Gui for x2svg

Hi,
project x2svg just released a new version that now contains a simple graphical user interface.

You can download it from Sourceforge.

Friday, July 20, 2007

x2svg 1.1 released

Today version 1.1 of x2svg has been released. Notable changes are:
* x2svg can now be run as ant tasks
* more output file types (eps, jpg, png, tiff, pdf) supported
* It is now easier to do mass convertions of svg files or input formats (The svg to xxx converter can be used standalone)
* added an alpha quality XML Schema parser

Check it out and: please give feedback!

Tuesday, July 10, 2007

Real Benchmark on Postgres

Sun submitted results of the SpecJAppserver benchmark running on Glassfish and Postgres.
Josh Berkus discusses the results at his blog: http://blogs.ittoolbox.com/database/soup/archives/postgresql-publishes-first-real-benchmark-17470.
The benchmark results can be found here.

Congratulations to the whole team that made this possible. It is a big sign that Postgres is in fact fast (other than what urban legends are always trying to tell).

Of course no one has that configuration 'at home' and I would recommend JBossAS anyway :), but anyway ... :-)

Tuesday, June 12, 2007

Safari 3 (beta) rocks

Apple presented the new Safari version at WWDC yesterday. It is still a beta, but at least on the Mac it makes a great impression. It is blasting fast - if the server on the other side can deliver at that speed :)

There is now also a Windows version available, so PC users can now also use that great browser.

Ah and btw.: It now also has SVG support

Thursday, June 07, 2007

x2svg , first contributor

Today I got an email with patch for x2svg from a user. I am really pleased that finally someone is providing feedback - and then even in such a form.

Monday, May 28, 2007

x2svg 1.0 released

I am happy to anounce the first stable version of x2svg, a tool to
render tree like structures in scalable vector graphics (SVG).
Currently the following three input formats are supported:
- Document Type Definition (DTD)
- Java properties files
- ant build-files

Please check out the release information at Freshmeat.

And as always: please provide me with feedback, bug reports etc.

Sleepless in Stuttgart - the second month

Marlene is now two month old. I have been at home for a month as paternitiy leave, as this is now quite nicely supported with the new Erziehungsgeld from the Government. Also my team lead at Red Hat was quite forthcoming on this topic.
Nights are getting better and better.; the intervals between feeding Marlene are getting longer and somtimes reach 5 hours already. And even if this is not the case, it is relatively painless, as she seldom fully awakes.
As the days are now longer and the nights shorter, it is rather Orlando who doesn't want to go to bed in the evening and wakes up too early in the morning.
I am back at work since last Wednesday and found my way back into the code. For our JBoss ON, we now have a nice gui based installer which is also I18N'ed with (some) German messages. It's fun to see this.
As written in the previous post I was also able to create a tools to render DTDs in SVG. Even if I don't plan to write a new book in the near future, I am interested in finding a solution that could be used in such a project.
Over the bank holiday a week ago, we made a family trip to the town of Weikersheim, stayed at a Framhouse and made some trips into the surroundings.

Tuesday, May 15, 2007

Kindergarden Dad

Yesterday I spent the morning at the kindergarden of Orlando. Parents have the possibility to stay there to lurk around and see what the kids are doing. As I am currently at home, I took this opportunity.
And I must say that I don't regret it. It was very interesting. For the start the kids are in the courtyard. At 9:30 they go upstairs in the group room, drink tea, eat some fruit and talk about different things. Then they have one hour / 1:30 from 10am on to play at various places or paint or build things etc. At 11:30am lunch starts where the kids pick the meal themselves. After lunch, they
uncloth, go to the bathroom and then to bed for a little nap.
That was the point in time where I left again.
Orlando was very proud that his dady stayed at the kindergarden.
It's also interesting how children's brains work. They asked "Do you stay in kindergarden today?" Me: "Yes" They: "Then you are a baby, because babies stay in kindergarden". Or course they don't consider themselves as babies :-)

Thursday, May 10, 2007

x2svg first beta release available

A few days I wrote that I will release my dtd2svg tool as open source.
Meanwhile I refactored the code, fixed some bugs and also wrote a properties parser to visualize properties files.
As there are now not only DTDs accepted, I also renamed the project to x2svg, as I plan to add more parsers in the future.

You can grab the source distribution from here.
To build you also need fop and dtdparser, which need to be present in the lib folder.
Those can be obtained from

Have a look at the readme.html file in the doc/ directory of the distribution about details on how to install and run the tool.

x2svg is released under the LGPL.

Monday, May 07, 2007

SVG on Mac OS X

In a recent post I wrote that Safari on the Mac does not know about svg natively.
Inspired by a blog entry by Jeff Schiller, I just downloaded a nightly snapshot of Webkit, the browser engine behind Safari.
This snapshot is already quite well able to render svg on screen, even if it is not yet complete, as you can see on this chart.

Sunday, May 06, 2007

Visit to a historic iron mine

Today we made an excurs to an abandonned iron mine in Aalen-Wasseralfingen (around 80km from Stuttgart). The mine itself has been shut down after WWII and is now open for visitors. With little trains one drives into the 400m into the mountain. After a little film about the history of the mine and its general layout, one walks for about 800m through the mine and gets a very good impression why it is a good idea to wear a helmet.
The tour gives a very good impression under what bad conditions our ancestors were pulling iron ore out of the mountains, and it is a perfect occasion to go there when kids start to learn about those things in school.

Saturday, May 05, 2007

Where does organic food come from?

For quite some time now, we're getting each week a box delivered that contains organically grown fruit and vegetables. Our supplier is a company called Laisacker from about 30km outside of Stuttgart.
A nice thing about the box is that they put each week fruits and veggies from the current season in, which might be items that we would not buy ourselves, but which will always taste very well :) Laiseacker is growing much of the stuff themselves or buying it at regional partners. In total that organically grown food tastes very good.

Yesterday we made an excurison to the company, as they invited their customers to have a peek. For children there have been various stations to play or to get face painted. The adults could drink a coffe and look at how the boxes are packaged.