Monday, August 11, 2008

Easter eggs in a software

An Easter egg is a hidden functionality(set of tasks which however may or may not be part of the main system,it totally depends on the programmer's wish..whatever he likes to do he will do,it means there is not any preset standard to enforce the programmer to provide some specific functionality.) in a software, Which is not directly visible to the users however depending on some specific events they come into action....Now we will illustrate it in a very simple way by taking an example of a html page. In this page, suppose i want to show a help section which needs to be some event specific..i mean some particular event will trigger it.
So i say if u type help anywhere in the page , You will be taken to the help section....so this is known to me only ...however when users will go through it they will be knowing it afterwards. so obviously this is something hidden and about which there is not any message or say informatiion.

Now use this code (You are taken to google help section after typing the word "help", so this is an easter egg of this webpage.) in understanding this term......here goes the code!


http://www.w3.org/TR/html4/loose.dtd">
var accumulator = new Array();
var match_it = new Array();match_it[0]= 72;
match_it[1] = 69;
match_it[2] = 76;
match_it[3]= 80;
var index = 0;
var started = 0;
window.onkeyup = keyup;
function clearString()

{index = 0;}
function keyUp(e)
{var mykeycode = e.keyCode;
var temp = parseInt(mykeycode);
accumulator[index] = temp;

index++;
if(index==4)
{
var matched = 0;
for(i=0;i<=3;i++)
{ if(accumulator[i]==match_it[i])
{
matched++; } } }
if(matched==4)
{ alert("you typed help");
window.location = "http://www.google.co.in/help" }
if(started==0)
{ var t = setInterval("clearString()",2500); started = 1; }
}
body onkeyup="javascript:keyUp(event);">

press and hold any key, then release it to fire the keyup event

No comments: