| CARVIEW |
Realtime Performance Visualizations using Node.js
This article outlines how to create a realtime heatmap of your syscall latency using HTML5, some great node modules, and DTrace. It was inspired by talk that Bryan Cantrill and Brendan Greg gave on Joyent's cool cloud analytics tools. While specific, the code provided could easily be adapted to provide a heatmap of any type of aggregation Dtrace is capable of providing.
Read more...Node.js and Redis Pub-Sub
Read more...This is the 7th in a series of posts leading up to Node.js Knockout on how to use node.js. This post, cross-posted from GitHub, was written by James Bracy, founder of Redis To Go. Redis To Go is a dead simple solution for managed Redis instances.
Creating safe and composable 'mixins' with traits.js
In this article I will introduce traits.js, a small library to define, compose and instantiate traits. Traits are reusable sets of properties and form an alternative to multiple inheritance or mixins.
Read more...Learning Javascript with Object Graphs (Part III)
Part I of this series explained basic object graphs and visually described references, closures, and basic inheritance in JavaScript. Part II compared different styles for doing object-oriented programming in JavaScript. Now in Part III we'll get creative and look as Ruby's object model and compare it to how JavaScript works. Also I'll show how to implement some Ruby style classes. JavaScript is a very flexible language and can support about any object model you want with enough understanding and creativity.
Read more...Learning Javascript with Object Graphs (Part II)
The first article using graphs to describe JavaScript semantics was so popular that I've decided to try the technique with some more advanced ideas. In this article I'll explain three common techniques for creating objects. They are constructor with prototype, pure prototypal, and object factory.
My goal is that this will help people understand the strengths and weaknesses of each technique and understand what's really going on.
Read more...Learning Javascript with Object Graphs
One of the secrets to being a super effective JavaScript developer is to truly understand the semantics of the language. This article will explain the basic elemental parts of JavaScript using easy to follow diagrams.
Read more...Testing your JavaScript with shoulda.js
The last thing you want this weekend is to be introducing bugs at 4:30PM on Sunday as you frantically hack in more functionality. One way to avoid that risk is to write some tests for your critical, stable bits. If you have time this weekend to hack on unit tests in between the red-bull-induced coma and the confused debates about sockets vs. ports (unlikely!), shoulda.js will help you get up and running very quickly.
Shoulda.js is a micro javascript unit testing framework inspired by Thoughtbot's Shoulda for Ruby. It gives you a tight syntax for writing terse, readable unit tests. It weighs in at under 300 lines and makes no assumptions about your javascript environment or libraries.
Read more...Capturing Packets in JavaScript with node_pcap
OK, I hear you. Capturing packets is hard and best left to kernel hackers, assembly language programmers, and black hat security researches. If you just want to make things for the web using node.js, why should you care?
Pulling packets off the network can show you what your computers are saying to each other without disrupting the flow of or changing any applications. Packet capture is a fantastic debugging tool that will remove a lot of the mystery from writing and running network programs. The point of node_pcap is to provide a good HTTP debugging tool and a framework for doing your own network analysis.
There are plenty of ways to do packet inspection these days, but none of them let you interact with your network traffic the way that node lets you write network programs: by writing a few event handlers in JavaScript. node_pcap not only let's you capture and process packets in JavaScript, but since it is built on node.js, data from the packets can be easily routed around to web browsers, databases, or whatever else you can think of.
Intro to Jake - JavaScript build tool for Node.js
Jake is a JavaScript build program for Node.js, with capabilities similar to GNU Make or Ruby's Rake. If you've ever built projects with Rake, you'll be very at home using Jake
Jake has the following features:
- Jakefiles are in standard JavaScript syntax
- Tasks with prerequisites
- Namespaces for tasks
- Async execution of tasks
Websockets everywhere with Socket.IO
If you've stayed on top of the advances in the realtime web for the past few years, you've probably heard of different techniques aimed to reduce the latency (ie: speed) of the message exchange between a client and a server. If you're developing a multiplayer game, a chat application, or showing frequent updates of data like tweets or stock price changes, you probably want to reverse the traditional model of communication. So instead of requesting (polling) data on a specific interval of time, you want the server to send (push) data to the client.
Nowadays, terms like long polling, comet and WebSocket come to mind when it comes to developing a realtime web application or widget. But it's not always obvious how they work, their advantages, disadvantages and limitations, or even what percentage of the web browser market share supports them.
Socket.IO is a lightweight API that runs on the browser and looks like this:
var socket = new io.Socket();
socket.on('connect', function(){
// connected!
});
socket.on('message', function(msg){
// message coming
});
socket.send('Hello world!');If you're familiar with WebSocket, the protocol that aims to simplify bi-directional communication over HTTP once and for all, you'll notice that it looks very similar. The difference is that Socket.IO, under the hood, will enable realtime communication for IE6-9, Firefox 3-4, Safari 3-5, Chrome 3-6, iOS (iPhone and iPad), and other commonplace user agents.
Twinkle Twinkle Little Meryl
This article will get you into the little world of Meryl, which is a minimalist web framework built on nodejs. With its small sized code base, it is very simple to use, fun to play and easy to modify. Unlike other full-stack web frameworks, Meryl tries to keep some core features minimal and powerful and leave the rest for you. With about 140 lines of core code Meryl implements some basic fundamentals of web application building blocks while letting users to build their own web applications as flexible as it could. Please visit Meryl homepage for more details.
Read more...Node.js and MongoDB
This was the sixth in a series of posts leading up to Node.js Knockout on how to use node.js. This post was written by 10gen and is cross-posted from their blog.
10gen is the corporate sponsor of MongoDB. MongoDB bridges the gap between key-value stores (which are fast and highly scalable) and traditional RDBMS systems (which provide rich queries and deep functionality).
Read more...An Introduction to Geddy
This was the fifth in a series of posts leading up to Node.js Knockout on how to use node.js. This post was written by geddy author and Node.js Knockout judge Matthew Eernisse.
Geddy is a modular, full-service web framework for Node.js, similar to Merb, Rails, Pylons, or Django.
Geddy provides a lot of great features:
- Flexible, robust router with easy RESTful routing (router docs)
- Intelligent content-negotiation (content-negotiation docs)
- Models and validations(model docs)
- Simple, intuitive views with partials support
- Generator utility for easy creation of apps and scaffolding
Debugging with node-inspector
This was the fourth in a series of posts leading up to Node.js Knockout on how to use node.js. This post was recorded by node-inspector author and Node.js Knockout judge Danny Coates.
Read more...Introduction to npm
This was the third in a series of posts leading up to Node.js Knockout on how to use node.js.
npm is a NodeJS package manager. As its name would imply, you can use it to install node programs. Also, if you use it in development, it makes it easier to specify and link dependencies.
Read more...About HowToNode.org
HowToNode.org is a community supported blog created by Tim Caswell. The purpose of the blog is to teach how to do various tasks in node.js as well as teach fundamental concepts that are needed to write effective code.
This site is powered by Wheat, a git based blogging engine written in node.JS.
The content for this site is stored in a git repository that anyone can fork, write an article, and send a pull request. If your article passes the quality standards it will be published and help support the greater node community.
Articles
- Realtime Performance Visualizations using Node.js by Geoff Flarityv0.4.0
- Node.js and Redis Pub-Sub by James R. Bracyv0.2.0
- Creating safe and composable 'mixins' with traits.js by Tom Van Cutsem
- Learning Javascript with Object Graphs (Part III) by Tim Caswellv0.2.4
- Learning Javascript with Object Graphs (Part II) by Tim Caswellv0.2.3
- Learning Javascript with Object Graphs by Tim Caswellv0.2.2
- Testing your JavaScript with shoulda.js by Phil Crosby
- Capturing Packets in JavaScript with node_pcap by Matt Ranney
- Intro to Jake - JavaScript build tool for Node.js by Matthew Eernisse
- Websockets everywhere with Socket.IO by Guillermo Rauch
- Twinkle Twinkle Little Meryl by Kadir Pekelv0.1.102
- Node.js and MongoDB by Node Knockoutv0.2.1
- An Introduction to Geddy by Matthew Eernissev0.2.1
- Debugging with node-inspector by Danny Coatesv0.2.1
- Introduction to npm by Isaac Z. Schlueterv0.2.1
- Getting Started with Express by TJ Holowaychukv0.2.1
- How to Install Node.js by Node Knockoutv0.2.1
- Flow Control in npm by Isaac Z. Schlueter0.2.0
- Demystifying events in node.js by Kenny Shenv0.1.102
- Shoutbox with Grasshopper and CouchDB by Chandra Sekar Sv0.1.103
About HowToNode.org
HowToNode.org is a community supported blog created by Tim Caswell. The purpose of the blog is to teach how to do various tasks in node.js as well as teach fundamental concepts that are needed to write effective code.
This site is powered by Wheat, a git based blogging engine written in node.JS.
The content for this site is stored in a git repository that anyone can fork, write an article, and send a pull request. If your article passes the quality standards it will be published and help support the greater node community.

Site Design and code is © 2010 to Tim Caswell under the MIT license. Content and articles are copyrighted to the individual authors. All code snippets used in the examples are in the public domain.
Wheat running on node v0.2.3