PHP: Quick tip on setting up server-side logger
October 30, 2007 § Leave a Comment
Changes in php.ini:
- Around line:416: uncomment error_log variable, and assign it to your prefered logfile.txt. For example, on Windows box: error_log = “C:\log.txt”. Beware: make sure that PHP has permission to modify the log file on *NIX system.
- If you want to NOT displaying PHP error on the screen: Around line 360, make sure that: display_errors = off
Grunt work required to make sure that things are logged properly:
use if block:
if(something->bad->going->to->happen)
{
//call this system function
error_log(‘the message why this is bad’);
}use try catch:
try
{
//do something that’s possibly bad
}
catch(Exception $e)
{
error_log(‘Exception thrown: ‘.$e->getMessage());
}
FreeBSD/OS X: Periodic…
October 22, 2007 § Leave a Comment
What is it?
It is the equivalent of cron job on many Linux distros. It performs auto executable scripts given the following intervals: daily, weekly, or monthly.
Where is it located?
There are 2 places that you need to know:
- /etc/periodic.conf
- And, specific periodical scripts, usually under /etc/periodic/{x}, where x is daily, weekly, or monthly
What can you do with this script?
Python Quickies: Guido’s blog…
October 11, 2007 § Leave a Comment
in case some readers don’t know where Guido’s blog is:
Multitouch Media Wall…
October 11, 2007 § Leave a Comment
is listed as one of Popular Mechanics’ 2007 Breakthrough Awards.
The innovator is Jefferson Y. Han who got the inspiration from a phenomenon called “Frustrated Total Internal Reflection”.
The wall screen looks super awesome, very much like Tom Cruise’s movie, Minority Report.
Big ass touch screen monitor that allows collaborative works is no longer science fiction.
References:
Javascript: setTimeout() vs setInterval()
October 11, 2007 § 1 Comment
What is setTimeout():
It is a function that can execute other javascript statement AFTER x interval. The interval unit is millisecond.
Syntax:
setTimeout(“do.something();”, 1000); //Execute do.something() 1 second later.
What is setInterval():
It is a function that can execute other javascript statement EVERY x interval. The interval unit is millisecond.
Syntax:
setInterval(“do.somethingElse();”, 2000); //Execute do.somethingElse() every 2 seconds.
Notes:
Use clearTimeout() to cancel setTimeout(). Similarly, clearInterval() is used to cancel setInterval().
When calling “this” inside setTimeout() or setInterval(), it refers to window(global) as opposed to the object you are calling the function from.
References: