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!
Monthly Archives: April 2006
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(); logger.fine(myMessage); } |
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(); logger.fine(myMessage); } |
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.
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.
1982 |
1987 |
2006 |
The Millionaire Next Door
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.
reg.addRegistryChangeListener(this);
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. |
Finally, the Rich Text pasting from Eclipse source works!
I downloaded and installed Eclipse 3.2 M6 and just noticed copying and pasting code into Emails works correctly. Prior to this it would not copy the text with fonts and colors maintained.
| public void createPartControl(Composite parent) { preview = new Label(parent, 0); progress = new ProgressBar(parent, 0); preview.setToolTipText(“Provides a source preview of the HTML“); preview.setText(“Source Preview Pane“); System.out.println(“Preview View Created:” + this.getViewSite().getId() + “:” + this.getViewSite().getSecondaryId()); } |
Happy Easter!
I found these jokes on Happy-Easter.com, pretty funny for the kids.
Why does the Easter bunny have a shiny nose?
His powder puff is on the wrong end.
Is it true that bunnies have good eyesight?
Well you never see a bunny wearing glasses, do you?
What is the difference between a crazy bunny and a counterfeit banknote?
One is bad money and the other is a mad bunny!
Why did the Easter egg hide?
He was a little chicken!
Why did a fellow rabbit say that the Easter Bunny was self-centered?
Because he was eggo-centric!
Why is a bunny the luckiest animal in the world?
It has four rabbits’ feet
What do you get when you cross a bunny with an onion?
A bunion
What did the bunny want to do when he grew up?
Join the Hare Force.
What do you call a bunny with a large brain?
Egghead!
What does a bunny use when it goes swimming?
A hare-net.
How do you make a rabbit stew?
Make it wait for three hours!
What did the grey rabbit say to the blue rabbit?
Cheer up!
What do you get when you pour hot water down a rabbit hole?
A hot cross bunny.
How do you post a bunny?
Hare mail
How does the Easter Bunny say Happy Easter?
Hoppy Easter
Face to Face Design Sessions
IBM is moving more and more to the remote employee and virtual team model. Technology allows us to do just about anything from the luxury of our homes. I work with many people who work out of their home and the entire concept is becoming more popular and more acceptable. Any time I find out someone works from their house I immediately ask how they feel about it and if it is working out. The consensus seems to be that you get a lot more work done and you actually have to balance work and life even more because work can take over completely. I found this out in the beginning and every now and then see the same things happening again. Since there is no commute and I rarely leave my office for lunch I immediately get 1-2 hours of more work time a day.
Ok, given that everything seems to benefit both IBM and myself there is one element I feel can never be replaced; that is the element of face-to-face design sessions. You can present over the phone, you can have 95% of your meetings over the phone but when you really need to get ideas across and “brain-storm” you really need that face-to-face meeting. I write a lot of code, a lot of specs and attend a lot of meetings but it seems the white-board design sessions are worth their weight in gold. I just did a 1.5 day session in Austin this past week and we not only got through all of the design but we had time left over to dive on some great details. I was also able to meet with the quality engineering manager to discuss what was designed over the previous day (so we not only have a design but QE is getting prepared to test). If you think about the 4-5 teams involved in the meeting and the complexity of the feature (that spanned both client, server, administration, and several protocols) it is a pretty powerful event to get everyone on the same page in a day.
Check out this interesting site called YouCanWorkFromAnywhere.com. It has some great tips an articles on working from anyplace. Of course it mentions M$ Netmeeting but we all know Sametime rules!

