C++ Global _CRT_SECURE_NO_WARNINGS Apr 16, 2012 I became extremely annoyed by thousands of these messages while running MSBuild: c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\string.h(105) : see declaration of 'strcpy' SomeFile. ...
Ubuntu: Open With… Wireshark Mar 23, 2012 Reading through Practical Packet Analysis, I ran local captures to follow along until Chapter 5. Instead of trying to simulate an improperly-dissected packet, I downloaded the captures which accompany the book. ...
C# Null-Coalescing (??) operator Mar 19, 2012 The null-coalescing operator (??) is one of my favorites, and I see so few developers using it. MSDN defines the null-coalescing operator as ...
My Review of Accessible EPUB 3 Feb 23, 2012 Originally submitted at O’Reilly <div> <img src="https://images.powerreviews.com/images_products/05/49/15318982_100.jpg" class="photo" align="left" style="margin: 0 0.5em 0 0" /></p> <p style="margin-top:0"> Best Practices for Creating Universally Usable Content </p> </div> <p> <a href="http://shop. ...
git push: fatal: unable to read SHA1 Feb 21, 2012 Today, I was faced with an interesting error in a git repository. I am backing up a lot of old projects from during and after college into a private git repo. ...
My Review of Learning Perl, 5th Edition Feb 18, 2012 Originally submitted at O’Reilly <div> <img src="https://images.powerreviews.com/images_products/06/14/5204063_100.jpg" class="photo" align="left" style="margin: 0 0.5em 0 0" /></p> <p style="margin-top:0"> Making Easy Things Easy and Hard Things Possible </p> </div> <p> <a href="http://shop. ...
My Review of CLR via C#, 3rd Edition Feb 18, 2012 Originally submitted at O’Reilly <div> <img src="https://images.powerreviews.com/images_products/00/88/7284232_100.jpg" class="photo" align="left" style="margin: 0 0.5em 0 0" /></p> <p style="margin-top:0"> CLR via C#, 3rd Edition </p> </div> <p> <a href="http://oreilly. ...
My Review of Node for Front-End Developers Feb 11, 2012 Originally submitted at O’Reilly <div> <img src="https://images.powerreviews.com/images_products/05/49/14267351_100.jpg" class="photo" align="left" style="margin: 0 0.5em 0 0" /></p> <p style="margin-top:0"> Writing Server-Side JavaScript Applications </p> </div> <p> <a href="http://shop. ...
My Review of McCullough and Berglund on Mastering Advanced Git Feb 7, 2012 Originally submitted at O’Reilly <div> <img src="https://images.powerreviews.com/images_products/01/34/15258733_100.jpg" class="photo" align="left" style="margin: 0 0.5em 0 0" /></p> <p style="margin-top:0"> McCullough and Berglund on Mastering Advanced Git </p> </div> <p> <a href="http://shop. ...
Mastering Node: Addons and FunctionTemplate (uuid.node) Feb 7, 2012

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:

...