My 2x estimation rule

Estimation is an important part of software development and its incredibly difficult to make correct estimation. Over the time, I have realized that on most occasions my estimates were very aggressive despite keeping some buffer time.

Then one day I decided to try out something new. I divided the feature in small tasks and then made best case estimates. Then I added all the individual estimates and multiplied it by two.

This has worked pretty well for me. Still sometimes I run out of time and have to work late night 🙂

Image Source: http://blog.jr0cket.co.uk/2010/08/my-favourite-estimation-technique.html

disabling output buffer from python scripts

Today I encountered a weird problem while running a python script with nohup. I was not getting anything in the output file even after waiting for 2-3 minutes which was unusual as I have used nohup on countless occasions with bash scripts and had not seen this issue.

Python itself buffers stdout and stderr which was causing this issue. So you have to explicitly disable buffering when you execute python scripts with nohup.

$nohup python -u script.py

With -u parameter python will disable the buffering and you will get all the outputs as it happens.

WFH

After a brief stint at Mountain View, I came back to Bangalore and have been working from home since then. Working from home (rather from a remote location for me, since rest of my team is on the other half of the world) has its own advantages and disadvantages. I am listing down some of the things that I have noticed about myself.

Pros:

  • You have the liberty of choosing when you want to work.
  • There is nobody to look at what and when you work. It has its own disadvantages.
  • You have time for everything as you save the extra 1.5 to 2 hours of daily commute time. If you live in Bangalore you know how difficult it is to travel during work hours.
  • Have been cooking regularly, and trying out new dishes. Have been looking at lot of cookery videos on youtube. Sometimes I feel as if I have landed in wrong profession 😛

Cons:

  • Since I am living alone in my flat, at times I feel the need to talk to people. Have been bugging my friends every now and then.
  • Its difficult to concentrate on work.
  • Collaborating on things become difficult as you don’t get to discuss things on paper or whiteboard.

Anyways its temporary since my team will be back by March. Also we will be looking for office space soon, if you happen to know any startup friendly place in IndiraNagar or Koramangala let me know.

My desk

This is my desk.

DSC_0475

So what do we have here:

  • Lenovo Thinkpad T530
  • Dell H2312HM Monitor
  • Microsoft Ergonomic 4000 Keyboard
  • 3M Ergonomic mouse
  • Apple Mini Displayport to DVi Adapter
  • Creative 2.1 Speaker system (not visible in the pic)

All the products are from different vendors. I had not noticed this until I took this pic.

Real time notifications for web applications using nodejs, socket.io and redis pubsub

Recently I was working on a real time workflow for a module. I found it really difficult to find good tutorial for the same. I struggled with Flask, gevents and lot of other things and finally settled down to nodejs and socket.io and redis pubsub.

I have written a tutorial for the same https://github.com/roshansingh/realtime-notifications.

The beauty of nodejs is that everything was accomplished in less than 50 lines of code :). Read it and let me know if you have any feedback.

 

Getting middle button of 3M ergonomic mouse to work

Yes that is a mouse. I use this at work.

3M-Ergonomic-Mouse_1

But the default configurations did not let me use the middle button. I wanted to use it for scrolling. So I had to add some custom settings to X.

Before we begin, we need to know the device name:

# hal-find-by-capability --capability "input.mouse"

/org/freedesktop/Hal/devices/usb_device_4b4_60_noserial_if0_logicaldev_input

Then get the product name by

hal-get-property --udi "/org/freedesktop/Hal/devices/usb_device_4b4_60_noserial_if0_logicaldev_input" --key "info.product"

Areson USB Device

On an ubuntu system you need to create a file at /usr/share/X11/xorg.conf.d/42-middle-mouse-scrolling.conf with the following contents:


Section "InputClass"
    Identifier "Middle Mouse Button Scrolling"
    MatchProduct "Areson USB Device"
    MatchDevicePath "/dev/input/event*"
    Option "EmulateWheel" "true"
    Option "EmulateWheelButton" "2"
    Option "XAxisMapping" "6 7"
    Option "YAxisMapping" "4 5"
EndSection

Then restart X or reboot.

Original Source: http://www.conrad.id.au/2011/08/middle-mouse-button-scrolling-on-linux.html

Some useful tips for life

I had taken a break from studies to prepare for Engineering entrance examinations in Delhi. I was at one of the best coaching centers at Delhi (I am not taking their name as this post is not about them). I met some of the best teachers in my life there. Other than regular stuff they taught me I learned some skills which I will use for my entire life.

There was a Physics teacher who was also an M.Tech from a premier institute. He taught me what to aim for in life and how to motivate yourself to reach there. I still use it to keep myself focused when I am feeling low or struggling with something.

Motivation tip: Whenever you are doing things think about the reasons for doing it. Doing it for yourself or money you may not motivate you. Think about how proud people around you (like your family or other loved ones) will feel when you complete it or how it will benefit their lives.

For the same reason you can’t keep on working just for the sake of earning money.

And there was an amazing mathematics teacher who taught me time management skills. This was really useful then and even after several years if I follow this I can get my work done. This tip also helps you measure your capacity.

Time management tip: Plan before, plan small. When you lie down on bed for sleeping at night think about what you are going to finish tomorrow. Most important thing is to plan small so that you can get it done no matter what. Never give yourself excuses for not getting it done.

He also taught me a concentration tip. I can not concentrate for more than 10 minutes. Even now while attending meetings I lose concentration and am usually clueless about the results of the meetings when I come out of meeting room :P.  My mind starts roaming around the entire world after 10 minutes.

Concentration tip: Close your eyes and try to roll your eyes upwards (till you are comfortable) for 5-10 seconds. The idea is to roll your eyes up, relax and not to think about anything. After 10 seconds magically your brain is blank and you have cleared all the random thoughts and you can start doing your work again.

The chemistry teacher was equally good and he also used to give useful tips from time to time though I do not remember them now.

That drop year was a real life opener for me, and I am glad that I took that break. I realized a lot of things about myself. One of the many reasons could be that for entire one year I was away from my home. I was also a pampered kid at home as I was good at studies, and usually escaped scoldings at home.

I hope some of these tips benefit you.

Jab Tak Hai Jaan – Poem

This is the poem from the movie “Jab Tak Hai Jaan”. I have been listening to this song on loop for a few days. Lyrics and the music both are just perfect.

Teri aankhon ki namkeen mastiyan
Teri hansi ki beparwaah gustakhiyaan
Teri zulfon ki leharaati angdaiyaan
Nahi bhoolunga main
Jab tak hai jaan, jab tak hai jaan

Tera haath se haath chhodna
Tera saayon se rukh modna
Tera palat ke phir na dekhna
Nahin maaf karunga main
Jab tak hai jaan, jab tak hai jaan

Baarishon mein bedhadak tere naachne se
Baat baat pe bewajah tere roothne se
Chhoti chhoti teri bachkani badmashiyon se
Mohabbat karunga main
Jab tak hai jaan, jab tak hai jaan..

Tere jhoothe kasme vaadon se
Tere jalte sulagte khwabon se
Teri be-raham duaaon se
Nafrat karunga main
Jab tak hai jaan, jab tak hai jaan

Source: http://www.lyricsmint.com/2012/09/jab-tak-hai-jaan-gulzar.html

Adding a youtube video. Enjoy 🙂

Personalizing GNOME and Unity

I have used GNOME 3 for quite some time now. Of late the shell started to crash a lot, so I switched to Unity. I usually hate dark themes, I like bright desktop and larger fonts so that my eyes don’t get strained. It is great that people have so many useful gui tools for these things. These are my personal favorites:

  • gnome-tweak-tool – Good for changing themes and font, adding removing shell extensions. It can also be used to customize buttons(minimize, maximize, close) on title bar. I am still old school and I like all the buttons there.
  • gconf-editor – This is an advanced tool. Before you start be exactly sure about what you are doing. You can configure most of the gnome behaviour using this.
  • gnome-color-chooser – This lets you choose the various color schemes. This was particularly useful in my case as I hate white on black, and the default ubuntu has white on black for eclipse tooltips which is really annoying for me.
  • CompizConfig Settings Manager(ccsm) – You can use this to configure Unity hot-keys. I have changed the hot key for Unity launcher from super key (windows key) to super-z as I wanted to use super-c and super-v for copy paste on my terminal.
  • Gnome-Terminal – This comes with its own options for personalizing it. I use profile preferences to change the font and the color schemes. I use Monaco font. Also I have changed the copy and paste shortcut. Pressing 3 keys is cumbersome and that too when you have to do it so many times.

In the process if you screw up your system simply log out, and log in to the shell using Alt+Ctlr+F1 and delete .gnome. .gnome2. Sometimes you may have to delete .local and .config depending on what you have modified. After that press Alt+Clrl+F7 to log back in.