Beware of the underscore
Have you ever tried using underscores (_) in your controllers variables that you are passing to the view using a combination of Controller::set() and compact()? Well, if you did, you must have realized that they never make it there, right? I haven’t submitted it as a bug yet but here it is:
class SandboxController extends AppController {
var $uses = null;
var $layout = 'sandbox';
function beforeRender(){}
function index()
{
$foo = 'foo';
$bar = 'bar';
$foo_bar = 'foobar';
$this->set(compact('foo', 'bar', 'foo_bar'));
$john = 'john';
$doe = 'doe';
$john_doe = 'john_doe';
$this->set(compact('john', 'doe'));
$this->set('john_doe', $john_doe);
}
}
Now, in your view:
echo $foo . "<br />";
echo $bar ."<br />";
echo $foo_bar ."<br />";
echo "<br /><br />";
echo $john ."<br />";
echo $doe ."<br />";
echo $john_doe ."<br />";
Finally, the returned output:

Anyone knows if that’s how it’s supposed to act?
Update: there is a way to actually get those variables intact. Thanks to Taylor for pointing it out.
$this->set(compact($foo, $bar, $foo_bar), false);
My current development environment - suggestions?
While I was away, I wasn’t 100% on break… Among the work related stuff I’ve done was revamping my whole dev environment, hardware as well as software.
For a little over a decade now, I have been a Windows user. In the early days, it was because Mac was just too expensive for what my parents could afford for my toys; but since all the Mac-frenzy started, it was more out of fear of loosing some precious time adapting to a new OS (and all what comes with it) than anything else really. I finally decided to give it a try early this year with a Mac mini to start with but that didn’t impress me much at first, mainly because I was never really giving it a real chance to. Only a month or two later, when I got the MacBook Air as a gift from my partner, that I really started enjoying and appreciating the new OS.
I went ahead and purchased the Mac OS X, installed that on the mini, hoping that it will push me into using that little machine some more until I identified the real reason behind my constant bouncing back to Windows: multiple displays. I know you have ’spaces’ in Mac but I still prefer the physical black separation that I get from working with 2 screens (back then), the same reason why I’d rather have 2 x 21″ screens instead of one big display. To my big deception, the mini was not fit for the multiple displays setting because of it’s low-end graphic card - same for the Air.
Around the same time, I was revamping my desk, making it more ergonomic and much simpler. A solid wood board with a metallic bar going horizontally across to support the extra weight, 2 metallic frames for the legs, a keyboard/mouse tray (#02-ORB439BK) w/ ball bearing arm (#02-ARMLKS) and a multi-display desk mount (#30-500-B16-04). The multiple displays were used back then as follow: one on the mini, 2 for the PC and one switching between the FreeBSD box and the docked laptop. Given the fact that I could run all these OS from a central machine, I decided it was time to invest in a real beast, the Mac Pro, for which I had to add an extra VGA card, a wireless ethernet card (- )can you believe this machine comes with no wireless included?) and some RAM.

Once all that was plugged, the only PC left around was a Toshiba laptop. The temptation to bounce back to Windows was slowly dying and the current setup was only contributing to that.
Now, a couple months later and after having toyed with different tools, here are the ones that I felt worked well for me:
- Adium
- Calendar
- Firefox 3 (add-ons: Read it later, Firebug)
- [Fireworks CS4]
- MySQL Administrator
- Office 2008
- Parallels (running: DBDesigner 4 on WinXP)
- Skype
- TextMate (bundles: CakePHP, FTP/SSH, Trac)
- Time Capsule
And finally, I keep all files (local sandbox, remote projects, etc.) in SVN repositories for easy access to my files from anywhere. That pretty much covers it all. Since I am new to Mac, maybe there are stuff I’m missing out on, if so, please share. Also, what’s your approach on having your development environment follow you (files, tools, etc.)?
Summer’s over - and so is my break!
Hi everyone,
I know my posts have been few and far between over the last several months, that’s because I never really felt like getting back to work since I started my break in mid-December ‘07. Who would like to get back to work, right? I have to admit, it felt GOOD! But summer is over now, fall officially started yesterday and for me that means only one thing: it’s time to start getting ready for hibernation mode!
Why hibernation mode? Because, for one, I don’t do any winter sport (and I don’t see myself starting one at this age with a semi-handicapped elbow), I rarely have the need to get out to do things (there’s always someone for every task) and, to be honest, who likes to stick his nose out by -30 celsius? Exactly, not many, when given the option.
And basically, now that I’m seriously back, you shall see a lot more coming from me on this blog in the days, weeks and months to come. Maybe finally doing the move to it’s own CakePHP-based CMS and domain?

