zen of coding

User Auth with CakePHP 2.1 – part 2

CakePHP 2.1 Now that we’ve completed our basic setup for Auth, let’s take a look at the User.php model… class User extends AppModel {         public $validate = array(       ‘username’ => array(           array(            […]

Read More »

User Auth with CakePHP 2.1 – part 1

CakePHP 2.1 The example application in the CakePHP book does a very good job of covering setup and implementation of a basic Auth system. Let’s continue building on that and cover a few other things, by adding a couple of more features and looking at some of the other things[…]

Read More »

“Error: Database connection “Mysql” is missing, or could not be created”. CakePHP 2.0 — cake bake trouble

CakePHP 2.0 Nothing like coming back from a hiatus with a WTF? post. My favorite “cake bake” started failing with the message in the subject; as well it seems that I am not the only one who had suffered from the problem… (just give it a quick check on google).[…]

Read More »

Setting up Nginx and CakePHP 2.0

Nginx is a pretty awesome web server (fast, and easy to configure… at least I prefer the syntax over some other popular web servers). I figured to share the installation process of both CakePHP 2.0 and Nginx on Ubuntu 11.04 (Natty). Let’s fire up the terminal… (I presume you have[…]

Read More »

Quick comparison of Nginx and Apache

This was a quick test as I was playing around with Nginx and CakePHP 2.0. The numbers were interesting, however. What I did: – Setup a virtual box with Windows host – OS: Ubuntu (Natty) – PHP 5.3.8 – CakePHP 2.0-beta (freshly pulled) – apache2 (2.2.17) – nginx (1.0.5) Nothing[…]

Read More »

Under the hood of CakePHP 2.0

Thanks to excellent Mr. jrbasso for putting together this list for me. In case one wonders, yes he does know a few things about cake ;) So, without further ado here’s a couple of things to enjoy in CakePHP 2.0… __() now works like sprintf() There were a few complaints[…]

Read More »

Setup debugging for Netbeans + CakePHP

Update (7/22/2011): dogmatic69 pointed out that you can do the same with Chrome by installing the xdebug extension. See his comment for details. For all the Netbeans users out there, if you don’t have debugging enabled, this little “how-to” should get you stared pretty easily. First prerequisite is to make[…]

Read More »

Offload read queries to a replica DB for better performance

In most web application, which require a lot of find()’s especially if more than a couple of models are involved, you should probably consider offloading those operations to read-only replica of your DB. This is typically achieved by having a master/slave or master/master configuration. In high traffic application you might[…]

Read More »

If you use UUID’s…

Be extra careful to make sure that, according to convention, your ‘id’ column (or primary key) is: char(36) and never varchar(36) CakePHP will work with both definitions, however you will be sacrificing about 50% of the performance of your DB (MySQL in particular). This will be most evident in more[…]

Read More »

find(‘first’)… gotcha

Just a simple tip… Here’s a typical find() example: $this->Post->find(’first’, array(’condition’ => array(’id’ => 5))); Why does it return me the post with ID = 1, rather than ID = 5? Of course, a careful reader spotted the spelling issue in the key: ‘condition’ instead of ‘conditions’. Moral of the[…]

Read More »
%d bloggers like this: