Re: [node-dev] __proto__ vs. Object.create?

2012-06-08 Thread Oleg Efimov (Sannis)
Very bad... This trick is the only one way I found to inherit from class exported by binary addon. пятница, 8 июня 2012 г., 16:35:12 UTC+4 пользователь Tim Smart написал: __proto__ is marked for depreciation in upcoming ecmascript specs. I think that is the most common reason you might find.

[node-dev] context (thisness) to EventEmitter#on, process.nextTick, etc

2012-06-08 Thread AJ ONeal
I would like to propose that an additional parameter, `context` be added to core node modules that accept callbacks to give this-ness to the callback. The reason being is that I'm trying to eliminate anonymous callbacks from my code and have generally cleaner, more readable code (as well as lower

Re: [node-dev] context (thisness) to EventEmitter#on, process.nextTick, etc

2012-06-08 Thread AJ ONeal
Yes, That's what I am suggesting. AJ ONeal On Fri, Jun 8, 2012 at 12:17 PM, Tim Caswell t...@creationix.com wrote: So this proposal is to modify the API of all async functions to have an extra thisp argument after the callback argument (like done in Array.prototype.forEach)? On Fri, Jun

Re: [node-dev] context (thisness) to EventEmitter#on, process.nextTick, etc

2012-06-08 Thread Tim Caswell
I think it's a useful addition, but it does cause a little overhead (though it's probably not noticeable compared to the actual work the async function is doing). EventEmitters might feel the pain since they are sync. I do worry that it makes things harder for our argument guessing code that

Re: [node-dev] context (thisness) to EventEmitter#on, process.nextTick, etc

2012-06-08 Thread AJ ONeal
If you're going to use `this` then you must have a callback. It would make no sense to have a `this` and nothing to apply it to. You think EventEmitters would feel the overhead of the if? // context is Array, Object, or Function. // Numbers, Strings, and Booleans need not `apply` (very

Re: [node-dev] context (thisness) to EventEmitter#on, process.nextTick, etc

2012-06-08 Thread Tim Caswell
Actually event emitters already call in the scope of the emitter, so there is no need for a specific this value there. Just subclass EventEmitter and use normal methods. On Fri, Jun 8, 2012 at 1:34 PM, AJ ONeal coola...@gmail.com wrote: If you're going to use `this` then you must have a

Re: [node-dev] context (thisness) to EventEmitter#on, process.nextTick, etc

2012-06-08 Thread AJ ONeal
emitter.on('data', myModule.dataHandler, myModule); Even if myModule were to subclass EventEmitter, wouldn't I still need to pass in the `myModule` instance so that I get the correct `this`? I don't think I understood what you meant by that. And then these cases as well:

[node-dev] Re: context (thisness) to EventEmitter#on, process.nextTick, etc

2012-06-08 Thread tjholowaychuk
what's wrong with .bind() ? On Jun 8, 11:52 am, AJ ONeal coola...@gmail.com wrote:     emitter.on('data', myModule.dataHandler, myModule); Even if myModule were to subclass EventEmitter, wouldn't I still need to pass in the `myModule` instance so that I get the correct `this`? I don't think

Re: [node-dev] Re: context (thisness) to EventEmitter#on, process.nextTick, etc

2012-06-08 Thread George Stagas
No need to change the API, we have .bind() - use the language features, don't reinvent them. 2012/6/8 Tim Caswell t...@creationix.com: On Fri, Jun 8, 2012 at 2:10 PM, tjholowaychuk tjholoway...@gmail.com wrote: what's wrong with .bind() ? Mainly the overhead.  Bind creates a new function

Re: [node-dev] Re: context (thisness) to EventEmitter#on, process.nextTick, etc

2012-06-08 Thread AJ ONeal
If I'm not mistaken, bind() has the same technical drawbacks as using an anonymous function (higher memory usage, more garbage collection, and slower says Tim), but it does solve the maintainability / prettiness issue. I just want to point out that Raspberry Pi is now shipping. NodeJS is a very

Re: [node-dev] Re: context (thisness) to EventEmitter#on, process.nextTick, etc

2012-06-08 Thread Jimb Esser
Technically, at least in V8, .bind is a lot lighter weight than an anonymous function. There are a large number of micro-benchmarks to look at on jsperf.com, but for an actual anecdote, at one point we accidentally required in a module which overrode Function.prototype.bind with something that

Re: [node-dev] Re: context (thisness) to EventEmitter#on, process.nextTick, etc

2012-06-08 Thread Jimb Esser
Though significantly faster than making a closure, .bind is still fairly expensive, and creates a heap allocation, which adds to heap pressure and time spent garbage collecting, which (in our, admittedly, not particularly normal, case) is our biggest performance concern - with a real-time system

Re: [node-dev] Re: context (thisness) to EventEmitter#on, process.nextTick, etc

2012-06-08 Thread AJ ONeal
Interesting. So have you found bind() to be more or less efficient than .call() and or .apply()? AJ ONeal On Fri, Jun 8, 2012 at 3:48 PM, Jimb Esser wastel...@gmail.com wrote: Technically, at least in V8, .bind is a lot lighter weight than an anonymous function. There are a large number of

Re: [node-dev] Re: context (thisness) to EventEmitter#on, process.nextTick, etc

2012-06-08 Thread Nikhil Marathe
This has been previously discussed on nodejs - http://groups.google.com/group/nodejs/browse_thread/thread/220f9faac1b61798/8f3e85ec7e73f806?lnk=gstq=nikhil+marathe On Sat, Jun 9, 2012 at 3:44 AM, AJ ONeal coola...@gmail.com wrote: Interesting. So have you found bind() to be more or less

[nodejs] Re: Number of sockets capped when starting nodejs with upstart or supervisord (?!)

2012-06-08 Thread mscdex
On Jun 8, 1:33 am, Hugues Hardel hhar...@gmail.com wrote: My understanding is that the ulimit value is set once and for all (...and for all users) ? I am not a Linux expert so I could totally be wrong here. FWIW I will sometimes create a user, assign their resource limits (including max file

Re: [nodejs] node.js fuse bindings?

2012-06-08 Thread Arnout Kazemier
I was recently searching for the same bindings, I did found https://github.com/c4milo/fusejs but that is also not finished yet On Friday, June 8, 2012 at 1:42 AM, Marak Squires wrote: Is anyone working on fuse bindings for node / has working fuse bindings yet? see:

[nodejs] Re: Do we have anything like XMPP presence in node.js?

2012-06-08 Thread mscdex
On Jun 8, 3:33 am, Veeru veerabhadraiah...@gmail.com wrote: Hello everyone, I want to know if there is anything in node.js that works as XMPP presence? I believe so, search for 'xmpp' on http://search.npmjs.org -- Job Board: http://jobs.nodejs.org/ Posting guidelines:

Re: [nodejs] node.js fuse bindings?

2012-06-08 Thread Micheil Smith
Yeah, I think a few of us were working on Fuse bindings, but the projects have all kind of died, would be good to see one or two restarted; I think the main issue was trying to integrate the to event loops in a manner that made sense. – Micheil On 08/06/2012, at 7:56 AM, Arnout Kazemier

[nodejs] Nodeclipse -- node.js language support for eclipse

2012-06-08 Thread Lamb
Nodeclipse http://www.nodeclipse.org/ is an plugin that adds IDE functionality to the Eclipse http://www.eclipse.org/ for the Node.jshttp://www.nodejs.org/ . The purpose of Nodeclipse is to create an environment in which development of Node.js is easy for a beginner to intermediate user.

[nodejs] Integrate node.js server within a java application

2012-06-08 Thread Charles Moulliard
Hi, Is there a way to embed node.js in a java application to use the node.js HTTP / WebSocket server (instead of Eclipse Jetty Web Server) with integration solutions like Apache Camel (= java framework) to route, enrich, aggregate, split info for real time applications ? Regards, Charles --

[nodejs] Run different version of node.js servers

2012-06-08 Thread Charles Moulliard
Hi, Is it possible to deploy different versions of node.js (0.6.x, 0.7.x) servers on a machine and to switch easily from one to another ? Is there a script that we can use for that purpose ? Regards, Charles -- Job Board: http://jobs.nodejs.org/ Posting guidelines:

[nodejs] Equivalent of JMX to monitor

2012-06-08 Thread Charles Moulliard
Hi, Is there an equivalent of jmx java api to monitor node.js servers and applications running it ? Regards, Charles -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are

[nodejs] Using node.js to implement a non-transparent, RFC-2616 compliant proxy server

2012-06-08 Thread samizdat
I'm trying to build a proxy server using node.js that abides by all the RFC-2616 rules for general proxy servers, e.g. inserting Via: headers (sec 14.45) and deleting hop-by-hop headers such as Connection: and the headers mentioned in Connection: (sec. 14.10). You know, the kind of proxy server

[nodejs] Re: full hostname

2012-06-08 Thread Chris Dew
I'd like to know too. Thanks, Chris. On Friday, 25 February 2011 09:32:49 UTC, rolfn wrote: With os.hostname() I can ask for the name of my host. But how can I get the full qualified hostname? Thanks in advance, Rolf -- Job Board: http://jobs.nodejs.org/ Posting

Re: [nodejs] Run different version of node.js servers

2012-06-08 Thread Daniel Rinehart
This thread had a great list of possible solutions: https://groups.google.com/group/nodejs/browse_thread/thread/5b1a7a7cb15aa41/c17704c75f452940 -- Daniel R. dani...@neophi.com [http://danielr.neophi.com/] On Fri, Jun 8, 2012 at 3:58 AM, Charles Moulliard cmoulli...@fusesource.com wrote: Hi,

Re: [nodejs] Integrate node.js server within a java application

2012-06-08 Thread Ben Kelly
There is this: https://github.com/nearinfinity/node-java I think it lets you call out to java from node, which is a bit different than embedding. Not sure if this helps your situation or not. If you're interested in tight integration with Java, you might also check out an alternative to

Re: [nodejs] Run different version of node.js servers

2012-06-08 Thread John Teague
I believe nvm will do what you need. https://github.com/creationix/nvm On Fri, Jun 8, 2012 at 2:58 AM, Charles Moulliard cmoulli...@fusesource.com wrote: Hi, Is it possible to deploy different versions of node.js (0.6.x, 0.7.x) servers on a machine and to switch easily from one to another ?

[nodejs] Re: full hostname

2012-06-08 Thread Chris Dew
var hostname = unknown host; spawn2('hostname', ['--fqdn'], function(err, stdout, stderr) { hostname = stdout; }); /* * This function augments the spawn function with: * 1. extra logging * 2. a timeout to kill the whole process, if a child does not return * 3. an optional callback to be

Re: [nodejs] I have a proposal!!

2012-06-08 Thread Seiji Sam Lee
jaja, ok, by the way I mented phpjs ;-) Yes, isolation is and aim to achieve, but it could sort out the big quantity of functions that nodejs is coming to get. Really I have in my mind the way that Java does. That's right, it use namespaces, and we do so!! modules are like namespaces.

[nodejs] Howdy nodejs group members, I've got a memory question/problem

2012-06-08 Thread Mark Essel
I've been bugging TJ on node-canvas (https://github.com/LearnBoost/ node-canvas/issues/177#issuecomment-6154062) about a code speed up I'm working on in a fork of his node module. I found Canvas.toBuffer() to be killing our pipeline resources and created an alternative that would simply convert

Re: [nodejs] I have a proposal!!

2012-06-08 Thread Seiji Sam Lee
El 01/06/12 21:57, Alan Gutierrez escribió: On Fri, Jun 01, 2012 at 12:42:42PM -0700, Martin Wawrusch wrote: On Fri, Jun 1, 2012 at 2:26 PM, Seiji Sam Leeseijisam...@gmail.com wrote: Due the great expectation around node.js, libs and functions grow up without control. Nowadays we have a lot

Re: [nodejs] I have a proposal!!

2012-06-08 Thread Seiji Sam Lee
El 01/06/12 21:59, Isaac Schlueter escribió: No, we're not going to do this. The module system is finished. It won't be changing except for critical bugs. On Fri, Jun 1, 2012 at 12:57 PM, Alan Gutierreza...@prettyrobots.com wrote: On Fri, Jun 01, 2012 at 12:42:42PM -0700, Martin Wawrusch

[nodejs] require(), Object.Create and Inheritance

2012-06-08 Thread Dave Clements
like Tim said, so if you changed: var Client = require(./client); to var Client = require(./client)(); or Object.create(Client, to Object.create(Client(), it should work -- Job Board: http://jobs.nodejs.org/ Posting guidelines:

[nodejs] Re: full hostname

2012-06-08 Thread Thomas Shinnick
Of course, not proof against badly configured machines. hostname --fqdn on server setup by somebody else bjsapps17 gives me the 'long' answer, 'bjsapps17' :-/ host bjsapps17 gives me bjsapps17.example.com has address 10.39.37.251. Maybe try multiple techniques and choose the longest

Re: [nodejs] Nodeclipse -- node.js language support for eclipse

2012-06-08 Thread Mark Hahn
Can you give us a quick summary of features? On Thu, Jun 7, 2012 at 9:33 PM, Lamb lamb52...@gmail.com wrote: Nodeclipse http://www.nodeclipse.org/ is an plugin that adds IDE functionality to the Eclipse http://www.eclipse.org/ for the Node.jshttp://www.nodejs.org/ . The purpose of

Re: [nodejs] Nodeclipse -- node.js language support for eclipse

2012-06-08 Thread Nuno Job
noo Just kidding, nice work. I just worked for way too long at IBM, where everything is eclipse based :) Nuno On Fri, Jun 8, 2012 at 5:59 PM, Mark Hahn m...@hahnca.com wrote: Can you give us a quick summary of features? On Thu, Jun 7, 2012 at 9:33 PM, Lamb

Re: [nodejs] Re: full hostname

2012-06-08 Thread Ben Noordhuis
On Fri, Jun 8, 2012 at 6:41 PM, Thomas Shinnick tshin...@gmail.com wrote: Of course, not proof against badly configured machines. hostname --fqdn on server setup by somebody else bjsapps17 gives me the 'long' answer, 'bjsapps17'   :-/ host bjsapps17  gives me bjsapps17.example.com has

[nodejs] [ANN] UtahJS Conf 2012 Video on Flow-Control.

2012-06-08 Thread AJ ONeal
Flow-Control Love it. Hate it. Learn about it. Video: http://youtu.be/aHswD_Kwk9U Slides: http://bit.ly/Kmp5Qt At UtahJS Conf 2012 I presented on Flow Control. Unfortunately the video quality is lacking and you have to open the slides and flip through them on your own. I may re-upload with the

[nodejs] [ANN] UTOSC 2012 Videos

2012-06-08 Thread AJ ONeal
I completely forgot to send the link to the Utah Open Source JavaScript Track vids last month: In particular, there is this one on writing C++ NodeJS modules: http://www.youtube.com/watch?v=3lAn8SgTasIfeature=BFalist=PLF006D6215357F29E The full playlist is here:

[nodejs] Re: unix: fix loop starvation under high network load (what was this?)

2012-06-08 Thread Jimb Esser
It depends on how much work the callbacks were doing on each read - my echo server test case hits this issue at around 200mbits/s on my machine, and we were sometimes seeing this on production servers which were doing a lot of work (and definitely no where near that throughput, though it was

[nodejs] uncaught exception does not kill forked processes

2012-06-08 Thread Rambo
Does anyone know how to deal with this kind of thing? I have process A that forks 3 processes, but when an exception occurs in process A and it's not caught, it never dies and stays like a zombie waiting for something... Somehow the forked processes are preventing the parent process from

[nodejs] Re: require(), Object.Create and Inheritance

2012-06-08 Thread howdoicodethis
It worked great. Thanks! On Friday, June 8, 2012 11:39:25 AM UTC-4, Dave Clements wrote: like Tim said, so if you changed: var Client = require(./client); to var Client = require(./client)(); or Object.create(Client, to Object.create(Client(), it should work -- Job Board:

Re: [nodejs] I have a proposal!!

2012-06-08 Thread Mikeal Rogers
A similar idea was considered by Ryan a few years ago. I think it looked like this import('modulename') All the exports are dumped by name in to the scope. There was also some copy-on-write isolate stuff in there if i remember correctly. It was scrapped as a bad idea for a lot of the reasons

Re: [nodejs] [ANN] UtahJS Conf 2012 Video on Flow-Control.

2012-06-08 Thread Mikeal Rogers
haven't read the slides or seen the video yet but i have to say: love the title :) On Jun 8, 2012, at June 8, 201211:15 AM, AJ ONeal wrote: Flow-Control Love it. Hate it. Learn about it. Video: http://youtu.be/aHswD_Kwk9U Slides: http://bit.ly/Kmp5Qt At UtahJS Conf 2012 I presented on

Re: [nodejs] Nodeclipse -- node.js language support for eclipse

2012-06-08 Thread Dan Shaw
Nuno, I had the same reaction. Good job, Lamb. I'm sure people without deep Eclipse scares will appreciate this. Daniel Shaw @dshaw -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because

[nodejs] .bind performance (Was Re: context (thisness) to EventEmitter#on, process.nextTick, etc)

2012-06-08 Thread Jimb Esser
[Moved to nodejs instead of nodejs-dev since this is of general interest and only tangental to the original request] I've never thought of using .bind instead of .call, but since .bind does allocate something, and .call theoretically doesn't have to, I'd just assume .call is more efficient,

[nodejs] Re: Katana - MVC/HMVC framework for any Node.js samurai.

2012-06-08 Thread EllisGL
Shogun, Wondering how you use the session plugin? I'm hoping to use sessions with the MVC part and socket.io part. On Tuesday, May 8, 2012 5:17:24 PM UTC-5, Shogun wrote: Hi all! I know there already a lot of mini and almost full future frameworks for Node.js but anyway i build my own.

[nodejs] Microsoft Driver for Node.JS for SQL Server

2012-06-08 Thread Jonathan Guerin
Hi guys, I know you'd heard about this a while back when we were first exploring it, but it's my pleasure to officially announce the Microsoft Driver for Node.JS for SQL Server is now available as a preview. It's Open Source, it's hosted on Github, and we accept (and welcome!) contributions from

Re: [nodejs] uncaught exception does not kill forked processes

2012-06-08 Thread Ben Noordhuis
On Fri, Jun 8, 2012 at 9:41 PM, Rambo demia...@gmail.com wrote: Does anyone know how to deal with this kind of thing? I have process A that forks 3 processes, but when an exception occurs in process A and it's not caught, it never dies and stays like a zombie waiting for something... Somehow

Re: [nodejs] .bind performance (Was Re: context (thisness) to EventEmitter#on, process.nextTick, etc)

2012-06-08 Thread Rick Waldron
On Fri, Jun 8, 2012 at 7:23 PM, Jimb Esser wastel...@gmail.com wrote: [Moved to nodejs instead of nodejs-dev since this is of general interest and only tangental to the original request] I've never thought of using .bind instead of .call, but since .bind does allocate something, and .call

[nodejs] Re: .bind performance (Was Re: context (thisness) to EventEmitter#on, process.nextTick, etc)

2012-06-08 Thread Jimb Esser
Binding more than once is very common - any code that is written with a closure instead can be written with a static function and a .bind (and, in general, be more efficient, causing less heap pressure). But, yeah, the immediate bind vs call was just in response to AJs query, and it's pretty

Re: [nodejs] Re: .bind performance (Was Re: context (thisness) to EventEmitter#on, process.nextTick, etc)

2012-06-08 Thread Rick Waldron
On Friday, June 8, 2012 at 8:29 PM, Jimb Esser wrote: Binding more than once is very common The bound function returned by fn.bind cannot be rebound and will silently ignore any attempts to do so. - any code that is written with a closure instead can be written with a static

Re: [nodejs] Re: .bind performance (Was Re: context (thisness) to EventEmitter#on, process.nextTick, etc)

2012-06-08 Thread Tim Caswell
FWIW, my experience with .bind on V8 has always been that it's actually significantly slower than just creating a closure yourself. For a microbenchmark, see http://jsperf.com/bind-vs-closure Besides the memory overhead of using bind vs calling with call, bind has strange semantics. For

[nodejs] Re: .bind performance (Was Re: context (thisness) to EventEmitter#on, process.nextTick, etc)

2012-06-08 Thread Jimb Esser
By binding more than once, I mean binding the same original function multiple times (with different parameters), not binding the result of a previously bound function. An example of using bind instead of a closure: original: function backupFile(filename, cb) { fs.unlink(filename + '.bak',

Re: [nodejs] TLS - EPIPE error without close event being emitted

2012-06-08 Thread Ben Noordhuis
On Sat, Jun 9, 2012 at 4:59 AM, catshow ga...@dynafocus.com wrote: I am working on a new Apple Push Notification server using node.js.  I am having issues with node not emitting the close event on a TLS SecureStream after getting an EPIPE error event.  Has anyone else had this happen?  It

[nodejs] Re: .bind performance (Was Re: context (thisness) to EventEmitter#on, process.nextTick, etc)

2012-06-08 Thread Jimb Esser
And, bringing this back to the original poster's request for callback- taking API functions which take this arguments, I compared simulating the two methods in the last post, as well as if the API functions allowed for a this to be passed in [1], and heap growth per call was roughly: closure:

Re: [nodejs] Re: .bind performance (Was Re: context (thisness) to EventEmitter#on, process.nextTick, etc)

2012-06-08 Thread Rick Waldron
snip [1] https://gist.github.com/2899468 Nothing about the code in this gist actually needs to use bind(), but your findings are certainly as expected - bind() actually creates a whole new function object to return, whereas closing over with a function expression or passing as arguments

Re: [nodejs] getDate of Date having different results

2012-06-08 Thread Ryan Schmidt
On Jun 9, 2012, at 00:19, Angelo Chen wrote: In a centos server, I tried this, and get 7: node d1 = new Date(Fri, 08 Jun 2012 00:00:00 GMT) Fri, 08 Jun 2012 00:00:00 GMT d1.getDate() 7 in my local Lion OS X, I tried this, and get 8, why: node d1 = new Date(Fri, 08 Jun 2012 00:00:00

[nodejs] Re: nodejs and android c2dm

2012-06-08 Thread darren
Luca, I've used it without too many problems, but like catshow I think you might be hitting more of a c2dm limit than a nodejs limit... Can you confirm throughput rates with another tool, say, python? I don't send that many notifications but I'm interested to know what message caps exist... On

[nodejs] Re: .bind performance (Was Re: context (thisness) to EventEmitter#on, process.nextTick, etc)

2012-06-08 Thread Jimb Esser
There certainly is a reason, it makes for (arguably) cleaner code in some cases (quite arguably not so in this example =), and can be used to have one *less* function on the stack than if you made a closure (e.g. fs.unlink(fn2, fs.rename.bind(fs, fn1, fn2, cb)); ) - at least it appears that a

[nodejs] Re: Run different version of node.js servers

2012-06-08 Thread darren
n is a great little node version manager and easy to type! On Jun 8, 3:58 am, Charles Moulliard cmoulli...@fusesource.com wrote: Hi, Is it possible to deploy different versions of node.js (0.6.x, 0.7.x) servers on a machine and to switch easily from one to another ? Is there a script that we

[nodejs] Re: getDate of Date having different results

2012-06-08 Thread Angelo Chen
correct, thanks. On Jun 9, 1:25 pm, Ryan Schmidt google-2...@ryandesign.com wrote: On Jun 9, 2012, at 00:19, Angelo Chen wrote: In a centos server, I tried this, and get 7: node d1 = new Date(Fri, 08 Jun 2012 00:00:00 GMT) Fri, 08 Jun 2012 00:00:00 GMT d1.getDate() 7 in