Tuesday, July 25, 2006

 

Solaris on VMware Infrastructure 3

Finally, Solaris is offically supported. I just got a machine up Infrastructure so naturally one of the first things I try is to install Solaris on it! The install went with little problems except networking did not work during the install. No big deal because now I can install VMware tools! So installed the tools and rebooted Solaris and all of a sudden I loose connection to the VMware server. So I walk up to the server room only to find a nasty purple screen of death on the VMware server, bummer. But after hitting the reset button on the IBM server (can you believe it, a server that comes with a reset button) all seems well. To be fair to VMware, the hardware isn't supported and I am only using it for testing.

Monday, July 24, 2006

 

The Power of sed

So here is the Scenario, I have a large inherted code base where I want to change the package name to match the new owners. How big you ask? Well how about over 1800 Java files and about 3700 jsp's. Well I tried using Netbean's "rafator" tool but Netbeans and choked. And if I broke the task down it to smaller tasks it would take for ever. So I pulled out good ole sed with something like this for the Java files:

find . -type f -name '*.java' -print |
while read filename
do
(
(cat $filename; echo "") | sed 's/[old package goes here]/[new package goes here]/g' > $filename.tmp
mv $filename.tmp $filename
)
done

The whole thing took less than 30 seconds. IDE are good but don't forget you shell, that is where the real power is!

Monday, July 10, 2006

 

The power of inner classes

When Java 1.1 came out I was a little intimidated by inner classes. I think the biggest reason was you couldn't (at the time) represent them in the UML tools. I did a lot of AWT programming then and trying to do event handling with out them got ugly. So eventually I learned them and began to see how useful they were. For example, how cool is this:

final javax.swing.JList tracesList = new javax.swing.JList() {
public String getToolTipText( MouseEvent e ) {
int i = locationToIndex( e.getPoint() );
Object o = getModel().getElementAt(i);
return o.toString();
}
};

You can override just one method right there in the middle of your code.

But inner classes aren't used often on the server side. I bet part of the answer is that it makes it harder to do all that UML modeling! :-) Hopefully my recent work with Swing will remind me about the types of inner classes I have available when doing server side development.

BTW, that is real code that I am working on for the Chime project. Note the { is not my prefered way and neither is the ( placement so I need to retrain my brain/emacs/netbeans everytime I work on it!

Friday, July 07, 2006

 

Back into the "Swing" of things...

With everything going on I have actually found some time to some OpenSolaris related coding. I have few updates for the Chime project. I really do enjoy working with Swing. One thing I want to say is that the jstyle tool has a really strange idea of how code should be formated!

I am also doing a mini project at work on Swing. So I living and breathing Swing right now. I am using good old Netbeans. It is a great tool but sometimes I feel like I am fighting it. But I have to say it is light years ahead of the first IDE I used for building GUIs, VisualCafe.

This page is powered by Blogger. Isn't yours?