serverside-javascript

What is non-blocking or asynchronous I/O in Node.js?

两盒软妹~` 提交于 2019-11-26 19:16:49
In the context of Server Side Javascript engines, what is non-blocking I/O or asynchronous I/O? I see this being mentioned as an advantage over Java server side implementations. Joseph Synchronous vs Asynchronous Synchronous execution usually refers to code executing in sequence. Asynchronous execution refers to execution that doesn't run in the sequence it appears in the code. In the following example, the synchronous operation causes the alerts to fire in sequence. In the async operation, while alert(2) appears to execute second, it doesn't. Synchronous: 1,2,3 alert(1); alert(2); alert(3);

How to sync a javascript countdown with server time [duplicate]

那年仲夏 提交于 2019-11-26 15:47:43
问题 This question already has answers here : The best way to synchronize client-side javascript clock with server date (7 answers) Closed 6 years ago . I am building a site which has times and prices which tick down. The thing I am most concerned with is syncing time so that it is as accurate as possible across all clients. Currently, I am sending the client the number of milliseconds left which is then used to fuel the countdown timer, but due to transfer and rendering delays, this can be off by

Using a .NET DLL in Node.js / serverside javascript

空扰寡人 提交于 2019-11-26 15:16:33
问题 I have a pet project that is an online game, the entire game engine is written in C# and I would like to know if there is anyway I can call the functions of this existing assembly (.dll) from a solution built using Node.JS, Socket.IO, Express etc? The game engine itself is pretty complete; tested and robust. I am hoping there is some neat way of exposing its functionality without too much overhead. UPDATE : To answer my own question a little.. I have ended building my own web socket server

Why and when to use Node.js? [duplicate]

六眼飞鱼酱① 提交于 2019-11-26 14:59:52
问题 Possible Duplicate: How to decide when to use Node.js? Sorry if I'm a bit ambiguous, but I'm trying to understand the real advantages of using Node.js instead of other server-side language. I'm a JavaScript enthusiast, so I'm probably going to play with Node.js, but I want to know if I should use it in my projects. 回答1: It's evented asynchronous non-blocking I/O build ontop of V8. So we have all the performance gain of V8 which is the Google JavaScript interpreter. Since the JavaScript

user authentication libraries for node.js?

流过昼夜 提交于 2019-11-26 14:50:18
Are there any existing user authentication libraries for node.js? In particular I'm looking for something that can do password authentication for a user (using a custom backend auth DB), and associate that user with a session. Before I wrote an auth library, I figured I would see if folks knew of existing libraries. Couldn't find anything obvious via a google search. -Shreyas If you are looking for an authentication framework for Connect or Express, Passport is worth investigating: https://github.com/jaredhanson/passport (Disclosure: I'm the developer of Passport) I developed Passport after

Referencing Google's V8 engine from a .NET app

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-26 12:36:23
问题 I\'m building a .NET 3.5 application and have the need to evaluate JS code on the server - basically a user provided rule set that can work within a browser or on the server. Managed JS is not an option, because the JS code would be provided at runtime. Aptana\'s Jaxer is also not an option. So I was looking into using a build of the V8 engine within my app. I built the source successfully into a DLL, but that DLL is not not a managed library and is not COM either. V8 is just plain C++. Any

How does setTimeout work in Node.JS?

萝らか妹 提交于 2019-11-26 11:57:59
问题 I guess that once it\'s executed it\'s on the queue, but in the queue is there any assurance it will invoke exactly after X milliseconds? Or will other heavy tasks higher on the queue delay it? 回答1: The semantics of setTimeout are roughly the same as in a web browser: the timeout arg is a minimum number of ms to wait before executing, not a guarantee. Furthermore, passing 0, a non-number, or a negative number, will cause it to wait a minimum number of ms. In Node, this is 1ms, but in browsers

What is non-blocking or asynchronous I/O in Node.js?

安稳与你 提交于 2019-11-26 08:54:14
问题 In the context of Server Side Javascript engines, what is non-blocking I/O or asynchronous I/O? I see this being mentioned as an advantage over Java server side implementations. 回答1: Synchronous vs Asynchronous Synchronous execution usually refers to code executing in sequence. Asynchronous execution refers to execution that doesn't run in the sequence it appears in the code. In the following example, the synchronous operation causes the alerts to fire in sequence. In the async operation,

user authentication libraries for node.js?

江枫思渺然 提交于 2019-11-26 04:02:15
问题 Are there any existing user authentication libraries for node.js? In particular I\'m looking for something that can do password authentication for a user (using a custom backend auth DB), and associate that user with a session. Before I wrote an auth library, I figured I would see if folks knew of existing libraries. Couldn\'t find anything obvious via a google search. -Shreyas 回答1: If you are looking for an authentication framework for Connect or Express, Passport is worth investigating:

nodejs vs node on ubuntu 12.04

本小妞迷上赌 提交于 2019-11-26 03:15:41
问题 I installed nodejs on ubuntu from instructions given here When I write node --version in the terminal I see this : -bash: /usr/sbin/node: No such file or directory I can see node in the /usr/sbin/ directory, though. Writing npm --version shows 1.3.5 Writing nodejs --version shows v0.10.15 Also, I can see node in the /usr/bin/ directory. So, how do I get node working? Also, If I use zsh instead of bash, then node command works. 回答1: You need to manually create a symlink /usr/bin/node .