Archive for April, 2011

25th April
written by simplelight
22nd April
written by simplelight

Probably one of the first topics covered when you get started learning about jQuery events is the concept of canceling the browser’s default behavior. For instance, a beginner click tutorial may include this:

$(“a.toggle”).click(function () {
return false; // Prevent browser from visiting `#`
This function toggles the hiding and displaying of #mydiv, then cancels the browser’s default behavior of visiting the href of the anchor tag.

It is in these very first examples that bad habits are formed as users continue to use return false; whenever they want to cancel the default browser action.


13th April
written by simplelight

If you’re getting 502 Bad Gateways from your WordPress site when using Nginx then the following cron job might help:

Add a .sh script with this content and set it to trigger every ten minutes:

PHPCOUNT=`ps aux | grep ‘.php.sock’ | grep ‘php5.cgi’ | wc -l`
while [ “$PHPCOUNT” -eq 0 ]
/etc/init.d/nginx startphp
PHPCOUNT=`ps aux | grep ‘.php.sock’ | grep ‘php5.cgi’ | wc -l`

That should check the number of processes, and if it’s not correct restart them.

The script is /root/

The cronjob is installed under root, and this is the content:

ps19952:/var/spool/cron/crontabs# crontab -l
*/10     *       *       *       *       /bin/sh /root/nginx_php.shps19952:/var/spool/cron/crontabs#