We have shuffle() to reorder a numeric array, we have array_rand() to randomly pick a specific number of values from an array but there’s no built-in command for shuffling an associative array. After having seen a few pretty bad solutions I decided to offer my own.
Shuffling associative array
April 19th, 2011Yet another way to customize your flash messages – with a helper
October 7th, 2010Just 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.
CSS class or id in a SELECT box OPTION? You can!
October 1st, 2010I’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.
Strong random password with a bookmarklet
August 19th, 2010I 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.
Baking with XAMPP on Windows
September 14th, 2009I’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
-
-
Fatal error: Call to undefined function mysqli_connect() in C:\…\cake\libs\model\datasources\dbo\dbo_mysqli.php on line 73
-
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.

