Things that move me..

It has been a while since my last post, but as the falgun (spring of 1419) comes by and entire Dhaka city and all the community of Bangladeshi living abroad, unites in protest.. silence doesn’t justify.

One of my junior school-mate shared a request for petition with this video. For those who are coming up with excuse(s) and justifying their silence, let it be a push.

We are always taking the back-seat, waiting for others to take over and lead things. I partly blame our generation’s conservative attitude for the situation in our country, with all the corruption, negligence and misfortune. We have created a void of active intellectuals, we’ve read, we’ve learnt and we moved outside of country and now only complain about what is wrong with our country.

I understand the inconvenience caused by the protest at Shahabag for the conservatives, but for once this is for ourselves, for our country, for our history. Over the years we’ve managed to tolerate all those nuisance created in the city by political parties, why should our younger brothers and sisters be scrutinized in the same scale?

Have you read Jahanara Imam’s ‘Ekatturer Dinguli’?
Collection of true stories Nilima Ibrahim’s ‘Ami birangana bolchi’? Enough of reading all the petty novels, atleast read ‘Shamol Chaya’ by Humayun Ahmed. We are grossed out by the brutality of the fight and we try to escape from the pain that still lingers in the heart of the one who lost someone in the freedom fight.

My heart reaches out to the people who are protesting, standing under the open sky, asking for justice. Islam doesn’t support the brutal acts committed in the name of religion, may Almighty grant us the justice that we have been waited so long for.

Person who is my father i

He was born on Shab-e-borat. He brags how he took his own time to be born, oh! how my dear grandma must have suffered! But he remains unphased when he tells the story, as the pain was worth the outcome.
Being fourth is quite low in hierarchy of siblings. Not even in top 3, always in shadows of predecessors? But
he had mind of his own to make this rule completely false, he would never live in shadow but be the tree on which sheikh family will redefine their status. On the night of Shab-e-borat, so was the luck written.

Person who is my father ii

He always managed to rise to the occasion, nothing ever left him broken.
When his immediate brother died off on a tragic accident(the baby boy was too young to swim and was trying to fetch a spoon from the ****), he started breastfeeding again. In his own way he consoled his mom. Later he honored his brother by taking up his name for himself.
Being brought up with notorious influence of his maternal uncles, he was designed for mischief. However, my grandma was quite strict about how to raise her sons and she made sure all of them headed to school at right age and stayed there.

Mono – take1

So I had to write a client/listener for an MQ server, I planned to use an existing web service that was left out from being used during one of the site makeover.

Since one of the app in java is already doing that using Spring and jms template, I made a point in trying to do the same in .NET. Problem is simple, the MQ server is in Java platform and I needed to run a C# tool/deamon on Linux distribution 5.x.

Mono is a wrapper for C#/.NET to enable user to convert a *.dll/*.exe to run in any environment that does/not support .NET framework.

I’m still testing it, I’ll update you guys when something good comes out of it.

How to link the svn revision with maven pom.xml project version

For a while now we are using tortoise svn to maintain our code repository, no question asked it is an excellent tool.
Now we also have nexus to store our generated artifacts/jar, but I can’t seem to find a way to identify from which svn revision this particular jar file was generated.

Also all of us are quite lazy to go up to the version node in the pom.xml and change it, and for months and months we are usually generating the same version, which is 1.0-SNAPSHOT.

I did a bit of digging around and tried something very simple..
STEP 1: Added a placeholder in pom.xml and property field in settings.xml
STEP 2: Made sure the mvn.bat performs a svn update at mvn build and supplies the property value to it.

STEP 1 goes something like this : pom.xml with variable ${svn.version}

<project>
 <modelVersion>4.0.0</modelVersion>
 <groupId>com.somedomain</groupId>
 <artifactId>mysuperproject</artifactId>
 <packaging>war</packaging>
 <version>1.0.${svn.version}</version>
...
</project>

Just to make sure the editor(netbeans) build doesn’t complain, I added a placeholder in settings.xml

<profiles>
 <profile>
  <id>my-usual-profile</id>
  <properties>
   <svn.version></svn.version>
  </properties>
...
 </profile>
....
</profiles>

STEP 2 was a bit trickier, keep a backup in case you break it, it is updating the mvn/mvn.bat
The dirty fix is to edit mvn.bat and at the top just add this bit above the Apache license declaration.


@REM ----------------------------------------------------------------------------
@REM Farlin : Adding a bit of logic to update project version number with svn revision
@REM ----------------------------------------------------------------------------
@ECHO OFF
:; Turn echo off (above) to keep it clean
:; Clear any previous variables set, and set your desired property name
SET PropertiesName=svn.version
SET SvnCurrentRev=
:; Get the output from the "svn up" and trim to revision number
SET temp=
FOR /F "tokens=*" %%i in ('svn up') do SET temp=%%i
FOR /F "tokens=3 delims= " %%A IN ("%temp%" ) DO (
SET temp=%%A
)
FOR /F "tokens=1 delims=." %%A IN ("%temp%" ) DO (
SET SvnCurrentRev=%%A
)
:;ECHO %SvnCurrentRev%
:; create a mvn commandline switch with svn revision number
SET MAVEN_CMD_LINE_BUILD_VERSION=-D%PropertiesName%=%SvnCurrentRev%
:;ECHO %MAVEN_CMD_LINE_BUILD_VERSION%
@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
....

and also locate the place where Start MAVEN2 is configured in the mvn.bat file

....
@REM Start MAVEN2
:runm2
%MAVEN_JAVA_EXE% %MAVEN_OPTS% -classpath %CLASSWORLDS_JAR% "-Dclassworlds.conf=%M2_HOME%\bin\m2.conf" "-Dmaven.home=%M2_HOME%" org.codehaus.classworlds.Launcher %MAVEN_CMD_LINE_ARGS% %MAVEN_CMD_LINE_BUILD_VERSION%
if ERRORLEVEL 1 goto error
goto end
...

This should do the trick and append the revision number when you do a mvn build.
To check, go to your checked out version and do :

mvn clean install

Want to check if this worked? Just browse inside your *.jar/*.war and inspect the file called pom.properties
mysuperproject.war\META-INF\maven\com.somedomain\mysuperproject\pom.properties
you will see :

#Generated by Maven
#Fri Jul 09 15:05:59 EST 2010
version=1.0.1326
groupId=com.somedomain
artifactId=mysuperproject

And when you deploy your artifact to nexus, it will automatically create a folder for your jar with respective build number. Hope this helps!

Trouble relocating nexus folder?

I got a bit adventurous and decided to install the Nexus in our Dev server. We already have a working version in a virtual environment, but I’ve got my hands on a clean Linux machine and I thought to make best use of it.

I have found this blog post very helpful for a non-Linux native person.
It was very simple to get it started (after I have sorted out some environmental and user right issues).

Once I got it started at port 8081, I wanted to move the folders around. But I didn’t want to set the environment variables, just to make sure my folder structure works..

In order to do this the main file you want to edit is located here,

/[your system folder structure]/nexus-webapp-[version]/conf/wrapper.conf

the wrapper.conf looks like this – just out of the box..

#********************************************************************
# Wrapper Properties
#********************************************************************
# Java Application
wrapper.java.command=java

# Wait a bit longer than default before assuming jvm hasn’t started properly
wrapper.startup.timeout=90

#wrapper.debug=true
#This should be set to the base of your system, which is one folder below the container and nexus folders
#wrapper.working.dir=../../../../

# Java Main class.  This class must implement the WrapperListener interface
#  or guarantee that the WrapperManager class is initialized.  Helper
#  classes are provided to do this for you.  See the Integration section
#  of the documentation for details.
wrapper.java.mainclass=org.codehaus.plexus.classworlds.launcher.Launcher

# Java Classpath (include wrapper.jar)  Add class path elements as
#  needed starting from 1
#wrapper.java.classpath.1=../lib/wrapper.jar
#wrapper.java.classpath.2=../lib/my-app-1.0-SNAPSHOT.jar
wrapper.java.classpath.1=../../../lib/*.jar
wrapper.java.classpath.2=../../../conf/

# Java Library Path (location of Wrapper.DLL or libwrapper.so)
wrapper.java.library.path.1=./lib

# Java Additional Parameters
#wrapper.java.additional.1=-d64
#wrapper.java.additional.2=-Dcom.sun.management.jmxremote
#wrapper.java.additional.3=-Dorg.tanukisoftware.wrapper.WrapperManager.mbean=true
wrapper.java.additional.1=-Dbasedir=../../..
wrapper.java.additional.2=-Djava.io.tmpdir=../../../runtime/tmp
wrapper.java.additional.3=-Dsun.net.inetaddr.ttl=3600
#wrapper.java.additional.4=-Xdebug
#wrapper.java.additional.5=-Xnoagent
#wrapper.java.additional.6=-Djava.compiler=NONE
#wrapper.java.additional.7=-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
#wrapper.java.additional.8=-XX:+HeapDumpOnOutOfMemoryError

# Initial Java Heap Size (in MB)
#wrapper.java.initmemory=3
#

# Maximum Java Heap Size (in MB)
#wrapper.java.maxmemory=64
#

# Application parameters.  Add parameters as needed starting from 1
#wrapper.app.parameter.1=com.mycompany.app.App
#

# Make wrapper reload configuration between app restarts (NEXUS-3032)
wrapper.restart.reload_configuration=TRUE
wrapper.on_exit.12=RESTART

#********************************************************************
# Wrapper Logging Properties
#********************************************************************
# Format of output for the console.  (See docs for formats)
wrapper.console.format=PM

# Log Level for console output.  (See docs for log levels)
wrapper.console.loglevel=INFO

# Log file to use for wrapper output logging.
wrapper.logfile=../../../logs/wrapper.log

# Format of output for the log file.  (See docs for formats)
wrapper.logfile.format=LPTM

…..

I didn’t like the idea of having relative paths and leaving all the standard stuff aside, I only wanted to make sure it has got the correct base directory to work with.

So all I did is introduce couple of variable like this at the top :

set.REPO.HOME=/usr/local/your-base-directory-for-nexus/
set.NEXUS.HOME=/usr/local/your-base-directory-for-nexus/nexus
set.NEXUS.PLATFORM=linux-x86-xx

and for all the relative path-ed variable, just update them like this:

….

wrapper.java.additional.1=-Dbasedir=%NEXUS.HOME%
wrapper.java.additional.2=-Djava.io.tmpdir=%NEXUS.HOME%/runtime/tmp

# Log file to use for wrapper output logging.
wrapper.logfile=%NEXUS.HOME%/logs/wrapper.log

If you want to change the folder location, all you need to do is just update your HOME variable to the new path and all will be well. Hope this helpful !

Step 1 : Maven pom.xml

Read a lot and read a bit more.. until you think you will never understand what this thing is supposed to help you with..

Then you discover the dependency management, discover how you can get minions aka. plug-ins to do your dirty work, how you can control the properties values from settings.xml and how you can change your profile to suit building artifact/war/jar for different environment.

Then you want more.. mm..what is up with this repository management??

stop poking us, I beg you..

It is an interesting thing, this Death.

Unless it touches you somehow, you are behind the glass, you can see the people tormented by it,
like you watch those bats in the dark, glass-enclosed confinement. You feel empathetic towards them.
you ponder, ‘..such sad things happen to people’.
Only when Death reaches you somehow, snatches someone beloved from you,
you break in to one of those silent scream that you often hear the bats do.

What is the best thing to do? Hide yourself and hung upside down?
I count my blessings, Merciful God can be quite brutal sometime,
I am told – He knows everything and there must be a reason for what he is doing..
It is His way of testing.

I had a parrot once, quite rebellious one at that.
It never liked staying inside the wire-cage it came with.
It would rub and wriggle its head through the small opening between the wires to find a way out.
I was quite fond of poking it. I never understood how painful it must have been for that parrot.

Knowing all He knows, I should think He would stop poking us, isn’t it?

Phases of Me

I go through this on and off phases of self-confidence.

There are times when I am pretty satisfied with what I am and how things are going around me. But all on a sudden I would suffer from tremendous self-consciousness, and I would go in the snail-shell phase, where I don’t feel my self anymore. I get easily intimidated and acts out to be overly sensitive. I hate being that sentimental.

scar in my hand

Few weeks ago I had a minor kitchen accident, which resulted in some (quite) hot oil being spilled in on my hand. Now that I look at my peeling burnt skin, I can’t recall how painful it was to have hot oil on my skin. I am more worried about this albino skin tattoo that I would have to bear on my hand for rest of my life.

It is sad why I am like this, more worried about less important things. I think I am obsessed with making sure people are pleased with me over the actual problem at hand.