Some Thoughts On Netbeans

Posted by Stuart Herbert on March 26th, 2009 in Opinion, Toolbox.

When it comes to IDEs for working on PHP projects, I’ve been a relatively happy user of phpEclipse for several years. (Tried Zend Studio, but never managed to convince Zeev about how much it sucks). But when the guys in the office started switching over to Netbeans, I thought it would be interesting to take a look for myself.

I’ve been using several of the nightly builds on both Linux and OS X for about a month now, after reading on Planet PHP about the UI improvements vs Netbeans 6.5. Apart from one bizarre problem, in general the nightly builds have performed well; I haven’t come across any major bugs in the builds. I don’t care about integrated source control, deployment or Apache management. What I care about is a solid IDE that saves me time, and helps me quickly work with larger PHP projects where I’m not yet intimately familiar with the code.

Positives:

  • Performs well enough … keeps up with my typing.
  • Code completion works more often than not.
  • Doesn’t have the annoying lockups that Eclipse-based editors suffer when they decide to rebuild the project.
  • Code refactoring (BIG time saver) worked every time I tried it.

Drawbacks:

  • A real memory hog – my copy is using half a gig of RAM with just 4 editor tabs open. Ignore the memory usage that displayed inside Netbeans itself (which currently claims 99MB being used); it’s either selective in what it monitors or is just plain fubar.
  • Doesn’t use any native controls on OS X; looks fugly and doesn’t mimic standard OS X dialog boxes or behaviour.
  • Too many dialog boxes; UI could be simplified with in-place editing or just skipping the dialog box completely (a la phpEclipse).
  • No shortage of time-wasting UI design, such as not auto-populating the Find in Projects search field.
  • No context-sensitive help on F1.
  • No bundled documentation for PHP itself.
  • xdebug support no use to me. I was unable to debug a CLI script, and I was unable to debug a website unless I went through the website’s homepage first.
  • phpUnit support no use to me either. To use phpUnit from inside Netbeans, it requires all the tests to be in a separate folder tree. I choose to keep my tests in the same folder as the code under test.

I did find one bizarre problem with it. I was editing code stored on a networked drive whilst on the train, and I went through a blackspot which caused the networked drive to become disconnected. Netbeans did the sensible thing of marking all the open files as read-only, but once I had re-attached the networked drive, I couldn’t then save these files at all. Fair enough, I thought – I’ll just open the file again in another tab and copy and paste my changes across. Sadly, Netbeans wouldn’t actually copy the content of the read-only files into the clipboard at all.

Overall, I feel that Netbeans is a good editor, and I’m still using it every day on Linux (but not on OS X). The IDE features that relate directly to code all appear solid enough. The issues with phpUnit aren’t a big deal for me, but it would be nice to see the xdebug support overhauled and made useful one day.

Just a shame they can’t do anything about the fact it uses Java … 🙂

Be the first to leave a comment »

Zoe invited me to go down to IBM Hursley yesterday to deliver my talk about building Twittex from PHPNW and to also meet the Project Zero team. I had a great time, and the folks from IBM made for a very engaging and collaborative audience. It was particularly nice to meet Ant in person; he’s currently one of the better bloggers about PHP imho and as a community we sure could use more folks writing to his standard 🙂

If you haven’t heard of it before, Project Zero is a new implementation of PHP running on top of J2SE. It gives you the ability to run PHP in an environment that eventually should out-perform the Zend Engine (which will be very welcome here), plus the ability to pull in and make use of many excellent Java libraries that have no equivalent in the PHP world (like, for example, a SOAP client that isn’t a toy …)

Higher performance is important to ISVs in particular, because as you get away from non-trivial apps and get your caching strategy mature, the bottleneck moves from the database back into the amount of CPU available for the web server. Over here in the UK, servers are expensive, and hosting them even more so. There is real money to be saved by not requiring extra servers.

But my personal interest with Project Zero is evaluating it as a platform for API integration and development. Many of the products I need to integrate with are .NET based, and their APIs make a fairly rich use of SOAP. So the first thing I’m going to try with Project Zero is a little app to merge data between our ERP platform and our project management platform – two platforms that PHP’s SOAP client struggles with at best. I’ll let you know how I get on 🙂

Be the first to leave a comment »

Where Are The Benchmarks For Phar?

Posted by Stuart Herbert on June 29th, 2008 in Toolbox.

Derick recently blogged that “phar is cool!” Cool is great … but it doesn’t answer important questions: how does loading your application from a .phar file affect overall performance and scalability? How well does it work with leading bytecode caches?

Where are the benchmarks for phar? 🙂

Be the first to leave a comment »

… as recommended by readers of Planet PHP 🙂

Most Recommendations

There were six Firefox extensions that folks repeatedly recommended …

  1. ColorZilla – advanced eyedropper, color picker, page zoomer and other colorful goodies.
  2. FireBug – live DOM & CSS inspector. The single greatest web developer add-on for Firefox.
  3. Live HTTP Headers – view HTTP headers of a page and whilst browsing.
  4. Web Developer Toolbar – adds a menu and a toolbar with various web developer tools.
  5. YSlow – Yahoo’s tool for analysing web pages and telling you why they are slow. Requires Firebug.
  6. Zend Studio Toolbar – debugging assistance for Zend Studio 5.5 and earlier. Isn’t mentioned on the Zend Studio 6 pages, so does that mean it is now obsolete?

… and after that, there was a lot of variety amongst the other extensions that were recommended.

Also Recommended

  1. Cache Status – easy cache status & management from the status bar.
  2. ChatZilla – IRC client for Firefox.
  3. Duplicate Tab – clone a tab along with its history.
  4. Edit Cookies – edit your cookies right in Firefox.
  5. Fasterfox – performance and network tweaks for Firefox.
  6. Firefox Accessibility Extension – test your web pages for functional accessibility features based on the iCITA HTML Best Practices.
  7. FirePHP – print to your Firebug console using a simple PHP function call.
  8. FireShot – take screenshots of web pages, and a whole lot more.
  9. Google Toolbar – Google’s famous in-browser search toolbar.
  10. GreaseMonkey – customise the way a web page displays using your own Javascript add-ons. See also Lifehacker’s Top 10 Greasemonkey User Scripts, and their Better GMail and Better Flickr add-ons to get an idea of just what can be done with Greasemonkey as a Firefox extension tool.
  11. HTML Validator – add HTML validation to your browser.
  12. IE Tab (Windows only) – open Firefox tabs using IE’s rendering engine. See also the popular IE View alternative.
  13. LocationBar2 – adds additional features to Firefox’s address bar.
  14. Lorem Ipsum content generator – Generate “Lorem Ipsum” dummy text, for when you need to fill a page with content for testing purposes.
  15. MeasureIt – draw out a ruler to get the pixel width and height of any element on the web page.
  16. NagiosChecker – see the status of your services and servers in Firefox’s status bar. You do monitor your servers, right? 😉
  17. PrefBar – power user toolbar for Firefox.
  18. Regular Expressions Tester – testing tool for regular expressions with colour highlighting.
  19. RefSpoof – easy spoofing of the HTTP referrer header.
  20. ReloadEvery – reloads a web page every so many seconds.
  21. Save Session – save your current browser windows & tabs for the next time you open Firefox.
  22. Scrapbook – save web pages locally and easily manage collections. (Like OS X web archives, as supported by Together, DevonThink, and so on, but cross-platform).
  23. Selenium IDE – record, edit and debug tests for Selenium, the automated UI testing tool for web developers. See also PHPUnit’s support for Selenium. You do have reproducible testing for you web apps, right? 😉
  24. Stylish – fix ugly sites, customise the look of your browser or mail client by using your own CSS files. Stylish is to CSS what Greasemonkey is to Javascript.
  25. Tab Mix Plus – tab management on steroids.
  26. Tamper Data – view and modify HTTP/HTTPS headers and POST parameters.
  27. TimestampDecode – treats the selected number as a timestamp and displays a decoded date/time.
  28. TitlebarTweaks – tweak Firefox’s titlebar text.
  29. User Agent Switcher – Adds a menu and a toolbar button to switch the user agent of the browser.
  30. Venkman – Javascript debugger for Firefox.

Stu’s Recommends

To round off the list, here are a few extensions that I find useful, but which weren’t recommended. If you haven’t heard of these before, give them a try.

  1. Flagfox – display a country flag in the status bar for the location of the current website’s server.
  2. Server Switcher – easily switch between development and production servers.
  3. Show MyIP – display your current external IP address.
  4. SQLite Manager – Manage any SQLIte database on your computer.

Are you a web developer? Got a favourite Firefox extension that isn’t on this list? Let us know in the comments below.

Be the first to leave a comment »

When it comes to web development, there’s no doubt that Firefox is king. What makes it king is the large collection of third-party extensions available for it. These days, just about everyone has heard about Firebug, but what other extensions would you recommend to folks who do web development?

Be the first to leave a comment »

What Should An ORM Offer?

Posted by Stuart Herbert on May 8th, 2008 in Toolbox.

I have a question for you: what features do you think a good PHP-centric ORM should offer?

16 comments »

If you’re using the Advanced TinyMCE Editor plugin in WordPress (to replace WordPress’s less-than-stellar WYSIWYG editor), make sure you disable it before upgrading to WordPress 2.5. It isn’t compatible with the latest version of WordPress atm, and you might not need it … WordPress 2.5 includes a revamped WYSIWYG editor that (so far) seems to do a great job.

It even avoids screwing things up in Safari at last 🙂

Be the first to leave a comment »

A Book On Git

Posted by Stuart Herbert on March 25th, 2008 in Toolbox.

Tagged with , , , , ,

Travis has just announced that he’s working on a book about Git, the version control system created for the Linux kernel by Linus Torvalds. This is great news, as there currently isn’t anything else out there in dead-tree form to help folks get up and running with this incredibly powerful distributed version control system.

It’s predicted that workplaces will change over the next ten years, with more and more people telecommuting rather than working in the office. Distributed people mean distributed teams – something that the open source world is already very used to. Git was specifically designed to solve the version control problems that distributed teams maintaining multiple branches face, and it’s slowly but surely gaining popularity amongst folks who’ve found Subversion’s branching and merging too painful to do.

Be the first to leave a comment »

Anyone know of a really great mind-mapping tool for OS X? It’s the one tool I haven’t picked up since buying my beloved MBP in 2006.

What I’m really looking for is something that supports a more 3D approach to mind-mapping than the traditional tools do (which just mimic pen and paper, at the end of the day). I feel constrained with having to hang all the nodes off a single central node – rich detail just doesn’t work like that, where things are much more interconnected. Ideally, it can cope with thousands of nodes, and support storing rich text or HTML in the notes at each node too. (Don’t want much, do I? 🙂

If you’ve got a favourite tool for this job, please leave a comment below. Ta.

9 comments »

More about Performance Tuning

Posted by Stuart Herbert on January 31st, 2008 in Toolbox.

Mike Willbanks recently wrote a good article about performance tuning. There’s some good advice in there, and I thought it’d be a good idea to quickly add a bit more detail about the separate approaches that Mike raises.

Mike recommended using APC for bytecode caching. APC’s pretty good, but just be aware that APC isn’t compatible with Sara’s excellent runkit extension. Xcache is, but some versions of Zend Optimizer refuse to run if they detect Xcache has been loaded. (Btw, Zend Optimizer is worth looking at, but because of the way Zend compile it, it can affect overall scalability. I haven’t sat down yet and worked out whether Zend Optimizer’s performance improvements make up for the cost of how the Linux kernel has to load it into Apache. I touched on the issues with how things are compiled last year, but haven’t followed it up yet with any definitive figures on scalability.)

If you don’t need Zend Platform’s download server (which rocks), then XCache + Zend Optimizer + Memcache out-performs Zend Platform substantially, and costs a lot less too 😉 Zend Platform also isn’t compatible with runkit. It’d be great to see runkit supported better by accelerators.

Memcache is best suited to storing smaller pieces of data. If you’re using it to cache whole XHTML pages, they sometimes don’t fit into Memcache, and need to be cached on disk instead. (Always cache onto local disk, never NFS). Memcache divides the memory allocated to it into different size buckets for performance reasons, and there are far more small buckets than there are large buckets. You can edit the Memcache source code and change the size of the largest bucket before recompiling.

The GZIP trick Mike mentions just isn’t safe with IE6. There are copies of IE out there that fail to decrypt the content correctly alas 🙁 I remember reading a stat that it was about 1% of copies of IE had this bug, but I don’t have the link to hand. I have seen copies of IE with this bug myself. There’s nothing more frustrating than looking at two copies of IE, both reporting exact version numbers, and one copes with GZIPed data whilst the other one doesn’t 🙁 It’s possible that the widespread adoption of IE7 has “fixed” a lot of these buggy IE copies.

I’d recommend placing more emphasis on the Not Modified header, and also on making sure that your code is architected to send back Not Modified headers as quickly as possible. It not only improves per-page performance, but reduces per-page memory usage, and substantially improves scalability. Getting this right can make a huge difference, especially for sites where users normally view more than one page per visit. And make sure the metadata you use to work out whether or not you can send back the Not Modified header is fine-grained enough 🙂

Also, looking at the Not Modified header … don’t take it for granted that Apache is getting this right for your static files. I can’t remember which Apache module disables this off the top of my head (I think it was mod_includes, but I could be wrong), but check the HTTP traffic to make sure your site isn’t sending static files when it doesn’t need to.

With SQL queries of the form “SELECT … FROM table WHERE primaryKey IN ( … )”, be aware that the size of the IN list varies from database server to database server, and it doesn’t take all that big a list before you run into portability problems.

One important thing Mike didn’t touch on was about separating out static files onto a separate box. Apache + mod_php doesn’t serve static files very efficiently. With static files on a separate box, you can recompile Apache to use the “worker” MPM, which serves static files substantially better, or you can use an alternative web server such as lighttpd.

There are plenty of other things you can do to optimise PHP on servers, such as tuning Apache to prevent swapping, tuning the Linux TCP/IP stack to reduce connection failures at peak times, and moving your database off onto a separate box. I’m going to go into these in a lot more detail at a later date.

Finally, xdebug is a fantastic tool for profiling your code and telling you where you have inefficient loops and whatnot. It takes the guesswork out of finding bottlenecks!

Be the first to leave a comment »
Page 8 of 9« First...56789

This Month

January 2018
M T W T F S S
« Jul    
1234567
891011121314
15161718192021
22232425262728
293031