Author Archive
Grails: The View Layer [GUM]
by Colin on Feb.04, 2010, under Groovy-Grails
This past month, I did a presentation at the Groovy Users of Minnesota which I called Grails: The View Layer. We took our time delving into the Groovy Server Pages, how Grails utilizes Sitemesh and some of the more obscure tags related to Sitemesh. Currently, Grails’ Sitemesh integration is not very well understood by the community at large and I wanted to spend some time on it since Sitemesh is such a powerful part of the Framework.
I was hoping to spend some more time polishing this slide deck, but hopefully this presentation skeleton is helpful to the community as it is. I am hoping to give this talk again at Gr8Conf in the USA this upcoming April and spend some more time creating more concrete and digestible examples.
Grails user-specific configurations
by Colin on Nov.26, 2009, under Groovy-Grails
I asked a question on the GUM (Groovy Users of Minnesota) User list about how to achieve a user/machine specific config.
I didn't have much time to figure it out but this is what I ended up finding out:
Grails 1.1.1 create-app generates a Config.groovy with this as the first few lines that would have told me what I need to know if I actually took the time to read it:
// locations to search for config files that get merged into the main config
// config files can either be Java properties files or ConfigSlurper scripts
//
// grails.config.locations = [ "classpath:${appName}-config.properties",
// "classpath:${appName}-config.groovy",
// "file:${userHome}/.grails/${appName}-config.properties",
// "file:${userHome}/.grails/${appName}-config.groovy"]
//
// if(System.properties["${appName}.config.location"]) {
// grails.config.locations << "file:" + System.properties["${appName}.config.location"]
// }
So in my case all I had to do was put this in Config.groovy:
if (new File("${userHome}/.grails/${appName}-config.groovy").exists()){
grails.config.locations = ["file:${userHome}/.grails/${appName}-config.groovy"]
}
which allowed me to override properties by doing something like this in my ~/.grails/${appName}-config.groovy :
username = "sa"
password = "sekret"
// environment specific settings
environments {
development {
dataSource {
dbCreate = "create-drop" // use your imagination...
}
}
}
I also ran across a little gem that you can do the same type of config merging with your BuildConfig.groovy by implementing a ~/.grails/settings.groovy file. (yes its hardcoded rather than a config.locations property in BuildConfig.groovy – see BuildSettings.groovy for more)
Now I really wish there was a way to set defaults for things like server.port in the configs.
Thanks, Ted Naleid, Scott Vlaminck, and Robert Fischer for helping me find what I was looking for!
Grails BOF recording at SpringOne2GX
by Colin on Oct.24, 2009, under Groovy-Grails
SpringOne2gx was a blast this year. It was great to get to know many members from the community!
I was able to record the Grails BOF (Birds Of a Feather) session at SpringOne2gx this year: Download it Here (80MB)
Big thanks to SpringSource and No Fluff Just Stuff for putting together an awesome conference!
Props to Dropbox for allowing me to share this recording.
Hulu Desktop for Linux! 32 & 64bit versions for Ubuntu & Fedora
by Colin on Oct.08, 2009, under General, Linux, Streaming, Ubuntu, Video
Hulu Desktop (currently Beta) is now available on Linux! A friend tipped me off to an article on TechCrunch about it.
Downloading it and setting it up was pretty easy. I went to Hulu Desktop and selected download for linux. From there It gave me choices for Fedora and Ubuntu (both 32 & 64bit versions!) Since I run Ubuntu I downloaded and installed the deb – easy enough.
When you first launch it it asks you to accept the EULA.
The first time I launched Hulu Desktop I got an error, that "Hulu Desktop could not locate the Flash plugin. If you do not have it installed, please modify ~/.huludesktop with the correct location of libflashplayer.so." (remember the beta sticker?)

I had to edit the ~/.huludesktop file to use the wrapped version of the Flash plugin /var/lib/flashplugin-installer/npwrapper.libflashplayer.so and it worked like a charm!

Playback worked great, probably better than the in-browser experience. The interface is slick, better than the web-interface and more along the lines of Boxee. Fullscreen worked well for me.
Props to Hulu for providing a Linux version. The Linux desktop is a first class citizen. Skype has a Beta version that rocks on Linux. Google Chrome, Firefox, etc. Who is next? Adobe? CS5? I’d pay for Adobe CS5 on Linux.
So far its been pretty good stuff for Beta Software! I’ll definitely be using Hulu more now.
Here is a shot of the opening screen:
And another of the Menu (while watching media):
VMWare acquiring SpringSource which Acquired G2One
by Colin on Aug.10, 2009, under Groovy-Grails
Wow, Big news for the Groovy and Grails Community! VMWare has announced that it is acquiring SpringSource. Rod Johnson, the founder of SpringSource and Initial author of the Spring Framework also posted his thoughts on SpringSource’s blog calling it ‘SpringSource – Chapter Two’. I don’t think that too many of us saw this one coming. Now its time to wait until Oracle acquires VMWare If Marcel Overdijk’s prophecy is true
I’m not that familiar with SpringSource’s offerings, but It does seem like some of VMWare’s products are a natural extension to the goals that SpringSource is trying to accomplish with their Build / Run / Manage mantra. The two companies don’t really compete, but VMWare + Grails seems like a good combo to me
Jerome Gagner blogged about how VMWare should throw in some terracotta for some extra spice to take on (read ‘out’) Windows Azure.
I must say that PaaS offerings look really appealing to me as a developer. Even though I *can* manage machines and hardware, I don’t want to have to take on the risks and responsibilities. I’m not quite sure what they are going to accomplish together but VMWare + Grails + SpringSource Technologies as a PaaS solution sounds good to me.
Windows Vista = Slow^3
by Colin on Jul.17, 2009, under General
Yep that’s a snail on a turtle with a Vista tattoo to illustrate how Vista = slow3. I threw this together to console a friend who was going through an upgrade to Windows Vista SP3. It took them weeks(so far) to roll it out at his work; and it still isn’t complete. The pic is adapted from an icanhazcheezburger.com post.

Maybe I’ve been spoiled with the speed of a Linux desktop without intrusive ‘virus protection’, but everytime I use a Vista machine, I find myself frustrated. I guess I get sick of the waiting, double confirmations, the "I told you to shutdown, why are you installing updates… ", etc.
I have professionally developed on all major desktop OSs (Windows[98,2k,XP,Vista], OSX, and Linux) as well as used many others over the years (RHEL, CentOS, Fedora, Solaris, HPUX, Windows[2k3,2008], etc.) So when I started my current contract, I had a bad dream the night before. I dreampt that I was forced to use Windows Vista. I’m not going to call it a nightmare, but it came close
(They ended up giving me an XP box)
This is my OS Preference as it stands today:
Vista < XP < Windows 7 < OSX < Linux (Ubuntu, Gentoo, etc.)
I honestly expected more from Vista seeing that it was coming from the largest/wealthiest software company/OS vendor in the world. Using Vista isn’t the end of the world, but you don’t know better until you get a taste of freedom
To be fair, Microsoft has put a lot of effort behind Windows and it is a big responsibility when you take the OS Market in the 90’s and into the 2000s. MacOS was saved by OSX; can Microsoft follow suit? Either way, good competition makes for a better Operating System landscape.
Grails Growl-like notifications in Linux (Ubuntu, 9.04)
by Colin on May.24, 2009, under General, Groovy-Grails, Linux, Ubuntu
When I was developing on OSX, a fellow developer Ted Naleid tipped me off to a script that does Growl notifications for Grails events that Marc Palmer had written. The Growl notifications were handy, but now that I’ve been working on Linux, I’ve definitely missed them.
I first used a tool called Mumbles, which attempted to be a clone of Growl, but I later realized that the built in notification system is probably the way to go. After I learned of Ubuntu 9.04 (Jaunty Jackalope) had some major visualization enhancements to the notifications, I thought that it was definitely the way to go.
This is what I currently have with Ubuntu 9.04:


Implementing this is very simple, you simply create an _Events.groovy file in your ~/.grails/scripts directory (create it if it doesn’t exist) with the following contents (modified from the Growl Script):
eventStatusFinal = { msg ->
libNotify('Final status', msg)
}
eventStatusUpdate = { msg ->
libNotify('Status', msg)
}
eventCreatedFile = { fileName ->
//libNotify('Created file', fileName)
}
eventStatusError = { message ->
libNotify('Error', message)
}
eventExiting = { code ->
libNotify('Exit', "Return code $code")
}
eventCreatedArtefact = { type, file ->
libNotify('Created artefct', "$type with name $file")
}
eventCompileStart = { kind ->
//libNotify('Compiling', "Compiling $kind")
}
eventCompileEnd = { kind ->
//libNotify('Compilation complete', "Compiled $kind")
}
eventPluginInstalled = { pluginName ->
libNotify('Plugin installed', pluginName)
}
// Do the notification
void libNotify(title, message) {
def cmd = [
'notify-send',
title,
message,
'-i',
'grails'
]
cmd.execute()
}
It is simply using Groovy to execute "notify-send $title $message -i grails". if you don’t have notify-send, it is part of libnotify so sudo apt-get install libnotify-bin will get you what you need. If I get some time I’d like to find a way to take advantage of a Java Dbus implementation to talk to the notification system without having to go through libnotify.
If you want mumbles notifications just do something like this:
void mumblesNotify(title, message) {
def cmd = [
"mumbles-send",
"-l",
title,
message
]
cmd.execute()
}
Occasionally I’ll get a failure that there are too many files open (using .execute() in Groovy) and that should be cleared up by using a Java implementation of the DBus notifications.
Let me know what you think. Anything that could be done better?
Customizing rEFIt (an EFI Bootloader – Intel Macs) Slick!
by Colin on May.05, 2009, under General, Linux, Logo, Ubuntu
I recently installed Ubuntu 9.04(Jaunty Jackalope) on a 17" Macbook pro and as a part of that process, I had to install a bootloader called rEFIt. You could think of EFI is just a next-gen BIOS.
Even though the bootloader looks decent, I don’t like the look of silver/grey color, so I decided to customize it. The process to customize rEFIt was relatively straight forward and the result is beautiful.
This is what I came up with:
This is what it looks like with a Windows Partition:
I love the simplicity of it!!
Here is a closeup of the icons / OS Choices:

I don’t really know where the icons came from, but they look tasty
On Linux there is a decent package for working with mac icons (.icns) or sudo apt-get install icnsutils which will get you some useful tools (png2icns and icns2png)
I did have to make a few modifications to the Tux icon [os_linux.icns] to give him a ‘glow’ so that he doesn’t fade into the black on black:

This windows Icon [os_win.icns] is the stock version I think (send me a link to the author if you know):

I did add a slight ‘glow’ to the apple icon [os_mac.icns] (send me a link to the author if you know):

I tried a number of custom ’selected’ themes but gradients didn’t look right, so I went with the simple plan. The selection bitmap can be found here:

the process is simple once rEFIt is installed: modify the refit.conf with the icons in place, and you are done!
Here is what I came up with for my refit.conf (comments removed):
timeout 5
banner hostname.bmp
selection_big selection-big-ring.bmp
hideui tools shell funcs hdbadges label
legacyfirst
The original comments in the refit.conf file are helpful! Its straight forward if you can read
- timeout = the number of seconds before it automatically chooses for you
- banner = the bitmap of the upper part of the screen (top left pixel = background color)
- selection_big = the grey ‘ring’ that indicated the selection
- hideui = Hide elements of rEFIt so we can get a clean interface
- legacyfirst = Legacy OS first (Linux)
Use at your own risk!!
If I had the time, it would be fun to build/enhance rEFIt to have an all-black fill instead of the grey/silver.
I’ve had a good experience with Ubuntu 9.04 on a 17" Macbook Pro, and I’ll Blog about it – and see what I can do to help update the documentation – look for an upcoming post.
Ubuntu Logo
by Colin on May.03, 2009, under Linux, Logo, Ubuntu
I spent a little bit of time customizing rEFIt, which is an EFI Bootloader that can be used on intel macs. So far I like it. Its not 100% feature complete (imho), but its open source
I found myself looking for a good logo for Ubuntu that it shows after you make your OS Choice in rEFIt. There was plenty of good artwork on deviantart.com, but I decided to make my own
So this is what I came up with based on one of the official logos:
ps, I also have a post coming on customizing rEFIt (it looks juicy)
Greasemonkey + live.gizmodo.com
by Colin on Mar.17, 2009, under General
The Keynote for iPhone 3.0 just got over and I thought I should share a tiny greasemonkey script that I put together to reload http://live.gizmodo.com/ much sooner than the 90 seconds that one would wait.
It is too bad that macrumorslive.com is out of buisiness since they got hacked this past January. Their application wasn’t too hard to mashup either. It was simply changing a timout var in one version and then changing an obfuscated function later.
So the Greasemonkey script is really a breeze, it simply loads jQuery, hides the banner/space-waster and sets a timer to reload the page after 15 seconds (15000 milliseconds…)
// ==UserScript==
// @name live.gizmodo.com
// @namespace live.gizmodo.com
// @description live.gizmodo.com
// @include http://live.gizmodo.com/
// ==/UserScript==
// Add jQuery
var GM_JQ = document.createElement('script');
GM_JQ.src = 'http://jquery.com/src/jquery-latest.js';
GM_JQ.type = 'text/javascript';
document.getElementsByTagName('head')[0].appendChild(GM_JQ);
// Check if jQuery's loaded
function GM_wait() {
if(typeof unsafeWindow.jQuery == 'undefined') { window.setTimeout(GM_wait,100); }
else { $ = unsafeWindow.jQuery; letsJQuery(); }
}
GM_wait();
// All your GM code must be inside this function
function letsJQuery() {
$('#header_container').hide()
setTimeout(function(){ window.location.reload(true);}, 15000);
}






