Search this site


[prev]  Page 2 of 2

Metadata

Articles

Projects

Presentations

another lame hack (ALH)

So I got bored and after discovering that java doesn't let you (Or to my knowledge) access enviroment variables.
ENVS=`env | sed -e 's/"/\"/g' | sed -e 's/^(.*)=(.*)$/-D1="2"/' | \
      sed -e 's,.$,& \\,' && echo "$*"`
sh -c "java ${ENVS}" 
Put that in a shell script and call it with the same parameters you'd normally call java with. ie;
./lamehack.sh test
This will run 'java test' except it also passes a bunch of -D definitions for use in System.getProperty(). For example, you could now do: System.getProperty("DISPLAY") to grab the DISPLAY enviroment variable.

xapply rocks me

I have a lot of mail boxes that need sorting from the various lists I subscribe too, and sorting by hand or on "viewing" is annoying, so I got bored and made use of xapply and the 6 processors on fury.csh to sort all of my mailboes.

find ./ -type d | xapply -f -P6 'echo "Sorting %1" && mhthread -fast -lock %1 && echo "Done sorting %1"' -

The cwd was ~/mail/ and directories under here are all mailboxes. So, xapply uses 6 parallel processes to call mhthread on each mailbox that was found.