How Facebook is Tracking Your Every Move

We recently encountered a bug at work that had to do with cookies. The incident made me realize I didn’t know as much about cookies as I should, and so I started searching for stuff to read. And I got the shock of my life when I saw this article on LifeHacker about how Facebook is using cookies to track every move you make on the Web. Even if you’re not logged into Facebook. Even if you don’t hit Like anywhere. Even if you don’t use Facebook authorization anywhere.

It’s a must-know issue for the end-users, and an enlightening insight for Web developers.

You Can’t Escape Unicode (but here’s something to ease the pain)

First published on LinkedIn.

These are two kinds of programmers in this world: those who don’t know about the existence of Unicode, and those who don’t care. For many of us Unicode seems like SGML, another burgeoning web “standard” imposed on us by the powers that be for no practical use.

But if you’ve done any bit of internalization, you know the pain of handling unreadable characters. Deep down, such programmers know the importance of Unicode, but hardly comprehend it.

I’ll admit I had no idea of Unicode until recently, and even then reading article after article yielded only frustration (now you know why I keep short hair!). Until I came across one article that provides the most simple, gentle and funny introduction to Unicode.

In the hope that it’ll save you some sanity (and hair, not to mention!), I take the liberty to tempt you into spending five minutes understanding the beast known as Unicode:

As an aside, is it any surprise that the article was written by a Python enthusiast?

Stop Loving Your Programming Language

First published on LinkedIn.

I’ve said something blasphemous, haven’t I?

Programming languages are like job titles and expensive cars — we’ve worked hard to add them to our arsenal, we love what they are and do, and we certainly believe ours is the best in the world. Pride, then, is something that programmers naturally feel whenever “their” language comes up. Is that the way it should be?

I’m not saying we programmers should neglect the tools we work with, but sticking to a language (for any reason) is bad for the health of your career.


That’s because unless you are in academia, you are being paid to solve business problems. And businesses survive by getting things done, in the most efficient manner possible. And sometimes (or most of the times) the most efficient route is to do it the way things are done.

That’s why languages like COBOL refuse to die out. That’s why some of the most highly paid (if most boring) jobs are with giant enterprises having legacy systems written in pre-2000’s Java.

Let me repeat in case it didn’t sink deep enough: Nobody gives a damn about what your favorite language is and how much you love it. Keep that idealism to yourself. Instead, focus on being committed to results and making things easy for your employer.

Languages keep coming and going. The intelligent programmer stays.

(JavaScript) An Object and its Prototype are distinct

The first thing to remember about prototypes is that these are different objects altogether. So if you have an object  a, it’s prototype is not  a, but something else altogether. It can be little jarring that the prototype chain doesn’t hop over the objects themselves, but rather moves “diagonally” every time to consult for property existence.

So if you write:
var a = {}, console.log(a) gives just Object {}.

However, saying something like console.log(Object.getPrototypeOf(a)) of produces:

Here we see a JavaScript object in its full glory, which has just been built from the mighty Object itself, and so carries all those wonderful methods.

In the coming posts, I’ll shine more light on prototype, but for now, let’s remember that prototypes are totally distinct (and in our case, more “decorated”) objects that are linked with every object in JavaScript.

Finding a Good Job is Easy

First published on LinkedIn.

Today we have a definite dilemma in the job market: Almost every job seeker is sulking about the lack of good jobs, and almost every employer has given up looking for candidates. As a result, most of us have given up, waved our hand and said, “Dash it! It doesn’t work”.

Except that it does. Because it worked for me, and in this post, I want to tell you (very quickly) how I did it.

In my previous job, I had a mixed role, working as a content writer AND a software developer. But I wanted to move on to a pure development role. So I wrote an interesting (and honest) cover letter, and mailed it to 3-4 good companies I thought were good a fit for me.

Two of them called me for interview instantly, and one of them ended up hiring me (Muhahahahahahahahaha, mission accomplished!).

Here’s what I wrote:


“A guy who’s in his 30th year, with a weird career twist (an engineer who jumped into copywriting/editing), now wants to make it to software development . . . what the heck is he thinking?!”

Dear sir/madam,

I know it looks weird, and if you’re thinking on these lines, I can understand.

But allow me a moment to convince you.

My career has been like a startup – focused on maximizing satisfaction from day one. So when a job with a large corporation failed to impress me, I went on an adventure. And much like a startup, I pivoted whenever needed, without regard to bank balance and social conventions (and that’s why I didn’t marry, until recently).

I’ve been to organizations large and small, and even had a decent stint with freelancing. By now I’ve dabbled in copywriting, editing, script writing, report writing, digital marketing, branding, software, and what have you. In other words, I’ve taken my own sweet time to understand myself, guided by my inner compass at all times.

My search is now over, and the domain of computer programming is shining brighter than ever in front of my eyes. In fact, it’s so clear to me that I recently got married and am now hyper-focused on software.

I know I’m not a genius, and I don’t intend to be, but I sure want to be among the most respected software engineers around.

And I’d like to start my journey with you.


And so, the content writer was hired as a developer (of course he had talent!), which would’ve been impossible had I gone the traditional way. What I’m emphasizing is that if we all stay honest, enthusiastic and a little creative, the job market problems will vanish and the world will be a happy place!

I admit this was a very simple affair. What I’d love to hear stories of you or your friends. How did you use an honest trick to find/weasel/muscle your way into a better job?

Visualizing RegEx Backtracking

Every developer learning Regular Expressions is foxed when he first encounters the feature called backtracking. Once we’ve learned the basic patterns and done a few small matches, we image a regular expression to be a one-way train, if you will, which marches on with resolve and weeds out what it was asked to look for.

Only if.

The recursive algorithms inside a RegEx engine also make it “re-consider” its choices when a match fails, and the greedy quantifiers “give up” space. In a way, then, the engine goes back, or backtracks. If you’re not careful, you can blow up your processor.

I’m writing this post because I had severe problems finding a visualization of this backtracking process, and why it might lead to  a recursive hell. Almost an hour of searching threw up a wonderful post, so I decided to include the link and screenshot on my website to preserve it.

For the tutorial, go here.

The screenshot of page content is below. I sincerely hope it helps someone!



Which is the Best PHP Framework?

How I wish I had a dollar for every time this question is asked on programming forums! Frameworks are a highly personal choice; while some worship raw execution speed and are drawn to the likes of Phalcon, others refuse to get over “good old days” and still insist on CodeIgniter, or some variant of it. And then we have yii and Laravel, which claim to be on the bleeding edge of innovation, while Zend likes to throw its “official” weight around. Not to mention FuelPHP, Symfony, make-your-own-framework, or even putting good old PHP spaghetti to work.

It’s not just that there are too many choices, but also that there exists no objective criterion to decide on a framework. If your employer already uses a framework then the die is cast, but when it comes to personal projects, the dilemma is non-trivial.

I’m writing this because I’ve been through my fair share of mental anguish, and that I’ve managed to come out of it. What decided for me was the insight that as a developer, I’m going to be doing two kinds of projects: very, very small personal projects where I make something quick for myself or for friends; and something that’s large enough to demand much heavy-lifting.

And so, I’ve decided on:

  1. Small projects: Slim Framework. It’s a 600+ KB micro-framework with a very clean design.
  2. Large projects: Laravel. A framework that brings magic to PHP development (seriously!).

Can you copy my decision and make it work for you? Perhaps. But a lot goes into making a choice. You need to be at least an intermediate Web developer to understand the various jargons and .htaccess settings, and you need to be willing to waste a few hours trying a few things.

I wish you all the best!



Hitting the Metal Anvil

I once remarked to a friend, by whom I was introduced to Metal music, that it was a music of disturbed people. He seemed surprised, perhaps because his musicianship went beyond metal (and also because he didn’t consider himself disturbed). Well, if not disturbed people, it is certainly music of extreme people. The drumming is extreme, the guitar distortion is extreme, the lyrics and vocals are extreme. Why will a calm, regular human being put effort into this genre, and eventually come to like it, is beyond me. At least to me, it looks like metal was the culmination of punk, rap, and all those genres that had “rebellion” written all over them.

I make this claim because I fail to understand how the people who listen to metal and claim to have a “superior taste for music” don’t find any charm in the likes of Mozart, Chopin, etc.

A Look Inside the Recursive Hell of Fibonacci Series

Recursion is cute, no? After all, this is what every programmer learns in his early days while attempting (and failing at) the Towers of Hanoi problem. But this cuteness comes at a cost: overhead of making a lot of function calls.

Consider this simple Java program that produces the first 100 members of the Fibonacci series:

When I run it on my SSD-enhanced, Intel i5-powered laptop, the computation time starts hitting several seconds even as the 44th member is being printed. Interesting . . . I’m now intrigued about exactly how many function calls are being made. So let’s tweak this program a little and add a static variable to keep the count:

This run reveals something startling:


As you can see, the function exhibits insane growth as soon as it nears N=40. At N=44, this “cute” recursive function is making more than 2 billion function calls!

That’s scary. Now let’s convert it into an iterative computation:

And the resulting growth graph:


Look like a quadratic growth curve. As you can see, for N=40, we now have to make only 821 calls as opposed to 2 billion+ form before. Quite an improvement!

Moral of the story: Go easy on recursion, people!