zen of coding

Building “the blog tutorial”… the TDD way (part 1 – model testing)

CakePHP 2.2 Part 2 I personally consider Test Driven Development (TDD) as a “must do”, rather than a “nice to have”. Unfortunately as developers we often suffer from tight deadlines, tons of requirements and deliverables and sometimes a simple lack of understanding as to why TDD is so important. Granted,[…]

Read More »

User Auth with CakePHP 2.1 – part 3

As promised in the previous part we’ll take a look at the admin section. If you remember, we’ve setup our users so that when they create an account, they are inactive by default and cannot login into the app. app/Controller/AppController.php [cc lang=”php”] $this->Auth->authenticate = array( ‘all’ => array ( ‘scope’[…]

Read More »

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… [cc lang=”php”] class User extends AppModel { public $validate = array( ‘username’ => array( array( ‘rule’ => ‘notEmpty’, ‘message’ => ‘Username cannot be empty’ ), array( ‘rule’ => ‘isUnique’, ‘message’ =>[…]

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 »
%d bloggers like this: