Archive for March, 2008

New Live Gear

Monday, March 24th, 2008

Marshall Acoustic Soloist 100D + Yamaha Silent Guitar

I left my band when I came to Luxembourg last month. Since then I’m working on some new personal material.

Last week I had a drink in a local Irish Pub and thought that I could play a small acoustic set there. Since I was thinking about buying an acoustic guitar amplifier for a while now, this was the spark that made me go to a shop and buy this nice Marshall AS100D. This one sounds really great, features high-quality built-in effects and offers inputs for 2 instruments, a microphone and an auxiliary unit.

Now I’ll start to work on some pieces….

Java Tips – Final and Finally

Thursday, March 13th, 2008

I spent more and more time doing Java development during the last months. I really like this language because I think its syntax is the right balance between advanced concept expression and readability. And I must also say that it’s nice being able to assert a 12 years Java programming experience when the technology itself is 12 years old ! I was introduced to it at the time by Stéphane Fritsch, a former university friend of mine who was ecstatic about the perspectives it was already offering at the time.

Today I faced a something that I didn’t see before: the use of final local variables and method parameters.

I was using the const keyword in method signatures a lot when developing C++ code, but I never thought about the use of final variables in Java, except for static constants. This modifier will forbid any change in the variable reference. Nice optimization in theory, but what’s really the point since this won’t affect the code execution much as we are only manipulating object references (as opposed to const objects in C++). Well, I discovered on the jGuru website that this was mandatory to share a variable value with a local inner class:

public void setText(final String str) {
   final JLabel label = new JLabel();

   SwingUtilities.invokeLater(new Runnable() {
    public void run() {
     label.setText(str);
    }
   });
}

Another point that bugged me often is the way people fail to get the true meaning of the finally block in an try/catch/finally exception management code. When asked, most of the people will explain the finally block like “the code that will be executed after the try and any of the potential catch blocks”. Ok with this, but what’s the point in doing a specific block for this instead of simply writing code directly after the try/catch block ? It would also be executed after all the rest too…

The difference is that the finally block will be executed even if a catch block raises an exception.

System.out.println(“A-start”);

try {
  System.out.println(“A-try”);
  B(); // this method will raise an exception
} catch (Exception e) {
  System.out.println(“A-catch”);
  throw new RuntimeException(“Another exception”);
} finally {
  System.out.println(“A-finally”);
}

System.out.println(“A-end”);

This will output:

A-start
A-try
B-start
A-catch
A-finally
Exception in thread “main” java.lang.RuntimeException: Another exception
   at Finaltest.A(Finaltest.java:13)
   at Finaltest.main(Finaltest.java:33)

Thus asserting that the finally block was executed after the try/catch blocks and before the parent exception handling.

New Hosting

Monday, March 10th, 2008

Last week, my chess website MKGI Chess Club went down for 4 days because of an internet issue at my french home… I was really sorry since there are so many people playing there (we have almost reached 300.000 moves played on the site) and it is really bad experience to stop for so long.

I finally decided to rent a virtual private server to host it and let my old servers go to the trash. It will cost me some bucks, but I hope that it will allow me better performance and a better bandwidth. I ran a Python pystone benchmark on the new server (running Debian Linux), and it did score 6 times better cpu than the computer I’m currently running the site on. I did rent this server at gandi.net since it always seemed to be one of the most serious registrar/host.

I will migrate all my web hostings (and I still have a few from the time I ran MKGI Esprit Marketing) to basic DNS-only hostings and put everything on this server in the next weeks.