Pages
Wednesday, April 16, 2014
How to Remote Control your Windows PC with Email or SMS
Tuesday, April 15, 2014
Nokia Twist 7705 Review
Whats hot: Head turning design. Cool Habitat mode. Whats not: Must twist open the phone to answer a call (unless youre using a headset). If you are looking for a phone that turns heads, the Nokia Twist 7705 will do just that. Shiny, unique and modern, the Nokia 7705 Twist makes the diminutive Motorola Karma and Verizon Blitz look like chunky monkeys. The Nokia has a swivel design and it feels natural to open the phone like fanning open a deck of cards. When the phone is closed, it looks like a makeup compact with a screen; but swivel open the QWERTY keyboard and the phone looks much more like a normal phone. A large LED-lit ring anchors the two panels and offers notifications in different colors. The Nokia 7705 Twist is a digital CDMA phone with EV-DO Rev. 0 for data, and it’s exclusively available from Verizon. In addition to a roomy QWERTY keyboard, the Nokia Twist has a built-in 3 megapixel autofocus camera with video capture, aGPS that works with VZ Navigator, V CAST Music and Video and Bluetooth with A2DP. The phone runs Verizon’s UI and comes with the Polaris web browser that’s on many of Verizon’s feature phones. Design and Ergonomics The Nokia Twist 7705 is a perfect square when closed, measuring 2.71 x 2.71 x 0.59 inches. The phone feels small when it’s closed, but when the keyboard swivels out it actually feels very wide. It’s wider than the iPhone 3GS which is just about the widest phone currently on the market. The 2.4” landscape display dominates the front of the phone, but the large LED ring that anchors the two swiveling panels vies for attention. The LED ring can flash in different colors (6 colors) for different contacts (you can select ring colors in Contacts), and the ring can send notifications (missed calls, messages, etc.) by “breathing” the LED color of your choice. A normal d-pad lives in the center below the display, and two shoulder keys and the “CLR” key are touch sensitive keys with haptic feedback. The d-pad feels good to use even for gaming, but the touch keys are easy to press by accident. There are options that allow you to set the sensitivity and vibration feedback for the touch keys. There is also a proximity sensor above the screen. The wide body affords the Nokia Twist a good size landscape display and a very roomy four-row keyboard with an additional launcher row above. The keyboard is extremely easy to use, and the keys have both a tactile click and audio feedback when pressed. The number keys are embedded in a block (phone dial pad arrangement), and those who favor large space bars on their mobile phones will appreciate Nokia’s keyboard. Dedicated launcher keys include messaging, music player, web browser, voice command (Nuance voice command onboard), speakerphone, camera/camcorder as well as call Send and End buttons. For mobile messaging addicts, the Nokia Twist offers one of the best keyboards in a mid-sized phone. The Nokia Twist 7705 has minimal side buttons. Side ports include the charging port, the microSD card slot, the 2.5mm stereo headset jack and the volume rocker. There is also a holder for phone charms, and the speakerphone fires to the right through the speakerphone grille. The Nokia Twist comes with two back covers, one in black and one in purple. The back cover is easy to take off, just release the small latch to unlock the cover. The 3-megapixel camera with flash lives on the back of the phone, and when the phone is open, the back of the display panel does double-duty as a mirror. |
Monday, April 14, 2014
Bubble sort algorithm with time complexity calculation
//Bubble sort algorithm implementation. Also calculate time complexity.
#include<stdio.h>
#include<conio.h>
void main()
{
int a[100],temp,i,j,n,count;
count=0;count++;
printf("Bubble Sort
Enter total no. of values: ");
{
scanf("%d",&n);
count++;
}
printf("Enter the values:-
");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
count++;
}
for(i=0;i<n;i++)
{
for(j=i;j<n;j++)
{
if(a[j]<a[i])
{
temp=a[j];count++;
a[j]=a[i];count++;
a[i]=temp;count++;
}
count++;
}
count++;
}
printf("Bubble-Sort result:-
");
for(i=0;i<n;i++)
{
printf("%d ",a[i]);
count++;
}
printf("
Time Complexity is: %d",count);
getch();
}
//program written by Mars.
Sunday, April 13, 2014
Telecommuting With Voip Phone Systems For Business Austin
Buy into features which is appropriate to your enterprise conditions and budget. The bottom-line will be to generate more revenues soon to have the enterprise still living and kicking for several years. Examining the system to obtain trial time periods and demos before you pay for it. You need to have the system as a way to determine its appropriateness to the enterprise demands, simple to use, quality of calls, and also the benefits such as voice mail.
There are many benefits to the company which allows employees to work from home using these modern communication gadgets. In addition to happy employees, there is also the ability save on office expenses. Happy employees also equate to better productivity.
Additionally, telecommuting means it is possible for businesses to hire employees from anywhere in the world. With all of the different benefits being offered, it is no surprise more businesses have started to turn to VoIP communication gadgets to help with better telecommuting options. When you allow your employees to work from home using VoIP communication gadgets, it is likely that they will appreciate the switch.
When automatic attendants and call forwarding are wonderful characteristics for a virtual PBX procedure, most providers do not get all of their incoming communication from mobile telephone devices alone. The company still employs a fax machine in some ability. The integrated virtual fax attribute of a virtual PBX technique would make it significantly less complicated to deliver and acquire faxes, as it utilizes the current Online connection of a corporation to give a total vary of specialist fax features.
Incoming faxes can be directed to employees email addresses in the form of frequent workplace paper forms. Once again, this recommends more versatility and superior association, the two important things for a small enterprise. Outgoing faxes can be checked and standardized with combined digital fax.
Also, request a quote for each and every plan for you to definitely examine and evaluate. You should picking the service provider. The most significant step after you have decided to upgrade your enterprise telephone system.
By not having to have all of your employees in the same office, you can cast a wider net when searching for those you will hire. The VoIP phone systems for business Austin residents would make it possible to hire anyone in the world and make it seem as if they are working right in the office along with you. The PBX can be set up in such a manner that even if customers or clients are calling a number in one country, the extension can actually lead them to another country without an additional expense to the client or to the business. You can hire the professionals you actually want rather than those who are available.
About the Author:
Factors To Consider When Choosing The Finest PC Service Atlanta
There are many companies that offer computer support. On the other hand, not all of them will give you a warranty once they are done with their repairs. To be on the safe side before recruiting a support company, you to check if the company will offer you any guarantee when they work on your computer. If not, then opt for another that can offer you one.
For instance, one must consider a few things before even thinking of getting to an expert. One should try to find out where the problem originated. For example, a computer not starting would be because the power cable is not plugged. Alternatively, the computer display may hang due to low disk space. It is important to at least run basic diagnostics before thinking of an expert.
If the diagnosis does not yield any fruits, then expert intervention is required. This begs the question of who to trust with the computer. To begin with, experts are all over town, but the qualified ones are not just found on a website. This is because almost everybody uses the internet to advertise their products and it is very easy to land on fraudsters if not careful.
First thing should be contacting the manufacturer of the particular electronic in question. If their assistance is not satisfactory, then you should consider involving professionals. They could be companies or individual experts. You can find them from their websites online or advertisements.
The cost of repairing the computer is also another major factor. Some companies charge quite a lot of money even for small repairs. With proper research, you will definitely find other companies that offer relatively the same services, but on a much lower cost. However, you should not base your judgment entirely on costs. At times low costs translate to poor services.
Once the cross checking is over, go on and select the company that most fulfills your needs. Go through their terms of service and requirements so as to be sure of what you are getting into. Once you are done with the procedures, you can offer them your machine and wait patiently as they resolve the problem. Most companies will call you to pick it once they are done.
Computers have become a part of the day-to-day lives of many people. Therefore, when you find yourself in stuck and in need of pc service Atlanta is the right place to get an expert. Many people are out there to make the extra cash from unsuspecting clients that are desperate for assistance. It is better to spend a little more time researching for better quality experts.
About the Author:
Saturday, April 12, 2014
Using Virtual Base Classes to Avoid Ambiguity
Let’s start this with the following example program:
// this program contains errors
#include<iostream.h>
// base class
class base
{
public:
int a;
};
// derived class (1)
class derived1:public base
{
public:
int b;
};
// derived class (2)
class derived2:public base
{
public:
int c;
};
// derived class (3)
class derived3:public derived1, public derived2
{
public:
int d;
};
// main
void main()
{
derived3 ob;
// this is ambiguous
// since two copies of
// base is present in
// the class derived3
// one from derived1 &
// the other from derived2
ob.a=10;
}
The program above contains an error (as stated) in the following line:
ob.a=10;
Since the base class is inherited by the two classes (derived1 and derived2),
which are again inherited (both together) by another class derived3, there are
two copies of the base class (and hence two copies of variable ‘a’
too).
Therefore when we refer to the variable ‘a’ with respect to the
derived3 class then as there are two copies of it, it becomes ambiguous or confusing
for the compiler to select one from the two and hence it is reported as an ERROR.
This is very common error which creeps in when you write long and complex program
consisting of classes some of which are hierarchically inherited.
So how can we prevent this from happening?
Actually, we can prevent this by using the scope resolution operator but this
is not a permanent solution besides having other flaws. Then what else can we
do?
Yeah, you guessed it right; Virtual Base Class is he answer.
Now, have a look at the same program with slight modification (as to apply
the virtual base class method), now it’s perfectly all right!
// Virtual base classes
#include<iostream.h>
// base class
class base
{
public:
int a;
};
// derived class (1)
// notice the use of virtual keyword
class derived1:virtual public base
{
public:
int b;
};
// derived class (2)
// notice the use of virtual keyword
class derived2:virtual public base
{
public:
int c;
};
// derived class (3)
class derived3:public derived1, public derived2
{
public:
int d;
};
// main
void main()
{
derived3 ob;
// now its O. K.
ob.a=10;
}
As you can see, we’re using virtual keyword to derive the classes (derived1
and derived2) from the base class.
This prevents other inheriting classes (which inherits more than one such derived
classes) to have only one copy of the base class and hence ruling out chances
of ambiguity.
Please note that the derived classes (derived1 and derived2 individually) still
contains one-one copy of base class, it is only when they are inherited is the
virtual nature comes into action.
We conclude this article with the following example program to illustrate all
that we have discussed so far in this article.
// Virtual base classes
#include<iostream.h>
// base class
class base
{
public:
int a;
};
// derived class (1)
// notice the use of virtual keyword
class derived1:virtual public base
{
public:
int b;
};
// derived class (2)
// notice the use of virtual keyword
class derived2:virtual public base
{
public:
int c;
};
// derived class (3)
class derived3:public derived1, public derived2
{
public:
int d;
};
// main
void main()
{
derived1 ob1;
derived2 ob2;
derived3 ob3;
// derived classes still
// contain one-one copy
// of the base class
ob1.a=10;
ob2.a=20;
// but the class derived
// form the classes of
// the above two objects
// contains only one copy
// of the base class
ob3.a=100;
}
Related Articles:
Friday, April 11, 2014
C program to find Fibonacci Series with understanding logic
The Fibonacci numbers or Fibonacci series or Fibonacci sequence has first two numbers equal to 1 and 0 and the further each number is consist of the addition of previous two numbers1st number = 0
2nd number = 1
3rd number = 0+1= 1
4th number = 1+1= 2
5th number = 1+2= 3
And so on.
The Fibonacci Sequence can be written as 0,1,1,2,3,5,8,13........
C++ program to find Fibonacci Series upto given range.This C++ program use simple logic to get the about of writing code in C++ for Fibonacci Series
- #include<iostream>
- using namespace std;
- int main()
- {
- int range, first = 0, second = 1, fibonicci=0;
- cout << "Enter Range for Terms of Fibonacci Sequence: ";
- cin >> range;
- cout << "Fibonicci Series upto " << range << " Terms "<< endl;
- for ( int c = 0 ; c < range ; c++ )
- {
- if ( c <= 1 )
- fibonicci = c;
- else
- {
- fibonicci = first + second;
- first = second;
- second = fibonicci;
- }
- cout << fibonicci <<" ";
- }
- return 0;
- }
Fibonacci Series program logic explanation
- Before writing C++ code we understand that what is Fibonacci Series and in what sequence numbers are occurs
- After understanding mathematically Fibonacci series completely we thought it in the form of C++ code
- The Fibonacci series is infinite but we cant make a program that display an infinite output
- In above program we take input the range in integer upto which Fibonacci series will be displayed
- For this purpose a for loop has been taken which starts from 0 and terminates less than range for example if Input is 5 then for loop will run from 0 to 4.
- In for loop if variable c is less or equal than 1 in this case if statement will be executed and if c is greater than 1 else part will be executed for greater than 1
if part will run. let input is equal to 5
Before loop variables values
After input range=5
Values are changing in the following sequence
c first second Fibonacci Output
0 0 1 0 0
1 0 1 1 0 1
2 0 1 0+1=1 0 1 1
1 1 1
3 1 1 1+1=2 0 1 1 2
1 2 2
4 1 2 1+2=3 0 1 1 2 3 its final output
2 3 3
Image View Of Program (Click on Image To Enlarge)
Fibonacci series in C++ image Code
Fibonacci series C++ Code |
Support for CSS class tags
One new addition to Run BASIC is the ability to add a CSS class tag to an object on a web page, so that it can be manipulated.
For example the following would create a link and set a class to "button".
link #doMyBidding, "GO", [go]
#doMyBidding cssclass("button")
And the following statement would add the CSS needed to style the link (or any object that has the class tag "button"):
cssclass ".button", "{ put some css styling in here }"
Here is a link to a video demonstrating how this all works.
http://www.youtube.com/watch?v=1qomg67VdF0
Thursday, April 10, 2014
How Can A Free Reverse Cell Phone Number Look Up Benefit You
Its likely you have been a victim for these a theft. Similar with other women, you could have kept all your personal belongings like cellphone and purse within it. So, now, there is the hassle of being forced to find all of the contact names and corresponding numbers, until you took the precaution of creating a backup copy on your hard drive. Many people dont take into consideration making a backup copy of their cell contact list. Perhaps, simply because they dont have knowledge of how without headaches it is to do this.
In terms of a police report, no end with creating a report. You will find the time for it to be spent for following high on the problem. Regardless of whether you can see the persons number you arent. Setting up a police report isnt be considered a good step unless you do not mind enduring all the hassle of doing so. The better option will be to wait for the person to you together with ask because of their name at the very least.
The true secret is to discover paid site, that is reputable with higher reviews. People change their cell numbers on occasion. The cell phone companies tend not to delete the existing numbers from other system. Instead they recycle the previous numbers. Quite simply, someone else using a different name may be while using cell phone number you want to test, unless the site that offers the paid cell lookup service updated its search system. So, look for a site that offers a regularly updated search system to achieve accurate specifics of the cell number you are keen on checking.
By using a site with a huge database is often a victorious one so you can get accurate details about a particular cell phone number. How do you determine if they have a large database? One smart way is to see its site and check out the offered services. If the site offers other services like neighborhood check and criminal record check or a paid cell lookup service, you can find high chances how the database for cell lookup is big. It also ensures that the database available from this type of site could possibly be reliable.
Indeed, utilizing a track cell number download service is very tempting. However there are certain risks if you do this. You have the potential for malware infecting your laptop or computer. As there are the issue of whether or not the provided details are reliable you arent. This is applicable to both paid and download cell lookup service.
About the Author:
Wednesday, April 9, 2014
Buying Car Laptop Desks At Pro Desks American Stores
The benefits laptops can bring to people in this high-tech modern world are indisputable. The usefulness and mobility have made laptops develop into a must-have piece for a number of people, particularly for businessmen. Nevertheless, unsuitable posture while using laptops may result in health issues for laptop users. People can experience back pain, eye strain and also neck pull if they work on the laptops for long hours.
Pro Desks provides perfect mobile computing solutions. The company is located in North America but they ship their products around the world. These laptop mounts can easily fit with all GMC as well as the Chevrolet cars. If you do a quick research, you can find some of their most powerful car computer stand models such as the Enforcer II, the Navigator, the Enforcer. No other products made by competitors can be compared to the Enforcer II in terms of having advanced features and durability. It is the advanced features that make the Enforcer II gain such good rating on the market. This typical car laptop holder fit laptop of all sizes, including the ones with widescreens. Additionally, it can also accommodate laptops that were ruggedized without any problems. Take note that this laptop desk is basically an interchangeable base plate, thus you can move it to a different vehicle if needed. This car laptop holder is a wise investment since you will not to change the mount when you change your car models. Just remove and re-install the mounting system using the tools provided, use suitable base and you are done.
Now we take a closer look at the features of the Pro Desks Mongoose. Pro Desks Mongoose car laptop desks easily stand out from other products made by competitors in terms of quality and durability. You can find no other car laptop desks which have more advanced features than the Mongoose. One of the most impressive features is the 360 degree rotating pedestal arm holding the slide. It fits well with laptop of any sizes, including the 17 widescreen ones. One more innovative feature of the Mongoose is the custom base plate. Mongoose is a no-drilling car laptop desk, which means no modifications will be done to your car while the Mongoose is being installed. Mongoose is also referred to as a "seat rail desk".
The Pro Desk Navigator is considered as a very durable laptop desk for cars. This laptop desk is specifically designed in order to provide years of service since it can also be removed from one vehicle and transferred to another. You just need to remove the base and then install it to the new car. This is a no-drilling product so no car modifications are required. You can have a passenger as usual without worrying that the desk system will affect the movement of him. Your passenger can comfortably work on the laptop. He just needs to adjust the position a little bit.
The Pro Desks Navigator is best suited for people who work in fields which require on-site work such as supply sales professionals, utility companies and services. Almost all on-the-go professionals will benefit from this laptop mount. With the advanced locking system, this car laptop holder has the best theft protection feature on the market.
About the Author:
How Top Rated St Petersburg Marinas Provide Winterization Solutions For Boat Owners
A boat can incur quite a bit of damage, especially if you leave it out during the winter season. With lesser use of it during this time, having your vessel dry stored is a good idea. You will be able to avoid getting it damaged by both sea water and the harsh weather.
A vessel such as this has several complex systems that could be adversely affected by weather. Having your yacht dry stored will avoid this during the times that it will not be getting much use. Thus, it is best to look into winterization methods that these marina companies provide.
Using specialized storage racks, you can have your yacht stored above the ground to minimize damage. It will be lifted out of the water using special lift trucks that can do this task safely. These trucks will take the boat out of the water and position it on the racks. You can opt for either indoor or outdoor storage.
This is also a perfect time for you to have maintenance services done on your yacht. These professionals will be able to look into all the boats parts and equipment and conduct any repairs if needed. By doing so, your boat is brought back to its top condition.
There is no need to risk having your sailing vessel damaged during winter. St. Petersburg marinas offer winterization services that will keep your boat protected. They will also bring your boat back to its prime condition with maintenance servicing while in storage. Having your boat stored will cost much less than having to repair damage caused by being exposed during the winter.
About the Author:
Tuesday, April 8, 2014
Read and print string
#include<conio.h>
int main()
{
char str[30];
printf("Enter your name : ");
gets(str);
puts(str);
getch();
return 0;
}
Screen shot for read and print string via gets() and puts() |
#include<conio.h>
int main()
{
char str[30];
printf("Enter your name : ");
scanf("%s", &str);
printf("Your name is %s",str);
getch();
return 0;
}
Screen shot for read and print string via scanf() and printf() |
A Simple Pong Game using JavaScript
Having the knowledge of moving images using JavaScript, we’ll be creating a small Ping Pong game as an example for this post.
Today we’ll learn to do a few new things in JavaScript:
1. Executing some code every specified time interval (for game loop).
2. Tracking and using mouse movements.
3. Attaching code (function) to events.
Game Theory
As you should be knowing, in this game there is one ball and two paddles at two ends. One is user-controlled the other, for this example, is CPU controlled. User has to move the paddle in order not to let the ball pass through, CPU also has to do the same thing. Whoever’s side the ball passes through looses the game.
There are a few objects which can interact with each other, these are ball, paddles, walls. Let’s see the various interactions that can take place between these:
Ball Hitting Upper/Lower Wall – Ball will bounce off.
Ball Passing Through Either Side – Player or CPU, depending on whose side ball passed through, will loose the game.
Ball Hitting Paddle – It’ll bounce off
We’ll need to take care of these events:
Page Load – Game objects will be initialized
Game Start – Mouse click on the player paddle will start the game.
Mouse Movements – Inside the game area (a div), the paddle will follow the y-position of the mouse. Paddle however should not get past the boundaries.
CPU Paddle – The paddle will follow the ball by moving up/down depending the relative position of the ball. We’ve added a little intelligence by only moving the paddle while ball is coming towards it. This will make the movement as well as the game look more real.
Code
NOTE: Put two files ball_small.png, paddle.png (Right-Click "Save As") in the same directory the script is in.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Pong Game In JavaScript</title>
<style>
#box
{
width: 500px;
height: 300px;
margin: auto;
border: 5px solid #ccc;
position: relative;
overflow: hidden;
}
.ob
{
position: absolute;
border: 0px;
}
</style>
<script type="application/javascript">
// CHANGE THESE, IF REQUIRED
var Speed = 5; // Speed of ball (pixels/step)
var CPUSpeed = 5; // Speed of CPU Paddle (pixels/step)
// Short references to objects
var paddle1;
var paddle2;
var ball;
var box;
var msg;
// For internal use
var dx, dy; // Speed in x and y directions
var ballX, ballY; // x and y positions of ball
var playerY; // y position of player paddle (x fixed)
var cpuY; // y position of CPU paddle (x fixed)
var iID; // To store ID of set interval used to clear it when required
// Attach a function to onLoad event
window.onload = Init;
// INITIALIZE GAME OBJECTS
function Init()
{
// Make short refrences to objects
paddle1 = document.getElementById(paddle1);
paddle2 = document.getElementById(paddle2);
ball = document.getElementById(ball);
box = document.getElementById(box);
msg = document.getElementById(msg);
// Initial values
ballX = (box.offsetWidth / 2) - (ball.offsetWidth / 2);
ballY = (box.offsetHeight / 2) - (ball.offsetHeight / 2);
cpuY = (box.offsetHeight / 2) - (paddle2.offsetHeight / 2);
playerY = (box.offsetHeight / 2) - (paddle1.offsetHeight / 2);
dx = dy = Speed;
paddle1.style.left = 20 + px;
paddle1.style.top = playerY + px;
paddle2.style.left = box.offsetWidth - (20 + paddle2.offsetWidth) + px;
paddle2.style.top = cpuY + px;
ball.style.left = ballX + px;
ball.style.top = ballY + px;
// Show message
msg.innerHTML = <h2>Click on Paddle to Start Game.</h2>;
}
// START GAME
function Start()
{
// Attach a function to onmousemove event of the box
box.onmousemove = MovePaddle;
// Call GameLoop() function every 10 milliseconds
iID = setInterval(GameLoop(), 10);
msg.innerHTML = ;
}
// MAIN GAME LOOP, CALLED REPEATEDLY
function GameLoop()
{
// MOVE BALL
ballX += dx;
ballY += dy;
// See if ball is past player paddle
if(ballX < 0)
{
clearInterval(iID);
Init();
box.onmousemove = ;
msg.innerHTML = <h2>You Loose!<br/>Click on Paddle to Re-Start Game.</h2>;
}
// See if ball is past CPU paddle
if((ballX + ball.offsetWidth) > box.offsetWidth)
{
clearInterval(iID);
Init();
box.onmousemove = ;
msg.innerHTML = <h2>You Win!<br/>Click on Paddle to Re-Start Game.</h2>;
}
// COLLISION DETECTION
// If ball hits upper or lower wall
if(ballY < 0 || ((ballY + ball.offsetHeight) > box.offsetHeight))
dy = -dy; // Make x direction opposite
// If ball hits player paddle
if(ballX < (paddle1.offsetLeft + paddle1.offsetWidth))
if(((ballY + ball.offsetHeight) > playerY) && ballY < (playerY + paddle1.offsetHeight))
dx = -dx;
// If ball hits CPU paddle
if((ballX + ball.offsetWidth) > paddle2.offsetLeft)
if(((ballY + ball.offsetHeight) > cpuY) && ballY < (cpuY + paddle2.offsetHeight))
dx = -dx;
// Place ball at calculated positions
ball.style.left = ballX + px;
ball.style.top = ballY + px;
// MOVE CPU PADDLE
// Move paddle only if ball is coming towards the CPU paddle
if(dx > 0)
{
if((cpuY + (paddle2.offsetHeight / 2)) > (ballY + ball.offsetHeight)) cpuY -= CPUSpeed;
else cpuY += CPUSpeed;
paddle2.style.top = cpuY + px;
}
}
// TO MOVE PLAYER PADDLE ON MOUSE MOVE EVENT
function MovePaddle(e)
{
// Fetch y coordinate of mouse
var y = (e.clientY - (box.offsetTop - document.documentElement.scrollTop));
// Here, (box.offsetTop - document.documentElement.scrollTop) will get the relative
// position of "box" w.r.t to current scroll postion
// If y below lower boundary (cannot go above upper boundary -
// mousemove event only generated when mouse is inside box
if(y > (box.offsetHeight - paddle1.offsetHeight))
y = (box.offsetHeight - paddle1.offsetHeight);
// Copy position
playerY = y;
// Set position
paddle1.style.top = y + px;
}
</script>
</head>
<body bgcolor="#fff">
<h1 align="center">Pong Game Example in JavaScript</h1>
<div id="box">
<img class="ob" id="paddle1" src="paddle.PNG" onclick="javascript: Start()"/>
<img class="ob" id="paddle2" src="paddle.PNG" />
<img class="ob" id="ball" src="ball_small.PNG" />
</div>
<div id="msg" align="center"></div>
</body>
</html>
Related Posts:
Sunday, April 6, 2014
C PUZZLE
“, ch, ch);
%u %u ",j,k);