Thursday, November 18, 2004

JEdit 2

Quick way to get the syntax checking on is to create a macro that runs JCompiler. This worked for me because the classpath that I have JCompiler set up with (from maven) will compile the files I'm working on. So all I do is run a macro that saves the buffer and compiles it. JCompiler updates ErrorList with the line numbers of the issues it
encounters. Everything works beautifully.

Jedit rules

Okay, I've had it again with Eclipse. It's slow, cumbersome, and drives me nuts with its unresponsive behavior. Several times this week I've completely lost my keyboard functionality. Sure it responds to the mouse and I can navigate, click on menus, etc. But i can't type! Usually I have to either reset the beast or I have to open a model
dialog, then close it, and then the keyboard may work. Either way, I'm jumping back to JEdit.

Several huge plug-ins I got working this morning and absolutely love:

a) Open It. This functions just like the Open Resource in Eclipse: a dialog pops-up, you type in the filename and it matches as you type. This is great because it alleviates the necessity to use the built-in file-explorer in JEdit (which I think is kind of a pain).

b) Dot-Complete. Finally had some inspiration this morning in getting this to work the way I want it. Our projects are Maven projects. How to get the classpath into Dot Complete? Solution is simple, maven -X build-ourproject. Dumps out the the classpath that's created from the dependencies in project.xml. This is great! Now it works and is saving me time and pain of constantly referencing Javadocs.

c) XML/HTML. While I have had this working forever, I simply love how easy it is to create XML/HTML docs in JEdit. It's awesome because it auto-completes closing tabs, shows the hierarchy of the DOM (in relation to the current element) and is overall so fluid. Have yet to find something so simple and powerful. Oxygen is too bloated, Eclipse HTML editor is crap, etc. JEdit reigns in this area.

d) JDiff. This is a beautifully simplistic diff. Nothing else to add. It just works, and functions nicely.

e) Java Browser. If you like the ctrl+o functionality in Eclipse, then this does an adequate job of replicating the behavior. Opinions may differ.

f) Getters/Setters. Autogenerate these by selecting the the variables for which you want them created. Then run the build-in macro.

g) Class Wizard. Rather simple but competent class wizard (for those that like using wizards).

Only thing missing now is a nice syntax validator for the missing ;

Monday, November 15, 2004

MVC definition

Best definition I've yet to find of the Model-View-Component design pattern:

* A Model that represents application data or state
* The View that processes, formats and renders the display of the Model
* The Controller that is responsible for taking user/client input and
updating the Model
(Enhydra XMLC, David H. Young, Sams Publishing, 2002)

Thursday, November 11, 2004

Search through jars for a class, then invoke javap

Script now works nicely--now to track down my DOM problem:
#!/bin/bash
temp='./temp.out'
temp2='./temp2.out'

echo -n "Enter class name: "
read -e SEARCHEE
echo Beginning recursive search through jars $PWD for $SEARCHEE
for i in `find . -name "*.jar"`;
do
# result= sed -e 's/\//\./g `jar tf $i | grep -i $SEARCHEE`'
result=`jar tf $i | grep -i $SEARCHEE`
if [ "$result" != "" ]; then
echo $result > $temp
#replace / to .
result=`sed 's/\//./g' $temp`
echo $result > $temp
#get rid of the .class, print to file for awk evaluation
`sed 's/.class/\ /' $temp > $temp2`
result=`awk 'BEGIN {FS="[ ]"}; { print $1 }' $temp2`
echo $i
echo $result
#setting the bootclasspath to . otherwise this search
#will report classes found in the bootclasspath jars and not the
#jars starting in .
javap -classpath $i $result -bootclasspath .
`rm $temp`
`rm $temp2`
echo
fi
done

javap and classpath resolution

Having a heck of a time trying to get javap to spit out correct info
for a class that's contained in many jars--it was spitting out the
same thing for each class in the jar (from my script that searches
through the jars for a particular class). After about 10 minutes of
frustration and figuring this out I went to the web and found this:
http://www.ecst.csuchico.edu/~amk/foo/java2tools.html. So, no thanks
to the man page for javap. If the class on which you are invoking
javap resides with the JDK, it'll ALWAYS be decompiled from the JDK
entry. What you need to do is add "-bootclasspath ." to the command
line so that you bootclasspath gets reassigned (to something you don't
care about) to your local dir. Glad this didn't waste too much more
time. Once I get the script completed I'll post it.