Sunday, July 05, 2009

Why FAST?

A batch-mate sent a message on MSN messenger a few days back. It's always nice to hear from old fellows, specially after 9 years :) Below is a snap of the chat; with due respect to FAST and its administration.
Note 1: It's not that I have something personal against FAST rather I am one of the proud alumni. I hold the institute dear to me to the extent that some of the most respected people for me are the teachers at FAST, who made me what I am today. Laster, when I was doing my Masters at Chalmers University of Technology, the coursework at FAST made me shine. But how can I not see the problems? In the words of Iqbal, "nala-e-bulbul sunoon or hamatan gosh rahoon?"
Note 2: I have made some modification to make the conversation a bit more understandable


One Guy says:
salam
jaywalker v4.7.3 says:
Wa alailkum Assalam!
One Guy says:
do you remember what was the policy of gold medal for our batch ?
One Guy says:
or we didn't have any gold medal?
jaywalker v4.7.3 says:
was there a policy? :)
One Guy says:
hehehheheheheheh
jaywalker v4.7.3 says:
well, I, "A" and "B" were given gold medals
jaywalker v4.7.3 says:
we had equal GPA's: 3.78
One Guy says:
why not you?
One Guy says:
actually i seen on nu.edu.pk website
One Guy says:
they listed positions holders for every year
One Guy says:
and now a days...they have 1st , 2nd third postion
One Guy says:
but in our time they have something else....
One Guy says:
so if no person have more then 3.8 then no gold medal
One Guy says:
am i right?
jaywalker v4.7.3 says:
give me the link
jaywalker v4.7.3 says:
yes, you are right...there used to be something like 3.8...but still they have 3 medals to our batch
One Guy says:
http://nu.edu.pk/MedalHolders.aspx
One Guy says:
check this out....
jaywalker v4.7.3 says:
you can see that 3 names are mentioned for gold in year 1998
One Guy says:
we have olympic style medal...silver bronze etc...
One Guy says:
i got Alumunium one
jaywalker v4.7.3 says:
that's great :D
One Guy says:
i remebered may be wrong
One Guy says:
you got more GPA then naveen?
One Guy says:
Sr.# Roll No Name Medal
1 98-0858 Hamid Shahid Gold
2 98-0958 Muhammad Ali Shah Gold
3 98-0976 Muhammad Imran Saeed Gold
4 98-0931 Rizwan Hassan Silver
5 98-0889 Naveen Anwar Bronze
jaywalker v4.7.3 says:
sub bakwas hai bhai...yes, I got more gpa
jaywalker v4.7.3 says:
but you know how they give gpa
jaywalker v4.7.3 says:
there used to be a random number generator
jaywalker v4.7.3 says:
which assigned random gpa's to people
One Guy says:
yes i belived on this otherwise you know
jaywalker v4.7.3 says:
on a serious note, results submitted by external faculty were always manipulated by the trio
jaywalker v4.7.3 says:
why digging this out after 9 years?
One Guy says:
other then me who else can come in top most position
One Guy says:
actually....i saq Mr.Rizwan Rajwani picture on road
One Guy says:
on sign board with NU-FAST Ad
One Guy says:
they put ad on roads....ad different location in city beside tooth paste ads...
jaywalker v4.7.3 says:
acha, ok :)
One Guy says:
then i check website and came to know the positin holders list
One Guy says:
kher leave it...actually we know real things that's enough..........

Note 3: There are actually 8 photos of alumni on such billboards; 3 of them are from my batch: Rizwan Ravjani (now in Standard Chartered Bank), Rehan Abdul Ghaffar (now in Unilever) and Naveed Bajwa (now in Microsoft)---all having nice positions within Pakistan.

Labels: ,

Friday, July 03, 2009

The Emperor's New Clothes

A stupid story read in the childhood seems so relevant and to the point in the mid-ages! I am sure you have read The Emperor's New Clothes in one form or another.

Time and again, I have seen people praising something just because some other people were praising the same thing! In fact, people seem stupid (or backward or conservative) if they don't appreciate the "new clothes" which either do not exist or are very low quality from what they actually have. Usually, the person "demonstrating the new clothes" is a consultant or a new inductee, who tries to impress others by his "vast experience" and acumen---not necessarily duping them but selling them an idea without facing any resistance. Finally, the ideas are very well appreciated by the people attending the presentation, even though very little would have gone in their heads.

I remember someone told me years ago, "God has created a fair share of stupids for each one of us; it's upto us to find them."

Labels: , ,

Monday, June 08, 2009

Outlook: Forgot to attach the document?

Sometime back, I discussed how you can get notified while sending emails without a subject in Outlook. Below is an improvement which checks for missing attachments when there is a keyword "attach" found in the body of the message before a "From: " string is found.

1Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
2 If (Not Item.Class = olMail) Then Exit Sub
3
4 Dim mailItem As mailItem
5 Set mailItem = Item
6 If (mailItem.Subject = "") Then
7 answer = MsgBox("Do you want to send the message without entering a subject?",
8 vbYesNo + vbSystemModal)
9 If (answer = vbNo) Then
10 Cancel = True
11 End If
12 End If
13
14 msgBody = mailItem.Body
15 posAttach = InStr(1, msgBody, "attach", 1)
16 posFrom = InStr(1, msgBody, "From:", 1)
17 If (posAttach <> 0) Then
18 ' word "attached" found
19 wordInOldEmail = False
20 If (posFrom <> 0) Then
21
22 ' word "from: " found
23 If (posAttach > posFrom) Then
24 wordInOldEmail = True
25 End If
26 End If
27
28 If (Not wordInOldEmail And mailItem.Attachments.Count < 1) Then
29 answer = MsgBox("Do you really want to send the message without attachment?",
30 vbYesNo + vbSystemModal)
31 If (answer = vbNo) Then
32 Cancel = True
33 End If
34 End If
35 End If
36End Sub
37


As in the past, this is not a COM add-in. I have tested it with Outlook 2003 only in the VBScript Macro editor.

Labels: ,

Sunday, May 31, 2009

PHP: strpos() and the game of Booleans

Once you know a certain programming paradigm, learning different languages within that paradigm is a piece of cake, except for the idiosyncrasies of these languages. I wonder if there is any language without these!

So, while writing a game of hangman in PHP, I needed to use strpos() and was happy that the syntax matched C++.

int strpos (string $haystack, string $needle [, int $offset = 0])


However, if you have tried to match the result of strpos() in an if condition, you might have struck a brick wall:



The problem here is that strpos() can return an integer or a boolean false! That is, it either returns the position where the $selection is found in $word or it could return "false" if not found. At first sight, I couldn't believe that the return value can both be an integer or a boolean!

Now, in the code above, if the result of the strpos() call is 0, i.e., the very beginning of $word matches the $selection, the next if-condition will evaluate to true because 0 is equal to false in PHP. So, how do we match a varied data type with a single typed-value in PHP?

The solution to this is a strange === operator as documented in the strpos() API. There is a conjugate not operator which is written as !==.

Ah, the language designers! It's so un-intuitive that people have reported bugs around this very problem. And it's the same reason why some careful designers don't implement certain features.

How come one can write functions like the one below in PHP?

Labels:

Thursday, May 28, 2009

Mobilink EDGE Settings for BlackBerry

While playing with my Blackberry Curve 8310 a few weeks back, I somehow deleted some configuration which caused all programs using GPRS/ EDGE Connectivity to stop working. The blackberry effectively got limited to being an email client. The surprising thing is that the web browser kept on working but remain limited to a few sites (mainly Google). If I tried to surf to some other site, I usually got one of these two errors:
  • Communication Failure: A communication failure has occurred. The server may be busy, please try again later. If the problem persists contact your service provider.

  • HTTP Error 502: Bad Gateway: The gateway received an invalid response from the server when attempting to fulfill your request. Please try loading a different page. Contact your service provider if the problem persists.

Please note that I have a Mobilink Indigo connection. When resetting the "Service Book Entries" and Re-registering the Host names (as suggested on various sites) didn't work out, I finally figured out that I needed to set the APN Name in Options -> Advanced -> TCP Settings to "connect.mobilinkworld.com" without any userid and password. It seems that Mobilink's settings for Jazz are "jazzconnect.mobilinkworld.com". The settings are mentioned on Mobilink's site as well.

Bingo! Everything is back to normal.

Labels: ,