Archive for the ‘Technology’ Category

Enums are classes too. Neat

September 29, 2009 Leave a comment

Got this from Effective Java, which I would strongly urge anyone to read before they write production code in Java.

Copied from here


public enum Direction {
    NORTH { public Direction getOpposite() { return SOUTH; }},
    EAST { public Direction getOpposite() { return WEST; }},
    SOUTH { public Direction getOpposite() { return NORTH; }},
    WEST { public Direction getOpposite() { return EAST; }};

    public abstract Direction getOpposite();

Also possible

public interface Direction {
    public Direction getOpposite();

public enum ValidDirection implements Direction {
    NORTH { public Direction getOpposite() { return SOUTH; }},
    EAST { public Direction getOpposite() { return WEST; }},
    SOUTH { public Direction getOpposite() { return NORTH; }},
    WEST { public Direction getOpposite() { return EAST; }};

PS: WordPress has changed a LOT over the year!

Categories: Java, Technology Tags: , , ,

Amazon Kindle: Reading will never be the same again

November 19, 2007 24 comments

After more than ten years of revolutionizing the way books are sold, Amazon is all set to revolutionize books themselves. Our new e-book reader, the Amazon Kindle launches today.
Read Jeff’s personal letter at

I’ve had the privilege of working on this project and it’s been an incredible roller-coaster of a joy ride.

You can get more info from Newsweek’s cover story on the kindle here.

In my opinion, there’s one feature that trumps things in Kindle’s favour. Free Wireless, For Life.
This means two things to me:

  • You only have to pay for the books and Amazon will back it up, store your annotations and bookmarks at our site. You don’t lose your books even if you lose your kindle.
  • Books will *never* be out of stock for the kindle and they arrive the minute you order them.

Oh and did I mention that I worked on this product?

Categories: Technology Tags: , ,

Social Service

September 20, 2007 Leave a comment

Lisp tutorial
Read this for more info

And no, I haven’t read the book yet 😀

Categories: Technology

5 things I learnt at Amazon

September 13, 2007 5 comments

It’s been a exhilarating four months at Amazon, or atleast it will be in another eight days!

Coming fresh out of college, I learnt a lot about the difference between being just a programmer and a software development engineer. A programmer is someone who just codes what you tell him to; a code monkey, so to say. But a software development engineer is “a biological machine that automatically converts coffee and beer into code”!

This big lesson apart, here are a few other things I learnt so far,

  1. Your 10K+ code with all it’s fancy architecture and flawless implementation is worth nothing if it’s not solving the business problem that it was needed for. Understand the context of the problem before jumping to conclusions.
  2. Sending your code review without proper comments is *much* worse than walking naked on the streets
  3. 5 minutes of extra thought at design time is 5 hours in dev time. Sketch up a rough design even if your writing a script.
  4. 1 hour into reading the fine manual is otherwise 10 in writing your own code.
  5. Using an unstable library is like shaving in the dark. You’re bound to cut yourself if you don’t know what you’re laying your hands on

At the end of the day, work is a lot of fun (and a lot of TT 😀 ). I find it hard to go home 🙂

Categories: Technology

A five pointer on Hpricot Vs REXML

September 11, 2007 Leave a comment

I’ve been learning to parse XML in Ruby for a while now using Hpricot and REXML. And here’s essentially what you should know if you are going through the same path

  1. Hpricot(as of this writing) is still *very* incomplete! It’s doesn’t support everything that you would want to do in Xpath. I had to jumps through hoops to get a few things done. REXML on the other hand works like a charm. Hpricot also behaves weirdly(and unpredictably) at places.
  2. Hpricot has parts of its implementation in C and way faster than REXML.
  3. I like the Hpricot syntax, which seemed more natural than what REXML uses
  4. REXML is very adament about content errors and would refuse to parse a document having a single misplaced ‘&’. Hpricot never complained.
  5. REXML is in the standard library
Categories: Ruby, Technology

Ruby from a Newbie

July 23, 2007 4 comments

A presentation I gave after learning the language for about a week.
Comments on accuracy and presentation and content are most welcome.

Ruby Talk Slides
Ruby Talk Source

Categories: Ruby, Technology

Templates in Vim

January 19, 2007 Leave a comment

I always wanted something that will automatically insert a few header files and macro definitions for newly opened C/C++ files. NOT that i solve too many problems these days(it’s been a looooooong time now 😦 ) but the lazy programmer in me wouldn’t stop craving for one. Lot of people asked me to switch to emacs which apparently has something builtin for this purpose, but G0SUB came to my rescue and showed me this plugin for Vim.

And trust me, it works like a charm 🙂

Categories: Personal, Technology