Are You a Control Freak?

Am I a control freak? What better way to check than an internet quiz!

My results:

You Are 32% Control Freak

balance

You have achieved the perfect balance of control and letting go.
You tend to roll with whatever life brings, but you never get complacent.

You can check whether you are a control freak? too.

Via que sera sera, about whom the control freak in me wants to know if she is who I think she is.

Haj and Eid Mubarak

Congratulations on your Haj to all Hajis. Eid Mubarak, everyone.

Today is the main day, the day of Arafa’, of Haj, the Islamic pilgrimage to Makkah. Congratulations to all Hajis including my mother-in-law.

The day after is Eid-ul-Azha in Saudi Arabia. Here, we are celebrating Eid on December 31 while it is on New Year’s Day in Pakistan. Eid Mubarak, everyone.

UPDATE: As usual, we have sent our donation to the Edhi Foundation for the qurbani (slaughter of goat) in Pakistan.

Looking at the Atlanta mosque websites, it seems like a majority of them are going to follow Saudi Arabia and celebrate Eid on the 30th. However, we like combining New Year’s Eve celebrations with Eid.

Merry Christmas

Merry Christmas.

Merry Christmas, everyone.

This year we are celebrating Christmas in Las Vegas, which seems like a better option than being alone in Pretoria on Christmas a decade ago. We are going to Red Rock Canyon today.

Weird Me

There is a tag going around asking about anything weird about yourself. Here are my weirdness list.

Wayfarer tagged me with this meme where I have to list six weird things about myself. Now the problem is weird according to whom. Let’s see if you find the following weird.

  1. I am sorta afraid of heights. I can’t climb on trees and the couple of times I have done indoor rock climbing I was frightened. I also don’t dive or jump into swimming pools from diving boards or platforms. Actually I don’t even jump into a pool from ground level. I either sit on the edge and slip into the pool or take the stairs. On the other hand, I had a lot of fun doing this:
    Zack skydiving
  2. I did not shave until I was starting college. So I had a beard in high school. Later, I tried all combinations: beard and moustache, beard without moustache, moustache without beard, and clean shaved. Nowadays, I am clean shaven. But I still do not shave more than 2 or 3 times a week while my facial hair demands shaving twice a day for a clean look.
  3. My only car accident involving another moving object was when a running pedestrian hit my side-view mirror. Otherwise my accidents involve lamp posts, pillars and other immovable objects. The first time I took my dad’s car for a drive alone, I hit the gate pillar of our house on my return.
  4. For someone who loves sports cars and driving, I do not drive fast. I also don’t like weaving in and out of traffic, usually preferring to remain in my lane even if it seems slower than the others. And I turn blind when driving while it is raining at night.
  5. I enjoyed watching my ophthalmologist poking needles and performing surgery on my left eye when I was 13. I had only local anesthesia.
  6. I am left-handed and left-footed. I kick soccer balls with my left foot and play tennis and write with my left hand. However, I play cricket right-handed. I bat, bowl and field right-handed.

Unlike Wayfarer or Koonj, I’ll stop at six items.

So who to tag to carry on this meme? Let’s try to spread this meme in the Pakistani and Urdu blogosphere. So I tag: Teeth Maestro, Noumaan, Nabeel, Shakir, Asma, Badtameez.

The Fountain

We watched The Fountain in the theater on our anniversary. It is a good movie about eternal life, love and death. I rate it 8/10.

On our anniversary, we went to the theater and watched The Fountain. It is not often we get a chance to watch a movie in the theater, so that was fun.

Was it an appropriate movie for celebrating our anniversary? Yes and no. The Fountain is about love, death, and eternal life. It has three parallel stories situated 500 years apart. The plot is about trying to escape death and find eternal life and then finally embracing death as being a sort of eternal life.

I liked it very much, though Amber was a bit depressed and didn’t think it an appropriate choice for the occasion. I rate it 8/10.

مزید درجن

آج میری سالگرہ ہے۔

یہ سال درجنوں کا سال ہے۔ ابھی پچھلے ہفتے ہم نے شادی کے 12 سال منائے تھے اور آج میری سالگرہ ہے۔ میری عمر اب تین درجن سال ہے۔ آج ہمارا سالگرہ گھر میں کیک کاٹ کر اور موم‌بتی بجھا کر منانے کا ہے کیونکہ مشیل ایک مہینے سے کیک اور موم‌بتی کے انتظار میں ہے۔

Baby me

Last week we celebrated a dozen years of marriage and today is my 36th birthday.

This year we are going to celebrate at home with a cake. Michelle has been excited about my birthdya for some time now. She wants a cake and even more than that, she wants to “blow a wish” i.e. a candle. This year, Michelle has been very much into birthdays. She likes the ones of other kids at her preschool as well as the ones of our friends’ kids. She was really happy about her own and has been mentioning her grandparents’, Amber’s and now mine for some time.

Coeur à la Crème

Here is the recipe for Coeur à la Crème. It is easy to make and turns out great.

For Thanksgiving, I made dessert. Here is one recipe. I got it from Simple French Desserts. I have made some minor changes in the recipe.

Ingredients

  • 1 cup heavy cream
  • 2/3 cup sugar
  • 2 egg whites
  • 1 cup plain organic yogurt
  • 1 teaspoon pure vanilla extract
  • Fresh raspberries for garnish
  • Raspberry Coulis (recipe)
  1. Stir the cream and 1/3 cup of the sugar together in a large bowl. Beat (I use an electric mixer) the sweetened cream until soft peaks form. Set aside.
  2. In a large bowl, using an electric mixer, beat the egg whites to soft peaks. Continue beating, adding the remaining 1/3 cup sugar 1 tablespoon at a time, until the whites form stiff, glossy peaks. Fold the cream mixture and beaten egg whites into the yogurt. Fold in the vanilla.
  3. Line a large sieve with a double thickness of damp cheesecloth, allowing the excess to hang over the edge.
  4. Fill a bowl with the cream mixture. Set the sieve over the bowl to drain. Cover with plastic wrap and refrigerate for 24 hours.
  5. Unwrap and invert the bowl onto a serving plate. Remove the cheesecloth. Surround the coeur à la crème with Raspberry Coulis and a few fresh raspberries.

That’s it. It is easy to make and tastes great. You can ask Wayfarer if you don’t believe me.

درجن

آج ہماری شادی کی بارہویں سالگرہ ہے۔ اسے منانے آج ہم سٹیک کھانے گئے اور سینما میں فلم دیکھی۔ فلم کا موضوع بھی محبت تھا اور میری آج کی پوسٹ کا بھی یہی موضوع ہے۔

درجن سال بہت ہوتے ہیں۔ بارہ سالوں میں دنیا بدل جاتی ہے۔ کہاں میں ایک 23 سالہ نوجوان تھا جو واہ کینٹ میں رہتا تھا اور کہاں اب 12 سال بعد شادی‌شدہ اور ایک بیٹی کا باپ اٹلانٹا میں۔

ایک شخص کے ساتھ 12 سال گزارنا بڑی بات ہے۔ ان سالوں میں محبت بھی بڑھتی ہے اور لڑائیاں بھی ہوتی ہیں۔ آپ ایک دوسرے کو مکمل طور پر جان لیتے ہیں جیسے کوئی اور نہیں جانتا۔

جب میں نے عنبر کے ساتھ اس سفر کا آغاز آج سے ٹھیک بارہ سال پہلے یکم دسمبر 1994 کو کیا تھا تو اندازہ بھی نہیں تھا کہ ان منزلوں سے بھی گزر ہو گا۔ سمجھتے تھے کہ ہمیں محبت ہے مگر شاید رائی برابر بھی پتا نہ تھا۔

آج اپنی شادی کی سالگرہ منانے ہم بونز ریستوران گئے جہاں کا سٹیک بہت مشہور ہے۔ واقعی بہت مزا آیا۔ اس کے بعد ہم کافی عرصہ بعد سینما میں فلم دیکھنے گئے۔ ارادہ تو جیمز بانڈ کی Casino Royaleدیکھنے کا تھا مگر دیکھی The Fountain۔ محبت، زندگی، موت اور روحانیت کی یہ کہانی معلوم نہیں آج کے دن کے لئے مناسب تھی یا نہیں مگر ہمیں کافی مزا آیا۔

Movable Type and Unicode

Running Movable Type natively in Unicode was not as difficult as I thought but it still required a number of patches to the code.

I have been trying to get Movable Type to run Unicode natively for a while. When Movable Type was upgraded to version 3.3, I saw my chance. This new version has a lot of the needed code for encoding and decoding etc. and made my job much easier than before.

If you remember my previous travails, DBD::mysql module lacked UTF8 support. Almost immediately after my changes, the develper release of DBD::mysql finally included a UTF8 patch. But that was too late for me. Plus I am going to wait for it to be included in a regular release since DBD::mysql is somewhat complicated.

What I did was to set the UTF-8 flag for everything coming out of the database using a wrapper around the DBI module. I used Pavel Kudinov’s code for that, which is given below.

# UTF8DBI.pm re-implementation by Pavel Kudinov http://search.cpan.org/~kudinov/
# originally from: http://dysphoria.net/code/perl-utf8/
package UTF8DBI    ; use base DBI    ;
package UTF8DBI::db; use base DBI::db;
package UTF8DBI::st; use base DBI::st;
sub _utf8_() {
use Encode;
if    (ref $_ eq 'ARRAY'){ &_utf8_() foreach        @$_  }
elsif (ref $_ eq 'HASH' ){ &_utf8_() foreach values %$_  }
else                     {         Encode::_utf8_on($_) };
$_;
};
sub fetch             { return _utf8_ for shift->SUPER::fetch            (@_)  };
sub fetchrow_arrayref { return _utf8_ for shift->SUPER::fetchrow_arrayref(@_)  };
sub fetchrow_hashref  { return _utf8_ for shift->SUPER::fetchrow_hashref (@_)  };
sub fetchall_arrayref { return _utf8_ for shift->SUPER::fetchall_arrayref(@_)  };
sub fetchall_hashref  { return _utf8_ for shift->SUPER::fetchall_hashref (@_)  };
sub fetchcol_arrayref { return _utf8_ for shift->SUPER::fetchcol_arrayref(@_)  };
sub fetchrow_array    {                 @{shift->       fetchrow_arrayref(@_)} };
1;

With that code, I needed to replace calls to DBI module with calls to UTF8DBI module as shown in the patches below.

--- lib/MT/ObjectDriver/DBI.pm.orig	2006-09-06 19:27:17.000000000 -0700
+++ lib/MT/ObjectDriver/DBI.pm	2006-09-06 19:23:09.000000000 -0700
@@ -7,7 +7,7 @@
package MT::ObjectDriver::DBI;
use strict;
-use DBI;
+use UTF8DBI;
use MT::Util qw( offset_time_list );
use MT::ObjectDriver;
--- lib/MT/ObjectDriver/DBI/mysql.pm.orig	2006-09-06 19:26:55.000000000 -0700
+++ lib/MT/ObjectDriver/DBI/mysql.pm	2006-09-06 19:24:20.000000000 -0700
@@ -93,10 +93,10 @@
$dsn .= ';hostname=' . $cfg->DBHost if $cfg->DBHost;
$dsn .= ';mysql_socket=' . $cfg->DBSocket if $cfg->DBSocket;
$dsn .= ';port=' . $cfg->DBPort if $cfg->DBPort;
-    $driver->{dbh} = DBI->connect($dsn, $cfg->DBUser, $cfg->DBPassword,
+    $driver->{dbh} = UTF8DBI->connect($dsn, $cfg->DBUser, $cfg->DBPassword,
{ RaiseError => 0, PrintError => 0 })
or return $driver->error(MT->translate("Connection error: [_1]",
-             $DBI::errstr));
+             $UTF8DBI::errstr));
$driver;
}

However, that didn’t fix all the problems. The Perl CGI module was still working in Latin1 mode. I could wrap that into a UTF8CGI module but the newer versions of CGI module support Unicode. So I just upgraded the version of CGI bundled with Movable Type. Still I needed to tell the CGI module that the character set in use was UTF-8. I could either do that every single time the CGI module was called or I could just set the default character set to UTF-8. Since this CGI module was in the Movable Type extlib folder, I decided to modify its default character set.

--- extlib/CGI.pm.orig	2006-09-15 10:39:30.000000000 -0700
+++ extlib/CGI.pm	2006-09-15 10:39:59.000000000 -0700
@@ -517,8 +517,8 @@
$fh = to_filehandle($initializer) if $initializer;
-    # set charset to the safe ISO-8859-1
-    $self->charset('ISO-8859-1');
+    # set charset to utf-8
+    $self->charset('utf-8');
METHOD: {

I also set the utf8 mode for writing the files to disk.

--- lib/MT/FileMgr/Local.pm.orig	2006-09-27 06:56:39.000000000 -0700
+++ lib/MT/FileMgr/Local.pm	2006-09-27 06:57:36.000000000 -0700
@@ -75,6 +75,9 @@
binmode(FH);
binmode($from) if $fmgr->is_handle($from);
}
+    else {
+        binmode(FH, ":utf8");
+    }
## Lock file unless NoLocking specified.
flock FH, LOCK_EX unless $fmgr->{cfg}->NoLocking;
seek FH, 0, 0;

These changes caused problems with file uploads through the Movable Type interface. I expected this since I have run into this problem with PHP and mbstring as well. The following patch fixed this issue.

--- lib/MT/App/CMS.pm.orig	2006-10-08 21:17:11.000000000 -0700
+++ lib/MT/App/CMS.pm	2006-10-08 21:17:37.000000000 -0700
@@ -8334,6 +8334,7 @@
$app->validate_magic() or return;
my $q = $app->param;
+    $q->charset('iso-8859-1');
my($fh, $no_upload);
if ($ENV{MOD_PERL}) {
my $up = $q->upload('file');

Then it was time to comment out the liberally sprinkled code to switch off the utf8 flag in Movable Type.

--- lib/MT/I18N/default.pm.orig	2006-09-16 20:22:22.000000000 -0700
+++ lib/MT/I18N/default.pm	2006-09-16 20:23:26.000000000 -0700
@@ -292,7 +292,7 @@
$text = $class->_conv_to_utf8($text, $enc) if $enc ne 'utf-8';
Encode::_utf8_on($text);
$text = substr($text, $startpos, $length);
-    Encode::_utf8_off($text);
+#    Encode::_utf8_off($text);
$text = $class->_conv_from_utf8($text, $enc) if $enc ne 'utf-8';
$text;
}
@@ -322,7 +322,7 @@
}
}
-    Encode::_utf8_off($text) if $to eq 'utf-8';
+#    Encode::_utf8_off($text) if $to eq 'utf-8';
$text;
}

Finally I had to make changes to the MTHash plugin that I use to force comment previews. The Digest::SHA1 module only accepts bytes, therefore, the UTF-8 characters had to be encoded as bytes before being passed to any functions in the module. Here is my patch:

--- lib/MT/App/Comments.pm.orig	2006-09-16 21:01:21.000000000 -0700
+++ lib/MT/App/Comments.pm	2006-09-16 21:03:08.000000000 -0700
@@ -266,9 +266,10 @@
require Digest::SHA1;
my $sha1 = Digest::SHA1->new;
-     $sha1->add($q->param('text') . $q->param('entry_id') . $app->remote_ip
-                . $q->param('author') . $q->param('email') . $q->param('url')
-                . $q->param('convert_breaks'));
+     my $octets = Encode::encode_utf8($q->param('text') . $q->param('entry_id') . $app->remote_ip
+                                      . $q->param('author') . $q->param('email') . $q->param('url')
+                                      . $q->param('convert_breaks'));
+     $sha1->add($octets);
my $salt_file = MT::ConfigMgr->instance->PluginPath .'/salt.txt';
my $FH;
open($FH, $salt_file) or die "cannot open file <$salt_file> ($!)";
--- plugins/MTHash.pl.orig	2006-09-16 20:29:22.000000000 -0700
+++ plugins/MTHash.pl	2006-09-16 20:57:22.000000000 -0700
@@ -32,7 +32,8 @@
or return $ctx->error($ctx->errstr);
my $sha1 = Digest::SHA1->new;
-  $sha1->add($content);
+  my $octets = Encode::encode_utf8($content);
+  $sha1->add($octets);
my $salt_file = MT::ConfigMgr->instance->PluginPath .'/salt.txt';
open(FH, $salt_file) or die "cannot open file <$salt_file> ($!)";
$sha1->addfile(FH);

One thing that I still need to do is to fix the Serializer and Un-serializer used by Movable Type plugins.

Happy Thanksgiving

Happy Turkey Day.

Happy Thanksgiving, everyone!

We are off to a friend’s to enjoy turkey (and more). I made dessert, lemon tart and Couer a la Creme. I might post the recipes later.