Saturday, August 09, 2008

Can you spell 'frame-up'?

From an article in The Hindu about Aafia Siddiqui:
...Ms Siddiqui was arrested by Afghan police in July along with her son — the date is unclear — after they found them loitering outside the compound of the Governor’s house in Ghazni. They questioned her, and on suspicion, checked her bag, in which they allegedly found “suspicious” liquids in glass containers, a bomb-making manual, and some material on New York and its landmarks. She was handed over to the U.S. authorities on July 17.

On July 18 , Ms Siddiqui is said to have fired at American soldiers who were present at the Afghan facility where she was being held, with a rifle that one of the soldiers had left lying around. A soldier fired back, wounding her. Charged in a criminal complaint filed in the Southern District of New York with one count of attempting to kill U.S. officers and employees and one count of assaulting U.S. officers and employees

Saturday, July 26, 2008

Just Saying

Amazon has released information about the cause of the recent S3 outage and what they are doing to ensure that their "performance is statistically indistinguishable from perfect":
Here are the actions that we're taking: (a) we've deployed several changes to Amazon S3 that significantly reduce the amount of time required to completely restore system-wide state and restart customer request processing; (b) we've deployed a change to how Amazon S3 gossips about failed servers that reduces the amount of gossip and helps prevent the behavior we experienced on Sunday; (c) we've added additional monitoring and alarming of gossip rates and failures; and, (d) we're adding checksums to proactively detect corruption of system state messages so we can log any such messages and then reject them.
Except for (d), these actions don't really address the cause, but only mitigate the effects.

Thursday, July 24, 2008

Quicksort in Lisp

Version #1:
(defun generate-lt (value)
(lambda (x) (and (< x value) (list x))))

(defun generate-eq (value)
(lambda (x) (and (eq x value) (list x))))

(defun generate-gt (value)
(lambda (x) (and (> x value) (list x))))

(defun quicksort (list)
(if (<= (length list) 1)
list
(let ((pivot (nth (truncate (/ (length list) 2.0)) list)))
(append (quicksort (mapcan (generate-lt pivot) list))
(mapcan (generate-eq pivot) list )
(quicksort (mapcan (generate-gt pivot) list))))))
Duplication of code in the 'generate-' functions. Need a macro.

Version #2:
(defmacro generate-comparator (value fn)
`(lambda (x) (and (,fn x ,value) (list x))))

(defun quicksort (list)
(if (<= (length list) 1)
list
(let ((pivot (nth (truncate (/ (length list) 2.0)) list)))
(append (quicksort (mapcan (generate-comparator pivot <) list))
(mapcan (generate-comparator pivot eq) list )
(quicksort (mapcan (generate-comparator pivot >) list))))))
Looks elegant, but can we make this even more concise?

Version #3:
(defun quicksort (list)
(if (<= (length list) 1)
list
(let ((pivot (nth (truncate (/ (length list) 2.0)) list)))
(append (quicksort (mapcan (lambda (x) (and (< x pivot) (list x))) list))
(mapcan (lambda (x) (and (eq x pivot) (list x))) list)
(quicksort (mapcan (lambda (x) (and (> x pivot) (list x))) list))))))
Seven lines of condensed confusion. Not to mention wreaking havoc with the layout of the blog.

(Blog post inspired by a) a rekindled interest in Lisp and b) a sudden urge to share the joy of having found a non-gratuitous use for macros)

Update: Version #4:
(defun quicksort (list)
(if (<= (length list) 1)
list
(let ((pivot (first list)))
(nconc (quicksort (remove-if #'(lambda (x) (>= x pivot)) list))
(remove-if #'(lambda (x) (not (= x pivot))) list)
(quicksort (remove-if #'(lambda (x) (<= x pivot)) list))))))

Saturday, July 19, 2008

Who Moved My Chees(y Distro)?

[Warning: boring post about Linux distros]

Kubuntu has been my distro of choice for more than a year; I had reached a point where the download-new-distro-spend-a-week-tweaking-it was no longer appealing. Every once in a while the urge to go distro-hopping would hit, but the comfort zone of status quo would prevail.

But the cheese did move one day: KNetworkManager would drop connections at random, not remember the wireless router's SSID, and so on, and things got fairly annoying. Not to mention the fact that things were, on the whole, not as zippy as they used to be. Time for a change.

I decided to give OpenSuse 11.0 a try. After a few false starts with the ISO download (see problem with KNetworkManager above), SuSE was up and running, but no go. What with my peeves with KDE 4.0 and the problems with the Java plug-in (1.5 would crash Firefox while 1.6 would make the applet disappear after one or two operations), I quickly abandoned it.

I have tried out MEPIS in the past, and except for the sound problem found it to be very good. True enough, 7.0 turned out to be equally good, but the sound problem seemed to have been carried over from 6.5. But this time a quick modprobe snd_hda_intel took care of it (Did I try this before? Not sure), and so here I am, with SimplyMEPIS 7.0 as the distro de jour (well, not exactly a day -- I plan to use it for at least six months).

Good things about MEPIS:
  1. Very zippy

  2. Comes with a lot of stuff already bundled, so you don't have to look beyond the CD for things like the Java Runtime, Skype, etc.

  3. Better handling for wireless (KNemo in place of KNetworkManager)
The not-so-good things:
  1. Some of the bundled packages are slightly outdated (Firefox, Postgres)

  2. I found some random weirdness with the mounting of other partitions. For some reason I couldn't get them to mount on a directory I had created in the root partition. Instead, I had to allow them to be mounted as /mnt/sda*, and then create a symlink to this directory.

Sunday, July 13, 2008

Put a Shark in Your Tank

There's this story about how Japanese fishermen put small sharks in their fish tanks to keep the fish fresh and better-tasting till they reach the shore. A Google search for the title of this post will give you the full story.

I have nothing against this story -- kudos to the Japanese fishermen for solving their problem in an innovative manner. What I do take exception to is holding up this story as motivational lesson:
Instead of avoiding challenges, jump into them. Beat the heck out of them. Enjoy the game. If your challenges are too large or too numerous, do not give up. Failing makes you tired. Instead, reorganize. Find more determination, more knowledge, more help. If you have met your goals, set some bigger goals. Once you meet your personal or family needs, move onto goals for your group, the society, even mankind.

Don't create success and lie in it. You have resources, skills and abilities to make a difference." So, put a shark in your tank and see how far you can really go!
That's all very well, but there's another -- admittedly pessimistic -- way of looking at it, from the perspective of the poor fish: no matter what you do, nothing matters in the end; you will end up getting eaten anyway, so you might as well surrender to the shark and get it over with ("Oh, these poor humans will end up with not-so-great-tasting fish? Bite me").

Also, just because the fish taste better, it doesn't mean that they had a hoot, trying to save their asses from the %^&# shark.

Sunday, July 06, 2008

Something to Think About

"Have you imagined commodities like steel, crude oil, red chilli, pepper and gold is [sic] a highly potential [sic] investment option. Read on to see why? [sic]" begins an ad in The Times of India today. It goes on to quote figures like 47.58% for cardamom, 25.22% for gold, and 23.80% for crude as the returns in the derivatives market for these commodities, and pitches for a training course on derivatives.

Two points:
  1. Per a report by a United States Senate subcommittee entitled "The role of market speculation in rising oil and gas prices", a speculator 'does not produce or use the commodity, but risks his or her own capital trading futures in that commodity in hopes of making a profit on price changes.'

  2. The folks who enroll for the above mentioned course are already suffering from the actions of people whom they are trying to emulate ("I guess I'll have to take the public transport to attend the classes because petrol is so expensive these days. Those ^&*$ speculators!").

Saturday, June 28, 2008

Here's an idea for a startup project

I was (re)reading Paul Graham's older essays [*], and was thinking about his contention that one can get ideas for startups just by reading a business newspaper for a week.

Well, I didn't do that, but here's an idea all the same.

The IT Department has taken to electronic filing of tax returns in a big way, and have published an XML schema for this, in addition to launching web services for consuming the electronic filings.

I have been using this system for filing my returns, and have found the procedures in place quite cumbersome -- last year it was Adobe Reader , with all its quirks and bugs, while this year it's an Excel document that serves the same purpose, though not very well.

Now, if somebody comes up with a tool that does this job in a more user-friendly manner, I'm sure there would be takers. Mind you, the tool would not be very complicated, so one cannot charge more than, say, 50 bucks for it, but there's still some money to be made.

There is already a web-based solution for this (taxsmile.com), but it involves storing your personal finance data in somebody else's servers. The tool I have in mind will be a purely client-side solution, one that will simply take your data and create an XML version of it that you can upload to the IT department's website yourself. What the hell, one might even go all the way and put in the functionality to upload the XML file as well.

Things like piracy, ease of installation (think applets) are to be worked out, but hey, this is just a blog post, not a pitch to a VC.

[*] I know, I said earlier that I had stopped reading them, but his essays keep appearing on Reddit's front page, and let me be honest -- he does write well, and makes you question a lot of things.

Dave's Back

... and with some good stuff as usual:
I guess I need to pause here briefly to fend off a barrage of e-mails railing against my ‘racist’ reference to Barack Obama as a “whitish black guy.” For the record, I am not suggesting here that a black man cannot be articulate and well groomed. No, what I am suggesting is that what is fundamentally racist here is the fact that Mr. Obama is universally referred to as “Black” or “African-American” despite the fact that, according to my exacting mathematical calculations, he is actually precisely ½ black and ½ white. Wouldn’t it then be just as accurate to refer to Obama as “White” or “European-American”? Why is he disqualified from inclusion in the Caucasian ‘race’ even though he is every bit as white as he is black? In labeling him as “black,” aren’t we really saying that his bloodline is tainted? Aren’t we saying that, even though he has Caucasian blood, it isn’t pure enough for inclusion in the Master Race?

Two Words for Paul Krugman: Um, No.

I am usually in agreement with Paul Krugman's views, but not with this one:
What about those who argue that speculative excess is the only way to explain the speed with which oil prices have risen? Well, I have two words for them: iron ore. 

You see, iron ore isn’t traded on a global exchange; its price is set in direct deals between producers and consumers. So there’s no easy way to speculate on ore prices. Yet the price of iron ore, like that of oil, has surged over the past year. In particular, the price Chinese steel makers pay to Australian mines has just jumped 96 per cent. This suggests that growing demand from emerging economies, not speculation, is the real story behind rising prices of raw materials, oil included.
If the emerging economies continue to grow at more or less the same pace as for the last two or three years (and, in fact, are even slowing down, like in the case of India), where is this alleged "growing demand" coming from?

Thursday, June 26, 2008

Germany 3 - 2 Turkey

... and Semih Şentürk can STFU at last. Maybe it's just me, but I found his repeated gesture of putting his finger to his lips and 'silencing' the opposite team's fans after scoring a goal incredibly obnoxious.

BTW, the loss of pictures from the stadium from the 75th minute or so onwards, just when things got interesting was, well, unique.

Sunday, June 22, 2008

Hilarious

Gail Collins:
... picking a running mate is -- no disrespect intended -- like picking a pet. How much time are you planning to spend with the little fellow? How much exercise will he be getting on an average day? On the extreme, you have the William Wheeler model ("There's the living room. Go find a corner and sleep in it") On the other end, there's the Cheney version in which the pet takes over the chequebook, diversifies the family investment portfolio and starts strafing at the neighbour's cat.

There's a place for one-touch passing

... and it isn't in front of your own goal. When you have the opposite team's fowards breathing down your neck, the safest thing to do is to boot the ball, and hard.

I'm referring to the Russians. Not that they came to grief because of this, but they did make their supporters' hearts skip a bit. Having said that, to thrash a team as strong as the Netherlands with such delightful one-touch passing is something special.

Arshavin is going places next season, no doubt about it.

Saturday, June 21, 2008

Yeah, That'll Do It

From The Hindu:
...the general apprehension is that of yet another bout of monetary policy tightening by the RBI - which could lead to increases in lending rates with respect to automobile, housing and consumer loans.
New loans will become dearer, alright, but how's this going to have a direct bearing on the family budget? OK, I get it, below-poverty-line families thinking about buying a car, a house, or a flat-screen TV will balk at the high EMIs, and will therefore have more disposable income to spend on luxuries like food, thereby offsetting the pinch of higher prices. Bottom line is, this will not have a first order impact on inflation: the fuel prices hike is too much of a countervailing force on the other side.

On a side note [*], now that the inflation rate has reached truly alarming levels, the captains of industry have woken up. Not out of concern for the common man, but about sustaining economic growth:
Inflation is not only a concern for the government but also a concern for the industry.. [the unabated rise in prices] reduces the space for fiscal and monetary policy maneuverability without seriously impacting growth.
[*] Come to think of it, the concern over a rise in lending rates for say, flat-screen TVs, actually ties in with the worry about sacrificing economic growth. Silly me.

Quote of the Day

From a letter in today's Hindu:
The message that is loud and clear is: if you want a free helicopter ride plus your photo on the front page of national newspapers, sit tight on the main railway track and hold the nation to ransom.

Friday, June 20, 2008

Spot the Irony

Obama has to vehemently deny the 'slur' that he's a Muslim, while the EU is being chastised for blocking Turkey's entry into the Union:
All this is wrong-headed. Turkish membership of the EU is important - Bush is right about that - for historical reasons as overarching as Europe's debt to the nations Yalta imprisoned. No more important bridge could be forged at this moment between the Christian and Muslim worlds.

Thursday, June 19, 2008

Fsck You Fridays

Dear cubicle dweller,
  1. Tired of having to put up with colleagues who refuse to respond to your emails unless you copy their supervisor in the email and/or tag a return receipt notification?

  2. Do you feel like smashing your fist on the face of the punctilious jerk who a) rejects your IT request form because you had selected the wrong category and b) refuses to respond to emails asking him to enlighten you as to what the fricken correct category is?

  3. Are you sick of HR folks whom you talk to 24 hours ago about your problem, but who feign complete loss of memory and ask you to start from the beginning all over again?
Fret no more, because 'Fsck You Fridays' is here. Every Friday, between 3 and 4 PM, one workstation on each floor will be open to you and your fellow cube-dwellers for you to express your unalloyed love for the above-mentioned folks. Just walk up to the screen, type in the employee number of the person you would like to bless, a short description as to why you love them, and press 'Submit'. The object of your affection will instantly receive a missive (anonymous, of course) that encapsulates your sentiments, accompanied by a cheap plastic hand (life-sized) performing a one-finger salute.

Thrilled? Jumping with joy? Wait, there's more. Employees winning more than ten tokens of affection in a month will be entered in a monthly 'Screw You Sundays' raffle where...

Regards,
Corporate Cross Functional Team on Motivation and Employee Empowerment (CCFTMEE)

REST

I have been coming up to speed on REST for the last couple of days or so. Some obvious and some not-so-obvious things I've learned:
  1. REST may be the architectural style on which the World Wide Web was built, but it's not exactly tailor made for web applications (accessed by humans from browsers).

  2. Since REST favors a stateless mode of interaction, transactions will have to be done outside REST (not even sure if this is possible), or we'll have to treat each service invocation as atomic, and build compensating transactions a la BPEL.

  3. REST mandates that we model the application in terms of resources and representations. Not sure how well can this be mapped to the domain we are modeling. It's easy to say 'think in terms of resources, not services', but dressing up an itinerary creation service as an itinerary creator object (sorry, resource) doesn't cut it, IMHO.

  4. We need an HTTP client to program to a REST service; support for PUT/DELETE in browsers is not available (yet?). Don't know whether this can be done in JavaScript.

  5. If we want to architect a web application whose service layer is implemented in REST, we will need two web/application server layers -- one to receive the request from the browser client, and another that actually implements the service. The two layers can be collocated, of course.

  6. This is a minor nit: since one of the strengths of REST is the uniform interface, there is no interface specification (equivalent of WSDL), and we cannot generate the service invocation code automatically.

  7. More network traffic as we need to transport more information to the service because of its statelessness.

  8. Authentication information needs to be sent with each request. This implies that the first layer in point #5 will have to manage the session data if it is servicing a user logged in from the browser application. The scalability benefits are therefore not available to this layer.

  9. Issues like locking, concurrency, etc. seem tricky. I haven't thought this through yet, but off the top of my head, things like including a timestamp field in the representation seem necessary.

Saturday, June 14, 2008

That's a new one

Spammers/Hackers have now taken to insulting their potential targets: there's an email in my spam folder with the subject 'You look really stupid rajesh.jayaprakash' with a link to a Windows executable called video.exe, which is probably malware.

Commitment

Yuvraj Singh has agreed to present the Man of the Match award at a Euro 2008 match on Sunday. Nothing of significance here -- he is supposedly a Man United fan and would love to meet Ronaldo -- except that if the Tri-Nation final on Saturday spills over to the reserve day, i.e. Sunday, there will be a conflict in his schedule.

Turns out that Carlsberg's first choice was Dhoni, but he declined on account of the above potential schedule conflict. Considering that Dhoni is also a keen football fan, this says something about his commitment, doesn't it? Or does it have more to do with his being the captain of the team?

Friday, June 13, 2008