Monday, January 30, 2006

Managed Instant Messenger

Many students asked me at various times on how to integrate their own application with MSN Messenger or to import the contacts from the MSN Addressbook. My answer was that this would need to be done on the socket level, connecting to the MSN Messenger Service and a lot of hacking would be needed to figure out the request response possibilities. Well, there is a sample application that does IM through MSN. Check it out. I hope you find that useful. It is a command line based application and there is a link to another application developed using the same code but is richer. I had been wanting to blog about this for months, so I finally succeeded in doing it tonight.

Sunday, January 22, 2006

Merchandise

Recently, I ordered the merchandise from Microsoft company online store for the gift voucher that I got for my MVP award. The merchandise just arrived. Here's a glimpse of it.

Hooded shirt.


Geek T-shirt.


Bag and books.


Microsoft mouse keyring.


Mouse keyring was in this case.Posted by Picasa

Tests on random numbers

If someone (such as a random number generator) claims a set of numbers to be random numbers, following some probability distribution, most commonly, uniform, there are certain tests that can be performed on these random numbers to ascertain or deny this claim. Such tests include Kolmogorov-Smirnov test, Chi-square test, Poker test, Gap test, Runs test. There are also some batteries of tests such as the Diehard battery of tests, that can be performed on the set of random numbers. The results of these tests can be analyzed to accept or deny the claim.
We were asked to perform these tests on the random numbers generated through Microsoft Excel and Matlab. Here is everything, including the Excel workbook to perform the tests on Excel random numbers as welll as a workbook to perform the tests on Matlab random numbers. Different worksheets correspond to each test. Macros have been written to perform and repeat these tests on 100 sets of 100 random numbers. Matlab includes a command called xlswrite() to export some Matlab variable to excel.
Also included is the C# program to export random numbers from Excel to a binary mode file for the DieHard battery of tests using Office Interop. Apart from that, there is a Visual C++ program to export random numbers from Matlab into a binary mode file for the same purpose. Test results from the Diehard battery are also included, as is an MS Word document that summarises and analyzes the results.

Shepherds

"I didn't know shepherds knew how to read," said a girl's voice behind him.
"Well, usually I learn more from my sheep than from books," he answered. The shepherd told her of the Andalusian countryside, and related the news from the other towns where he had stopped. It was a pleasant change from talking to his sheep.

But when he thought to complain about the burden of its weight (his jacket), he remembered that, because he had the jacket, he had withstood the cold of the dawn.
We have to be prepared for change, he thought, and he was grateful for the jacket's weight and warmth.
The jacket had a purpose, and so did the boy. His purpose in life was to travel, and, after two years of walking the Andalusian terrain, he knew all the cities of the region.

Ethan

"Ethan do you copy?"
"No, but I do scan, email and print."

Sunday, January 15, 2006

We failed again

Once again we let our masters down. If we had bombed the shit out of that house in Bajor agency ourselves, they wouldnt have been troubled to do it themselves. What are here for anyway?
And dont you go talking about violation of sovereignty. Sovereignty is violated when one armed force attacks another country's territory. In this case, the attackers were conducting an operation within their own land.
Never forget: we'd sell our mother if the price were right.

New Islamabad police

So, they've set up a new Police force for the federal capital. My argument is, can any police force act against Brigadier Blah Blah, or Secretary Blah Blah, or son of Minister for Waste Management? When the so-called elite considers itself above the law, and the police has no abiliy to enforce the law, you can continue inventing new police forces, which we've been seeing non stop in Karachi for two decades, without any results. Bottom line is, they're spending the tax payers money to get better looking protocol.

Saturday, January 14, 2006

A shepherd and his sheep

He swept the floor with his jacket and lay down, using the book he had just finished reading as a pillow. He told himself that he would have to start reading thicker books: they lasted longer, and made more comfortable pillows.
He arose and, taking up his crook, began to awaken the sheep that still slept. He had noticed that, as soon as he awoke, most of his animals also began to stir. It was as if some mysterious energy bound his life to that of the sheep, with whom he had spent the past two years, leading them through the countryside in search of food and water. "They are so used to me that they know my schedule," he muttered. Thinking about that for a moment, he realized that it could be the other way around: that it was he who had become accustomed to their schedule.
He had always believed that the sheep were able to understand what he said. So there were times when he read them parts of his books that had made an impression on him, or when he would tell them of the loneliness or happiness of a shepherd in the fields. Sometimes he would comment to them on the things he had seen in the villages they passed.
Quoted from The alchemist by Paulo Coelho

Thursday, January 12, 2006

Adams

A while ago I was watching the movie Stepmom on TV. I've seen it before, but I hadnt noticed that old boy Bryan Adams' song was in there, too. And a smashing one at that. Bryan Adams is definitely reputed to be the world's best ever live singer. I've listened to him studio recorded, I've listened to him MTV Unplugged, and I've listened to him recorded from a live performance. He's truly awesome. Summer of 69 is so amazing, it never misses hitting the spot whenever you listen to it.
But then I quite listening to music a long time ago. This particular song that I heard in this movie, brought back old fond memories. The song is called When you love someone. It's one of my favorites and I absolutely loved the MTV unplugged version of it. Here are its lyrics.

When you love someone - you’ll do anything
You’ll do all the crazy things that you can’t explain
You’ll shoot the moon - put out the sun
When you love someone

You’ll deny the truth - believe a lie
There’ll be times that you’ll believe you can really fly
But your lonely nights - have just begun
When you love someone

When you love someone - you’ll feel it deep inside
And nothin else can ever change your mind
When you want someone - when you need someone
When you love someone...

When you love someone - you’ll sacrifice
You’d give it everything you got and you won’t think twice
You’d risk it all - no matter what may come
When you love someone
You’ll shoot the moon - put out the sun
When you love someone

And then there's Jon Bon Jovi that I like very much. They had a soundtrack for a movie, which I think was called Young guns. That soundtrack, by the way, was the first thing I ever listened to on a compact disc on our first ever Aiwa CD player. It belonged to a friend of mine and he leant it to me. Billy get your guns, Blaze of glory, Blood money, absolutely awesome songs. I also used to enjoy Def Leppard. These guys were great.
I was also watching The terminal starring Tom Hanks and I loved it very much. Tom Hanks is truly the best actor ever born. I've seen him do all sorts of characters and he does them like no other and leaves you feeling short of nothing. Mel Gibson is cool, too, with his emotional scenes, but this guy, Tom Hanks is a maestro.
In this movie, towards the end (advance apologies to the ladies), when Tom Hanks is about to kiss Catherine Zeta Jones (cant blame him for that, by the way), my brother switched the channels to Geo, where nothing short of pornography was being played in terms of a hindi song, but that channel stayed put. I wonder why more is acceptable in a more recognizable language.

Check this out

This might be a surprise to some of the readers, but this is no news and there's a lot more going on in our society than meets the eye. Now, though, it has started to meet the eye a lot more and those who dont like it have been ordered vide what you could call an ordinance to keep their eyes shut if they dont like what they see. Daily Times published a feature article recently, a reference to which was made at this blog.
I wouldnt comment on the contents of the article, you can form your own opinions.

Phuns gaay

Now, our big guy is really proud of himself. And how can one get to the top of the (not so) pak foj without having good propaganda and public dealing skills. A couple of days ago we saw him pitted against Karan, an Indian origin journalist on a CNN interview. Karan won hands down. He flattened our big guy very quickly, who wasnt able to get up. Our big guy started talking to him as if he were talking to the Indian government. DUH, even if he were an Indian, he was representing an American (friend?) news channel. Karan, why dont you take over? Our big guy was teaching everyone about leadership and how the leader should dictate his "ideas" onto others and not be dominated by theirs, yet, somehow mysteriously enough, be open to their ideas. Now, I'm an engineer, basically, and I like precise stuff, and this sounds a self-contradictory statement. Karan kept calling him quite rightly, like all other foreign visitors by his military rank instead of Mr. Pres or something.
One analyst earlier on pointed out on the topic of public consensus on Kalabagh that the consensus was not sought on issues like LFO and District Governments, steps that changed everything, and are supposedly in the greater national (we know which nation we are talking about) interests. Kalabagh also being in national (in this case, this nation, if there is such a thing) interests, why do you need consensus now? Yea, Mush boy, lay down the foundation stone baby. Or should I say, cast the stone?

Tuesday, January 10, 2006

Diehard battery of tests

There is a battery of tests that assess the randomness of a sequence of (pseudo-)random numbers, called the Diehard battery of tests. We have been assigned a task to run this battery of tests on random numbers generated by MS Excel and Matlab. It's a strange set of tests in the sense that it requires an input file of 10 to 11 MB, containing nothing but random numbers and the file needs to be in binary format.
I used C++ to generate such a number (2867200 to be precise) of random numbers and dumped it to a binary file of 11.2 MB. I'll upload the code to do that soon.
The squeeze test always failed. I tried to increase and decrease the size of the file but to no avail. Ultimately, I stumbled onto the fact that the random numbers were not in the range from 0 to 2^32 - 1. What I was generating were 0 to 2^16 - 1. This is just so if someone stumbles into this problem and does a search, hopefully they would bump into this.
Now I am working to generate such a file from within Excel.

So, what is the problem?

OK, so we've been pointing out deficiencies, and we've been saying how Pakistanis behave abroad and make it a point to misbehave when not. Why is that? Well, if I were to talk of the US, if I were to skip a red light, or stop at a traffic light beyond the zebra crossing, or stop in the middle of two lanes and the list goes on, it is entered to my record by the policeman whom I can not bribe. The result is not merely a few dollars fine, the result replicates itself into my houserent, my loan interest rates, my insurance premiums (which are mandatory by law) and so many other things, that you can not even imagine doing any of that stuff.
So, it is fear of punishment that makes us behave. Down here, though, there is no fear. When President of the United States of Pakistan, General George W. Mush took over, I thought that he has an opportunity at a critical point in the nation's lifetime. It's now or never. If he puts just a few thousand corrupt people in front of the firing squad, without courts, without lawyers, just shoot, then a few hundred good men would die, but their blood would not go in vain and everyone else would learn the lesson they defie. But no, he wasnt there for that. He is there for other reasons, which are becoming obvious with time.
So, who or what, if ever, will erect those hangman's in the roundabouts of our towns?

Sunday, January 08, 2006

Retribution

I was reading a novel by Paulo Coelho titled, "The Devil and Miss Prym." It is a story of a small town in the mountains which, being remote, is inhabited mostly by criminals, who go there because they know no one would catch them there. A priest also lives there in a small church. The strongest of those criminals is Aheb. The priest, sick of living alone in the church wants to get a good night's sleep in a proper bed, for once. He goes to town and over to Aheb's place. Aheb is astonished how come this guy is sleeping at a killer's place. He gives him a bed and sits close by sharpening his knife while talking to the priest. Soon, the priest goes to sleep, waking up to the sound of Aheb crying. He asks Aheb what is wrong, and Aheb says that his whole life is changed. Aheb is amazed how a person could be so calm to go to sleep knowing that death is on his bed post.
Aheb then tells all the criminals to mend their ways and to find a legal line of work otherwise, Aheb would punish them. Everyone is apprehensive and talking amongst themselves of what to do. Aheb gives the design of a wooden structure to the carpenters and has them build a big structure in the middle of the town's square. He unveils it. It is a sort of hanging place. Now, the criminals are always crafting their crimes, but whenever they do their planning, the wooden structure comes to their mind and being scared, they give it up. The wooden structure is up for years, but no crime is committed. Then when everyone is righteous, whether they like it or not, Aheb has the carpenters take the structure down and replace it with a cross made of the same wood.
We need such wooden structures in our streets. We have no real punishment system. We know that even if we commit wrong, we'll let ourselves off by bribing or by influence.
We need a few of those wooden structures and we need a few million people or so hanged or put to firing squads. That's the only way to survival. We need a Mao Ze Tung.

Car parking

Our lane is currently under maintenance as a new sewerage line is being laid. Half of the lane is dug up in the middle. Now, that means that half of the residents are unable to get their vehicles to their car porches or to park them outside their own homes. The lane being not too wide, means, that our half of the lane is loaded with twice the load. Even with half the load, sometimes, some Einstein would park their vehicle in a creative fashion such that entire empty piece of land where I'm sure we can park six vehicles, is able to house only one.
Even if it is shared, no one wants to park their vehicle inside the plot and would like to park on the outside edge. The situation, now is more severe. No sense of sharing. Everyone's going through a difficult time, can being cooperative be so bad? But I'm living amongst Pakistanis.

Print

Well, thanks to Zeeshan Muhammad, my rants made it to the Daily Dawn of December 31, 2005. I'm sure it will piss off several people in the IT industry, provided they do read it, that is.

Monday, January 02, 2006

Long wedding

Last year I went to Islamabad with technical collaboration of South Korea (Daewoo Express Bus Service) to attend my friend's wedding, which was finally held yesterday. Why the hell did I have to go one year earlier than the marriage? No, I'm not a wedding counselor or consultant, I went there on December 31, 2005 and the wedding was on January 1, 2006.