PIT Score

Starting a new project and not finishing it can be quite a discouraging experience. If it ends up becoming something you tend to do often, you lose the motivation to pursue new ideas and that can be bad.

How many times have you started a project and felt like you should’ve picked another one? What if you have a technique to figure out which idea/project to pick next? You should pick the one that you’re more inclined towards. But, how do you get clarity around this inclination?

It’s extremely important to have clarity on why you want to work on a project, how interested you are, and which technology you want to use. I’ve come up with a technique that I use myself for getting this clarity. It’s simple really.

PIT Score

PIT stands for Purpose Interest Technology. I consider these three as the key factors that provide clarity on which idea to pick next. I’ve tried this technique with a few ideas/projects now and I’m pleased to inform you that it has worked really well.

Continue reading

Safe way to calculate the mid in a range

Given a range, calculating the mid is a straight forward process.

mid = (low + high) / 2;

But, there’s a problem with this line. Adding two large positive numbers can result in an overflow, if the sum is more than the max positive number.

One way to fix it is to use the following:

mid = low + ((high - low) / 2);

This’ll prevent the expression from overflowing to a negative value. I’ve read this line in random code so many times and wondered why anyone would want to write it this way instead of the simpler and more straight forward way I mentioned in the beginning of this blog. It wasn’t until I read this lovely blog post that I understood the reason behind it.