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!

Refuge

Most people don’t realize just how impossible it is to work at home in peace, especially when everyone else is also at home. But even when nobody is at home to bug you, there’s still plenty of distractions:

“Have I paid the electric bill yet? I better do that now.”
“What’s that sound in the living room? Did one of the cats knock something off? I better go check it out.”
“Did the postman just drop off the mail? I better go get that…”
“Why doesn’t the neighbor pick up her phone? It rings so damn loud…”

It’s especially tough this month because my mom’s visiting, and I basically gave our spare bedroom, a.k.a. “my office”, to her and work on our dinning table in the kitchen where it’s almost impossible to work because Grace and mom watch Korean drama, marathon style. Besides, mom is always doing stuff in the kitchen when she’s not watching Korean drama with Grace… Then there’s Bryan playing with his toys just 3 feet away in the living room right next to me.

With my latest project being 2 months overdue, and I am under tremendous pressure to “show” something in 3 days, I have had to “escape” from the house and find refuge elsewhere to concentrate and just crank out codes. At first I tried the library, but then it’s almost eerily quiet after having been in a house where there’s always something going on.

The most unlikely refuge, I found out, is the Mall, of all places, the most crowded and noisy space. The interesting thing about the mall though, specifically Vally Fair Mall in Santa Clara, is that the music is always blasting in full volume (which I never noticed before). The crowd and the noise actually help me concentrate even more. It’s like I find peace in my little 15.4″ laptop screen in a massive crowd where I intended to find refuge away from a small crowd at home. What an oxymoron.

Just a couple of months ago I debated really hard whether or not to rent a small corner office for a few hundred bucks a month just so that I have a place to go and just focus on my programming, homework and everything else. But I just couldn’t justify having to spend that kind of money when we are trying to save every penny we can being in the situation that we are in.

The mall then becomes an interesting choice because it has no distractions (as long as I don’t lift my head up from the screen), no trivial household tasks to take care of, even going to the bathroom is inconvenient. And it’s got free wifi connection right next to the Sony Store where there are lots of seats, tables and even power outlets. So there, about the only thing I can do is bury my head in my thoughts and programming logics and just work.

The joke between me and Grace now is: if you ever need me, I’ll be in my “office” at the mall…. Hah!

Safari Unable to Load Nested xhmHttpRequest Objects!

I started a project where I used pure CSS and Ajax on the interface, like how Google implemented the Gmail interface. But soon it was clear that Safari’s handling of Ajax and dynamic DOM element updates is very limited.

I created a “div” tag on the base page to load various sections of the website into it using xmlHttpRequest object. Where Safari (and Shiira as well as Opera) failed was when I started loading a separate page into another “div” tag that was dynamically created by the “div” tag created by the base page. At first the problem persisted only within my application. But then I was able to recreate the problem by making a bare application just to load one “div” tag into another.

So basically, Safari is unable to recognize nested HTML elements created by xmlHttpRequest…. Or so my theory goes.

Yuck…

UPDATE 08.02.2006: I tested using a plain javascript to load DOM elements into each other without Safari complaining. So one can assume the issue is only with loading DOM elements via xmlHttpRequest or that the particular method I am using makes Safari very unhappy.

Perl and More Perl

Finally finished another intensive 4-day course in more advanced Perl this week. I have to say that Perl gets a little disappointing in the more advanced level. Making an object/class is kind of painful compared to more modern scripting language like PHP. And the CGI portion gets more ugly when it comes to having to edit multiple files in different directories…. or one can venture into using the dreadful CGI package. But luckily there’s Mason which runs on the server side and makes everything very PHP-like. Unfortunately it requires separate installation. And I am doubtful of its support on most web hosting services.

In any case, I am still glad I got to know as much Perl as I did. It’s another tool in my arsenal of scripting/programming languages for future gigs. Next on my list, C, C++, Java, Ruby on Rails, and hopefully someday, Objective-C/Cocoa!

Internet Explorer Woes

I probably wrote about this before… But I am going to rant about it again…

Microsoft Internet Explorer SUCKS ASS! And the engineers who came up with versions 5.0, 5.5 and 6.0 should go to hell and stay there.

It’s probably not entirely their fault that IE has sucked ever since its inception. For what its’ worth, Netscape 4.x sucked so bad that it skipped 5.0 and went straight to 6.0, which help contributed the collapse of the once great Netscape empire.

That said, how much IE has sucked in the past 6 or 7 years since the fall of Netscape just goes to show that monopoly in any given technological field DOES harm innovation. Had Netscape stayed (or Firefox came out earlier), IE wouldn’t have stayed sucky for 3 versions straight with little to no improvements in each version.

On top of that, they are so broken that developing web interfaces for them is virtually impossible. I have had perfectly coded sites working with all other major browsers BUT IE! So that meant I have had to come up with hacks and work arounds just to make things work for IE, which is so damn non-compliant with standards in a very ugly way… And like I said, people who keep using IE to surf the web aren’t helping with the cause either… (why anyone would use IE to surf the web is beyond me… it’s so tied in with the operating system that any hacker going through IE, which is nortoriously known for its suckiness in security, can practically get the entire computer fried… figuratively speaking).

I had this beautifully written pure css sytle sheet design that worked perfectly in Firefox and Safari, but as soon as IE sees it, all hell broke lose. So now I gotta use stupid tables just so that I don’t have to waste time tweaking the css just for damn IE.

A lot of comments in codes I have read often include phrases like ”

1
/*fix for stupid IE*/

“, or ”

1
/*hack for stupid IE*/

“… With the intorduction of IE7 beta, which I have tried, things aren’t getting better. I hopte Firefox will just run IE over and Steve Ballmer can just run Microsoft to ground (at which he’s already doing a pretty good job) so that we will never have to deal with another inferior, buggy Microsoft product again, EVER!

God damn! Microsoft… Seriously… Go to hell with IE! Damn it…
.
.
.
.
There, I vented. I can’t stress just how pissed I can get working with Microsoft technology at times… Sometimes I wish I can just choke Steve Ballmer into fixing these damn problems in IE. I guess I should probably document some of the issues I have dealt with and solutions I found/discovered/made (thanks, solely, to Google… no thanks to MSN).

An interesting side note… while working with Murdza on a mass mail campaign, the project redered out perfectly in EVERYTHING but Hotmail… So I had to find fixes just for stupid Hotmail… It’s no accident that Hotmail is another inferior product of Microsoft’s that way too many ignorant people are still using as if it’s oxygen for their lungs… Fricking convert to Gmail or Yahoo Mail already… damn it…

Stupid Microsoft…

My First Ajax Program

I finally got my fist Ajax program to work the way I wanted it to… It’s like getting my first PHP (or, Cocoa, or C++… etc*) program to do “Hello World” (only Ajax is slightly more complicated than simply doing

1
echo "hello world"

in PHP)… the excitement!

Now maybe I can finally solve a couple of the long standing problems I have been trying to crack with this project I have been working on…

Yay!

* I never really got anywhere with Cocoa, C++ or even Perl… never had to use them for anything; only if Neely can get me a freelance project to work with Cocoa or Objective-C, then I’ll probably have to do a crash course on it with a month… then my dream of being able to write apps for Mac OSX would be complete…

Programming on OSX with Objective-C

Slashdot effect takes center stage again as geeks from all over the world discuss Apple’s Xcode and Objective-C (a variant of C; a quick and dirty how-to here).

It all started with a simple email exchange between one programmer with Steve Jobs:

From: Nitesh Dhanjani
Subject: Re: Will XCode+ObjC ever suck less?
Date: December 25, 2005 5:27:02 PM CST
To: *****@apple.com

I look forward to the improvements! Thanks,

Nitesh.

On Dec 25, 2005, at 5:10 PM, Steve Jobs wrote:

I guess we disagree. First of all, .NET with CLI and managed code runs SLOW, so most serious developers can’t use it because of performance. Second, the libraries in C# are FAR less mature and elegant than those in Cocoa. We are working on a better implementation for garbage collection than we’ve seen out there so far, but in the end its a performance hit and an unpredictable time that is not good for some kinds of apps.

Steve

On Dec 25, 2005, at 2:36 PM, Nitesh Dhanjani wrote:

Objective C is old and clunky. Its almost 2006, and I _still_ have to look out for yucky pointers? I’d love to be able to write native apps with Ruby (or even C#!.) There are open community projects in progress that are trying to bind ruby and C# (mono) with Cocoa, but I’d love for Apple to step in and make this happen faster. Today, Microsoft seems to be _way_ ahead of the development curve – with their .NET implementation, you are allowed to code using a plethora of languages (C#, Python, VB, etc), as long as the interpreter/compiler follows the IL specification – pointers don’t matter, garbage collection is done for you – ah the beautiful world of managed code.

Having said that, most native OSX apps are still beautiful and well designed. Imagine how much better we could do if the developers had a more flexible choice of languages? I can _bet_ you a lot of OSX app developers use Objective C because they have no other choice.

Nitesh.

On Dec 25, 2005, at 3:11 PM, Steve Jobs wrote:

Actually, Objective C is pretty great. Its far nicer than most other ways of writing apps. What don’t you like about it? What do you like better?

Steve

On Dec 25, 2005, at 11:59 AM, Nitesh Dhanjani wrote:

Hi Steve

Will it ever be easy to write native OSX GUI apps? Objective C sucks.

Thanks,
Nitesh.

More geeks talking about it here.

It’s been said that Steve Jobs has a team of secretaries that comb through all his emails on a daily basis. I guess he ain’t taking chances on important messages. But it’s gratifying to see Jobs himself working on Christmas day having replied to this Nitesh guy several times throughout the day. Impressive stuff. Being a geek, a perfectionist and a workaholic at the same time can pay off sometimes.

Internet Explorer Got No Style

Homework from my “Human-Centered Interactive Design” class at SCAD’s e-Learning program is killing me. I wonder how I ever survived being a full time student at SCAD before. I like the class and all, but the amount of work has been overwhelming on top of my classes from UC.

The main motivation behind this post is to complain about Microsoft (again). The latest project is to implement an interface I designed into a working flow of wireframes. That’s the easy part. But inevitably, it was so easy to take that extra step to style the template just a little nicer since I am using CSS for everything anyway. And boy, what a bitch Microsoft Internet Explorer is to style for. Elements/styles that work for other browsers just don’t work on stupid IE. I guess this is not news for anyone who’s worked with CSS for longer than a few hours. But it’s annoying as hell.

Since I was checking my homework via Windows IE, I also checked out my blog to see how everything looks since I did quite a few improvements. Sure enough, the announcement tag line for Bryan’s new pictures below the header was somehow under a white block. A trip to the stylesheet fixed that. But again, it’s annoying. I wish Microsoft can stop being so damn cocky and start conforming to the web standards already. Jackasses.

Blog Interface Update

I added a header with navigation to kind of unify all the misc links I thought were better served as top navigation elements. So I consolidated them. I also commented out “Pages” section on the sidebar.php since it looked kind of annoying. But basically, those pages are exactly the same as what’s on the top nav anyway.