Saturday, October 04, 2008

Near-Death Experiences

There's an article about research into 'out-of-body' experiences in yesterday's Hindu (note: the online edition is a truncated version of the print article). I have been fascinated with NDE for quite some time, and so I was looking forward to knowing whether there is any conclusive evidence one way or the other. Sure enough, there is mention of an objective method to collect evidence (emphasis mine):
I wanted to investigate if these experiences could be attributed to the drugs that we gave the patients, to abnormal levels of oxygen or carbon dioxide in the blood and was there a way of verifying the out-of-body component? So I hid symbols on top of cardiac monitors at each patient's bedside which could only be viewed from an out of body perspective.
That sounds promising; reading on:
In June 2008 my book, an academic monograph, "The Near-Death Experiences of Hospitalized Intensive Care Patients: A Five Year Clinical Study" was published by The Edwin Mellen Press. The reason that I chose to publish an academic book is because I believe these experiences need to be taken seriously.
The article then goes into the details of the study, its purported benefits, and so on, but there is no mention of whether any evidence supporting these experiences was found.

Methinks there's no conclusive evidence; or, it's a "buy my book to find out all about it" ploy. Also, what the heck is an academic book? Has it been peer-reviewed like an academic paper?

Friday, September 19, 2008

Predatory Lending

Just when the whole world is waking up to the fact that too much of leverage is a bad thing, there's an ad in today's Hindu for home loans with a 3% down payment. The lender is none other than ICICI Bank, who is also in the news today for the wrong reasons:
Mr. Chidambaram pointed out that the country’s public sector banks, in which the government holds the majority shareholding, did not have any “undue exposure” and whatever they had were in accordance with the Reserve Bank of India guidelines. ICICI Bank, however, did have some exposure and it had made the necessary disclosures.
No surprises there.

Sunday, September 14, 2008

The Best Argument Against Democracy

.. is a five minute conversation with an average voter.

Here's a letter to Deccan Chronicle in favour of the Indo-US nuclear deal:
I have been following (Brahma) Chellaney's articles on the nuclear deal. From the beginning he has been assiduously following a line quite opposite to the one held by the government. In a democratic country, every citizen has a right to express his or her opinion, and Chellaney is one among them. He, however, appears to be a diehard critic of the deal for reasons best known to him.
Excuse me, "reasons best known to him"? Here's this guy, who has been busting his hump, wading through the text of the various documents pertaining to the deal and the NSG waiver, and putting down bulleted points for why he is against the deal, and we still get questions like this.

Reminds me of the Friends episode where Phoebe announces that she wants to carry her brother's baby, and Ross lists a number of reasons why she needs to think this through, and Phoebe's reacts "What's your point?"

Staying on the nuclear deal, there seems to have been a sort of realignment among the supporters and opponents. Hindu started out as a critic, then revised its stance, and is now once again giving prominence to things that are wrong with the deal. DC, on the other hand, started out negative, but is keeping quite nowadays -- Chellaney's columns notwithstanding -- about the various bits of bad news (no columns from Seema Mustafa, too).

Wednesday, September 03, 2008

Of Objects, Classes and Metaclasses

"The greatest talents are slowly mastered" (Lao Tzu)

It started with the metaobject protocol, moved on to metaclasses, and culminated in this paradoxical statement from Wikipedia: "[T]he metaclass of Metaclass is an instance of Metaclass."
  • An object is an instance of a class.

  • A class is a singleton instance of a metaclass.

  • A class is also an object.

  • A metaclass is also a class (as well as an object, of course).

  • A metaclass, being a class, is a singleton instance of a metaclass.

  • Metaclasses are instances of the class Metaclass.
Which, I think, leads us to the Wikipedia quote.

Class diagram (Smalltalk-specific, with a few bits omitted for clarity; also, NumberMetaClass isn't named as such):



I started off with the profound quote from the Tao Te Ching, but I'm not really sure what the utility of this stuff is, unless I'm implementing a Smalltalk virtual machine. Well, I can at least sleep peacefully at night, knowing that if ever I run into the Wikipedia quote again, I know that I can figure it out. Sort of.

Staying on the subject of objects (pun unintended), here's a delightfully candid quote from an interview with Alexander Stepanov (emphasis mine):
Question: I have done a search on Lycos for your papers and I only found two titles: the STL manual and a resume of you presentation of STL to the standardization committee.

Answer: Well, I am lazy, but not that lazy. I probably published 20 papers and a book. Many of them are on different STL sites. (Dave Musser's site probably has several.)

Question: Which book?

Answer: The book is "The Ada Generic Library: Linear List Processing Packages", by David R. Musser and Alexander A. Stepanov, Compass Series, Springer-Verlag, 1989. It is not really worth reading.
Trivia: there are 23 occurrences of the word 'class' in this post.

Saturday, August 30, 2008

Movie Review: The Dark Knight

The first thing that comes to mind when I think of The Dark Knight a week after watching it is the great role played by Heath Ledger. The scene where he talks about his drunk father had me involuntarily touching my face, in anticipation of the gore that mercifully remains off-camera. All in all, a great villain. Pity we won't get to see him again.

Batman, in contrast, is not so great. He is overshadowed in so many scenes; can't blame him really, when you have folks like Michael Caine and Morgan Freeman as co-stars (not to mention The Joker).

The movie may be topical for an American audience, in that it explores things like how too much focus on security could lead to fascism, what people are willing to sacrifice for their personal safety [*], and so on, but these things are of not much interest to somebody who is just looking for a good action movie.

One thing that strained the credibility a bit was the power wielded by the Joker, and how he gets access to all the resources that he commands. Would have been easier to believe if he were a traditional comic book villain with superpowers or a super-weapon.

Oh, I've mentioned this before, but what's with these superhero movies where people are not able to put two and two together and figure out that the caped crusader bears a more than passing resemblance (mask notwithstanding) to the well-known local billionaire?

[*] The denouement of the ferry scene, while inducing the intended swelling of hearts in the audience, seemed a trifle contrived. Maybe it's just the cynic in me.

P.S. The high-tech kidnap scene in Hong Kong would have looked more natural in a Bond movie or in an MI sequel, IMO.

Friday, August 29, 2008

WTF?

I received this in an email from Citibank (italics mine):
Dear Customer,

When did you last abandon the boardroom in pursuit of play? Forsaken corporate schedules in favor of a holiday itinerary? Swapped your starched suit for a glowing tan?
...
Dear Marketroid, if you click on the 'Profile' link on the top right hand corner of this page, you will see my picture. Please note that I am a dark-skinned Indian, and that a 'glowing tan' is the last fricken thing on my mind. Considering the fact that the email was sent from 'india.marketing@citi.com', you guys will have to either a) stop mindlessly using copy from your international marketing *ahem* collateral or b) kindly remind your copywriters that, while they are enamoured with all things western, it wouldn't hurt them to reflect once in a while on the fact that they are in India, where people buy Fair and Lovely, not Coppertone.

Saturday, August 23, 2008

Lisp or Smalltalk?

I have been thinking about doing all my side projects in Lisp -- due in no small measure to taking the time to finally read Practical Common Lisp cover to cover -- and have been playing around with the various Lisp environments and libraries. Impressions:
  1. Programming in Lisp makes one feel good (I know, this is about as touchy-feely as you can get). The constant effort to abstract things away, looking for ways to automate repetitive code fragments, and so on brings with it a real sense of progress (at least from a programming perspective).

  2. Though Lisp shares the concept of an image with Smalltalk, this is not as readily apparent and IMHO as powerful as Smalltalk; for example, I need to load packages through startup files each time I start the environment.

  3. The Lisp environments are not as friendly as the Smalltalk IDEs where everything hangs together, so to speak.

  4. Library support also seems more cohesive in Smalltalk. asdf-install does provide a way to pull packages easily, but there is no way to see what packages are currently installed in the image, what *are* the 'right' packages to install, etc. Not to mention the need to load packages every time using the startup file.

  5. File-based development seems like a regressive step after programming in Smalltalk. For one thing, I don't know if there is an easier way to load the code from all my files than calling load every time I start the environment.

  6. I have a small homegrown wiki application running in VisualWorks which I wanted to see if I could redo in Lisp. After googling a bit and searching the Common Lisp web sites, two frameworks seemed worth pursuing: WebActions (modelled on Struts) and Weblocks (a Seaside-like continuations-based framework). Weblocks seems the more promising, no doubt owing to the advantages of using continuations.
From a programming perspective, I guess it does not really matter whether I choose Lisp or Smalltalk (unless I run into a situation where the use of macros is the only way to get something done), but Smalltalk does score from a convenience perspective. I think I'll stick with ST.

Monday, August 11, 2008

Joke of the day

From a Slashdot comment:
Where did you get your php info? foreach was introduced in PHP4...
I get mine from phpinfo();

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.