Tag Info

New answers tagged

1

First of all, I don't think Composer is trying too hard to be a PHP version of NPM - there may be similarities, but differences are to be expected. It may not be the best way to understand it to think of the tool as NPM, Maven, Rake or whatever, but translated into PHP. Secondly, understand that Composer solves 'problem' of autoloading in PHP. Having two ...


1

You would use some async IO library (or use the nitty gritty posix or win32 api yourself if you are masochistic) and use it to create a dispatcher loop. For example in Boost's asio library you would create a boost::asio::io_service open the streams and start the async_read with a handler that will do what you want and call run on the io_service which will ...


1

You (and node.js) cannot read from 2 streams simultaneously on a single thread. You'll have to either interleave reads as data is received, or read from both on different threads. You could use beginthread() to start a function in a thread, and read from there. Use setbuf() to redirect the FD to a buffer in your program that you can use to read using the ...


1

You are declaring a local scope function in this case. This means it will only be available withing your scope which is very limited. If you are not planing to reuse it, I wouldn't declare a function all together. if you are planing to reuse it, I would move it outside the callback scope into a separate module/class depending on what the responsibility of ...


1

I don't buy the argument that the JVM is not as good to manipulate JSON than Node. The JVM is filled with a lot of really fast JSON parsers, Jackson being one of them. As a bonus it handles streaming json as well. Look at the project before making an opinion. Your problem is fairly common, you want to connect to a firehose of social data, via an actor, pass ...


0

A Node program is at its core a normal program, it isn't even a web-server unless you write code specifically to make it so (though that is pretty easy with the built-in HTTP library). Your program will get the HTTP requests, and your code can respond any way you like, using all the resources otherwise available to the program. If JavaScript was old-school ...


0

Unlike all other servers you have mentioned, Node is single threaded, but asynchronous - as some have mentioned here, it schedules callbacks instead of waiting for operation to execute and runs callbacks when the operation is complete, however a number of other operations might have been processed in between with the same thread. Caveats: Although it's a ...


6

Let's immediately get the Turing-completeness disclaimer out of the way and say any language can probably approximate any runtime feature of any other language. Good? Good. The main difference between the Node.js approach and a Python threaded-server (or a typical Java HTTP server implementation) is that Node.js is single threaded while the latter two are ...



Top 50 recent answers are included