January 2009

As I mentioned I’ll probably be stuck forever as n00b, so I have absolutely no intention to compare the real merits of languages. It’s just that I finally got to learn Ruby (and then Python) for real, and it’s so different from C++ and Java that I think it’s worth documenting.

I don’t have any emotion for or against C++ since it’s just too big. I’ve used Java for just over 2 years and like its relative simplicity. I’ve learned Ruby for a day, and would take

a = { 1 => "blah" }


Map map = new HashMap(); map.put(1, "blah");

any given time.






single base class, multiple interfaces

single base class, multiple mixins


throw try catch

throw try catch finally

raise begin rescue ensure
catch throw (with label, not exception)

raise try except finally







Object …


*args, **args



inner class

anonymous class


lambda (limited)

final (not quite)


enum: int only

enum: full class, but no more inheritance

N/A (type-safety is moot)


pointer, iterator

JRE, javadoc, IDE

yield, block/closure

list comprehension

hash table, regexp, thread



complex and cryptic

String ==

elsif, no ++

elif, no switch/case

The Dilbert blog is sometimes bizarre, sometimes lewd, and always funny and smart. Until now.

I want to find a place to cry my heart out.

For a cat.

A few years ago, Robert Scoble wrote about his mother’s passing away in a series of extremely painfully beautiful pieces. I can’t find one central post (there’s probably none due to Scoble’s personal and free-flowing style), so here’s the moment of truth.

阮一峰 wrote about the passing of someone’s wife, whom he only knew via email. Here’s the beautiful James Joyce ending of The Dead that he quoted. BTW I don’t like his habit of interleaving English and Chinese translation as it breaks the flow of both.

(S)now was general all over Ireland. It was falling on every part of the dark central plain, on the treeless hills, falling softly upon the Bog of Allen and, farther westward, softly falling into the dark mutinous Shannon waves. It was falling, too, upon every part of the lonely churchyard on the hill where Michael Furey lay buried. It lay thickly drifted on the crooked crosses and headstones, on the spears of the little gate, on the barren thorns. His soul swooned slowly as he heard the snow falling faintly through the universe and faintly falling, like the descent of their last end, upon all the living and the dead.

Till death do us apart, I promise to live and love.

(I later learned that melamine ends with a “min” sound, but what the heck.)

‘Tis was a year of craziness
With all kinds of killing business
China had riot, earthquake, and melamine
Terror in Mumbai, and for the rest of the world: subprime

After in-Greenspan-we-trust there came Bernanke
A nice fella from a neighbor of Kentucky
Let’s pray he knows how to salvage our stock
Not as a drunk jockey riding backward in the derby

Mr. Hanky Panky we have a problem
Your alma mater has lost its emblem
Blankfein & Co. bring home no cookie this year
Bet they’re cursing your super-G slalom

You stretched your arms in March, but in September you waved your hands
Bear was saved in a trap, but no such luck for poor Lehman
Dick Fuld may have to sell his houses and paintings
‘Coz his fellow Streeters couldn’t make a stand

For two days his calls for Lewis fell on deaf’s ear
While Ken was smooching with Buzz Lightyear
Mr. Thain saved the Mother from vultures
But he still had to give up his $10m in tears

It sounded a lot when SocGen lost $7 billion
But its trader was a kitten compared to other hellions
Detroit begged for 15 while 85 went down AIG’s throat
But nothing tops TARP’s seven hundred thousand million

Citi didn’t get Wachovia, and my best friend was laid off
Among 50,000 others, after billions of write-off
Even the Oracle had a deal fell through
But his $5b doubled so he’s still better off

In market good and bad, Uncle Bernie delivers 12 percent
Until blue blood spilled from La Villehuchet’s hand
$50 billion over 20 years would make Mr. Ponzi proud
But that’s not what his sons and the SEC can comprehend

Spitzer the prosecuter got hookupped
Blagjo the reformer got phone-tapped
Bleeping golden turns into bleeping nothing
When the muddy basement got mopped

We got a historical president in Obama
Even though New Yorker paints him as Osama
2008 would’ve been a lot more crazier
If the American people had picked the Old Man and the Grandma

With Google News, I thought I’d never read any newspaper again. But to my surprise, in the last several months I’ve enjoyed WSJ on my morning commute. Part of the surprise is that I could stay awake to read.

My favorite has been the quirky bottom-first-page story, and this one from last Saturday is the best that I can remember (which means within the last couple of days), as it’s the best illustration of the financial crisis that I can remember (in a slightly longer timeframe).

You should really read the whole thing, and then see all the pictures. Just amazing and freaking unbelievable, but that’s exactly how we got into this mess.

These numbers really say it all:

  • The “house” has 576 sq ft (about the same size as our living room plus den) with 2BR/1BA.
  • The owner, Ms. Halterman, said that at one point there were 23 people living there, ~25 sq ft/person, on par with a sweat shop dorm.
  • She bought the house with $3,500 40 years ago.
  • “She receives about $3,000 a month from welfare programs, food stamps and disability payments related to a back injury.”
  • She owed $36,605 on a home-equity loan in 2006, and got a $75,500 credit line. Then in 2007 Integrity gave her a $103,000 30-year ARM starting at 9.25%.
  • How much money everybody in the food chain made:
    • Appraiser: $350. The appraisal is $132,000.
    • Integrity: $6,153 at closing, then $3,090 when it transferred the mortgage to Wells Fargo.
    • Wells Fargo sold it to HSBC, and S&P rated the MBS (probably CDO) AAA. The article didn’t say how much these guys made, but you can be sure they got bonuses many times of $11,090.33, the amount that Ms. Halterman got at closing.
  • After foreclosure, the house was sold at $18,000 to the wealthy next door neighbor so they can tear it down. That’s 17.5% of the mortgage.
  • “After expenses, investors in the mortgage-backed security will probably divide up no more than $15,000 in proceeds.”

According to a CPI calculator, $3,500 in 1967 = $21,727.46 in 2007. Using the inflation adjusted number, $103,000 (4.74 times) makes annual growth at about 4%. According to http://mysite.verizon.net/vodkajim/housingbubble/, nominal US median house price went from ~$20k in 1967 to ~$225k in 2007, and inflation adjusted price from ~120k, a mere 1.5% per year (1.83 times). So the “little shack on the desert” is really the highest flying bubble of all.

I agree with one of the comments that we should applaud Ms. Halterman. Sure, she has plenty of her own problems with drug, alcohol, trash, etc. But she managed to feed many people and raise numerous children, some foster. (Though it’s a different issue how they will live their lives, as her own son is now in prison.) We cannot expect someone like her to use Quicken to track her cashflow and some online “how much mortgage can you afford” calculator.

I also heard a story on NPR the other day about an immigrant single mom with 3 kids in Brooklyn. She earns minimum wage, and yet got a half million mortgage on a relatively large house. Monthly payment is a few thousand, and she only paid a couple of months.

The last paragraph in the piece is a real gem:

A few weeks ago, Mr. Arce (the new owner) asked Mike Summers, a city code-enforcement officer, whether a permit was required to raze the blue house.

“Yes,” Mr. Summers replied, “but all you need is the big, bad wolf to come out and huff and puff.”

At a party you met someone. Here’s part of the small talk:

“Do you have any kids?”
“Yes, two.”
“Boys? Girls?”
“One of them is a girl.”

What are the odds that the other child is a boy?

I still have a hard time believing that it’s NOT 50-50.

Coding Horror asked the question and gave the answer as new year’s present. However, the “unfinished game” he gave as an example for the answer only confused more people, because the order (head then tail, or tail then head)is intuitively significant in the unfinished game, whereas order is intuitively UN-significant in the gender question.

I think it’s easier to understand it by asking a different question: If someone tells you s/he has two kids, and the older one is a girl…

The probability that the other one is a boy is a cold, hard 50%.

The answer is the same for this question: If someone tells you s/he has two kids, and the younger one is a girl…

It’s like seeing a little girl in a party, and someone besides her said “hi, this is my daughter Katie, she’s the older (or younger) sister.” Of course Katie either has a brother or a sister with 50-50 chance.

Now here’s the real tricky part, and that’s where the confusion comes from (I was confused again as I was writing this): in the same scenario, the parent said “hi, this is Katie, one of my two kids.”

Katie could have a younger or older brother, or a younger or older sister. So the odd IS STILL 50-50.

But that is NOT the original question.

The original question corresponds to this scenario instead:

At a party, you saw 2 girls and a boy playing together. Then someone said “one of those girls is mine, and her only sibling is also there”.

The key is you don’t know which girl the parent is talking about. His/her two kids can be girl A and girl B, girl A and boy, or girl B and boy. That’s why the odds for a boy is 2/3.

If instead s/he points to girl A and said “that’s one of my two kids”, then the answer is again 50%, because that eliminates one possibility.

It’s the same as this: if you saw 2 boys and a girl and someone said “my daughter is playing over there, and she has a sibling”. 50% boy.

My illustration isn’t perfect, though, as the answer depends on the group of kids you see. You get a different answer with a different composition. 3 girls and a boy: 50%. 2 girls and 2 boys: 80%.

In the original question, the parent is talking abstractly.