Tuesday Dec 02, 2008

java classpath unix shell tip

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:

javainvoke JVM
-cpuse the following word as the classpath
use the backticks to execute shell commands:
`starting backtick
ls -1 \*.jarthat 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.jarmy jar file appended to end of the output from backticks
sun.rre.get.GetFolderListthe 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.

Wednesday Dec 15, 2004

Chomp Sticks

As the family was eating Chinese food over the weekend, my 4 year old son Ian asked, "Why did people make chomp sticks?" Having a keen interest in cognition and linguistics and artificial intelligence, I latched on to the mis-pronunciation of "chop stick" as "chomp stick". Chomp is a synonym for bite, so I presume Ian's mind has categorized chop sticks as biting sticks. Makes tremendous sense to me, you certainly don't use chop sticks to chop your food! I documented some other great "mistakes" in language learning that my children have come up with, namely rainbrella and smooshmellow. Much of the knowledge we have is built up one tiny layer upon another "in terms of" the smaller things we already know.

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.

About

hoffie

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today