GIT: Starting using GIT as your SCM

I am a user of SVN and was a fan of it as well. But the following video demonstrated some requirements of SCM which I liked a lot Especially as I want to work distributed, offline, modular and essentially fast GIT came to me as a gift and I want to share it with everyone. This Tech talk from Linus actually convinced me to take a deep look at GIT.


Then this video (which for some reason YouTube does not allow to embed) actually helped me understand more about how GIT works and some tips to work better with GIT.

This image could be helpful enough to have it beside your desk and it also has a larger resolution one if you want it. These images and other documentation are available at the GIT Wiki site. If you are looking for a extended cheat sheet you can find it here. If you are looking for the manual its here and you might also find the "Everyday GIT ..." page helpful. Some useful How-To s can be found here. If you are looking for how to setup a hook, have a look here; you can also simply find those scripts doing locate hooks in your linux box.

I have developed such likings towards GIT to the extend that I have started writing a Maven2 SCM Provider for GIT (using the Mercurial provider as example). Once I am done with it I will also be writing a NetBeans VCS Plugin again in light of the Mercurial plugin (if no VCS plugin for GIT is available in NetBeans prior to that).

Retreiving all classes in a package

Straight to the point - I had to list all ReadOnly attributes for my domain objects as I had to list them in the office Wiki. I had several of them and doing that manually would be tiring (not to mention that I actually do not like documentation that much), I had to find a shortcut and only way is to use reflection; the next question was - how can I just simply mention the package and it will do the rest for me, so after Googling I could not find a solution to my liking so I thought of writing one myself and it took 10~15 minutes to come up with this piece of code.
I did the following with it and it worked nicely for me -
javac GenerateProperties.java
java -cp /opt/jdk1.6.0_01/jre/lib/rt.jar:./ GenerateProperties
If you are running your program from IDE, if you have several modules in your classpath (i.e. their target/classes/) and/or zip/jar(s) it will also search through them to list the methods. I am thinking of making a small framework, or API, out of it. I would like some enhancements on this code, please feel free to send them to me.

SMTP setting for GMail in Evolution


This post of mine involves the least technical depth probably :), it is mainly about configuring SMTP for GMail with Evolution mail client (not that it could not be figured from the image). As GMail users know GMail does not use the default SMTP port (25), the custom port number has to be mentioned in the configuration and though there is no field labelled as Port, but users can easily set the port number as I did. Please see the red border region for it in the image - server-address:port. If required port number can also be provided in similar fashion for incoming mail server.

Modular project development - with Maven and GIT

For sometime I have been searching for a combination for Multi-Module project development with SCM and Project Build tool. After using and testing some tools I have settled GIT and Maven; actually honestly speaking I have quite impressed by GIT. Though the main repository for my projects will be either CVS and SVN because dev.java.net provides those only but the developers will be requested/encouraged to use GIT (through online collab) as their local/team SCM/VCS. As result of my conviction I have decided to start a plugin for GIT-NetBeans integration as well; Almighty willing. At first I will use it for the DatabaseReport and JAIN SIP adapter projects. Everyone interested can join in any of the 3 projects (including the GIT-NetBeans Plugin).

NetBeans RCP development with Maven

I have been wanting to work with NetBeans RCP for quite some time now, but I felt that resources were lacking; then came along API changes for NetBeans 6.0 Platform and I felt there is a lot of improvement in it, along with its platform home, the excellent RCP book and Maven integration for plugin/suite/Rich Client Application development (I personally tested it whether it works or not and it does smoothly except that when I was reading it Figure 4 and Figure 6 were in opposite places), now I reckon NetBeans RCP as a force. The biggest advantage of NetBeans RCP that actually initially dragged me to NetBeans was the JavaHelp integration.
I just wish NetBeans also support(s)/ed GIT. Actually I am planning to add support for it in NetBeans.

Killing a process in Linux

As a software developer one thing I have several times is killing a process, some people will term is as ugly or bad, but general software developers often come across situation where killing a process is handy or necessary. I will mention some use cases later in the blog.

Killing a process usually involves 2 steps. Finding the process ID that is intended to be terminated and terminating it with a kill statement. Step one for general users (like myself) again involves a ps command with some grepping and then manual lookup. I have to these almost every time I kill a process. I have simply put this steps into this script so that I can do them in a single command. If someone has any improvements please inform me about it.

The shell script expects 3 arguments, of which 2 are mandatory and 1 is optional. The first 2 are grep params to identify the process. For example, to identify a Tomcat running Escenic Content Engine I use java and escenic.root to identify the process. The third param is the user to search it with. If it is not provided then whoami will be used to determine the user executing the shell.


This shell script has enabled me to sync, build, deploy my projects all with a single command and this helps me save some sustainable amount of time. Now without a build server I can still achieve what a build server like Hudson can do. Actually I use this script from within Hudson and thus I almost "never" have to be concerned about deploying applications to my demo server. I hope this is useful to all.

Guarding against softwares with memory leak

I have been using IntelliJ IDEA as the IDE for my project development. It has been satisfying but sometimes it annoys me a lot. For example, when I am typing in the code editor and all of a sudden I cant hear the music playing (which I always play while coding), the IDE stopped responding and the mouse pointer hardly moves. The only way to start working normally again is to restart my laptop and on a laptop it is not a happy scenario to force reboot and moreover I do not like force reboot as a solution. So first I had to detect what caused the catastrophe and I find that the Java VM running IDEA keeps taking up memory linearly at 45 Degrees angle in the resource monitor. Furthermore this is not a infrequent event it usually occurs 2-3 times a day.

As I could not live with the reboot I had too make sure it did not occur and for that I thought of the a solution - I will have a cron job that will monitor the used memory by IDEA and will kill it if it crosses a certain amount. So I wrote a shell script and created a cron job following the the Ubuntu help. That solved my problem. The shell script can actually be used to kill any Java process that leaks memory and might disrupt the normal flow of PC usage experience.

If anyone has any alternate solution please feel free to share it.

Search