Unix find and grep

Periodically I need to find some files within a unix server that contain some random text. I also get caught out between say Redhat or Solaris or OSX.

Recently it was searching for some text within a heap of maven pom files.

find . -name pom.xml | xargs grep '1.2-SNAPSHOT'

Jenkins REST API

Jenkins has a useful REST api that can be used to create jobs, build and disable them.

Quick reference:

GET request to build

http://[userid]:[apitoken]@[jenkinsURL]/job/[Jenkins Job Name]/build

POST Request to Disable

http://[userid]:[apitoken]@[jenkinsURL]/job/[Jenkins Job Name]/disable

Groovy: Writing to a File

Recently had a requirement at work to update multiple maven pom files with the correct <version>. After performing a grep for the files that I needed to change I wrote this simple grroovy script to open each file replace the text and then save the file.

def fileName = "pom_location.txt" // Locations of the pom files
def sourceText = "1.2-SNAPSHOT"
def replaceText = "1.2"

new File(fileName).eachLine { line ->

def pomFile = line
pomFile = pomFile.replaceAll("\\s","") + "/pom.xml"
def file = new File(pomFile)
println "Editing ... $pomFile"
def fileText = file.text
fileText = fileText.replaceAll(sourceText, replaceText)

Thanks to David Heffelfinger http://ensode.net/roller/dheffelfinger/entry/groovy_script_to_find_and

CURL Tutorial

I am always having to google a decent lookup on CURL.

Quick usage:

curl <url>


Maven Skip Tests

I keep forgetting this. So to skip the test cycle when executing maven:


Professional vs Passionate

Chatting with a bunch of work dudes recently I started thinking out loud about being passionate about what we do and then went into a little rant about it. I think this article by Kathy Sierra seriously influenced me.

Martin Fowler has an interesting presentation on the development of mobile applications and conundrum of the various platforms.

I like this quote from Giles Alexander from Thoughtworks:

“Mobile is the new web: in 2000 businesses were realizing that the future of commerce and customer relations was on the just-exploding web. In a few years time, web commerce had eclipsed traditional off-line commerce. Mobile commerce is currently a fraction of web commerce. But in a few years time it will, in turn, eclipse traditional web commerce.”

What struck me was slide 17 that stated: “The choice between native apps and webapp is essentially between user-experience and affordability”

It will be interesting to see what develops as iOs and Android dominate the market, will Windows make inroads. What about Blackberry? Then there is also the web. How does that all fit in? I guess the consumer will decide.

As a developer, where do I put my skills and learning?

My first Android App

After much time wasting I finally decided to give writing my first android app.

So I went to the official source: http://developer.android.com/training/basics/firstapp. After downloading and installing the various bits and pieces, I followed the instructions and was delighted to see “Hello World” running on my Galaxy S2. Stupidly I couldn’t get the app to do exactly what the tutorial wanted. Maybe it’s just late.

My first impressions of looking at the code in Eclipse. It’s very Java’ery. I guess after well over a decade of developing webapps doing the layout of my lame widget seemed foreign. One surprise was a whole heap of XML. Sigh! I thought the powers that be had slayed that beast.

I ordered Professional Android 4 Development from , it has a cool looking Terminator on the cover. Hopefully this book ins’t crap.

MySQL how to display the character set for a table

Needing the character set details on various tables within a MySQL Database:


Have a look the MySQL documentation: http://dev.mysql.com/doc/refman/5.1/en/show-table-status.html

Executing a class using the Maven Exec Plugin

Today, in a java maven built webapp, I needed to have a way to execute a class from the commandline. As maven was already building package into a war, I needed something extra.

Bring in the Maven Exec Plugin: http://mojo.codehaus.org/exec-maven-plugin/index.html

Pretty useful as I was able to define a specific profile for this class and now execute it by:

mvn compile -P run_my_class

Have a look at the documentation.

Also a good quick overview is provided by http://www.vineetmanohar.com/2009/11/3-ways-to-run-java-main-from-maven