Tuesday, May 30, 2017

Bhujia Barons: The Untold Story of How Haldiram Built a Rs 5000-crore EmpireBhujia Barons: The Untold Story of How Haldiram Built a Rs 5000-crore Empire by Pavitra Kumar
My rating: 3 of 5 stars

Does a good job at describing the start of the Haldiram Empire. The struggle of Haldiram is insightful. But then the book looses its way and becomes a commentary on the legal fights between the various branches of Haldiram family. Dis-coherent at times, the book started of well and ended up in a heap of mess.

View all my reviews

Monday, July 9, 2012

Tip: traversing arrays in C-Shell

Below I have described two methods to traverse arrays in C-Shell - one uses the foreach loop and other while loop.
In both cases, the important thing to note is that array index in C-shell starts with '1' instead of '0' as in most programming languages, like C, C++, Java, Perl.


set a = (1 2 3 4)
set b = (5 6 7 8)
 

Method 1 - using the foreach loop, iterating on one array as the foreach index, and the accessing the other array inside the loop body using the index operator "[]"
set i = 1
foreach x ( `echo $a` )
  echo "x = $x b = $b[$i]"
  @ i = $i + 1
end
 

Output: 
x = 1 b = 5
x = 2 b = 6
x = 3 b = 7
x = 4 b = 8

Method 2 - using the while loop. Iterating on the size of array and accessing both the arrays inside the loop body using the index operator "[]"


set i = 1
while ($i <= 4)
  echo "a = $a[$i] b = $b[$i]"
  @ i = $i + 1
end
 

Output:
a = 1 b = 5
a = 2 b = 6
a = 3 b = 7
a = 4 b = 8




Wednesday, February 15, 2012

gdb stops at SIGPIPE



By default, gdb captures SIGPIPE of a process and pauses it. However, some program ignores SIGPIPE. So, the default behavour of gdb is not desired when debugging those program. To avoid gdb stopping in SIGPIPE, use the folloing command in gdb:

handle SIGPIPE nostop noprint pass

Wednesday, November 2, 2011

Parenting

Interesting insight on this blog entry in Freakonimics - http://freakonomics.blogs.nytimes.com/2010/07/07/the-paradox-of-parenting/
The crux is that parent's don't seem to enjoy parenting is a strange conclusion made by almost all studies in this field. I am not sure I fully subscribe to this theory as I oscillate between happiness and despair when parenting. Maybe its more despair than happiness, but one thing I am sure about it is that happiness definitely has a longer lasting effect than despair.

Accomplishment is important

Not losing focus is the key. It’s about switching your focus from quantity to quality, and making sure that you use your productivity for a greater good: reaching your goals. Wonderful insights at http://workawesome.com/productivity/being-productive/

Tips for remembering and organizing ideas

Use a pocket recorder and record the thoughts. Musicians do it all the time.