Zeitmanagment nach *nix-Art

06:01PM Mai 08, 2009 in category dev/fun by Alexander Pirsig

Für alle die den Absprung bei der Arbeit nie rechtzeitig hinbekommen.
# root werden
sudo bash
# Mo-Fr 18:01 == Feierabend ;)
crontab -l > /tmp/cron.tmp && echo "1 18 * * 1-5 shutdown now -h" >> /tmp/cron.tmp && crontab /tmp/cron.tmp
Nur für rechtzeitiges erscheinen zur Arbeit muss man noch manuell sorgen :D

Kommentare[0] Tags: ubuntu zeitmanagment debian zeit cronjob contab unix shutdown bash linux console

Quick Guide to use FirePHP + FireBug Console

09:30PM Apr 16, 2009 in category PHP by Alexander Pirsig

This is a quick guide to use FirePHP + Firebug to write debug output to firebug console. FirePHP is a Log-Appender for firebug console. With this piece of code you write php debug output directly to firebug console.

The requirements

So let's get started for beginning you need four things: After you've installed firephp and firebug in firefox, you have a "small bug icon" in the lower right corner that looks like this.

Netconsole settings

Next we're go to the test site and activate firephp. So type in http://labs.pirsig.net/firephp/firetest.php click on the Firebug icon. Next click on the Net-Tab and activate the "console" and "net" checkbox.

Net-Console Output

Next Click on "Console" and reload the site you should see some debug output in firebug console.

Testside PHP-Code

Enclosed is the php code for the testside
// Include FirePHP OOP Class
require_once("FirePHP.class.php");

// Define a Global DEBUG flag
// This should probly go to a central place
DEFINE(DEBUG,true);

// Get a instance the true automaticly create's
// an instance and makes sure there is only one
// registered (singleton)
$fb = FirePHP::getInstance(true);

// Array's with firephp configuration
//
// maxObjectDepth      Maximum depth to traverse objects.
// maxArrayDepth       Maximum depth to traverse arrays.
// useNativeJsonEncode Set to FALSE to use JSON encoder included
//                     with FirePHPCore instead of json_encode().
// includeLineNumbers  Include File and Line information in message.
// Defaults:
$options = array('maxObjectDepth' => 10,
                 'maxArrayDepth' => 20,
                 'useNativeJsonEncode' => true,
                 'includeLineNumbers' => true);

$fb->setOptions($options);

// Define to control global debug input output
$fb->setEnabled(DEBUG);

// Displays different kind of log output
$fb->log('Hello log');
$fb->info('Hello info');
$fb->warn('Hello warning');
$fb->error('Hello error');

echo "Normal site output";

Related sites

Kommentare[0] Tags: labs firephp javascript console debug php firebug error-handling