A Developer's Diary

Apr 1, 2009

Glass Of Water Theory of Stress Management

A lecturer, when explaining stress management to an audience, raised a glass of water and asked, "How heavy is this glass of water?"

Answers called out ranged from 8 ounces to 20 ounces.


The lecturer replied, "The absolute weight doesn’t matter. It depends on how long you try to hold it. If I hold it for a minute, that’s not a problem. If I hold it for an hour, I’ll have an ache in my right arm. If I hold it for a day, you’ll have to call an ambulance.

In each case, it’s the same weight, but the longer I hold it, the heavier it becomes". He continued, "And that’s the way it is with stress management. If we carry our burdens all the time, sooner or later, as the burden becomes increasingly heavy, we won’t be able to carry on.

As with the glass of water, you have to put it down for a while and rest before holding it again. When we’re refreshed, we can carry on with the burden.

So, before you return home tonight, put the burden of work down. Don’t carry it home. You can pick it up tomorrow. Whatever burdens you’re carrying now, let them down for a moment if you can.

Relax, pick them up later after you’ve rested. Life is short. Enjoy it!

Read more ...

Mar 31, 2009

Advice to young programmers - Alex Stepenov (Principal Scientist, Adobe Systems)

Following is the summary of speech given by Alex Stepenov (Principal Scientist, Adobe Systems) at Adobe India on 30 Nov 2004.


Study , Study and Study
Never ever think that you have acquired all or most of the knowledge which exists in the world. Almost everybody in US at age of 14 and everybody in India at age of 24 starts thinking that he has acquired all the wisdom and knowledge that he needs. This should be strictly avoided.

You should be habituated to studies...exactly in the same way as you are habituated to brushing teeth and taking bath every morning. The habit of study must become a ‘part of your blood’. And the study should be from both the areas: CS, since it is your profession, and something from non-CS...Something which does not relate to your work. This would expand your knowledge in other field too. A regular study, everyday, is extremely essential. It does not matter whether you study of 20 minutes of 2 hours, but consistency is a must.

You should always study basics and fundamentals. There is no point in going for advanced topics. When I was at the age of 24, I wanted to do PhD in program verification, though I was not able to understand anything from that. The basic reason was that my fundamental concepts were not clear. Studying 'Algebraic Geometry’ is useless if you do not understand basics in Algebra and Geometry. Also, you should always go back and reread and re-iterate over the fundamental concepts.
What is the exact definition of ‘fundamental’? The stuff which is around for a while and which forms basic part of the concepts can be regarded as more fundamental. Of course, everybody understands what a fundamental means.


Read more ...

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 ...