Archive for December 2006
Windows XP on a Mac
Saturday, December 23rd, 2006

Since they came out with the Macs with Intel processors and Bootcamp, I’ve been curious to see how this setup works out. Well, I now have a MacBook Pro at my disposal and figured I’d give it a go. I was not disappointed.

First off, the setup. It’s quite effortless, just follow the instructions provided with Bootcamp and you can’t really go wrong. I ran into absolutely no issues, it all worked flawlessly. They may provide the software with no guarantees or support, but they made sure that people wouldn’t be frying their machines installing it.

After setup, I ran Windows XP and installed the drivers as directed by the instructions. No problem there either. And after that, uh, well, like, everything just worked and stuff… From then on, I ran XP pretty much like I would on any other PC. I’ve got everything I need for work running, Eclipse, IIS, Apache, ColdFusion, PHP, Ruby on Rails, I have office apps, I have Skype, MSN, etc. Everything works beautifully.

On to hardware side there was one technical issue: the trackpad. For one thing, there’s only one button, so right clicking is a real problem. Fortunately, I was able to download applemou.exe, which allows you to ctrl-click to get the equivalent of a right-click. Kind of annoying to have to do, but if you have to rely on the trackpad, that’s the best bet I found. The other problem with the trackpad is that it sometimes stops responding properly, or altogether. Not too often, but it does go nuts once in a while.

The good news, however, is that you can get around the trackpad with a regular mouse. Or in my case, I had a Bluetooth mouse and I was able to use it no problem. Bye bye trackpad issues, everything worked normally.

So after running this for a few days, I can say I’m quite pleased with the results. I did have windows shut down all of a sudden and inexplicably once. Not too nice, but other than that everything has worked normally. And I’m assuming issues like the trackpad quirks may be down to the drivers, and I bet they’ll be corrected. So, to sum it all up, two thumbs up to Apple and Bootcamp. And may I add that the MacBook Pro is a sweet machine!

Dynamic PHP
Tuesday, December 12th, 2006

When you’re trying to build more complex classes/applications, the need for doing things dynamically often arises. I figured I’d compile a list of ways to do dynamic PHP for those starting out with PHP. Please note that the list was elaborated with PHP 5 in mind. Some items may work with previous versions, but you’ll have to test it out for that.

Variable Variables

Suppose you need to output a variable but you don’t know in advance which variable it. Take a look at this code:

Using variable variables, you can rewrite the above as follows:

Because $greet == “hello”, the end of the script runs as if it were echo $hello. More details on variable variables here.

Dynamic Functions/Objects

The same principle described above can also be applied to functions, member variables, and functions, and object instantiation. Check this out:

Isn’t that exciting? Gotta love PHP for making it so easy!