PHP Dump/Debug script.

Ever use PHP’s var_dump() or print_r() to debug what is going wrong with that $data you have ?

Well, this simple script acts as the above functions, yours first parameter is your data, and the second optional parameter is stoping the script or continuing on.

The ‘debug_backtrace()’ function will return which file call’s the dump function so you can easily track where your errors are coming from.

	function dump($data = array(), $finish = TRUE) {

		list($referrer) = debug_backtrace();
		$total = count($data);
		echo '
'; echo ''.$referrer['file'].' @ line: '.$referrer['line'].''; echo '
		$l = 0;
		if($data) {
			foreach($data as $line => $value) {
		        echo '
Debug #'.(++$l).' of '.$total.', Line: #'. $line .':
'; print_r($value); } } echo "

echo "

if($finish == TRUE) die;


Auto Close Print Queue in OSX Leopard

When printing in Leopard, the print queue application remains open after the print job is done. In Tiger and all previous versions of OS X, the application would quit automatically as soon as the print job was finished. I find it very irritating to have to go and quit the application after every print job.

To stop this, after a print job, or if/when you have a printer open in the dock, right click it in the dock and choose auto quit. I did this with one printer and it changed the settings on all of mine.