Saturday, November 29, 2008

... And They Come Out of the Woodwork

Some false flag conspiracy talking points about the Mumbai attacks that are doing the rounds:
  1. Hemant Karkare was killed because he was close to exposing the truth about the involvement of the establishment in the Malegaon blast.

  2. One of the pictures of the terrorists shows him wearing a red thread on his right arm, so the whole thing is a right wing Hindu conspiracy.

  3. Some of the terrorists were seen ordering liquor (gasp!), so again it's an indication that it's a right wing Hindu conspiracy.

  4. All the Jewish/Israeli hostages at Nariman House escaped (factually incorrect).

  5. To top it all: India had a hand in 9/11

  6. Update: The hits keep coming: India, with its large foreign exchange reserves, is pressuring the United States into doing its bidding (whatever that is)
I used to have a lot of respect for Whatreallyhappened.com and Rigorous Intuition, but some of the posts there have left me shaking my head in disgust. There are questions still to be answered, no doubt, but it doesn't behoove folks calling themselves rigorous to jump to conclusions before all the facts are in and start mouthing off (BTW, the tone of certain comments in the Mumbai attacks thread at RI border on the antisemitic).

Saturday, November 22, 2008

Jargon, Jargon Everywhere

Fund Manager Speak:
The macro headwinds for equities are strong with the Reserve Bank of India, in their first quarter review of the annual monetary policy for 2008-09, lowering the growth forecast for the financial year 2008-09 by half a percentage point from 8.5% to 8%.
Translation:
Bad time for equities -- RBI has forecast that this year's growth will be 8% and not 8.5% as previously thought [*].
Fund Manager Speak:
The investment objective of the scheme is to generate capital appreciation from a diversified portfolio of equity and equity related securities.
Translation:
This scheme hopes to make money by buying shares low and selling them high; we are also not putting all our eggs in one basket.
[*] Note the use of the word 'strong' in a negative context; one can almost be mistaken into thinking that some good news is being delivered.

Joel on Friedman

Probably the most succinct, yet devastating critique of Thomas Friedman I've seen, Matt Taibbi notwithstanding:
... Thomas Friedman, who, it seems, cannot go a whole week without inventing a new fruit-based metaphor explaining everything about the entire modern world, all based on some random gibberish he misunderstood from a taxi driver in Kuala Lumpur

Thursday, November 13, 2008

Steps to Build and Run SUIF in Linux

  1. Install these packages:

    * bison
    * flex
    * graphviz
    * gcc-2.95
    * tcl8.4
    * tcl8.4-dev
    * tk8.4
    * tk-8.4-dev

  2. Extract the contents of basesuif-2.2.0-4.tar.gz to a directory of your choice

  3. export NCIHOME=<above directory>

  4. cd $NCIHOME

  5. /bin/sh ./install --with-CC=/usr/bin/gcc-2.95 --with-CXX=/usr/bin/g++-2.95 \
    --with-CXXLINK=/usr/bin/g++-2.95 --with-TCL_INCLDIRS=-I/usr/include/tcl8.4 \
    --with-TCL_LIBDIRS=-ltcl8.4

  6. make setup

  7. make

  8. . nci_setup.sh

  9. make test
To install other packages (I used these steps to build dataflow, suifbrowser and tclsuif):
  1. Extract the .tar.gz file to $NCIHOME

  2. Edit each package's makefile and:

    * Change occurrences of '-ltcl8.0' and '-ltk8.0' to '-ltcl8.4' and '-ltk8.4' respectively.
    * Add -DUSE_NON_CONST to the CXXFLAGS environment variable

  3. navigate to the package's directory and type 'make'
To run the SUIF binaries, set the following environment variables: LD_LIBRARY_PATH ($NCIHOME/solib) and VISUAL_TCL ($NCIHOME/suif/suif2b/suifbrowser/visual_tcl_lib/).

Sunday, November 09, 2008

The Global Financial Crisis

Some random thoughts on the global financial crisis:
  1. People keep calling it a liquidity problem, while it's actually a solvency problem. But in a world of fractional reserve banking and insane leveraging, there's not that much difference between the two, I guess.

  2. Fractional reserve banking may be the root cause of all the evils by causing unchecked expansion of credit and money supply, but would a world where all the currencies are backed by gold be capable of sustaining the prosperity of everybody (or even lifting more people out of poverty), when considering the rapid rise in the world population in the last hundred or so years?

  3. I was impressed enough with the tenets of Austrian economics -- due in no small measure to reading Mike Shedlock's blog -- to go out and buy Economics in One Lesson. While the arguments against government meddling for short term gains are impeccable in theory, one wonders whether it is possible to apply the theory to the real world without causing misery to large segments of the population. Consider this argument against minimum wages:
    When such consequences are pointed out, there are those who reply: "Very well; if it is true that the X industry cannot exist except by paying starvation wages, then it will be just as well if the minimum wage puts it out of existence altogether." But this brave pronouncement overlooks the realities. It overlooks, first of all, that consumers will suffer the loss of this product. It forgets, in the second place, that it is merely condemning the people who worked in that industry to unemployment. And it ignores, finally, that bad as were the wages paid in the X industry, they were the best among all the alternatives that seemed open to the workers in that industry; otherwise the workers would have gone into another. If, therefore, the X industry is driven out of existence by a minimum wage law, then the workers previously employed in that industry would be forced to turn to alternative courses that seemed less attractive to them in the first place.
    In reality, how easy is it for someone to change their career midway through? Unless the assumption is that since it's a minimum wage job we are talking about, one does not need significant retraining for a new career. Also, people sometimes don't want to relocate in favour of a higher paying job, and are forced to put up with lower wages.

  4. One keeps reading about the next round of CDS auctions being the ticking bomb that is going to blow us all sky high, but these D-days seem to come and go without much ado.

Drowning in Oil

From Caroline Baum:
All speculative bubbles have a kernel of truth behind them to justify their existence. This time around it was China and India. These emerging Asian giants were gobbling up all the commodities the world could produce to fuel their rapid industrialization.

It wasn't that the story was untrue; it was old. Growing global demand probably was the reason for the gradual rise in oil prices from $20 a barrel to $40 earlier in the decade, and even to $60 by mid-2005.

It was the moon shot to $147 that took on a life, and a litany, of its own. Emerging nations didn't start gobbling up crude, coal and copper all of a sudden in the middle of 2007.
That sure rings a bell.

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!").