Saturday, December 12, 2015

Conference: Sales for startups

This time around, I decided to go for NSRCEL's live streaming option via UStream, rather than lose 2 hours of travel time toward IIM-B and back. Turned out that actually going there would have been better. Streaming connectivity was very poor. On the up-side, there was a lot of knowledge I could gather anyway (as you see below), it saved some travel time and I could type my notes into my computer in real-time.

Today's session by Prof.Ramesh Venkateswaran was what I believe is one of the most important lessons that a CEO or a sales and marketing person should learn about business.

Perception vs reality

In tennis, Goran Vanesevic of 2001 Wimbeldon was a wildcard entry and there was just a 4 point difference when he beat Patrick Rafter. 4 points out of 304 points!
When you are talking about world class competition, there is no virtually no difference between you and your competition.
The international competition difference between top brands is 0.001% when you compare them in terms of price and features.

When a consumer looks at alternatives, they have pretty much the same choice everywhere. Rewards are not linked to your companies capability or potential. Whether it's a billion dollar company or a small one, there is no difference to a customer. It's a commodity world. You have to survive and succeed in this market. But we still think "this does not apply to me".

Example: In order to buy car worth Rs.6 lakh, you'd expect people to take a rational decision. The professor created a chart to compare cars of that price range, and he was surprised that the difference between cars of that price range was just 1%.
He asked an acquaintance what made her buy her Ford Accent at that price. The answer he received was shocking and was a revelation into how the consumer thinks. She said "We bought the car because it had very cute headlights and because the salesman was damn nice".

That is the reality of business. 1.8 billion of research that went into the car and a grand announcement of launching the car on the same day in India and Germany, was all ignored by a customer who just went by the niceness of the salesman!

Technology has changed our lives but it is now just one more thing in our life. Commodities have been "technologized".
The professor showed us an ad of Sony Vaio being endorsed by Kareena Kapoor (actress). The ad just showed the laptop being available in different colours. No mention of any of the features that the tech guys at Sony would have worked so hard at.

What do you think this ad is about?

No, it's not about an air hostess training institution or about pens or about hospitality services or about nurses.

It's about a dot-matrix printer!!!

This is the market. This is the world today. It doesn't matter what you are doing. You need to keep customers happy and sales people are a necessary evil. Think of what can you do to make your customer's life simple. That's it. You really don't need any of the business concepts or jargon you learn in classes.
Today tech companies are like commodities and simple consumer items and commodities are like tech products.

Ultimately, whichever way you look, the customer is just buying a commodity. How do you survive? Why should a customer choose A vs B. You must have prod quality. Without that you can't succeed.

If you have product quality success is not necessarily guaranteed. If you don't have it failure is guaranteed. What makes the difference?
It's happy customers? Experience makes them happy. Experience is about everything the person goes through when they come in contact with your company.

Amazon CEO says: Today customer experience is everything (70%). Advertisement's are about visibility, but that is only 30%. You don't build a brand by advertising. It's customer experience that builds the brand. Nothing kills a bad product better than good advertising. we are in a world where every idea has already been thought of. It's difficult to be different.
"Customer's trust" is a result of a hundred things, and not the starting point to make a customer happy.

So how to you deliver a good customer experience?
It's simple: What can I do to make the customers life easier? This is your competitive advantage. For B2B, it is in making the business more competitive.

Experience is everything I go through, right from the time I get to know about your product to the time I dispose of it. It's not always about using the product.

Product strategy

Involves every element of the interaction of the customer and product.
50% people say they stopped doing business with a company because of poor customer service.
86% customers stopped doing business with a company because of bad experience.

The challenge
  • How do we stand out?
  • Why should the customer choose me?

Some examples

Indian railways example

The professor had always wanted to travel in 1st class AC in Rajdhani. It was more than the air-fare, but one day he decided to travel from Delhi. The coach was tiny and not inviting at all. This set him thinking:

Who is Rajdhani's competitor?
The airlines. So you'd expect certain minimum things in the train, as an airline customer. This was a bad customer experience.

Who is responsible for it?
It's the designers of the train. Not the coach attendant.

The coach attendant cannot do anything about it because of the way it has been designed right from the beginning. You cannot do anything downstream if you do not build experience into the product design. This kind of design-thinking is what Steve Jobs did very well.

Massage parlour example

The professor loves massages. He looked up some numbers on the internet (JustDial) and called up GreenTrends massage parlour on a mobile number at 9:15am. Nobody took the call and nobody called back. Meanwhile, a Malayali named Ganesh (from another massage parlour) calls asking if he was looking for a massage, and gives him an address. At 12pm again, Ganesh calls up to remind him of his appointment. Until now Green Trends hasn't called back.

The professor went for a massage to Ganesh's place for Rs.1200, and after the massage the person offered him some more suggestions and eventually, the professor came out spending out Rs.15000. The professor being a Palghat Iyyer, he says it's very difficult to make him part with money. But still, he spent Rs.15000.

Ganesh's sales pitch did that. He extracted out that much money and the customer was happy. In a place where there are so many other massage parlours, he grabbed an opportunity which wasn't even there for him. GreenTrends on the other hand, lost a lifetime customer. Customers aren't going to come and tell you "please take my money".

Taxi driver example

This is about a commodity called "a taxi". A taxi driver (Sheikh Ahmed) once just offered a taxi ride to the professor. An illiterate guy without a website or much of technology knowledge. What he did provide, was a very reliable taxi service with SMS'es at every stage of engagement with the customer.

The engagement SMS'es:
  • Will be at airport at xyz time
  • Am waiting at entrance
  • Will be at residence tomorrow morning at xyz time
  • Will wake you up at xyx time
  • Picked up your guest. On our way
  • Happy Diwali
  • This is to inform you effective.. taxi fares are going up...
  • Wake up call

He just used a phone to create a reliable service for the professor and he's always on time. Now the professor's whole community uses Sheikh Ahmed.
If you calculate the lifetime value of customer that Sheikh Ahemed has got, you'll notice that he has knocked off more money than the massage parlour guy, and customers are happy!

This is how you look at sales and opportunities.

India post example

There was a letter delivered to the professor, and the envelope just has his name and the pin code mentioned on it. Nothing more than that. The postman does not know him either.
The post office department had every reason and were completely justified to throw that letter into the waste-paper bin, but they didn't. They ensured that it got delivered.
Why did the postman deliver the letter? Does he get a promotion or ESOP or increment? No. He gets kicked around and walks all over the place.
He delivered the letter because it's important for him. Not because it's important to his boss or market share.
Do it to make the customer happy. Not for your annual report or for anything else.

The letter above was one delivered to the professor's wife, and it had the wrong address mentioned on it. See the number of seals on the letter. Would any private company have gone through so much of trouble to get it delivered? If you want business, this is what you should do. It's not about attending sales conferences and networking. You need to want to do everything for the customer, and do it happily.

We deal with a business of dealing with human beings. Sheikh Ahmed the taxi driver had used CRM to the ultimate advantage with just an SMS.

A man without a smile should not open a shop. 

The professor advises that if you are a techie nerd, stick to your computer and stay away from the customer.

Customer response

At your doorstep, when you see a sales person wearing a tie on a Sunday morning. What do you say?

You say: "Whatever you are here to sell, I don't want it". *slams door*

As a sales person, you realize the world doesn't see things the way you do; and then you say "customers are idiots". For some sales people, the customer is a terrible person. You don't see that you are also a customer to someone else. Although when you are a customer, all you see are lousy sales people.

The customers job is not to create hassles for you. The customer wants to solve some problem of his. If you are not contributing to it, you aren't adding value.

Here's a new marketing concept: People aren't buying products. They are buying solutions: What does your product do for me?

It's also about access. Access is not about just delivering. It's about information too. People are not buying price. They will buy only when they see value. Price is about fact. Value is about perception. Facts contribute toward building perception.

What is your job in communicating with the customer? Today the word is "education". Educating the customer with solutions, access, value propositions and promotions.

Jeff Bezos created a practice in Amazon that every time a new feature is proposed by an employee, the narrative should take the shape of a mock press release. The goal was to get employees to distill a pitch into its purest essence to start from something the customer might see.

The professor says historical case studies are useless, because what worked for someone under certain conditions, might not work out for you.
The challenge for startups is to test your product out. Identify target people. People who are willing to try new things and willing to listen to you.
Your job is to shoot the target. Simple. Large companies take an AK-47 and keep shooting randomly. A startup should aim carefully because the bullets are limited and we never get to see the full picture.


What is value? When do you say something or someone has value?
How do you operationalize these in a sales call?

A customer believes that they have got value when they have got more than what they have given. The job of a sales person is to make the customer believe that.  

There are tangible and intangible aspects to it.
  • Ego
  • Risk
  • Uncertainty
  • Brand
In today’s world there are a huge number of things to be taken into account.

Value: Shirt purchase example

Let's say you are buying a shirt. When you're quality conscious and brand loyal. When you go to a store and the sales people are joking and chatting with each other and they just point you to a shirt and continue with their chatting, what will you do? You will walk out.
You walk out because you can still get a shirt of that brand from another store. The customer is not losing anything. You go to a few more showrooms, and you go through the same experience.

At this point of time, what exactly is ticking you off?
Behaviour and respect.

Why does it matter if they didn't behave properly? If you think rationally, you'll realize you just went to buy a shirt and you could have bought it without the sales-person's help.

When you're satisfying needs, there is a physical and psychological need to be satisfied. You are paying Rs.2000, not just for the shirt but also for the respect. People at a minimum want to feel important and respected.
That's why the lady paid Rs.6 lakh for the nice car salesman. That's what the Ayurveda massage parlour person and the cab driver did. They made their customer feel important.

Cash, risk and uncertainty are what the customer is giving. You have to be able to measure that.

To put it simply...

...there's the product and the customer.

That's not enough. The product has to fill the customer need fully.

But in the real world, only a part of the circles overlap.

And the professor says that's not value. Not yet.

The next definition of selling: I will be successful in sale if I either get the product to do what the customer wants or to get the customer to want it. Without this minimum condition, you don't make the sale.

The reality in life is that there is a competitor.

The competitor adds some value to the customer too. Points "A" and "B" are points of differentiation. The overlap "C" is called a point of parity and not differentiation. Parity won't add value. Differentiation won't add value.

The customer will buy from you only when "A" is larger than "B". This is the fundamental of value.

The point you want to remember:

Value is never in isolation. It's relative to something else. If you don't know what the 'something else' is, you can't create value.

Our sales job objective should be to make "A" much much bigger than "B".


No manager goes out with the intention of failure. But 95% of them fail because there was something unpredictable.

Focus your startup's energy in getting the potential target audience. You can't afford to waste energy in blindly shooting widely and hoping there would be customers.

You may be different but not be a differentiator. The customer sees a differentiator.

Use technology to deliver outstanding customer experience to build relationships and loyalty. use technology for the sake of technology and use it sensibly.

Final objective
The professor showed us a video of a baby on a swing. Whenever the swing moved forward, the baby could see the McDonald's logo through a window, and the baby smiled. When the swing swung backward, the baby could not see the logo and the baby cried briefly until he could see the logo again.
Your final objective is to make the customer to cry (like that baby) when your company is not there to fulfil their task. The services you provide should be so good that they should want to use the services of your company so badly.

The ultimate test of your customer
We were shown a video where a boy goes to a vending machine, inserts a coin into a slot that's just within his reach, to get a Coca-cola can. Then inserts another coin to get another Coca-cola can.
He then keeps both Coca-cola cans on the ground, stands on them to be able to reach a higher coin-slot on the machine, which is for Pepsi. He inserts a coin into the slot, gets a Pepsi and walks away with the Pepsi, and ignores the Coca-cola cans.

More from NRecursions, on startups:

Fixing the Grub boot options if your Linux installation does not see the Windows installation

A colleague and another experienced colleague had trouble installing Linux on a machine because Windows wasn't being recognized after Linux installation. The department head as usual, recommended me to them, as the go-to guy when others couldn't solve it either.

This problem was new to me. I had never had any problem with a dual-boot system. First install Windows, and then Linux. Grub would always show Windows as one of the boot options.
But here, after installing Linux, only the Linux boot options were shown. At first all of us thought that all hope was lost, and we'd have to reinstall Windows and settle for a lower version of Linux which would recognize the Windows partition.

A bit of searching showed me that all that actually had to be done, was to point Grub to the Windows partition.

The technique
  • First, login to Linux.
  • Open a terminal and use "su" to login as root user.
  • Type "cfdisk". This will show you all the partitions available, including the Windows partition.
  • At the left of the cfdisk output, you'll see "boot". Take note of the partition name which is on the same line. It might either be "sda1" or "sda2".
  • Open the Grub config file with "vi /boot/grub2/grub.cfg".
  • You'll see some lines which say "menuentry". Above one such "menuentry", add a menuentry for Windows, like this:

    menuentry "WINDOWS"{
    set root='(hd0, msdos1)'
    chainloader +1

This is if  the partition name you saw near the "boot" flag was /dev/sda1.
If it was /dev/sda2 you saw, then change the "msdos1" text to "msdos2".
Then type "grub2-mkconfig" to finalize your changes.
Reboot the system, and you'll find Windows also as a boot option!!!

p.s: When the system boots, if you want a more fancy name instead of just "Windows" in the Grub menu, you can change the "WINDOWS" text in the above code to make it "Navin's awesome Windows OS" or something like that.

The wish for a better bootloader

For a long time, I have wished that boot-loaders would be more reliable. If a person installs five different operating systems on five different partitions of the same hard disk, is it so hard to create a third-party boot-loader which is on a separate tiny partition, and able to recognize all five OS'es without even being told that there are OS'es on each partition? It would have been such a boon to have such a boot-loader which would automatically create the menu for us.
I even asked on SuperUser and got two upvotes but no response:

Thursday, December 3, 2015

Donating to every cause is impractical

People were in urgent need for help, some NGO's decided to help and they needed your help! Money, clothes, books, food....whatever you could give. It was urgent! People were suffering and you had a big heart.

No sooner that the donation drive was over, another request for donations came up. And then another one. Phew! Exhausting, isn't it?

What should one do when confronted with multiple genuine charity requests and are posed with these questions?

It’s not practical to donate to every cause.  Requests will keep coming. Choose which ones you are comfortable donating to and try to be consistent to those.

Nonsense. Don’t let anyone guilt-trip you. Let donations be a genuine wish to help. Identify the need and donate what you are comfortable with donating.

That’s why we donate together. Rs.10 donated by 1 lakh people is not small.

Very important. It’s better to see the bigger picture and create sustainability rather than keep donating, but there are always situations where immediate aid is more urgent. Select reliable people and NGO’s.

Donations to a cause are decided from the heart. A genuine feeling of caring and wanting to help. Let donations be about that feeling, and not about how much is donated or who donated or how many people donated how often or a competition of who donated the most.

It’s about sustaining a culture where we know that we are there for each other.


More on Volunteering

Sunday, November 29, 2015


 Continued from the previous Aha!.

Ameteur activists
Share with this link

Continued in the next Aha!

Saturday, November 7, 2015

Get through the certificate problems which show "This connection is untrusted"

At some places, the SSL security certificates used, don't get recognized properly and users are put through the hassle of adding an exception an innumerable number of times to connect to perfectly valid websites. This is the screen you get to see on Firefox:

Instead of always clicking the "Add Exception" button, I searched if there was something I could use to get rid of this error. Turned out that Firefox had an addon named SkipCert which automatically adds the exception and in a few seconds, you'll be taken to the website you wanted to view.

Get the addon here:

As for Chrome, these appear to be the solutions:

Using TBB's concurrent containers

When searching for a tutorial on TBB's concurrent containers, you might end up finding a 1 minute video on it which doesn't play because you don't have Flash installed, or might just want a tiny program to show how to start using it. This blog post shows you exactly that!

You can use a TBB concurrent vector exactly like you use an std::vector.

#include <iostream>
#include <tbb/concurrent_vector.h>

int main(int argc, char** argv)
    tbb::concurrent_vector vec;
    tbb::concurrent_vector::iterator vecIter;
    for(vecIter = vec.begin(); vecIter != vec.end(); vecIter++)
       std::cout<< *vecIter << "\n";
    return 0;

Just make sure you

  • Include TBB's includes folder (/usr/local/tbb44_20150728oss/include/)
  • Point the project to TBB's lib folder (/usr/local/tbb44_20150728oss/lib/ia32/gcc4.4/
  • Add TBB's lib folder to LD_LIBRARY_PATH in ~/.bashrc. (export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/tbb44_20150728oss/lib/ia32/gcc4.4/")

For concurrent queue, the pop function is different.

#include <iostream>
#include <tbb/concurrent_queue.h>

int main()
    tbb::concurrent_queue q;
    q.try_pop();//This is thread safe. Better than using if (!q.empty()) {q.pop();}

A C++ debugging helper

When working with C++ and you're in debug mode, you might be accustomed to these:
  • Using a lot of std::cout statements
  • Seeing a lot of such output to the terminal
  • Introducing a lot of temporary code which you don't want to be part of the final build
  • Commenting out useful code which you don't want others to delete later because it's useful

and more...

In such situations, it helps to have an hpp file which you can include wherever you like, and it will provide you a lot of #define options for conditional compilation. When you are ready to release, just comment out these #define's and the changes will be applied all over your project automatically.

Checkout these...

/* Include this hpp file in any file where you need to output
 * cerr or cout. The advantage of using this file is that if you
 * just comment out the "define DEBUG" line, then all the places
 * where you used "op" to output cout's and "err" to output cerr's,
 * will become inactive. ie: They won't output anything. Keeps the 
 * code clean and efficient.
 * Usage: In your code, instead of typing std::cout<<"Hi";
 * Just type cout("Hi");
 * Same way, instead of std::cerr<<"Error"; just type cerr("Error");


#define DEBUG_MODE


    //Colour code by Vaughan Schmidt.
    #define RESET   "\033[0m"
    #define BLACK   "\033[30m"      // Black
    #define RED     "\033[31m"      // Red
    #define GREEN   "\033[32m"      // Green
    #define YELLOW  "\033[33m"      // Yellow
    #define BLUE    "\033[34m"      // Blue
    #define MAGENTA "\033[35m"      // Magenta
    #define CYAN    "\033[36m"      // Cyan
    #define WHITE   "\033[37m"      // White
    #define BOLDBLACK   "\033[1m\033[30m"      // Bold Black
    #define BOLDRED     "\033[1m\033[31m"      // Bold Red
    #define BOLDGREEN   "\033[1m\033[32m"      // Bold Green
    #define BOLDYELLOW  "\033[1m\033[33m"      // Bold Yellow
    #define BOLDBLUE    "\033[1m\033[34m"      // Bold Blue
    #define BOLDMAGENTA "\033[1m\033[35m"      // Bold Magenta
    #define BOLDCYAN    "\033[1m\033[36m"      // Bold Cyan
    #define BOLDWHITE   "\033[1m\033[37m"      // Bold White
    #define CLEAR "\033[2J"  // clear screen escape code
    #define coutBlack(x) (std::cout << BLACK << (x) << RESET)
    #define coutBoldBlack(x) (std::cout << BOLDBLACK << (x) << RESET)
    #define coutRed(x) (std::cout << RED << (x) << RESET)
    #define coutBoldRed(x) (std::cout << BOLDRED << (x) << RESET)
    #define coutGreen(x) (std::cout << GREEN << (x) << RESET)
    #define coutBoldGreen(x) (std::cout << BOLDGREEN << (x) << RESET)
    #define coutYellow(x) (std::cout << YELLOW << (x) << RESET)
    #define coutBoldYellow(x) (std::cout << BOLDYELLOW << (x) << RESET)
    #define coutBlue(x) (std::cout << BLUE << (x) << RESET)
    #define coutBoldBlue(x) (std::cout << BOLDBLUE << (x) << RESET)
    #define coutMagenta(x) (std::cout << MAGENTA << (x) << RESET)
    #define coutBoldMagenta(x) (std::cout << BOLDMAGENTA << (x) << RESET)
    #define coutCyan(x) (std::cout << CYAN << (x) << RESET)
    #define coutBoldCyan(x) (std::cout << BOLDCYAN << (x) << RESET)
    #define coutWhite(x) (std::cout << WHITE << (x) << RESET)
    #define coutBoldWhite(x) (std::cout << BOLDWHITE << (x) << RESET)   

    #define cerr(x) (std::cerr << (x))
    #define cout(x) (std::cout << (x))
    //... etc
    #define cerr(x)
    #define cout(x)
    //... etc


Not only are the cout's easier to type now, they are also easy to disable.

Sunday, October 25, 2015


 Continued from the previous Aha!.

Brace yourselves!
Share with this link

Continued in the next Aha!

Wednesday, October 14, 2015

Do recruiters still need to ask for resume / CV printouts?

In a digitized world, it is quite a paradox that companies still require interviewees to bring a printout of their resume or interview invite email.

If the phrase"save trees" makes you roll your eyes, then please feel free to stop reading. The rest of this blog post requires a more creative and inventive mind to interpret it.

Why in the world would you require printouts?

For one, your company conducts hundreds of interviews. Assume a company conducting just 100 interviews per quarter.
  • That's 100 * 3 sheets of paper on average * 4 quarters a year = 1200 pages.
  • For 3000 companies in a city, that's = 1200 * 3000 = 3.6 million pages a year!!! With that much of paper, you can make 293.49 copies of the Indian Constitution. The bulkiest constitution in the world! As for cost, that'd be 7.2 million Indian Rupees.
  • And terms of trees, that's 432 of them.
  • On top of that, you also want candidates to carry a printout of the interview call email?
  • Some companies even expect candidates to carry and submit photocopies of their marks card and resume even if they have not yet been selected by the interviewer (when you ask a candidate to submit exactly the same details a million times, it's a sign that your recruitment process is messed up. Ever heard of referential integrity?).
  • Now add more paper and monotony to the filling up of candidate details on a bunch of forms!

Seriously, HR departments...haven't a single one of you considered moving into the digital age?

What can be done:

  • Give the interviewers a large tablet or even just let them use their work laptops. It is far better than the printouts.
  • Specifically ask the candidate not to bring a printout of anything
  • Candidates can email their resume and scanned copies of other documents.
  • They can bring a copy of the interview call email on their smartphone (a copy of this email is usually asked for by the security guard).
  • If candidates are expected to fill in their details in a form (do you even need a form? Why not fill in details after being selected?), allow them to do it via an online form (perhaps even a day before the interview). You could even create a user friendly form that could be used on a smartphone. Create forms that  can be shared with the candidate on the smartphone via bluetooth (if the candidate does not have connectivity to the internet).
  • If the candidate wishes to share any additional documents, it could be done either via bluetooth or via a pen-drive or rewritable CD/DVD. Make sure you use the pen drive on either a Linux or Mac OS, to avoid those annoying Windows viruses.

Yes, I know you might be a company which has very strict security and device policies. Do understand that these policies and security are meant to prevent sensitive company information from leaking out; not for preventing candidate information from coming into the company.

A creative/inventive mind will always find a way to create facilities and spaces where interviews can still be conducted with a minimal use of paper.
Once you've become digital, shout it out! Let the world know that your department is awesome! Spread the news. It really is time to get out of the feudal age.

No more printouts!!!

If you want to hear the magic word before going digital, here's me saying "Pleeeeeeease!!!".

Wednesday, October 7, 2015

Automation: Script to set up tabs for you in a single terminal and run commands in them

I noticed many colleagues loved opening up multiple tabs in a single bash terminal, setting title names for every tab and running commands in them. They performed this ritual manually every single day.

The first thought that went through my mind was "Hey, why don't we automate the process?". I suggested it to them, but I guess they preferred doing it the old way. So when I had some free time, I did a bit of finding out and created this shell script:

#The ampersand in the end of this file makes sure that the gnome-terminal command is run as a background process. 

echo "Setting up environment"; 

--tab-with-profile=Default --title=TAB1 -e "bash -c \"trap 'bash' 2; clear; ls; exec bash\"" 
--tab-with-profile=Default --title=ANOTHERTAB -e "bash -c \"trap 'bash' 2; clear; ls; pwd; exec bash\"" \

Place this code in an empty file named and use the command 
chmod +x 
to make it an executable file and then run it with

and viola! You have a terminal with multiple tabs! Just replace the "clear;ls" and "clear;ls;pwd" with any other commands of your choice.

The syntax for adding more tabs is:

--tab-with-profile=Default --title=<THE TITLE YOU WANT TO GIVE THE TAB> -e "bash -c \"trap 'bash' 2; <THE BASH COMMANDS YOU WANT TO EXECUTE> ;exec bash\"" \ 

One more thing to do

Having the script is not enough. You'll notice that when you finish running any commands on the terminal, the tab title/name you set, would have gotten reset.
To circumvent this problem, do this:

Go to the Edit menu of the terminal. In Profiles select Default. For the option of When terminal commands set their own titles, select Keep initial title

That's it! Don't stop at this. Keep finding ways to automate tasks and save time!

Sunday, September 20, 2015

How to solve Git merge conflicts using kdiff?

KDiff's windows (or any other three way merge tool's windows) aren't quite so intuitive, so here's some help.

Let's say you've worked on the master branch

and somebody else worked on a "tryingOutSomething" branch

...and you decide to merge that person's changes into your code.

But Git complains that there are merge conflicts!
Turns out the other person was working on the same file you were working on, and also on the same lines.

GitExtensions refers you to KDiff3 to solve the merge conflicts. Select the option to start merging and you see a screen with four sections.

Click image to view larger
The sections from right to left are:

  • Section C: The code of the branch you are going to merge into your branch.
  • Section B: The code of your current branch.
  • Section A: The code that is in the commit which is a common ancestor of B and C. Don't bother about section A. You'd hardly ever use it.
  • Bottom section: It's what your code will look like once you've done the merges and save the file.

You can manually make changes or copy code and paste it into the bottom section like this:

Or, note that the extreme left of the bottom section is segregated into areas where there are merge conflicts and it shows letters A, B, C or m.

Any letters that are there before you started merging, are merges that happened automatically. If that's not what you wanted to merge, then click on the letter in the bottom section and select amongst A, B or C in the toolbar on top.

You can even edit the automatically merged conflicts and choose A, B or C or edit it manually.

That's it. Now just save and exit, and Git will allow you to commit.


You'll see a residual file of the merge, which has a ".orig" extension. Don't commit it. Just delete it.
In case your merging went wrong and Git says "You have not concluded your merge (MERGE_HEAD exists)", then just go into the hidden ".git" folder and delete the files named:
After deleting those files, you'll be able to do the merging again. Do it carefully this time and save and exit.

All the best! :-)

Thursday, September 17, 2015


Today is a little turning point for the LOL pages. They are now "Aha's!!!". Laughing Out Loud is not really what happens when one reads the little jokes I put up here. Aha describes the emotion better. Here we go...

Festival Sale
Share with this link

Continued in the next Aha!.

Saturday, September 12, 2015

It's just about using the Hungarian variable naming convention appropriately

"...and when bmeJames oBond pulled the ftrigger, the sivillian jumped in the mwater."

This is what programmers are put through when reading or writing code in companies where somebody, some-day, misunderstood what the Hungarian notation was actually meant for and created a company policy of naming variables as such.

  • bBusy : boolean
  • chInitial : char
  • cApples : count of items
  • dwLightYears : double word
  • fBusy : float (or flag)

Apps Hungarian is the original Hungarian. Not Systems Hungarian. If your programmers are annoyed with this notation, they are not wrong. See what the creator of C++ and the creator of Linux have to say about Hungarian:

Bjarne Stroustrup:
No I don't recommend 'Hungarian'. I regard 'Hungarian' (embedding an abbreviated version of a type in a variable name) as a technique that can be useful in untyped languages, but is completely unsuitable for a language that supports generic programming and object-oriented programming — both of which emphasize selection of operations based on the type and arguments (known to the language or to the run-time support). In this case, 'building the type of an object into names' simply complicates and minimizes abstraction.
Linus Torvalds:
Encoding the type of a function into the name (so-called Hungarian notation) is brain damaged—the compiler knows the types anyway and can check those, and it only confuses the programmer.

How it all began

It started when Microsoft's chief architect, Dr.Charles Simonyi started it and it came to be known as "Hungarian" because it made variable names look as if they're non-English and also because Dr.Charles is originally from Hungary.
While Microsoft has a respectful article about him, praising how the introduction of the notation helped programmers write better code faster, the adulation could also just be the result of the influence of a powerful person. Given that in the days of the DOS operating system compilers weren't as programmer-friendly, and not being very careful with datatypes could lead to costly bugs when thousands of lines of code were involved, the Hungarian notation could have really helped programmers of that time.

My take on it: The Rudder Notation enhancement

Today's IDE's just need you to hover over a variable to view its type. But inspite of modern IDE's there are people who still find Hungarian useful. It can be useful when maintaining languages which use dynamic typing (JavaScript, for example).

Moreover, although there are various reasons for not using Hungarian, I just need one reason: Readability. We read left to right. Even in the days of DOS OS'es, variables would have been far more readable if the Hungarian notation were used as such:


Keep the type information away from the variable name with a distinct underscore and keep it on the right side of the camel-case variable. Of course, now that it looks exactly like English, you won't be able to call it the Hungarian notation anymore.

I named it the "Rudder notation" because the type information projects out of the name, pretty much like the rudder of a boat or plane, while also performing the function of guiding the developer or code-reviewer.

Are the variables more readable now?
  • Busy_b : boolean
  • Initial_ch : char
  • Apples_c : count of items
  • LightYears_dw : double word
  • Busy_f : float (or flag)

Some people want to use Hungarian because they may some-day take printouts of their code. Really? Then you're very likely doing something very wrong somewhere. Others have written long posts on Hungarian; but really...

...what you need to do, is identify which variables could mistakenly introduce bugs in your code, and apply the Rudder notation to them. This identification is very much dependent on what kind of application you are building, and not on the language or the datatype.

Forming a policy for your programmers to follow by doing a monkey-see-monkey-do of somebody else's Hungarian policy would not just be unwise, it would create a culture where team leads force ideas onto the team without understanding the idea, and cause disgruntlement within teams who don't see the point or value that the policy adds to their work. Instead, educate them to recognize potential problem areas and create a culture where they share this info with each other. Creates a better sense of ownership.


Update: Apparently I'm not the first person to suggest the underscore for Hungarian (but I'm the one who christened it the "Rudder notation"). pointed me to 'experts' who have already encouraged it:

Saturday, August 22, 2015

Empathy is not just human, it is the basis for collaboration and survival

A friend pointed me to a post on Empathy and the Global Corporation. A long well written intriguing post that addressed the growing concern about the "rank and yank" system that apparently works well at Amazon, but hasn't really caught on at other companies (and thus hurt their profitability) because human beings work better when empathised with rather than being treated like robots. Which brings any CEO to the logical conclusion that they actually could replace their employees with robots which would help them save costs and beat the competition, thereby gaining a more loyal customer-base. A customer base (read "you and me") who are equally un-empathetic about others; and wanting the best products and service at the lowest cost.
So in the blame-game, the blame shifts from the cruel CEO's to us.

I've interviewed with Amazon, and although I did see some signs of the uncaring nature, I also did see efficiency and caring. I believe that in every random sample of a human population, you will always find the nurturing as well as the selfishness. It's how the human psyche is built.

But I don't see a decrease in empathy around the world. In fact, empathy is increasing exponentially. There were times in the past where people would direct visually impaired people to walk into a ditch. Times when people would laugh uncontrollably at a mentally challenged person muttering gibberish. Times when people would knock off a person's crutches just to see them struggle to get up again. Times when women were denied basic rights. Times when people would laugh at what they thought was a backward culture.
I see less of that happening now. With better information, education and communication across people and cultures, empathy and understanding has grown manifold. That's why as mentioned in greatbong's article, the HR person asks their superiors “What kind of company do we want to be?”.

A similar line of thought was mentioned to me by my colleague. His teacher said that technology has ruined the world. I disagreed. I asked him: "If technology remained primitive and humans just kept multiplying, then wouldn't forests keep getting destroyed? Won't the water and air continue getting polluted? As humans take over the world, won't they eventually reach a compromise with each other but continue destroying the world?".

The real problem at hand is not technology or profitability.
The problem is population.
Two generations ago, the world was still an ok place to live in. And that was the time that people thought it was ok to have 4 children per family. Before that, people were ok with having 8 or even 14 children per family!!! All those mouths to feed and all those living bodies required the resources of the world.  A problem, one would say was addressed by technology and profitability: Creating more space for humans, packing more animals into smaller areas in farms, building transport systems and factories for mass production and delivery, injecting and spraying veggies and fruits with chemicals.
There were the needs of the population, and they had to be met. When the government can ban cloning and monitor a host of destructive attitudes and technology, then why didn't the government prevent pollution? Why didn't the government make laws that could have saved us all this trouble?

----- digression -----
Did you know that in 1996, General Motors created a beautiful, fast electric car that ran for 90 miles on a single charge? They gave it a trial run with 300 Californians and then took back all the cars and crushed them.

See the video on youtube, where even Tom Hanks expresses how much he loved the car. Some people say it was because there was too much money remaining to be made from selling oil. General Motors says it's because they felt people wouldn't buy a car that expensive. I believe there's also the element of a lot of people losing their jobs because electric cars need neither fuel nor maintenance. It doesn't even have an engine. Just batteries. Countries with high unemployment, also see a rise in crime and riots. Something you'd have faced while playing Caesar-3 :-)

----- end of digression -----

 If the needs of the population aren't met, bigger, unsolvable problems will crop up, leading to a more violent, selfish world. Technology and efficiency can help address these problems. Governments only ban technologies that can cause gross problems, so less-noticeable destructive technologies manage to continue surviving.

Although people fear robots may take our jobs one day and AI would be so dominant that they could take over human civilization, I don't think that's going to happen. Humans are too smart for that.
What we will do instead, is find ways to embed technology into us. We will strengthen our bodies with metal. Add processing power and information access to our brains. Perhaps even entirely replace our bodies with a synthetic material that has our consciousness. Imagine a world where you would never feel hungry. A world where you never fall sick. A world where you could replace a damaged part of your body. Where you could use technology and efficiency to travel to other planets or even create a self-sustaining home in the void of space. Don't discourage efficiency or data or smartness. It helps us take better decisions. And in reality, it helps build more empathy. For as long as we choose to be human, that is.

But even with such a high level of efficiency, would we still give up what it means to be human? It's a question that cannot be answered by a brain that still requires to bond with others or cares for others. But even a machine would eventually figure out "division of labour". The whole reason why a bond exists between anything that is conscious.
History has been witness to the Hemlock Society. An organization that neither accepted the authority of the State nor the authority of Religion. It collapsed. Without the bonding and caring for others, not even an intelligent machine would survive.

For as long as a consciousness wishes to survive, "Empathy" will exist and flourish. Destructive, selfish behaviours will exist in the universe. But that's not an indication of a lack of nurturing and care. For every yin there is a yang.

StackOverflow's 10million+ questions and they are giving away free T-shirts!!! Wait....what???

Stackoverflow recently changed its homepage to say "Stackoverflooooooow". Going a bit deeper revealed they were celebrating the fact that StackOverflow crossed 10 million questions! (I had the impression it'd have crossed 10million a long time ago. Anyway...)

I love StackOverflow and its sister sites. Although I've been active on other forums and the communities are very friendly and helpful, StackOverflow's primary advantage is that it has a LOT of people online and there's a very wide variety of technological help available.
51million users active online per second, is what they claim.
You get detailed, well-researched answers in a voted format with a clean, minimalist interface that not many other forums offer.
StackOverflow also participates in the real world with conferences modeled after Byte magazine which had a diverse range of topics on programming. 


Did you know that StackOverflow was designed with the Gamification concept of online reputation scores and medals? During winter, you can even win hats. They don't really translate into anything, but people want it. And they want it badly!
If you've tried making some work fun by using gamification and it has failed, there's one little thing you need to know:
The game won't work if the people aren't interested in doing the work in the first place.
But StackOverflow thrives! People dedicate hours a day answering questions, moderating and reviewing edits for free! Apparently people who become moderators get a T-shirt, as do those who cross 100K reputation. See the unicorn painting Jon Skeet of Google got when he crossed 200K.

Back to the 10million

If you tweet #SOreadytohelp or include it in your profile, you stand to get one of the 100 T-shirts (only?) that will be distributed to any random StackOverflow member over the next 4 weeks.

People are already excited...about the t-shirt....
Really? Excited about a t-shirt? Come on! 
How difficult would it be to create the StackOverflow logo in an image or icon editor, purchase a black t-shirt yourself and get the logo printed on it?
Apparently StackOverflow sends the selected person a Google Form where they an enter their address, and the t-shirt gets sent.

One would assume StackOverflow's funders would do something a bit more generous for its moderators and top contributors.
  • A little vacation to Hawaii perhaps?
  • or a meeting with some of the top celibrities in the programming world?
  • or a gift of some of the coolest gadgets the world knows of?
  • or a couple of adrenaline filled sky-diving jumps?
A 10 millionth celebration could've been that much cooler!

Anyway...keep up the good work, Joel and team!

Tuesday, August 18, 2015


Continued from the previous LOL page

Share with this link

Share with this link

Continued in the new Aha page.

Monday, August 17, 2015

Transfer data between two local PC's using an Ethernet (LAN) cable

Some people recommend buying a USB data transfer cable to transfer data between two computers.
No need.

A LAN cable can transfer data at a much higher rate. Let's assume you want to transfer data from your desktop PC to your laptop.

On your PC
To start, disconnect your PC's LAN cable from the modem's ethernet port and connect it to the laptop's ethernet port.
Now when you open up a command prompt on your PC and type "ipconfig" (without the quotes), you'll see a strange autoconfig IP. Ignore that.

Restart the PC, and you'll get a proper IP assigned.

Note down this IP address. ie: the one you see in the pic: "192.168.1.x". You'll have to enter this IP address into your laptop.

On your laptop

Open up Control Panel > Network and Sharing Center.
Click on "Ethernet"

Click "Properties"

Select "Internet Protocol Version 4"

Specify the IP address you noted down from the PC.

Now create a new folder on the laptop and name it whatever you like. I named it "shared".
Right click on the folder, goto "Properties" and select the "Sharing" tab.
Choose the people to share the folder with, and add "Everyone" to it (just for now).
Give "Everyone" read and write permission.

You'll be shown a message that the folder is shared, and you'll be shown a path through which you can access the folder too (the part that I've shown smudged below, which is "\\computerName\shared".

Now all you have to do is open up Windows Explorer on your PC and in the address bar, type the path you saw on the laptop:


...and you'll be able to see the contents of the laptop's folder. Now you can cut/copy/paste files in the shared folder and you'll be able to access it from the PC as well as the laptop.

Enjoy your high speed data transfer. I think I remember having got around 300MB/s on a LAN cable that could support 1GB/s.

When you're finished, go back to the laptop's Internet Protocol Version 4 settings and set it to "Obtain an IP address automatically" after disconnecting the laptop from the PC.

Wednesday, July 29, 2015

The Android Stagefright vulnerability frightens the actors and the audience!

Android's Broadanywhere threat was mistaken by many, and NRecursions clarified it to them. Now there's this surprising new bug found called "Stagefright". Here are the details that matter:

Why is Stagefright dangerous?
Usually, if your computer or phone gets infected or hacked, it happens when you perform an action. Inserting an infected pen drive or clicking on a phishing link or visiting malicious websites.
Stagefright on the other hand, needs you to do nothing. A hacker just has to know your mobile number, and they can send you an MMS which will deliver a media file to your phone, which will also contain a mechanism through which the hacker can execute software code remotely. All this happens automatically. Even without you touching your phone. The hacker can then compromise your phone's security (allowing them to cause integer overflows, underflows, access files in the phone's external storage, access the phone's camera, audio and even execute the hackers code) and then delete the MMS. So you won't even know that your phone has been hacked.

Could your phone have been attacked already?
Unlikely. The bug was found by Joshua J Drake, a person at Zimperium mobile security, while he was searching for potential bugs. Zimperium informed Google about the bug and gave Google patches too, and Google patched the Android code already (you'll have to contact your phone service provider to know if the patch is available for you to download).
The news about the bug was made public on 21st July 2015, and now that people know of the bug, it's better to protect your phone ASAP. Full details of the bug will be revealed only on August 5th and 7th 2015 at the US Computer Security Conference and Defcon respectively.
Android versions 2.2 to version 5.1.1 are vulnerable. Cyanogen too.
Zimperium zLabs VP of Platform Research and Exploitation - See more at:
Zimperium zLabs VP of Platform Research and Exploitation - See more at:
Zimperium zLabs VP of Platform Research and Exploitation - See more at:
Zimperium zLabs VP of Platform Research and Exploitation - See more at:

How to protect your phone?
Open up your messaging service (the one you send SMS'es with), go to the Settings, scroll to the "Multimedia message (MMS) settings" and un-select the Auto-retrieve option and the Roaming auto-retrieve option. Do the same for Google Hangouts.
This will prevent the malicious MMS from getting automatically retrieved and loaded into Android's Stagefright module.
Of course the other way to protect yourself is to receive Google's Android updates.

Why is it called Stagefright?
Ever since version 2.2 (Froyo), Android has a native media playback engine called "Stagefright". The bug happens to exist in a few places in this software module.
This is a screenshot from Stagefright's page:

For programmers: 
Would you have been able to spot such a bug?
See the patches for Stagefright below:

The integer underflow patch:
     if (streamDependenceFlag) {
+        if (size < 2)
+            return ERROR_MALFORMED;
         offset += 2;
         size -= 2;
@@ -145,11 +147,15 @@
             return ERROR_MALFORMED;
         unsigned URLlength = mData[offset];
+        if (URLlength >= size)
+            return ERROR_MALFORMED;
         offset += URLlength + 1;
         size -= URLlength + 1;
     if (OCRstreamFlag) {
+        if (size < 2)
+            return ERROR_MALFORMED;
         offset += 2;
         size -= 2;
The integer overflow patch:
     mTimeToSampleCount = U32_AT(&header[4]);
-    uint64_t allocSize = mTimeToSampleCount * 2 * sizeof(uint32_t);
+    uint64_t allocSize = mTimeToSampleCount * 2 * (uint64_t)sizeof(uint32_t);
     if (allocSize > SIZE_MAX) {
         return ERROR_OUT_OF_RANGE;
@@ -376,7 +376,7 @@
     mNumCompositionTimeDeltaEntries = numEntries;
-    uint64_t allocSize = numEntries * 2 * sizeof(uint32_t);
+    uint64_t allocSize = numEntries * 2 * (uint64_t)sizeof(uint32_t);
     if (allocSize > SIZE_MAX) {
         return ERROR_OUT_OF_RANGE;
@@ -426,7 +426,7 @@
         ALOGV("Table of sync samples is empty or has only a single entry!");
-    uint64_t allocSize = mNumSyncSamples * sizeof(uint32_t);
+    uint64_t allocSize = mNumSyncSamples * (uint64_t)sizeof(uint32_t);
     if (allocSize > SIZE_MAX) {
         return ERROR_OUT_OF_RANGE;


Google offers a bounty of upto $20000 (which is less, in my opinion) to people who find and report vulnerabilities in Google's codebase.

Wednesday, July 15, 2015

Configuring NTP between two linux machines

I have two virtual boxes at home. One that maintains system time accurately and another that always shows the time of some other country. I let the one with the correct time be considered the server and the other one be the client which polls the server using NTP (which is installed by default in Linux).

On the server side, use "su" to become the root user.

vi /etc/ntp.conf

Set these values in the ntp.conf file:
fudge stratum 10

Save and exit the vi editor.

service ntpd start

The basically refers to the same computer. Something like the localhost URL.
Stratum is the level of confidence you have in the time of your server. Stratum 0 would mean you have the highest confidence in it. So here we set it to 10, just-like-that. After you configure the client system, you'll see that the stratum of the client will be 11. i.e. lower than the trust you have on the server time.

On the client side:
Get into root mode.

vi /etc/ntp.conf

Comment out all other server address lines and add your server systems address.


Save and exit vi.

service ntpd restart

ntpq -p will show you a table of the network jitter, polling time, server address and other useful data. If you see an asterisk just before the server address, it means that the server is synchronized with your client machine. The offset value shown is the difference in time between the client and server. To convert the value to seconds, shift the decimal thrice to the left.

You can also use ntpdate -d to debug and see what is going on. This command will also show you the time difference between client and server.

Configuring polling time

Well frankly, don't try to configure it.
NTP will automatically choose between a polling value of 64 seconds to 1024 seconds. So don't be surprised if it takes 17 minutes for time to be synchronised. As time elapses, the clock time will drift away from the correct time and NTP will set it right. You have to allow a few days for NTP to select the right polling value based on network jitter and other parameters. NTP does not immediately trust the time it receives from the server. If you set a low polling time using the minpoll command, the scope for erroneous synchronization increases. So the best thing to do is to just ensure your configuration settings have synchronized the client and server and leave it at that. NTP will handle the polling automatically and optimally.