Re: [nodejs] Re: require() MODULE_NOT_FOUND - yet it does exist
In a nutshell you need to have the .js file in a directory node_modules either in the directory that contains the .js that is 'requiring', or a ancestor directory. For example, assuming the file that is 'requiring' lives at: /users/thatguy/dev/foo/bar/baz/myscript.js, the following paths would be checked for require('fob'). - /users/thatguy/dev/foo/bar/baz/node_modules/fob.js - /users/thatguy/dev/foo/bar/baz/node_modules/fob/index.js - /users/thatguy/dev/foo/bar/node_modules/fob.js - /users/thatguy/dev/foo/bar/node_modules/fob/index.js - /users/thatguy/dev/foo/node_modules/fob.js - /users/thatguy/dev/foo/node_modules/fob/index.js - /users/thatguy/dev/node_modules/fob.js - /users/thatguy/dev/node_modules/fob/index.js - /users/thatguy/node_modules/fob.js - /users/thatguy/node_modules/fob/index.js - /users/node_modules/fob.js - /users/node_modules/fob/index.js - /node_modules/fob.js - /node_modules/fob/index.js Note that you can override the 'index.js' with a package.json: http://nodejs.org/api/modules.html#modules_folders_as_modules What I suspect may be catching you off-guard is that you assume that global modules are checked as well. The name is 'global modules' entirely misleading, it's more along the lines of 'global node binaries'. When you install a package with -g npm creates a script that invokes it and nothing more (allowing you to e.g. 'jake build' from anywhere). 'require' does *not *look in the global modules (you can get npm to symlinkhttps://npmjs.org/doc/link.html from the global modules into your local modules, but that is mostly 'superficial'). Jonathan On Thu, Dec 27, 2012 at 2:44 AM, Isaac Schlueter i...@izs.me wrote: Yeah, share the actual example code. require() works fine with absolute paths. $ cat b.js console.log('hello from b', __filename) ^D $ cat a.js require(require('path').resolve('b.js')) ^D $ node a.js hello from b /Users/isaacs/dev/js/node-master/b.js On Wed, Dec 26, 2012 at 4:33 PM, Domenic Denicola dome...@domenicdenicola.com wrote: I don't believe `require` works with absolute paths, like those generated by path.resolve. (Could be wrong.) If I'm correct, then you may find path.relative to be a useful method. Also note that of course path.resolve without a second argument will resolve relative to process.cwd(), not relative to __filename. This is rarely what you want. On Wednesday, December 26, 2012 10:12:13 AM UTC-5, dar...@darrenwhitlen.com wrote: Hi, Trying to simply require() in a .js file seems to be failing for me here, raising a MODULE_NOT_FOUND error. However - a fs.readFileSync() on the file does work. My current failing debug code: // Fails require(require('path').resolve(module_file)); // Works require('fs').readFileSync(require('path').resolve(module_file), 'UTF8'); Since the readFileSync() call works I can rule out any file/directory permissions leaving me with absolutely no ideas left as to why require() cannot find the file? Anyone have any debugging pointers to share? Darren -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] Re: require() MODULE_NOT_FOUND - yet it does exist
Also, as far as Windows goes, require does work with absolute paths (I am using it): that may be a platform inconsistency though - anyone care to check on a *nix? Jonathan On Thu, Dec 27, 2012 at 10:43 AM, Jonathan Chayce Dickinson jonathand...@gmail.com wrote: In a nutshell you need to have the .js file in a directory node_modules either in the directory that contains the .js that is 'requiring', or a ancestor directory. For example, assuming the file that is 'requiring' lives at: /users/thatguy/dev/foo/bar/baz/myscript.js, the following paths would be checked for require('fob'). - /users/thatguy/dev/foo/bar/baz/node_modules/fob.js - /users/thatguy/dev/foo/bar/baz/node_modules/fob/index.js - /users/thatguy/dev/foo/bar/node_modules/fob.js - /users/thatguy/dev/foo/bar/node_modules/fob/index.js - /users/thatguy/dev/foo/node_modules/fob.js - /users/thatguy/dev/foo/node_modules/fob/index.js - /users/thatguy/dev/node_modules/fob.js - /users/thatguy/dev/node_modules/fob/index.js - /users/thatguy/node_modules/fob.js - /users/thatguy/node_modules/fob/index.js - /users/node_modules/fob.js - /users/node_modules/fob/index.js - /node_modules/fob.js - /node_modules/fob/index.js Note that you can override the 'index.js' with a package.json: http://nodejs.org/api/modules.html#modules_folders_as_modules What I suspect may be catching you off-guard is that you assume that global modules are checked as well. The name is 'global modules' entirely misleading, it's more along the lines of 'global node binaries'. When you install a package with -g npm creates a script that invokes it and nothing more (allowing you to e.g. 'jake build' from anywhere). 'require' does *not *look in the global modules (you can get npm to symlinkhttps://npmjs.org/doc/link.html from the global modules into your local modules, but that is mostly 'superficial'). Jonathan On Thu, Dec 27, 2012 at 2:44 AM, Isaac Schlueter i...@izs.me wrote: Yeah, share the actual example code. require() works fine with absolute paths. $ cat b.js console.log('hello from b', __filename) ^D $ cat a.js require(require('path').resolve('b.js')) ^D $ node a.js hello from b /Users/isaacs/dev/js/node-master/b.js On Wed, Dec 26, 2012 at 4:33 PM, Domenic Denicola dome...@domenicdenicola.com wrote: I don't believe `require` works with absolute paths, like those generated by path.resolve. (Could be wrong.) If I'm correct, then you may find path.relative to be a useful method. Also note that of course path.resolve without a second argument will resolve relative to process.cwd(), not relative to __filename. This is rarely what you want. On Wednesday, December 26, 2012 10:12:13 AM UTC-5, dar...@darrenwhitlen.com wrote: Hi, Trying to simply require() in a .js file seems to be failing for me here, raising a MODULE_NOT_FOUND error. However - a fs.readFileSync() on the file does work. My current failing debug code: // Fails require(require('path').resolve(module_file)); // Works require('fs').readFileSync(require('path').resolve(module_file), 'UTF8'); Since the readFileSync() call works I can rule out any file/directory permissions leaving me with absolutely no ideas left as to why require() cannot find the file? Anyone have any debugging pointers to share? Darren -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
[nodejs] Re: Checking node_modules into git
This is good approach, but only for final applications, you should never commit dependencies into repositories of resuable (generic) modules. I have great experience with that, and to me it's the *only* way to assure that installation of application is straightforward and the only way to make sure that your project is installed in designated places as you expect. First thing: You don't rely on npm repository state. That's not just about npm uptime, but mind that any package may be removed or replaced (even specific version of package may be replaced by the author with different code). Imagine that after one year of finished development you want to install project and you depend on npm state from year before, there's a chance that you'll run into problems. Second thing: You don't rely on the network, therefore you can easily install your product being behind firewall which may block connection to npm repository. On Thursday, December 27, 2012 1:05:45 AM UTC+1, José F. Romaniello wrote: Hi all, I have read few times that is better to checking the dependencies folder into git when you are working on a project that must be deployed, it seems that this makes testing and maintainance easier. So, the advice seems be flexible with the dependencies for libraries, and very strict for projects. For me the pros are: - dont have to blindly trust the correct use of semver from the package owner - make sure everyone has the same versions - probabily faster to deploy, since npm install will do nothing The bigger cons I see is that i dont like something in GIT that can be auto-generated. It will happen almost for sure that someone will commit a change in the package.json updating the version of the dependency and forget about the node_modules or vicecersa. It will be easy to notice if it breacks a test but not sure who wants to be dealing with that after all... Thoughts? experiences? Thanks! -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
[nodejs] node.js on a Solaris 11.1
Hi. I'm trying to build a node.js 0.8.16 on a Solaris 11.1 machine, and I'm getting the error: gmake -C out BUILDTYPE=Release V=1 gmake[1]: Вход в каталог `/home/emz/src/node-v0.8.16/out' LD_LIBRARY_PATH=/home/emz/src/node-v0.8.16/out/Release/lib.host:/home/emz/src/node-v0.8.16/out/Release/lib.target:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd ../.; mkdir -p /home/emz/src/node-v0.8.16/out/Release/obj/gen; tools/genv8constants.py /home/emz/src/node-v0.8.16/out/Release/obj/gen/v8constants.h /home/emz/src/node-v0.8.16/out/Release/obj.target/deps/v8/tools/gyp/libv8_base.a Traceback (most recent call last): File tools/genv8constants.py, line 20, in module bufsize=-1, stdout=subprocess.PIPE).stdout; File /usr/local/python/lib/python2.7/subprocess.py, line 679, in __init__ errread, errwrite) File /usr/local/python/lib/python2.7/subprocess.py, line 1249, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory gmake[1]: *** [/home/emz/src/node-v0.8.16/out/Release/obj/gen/v8constants.h] Ошибка 1 gmake[1]: Выход из каталога `/home/emz/src/node-v0.8.16/out' gmake: *** [node] Ошибка 2 Is there any way to get rid of it ? Thanks. -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
[nodejs] node.js on Solaris 10
Hi. How do you guys build it on Solaris ? Because I'm stuck. I have a Solaris 10 server and I need to put a node.js on it. First of all I tried to build it with default gcc 3.4.x. After fixing most of the python tools errors (I really miss the autotools), adding various --std=c99 and -D_XPG6 flags I got in the end: [...] g++ '-DSUNOS_NO_IFADDRS' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DENABLE_DEBUGGER_SUPPORT' '-DV8_TARGET_ARCH_IA32' '-D__C99FEATURES__=1' -I../deps/v8/src -Wall -m32 -pthreads -fno-strict-aliasing -m32 -O2 -fno-strict-aliasing -ffunction-sections -fdata-sections -g -fno-omit-frame-pointer -fno-rtti -fno-exceptions -MMD -MF /home/emz/src/node-v0.8.16/out/Release/.deps//home/emz/src/node-v0.8.16/out/Release/obj.target/v8_base/deps/v8/src/elements-kind.o.d.raw -c -o /home/emz/src/node-v0.8.16/out/Release/obj.target/v8_base/deps/v8/src/elements-kind.o ../deps/v8/src/elements-kind.cc In file included from ../deps/v8/src/elements.h:32, from ../deps/v8/src/objects-inl.h:38, from ../deps/v8/src/v8.h:60, from ../deps/v8/src/api.h:31, from ../deps/v8/src/elements-kind.cc:30: ../deps/v8/src/objects.h:1006: warning: integer overflow in expression ../deps/v8/src/elements-kind.cc: In function `v8::internal::ElementsKind v8::internal::GetInitialFastElementsKind()': ../deps/v8/src/elements-kind.cc:44: internal compiler error: in c_expand_expr, at c-common.c:4138 Please submit a full bug report, with preprocessed source if appropriate. See URL:http://gcc.gnu.org/bugs.html for instructions. gmake[1]: *** [/home/emz/src/node-v0.8.16/out/Release/obj.target/v8_base/deps/v8/src/elements-kind.o] Error 1 gmake[1]: Leaving directory `/home/emz/src/node-v0.8.16/out' gmake: *** [node] Error 2 I guess nobody is interested in fixing long ago rested in piece GCC 3.x. I tried to build node.js with a Sun Studio (nowdays Oracle Studio) complier but it seems like python tools expect GCC only. So... I tried to build a newer 0.9.x branch. After doing same stufff (adding a couple of --std=c99 and -D_XPG6 flags to some .mk and .gyp) I got the following issue: /usr/sfw/bin/gcc '-DSUNOS_NO_IFADDRS' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D_GNU_SOURCE' '-DHAVE_CONFIG_H' '-D__EXTENSIONS__' '-D_XOPEN_SOURCE=500' '-D_XPG6' -I../deps/uv/include -I../deps/uv/include/uv-private -I../deps/uv/src -pthreads -Wall -Wextra -Wno-unused-parameter -m32 -pthreads -g --std=c99 -pedantic -Wall -Wextra -Wno-unused-parameter -O2 -fno-strict-aliasing -ffunction-sections -fdata-sections -g -fno-omit-frame-pointer -MMD -MF /home/emz/src/node-v0.9.4/out/Release/.deps//home/emz/src/node-v0.9.4/out/Release/obj.target/libuv/deps/uv/src/unix/sunos.o.d.raw -c -o /home/emz/src/node-v0.9.4/out/Release/obj.target/libuv/deps/uv/src/unix/sunos.o ../deps/uv/src/unix/sunos.c ../deps/uv/src/unix/sunos.c: In function `uv__platform_loop_init': ../deps/uv/src/unix/sunos.c:67: error: structure has no member named `fs_fd' ../deps/uv/src/unix/sunos.c: In function `uv__platform_loop_delete': ../deps/uv/src/unix/sunos.c:80: error: structure has no member named `fs_fd' ../deps/uv/src/unix/sunos.c:81: error: structure has no member named `fs_fd' ../deps/uv/src/unix/sunos.c:82: error: structure has no member named `fs_fd' gmake[1]: *** [/home/emz/src/node-v0.9.4/out/Release/obj.target/libuv/deps/uv/src/unix/sunos.o] Error 1 gmake[1]: Leaving directory `/home/emz/src/node-v0.9.4-patched/out' gmake: *** [node] Error 2 My C skills are really low, but I didn't find any traces of the fs_ds in the uv_loop_t struct. Can you guys help me with it ? Thanks. -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] Checking node_modules into git
There was a blog post on the node.js blog comparing the npm-shrinkwrap and node_modules approaches: http://blog.nodejs.org/2012/02/27/managing-node-js-dependencies-with-shrinkwrap/ Basically, checking node_modules into git works fine until you need to use a binary module, or a module with a binary dependency. You don't want to check in binary files if your server is on a different platform than your development environment. You can hack around it by adding rules to gitignore the binary files and running npm rebuild when you deploy, but npm-shrinkwrap is cleaner and simpler, in my opinion. Feross If you check in the binary, then your code won't run actually be checking in binary filesyou use a binary On Wednesday, December 26, 2012 8:59:11 PM UTC-8, Mikeal Rogers wrote: I wrote an article about it a year ago, it's still relevant. http://www.mikealrogers.com/posts/nodemodules-in-git.html On Dec 26, 2012, at December 26, 20124:05 PM, José F. Romaniello jfroma...@gmail.com javascript: wrote: Hi all, I have read few times that is better to checking the dependencies folder into git when you are working on a project that must be deployed, it seems that this makes testing and maintainance easier. So, the advice seems be flexible with the dependencies for libraries, and very strict for projects. For me the pros are: - dont have to blindly trust the correct use of semver from the package owner - make sure everyone has the same versions - probabily faster to deploy, since npm install will do nothing The bigger cons I see is that i dont like something in GIT that can be auto-generated. It will happen almost for sure that someone will commit a change in the package.json updating the version of the dependency and forget about the node_modules or vicecersa. It will be easy to notice if it breacks a test but not sure who wants to be dealing with that after all... Thoughts? experiences? Thanks! -- 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 nod...@googlegroups.com javascript: To unsubscribe from this group, send email to nodejs+un...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] node.js on Solaris 10
On Thu, Dec 27, 2012 at 11:19 AM, Eugene Zheganin zhega...@gmail.com wrote: Hi. How do you guys build it on Solaris ? Because I'm stuck. I have a Solaris 10 server and I need to put a node.js on it. First of all I tried to build it with default gcc 3.4.x. After fixing most of the python tools errors (I really miss the autotools), adding various --std=c99 and -D_XPG6 flags I got in the end: [...] g++ '-DSUNOS_NO_IFADDRS' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DENABLE_DEBUGGER_SUPPORT' '-DV8_TARGET_ARCH_IA32' '-D__C99FEATURES__=1' -I../deps/v8/src -Wall -m32 -pthreads -fno-strict-aliasing -m32 -O2 -fno-strict-aliasing -ffunction-sections -fdata-sections -g -fno-omit-frame-pointer -fno-rtti -fno-exceptions -MMD -MF /home/emz/src/node-v0.8.16/out/Release/.deps//home/emz/src/node-v0.8.16/out/Release/obj.target/v8_base/deps/v8/src/elements-kind.o.d.raw -c -o /home/emz/src/node-v0.8.16/out/Release/obj.target/v8_base/deps/v8/src/elements-kind.o ../deps/v8/src/elements-kind.cc In file included from ../deps/v8/src/elements.h:32, from ../deps/v8/src/objects-inl.h:38, from ../deps/v8/src/v8.h:60, from ../deps/v8/src/api.h:31, from ../deps/v8/src/elements-kind.cc:30: ../deps/v8/src/objects.h:1006: warning: integer overflow in expression ../deps/v8/src/elements-kind.cc: In function `v8::internal::ElementsKind v8::internal::GetInitialFastElementsKind()': ../deps/v8/src/elements-kind.cc:44: internal compiler error: in c_expand_expr, at c-common.c:4138 Please submit a full bug report, with preprocessed source if appropriate. See URL:http://gcc.gnu.org/bugs.html for instructions. gmake[1]: *** [/home/emz/src/node-v0.8.16/out/Release/obj.target/v8_base/deps/v8/src/elements-kind.o] Error 1 gmake[1]: Leaving directory `/home/emz/src/node-v0.8.16/out' gmake: *** [node] Error 2 I guess nobody is interested in fixing long ago rested in piece GCC 3.x. I tried to build node.js with a Sun Studio (nowdays Oracle Studio) complier but it seems like python tools expect GCC only. So... I tried to build a newer 0.9.x branch. After doing same stufff (adding a couple of --std=c99 and -D_XPG6 flags to some .mk and .gyp) I got the following issue: /usr/sfw/bin/gcc '-DSUNOS_NO_IFADDRS' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D_GNU_SOURCE' '-DHAVE_CONFIG_H' '-D__EXTENSIONS__' '-D_XOPEN_SOURCE=500' '-D_XPG6' -I../deps/uv/include -I../deps/uv/include/uv-private -I../deps/uv/src -pthreads -Wall -Wextra -Wno-unused-parameter -m32 -pthreads -g --std=c99 -pedantic -Wall -Wextra -Wno-unused-parameter -O2 -fno-strict-aliasing -ffunction-sections -fdata-sections -g -fno-omit-frame-pointer -MMD -MF /home/emz/src/node-v0.9.4/out/Release/.deps//home/emz/src/node-v0.9.4/out/Release/obj.target/libuv/deps/uv/src/unix/sunos.o.d.raw -c -o /home/emz/src/node-v0.9.4/out/Release/obj.target/libuv/deps/uv/src/unix/sunos.o ../deps/uv/src/unix/sunos.c ../deps/uv/src/unix/sunos.c: In function `uv__platform_loop_init': ../deps/uv/src/unix/sunos.c:67: error: structure has no member named `fs_fd' ../deps/uv/src/unix/sunos.c: In function `uv__platform_loop_delete': ../deps/uv/src/unix/sunos.c:80: error: structure has no member named `fs_fd' ../deps/uv/src/unix/sunos.c:81: error: structure has no member named `fs_fd' ../deps/uv/src/unix/sunos.c:82: error: structure has no member named `fs_fd' gmake[1]: *** [/home/emz/src/node-v0.9.4/out/Release/obj.target/libuv/deps/uv/src/unix/sunos.o] Error 1 gmake[1]: Leaving directory `/home/emz/src/node-v0.9.4-patched/out' gmake: *** [node] Error 2 My C skills are really low, but I didn't find any traces of the fs_ds in the uv_loop_t struct. Can you guys help me with it ? Thanks. Can you try a patch? Apply it with: curl -s https://github.com/bnoordhuis/libuv/commit/6e12bff.patch | git apply --directory=deps/uv -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] node.js on a Solaris 11.1
On Thu, Dec 27, 2012 at 12:24 PM, Eugene Zheganin zhega...@gmail.com wrote: Hi. I'm trying to build a node.js 0.8.16 on a Solaris 11.1 machine, and I'm getting the error: gmake -C out BUILDTYPE=Release V=1 gmake[1]: Вход в каталог `/home/emz/src/node-v0.8.16/out' LD_LIBRARY_PATH=/home/emz/src/node-v0.8.16/out/Release/lib.host:/home/emz/src/node-v0.8.16/out/Release/lib.target:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd ../.; mkdir -p /home/emz/src/node-v0.8.16/out/Release/obj/gen; tools/genv8constants.py /home/emz/src/node-v0.8.16/out/Release/obj/gen/v8constants.h /home/emz/src/node-v0.8.16/out/Release/obj.target/deps/v8/tools/gyp/libv8_base.a Traceback (most recent call last): File tools/genv8constants.py, line 20, in module bufsize=-1, stdout=subprocess.PIPE).stdout; File /usr/local/python/lib/python2.7/subprocess.py, line 679, in __init__ errread, errwrite) File /usr/local/python/lib/python2.7/subprocess.py, line 1249, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory gmake[1]: *** [/home/emz/src/node-v0.8.16/out/Release/obj/gen/v8constants.h] Ошибка 1 gmake[1]: Выход из каталога `/home/emz/src/node-v0.8.16/out' gmake: *** [node] Ошибка 2 Is there any way to get rid of it ? Thanks. Presumably the dtrace glue code failed to generate. Does the build succeed when you run `./configure --without-dtrace`? -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
[nodejs] process id from unix socket
I'm using unix sockets of 'net' -module to send events between desktop compositor and apps on linux. I know unix sockets would let me to retrieve ucred -struct, which tells me pid, gid and uid of the process. But node.js doesn't seem to have API for that. How do I get this information otherwise? If I get it through the socket itself, I cannot know whether it's correct. Though I'm doing that workaround if I won't get it otherwise. -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] http request hangs
Unfortunately as a me too post, we have been seeing this random stalling behaviour for our Node server as well in recent weeks. The issue is described in the Restler issue log, since we use Restler on top of Node. https://github.com/danwrong/restler/issues/102 In summary, we use Node (Windows) as a web socket server via Sockjs. The front-end part of accepting client connections and responding works fine. But backend HTTP requests it is supposed to make would cease to happen after a random period of time (couple of days to couple of hours) for some unknown reason. As in, absolutely no TCP socket opened on the network adapter to connect to backend server. Only workaround is to restart the node.exe process. Would appreciate advice on how to diagnose this problem; the unreliability is affecting us significantly. Happens be it v0.6 or v0.8. Thanks, Aaron On Monday, 22 October 2012 18:58:04 UTC+8, Michael wrote: ok. I will trace all if the problem happens again. We can not reproduce the failure at the moment, so we have top wait until it happens... -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] http request hangs
Hi Aaron, I haven't found the solution yet. For the moment my system runs with http.globalAgent.maxSockets = 1 I haven't had the problem since then...:) Maybe this could help you? Am 27.12.2012 um 13:17 schrieb Aaron Seet icel...@gmail.com: Unfortunately as a me too post, we have been seeing this random stalling behaviour for our Node server as well in recent weeks. The issue is described in the Restler issue log, since we use Restler on top of Node. https://github.com/danwrong/restler/issues/102 In summary, we use Node (Windows) as a web socket server via Sockjs. The front-end part of accepting client connections and responding works fine. But backend HTTP requests it is supposed to make would cease to happen after a random period of time (couple of days to couple of hours) for some unknown reason. As in, absolutely no TCP socket opened on the network adapter to connect to backend server. Only workaround is to restart the node.exe process. Would appreciate advice on how to diagnose this problem; the unreliability is affecting us significantly. Happens be it v0.6 or v0.8. Thanks, Aaron On Monday, 22 October 2012 18:58:04 UTC+8, Michael wrote: ok. I will trace all if the problem happens again. We can not reproduce the failure at the moment, so we have top wait until it happens... -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] Checking node_modules into git
Thank you all.. All these are very good points and I didnt know about shrinkwrap! I will try it. 2012/12/27 Feross Aboukhadijeh fer...@gmail.com There was a blog post on the node.js blog comparing the npm-shrinkwrap and node_modules approaches: http://blog.nodejs.org/2012/02/27/managing-node-js-dependencies-with-shrinkwrap/ Basically, checking node_modules into git works fine until you need to use a binary module, or a module with a binary dependency. You don't want to check in binary files if your server is on a different platform than your development environment. You can hack around it by adding rules to gitignore the binary files and running npm rebuild when you deploy, but npm-shrinkwrap is cleaner and simpler, in my opinion. Feross If you check in the binary, then your code won't run actually be checking in binary filesyou use a binary On Wednesday, December 26, 2012 8:59:11 PM UTC-8, Mikeal Rogers wrote: I wrote an article about it a year ago, it's still relevant. http://www.mikealrogers.com/**posts/nodemodules-in-git.htmlhttp://www.mikealrogers.com/posts/nodemodules-in-git.html On Dec 26, 2012, at December 26, 20124:05 PM, José F. Romaniello jfroma...@gmail.com wrote: Hi all, I have read few times that is better to checking the dependencies folder into git when you are working on a project that must be deployed, it seems that this makes testing and maintainance easier. So, the advice seems be flexible with the dependencies for libraries, and very strict for projects. For me the pros are: - dont have to blindly trust the correct use of semver from the package owner - make sure everyone has the same versions - probabily faster to deploy, since npm install will do nothing The bigger cons I see is that i dont like something in GIT that can be auto-generated. It will happen almost for sure that someone will commit a change in the package.json updating the version of the dependency and forget about the node_modules or vicecersa. It will be easy to notice if it breacks a test but not sure who wants to be dealing with that after all... Thoughts? experiences? Thanks! -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/**node/wiki/Mailing-List-** Posting-Guidelineshttps://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 nod...@googlegroups.com To unsubscribe from this group, send email to nodejs+un...@**googlegroups.com For more options, visit this group at http://groups.google.com/**group/nodejs?hl=en?hl=enhttp://groups.google.com/group/nodejs?hl=en?hl=en -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] node.js on a Solaris 11.1
Hi. Thursday, Dec 27 2012 г., 18:10:16 UTC+6 Ben Noordhuis wrote: Presumably the dtrace glue code failed to generate. Does the build succeed when you run `./configure --without-dtrace`? Yup, thanks a lot ! -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] node.js on Solaris 10
Hi. Thursday, Dec 27 2012, 18:07:27 UTC+6 Ben Noordhuis wrote: Can you try a patch? Apply it with: curl -s https://github.com/bnoordhuis/libuv/commit/6e12bff.patch | git apply --directory=deps/uv Thanks a lot ! Patch helped to pass the crash point, but then I was hit by the same error as in the 0.8.x case: [...] g++ '-DSUNOS_NO_IFADDRS' '-DENABLE_DEBUGGER_SUPPORT' '-DENABLE_EXTRA_CHECKS' '-DV8_TARGET_ARCH_IA32' '-D__C99FEATURES__=1' -I../deps/v8/src -Wall -Wextra -Wno-unused-parameter -m32 -pthreads -fno-strict-aliasing -m32 -O2 -fno-strict-aliasing -ffunction-sections -fdata-sections -g -fno-omit-frame-pointer -fno-rtti -fno-exceptions -MMD -MF /home/emz/src/node-v0.9.4/out/Release/.deps//home/emz/src/node-v0.9.4/out/Release/obj.target/v8_base/deps/v8/src/elements-kind.o.d.raw -c -o /home/emz/src/node-v0.9.4/out/Release/obj.target/v8_base/deps/v8/src/elements-kind.o ../deps/v8/src/elements-kind.cc In file included from ../deps/v8/src/elements.h:32, from ../deps/v8/src/objects-inl.h:38, from ../deps/v8/src/v8.h:60, from ../deps/v8/src/api.h:31, from ../deps/v8/src/elements-kind.cc:30: ../deps/v8/src/objects.h:1029: warning: integer overflow in expression ../deps/v8/src/elements-kind.cc: In function `v8::internal::ElementsKind v8::internal::GetInitialFastElementsKind()': ../deps/v8/src/elements-kind.cc:44: internal compiler error: in c_expand_expr, at c-common.c:4138 Please submit a full bug report, with preprocessed source if appropriate. See URL:http://gcc.gnu.org/bugs.html for instructions. gmake[1]: *** [/home/emz/src/node-v0.9.4/out/Release/obj.target/v8_base/deps/v8/src/elements-kind.o] Error 1 gmake[1]: Leaving directory `/home/emz/src/node-v0.9.4/out' gmake: *** [node] Error 2 As I said, I understand that nobody would mess with the old and outdated compiler in Solaris 10 (I understood this point when I was fighting with some code in other opensource projects, and I accept my doom). But perhaps anyone could suggest the way of building node.js on Solaris 10 ? Is there any way I can try to use Oracle Studio compiler (I understand I need some way to bypass the python autotools, I didn't figure out it yet) ? Thanks. -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
[nodejs] requesting guidance on possible contributions: reassigning console.log to a different stream and enabling debugger programmatically
Hi, There are two changes to node that I'm considering contributing. Before I get started, I wanted to get some guidance on whether these things might ever be accepted into master. *1. allow reassigning of console.log (and console.error, etc.) to other output streams* * * Right now (as far as I can tell) the console logging functions always write to the original stdout or stderr streams that the process was passed at creation. I believe it would be nice to be able to reassign these to any stream object. The use case for me is when node is launched as a child process and stdout is used for IPC with the parent. It's annoying to write an IPC protocol that's tolerant to random strings getting written to stdout (via spurious console.logs in packages I didn't write). An alternative to allowing this reassignment could be to have a call that sets all console logging functions to write to stderr. (Then stdout would be left free for IPC.) This might be drastically simpler. A few questions: - Where should the API call go? The 'util' package? And, any guidance on what the API should be? - Right now, writes to stdout/stderr are usually blocking. Would we be opening up a can of worms by trying to have console.log write to streams in non-blocking ways? - If we consider this change, would we also change the logging functions in the 'util' package? Would we allow the user to switch each separately, or would console.log/util.log always write to the same place (and the same for console.error/util.error)? - Are there logging functions other than console.log/info/debug/error and util.debug/error/puts/print/log? *2. allow enabling the V8 debugger programmatically (from a JS call)* * * Right now, one can hackily enable the V8 debugger from JS by doing: process.kill(process.pid, SIGUSR1); However, this doesn't provide any feedback: the caller has no way of knowing if/when the debugger is enabled, nor any notification of why enabling failed (e.g. because port 5858 is already open in another process). Additionally, the caller can't control what port the debugger is opened on. My use case for this is, again, in the situation where node is being run as a child process. The child process runs a server, and clients communicate over a websocket. I currently allow clients to enable debugging using the hack above (and then do the debugging using node-inspector). But, it would be nice to provide feedback to the client when it fails (and to allow the user to set alternate ports). If we consider this change, what should the API be? How about something like: process.enableDebugger([port], [callback(err)]) Thanks! -- Joel -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] node.js on Solaris 10
On Thu, Dec 27, 2012 at 3:11 PM, Eugene Zheganin zhega...@gmail.com wrote: Hi. Thursday, Dec 27 2012, 18:07:27 UTC+6 Ben Noordhuis wrote: Can you try a patch? Apply it with: curl -s https://github.com/bnoordhuis/libuv/commit/6e12bff.patch | git apply --directory=deps/uv Thanks a lot ! Patch helped to pass the crash point, but then I was hit by the same error as in the 0.8.x case: [...] g++ '-DSUNOS_NO_IFADDRS' '-DENABLE_DEBUGGER_SUPPORT' '-DENABLE_EXTRA_CHECKS' '-DV8_TARGET_ARCH_IA32' '-D__C99FEATURES__=1' -I../deps/v8/src -Wall -Wextra -Wno-unused-parameter -m32 -pthreads -fno-strict-aliasing -m32 -O2 -fno-strict-aliasing -ffunction-sections -fdata-sections -g -fno-omit-frame-pointer -fno-rtti -fno-exceptions -MMD -MF /home/emz/src/node-v0.9.4/out/Release/.deps//home/emz/src/node-v0.9.4/out/Release/obj.target/v8_base/deps/v8/src/elements-kind.o.d.raw -c -o /home/emz/src/node-v0.9.4/out/Release/obj.target/v8_base/deps/v8/src/elements-kind.o ../deps/v8/src/elements-kind.cc In file included from ../deps/v8/src/elements.h:32, from ../deps/v8/src/objects-inl.h:38, from ../deps/v8/src/v8.h:60, from ../deps/v8/src/api.h:31, from ../deps/v8/src/elements-kind.cc:30: ../deps/v8/src/objects.h:1029: warning: integer overflow in expression ../deps/v8/src/elements-kind.cc: In function `v8::internal::ElementsKind v8::internal::GetInitialFastElementsKind()': ../deps/v8/src/elements-kind.cc:44: internal compiler error: in c_expand_expr, at c-common.c:4138 Please submit a full bug report, with preprocessed source if appropriate. See URL:http://gcc.gnu.org/bugs.html for instructions. gmake[1]: *** [/home/emz/src/node-v0.9.4/out/Release/obj.target/v8_base/deps/v8/src/elements-kind.o] Error 1 gmake[1]: Leaving directory `/home/emz/src/node-v0.9.4/out' gmake: *** [node] Error 2 As I said, I understand that nobody would mess with the old and outdated compiler in Solaris 10 (I understood this point when I was fighting with some code in other opensource projects, and I accept my doom). But perhaps anyone could suggest the way of building node.js on Solaris 10 ? Is there any way I can try to use Oracle Studio compiler (I understand I need some way to bypass the python autotools, I didn't figure out it yet) ? Thanks. Oracle Studio (nay Sun Studio) is not really supported. The minimum requirement is gcc 4.2. I believe there are pre-compiled 4.5 packages but if not, compiling from source is not difficult. -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] Substream of Streams2 ReadableStream
Fixed using nextTick in https://github.com/bmeck/node-tart/blob/b44c960b18904b4ba1b36f02c2e3f569af948503/lib/substream.js . Basically, when having a stream that has read the end of it's data and is also ending at the same time, you need to nextTick the cb(null, null) otherwise the consumer must do unnecessary reads. -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] http request hangs
Thanks for the suggestion; i will try that tomorrow. However, netstat would not show any existing TCP connection to the backend server, so I'm not sure if providing a high number would somehow encourage Node to continue opening new connections. Do you notice growing memory leak with such a setting? thanks, Aaron On Thursday, 27 December 2012 22:01:24 UTC+8, Michael wrote: Hi Aaron, I haven't found the solution yet. For the moment my system runs with http.globalAgent.maxSockets = 1 I haven't had the problem since then...:) Maybe this could help you? -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] Load Html file.
Thanks Martin, I will read the tutorials. cheers. -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] Re: require() MODULE_NOT_FOUND - yet it does exist
On Thu, Dec 27, 2012 at 12:43 AM, Jonathan Chayce Dickinson jonathand...@gmail.com wrote: In a nutshell you need to have the .js file in a directory node_modules either in the directory that contains the .js that is 'requiring', or a ancestor directory. For example, assuming the file that is 'requiring' lives at: /users/thatguy/dev/foo/bar/baz/myscript.js, the following paths would be checked for require('fob'). All of that is bypassed, though, if the value passed to require() is an absolute path. With an absolute path, the target can be anywhere, and no search / path walk is required. -- Martin Cooper - /users/thatguy/dev/foo/bar/baz/node_modules/fob.js - /users/thatguy/dev/foo/bar/baz/node_modules/fob/index.js - /users/thatguy/dev/foo/bar/node_modules/fob.js - /users/thatguy/dev/foo/bar/node_modules/fob/index.js - /users/thatguy/dev/foo/node_modules/fob.js - /users/thatguy/dev/foo/node_modules/fob/index.js - /users/thatguy/dev/node_modules/fob.js - /users/thatguy/dev/node_modules/fob/index.js - /users/thatguy/node_modules/fob.js - /users/thatguy/node_modules/fob/index.js - /users/node_modules/fob.js - /users/node_modules/fob/index.js - /node_modules/fob.js - /node_modules/fob/index.js Note that you can override the 'index.js' with a package.json: http://nodejs.org/api/modules.html#modules_folders_as_modules What I suspect may be catching you off-guard is that you assume that global modules are checked as well. The name is 'global modules' entirely misleading, it's more along the lines of 'global node binaries'. When you install a package with -g npm creates a script that invokes it and nothing more (allowing you to e.g. 'jake build' from anywhere). 'require' does *not *look in the global modules (you can get npm to symlinkhttps://npmjs.org/doc/link.html from the global modules into your local modules, but that is mostly 'superficial'). Jonathan On Thu, Dec 27, 2012 at 2:44 AM, Isaac Schlueter i...@izs.me wrote: Yeah, share the actual example code. require() works fine with absolute paths. $ cat b.js console.log('hello from b', __filename) ^D $ cat a.js require(require('path').resolve('b.js')) ^D $ node a.js hello from b /Users/isaacs/dev/js/node-master/b.js On Wed, Dec 26, 2012 at 4:33 PM, Domenic Denicola dome...@domenicdenicola.com wrote: I don't believe `require` works with absolute paths, like those generated by path.resolve. (Could be wrong.) If I'm correct, then you may find path.relative to be a useful method. Also note that of course path.resolve without a second argument will resolve relative to process.cwd(), not relative to __filename. This is rarely what you want. On Wednesday, December 26, 2012 10:12:13 AM UTC-5, dar...@darrenwhitlen.com wrote: Hi, Trying to simply require() in a .js file seems to be failing for me here, raising a MODULE_NOT_FOUND error. However - a fs.readFileSync() on the file does work. My current failing debug code: // Fails require(require('path').resolve(module_file)); // Works require('fs').readFileSync(require('path').resolve(module_file), 'UTF8'); Since the readFileSync() call works I can rule out any file/directory permissions leaving me with absolutely no ideas left as to why require() cannot find the file? Anyone have any debugging pointers to share? Darren -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en -- 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] Inconsistent method names?
Hi, I am quite new to node.js. As far as I can see the method names aren't very consistent. Take the methods from File System for example: http://nodejs.org/api/fs.html It is .readFile (Camelcase) But it is .readdir (all lowercase) There are a few more such cases where I don't see a pattern when camelcase is used and when not. You could say that this is absolutely irrelevant and you would be right. But it annoys me :-( And it reminds me of PHP syntax garbage. Is there any interest in getting all method names either camelcase or lowercase, or will this just stay as is? ~dave -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] Inconsistent method names?
As for readdir (and many other functions in the fs module) they are named to match the underlying POSIX function name. For instance: http://linux.die.net/man/3/readdir readFile is an abstraction created by Node so it adheres to naming standards. On Thu, Dec 27, 2012 at 12:02 PM, David Habereder david.habere...@gmail.com wrote: Hi, I am quite new to node.js. As far as I can see the method names aren't very consistent. Take the methods from File System for example: http://nodejs.org/api/fs.html It is .readFile (Camelcase) But it is .readdir (all lowercase) There are a few more such cases where I don't see a pattern when camelcase is used and when not. You could say that this is absolutely irrelevant and you would be right. But it annoys me :-( And it reminds me of PHP syntax garbage. Is there any interest in getting all method names either camelcase or lowercase, or will this just stay as is? ~dave -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] One complicated SQL query or many smaller ones
This is not always true. It's much easier to add more database clients than it is to add database servers. Offloading work from a hot database server to a web cluster can be just as good of an idea.. it depends a lot on your infrastructure and there's no golden bullet for this guy. On Wed, Dec 26, 2012 at 5:23 PM, Jonathan Chayce Dickinson jonathand...@gmail.com wrote: it's usually good to offload as much work to SQL as possible -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] Inconsistent method names?
I think you'll likely find where it isn't the case (such as readdir) the name comes from the POSIX function name. There's no readfile function in POSIX, but there is readdir(). The only other case seems to be readlink, which is the same issue. http://linux.die.net/man/2/readdir http://linux.die.net/man/2/readlink On Thu, Dec 27, 2012 at 1:02 PM, David Habereder david.habere...@gmail.comwrote: Hi, I am quite new to node.js. As far as I can see the method names aren't very consistent. Take the methods from File System for example: http://nodejs.org/api/fs.html It is .readFile (Camelcase) But it is .readdir (all lowercase) There are a few more such cases where I don't see a pattern when camelcase is used and when not. You could say that this is absolutely irrelevant and you would be right. But it annoys me :-( And it reminds me of PHP syntax garbage. Is there any interest in getting all method names either camelcase or lowercase, or will this just stay as is? ~dave -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] Inconsistent method names?
That clears that up. Thanks. Am Donnerstag, 27. Dezember 2012 20:36:30 UTC+1 schrieb Matt Sergeant: I think you'll likely find where it isn't the case (such as readdir) the name comes from the POSIX function name. There's no readfile function in POSIX, but there is readdir(). The only other case seems to be readlink, which is the same issue. http://linux.die.net/man/2/readdir http://linux.die.net/man/2/readlink On Thu, Dec 27, 2012 at 1:02 PM, David Habereder david.h...@gmail.comjavascript: wrote: Hi, I am quite new to node.js. As far as I can see the method names aren't very consistent. Take the methods from File System for example: http://nodejs.org/api/fs.html It is .readFile (Camelcase) But it is .readdir (all lowercase) There are a few more such cases where I don't see a pattern when camelcase is used and when not. You could say that this is absolutely irrelevant and you would be right. But it annoys me :-( And it reminds me of PHP syntax garbage. Is there any interest in getting all method names either camelcase or lowercase, or will this just stay as is? ~dave -- 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 nod...@googlegroups.comjavascript: To unsubscribe from this group, send email to nodejs+un...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] Inconsistent method names?
Why not also allow readDir? It would cause no harm to do so. This isn't node, but what also bugs me is typeof and instanceof. I cringe every time I type them. On Thu, Dec 27, 2012 at 11:47 AM, David Habereder david.habere...@gmail.com wrote: That clears that up. Thanks. Am Donnerstag, 27. Dezember 2012 20:36:30 UTC+1 schrieb Matt Sergeant: I think you'll likely find where it isn't the case (such as readdir) the name comes from the POSIX function name. There's no readfile function in POSIX, but there is readdir(). The only other case seems to be readlink, which is the same issue. http://linux.die.net/man/2/readdir http://linux.die.net/man/2/readlink On Thu, Dec 27, 2012 at 1:02 PM, David Habereder david.h...@gmail.com wrote: Hi, I am quite new to node.js. As far as I can see the method names aren't very consistent. Take the methods from File System for example: http://nodejs.org/api/fs.html It is .readFile (Camelcase) But it is .readdir (all lowercase) There are a few more such cases where I don't see a pattern when camelcase is used and when not. You could say that this is absolutely irrelevant and you would be right. But it annoys me :-( And it reminds me of PHP syntax garbage. Is there any interest in getting all method names either camelcase or lowercase, or will this just stay as is? ~dave -- 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 nod...@googlegroups.com To unsubscribe from this group, send email to nodejs+un...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] Inconsistent method names?
It just occurred to me that I can do fs.readDir = fs.readdir. Will this apply to fs in every module? A normal module only has one copy. Is there only one instance of fs? If it does work then I'll make a module that fixes all of these. It won't break anything. On Thu, Dec 27, 2012 at 12:13 PM, Mark Hahn m...@hahnca.com wrote: Why not also allow readDir? It would cause no harm to do so. This isn't node, but what also bugs me is typeof and instanceof. I cringe every time I type them. On Thu, Dec 27, 2012 at 11:47 AM, David Habereder david.habere...@gmail.com wrote: That clears that up. Thanks. Am Donnerstag, 27. Dezember 2012 20:36:30 UTC+1 schrieb Matt Sergeant: I think you'll likely find where it isn't the case (such as readdir) the name comes from the POSIX function name. There's no readfile function in POSIX, but there is readdir(). The only other case seems to be readlink, which is the same issue. http://linux.die.net/man/2/readdir http://linux.die.net/man/2/readlink On Thu, Dec 27, 2012 at 1:02 PM, David Habereder david.h...@gmail.com wrote: Hi, I am quite new to node.js. As far as I can see the method names aren't very consistent. Take the methods from File System for example: http://nodejs.org/api/fs.html It is .readFile (Camelcase) But it is .readdir (all lowercase) There are a few more such cases where I don't see a pattern when camelcase is used and when not. You could say that this is absolutely irrelevant and you would be right. But it annoys me :-( And it reminds me of PHP syntax garbage. Is there any interest in getting all method names either camelcase or lowercase, or will this just stay as is? ~dave -- 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 nod...@googlegroups.com To unsubscribe from this group, send email to nodejs+un...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] Load Html file.
No, the server is* created once*, and the (anonymous) function that was passed to createServer is called each time a request is handled. That function sends back the contents of the file that was read earlier. Ok, it´s created once, but, if there is another server that was created? I have to put the same port? Another thing interesting, when i put the same port or any other port in listen() is that when i reload in the first time my view is rendered normally, on the second time my view lose the css and on the third time i lost the contact with the server, but when i don´t put anything in listen, the view render normally, why? I'm reading these tutorial, understanding a bit the node, but this is really curious for me... It might be a good idea for you to work through one or two tutorials on Node, so that you get a clearer picture of how it all works. You'll find pointers to several of those in the archives of this list. Those at http://www.nodetuts.com/ and http://www.nodebeginner.org/ seem to be fairly frequently referenced here. I started with nodebeginner, i'm really enjoying, thanks again. -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] Inconsistent method names?
Mark, Yes, there is exactly one require(fs). On Thu, Dec 27, 2012 at 12:17 PM, Mark Hahn m...@hahnca.com wrote: It just occurred to me that I can do fs.readDir = fs.readdir. Will this apply to fs in every module? A normal module only has one copy. Is there only one instance of fs? If it does work then I'll make a module that fixes all of these. It won't break anything. On Thu, Dec 27, 2012 at 12:13 PM, Mark Hahn m...@hahnca.com wrote: Why not also allow readDir? It would cause no harm to do so. This isn't node, but what also bugs me is typeof and instanceof. I cringe every time I type them. On Thu, Dec 27, 2012 at 11:47 AM, David Habereder david.habere...@gmail.com wrote: That clears that up. Thanks. Am Donnerstag, 27. Dezember 2012 20:36:30 UTC+1 schrieb Matt Sergeant: I think you'll likely find where it isn't the case (such as readdir) the name comes from the POSIX function name. There's no readfile function in POSIX, but there is readdir(). The only other case seems to be readlink, which is the same issue. http://linux.die.net/man/2/readdir http://linux.die.net/man/2/readlink On Thu, Dec 27, 2012 at 1:02 PM, David Habereder david.h...@gmail.com wrote: Hi, I am quite new to node.js. As far as I can see the method names aren't very consistent. Take the methods from File System for example: http://nodejs.org/api/fs.html It is .readFile (Camelcase) But it is .readdir (all lowercase) There are a few more such cases where I don't see a pattern when camelcase is used and when not. You could say that this is absolutely irrelevant and you would be right. But it annoys me :-( And it reminds me of PHP syntax garbage. Is there any interest in getting all method names either camelcase or lowercase, or will this just stay as is? ~dave -- 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 nod...@googlegroups.com To unsubscribe from this group, send email to nodejs+un...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
[nodejs] Re: Checking node_modules into git
Here's the article I wrote on checking in modules as well. I haven't really tried shrinkwrap, but it sounds like there are enough differences between the two approaches that you should explore both and see which one suits your needs best. I would employ shrinkwrap on a project where the deploy process was straightforward and the deps were very manageable. But as soon as any of that became a problem, I would move to checking in deps without thinking twice. http://eng.yammer.com/managing-node-js-dependencies-and-deployments-at-yammer/ :Marco On Wednesday, December 26, 2012 4:05:45 PM UTC-8, José F. Romaniello wrote: Hi all, I have read few times that is better to checking the dependencies folder into git when you are working on a project that must be deployed, it seems that this makes testing and maintainance easier. So, the advice seems be flexible with the dependencies for libraries, and very strict for projects. For me the pros are: - dont have to blindly trust the correct use of semver from the package owner - make sure everyone has the same versions - probabily faster to deploy, since npm install will do nothing The bigger cons I see is that i dont like something in GIT that can be auto-generated. It will happen almost for sure that someone will commit a change in the package.json updating the version of the dependency and forget about the node_modules or vicecersa. It will be easy to notice if it breacks a test but not sure who wants to be dealing with that after all... Thoughts? experiences? Thanks! -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] Inconsistent method names?
fs.prototype.readDir = function() { return fs.prototype.readdir.apply(this, arguments); } ... if it nags you that much. It's too late to change it now: it's breaking ABI (although I agree; keep your shit consistent, major pet peeve of mine). Jonathan On Thu, Dec 27, 2012 at 10:33 PM, Isaac Schlueter i...@izs.me wrote: Mark, Yes, there is exactly one require(fs). On Thu, Dec 27, 2012 at 12:17 PM, Mark Hahn m...@hahnca.com wrote: It just occurred to me that I can do fs.readDir = fs.readdir. Will this apply to fs in every module? A normal module only has one copy. Is there only one instance of fs? If it does work then I'll make a module that fixes all of these. It won't break anything. On Thu, Dec 27, 2012 at 12:13 PM, Mark Hahn m...@hahnca.com wrote: Why not also allow readDir? It would cause no harm to do so. This isn't node, but what also bugs me is typeof and instanceof. I cringe every time I type them. On Thu, Dec 27, 2012 at 11:47 AM, David Habereder david.habere...@gmail.com wrote: That clears that up. Thanks. Am Donnerstag, 27. Dezember 2012 20:36:30 UTC+1 schrieb Matt Sergeant: I think you'll likely find where it isn't the case (such as readdir) the name comes from the POSIX function name. There's no readfile function in POSIX, but there is readdir(). The only other case seems to be readlink, which is the same issue. http://linux.die.net/man/2/readdir http://linux.die.net/man/2/readlink On Thu, Dec 27, 2012 at 1:02 PM, David Habereder david.h...@gmail.com wrote: Hi, I am quite new to node.js. As far as I can see the method names aren't very consistent. Take the methods from File System for example: http://nodejs.org/api/fs.html It is .readFile (Camelcase) But it is .readdir (all lowercase) There are a few more such cases where I don't see a pattern when camelcase is used and when not. You could say that this is absolutely irrelevant and you would be right. But it annoys me :-( And it reminds me of PHP syntax garbage. Is there any interest in getting all method names either camelcase or lowercase, or will this just stay as is? ~dave -- 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 nod...@googlegroups.com To unsubscribe from this group, send email to nodejs+un...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] Inconsistent method names?
Inline... On Thursday, December 27, 2012, Mark Hahn wrote: Why not also allow readDir? It would cause no harm to do so. This isn't node, but what also bugs me is typeof and instanceof. I cringe every time I type them. Completely irrelevant to the discussion... but you have my attention now—I'm curious to know what sort of program scenarios you've found yourself in where instanceof was the go to solution (but painful to use?), aside from useful type checking (types as in object types, not as in data-types). If you want to know if x has Foo constructor in its prototype chain, instanceof has you covered. Rick On Thu, Dec 27, 2012 at 11:47 AM, David Habereder david.habere...@gmail.com wrote: That clears that up. Thanks. Am Donnerstag, 27. Dezember 2012 20:36:30 UTC+1 schrieb Matt Sergeant: I think you'll likely find where it isn't the case (such as readdir) the name comes from the POSIX function name. There's no readfile function in POSIX, but there is readdir(). The only other case seems to be readlink, which is the same issue. http://linux.die.net/man/2/readdir http://linux.die.net/man/2/readlink On Thu, Dec 27, 2012 at 1:02 PM, David Habereder david.h...@gmail.com wrote: Hi, I am quite new to node.js. As far as I can see the method names aren't very consistent. Take the methods from File System for example: http://nodejs.org/api/fs.html It is .readFile (Camelcase) But it is .readdir (all lowercase) There are a few more such cases where I don't see a pattern when camelcase is used and when not. You could say that this is absolutely irrelevant and you would be right. But it annoys me :-( And it reminds me of PHP syntax garbage. Is there any interest in getting all method names either camelcase or lowercase, or will this just stay as is? ~dave -- 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 nod...@googlegroups.com To unsubscribe from this group, send email to nodejs+un...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en -- 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 To unsubscribe from this group, send email to nodejs+unsubscribe@go -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] Inconsistent method names?
what sort of program scenarios you've found yourself in where instanceof was the go to solution I use typeof a lot, but instanceof not so often. I sometimes use instanceof Array when I don't have a helper around for that. I've just started a module for use in node and the client that fixes these as much as possible. It is annoying when I get an error just because of lack of camelCasing. My mind isn't good at remembering minor things. Does anyone know how I could fix typeof in node? I can see how to do it in the client. Luckily I'm using coffeescript so making typeOf a function will be used like `typeOf x` and it will look the same as typeof `x`. Completely irrelevant to the discussion... What is irrelevant? On Thu, Dec 27, 2012 at 1:06 PM, Rick Waldron waldron.r...@gmail.com wrote: Inline... On Thursday, December 27, 2012, Mark Hahn wrote: Why not also allow readDir? It would cause no harm to do so. This isn't node, but what also bugs me is typeof and instanceof. I cringe every time I type them. Completely irrelevant to the discussion... but you have my attention now—I'm curious to know what sort of program scenarios you've found yourself in where instanceof was the go to solution (but painful to use?), aside from useful type checking (types as in object types, not as in data-types). If you want to know if x has Foo constructor in its prototype chain, instanceof has you covered. Rick On Thu, Dec 27, 2012 at 11:47 AM, David Habereder david.habere...@gmail.com wrote: That clears that up. Thanks. Am Donnerstag, 27. Dezember 2012 20:36:30 UTC+1 schrieb Matt Sergeant: I think you'll likely find where it isn't the case (such as readdir) the name comes from the POSIX function name. There's no readfile function in POSIX, but there is readdir(). The only other case seems to be readlink, which is the same issue. http://linux.die.net/man/2/readdir http://linux.die.net/man/2/readlink On Thu, Dec 27, 2012 at 1:02 PM, David Habereder david.h...@gmail.com wrote: Hi, I am quite new to node.js. As far as I can see the method names aren't very consistent. Take the methods from File System for example: http://nodejs.org/api/fs.html It is .readFile (Camelcase) But it is .readdir (all lowercase) There are a few more such cases where I don't see a pattern when camelcase is used and when not. You could say that this is absolutely irrelevant and you would be right. But it annoys me :-( And it reminds me of PHP syntax garbage. Is there any interest in getting all method names either camelcase or lowercase, or will this just stay as is? ~dave -- 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 nod...@googlegroups.com To unsubscribe from this group, send email to nodejs+un...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en -- 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 To unsubscribe from this group, send email to nodejs+unsubscribe@go -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] Inconsistent method names?
fs.prototype.readDir = function() { return fs.prototype.readdir.apply(this, arguments); } What is the advantage of this over `fs.readDir = fs.readdir;` ? fs.readdir doesn't use `this`, does it? And doesn't `fs.readdir` get the same function as `fs.prototype.readdir`? On Thu, Dec 27, 2012 at 1:32 PM, Mark Hahn m...@hahnca.com wrote: what sort of program scenarios you've found yourself in where instanceof was the go to solution I use typeof a lot, but instanceof not so often. I sometimes use instanceof Array when I don't have a helper around for that. I've just started a module for use in node and the client that fixes these as much as possible. It is annoying when I get an error just because of lack of camelCasing. My mind isn't good at remembering minor things. Does anyone know how I could fix typeof in node? I can see how to do it in the client. Luckily I'm using coffeescript so making typeOf a function will be used like `typeOf x` and it will look the same as typeof `x`. Completely irrelevant to the discussion... What is irrelevant? On Thu, Dec 27, 2012 at 1:06 PM, Rick Waldron waldron.r...@gmail.com wrote: Inline... On Thursday, December 27, 2012, Mark Hahn wrote: Why not also allow readDir? It would cause no harm to do so. This isn't node, but what also bugs me is typeof and instanceof. I cringe every time I type them. Completely irrelevant to the discussion... but you have my attention now—I'm curious to know what sort of program scenarios you've found yourself in where instanceof was the go to solution (but painful to use?), aside from useful type checking (types as in object types, not as in data-types). If you want to know if x has Foo constructor in its prototype chain, instanceof has you covered. Rick On Thu, Dec 27, 2012 at 11:47 AM, David Habereder david.habere...@gmail.com wrote: That clears that up. Thanks. Am Donnerstag, 27. Dezember 2012 20:36:30 UTC+1 schrieb Matt Sergeant: I think you'll likely find where it isn't the case (such as readdir) the name comes from the POSIX function name. There's no readfile function in POSIX, but there is readdir(). The only other case seems to be readlink, which is the same issue. http://linux.die.net/man/2/readdir http://linux.die.net/man/2/readlink On Thu, Dec 27, 2012 at 1:02 PM, David Habereder david.h...@gmail.com wrote: Hi, I am quite new to node.js. As far as I can see the method names aren't very consistent. Take the methods from File System for example: http://nodejs.org/api/fs.html It is .readFile (Camelcase) But it is .readdir (all lowercase) There are a few more such cases where I don't see a pattern when camelcase is used and when not. You could say that this is absolutely irrelevant and you would be right. But it annoys me :-( And it reminds me of PHP syntax garbage. Is there any interest in getting all method names either camelcase or lowercase, or will this just stay as is? ~dave -- 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 nod...@googlegroups.com To unsubscribe from this group, send email to nodejs+un...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en -- 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 To unsubscribe from this group, send email to nodejs+unsubscribe@go -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en -- 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
Re: [nodejs] Inconsistent method names?
Inline.., On Thursday, December 27, 2012, Mark Hahn wrote: what sort of program scenarios you've found yourself in where instanceof was the go to solution I use typeof a lot, but instanceof not so often. I sometimes use instanceof Array when I don't have a helper around for that. Browser or node? In the browser, instanceof fails across frames/global scopes, but all modern browsers and node have the built-in Array.isArray static method. I've just started a module for use in node and the client that fixes these as much as possible. It is annoying when I get an error just because of lack of camelCasing. My mind isn't good at remembering minor things. Not sure I follow this part, are we still on instanceof? What things lack camelCase? The functions in fs, or typeof and instanceof? Does anyone know how I could fix typeof in node? I can see how to do it in the client. Luckily I'm using coffeescript so making typeOf a function will be used like `typeOf x` and it will look the same as typeof `x`. Fix it how? It's an operator, which cant be overloaded or overridden in JavaScript. You could make a custom function... function typeOf(o) { return Object.prototype.toString.call(o).slice(8, -1).toLowerCase(); } I'm mobile and that's not tested, but it probably works. Rick Completely irrelevant to the discussion... What is irrelevant? On Thu, Dec 27, 2012 at 1:06 PM, Rick Waldron waldron.r...@gmail.com wrote: Inline... On Thursday, December 27, 2012, Mark Hahn wrote: Why not also allow readDir? It would cause no harm to do so. This isn't node, but what also bugs me is typeof and instanceof. I cringe every time I type them. Completely irrelevant to the discussion... but you have my attention now—I'm curious to know what sort of program scenarios you've found yourself in where instanceof was the go to solution (but painful to use?), aside from useful type checking (types as in object types, not as in data-types). If you want to know if x has Foo constructor in its prototype chain, instanceof has you covered. Rick On Thu, Dec 27, 2012 at 11:47 AM, David Habereder david.habere...@gmail.com wrote: That clears that up. Thanks. Am Donnerstag, 27. Dezember 2012 20:36:30 UTC+1 schrieb Matt Sergeant: I think you'll likely find where it isn't the case (such as readdir) the name comes from the POSIX function name. There's no readfile function in POSIX, but there is readdir(). The only other case seems to be readlink, which is the same issue. http://linux.die.net/man/2/readdir http://linux.die.net/man/2/readlink On Thu, Dec 27, 2012 at 1:02 PM, David Habereder david.h...@gmail.com wrote: Hi, I am quite new to node.js. As far as I can see the method names aren't very consistent. Take the methods from File System for example: http://nodejs.org/api/fs.html It is .readFile (Camelcase) But it is .readdir (all lowercase) There are a few more such cases where I don't see a pattern when camelcase is used and when not. You could say that this is absolutely irrelevant and you would be right. But it annoys me :-( And it reminds me of PHP syntax garbage. Is there any interest in getting all method names either camelcase or lowercase, or will this just stay as is? ~dave -- 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 nod...@googlegroups.com To unsubscribe from this group, send email to nodejs+un...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en -- Job -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] Inconsistent method names?
On Thu, Dec 27, 2012 at 1:03 PM, Jonathan Chayce Dickinson jonathand...@gmail.com wrote: fs.prototype.readDir = function() { return fs.prototype.readdir.apply(this, arguments); } That's not going to work. fs is an object, not a class. I think what you mean is `fs.readDir = fs.readdir`. We do keep our shit consistent. Specifically, we keep our method names consistent with the posix syscalls they invoke. -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
[nodejs] Re: Inconsistent method names?
Huh, had similar problems, recently had project with a lot of IO, so I just created wrapper over fs. https://github.com/alexeypetrushin/node2 The main reason though was not consistency and legacy bugs ( like fs.exists https://groups.google.com/forum/?fromgroups=#!searchin/nodejs/fs.exists/nodejs/gRRuly79oRc/BC4s4rtF2zEJ ) but handy things like automatically create parent dirs and so on. -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
[nodejs] One JS interface to rule them all?
I am writing this in a canvas-based, curses-style text editor that I have incorporated into my site at http://luvluvluv.info. But more about that later... I started working on the current incarnation of my site just over 3 months ago... my challenge was to develop the best possible JavaScript Web interface, so I chose to use OSX as my model. Ever since I learned about node.js and got bitten by the JavaScript bug, I have wanted to see how far I could push the boundaries of web programming. I can honestly say at this point: pretty damn far, LOL! I finished all of the major icon and window handling work quite a while ago, and I have been recently working on window tiling, the above-mentioned text editor, and now, a chat application. I want to use this site as something that can do, well, anything really. And to be able to do anything, you really do need a text editor that is up to the task. The editor is something of a combination between my favorite aspects of nano and vim. I like nano because there are no weird major modes to trip you up. If you press a key expecting a letter to show up at the cursor, you will always get what you expect. But at the same time, I do enjoy a lot of the functionality of vim. I have put a lot of effort into allowing a lot of different ways to select blocks of text and move them around the page, as well as shifting and trimming/cutting/padding the entire file itself (or portions thereof). I wanted to be able to easily create column-based text documents that could be used for things like push-button database loading (table creation, etc) as well as even doing run time data binding from within the text editor itself (to use it as a kind of in-browser database solution). I even added a command mode that allows users to input arbitrary commands on the status line, so that it can double as a simple command shell. At the moment, there are only a few commands related to editing, but there is no reason to not extend it to more interesting functions :) It wasn't until about 3 months into the programming effort that I even start to *think* about the server side. I wanted to have a tight little chat window that could put node to good use. The chat app is currently at a very basic level, but I want to be able to extend it to allow users to construct natural language queries to submit to the server (I have done quite a bit of NatLang programming in the past, and I'm looking forward to integrating some of my old stuff onto the current site.) There is really so much possibility when using this thing as a development environment. It will allow a new kind of web programming that abstracts away the horrible DOM API very nicely. Here are some of the kinds of applications that I am interested in prototyping/developing. 1) Educational software: this will give educators the ability to quickly develop online lecture presentation material, as well as allowing for the ability to administer and monitor web-based test taking. 2) Government agency web interfaces: for any agency that is concerned primarily with getting its users to navigate to a particular resource, interfaces like this can be very valuable. The web interfaces of most governmental sites leave much to be desired, haha :) 3) Businesses: everything from online customer support to order entry screens to inventory tracking can be greatly facilitated with this technology. Well, this letter has honestly been my first real use of this cool little text editor (I call it archiTex), and I have to say that I am pretty satisfied with it. Hopefully some of you out there can give it a shot and tell me what you think. There are pretty detailed instructions on the site (just click on the Help icon on the dock at the bottom of the page). And I almost forgot to mention: I only develop for Google Chrome, so I highly recommend that you use that. Safari should be pretty much the same for most uses, and Firefox might work, but I don't really care too much if it does. I could not care less if the site causes IE to crash and burn, LOL. -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] Inconsistent method names?
On Thu, Dec 27, 2012 at 1:06 PM, Rick Waldron waldron.r...@gmail.comwrote: Inline... On Thursday, December 27, 2012, Mark Hahn wrote: Why not also allow readDir? It would cause no harm to do so. This isn't node, but what also bugs me is typeof and instanceof. I cringe every time I type them. Completely irrelevant to the discussion... but you have my attention now—I'm curious to know what sort of program scenarios you've found yourself in where instanceof was the go to solution (but painful to use?), aside from useful type checking (types as in object types, not as in data-types). If you want to know if x has Foo constructor in its prototype chain, instanceof has you covered. Unless you're working with VMs, that is. Then you might not get the results you expect. For example, this: var vm = require('vm'), sandbox = {}; vm.runInNewContext(myDate = new Date(), sandbox); console.log(sandbox.myDate instanceof Date); will output 'false', because Date in the new context is not the same as Date in the original context. Just one of those little things to be aware of. -- Martin Cooper Rick On Thu, Dec 27, 2012 at 11:47 AM, David Habereder david.habere...@gmail.com wrote: That clears that up. Thanks. Am Donnerstag, 27. Dezember 2012 20:36:30 UTC+1 schrieb Matt Sergeant: I think you'll likely find where it isn't the case (such as readdir) the name comes from the POSIX function name. There's no readfile function in POSIX, but there is readdir(). The only other case seems to be readlink, which is the same issue. http://linux.die.net/man/2/readdir http://linux.die.net/man/2/readlink On Thu, Dec 27, 2012 at 1:02 PM, David Habereder david.h...@gmail.com wrote: Hi, I am quite new to node.js. As far as I can see the method names aren't very consistent. Take the methods from File System for example: http://nodejs.org/api/fs.html It is .readFile (Camelcase) But it is .readdir (all lowercase) There are a few more such cases where I don't see a pattern when camelcase is used and when not. You could say that this is absolutely irrelevant and you would be right. But it annoys me :-( And it reminds me of PHP syntax garbage. Is there any interest in getting all method names either camelcase or lowercase, or will this just stay as is? ~dave -- 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 nod...@googlegroups.com To unsubscribe from this group, send email to nodejs+un...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en -- 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 To unsubscribe from this group, send email to nodejs+unsubscribe@go -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] Load Html file.
On Thu, Dec 27, 2012 at 12:21 PM, Rodrigo Fonseca fonsecaa...@gmail.comwrote: No, the server is* created once*, and the (anonymous) function that was passed to createServer is called each time a request is handled. That function sends back the contents of the file that was read earlier. Ok, it´s created once, but, if there is another server that was created? I have to put the same port? Another thing interesting, when i put the same port or any other port in listen() is that when i reload in the first time my view is rendered normally, on the second time my view lose the css and on the third time i lost the contact with the server, but when i don´t put anything in listen, the view render normally, why? I'm reading these tutorial, understanding a bit the node, but this is really curious for me... You haven't mentioned CSS before, and you haven't shown us the HTML content, so it's a little hard to know what's going on. However, I should point out that you are responding to *every* request to your server with the contents of the HTML file. So if your CSS URL is also pointing to the same server, it's going to retrieve HTML content and not CSS content. That would not be good! You would need to look at the request, in your server, to determine what you should be sending back. Again, the tutorials should help you understand this better. -- Martin Cooper It might be a good idea for you to work through one or two tutorials on Node, so that you get a clearer picture of how it all works. You'll find pointers to several of those in the archives of this list. Those at http://www.nodetuts.com/ and http://www.nodebeginner.org/ seem to be fairly frequently referenced here. I started with nodebeginner, i'm really enjoying, thanks again. -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] Inconsistent method names?
Inline... On Thursday, December 27, 2012, Martin Cooper wrote: On Thu, Dec 27, 2012 at 1:06 PM, Rick Waldron waldron.r...@gmail.comjavascript:_e({}, 'cvml', 'waldron.r...@gmail.com'); wrote: Inline... On Thursday, December 27, 2012, Mark Hahn wrote: Why not also allow readDir? It would cause no harm to do so. This isn't node, but what also bugs me is typeof and instanceof. I cringe every time I type them. Completely irrelevant to the discussion... but you have my attention now—I'm curious to know what sort of program scenarios you've found yourself in where instanceof was the go to solution (but painful to use?), aside from useful type checking (types as in object types, not as in data-types). If you want to know if x has Foo constructor in its prototype chain, instanceof has you covered. Unless you're working with VMs, that is. Then you might not get the results you expect. For example, this: Next time, please read the entire thread before wasting all of our time trying to correct another poster, by saying almost exactly the same thing as that poster, ie. me: Browser or node? In the browser, instanceof fails across frames/global scopes Despite my being over-specific here, the cross-frame/global scope/context failure still applies anywhere that multiple globals can exist. Rick var vm = require('vm'), sandbox = {}; vm.runInNewContext(myDate = new Date(), sandbox); console.log(sandbox.myDate instanceof Date); will output 'false', because Date in the new context is not the same as Date in the original context. Just one of those little things to be aware of. -- Martin Cooper Rick On Thu, Dec 27, 2012 at 11:47 AM, David Habereder david.habere...@gmail.com wrote: That clears that up. Thanks. Am Donnerstag, 27. Dezember 2012 20:36:30 UTC+1 schrieb Matt Sergeant: I think you'll likely find where it isn't the case (such as readdir) the name comes from the POSIX function name. There's no readfile function in POSIX, but there is readdir(). The only other case seems to be readlink, which is the same issue. http://linux.die.net/man/2/readdir http://linux.die.net/man/2/readlink On Thu, Dec 27, 2012 at 1:02 PM, David Habereder david.h...@gmail.com wrote: Hi, I am quite new to node.js. As far as I can see the method names aren't very consistent. Take the methods from File System for example: http://nodejs.org/api/fs.html It is .readFile (Camelcase) But it is .readdir (all lowercase) There are a few more such cases where I don't see a pattern when camelcase is used and when not. You could say that this is absolutely irrelevant and you would be right. But it annoys me :-( And it reminds me of PHP syntax garbage. Is there any interest in getting all method names either camelcase or lowercase, or will this just stay as is? ~dave -- 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 nod...@googlegroups.com To unsubscribe from this group, send email to nodejs+un...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en -- 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 To unsubscribe from this group, send email to nodejs+unsubscribe@go -- 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 -- 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.comjavascript:_e({}, 'cvml', 'nodejs@googlegroups.com'); To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com javascript:_e({}, 'cvml', 'nodejs%2bunsubscr...@googlegroups.com'); For more options, visit this group at
Re: [nodejs] requesting guidance on possible contributions: reassigning console.log to a different stream and enabling debugger programmatically
On Thu, Dec 27, 2012 at 6:52 AM, Joel Brandt jobra...@adobe.com wrote: There are two changes to node that I'm considering contributing. Before I get started, I wanted to get some guidance on whether these things might ever be accepted into master. As you've presented them here, not very likely. I'll explain why below. I believe it would be nice to be able to reassign these to any stream object. This would add complexity, and you can easily implement it yourself: function myConsoleLog() { var str = util.format.apply(util, arguments); myStream.write(str + \n); } The use case for me is when node is launched as a child process and stdout is used for IPC with the parent. Why not use node's built-in IPC and just don't use stdout/stderr as the IPC channel? var child = child_process.spawn(process.execPath, [script], { stdio: [ 'pipe', 'pipe', 'pipe', 'ipc ] }) That'll open up fd3 in the child as an IPC channel, and stdin/out/err will be streams that you can write to/read from. You'll be able to then do stuff like: // in the parent child.send({ some: message }) child.on(message, function(response) { ... }) // in the child: process.on(message, function(message) { ... }) process.send({ some: response }) An alternative to allowing this reassignment could be to have a call that sets all console logging functions to write to stderr. (Then stdout would be left free for IPC.) This might be drastically simpler. Then use console.error instead of console.log. - Where should the API call go? The 'util' package? And, any guidance on what the API should be? The API should go in npm, if you decide to create it. - Right now, writes to stdout/stderr are usually blocking. Would we be opening up a can of worms by trying to have console.log write to streams in non-blocking ways? Logging to a non-blocking stream will mean that chunks may be lost if you do `process.exit()` explicitly. But as long as there are pending writes, node won't automatically quit. - If we consider this change, would we also change the logging functions in the 'util' package? Would we allow the user to switch each separately, or would console.log/util.log always write to the same place (and the same for console.error/util.error)? The util.log/p/error/debug functions are deprecated in favor of console. - Are there logging functions other than console.log/info/debug/error and util.debug/error/puts/print/log? Well, someone can always write to process.stdout/err explicitly. 2. allow enabling the V8 debugger programmatically (from a JS call) There are already command-line arguments for turning on the debugger and controlling its port. The API to call into is internal and undocumented for a reason; it's not really to be started from within JavaScript. But I might be missing something here, and I can see that it could be useful. Fedor Indutny is our resident debugger expert. Post an issue on the github asking about this, and mention @indutny in it. If he says it's a bad idea, I'd believe him. -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] requesting guidance on possible contributions: reassigning console.log to a different stream and enabling debugger programmatically
Debug: At least give a way to disable it for when im doing live debugging and want to regain the port and debug a different process. On Thursday, December 27, 2012 10:51:44 PM UTC-6, Isaac Schlueter wrote: On Thu, Dec 27, 2012 at 6:52 AM, Joel Brandt jobr...@adobe.comjavascript: wrote: There are two changes to node that I'm considering contributing. Before I get started, I wanted to get some guidance on whether these things might ever be accepted into master. As you've presented them here, not very likely. I'll explain why below. I believe it would be nice to be able to reassign these to any stream object. This would add complexity, and you can easily implement it yourself: function myConsoleLog() { var str = util.format.apply(util, arguments); myStream.write(str + \n); } The use case for me is when node is launched as a child process and stdout is used for IPC with the parent. Why not use node's built-in IPC and just don't use stdout/stderr as the IPC channel? var child = child_process.spawn(process.execPath, [script], { stdio: [ 'pipe', 'pipe', 'pipe', 'ipc ] }) That'll open up fd3 in the child as an IPC channel, and stdin/out/err will be streams that you can write to/read from. You'll be able to then do stuff like: // in the parent child.send({ some: message }) child.on(message, function(response) { ... }) // in the child: process.on(message, function(message) { ... }) process.send({ some: response }) An alternative to allowing this reassignment could be to have a call that sets all console logging functions to write to stderr. (Then stdout would be left free for IPC.) This might be drastically simpler. Then use console.error instead of console.log. - Where should the API call go? The 'util' package? And, any guidance on what the API should be? The API should go in npm, if you decide to create it. - Right now, writes to stdout/stderr are usually blocking. Would we be opening up a can of worms by trying to have console.log write to streams in non-blocking ways? Logging to a non-blocking stream will mean that chunks may be lost if you do `process.exit()` explicitly. But as long as there are pending writes, node won't automatically quit. - If we consider this change, would we also change the logging functions in the 'util' package? Would we allow the user to switch each separately, or would console.log/util.log always write to the same place (and the same for console.error/util.error)? The util.log/p/error/debug functions are deprecated in favor of console. - Are there logging functions other than console.log/info/debug/error and util.debug/error/puts/print/log? Well, someone can always write to process.stdout/err explicitly. 2. allow enabling the V8 debugger programmatically (from a JS call) There are already command-line arguments for turning on the debugger and controlling its port. The API to call into is internal and undocumented for a reason; it's not really to be started from within JavaScript. But I might be missing something here, and I can see that it could be useful. Fedor Indutny is our resident debugger expert. Post an issue on the github asking about this, and mention @indutny in it. If he says it's a bad idea, I'd believe him. -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
[nodejs] Re: PHP in node.js feature call
On Dec 25, 7:49 pm, JSON wackd@gmail.com wrote: What features would you be most interested in? encryption? gd/image magic? database connectivity? Any input would be very helpfull. Aren't most, if not all, of these already covered in various npm modules? -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] node.js on Solaris 10
Hi. Thursday, Dec 27 2012, 21:07:25 UTC+6 Ben Noordhuis wrote: Oracle Studio (nay Sun Studio) is not really supported. The minimum requirement is gcc 4.2. I believe there are pre-compiled 4.5 packages but if not, compiling from source is not difficult. Okay. Thanks for this advice, I finally managed to build gcc 4.7.x on Solaris 10. Turned out it was less difficult than I imagined and far less difficult than some of the project I built on Solaris 10. But. :) The tricky part is that node.js built with this gcc 4.7.x is crashing. Like immidiately: ./node Segmentation Fault (core dumped) Of course I decided that something is wrong with the compiler, and that it actually was not that simple. So I built a couple of other projects (besides the hello world), like gdb and bash. Both seem to be running fine, at least they aren't crashing immidiately after start. But I still suppose that something went wrong. About that: when building I had to do two modification: first was getting rid of the -Wl,--start-group and -Wl,--end-group, Solaris 10 ld doesn't support that (although Solaris 11 ld does), so I read here that this can be changed by adding a -z rescan option to the ld, and I did that. Second modification I made was -lrt flag to the final linking stage, because without it I was having the 'undefined symbols' error for the sem_*() routines. Was it wrong ? Can these modifications cause the crash ? So, about this crash. The backtrace isn't really helping. I've built the node.js with a debug (-g) flag but it seems to me like it's still built without debug symbols (although -g was present at the build time, and I saw it on the stdout): # dbx node core For information about new features see `help changes' To remove this message, put `dbxenv suppress_startup_message 7.7' in your .dbxrc Reading node core file header read successfully Reading ld.so.1 Reading libumem.so.1 Reading libkstat.so.1 Reading libsocket.so.1 Reading libnsl.so.1 Reading librt.so.1 Reading libstdc++.so.6.0.17 Reading libm.so.2 Reading libgcc_s.so.1 Reading libpthread.so.1 Reading libc.so.1 Reading libaio.so.1 Reading libmd.so.1 t@1 (l@1) program terminated by signal SEGV (no mapping at the fault address) 0x081b9765: _init+0x0015: addb %al,(%eax) (dbx) where current thread: t@1 =[1] _init(0x1, 0x80479c0, 0x80479c8, 0x81b9790, 0x0, 0x0), at 0x81b9765 GDB (built with a GCC that I build): # /usr/local/gdb/bin/gdb node core GNU gdb (GDB) 7.5.1 Copyright (C) 2012 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type show copying and show warranty for details. This GDB was configured as i386-pc-solaris2.10. For bug reporting instructions, please see: http://www.gnu.org/software/gdb/bugs/... Reading symbols from /usr/local/node.js/bin/node...done. [New LWP 1] [Thread debugging using libthread_db enabled] [New Thread 1 (LWP 1)] Core was generated by `./node'. Program terminated with signal 11, Segmentation fault. #0 0x081b9765 in _init () (gdb) bt #0 0x081b9765 in _init () #1 0x0819b9fb in _start () (gdb) So I got a truss output: # truss ./node execve(node, 0x080479C0, 0x080479C8) argc = 1 mmap(0x, 4096, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANON, -1, 0) = 0xFEFF resolvepath(/usr/lib/ld.so.1, /lib/ld.so.1, 1023) = 12 getcwd(/usr/local/node.js/bin, 1018) = 0 resolvepath(/usr/local/node.js/bin/node, /usr/local/node.js/bin/node, 1023) = 27 stat64(/usr/local/node.js/bin/node, 0x08047750) = 0 open(/var/ld/ld.config, O_RDONLY) = 3 fstat64(3, 0x08047300) = 0 mmap(0x, 612, PROT_READ, MAP_SHARED, 3, 0) = 0xFEFC close(3)= 0 sysconfig(_CONFIG_PAGESIZE) = 4096 stat64(/usr/local/gcc/lib/libkstat.so.1, 0x08046FF0) Err#2 ENOENT stat64(/lib/libkstat.so.1, 0x08046FF0)= 0 resolvepath(/lib/libkstat.so.1, /lib/libkstat.so.1, 1023) = 18 open(/lib/libkstat.so.1, O_RDONLY)= 3 mmap(0x0001, 32768, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_ALIGN, 3, 0) = 0xFEFB mmap(0x0001, 73728, PROT_NONE, MAP_PRIVATE|MAP_NORESERVE|MAP_ANON|MAP_ALIGN, -1, 0) = 0xFEF9 mmap(0xFEF9, 3339, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_TEXT, 3, 0) = 0xFEF9 mmap(0xFEFA1000, 268, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_INITDATA, 3, 4096) = 0xFEFA1000 munmap(0xFEF91000, 65536) = 0 memcntl(0xFEF9, 1388, MC_ADVISE, MADV_WILLNEED, 0, 0) = 0 close(3)= 0 stat64(/usr/local/gcc/lib/libumem.so.1, 0x08046FF0) Err#2 ENOENT stat64(/lib/libumem.so.1, 0x08046FF0) = 0 resolvepath(/lib/libumem.so.1, /lib/libumem.so.1, 1023) = 17 open(/lib/libumem.so.1,
Re: [nodejs] node.js on Solaris 10
Hi. I forgot to mention that the crash problem was on 0.8.x. Funny thing, I managed to build 0.9.[ with your patch (thanks again !) with gcc 4.7.x and it doesn't crash. I think I can live with it. But at least it's very interesting what's wrong with my build of the 0.8.x version. Thanks. -- 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 To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en