Showing posts with label geek. Show all posts
Showing posts with label geek. Show all posts

Tuesday, October 04, 2011

Funky Cygwin Path Issues

In getting familiar with Stuart Sierra's lovely Clojure test library Lazytest, I ran into a problem running it from the windows command console. The test output had special control codes not properly processed by the console:
E:\development\clojure\calibration>java -cp src;test;lib/*;lib/dev/* lazytest.watch src test

======================================================================
At  #<Date Tue Oct 04 07:45:47 CDT 2011>
Reloading calibration.test.core, calibration.core

←[33mNamespaces (no cases run)←[0m

←[33mRan 0 test cases.←[0m
←[32m0 failures.←[0m

Done.
I use mintty for cygwin, which will process those codes correctly, but I then had trouble with the Java classpath:

yawmark$ java -cp "src:test:lib/*:lib/dev/*" lazytest.watch src test
java.lang.NoClassDefFoundError: lazytest/watch
Caused by: java.lang.ClassNotFoundException: lazytest.watch
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: lazytest.watch.  Program will exit.
Exception in thread "main" [~]

After a little online research, I found that I needed to decorate the classpath a bit:
java -cp `cygpath --path --windows "src:test:lib/*:lib/dev/*"` lazytest.watch src test
After that, all is once again right with the world.

Sunday, April 26, 2009

Netbeans 6.5 + Grails

I'm not pleased with the apparent behavior of NetBeans 6.5 when creating a new Grails domain class. I'm unable to create a domain class anywhere other than the default package; the dialog keeps asking for a "valid class name":



This name works fine for creating a Groovy class, just not a Grails domain class. So, why won't the Grails support allow it?
 

UPDATE (2009-05-08): This seems to be straightened out in NetBeans 6.7 (beta).

Tuesday, March 17, 2009

Hardest. Puzzle. Ever.

A hundred prisoners are each locked in a room with three pirates, one of whom will walk the plank in the morning. Each prisoner has 10 bottles of wine, one of which has been poisoned; and each pirate has 12 coins, one of which is counterfeit and weighs either more or less than a genuine coin. In the room is a single switch, which the prisoner may either leave as it is, or flip. Before being led into the rooms, the prisoners are all made to wear either a red hat or a blue hat; they can see all the other prisoners' hats, but not their own. Meanwhile, a six-digit prime number of monkeys multiply until their digits reverse, then all have to get across a river using a canoe that can hold at most two monkeys at a time. But half the monkeys always lie and the other half always tell the truth. Given that the Nth prisoner knows that one of the monkeys doesn't know that a pirate doesn't know the product of two numbers between 1 and 100 without knowing that the N+1th prisoner has flipped the switch in his room or not after having determined which bottle of wine was poisoned and what colour his hat is, what is the solution to this puzzle?

Heh
.