A Developer's Diary

Feb 26, 2009

How to find processes using a file on HPUX

I got the following error while I was trying to remove (forcefully) some of the files on HPUX
"rm: filename not removed. Text file busy"
This was happening as the files were used by one of the running process and were in use.

Use the following command to find out the process using the files.

fuser <filename>


The command displays the pid of the process. You can kill the process using the pid and remove the file successfully.

Read more ...

Dec 25, 2008

Building Apache Log4cxx on Windows

Apache Log4CXX is a logging framework for C++ patterned after Apache log4j.
Read below for sequence of steps for building the software with Visual Studio .NET 2003

1. Download APR 1.3.3 and extract it. Rename to apr
2. Download APR Util 1.3.3 and extract it. Rename to apr-util
3. Download Log4CXX 0.10.0 and extract it
4. Enter directory apache-log4cxx-0.10.0
5. Execute configure.bat
6. Execute configure-aprutil.bat
7. Open the log4cxx.dsw file. When asked to convert the solution, click Yes to All
8. Right click on Solution log4cxx and select Build solution


Read more ...

Jul 15, 2008

Code to check if a number can be expressed in the form 2^n

The bit representation of any number of the form 2^n will have only one field set.
If we do an AND operation with the (number-1) the result is 0
i.e (n & n-1) is 0

The number is of form 2^n if (n & n-1) is 0


Read more ...

May 6, 2008

Installing and Configuring Software/Patches on HPUX

The information on individual patches in a patch bundle can be obtained by using

/usr/sbin/swlist -s /temp/depot_name -l product -a readme patch_name


Patch and software can be installed using the following command. This will open up an interactive interface where you have to select and install the software.

/usr/sbin/swinstall -s /directory/depot –x autoreboot=true

Read more ...

Apr 4, 2008

Java - Debugging In Tomcat 5.5

Steps to be followed to enable debugging in Tomcat 5.5 through Eclipse

Configuring Tomcat
1. Go to configure options in Tomcat5.5
2. Select Tab "Java" and in Java Options add the following lines
-Xdebug
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000

Configuring Eclipse
1. Click on Debug
2. Select Remote Java Application
3. In connection properties add host and Port = 8000
4. Add break point

Happy Debugging :)
Read more ...