Sunday, October 23, 2011

Microsoft YouTube Account Hacked

Hi,

I have subscribed to YouTube's Microsoft's official channel. Got a mail that they have uploaded a new video and when I clicked on the link, the video doesn't seem official.
Checked their YouTube's Page and voila see the screenshot.


All the past videos uploaded by Mircosoft are gone. Hope YouTube's fix it soon.
Till that time enjoy the random upload's from the account asking for backgrounds. ;)




Update: New Background to the Account


Update: Another New Background to the Account




Update: And we are back again with "Epic Share"



Sunday, October 16, 2011

Angry Birds For Chrome Browser

Hi,

Want to play the much hyped game "Angry Birds".
Thanks to Google for giving the people who don't own andriod / apple devices.


Cheat Available ::

For unlocking all levels : In the browser window ( the one in which game is opened) place this javascript and press enter
javascript: var i = 0; while (i<=69) { localStorage.setItem('level_star_'+i,'3'); i++; } window.location.reload();

For relocking all levels :
javascript: var i = 0; while (i<=69) { localStorage.setItem('level_star_'+i,'-1'); i++; } window.location.reload();




For checking the cheat source click here.

ICallBackEventHandler Mystery

Hello,

I was working on a project in which I needed to use call server-side code to get data after the page load.
Instead of the latest jquery ajax I preferred to use the old sword for ajax call ICallBackEventHandler.
On reading certain history on Ajax Calls to server, I found that there are many techniques which can help me. But after exploring more about ICallBackEventHandler I thought that will suffice my purpose and the amount of data travelling on wire is also less in this as it uses raw ajax. Some MVP's says that ICallBackEventHandler was a failure, they suggest to use ASP.NET Ajax instead.
But I already had a POC which was giving me expected results. So I didn't bothered to explore that front much.

The requirement was, there were two controls in my page which needed to show data after the page load.
I made two CallServer methods, binding each control.

I tried to call server methods on a button click.

function ServerMethods() {
   CallServer1();
   CallServer2();
}
And the load methods as:

function CheckforContent1() {
    alert('function 1');
}

function CheckforContent2() {
    alert('function 2');
}
On debugging both the functions are called, but at the time of response only the latter CallServer method's CheckforContent method is executed. In my case only CheckforContent2 method gives the alert. Not the first one. It got me confused that why is that happening.

As the deadline was closer I found a workaround for the problem but the original issue kept bugging me.
Workaround:

function ServerMethods() {  CallServer1();  }

    function CheckforContent1() {
    alert('function 1');
    CallServer2();
}
The workaround solved the problem the page to become idle was increased as the second server call was after the first get completed instead of being in parallel which I expected. I kept searching for the answer but couldn't find one. All I can get was the way to do it is the way I did it. When ICallBackEventHandler was designed it was taken into consideration of multiple simultaneous callback's. Since I only needed small data in string format so this served the purpose this time but now I think I may need to explore better options for calling server asynchronously.

Sunday, October 9, 2011

jQuery .data

Hi,
 Recently I faced an issue regarding Global variables in Javascript.
 I had to save a lot of data regarding many DOMElements and do manipulation later on them.
 I had declared about 10 global variables. Getting them was fast but remembering which is related to which DOMElement was difficult.
So had to name them with ID's of the DOMElements prefixed to variables names. But I searched for an elegant method to do this job and yes I found that. jQuery again came to rescue here.

There is a method name .data which can be used to save values related to an DOMElement in form of a key-value pair. Can read the documentation of the method on the this link... jQuerydata I am going to give you a small implementation which explains how this works.

Sample HTML

<span class="yes" id="save">Click to Save Value</span>
<span class="no" id="get">Get Value</span>
jQuery Scripts

$(".yes").click(function() {
    var v = $("#save");
    $.data(v, "key", "value!!!");
    alert($.data(document.body, "bodyKey")); 
});

$(".no").click(function() {
     var v = $("#save");
    if($.data(v, "key") != null ) {
    alert($.data(v, "key")); 
    }
});

$(function (){
    $.data(document.body, "bodyKey", "Global Body Variable");
});


I have also saved some value in document body, giving a way to declare global variables. Hope this helps..

PS: The code in this post won't work. You can save the scripts and html to try it out.