Archive for September, 2007

India won the Worldcup twenty-20 cricket :)

September 24, 2007

Hi,

This is really a long long time since I posted anything here.Well, partly because I was busy watching twenty-20 cricket world cup. First some matches I missed and that was intentional as our team was not performing well. But after India beat England :) and Yuvraj scored 36 out of 6 deliveries ( all 6s to a over ) with the quickest 50 ( out of 12 balls ), something inside me started burning. I said to myself, you must watch one match at least. So I started watching from India-SoutAfrica match.To my surprise our team played in a manner which I have never seen since I have started watching cricket from my childhood. They were ruling in all the time, whether its bowling, batting or fielding.The captaincy of Dhoni is rock solid but cool and calm. And finally today India beat Pakistan to win the first twenty20 Worldcup.Here is the scorecard. All thumbs up. They are the best when they play it.Three cheers to India.

I can see the clear picture when a team plays to its strength as a team under the guidance of solid, planned and calm captain. All the players, I mean all the players played very well, not well, very well. This worldcup shows what India can do, if they are addressed by one team rather than individuals.

There were times when things went wrong, but I found no dropped shoulders.Absolutely no to defeat.Always up for the challenge, always throughout the game.I hope they keep up the good spirit and make me proud and happy as I am today. :) :) :) Three cheers again to Indian twenty-20 cricket team. :) Congratulations to the team and all you Indians out there. :)

Methods with unknown number of parameters

September 3, 2007

Recently I am studying “Essential Actionscript 3.0″ by Colin Mook. I am in the first chapter itself and informations are already there to digest. I simply love the Mook’s books. Previously it was for AS2 and that was too good, now this is an excellent addition. This writing simply brings the books pages to here with my own edits :) .
Ok, straight to the point, how to write a method,  inside a class, which can handle “multiple” or better word as per Mook is “unknown” number of parametrs ?!! The answer is “…(rest)” parameter. This parameter defines an Array to hold any number of arguments passed to a given method. It can be used on its own or in combination with named parameters.
Using the parameter alone :
function myFun(…what){
for(var i:int=0;i<what.length;i++){
trace(what[i]);
}
}
myFun(’a',’c',’b',’g',’h',’j');

Now try to call the function with some new number of parameters as
myFun(’a',’c',’b',’g');
The result will be obviuos.Lets try to use the “…(rest)” parameter with a named parameter.
function samAdd(a:int,…more){
var addValue:int=a;
for(var j:int;j<more.length;j++){
addValue+=more[j];
}
trace(’sum=’+addValue);
}
samAdd(5,4,5);

I have simply added “sam” before the function name, instead of my name “saumya” :) . Ok, now if you look at the result it will give you “14″.Lets the call the function with the desired number of parameter, which is 1.I mean you must pass one parameter to successfully call this function.So the next call will be
samAdd(20);
This will result in “20″, but what happens if we call it without any parameter as
samAdd();
The compiler throws an error saying “Incorrect number of arguments.Expected 1.”

When used with other parameters, the “…(rest)” parameter must be the last parameter in the parameter list.That means, we can not write
function samAdd(…more,a:int){
//code to be executed
}

For me, its just WOW.

Cheers to Mook. I will put things like this as i proceed through the book.

PHP 5.2.4 Released and PHP 4 end of life announcement is done

September 3, 2007

There is a new version of PHP released and at the same time the death of PHP 4 is also announced. There are a number of new enhancements to the new release of PHP 5.2.4. For a complete list of enhancements and bug fixes, you must have a look at this.