Google Reader is going away

Google Reader has been my RSS reader of choice for the sometime now. But for the past few months I have been reading the feeds exclusively on my HTC One X using Feedly. With the little free time I had this was a quick way to catch up on reading. Now looks like Feedly is going to be my RSS reader on the desktop too. They are looking to clone the Google Reader API and continue supporting feed syncing. Awesome.

Google Reader API made Google host the backend for numerous RSS clients like Feedly. The clients could just concentrate on the presentation layer and not worry about the backend. Looks like all these clients have to rethink their strategy now. Maybe this is why Google is shutting down Reader. It does not want to be just a API with no way to make money.

Running standalone Groovy scripts

As I mentioned in my post Learning Groovy, I am writing Groovy scripts to automate some simple tasks. Now I want to share the scripts with others. I did not want them to install Groovy just to run the scripts. I had the groovy-all-1.8.0.jar, so I typed the following in the command prompt:

[cc lang=’dos’ ]C:\temp>java -jar groovy-all-1.8.0.jar Hello.groovy

It worked. Simple. Now I tried to run my script that retrieved the XMLs from a database.

[cc lang=’dos’ ]
C:\work\FetchData>java -jar groovy-all-1.8.0.jar FetchData.groovy
Caught: java.lang.ClassNotFoundException:
at FetchData.fetch(FetchData.groovy:51)

Of course I need the driver jar in the classpath. So I added the sqljdbc.jar to the classpath.

[cc lang=’dos’ ]
C:\work\FetchData>java -cp sqljdbc.jar -jar groovy-all-1.8.0.jar FetchData.groovy
Caught: java.lang.ClassNotFoundException:
at FetchData.createCSV(FetchData.groovy:51)

Looks like the script is run with a different classloader and the java classpath is not passed to it. I did some lazy googling but did not find the answer I was looking for. So I looked at how eclipse is doing it. Eclipse used GroovyStarter and GroovyMain to run scripts. Not knowing which to use, I just used GroovyMain:

[cc lang=’dos’ ]
C:\work\FetchData>java -cp lib/groovy-all-1.8.0.jar;lib/sqljdbc.jar groovy.ui.GroovyMain FetchData.groovy
Fetched Data!

It worked! I just added the command in a batch file to share the script.

Infinitest: A continuous test runner for Java.

Infinitest is a continuous test runner for Java.

Infinitest is an Eclipse plugin that runs the JUnit tests instantly when you save a Java file. Check out the demo above. It smartly runs only the test affected by the file you just saved. This is cool. You can immediately know if you broke something as soon as you save your code. Of course, your test cases should be comprehensive. Improving Works developed this plugin and has released it as a open source project.

Learning Groovy

I have dabbled a bit with scripting languages before but for some reason never really used one long term. I think that might change with Groovy. A colleague of mine got me interested in it and I have been picking up all the cool things Groovy can do by reading Dustin’s “Inspired by Actual Events” blog. Come to think of it Groovy could have saved me a ton of time I spent in writing small tools to help me in development.

I like the how concise and simple writing groovy scripts are. Here is a snippet of code to print rows retrieved from a database.

[cc lang=’groovy’ ]

// Get instance of Groovy’s Sql class
// See
import groovy.sql.Sql

def sql = Sql.newInstance(“jdbc:oracle:thin:@localhost:1521:orcl”, “hr”, “hr”, “oracle.jdbc.pool.OracleDataSource”)

// iterate over query’s result set and “process” each row by printing two names
sql.eachRow(“SELECT employee_id, last_name, first_name FROM employees”)
println “Employee ${it.first_name} ${it.last_name} has ID of ${it.employee_id}.”


At work I needed to retrieve about 100 XMLs stored in a database, strip out some tags from it and write it to a file. It took about 15 lines of Groovy code to do it. Probably could have done it in less but I am just learning Groovy.

Here is another way to use Groovy that I wish I knew before. Embedding Groovy in Ant:

[cc lang='xml' ]

     project.references.found.each {


Though the above snippet is simple, it shows how the Groovy script is aware of the Ant references. Pretty powerful.

I will showcase just another snippet before I am off to learn more Groovy. Invoking a web service:

[cc lang=’groovy’ ]
@Grab(group=’org.codehaus.groovy.modules’, module=’groovyws’, version=’0.5.2′)

proxy = new WSClient(“”, this.class.classLoader)

result = proxy.CelsiusToFahrenheit(0)
println “You are probably freezing at ${result} degrees Farhenheit”

my thoughts on java, smartphones, gadgets, stuff…