Sunday, June 28, 2009

AJAX Control Toolkit

With .NET 3.5, you can easily work on AJAX without installing any add-on. AJAX can be used in any web application without any hassel to speak of. And with AJAX more interactivity can be put in an application.

AJAX control toolkit makes life more easier. It provides many interactive controls, that can be put in your application easily. It is an open-source project.

How to start using AJAX Control Toolkit:

1. Download the toolkit here
2. Here's a video that explains how to set up the toolkit.


ASP.Net's official website gives an over view of all the controls provided in the toolkit here.


With the toolkit you can easily put animation in your app. There are a lot of things which can prove to be very helpful. You should definitely go through the above link, it shows how all the controls work, plus code is given to help you get you on your way to using these control effectively.

For every page that's going to use AJAX, or the toolkit (in other words, AJAX) ScriptManager has to be added.
All you have to do is put

<asp:ScriptManager ID = "Scr_Mgr" runat = "server" />


Plus to use the toolkit you have to register it first. If you just drag and drop any control then the below line of code would be added automatically, other wise you can put the line yourself;

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>

Masked Edit Extender:
In the application I am working on these days; I have to provide a mask for the text box, so that each user who enters data can simply punch in the characters and the data will be formatted automatically. Of course, you can use a javascript for this, it's not like people didn't do this before AJAX came into the scene. But with the toolkit, as I mentioned, it becomes much more easier.

For the above scenario, Masked Edit Extender can be used. Masked Edit Extender, extends a textbox, you have to provide a Mask. Mask basically tells the format of the data.

Let's say you are looking for a format like this: "0312-3456789".
The syntax would go something like this;


<asp:ScriptManager ID = "Scr_Mgr" runat = "server" />
<asp:TextBox ID = "txtbx" runat = "server" />

<cc1:MaskedEditExtender ID="txtbx_MaskedEditExtender" runat="server"
TargetControlID="txtbx"
Mask = "9999-9999999"
MessageValidatorTip="true"
MaskType= "None"
InputDirection="LeftToRight"
AcceptNegative="Left"
DisplayMoney="None"
ErrorTooltipEnabled = "true"
ClearMaskOnLostFocus = "false" >
</cc1:MaskedEditExtender>


1. It doesn't let you type more than the number of characters in the mask.
2. It lets you type letters if the mask allows you to. So say you put mask as
"AAAA-99999", for the first four characters only letters will be allowed, and no numbers,
and for the rest of the input, only numbers will be allowed, no letters.

The problem I faced was that, the mask appeared only when the user clicked on the text box, and when
the user was done typing and as the focus shifted to some other control, the input data again became
unformatted. That too can be handled simply by setting a property.

ClearMaskOnLostFocus = "false"

That's all for the moment. Other controls I found helpful are: Filetered Text Box and Validator Callout.
Might write something on them soon. :)

Thursday, June 25, 2009

Shadows of the past.....

It amazes me sometimes, how we keep living in the past. How something bad that happened to us a long time ago still has the power to affect us. I am not talking about things that have put a permanent dent on our lives, but things that we have overcome, simple facts that we have learnt to live with, the facts that are no more facts.
A simple example would be not getting something you really worked hard for, and even after you have realized that that something really wasn't for you, and what you've got as a substitute proved to be perfect for you. That not getting that something, not getting your desire, not getting what you wished dearly for, may have been depressing at the moment, but all got better after that. And maybe you got what you wanted to, but a little late. And you know all this, you know that whatever happened, happened for a reason, and a good one. You know that what happened was the best thing that could've happened to you, but whenever you are pushed down the memory lane, and you have to travel through the same depressing time again, why aren't we strong enough to make the journey down that road again with a smile, knowing that it had all passed now, and what you have at the present is good enough for you. Why?

And why, when you keep on telling people, who are going through something like that in the present, that everything will be fine. You keep reminding them that life won't give you anything you can't handle, and you really believe it too.

But even then, why do we still let that past control our today??
Or... is it just me????

Tuesday, June 23, 2009

And Pakistan brings home the cup..

Again this is not an informative/news post.. EVERYONE knows Pakistan won Cricket World Cup T20, those who didn't watch the match, got to know that by the excited chattering of their cricket-lover friends..
Then what this post is for then? Well.. nothing,, just a post :P

Almost everyone, even people who after being disappointed again and again by Pakistan team's performance, put aside their frustrations and watched the final match between Pakistan and Sri Lanka.

Sri Lanka, who had not lost a single match throughout the tournament, finally lost the most important match of all. But they did play very well. It was not a match won easily. It was not an easy win, and hence deserving, with superb performances by our team. :D :D


And so the people went crazy. We've been disappointed too many times, that when Pakistan won the match, and when we Pakistanis finally got a good news amidst the troubles the nation has been facing for quite a while now, all went delirious (well, most) in their own unique ways.

It was quite a celebration everywhere.

As soon as Pakistan won, people started messaging each other, sending their congratulations to their friends. Appropriately saying.. "We WON!!!!"

Many had already gathered at friend's places so that they can watch the match together, and that sure would have been fun.

The next day, people were actually hugging each other and saying congratulations.

Almost everyone on my messenger and gtalk list mentioned in their nicks that: "Yehhhh.. Pakistan won" (by the grace of Allah)

This was prove enough that we were all full of bliss.. :D

A good post, with a few facts can be found at Ammad Saleem's blog


Monday, June 22, 2009

Office Chuckles

Note:
The following though may not be very funny for all, and it wasn't exactly hilarious for me either, but it was something I thought was worth sharing on blog.. so here goes.. (aren't Notes supposed to be in the end??? well.. never mind.. :) )

As I sat trying to work my way through the log files, trying to find the reason due to which the customers were facing an error, thinking..
"Ab kya phat gaya yaar?" ("NOW what's wrong?")

suddenly a voice like "Peeepp" from behind me startled me, but only for a few seconds, as I realized what it was, I got back to my work.

A message popped on my screen (Office Network Chat);
F:
"That voice...any idea?"

Me:
"Yup, it's the laptop. Apni zindagi kee akhri saansein letay waqt chila raha hai.. (crying while counting minutes to it's death)"

F:
"Oh...."

The peep voice continued and after a while I added.

Me:
"And all of us are too busy to put the laptop to peace. We'll let it shout and disturb us rather than get up and do something about it. Getting up and taking a few steps towards the laptop may be counted as exercise you know."

F:
"Then why don't you get up if you are so worried about it."

Me:
"Naah... Let it be"

Just about then I found the root of error and called my boss. At that point my boss and the people sitting next to him realized the noise pollution emitting from the cubicle near me... It took them a few seconds to realize that it was the laptop. And I, helpful as I am (:P), suggested that we keep it for charging.
And my boss, as he walked towards the laptop, rejected my suggestion and did something more wise.. He put it to sleep... (equivalent to killing it in accordance with my analogy of the laptop dying).

Though it was the obvious thing to do if you weren't in the mood of going through the hassle of putting the laptop on charge, neither F nor I came up with it. And it was a little funny when I saw my boss executing the easier solution.

Friday, June 19, 2009

Cricket World Cup T20




It's been a long long time, almost two years, since I have watched cricket.
When I did watch, it was more for the love of watching Pakistan win than the love for the game itself. I have always been interested in Pakistan playing and winning (of course) as compared to enjoying the game.
And why it has been so long.... the last year at Bachelors, which we like to call the FYP year was spent doing a lot of things; studying, making your FYP, job surfing, interviews and of course enjoying the last year, celebrating days etc. I was so busy doing all this that I forgot about cricket altogether. Plus, the last World Cup, with the coach's story and Inzi resigning and Pakistan loosing horribly, didn't help at all. And then when that hectic year ended, another began, and the tempo was lost somewhere. :P
Anyways, so these days, I am not actually free, but I have found my long-lost interest in Cricket... that may very well be because of the fact that Pakistan is performing better. Plus, after every match, team mates discuss the highlights. All this was bound to get me back on my track..
So ta-daaaa I am back!!!!!!

Anyways, so I am not actually here to discuss World Cup T-20, if you wanna do that.. go hang out on Cricinfo... Here we'll be discussing something else... :P This is a trip down the memory lane.. only people who were there with me will be able to enjoy this (of that too there is only a thin chance) :P

So all of this cricket-fuss reminded me of the time when I used to be a die-hard fan and still couldn't understand why there was such a thing as LBW.. :P

Only one of the girls in my class shared my never-dying (which eventually did die.. but only for a while) devotion for Pakistan team, and only one was what I needed.
During breaks between classes, we'll rush to the computer labs, trying to find a free computer, hurridely logging in and then checking cricinfo for the latest updates. But more fun was when we didn't find any free computer, but still we couldn't risk not knowing ball-to-ball details, so we would go and nag others;


  1. We would either find someone with cricinfo open (and there were many!!), we would make sure they happen to come in our route to the door, and give a furtive, non-interested glance to their computers while we were passing by, and there... we'll have our scores.

  2. Or we'll sneak up on our unsuspecting friends, snatch away the keyboards from them, and check the score. And hear things like;

    "Koi kaam nahi hai tum logon ko kya????"



    "Don't you people have TRW class?"



    "Khud ko to kuch karna nahi hai.. humein to project/assignment bananye do...."



And then there was that day, when one of our teachers, who proved to be an even-bigger fan, started discussing a match, giving her comments (and that too like an expert) on yesterday's game, and suddenly one of the guys stood up, and said, with a very serious expression on his face..

"Ma'am mein abhi ja ke score check kar ke aata hoon"

like that was the most important thing in the world to do at that exact moment.. and seriously it was... :) :P


And then came the World Cup... I wasn't disappointed at Pakistan loosing, more disappointed by the way our people were reacting. No matter how important it is for anyone to watch Pakistan win, it's still just a game, nothing more, nothing less.. These are the people who make heroes and they are the ones who perish them.

And I remember.. well not exactly, as I didn't watch the match... the match between Pakistan and Ireland, which unfortunately Pakistan lost, and which was Inzimam's last match.

Back to the present, as Rambler and I were going up the flight of stairs, making our way towards the lunch room and we had an encounter with two ladies coming back from lunch....

Lubrilu:
"Mubarak ho India haar gaya"

And as the match I mentioned above (the one between Pakistan and India), was all that I had on my mind that day, I found the mention of cricket as a great opportunity to let everyone have an insight on my story... I immediately switched into my story-telling mode, not caring at all whether anyone was interested even a bit or not;

"I remember that Pakistan-Ireland match... and can you imagine? I had a mid-term the next day.. and that too of Software Engineering.. Why would they ever schedule papers during World Cup... "

FarQuest said:
"And I know you still watched the match"

Me:
"NO!!!! I studied.. and I flunked... well what else was I supposed to do... Almost everyone failed that mid-term.."


(And I don't know why I would mention something like me failing a paper on my blog.. but well.. I just did. And I'll get people to comment and vouch for 'everyone failed that midterm..' to prove that I wasn't the only one)

The reason I decided to mention this match was that I still remember the only glimpse I had of that match.. Inzimam-ul-haq going back to the pavilion after playing his last batting inning, with tears in his eyes... You put in so much of your time on a game, even if you are playing for yourself, and not for your country or your team, even then.... you deserve a better farewell than Inzi got.. His team mates might have given him a better one.. and maybe Pakistanis did too, and I just don't know of that, but what I do know is that what was happening in those days, our reaction at that time.. well, they weren't good.. :)

And as that was the last match I watched before I lost my interest in Cricket, it's going through my head these days, this match and all the fun we had in uni, the way we died to hear of the updated score. And I thought I should better write a post on it (for the need of having something better to write)

Anyways.. I am back on track.. I have started watching cricket again.. Pakistan is in Finals (YEHHH!!!)
Yesterday, everyone was hugging each other and saying Congratulations like Pakistan has won the final already.. (when it has won the semi-final only, I hope it does win the finals, and then it will be time for celebration..)
And about two to three times, the semi final was discussed by my team-mates.. Sentences like
"Kya awesoommee match tha yaar.."

kept landing on my ears...

P.S:

  1. The first post I wrote on my blog was of Pakistan loosing the match.. :P

  2. The Writer commented on me a few days ago..
    "You can write an essay on anything"

    Though I did not take very lightly to that comment.. but I think I have just proved him right, haven't I?
    Just wrote a mindless post.. on a mindless topic, which was completely OFF the topic... :P :P