[nodejs] Pass an int to a node.js addon

2012-10-25 Thread NodeNinja
My original c++ function had the following signature unsigned char* random(int length); To use this as an add-on I modified it to Handle random(const Arguments& args) { if(args[0]->IsInt32()){ Local length = args[0]->ToInt32(); // Now here I want to create an array like this "unsigned char

Re: [nodejs] missing module ('through')

2012-10-25 Thread Samuel A
i fix the problem. just been in the wrong directory when i installed the module. thanks On Thursday, October 25, 2012 4:41:37 PM UTC+2, Isaac Schlueter wrote: > > What does `npm ls` output? > > > On Thu, Oct 25, 2012 at 3:01 PM, Samuel A > > wrote: > > > > hello everyone, i need some help her

Re: [nodejs] An idea how to probably improve Date.now() (new Date, etc.) speed.

2012-10-25 Thread Ben Noordhuis
On Fri, Oct 26, 2012 at 5:31 AM, Alexey Kupershtokh wrote: > Currently after removing one excessive call to Date.now makes the other > Date.now call require as much time as all the other logic in setTimeout() + > active() + all the _linklist stuff (L.isempty, L.remove, L.append, etc.). I > think i

Re: [nodejs] An idea how to probably improve Date.now() (new Date, etc.) speed.

2012-10-25 Thread Alexey Kupershtokh
Currently after removing one excessive call to Date.now makes the other Date.now call require as much time as all the other logic in setTimeout() + active() + all the _linklist stuff (L.isempty, L.remove, L.append, etc.). I think it can be better. Looking from another side, Date.now() can be ca

Re: [nodejs] nodejs zlib performance

2012-10-25 Thread Ben Noordhuis
On Thu, Oct 25, 2012 at 7:24 PM, Vadim Antonov wrote: > There're 8 processes (1 per core, created with cluster lib) and every > process has got 6 threads. > Do you have an ETA for the thread pool updates? Is there a way how can we > help you? It's expected to land in v0.10. If you want, you can

Re: [nodejs] An idea how to probably improve Date.now() (new Date, etc.) speed.

2012-10-25 Thread Ben Noordhuis
On Thu, Oct 25, 2012 at 8:48 PM, Alexey Kupershtokh wrote: > This is a relatively often used function in node.js. I think speeding it up > would be great. So I have an idea how to improve it. > What if we could set it every 1 ms to a variable, similar to how --prof > works. > This way we could get

[nodejs] Being able to step through module code while debugging modules

2012-10-25 Thread Axel
I am writing some Node.JS modules and had been using IntelliJ, but I've since discovered that the IntelliJ debugger is unable to actually step through module code and catch breakpoints inside of modules. It essentially just steps into the code of the core modules, but never actually can step in

Re: [nodejs] nodejs zlib performance

2012-10-25 Thread Isaac Schlueter
Yes, it is a bit weird that crypto is sync and zlib is async. It'd be nice if we had a sync zlib API, and could move crypto stuff onto the thread pool, especially for TLS. On Fri, Oct 26, 2012 at 12:49 AM, Jimb Esser wrote: > That is exactly what node seems to do with the zlib API. Though there

Re: [nodejs] nodejs zlib performance

2012-10-25 Thread Dan Milon
Thats out of node's scope. If you've got too much work to do, and too few cores, well, shit get scheduled. Plus, there are a lot of processes already fighting for some CPU juice. Essentially what you're talking here is CPU scheduling. danmilon. On 10/26/2012 02:49 AM, Jimb Esser wrote: > That is

Re: [nodejs] nodejs zlib performance

2012-10-25 Thread Jimb Esser
That is exactly what node seems to do with the zlib API. Though there are times where this is great, this API definitely bothers me, and causes some problems. In theory, if I have a 4 core machine, and have 4 busy node processes, and each of them try to use the zlib API, suddenly I've got 8 c

Re: [nodejs] nodejs zlib performance

2012-10-25 Thread Nathan Rajlich
Jorge, knock it off, seriously. Like Isaac said, actually bring something useful to the discussion otherwise you're blatantly trolling. On Thu, Oct 25, 2012 at 2:38 PM, Jorge wrote: > Hi Isaac, > > He could pipe uncompressed output from node process A onto compressor node > process B. That's the

Re: [nodejs] nodejs zlib performance

2012-10-25 Thread Mark Hahn
> He could pipe uncompressed output from node process A onto compressor node process B. Could he use buffers? Would that be faster? What is the overhead of the piping compared to the compressing? I assume it would be minor. On Thu, Oct 25, 2012 at 2:38 PM, Jorge wrote: > Hi Isaac, > > He cou

Re: [nodejs] nodejs zlib performance

2012-10-25 Thread Mark Hahn
> Are you saying that node, internally, delegates CPU intensive work to background threads? What the heck are you talking about? There is no such feature and there shouldn't be. Are you just trolling? If so, quit it. On Thu, Oct 25, 2012 at 2:26 PM, Jorge wrote: > Are you saying that node, i

Re: [nodejs] nodejs zlib performance

2012-10-25 Thread Jorge
Hi Isaac, He could pipe uncompressed output from node process A onto compressor node process B. That's the Node Way®, isn't it? Or, he could do it all in a single node process, but that would mean delegating CPU intensive jobs to background threads, the mere idea of which is something that unn

Re: [nodejs] nodejs zlib performance

2012-10-25 Thread Jorge
Are you saying that node, internally, delegates CPU intensive work to background threads? Heresy! -- Jorge. On 25/10/2012, at 23:22, Vadim Antonov wrote: > We don't use threads by ourselves. It's default nodejs zlib library > implementation. > -- > Vadim > > On Thursday, October 25, 2012 2:

Re: [nodejs] nodejs zlib performance

2012-10-25 Thread Isaac Schlueter
Jorge, Please do not make snarky remarks about Node on this mailing list. If you have a problem with something, bring it up in a new thread. If you have something to add to this thread, then please do so, but this is not helpful. On Thu, Oct 25, 2012 at 10:15 PM, Jorge wrote: > Threads are ev

Re: [nodejs] nodejs zlib performance

2012-10-25 Thread Mikeal Rogers
Seriously? How do you read this stuff before you send it and not think you're a troll? On Oct 25, 2012, at October 25, 20122:15 PM, Jorge wrote: > Threads are evil™, don't use threads. > > The Node Way® (just don't ask) is to pipeline processes as in the good ol' > 70s. Flower Power, peace a

Re: [nodejs] nodejs zlib performance

2012-10-25 Thread Vadim Antonov
We don't use threads by ourselves. It's default nodejs zlib library implementation. -- Vadim On Thursday, October 25, 2012 2:16:35 PM UTC-7, Jorge wrote: > > Threads are evil™, don't use threads. > > The Node Way® (just don't ask) is to pipeline processes as in the good ol' > 70s. Flower Power,

[nodejs] Version 0.8.14 (Stable -- Bugfix for 0.8.13 EventEmitter regression)

2012-10-25 Thread Isaac Schlueter
Note: v0.8.13 contains a regression in the EventEmitter class. This is a bugfix release, but contains no new features. Most of the release notes are copied from v0.8.13, since it didn't live long. 2012.10.25, Version 0.8.14 (Stable) * events: Don't clobber pre-existing _events obj in EE ctor (

Re: [nodejs] nodejs zlib performance

2012-10-25 Thread Jorge
Threads are evil™, don't use threads. The Node Way® (just don't ask) is to pipeline processes as in the good ol' 70s. Flower Power, peace and love bro, and etc. Cheers, -- Jorge. On 25/10/2012, at 19:24, Vadim Antonov wrote: > There're 8 processes (1 per core, created with cluster lib) and ev

Re: [nodejs] long running operation

2012-10-25 Thread Ryan Schmidt
On Oct 25, 2012, at 05:34, Alessandro Arnodo wrote: > I need to create a feature that download about 100 images from 100 different > url, put the imahes into a zip file, and notify user with an email when the > job is done. > As nodejs single threaded, how can i achieve this without blocking se

[nodejs] Re: Version 0.8.13 (Stable)

2012-10-25 Thread Isaac Schlueter
Unlucky 13, it seems. There's a gnarly regression here that affects npm. Patch coming shortly. On Thu, Oct 25, 2012 at 8:55 PM, Isaac Schlueter wrote: > 2012.10.25, Version 0.8.13 (Stable) > > * V8: Upgrade to 3.11.10.25 > > * npm: Upgrade to 1.1.65 > > * url: parse hostnames that start with -

[nodejs] Version 0.8.13 (Stable)

2012-10-25 Thread Isaac Schlueter
2012.10.25, Version 0.8.13 (Stable) * V8: Upgrade to 3.11.10.25 * npm: Upgrade to 1.1.65 * url: parse hostnames that start with - or _ (Ben Noordhuis) * repl: Fix Windows 8 terminal issue (Bert Belder) * typed arrays: use signed char for signed int8s (Aaron Jacobs) * crypto: fix bugs in Diffi

[nodejs] An idea how to probably improve Date.now() (new Date, etc.) speed.

2012-10-25 Thread Alexey Kupershtokh
This is a relatively often used function in node.js. I think speeding it up would be great. So I have an idea how to improve it. What if we could set it every 1 ms to a variable, similar to how --prof works. This way we could get real time with 50-100 times less impact that it has now. So how st

Re: [nodejs] Weak references. Does node-weak and other simliar libraries, add significant overhead?

2012-10-25 Thread Rick Waldron
Also, take a look at these... http://wiki.ecmascript.org/doku.php?id=strawman:weak_references http://wiki.ecmascript.org/doku.php?id=strawman:weak_refs Perhaps there is something that can built on top of, or an aspect you can prove/disprove? Rick On Thu, Oct 25, 2012 at 1:03 PM, Nathan Rajlich

Re: [nodejs] Weak references. Does node-weak and other simliar libraries, add significant overhead?

2012-10-25 Thread Rick Waldron
On Thu, Oct 25, 2012 at 1:03 PM, Nathan Rajlich wrote: > Rick, is there a template for proposals I should base it off of? > Not really, a gist in markdown will be more then sufficient. Include a rationale (this is probably the easiest part) and ideally a summary of your experience with weak refs

Re: [nodejs] nodejs zlib performance

2012-10-25 Thread Vadim Antonov
There're 8 processes (1 per core, created with cluster lib) and every process has got 6 threads. Do you have an ETA for the thread pool updates? Is there a way how can we help you? Thank you. -- Vadim On Wednesday, October 24, 2012 5:41:36 PM UTC-7, Ben Noordhuis wrote: > > On Thu, Oct 25, 2012

Re: [nodejs] Re: Use of Node / Express / MongoDB for a e-commerce website?

2012-10-25 Thread Dan Milon
Still, postgres foreign tables do not support SQL transactions, which you'd need for an e-commerce product. But its definitely interesting. On 10/25/2012 06:58 PM, Stephen Handley wrote: > re: the idea of using sql for some transactions and mongo for an object > store > > http://www.citusdata.c

[nodejs] Problem using redis + MULTI - hiredis

2012-10-25 Thread Andrea Baccega
Hello All, i'd like to know if Some of you have the same problem. The issue is the following: Using the following setup: - Node v0.8.12 - node_redis - redis server ( tried 2.6.0 and 2.4.17 ) And being sure to not use hiredis. I get random issues using MULTI. Basically the test is com

Re: [nodejs] Weak references. Does node-weak and other simliar libraries, add significant overhead?

2012-10-25 Thread Nathan Rajlich
Rick, is there a template for proposals I should base it off of? On Wed, Oct 24, 2012 at 12:38 PM, Rick Waldron wrote: > WeakRefs are on the table for ES6... if someone here wants to write up a > proposal (I'm looking at Nate) I will gladly champion it at the next TC39 > meeting. > > Rick > > > O

Re: [nodejs] long running operation

2012-10-25 Thread Tim Caswell
Also, all of node's network APIs are non-blocking, so it's impossible to truly block the CPU on network waits. The work you'll need to do is have code to manage all the parallel requests and not doing too many at once, handling errors, and combining the results when done. There are many node modul

Re: [nodejs] Re: Use of Node / Express / MongoDB for a e-commerce website?

2012-10-25 Thread Stephen Handley
re: the idea of using sql for some transactions and mongo for an object store http://www.citusdata.com/blog/51-run-sql-on-mongodb http://www.craigkerstiens.com/2012/10/18/connecting_to_redis_from_postgres/ http://wiki.postgresql.org/wiki/Foreign_data_wrappers -- Job Board: http://jobs.nodejs.o

Re: [nodejs] Weak references. Does node-weak and other simliar libraries, add significant overhead?

2012-10-25 Thread Fredrik O
I have created a new thread for this, see: https://groups.google.com/forum/?fromgroups=#!topic/nodejs/p7kfwcbJBxE Den onsdagen den 24:e oktober 2012 kl. 20:15:49 UTC+2 skrev Marco Rogers: > > Can you elaborate on "domains just feel wrong". I'm interested in how the > domains api comes across. I'

[nodejs] RAII as a complement to error handling, to handle large resources which must do some clean up

2012-10-25 Thread Fredrik O
Marco Rogers wanted me to elaborate on "domains just feel wrong" in another thread. In this thread will some of that. Let me start. I have a module "pool" there I use weak references to handle when one of its returned object get out out of reach: function foo() { var resource = pool.create()

Re: [nodejs] missing module ('through')

2012-10-25 Thread Isaac Schlueter
What does `npm ls` output? On Thu, Oct 25, 2012 at 3:01 PM, Samuel A wrote: > > hello everyone, i need some help here. > > I'm trying to do this: >> >> > var request = require('request') > , JSONStream = require('JSONStream') > , es = require('event-stream') >> >> > > but i get this error: > >

[nodejs] missing module ('through')

2012-10-25 Thread Samuel A
hello everyone, i need some help here. *I'm trying to do this*: > > var request = require('request') , JSONStream = require('JSONStream') , es = require('event-stream') > > *but i get this error:* module.js:340 throw err; Error: Cannot find module 'through' i did: > npm install through

Re: [nodejs] Re: Sample code to add basic authentication to node http server

2012-10-25 Thread Dan Milon
Basic Auth does not use cookies. After you provide the credentials, its up to the browser to stop sending the Authentication header. Usually that happens after a browser restart. Try private browsing. danmilon. On 10/25/2012 04:16 PM, gng wrote: > Sorry, I should have been more specific: I have r

Re: [nodejs] Re: Sample code to add basic authentication to node http server

2012-10-25 Thread Angel Java Lopez
AFAIK, basic authentication data trips on an HTTP header, not using a cookie According to http://en.wikipedia.org/wiki/Basic_access_authentication Existing browsers retain authentication information until the tab or browser is closed or the user clears the history.[1]

[nodejs] Re: Sample code to add basic authentication to node http server

2012-10-25 Thread mscdex
On Oct 25, 9:16 am, gng wrote: > Is there anything that I'm missing ? The way I understand things is that on > clearing any set cookies, you should be challenged each time the page is > next visited. Why do you have this line?: server.use(express.basicAuth('test','testpass')); -- Job Board: htt

[nodejs] Re: Sample code to add basic authentication to node http server

2012-10-25 Thread gng
Sorry, I should have been more specific: I have removed cookies (even restarted the browser) but I do not get challenged again. Is there anything that I'm missing ? The way I understand things is that on clearing any set cookies, you should be challenged each time the page is next visited. On

[nodejs] Re: Sample code to add basic authentication to node http server

2012-10-25 Thread greelgorke
check your cookies. flushing cache has no effect on cookies. Am Donnerstag, 25. Oktober 2012 14:31:53 UTC+2 schrieb gng: > > Thanks. I added that so my code now looks like :- > > var express = require('express'); > > var server = express.createServer(); > > server.use(express.basicAuth('test','tes

[nodejs] Re: Sample code to add basic authentication to node http server

2012-10-25 Thread gng
Thanks. I added that so my code now looks like :- var express = require('express'); var server = express.createServer(); server.use(express.basicAuth('test','testpass')); io = require('socket.io').listen(server); io.set('log level', 1); // reduce logging server.use(express.static(__dirname + '

[nodejs] Re: Sample code to add basic authentication to node http server

2012-10-25 Thread greelgorke
http://expressjs.com/api.html#basicAuth Am Donnerstag, 25. Oktober 2012 11:23:08 UTC+2 schrieb gng: > > Hi, > > Can anyone provide some sample code to show how a node http server can be > secured using basic username/password authentication. Here's my sample > server :- > > var express = require

Re: [nodejs] long running operation

2012-10-25 Thread Ben Noordhuis
On Thu, Oct 25, 2012 at 12:34 PM, Alessandro Arnodo wrote: > Hello, > I need to create a feature that download about 100 images from 100 different > url, put the imahes into a zip file, and notify user with an email when the > job is done. > As nodejs single threaded, how can i achieve this withou

[nodejs] Sample code to add basic authentication to node http server

2012-10-25 Thread gng
Hi, Can anyone provide some sample code to show how a node http server can be secured using basic username/password authentication. Here's my sample server :- var express = require('express'); var server = express.createServer(); server.use(express.static(__dirname + '/public')); server.listen

[nodejs] long running operation

2012-10-25 Thread Alessandro Arnodo
Hello, I need to create a feature that download about 100 images from 100 different url, put the imahes into a zip file, and notify user with an email when the job is done. As nodejs single threaded, how can i achieve this without blocking server and user navigation? Maybe i need to manage this

Re: [nodejs] Re: Use of Node / Express / MongoDB for a e-commerce website?

2012-10-25 Thread mlegenhausen
@tedsuo good that you say it that directly. If someone had say it to me I hadn't build a ecommerce system on mongo. It is a myth that mongo increases productivity. Of cause the first steps will go faster, cause mongo simply has less features. You don't need to define schemas, don't have to thing