Re: [nodejs] Re: Access network interface info...

2013-08-26 Thread Faysal Banna
You're welcome ... hope it came in handy much regards Faysal Banna Meteorological Services Rafic Harriri International Airport Beirut - Lebanon Mob: +961-3-258043 On 08/25/2013 11:15 PM, Ashutosh Das wrote: Thnx degreane :) -- -- Job Board: http://jobs.nodejs.org/ Posting

[nodejs] Re: describe is not defined

2013-08-26 Thread Nadeesha Cabral
Try running: mocha test1.js On Monday, August 26, 2013 2:20:09 AM UTC+5:30, Daniel Rosales wrote: An earlier post by Artur on 12/24/12 he posted a question to this group about describe is not defined. He did not provide the details about how he solved his problem. I am on a windows 7 home

[nodejs] Cluster: signal handler for worker process works?

2013-08-26 Thread Jeong Heon
Hi, to make my service to do graceful shutdown, I'm trying to write signal handler for worker processes(to flush buffered internal logs to external log server, etc.) but they just dies without signal handling. I don't know why and how to fix this issue. but code below is example. try running

Re: [nodejs] Cluster: signal handler for worker process works?

2013-08-26 Thread Ben Noordhuis
On Mon, Aug 26, 2013 at 9:17 AM, Jeong Heon blmar...@gmail.com wrote: Hi, to make my service to do graceful shutdown, I'm trying to write signal handler for worker processes(to flush buffered internal logs to external log server, etc.) but they just dies without signal handling. I don't know

[nodejs] SIP Redirect server using node.js

2013-08-26 Thread akhil . p
/* include lib */ var dgram = require('dgram'); var server = dgram.createSocket('udp4'); /* server config */ var host = '192.168.0.177'; var port = 5060; /* sample INVITE request */ var invite = INVITE sip:+17066450067@192.168.0.177:5060;transport=udp SIP/2.0\r\nVia: SIP/2.0/UDP

[nodejs] The problem with the current working directory

2013-08-26 Thread Gagle
The cwd has nothing to do with any language because it is part of the os but it can break your app and it's nearly impossible to fix it if you don't know that cwd != dir of main file. node dir/app behaves different than cd dir node app. The __dirname variable fixes this problem but it only

Re: [nodejs] The problem with the current working directory

2013-08-26 Thread Ryan Schmidt
On Aug 26, 2013, at 07:25, Gagle wrote: What do you think? As you said this issue affects most languages, perhaps all. I don't think it's the language's (or runtime's) responsibility to second-guess the programmer (or user) about their environment. I think if you want to guarantee that the

Re: [nodejs] The problem with the current working directory

2013-08-26 Thread Angel Java Lopez
In Ruby, you can run cd build ruby app.rb or you can say ruby -I./lib build/app.rb I'm not a rubyist, but I remember this from one of my pet projects You can add an additional directory for requires, BEFORE launching the application On Mon, Aug 26, 2013 at 9:35 AM, Ryan Schmidt

[nodejs] Re: The problem with the current working directory

2013-08-26 Thread mks
__dirname is local to any file. It works everywhere. -- -- 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,

[nodejs] Re: The problem with the current working directory

2013-08-26 Thread Gagle
Because it's local to the file, it doesn't work anywhere. El lunes, 26 de agosto de 2013 14:46:55 UTC+2, mks escribió: __dirname is local to any file. It works everywhere. -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines:

Re: [nodejs] Re: The problem with the current working directory

2013-08-26 Thread Angel Java Lopez
Gagle, can you write down a concrete use case? On Mon, Aug 26, 2013 at 9:59 AM, Gagle gagle...@gmail.com wrote: Because it's local to the file, it doesn't work anywhere. El lunes, 26 de agosto de 2013 14:46:55 UTC+2, mks escribió: __dirname is local to any file. It works everywhere. --

Re: [nodejs] Re: The problem with the current working directory

2013-08-26 Thread Martín Ciparelli
Well then it's your problem to know where your local file is located in relation to your main file On Mon, Aug 26, 2013 at 9:59 AM, Gagle gagle...@gmail.com wrote: Because it's local to the file, it doesn't work anywhere. El lunes, 26 de agosto de 2013 14:46:55 UTC+2, mks escribió:

[nodejs] Re: The problem with the current working directory

2013-08-26 Thread Jeroen Janssen
From http://nodejs.org/docs/latest/api/globals.html#globals_dirname it states: __dirname isn't actually a global but rather local to each module. So it actually works in each module (not just the main file). Best regards, Jeroen Janssen Op maandag 26 augustus 2013 14:25:26 UTC+2 schreef

[nodejs] Re: DTLS Support in node

2013-08-26 Thread Ben Noordhuis
On Fri, Aug 23, 2013 at 11:05 PM, migounette yann.step...@gmail.com wrote: All, I am planning to implement DTLS, I would like to have this in nodejs core and not as a npm module. It may be like http://nodejs.org/api/all.html#all_tls_ssl, but instead of TCP it will be over UDP This

Re: [nodejs] Re: The problem with the current working directory

2013-08-26 Thread Gagle
$ pwd /home/user1 $ mkdir dir $ cat dir/app.js console.log (process.cwd ()); $ node dir/app.js /home/user1 $ cd dir node app.js /home/user1/dir Now suppose you have this code: //app.js var fs = require (fs); if (fs.existsSync (settings.json)){ doSomethingUseful (); }else{ //Warning!!

Re: [nodejs] Re: The problem with the current working directory

2013-08-26 Thread Angel Java Lopez
Ah! I see.. But this is not a problem for require, but for fs. Ok, in my code I would use if (fs.existsSync(path.join(__dirname, settings.json)) On Mon, Aug 26, 2013 at 10:27 AM, Gagle gagle...@gmail.com wrote: $ pwd /home/user1 $ mkdir dir $ cat dir/app.js console.log (process.cwd

Re: [nodejs] Re: The problem with the current working directory

2013-08-26 Thread Gagle
But now suppose you have another file called b.js that is required by a.js and is stored in a different directory and uses a relative path. You can't use __dirname. El lunes, 26 de agosto de 2013 15:32:17 UTC+2, ajlopez escribió: Ah! I see.. But this is not a problem for require, but for

Re: [nodejs] Re: The problem with the current working directory

2013-08-26 Thread Angel Java Lopez
Ok, only to be aligned, can you write down a concrete use case? Now you switched to a require issue, not fs. On Mon, Aug 26, 2013 at 10:34 AM, Gagle gagle...@gmail.com wrote: But now suppose you have another file called b.js that is required by a.js and is stored in a different directory and

Re: [nodejs] Re: The problem with the current working directory

2013-08-26 Thread Martín Ciparelli
./a.js require('./b_dir/b'); ./b_dir/b.js var fs = require('fs'); console.log(fs.readFileSync(__dirname + '/../a.js', 'utf-8')); As I was saying, it's your problem to know where your required file is located relative to the main file in your application. Or you could always use some sort of

Re: [nodejs] Re: The problem with the current working directory

2013-08-26 Thread Tim Caswell
Node's require is always relative to the file that calls require. In fact, the internal implementation of this is done by giving file a unique copy of the require function that embeds that file's directory. If you wanted to require relative to the cwd, then use process.cwd and path.resolve. If

Re: [nodejs] Re: The problem with the current working directory

2013-08-26 Thread Angel Java Lopez
+100 Relative requires combined with npm dependencies are the next big thing since sliced bread ;-) On Mon, Aug 26, 2013 at 12:05 PM, Tim Caswell t...@creationix.com wrote: Node's require is always relative to the file that calls require. In fact, the internal implementation of this is done

Re: [nodejs] Re: The problem with the current working directory

2013-08-26 Thread Gagle
If node.js is better at requiring modules than other platforms why not include a warning when you execute a file with a relative path different than the directory of this file? The process.root solution is already implemented: process.root = path.dirname(process.mainModule.filename) We could

Re: [nodejs] Re: The problem with the current working directory

2013-08-26 Thread Martin Cooper
On Mon, Aug 26, 2013 at 9:10 AM, Gagle gagle...@gmail.com wrote: If node.js is better at requiring modules than other platforms why not include a warning when you execute a file with a relative path different than the directory of this file? Because it's not a problem, it's a useful feature,

[nodejs] Re: How i can deploy nodejs in vps

2013-08-26 Thread Michael Pisarski
I use forever and have not had any issues. On Sunday, August 25, 2013 4:57:10 AM UTC-4, Fernando Segura Gòmez wrote: Hi. I need help, im very newbie about how deploy my nodejs app in production,i have always worked in localhost, but i dont know how i can deploy an app and run always, when

[nodejs] Re: How i can deploy nodejs in vps

2013-08-26 Thread Gagle
Use the linux services El domingo, 25 de agosto de 2013 10:57:10 UTC+2, Fernando Segura Gòmez escribió: Hi. I need help, im very newbie about how deploy my nodejs app in production,i have always worked in localhost, but i dont know how i can deploy an app and run always, when i run with

Re: [nodejs] Re: How i can deploy nodejs in vps

2013-08-26 Thread Tim Caswell
On Mon, Aug 26, 2013 at 11:30 AM, Michael Pisarski mspis...@gmail.comwrote: I use forever and have not had any issues. Does forever handle machine reboots? On Sunday, August 25, 2013 4:57:10 AM UTC-4, Fernando Segura Gòmez wrote: Hi. I need help, im very newbie about how deploy my nodejs

Re: [nodejs] Re: The problem with the current working directory

2013-08-26 Thread mks
The point is that cwd is not problematic at all. Think of a command line program that you want to do something with your current working directory: $ /usr/local/bin/myls $ cd ~ $ myls On Monday, August 26, 2013 6:10:07 PM UTC+2, Gagle wrote: If node.js is better at requiring modules than

Re: [nodejs] Re: How i can deploy nodejs in vps

2013-08-26 Thread Dylan Hassinger
For machine reboots, I think you would need a boot script that re-launches Forever. On Mon, Aug 26, 2013 at 5:35 PM, Tim Caswell t...@creationix.com wrote: On Mon, Aug 26, 2013 at 11:30 AM, Michael Pisarski mspis...@gmail.comwrote: I use forever and have not had any issues. Does

Re: [nodejs] Re: How i can deploy nodejs in vps

2013-08-26 Thread Jeremy Darling
Assuming your on linux: http://stackoverflow.com/questions/11275870/how-can-i-automatically-start-a-node-js-application-in-amazon-linux-ami-on-aws Also, wrap your process in forever to keep it up and running in case of faults. If you want to go all out, services like AppFog, NodeJitsu, and etc

Re: [nodejs] Re: describe is not defined

2013-08-26 Thread Isaac Schlueter
This is, without a doubt, one of the most annoying things I've ever encountered in any test runner. And I grew up on PHP and Visual Basic. On Mon, Aug 26, 2013 at 12:38 AM, Nadeesha Cabral nad...@gmail.com wrote: Try running: mocha test1.js On Monday, August 26, 2013 2:20:09 AM UTC+5:30,

Re: [nodejs] Re: How i can deploy nodejs in vps

2013-08-26 Thread Pisarski, Michael S
Tim, I have a simple script in /etc/init.d (on CentOS/RHEL 5+) Looks something like this: #!/bin/sh # # chkconfig: 235 90 10 # description: Starts YOUR_SERVICE to control application. # source function library . /etc/rc.d/init.d/functions NAME=YOUR_SERVICE DAEMONDIR=/usr/bin

Re: [nodejs] Re: process out of memory error with 0-wait setTimeout

2013-08-26 Thread ming
Just because you've exited the function doesn't mean that the underlying Agent or Socket objects can be garbage collected. Agreed. Yes, that's a more precise description. Thanks. especially if you're not doing anytyhing ... For the someBadURI in foo1 in my very first post of this topic,

Re: [nodejs] process out of memory error with 0-wait setTimeout

2013-08-26 Thread ming
Hi Martin, Thanks for the input. i was a bit surprised to learn that. What version of node are you running over there? i should have mentioned that the version of Node i use is 0.8.22. Not sure if that plays any role in the crash. i know 0.8.22 is not the latest (and likely the greatest)