Yet another way to customize your flash messages – with a helper

October 7th, 2010

Just in case you’re not familiar with the basics, I suggest you read James Fairhurst’s and teknoid’s posts first. Good stuff but doesn’t work for Auth messages because you can’t specify parameters when Auth calls $this->Session->setFlash().

So I decided to ignore the phase where you set the flash message and hack the phase where the message is being printed. I created a custom helper and extended/overrode SessionHelper.

Read the rest of this entry »

CSS class or id in a SELECT box OPTION? You can!

October 1st, 2010

I’ve been wrestling my mind around a rather simple request today. I needed to display the first OPTION in a SELECT box in a different colour. Simple in HTML but I just couldn’t find a solution that would do it the cakeish way. Until I RTSC and found that I can specify the options in a more complex way.

Read the rest of this entry »

Strong random password with a bookmarklet

August 19th, 2010

I create all sorts of passwords rather often, be it for me or for my clients. Until today, I always sort of let my hands use the free-fall feature and generated some random characters just by dropping them onto the keyboard. Then I added upper/lower case character and a symbol here and there. I tried to use random password generators before but the above procedure was always faster than locating and executing a special-purpose application. Well, today it occurred to me that a bookmarklet would be a much better solution. The browser is always running and having the bookmarklet in the bookmark toolbar makes using it a single-click job.

Read the rest of this entry »

Baking with XAMPP on Windows

September 14th, 2009

I’m not sure if it’s just my set-up but when I run cake.bat and say, try to bake a model I get

  1.  
  2. Fatal error: Call to undefined function mysqli_connect() in C:\…\cake\libs\model\datasources\dbo\dbo_mysqli.php on line 73
  3.  

The reason is that php.exe when run from a command line uses a different php.ini than PHP that’s run as an Apache module. To fix this edit cake.bat and add -c"C:\xampp\apache\bin\php.ini". This is the path where XAMPP placed php.ini.

Getting rid of JOINs in updateAll() query

September 13th, 2009

I guess I haven’t mastered the model relationships enough in order to appreciate them – and use correctly. On one hand they seem to be really cool and provide an easy access to linked database records while on the other hand, they just seem to stand in the way too often.

Read the rest of this entry »