Addictive little online games

 

It's the Friday before Christmas weekend. Stop pretending you're trying to get any work done today. Your boss is either off on vacation already or has her feet up on the desk, waiting for the appropriate hour to sneak off for a "late lunch" and never come back. To help you in your final hours of pre-holiday work, I compiled a list of some addictive online games, easy to play but hard to master. Have hours of fun. Go on, you deserve it.

Line Rider - You know it, you love it. This is the new version, just released.

Winterbells - Jump a bunny from bell to bell.

Finger Frenzy - How fast can you type the alphabet? (My high is 8.54 seconds. (Slow typer.))

Sober Santa - Steer drunk Santa away from the rails.

Falling sand game - Part game, part physics experiment.

...and many more.

Source: Addictive little online games (kottke.org)

10 online operating systems

This is an interesting article about WebOS concept, also has links to 10 WebOSs and reviews about them.

Here is the list:

1. Craythur
2. Desktoptwo

3. EyeOS

4. Glide

5. Goowy

6. Orca

7. Purefect

8. SSOE

9. XinDESK

10. YouOS

Here's the excerpt from the link:

But what is a WebOS (not to be confused with another definition of the term, see here), or a Webtop, anyway ? Here’s a simple definition: WebOS is a virtual operating system that runs in your web browser. More precisely, it’s a set of applications running in a web browser that together mimic, replace or largely supplement a desktop OS environment. It’s a tough field to start in for a Web 2.0 entrepreneur, because to be successful you need to create several applications that are at least as good as other competitors, and you need to connect them all into a usable bundle. What’s also expected by most users is that all this looks decent, operates similarly to a “real” OS and behaves as a real “OS” would, and is relatively bug-free. Simply put, to gain real everyday users, your WebOS has to be damn good. We’ll see how these newcomers fare in the following months and when (and if) some big giant like Google decides to create their own WebOS.

Source: Big WebOS roundup - 10 online operating systems reviewed at franticindustries - web 2.0, social networking, IT technology trends.

Get distracted

This game also distracts you from playing it. Fun to play and get distracted! My highest till now 19832.

Linked List Code for Beginners

#include "stdafx.h"
#include <iostream>

#ifndef _DSCLASS_H_
#define _DSCLASS_H_
class linkedlist{
private:
struct node{
int data;
node *link;
}*list;
public:
linkedlist();
~linkedlist();
//stack methods
void push_item(int num);
void pop_item();

//queue methods
void append_item(int num);
void delete_item();

//other insertion and deletion methods
void insert_item(int pos,int num);
void delete_item(int pos);

//other operations
void reverse();
void merge(linkedlist l1, linkedlist l2);
linkedlist operator +(linkedlist l1);

void display();
};
linkedlist::linkedlist()
{
list = NULL;
}
linkedlist::~linkedlist()
{
//TODO: yet to be implemented
}

void linkedlist::insert_item(int pos, int num)
{

if (pos<0) return;
printf("inserting %d at %dth position...\n", num, pos);

node *newone;
node *ptr = list;

if (pos==0)
{
newone = new node();
newone->data = num;
newone->link = ptr;
list = newone;
return;
}

for (int i=0;i<pos-1;i++)
{
if (ptr!=NULL) ptr=ptr->link;
else return;
}

newone = new node();
newone->data = num;

if(ptr->link!=NULL) newone->link = ptr->link;
else newone->link = NULL;

ptr->link =newone;


}

void linkedlist::delete_item(int pos)
{
if (list == NULL && pos<0) return;
printf("deleting item at %d position...\n",pos);
if (pos==0)//deleting the head
{
node *temp = list;
list = list->link;
delete temp;
return;
}

node *ptr = list;
node *temp;
for (int i=0;i<pos-1;i++)
{
if (ptr!=NULL)
{
temp = ptr;
ptr = ptr->link;
}
else return;
}

if (ptr->link!=NULL)
temp->link = ptr->link;
else
temp->link = NULL;

delete ptr;

}

void linkedlist::push_item(int num)
{
printf("pushing %d..\n",num);
if (list == NULL)
{
list = new node();
list->data = num;
list->link = NULL;
}
else
{
node* t = new node();
t->data = num;
t->link = list;
list =t;
}

}

void linkedlist::append_item(int num)
{
printf("appending %d..\n",num);
if (list == NULL)
{
list = new node();
list->data = num;
list->link = NULL;
}
else
{
node* par = list;
while (par->link != NULL)
{
par=par->link;
}
//now we are at the end
node *newone = new node();
newone->data = num;
newone->link = NULL;
par->link = newone;
}
}


void linkedlist::pop_item()
{
printf("popping ..\n");
if (list ==NULL)
{
printf("empty list\n");
return;
}
else
{
node *del = list;
list = list->link;
delete del;
}
}


void linkedlist::delete_item()
{
printf("deleting ..\n");
if (list==NULL)
{
printf("empty list\n");
return;
}
else
{
node *del = list;
node *temp = NULL;
while(del->link!=NULL)
{
temp = del;
del = del->link;
}
if (temp!=NULL) temp->link = NULL;
delete del;
if(del==list) list = NULL;

}
}
void linkedlist::display()
{
if (list==NULL)
return;

node *dis = list;
char str[100]="";
while (dis!=NULL)
{
sprintf(str,"%s%d->",str,dis->data);
dis=dis->link;
}
printf("%sNULL\n",str);
}

void linkedlist::reverse()
{
printf("reversing...");
if (list == NULL && list->link == NULL) return;
node *current = list;
node *prev = NULL;
node *next = NULL;
while (current!=NULL)
{
next = current->link;
current->link = prev;
prev= current;
current = next;
}
list = prev;

}

void linkedlist::merge(linkedlist l1, linkedlist l2)
{

node *top = l1.list;
while (top!=NULL)
{
append_item(top->data);
top = top->link;
}
top = l2.list;
while (top!=NULL)
{
append_item(top->data);
top = top->link;
}

}

linkedlist linkedlist:: operator +(linkedlist l1)
{
linkedlist temp;

node *top = this->list;
while (top!=NULL)
{
temp.append_item(top->data);
top = top->link;
}

top = l1.list;
while (top!=NULL)
{
temp.append_item(top->data);
top = top->link;
}
return temp;
}
#endif

How does a rice cooker know when to turn off?

How does a rice cooker know when to turn off?

There are a number of appliances that "know" when they should turn off. A rice cooker is one of them. The water-heating portion of a drip coffee maker (as opposed to the burner under the pot) is another. Automatic hard-boiled-egg makers work the same way.

All of these appliances use the same principle. If there is water in a heated container and the water is boiling, the container will maintain a constant temperature. See How Refrigerators Work for two experiments you can perform to prove this fact to yourself.

At sea level, the boiling temperature for water is 212 degrees F or 100 degrees C. As soon as all of the liquid water has evaporated (or, in the case of the rice cooker, as soon as all of the water is absorbed by the rice), the temperature inside the container immediately rises. The appliance has a thermostat that can detect when the temperature rises above 212 degrees F in the container, and it turns itself off.

Source: Howstuffworks "How does a rice cooker know when to turn off?"

50 Things to do with Google Maps

1. Measure your run route or commute
2. Check the time in a world location
3. Look up a US zip code
4. Measure Area
5. Make your own Google Map out of any map
6. Map your photos
7. Check what's on the other side of the world
8. Find a person in the US
9. Check the weather anywhere
10. Find the nearest Starbucks
11. Discover an eBay real estate deal
12. Find airport parking in the US.. or the UK
13. Create a running route
14. Watch a travel video
15. Find Fast Food in the US
16. Buy beer in Ontario
17. Check the news for your zip code
18. Avoid disease outbreak
19. Beat traffic
20. Make your own Google Maps mashup
21. Avoid red light cameras
22. Find cheap gas
23. Check sunrise or sunset times
24. Convert currency
25. Find a place to live in the US
26. Find out where the daylight is right now
27. Find a ski resort anywhere in the world
28. Track a flight on Google Maps
29. Calculate the distance between two world airports
30. Find the elevation/height above sea level
31. Map the 7 Wonders of the World
32. Find a golf course anywhere in the world
33. Click anywhere and get travel info
34. Simulate a flood to show damage effects
35. Fly a plane
36. Search Google Maps in full screen
37. Find a world webcam
38. Find a US or Canadian Library
39. Find a world port
40. Map the fish in your tank
41. Find high risk areas for modern marine pirates
42. Find a world dive site
43. Map Wikipedia articles to their location
44. See where UFOs have been sighted
45. Pray in the direction of Mecca
46. Search eBay items by US zip code
47. Map flight turbulence and pollution
48. Plan a London tube journey
49. Calculate cab fare in New York City
50. Map where movies were filmed in the US and Canada

Source: Google Maps Mania: 25 Things to do with Google Maps mashups

Skytopia : Illusion that is supposed to be scary

Copied from Source: Skytopia : Dynamic optical illusions. Pictures, 3D and animation

Vision distorter (v2.0)
Watch your very world around you distort!

Seeing is believing..... or so they say. Well believe it no more, because as these animations will show, your very world is going to distort around you!
Improved over time, this ranks as one of the more scary optical illusions. There are anims to make everything shrink, grow, stretch, and a mix of these.
For this stunning illusion, you'll want to download this small and easy to install
ultra-efficient AVI lossless codec created by Kenji Oshima. Otherwise, you may download the standard "Microsoft Video 1" AVI versions here (20k zipped), but then you'll need to follow the instructions in the blue box-out to the right.

Online Morse Code Conversion

.--. .-. .- ...- .- .-. .- -.- .... -.-- .- .-.-.- -... .-.. --- --. ... .--. --- - .-.-.- -.-. --- --

That was pravarakhya.blogspot.com in morse code!

Link to Online Conversion - Morse Code Conversion

More Code Puzzles

1. Find Second Maximum in an array.

void findSecondMax(int a[])
{
    int max=a[0], secondmax=0;
    int size = sizeof(a)/sizeof(int);//doesnt work here
    for (int i=1;i<10;i++)
    {
        if (max < a[i])
        {    secondmax = max;
            max = a[i];
        }
        else
            if(secondmax<a[i])
            {
                secondmax = a[i];
            }
    }
    printf("second max is %d... max is %d",secondmax,max);

}

2. Remove the duplicates from an array.

void removeDuplicates()
{
    //int a[10]={1,1,1,3,3,5,5,6,6,6};
    int a[10]={1,2,2,3,4,5,5,6,7,8};
    int b[10];
    int size = 10;
    for(int i=0, j=1;j<size;j++) { if(a[i]==a[j])
        {
            for (int k=j;k<size-1;k++)
                a[k] = a[k+1];
            size--;
            j--;
        }
        else
        {
            i++;
        }
    }
    for (int j=0;j<size;j++)
    {
        printf("%d ", a[j]);
    }
}

Code Puzzles

1. Reverse a string

void reverseString()
{
    char r[12]="reversethis";
    char *start = r;
    char *end = r;
    while (*end!=0)end++;
    end--;
    while(start!=end)
    {
        //swap
        char t = start[0];
        *start = *end;
        *end = t;

        start++;
        end--;
    }
    printf("%s",r);
}

2. Traverse a matrix (m X n) spirally

void goSpiral()
{
    int arr[5][6] = {{1,2,3,4,5,50},
                    {6,7,8,9,10,100},
                    {11,12,13,14,15,150},
                    {16,17,18,19,20,200},
                    {21,22,23,24,25,250}
                    };

    int i=0, j=0,ilim=5,jlim=6;
    int till=0;
    int doing = 1;
    while(doing)
    {
        doing =0;
        for (i=till,j=till;j<jlim-till;j++)    doing = printf("%d ",arr[i][j]);
        if(doing==0) break;
       
        doing =0;
        for(j--,i++;i<ilim-till;i++)    doing = printf("%d ",arr[i][j]);
        if(doing==0) break;
       
        doing =0;
        for(j=jlim-till-2,i=ilim-till-1; j>=till+0; j--) doing = printf("%d ",arr[i][j]);
        if(doing==0) break;
       
        doing =0;
        for(j=till+0,i=ilim-till-2; i>=till+1; i--) doing = printf("%d ",arr[i][j]);
        if(doing==0) break;
        till++;
    }

   
}

3. Sort an array with just 2 types of elements

void sortJustTwoThings()
{
    int a[10]={1,0,1,0,1,0,1,0,1,0};
    int ptr1 = 0; //start of the array
    int ptr0 = 9; //end of the array
    while(ptr1 != ptr0)
    {
    if(a[ptr1]!=0)
    {
        while(a[ptr0]!=0) ptr0--;
        if(ptr1>ptr0) break;
        int t = a[ptr1];
        a[ptr1] = a[ptr0];
        a[ptr0] = t;
        ptr0--;
        if(ptr1==ptr0) break;
    }
    ptr1++;
    }
   
    for(int i=0;i<10;i++)
    {
        printf("%d ",a[i]);
    }
    printf("\n");

}

4. Concatenate 2 strings and remove the overlap. For eg, if string1 is PRAVARABC and string 2 is ABCAKHYA resultant string should be PRAVARAKHYA.

void removeOverlap()
{
    char str1[]="ABCDE";
    char str2[]="DECDGEFGHIJK";
    char strout[500];
    char temp[20]="";
    //first copy the first string
    strcpy(strout,str1);
    int l = strlen(str1);
    int r = 0;
    bool overlap = false;
    for(int i=1;i<=strlen(str2);i++)
    {
        strncpy(temp,str2,i);
        char *s = strstr(str1,temp);
        if (s!=NULL)
        {
            r = l-(int)(s-str1);
            if (i==r)
            {
                for (int m=i; m<strlen(str2);m++)
                    strout[l++] = str2[m];

                strout[l]='\0';
                overlap = true;
                break;
            }
        }
    }

    if(!overlap)
        strcat(strout,str2);

    printf("%s",strout);
}

5. reverse the words in a sentence.

void reverseSentence()
{
    char sent[]= "sun rises in the east and sets in the west";
    int s = strlen(sent);
    for (int i=0; i<s/2; i++)
    {
        char c = sent[i];
        sent[i] = sent[s-1-i];
        sent[s-1-i] = c;
    }
    int cur =0;
    char *c = sent;
    int j =0;
    while (*c != '\0')
    {
        j =0;
        while (*c!=' ')
        {
            if (*c=='\0') break;
            j++;
            c++;
        }
        for(int k = cur, m=0; k<cur + j/2 ; k++,m++)
        {
            char l = sent[k];
            sent[k] = sent[cur+j-m-1];
            sent[cur+j-m-1] = l;
        }

        if (*c=='\0') break;
        c++;
        j++;
        cur += j;
    }


    printf("%s",sent);
}

 

 

QuickSort C Code

void testQuickSort()
{
static int a[8]={4,7,8,5,2,6,3,1};
quickSort(a,0,7);

for(int i=0;i<8;i++)
printf("%d",a[i]);

}
static void quickSort (int a[], int lo, int hi)
{
// lo is the lower index, hi is the upper index
// of the region of array a that is to be sorted
int i=lo, j=hi, h;
int x=a[(lo+hi)/2];

// partition
do
{
while (a[i]<x) i++;
while (a[j]>x) j--;
if (i<=j)
{
h=a[i]; a[i]=a[j]; a[j]=h;
i++; j--;
}
} while (i<=j);

// recursion
if (lo<j) quickSort(a, lo, j);
if (i<hi) quickSort(a, i, hi);
}

More Links

ninjawords: Best Online dictionary i found till date. Gives meaning instantly, simple interface

moola: Gaming site where you can earn money for every win. Addictive. Beautiful User Interface. Need to register and will need an invite for registration.

Using no-to-all while replacing files in Windows: Useful tip.

Enough of links now, my next post will be the source code snippets (C++) that I have with me. I found cool plugins for Writer which enable me to put code snippets in the blog with syntax coloring. I have just installed "Paste from Visual Studio" and "Insert Code for Windows Writer" plugins from Microsoft Site, lets see how it works.

Empty Constructor or No Constructor?

Here is a good article about the difference in having a class with and empty constructor and no constructor.

Got this article from this blog which also has a couple of interesting CPP articles.

My First Post from Windows Writer (Beta)

This is post is being written using Microsoft Windows Writer (Beta). I just got a chance to install it on my machine in the Office. When I gave my credentials and logged in to blogger service, I got a message saying that my blog templates couldn't be downloaded, so I'm not seeing my WYSIWIG interface, although the editing UI is pretty simple.

I have tried to publish this post but it gave me some blogger2 error. I think its because I have Writer version 1.0. I have now upgraded to Writer 1.0.1.

Now I'm able to see the WYSIWIG interface, as I think my blog templates are also downloaded. This is cool!

Lets see how it works!

Update: It works. This is lot simpler (and powerful with many features) than logging in to blogger website and edit posts from the Web Interface.

Microsoft Interview Questions

1. Microsoft Interview questions from this site. Contains riddles, algorithms, applications and thinkers.

2. Sketchup from Google: Neat and easy way to draw the 3D layouts of your house. Can even upload it to google account and also to google earth. Need to download a standalone app of 19MB.

Want to fly an aircraft?

Aircraft simulator : http://flightgear.org: never tried it.
Dots and lines game: http://www.athey-educational.co.uk/games/game5/game5.htm: doesnt congratulate you even if you win against computer!
Line Rider: http://www.linerider.org: there is something special about this game.
City Pixel: Wonderful site, roam around the virtual city, hire an apartment, design and furnish it, and meet your neighbors!

Best way to say Thank You!

This summary is not available. Please click here to view the post.