« Previous day (Apr 30, 2005) | Main | Next day (May 2, 2005) »

20050501 Sunday May 01, 2005

pe-start

Creator ships with a script under startup/bin named pe-start.sh (there's a .bat file there for Windows too). You can use this to start the Application Server from the command line. One of the arguments to this script is -reset:

% ./startup/bin/pe-start.sh -reset
The domain (creator) isn't running.
CLI157 Could not stop the domain creator.
WARNING: The --adminpassword option is insecure and should not be used since it can compromise your password.  Please use either the command prompt or the --passwordfile
option.
Using default port 8,686 for JMX_ADMIN.
Domain creator created.
Starting Domain creator, please wait.
Log redirected to /home/tor/SunAppServer8.1/domains/creator/logs/server.log.
One of the nice things about this script is that it not only starts the app server - it completely resets it, by throwing away the entire Creator domain. Every time you deploy a new application it's added into the domain and restarted the next time. This is a feature - you wouldn't want to have to redeploy all your web applications if you needed to restart your system for some reason. But of course these add overhead. If you know you're not using any of the previously deployed web apps, you can just remove them. There are ways to do that through the Admin Console (on port 14848), or even via the Server Navigator, but I like using the script to get a completely fresh start, especially if I'm going to give a demo :-) If only I had used this before....

(2005-05-01 13:27:31.0) Permalink

NetBeans plugins I use, part 1

One of the optional plugins for NetBeans I rely on the most heavily, is the Jalopy plugin. It reformats source files (provided they are compilable). Unlike the built-in basic formatting, it performs all kinds of nice cleanup, like moving fields to the top of the file, enforces whitespace around if blocks, and so on. And it's extremely configurable - if you invoke the Jalopy Settings dialog from the Tools menu, you get the dialog shown on the right - plus a source file viewer on the right immediately showing the effects of your toggling of components on the options panel on the left. (Click on the image to see it in full size - that's true in general for all small pictures in my blog.)

I've gotten in the habit of hitting Ctrl-Shift-F10 after making edits to my files now, to immediately have the source file reformatted.

Of course, the first time I did this, I generated a huge number of CVS diffs in my module. People generally don't like that since it makes source code archaeology harder. But finding the original checkin comment for a reformatted line is still possible, so because of that I find that the benefits outweigh this disadvantage. In fact, I would be quite happy if the entire NetBeans source tree was reformatted too, since a couple of people checking in code in that code base (at least early on) like to put a space between function names and the parentheses -- foo (); and that drives me nuts!!

By the way, Here's my Jalopy settings XML file - you can import it directly from the Jalopy Settings file. This is basically the default JDK style, but I've increased the line length up to 100 instead of 80 columns, and I've tweaked the import organization. One thing I left alone was its parenthesis preferences, even though I like to omit some parentheses where it goes and puts them back in.

You can find the plugin NBM file for 4.0/4.1 here. Note that there is also a commercial plugin version of Jalopy for NetBeans, and it supports JDK 1.5 - which the current free plugin does not. I just started writing some JDK 1.5 code the other day - and loved every minute of it. The new language constructs and APIs are extremely handy.

I use some other optional plugins quite a bit too - I'll blog about them another time.

(2005-05-01 13:03:38.0) Permalink