DRY: Applied to your setup
20 Nov 2007
As pointed out in a recent comment, when changing your cake version you may find that some of your hand written config files are nolonger compatible with the version of cake you have selected. However by making use of a a custom production setup there is a way to configure your application defensively and in less lines of code.
Every time I use copy, paste &...
read populates $model->data
02 Nov 2007
For the past couple of days, I've had this niggling doubt that I've been missing something. Some code that I had in a behavior, which was supposed to be triggering a save for two field values, further down the line kept turning into a save which included every field in the table with the old field values. Why was this happening? I asked Elvis, he didn't know so I had to ...
Automatically track who makes Database changes
19 Sep 2007
You may well find that you want to automatically know which user is adding or updating your database info. There are a few ways to do this and I recently, inadvertently, let slip that I have a whoDunnit (who did it) behavior which I use for exactly this purpose.
I wasn't sure if I should make it public; trouble is a little knowledge is a dangerous thing, and the...
Generic File Upload Behavior
14 Sep 2007
On a recent project I had to address the requirement that the admin user can "upload any type of file and associate it with any of the models in the system". In reality this seems to be a rather logical and common requirement. For quite a while now I've been collecting bits of info on how to upload files with cake and it's about time to begin sharing the knowledge. Did I say ...
Announcing ?DM0eight
11 Sep 2007
I usually only write about technical things here, but there are some things that are worth sharing. Still, it's boring to just blurt things out so for anyone reading the title to this blog thinking "huh?" (and I bet that's most of you) here are some hints to help figure out what it means:
- My net name is AD7six
- This is made up of my initials and the year I was...
Production setup revisited
24 Aug 2007
A while ago I wrote about how to have a production setup on a shared host, an insightful comment from CraZyLeGs pointed out that the same idea could be extended (on either a shared of dedicated machine) to allow multiple applications to be installed on the same server, and have multiple parallel versions of cake installed as well. For some time, and in reality probably...
Generic capability-based security (CSRF prevention)
23 Aug 2007
Over time I have become more and more interested (concerned?) with the security aspects of web development, and lately I've been looking at defense tactics against CSRF type attacks. To put CSRF into layman speak using a typical example, its an exploitation of sites where the only means of checking whether or not to do something, is to check if the request came from a logged...
Debugging test cases
21 Aug 2007
Hurray it's the middle of summer and obviously like most people I am quite focused on testing code. What? You mean that isn't a typical summer activity :D?
I've written a few tests with the CakePHP test suite now and can safely say that after you have written your first one, it's very easy to write another. One thing that is a great help but not so clear how to do is how...