Rudimentary Art of Programming & Development

Promoting Open Source, Always…

Archive for October 2007

PHP: Quick tip on setting up server-side logger

without comments

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

Written by didip

October 30, 2007 at 12:27 pm

Posted in for dummies, php, tutorial

Hmm… Google down?

without comments

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:

  • http://www.google.com
  • http://images.google.com
  • http://maps.google.com

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.

Written by didip

October 22, 2007 at 9:41 pm

Posted in Google, i must be lying

FreeBSD/OS X: Periodic…

without comments

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

Written by didip

October 22, 2007 at 9:35 pm

Python Quickies: Guido’s blog…

without comments

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

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

Written by didip

October 11, 2007 at 11:08 pm

Posted in python

Multitouch Media Wall…

without comments

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:

Written by didip

October 11, 2007 at 8:16 pm

Posted in innovation, tech, technology

Javascript: setTimeout() vs setInterval()

with one 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:

Written by didip

October 11, 2007 at 4:37 pm