Saturday, April 17, 2010

Tapestry 5 with Scala

Scala language is considered to be the next level of Java. It supports both object oriented and functional programming transparently within the same language.
I gave it a try couple of days back. I really enjoyed working with Scala because of its productivity and seamless integration to use existing java classes.
Here is a blog post explaining in detail on mixing scala and java together.

T5 is a great framework for developing web based applications in Java. The above approach can be easily applied to T5 applications.

Thursday, July 23, 2009

Configuring gitweb in Linux

Gitweb is a web interface to git. I use frequently gitweb to view repository inside browser and hence configured the same on my laptop running Linux OS.

Apache is used as a web server to run gitweb.
Below is a step by step guide to setup git inside Linux using Apache.
1. Download gitweb from web. Run "yum install gitweb" for distributions supporting yum.
2. Add the following code to httpd.conf file (generally in /etc/httpd/conf/httpd.conf)

<VirtualHost *:80>
DocumentRoot /opt/git
ServerName git.pawan.com

Allow from all
AllowOverride all
Order allow,deny
Options ExecCGI

SetHandler cgi-script


DirectoryIndex gitweb.cgi
SetEnv GITWEB_CONFIG /etc/gitweb.conf
</VirtualHost>

NameVirtualHost *:80
3. Set the repository root path inside /etc/gitweb.conf as shown below.
$projectroot = '/opt/git/';
4. Restart Apache HTTPD server to take effect by "/etc/init.d/httpd restart" or the corresponding command as per your distribution.
5. Visit http://localhost/git to view git repositories on web.

Setting up of local Git repository.

Git is a great distributed source code management (SCM) software developed by Linus Torvalds. Merging in git is simply awesome. I have used in the past subversion, cvs and VSS but now using Git extensively for small and large projects. It helps you to focus really on development rather than nuiances of typical SCMs.

Below is a step by step guide to setup Git on a Linux machine (My machine configuration is: Fedora Core 10, Kernel 2.6.30)-
1. Choose a folder where you want to keep all git repositories. I have placed all source code in /opt/git (say GIT_HOME)
2. Go to GIT_HOME. Create a new repository directory say Test.git. It is just a convention to put .git in the end of repository name.
3. Initialize newly created repository using "cd Test.git/; git --bare init"
4. Go to project folder which you want to put in git repository. Say, for ex Test inside /pawan/workspace/Test.
5. Initialize desired project folder using command "git init"
6. Add the newly created git repository inside Test/ using "git remote add origin ssh://localhost/opt/git/Test.git" (This assume you have already configured SSH)
7. Now, add desired folders and files in working project folder using "git add .". If you want to add only specific type of files, use "find . -iname "*.java" | xargs git add"
8. Commit all of your changes using "git commit -a -m "Initial version for Test.". Please change the message you want to change after -m.
9. Now, push the local code to repository using "git push origin master".
10.View the repository in gitweb and you will see your code inside git repository.

Visit http://git-scm.com/ for visual and written tutorials.

Thursday, February 12, 2009

Run Windows inside Linux

Generally I doesn't like all MS products very much but Project Plan and Visio (dia - open source is an alternative but not so user friendly) seems to be very impressive to me. These are some of the great tools developed by MS team. Though I use Linux at work and at home full time but when it comes to creating a project plan and nice design and architecture diagrams, I prefer MS Project Plan and Visio resp. My laptop came preinstalled with Windows XP and a recovery disk for the same. Now, I am using VirtualBox (http://www.virtualbox.org/) to run windows XP inside Linux. It is very easy to configure and gives you lot of features you would need to run and use windows easily inside Fedora Core 10 (distribution I am using) with 1.5GB RAM and 1.73GHz Intel 32bit processor.

Easy search and replace in a directory

A python script to search (http://groups.google.com/group/pawan-kumar-group/web/SearchReplaceUtil.py?hl=en) for a keyword and replace the same with the proposed keyword inside a directory recursively.

Query RPM packages easily

This is a very basic query script (http://groups.google.com/group/pawan-kumar-group/web/pkrpm?hl=en) to get information about an installed RPM package in OS supporting Redhat Package Manager (RPM).

Change images in WindowMaker

It is always good to see pictures of your loved ones in the background appearing one after another while working. This python script (http://groups.google.com/group/pawan-kumar-group/web/changeimages?hl=en) gives you the ability to set images on dynamic basis inside windowmaker.