Tuesday December 02, 2008 I am writing a java web service client as a command line tool. I'm using a 3rd party stub that depends on Apache Axis2 libraries. When it came time to invoke the java program, I realized I needed to load up the classpath with all 59 jars that are in Axis2. So, I came up with this little diddy:
java -cp `ls -1 /Projects/xyz/lib/axis2-1.4.1/lib/*.jar | sed 's/\(.\)$/\1:/' | tr -d '\n'`/Projects/xyz/build/lib/Xyz32-test-client.jar sun.rre.get.GetFolderList
Let's break it down:
| java | invoke JVM |
| -cp | use the following word as the classpath |
| use the backticks to execute shell commands: | |
| ` | starting backtick |
| ls -1 *.jar | that is a one, not an ell - list all jars one per line |
| | | pipe the output to the next command |
| sed 's/\(.\)$/\1:/' | replace the last character on the line with last character plus a semi-colon |
| | | pipe the output to next command |
| tr -d '\n' | remove the newlines from stream |
| ` | closing backtick |
| /Projects/xyz/build/lib/Xyz32-test-client.jar | my jar file appended to end of the output from backticks |
| sun.rre.get.GetFolderList | the class to invoke from my jar |
The unix shell is still a source of joy to me almost on a daily basis after 11 years at Sun.
(2008-12-02 13:19:22.0)
Permalink
Comments [2]
Wednesday December 15, 2004 While not a believer in hard AI, I'd like to see progress toward it. The only way I can envision that progress is to model it after my children. It seems imperative for computers to start to build up their own knowledge "in terms of" everything else they know. This implies these systems will have to learn and that every system would end up creating a different corpus of knowledge than every other one. It will depend on what it has been exposed to and in what order. Given the widepsread adoption of systems like these, there will become a new profession; teaching computers! It will be the responsibility of the teacher to expose the system to new material and check the conclusions it draws. I would postulate that only if the machine is capable of making mistakes in its learning, will it be capable of creating new insights. When we learn, we are bombarded with words we don't yet understand and ideas that make no sense. Somehow our fantastic brains store much of that ambiguity in the background and future experiences and learning gradually shape the noise into clear ideas.
I read and write code every day. The vast majority of it is mechanical in nature and like machines it can only cope with the specific circumstances for which it was designed. Unfortunately the circumstances for which it is designed are limited by both budget and time constraints and the imagination and experience of the programmer. My great hope is that I will be part of a software revolution that will be building systems that learn and improve with experience rather than die of software rot akin to the rusted fate of their mechanical couterparts. (2004-12-15 10:04:48.0)
Permalink
Comments [2]