Re: [nodejs] Re: Simple LightWeight OOP. 100% compatibility with JavaScript. Feedback please!

2012-12-12 Thread Luke Arduini
I have yet to hear a particularly convincing argument for this type of OOP in javascript. As Raynos and Isaac explained, the idiomatic js style way without some additional special wrapper or helper is trivial to do. "I like it more" is a fine reason to do it yourself. I think it's a waste of t

Re: [nodejs] ReadableStream from Buffer

2012-12-12 Thread Nathan Rajlich
There's actually no benefit to breaking up a *big* Buffer into smaller chunks for the purposes of streaming. Once that big buffer is in memory, you're better off just calling .write(buf) on the writable stream and writing the entire Buffer at once; libuv/the kernel will take care of flushing the bu

Re: [nodejs] "this" and that

2012-12-12 Thread Rick Waldron
On Wednesday, December 12, 2012 at 8:09 PM, Jorge Chamorro wrote: > On 13/12/2012, at 01:47, Rick Waldron wrote: > > > > On Wed, Dec 12, 2012 at 7:20 PM, Jorge Chamorro > > wrote: > > On 12/12/2012, at 18:37, Rick Waldron wrote: > > > > > > On Wed, Dec 12, 2012 at 2:17 AM, Isaac Schlueter w

Re: [nodejs] ReadableStream from Buffer

2012-12-12 Thread Martin Cooper
On Wed, Dec 12, 2012 at 5:36 PM, dhruvbird wrote: > Hello, > > Is there a module that creates a ReadableStream given a Buffer, or > something like if I write to the stream, it emits the 'data' event every > time someone writes to it. > This one might fit the bill: https://github.com/mjijackson/

Re: [nodejs] "this" and that

2012-12-12 Thread Jorge Chamorro
On 13/12/2012, at 02:20, spqr wrote: > I couldn't agree more. I'm very happy that for my purposes (and given > JavaScript's quirks) I could avoid it, but sometimes > you just need to generate code and execute it. ;-) It's not evil and it > has been going on in programming almost since > day

[nodejs] ReadableStream from Buffer

2012-12-12 Thread dhruvbird
Hello, Is there a module that creates a ReadableStream given a Buffer, or something like if I write to the stream, it emits the 'data' event every time someone writes to it. I found 2 modules, both of which seem unrelated: https://github.com/dodo/node-bufferstream https://github.com/bnoordhuis

Re: [nodejs] "this" and that

2012-12-12 Thread Jorge Chamorro
On 13/12/2012, at 01:47, Rick Waldron wrote: > > On Wed, Dec 12, 2012 at 7:20 PM, Jorge Chamorro > wrote: > On 12/12/2012, at 18:37, Rick Waldron wrote: > > Runtime code generation? new Function( thecode ) works just as well, I guess > > ...sometimes: > > (function (p) { > > eval("(function

Re: [nodejs] "this" and that

2012-12-12 Thread spqr
I couldn't agree more. I'm very happy that for my purposes (and given JavaScript's quirks) I could avoid it, but sometimes you just need to generate code and execute it. ;-) It's not evil and it has been going on in programming almost since day one. Who remembers graphics code that generated

Re: [nodejs] "this" and that

2012-12-12 Thread Jorge Chamorro
On 13/12/2012, at 01:47, Rick Waldron wrote: > > On Wed, Dec 12, 2012 at 7:20 PM, Jorge Chamorro > wrote: > On 12/12/2012, at 18:37, Rick Waldron wrote: > > > > On Wed, Dec 12, 2012 at 2:17 AM, Isaac Schlueter wrote: > > On Tue, Dec 11, 2012 at 7:18 PM, spqr wrote: > > > maybe my question shou

Re: [nodejs] "this" and that

2012-12-12 Thread Rick Waldron
On Wed, Dec 12, 2012 at 7:20 PM, Jorge Chamorro wrote: > On 12/12/2012, at 18:37, Rick Waldron wrote: > > > > On Wed, Dec 12, 2012 at 2:17 AM, Isaac Schlueter wrote: > > On Tue, Dec 11, 2012 at 7:18 PM, spqr wrote: > > > maybe my question should have been "why does JavaScript have eval()?" > ;-)

Re: [nodejs] "this" and that

2012-12-12 Thread Jorge Chamorro
On 12/12/2012, at 18:37, Rick Waldron wrote: > > On Wed, Dec 12, 2012 at 2:17 AM, Isaac Schlueter wrote: > On Tue, Dec 11, 2012 at 7:18 PM, spqr wrote: > > maybe my question should have been "why does JavaScript have eval()?" ;-) > > I think a lot of people have wondered the same thing. > > Ye

[nodejs] Re: Advice when using streams, pipe and waiting for metadata

2012-12-12 Thread Alexander Shtuchkin
AFAIK, its either buffering, or you can call pause()/resume() to control incoming data flow. Alex. On Wednesday, December 12, 2012 1:27:25 PM UTC+4, Paul Connolley wrote: > > Hi there > > Long time lurker, first time poster. I've been working on a module for the > last couple of weeks as a bit

Re: [nodejs] "this" and that

2012-12-12 Thread José F . Romaniello
jquery and also JSON2 uses eval as fallback mechanism when the browser doesnt support JSON.parse, seems like a legit use case :) 2012/12/12 Rick Waldron > > > > On Wed, Dec 12, 2012 at 2:17 AM, Isaac Schlueter wrote: > >> On Tue, Dec 11, 2012 at 7:18 PM, spqr wrote: >> > maybe my question sho

Re: [nodejs] "this" and that

2012-12-12 Thread Rick Waldron
On Wed, Dec 12, 2012 at 2:17 AM, Isaac Schlueter wrote: > On Tue, Dec 11, 2012 at 7:18 PM, spqr wrote: > > maybe my question should have been "why does JavaScript have eval()?" ;-) > > I think a lot of people have wondered the same thing. > > Yes, it has its uses, but at this point, I don't know

[nodejs] Re: Why no additional parameters in (async. node.js API) callback functions?

2012-12-12 Thread Patrick Mueller
On Wednesday, December 12, 2012 10:52:19 AM UTC-5, greelgorke wrote: > Well, DOM Event API defines the EventListener interface. you could do this: > document.body.addEventListener('click', > {foo:'foo',handleEvent:function(ev){console.log(this.foo)}}) > and this will print foo to your console, bu

[nodejs] Re: Best Pattern to wrap class hierarchy

2012-12-12 Thread lent
Hi Bradley, thanks for the reply, but maybe I have not expressed clearly: I don't want to *convert* my c++ classes to javascript. Instead, I create a *custom module* with *node::ObjectWrap* class AnimalWrap : public node::ObjectWrap { public: static Handle sound(const Arguments &args);

[nodejs] Re: The new game server demo written in node.js

2012-12-12 Thread Bradley Meck
Very interesting. Seems to still have some graphical jitters, but could be very promising. Cheers, Bradley -- 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 subscribed to the G

[nodejs] Re: Why no additional parameters in (async. node.js API) callback functions?

2012-12-12 Thread greelgorke
Well, DOM Event API defines the EventListener interface. you could do this: document.body.addEventListener('click', {foo:'foo',handleEvent:function(ev){console.log(this.foo)}}) and this will print foo to your console, but thats, right. it's possible just to pass a function and most of devs do thi

Re: [nodejs] Re: Why no additional parameters in (async. node.js API) callback functions?

2012-12-12 Thread greelgorke
i meant not pure functionAL style, but pure functions: http://en.wikipedia.org/wiki/Pure_function the state of the art at the moment is to use closures, which often are not pure functions. they close over some values from the parent scope, that is not under control of the closure itself. the clo

[nodejs] Re: Why no additional parameters in (async. node.js API) callback functions?

2012-12-12 Thread Patrick Mueller
On Wednesday, December 12, 2012 4:36:29 AM UTC-5, Michael Hasenstein wrote: > ... > > So, can anyone enlighten me - and I MAY INDEED be simply incredibly stupid > not to see the point without help - why node.js could not just let me add > custom parameters for callbacks? Again: additional scope-

[nodejs] Re: Why no additional parameters in (async. node.js API) callback functions?

2012-12-12 Thread greelgorke
yes, thanks, for the hint. :) Am Mittwoch, 12. Dezember 2012 12:16:27 UTC+1 schrieb Ruben Tan: > > I think you meant "closure". clojure is a language running on JVM. > > On Wednesday, December 12, 2012 6:59:56 PM UTC+8, greelgorke wrote: >> >> why? its the simpliest and most common way, that's it.

Re: [nodejs] Re: Why no additional parameters in (async. node.js API) callback functions?

2012-12-12 Thread Richard Miller-Smith
I'm certainly no expert, but I expect the design choice was made to do it that way to make the C/C++ asynchronous calls within the node core to be simpler and easier. At present, to jump back into the callback the C++ side just needs a single function reference. If a list of arbitrary arguments are

RE: [nodejs] Re: Why no additional parameters in (async. node.js API) callback functions?

2012-12-12 Thread Chad Engler
If you don't want help and just want a straight answer as to why, the answer is "because". If you don't like the syntax use promises or some compile to JS language to clean it up. But `.bind()` is the way to do this, and it isn't ugly it is just JavaScript. Don't use JavaScript if you don't like J

[nodejs] Re: a new service to run your browser tests on every commit

2012-12-12 Thread sveisvei
Good stuff! :) kl. 02:05:07 UTC+1 onsdag 12. desember 2012 skrev substack følgende: > > There are a ton of modules on npm and github that aren't just for node.js > but for browsers too. However, figuring out *which* browsers these modules > work with can be tricky. It's often that case that some

Re: [nodejs] Re: How To get session of java

2012-12-12 Thread Angel Java Lopez
I'm not sure what is your use case. If you need some value at client side/javascript, and you are using JavaServerPages (JSP), you could try (quick and dirty): var myclientsidevalue = '<%= session.getValue("myserversidename") %>'; // I don't remember the exact notation, method call, etc.. ther

Re: [nodejs] Re: Why no additional parameters in (async. node.js API) callback functions?

2012-12-12 Thread Jonathan Dickinson
At least with my .bind() example one could argue that it makes the code harder to read (yes, I completely agree with you about closure hell; and they are way less understandable than what I am about to say): it has to do with expression of intent. To the untrained eye, what is going on here? fs

Re: [nodejs] Re: How To get session of java

2012-12-12 Thread ayaz ali
is it possibe to acess session from javascript? -- 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 subscribed to the Google Groups "nodejs" group. To post to this group, send emai

Re: [nodejs] Re: Why no additional parameters in (async. node.js API) callback functions?

2012-12-12 Thread Michael Hasenstein
I know how I can do it (at least 3 different very ways came to my mind immediately), I said so ;-) - that was't my question (or point). I don't WANT to have to write that, if I can help it. I would except the explanation that since node.js is very low-level burdening the API functions with an add

[nodejs] Re: Why no additional parameters in (async. node.js API) callback functions?

2012-12-12 Thread Jonathan Dickinson
You can do it with .bind(). I assume that the 1...n arguments of .bind() are often overlooked. var fs = require('fs'); function onStat(file, err, stat) { if (stat.isFile()) { //fs.readFile(...)... WHICH FILE console.log(file); // This file } } var files = [ "E:\\site

[nodejs] Advice when using streams, pipe and waiting for metadata

2012-12-12 Thread Paul Connolley
Hi there Long time lurker, first time poster. I've been working on a module for the last couple of weeks as a bit of a training exercise. I´ve been digging in to node for the last 6 months and I´m trying to make all my modules streaming. The latest exercise is a reverse image proxy for mapping

Re: [nodejs] Re: How To get session of java

2012-12-12 Thread Ben Noordhuis
On Wed, Dec 12, 2012 at 10:21 AM, ayaz ali wrote: > is it possibe to acess session from javascript? hop eits silly questuin :p > bt just for confirmation What exactly is unclear? It's been spelled out for you several times now. -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https:/

Re: [nodejs] Re: Why no additional parameters in (async. node.js API) callback functions?

2012-12-12 Thread Michael Hasenstein
CORRECTION, I take my last statement back, you DID add to the conversation and I am a bad reader. I had already considered the performance issue of having the API functions not just call the callback, but also having to handle OPTIONAL additional parameters, which in node.js might happen some mill

[nodejs] Re: Why no additional parameters in (async. node.js API) callback functions?

2012-12-12 Thread Ruben Tan
I think you meant "closure". clojure is a language running on JVM. On Wednesday, December 12, 2012 6:59:56 PM UTC+8, greelgorke wrote: > > why? its the simpliest and most common way, that's it. passing by custom > params has to be implemented in the async function itself, there is no > native su

Re: [nodejs] Re: Why no additional parameters in (async. node.js API) callback functions?

2012-12-12 Thread Michael Hasenstein
Sir, you did not understand my question :) However, I don't see how I could possibly be clearer - which definitely is MY shortcoming. So sorry. On Wed, Dec 12, 2012 at 11:59 AM, greelgorke wrote: > why? its the simpliest and most common way, that's it. passing by custom > params has to be impl

[nodejs] Re: Why no additional parameters in (async. node.js API) callback functions?

2012-12-12 Thread greelgorke
why? its the simpliest and most common way, that's it. passing by custom params has to be implemented in the async function itself, there is no native support in js nor node for this. and since use of clojures is very common in js world, mostly noone cares about it. but yes it may help to un-cl

Re: [nodejs] Current Windows Deployment Story

2012-12-12 Thread Charlie Circle
make for windows is needed in some modules, http://gnuwin32.sourceforge.net/packages/make.htm On Wednesday, December 12, 2012 5:27:35 PM UTC+8, Glenn Block wrote: > > Hi Mike > > Full disclosure, I work on a team at Microsoft whose sole mission is to > make Node work well on Windows and Windo

[nodejs] integrate in project

2012-12-12 Thread ayaz ali
hello can anyone tell me that how can i integrate nodejs chat app in existing java app which is deployed in tomcat. i want that when user login he also connect to my node app. Thanks -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Post

[nodejs] Why no additional parameters in (async. node.js API) callback functions?

2012-12-12 Thread Michael Hasenstein
This is not a technical question (I'm quite clear about how the stuff works). I also did some (Google) research before asking. I'm just curious if there is a good reason that I just fail to see... I AM aware that very obviously I am not the first person to think about this, but I just could not

Re: [nodejs] [CONCURRENT REQUEST]

2012-12-12 Thread greelgorke
see here http://en.wikipedia.org/wiki/Berkeley_sockets#accept.28.29 Am Mittwoch, 12. Dezember 2012 10:29:21 UTC+1 schrieb greelgorke: > > requests are always coming on the same socket. After the TSP-Handshake > server opens a new socket for the connection to the client and handles the > requests

Re: [nodejs] [CONCURRENT REQUEST]

2012-12-12 Thread greelgorke
requests are always coming on the same socket. After the TSP-Handshake server opens a new socket for the connection to the client and handles the requests over it. the socket on bound on listen-port is still there for accepting connections. OS buffers incomming requests on this socket internaly

Re: [nodejs] Current Windows Deployment Story

2012-12-12 Thread Glenn Block
Hi Mike Full disclosure, I work on a team at Microsoft whose sole mission is to make Node work well on Windows and Windows Azure. There are *not* a ton of modules that fail. The majority actually work just fine. With node-gyp becoming the defacto standard for native modules, most work just as wel

[nodejs] Re: How To get session of java

2012-12-12 Thread ayaz ali
is it possibe to acess session from javascript? hop eits silly questuin :p bt just for confirmation -- 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 subscribed to the Google Gr

Re: [nodejs] Re: How To get session of java

2012-12-12 Thread Angel Java Lopez
Umm... then, you could serialize the session to JSON, if the objects are suitable for that serialization. Distributed session using memcached uses that approach http://code.google.com/p/memcached-session-manager/wiki/SerializationStrategies I don't know the "state of art" in Java to JSON serializ

Re: [nodejs] [CONCURRENT REQUEST]

2012-12-12 Thread Hardik Shah
Hi Nikhil, Thanks for the knowledge sharing... As you are saying that each request is coming on different TCP socket, then again number of socket is limited (2^16=65536 - 1024 some reserved sockets) so as per theory it can handle at max 64k concurrent request? is it like that? Thanks in advanc

[nodejs] Re: How To get session of java

2012-12-12 Thread ayaz ali
its an httpsession -- 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 subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com

Re: [nodejs] How To get session of java

2012-12-12 Thread greelgorke
it depends on how java session is implemented. is it persisted in a db? then you just have to read the session-id cookie in node and fetch it from db. if its in-memory stored in java, then you have to implement a rpc/rest interface in java, which profides the session data as json to your node a

Re: [nodejs] "this" and that

2012-12-12 Thread Angel Java Lopez
Something I missed (I had it at Python): exec. So I could create a local variable with a dynamic name: mynewname = exec("var " + mynenname + " = "); Ok, only one case found yet. I could circumvent it using myobj[mynewname] = ... with (myobj) { // use mynewname "alone" } On Wed

Re: [nodejs] How To get session of java

2012-12-12 Thread ayaz ali
i need the complete session object which is created after login. it may contain any thing any solution please -- 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 subscribed to the

Re: [nodejs] "this" and that

2012-12-12 Thread greelgorke
you should really read the book first... complaining about "rtfm-calls" without knowing basic stuff about the language is pretty much trolling. Am Mittwoch, 12. Dezember 2012 04:18:08 UTC+1 schrieb spqr: > > > Thanks for your help on this, I think you solved my problem with "this" by > helping m

Re: [nodejs] How To get session of java

2012-12-12 Thread Angel Java Lopez
Hi people! U.. do you need somevalue of session? or only the name of the user, to be used at the chat activitiy? In any case, I would implement: - Java (web server, I guess) sends a token to browser. In this context, token is a random key (a GUID, maybe). Java web server keeps a weak diction

Re: [nodejs] can't launch .js in node command line

2012-12-12 Thread Isaac Schlueter
Type `node file.js` all in one command at the main prompt. You're typing `node` and then later typing `file.js`. If you don't provide a filename on the command line, then Node will go into the repl (read-eval-print-loop) where you can type JavaScript commands (like your console.log command) and s

[nodejs] Re: The new game server demo written in node.js

2012-12-12 Thread Charlie Circle
Thank you, I've start a new post. The administrator can delete this post, thank you On Wednesday, December 12, 2012 4:21:59 PM UTC+8, Charlie Circle wrote: > > Oh, sorry, there is no s there, the link is: > http://pomelo.netease.com/lordofpomelo > > > On Wednesday, December 12, 2012 4:07:54 PM

[nodejs] The new game server demo written in node.js

2012-12-12 Thread Charlie Circle
Guys, we've written a full node.js game server demo in node.js. Here is the github source code: https://github.com/NetEase/lordofpomelo Here is the online demo: http://pomelo.netease.com/lordofpomelo Lordofpomelo is a browser-based MMORPG(massively multiplayer online role-playing game). T

[nodejs] Re: The new game server demo written in node.js

2012-12-12 Thread Charlie Circle
Oh, sorry, there is no s there, the link is: http://pomelo.netease.com/lordofpomelo On Wednesday, December 12, 2012 4:07:54 PM UTC+8, Dileep Singh wrote: > > demo link is broken... > > On Wednesday, December 12, 2012 1:31:29 PM UTC+5:30, Charlie Circle wrote: >> >> Guys, we've written a full no

[nodejs] Re: The new game server demo written in node.js

2012-12-12 Thread Charlie Circle
On Wednesday, December 12, 2012 4:01:29 PM UTC+8, Charlie Circle wrote: > > Guys, we've written a full node.js game server demo in node.js. > > Here is the github code: > https://github.com/NetEase/lordofpomelo > > Here is the online demo: > http://pomelo.netease.com/lordofpomelo

Re: [nodejs] Function SHA256_Update is not being called in my C addon

2012-12-12 Thread Ben Noordhuis
On Wed, Dec 12, 2012 at 1:31 AM, Nathan Rajlich wrote: >> I am forced to wrap my header file for scrypt in `extern "c"` for correctly >> linking. This is correct, isn't it? > > Not *totally* positive but I believe this is correct. Ben or someone > else can probably clarify. Yes, wrapping the incl

[nodejs] Re: The new game server demo written in node.js

2012-12-12 Thread Dileep Singh
demo link is broken... On Wednesday, December 12, 2012 1:31:29 PM UTC+5:30, Charlie Circle wrote: > > Guys, we've written a full node.js game server demo in node.js. > > Here is the github code: > https://github.com/NetEase/lordofpomelo > > Here is the online demo: > https://pomelo.netease.com/lo

Re: [nodejs] How To get session of java

2012-12-12 Thread Ben Noordhuis
On Wed, Dec 12, 2012 at 8:39 AM, ayaz ali wrote: > hello everyone i have made a nodejs chat app with express and io. i want to > integrate it with existing java application which is mode on java spring. > flow will be like that when user login the application i want to get the > session of java in

[nodejs] The new game server demo written in node.js

2012-12-12 Thread Charlie Circle
Guys, we've written a full node.js game server demo in node.js. Here is the github code: https://github.com/NetEase/lordofpomelo Here is the online demo: https://pomelo.netease.com/lordofpomelo Lordofpomelo is a browser-based MMORPG(massively multiplayer online role-playing game). The backend