27 October, 2008

Calling JavaScript functions from C#

There is perhaps no way available to do this, nor should there ever be one. This is because your C# code runs in the code behind, a repository of code to handle post backs, while your JavaScript is executing on the client side. If at all client side javascript was let to be executed from C# code, then it would be similar to AJAX RPC's! A better way to call Javascript functions is by using hidden fields. The following logic demonstrates how:


|
|-->set a hidden field


|
|-->check the value of the hidden fields for changes, if any write logic which has to execute.

Reverse the above logic, and put the javascript hidden field check so that it executes when the page gets loaded, and VOILA, you have an answer to your solution.

10 October, 2008

i = i + 1 : A ridiculous way to say increment I !

How many of you have coded in C, C#, Java or even JavaScript for that matter? If you have, then you'd probably know i=i+1 as one of your best companion when dealing with loops. Yet, I call the practice ridiculous...Why do you think that is?

For one, any programmer with a basic understanding of math would have puzzled over this question: isnt i->i+1 more meaningful than i=i+1 in a programming context? Why then do all programming languages follow the pattern of variable = variable +1?? I have no clue whatso ever, but I would reckon it is a reminiscent of the age when there were no standardized charecter sets for various programming languages and all vendors defined their own charecter sets, and standards.

And, to add to this mess, every programmer, no matter how experienced uses the counter variable named i, instinctively. Of course, he'd have to use an alternate variable to nest loops within other loops, he'd have to use another variable, and the second variable would instinctively be named j. I do not know if the collective conciousness of all programmers is at play here, for I have seen the same pattern repeating with every coder I have met over the past decade or so.. Even with me ! As we all pave way for new programming languages and techniques, I also hope that this hideous practice will be stopped, for all our sakes.

08 October, 2008

The environment?...Naah, who cares...

We humans are a filthy lot. I say this because from time immemorial, there hasn't been any one species which has filthed its own nest.. Until now. Humans are everywhere. With the unknown world shrinking and even the most remotest of remote places being explored, we arent far from colonizing every habitable patch of land on the planet. "Just because we can, we will" seems to be the attitude of our beloved fellow homosapiens.

Between all the colonization and resource exploitation, we all manage to turn a deaf ear to the environment which is literally crying for help around us. Utter stupidity if you ask me. If there is no earth, there are no humans.

We dont know half the things there is about earth that we ought to know, and yet, our kids know a lot more about alpha centauri than our earth. There have been talks of migrating out of earth and taking the human race with us, because by the time this plan solidifies, earth will be all but a nuclear waste ground. With all this knowledge and profoundness, we still continue to haunt the earth, and pollute the environment with reckless abandon. All this being said, even I myself am one of the filthy lot.

I don't use a public transport because I would then lose my convenience. I still travel to work everyday in a bike which guzzles up more fuel than the neighbors car. Im writing this in my blog because we humans will always be selfish. We never admit our mistakes and will surely not do anything to rectify what wrong we have done. All that being said, I wish all of us could switch onto more efficient means of energy such as solar / hydroelectric / Nuclear energy, all of which are limitless. But until our scientific communities can put their differences aside, and the pope can agree that physical attraction is not a crime, we will all just delay our days in cold hell...

03 October, 2008

Wow..what a life!!!

I just bagged myself a job in the .net domain... I landed a job in a company called Asclepius (name of the greek god of medicine) consulting. And I must say I was very overwhelmed by the work environment. Everyones very friendly, and people dont make a fuss of everything. This actually goes against conventional corporate culture where you are just a sheep in the crowd, and thus, no one knows you. When you enter a big company, chances are you would be oblivious as to what to do, or whom to ask...

That is just not the case with Asclepius. The timings are very flexible, and all the bosses(YES, there are three founders) are asking is for me to do my job and go home. Currently, the companies is expanding rigorously, so theres no doubt about job guarantee and some such thing. The bosses said they wanted me to be with the company for atleast 2 years. There is no concept of control at all in the company. All in all, Im very happy that the tech lead knows my name and is happy everytime I speak...

What more would you ask in a company when its your first job?