Categories
Technology Writing

Node: References and Resources

Recovered from the Wayback Machine.

During my explorations of Node.js, I came across many excellent resources, references, tutorials, and various other online publications related to the technology. I had planned on incorporating this material into an appendix for Learning Node but decided it would make a better online resource than a book chapter.

Every person interested in Node should start with the Node.js web site, as well as the web site for npm, the application that manages Node module installations:

If you’re interested in Node in a Windows environment, you might a little extra help in getting set up. I recommend the following resources:

There’s an enormous number of resources for the Node.js newbie, including basic tutorials and entire online books. I know there are more than what I discovered, but the following is a good start:

One person, Felix Geisendörfer, has provided several excellent online resources for new and experienced Node folks:

As you learn Node, you’ll hear about the Node event loop. The following are a couple of good articles on the event loop:

REPL is the Node interactive stand alone application. REPL stands for Read-Eval-Print-Loop. Following are good REPL resources:

Modules are the heart and soul of Node.js. It can be an interesting experience finding Modules, because you need to look carefully among the many available to see which are the ones currently supported, and which have, more or less, been abandoned. Luckily, there are good Node module resources:

A good rule of thumb about which module to use is check for recent activity in the module’s repository. Are there outstanding issues? Pull requests that have gone unanswered for a long time? Also do a Google search, see who is using the module, for what, and how recently.

For more on npm, itself, do check out the Developer guide. Also spend some time understanding the differences between global and local installation of modules.

Node is based on the CommonJS model. If you want to learn more about CommonJS, I recommend Taking baby steps with Node.js–CommonJS and creating custom modules.

The heart of the module system is the package.json file. Nodejitsu provides an article and a couple of good cheat sheets related to package.json and npm:

Peter Krumin did a great series of articles on Node.js Modules you should know about. Several of my favorite are included in the list.

If you work with Node, and you write modules, chances are you’re going to become intimately involved with EventEmitter. The following are good EventEmitter resources and references:

Control flow is a big topic of interest for Node developers:

There are good frameworks for Node, but I focused on Connect/Express. I felt that Express was more Node-like, and requires less upfront time than the other frameworks. That’s not to say there weren’t challenges with Express, as it went from Express 2.x to Express 3.x and then back down to Express 2.x, but one adapts. I focused on Express 3 in the book.

Connect is the middleware layer for Express. TJ Holowaychuk provides an introduction to Connect 2 at Connect 2.0. The Express web site is at Express.com, though note that the documentation is still focused on Express 2. For the Express 2 developer, check out the Migrating from 2.x to 3.x guide. Mike Valstar writes specifically about Express error handling and 404 pages.

I grew fond of Redis when working with Node.js. The Redis site is at redis.io. Redis is nicely documented, at the site and in the Little Redis Book.

Following are other articles and links of interest, in no particular order or grouping:

Hack Sparrow article on running Express application in a production environment http://www.hacksparrow.com/running-express-js-in-production-mode.html. Charlie Robbins provides a how-to on distributing Node.js apps with Hook.io at http://blog.nodejitsu.com/distribute-nodejs-apps-with-hookio. More on the Hook.io module at http://ejeklint.github.com/2011/09/23/hook.io-for-dummies-part-1-overview/.

Rasmus Andersson wrote a Template for setting up Node.js-backed web apps on EC2 at http://rsms.me/2011/03/23/ec2-wep-app-template.html. Another writing on setting up Node on Amazon EC2 from Ben Nadel at http://www.bennadel.com/blog/2321-How-I-Got-Node-js-Running-On-A-Linux-M….

A XSS (Cross Site Scripting) Cheat Sheet can be found at http://ha.ckers.org/xss.html. Another cheat sheet, this time on SQL Injection at http://ferruh.mavituna.com/sql-injection-cheatsheet-oku/.

Heroku provides instructions on how to create a self-signed SSL certificate at https://devcenter.heroku.com/articles/ssl-certificate-self. Another tutorial on the same subjec. at http://www.akadia.com/services/ssh_test_certificate.html.

I don’t cover backbone.js in the book, but an article on combing it with MongoDB, Mongoose, and Restify can be read at http://backbonetutorials.com/nodejs-restify-mongodb-mongoose/.

A comparison of Redis and Cassandra http://hammerprinciple.com/databases/items/redis/cassandra. More on Apache Cassandra at http://cassandra.apache.org/. Redis is compared with Memcached at http://webdevrefinery.com/forums/topic/8221-memcached-vs-redis/. The Memcached web site is at http://memcached.org/.

Guillermo Rauch’s Use Jade Blocks, not Layouts, at http://www.devthought.com/code/use-jade-blocks-not-layouts/.

Curl is your friend when testing RESTful applications. Some helpful examples at http://www.yilmazhuseyin.com/blog/dev/curl-tutorial-examples-usage/.
The Ruby on Rails routing guide applies equally well to Node: http://guides.rubyonrails.org/routing.html.

Charlie McConnell wrote an article on “How to use stream.pipe” at http://docs.nodejitsu.com/articles/advanced/streams/how-to-use-stream-pipe.

One of the better, more thorough answers I’ve seen at Stack Overflow is the answer to “What is the Difference between proxy server and reverse proxy server” at http://stackoverflow.com/questions/224664/difference-between-proxy-serve….

Guillermo Rauch wrote a multipart tweet filtering proxy, beginning with Part 1 at http://www.devthought.com/2012/01/24/filtering-tweets-for-your-favorite-….

Shravya Garlapati at LinkedIn, wrote a very helpful article, Blazing Fast node.js: 10 performance tips from LinkedIn Mobile http://engineering.linkedin.com/nodejs/blazing-fast-nodejs-10-performanc….

The Async module can be found at https://github.com/caolan/async. More on the creation of Async at http://caolanmcmahon.com/posts/asynchronous_code_in_node_js.

The Step module is located at https://github.com/creationix/step.
There is promise support in Node with Q at https://github.com/kriskowal/q, and deferred https://github.com/medikoo/deferred, as well as Futures https://github.com/coolaj86/futures.

Yes, you can use Node modules with client-side JavaScript with help from RequireJS at http://requirejs.org/. And you can scrape web pages using Node, jQuery, and Jsdom, with a little help from this article http://liamkaufman.com/blog/2012/03/08/scraping-web-pages-with-jquery-no….

Since Node is based on the CommonJS model, read more about CommonJS at http://www.commonjs.org/. An interesting article on Node, CommonJS, and custom modules by Jan Van Ryswyck can be found at http://elegantcode.com/2011/02/04/taking-baby-steps-with-node-js-commonj….

A Nodejitsu article on using the Process module can be found at http://docs.nodejitsu.com/articles/getting-started/the-process-module. More on Node and processes by at http://dailyjs.com/2012/03/22/unix-node-processes/.

More on TCP Socket Programming in Node.js at http://www.hacksparrow.com/tcp-socket-programming-in-node-js.html. A general article on TCP vs. UDP can be found at http://www.skullbox.net/tcpudp.php. More on UDP Networking at http://twistedmatrix.com/documents/current/core/howto/udp.html.

If you’re curious about the performance differences between using process.nextTick and setTimeout, you can view benchmark tests at https://gist.github.com/1257394.

Categories
Books

Learning Node: Raw

Evidently, O’Reilly is going to publish my Learning Node book as a Rough Cuts/Early Release.

What people should know is that the material has not gone through a final edit, a copy edit, or a tech review. So yes, there will be typos, gotchas, and oopsies. Probably lots and lots of oopsies. But the advantage to getting a Rough Cut is you get the work early, but still get the finished product when it’s complete.

I decided not to have an Appendix with all the links. This kind of material doesn’t really suit a book; it’s more appropriate for a web page. I’m in the process of converting this rich material into an online source page, which I’ll post at Tech at Burningbird when finished.

I’ll also publish a “lessons learned” from the book. Bottom line, though, is that I like Node. I think it really fills a need. What I love most about Node are child processes. I had a lot of fun with these during the book’s development. I’m definitely fond of child processes—that, and how easy it is to install and incorporate modules. The whole infrastructure just cuts through so much server-side cruft. I don’t like server-side cruft. There’s a reason I’m not a C or C++ developer.

I’ve also become a real fan girl of Redis. We have needed a Redis for years. I’m also more amenable to web sockets now, especially since the security issues have been addressed.

Categories
Diversity HTML5

Homogeneity

homogeneity: noun

composition from like parts, elements, or characteristics

Not long ago, Molly Holzschlag tweeted an innocuous comment:

I’d love to see a woman or group of women edit the HTML5 spec. It’d make for an interesting social experiment. Certainly would be a first.

I re-tweeted her without additional comment, and that started a sequence of responses that surprised me in their vehement rejection of “positive discrimination”—as if the only way that women could possibly be involved in editing the HTML5 spec is because of the result of some kind of reverse discrimination.

Craig Grannel caught the byplay and sent me an email asking if I’d be willing to be interviewed for .net magazine, not only about the tweets, but comments I made about the W3C and sexism. Discussions on this topic have not gone well in the past, and I didn’t expect any positive dialog from this interview, but as the saying goes: hope springs eternal.

The interview appeared in Call for greater diversity in web community. I thought that Craig did a decent job of taking my disjointed thoughts and punching them into a coherent whole, but I also decided to publish my full comments. There were a couple of points I made in my response that I wanted to emphasize.

> – How do you think the HTML WG would benefit from female leadership, or, at least, more women being involved? In what ways do you think the “dynamics of an all male leadership” have been negative?

I can’t give you a sound bite, because there is a back story to these communications. I guess I’ll have to trust that what I write will either not be used, or won’t be used in such a way as to cause more problems.

Women are underrepresented in the tech field, but they’re even more underrepresented in W3C working groups. Even with the recent addition of a woman to the TAG group, men in leadership positions in the W3C and in W3C working groups is disproportionate.

Unfortunately, women also underrepresented among the W3C representatives from the browser companies, which is why I believe the HTML WG is so badly skewed towards the masculine.

The group’s entire focus the last few years has been on basically giving the WhatWG members representing a few of the browser companies whatever they want. The procedures put in place to demonstrate a more “egalitarian” viewpoint have actually done the opposite.

If you’ve followed along the effort over the years, the debacle over the longdesc attribute, an accessibility aid, is representative of how badly the change process procedures have failed.

And that might be one key to some of the problems women have had in the group. Most of the women participating in the HTML WG have come in from the accessibility movement, and the people interested in accessibility have long been recipients of disdain and derision–typically expressed outside the group, true, but impacting on group dynamics.

However, what happens in public concerns me less than what happens in private. I’m not the only woman who has received a “tsk tsk, must behave better” email from the HTML WG chairs and members. The chairs say they’ve sent emails of like nature to guys, too, but there’s a different flavor to the communications–a patronizing tone that just sets my teeth on edge.

One time, I addressed some of my concerns in an email to www-archives–the dump hole for W3C communications–about my perceptions of sexism in the HTML WG group, and a W3C staff member wrote me to chastise–literally chastise me–telling me that he showed the communications that led to my emails to his girlfriend. and she didn’t see anything sexist about them.

As if we women all think alike, like some kind of single celled organism that shows absolutely no differentiation.

Tell me something: do you think the exact same thing as all the men you know? Do you perceive writings the same way? Do you all share the exact same opinions? Then why the heck would any of you expect the same from women?

I actually did formally complain to W3C leadership about my concerns about the HTML WG and underlying, subtle sexism, and their handling of the complaint was appalling. They turned around and communicated my complaint to the HTML WG co-chairs, one of whom sent me a blistering email in response. It was impossible to work with the group after that, and I’ve had little respect for the W3C management since.

Now I’m greatly concerned, because I’m seeing the same disdain and patronizing attitude directed to an HTML WG member who has been with the group for years, fighting for accessibility. I’ve watched her become disillusioned, and go from being an active, engaged member, to someone who rarely participates at all.

It’s not right.

Can more women in leadership help? I honestly can’t say whether we could or not, but I’d like to think it would help to have more women in positions of responsibility and authority. At a minimum, we couldn’t make it any worse that what it is. Frankly, the group is too homogeneous. It really doesn’t represent the broader Web community.

> – You said: “How about encouraging more women to get involved, rather than chasing out most who were?” What did you mean by that? (Note: from some of the responses in your feed, I can certainly infer, but it’d be good to get your thinking on this.)

I don’t want to speak for other women, I can only speak for myself.

I left the HTML WG group. I just couldn’t handle the emails telling me to behave, the chastisement, as if I’m a little girl and they’re all Daddy. I have better things to do with my time than be condescended to.

What’s been frustrating about my decision to leave, though, is people telling me now that “If you don’t like what’s happening with HTML5, get involved”, when I was involved at one time, and had to leave.

What’s even more frustrating is an attitude I see from many men and women involved in technology, especially as it relates to the W3C: unless a guy points out that sexism exists, it doesn’t exist.

Sexism isn’t always overt. It isn’t always some guy showing a slide with a naked woman’s bum during a tech conference. Sexism can be as much slow erosion as sudden explosion. Women feeling as if we’re ignored, that we’re patronized, that our contributions weigh less–sexism is as much about subtle perception, as it is about blatant acts.

In my opinion, the W3C, in general, and the HTML WG, in particular, have problems with sexism.

And every time I say this, I get slammed. So here we go again.

Ian Devlin wrote what I felt was a disappointing response to the .net magazine article.

What I did have issue with however, was what I saw as the implied notion that a woman would be better at doing the job of HTML5 editor simply because of her sex.

Isn’t that just as bad as saying that a man would be better at the task at hand simply because he is a man? Such a comment would, quite correctly, cause uproar. Granted the implication probably wasn’t intended, but I think that it was this perceived attitude that started the debate.

No one ever implied that women would do better just because we’re women. This was never said: in Molly’s comment, in my responses, or in the article. The real focus in all of the remarks was on the lack of diversity in the W3C leadership and among the working groups. Not only are women not well represented, but even among the men there is little diversity. Those who have defined the HTML5 spec display a remarkable similarity in thought and opinion, matched only by an almost complete lack of empathy.

Could women help? Good lord, we couldn’t make matters worse.

There’s a second component to my comments, though, that I wanted to re-emphasize: that sexism isn’t always overt acts. In fact, I don’t really care about overt sexism. Acts of this nature tend to self-implode, and they don’t need me to light a match. No, it’s the subtle form of sexism that bothers me. As I wrote in the interview response, subtle forms of sexism erode over time. There is rarely anything anyone can point to and say, “Aha! Sexism!” But in the back of your mind, there exists a feeling that no matter what you do or say, you won’t be heard, your concerns will not be addressed, your input really isn’t welcome.

You just kind of drift away.

Even now, when we have a fresh opportunity to discuss the issues, to address the lack of diversity in the W3C, our concerns are rejected as “positive discrimination”. That’s the same as saying how dare we hit that fist with our face.

Just as an aside: I did volunteer to be a co-editor of HTML5, back in 2008, I believe it was. My offer was rejected.

Categories
Critters

Is the puppy mill fight over?

Good question: is the puppy mill fight over?

Rabbit Ridge is still in business. It starved a dog to death, and it’s still in business.

http://www.stltoday.com/news/local/metro/where-did-missouri-s-puppy-mill…

Categories
Media Specs

Mozilla reluctantly embracing H.264

Recovered from the Wayback Machine.

Interesting doings this week on the HTML5 video front.

Brendan Eich of Mozilla has stated the organization will now provide native support for H.264. In Video, Mobile, and the Open Web (also cross-posted at his personal web site), Eich writes:

What I do know for certain is this: H.264 is absolutely required right now to compete on mobile. I do not believe that we can reject H.264 content in Firefox on Android or in B2G and survive the shift to mobile.

Losing a battle is a bitter experience. I won’t sugar-coat this pill. But we must swallow it if we are to succeed in our mobile initiatives. Failure on mobile is too likely to consign Mozilla to decline and irrelevance.

Douglas Perry in Tom’s Guide writes:

For Google, Mozilla’s complaint is a dent for the credibility of the Chrome strategy and the pro-open source campaign. If Mozilla drops WebM entirely, WebM is practically dead. Firefox isn’t significant in market share on mobile devices, but it is the 25 percent wild card on the desktop. Google will only be able to help WebM survive with the support of Mozilla, which gives Google/Mozilla about 55 percent of the total browser market (according to StatCounter). Without Mozilla, WebM drops to 30 percent and H.264 rises to 70 percent of the market.

On her blog, Mitchell Baker writes:

For the past few years we have focused our codec efforts on the latter part of this sentence. We’ve declined to adopt a technology that improves user experience in the hopes this will bring greater user sovereignty. Not many would try this strategy, but we did. Brendan’s piece details why our current approach of not supporting encumbered codec formats hasn’t worked, and why today’s approach regarding existing encumbered formats is even less likely to work in the future.

Andreas Gal, director of Mozilla research, sums it up:

Google pledged many things they didn’t follow through with and our users and our project are paying the price. H.264 wont go away. Holding out just a little longer buys us exactly nothing.

Google has only its self to blame if (when) WebM follows Betamax and HDD into tech oblivion.