I Prefer Jim Developer James Schubert shares his code and his thoughts.

6Feb/12Off

Mastering Node: Addons and FunctionTemplate (uuid.node)

Last night, I pushed an addition to my fork of Mastering Node. I decided to add a bit to the Addons chapter. The first example in this chapter only shows how to add a function to a natively-compiled module (i.e. an addon). This example shows you how to start a module which can be used in the following way:

var Uuid = require('./uuid.node').Uuid;
var uuid = new Uuid();
var myId = uuid.generate();

The project files referenced in the following text can be downloaded from the repo: jimschubert/masteringnode


FunctionTemplate

In v8, a FunctionTemplate is used to create the equivalent to:

var template = function() { }

The function at this point is an object and not an instance of the function.

As an example, we will use the linux package uuid to generate a uuid. We will define the header for this addon as:

flattr this!

9Apr/11Off

[node.js] Mastering Node excerpt: Addons

Addons

The node documentation for addons is self-admittedly pretty weak as of v0.4.0.

This chapter doesn't aim to be a replacement for the official documentation. Instead, we'd hope this can expand on some of the basics a little more than a simple "Hello, World!" and drive you as a developer more on the path toward mastering node through its source code.

In fact, for now, we're only going to cover some shortcuts for creating properties on an object, functions, and interacting with function prototypes. This doesn't reach the evented level of node's awesomeness, but you should be able to look at examples in node's source and the documention for libev and libeio to find answers.

Pre-requisites

* Some C/C++ knowledge
* V8 JavaScript
* Internal Node libraries
* libev
* libeio

hello.node

Our first example is the very same one from node's docs. We're going to include it for those who haven't read through the docs and have instead trusted in the knowledge of this ebook's authors (thanks, by the way).

A node addon begins with a source file containing a single entry point:

flattr this!

6Jan/10Off

Free Software Architecture eBooks on MSDN

Microsoft Application Architecture Guide, 2nd Edition

Enterprise Solution Patterns Using Microsoft .NET

Data Access Architecture Guide

Found via http://apparchguide.codeplex.com/

flattr this!

Tagged as: No Comments
1Nov/09Off

Free Subversion Book by O’Reilly

O'Reilly Media has released a free subversion book, located at http://svnbook.red-bean.com/

It's downloadable as a PDF, single-page HTML and multi-page HTML.

There is also a mercurial book available at hgbook.red-bean.com.

flattr this!

Tagged as: No Comments