Fireworks captured by a drone

This is an awesome video captured by a drone and a GoPro Hero 3 silver flying though 4th of July Fireworks. Amazing that the drone was not damaged. [theverge.com]

Posted in Videos

Happy Holidays

Decorations

Posted in Uncategorized

Blog is back.

Hmmm… My old host shutdown my site stating that there was a security issue with my account. Finally move to a new host. Hopefully I get more time to blog soon.

Posted in Uncategorized

Moved out of Facebook Home

image

It just lasted an hour. I would use it if I were more into Facebook.

Posted in Uncategorized

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.

Posted in Uncategorized

The project I was working on for the…

The project I was working on for the past year went live just when I was on paternity leave. Check out http://www.westernunion.com and https://m.westernunion.com.

Posted in Uncategorized

It’s a boy

Joshua Bradley Vasanth

Joshua Bradley Vasanth

My wife and I are blessed with a baby boy. This makes Kaitlyn a big sister!

Posted in Uncategorized

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
Hello[/cc]

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: com.microsoft.sqlserver.jdbc.SQLServerDriver
at FetchData.fetch(FetchData.groovy:51)
at FetchData.run(FetchData.groovy:3)
[/cc]

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: com.microsoft.sqlserver.jdbc.SQLServerDriver
at FetchData.createCSV(FetchData.groovy:51)
at FetchData.run(FetchData.groovy:3)
[/cc]

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!
[/cc]

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

Posted in Groovy, Java, Software

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.

Posted in Eclipse, Java, Software

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 http://marxsoftware.blogspot.com/2009/05/groovysql-groovy-jdbc.html
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}.”
}

[/cc]

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 {
         println it.name
     }
 

[/cc]

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′)
import groovyx.net.ws.WSClient

proxy = new WSClient(“http://www.w3schools.com/webservices/tempconvert.asmx?WSDL”, this.class.classLoader)
proxy.initialize()

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

Posted in Groovy, Java, Software

Ads By Google