Category Archives: Experiments

Multiplayer Online Game


I was develop one multiplayer online game “pairs game” with a node.js server , the purpose of this development is to test node.js powerfull features and asyncronous programming techniques.

this project does not uses (that is the best option to develop whit node.js) becose the “logic” of the game is very simple and with ajax long poll technique is enough to acomplish the goal. The engine of the game works with memory variables( no mysql calls)  and is very fast!!, is a multi game/player server,

About the html of the page, is only one HTML file with his CSS and JS files, all the elements are stored in memory at first load page, after all is done directly with ajax calls (if you press F5 the game restarts)

The engine of the game incorporates one control that checks the origin of the url  for each ajax call, to prevent using the engine to another not autorized sites.

general shema:

The logic is very simple:

  • one user creates one game ( private or public)
  • another user joins to this game.
  • another user joins to this game
  • … (max 4)
  • only the user that creates the game can start de game.
  • the user that have the turn, have 15 seconds to move one chart, if the time expires, then the turn goes to the next user
  • Every movement is distributed to all the users of the game.
  • when one change is done at the game (  2 open cards, and pairs match or not match) , all users that are playing are notified, scoreboard are updated
  • the users that wins the game, is automatically added or updated (+) his general score ( visible at main site)

On the client’s side, a long poll call is done recursively, until game is finished.

If you want to test multiplayer features or view a demo, you can simulate 2 users open 2 browser sessions, or with your friends, enjoy it:

this video demostrates the multiplayer features:


If you want to send me a feedback or you like to add this game in your site (fully css customizable), and view only your active games and your global scorelist, I can authorize your domain,  contact me:


Read More ...

Asus WL-500gp-V2

Invention with  WL-500gP V2

Meteorology: Experiment Asus WL-500Gp V2


  • Creating a system for sending automated weather data without the need to have your computer running
  • It consists of a telephone DSL router (Comtrend) in bridge mode, an Asus router, which in turn makes firewalls, ftp server, and server for other wireless devices (mobile, portable, …)
  • there is a USA hosting with unlimited space and bandwidth : Bluehost


Firmware of the router:

After trying many frimwares: openwrt,ddwrt,… I have finally decided on Oleg’s firmware, more information about the project: , is best adapted to me the router, specifically: WL500gpv2- becose my router is V2 with 16 MB ram, for a novice like me, with linux, it was quite complicated, the main steps:

  • Download and install Optware to compile programs from the router itself, an alternative is to compile out by a cross-compile with a colinux for example, but is much more complex set you build modules to the router, also with 16 mb compiled ram pretty fast. if you seek on google: You will find several links on how to do
  • Mount a usb memory stick as / opt and start it at the beginning:

mount /opt at start up:

[admin@asus sbin]$ pwd


[admin@asus sbin]$ cat post-mount


mount -o bind /tmp/mnt/disca_1/opt /opt


/usr/sbin/wl radio off

  • Disable USB 2.0 support in the web console of the router (if enabled, does not work)
  • Install the following ipkg packages:

ipkg list_installed

buildroot – 4.1.1-13 – uClibc compilation toolchain
bzip2 – 1.0.6-1 – Very high-quality data compression program
ipkg-opt – 0.99.163-10 – The Itsy Package Manager
libdb – 4.2.52-3 – Berkeley DB Libraries
libusb – 0.1.12-2 – Library for interfacing to the USB subsystem.
make – 3.82-1 – examines files and runs commands necessary for compilation
ncurses – 5.7-1 – NCurses libraries
ncursesw – 5.7-1 – NCurses libraries with wide char support
openssl – 0.9.7m-5 – Openssl provides the ssl implementation in libraries libcrypto and libssl, and is needed by many other applications and librari
py-usb – 0.4.1-1 – PyUSB is a native Python module written in C that provides USB access for it.
python24 – 2.4.6-2 – Python is an interpreted, interactive, object- oriented programming language.
readline – 6.1-2 – The GNU Readline library provides a set of functions for use by applications that allow users to edit command lines as they are
uclibc-opt – 0.9.28-13 – micro C library for embedded Linux systems
zlib – 1.2.5-1 – zlib is a library implementing the ‘deflate’ compression system

  • Be sure to record the flash every time: flashfs save && flashfs commit && flashfs enable
  • Modify crontab: one task that makes every minute shipping and another that clears the log every 2 hours to the minute 1

[admin@asus etc]$ pwd
admin@asus etc]$ cat crontab
# ———- ———- Default is Empty ———- ———- #
*/1 * * * * admin /opt/jordi/jww/
1 */2 * * * admin /opt/jordi/jww/

  • Details of the scripts:
  • (script to send the data, explained later)

[admin@asus jww]$ cat
url=”wget -O /dev/null$u2″
echo $url

[admin@asus jww]$ cat
rm /tmp/syslog.log

  • (scipt that deletes the log file of submittals)
  • set the red button to enable-disable wifi ez-setup in the same directory as post-boot /usr/local/sbin:

if [ $(wl radio) = “0x0000” ]; then wl radio off; exit; fi
wl radio on


if (showraw==1)
printf(“&HI=%d&”, buf5.hindoor);
printf(“HO=%d&”, buf5.houtdoor);
remain = buf5.tindoor%10;
if ((signed) remain<0) remain = remain * -1;
printf(“TI=%d.%d&”, buf5.tindoor / 10 ,remain);
remain = buf5.toutdoor%10;
if ((signed) remain<0) remain = remain * -1;
printf(“TO=%d.%d&”, buf5.toutdoor / 10 ,remain);
remain = buf5.swind%10;
printf(“W=%d.%d&”, buf5.swind / 10 , remain);
remain = buf5.swind2%10;
printf(“G=%d.%d&”, buf5.swind2 / 10 , remain);
printf(“D=%s&”, buf5.winddirection);
printf(“R=%d&”, buf5.rain );
remain = buf5.pressure%10;
printf(“B=%d”, buf5.pressure / 10 , remain);

  • Como he comentado, basandome en el programa creado por Michael Pendec, añadi la siguiente opción al ejecutar el programa sin parámetros:
  • This causes the generation of a string of the form: &TO=15.7&TI=15.7&HO=66&HI=45&B=1024&D=NNW&W=20&R=56 that added to get the query string, as shown in the script allows us to send data every minute.
  • In the hosting, I have the page live.php which processes the request i add the record in the mysql database, I leave the code example to give you an idea:
<p style="padding-left: 60px;">
	.!--?php<br />
	$timezone = +0;<br />
	if (substr($_GET['C'], 0, 9)=='csdfr_')<br />
	{<br />
	$con = mysql_connect("localhost",$_GET['C'],"password");<br />
	if (!$con)<br />
	{<br />
	die('Could not connect: ' . mysql_error());<br />
	}<br />
	$loop=gmdate("Hi", time()+ 3600*($timezone+date("I")));<br />
	$hora=gmdate("H:i:s", time()+ 3600*($timezone+date("I")));<br />
	mysql_select_db($_GET['C'], $con);<br />
	// borro el registre anterior -<br />
	$q="DELETE FROM `live` WHERE `LOOP`='".$loop."'";<br />
	mysql_query($q);<br />
	$raina=$_GET['R'];<br />
	$pluja=0.0;<br />
	<br />
	// busco el valor anterior de pluja -<br />
	$result = mysql_query("SELECT `RAINC` FROM `live` ORDER BY `YMDHMS` DESC LIMIT 1"); while($row = mysql_fetch_array($result))<br />
	{<br />
	// - si ha plogut i vigilo el loop del contador<br />
	if ($_GET['R'] &gt;$row['RAINC'])<br />
	{<br />
	$pluja= ($_GET['R'] - $row['RAINC']) * 0.3;<br />
	}<br />
	else<br />
	{<br />
	$pluja=0.0;<br />
	}<br />
	}<br />
	// insercio principal<br />
	$q="INSERT INTO `live` (`TO`,`TI`,`HO`,`HI`,`BAR`,`WND`,`RAC`,`DIR`,`RAINC`,`DATE`,`TIME`,`YMDHMS`,`H10M`,`LOOP`,`RAIN`) VALUES (".<br />
	$_GET['TO'].",".$_GET['TI'].",".$_GET['HO'].",".$_GET['HI'].",".$_GET['B']. ",".$_GET['W'].",".$_GET['G'].",'".$_GET['D']."',".$_GET['R'].<br />
	",'".gmdate("Y-m-d", time()+ 3600*($timezone+date("I")))."','".$hora. "','".gmdate("YmdHi", time()+ 3600*($timezone+date("I"))) ."','".substr($loop,0,3) .<br />
	"','".$loop."',".$pluja.")" ;<br />
	mysql_query($q);<br />
	mysql_close($con);<br />
	// aqui cada 10 minuts , gravo els registres<br />
	if(substr($loop,2,1)=="0" )<br />
	{ $q="";<br />
	}<br />
	}<br />
	//else<br />
	//echo 'Error';<br />


  • The last step is to publish the data online, this is accomplished with a script “cron” which runs every 10 minutes i used to publish data on 5 sites :
  • Meteoclimatic: from a template generated a meteoclimatic.html file and the configuration of the station, put the url where I created the file
  • Awekas: I generate a file at the station awekas.txt i configure the url where you have to go to see
  • Weather Undergroud: By sending an HTTP GET request data
  • Personal Weather Stations: same as Weather underground.
  • My own page



Read More ...

Slide puzzle

Easily create your own “Slide Puzzle” with the image you want!

Tell your friend with the photo you want to spend some time solving it!

is super easy and fast !! totally free!!

upload your photo (picasa, facebook, imageshack, dropbox, etc…), share the link and copy-paste (edit copy) (right clic, copy image URL)

Just add this to the url below: /?p=(number of pieces)&img=(image URL)

in this link:


for example, this link, generates a 6-piece puzzle with the image of google


this other link generates a puzzle of 10 pieces with the same image

Link Generator:

Number of pieces:

Image URL:


Works on an I-Pad IPhone, Android,….!!!


More examples:


Read More ...

Slide Puzzle Plugin for Joomla 2.5

Hi guys!!

This is my first plugin for Joomla 2.5: sp_effects It’s really simple to use, only install it and enable, it uses tags to generate slide puzzle from any image that you want, as follows:


Where X are the number of pieces, the image url will be absolute or relative

I enable it on my joomla to test, For example:



Try it! if you like, post a comment!


at 18/07/2012 corrected some errors ( posts below solved at this date)

Link to download:




Read More ...


Subscribe to my Newsletter

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.