Wednesday, November 26, 2008

Overriding java endorsed direcctory for maven unit tests.

I was testing a web application using jwebunit (which has great ajax support
because of htmlunit). The test was running fine in Eclipse, but when I wanted
to run it from maven as a unit test I got an exception that started like this


java.lang.NoSuchMethodError: org.apache.xpath.compiler.FunctionTable.installFunction(Ljava/lang/String;Ljava/lang/Class;)I
at com.gargoylesoftware.htmlunit.html.xpath.XPathAdapter.initFunctionTable(XPathAdapter.java:58)



Another blog posting helped me identify that root cause was the xalan that is
included with my Mac osx version 1.5 of java is older than what the htmlunit
package was using. I found an email

http://mail-archives.apache.org/mod_mbox/incubator-yoko-dev/200609.mbox/%3CE91104197DA2654DA833B6EB53B6C488DD6C7A@emea-ems1.dublin.emea.iona.com%3E

that told me how to add a argLine to the maven-surefire-plugin.

And below is how I fix this in the "build" section my pom.xml.

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy</id>
<phase>test-compile</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/endorsed</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- This needed because jwebunit uses newer version of xalan than regular java -->
<argLine>-Djava.endorsed.dirs=${basedir}/target/endorsed</argLine>
<systemProperties>
<property>
<name>java.endorsed.dirs</name>
<value>${basedir}/target/endorsed</value>
</property>
</systemProperties>
</configuration>
</plugin>
</plugins>


Now my tests are running fine.

Thursday, November 13, 2008

bash chooser

Note: I've found a better way here:
http://www.vim.org/scripts/script.php?script_id=2769

My friend hacked up a ruby script to enable some better use of the bash command line. The problem I was having was that sometimes I wanted the bash command line to be interactive so that could pick one of several outputs. For instance let's say I am hunting for a file to edit from bash

so I run:


jalvarado:~/bobo jalvarado$ find . -name "Have*"
./bobo-browse/src/com/browseengine/local/glue/HaversineGeoScoreAdjuster.java
./bobo-browse/src/com/browseengine/local/service/geosearch/HaversineFormula.java
./bobo-browse/src/com/browseengine/local/service/geosearch/HaversineWrapper.java


Well, the second file is the one I want to edit so to get to in the normal bash may I may have to write.


vi `find . -name "Have*" | head -n 2 | tail -n 1`


and that would open the second file, but that is alot of typing and if I then wanted to open a different file of that set I would have to modify the command line in two places. So he wrote a script that let's you use this type of syntax

jalvarado:~/bobo jalvarado$ choose vi `find . -name "Have*"`
[1] ./bobo-browse/src/com/browseengine/local/glue/HaversineGeoScoreAdjuster.java
[2] ./bobo-browse/src/com/browseengine/local/service/geosearch/HaversineFormula.java
[3] ./bobo-browse/src/com/browseengine/local/service/geosearch/HaversineWrapper.java

Then you type "2" and up comes your file. Even better would be syntax like

find . -name "Have*" | choose vi

but haven't figured that one out yet.

Here is the Ruby script.


#!/usr/bin/ruby

require 'Open3'

if ((ARGV.nil?) || (ARGV.size <> filename1 filename2 ...';
puts 'example: choose "cvs log" `find . -iname "*tokenizer.java*"`';
exit;
end

command = ARGV[0];
filenames = ARGV[1,ARGV.size];

filenames.each_with_index do | line, index |
puts '[' + (index+1).to_s + '] ' + line
end

selection = STDIN.readline

filename = filenames[selection.to_i-1]

Open3.popen3(command + " " + filename) do |read_stdin, read_stdout, read_stderr|
puts read_stdout.readlines;
end



Tuesday, November 11, 2008

VBDG is ready to roll

VBDG is the company behind Hercules Hooks, MyPlace, Zorbeez, and other As Seen On TV products. They will be releasing their 3rd quarter results this Friday after the market close. I have personally seen their products in CVS, Fry's, Rite-Aid, and Bed Bath and Beyond and they are reported to be in many other retailer stores. I expect this 3rd quarter report to push them into profitability and drive their share price up sharply.


UPDATE: Well they ended going almost to zero, ugh.

GOOG 411 is awesome

I just tried out Goog 411 and it works so well. I have tried out various speech recognition programs and some have been pretty good, but when I tried GOOG 411 it got almost everything I said simply and quickly. Also it gives you listings that you can browse using your voice and get details on. All that and it is free too. To build a truly great voice recognition system you need many voice fragments. This 411 system allows google to train a great voice recognition model. I'm sure you will start seeing this in other offerings from google. One application is to transcribe voices in videos and podcasts. They will be able to use voice recognition and search in the same way as everyzing.com