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:
//call this system function
error_log(‘the message why this is bad’);

use try catch:
//do something that’s possibly bad
catch(Exception $e)
error_log(‘Exception thrown: ‘.$e->getMessage());

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.


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.


setInterval(“do.somethingElse();”, 2000); //Execute do.somethingElse() every 2 seconds.


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.


CakePHP: book for newbies…

July 30, 2007 § 1 Comment

is almost here.

David Golding is the author, and here is his announcement about it.

Update: December 29th, 2007

Couple of the chapters are available here.

There’s also discussion forum about the book.

If you cannot wait to get started on CakePHP, see Resources below:

CakePHP: getting list of all of your controllers

July 30, 2007 § Leave a comment

This tips is written by Felix Geisendörfer aka the_undefined. He is waaaaay involved with CakePHP community.

His blog is recommended for readers who enjoy baking with CakePHP.

Zend Framework… Performance & Caching (part 2.1)

July 30, 2007 § 2 Comments

In my previous post (here), I promised you about performance of Zend Framework.

Unfortunately, I cannot give you the result yet. Because it is still work in progress.

So here is the low-down:

First of all, I’m researching (learning) about Zend_Cache, which consist front_end and back_end. Don’t worry about the mumbo jumbo just yet. The front_end is nothing more than helper functions that can help you optimized specific parts of your application code. The back_end utilize different types of medium Zend Framework use (as of version 1.0, there are 5 different choices of storage: filesystem, APC, SQLite, memcache, or ZendPlatform). ZendPlatform is not free.

The plan is to implement caching and run stress/load testing on both before and after-cache. Then I can publish the result here.

Currently, the front_end confuses me on how to utilize it… It promotes sloppy code. Or is it me not finding the good tutorial online?

Here is an example from Zend_Cache_Frontend_Output (<– it’s 1 of 4 front_end Cache objects):

(assuming $cache object has been initialized using the factory pattern)



[you block of PHP code]



How in the world does this promote elegance? I supposed it should be fine if I enforce its usage strictly on View pages. But still…

Another thought would be to cache all public functions inside model classes using Zend_Cache_Frontend_Function. It’s the cleanest, most seperated (because hidden inside model classes), & has the highest impact (because of caching database calls made by the functions).

(Brain starts steaming up…)

So now y’all know why I’m so late in giving the performance report. Stay tuned for more tips on how make your Zend application… “enterprise-level”

Javascript: == OR ===

July 10, 2007 § Leave a comment

As it is similar to almost many other languages,

== checks the equality of values on both sides.

While === checks the equality of values as well as data type on both sides.

For example:

null == undefined is True, but

null === undefined is False.

Yet another simple and obvious tips to make readers even more awesome in Javascript.

Prototype property in Javascript

July 6, 2007 § Leave a comment

What it is not:

It is not Prototype Library (Toolkits for applying various DHTML effects)

What is it?

It is a built-in object that simplifies the process of adding custom properties/ methods to all instances of an object. In short, It applies any changes you made to all instances of a particular Javascript object.

Why is it useful?

When defining basic properties of Javascript object, you definitely need Prototype property.

For example, If your object is called robot, then robot.prototype would contain var head, var limbs, var body, etc. etc.


Python for N00bies Resources

May 23, 2007 § Leave a comment

When coding with new language, unfamiliar syntax & API might frustrates you a lot.

That’s what I felt with Python, thus to familiarize myself, I’ve compiled list of online resources that I (or readers) can download or read online.

Online Books:

Online Tutorials:

Apache & CherryPy Tutorial

May 16, 2007 § Leave a comment

I cannot write it better than his.

So, I’ll just include the original article here.


Other References:

OS X as the ultimate Web Dev machine!

April 22, 2007 § Leave a comment

Below are blogs, tutorials, and articles that help me configuring OS X to be the ultimate web development machine:

  1. Before doing anything, first execute command: “periodic weekly”. This allows you to use “locate” command.
  2. Fink! Before installing your favorite Linux tools/packages, get this one first. This app contains apt-get and much more.
  3. While you are installing Fink, why not FinkCommander?
  4. This guy presents dead-on tutorial on how to install Apache, MySQL, & PHP.
  5. This is my take on how to install Apache2 & PHP5.
  6. This guy shares us the joy of Python via this easy, breeze, beautiful blog.
  7. In case you have amnesia, or simply didn’t know SVN… Read this!
  8. What about Text Editor you say?
    • The hardcore side of me says “Use VIM my friend…”
    • The easy-to-use-but-resource-hog side of me says “How about Eclipse?”
    • Though TextMate still rules the realm of Darwinian.

More is coming up, if only I could find some of yesterday’s online tutorials ( hasn’t solved my problem yet).

Where Am I?

You are currently browsing the tutorial category at RAPD.


Get every new post delivered to your Inbox.