Sunday, January 21, 2007

playing with ruby

It's been a while since I played with ruby.

I have a Subversion repository that contains stupid stuff like my .emacs file, and then I have some personal wiki's and blogs that use files or mysql dbs under the covers.

I haven't been very diligent about setting up a backup process for all that crap, so I've been playing a bit with some scripts to automate all of that stuff using Ruby. My ruby skills are quite rudimentary and based entirely on some playing around I did with rails two years ago. But it's been exciting (and tedious) learning about stuff.

First off, the AWS S3 ruby libraries look cool, but don't work unless you have a ruby version > 1.8.4. I had 1.8.3 and it took me forever to find the root cause of an obscure error.

I also never knew about ri - the perldoc for ruby. Check out RI for emacs which lets you run ri from within emacs.

Also loading inf-ruby.el allows you to do M-x run-ruby and get an interactive ruby shell within emacs. This is great for a ruby beginner like me, because I can experiment with stuff from within emacs while I'm coding.

The S3 Rake file is a great starting point for backing up mysql databases and svn repositories, but is specific to a rails setup. I'm not working on a rails app; just trying to backup wiki databases and an arbitrary svn repository; so I'm rewriting it as a class that should be callable either as a command (from cron, which is what I want), or from rake. If I get it looking decent, I'll put it up somewhere.

Sunday, November 26, 2006

To पद्मामावशी from सुनंदा

(If you can't read the following all you can see is boxes or question marks, check out this site for help. (If you can see the fonts but can't read it, I can't help)

कै. ती. सौ. पद्मामावशीची श्रीसाई महाराजांवर खुप भक्ति होती आणि महाराजांची पण तिच्यावर कृपा होती. त्यामुळे ती गेल्यावर तिला त्यांच्या पायाशीच जागा मिळेल अशी मला श्रध्दा वाटली आणि त्यावरुनच मला ही कविता सुचली. हे तिच्या तोंडचेच शब्द आहेत अशी कल्पना इथे आहे ...

साश्रुपूर्ण नयनांनी तुम्हा सर्वांचा निरोप घेतेय
निघायची वेळ झाली माझी गाडी शिट्टी देतेय ।

पुनः पुन्हा डोळ्यात आणू नका पाणी
गेली बिचारी असे म्हणू नका कुणी ।

विरत चालल्या आहेत सर्व आठवणी
आता इथे माझे उरले नाही कुणी ।

गाडीने सोडले आहे ठिकाणं
पुसत चालली आहे एकेक खूणं ।

समोर दिसताहेत वळणदार वाटा
मऊशार माती इथे न काटाकुटा ।

फेसाळलेल्या समुद्रावरचा सुखद गार वारा
सोनेरी रेतीचा सभोवती किनारा ।

रंगबिरंगी फुलांचे तारवे फुललेले
सुगंधाच्या लाटेवरती मन माझे डोले ।

कवितेतल्या कल्पवृक्षांची गर्द गार सावली
ह्या गावाची हवा मला फारच बाई भावली ।

थांबू का जरा इथे, घेऊ का थोडा श्वास
नको! नको!! अत्त्युच्च सुखाचा मला लागाला आहे ध्यास ।

कसल्या तरी तेजाने उजळले आहे आकाश
दिसला! मला हवा तो दिव्य तेजस्वी प्रकाश ।

चिरंतन सुखाचं भांडार मला गवसलं
हाती आली माझ्या सद्गुरुंची पदकमलं ।

नको पुनर्जन्म, नको नाती-गोती
नको मोहमाया अन् पाप-पुण्यांची खाती ।

एकच मागणे देवा एकच द्यावा वर
पडू नये कधीही ह्या पाऊलांचे अंतर ।

- सुनंदा अभ्यंकर

Monday, October 30, 2006

pumpkin soup

I experimented with pumpkin soup yesterday. I think it turned out quite well - though you'll have to ask some of the taste testers for an honest opinion.

Basically I cooked a bunch (turns out that half a pumpkin serves way more than 6 people) of pumpkin in the pressure cooker along with some carrots. On the side, I sauteed onions and ginger.

Mashed the pumpkin, mixed it and the carrots with whipping cream, some milk, nutmeg, black pepper, and a tiny bit of cinnamon and cooked in a pot for a little longer.

Finally, put it through the blender and garnished it with some parsley.

I want to try adding some celery as well - I think that'll give it a nice bite.

Friday, October 20, 2006

data modeling

attended a pretty good presentation that Pierre gave on data modeling. Some things I learnt:
  • since 3nf captures most business rules, each subsequent denormalization that you may do should be countered or linked directly to a piece of code that implements the business rule that was lost during the denorm process. It'd be supercool if there was a way to document that in the code/model somehow.
  • successful normalization requires that you understand your business, whereas successful denormalization requires that you understand the runtime nature of your service (reporting, metrics, partitioning, performance, etc).
  • it's easier to backfill into a simple, crisp model than into a "flexible" model that probably doesn't work anyways and may be full of incorect business rules. Resist the urge to put random opaque fields (or arbitrary key/value pairs) into your data model.

Having worked almost exclusively on framework-level code, I haven't had to do much modeling of business problems. So I learnt a lot.

Tuesday, October 17, 2006

lamb

I need a web enabled cellphone. Everytime I go to the grocery store I randomly decide what I'm going to cook but then never have a recipe handy and have to guess how exactly I'm going to make it. Here is yesterday's impromptu lamb recipe, concocted from several recipes on epicurious, as well as a bit of creativity:

Ingredients:


  • Shoulders of lamb
  • Yogurt
  • Fresh mint
  • Garlic
  • Rosemary
  • Thyme
  • Balsamic Vinegar
  • Sea salt

Repeatedly stab the lamb with a fork on both sides. Sprinkle on some sea salt, spoon on some yogurt and let it sit for a bit. Turn on the broiler in your oven.

On a cutting board, chop some garlic and fresh mint. Add in the rosemary and thyme, and keep chopping until you have a finely chopped green mixture.

To the herb and garlic mixture, add in a little bit of vinegar and more yogurt and mix again. Spoon this onto the lamb and stab again repeatedly with a fork to help it absorb. Cover and let it set in the fridge.

Put it in the oven, about 3-4 inches from the broiler, for 6-7 minutes on each side.

Improvements? Ingredients that I mixed that shoudln't have been mixed? Let me know. I just made this up as I went along.

Monday, October 16, 2006

I'm dotting more than blogging

So you may be wondering why my blogging is suddenly less frequent than it used to be. Well often times what I have to say is related to something I read on the web. And there's a kickass service that lets me track that sort of stuff, and share/discuss it with my friends. bluedot.us.

I haven't figured out a way to splice my bluedot feed with my blog feed yet so you have to subscribe to it separately.

Note that unless you use a reader than can do authentication, this feed only contains my "public" dots, and not the ones that I reserve just for friends or particular groups of people to see. If you want to see those register/sign in, add me as a friend (I'll accept if I know you), and check out my dots on bluedot.

Update: With firefox 2 you can click on my bluedot feed and then automatically subscribe to it in bloglines.

Update: I put in a feature request to the feedburner folks to integrate with bluedot. They said that they generally wait to see what sites get heavy usage and then integrate with them. If more people ask for it, then they may start paying attention. bluedot folks - have you tried contacting them directly?

Tuesday, October 03, 2006

broadband by boeing

Wow. I'm on my way from Seoul to Seattle and have my laptop plugged into a power outlet under my seat and have broadband access (for free). I just tried skype-ing my wife's cellphone and was able to get a pretty damn clear connection, except that I'm guessing she heard a lot of white noise from the cabin noise.
That's pretty damn cool!
It's called Connexion By Boeing. Although it's free I was required to enter credit card information to use the service. Interestingly though, there were other payment options including what looked like tie-ups with telecom companies (maybe this gets tagged onto your monthly phone bill?)
I'm impressed.

Friday, September 29, 2006

link love from Mr. Bezos

Looks like I'm getting some link love following Jeff Bezos' keynote at MIT's Emerging Technologies Conference. He put up a quote from one of my earlier posts about Mechanical Turk (the last paragraph).

As I've said before, I work for Werner Vogels in the Distributed Systems Engineering group at amazon. We work on platform components (caching, messaging, persistence, logging, etc) that many teams (including AWS) rely on.

Put another way, we build the muck that powers the muck that could power your business.

Oh. and we're hiring. :)

Sunday, September 24, 2006

better tasting veggies.

I tend not to crave capsicum (green peppers) when I'm in India because I cook it so often at home.

The other day we had a simple cauliflower and capsicum sabji for lunch and the taste and flavor of the capsicum was fantastic. It sounds a little overly dramatic, but biting into it felt like I was eating capsicum for the first time.

Just a gentle reminder that the oversized, brightly colored, genetically engineered vegetables available in American grocery stores are not all that they appear; and all that glitters is not gold.

Monday, September 04, 2006

rain

mmmm.
I'm in Pune right now and it just started raining really hard after a morning/afternoon of sunshine.
I love (and missed) the smell of rain. mmm. And the sound of hard rain (vs. the seattle drizzle). And it's over before I could finish writing this.

I played golf on Friday morning and again today. Friday was great, but today I lost 7 balls. I came home more than a little dejected.

Saturday, August 19, 2006

Totalled by Muir

One of my friends was really enthusiastic about the two of us trying to summit Mt. Rainier this year. I was a little hesitant and committed only to doing some regular hiking with him in preparation for a summit next year.

Last week we decided to do a hike this weekend to Camp Muir, the basecamp for Rainier.

I picked him up early this morning and we were on the road by about 5:40am. We got there a little after 8am and hit the trail at 8:40am. Within an hour we had completed the first 2.2 miles and about 2000ft of elevation gain. This was on a very well-maintained trail that is actually mostly paved. The next 2 miles and 2000+ ft of elevation gain through snow took us 3 hours (3.5 for me).

The sun was painfully bright. In my mind snow is always associated with extreme cold. So I was dressed totally inappropriately. It was HOT. The high altitude (in combination with the heat/sun) caused my temples to throb and I got a slight feeling of nausea that intensified as we went up. The last hour of the ascent was quite gruelling for me because every time I got out of breath, I would also feel nausea. Coming down was somewhat fun because we would do controlled slide/steps down the snow (also known as Glissading). However, my nausea still persisted so I'd have to stop every few minutes - even though I wanted badly to get out of the sun.

It was a full 8 hour day for me; I got back to the parking lot around 5pm. In order to summit Rainier, RMI recommends that you be able to hike to Camp Muir in between 3-5 hours, with a full load on your back.

4.5 hours with a day pack is pretty pathetic but it's a checkpoint at least. At least now I know where I am vs. where I need to be in terms of my fitness level.

Friday, August 18, 2006

omakase

Amazon apparently launched Omakase recently. It's an adsense-like program that shows the user products based not only on the page-content (ala adsense) but also based on the user's preferences.

While this doesn't help sell services, it's an amazing way to sell products. Amazon knows products and it knows consumers. I know often-times on the amazon page, the products shown to you are in fact items from your own wishlist - that's probably because people are more likely to buy products for which they've already expressed interest.

Now, if I'm browsing around the web, amazon already knows what I've got in my wishlist, what I've been looking at on amazon, what "similar" people have been looking at, what they've bought, and how the site I'm looking at now might influence what I want to buy.

That's an aweful lot of information to put together. Although the current algorithms may not exploit all of this information my guess is that, as they iterate on Omakase, the recommendations will only get better.

Now if only you could ASIN-ize services...

Thursday, August 17, 2006

never work again...

Last weekend we were at Mother's Bistro (great place!) in Portland, OR and had a very cheerful server. The table next to us must've made some comment to him about how cheerful he was... his response:
"Find a job you love, and you'll never work again"

Though I'd read that before, it was great to hear someone say that about their own job.

Monday, August 14, 2006

windsurfing

This weekend, Nate, Sindya, and I to drove down to Hood River, OR to take windsurfing lessons. By the time we got in, it was about 2-ish. After signing waivers and swiping credit cards, we roamed around the city to looks for sunglasses for Sindya, and sunglass retainers for Nate.

The city is awesome. It reminded us of a ski town, except for water sports. There were windsurfing, kite surfing, and kayaking shops everywhere.

The windsurfing class was a lot of fun; I was able to get the hang of the basics after about 90 minutes - which left 30 minutes of confident surfing at the end :) We were in a lagoon, shielded from the strong winds. We later checked out the windsurfers on the Columbia river and man - they were flying by at absurd speeds.

Afterwards, we drove to Husum, WA to take a look at a white water kayak that I'd been eyeing on craigslist. After trying out a roll in the pool, I decided to buy it.

That evening we camped at viento state park. Since there weren't too many bugs in the air, we were able to sleep with just the rain-fly and no tent (it was cool enough at night that sleeping outside would've been a little too cold) - which was great because I could see the stars as I fell asleep and everytime I woke up.

We had planned on windsurfing some more on Sunday morning (exploiting the 1 hour free rentals that we got with the class) but there was absolutely no wind. Instead we drove into Portland and had a humungous brunch at Mother's. The line there has been too long the past few times so I was glad to make it in.

Luckily Sindya agreed to drive for the first hour after we left Portland; I was still digesting my food. The drive back was terrible. We left at 2:45 and didn't get back home until almost 8pm.

But now I have a white water kayak.

Sunday, July 23, 2006

kayaking

Five or six years ago I tried white water rafting as well as inflatable kayaks several times but I was always jealous of the hardshell kayakers on the river.

Last year in India I tried several times to go hardshell kayaking and learn how to do the eskimo roll. My three half-day attempts at learning didn't get me anywhere.

I took a class in Seattle in June this year but couldn't attend the second of the river days. Although I was able to eskimo roll in the pool, I couldn't pull it off in the river when I took a fall.

Yesterday I took a make-up class (for the second day that I had missed in June) and went down to a river again with NWOC. It was fantastic. It was only class II rapids but I was able to get in and out of eddies, I was able to roll comfortably in still water, and I even managed to roll twice while taking a fall in the rapids.

In addition to all that, I met some prety cool people during the class and had a beer with them at the Rogue Brewery in Issaquah.

Now I just need to go buy myself a kayak.

Friday, July 14, 2006

Thursday, July 13, 2006

cpu cycles

Yesterday I was faced with a design tradeoff on a Java API: make it
  • clean and easy to understand but slightly inefficient; or
  • more efficient in the simple case but a little more complicated overall?
My coworker provided some great insight. To paraphrase him :
APIs will never get cleaner, but CPU cycles will always get cheaper

That doesn't mean that one shouldn't try to design APIs that are efficient. It just means that you have to be careful how much emphasis you place on that.

Monday, July 10, 2006

making ghee

In general, I stay away from fried and oily foods - not because I'm watching my diet but because I just don't like them (there are exceptions, of course!). But I can't give up whole milk, or ghee. Eating hot chapatis with ghee on them is one of those pleasures that I'm not going to give up anytime soon.

Making ghee is not too difficult. The core process is as follows:

  1. Start with a few sticks of unsalted butter (assuming you're not using homemade butter!)
  2. Put it in a pot on medium heat but watch it carefully and stir it every now and then to make sure that the bottom doesn't burn. (I use a nonstick pot just in case)
  3. Once it begins to boil, you'll see a thick froth forming on top.
  4. My grandma told my mother to cook with her nose and not her eyes. Once the butter turns into ghee, you'll smell the unmistakable smell of ghee. If you don't smell it, or don't know what it smells like - don't worry. In addition to that fantastic smell, you see the froth will thin out a lot, and the liquid below it turn clear. That's the ghee. You will also see some grainy residue sitting at the bottom.
  5. Take it off the heat immediately and let it cool slightly. This is where you have to be watching it carefully. If you leave it on the heat too long, you'll burn the residue and all of the ghee will acquire a burnt taste.
  6. Carefully strain the liquid ghee into a jar while it's still warm (before it solidifies). I just use a metal tea strainer that looks something like this.
  7. Don't throw away the solid residue! It's edible and actually has a great (albeit maybe acquired) taste.
  8. To use up the residue and any ghee remaining in your pot, cook a cup or two of basmati rice in that pot. It'll taste fantastic!


It takes about 15-20 minutes from the time you put butter in a pot to when the ghee forms and as you can see, the recipe is quite straight forward.

That said, I think everyone has their secret mixins to make the ghee taste better. My mami (mom's brother's wife) puts in a Betel leaf for flavor, and some rock salt to make it more grainy when it cools (the opposite of 'grainy' ghee is 'waxy' ghee - not considered a good quality). My only mixin is a few cloves which help give it a nice color and subtle flavor.

If you have a special ghee recipe, I'd love for you to share by posting it in the comments below!

Thursday, June 29, 2006

Mr Anderson

No, not the dude from the Matrix. But Chris Anderson of longtail fame was at amazon today to promote his new book. I took away some good nuggets, even though I used to follow his blog quite regularly.

  • The long tail arises from
    1. variety
    2. inequality
    3. network effect

  • When plotted on a log-log scale, the long tail is a straight line. Most sales numbers drop off from this line because of limits of
    1. findability
    2. inventory

  • We can exploit the long tail by
    1. democratising production
    2. making distribution more efficient
    3. improving findability

  • Not everyone does everything for money:
    1. We are entering a "reputation economy" (people blog or write books for reputation, not money)
    2. Our talents are more varied than our job functions (I love this one!).
    Both of these point towards the rise of the amateur professional (the expert who doesn't do it for money)

  • Don't confuse limited distribution with shared taste (i.e. boxoffice hits happen because the supply of movies is limited by distribution, not because everyone necessarily loves those movies)

  • Everyone deviates from the 'mainstream' somewhere