Saturday, November 28, 2009

Profit and Laws

Let me suggest a simple way to make profit. Buy guns. Hold them to peoples's heads and ask for money. Pretty profitable, I should guess.

But you can't do that because there are laws prohibiting such behavior. Laws are important in deciding how profit can be made.

Yes, I am stating the obvious. :)

Friday, November 27, 2009

Why Mozilla Just Might Get it Right

In the beginning, there was the Internet Explorer. There was nothing great about it, but it was pretty much the only decent web browser out there. It came bundled with Windows and did what it was supposed to do – display web pages. Everyone used it. But no one paid too much attention to it, because the web wasn’t BIG. There was no facebook, or youtube and google was in its infancy.

Then web 2.0 happened and with that Firefox happened too. Opera was always lurking somewhere in the background. But Firefox really “got” the web. They knew that users didn’t need a clutter of options – they just needed use the internet. They also knew that every user had different needs. Which is why they had addons for almost everything under the sun. And firefox slowly gobbled up the big e.

Then chrome happened. Google became big and decided that they needed their own browser to do the stuff that they wanted to do on the internet – heavy javascript. So chrome focused on running javascript – fast. Somewhere in the background, IE woke up and brought in tabs and web slices and other shenanigans. (But they still don’t get it. Do they really expect web slices and Silverlight to replace flash and javascript? And what about speed?!) Opera and safari trudged along too.

And now people are talking about how Chrome might kill Firefox. After all, chrome is minimal, it’s going to have extensions soon and it’s FAST. It’s backed by google. It is actually being advertized. And did I say it was FAST?

However, I recently read how Mozilla is planning to kick the login’s butt. This reminded me that Chrome, IE and Safari and inextricably linked to their parent companies interests. On the other hand Mozilla is FREE. They can dare to think about doing things other browsers cannot. They don’t need to lock the user in. They don’t need to drive the user to specific services.

And that, my friends, is the reason Mozilla just might get it right, after all.

(In case you’re shouting ‘Mozilla is funded by Google’; shout away. I still think Mozilla has maintained it’s freedom.)

Tuesday, November 24, 2009

Evaporative Cooling

Just wanted to throw an idea out. Much is said about evaporative cooling on wikipedia. I think this technology has a lot of potential in a country like India where power is scarce and heat is abundant. I wish someone would deploy this on a mass scale -- central cooling etc.

Monday, November 23, 2009

Why the US Fails to Inspire Me

My friends wonder why haven’t written much since I came to the US. Before coming here, I used to be an infrequent but regular writer. But now, the writing seems to have dried off completely. (This blog is actually an effort to keep some semblance of writing going.)

I think that’s because I’m in a surrounding that I know nothing about. In India, everything used to inspire a story. I knew the people on the streets. I knew what their story was. A 14 year old bus conductor speaking half-English half-Hindi was intriguing. A pan-wala knowing the richest loan shark of the city was intriguing. And I knew how these things could be true. I knew how they could happen. I could write about them.

In the US, I know nothing. I look at faces and they are just faces. I don’t know their back stories. When I see a woman with long hair done into a choti, I don’t know why she’s dressing unlike other women around. When I see a homeless guitarist on the street, I don’t know where he sleeps at night. I’m afraid to walk into the back-alleys of this country and discover its dirty secrets.

And that, I think, is why I can’t write anymore.

But on the other hand, that might be the very thing to write about. :)

Saturday, November 14, 2009

Profit and Ownership

Case 1
Say I have 100 rupees. You come to me and say, hey, Vinod, lend me those hundred rupees. I will go buy potatoes and flour and masalas and make samosas and sell them for a profit. You can take a cut. How about ten percent?

I ask for 20 and we settle down on 15. You take the 100 rupees, make samosas, sell them and make 50 rupees in profit. I get my 100 rupees back. I also get a cut of 7.5 rupees from the profit. And you end up 42.5 rupees richer for your toil. Everyone’s happy.

Case 2
I have 100 rupees. You walk sneakily into my room and take that 100 rupee note. You go buy potatoes and flour and masalas and make samosas. You sell them for profit of 50 rupees. Then you sneak back into my room and replace that 100 rupee note. Since I’m a careless idiot, I never even notice. You end up 50 rupees richer. I don’t even know what hit me but since my 100 is still there, I’m good.

Functionally, nothing changes between these two scenarios. Samosas still get made, customers still get to satisfy their lust for spicy cuisine, and you still make profit. And yet, in onc case I end up richer and in another I do not. Why is that?

The difference, I think, is because in Case 1, I’m able to claim ownership of those 100 rupees. I’m entitled to a share in profits, even though I did not participate in any productive activity, merely by virtue of owning those 100 rupees. In the second case, no such ownership is established and I get no profit.

I’m able to establish ownership because I have control over the money. In Case 1, I most probably keep the money under lock and key so you can’t sneakily ‘borrow’ it. In Case 2, the money is up for anyone to grab. Therefore, no profit.

Put this way, the notion that I should get profit for mere ownership seems a little absurd. I didn’t make the samosas. I didn’t sell them. Then why should I get the profit?

What do you think?

Friday, November 13, 2009

The Array Multiplication Problem Solution

Use logarithms. They allow us multiply / divide numbers without using multiplication or division.

Find S = log(A[0]) + log(A[1]) + ... + log(A[N]). This takes O(n) time.
Set B[i] = antilog(S - log(A[i])) where i = 1:N. This also takes O(n) time.

B[i] = antilog(S - log(A[i]))
B[i] = antilog(log(A[0]) + log(A[1]) + ... + log(A[N]) - log(A[i]))
B[i] = antilog(log(A[0] * A[1] * ... * A[N] / A[i]))
B[i] = A[0] * A[1] * ... * A[N] / A[i]

The Array Multiplication Problem

Given: an array A of size N. Find the output array B, also of size N such that B[i] is the product of all elements of A except A[i]. That is,

B[0] = A[1] * A[2] * ... * A[N]
B[1] = A[0] * A[2] * A[3] * ... * A[N]
B[N] = A[0] * A[1] * ... * A[N - 1]

You have to do this in O(n) and WITHOUT using the division operator. :D


Thursday, November 12, 2009

What's Wrong with the KDE4 Panel

As some of you might know, I moved away from KDE4 quite a long while ago. I gave KDE 4.3 a spin with Karmic but still no joy. It just isn't working for me. Here's an example of why. Shown below is a screenshot of KDE4 on Arch Linux.

Look at the panel. It's big. Not only is the panel itself big, everything on it is big too. The clock is huge, we have gigantic tasks in the taskbar and absolutely monstrous start menu and quick launch buttons.

This is good if the user actually wanted it that way. But if I'm increasing the size of the panel, 9 times out of 10 I want to fit more stuff onto it, not make everything bigger. If I wanted to make everything bigger, I'd just change the screen resolution or get a bigger monitor. What I most probably want is to fit more tasks in the taskbar, more icons in the system tray and more quick launch icons. The current implementation doesn't leave much room for me to do that.

Wednesday, November 11, 2009

The 100 Floors Egg Dropping Puzzle

This one’s a classic. I don’t even know why I’m putting it here. But before we proceed, I’d like you to take a look at this awesome puzzle site. All puzzles on my blog are shamelessly lifted from there. :P

The Problem
So, the puzzle goes like this. You have two identical eggs. And you have a 100 storey building. The eggs could be very strong or they could be very weak. So, they could break when dropped from storey 1. Or they couldn’t break even when dropped from storey 100. You have to find out the lowest storey such that when an egg is dropped, it breaks. How can you do this in the minimum number of tries?

The Solution
The simplest solution to this problem is, well, simple. You drop an egg from storey 1. If it breaks, you know. If it doesn’t climb to storey 2 and repeat. Then to storey 3 and so on. This approach will take minimum 1 tries and maximum 100 tries. Not good enough.

But we have two eggs. Suppose we drop the egg from storey 50. If it breaks we know that the culprit storey is somewhere between 1 and 49. If it doesn’t we know it’s between 51 and 100. Then we can use the other egg to check which one. This way, we can get a minimum of 2 tries and a maximum of 51 tries. Slightly better, I guess.

Can we do even better?

Sunday, November 08, 2009

UNICEF Greeting Cards

Saw some UNICEF greeting cards at a store yesterday. The packaging had the following text on it
UNICEF has helped more underprivileged children than any other humanitarian organization in the world.
Okay. Good. But considering this was on an item up for sale and to an extent amounted to advertising:

1. Does helping more children somehow make you 'better'?
2. Do you mean to imply that I should not contribute to other humanitarian organizations because they help lesser number of children?
3. Is humanatarianism a competition? Why are you comparing yourself to others?

Thursday, November 05, 2009

The Married Guy Puzzle

Amar is looking at Akbar and Akbar is looking at Anthony. Amar is married and Anthony is not. Is a married guy looking at an unmarried guy?

  • Yes
  • No
  • Cannot be determined

While the answer may look obvious to some, they'd be surprised at how many people (including myself) answer this incorrectly.


When I look back (not that I have too many years to look back to), I see many things that have changed over time. In particular, I tend to think of my high-school days, when I was kind of an over-achiever. I had certain habits that helped me do that and I sometimes like to think what they were and inculcate them back.

So one thing that I had at that time was belief. Of course, I was young enough and naïve enough at that time to have it. I believed that I was special and that I was here to do something special. What exactly, I had no idea. But I had this nagging feeling all the time that life was going in the right direction. That I was doing what I was meant to do. And that I was meant to do something.

This belief stemmed from my belief in a greater meaning to life. I believed that there is some consciousness out there which created a plan that we were all playing out our roles in it. Somehow it felt good to know that everything was just as it was supposed to be.

As I grew up, I lost that faith. First the faith that there is a supreme being. Also the faith that I’m meant to do something special. I became the ordinary. And life became a lot less fun to live. These days I find it really hard to get excited about anything. Even if I do, I wonder what meaning does it have. Isn’t that sad? Wasn’t it better to be deluded but happy?

I wonder why people say delusions are never good.

Tuesday, November 03, 2009

The Five Cap Puzzle Solution

A lot of people provided solutions on fb. I'm posting some of them. They are quite elaborate. Save me the time to write it up. :)

By AD:

Black, the only way the last one can be sure of the hat on her head is if both the one's in front of her are white. So we can conclude that they are not. Thus, if the hat of the first one was white, the second one could safely have said hers was black, but since she doesn't do that, the first one can only be black.

By AD2:

Assumption: Each woman can hear the reaction of the others when they answer the question.

Now, Looking from the last woman's position. there is only one case when she can definitely tell which cap is on her head. The situation will be WWB ( from first to third). Ruling out this situation, now we get to the second woman, she knows that the third one behind her does not know the color of her cap. She also knows that had the color of the cap of the woman in front of her ( the first woman) been white, then there is only one case that the third woman would have been unaware of the color of her cap. Meaning, the second woman would have known the color in that case. But she does not too. This rejects the second case of WB(W/B). The last two cases in which both the second and the third woman do not know the colors of their respective caps, have the first woman wearing a black cap only. Thus hearing from the second woman that she also cannot determine the color of her cap tells the first woman for sure that her cap is Black.

There you go, BLACK is the answer.

By KS:

Since there are only two white caps and three women, at-least one of them is wearing black. If the last women sees two white caps in front of her, she knows, she herself is wearing black, and declares.

If she is keeping quite, that means, the two women in front are either wearing both black or one white and one black. Now if the middle woman sees a black cap in front of her, she doesnt know if she herself is wearing black or white. If the middle woman sees a white cap in front of her, she knows she herself is wearing black.

Since second lady is keeping quite, the cap on the third lady is black and the third lady comes to know.

Monday, November 02, 2009

The Five Cap Puzzle

There are five caps. Two of them are white and three of them are black. Three women are sitting one behind the other such that the first one cannot see the two behind her, the second one can see the one in front of her but not the one behind her and the last one can see both women in front of her.

The caps are randomly put on the heads of these women such that none of them can see what cap went where. Of course, once the caps are put, they can see the cap on the head of the woman/women in from of them. That is, the first one cannot see any, the second one can see one in front of her and the last one can see both in front of her. Also, they can't see what cap is on their own head.

The last one is then asked if she knows what colored cap is on her head. She says no. The second one is then asked if she knows what colored cap is on her head. She says no too. The first one is then asked the same question. She says yes and is able to tell the color of the cap on her head.

How and which color?