Showing posts with label Internet. Show all posts
Showing posts with label Internet. Show all posts


1) Code your Server.js - Node.js main file
        i) Importing libraries
        ii) Create Server and Handle Request
        iii) Play with to do MultiChatting
2) Develop Webpage with Socket Javascript
3) Download Project here

1) Code your Server.js - Node.js main file

i) Importing libraries

 var http = require("http");
 var url = require('url');
 var fs = require('fs');
 var io = require('');

ii) Create Server and Handle Request

var server = http.createServer(function(request, response){
 var path = url.parse(request.url).pathname;
  case '/':   
   fs.readFile(__dirname + "/index.html", function (error, data) {
    if (error) {
     response.write("opps this doesn't exist - 404");
     response.writeHeader(200, {"Content-Type": "text/html"});  
     response.write(data, "utf8");
  case '/socket.html':
   fs.readFile(__dirname + path, function (error, data) {
    if (error) {
     response.write("opps this doesn't exist - 404");
     response.writeHeader(200, {"Content-Type": "text/html"});  
     response.write(data, "utf8");
   console.log(path +"- Not found");
   response.write("opps this doesn't exist - 404");

iii) Play with to do MultiChatting

var serv_io = io.listen(server);
var textarea="";
var name="";
serv_io.sockets.on('connection', function(socket){
 //send data to client
        socket.emit('date', {'date': getCurrentTime()}
    }, 1000);
 socket.on('client_data', function(data){
  //socket.emit('textarea', {'textarea': data.textarea});

function emitData(socket){ 
  {'date': getCurrentTime(),
   'name' : name,

function getCurrentTime(){
 var d = new Date();
 var curr_date = d.getDate();
 var curr_month = d.getMonth()+1;
 var curr_year = d.getFullYear();
 var curr_hour = d.getHours()%12 +"";
 var curr_min = d.getMinutes() + "";
 var curr_sec = d.getSeconds() + "";
 if(curr_hour.length == 1)
 if(curr_min.length == 1)
 if(curr_sec.length == 1)
 //var dateString = sprintf("%2s-%2s-%s %2s:%2s:%2s ",curr_date,curr_month,curr_year,curr_hour,curr_min,curr_sec);
 var dateString = curr_date + "-" + curr_month + "-" + curr_year + "  " + curr_hour +":"+ curr_min +":"+ curr_sec;
 return dateString;

2) Develop Webpage with Socket Javascript

    <script src="/"></script>
 <script src=""></script> 
  width: 200px;
  height: 30px;
  padding-left: 10px;
  color: green;
  var socket = io.connect();
  socket.on('date', function(data){
  socket.on('message', function(data){   
   if(len > 0){
   if ( event.which == 13 ) {
    strname = $('#name').val();
    if(len > 0){
     socket.emit('client_data', {'name':strname,'textarea': message}); 
 function printMessage(strname,message){
  $('#messagearea').html($('#messagearea').html()+"<br/><span style='color:blue;font:18px;'>"+strname+"</span> : "+message);
    <div><h1>Welcome to Node.js - Simple Multi Chat Application</h1></div>
 <b> Get tutorial here (Post your comments and query)</b> - <a href=''></a><br><br>
 <b> Get Latest Code here </b> - <a href=''></a>
 <br><br>Current Time: <span id="date"></span><br/>
 <input type="text" id="name" value="Guest" class="common"> - Type Name here<br/><br/>
 <textarea id="textarea" class="common"></textarea> - Type Message here and press Enter.
 <div id="messagearea"></div>

3)  Download Project here

GitHub -

Post your comments and query for any help.

Develop your first Android Game

How to develop android games?

Developing android games is simpler than you think.

Check out this android game. Which is built using this technique.
Save Super Penguins

Before starting the tutorial familiar yourself with android.

1. Set up the Android Workspace

2. Create your Hello World Android application

Lets start the game development.

Just follow this Four Steps to start your first simple android game.
Step 1: Create a Game Loop Thread that renders the Frames.
Step 2: Create a SurfaceView class that will show the game UI and controls the game.
Step 3: Create a Image handler class that will help you in collision detection and loading bitmap images.
Step 4: Wire up your MainActivity.

Post your comments in case of any difficulty and help.

Step 1: Create a Game Loop Thread that renders the Frames.
package com.coolcomputerpctricks.tutorialgame;
import android.util.Log;
import android.view.SurfaceHolder;

 *  Android Game development tutorial * 

public class MainThread extends Thread {
 private static final String TAG = MainThread.class.getSimpleName();
 // Frames Per seconds
 public  int MAX_FPS = 150; 
 private  int FRAME_PERIOD = 1000 / MAX_FPS; 
 private SurfaceHolder surfaceHolder;
 private ViewGamePlay gamePanel;
 private boolean running;
 public void setRunning(boolean running) {
  this.running = running;

 public MainThread(SurfaceHolder surfaceHolder, ViewGamePlay gamePanel) {
  this.surfaceHolder = surfaceHolder;
  this.gamePanel = gamePanel;

 public void run() {
  Canvas canvas;
  long beginTime;  
  long timeDiff;  
  int sleepTime;  
  sleepTime = 0;
  while (running) {   
   canvas = null;
   try {
    canvas = this.surfaceHolder.lockCanvas();
    synchronized (surfaceHolder) {
     beginTime = System.currentTimeMillis();
     timeDiff = System.currentTimeMillis() - beginTime;
     sleepTime = (int)(FRAME_PERIOD - timeDiff);
     if (sleepTime > 0) { 
      try {
      } catch (InterruptedException e) {}
   } finally {
    if (canvas != null) {

Step 2: Create a SurfaceView class that will show the game UI and controls the game.
package com.coolcomputerpctricks.tutorialgame;

import java.util.Random;

import android.content.Context;
import android.view.MotionEvent;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
 *  Android Game development tutorial * 

public class ViewGamePlay extends SurfaceView{

 MainThread thread;
 ItemImages bgImage,parachute;
 int max,min;
 public ViewGamePlay(Context context) {
  thread = new MainThread(getHolder(), this);
  getHolder().addCallback(new SurfaceHolder.Callback() {
   public void surfaceDestroyed(SurfaceHolder holder) {
    boolean retry = true;
    while (retry) {
     try {
      retry = false;
     } catch (Exception e) {
   public void surfaceCreated(SurfaceHolder holder) {
     Canvas c = holder.lockCanvas(null);
     }catch(Exception e){

   public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
    //Surface changed


 public void initializeGame(Canvas canvas){
  bgImage =  new  ItemImages(BitmapFactory.decodeResource(getResources(),,0,0);
  parachute = new  ItemImages(BitmapFactory.decodeResource(getResources(), R.drawable.parachute),0,0);
  //Random left position for the parachute
  max=(int) (canvas.getWidth()-parachute.getWidth());
  Random rand = new Random();  
  int randomNum = rand.nextInt((max - min) + 1) + min;
 protected void drawGame(Canvas canvas) { 
 public boolean onTouchEvent(MotionEvent event) {
  float x = event.getX();
  float y = event.getY();
  if(parachute.isCollition(x, y))
    // If player touched, reset the parachute location
    Random rand = new Random();  
    int randomNum = rand.nextInt((max - min) + 1) + min;
  return true;
 public void render(Canvas canvas) {
   // Reset the parachute location
   Random rand = new Random();  
   int randomNum = rand.nextInt((max - min) + 1) + min;

Step 3: Create a Image handler class that will help you in collision detection and loading bitmap images.
package com.coolcomputerpctricks.tutorialgame;


 *  Android Game development tutorial * 

public class ItemImages {
 private float width;
    private float height;
    private float left;
    private float top;
    private Bitmap bmp;
    private boolean visible; 
    public ItemImages(Bitmap bmp,float left, float top)
     this.width = bmp.getWidth();  
        this.height = bmp.getHeight();
    public void setBmp(Bitmap bmp) {
  this.bmp = bmp;
 public void drawBMP(Canvas canvas) {
  if(canvas!=null && bmp!=null)
   canvas.drawBitmap(bmp, left, top, null);
    public void drawBMP(Canvas canvas,Rect src,Rect dst) {
  if(canvas!=null && bmp!=null)
   canvas.drawBitmap(bmp, src, dst, null);
    public boolean isCollition(float x2, float y2) {
        return x2 > left && x2 < left + width && y2 > top && y2 < top + height;
 public float getWidth() {
  return width;
 public void setWidth(float width) {
  this.width = width;
 public float getHeight() {
  return height;
 public void setHeight(float height) {
  this.height = height;
 public float getTop() {
  return top;
 public void setTop(float top) { = top;
 public float getLeft() {
  return left;
 public void setLeft(float left) {
  this.left = left;
 public boolean isVisible() {
  return visible;
 public void setVisible(boolean visible) {
  this.visible = visible;

Step 4: Wire up your MainActivity.

package com.coolcomputerpctricks.tutorialgame;

import android.os.Bundle;
import android.view.Menu;
 *  Android Game development tutorial * 

public class MainActivity extends Activity {

 protected void onCreate(Bundle savedInstanceState) {
  setContentView( new ViewGamePlay(this)); 


Here is the two images used in this tutorial



Download Project here

GitHub -

Post your comments for any doubts and helps.

Most Difficult Hardest Android Games

Most Difficult Hardest Android Games 

1) World's Hardest Game

(Crossing More than 6th stage is difficult)

This is The World’s Hardest Game! Work your way through 30 incredibly hard levels, and if you can finish all of them you can compete for a spot on the world leader board!
You are RED square, avoid the BLUE circles and collect Yellow circles. Once you have collected all the yellow circles move to GREEN beacon to complete the level.
Your score is a reflection of how many times you have died; the less, the better.

2) Parachute Penguins

(Crossing More than 8 Level is Difficult)


Parachute Penguins. Save Penguins from the hungry and sharp jaws of Sharks waiting at the bottom of the sea.
Make use of Three Exciting Bonus Powers
1) Freeze - Freeze the flappy penguins bird for short period of time in the sky and let you save the penguins easily
2) Slow Motion - Flappy penguins bird drop at slow motion which will give you plenty time to save the penguins before it drops to sea under waiting sharks jaw.
3) Brush - Just swipe the screen with your finger to save multiple flappy bird penguins at the same time. This makes you little easier to save the penguins for particular period of time.
Bonus Powers Drop from the sky.
Frequently Bonus Powers Drop from the sky along with the the cute parachute penguins, catch Bonus Power Parachutes to increase your bonus power counts.
KidMode Suitable for your kids to play, Save flappy bird penguins by just swiping the screen. KidMode doesnt support Highscore but it has 100 Life and just swiping the screen saves the flappy bird penguins drop from parachute.

3) Hardest Game Ever 2

Hardest Game Ever 2 is a series of fun and exciting mini-game that measures your reaction time to the milliseconds and pixels! See how fast you can slap and how sharp is your reaction to catch the eggs before they touch the floor in milliseconds! Hardest Game Ever 2 promises to bring you hours of adrenaline drain! Challenge your family and friends and find out who's got the fastest reaction on Android!
- Simple 3 Button Control
- 48 Stages with 4 Challenging Levels
- Ranking with Facebook Pals
- Simple yet addictive gameplay
- Multi-language Instructions

Are we trusting Google too much?

Are we trusting Google too much?

1. why should chrome warn us with a message when we clear browsing history?

Whenever we try to clear browsing history, chromes tells that there is incognito mode to use, is Google worried if you clear your entire browsing history from chrome?

What does Google do with your browsing history?
Here's a clear evidence, "YouTube", Google's YouTube shows video contents relevant to our browsing history stored in chrome. that's how your information is used to make you use their product(YouTube) more than what you do normally.
you can find the difference when you go to "YouTube" home page in both conditions
1. first without browsing history - everything cleared in chrome- visit YouTube home page
2. after doing couple of Google searches, let chrome shows some history and visit YouTube, you will feel the difference

2. why should chrome has separate log in session separating it from other google products.

when you logged in chrome, also when you logged in some of other google product like gmail, when you signout of gmail,chrome logged in session wont go.

chrome separate login session stores all your data ( you can control it by visiting settings, how many of us do that, what about people who doesn't have enough computer experience to change the settings ) user specific data stored in each of our google account right from browsing history to form input data's.

3. How does google map works - showing traffic information in the road we travel.

It does collect our location information including in which speed we are traveling, it collects every one who uses android mobile or signed in to google map atleast once and using some algorithm it gives back.

4. What will happen with Google Glass?


5. Not just above four items, there are lot more things.. like

     At first time when you open Google Chrome, it asks you to sign in with Google account. How many of you signed in without knowing that it is a log in for Google chrome to save your personal browsing data  in your account?
      Many would have no idea initially that it is a log-in specially for Google Chrome. and would have signed in directly thinking it is normal google product sign-in.

 Obviously, we are very much benefited and addicted to all those products, and there are ways we can control sharing our data to a certain level, but how many of us are really concerned about it, going to settings, searching where it is and switching it off?

Google's New Scientific Calculator

Google Launches its New Scientific Calculator.

If you type "Calculator" or "99/9" in google search, you will get the googles All New Scientific calculator.
Or if you do any mathematic calculations right away it will bring its Advanced Mathematical calculator
Try typing these things in google search for getting Google Scientific Calculator

Search it in Google - Calculator , 99/9 , Sin(90) , Sin 90,  log10 , like any mathematical calculations.
Its is as fast as google search results.

Google Restricts Labels in blogger (robot.txt)

Google Search restricts Labels (Categories) for all the blogs in Blogger (BlogSpot)

If you see something like this in your webmaster tools, be cool don’t worry for this.

This is because

Reason: Each Label entries are not sub pages, they are just a well framed search query
For example:
When you click the Label – Windows Trick in, the url pointing to that label is this

If you see this url carefully, you can see “/search/” in it, this means it is not actually a new page to be crawled by the Google search bot, it just a search query url, where all the pages yielded by this search query url is already indexed, so it just says it restricts the labels (search query url), but all the pages in your site is already indexed and included in search engine

The main idea behind having labels in the blogs or website, is to make the users comfortable in selecting categories they wished.

What should you do to make safe browsing, when using your friends laptop or using it in any Internet center.?

What should you do to temporarily erase the trace of what you searched for?

Keep the history unchanged, but temporarily disallow saving of histories, cookies, url names and everything.

Here is what you need to do.

Almost All the browsers has a concept called Private Browsing, Private Browsing helps not to save any information like histories, form entries, username, password, cookies, and everything you browsed for, so all the browsing entries can be unsaved for that particular time of browsing
For Chrome Users
1.       Click Settings ( Tool Icon on the top right corner of chrome)
2.       From the drop down, select “New Incognito Window

3.       You will now see a new window with a Detective Agent Logo on Top Left Corner, where you can make private browsing, credit card transactions, experiments, research, and anything that will not saved forever
4.       And when you close it, it goes normal, If you want to do Private browsing again, need to start from first

For Mozilla Firefox Users
1.       Click Firefox Button on the Left top corner
2.       Click “Start Private Browsing
3.       You will receive a alert box, click “Start Private Browsing” once again

4.       There you go, you will now see a new window that has changed color in the Firefox Button on the Left top corner enjoy private browsing, where you can make private browsing, credit card transactions, experiments, research, and anything that will not saved forever

For Internet Explorer Users
1.       Click Safety Menu on the Top right side of the Internet explorer
2.       Select “InPrivate Browsing

3.       There you go, you will now see a new window that has InPrivate icon on the address bar, enjoy private browsing, where you can make private browsing, credit card transactions, experiments, research, and anything that will not saved forever

Google Chrome gets a new Icon

Google Chrome icon changed

New Chrome ICON
Old Chrome ICON

The new Google Chrome Icon is very simple and looks like it's a 2 dimension of the old chrome icon.

The new Icon has been changed automatically for all the users of chrome browser. it seems like update is going on for the application without the users knowledge.

Simple things are always powerful - secret of Google.

Interesting !!! Google Vs Bing , Unbelievable Trick try it yourself.

Interesting !!! Google Vs Bing , Unbelievable Trick try it yourself.
Have you ever tried Automattic currency Conversion in Google or Bing search, There lies this interesting fact.Just have a look at it.. perhaps wait! how about Exploring this interesting crazy fact on your own with the help of following steps.

Step 1: Open your favourite Web browser twice (two windows or two tabs) open in one and In another.

Step 2: Type the following in both the search bar and hit Enter.

1 euros in usd

Step 3: Well I searched at this time December 5 2010 8.24 pm look what I get. Having two different answers for same question

Google said 1 Euro = 1.3382 US $

Bing said 1 Euro = 1.34246 US $

Step 4: Which one is correct??????????!!!!!!!?????????

Step 5: Well According to Yahoo (OMG!!! another search engine) Currency convertion at this page;to=EUR;amt=1.3399 says both are wrong.

Step 6: Well Let’s try some other site to verify it which says Google Data is better than bing and yahoo but not Accurate though !!!!!!.
Enable and Disable Thumbnail view (Most visited / Recently Closed) on the New tab of Google Chrome Browser

By Default you have the thumbnail view enabled, closing or disabling this view is very simple

Step 1: just click X – close button on the right side of the Most Visited or Recently closed frame.

Step 2: After clicking it, the thumbnail view will disappear.

Step 3: Though the thumbnail view disappeared, u can access the most visited and Recently closed items through links on the left down of the page in a simple view.


And to get back thumbnail view of Most visited or Recently Closed items
Step 1: click the “Most Visited” link (text) in the left down corner

Step 2: You will have your recently visited links poped up, now click the “Most Visited” link in the poped up window.

Step 3: now the Most Visited view will be appearing in the top of the page, click the arrow on the left side of it.

Step 4: That’s it You have your thumbnail view of Most Visited items back.

Step 5: Do the same for Recently Closed items .

Bug Exposed in Google Chrome Browser

Google Chrome Display Bug Exposed

Google browser Chrome - one of the newest widely used browser, has a funny display problem which is exposed, try this for yourself and have a look at it..

Step: 1 - Open Google Chrome Browser (well the latest version)

Step: 2 - Open Google mail ( ) and log into your account

Step: 3 - Open any of your contacts chat window just like chatting ( but we not gonna chat here).

Step: 4 - with your middle mouse button - click hold and drag down on the down left corner of the chat box. see the below picture..

Step 5: Now you see the Nasty Trick of browser scrolling out the window itself. the chrome browser scrolls outside its level.. this makes browser lost its screen display area.

now go to address bar and browse other sites and have a funny display out of it..

Digg two Posts

Store your Gmail mails in Computer without using any Email Client

Gmail Offline

Gmail Offline is a Feature where you can Store your Mails, Chats, Attachments, labels in your personal Computer without having to use any Email clients like outlook.

Gmail Offline Let you to Synchronize all your Gmail contents to your PC when your connected to internet and makes u to work with your mails while not connected.

Enabling Gmail Offline Feature

1. Log into your Gmail
2. go to Settings->Offline
3. click "Enable offline mail for this Computer" and click "Save changes" button
4. Follow the instructions and Accept to install Google Gears which is less than 1 MB.
5. After this Few minutes Process, u'r Google mail gets synchronized to your PC
6. and you can access all your gmail contets offline by clicking the "Gmail Offline" icon on your Desktop

Advantage of Gmail Offline

1. Very Simple Feature and easy to use
2. No Additional Software to be Installed like outlook express etc..
3. And More Importantly its the Google's Product you can be sure of security of your personal file's

Disadvantage of Gmail Offline
1. You cannot specify selected mails to get saved in your Pc, instead all your mails within specified years are get stored.

Google can do Calculators job toooo!!!

Using the Google calculator:

Google’s calculator tries to understand the problem you are attempting to solve without requiring you to use special syntax. However, it may be helpful to know the most direct way to pose a question to get the best results. Listed below are a few suggestions for the most common type of expressions (and a few more esoteric ones).

Most operators come between the two numbers they combine, such as the plus sign in the expression 1+1.

















exponentiation(raise to a power of)



modulo(finds the remainder after division)


X choose Y

determines the number of ways of choosing a set of Y elements from a set of X elements

18 choose 4

nth root of x

calculates the nth root of a x

5th root of 32

X % of Y

computes X percent of Y

20% of 150

Some operators work on only one number and should come before that number. In these cases, it often helps to put the number in parentheses.





square root


sin, cos, etc.

trigonometric functions (numbers are assumed to be radians)


tan(45 degrees)

ln logarithm base e ln(17)

log logarithm base 10 log(1,000)

A few operators come after the number.




Other good things to know

Parentheses can be used to enclose the parts of your expression that you want evaluated first. For example, (1+2)*3 causes the addition to happen before the multiplication.

The in operator is used to specify what units you want used to express the answer. Put the word in followed by the name of a unit at the end of your expression. This works well for unit conversions such as: 5 kilometers in miles.

You can use hexadecimal, octal and binary numbers. Prefix hexadecimal numbers with 0x, octal numbers with 0o and binary numbers with 0b. For example: 0x7f + 0b10010101.

The calculator understands many different units, as well as many physical and mathematical constants. These can be used in your expression. Many of these constants and units have both long and short names. You can use either name in most cases. For example, km and kilometer both work, as do c and the speed of light.

Feel free to experiment with the calculator as not all of its capabilities are listed here. To get you started, we’ve included a few expressions linked to their results.

1 a.u./c


1.21 GW / 88 mph

e^(i pi)+1

100 miles in kilometers

sine(30 degrees)

G*(6e24 kg)/(4000 miles)^2

0x7d3 in roman numerals


Convert Stubborn Webpage To .pdf

Convert Stubborn Webpage To .pdf

I have come across some websites that i wanted to save the page for later review. I found that i was having some problems with certain sites. I found a way around it.

what you need:adobe acrobat 6 pro or better

there may be a simpler way to do this but i found that this works:

when at a webpage that you want to copy (YOU MUST BE USING IE AND HAVE BOTH POPUPCOP INSTALLED AND ADOBE ACROBAT 6 PRO OR HIGHER, ACROBAT ICON MUST BE IN IE TOOLBAR TO CONVERT TO .PDF), slide popupcops popup intensity bar to the far left, now click on adobe acrobat icon to convert webpage to .pdf document. I have yet to find a webpage where this trick does not work.

Speed Up your Internet by 20%

Cool trick to Speed Up your Intenet by 20%

1. Click Start-->Run-->type "gpedit.msc" , This opens the group policy editor.

2. Then go to:
Local Computer Policy-->Computer Configuration-->Administrative Templates-->Network-->QOS Packet Scheduler-->Limit Reservable Bandwidth

3. Double click on Limit Reservable bandwidth. It will say it is not configured, but the truth is under the 'Explain' tab :
"By default, the Packet Scheduler limits the system to 20 percent of the bandwidth of a connection, but you can use this setting to override the default."

4. So the trick is to ENABLE reservable bandwidth, then set it to ZERO.

This will allow the system to reserve nothing, rather than the default 20%.