Caring for Your Baby and Young Child

I have been reading this book since Michelle was born. Overall, it is a good book for new parents, though at times it is not up to the mark.

Caring for Your Baby and Young Child is a book from the American Academy of Pediatrics. We bought it a little before Michelle was born and I have been reading it since then. It covers child care from birth to 5 years, so I guess I’ll be reading it for a few more years.

The first part of the book is based on age and gives the milestones for different ages as well as advice about child care. This is what I read over time as Michelle grows older. It is useful to me to figure out what sort of activities Michelle would/should be doing her age.

The second part covers accidents, injuries and illness. I read sections there as required when Michelle gets sick.

There are the usual clichés and overblown stuff as in most such advice books. For example, there is a short section on coping with terrorism in the new edition. Michelle’s pediatrician also pooh-poohs the example meal plans given in the book. But overall the book is worth reading and gives some ideas about childrearing. We don’t follow its suggestions all the time but there are something worth considering.

Happy Thanksgiving

Happy Thanksgiving to everyone.

Happy Thanksgiving, everyone. Well, may be not the turkeys! Hope you enjoy your turkeys.

This is the first time in recent years that we are not having a thanksgiving party at our home. Usually we invite friends over but this year we are invited to a friend’s.

Letter to a US Representative

Greetings Web Community,

I drafted the following letter with the intent of sending it to my representative in the US House of Reps. Before executing my plan, I wish to gather comments from this online community.

LETTER BEGINS

Our country’s current foreign, budget and resource policies compel me to take up the pen. This is the first in a series of letters intended to present these issues in a potentially different context and to suggest alternate approaches to confronting them. This letter deals specifically with our nation’s policies concerning prisoners taken during the war on terror.

Prisoner abuse, such as the incidents at Abu Garade, drew condemnations from the highest levels of government and the military. Yet, reports of abuse at the hands of our troops continue to surface. According to President Bush, the United States does not torture prisoners. Yet, the administration refuses to support Senator McCain’s efforts to make such practices illegal. The administration declared a “war on terror.” Yet, prisoners taken during this war are not identified as prisoners of war; instead, they are labeled detainees, enemy combatants and other such ambiguous designations – excluding them from the protections given by the Geneva Conventions. Such statements and actions smack of hypocrisy, a hypocrisy that tarnishes our nation’s image. Moreover, the actions which contradict our words imperil our brave service men and woman deployed in Afghanistan, Iraq and elsewhere. When the United States abuses and tortures, others are emboldened to do the same. Worse yet, as these occurrences become commonplace, the global community grows less sensitive, reducing the global outcry against terrorists and their deeds.

Unfortunately, the matter of abuse and torture fundamentally connects with the current administration’s efforts to stop terrorism. The president responded to September 11 by declaring a war on terror, but he never defined the enemy or desired end conditions. (Few, if any, politicians considered the logic of using terror to defeat terror.) In democracies, wars tend to be limited periods when the rules of normal conduct are bent to serve martial purposes. The current administration effectively committed our nation to an indefinite period in which the military and intelligence agencies can bend the rules. This policy placed our nation on a moral slippery slope with consequences beginning with evasion of the Geneva Conventions, proceeding to prison abuse and, now, reaching an implicit endorsement of torture. Should this continue, I am afraid that our nation will not stop there.

As a Representative in the United States Congress, you have the responsibility to take a stand against this moral ambiguity and the slippery slope policy underpinning it. The following steps will help set the nation on a path to the moral high ground where a great democracy such as the United States belongs.

– Support the House’s version of Sen. McCain’s anti-torture bill.

– Call for a public inquiry into the CIA’s alleged “black site” prisons in Eastern Europe and Southeast Asia. If you know this allegation to be true, lobby the administration to end this practice.

– Work to close detention facilities such as the one at Guantanomo Bay. These facilities are breeding grounds for abuse.

– Prepare legislation that reclassifies detainees in our custody as either criminals or prisoners of war. This act would clear the way for the ethical passage of detainees into criminal court systems (ours or their countries of origin) or prisoner of war camps satisfying the requirements in the Geneva Conventions.

– Change the slippery slope mindset by first changing the language. The nation is not conducting a “war against terrorism.” The nation is leading a campaign that seeks to end the threat of terrorism using social, economic and, where necessary, military means.

– Encourage your fellow representatives to take similar steps.

White

2nd in the Three Colors trilogy. Good movie with an interesting twist. Rated 7/10.

The movie White is the second movie of Krzysztof Kieslowski’s Three Colors trilogy. This one is about (in)equality.

The main character in the movie is a Polish hairdresser who is being divorced by his French wife and as a result loses everything. There is a twist in the movie which made it quite interesting.

I would rate White 7/10.

Empire and Torture

Torture is bad, empire might even be worse, especially when all the people in the world could be its subjects.

Somehow with so much news about torture by the US I have refrained from commenting on any of it for a while. What can I say, I have become disillusioned. But here are some scattered thoughts.

The Washington Post has an article about “black sites”:

The CIA has been hiding and interrogating some of its most important al Qaeda captives at a Soviet-era compound in Eastern Europe, according to U.S. and foreign officials familiar with the arrangement.

The secret facility is part of a covert prison system set up by the CIA nearly four years ago that at various times has included sites in eight countries, including Thailand, Afghanistan and several democracies in Eastern Europe, as well as a small center at the Guantanamo Bay prison in Cuba, according to current and former intelligence officials and diplomats from three continents.

When there are prisons, detention and torture centers spread around the world, can we finally say “Empire”?

On the other hand, His Imperial Majesty says:

“There’s an enemy that lurks and plots and plans and wants to hurt America again,” Bush said. “So you bet we will aggressively pursue them but we will do so under the law.”

He declared, “We do not torture.”

[…] “Our country is at war and our government has the obligation to protect the American people,” Bush said. “Any activity we conduct is within the law. We do not torture.”

While some libertarians have been worried about the rights of Americans being lost due to the war on terror, I am not extremely worried about that. The rights and liberties might vary over time but they will most likely remain within US historical norms (though historical norms isn’t good enough). However, with the reach of the US government beyond any historical power and its willingness to use that power, foreigners (especially those outside the US) might have something to fear. As an example, did you know that the US senate removed passed an amendment which if it goes through the rest of the legislative process would remove the right of habeas corpus from Gitmo detainees last week?

The Senate today passed Lindsay Graham’s amendment, 49 to 42 barring detainees at Guantanamo and others declared by the Executive Branch to be enemy combatants from seeking judicial review of the legality of their detentions.

To read more about the stupidity behind Senator Graham’s amendment, please do read the following Obsidian Wings posts.

The latest news on Guantanamo and habeas corpus is that a further amendment has been passed by the Senate.

Senators also voted to endorse the Bush administration’s military tribunals for prosecuting foreign terrorism suspects at the U.S. naval base at Guantanamo Bay, Cuba, but to allow the detainees to appeal their detention status and punishments to a federal court.

[…] Senators added the language Tuesday that would allow Guantanamo detainees to appeal their status as “enemy combatants” and the rulings of U.S. military tribunals to a federal appeals court in Washington, D.C. That avenue would take the place of the one tool the Supreme Court gave detainees in 2004 to fight the legality of their detentions — the right to file habeas corpus petitions in any federal court.

Senators approved the measure on tribunals by an 84-14 vote. It was a bipartisan compromise reached after last week’s Senate approval of a provision that stripped detainees entirely of their ability to file the petitions. Critics said that provision did not provide a meaningful way for detainees to appeal their status or the decisions of military tribunals.

Earlier Tuesday, senators defeated a Democratic proposal that would have reinstated the right to file habeas corpus lawsuits, but limited the challenges to one court.

The idea of not giving any rights to foreigners detained outside the US by Americans seems to remind me to some extent of former empires. After all, an Englishman was not the same as an Indian in the British empire. This action creates two classes of people, “us” and “them”: We have rights and they don’t. The point is argued well in this Slate article.

As if using Soviet-era prison compounds in Eastern Europe wasn’t enough, the United States is also copying communist torture tactics.

The Pentagon effectively signed off on a strategy that mimics Red Army methods. But those tactics were not only inhumane, they were ineffective. For Communist interrogators, truth was beside the point: their aim was to force compliance to the point of false confession.

Fearful of future terrorist attacks and frustrated by the slow progress of intelligence-gathering from prisoners at Guantánamo Bay, Pentagon officials turned to the closest thing on their organizational charts to a school for torture. That was a classified program at Fort Bragg, N.C., known as SERE, for Survival, Evasion, Resistance, Escape. Based on studies of North Korean and Vietnamese efforts to break American prisoners, SERE was intended to train American soldiers to resist the abuse they might face in enemy custody.

The Pentagon appears to have flipped SERE’s teachings on their head, mining the program not for resistance techniques but for interrogation methods. At a June 2004 briefing, the chief of the United States Southern Command, Gen. James T. Hill, said a team from Guantánamo went “up to our SERE school and developed a list of techniques” for “high-profile, high-value” detainees. General Hill had sent this list – which included prolonged isolation and sleep deprivation, stress positions, physical assault and the exploitation of detainees’ phobias – to Secretary of Defense Donald Rumsfeld, who approved most of the tactics in December 2002.

While you are at it, read this account of a guy tortured and murdered by the CIA in Iraq.

My Ride

I never did tell you which car I bought. So here it is: Infiniti G35 Coupe, 6-speed manual transmission with navigation system.

I never told you guys which car I finally bought. So here are a few photos of my car:

Michelle and me in the car
Rear view of my G35
Rear left view of my Infiniti G35
My G35 Coupe's side view
Another view of my G35
Front view of my Infiniti G35 Coupe

As it turned out, we had to order the Infiniti G35. It took more than 3 months to arrive. By that time, we had lost all the excitement of the purchase. However, once we got it, it was fun driving time. As a result, our trips to North Georgia have definitely increased in recent months.

The Ancestor’s Tale

A good book for the layman about evolutionary history despite some forced organization of topics and the author’s few digressions into politics.

The Ancestor’s Tale: A Pilgrimage to the Dawn of Evolution by Richard Dawkins is a good book with information about evolution and all kinds of living things.

The idea of the book, based on Chaucer’s Canterbury Tales, is to travel back in time and meet the ancestors of humans and other living beings. It works to an extent, but sometimes the organization of material seems forced. It seems like Dawkins wanted to put specific topics in the book and randomly decided to put them in specific chapters. Fortunately, not all the book is like that. And even then the topics of discussion are interesting and approachable by the layman.

Another annoyance in the book is that Dawkins gets off-topic a few times with digressions on politics, current affairs, George Bush and Tony Blair, etc. If I wanted to read a book about those topics, I wouldn’t have picked The Ancestor’s Tale.

Eid and Diwali Mubarak

Eid Mubarak. Happy Diwali.

Eid Mubarak, everyone. We are celebrating Eid today here in Atlanta.

And Happy Diwali too.

Movable Type, MySQL, Perl, Unicode

Unicode is tough. Programs and languages still have issues with supporting Unicode properly. This is the story of my adventures with phpbb, PHP, Movable Type, MySQL, and Perl wrestling with their Unicode support.

Unicode is tough. It’s tough because of bad programmers and their ingrained habits. Everybody loves shortcuts and programmers are no exception. That is why years after the introduction of Unicode, it is still difficult to do any real application programming with Unicode data.

Let us look at two examples.

We had a problem on our Urdu forum which runs on phpbb. Any user who registered with a somewhat longish Urdu user name could not log into the forum again. The maximum length of the user name field was set to 25 characters but people had problems even with user names 14 characters long. At first, we thought it was due to the size of the field in the MySQL database, but increasing that didn’t help. After much effort, I found out that when logging in (but not when registering), the user name was truncated to 25 characters using the PHP function substr. And of course it turned out that substr works only with bytes, not with characters. I hope you understand the difference between characters and bytes unlike a lot of programmers. So I had to replace substr with mb_substr. Yes, PHP has a separate set of string functions for multibyte encodings.

The other example comes from Movable Type which claims:

Movable Type ships with full support for Unicode and international character sets. Official, fully-supported versions with translated documentation are now available in Japanese, French, German, Spanish, and Dutch.

However, take a look at this function in the Movable Type code:

sub no_utf8 {
for (@_) {
next if !defined $_;
$_ = pack 'C0A*', $_;
}
}

So what does this function do? It converts character-based strings to bytes. It is used to truncate the excerpts of incoming trackbacks to 255 bytes. Unicode must be pretty hard if programmers keep tripping over the difference between characters and bytes! This code has been in Movable Type since version 2.6 (or earlier) and is still there in the latest version 3.2.

Now, remember that Movable Type has a Japanese version which obviously would have issues with this. However, the character-to-byte conversion is still done in that version, but some additional processing is used to bring it back to characters. Why? Because Unicode is hard, of course.

That was just a preamble. Let’s now talk about the problem that prompted this post.

First, here are the different versions of the software we’ll talk about that I am using:

Since my webhost recently upgraded to Debian 3.1 and Perl 5.8.4, I thought I could do Unicode better on my MT blog here. Perl 5.8 is really the first version of Perl with Unicode support; Perl 5.6.1 claimed some support but there were lots of issues. I should know, I tried.

Among my ideas was one that I wanted to use actual Unicode characters instead of HTML entities, numeric character references etc. Right now I am using numeric character references for MathML (via the Numeric Entities plugin), Urdu dates (my own localization of MT) and smart quotes (via the Smartypants plugin). The Numeric Entities plugin has a mode where it can output UTF-8 characters while the other two needed to be edited to use Unicode character literals instead of numeric character references (i.e., \x{hhhh} instead of &#xhhhh; where hhhh is a hexadecimal number).

When I made these changes, it garbled up my web pages. Basically, the Unicode characters that I had changed from entities showed up okay but the rest of the non-ASCII Unicode characters on the page were garbled into accented roman characters. Counting these roman characters it looked like there were more of these characters than the actual Unicode characters which they replaced on the web page. Can we say: Why is Unicode hard? Bytes vs characters, sir!

At first, I was stumped. How could the Numeric Entities plugin affect characters that were not even processed by it? Then the harsh truth dawned on me. Perl uses a UTF8 flag to mark Unicode strings. When two strings are concatenated but only one is a Unicode string, then the other must be converted into Unicode before the concatenation. By default, strings in Perl are Latin1 or ISO-8859-1. So what was happening was that stuff wasn’t marked with the UTF8 flag in Movable Type, but the explicitly defined Unicode characters generated by the Numeric Entities plugin were so marked. When these were concatenated to form the web page output, anything other than the characters converted from entities by Numeric Entities plugin was considered to be Latin1 and hence converted byte-by-byte to Unicode. Garbage (no UTF8 flag) in, Garbage (garbled Unicode characters) out! I confirmed this by doing a is_utf8() at different stages in Movable Type.

To recap, this meant that any programmatic insertion of Unicode characters was properly marked as Unicode. However, since none of the Unicode data entered by the user (in the entry or comment fields or even in the templates) was marked as such, the presence of programmatic Unicode characters garbled the rest of the non-ASCII Unicode characters.

The next step was to find out why and where this was happening. The first thing I found was that all the data in my MySQL database was marked Latin1. Why? Legacy issues: When I created that database, my host was running MySQL 4.0 which had only one character set: Latin1. MySQL 4.1 added Unicode (and lots of other character sets) support so that you can now assign character sets and collations not only to databases and tables but also to columns. That is great but if you want databases created in 4.0 or earlier to keep running without any conversions then all such databases need to be assigned the latin1 character set which is what my host did. As to why I was seeing the correct Unicode characters on my website and in the MT interface: The data was stored simply as bytes.

Time to fix the MySQL database character set then. First, I tried the easy way but that didn’t work for some odd reason. So I had to do it the hard way which involved changing the type of each column from CHAR(n), VARCHAR(n), TEXT, MEDIUMTEXT, TINYTEXT or LONGTEXT to its corresponding binary type (BINARY(n), VARBINARY(n), BLOB, MEDIUMBLOB, TINYBLOB or LONGBLOB) and then back along with changing the character to utf8. Here are the statements:

ALTER TABLE t MODIFY column BINARY(n) | VARBINARY(n) | BLOB | MEDIUMBLOB | TINYBLOB | LONGBLOB [ [DEFAULT | NOT] NULL];
ALTER TABLE t MODIFY column CHAR(n) | VARCHAR(n) | TEXT | MEDIUMTEXT | TINYTEXT | LONGTEXT CHARACTER SET utf8 [ [DEFAULT | NOT] NULL];

Replace t by the table name, column by the column name, and n by the length of the field for CHAR and VARCHAR types. Also, choose the corresponding data types for the specific column. One complication (other than doing this individually for all columns in all tables) is that you have to specify any attributes that were originally there for the column, otherwise they get dropped. These would be things like whether the default value for the field is NULL or the field cannot have a NULL value, etc. The easiest way to do this is using phpMyAdmin instead of typing these statements since it lets you alter specific characteristics.

I went through this for the more than 50 columns that needed changing for my Movable Type database. It was good to see the Urdu characters finally appearing in phpMyAdmin as I browsed the database. Then I opened the MT interface and saw that all Urdu characters were appearing as “?”. What the ****? Then I remembered: Unicode is hard.

Suddenly a light went on and I remembered this comment by Asif when he transferred our Urdu Wiki to its present location. Reading up on that I realized that in addition to database, table and column character sets, there were also character sets defined for server, client and connection. And obviously these were set to a default of latin1.

I found out where to put this statement (SET NAMES utf8) in mt/lib/MT/ObjectDriver/DBI/mysql.pm but found a more elegant solution than simply setting it for all cases. So here’s my patch (for Movable Type 3.2) for this issue:

--- lib/MT/ConfigMgr.pm.orig    2005-08-16 19:37:11.000000000 -0700
+++ lib/MT/ConfigMgr.pm 2005-11-01 19:48:26.000000000 -0800
@@ -151,6 +151,7 @@
['OutboundTrackbackLimit', { Default => 'any' }],
['OutboundTrackbackDomains', { Type => 'ARRAY' } ],
['IndexBasename', {Default => 'index'}],
+        ['SQLSetNames', {Default => 0}],
]);
}
--- lib/MT/ObjectDriver/DBI/mysql.pm.orig       2005-07-29 13:41:11.000000000 -0700
+++ lib/MT/ObjectDriver/DBI/mysql.pm    2005-11-01 19:45:32.000000000 -0800
@@ -49,6 +49,11 @@
{ RaiseError => 0, PrintError => 0 })
or return $driver->error(MT->translate("Connection error: [_1]",
$DBI::errstr));
+    if ($cfg->SQLSetNames && (my $c = lc $cfg->PublishCharset)) {
+        my %Charset = ('utf-8' => 'utf8', 'shift_jis' => 'sjis', 'euc-jp' => 'ujis');
+        my $c = $Charset{$c} ? $Charset{$c}  : $c;
+        $driver->{dbh}->do("SET NAMES " . $c);
+    }
$driver;
}

And of course add SQLSetNames 1 in your mt-config.cgi or mt.cfg configuration file.

Elated, I opened up MT and checked. The question marks had disappeared. So far, so good. Let’s check if the original Unicode problem was fixed. Oh no! It isn’t. I guess we are back to square one. Did I say something about Unicode being hard?

What is the reason for the problem now? MySQL has nice UTF-8 data which it passes along to MT’s Perl functions. Why is the data still not marked with the UTF-8 flag? Movable Type uses the Perl modules DBI and DBD::mysql to access the MySQL database. And guess what? They don’t have any Unicode support. In fact, forget marking the UTF-8 flag properly, according to this, DBD::mysql doesn’t even preserve UTF-8 flag when it’s already there.

In the end, I have 3 options:

  1. Wait for Unicode support for DBI/DBD::mysql which might be a long time since nobody is sure if it should be provided by the database-independent interface DBI or by the MySQL driver DBD::mysql or both together in some way.
  2. Use decode_utf8 on every output from the database. This is not very easy to do.
  3. Use a patch which blesses all database data (yes that includes the binary fields) as UTF-8 based on a flag you set when connecting to the database.

None of these options is very appealing and all have side-effects and problems associated with them. My plan is to set up a development subdomain and then test out options 2 and 3 there thoroughly before bringing them online for my weblog.

POSTSCRIPT: For something funny about Perl’s Unicode support, read about the difference between utf8 and UTF-8.

UPDATE: Here’s a DBI modification that does the same thing as option 3 above. See also an amendment.