Wednesday, May 23, 2007

Re-Learning java scripts

For my current project of a credit management portal I had to re-visit java scripts to perform some client side validations. I have never got the chance to do JavaScripts with ASP.Net 2.0 and every simple damn thing abt those 2 technologies together was foreign to me and I had to learn from scratch. Thought I should just jot down a few things I've learnt along the way.

    1. Internationalizing the javascript messages 
      You can attach java scripts to the page at server side as oppose to writing the whole thing in the html page (or seperate java script file) it self as we use to. So at the server side u have all the localizations tools/APIs in your hand and you can pump localized content in to your javascript.     
      string javaScriptString = 'blah blah blah ' + Localization.GetString('Key',LocalResourceFile) Page.ClientScript.RegisterClientScriptBlock (this.GetType(),'NameOfScript',javaScriptString);
    2. Prevent Postback of a page                                           Again adding java scripts to client side events can be done at the server side.
      TextBox1.Attributes.Add('OnClick', 'showHelp') will call the showHelp javascript once the button is clicked by the user. But what happens by default is that the page anyway is sent to the server as a post back. In order to prevent it the attribute should be added as follows.
      TextBox1.Attributes.Add('OnClick','return showHelp').
      In this instance if the showHelp function returns false, the page will not be posted back.

Attaching the javascript to the page at server side and having event handlers bind at server side are two simple yet useful tricks I learnt. You can increse the flexibility of your event handling model (Eg: You can add and remove the attributes from a control based on server side logic) with this easily.

With the popularization of Ajax on web the importance of learning java scripts is again emphasized to the developer community.

Labels:

Friday, May 18, 2007

Aren't u & I feel tired of this life at least several times a day? I mean 24 hours doesn't seem to be enough to do all the things that we wanna do. Life is so fast with fast foods, fast driving, rapid learning, rapid developoment etc...yet we're always falling behind, running after something which keeps eluding us.

The 'Slow Movement' has been set up to turn this around. They promote the idea of living slowly. Turn down the volume in our life stereos. Driven by the success owned by the 'Slow Food' campaign of the italians against the 'Fast Food'/Big Mac culture, there are many 'Slow Cities' now set up (mainly in Italy).

A slow city emphasises on less traffic, less noise, home made food, scholls paying more attention to life/morale/purpose, domestic industries etc...

Although u can't have all our cities to be slow overnight we can pick some ideas from these movements and try to give our selves more time to enjoy life at least make time to see for ourselves how it flows....

Wednesday, May 02, 2007

Are we killers?

The Virginia Tech massacre is one of many incidents of a raged or so called disturbed human being killing his fellow beings without any known/common motives like war, poverty, robbery, personal fight etc...

After identifying the killer the  media is slowly but surely convincing us that he is indeed an abnormal human being who had shown signs of this from his childhood and in the recent past and so called authorities haven't paid enough attention to chase him out of the society. So making sure that out of the ordinary people like 'Cho' are identified properly and put to mental hospitals might save us from future similar incidents. Or will it?

It is now known that 'Cho' was a consistent fun-factor in school & college. His quite style and peculiar way of English speaking had been a reason for other students to make fun of him. And the natural distant relationships existing in many developed countries like US had not allowed anyone to be close to 'Cho'.  After 9/11 the Bush regime has done whatever is possible to inflict fear upon its citizens and had succeeded in BIG time. Many of the US people now feel that the whole world is just plotting their fall day & night, thanks to Mr.Bush & co. Naturally this makes a foreign skin so much more alien to US citizens and make it much more difficult to build close connections with those people.

I'm sure we ourselves have neglected so many similar situations in our day to day work. Do u have any people in u'r office who doesn't interact with u like others do? Have u thought about why they behave like that? Can u do something about it? I'm sure you agree with me that making a better connection with such people is better.

My argument is that although we haven't gone wild and shot people in our school or neighborhood we definitely have assisted in some way or the other for killings like this. A real tiny negligence could be the life changing 'Butterfly Effect'  for another person.

Please pay more attention to people around you. Not in the sense where u try to identify whether that person is a threat and to make sure he/she is taken out from the system. But to make that person a part of the society, how different that person may be from the norm.