groovy

Sudoku is Groovy

Last week I spent a bunch of time implementing Sudoku solving strategies in Groovy.  Actually a pretty interesting exercise, I thought.  Even the simple solving techniques/strategies require a bit of thought to generalize into code.  This might seems like a pointless exercise, but think of it a cross training.  Football players can't hope to compete [...]

I Had a Doubt (About CFGroovy2 and Ehcache)

A couple months ago I added Ehcache support to CFGroovy2 as an alternative to the simple HashMap/WeakReference caching that had been there since it's inception.  I waffled a little bit at the time, but it seemed like the right thing to do.  I've changed my mind, and removed the Ehcache functionality in the latest build.  [...]

CFYourFavoriteJVMLanguage

Just in case you didn't come to my talk on leveraging Groovy in your CFML applications at CFUnited, I wanted to share this simple CFM page I demoed:
<cfimport prefix="g" taglib="cfgroovy2″ />
<cfscript>
myArray = [
"barney"
];
</cfscript>
<!— thanks Groovy —>
<g:script>
variables.myArray.add("heather")
</g:script>
<!— thanks Quercus —>
<g:script lang="php">
<?php
[...]

CFGroovy2 and Ehcache

Until this point, CFGroovy2 has used a custom WeakHashmap/WeakReference caching mechanism for compiled scripts.  It works, and it ensures that the script cache won't run your JVM out of memory, but that's about it's only selling point.
Today I plugged in Ehcache as an optional caching backend if it's available on your classpath.  When CFGroovy2 spins [...]

Custom Scopes for CFGroovy2

The middle of last week I committed an update to CFGroovy2 to allow an arbitrary number of scopes to be passed in as attributes, just like you have always been able to do with the 'variables' attribute.  If you update, the change is the addition of lines 47-51:
<cfloop list="#lCase(structKeyList(attributes))#" index="scope">
<cfif listFind("language,lang,script,variables", scope) EQ [...]

Edit Distances Bug

This evening I found a bug in one of the optimizations that I made to the edit distance function.  I've corrected the code in the original post, and made a note of the change there as well.  Just wanted to mention it in a second post so anyone who read via RSS will be aware [...]

Edit Distances and Spiders

An edit or string distance is the "distance" between two strings in terms of editing operations.  For example, to get from "cat" to "dog" requires three operations (replace 'c' with 'd', replace 'a' with '0', and finally replace 't' with 'g'), thus the edit or string distance between "cat" and "dog" is three.  Aside from [...]

Groovy Objects in CFML (a la Ben)

Ben Nadel posted an interesting article over on his blog titled Instantiating Groovy Classes In The ColdFusion Context where he demoed how to create a class factory in Groovy and invoke it from CFML to insantiate new instances of Groovy classes without actually reentering a Groovy context.  I wanted to expound on what he demoed [...]

This Is Why Groovy Rules

So I have a collection of newsletters, and each newsletter has a collection of articles.  Each article, in turn, has a collection of authors and a collection of categories.  Now what I need to do is get a list of unique handles for all the authors and categories for a given newsletter.  Here's the CFML [...]

CFUnited 2009

First, if you're looking for the goodies from my presentation, go here.
As always, CFUnited was a great conference. First, the location Liz (et al) found was great. Comfy room, lap pool, play pools, plenty of space to hang about, etc. There are advantages to being closer in to DC, but I'd come [...]