23 Jun 2011

Woody Allen

I saw Manhattan first.  And then I saw Vicky Cristina Barcelona almost immediately.  When VCB was just over, I was terribly depressed.  I had to go for a long aimless walk to pull myself back together.  I saw it again day before yesterday.  This time I could see a lot of resemblance to Manhattan.

Manhattan was made in 1979.  VCB in 2008.  29 years is a long time.  When the core of the movies of resemble each other, it only leads me to believe that Woody Allen hasn't found a convincing answer for his questions in these 29 years.  This kind of repetition is probably unavoidable when you are an honest artist struggling with an impossible puzzle.

(I realise there's another possible explanation.  VCB does have some solution for the puzzle, only I fail to see it.)

19 Jun 2011

Go: first impressions

After having written about 300 lines of Go code for something meant to be used in the real world, I have mixed feelings about Go.

Things I like
  • Static typing done really well.  Lightweight interfaces (see Rotting Cats section of Go tutorial), type inference, closures, etc. make the language fun like a dynamic language.
  • Clean standard library.  The interfaces are well thought out, and names are picked well.  Effective Go, the document that describes the design/style ideas used by the Go project says "long names don't automatically make things more readable" and I can't agree more.
  • Google App Engine support for Go.  This is the deciding factor for writing my current app in Go.
  • Object oriented programming without fetters.  There are no classes.  There is no type hierarchy.  You can define methods for any type, even those defined by a third party library you don't have source code for.
Things I have to get used to
There are certain things that are not entirely new to me, but I have almost forgotten because I have been coding mostly in Python and Java.
  • Values are different from pointers.  I can define a method on a type like this:
    func (o MyObject) Increment() {
        o.count++
    }
    But this will silently fail because o's type is not *MyObject.  So when I call myo.Increment(), myo is passed by value, i.e., a copy of myo is passed to Increment, not a reference.
  • Crashes and core dumps.  Because the code compiles to native code, you can easily crash your program by dereferencing a null pointer or accessing a nonexistent index in an array.
Things I don't like
  • Errors are returned, not thrown.  In most modern languages your code is mostly free of error-handling because either you want to propagate it to the caller or you can handle them all in one place (with a try-catch).  Go doesn't have exceptions.  So you have to check for errors after calling every function that may return an error.  If you forget to do that, too bad, the error is silently ignored.

16 Jun 2011

What I miss in Sydney

It's been two and a half months since I moved to Sydney.  Life in Sydney is pretty good.  But of course, there are things that I miss:
  • Lunch time, random coffee breaks, random dine outs, etc. with Ajay.  Now, if I am bored I cannot walk over to his desk for a random chat or go with him to get something chocolaty to eat.  The fact that he and I share similar taste in several things make our conversations lively.  I miss all those conversations and occasional silent lunches with him.
  • Tea breaks and occasional lunch with Jhinuk.  We have different philosophies, our views of life are very different.  Yet, we get along very well.  She's one of the few people I respect a lot.
  • After he moved to Bangalore, I don't get to meet Bharat often.  But when we do meet, it's always a pleasant experience.  He is the only one who understands my unclear frenzied ramblings.  He is the one I ask when I have any science question.  He is the one I have gone for aimless walks with.  Only when I think about him now I realise how rich our years together have been.
  • Rice and dal.  And parathas.  And coconut chutney.
  • The freedom of having my own transportation.  I realise that I am not the kind that can use public transport for travelling.  Should buy a bike soon... maybe next year.

Deteriorating relationships

What I was thinking so far: I get to know a lot of people.  With some of them I become kinda like a friend.  Most such "friendships" deteriorate over time; I don't remain friends with most people for a long time.  For some unknown reason the relationship doesn't work out.

What I think I have found today: When communicating with a person becomes hard, I stop talking to them.  Suddenly one day I decide I won't discuss serious issues with them.  That's pretty much the end of that relationship.

Takeaway: Keep talking to your spouse.  Even if you think/know that you would only annoy them.

11 Jun 2011

Life - 4

Life is like a place where you won't get lost no matter which path you walk, but you might if you stay put.

(Originally tweeted a few months ago.)

Writing

You don't write to advocate your ideas; you write to outgrow them.

I'm learning UX

One of the qualities of good user experience (UX) is that people don't notice good UX.  They'd find the product good, but if you ask them why they like a product, they can't tell you.  Because they don't know.  They don't know because they don't care.  Most people don't care how a product works[*], but they care about what they can do with it.

I wrote a simple program that lets my friend Nags post pictures to her photo blog.  Yesterday I made two tiny little changes to the UI.  She probably noticed one of them, but I doubt if she would care enough.  (Now that I have talked about it, she might go looking for it and she'll find it.)  When I make such changes I deliberately don't tell her about it: she doesn't have to know.  People notice it immediately when the experience gets slightly worse, but when it gets better, even if they notice, they soon forget about it.

I wrote the first version of this program about 5 months ago.  She has posted probably around 130 pictures to her blog using the program.  If the program saved her 2 minutes for each post, it's a saving of 2 hours over 5 months.  That number doesn't look great[**], but not everything is quantifiable.  I don't know about her, but I get demotivated easily with repeated manual work.  If I had a similar blog, I would have soon stopped posting without a helper tool.  I'm sure my program makes her photo blogging experience a bit more pleasant, and that's a lot more valuable.

PS: I started writing this post with the intention of writing about what I have learned about UX, but apparently I have failed in that.  Maybe it would take some time before I can think clearly about them.

* Unless it annoys them.  I had an iPod for a long time.  If I want music, I'd press the play button; I didn't have to think about what all it did internally.  We had a Creative player that would eat up all its battery in 3 hours because it would keep the screen on when it's playing.  My brother found a workaround to turn the screen off, and thus improve battery life.  The Creative player forced him to think/care about how it functions.
** I spent maybe around 20 hours on getting the program to the state it is now.  Spending 20 hours to save 2 hours is not the wisest thing to do, obviously.

7 Jun 2011

Life - 3

Life is like a dice we roll.  We may get a 2 or we may get a 12, but we can't just keep that score... we have to roll again.  Keep rolling: that's the secret.

6 Jun 2011

Match point

I am in a mood for Woody Allen.  Just watched Match Point once again, and loved it this time too.  The movie didn't really have a lot of interesting dialogues, but the movie was brilliant.  A few quotes I liked from the movie:
  • The man who said "I'd rather be lucky than good" saw deeply into life.
  • Some people just don't have any luck.
  • You never know who your neighbours are till there's a crisis.
  • You can learn to push the guilt under the rug and go on.  You have to.  Otherwise it overwhelms you.
  • "The innocent are sometimes slain to make way for a grander scheme.  You were collateral damage."
    "So was your own child."
    "Sophocles said, 'To never have been born may be the greatest boon of all'."

Thanks to Bharat, who recommended this movie to me a long time ago.

5 Jun 2011

Saving for tomorrow

Saving up for tomorrow is probably the worst thing you can do with your time.  Just sleeping off is far better than that.

4 Jun 2011

Results of two unscientific observations

It's a Saturday and I am kinda bored.  So I thought I'd explain my tweet a few days ago.
  • I was kicked to find out that the Atom chip my puny laptop has is a 64-bit processor.  I wiped out the 32-bit Ubuntu I was running and installed 64-bit version of it.  I don't know the internals of Linux, but it looked like the 64-bit kernel was swapping too much.  My machine has 2GB RAM.  Even when half of the physical RAM is free, the machine would be using around 0.5 to 1 GB of swap space.  It was unusably slow, I reverted to 32-bit Kubuntu.  It doesn't swap stupidly any more.  (On the other hand, 64-bit kernel runs fine on my machines that have 8 or 12GB RAM.  Maybe 64-bit works well on machines that have a lot of RAM.)
  • I was cribbing about bad wireless performance of my Galaxy Tab, and someone suggested that I use the n channel of 802.11 on my home wireless router.  I made the switch and the experience just got worse.  Maybe it was the router's 802.11n implementation that sucked.  After reverting to 802.11g, it's better now.

How I became so conceited

I read SRK's this blog post a few weeks ago and since then I have been thinking why I find it incorrect.

I just remembered something that happened 5 years ago.  Someone was asking for some technical help on a mailing list of the Madurai Kamaraj University alumnus.  Someone gave a blatantly wrong answer (that's what I thought back then) and I responded with a message that started with a "WTF".  A senior of mine posted this response:
It does not behave well for any member of the group to use such unparliamentary terms in the mails sent to the group.
  This is not a motley group of friends chit chatting amongst themselves through mails.It has members who are quite senior, having more than 10 years of experience in the Industry. So let the decorum of such an August group be preserved.
I didn't like that at all and I stopped being active on the list.  I was simply reading mails and when I wanted to help people, I mailed them privately.  (I have always hated the "I am elder, respect me" attitude of many of my seniors. It badly hurt my ego to think that they scrutinise and criticise the mails I wrote.)

Fast forward a few years.  The mailing list had become a place exclusively for "job openings" spam.  It's not like people who are looking for a job have nowhere to find openings.  It's not like recruiting is done only a few times a year.  All companies are recruiting all the time, so I didn't find those "Company X is hiring" mails useful.  I sent a mail to the list proposing that either people don't send such mails or they send them to a different mailing list.  It wasn't very well received.  A few weeks went and I unsubscribed from the mailing list.  I am completely disconnected from the MKU community now.

All of these happened after I had joined Google.  Madurai Kamaraj University is not one of those elite institutions where Google visits for campus recruitment, so one of the questions I frequently get asked by my juniors is "how can I get a job at Google?"  In that regard, I am more privileged than most others from MKU.  I am like those "rich people" SRK describes... I stay away from the rest of the crowd because I work at Google.

But the reality, at least my version of it, is different.  People who have worked with me or studied with me would know this: even in schools and colleges I was like this.  Two similar-looking girls were my classmates in MCA; it took me two or three semesters to get their names right.  A big percentage of my class has never spoken to me (apart from maybe a hi when we happen to see on the hallway).  It's very easy now to paint me "conceited Google employee" and add me to a "rich, so won't laugh at our jokes" bucket.  But the reality is people are just different.  Infinitely more different than we can define categories to put them in.

2 Jun 2011

Why is it so hot in humid weather?

My favourite style is talking about seemingly unrelated things first and then answering the primary question at last.  In that spirit, here goes the first unrelated question.

Why do we sweat?
Normal human body temperature is 98.6 °F.  When the external temperature drops or increases, it changes our body temperature too (obviously), but our body works to bring it back to the normal temperature.  When it's cold, our body shivers to generate heat; when it's hot, our body sweats to cool itself down.

How exactly does sweating help?
You need to know the physics of evaporation to understand that.  Take a very hot metal plate and pour water on it.  You'd see water boiling, and soon all of the poured water would disappear.  If you measure the temperature of the plate now, you can see that it's become colder than before pouring water.  What's really happened is, water took the heat energy from the plate and used it to become water vapour (which then mixed with air in the atmosphere).

Sweating is pretty much the same.  Our body becomes hot because of the weather.  As a response to it, we secrete sweat all over our body.  Sweat then uses the heat from our body to evaporate.  Since some body heat is expended on sweat evaporation, our body cools down.  (In a way, we return the unwanted heat back to the environment.)

Humid weather
What happens in hot-humid weather?  Because it's hot, our body secretes sweat to cool itself down.  Now we get all sweaty, but nothing happens after that.  Why?  When a liquid becomes gaseous vapour, it needs someplace to go to: usually it mixes with the air in the atmosphere.  But there's only so much air around us and only so much water vapour can mix with it.  In dry weather, the air can take in a lot of water vapour because it doesn't have much in it already... it's dry.  But in humid weather air is pretty much "full" so the vapour intake will be much less.  The sweat stays on our body until we wipe it off.  And our bodies remain hot.

In dry weather we probably sweat the same amount, but we don't notice it because the sweat evaporates pretty much immediately.  Our bodies don't get too hot either.

Add +1 buttons to your blog manually

Want +1 button on your Blogger blog, but you don’t want the full share widget?  Here’s how you can manually add only the +1 button to your blog:
  • Configure your +1 button and get the code from Google.
  • Remove href attribute of <g:plusone> starting tag; insert expr:href='data:post.canonicalUrl' in its place.  For example, the code on my blog is: <g:plusone expr:href="data:post.canonicalUrl" size="medium"/>
  • Insert the code in your blog’s template.
    • Open Blogger > your blog > Design > Edit HTML.
    • Check “Expand Widget Templates”.
    • Look for <div class="post-footer">
      if you want to place the +1 button at the bottom of each post; look for <div class="post-header"> if you want it at the top of each post.
    • Paste the +1 button’s code.  View your blog to see if the button appears at the right place, and adjust the placing accordingly.
Leave a comment if you have any questions.