node.js

How do I use Node.js modules?

Hey, I recently installed Node.js on a fresh Linode box, and I think I'm in a weird situation where I can't use require() to load any thrid party modules. I've installed npm and have successfully installed modules via npm, but whenever I try to require one of the modules (or just some of my own code in the same directory), Node throws a...

Can't configure node.js for make install on OS X (Snow Leopard)

I cloned the node git repo but the "waf" build tool that comes with node seems to not work with the latest version of Python. $ ./configure Traceback (most recent call last): File "/Users/greim/nodestuff/node/tools/waf-light", line 157, in <module> import Scripting File "/Users/greim/nodestuff/node/tools/wafadmin/Scripting.py", ...

Node.js Web Application examples/tutorials...

So I finished watching Douglas Crockford's excellent series on Javascript, and in the final episode (so far), loopage he lays out why Node.js is a near perfect solution for server side code. He talks about keeping state, not in the database, but in closures running in Node.js, he also states that templating systems (like JSP, PHP, and A...

Socket.IO / Node.JS / Rails 3 / IE

This is a bit complicated but here goes. I have a Rails app that has a small JS widget that gets updated on some backend processing stuff. The Rails app queues up a job in Redis (via Kthxbye) which gets processed and then once completed, fires off a redis publish message. This channel is being watched by a Node.JS server which is respon...

Download Tar File via NodeJS

I have two nodejs http servers, one requests a tar file from the other. It works fine via browser testing, but I can never get the second server to glue the chunks together correctly. My attempts with fwrite has been as useless as this // Receives File var complete_file = ''; response.on('data', function(chunk){ complete_file += chu...

iPhone and Node.js, multiple packets in single read

I feel like I'm doing this wrong, or it's just a result of my novice with sockets. I'm using asyncSocket on the iPhone to send data to node.js. My problem is that every so often, the app will hang, and then I'll get like 5 or 10 messages at once in one data read, rather than separate, more timely reads. Is this a network hiccup and the ...

stackvm: qemu on localhost:5900 died

I am trying to run StackVM. I am running Ubuntu 10.04 LTS in a VirtualBox. I have installed all the prerequisites for running StackVM as listed here. AQemu and other qemu packages are also installed. I have added one simple linux image (linux-0.2.img) which is available on qemu's site When I open stackvm in a browser and try to run th...

What is the scope of javascript callback and anonymous functions?

I have written the following code using node.js and riak-js. I have a recursive function walk that should be a list of JSON documents, but instead returns an empty list... why? how to fix? require('riak-js'); var walk = function(bucket, key, list){ if(list == undefined){ var list = new Array(); } db.get(bucket, key)(functi...

Require() wrapper in node.js?

I try to include a .js file in my app with node require(), but get this error. Any idea? a.js : function a() { this.a = 'a'; } Node application : require(./a.js); var test = new a(); Error: /Users/.../app.js:14 var test = new a() ^ ReferenceError: a is not defined ...

Is there a browserless websocket client for Node.js that does not need to use a browser?

Socket.IO, etc all require the using of browser on the client side....just wondering, how can we have browserless websocket client for node.js ? ...

What is the Haskell response to Node.js?

I believe the Erlang community is not envious of Node.js as it does non-blocking I/O natively and has ways to scale deployments easily to more than one processor (something not even built-in in Node.js). More details at http://journal.dedasys.com/2010/04/29/erlang-vs-node-js and http://stackoverflow.com/questions/3011317/node-js-or-erla...

storing a mongoose (node.js orm) query result

Hi, is there anyway to do something like var first_user = User.find({ _id: user_id }).first(); using the mongoose ORM? http://github.com/LearnBoost/mongoose What I'm trying to do is store the returned result of the query for later use. When I use the above all I get returned into the "first_user" var is the QueryWriter object. Ho...

node.js misconceptions?

From the node.js page "Almost no function in Node directly performs I/O, so the process never blocks. Because nothing blocks, less-than-expert programmers are able to develop fast systems." so if a less than expert programmer does something like start an infinite loop in the callback, it doesn't kill the system (eventually)? or, more ...

How can I use an http proxy with node.js http.Client?

I want to make an outgoing HTTP call from node.js, using the standard http.Client. But I cannot reach the remote server directly from my network and need to go through a proxy. How do I tell node.js to use the proxy? ...

Starting Node with God with sudo

I need to start a Node.js server as the root user (using sudo) with a start param that looks like: w.start = "sudo node #{KTHXBYE_NODE_ROOT}/poll.js" As I am using Socket.IO and need the use of Flash Sockets (which requires Node.js to be run as root). However, whenever I startup God, it fails to start node. I've tried running God wit...

Any Easy to extend Web-based File Manager for node.js?

Want to find one and modify that to read, write file on mongoDB gridfs store ...

Suggestions for dealing with `exports` in node.js

Theory: One of the things that appeals to me about node.js is using it as a command line tool. In theory, I can write libraries in Javascript and place them in my ~/.node_libraries directory, and then then I can reuse those libraries. So for instance, I have a text.js in ~/.node_libraries, and it has a bunch of text-related function...

Node.js return result of file

I'd like to make a node.js function that, when calls, reads a file, and returns the contents. I'm having difficulty doing this because 'fs' is evented. Thus, my function has to look like this: function render_this() { fs.readFile('sourcefile', 'binary', function(e, content) { if(e) throw e; // I have the content here...

nodejs (nodejs.org/) experience / comments

Has anyone experience with nodeJS? how about performance? memory management? I'm looking for a technology that allows me to create a real-time web app tracking system and a chat. If you considered and decided to don't use it, what did you use? Thanks in advance. ...

Node.JS and MySQL drivers

Is there a Node.JS Driver for MySQL that is commonly used other than http://github.com/masuidrive/node-mysql ? This driver is unstable (says the creator). It seems like there is not much activity with node.js database drivers. Is there a reason for this or is it just because Node.JS is so young? ...