Upgrading PEAR on Mac OSX Tiger

It’s annoying sometimes having to upgrade or install opensource applications on Mac OSX. Yes, it’s BSD Unix, but it’s not quite Linux when it comes to raw package management from command prompts and how some applications assume you are installing it on Linux. On my fresh install of Tiger, I was having some issues upgrade PEAR. Because it’s not really documented anywhere, here’s how I did it:

1. Follow the upgrade instruction on PEAR’s official website.

2. Once PEAR is upgraded, issuing

1
$: pear -V

from the command prompt should still give you an old version of PEAR as such:

1
PEAR Version: 1.3.6

3. To fix that, find out where the current version of PEAR is by issuing:

1
$: which pear

It should return:

1
$: /usr/bin/pear

4. Then find out where the upgraded PEAR went by issuing:

1
$: pear config-show

Look for:

1
PEAR executables directory   bin_dir

In my case, it resides in where PHP5 is at:

1
PEAR executables directory   bin_dir   /usr/local/php5/bin

5. Next I make a symbolic link to it from where

1
/usr/bin/pear

is:

1
2
$: mv /usr/bin/pear /usr/bin/pear.old
$: sudo ln -s /usr/local/php5/bin/pear pear

6. Do another

1
$: pear -V

and it should now show the proper version:

1
PEAR Version: 1.5.3

Laptop Backup

In preparation to completely wipe my laptop hard drive clean and reinstall Mac OSX (it’s been a couple of years), I got a giant Western Digital My Book drive to back all my data to. Since it’s got two 500GB hard drives in it, I knew making it a mirrored RAID 1 drive would be the ideal solution for a peace of mind (that means making the two drives as if it’s only one, only files backed up to it will be mirrored, or synchronized, on both drives in case if one of the drives fails, all that data is still safe and sound on the 2nd drive).

Unfortunately Western Digital’s hardware doesn’t allow Apple’s Disk Utility to manage it. I ended up having to install Western Digital’s custom RAID utility. Sucks.

The initial backup took about 3 hours to backup about 35GB of data — not very fast. But then again, it’s software RAID. It’s not supposed to be fast anyway.

So now that I have all my stuff backed up. Next week I will be able to finally reinstall OSX and see if the damn machine runs any faster.

Next is to back up all those digital photos stored on Grace’s Mac, which was the real reason I bought this drive in the first place.

Rebel Forces Have Landed

At long last, the much anticipated Java class I’ve been wanting to take all year in 2006 finally started on Tuesday. After having played with PHP for 4 years, I’ve finally felt the need to pick up something else for a change. Partly, my cousin Alex is to “blame” for pushing me into Java for its enterprise-readiness.

A couple of interesting statistics about this class:

1. A typically uber-geek class has almost 1/2 of the students being women.
2. Everyone else in the class has either an IBM ThinkPad or some sort of loser Dell laptop. I am the lone Mac user in the class with the only Mac laptop (yoohoo!).
3. Everyone else planned on coding Java using Windows; I am the only person using Mac OSX (yoohoo!) while one other guy is using Solaris.

Hopefully this class will worth its weight in tofu. I had the same instructor in a previous database design class, and that class turned out to be very “profitable” for me. So hopefully I’ll be able to make what I learn here equally successful economically. 🙂

Finally, An Apple Phone

It’s been rumored for years. But I am just about sick of hearing about it without seeing the real thing. But I guess all the patents Apple’s been making in the past year on touch-screen technologies have finally come to fruition. Today the Apple iPhone arrived. And as a direct result of it, my Apple stock jumped 7+ points, passing $92 per share… Sweet!

After having seen most of the fake iPhones and rumored features, I didn’t think Apple could surprise me. But what was announced today greatly surpassed my expectations on the GUI and usability. But someone’s got to play the devil’s advocate about the “misses” on this particular phone:

1. Not 3G.
2. I am guessing the battery is NOT removable. Is Apple banking on consumers replacing their phones every 2 years? Though people generally do it anyway, it’s annoying.
3. Storage is not upgradable (not by the user anyway).
4. The phone feature must work in order for the whole dvice to work; the caveat is, you MUST sign up with a network or else the entire device is just another paper weight. So I can’t just buy it for the PDA-ish features! Bastards.
5. What, no iChatAV?
6. No clearly stated standby time.
7. I am assuming no 3rd party developers can install their apps on the phone’s OS without Apple’s blessing.
8. Can’t transfer music/files wirelessly. Not that I care for Zune’s features, but it’d be nice to be able to sync with iTunes wirelessly. Isn’t it about time?
9. The phone surface is going to be all scratched up in the pocket. But then I guess Apple will probably ship it with some kind of sleeve when it’s available in June.

All in all, this is a pretty kick-ass first stab at making something they’ve never made before. Hopefully this will make the other phone makers piss in their pants so badly that it will improve the overall usability of cell phones in time. But Steve Jobs is right when he said today’s phones SUCK!

ReadyBoost Envy

I am rarely envious of anything from the Windows side of the world. And when I say “rarely”, it’s more like NEVER. But in Vista, there’s actually this ONE tiny feature that I hope the next version of Mac OSX would have — ReadyBoost. It’s basically a feature that allows a user to instantly increase the performance of a Vista-driven computer by simply adding flash memory! Sweet!

More features of Leopard (OSX.5) is to be unveiled on Jan. 9th, 2007 with Steve Jobs’ keynote speech at MacWorld Expo. I look forward to seeing what Apple’s been hiding for the past five months…

Upgrades

I’ve been dying to upgrade my aging PowerBook for about 8 months now. Even though I think its recent slowdown is caused by lack of hard drive space (only around 10% left), I am having a hard time finding stuff I can just get rid of without looking back.

Along with my PowerBook, a few things should probably go with it too: a 19″ CRT monitor (hello LCD monitor), a carpal-tunnel-syndrome causing mouse (umm, ergonomic mouse would be nice) and an old 802.11b wireless router/access point (which is now half broken). With one of those Intel Macs, many things I couldn’t do easily before will suddenly become possible (and obligatory) — like finally finish editing my wedding video.

I told Murdza I ran out of excuses not to get a new MacBook Pro. But I think I just came up with a few:

1. Would be nice to have Leopard shipped with it;
2. Would be great if video RAM was 256MB 512MB like some of Dell’s line ups;
3. Wouldn’t hurt if the LCD actually packed in more resolution like its PC counterparts;
4. Would love to finally know what file system Apple is eventually moving to;
5. I wish I had a great backup NAS drive for my home network.

Review of Mac PHP Development IDEs

Coding, some argue, is an art form. You try to achieve the best results with the most elegant codes you put together within the deadline. And those codes often go through different stages of metamorphosis as you gain more understanding and insight in the knowledge of coding… I don’t mean to get all “Zen” about this, but true geeks know what I am talking about.

And that’s how some people approach the kind of tools they choose to use doing what they do. I, for one, like the minimalistic and swiftness an all-purpose text editing tool like BBEdit offers. It’s light, fast and pretty powerful. And more importantly, it doesn’t screw up my codes like Dreamweaver probably would. But after having dealt with a couple of decent-size web developments, it’s become pretty evident that BBEdit is showing its weaknesses in areas like, for example, debugging, syntax auto-completion and project organization. So I started investigating using IDE to speed up development time and accuracy. I looked at and tested the following packages for Mac OSX:

Apple Xcode
Zend Studio
Eclipse (via PHP plugins: phpEclipse or PHP IDE for Eclipse)
ActiveState Komodo

I also checked out a couple of other simpler, not-quite-IDE, apps just for comparison’s sake against BBEdit:
PHP Studio
Smultron

For you Windows people, someone at IBM also did some homework for you…

Apple’s Xcode was pretty much out of the game as soon I started looking at the specs. There’s no debugging for PHP at all. PHP support stops at syntax coloring. Considering that the IDE is really meant for Macintosh desktop application development, there was no reason for me to pursue further… though I secretly wished it would just somehow magically work…

Next I tested Zend Studio along with Eclipse. Zend’s PHP debugger is very useful in catching even the most insignificant things like if a variable was declared but never used. It also supposedly comes with a “profiling” feature that tests which parts of my codes take the longest to execute so that I can perhaps write a more efficient code. But I never got that feature working. Even Zend’s own documentation and online forums are useless in solving the problem. Another very annoying thing Zend did was including features that are NOT supposed to work unless I paid for and installed Zend’s other products. Zend should at least have the courtesy to gray out those features. But instead, the company simply assumed that those products were already there and lets the user generate endless errors. There are other issues I ran into which made me feel that no one should have to pay for this software — it felt like a cheap beta.

Eclipse is an open source software which plenty of Java developers seem to love. Kyung first told me about Eclipse when he was using it. The setup was pretty straight forward and the debugger was also pretty nice, but its messages weren’t as contextual and as helpful as those in Zend Studio. But it was still a lot more helpful than PHP’s useless error messages. The only complaint I have about Eclipse is its performance on my aging PowerBook and lack of straight forward support for profiling (no graphics, just a bunch of tables).

Komodo is made by the same company that makes ActiveState Perl for Windows. It has by far the BEST user interface of all IDEs for Mac that I’ve tested, and it’s also most Mac-like. Unfortunately, it complained that my installation of PHP was bad (and won’t say why) and refused to work with it. And in order to get profiling to work, I’d have to install xDebug (which I did) and mess with a bunch of settings… It was pretty disappointing not getting Komodo to work.

PHP Studio and Smultron are pretty much like BBEdit except that PHP Studio has a more superior IDE-like code organization (like recognizing functions and classes that I’ve written within the same project and put them nicely in a side panel) which BBEdit doesn’t even come close to having. Unfortunately I could only work on one file at a time (no multiple tabs!). Smultron is pretty much a free version of BBEdit with a few things missing (which I don’t really care about). I probably wouldn’t have paid for BBEdit if I’d known about Smultron sooner….

So at the end, open source rules again. Come to think of it, I’d be pretty embarrassed if I were the project manager woking for Zend Studio or Komodo for making such awful products (though I should give Komodo the benefit of doubt since I couldn’t get it to work).

No wonder Apple ended up making its own IDE seeing that the mac programming IDE market is littered with such inferior alternatives. I wish someone would write an extension/plugin for Xcode and actually make it useful in coding web-based projects (PHP, Javascrit… etc). Maybe Xcode 3?

(More) Ajax Woes in Safari

The more I deal with Ajax and Safari, the more interesting problems I get with the combo from time to time. Since my last run in with the dual, which forced me to rebuild that particular section of the site using more traditional means, I have recently discovered one more issue having to do with multiple

1
XMLHttpRequest

calls via the same object from the same page. The short version of the story is: It CAN’T be done in Safari* (or not in the method that I know of). Firefox and IE, however, seem perfectly happy with using a single object to make multiple asynchronous calls.

Fortunately I am not crazy. I found an article that briefly touches on this issue. This article is also a very good short tutorial on how to get started on Ajax (though the author uses a Ruby backend to iterate the codes, which can easily be replaced using any code you are comfortable with.). Another article offers more depth on the same issue with some code samples to show (via Ajaxian.com).

To get around the problem, one way is to simply create multiple objects, one for each call request, as opposed to have one object to handle all the requests. If you don’t do this, when you make one

1
XMLHttpRequest

call, all the other Ajax fields on the same page will start loading as if they are expecting something back from the same request (for which they’ll wait an eternity and never get anything back).

Sometimes I just don’t know how I solve these kinds of voodoo-like problems. Even Google is powerless before I knew what the problem was. I mean, how do you Google for problems you don’t even know how to describe? And this issue was particularly annoying because Safari’s Javascript console didn’t report any errors.

*I also discovered that the same issue takes place in Webkit (the HTML rendering engine at the heat of Safari) based browsers, including Shiira. Though strangely enough, Camino (a cousin of Mozilla FireFox), much of whose gut is based on Safari’s renderer, didn’t have the problem at all! It’s also interesting to note that Opera 9 also suffers from the same issue.

More Geek Talk

Mike Neely discovered something pretty freaking awesome: It’s called Meebo. It’s basically Adiumx (or Trillian for you Windowz folks, gaim for you Linux dorks) except it’s web based. It supports quite a bit of stuff that you are accustomed to using desktop apps.

Speaking of apps, Neely revealed the other day that he’s doing some cocoa programming! I am so envious of him having the initiative and drive to pick up cocoa/objective-c. This reminds me that I ought to get back into desktop programming!

While I am on the topic of “desktop” programming, I tried upgrading my Fedora Core 5 to the latest Core 6 last night but failed. I guess it’s too new that various issues aren’t widely discussed yet (bless Google). I’ll probably give it another try another time. Strangely though, the audio in FC5 just magically started working all by itself — I spent days downloading and compiling various drivers for it to no avail. And that piece of sh*t just decided to work all of a sudden? WTF?! This is yet another reason Linux is far from being ready for mainstream consumption — lack of usability for everyday-users.

Back in Web Development

I have been working on a project non-stop for 2 weeks to get the final features up and running. But I just couldn’t stop squeezing in some good-to-have features to boost the overall “value” of the product a bit. Here’s a short list of what I thought were really slick features:

1. Javascript lightbox: This one feature can probably single-handedly describe what the Web2.0 movement is all about. The BEST part is, integrating Lokesh Dhakar’s code to the project (or ANY project, really) is just a couple of copy and pastes and one line of code change!! That guy is a genius.

2. Recursive delete: This a pretty kick-ass class for recursively deleting whole directory structures even if they are not empty (PHP programming in Unix environments, this is a big deal). My project requires my PHP scripts to interact with physical directories. I thought it’d be a complete waste of my time to write a function/class to do this if someone else’s already got a solid script. Implementing this just took one line of code.

3. Directory compress & backup: I used this script to work in conjunction with “Recursive delete”. Basically before anyone deletes a whole directory, my PHP application will automatically back it up and nicely tug the compressed file in a safe place. Again, this is a kick ass class because it only takes a copy/paste and defining of a couple of variables.

4. Unique ID check via Ajax + PHP: I wrote this myself using an Ajax class I assembled from prior projects. It simply goes to the database and checks if whatever the user ID (or product ID or whatever) already exists. One bug I encountered under Safari was that if

1
XMLHttpRequest

returns nothing from the database (which means the ID the user entered was unique), Safari makes

1
status undefined

or

1
null value

complaints. One way to get past solve this problem is for

1
XMLHttpRequest

to return an empty space via PHP (or whatever language you prefer)… i.e.

1
echo " "

. Here’s a nice blog about Ajax related issues. This issue is also pretty well documented here though “bitterpill.org’s particular trick didn’t solve the problem for me.

5. Multiple file uploads: The Stickman has some really neat references to a handful of technologies I am currently exploring. This “multiple file upload” script isn’t particularly elegant but does its job exceptionally well. I was able to integrate this, along with everything above, into one coherent code base, fortunately.

6. Snif (stands for “simple and nice index file” ) is probably one of the best-looking and utilitarian directory and file index script I have found thus far. There are tons of others that do way too much or too little (some of which cost quite a bit too). The downside of snif is that the code hasn’t been maintained for quite a while, and its forum is littered with more questions than answers. But I did find some nice “mods” to enhance its core functionalities quite a bit. Another problem I had with snif was how hard it was to integrate into my existing code base. That said, snif is still a very solid standalone directory index script though!

7. By accident, I stumbled upon a list of Web2.0 sites from Tucows. I look forward to studying up the latest eye candies these sites offer for my future projects.

So now that most of the core features are done, I just need to find a fast(er) Windows environment to test the css layouts, mostly for IE. I wish IE would just go away so that us web programming types don’t have to deal with Microsoft’s snobbish approach towards web standards. Go Firefox, Opera and Safari.
.
.
.
Apple finally decided to release Core 2 Dual version of MacBook Pro right before Christmas! How kind. I made a pseudo promise that I’d get a MacBook Pro if they upgraded it to Core 2 Dual… not knowing they’d do it before January’s Macworld… But since the budget is kind of tight these days, I will hang on to my trusty old PowerBook G4 until OSX.5 Leopard comes standard with MacBook Pros! Hah!

Apple Is Parallels Shy

We went to the mall today to get Bryan’s picture taken for his Canadian residency application (long story). So I went to the Apple Store to check out the latest iPods and other toys. I was really amazed how thin and light the new iPods are.

One of the things I’ve always wanted to test out was running Parallels, a new emulation software, on an Intel Mac. It’s been widely reported that it is capable of running Windows at near-native speed on an Intel Mac. I really needed to see just how efficient I can be coding within OSX while testing my codes in other browsers under Windows. Unfortunately, Apple doesn’t have any machine with Parallels installed. I wouldn’t be surprised if that was because Parallels did not pay Apple to install its software on Apple’s demo machines. That said, third party softwares are actually pretty hard to find on those demo Macs except for Microsoft Office for Mac.

Civilization IV for Mac

I saw that Civilization IV for Mac was finally released, and a demo version is now available for download. I checked out the specs needed to run the game and was sadly disappointed — it requires a G5 processor or an Intel Mac!

Simulation games are about the only thing I like as far as gaming’s concerned: The SimCity series, Civilization series, Age of Empires series and those Rainbow Six/Rouge Spear military/special forces games. Argh!… But then again it has been 4 years since I got my PowerBook… Damn old Macs…