Archive for September, 2007

db4o speed improvements

I use db4o (GPL) within some projects. It is a really great peace of software. If you don’t need a relational database (and often you don’t!), db4o is definitly worth taking a look at it.

It is possible to use db4o with a client-server architecture. Often this is a faster and easier way to use db4o than some sort of RMI. Applications that shall use a common database but run on different machines (rich clients within a LAN) can benefit from those features of db4o.
For the next version (6.4) the performance of client server architectures is within focus – with success:
client server performace

Java Image manipulation tutorial

Josiah Hester has created a great tutorial about image manipulation in Java. Take a look at it, it is very interesting and a good answer
to frequently asked questions.

The article contains informations about loading and drawing images. But then Josiah talks about image operations like flipping, rotating, splitting….

Joda Time: Great API

Today I tried to calculate some interest rates for one of my customers. In Germany we have several different and complicated calculation rules…

To solve this problem I used the Joda Time framework. This is a complete replacement for java.util.Calendar. When you ever tried to do any calculations related to dates, you know that *every* framework is better than java.util.Calendar….

And Joda Time is really great. You need some minutes to understand which interfaces to use (ReadableDateTime is a default replacement for java.util.Calendar). But especially the possibility to get many informations about a period between to dates is great. Joda Time fully supports several types of describing those periods. A period may be half a year, 6 months, 26 weeks, 182 days or a composition of them (1 year, 2 months and 15 days).
All you need is just a specific org.joda.time.PeriodType.

Guice: Injecting Method Interceptors

I am a big fan of Guice. Unfortunately Guice is not complete yet. There are several features that should be added as fast as possible – so everybody is waiting for version 1.1.

Tim Peierls has posted an interesting article about injecting method interceptors. Take a look – this is definitely worth a look.

http://tembrel.blogspot.com/2007/09/injecting-method-interceptors-in-guice.html

One of the main problems of Guice is that it is so different than Spring (but better). Several problems require a different approach than what an old Spring user expects. Because of that fact is is very inspirating to see people doing such things with Guice.

Google releases some nice code…

Google Guice is a really great Dependency Injection Framework and worth a look. Especially the performance and – much more important – the configuration using Java code in a very intuitive form are great features.

They have now released another project that can be very, very helpful. It is called Google Collections and provides some small but helpful classes.

A series describing the details can be found here:
http://publicobject.com/2007/09/coding-in-small-with-google-collections_08.html

Splitting up your pom.xml into multiple files

Ever had to deal with a really, really huge pom.xml? As soon as you start not only to declare the dependencies but also to add informations about the distribution (repositories, site), mailinglists or developers, the pom.xml starts to become really huge.

It is hard to find the informations you search. And it is much harder to find that revision a dependecy has changed if there is so much noise due to changes in other sections.
Many applications with huge configuration files started to convert their files into directories over the last years. Apache now has its “conf.d” directory, crontab uses “cron.d” and so on.

Why not take the same step, too? Why not split up the pom.xml into several files that are placed within a directory called “pom.d”?
So I have created a proposal for Maven 2.1.

What do you think?

Shutting down your crashed linux machine safely

This is not a joke. It is possible to shut down your crashed linux box safely. It is possible to perform various low level commands regardless of the system’s state.

To perform such a command you have to press Alt + SysRq (Print) + a key representing the command.

To shutdown your box safely use the following combo:

  1. Alt + SysRq + R – takes the keyboard out of raw mode.
  2. Alt + SysRq + E – terminates all processes (except init).
  3. Alt + SysRq + I – kills all processes (except init).
  4. Alt + SysRq + S – synchronizes the disk.
  5. Alt + SysRq + U – remounts all filesystems read-only.
  6. Alt + SysRq + B – reboots the machine.

More details can be found at Wikipedia.

No! Don’t do this! This is not the way! (Bean Bindings)

Some days ago, Bean Bindings 1.0 has been released – also known as JSR 295 (and as the JSR suggests, this may be added to the Java very soon).
I really love bindings. And I use JGoddies Binding very often. But the JGoodies Bindings has one big disadvantage. The binding is done based on strings.
You have to write something like that to bind a property:

PropertyAdapter adapter = new PropertyAdapter(bean, "propertyName", true);

The problem is, that it is necessary to write the name of the property as String. It is very hard to refactor that code later… And it is impossible for the compiler to verify it (without a major improvement).
But as we don’t have any better support build into Java now, it is better than nothing (as said, I use it often)…
And now there is this JSR. And they work really hard on that binding issue. And they talk and write and talk and write and finally release version 1.0. And what must I see?

Property firstP = BeanProperty.create("firstName");

That is exactly the same code (in its essence) as the other Binding Frameworks use. And this is *not* the way. Java has its weaknesses. But one of the most important strengths is the strict compiler…
Integrating sublanguages as EL into Java complicates everything: Compiler, Code Editors, GUI Tools….

I prefer waiting another two years for a good solution based on some other language feature (such as closures) than adding such an awful thing…

To be clear: I don’t criticize the details of the implementation. I didn’t even take a look at the code. I am sure it is done very well. All I hate is that awful string based thing…

Return top
 
10 visitors online now
10 guests, 0 members
Max visitors today: 19 at 06:08 am CEST
This month: 24 at 07-06-2010 06:16 pm CEST
This year: 54 at 05-11-2010 04:53 pm CEST
All time: 54 at 05-11-2010 04:53 pm CEST

Switch to our mobile site