
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).

//form[@id='myFormName']/table/tr[2]/td[2]
//form[@id='myFormName']/table/tbody/tr[2]/td[2]
"There's no point in being exact about something if you don't even know what you're talking about."
-- John von Neumann, as quoted in "Software Estimation" by Steve McConnell
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?
"The indispensable first step to getting what you want is this: Decide what you want."
-- Ben Stein
import org.joda.time.LocalDate
import static org.joda.time.Days.*
date1 = new LocalDate(2008, 3, 10)
date2 = new LocalDate(2008, 3, 12)
assert 2 == daysBetween(date1, date2).days
void testUpdateNotFound() {
def bc
def mock = new MockFor(BookmarkController)
mock.demand.redirect { Map params ->
assert params.action == bc.edit
}
mock.use {
bc = new BookmarkController()
bc.params.id = 5
bc.update.call()
}
}import groovy.mock.interceptor.*
class BookmarkController {
def update = { redirect("value from original") }
def redirect = { println "Original class: $it" }
}
class BookmarkTests extends GroovyTestCase {
void testUpdate() {
def bc
def mock = new MockFor(BookmarkController)
mock.demand.redirect { println "Mock class: $it" }
mock.use {
bc = new BookmarkController()
bc.&update.call()
}
}
}
new BookmarkController().&update.call()
new BookmarkTests().testUpdate()
On two occasions I have been asked, – "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" In one case a member of the Upper, and in the other a member of the Lower, House put this question. I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
-- Charles Babbage, English mathematician, philosopher, and mechanical engineer
#! /usr/bin/groovy
df = new java.text.SimpleDateFormat('yyyy-MM-dd')
// These dates cross DST...
startDate = df.parse('2007-03-10')
endDate = df.parse('2007-03-12')
expectedDifferenceInDays = 2
// Here's the problem with millis:
millisInADay = 1000 * 60 * 60 * 24
differenceInMillis = endDate.time - startDate.time
actualDifferenceInDays = differenceInMillis / millisInADay
assert expectedDifferenceInDays != actualDifferenceInDays
assert actualDifferenceInDays < expectedDifferenceInDays
#! /usr/bin/groovy
df = new java.text.SimpleDateFormat('yyyy-MM-dd')
// These dates cross DST...
startDate = df.parse('2007-03-10')
endDate = df.parse('2007-03-12')
expectedDifferenceInDays = 2
calendar = Calendar.instance
calendar.time = startDate
actualDifferenceInDays = 0
while (calendar.time.before(endDate)) {
actualDifferenceInDays++
calendar.add(Calendar.DATE, 1)
}
assert expectedDifferenceInDays == actualDifferenceInDays