node.js

How do I escape a string for a shell command in nodejs (V8 Javascript engine)?

In nodejs, the only way to execute external commands is via sys.exec(cmd). I'd like to call an external command and give it data via stdin. In nodejs there does yet not appear to be a way to open a command and then push data to it (only to exec and receive its standard+error outputs), so it appears the only way I've got to do this right ...

Is there a template engine for Node.js?

I'm kind of falling in love with Node.js not because you write app code in javascript but because of its performance. I really don't care a lot about how beautiful a server side language might be but how much requests per second it can handle. So anyway I'm looking forward to experiment building an entire webapp using Node.js (and goi...

Can I use jQuery with node.js?

Is it possible to use jQuery selectors/dom manipulation server-side using node.js? ...

Managing lots of callback recursion in Nodejs

In Nodejs, there are virtually no blocking I/O operations. This means that almost all nodejs IO code involves many callbacks. This applies to reading and writing to/from databases, files, processes, etc. A typical example of this is the following: var useFile = function(filename,callback){ posix.stat(filename).addCallback(function (...

Clientside going serverside with node.js

Hello, I`ve been looking for a serverside language for some time, and python got my attention somewhat. But as I already know and love javascript, I now want learn to code on the server with js and node.js. Now, what books and what subjects do I need to learn to understand the serverside world better? (let me know if Im to vague) ...

node.js callback getting unexpected value for variable

I have a for loop, and inside it a variable is assigned with var. Also inside the loop a method is called which requires a callback. Inside the callback function I'm using the variable from the loop. I would expect that it's value, inside the callback function, would be the same as it was outside the callback during that iteration of the...

What is node.js?

I don't fully get what node.js is all about. Maybe it's because I am mainly a web based business app developer. Can someone please explain what it is and the use of it? Thanks. My understanding so far is that: The programming model is event driven, especially the way it handles IO. It uses javascript and the parser is V8. It can be ea...

How to debug node.js applications

How do I debug a node.js server application? Right now I'm mostly using alert debugging with print statements like this: sys.puts(sys.inspect(someVariable)); There must be a better way to debug. I know that google Chrome has a command line debugger. Is this debugger available for node.js as well? ...

Auto-reload of files in Node.js

Any ideas on how I could implement an auto-reload of files in node.js. I'm tired of restarting the server every time I change a file. Apparently Node.js' require() function does not reload files if they already have been required, so I need to do something like this: var sys = require('sys'), http = require('http'), pos...

Node.js REST framework?

Just got node.js running on an ubuntu server instance. Got a couple of simple server apps running. Does anyone know of any REST frameworks that have been built or are in development? ...

How do I do a deferred response from a node.js express action handler?

Using Express (for node.js) How do I write a response after a callback? The following is a minimal example. posix.cat is a function that returns a promise, up does something to the result, and I want to send that as the response. require.paths.unshift('lib'); require('express'); var posix = require('posix'); get('/', function () { ...

How would MVC-like code work in Node.js?

I'm starting to get my head around node.js, and I'm trying to figure out how I would do normal MVC stuff. For example, here's a Django view that pulls two sets of records from the database, and sends them to be rendered in a template. def view(request): things1 = ThingsOne.objects.all() things2 = ThingsTwo.objects.all() ren...

MySQL 1064 error, works in command line and phpMyAdmin; not in app

Here is my query: select * from (select *, 3956 * 2 * ASIN(SQRT(POWER(SIN(RADIANS(45.5200077 - lat)/ 2), 2) + COS(RADIANS(45.5200077)) * COS(RADIANS(lat)) * POWER(SIN(RADIANS(-122.6942014 - lng)/2),2))) AS distance from stops order by distance, route asc) as p group by route, dir order by distance asc limit 10...

Is there a solution that lets Node.js act as an HTTP reverse proxy?

Our company has a project that right now uses nginx as a reverse proxy for serving static content and supporting comet connections. We use long polling connections to get rid of constant refresh requests and let users get updates immediately. Now, I know there is a lot of code already written for Node.js, but is there a solution that le...

Nodejs in-memory storage

How do i store data to be used for all the clients in my server? (like the messages of a chat) ...

gzip without server support?

I have written a css server which does minimization and basic parsing/var replacement. The server is using node.js. I am wanting to gzip my response from this server. As told in IRC, node.js does not currently have a gzip lib, so I am attempting to do it manually from the command line (as I am only gzipping when not in cache). I am pus...

How do I get started with NodeJS

Is there any good resources to get started with Node.JS? Any good tutorial, blog or books? Of course, I have visited http://nodejs.org/, but I didn't think the documentation they have is a good starting point. Thanks ...

node.js on multi-core machines

node.js looks interesting BUT... I must miss something - isn't node.js tuned only to run on a single process & thread? Then how does it scale for multi-core CPUs and multi-CPU servers? After all, it is all great to make fast as possible single-thread server, but for high loads I would want to use several CPUs. And the same goes for maki...

Node.js as a custom (streaming) upload handler for Django

I want to build an upload-centric app using Django. One way to do this is with nginx's upload module (nonblocking) but it has its problems. Node.js is supposed to be a good candidate for this type of application. But how can I make node.js act as an upload_handler() for Django? I'm not sure where to look for examples? ...

Getting error while running simple javascript using node framework

As i run this peice of code using node a.js: var sys = require('sys'); sys.puts('Hello, World'); it gives an error axconfig: port 1 not active axconfig: port 2 not active I am new to using node..please help ...