I recently ran into a case where I was violating the DRY principle by having to encode part of a string every time I added to it. After some digging I found the solution: Groovy Categories.
A bit of Groovy background
A couple key features of Groovy are that everything is an object and that operators are just syntactic sugar for calling methods on the objects. What’s cool about this is that with Groovy you can override the default behavior of these operators for certain classes. For example, 4 + 2 in Groovy really means 4.plus(2)
How to implement/override operators in Groovy
Groovy allows you to override a LOT of stuff, including final methods and operators. If I want to override a method on the String class, all I need to do is:
Continue reading →
I was interviewed by Mark Sanborn and Jade Robbins on the Faceoff Podcast.
Restrain yourself from making fun of my geeky voice and focus instead on the awesomeness of Selenium, a fantastic web-application testing tool. I talk about what Selenium is, some features and uses, and speculate on possible future extensions.
The interview starts at the 12th minute or so. That said, I have learned a lot from these guys and think you’d benefit from giving their podcast a listen.
Check it out! Continue reading →
The days of the traditional web where we have to “go” somewhere to do something are ending. Ubiquity is a Mozilla Labs project that is a bit like a command-line for the web. It is powerful because it allows you to use a bunch of common web-tools without leaving the pages you actually care to visit.
One really cool thing about Ubiquity is that you don’t have to type “add-to-calendar blah blah”. If you type “add”, Ubiquity will figure out what you want so you just have to type: “add beer with David Walsh at 9pm” and it will figure it out. If you have text selected, just type “this” and it will insert the selected text into that part of the command.
Get started with Ubiquity
While using Firefox, download the Ubiquity Firefox extension. Once you have it, you can install extra commands by clicking any of the command links above. You can summon Ubiquity with Ctrl-Space by default, but this is easily changed. That’s all!
Continue reading →