Tuesday, 10 May 2011

First Attempt With CakePHP

Currently learning from the IBM tutorial:
Cook up Web sites fast with CakePHP, Part 1: Getting started

I am using easyphp, and is go to set up the new cake as a production installation.

Several important steps:
1. In httpd.conf, set document root to:
DocumentRoot "${path}/www/cakephp/app/webroot" 


2. Also in httpd.conf, also set document root directory to
Directory "${path}/www/cakephp/app/webroot" 
...
 AllowOverride All
...


3. Setting up the database configuration:
Copy and rename the "app/config/database.php.default" into "app/config/database.php" and edit accordingly.


4. Create a user model:
 Create the file as "app/model/user.php" (or whatever name, as long as know how to handle)


5. Create a register view:
Create the file as "app/views/users/register.ctp" 


6. Create a controller and register action:
Create the file as "app/controller/users_controller.php". 



7. Bake it:
Go to the url: "http://localhost/users/register". 

Monday, 9 May 2011

CakePHP, EasyPHP and mod_rewrite

For a standard EasyPHP package, mod_rewrite is off in httpd.conf.
As using CakePHP requires the mod_rewrite, we will need to modify the httpd.conf of EasyPHP by just, uncomment it.

#LoadModule rewrite_module modules/mod_rewrite.so -> remove the hash

Tuesday, 3 May 2011

Switching Back To Opera Again

Since switching over to Chrome 15 months ago, now finally come back to Opera.

Opera 10 series, for me is quite a failure which contributes to the switch over, particularly in web compatibilities and extremely slow javascript execution speed as compared to chrome. (Or maybe i should say it is the result of following the protocols and procedures 100%?)

But now, Opera 11 is just as nice as Chrome, so it's time for me to come back to Opera again.

A major weakness for both web browsers:

Chrome 10: Sometimes will still crash when visiting some websites that contain flash applications.

Opera 11: Speed is still lacking a bit compared to chrome, but is very much faster than opera 10.

And don't ask/suggest me to use IE or Firefox unless they are proven...

Thursday, 21 April 2011

Using Apache As Server In A Local Area Network (LAN)

Let's said, you have set up server for LAN usage only. If you have ever come across to a page stating "Could not connect to remote server" or alike, can try out this solution.

1. Open the apache configuration file, httpd.conf.
2. Go to the section that configure the ip address.
3. Make sure it listen to the server's ip (not 127.0.0.1)
eg. Server's ip is 192.168.x.x using port 80, the make sure you have the following line :

Listen 192.168.x.x:80

Monday, 18 April 2011

Time Wasted On Nested Javascript Functions With onSubmit()

I want to create nested Javascript functions for my onSubmit() validation. However, it seems that my skill is still not there yet, (or there is javascript rendering problem in Opera?) where the form is still submitted even though the value returned for the onSubmit() is false.

So, the solution is:
Use back the old school method -- Structured programming without calling of nested functions!

And several hours has been wasted...

Wednesday, 13 April 2011

Internet Explorer 7 Failed To Render Simple Javascript and HTML DOM

Speechless, where i can use the same portion of code successfully in Opera, Chrome, Firefox and Safari...

Tuesday, 12 April 2011

CSS in PHP file

To enable css effects in a php file, just remember to declare !DOCTYPE (for HTML5) and HTML tag inside the php file.