Borrowing chip and pin credit cards

Just before she left for school on Friday, the wife told me that her debit card was in a certain drawer in her cupboard, and I should use it in case I wanted to go out. She told me the PIN and said that I could wish to draw money from the ATM downstairs if necessary, or simply swipe the card wherever I go.

I’ve always been queasy about borrowing or lending credit/debit cards. I’ve always thought that it’s illegal to use someone else’s card, even with their consent. The traditional way a credit/debit card works, your signature on the charge slip is supposed to be compared to the signature on the back of the card, and the merchant can refuse you service if the two don’t match (this is seldom implemented in India, but that’s the theory). For that reason, if i were to use the wife’s credit card and the waiter sees that the signature on the charge slip doesn’t match that on the card (obviously!), it might lead to an embarrassing situation.

For this reason I ended up withdrawing a significant amount from the ATM and using the cash thus withdrawn for my expenses. Looking at credit/debit card swipes in action later on, however, I was wondering if it was actually necessary to do so.

In Europe, like in India (Europe is the leader, India followed; US has no plans to follow it seems), all credit and debit cards are chip-and-PIN based cards. The credit card is not swiped in the terminal, but instead is inserted in a way that the terminal can read an embedded chip (more secure than the magnetic stripe). To this, you enter a four-digit PIN, which acts as the validation after which the charge gets approved. Typically, after you’ve approved a transaction with your PIN, a signature is not required, though in India they insist on it (despite the charge slip saying “PIN verified; signature not required”).

And that is what I’ve noticed here in Spain ever since I withdrew money from the ATM that day – there is no requirement for signature in any transaction. The waiter (let’s say we’re at a restaurant) brings the swiping machine, you enter the card, the waiter enters the amount and you enter your PIN, and out comes the slip and the waiter hands back the card to you and walks away. No signature! And this is standard practice across all debit and credit card terminals!

A possibly unintended advantage of this is that it’s now possible to borrow (with permission) someone else’s credit or debit card and actually use it!

Amending the snooze function in alarm clocks

This is an idea that appeared to me in my dreams. Really. I’m not joking. Or maybe I thought of it as soon as I woke up this morning – in the cusp of dreams and reality, and then presently fell back asleep. Either ways, it doesn’t matter. The idea is surely mine, and not knowing how to profit from it I’m making it public.

The basic idea is that the inter-snooze interval between consecutive alarms should decrease geometrically. Currently, alarm clock apps on mobile phones have a fixed snooze duration. For example, my Moto G has a fixed snooze duration of 6 minutes (which I think i can change through settings, but will remain fixed at the new level then). The wife’s iPhone has a fixed snooze duration of 5 minutes (again customisable I believe).

However, I believe that this is illogical and makes you wake up over a longer time interval than necessary. The reasoning is that the degree of wakefulness at each alarm ring is different. When you wake up at the second ring (after you’ve snoozed it once), you’re more wakeful than you were when the alarm rang for the first time. After you’ve snoozed for the second time, you are unlikely to go into as deep sleep as you did when you snoozed it for the first time, in which case you are unlikely to go into the kind of deep sleep you were in before the first ring of the alarm clock.

By keeping the inter-snooze duration constant, what the alarm clock is doing is to give you an opportunity to go back in into the same kind of deep sleep (the longer you sleep between alarm rings, the greater the possibility that you will go back into deep sleep), which further impedes your complete waking up.

What is ideal is that the first time you get woken up from deep sleep, you struggle, snuggle and snooze, and go back to sleep. The next time you should be woken up before you’ve hit the deep sleep phase. You wake up again, struggle, snuggle and snooze, and go into shallower sleep. The next alarm ring should catch you at this shallower stage, and rouse you up. And so on.

So what I’m proposing is that the inter-snooze interval in alarm clocks should decrease geometrically. So if the first inter-snooze interval lasted five minutes, the next one should last less than that, and the one after that even less than that. Each time this interval should come down by a pre-defined fraction (let’s say half, without loss of generality). That way, even if you snooze multiple times, it ensures that you finally wake up in a time-bound fashion (beyond a point, the snooze duration becomes so small that it rings continuously until you switch off and wake up, and by then you have attained full consciousness).

So the way I want my alarm clock designed is that I define how much time I want to wake up in (let’s say default is 20 minutes), and a (harder to change) multiplicative factor by which inter-snooze times come down (default is half), and the inter-snooze interval decreases accordingly geometrically so that you wake up in exactly the time that you’ve initially specified!

So with the defaults of 20 and 1/2, the inter-snooze periods will be 10 mins, 5 mins, 2 min 30 secs, 1 min 15 secs, 37.5 secs, 18.75 secs, … by which time you should be annoyed enough to have woken up but yet wakeful enough having drifted back only just enough!

I think this is a world-changing idea, but I mention again that I don’t know how to commercialise it so putting it out in the open. If you think this works for you, thank me!

And perhaps this is a good assignment to start my career in programming mobile phone apps. Should I start with iOS or Android? (I have an android phone and an iPad).

The Explosion of Karthiks

Back when I was in LKG, I was one of 6 Karthiks in my class, and one of two “S Karthik”s. Two years later there was a reshuffle in sections, and there were now “only” 4 Karthiks in my class. The number varied over the years but it was a very rare class I sat in (IIT being one of them) where I was the only Karthik.

So it appears that Karthik is an exceedingly popular name. But why did it become so popular? We don’t know. When did it really become popular? That is a question we can now answer thanks to Anand C, who has put out data as part of what he calls the “Indian Names Database“.

Anand trawled through electoral rolls (available in PDF form), and extracted the names of all registered voters in Andhra Pradesh. For privacy reasons he’s not put out the full data (he checked on this “datameet” group if it’s okay to put but that group convinced him it would be a violation of privacy – I’m not so sure since said data is already public , so I hope he puts out the full data sometime). So what he’s done is to extract words from each name, and published how many people with that word in their names were born in each year.

So for example the dataset he has published says that there were 2000 people with “kumar” in their names born in 1955 (and on the current electoral rolls), and this number went up to 53000 in 1984. Thus, playing around with Anand’s dataset we can find out the relative popularity and unpopularity of names over the years.

So I decided to check with my own name. How many people named “Karthik” born in each year were now on the electoral rolls in Andhra Pradesh? Given the format in which Anand has put out the data, it was easy to find, and here is the graph:

karthik1

So there were a few Karthiks right from the 1940s, but the number was low, and then for some reason the name suddenly became popular in the late 1970s, after which it grew exponentially.

And it DID grow exponentially – in the literal sense and not in the figurative sense that people use the term for any fast growth. I plotted the same data using a logarithmic scale on the y-axis, and this is what I found:

karthik2

Notice how this plot is a straight line between the late 1970s and about 1990. So if the logarithm of the number of Karthiks born in each of these years is a straight line, then we can surely conclude that Karthiks grew exponentially in this period?

So what are the most popular words in Andhra names over the years? The top 20 all-time names based on Anand’s data are:

apnames

Draw your own conclusions!

The Prime Minister has lunch

Much has been made of the fact that Prime Minister Narendra Modi had lunch at the parliamentary canteen a few days back. The “event” has been covered by newspapers in excruciating detail, and the opposition Congress has taken a jibe at the PM for “eating subsidised food”.

That something like the PM having lunch at the parliamentary canteen being news suggests that something is seriously wrong. I mean, I know that the PM is a busy man and may not have time to socialise during lunch and all that, but considering that he’s also an MP and that parliament is in session, the parliamentary canteen is possibly the most logical place for him to have lunch if he didn’t have any other plans!

Some of the reports also talk about the fact that no prime minister in the last <numbers vary> years had done this, and reports also go on to make a big deal that Modi paid for his own lunch. The amount he paid and the amount he got back as change is also well noted. It is possible that there may not be much news happening, but the footage this event has received is definitely overblown.

Anyway, apart from the fact that this shouldn’t have been news, I have one other quibble with the whole episode. The Indian Express writes:

“As is standard operating procedure, the security personnel accompanying the PM tasted the food before it was served to him. They also took samples of all that was served to him — which is also the standard drill,” a senior catering official said, adding that these samples would be preserved for 72 hours during which they would be sent for testing.

Now, I know that we need to take utmost care for our Prime Minister’s health and safety and all that, but I found this bit a little weird. I mean, while it might be standard operating procedure, this event discloses a level of distrust in the food prepared by the government (IRCTC to be precise) run parliamentary canteen, and that cannot be good signalling!

Programming assignments and blind men and the elephant

Evaluating a tough programming elephant is like the story of the blind men and the elephant. Let me explain.

The assignments that I’ve handed out as part of my Spreadsheet Modelling for Business Decision Problems course at IIMB involve fairly complex spreadsheet modelling (as the name of the course suggests). Thus, while it is a lot of effort on behalf of the student to do the assignment, it is also a lot of effort on my behalf if I’ve to go through the code line by line (these guys code using VBA macros), understand it and evaluate them.

Instead, I have come up with a set of “tests” – specific inputs that I give to the program (I’ve specified what the “front sheet” should look like so this is easy), and then see if the program gives out the desired outputs. Either way, I dig a little deeper and see if they’ve done it right, and based on that I grade the assignment.

If the assignments that they’ve turned in are elephants, it’s too much of an effort for me to open my eyes and actually see that they are elephants. Hence, I feel around, and check for a few different components to make sure they’ve submitted elephants. So for this assignment I might check if the trunk is like a snake, and if so, they’ve passed. For another assignment, I might check if the legs are like trees, and if they are, pass them. And so forth.

Now, this is evidently not perfect. For example, if you know that I’ll only check for the trunk to be like a snake, you’ll just submit a trunk that’s like a snake rather than submitting a full assignment! But if you don’t know what I’m going to check for, then it might be possible that you’ve only submitted a snake, I look for treetrunks and not finding them, give you a failing grade! There is a little bit of luck involved on both sides, but that’s how things work!

Extending this analogy to software testing, you can think of that too as an exercise of blind men learning about an elephant. The testers are the blind men of Indostan, trying to find out if the piece of code they’ve been given is an elephant. Each tester pokes around at a different part of the beast, trying to confirm if it fits what they’re looking for. And if the beast has a knife, a snake, a fan, a wall, a tree and a rope as part of it, it is declared as an elephant!

Speaking of software testing, I came across this brilliant video of a class in Hyderabad where software testing is being taught. Enjoy (HT: V Vinay).

Why AAP should win Delhi

Though I frequently write analytical pieces about elections, this is NOT one of them. It’s pure unbridled opinion.

I had mentioned this a couple of years back before the elections in 2013, and I mention it again now. The Aam Aadmi Party (AAP) should win Delhi. To rephrase, Delhi should be “sacrificed” to them. If only to illustrate how ridiculous some of their policy ideas are, and why them having a larger role in Indian politics is a terrible idea.

Now, from my timelines on twitter and facebook, I see that a lot of people I know are big fans of AAP. What attracts them to the party is their image of being “clean” and “beyond corruption”. There is also the TINA factor – the Congress has proved time and again that it is incapable of governance and the BJP has this looney fringe with ridiculous social ideas which they actually pay attention to. Given such worthy alternatives, people are plumping for AAP as a party that can provide superior governance.

Except that they seem incredibly commie, except perhaps in name. Look at some of their policy prescriptions (free power, free water, etc.) and you can imagine one of the communist parties coming up with the same. They want to bring back big government in areas where government interference has been cut down after significant effort. They believe that the solution to corruption is more layers of bureaucracy (Jan Lok Pal, etc.). And as the Somnath Bharti incident showed, they are not paragons of virtue when it comes to social freedom, either.

The problem with the AAP is that they haven’t got enough opportunity to show their incompetence, which is why people worship them. They got an opportunity last year, when the Congress supported their minority government in Delhi, but they perhaps wisely saw that their incompetence was being shown up, and Kejriwal resigned in a hurry. And from what opinion polls show, this gambit seems to be working for them. The problem with gambits is that they are tactical weapons, and usually don’t work over a long-drawn period.

So it is time to give the AAP another opportunity to show off their incompetence and bad ideas. Delhi is in that unique position where there is the central government and the municipal government that tread on over one foot of the state government, so the state government can’t do too much damage. And Delhi is also a small state, so any damage will have limited scope.

From this perspective, it is a great idea to “sacrifice” Delhi to the Aam Aadmi Party. I hereby call upon voters in Delhi to vote for the muffler broom.

The Ramayana and the Mahabharata principles

An army of monkeys can’t win you a complex war like the Mahabharata. For that you need a clever charioteer.

A business development meeting didn’t go well. The potential client indicated his preference for a different kind of organisation to solve his problem. I was about to say “why would you go for an army of monkeys to solve this problem when you can.. ” but I couldn’t think of a clever end to the sentence. So I ended up not saying it.

Later on I was thinking of the line and good ways to end it. The mind went back to Hindu mythology. The Ramayana war was won with an army of monkeys, of course. The Mahabharata war was won with the support of a clever and skilled consultant (Krishna didn’t actually fight the war, did he?). “Why would you go for an army of monkeys to solve this problem when you can hire a studmax charioteer”, I phrased. Still doesn’t have that ring. But it’s a useful concept anyway.

Extending the analogy, the Ramayana was was different from the Mahabharata war. In the former, the enemy was a ten-headed demon who had abducted the hero’s wife. Despite what alternate retellings say, it was all mostly black and white. A simple war made complex with the special prowess of the enemy (ten heads, special weaponry, etc.). The army of monkeys proved decisive, and the war was won.

The Mahabharata war was, on the other hand, much more complex. Even mainstream retellings talk about the “shades of grey” in the war, and both sides had their share of pluses and minuses. The enemy here was a bunch of cousins, who had snatched away the protagonists’ kingdom. Special weaponry existed on both sides. Sheer brute force, however, wouldn’t do. The Mahabharata war couldn’t be won with an army of monkeys. Its complexity meant it needed was skilled strategic guidance, and a bit of cunning, which is what Krishna provided when he was hired by Arjuna ostensibly as a charioteer. Krishna’s entire army (highly trained and skilled, but footsoldiers mostly) fought on opposite side, but couldn’t influence the outcome.

So when the problem at hand is simple, and the only complexity is in size or volume or complexity of the enemy, you will do well to hire an army of monkeys. They’ll work best for you there. But when faced with a complex situation and complexity that goes well beyond the enemy’s prowess, you need a charioteer. So make the choice based on the kind of problem you are facing.