Sunday, August 18, 2013

Grails Learnings

To log something use the following:
log.info('In the index action...')
For example:
class SampleController { def index() { log.info('In the index action...') // ... } }
Multiple constraints for the same field are done like this:
static constraints = { bagId(blank: false) barcode(blank: false, matches:/[0-9]/)

Friday, July 06, 2012

set Alias at Startup


There is an alias in my startup.  I like running Notepad++ from the command line, and I don't like typing "Notepad++".  Solution: I put an alias in a startup.cmd file.  
C:\APPS\startup>type startup.cmd
@echo off
set JAVA_HOME=C:\apps\java\jdk1.7.0_05
doskey npp=c:\apps\npp\notepad++.exe $*
cd \temp
I can run it manually or via this registry key:
C:\APPS\startup>type autorun.reg
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Command Processor]
"Autorun"="c:\\apps\\startup\\startup.cmd"

Tuesday, November 29, 2011

groovysh

Here are a few things I learned about groovysh: if you declare a variable like so:


def foobar = 5;

and then try to use foobar you get the following error:

groovy:000> def foobar = 5; ===> 5 groovy:000> print foobar; ERROR groovy.lang.MissingPropertyException: No such property: foobar for class: groovysh_evaluate at groovysh_evaluate.run (groovysh_evaluate:2) ... groovy:000>

It turns out that you must leave off the def. Then it works fine:
groovy:000> foobar = 5; ===> 5 groovy:000> print foobar; 5===> null groovy:000>


TAB Completion
You can type the first few letters after the . for a given object then press TAB. groovysh will display the possible options:
groovy:000> foobar.l
lastIndexOf(   leftShift(     length()

groovy:000> foobar.l

Type a few more characters, and the shell will complete the method name:

groovy:000> foobar.length()
===> 5
groovy:000>

Monday, September 05, 2011

Groovy and its bad moods

I had not picked up Groovy in a while. So I downloaded Groovy 1.8.1 and off I went with HelloWorld.
class Greet {
def name
Greet(who) { name = who[0].toUpperCase() +
who[1..-1] }
def salute() { println "Hello $name!" }
}

g = new Greet('world') // create object
g.salute()

Then I compiled it in the GroovyConsole and I got the following error:
Invalid duplicate class definition of class Greet : The source Greet.groovy contains at least two definitions of the class Greet.


What da!?
It turns out that the Groovy compiler tries to put the code that is outside the class into a .class file called Greet.class Ooops! So the quick fix is to save the file as a different name such as Foo.groovy. Then after the Groovy compiler runs, you will end you with Foo.class and Greet.class

Now you know.

Tuesday, April 05, 2011

VirtualBox and Ubuntu

I just installed VirtualBox. Pretty coool! Then I created a VDI and installed Ubuntu 10.10. I might uninstall it and just install an instance of headless Fedora.

Wednesday, July 29, 2009

Pocket Devils

Get ready for latest craze: Pocket Devils.
The are portable, hand sewn, cute, angry and evil!
Buy them at www.pocketdevil.com

Thursday, November 27, 2008

Lake Harriet Yugioh Club

The Harriet Yugioh Club will start meeting a Java Jacks Saturdays at 2 pm. If you want to dual sent mail to lhyugioh at yahoo dot com