Friday, October 09, 2009

Debian+Apache+Tomcat+Axis

Hello,
one of the courses I'm following at the university is "Laboratorio di reti
di calcolatori" which uses the technologies (really technologies?????)
listed in the post title. This is a little tutorial for making them works,
with a little script for registering .wsdd files.

- aptitude install apache2 tomcat6
- download the binaries of axis 1.x (latest is 2.x, it's not used in our course) and xerces then unpack them.
- copy *.jar of xerces into the "lib" dir of axis.
- create "/etc/tomcat6/policy.d/99axis.policy" with:
grant codeBase "file:/var/lib/tomcat6/webapps/-" {
permission java.security.AllPermission;
};

- copy the "axis" directory found under webapps of the axis binaries into /var/lib/tomcat6/webapps
- invoke-rc.d apache2 restart
- invoke-rc.d tomcat6 restart

Now go to http://localhost:8080 to make sure that Apache-Axis works.

Finally, this is the script for deploying web services (call it deploy.sh):
export AXIS_HOME="/home/lethal/ingegneria/reti/axis/axis-1_4"
export AXIS_LIB="$AXIS_HOME/lib"
export AXISCLASSPATH="$AXIS_LIB/axis.jar:$AXIS_LIB/commons-discovery-0.2.jar:$AXIS_LIB/commons-logging-1.0.4.jar:$AXIS_LIB/jaxrpc.jar:$AXIS_LIB/saaj.jar:$AXIS_LIB/log4j-1.2.8.jar:$AXIS_LIB/xml-apis.jar:$AXIS_LIB/xercesImpl.jar"
java -cp "$AXISCLASSPATH" org.apache.axis.client.AdminClient -lhttp://localhost:8080/axis/services/AdminService "$1"

In the script, you must tweak the AXIS_HOME variable to point to the unpacked axis binaries: avoid using spaces in this variable or you'll encounter several errors in terms of classpath.
Usage of the script:
sh deploy.sh file.wsdd

We're done!

Wednesday, October 07, 2009

Speeding up zsh completion

Hello,
since I've started using zsh, a great shell with great out of the box completion, one of the most boring issues was having a really slow completion. I can understand it could be slow to get a list of packages, remote files or command line options, but also paths were often slow to be completed. After lots of searches I've ended up in adding this magic line to my ~/.zshrc:
zstyle ':completion:*' accept-exact '*(N)'
This way you tell zsh comp to take the first part of the path to be exact, and to avoid partial globs. Now path completions became nearly immediate.

Another important speed up is using the cache for packages and other stuff:
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path ~/.zsh/cache
If you know how to boost up options/remote files, please share :)