PHP: Quick tip on setting up server-side logger

October 30, 2007 § Leave a comment

Changes in php.ini:

  1. 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.
  2. 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());
}

Hmm… Google down?

October 22, 2007 § Leave a comment

I must be shitting myself. But I’m not… Yahoo! and MSN work just fine.

Todey, I cannot access Google.com. Weird…

These are links that I couldn’t access:

GMail still works fine tho…

Let’s try ping:

Mon Oct 22–at[~/Desktop]–do–>ping http://www.google.com
ping: cannot resolve http://www.google.com: Unknown host
Mon Oct 22–at[~/Desktop]–do–>ping http://www.yahoo.com
PING rc.yahoo.com (xx.xx.xxx.xx): 56 data bytes
64 bytes from xx.xx.xxx.xx: icmp_seq=0 ttl=50 time=39.706 ms
64 bytes from xx.xx.xxx.xx: icmp_seq=1 ttl=50 time=36.830 ms
64 bytes from xx.xx.xxx.xx: icmp_seq=2 ttl=50 time=38.189 ms
64 bytes from xx.xx.xxx.xx: icmp_seq=3 ttl=51 time=36.163 ms

Naah, this cannot be right… there must be something else…

Damn, just realize how much I’m dependent on Google. And the timing is so perfect, while I’m reinstalling OS X & my development tools.

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:

  1. /etc/periodic.conf
  2. And, specific periodical scripts, usually under /etc/periodic/{x}, where x is daily, weekly, or monthly

What can you do with this script?

This is the complete list from ONLamp.com

Python Quickies: Guido’s blog…

October 11, 2007 § Leave a comment

in case some readers don’t know where Guido’s blog is:

http://www.artima.com/weblogs/index.jsp?blogger=guido

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:

Where Am I?

You are currently viewing the archives for October, 2007 at RAPD.