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(

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

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.

<!-- This needed because jwebunit uses newer version of xalan than regular java -->

Now my tests are running fine.

Thursday, November 13, 2008

bash chooser

Note: I've found a better way here:

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*"

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/
[2] ./bobo-browse/src/com/browseengine/local/service/geosearch/
[3] ./bobo-browse/src/com/browseengine/local/service/geosearch/

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.


require 'Open3'

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

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

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

selection = STDIN.readline

filename = filenames[selection.to_i-1]

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

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

Saturday, May 3, 2008

Helicopter Ben and other stuff

See how many links come up with helicopter and Ben in them.

I think this is the famous speech from 2002 where he talks about a "helicopter drop" of money referring to the famous monetarist Milton Friedman's comments.

Bernanke gave a speech in honor of Milton Friedman's 90th birthday here:

"The best thing that central bankers can do for the world is to avoid such crises by providing the economy with, in Milton Friedman's words, a "stable monetary background"--for example as reflected in low and stable inflation.

Let me end my talk by abusing slightly my status as an official representative of the Federal Reserve. I would like to say to Milton and Anna: Regarding the Great Depression. You're right, we did it. We're very sorry. But thanks to you, we won't do it again.

Best wishes for your next ninety years."

He says that yes the Fed caused the great depression by contracting the money supply and we won't do it again. Meaning that he'll do whatever he can to avoid an economic crisis by printing money.

Here's Jim Rogers saying he is still short the financials and will short more if it rallies.

Switching to your old home, what are your thoughts on the U.S. credit crunch?

We had the worst credit bubble ever in American history, perhaps world history. I can't remember anytime in history when people were able to buy a house with no money down -- sometimes with no income. You don't clean out a bubble like that in six months to a year. I've been short the U.S. investment banks by using the Amex Securities Broker/Dealer Index [ticker: XBD], an exchange traded fund with exposure to many of those firms. I've also been short Citigroup [C] and Fannie Mae [FNM]. I'll short some more if we get nice rallies in any of them. I am still short some of the U.S. homebuilders like Lennar [LEN].

Here is a chart of the upcoming variable apr mortgage resets.

Wednesday, April 30, 2008

One liner for killing processes

Here is a handy one-liner for killing a bunch of processes, postgres in this case.
It also uses the perlesque qualities of ruby. Googling "ruby oneliners" finds a bunch of other
one-liners. I tried sed at first but the regular expression support is different than perl.

ps auxww | grep postgres | ruby -pe 'gsub(/[ \t]+/, " ")' | cut -f 2 -d ' ' | xargs kill -9