Monday, November 28, 2011

Guinea pig

Hi, I recently gave my GRE exam which I have been planning to give for past 2 years. Sometimes I didn't got courage and sometimes I thought I am happy where I am. But constant pressure from parents and from my dear friends that says "What's the use of doing only B.Tech these times? That can be done by anyone."

Well, I am not at all in favor of the statement. B.Tech though can be done by anyone literally but the knowledge gained in the time period of 4 years only that matters. I have seen people who are undergrads from not so good college and they managed to score 9 pointers during whole of their college life. And even after that when you ask them difference between an interface and a class they are blank. { I have most of friends in section of CS and IT }. That is true for some students in good colleges also. But sometimes the tag name of college helps to get through the placements. I will stop cribbing on this subject because this is very controversial. Each one have opinion and supporting points for that.

That doesn't matter currently, the blabbering is about the career path which I choose I always become the lab pig for experimentation.
When gave 10th CBSE boards, entire syllabus changed.
When gave 12th CBSE boards, the exam syllabus and pattern changed.
When gave IIT-JEE Entrance, the exam pattern changed.
When gave GRE, the exam pattern changed.

Now it feels like whenever I need change some exam pattern I should just plan to give it. And when I have taken a date for that exam a mail will come saying the pattern has been changed. Please study according to new pattern and also flush your old books and specific preparation in toilet. The exam which remained stick to old pattern was toefl only. I consider that just an exception.

I am planning to go in Fall 2012 for MS. But I am confident when I will go for visa applications the procedure will be changed and will be made much harder to complete the whole process. I also wish all the best to all the aspirants planning to go next year with me because my bad luck might also ruin their chances of getting in. I can't help me it out so just deal with it.
Adios.

Sunday, November 6, 2011

We are Number One

Hi,

Recently Metallica toured India. It was the first time when India got the chance to organize a concert by the Gods of Metal. The ardor of the crowd was on cloud 9. Waiting to get in the palace ground, banglore since morning showed the passion. But what does this tour of have to do with the post title. Well when Metallica played The Memory Remains and the epilogue of the song have a melodious tune. When James finished the song, the crowd continued even after he stopped singing. Later when all of them stopped playing the crowd was in full swing, singing that part. It went on for twice, thrice.. and the expression which came on James face was priceless. The crowd was unstoppable. The encore continued. James had to speak up and stop the crowd so that they can continue with the concert. And I am sure, if James haven't spoken we could have continued whole night.
Indians have this desire of proving them that they are no less than other. The same feeling which was shown to the band who has performed all round the globe, to let them know they also have an immense fan following here. The energy and the passion is the same or even more than what other audience have shown them.

One more example of the same which I have came across in my professional life. Indians literally work their assess off to impress the boss/client sitting off-shore. Ask an Indian developer whether he will be able to work late hours or will he be able to attend calls on weekends if some problem occurs. I rarely know who has refused to this. This can also be coined as greed for appreciation. But if the same situation is presented to an developer who don't have Indian phenomena, he/she will surely refuse to do any sort of office work on other day than they are being paid. Even without asking, some people are so courteous to say "If you face any problem, anytime and need help; call me. I am always reachable by my phone."

This prove our desire to work which in return raise bar for others. As quoted correctly by Bill Gates, that India has a huge technical expertise. Even not being number one but there are some aspects which are not accounted when ranking is conducted. The work which an B.Tech college pass out can learn in 3-4 weeks of training and do it profoundly for rest of his career proves the point.

In the end all I want to say that I am proud to be an Indian. And we are number one.

Friday, November 4, 2011

jQuery Events: e.preventDefault and e.stopPropogation

Hi,

I read about the tunneling and bubbling of events in javascript. After reading the history about the events and how that helps to do handle events at various levels; I thought of sharing my insight on that.

There are already enough materials which can be found on internet regarding this. I thought of presenting simplest model to present the difference between e.preventDefault and e.stopPropogation.


The core concept about the events order is explained in a very nicely written blog post I found. Instead of rewriting the same in different form, I thought of sharing the link of the same. Here is it --> Events Order.


Now being acquinted with the history, now I can explain the usage and difference of mentioned events in the title.


e.preventDefault: This event is used to cancel the default behavior of the element it is bound to.
e.stopPropogation: This event prevents the event from bubbling further in DOM.


HTML 
 <div>
    <a type="button" href="navigate.com">Click Me!</a>
 </div>

Javascript
jQuery("a").parent.onclick(function(e){
   alert('from parent');
});


//code 1
 jQuery("a").onclick(function(e){
    e.preventDefault();
    alert('Preventing Default calling');
});

//code 2

 jQuery("input").onclick(function(e){
    e.stopPropogation();
    alert('Preventing Propagation of Event');
});



In code 1 e.preventDefault() is called is suppress the href and cancels the navigation of the page. But in this the event written for parent is also called.

In code 2 e.stopPropogation() stops the bubbling of the event but href navigation happens. So here the event written for parent is not called.

After learning about these event a question pop-up in mind isn't the functionality provided by e.preventDefault() is similar to that of return false statement written in the end.
Well the functionality provided in similar but there is a noticeable difference.

Lets modify code 1 to see the difference


//code 1.1
 jQuery("a").onclick(function(e){
    e.preventDefault();
    err();   // error code
    alert('Preventing Default calling');
});


//code 3

 jQuery("a").onclick(function(e){
    err();  // error code
    alert('Preventing Default calling');
    return false;
});


Consider the err() function as some error has occurred in the code. Since we are not handling the exception the code is going to break. But in case of code1 calling e.preventDefault() prevent's the default behavior of the element, so the page still won't navigate to a new link.
But in code 3 , it doesn't reaches the statement return false. So the default behavior is called and the page navigates.

I hope this helped you. If you have any queries, do comment.