Skip to content

Category Archives: Uncategorized

Parsing CSV files with ruby FasterCSV : An example

Need to parse csv files in ruby, skipping the first row (usually some header)?. Use FasterCSV. (Yes, its faster). Install it
$ sudo gem install fastercsv
Here is one solution
#!/usr/bin/ruby -w

require ‘rubygems’
require ‘faster_csv’

#put everything in an array
array_of_arrays = FasterCSV.read(”some_file.csv”)

# remove headers
array_of_arrays.slice!(0)

array_of_arrays.each{|row|
puts row
}
Another solution is

#!/usr/bin/ruby -w

require ‘rubygems’
require ‘faster_csv’

# setting the headers option [...]

Mockito vs EasyMock - Mockito wins

I would definitely recommend Mockito over EasyMock (and ofcourse, over JMock).  I was initially hesitant of using Mockito on my project, but when I did, I found it a lot easier to use and with a lot less noise in test setup compared to EasyMock.

Using Dbdeploy with Ant, an example

Here is an example of using dbdeploy in an  ant build file:
<taskdef name=”dbdeploy” classname=”net.sf.dbdeploy.AntTarget”
classpathref=”lib.dir”/>

<target name=”build” depends=”create-build-directory”
description=”Compile main source tree java files”>
<echoproperties prefix=”jdbc” />
<echoproperties prefix=”smn” />
<javac destdir=”${smn.build.dir}” source=”1.5″ target=”1.5″
debug=”true” deprecation=”false” optimize=”false” failonerror=”true”>
<src path=”${smn.src.dir}”/>
[...]

Removing duplication from ant build files

Once I started getting my ant build script to work for both my development and production environment, I started getting some (evil) duplication in it.
build.xml
<?xml version=”1.0″?>
<project name=”some-project” basedir=”.”>
<property name=”dev-deploy.path”
value=”./lib/apache-tomcat-6.0.18/webapps”>
<property name=”prod-deploy.path”
value=”/usr/share/apache-tomcat-6.0.16/webapps”>

<target name=”copy-dev-war”
depends=”build” description=”copy WAR to webapps directory”>
<copy todir=”${dev-deploy.path}” preservelastmodified=”true”>
<fileset dir=”.”>
<include name=”*.war”/>
</fileset>
</copy>
</target>

<target name=”copy-prod-war”
depends=”build” description=” copy WAR to webapps directory “>
<copy todir=”${prod-deploy.path}” preservelastmodified=”true”>
<fileset dir=”.”>
<include name=”*.war”/>
</fileset>
</copy>
</target>

</project>
As you can [...]

Scaling agile software development – a few suggestions.

If you are scaling an agile team from say 6 to 60, here are my suggestions. They are from my point of view as a developer:
1.    Consider having one large team made up of smaller sub-teams.
Why: People work best in small teams. This sub-teams should be independent, poly-skilled teams. A large team of 60 can [...]