A Tough Week

This was a tough week for my oldest. Just to give you a small recap: he and his friend got caught poking holes in the bus seat, he then forgot his some what new phone number and was sitting there with his coach until we showed up a half hour later at practice (it ended early because they got kicked off the field), he ended the week by accidentally slamming his brothers thumb in the front door. Hang in there kid, we all have bad weeks!


Optimizing your Java logging

I have seen this in a lot of code and I figure I would blog about it because I think there is a lot of confusion around the best practices with regards to JSR47 and how to properly optimize your logging code. The first thing to remember is that methods like logger.fine(), logger.enter(), etc all do a log level check inside of the method and will ultimately not log unless the level is met. However, for optimization and CPU cycles you also need to be careful calling these methods with large strings or a large concatenation of strings.

Here is some sample code:

if (error > 0){

String myMessage = “Error: syncNow(): code= “;
myMessage += getErrorCode()
myMessage += ” because the server could not be found. Server = “;
myMessage += getServerName();



So now, any time there is an error all of that string concatenation will happen and the problem is the JVM may only be logging WARNINGS. The string building code is all for nothing, not to mention a call to those two methods plus the logger.fine() call. ie. You should also use a StringBuffer…

Some better code:

if (error>0 && logger.isLoggable(Level.FINE) ){

String myMessage = “Error: syncNow(): code= “;
myMessage += getErrorCode()
myMessage += ” because the server could not be found. Server = “;
myMessage += getServerName();



To summarize, it is ok to call logging methods with small and preferably static strings, ie “logger.fine(“My message”);” but you need to be careful in how much processing you do to get that string.

Java Logger Class
Java Logging Overview

Quick and easy tutorial on creating JSR 168 Portlets with Pluto

Excellent article for quickly learning how to deploy a portlet to Pluto.

Build and test JSR 168-compliant portlets with Apache Pluto

PC In a Keyboard Concept

I was browsing the April 10th issue of InfoWorld and saw this add which caught my eye. I love the entire concept because it brings a bit of nostalgia back when I owned the Commodore 64 and Amiga 500. I find it interesting that the design is almost identical yet over 20 years have passed. I use to love the fact I could just pick it up and go and basically plug them into any TV.







The Millionaire Next Door

Book Cover This was an eye catcher in the airport when I was waiting 5 hours for my next flight (after missing a leg because the airplane was 45 minutes late). I certainly have ambitions of being well off in my later years (and sooner would also be nice) so the flashy “More than two million copies sold” and the dollar bill cover sold me. I had a lot of different thoughts going through my head as I read this book. Each page made you think about choices you have made in life and you quickly do the analysis of whether you are “on track” or not.

In a nutshell this book is excellent for people in their teens, 20’s and thirties. If you are in your 40’s or higher you may just get pissed off seeing that you probably missed something financially along the way. I know I have to make some minor adjustments in order to meet their criteria but I also think the book presents some rather extreme cases. I guess they are all possible but if you have half a brain you should not end up in the bad side of the book. I was seriously shocked that I did in fact make some pretty good decisions early in life, however, it appears the major decisions I made were completely against the book. I did not go to college directly our of high school. I served in the Marines for seven years. My family has been a single income family for over 90% of my marriage – also against the statistics. And I have never been an entrepreneur – high percentile of millionaires are entrepreneurs. I do save aggressively however I plan on making more IRA contributions for my wife; I also do 100% of my own finance and investment. I have owner the same cars for 6 years and 3 years – a whole chapter was dedicated this. I do think paying for my kids first degree is extremely important and will hopefully do so – meaning I do now think a college education is a huge leap and even a Master’s degree is just as important. The key point I took out when comparing my success to those in the book is I have passion for what I do. It makes me good at it because it is fun. I can not learn enough about computers and software engineering. I would rather read technical books than books like this (just look at my book list…). And I just happen to have a career in a time when software engineers are paid well…for now. I am also fortunate to be working for what I consider the best software company in the world – arguable to any Microsoft people. The book keys on all of these things and it is a great read.

Optimizing addRegistryChangeListener

One of the things I have noticed in many Eclipse plugins is the use of the registry change listener implementation. This will be more common as plugins move to support dynamic extensions.

I admit I was at fault also and after some debugging I figure this would be some good information to share with all. If you do not specify a namespace on the call your callback method will get called on every registry changed.


Should be:

reg.addRegistryChangeListener(this, PLUGIN_ID);

Now your plugin will only get called when there are changes in your namespace.

XULRunner looks pretty cool

In case you haven’t heard of or seen XULRunner (pronounces ZoolRunner) it is pretty slick stuff. FireFox 3 is scheduled to be a 100% XUL based application. You can check out the roadmap where it shows FireFox 3 will ship in Q1 2007 and based on XULRunner 1.9.

XULRunner is a Mozilla runtime package that can be used to bootstrap XUL+XPCOM applications that are as rich as Firefox and Thunderbird. It will provide mechanisms for installing, upgrading, and uninstalling these applications. XULRunner will also provide libxul, a solution which allows the embedding of Mozilla technologies in other projects and products.