Archive for the ‘Node.js’ Category.

Top 10 Posts of 2011

Following in the trail blazed by the likes of Cal Evans and Chris Cornutt, I decided to post a list of the posts on this blog that have received the most traffic this year along with some related commentary. However, in the spirit of Charles St. Michael, I decided to up the number of posts from three to 10. So, here we go:

10. Building PHP-GTK with Cairo Support on Ubuntu Jaunty – 2009-04-25

Very interesting that this post was in the running at all. It’s over two years old, goes back five Ubuntu versions, and deals with PHP 5.3.0RC1 (current is 5.4.0RC4) and PHP-GTK when Cairo support was relatively new. (There’s now a separate PECL extension for it now.) If you want to learn more about this, you should definitely check out Elizabeth Smith and Michael Maclean.

9. Renaming a DOMNode in PHP – 2010-02-09

It seems this isn’t as uncommon a problem as I would have thought. Sadly, in the 22 months that have passed since I authored the post, it seems the DOM extension hasn’t been updated further to support the DOM 3.0 standard or the renameNode() method mentioned in this post.

8. PHP_CodeSniffer Article in php|architect – 2011-04-28

It’s nice to see this post get attention even if was just a brief hand-waving to point people to the article, which is one of two I wrote for php|architect Magazine this year. It’s also nice to see that despite being seen by some as a more menial facet of quality assurance, other people consider it important enough to read the article and take something away from it.

7. ‘New SPL Features in PHP 5.3’ Hits php|architect – 2011-02-01

Another post that was just hand-waving to an article that dealt with a topic I saw as underrated. The article followed my php|tek 2010 session and preceded a Zend webinar this year on the same topic.

6. Process Isolation in PHPUnit – 2010-08-19

Between views and comments, it seems I wasn’t the only one who ran into this head-scratcher. However, if memory serves, I think there are plans to remove this feature from PHPUnit in future versions.

5. Node.js: A Beginner’s Perspective – 2010-10-19

The post is about a year old now, and sadly I haven’t done anything of merit with Node.js since (though I hope to change that), but it seems the community is still as vibrant and growing as it ever was. Heck, you can even integrate PHP-FPM with Node via FCGI now. Node is definitely a technology to continue keeping your eye on if you don’t already use it.

4. PHPUnit and Xdebug on Ubuntu Karmic – 2010-01-03

It’s surprising that this post is still relevant since there have been four Ubuntu releases since the version that this post deals with. I’ve since moved over to Fedora 16, at least for now, and it seems to address most of my regular needs. I may look at other distributions like Mint later on.

3. Models in Zend Framework – 2010-03-26

Even though it’s over a year old now, I think this post gets the traffic it does because there’s not really one prescribed way to build models and because the existing documentation describes a number of components that can be used to build models, but doesn’t really offer specific guidance on how to approach it. Bit of a double-edged sword, I suppose.

2. New SPL Features in PHP 5.3 – 2010-05-20

I published this post on the same day that I gave my session on the topic at php|tek 2010. It’s one of my longer and more content-rich posts and I’ve updated it on occasion as I’ve had cause to update the benchmarks that go along with it. Good to see that interest in SPL seems to be rising.

1. Database Testing with PHPUnit and MySQL – 2010-01-04

While I love that this post is driving as much traffic to my blog as it is, I do want to get around to contributing related documentation to the PHPUnit project. Hopefully that will happen soon. In the meantime, you can also read more about this topic in the Testing chapter of my most recent book.

So, one big take-away from this post has been that most of my high-traffic posts were written last year rather than this year. I can’t say it’s very surprising since, looking back, a number of my posts from this year were of the hand-waving variety. I’m hoping to publish more content-rich posts more frequently in 2012. I won’t call it a resolution, because I’d likely be jinxing myself in the process, but I will say that I’ll make my best attempt.

Best wishes to everyone in the new year.

Node.js: A Beginner’s Perspective

I’d been curious about node.js for a while. Finding Twitter all atwitter about it at any particular moment isn’t difficult. People are experimenting with it and other JavaScript technologies, like WebSockets. Yahoo even showcased a multi-core HTTP server written in it a few months back. I already had a decent working knowledge of JavaScript. (If you don’t, check out Eloquent JavaScript or Crockford’s JavaScript to get up to speed.) So, I decided to poke my head in, see what all the hype was about, and share my experiences for any others considering doing the same. Here are my lessons learned.

Have at least a basic working knowledge of git. A significant number of node.js projects are hosted exclusively on github. While you can grab the source code by downloading an archive, it can make getting the latest updates tedious (compared to a few simple git commands) and makes it a lot more difficult to contribute back to those projects. Also, users of node.js and git seem to be of similar mindsets, so if you’re familiar with one community, chances are you’ll be comfortable in the other. There tends to be a good bit of overlap as well.

Look around for existing solutions. Don’t succumb to NIH Syndome, especially not just because of the project’s young age compared to some much older languages. The plethora of existing software written for it is pretty amazing. Good examples include the npm package management system, which can be very helpful in installing and distributing node.js packages, and nodeunit, a great simple unit testing framework. Regardless of what supporting library or tool you might need, you’ll probably find at least one option already available.

Seek out good resources. The project docs are pretty good. The community blog How to Node has lots of info on node.js topics. Follow the #nodejs Twitter hash tag or Delicious nodejs tag. Talk to others using node.js. It’s got a large and lively community of enthusiastic people doing cool cutting-edge stuff. For example, most non-library projects will probably need to be backed by a data source of some type. Whether you want to use MySQL or MongoDB, node.js can handle it. If you get stuck, post your query to the mailing list.

Don’t forget what language you’re using. While node.js hasn’t been around but a few years and isn’t a language in and of itself, JavaScript is very well-established and has plenty of existing libraries already available. node.js runs on V8, the same JavaScript engine that powers Google Chrome. If you can’t use your favorite library in node.js, there are probably already similar alternatives that people will readily suggest.

Most people know me as being a PHP developer. Don’t think this means that I’m abandoning it in favor of node.js. This was mostly just a small foray to explore another development platform. I’ll likely be keeping my eye on it, but it’s not likely to become my primary skillset anytime soon.

If you’ve used node.js, please post a comment. I’d love to hear about your own experiences and what resources you have to suggest for new users like me who are looking to get their hands dirty.