I am Hack Sparrow
Captain of the Internets.

Archive for October, 2011

Form submission with iframe target opens in a new Window

Give the iframe a name attribute. This is the proper way of submitting a form through a named iframe. [code] <form action="/upload" method="post" enctype="multipart/form-data" target="uploader_iframe"> <input type="file" name="image" /> <input type="submit" /> <iframe id="uiframe" name= ...

Using Node.js to download files

There are three approaches to writing a file downloader app using Node - i. HTTP.get, ii. curl, iii. wget. I have created functions for all of them. To get the examples working makes sure you have the dependencies and app variables intact. Read the comments thoroughly, you will not only learn how to download files, but will also learn more about Node's child_process, File System, Buffers, and Streams. Let's start with HTTP.get. ...

Install Node.js and NPM on Windows

[notice] UPDATE Feb 1, 2012: This article is fairly outdated now. Node.js installs right into the Windows system now, no need for moving files, setting path etc. If Node path is not detected, do a restart. [/notice] [notice] UPDATE: NPM now comes bundled with Node.js which can be installed using an MSI - get it here. No more headache of installing NPM separately on Windows. [/notice] Well, Nod ...

TCP Socket Programming in Node.js

Eager to know how sockets are programmed in Node? There are three variants of sockets in Node - i. TCP, ii. UDP, iii. UNIX domain. In this particular post, I will show you the basics of TCP socket programming in Node.js. There are two categories of TCP socket programs you can write - i. server, ii. client. A TCP server listens for connections to it from clients and send data to the client. A TCP client connects to a TCP server exchange data with ...

The MongoDB Tutorial

Even as I write this, there are numerous MongoDB tutorials on the Web, including the official one at www.mongodb.org. They all have a big problem - they all suck. They are either a headache to follow, or miss the basics, or are extremely hard to absorb information from. I want to change that, I want to create the best ever MongoDB tutorial on the Web - a tutorial that efficiently focuses on orienting users to MongoDB. While this tutorial is not g ...