Javascript table grid sort
Mar 31st, 2008 by admin

fastcgi load balancing with lighttpd
Jul 27th, 2007 by admin

Lighttpd, fast-cgi & PHP can do quite a wonderful setup that can handle significant load. You can have many layers of load balancing & fail-over. Here is a three-layer approach. A dedicated load balancer directs many web servers. Each web server (lighttpd) delegates the processing of dynamic to multiple application servers (fast-cgi).


Check out the lighttpd config for mod_fastcgi. In this case, we want only load-balance a single controller PHP file that is called heavily. We also let the webserver be the appserver itself for the moment and become a dedicated one if it becomes overloaded. All other regular PHP requests are served by the localhost (webserver). Add this into your lighttpd.conf:

To start the fast-cgi processes on the application servers:

RPM for eAccelerator 0.9.5
Apr 20th, 2007 by admin

This is the RPM for eAccelerator 0.9.5 for PHP 5.1.6 including source RPM, you can rebuild it by running “rpmbuild –rebuild file.rpm”



PHP – Customize str_rot13 function
Feb 12th, 2007 by admin

If you find str_rot13 is limited, this is a more customized string rotation function. It allows you to specify how many characters to shift (positive for moving forward, negative for moving backward) and which characters to shift.

MySQL – Shell script to optimize all tables
Jan 29th, 2007 by admin

Usage: –optimize MyDatabaseABC

Parsing Verisign .COM/.NET zone files
Apr 9th, 2006 by admin

If you have access to the zone files from Verisign (COM/NET/EDU) and want to extract the list of domains from these zone file. This is a one-line extraction command in Linux:

The command:

grep '^[a-zA-Z0-9-]\+ NS .*'|sed 's/NS .*//'|uniq

The output will be something like this:

Timing test (DB as of April 09, 2006, tested on Dual Opteron 244, 4G RAM)

DOT EDU (, 7,645 domains)
real    0m0.143s
user    0m0.240s
sys     0m0.010s

DOT NET (, 7,338,096 domains)
real    3m33.223s
user    4m29.380s
sys     0m3.130s

DOT COM (, 50,495,462 domains)
real    24m47.369s
user    32m51.330s
sys     0m25.420s

If divide the one-liner command into 3 separate ones, performance decreases

# time grep '^[a-zA-Z0-9]\+ NS .*' > net.grep
real    2m27.388s
user    2m21.480s
sys     0m2.400s

# time sed 's/NS .*//' net.grep > net.sed
real    1m46.816s
user    1m0.270s
sys     0m1.380s

# time uniq net.sed > net.uniq
real    1m13.276s
user    1m4.180s
sys     0m0.570s
Alexa Traffic Rank PHP5 Class
Mar 31st, 2006 by admin

This PHP5 class utilizes the web service provided by Alexa/Amazon to get the traffic information about the site. You’ll need to sign up for an account at Alexa to get the pair (access key and secret key). The first 10,000 queries per month are free.

Sample Usage:

Google PageRank PHP5 Class
Mar 31st, 2006 by admin

This PHP5 class computes the Google PR for any URL. Source code is available online and this is the PHP5 version, can be plugged into any application/software.

Welcome to
Mar 27th, 2006 by admin is an extension of AdSpeed, our popular commercial ad serving solution. We plan to use this site to share our technical and business knowledge about the online advertising industry. We benefit from open-source software every day and we would like to give something back. All the source code contributed on this site are free to the public. It’s a way to say Thank You to the developers. We also host a variety of open-source mirrors.

»  Substance:WordPress   »  Style:Ahren Ahimsa