Setup logcheck on Ubuntu 10.10

Logcheck is a nifty tool that reads all system and application logs for you, and then send e-mails with reports of anomalies. It makes maintaining a server easier, and therefore increases security.

I couldn't find a guide for installing and setting up on Ubuntu, so I decided to share my notes.

logcheck

Trim unicode/UTF-8 whitespace in PHP

preg_replace('/^[\pZ\pC]+|[\pZ\pC]+$/u', '', $string);

This will effectively remove any weird whitespace characters, control characters and even those pesky Apple logos.

Have a look at the page below for more information on the Unicode characters and regular expressions.

nadeausoftware.com

"2006 - MySQL server has gone away" error when importing with SQLyog

Get this annoying error when importing a database with SQLyog? "There was an error executing the query. [...]". When you click "Open error file..." the real MySQL error is presented: "Error Code: 2006 - MySQL server has gone away".

PHP: Get filename extension with native PHP function

The extension part of the filename, is what typically tells us what type of file it is. A JPEG image may have the filename "image.jpg", where "jpg" is the extension.

Click through to learn how easy it is to extract this with PHP.

PhpED: Get back Tortoise SVN in the shell menu

After I reinstalled my system with Windows 7 64 bit, the very handy SVN Tortoise icons were all gone from the shell menu in Nusphere PhpED. This made SVN actions so much more time consuming.