Get the source code today
If you're interested in playing around with this websocket server, you can download the source code for it at my official website.
About the author
php file.php
(assuming that you're in a directory that has a file named file.php, of course);extension=php_sockets.dll
extension=php_sockets.dll
php --ini
This will list the information (file paths) about the configuration of your PHP that you need to edit. The second line of the output you get from this step shows where the true php.ini file is located. Go to that path and uncomment the line that points to the sockets.dll file as described in the previous step.C:\Users\Rodrixar>php --ini
Configuration File (php.ini) Path: C:\Windoows
Loaded Configuration File: C:\wamp\bin\php\php5.3.4\php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
var spriteFrames = [
{x: 0, y: 0, w: 32, h: 30},
{x: 33, y: 3, w: 42, h: 27},
{x: 78, y: 5, w: 30, h: 33}
];// a lot of people do this: currentFrame++; if( currentFrame > totalFrames - 1) currentFrame = 0; /*** WHAT A WASTE OF BYTES! ***/ // this is how you should increment your current frame index: currentFrame = (currentFrame + 1) % totalFrames; /********************************** * WHAT? but why do that? well... follow the math. If you're not familiar the % (MOD) operator, it simply performs division, then returns the remainder, which is never greater than the number being divided by, which means you always stay within the array bounds. var totalFrames = 3; var currentFrame = 0; currentFrame = (currentFrame + 1) % totalFrames; -> currentFrame = (0 + 1) % 3 = 1 % 3 = 1 currentFrame = (currentFrame + 1) % totalFrames; -> currentFrame = (1 + 1) % 3 = 2 % 3 = 2 currentFrame = (currentFrame + 1) % totalFrames; -> currentFrame = (2 + 1) % 3 = 3 % 3 = 0 currentFrame = (currentFrame + 1) % totalFrames; -> currentFrame = (0 + 1) % 3 = 1 % 3 = 1 * ***********************************/
// function drawCharacter() { canvasContext.drawCharacter( frame, x, y ); }
// our main Player object has an attribute frameUpdated,
// which is the time it was last updated (in milliseconds)
function updateAnimationFrame()
{
if( Date.now() - Player.frameUpdated > 70 )
{
Player.currentFrame = (Player.currentFrame + 1) % Player.totalFrames;
// update time frame was animated
Player.frameUpdated = Date.now();
} Dummy text. Move the slider below to change the width of this text and see how this works.
<style>
.elip {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
width: 100%;
}
</style>
<p class="elip">Some text to be wrapped by the CSS3 ellipsis attribute<p>#!python
print "Content-type: text/html"
print ""
print "Hello, World"
C:\wamp\bin\apache\Apache2.2.17\cgi-bin
http://localhost/cgi-bin/hello.py
How to install Python on Windows
python
C:\Python
Copyright 2007-2010 Rodrigo Silveira. All rights reserved.
