Friday, October 07, 2011

Steve Jobs is dead. Long live Steve Jobs.

He was a polarizing figure; a lot of people loved him like a seer, a lot loathed his ability to make others love him like a seer. Most admired him from a safe distance.

Apparently, he was a mercurial, highly unsentimental man. One of his first acts as CEO was to empty out displays of old products on company premises. He never believed in looking back, he considered it baggage, an anathema to be shunned. He went to great lengths to say the great products of Apple were not made by him alone, but by an army of talented people, doing difficult work.

Despite the 300 or so patents to his name, anybody that has been involved in the making of anything non-trivial knows the many pairs of hands and eyes something has to go through, to make something great. The fact that none of his patents are solely under his own name, bears witness to this fact.

What will really live on is the story of his life. He was born a child out of wedlock, given up for adoption after his birth to relatively poor parents, who could not even finance his education. When success came, he was kicked out of his own company, betrayed. And the final setback that ultimately took his life, contracting a rare form of pancreatic cancer.

Despite all this, he oversaw some of the greatest successes of our time. We love turnaround stories, and Steve Jobs, and by extension, the company he founded, is one of the greatest turnaround stories of our time.

He achieved it not through luck, but through sheer determination of will, faith in himself, and the vision to realize that the times, they are-a changin'.

That will be his legacy. And it won't be just his legacy, but of many unassuming men and women before him, who overcame similar odds to achieve similarly lofty goals.

Mr. Jobs will live longer than most of his mourners. Some of them will rise to the occasion, and live the lessons he espoused. Most will fail, some will succeed. But all of them will be happier for it. And we will all be better off for it.

May he journey well, to whatever lies beyond.

Sunday, July 17, 2011

Awesome Tool to Justify Text: Par

I recently came across a problem: I wanted to format text in my favorite text editor (vim) in a very specific format. Lines should have a maximum of n number of characters on them, and it should justify properly, nice and pretty, and I shouldn't have to think about it. It should be automagic.

I came across a utility called par. It's a very powerful utility that can process a block of text into an organized format, and I think not enough is being said about it!

http://jmcpherson.org/par.html

It's an open-source project, and it adopts one of the core tenets of the Unix philosophy: do one thing, and do it well.

All I can say is when I use it, it does all the magic I need it to do, and in a sense, the technology 'disappears.' It's a funny thing to say that since it is a tool designed by a technical person, for technical people (very few non-techies use vim). But it's true, even at this relatively deep level of technology, the really good tools... simply disappear.

It's coming across gems like these that make me wonder why we put up day in and day out with all the poorly written, poorly designed software out there. From the cruft of Microsoft Word, to the sluggishness of Firefox, we have to put up with these things regularly.

A lot of it has to do with the fact that writing good software is actually quite hard. But most of it is really to do with our intransigence. We get used to a toolchain and refuse to be flexible and move around.

I think a bit more toolchain promiscuity would make us all a little happier.

Thursday, June 30, 2011

How to Make Simple White Rice

Rice is a staple crop in vast swathes of the world. It is said to have been domesticated on the flood plains of Iraq at the dawn of civilization, and is one of the cornerstone crops that allowed for agriculture, dense population structures, and the resultant technological, and economic development of modern civilization.

Rice is kind of a big deal. It gets a bad reputation nowadays, because carbohydrates have been demonized. I know better, though.

This is a simple recipe on how to cook white rice.

Ingredients:
  1. Rice
  2. Water
  3. Salt
Instructions:
  1. Put whatever amount of rice you want to eat into a pot (usually, it's about 1 cup for 1 person)
  2. Put your index finger on the surface of the rice, and fill it with water till the surface of the water reaches the first knuckle of that finger
  3. Add salt to taste
  4. Let it boil
  5. Take it off the cooker once the water has evaporated
You don't need to drain the starch from this recipe. The amount of water to put in is always one knuckle's distance, from the surface of the rice, to the surface of the water. It's an old standard used for white rice, no matter how much rice you have. This works best with long grain white rice, but should hold for all kinds of white rice.

Note that for health reasons, sometimes it's good to add water "in excess" (i.e., a lot more than you need), note when the rice is cooked, and then drain the rice. This reduces the amount of starch you ingest, which isn't so bad a thing. Choose your poison, if you'll pardon the phrase.

Whatever works for you. This is an easy recipe, and rice (white or brown) is an awesomely delicious thing to eat.

Wednesday, June 22, 2011

Amsterdam: First Glance, Part II

Public Transport

Public transport in Amsterdam is, on the whole, quite good. Arrival times are published on a per-station basis. In Singapore, they only publish bus frequencies, which are really rough guidelines. Sometimes the frequency metric is meaningful, often-times, it's complete bollocks.

Here, they have ETA's (estimated time of arrival) for each train throughout the day, published in a very nice format. This is extremely handy, and I much prefer it to Singapore's unwieldy, non-committal, and of-times plain inaccurate approach.

But public transport here is extremely heterogenous.

There are trains, there are metros (which are basically trains, but if you call them that you'll completely confuse people), and then there are trams, which run on metro tracks (and often have overlapping routes), and are, in essence, a subset of the metro, but with the exception that they ply downtown streets, which neither the metro nor the trains do.

Confused yet?

The word train is used to connote inter-city trains. So you don't take a train to Amstelveen (a satellite city of Amsterdam), you take a metro. You take a train to Utrecth (a neighbouring city), but you can also take a metro, because some metros actually go to neighbouring cities. They metro and trains run on the same gauge, they look similar, have overlapping routes, but are, at least in terms of nomenclature, completely different.

The trams ply city roads within Amsterdam-proper. They have tracks laid down major roads in the city, and they merrily roll by with a quiet electric hum.

The metro links far corners of the city, and basically link up the disparate parts of metropolitan Amsterdam. They also sometimes go to neighbouring cities, like in the example above. But they're not trains.

Confusing enough for you?

They try, though. There's a unified RFID prepaid payment mechanism called OV-chipkaart. You top it up with money, and spend it through your tram/train/metro rides. The only thing is, not all the stations are closed off. Some train stations won't allow you to exit if you don't tap. Some don't seem to care, with permanently open gantries. So you can forget to tap in, then be on your merry way out of one of the stations that are secured, and then get stuck.

It's just asking for people to take free rides, and I did that initially when I didn't know how to make sense of any of it, even though I was wielding a bona fide OV-chipkaart. Even when you have made sense of it, they have different sets of tapping machines, some for inter-city, some for metro, and tapping the wrong one can be very punitive in terms of the money they deduct from your card.

It's all over the place. Just remember, when in doubt, don't pay.

Sunday, June 19, 2011

Amsterdam: First Glance, Part I

I've been in Amsterdam for about 4 months now. I've had some time to settle in and soak up the atmosphere, the language, and local attitudes. In many ways, it's still too soon to form real opinions, so this isn't a definitive snapshot of life in Europe for a brown outsider. But I think it's a pretty close indicator.

Opening Hours

Everything closes at 6. If you need to fix your bicycle, you need to take time off work to get it done. Supermarkets open till 8pm, which is a small mercy. Thursdays are special, some shops (note: some, not all) are open till 8pm.

To an Asian, this is the weirdest thing ever. In Asia, even stationery stores are open till 9 or 10pm. The city doesn't even begin to sleep until about 11pm.

Over here, by 8pm, most stores are shuttered, and only food and beverage, and entertainment facilities are open.

Food

I'm a South Asian, and I've lived a goodly portion of my life in South-East Asia. I come from a heritage of North Indian, and Thai food, arguably some of the best food ever invented. I have high standards for food.

Unfortunately, the Dutch don't know how to eat.

It's a little disappointing because their southern neighbours the Italians have made an art-form of the thing, and their near neighbours the French have a good taste for the stuff.

Honestly, though, it's okay. Amsterdam is awesome in so many other ways, and is home to so many visible minorities that finding good food isn't hard at all. The only thing is, it won't be Dutch.

Banks

Tellers at banks don't take cash.

I needed to pay my deposit and first month's rent to move into my new apartment. I had applied for an account, got an account number, but I hadn't received my ATM card, which comes in the post. My putative landlord wanted a bank transfer, it's easier for tax purposes, he told me.

The tellers were behind the counter, serving customers. But they wouldn't take cash. I did a double-take when I heard it the first time. I politely asked the young lady from ABN AMRO to repeat herself. Yup. Those people there? Inside the bank? Behind the counter? Your money is no good with them.

I talked my landlord into accepting cash.

Wednesday, June 15, 2011

Bash Color Prompt Problems With Reverse-I-Search in Terminal.app

I recently colorized my bash prompt. It's a nice touch, and with a bit of taste, it's good design. Makes visual parsing very quick.

Gone are the days of souped up command-line prompts that look like they're about to lift off into orbit. For a trip down memory lane, check this out. I stumbled across it while Google'ing this problem. Good fun. :-)

No, my prompt is very Spartan:



shaque@marius is user@host (so you know what computer you're on), ~/git_tree/users is the present working directory, and ihaque/vim-tweaks is my git branch.

All of this is awesome. The colors are awesome too (Solarized), they're specially picked colors for a low contrast delta between the foreground and the background, while maintaining excellent readability over prolonged periods. Prevents tired eyes. Go to Ethan Schoonover's website I've linked to, and integrate it into your environment. Srsly.

The problem: once you have colors, and if you use bash's builtin reverse-i-search for previously typed commands, things get fudged. Terminal.app doesn't write the characters properly on-screen so if you reverse-i-search for a previous command, then scroll backward or forward to edit it, it doesn't display correctly.

I spent a lot of hours tinkering with my bash prompt to make this work. It was awful, because bash syntax is very un-pretty. Look at the code for my prompt:

export PS1="\[\e[0;36m\]\u@\h\[\e[m\] \[\e[0;34m\]\w\[\e[m\] \[\e[0;33m\]\$(parse_git_branch)\[\e[m\]\$ "

Uffffff.

The fix: use iTerm.app. Terminal.app doesn't render color properly, apparently. I don't have an explanation for this yet, but iTerm.app will gladly handle your colorized prompt and finicky interactive shell features with barely a sweat.

It's also an actively maintained open source project with a shorter release cycle (read: one that is not pinned to that of OS X's).

Bless the folks at Apple, I think they did a pretty good job with Terminal.app. It's miles and miles better than any stock CLI shell Microsoft ever shipped with their operating systems, and the anti-aliasing and opacity control is better than anything I've seen on Linux (though Terminal.app is not nearly as feature rich, or as responsive as anything on Linux).

Credit goes to Terminal.app, I stuck with it for a long time, but I'm switching to iTerm.app now. It's just better.

Monday, June 06, 2011

Installing ack with Macports

Macports is awesome. Also, ack is awesome. ack is made to replace 99% of the use-cases of grep, and it's customizable with an runtime configuration too (~/.ackrc). To install one awesome thing with another awesome thing:

user@host $ sudo port install p5-app-ack

Not a very intuitive name for ack, but this is the naming convention for CPAN modules on Macports.

I was having a spot of trouble finding the package name for ack (port search ack returns way too many results to be meaningful, thank goodness for Google), and came across this blog post that complains about Macports deciding as soon as you want to install ack that the stock perl in OS X isn't good enough, and summarily takes over your computer by downloading and installing a more recent perl on your box.

This made me think. That's not nice.

But then I thought some more, and I decided, no, that is nice. In fact, it's awesome.

OS X ships once every couple of years (which is considered a pretty sprightly clip in the world of operating systems) and stock installations of OS X ship with obsolete versions of perl for the majority of the product's life-cycle.

I'm glad Macports takes over and updates my perl for me. It saves me the trouble of doing it, and worrying about dependencies. I don't want to worry about dependencies. That's why I installed Macports. If I wanted to "roll my own," I'd download tarballs and roll up my sleeves (right after I cut myself with shards of glass).

The first thing I'm going to do when I get a new Mac is install Macports. It's really so convenient.

I like to think of these package management systems as open-source App Stores, which they basically are, except you never have to pay. And to consider open source developers had mature implementations of these so many years before App Stores ever entered the mainstream.

Whatever those guys are doin', they're doin' it right.

Basic Usage of launchctl (with MySQL)

Macports is awesome. I've installed Vim 7.3, Emacs 23.3, mutt, and mysql5-server, and it has been as smooth as apt on Debian (a very high compliment!). Dependencies, download sources, building, linking, it's all taken care of.

You need to have developments tools installed on OS X, though, because it uses gcc, and from what I can tell, it compiles everything.

Macports Just Works.™ I recommend. I am a fan.

I needed to install MySQL on my local machine, but I didn't want mysql5 running all the time; I want to start it up whenever I need it, and shut it down when I'm done. When Macports finished the install, it told me to run a command to make it run on start-up, which I ran.

I wanted to undo it, because I wanted to know how to.

launchctl (short for "launch control"), controls what launches on startup on OS X. Very basic usage is:

user@host $ launchctl load -w com.your.daemon.plist

To make sure it starts up on login. Or:

user@host $ launchctl unload -w com.your.daemon.plist

To make it not start up on login.

It does magicks in the background you don't need (immediately) to know about. Just use it to control what goes on startup and what doesn't.

If you're worried things are starting up that you don't know about, go to /Library/LaunchDaemons/, and do an ls -l (-l is important, because they're all symlinks).

It's basically a directory of symlinks to plist files that are read to get details on daemons to start up for you. If you don't like something (I noticed some Microsoft registration thingy there), just launchctl unload it.

Simple Cooking

Cooking is good fun. At it's core, it's simple chemistry and physics. At it's most flamboyant, it is art and a form of expression.

The problem I find, though, is that I'm not looking for art. I just want to eat. I have the BBC on, I just got back from work, and I'm at my kitchen counter, and I want to make food.

I had trouble finding good websites online that give you simple recipes. Most of them:
  1. Have too many ingredients
  2. Have too detailed and lengthy protocols
  3. Often express key ingredients in grams (impossible to visualize since density is difficult to intuit), which makes the rest of the ingredients expressed in more easy terms (like teaspoons or pinches) impossible to follow, since your base assumption is suspect (what does 250 grams of chicken really look like?)
You can work around these, certainly. Estimate the weight. A normal chicken weighs about a kilo, so 250 grams is about a quarter of that. None of these are major roadblocks.

But it's annoying. Simple things should be simple.

Which is why I'm publishing a few of the basic recipes I've picked up in my very brief time cooking. My recipes will:
  1. Express ancillary ingredients as percentages by volume of your primary ingredient
  2. Express time as percentages of completion rather than minutes (since cooking styles, timeframes, electric or gas stove, all constrain the pace at which you can move)
  3. Have a clearly defined core
  4. Be extensible
Points 3 and 4 need some explanation.

By "clearly defined core," I mean that there are a few things in the protocol that absolutely have to be done. If any of these break, you're breaking the recipe. Everything beyond those core points are negotiable, and variable.

Most people don't like eating the same thing everyday. So this is an important part of cooking. The assumption here is that you are looking to use the same recipes, but vary certain parameters. Mixing and matching should be a foregone conclusion.

"Extensible" is a continuation of the point on "clearly defined core," as it is a step further than merely tweaking certain parameters. It connotes modularity. One recipe should easily be the precursor for further recipes, and one should be able to swap certain key ingredients in a recipe for something completely different, but keep the basic principles the same. For example, a recipe on chicken curry should be just as applicable to mutton or beef, with only slight variations unique to the ingredient.

I'll publish them as I get better at them. Till then, goedenavond!

Sunday, June 05, 2011

How To Make Simple Chicken Curry

Ingredients:
  1. Some chicken (skin or no skin, whatever is good for you)
  2. Some onions (~10% the mass of chicken)
  3. Tomatoes (or tomato puree, about 10% the mass of chicken)
  4. Garlic, and ginger (preferably as paste, but finely cut will do, about 2% of the mass of chicken)
  5. Curry powder mix (availably freely, usually a blend of spices, about 5% the mass of chicken)
  6. Cooking oil (about 2% the mass of chicken)
  7. Salt to taste
Instructions:
  1. Put it all into a pot (don't add water).
  2. Turn the heat on low, and mix things up a little best you can (doesn't have to perfect, it's just the beginning)
  3. Cover it, and keep mixing. The lack of water may make the chicken stick to the bottom, so just shake things up every few minutes.
  4. After a while, chicken broth will develop (guaranteed to happen with raw chicken), which is why you don't need to add water. This is what you're waiting for.
  5. Mix it more thoroughly now, and make sure the spices are evenly distributed (easier to do now that there's a medium)
  6. Cover it, and let it cook. You can turn the heat up a bit more, now that there's water.
  7. When it's done, feast, preferably with rice. Flatbread, pita bread, sliced bread, or tortillas work just as well, though.
Variations:
  1. I love vegetables, and adding them to this recipe is very simple. The main parameter to consider here is timing. Too soon, and your vegetables become mush. Too late, and they're totally raw (not necessarily a bad thing, but not always ideal, like with potatoes).

    Just go crazy with the vegetables being cognizant of the timing. For potatoes, pop them in at about 40% completion. Your mileage may vary depending on the kind of potatoes you use, and how finely you cut them. Finely cut potatoes have a higher surface area-to-volume ratio, and so cook faster.
     
  2. Sometimes you want gravy, sometime you don't want much gravy (depending on if you're eating it with rice, or with bread, or with vegetables, or on its own). You vary this by varying how much you cover your pot. If you cover it more, you'll have more gravy (more water is retained in the system). If you cover it less, it will be drier.

  3. Minimize the amount of oil you put in. Oil isn't the best thing to eat, and it makes cleaning up harder. But oil is an oft-abused ingredient. Think about it, too much oil doesn't ruin a dish the same way too much salt ruins it. So a lot of people become chronic abusers of it.

    The reason for that is simple: oil is a good heat buffer, so adding extra oil delays food from burning. But oil is not meant as a cover for bad cooking, it's meant as a flavor enhancer, and a cooking medium.

    Minimize the amount of oil you add, and monitor and regulate the amount of heat you apply. This isn't possible on first try, but do your best and refine your protocol as you go along.

  4. Salt. If you're eating the chicken with rice, too much salt is okay (rice dilutes the salt, so you have some leeway). If you're eating it with bread, it could mean the difference between an edible and inedible meal. Be careful with salt, and err on the side of caution. Add less to start with, and refine the amount later on in the cooking. I usually add some salt initially, and refine it at about the 70% completion mark by tasting it.

  5. This simple recipe can be varied by varying the spice blend. Go crazy with it. You can't go wrong so long as you have the core spices: turmeric and coriander. After that, your imagination and taste palate are the only limitations.

Monday, January 17, 2011

My Cat Is Up For Adoption

*** UPDATE *** 04/02/2011 Kasey has been adopted by a friend. His new home is nicer than I could have ever imagined. I'm happy. :-)

I'm moving out of Singapore and I'm looking for a friendly place where I can put up Kasey, my adorable little kitty cat, and best friend forever.

Kasey can also be KC, short for Kitty Cat. Very clever, yes?

Kasey is a tabby-white domestic shorthair (shorthairs are convenient as indoor cats because they don't get furballs in their throats as much). He's a rescue kitty, I found him as a week-old, malnourished little kitten near Eunos MRT in May 2009. I had no intention of adopting a cat, but I wasn't confident he'd survive if I let him back out on the streets, so I took him in.

He's very friendly and playful, but is also super-shy and easily scared. He's had all his shots, he's been spayed, and he's fully potty-trained. In my 2 years of knowing him, he has never vomitted, sprayed, or done anything overtly disgusting or spiteful, except when he is under the severest of stress.

At about 2 years old now, he's really just a very awesome cat with a gentle soul and heaps of personality, and I'm sad to have to leave him behind.

Kasey is about 2 years old.

I've been training him to poop and pee into a toilet (like in the movies, yes!). He's very far along in his training and he's just a few stages away from completing it. So if you're interested but are finding that you don't have space for a litter box, he's almost there in not needing one (and all the germs, maintenance, and expense that a litter box comes with). Once his training is complete, all you have to do is flush twice a day, and scrub your toilet bowl a bit more frequently than you normally would. Very low-maintenance, ideal for apartments and condos.

I'd love to take him with me to see the world, but as a working bachelor who travels frequently, I think Kasey would do well in an environment with more stimuli, and a pet human who is around a bit more to do his kitty bidding.

I always wanted to keep a cat since I was a child, but never did as my mom was a firm believer that animals belong outside the house, and not inside. Keeping a cat, though, is a big responsibility as I have discovered. It needs patience, and lots of love, and is by no means easy. You need to be kind and loving, but also firm and at times strict and unforgiving to establish rules and boundaries that cannot be crossed.

For example, we have no scratch poles in our apartment, but there is some furniture that is old enough that me and my flat-mates don't care if he scratches them. Kasey has spent more than a year sleeping within kitty-arm distance of my PVC leather computer chair, and hasn't scratched it, but has been scratching with particular glee my flat-mate's bed frame, and our old mattresses set up in the living room as an impromptu sitting area. To establish that kind of an understanding between you and an animal, you need to serve up a proper balance of love and approval, and discipline and firmness.

Discipline! Discipline is the thing! Builds character, and all
that sort of thing, you know?

I'm going to miss him a lot, but I'd like to know that he's having fun wherever he is, making new friends, and living life to the fullest.

If you're interested, please e-mail me at iftekharul dot haque at gmail dot com.

Tuesday, January 11, 2011

Cricket Spot-Fixing Trio Should Face Maximum Penalty, If Found Guilty

If Pakistani cricketers Salman Butt, Mohammed Asif, and Mohammed Amir are found guilty by the ICC of spot-fixing, I believe they should face the maximum penalty of a lifelong ban.

Mohammed Amir, a particularly talented young man, is attempting to make a plea that he is young (18 years old) and has no prior disciplinary record, and should be let off easy. This plea has a lot of support from both Pakistanis and non-Pakistanis, as Amir's magnificent bowling is a match-winner for a deteriorating Pakistani cricket team at the highest levels of the game, and at 18 years of age with 51 Test scalps to his name, this young man is a legend in the making.

As much as Mr. Amir is an asset to the game, I feel leniency by the ICC would be entirely inappropriate if indeed wrongdoing is established. Competing at the international level, the apex of the game, comes with perks and responsibilities, neither of which are mitigated by a tenderness of age.

Pakistan recently demolished New Zealand by 10 wickets in a Test match at Hamilton, bowling the hosts out twice in 3 days, and finding time to put up a very respectable 388 runs in between. Beset by controversy and chronic structural problems in Pakistan Cricket, the team continues to punch above its weight category in the international arena, and the country seems to be drawing from a fairly rich pool of talent (see article). These cricketers will be replaced soon enough by new, hopefully more ethically compliant, athletes.

This is the first corruption case to be handled by the newly assembled, centralized anti-corruption apparatus of the ICC. A clear message should be sent, both to players and to spectators, that corruption, however small, will not be tolerated from anyone, however young and promising.

A verdict is expected later today.

***Update*** They've deferred judgement to the 5th of February. Anti-climactic, but wholly appropriate that they want to give the issue full consideration before considering an outcome.

Monday, January 10, 2011

Looking Back, Starting Again

Looking back on this blog, more than 6 years after my first blog post, I flirted with the idea of jettisoning this baggage of the past and starting a new blog.

A new blog, for a new sense of purpose, and a new sense of myself in the world. One in which I took myself a little less seriously, and perhaps didn't impose a sleep-inducing 2,000-word minimum to merely state the obvious.

The temptation to delete everything and start anew is one I've decided not to flirt with any longer, though. It's the temptation of the idealistic perfectionist, and though both qualities are to be celebrated, neither are to be humored for too long. This blog, in all its rambling rhetoric, and self-absorbed glory, is me. It plots my course, as a confused, idealistic nativist, to an equally confused working professional with way too much time on his hands.

I think this journey should continue. Let's see where it goes.

Labels

About Me

My photo
Singapore
I write essays in my spare time on things that are important to me. The ones that I feel are any good, or make any sense, I put them up here. :)