Amazon datasources

This is just a short announcement. I’ve been dealing a lot with Amazon API and LastFM api in my last project. (Cloudspeakers new design/site) I’ve made a CakePHP datasource for Amazon S3 storing and retrieving and one I modified the datasource from Felix for the Amazon product advertising API.

I will share those through git (theChaw) but have to finalize them a bit. Also the retrieving S3 part is not working yet, but not needed in my project.. so that will be a bit later.

Update 2009-07-11: Just had an interesting talk of Joel Perras @cakefest about datasources. I have to rewrite mine. Sorry and have some patience.

Update 2009-11-08: Just added the Amazon eCommerce code datasource to GitHub: http://github.com/primeminister/CakePHP-Amazon-eCommerce-datasource

Displaying custom error message with the right HTTP response codes

I’m building an RESTful API with CakePHP now. That is great stuff. Very easy and quick for the basics. Some more info on how to in the book and here.

But I wanted a custom XML error message with the right HTTP respond code like the Twitter API does. I knew it could be done with overwriting the AppError class and make my own custom method.

This is how I did it: (more…)

Cache duration and configuration tips

320gb-werstern-digital-hard-drive-7200-rpm-cache-8mb-hd-w3200jbAs you know you can cache several elements in you application. When I wrote a value to the cache I did it by setting the duration in the third parameter of write:

Cache::write('cache_key', 'value to cache',array(
    'config'=>'default',
    'duration'=>'+1 day')
);

But today I learned a lesson from Mark Story that this was a bug and it is fixed and doens’t work anymore. It is ignored.

So how do I set the duration before read/write for specific data in my code? (more…)

Mapping content over domains with Apache

Using ‘Dynamic Mirror‘ in Apache you can map content from one domain to another. This was useful for a customer who had two very old domains from 1993 and built-up a nice SEO ranking.

We have two domains a-domain.com and b-example.com. The last one has a new design and some different links and is an application built in CakePHP. 
The other domain ‘a-domain.com’ had its purpose to serve the same content. (more…)

Writers invite

Hi all,

rp-pencil-tipAs you see I don’t write very often. That is because I have a lot todo and I sometimes I really don’t know what to write about! And if I do teknoid or someone else beats me to it … (keep doing that you guys!)

My intention with this blog was that more writers join in and write together with me tips and insights of cake and other tech stuff. 
So… If you thought of writing articles, short tips and tricks but never had the time to setup your own blog? Or are you someone like me that doesn’t write much but sometimes want to?

Come in, register and write! Or leave a comment on this post. Join me to write (great) stuff about what’s keeping us busy.

Cheers!
- primeminister

Happy New Year, Bakers!

Happy New Year!In advance… Happy New Year to all you bakers in the whole world!
Be carefull with the fireworks and keep an eye on that important fingers of you, because I want to see as many blog posts about Cake as this year, deal?

Cheers!

Yii and CakePHP

what-do-you-look-for-in-a-php-framework-graphI like working with CakePHP because it saved me a lot of time when it comes to roll-out new features for an existing app. Now I’m working on new features in markt.nl and it saves me like days to get going again and change some search results look and feel.

I also sometimes think CakePHP framework is a little bit bloated and I miss the lazy loading a lot. In some apps I use the (un)bindModel methods and containable behaviour a lot and often have to read the whole method again and wonder how I did it. (/em is asheamed of writing code without comments) ;)

So I stumbled against a blog post by Jonah while writing about the Yii framework in comparisment to CakePHP. I liked what I read but always have to try it out myself. So I will do that in the future. Maybe on Christmass because I hate such holidays (sorry all…)

Speaking of frameworks… Chris Hartjes made a shop with a nice t-shirt. I like the drawing but not gonna buy the shirt. The collar of those things always kill me ;)