Archive for September, 2008

Simple SSH tunneling: access your VNC from anywhere in the world

Tuesday, September 16th, 2008

My dev machine, bsdev, is behind a firewall with only port 22 open for SSH.

Want to access the VNC server running on it on port 5901 from your Windows machine?


1/ Open putty, go to connection/ssh/tunnels

2/ Input your settings

In Source Port: 5901 (or any other port, it’s gonna be the local port on the client machine, just make sure it’s available)
In Destination: (this 5901 is important, it’s where the actual VNC server is running)
Then click “Add”, select the newly created entry, then click “Open”.

3/ Your user/pass on bsdev is asked, enter it and you get a shell

4/ Point your browser to localhost:5901

It prints just “RFB 003.008″ on the page, probably the VNC version or identifier.
Now start your VNC a point it to localhost:1 (1 maps to 5901)

The VNC should start as if connecting directly to bsdev.


Mafia Wars MySpace by Zynga reached 1M DAUs today

Thursday, September 4th, 2008

With this milestone reached, the old F5 load balancer is reaching 80% utilization.

Time to replace it with a new F5 6400.

Increasing PHP limits

Tuesday, September 2nd, 2008

When doing statistical computations on a DB, you can easily reach the default memory and execution time limits of PHP.

You could change those settings directly in your php.ini file, but it would make the changes server-wide, meaning that even those scripts that should never eat that much memory can potentially hog the system if they start running wild.
It’s better to enable it on a file basis, if not on a compute-heavy function basis using ini_set.

For instance if your script reaches the default 16M of memory usage, this message will appear:

PHP error: Fatal error: Allowed memory size of 16777216 bytes exhausted

To change the default value:

ini_set('memory_limit', '20M');

When reaching the maximum execution time of a script you’ll get this message:

Maximum execution time of 30 seconds exceeded

To change the default value:

ini_set('max_execution_time', 90);

When dealing with extremely long processes, like for instance sending millions of notifications to your app users on Facebook, you might even want to use as much memory and time as possible:

ini_set('max_execution_time', 90000);
ini_set('display_errors', 1);