[nodejs] Re: A little streams2 confusion

2013-11-18 Thread greelgorke
hey James,

i think what you need is the objectMode 
http://nodejs.org/api/stream.html#stream_object_mode i think if you don't 
use it, there is no guarrantee that you pushes are kept separated

Am Freitag, 15. November 2013 18:18:18 UTC+1 schrieb James Coglan:

 On 15 November 2013 17:11, James Coglan jco...@gmail.com javascript:wrote:

 On 15 November 2013 17:08, James Coglan jco...@gmail.com 
 javascript:wrote:

 I'm a bit confused about how the streams2 Readble implementation using 
 push() interacts with the on(data) event. Consider these examples. When I 
 push 3 times in succession on a Readable, I get one data event with the 
 concatenated output, but when I pipe the readable into a Transform, those 
 chunks are yielded on at a time.


 Ah, just realized what I missed. In R, the chunks are all pushed before a 
 data listener is added, which explains why it gets the buffered output. 
 Still confused about why the T gets the chunks one by one though. 


 One final question: will all push() calls in a Readable or Transform 
 *after* a 'data' listener have been added result in a single corresponding 
 'data' event? Or can multiple push() calls still get collapsed down to one 
 'data' event due to the stream being paused, backed up, buffering, etc.? 
  

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [nodejs] Re: What's the unicorn for Node? How should I think of deployment?

2013-11-18 Thread greelgorke
for http/s node apps there is also https://npmjs.org/package/up-time which 
i liked pretty much.

Am Sonntag, 17. November 2013 22:13:34 UTC+1 schrieb Evan:

 Ahh! Thanks for clearing that up.

 On Sun, Nov 17, 2013 at 12:25 PM, Matt hel...@gmail.com javascript:wrote:


 On Sat, Nov 16, 2013 at 9:22 PM, Evan evant...@gmail.com 
 javascript:wrote:

 @matt I guess it really depends on your application logic.  My 
 understanding of 
 cluster.disconnecthttp://nodejs.org/api/cluster.html#cluster_cluster_disconnect_callback
  is 
 that the worker/child will instantly close all open sockets/pipes/etc. 
  That means that if you have a client mid-request, that request will 
 timeout.  I don't think the client will see a true connection failure, as 
 they are technically connecting `via` the cluster master, and the socket 
 (as far as they can see) will remain open.  This kind of thing gets 
 dangerous if you are mid-database operation or similar.  


 Nope, that's not how worker.disconnect() works.

 It just tells the master to not send any more connections to that child, 
 allowing it to gracefully exit. Now of course if the child has some other 
 reason to stick around (a setInterval or an outbound connection somewhere) 
 then it will do so, but you need to take care of that in any system which 
 supports graceful restarts.
  
 Matt.

 -- 
 -- 
 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
  
 --- 
 You received this message because you are subscribed to a topic in the 
 Google Groups nodejs group.
 To unsubscribe from this topic, visit 
 https://groups.google.com/d/topic/nodejs/PiG9kQ9u-CU/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to 
 nodejs+un...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: How to do a PostgreSQL COPY with Node.JS?

2013-11-18 Thread greelgorke
my 10 secs on that: 
https://github.com/brianc/node-postgres/wiki/Client#wiki-bulk-load

Am Montag, 18. November 2013 01:43:54 UTC+1 schrieb Victor Hooi:

 Hi,

 PostgreSQL offers a COPY command, to move data efficient between the 
 database and files.

 So basically, you can bulk-export a SQL command into a local CSV command.

 I come from the Python world, and there's the psycopg2 library, which 
 offers copy_to() method to dump a SQL command straight into a local 
 file-like object:

 http://initd.org/psycopg/docs/usage.html#using-copy-to-and-copy-from

 I'm new to Node.js, and I'm wondering if there's something similar for 
 Node.JS - perhaps that can stream the resulting CSV file back?

 I had a look at the node-postgres library:

 https://github.com/brianc/node-postgres

 and from what I can tell, it seems to operate on individual rows for a 
 query result.

 Is there an efficient way of bulk dumping a PostgreSQL table into Node.JS?

 Cheers,
 Victor


-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: [ANN] bellhop: transport-agnostic streams for RPC and PubSub

2013-11-18 Thread Floby
Got it on Axon and ZeroMQ. My experience with ZeroMQ is strictly using the 
addon or the C library.

My remark concerning the complexity of the examples is that setting up an 
RPC link between to nodes involves a lot of steps

   - Instanciate a server
   - add methods
   - instanciate client
   - generate RPC shim
   - connect to server
   - use shim
   - get result in callback

Whereas dnode works like this

   - instanciate server with an object of methods to expose
   - instancate client
   - pipe'em up
   - call methods
   - get results in callback

There are less steps and they involve less lines of code (and therefore 
less chances of mistakes). Dnode can also send functions as results, but 
maybe that's what you incluce in non-JSON types. However it doesn't seem 
from the example that bellhop can do it

I'm very interested with the PubSub aspect of bellhop, especially if the 
effort is on the throughput.

On Friday, 15 November 2013 00:10:45 UTC+1, mscdex wrote:

 bellhop provides transport-agnostic streams for doing RPC and PubSub. This 
 gives you the freedom to use whatever transport you want: HTTP, TCP, Unix 
 Sockets, WebSockets, SockJS, Socket.IO, etc. Also, being separate streams, 
 they do not wrap your HTTP/TCP/etc. streams so you have the flexibility of 
 choosing when to do RPC and/or PubSub.

 Some other features:
 * very fast
 * streams2
 * serialization/deserialization of special JS values/objects that 
 JSON.stringify() does not support (this can be disabled)
 * pipe() a single stream to/from both an RPC and a Pubsub stream to do RPC 
 and PubSub over the same TCP socket for example
 * simple, versioned protocol ensures compatibility among streams

 Link: https://github.com/mscdex/bellhop
 install via npm: npm install bellhop


-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: How to do a PostgreSQL COPY with Node.JS?

2013-11-18 Thread Victor Hooi
Hi,

I saw the author also has this repo:

https://github.com/brianc/node-pg-copy-streams

I'm curious if anybody has experience with it, or how it compares to the 
node-postgres Client that greelgorke mentioned?

Cheers,
Victor

On Monday, 18 November 2013 19:57:35 UTC+11, greelgorke wrote:

 my 10 secs on that: 
 https://github.com/brianc/node-postgres/wiki/Client#wiki-bulk-load

 Am Montag, 18. November 2013 01:43:54 UTC+1 schrieb Victor Hooi:

 Hi,

 PostgreSQL offers a COPY command, to move data efficient between the 
 database and files.

 So basically, you can bulk-export a SQL command into a local CSV command.

 I come from the Python world, and there's the psycopg2 library, which 
 offers copy_to() method to dump a SQL command straight into a local 
 file-like object:

 http://initd.org/psycopg/docs/usage.html#using-copy-to-and-copy-from

 I'm new to Node.js, and I'm wondering if there's something similar for 
 Node.JS - perhaps that can stream the resulting CSV file back?

 I had a look at the node-postgres library:

 https://github.com/brianc/node-postgres

 and from what I can tell, it seems to operate on individual rows for a 
 query result.

 Is there an efficient way of bulk dumping a PostgreSQL table into Node.JS?

 Cheers,
 Victor



-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] really confused about which node_modules folder is being used by my application

2013-11-18 Thread vesper8
Hello fellow programmers,

I'm pretty new to node.js and I've just inherited a massive project that's 
built in node and I need to prepare it for small team development.

I apologize in advance for my newbieness.. I hope to become much better at 
node.js in the coming months (I have no choice)

I plan to use SVN and wanted to segment the existing project into many 
smaller repos to lessen the chance of conflicts when being working on by 
multiple people.

One thing I want to do is move the node_modules out of the main application 
repo because it causes commits and deployments to take waaay too long 
because of how massive the node_modules folder is.

I understand that the node_modules can be anywhere above the application 
root so right now I've set it up so it looks like this:

Before:
/var/myProjects/ProjectX/node_modules/
/var/myProjects/ProjectX/app.js
/var/myProjects/ProjectX/everything else

After:
/var/myProjects/node_modules/
/var/myProjects/ProjectX/app.js
/var/myProjects/ProjectX/everything else

I run my app and everything seems to be working fine. 

Now here's my confusion. I wanted to make sure that having moved the 
node_modules folder one level up from my application root really worked. So 
I went ahead and renamed the node_modules folder to test.

And low and behold.. my application doesn't break! It doesn't stop 
working.. which has me very puzzled. Where is it loading the dependencies 
from??

I noticed that /home/myUser/.npm/ appears to have all the same node_modules 
as the ones that were in my application. Is it loading it from there? How 
can I verify this?

Is what I did ok? Moving node_modules up one folder I mean.

Really appreciate your time. Thank 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

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: Are there benefits from minifying modules for node.js?

2013-11-18 Thread Petka Antonov
It depends on your code style - if you have overly verbose code style then 
functions that normally deserve and benefit from inlining would not be 
inlined because one of the heuristics looks at raw code size including 
comments and the heuristic isn't really
tuned for heavily verbose code styles.

tiistai, 12. marraskuuta 2013 12.58.12 UTC+2 Stefan Klein kirjoitti:

 I'm wondering if there are any significant benefits of minifying module 
 code with uglyfyjs/google closure compiler.
 Did anybody test this yet?




-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: [ANN] bellhop: transport-agnostic streams for RPC and PubSub

2013-11-18 Thread mscdex
On Monday, November 18, 2013 4:30:03 AM UTC-5, Floby wrote:

 My remark concerning the complexity of the examples is that setting up an 
 RPC link between to nodes involves a lot of steps

- add methods

 You can add() an object or array of functions too.
 


- generate RPC shim

 This isn't required, you can use .send() directly if you wish. generate() 
is there for convenience.
 


- connect to server

 This is just due to the nature of the module -- they're just generic 
(transform) streams. So in this way it's pretty much the same as dnode, 
minus dnode's 4 line listen() wrapper around net.createServer().listen() 
and 4 line connect() wrapper around net.connect(). IMHO calling 
net.createServer() or http.createServer() for example does not take much 
code/effort.

If you think the examples are missing something in particular, I'm open to 
suggestions.
 


- use shim

 Again, optional as noted previously if you use .send() directly.

Dnode can also send functions as results, but maybe that's what you incluce 
 in non-JSON types. However it doesn't seem from the example that bellhop 
 can do it


Huh? I thought the first example in the readme already showcased this 
somewhat. In particular a Date object is passed from server to client and 
also a function is sent to the server and executed server-side (albeit 
within the same process for simplicity).

Also I've taken a peek at more of dnode's code along with dnode-protocol 
and jsonify and cannot seem to find where it's sending non-JSON values such 
as functions over the wire.

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: really confused about which node_modules folder is being used by my application

2013-11-18 Thread mscdex
On Monday, November 18, 2013 4:57:23 AM UTC-5, vesper8 wrote:

 And low and behold.. my application doesn't break! It doesn't stop 
 working.. which has me very puzzled. Where is it loading the dependencies 
 from??


You can do `npm ls` in your project's root directory to see where modules 
are installed. 

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: really confused about which node_modules folder is being used by my application

2013-11-18 Thread vesper8
I just tried that.. npm ls. And it is giving me a bunch of errors about 
unmet dependencies.

It's weird that my app seems to be working fine despite all the missing 
dependencies. But I did just notice that a few things appear to be broken.

Now the question is, why isn't it finding the node_modules that is just 
above the application root? I thought the default behavior is to look for a 
node_modules in the CWD, and if none is found it crawls up the root and 
looks in those folders.

As it stands the node_modules folder is two levels above the project root 
so it should find it easily?

If I'm wrong in my assumptions, then how can I point it to the folder. That 
is, without having to modify hundreds of paths accross my project.

On Monday, November 18, 2013 4:57:23 AM UTC-5, vesper8 wrote:

 Hello fellow programmers,

 I'm pretty new to node.js and I've just inherited a massive project that's 
 built in node and I need to prepare it for small team development.

 I apologize in advance for my newbieness.. I hope to become much better at 
 node.js in the coming months (I have no choice)

 I plan to use SVN and wanted to segment the existing project into many 
 smaller repos to lessen the chance of conflicts when being working on by 
 multiple people.

 One thing I want to do is move the node_modules out of the main 
 application repo because it causes commits and deployments to take waaay 
 too long because of how massive the node_modules folder is.

 I understand that the node_modules can be anywhere above the application 
 root so right now I've set it up so it looks like this:

 Before:
 /var/myProjects/ProjectX/node_modules/
 /var/myProjects/ProjectX/app.js
 /var/myProjects/ProjectX/everything else

 After:
 /var/myProjects/node_modules/
 /var/myProjects/ProjectX/app.js
 /var/myProjects/ProjectX/everything else

 I run my app and everything seems to be working fine. 

 Now here's my confusion. I wanted to make sure that having moved the 
 node_modules folder one level up from my application root really worked. So 
 I went ahead and renamed the node_modules folder to test.

 And low and behold.. my application doesn't break! It doesn't stop 
 working.. which has me very puzzled. Where is it loading the dependencies 
 from??

 I noticed that /home/myUser/.npm/ appears to have all the same 
 node_modules as the ones that were in my application. Is it loading it from 
 there? How can I verify this?

 Is what I did ok? Moving node_modules up one folder I mean.

 Really appreciate your time. Thank 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

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] NeDB question

2013-11-18 Thread Jens Christian Rodi Hansen
Hi,

I'm new to Node, trying to build a small application on node-webkit, which 
needs a little embedded database. I found NeDB, seemed to fit my purpose.

I add a number of documents, each containing field with an identifier, 
which can be the same for multiple documents. It is used to group the 
documents. Later I would like to get at list of all posible values for this 
identifier, so I can lists these. I know how to do this in an SQL based 
database, just selecting the unique values for a field, but I cannot figure 
out how to get the similar done in NeDB. 

Any quick pointers to help me get on?

Yours,
Jens Christian Rodi Hansen

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: how to run node.js server on windows machine?

2013-11-18 Thread Peter Rust
It is not common or well-supported to run node directly from Apache. There 
are some attempts at a mod_node module that would allow this, but it 
doesn't look like the development has gotten very far. You can run Apache 
as a proxy to node, but that doesn't make a lot of sense from a performance 
standpoint due to the difference in models (node uses an event-driven model 
like nginx; apache uses a more traditional one-thread-per-request model).

It is a lot more common to run node behind nginx -- you'll find a lot more 
people are doing this and there is a lot more help and tutorials available 
online.

There are more details and links regarding running node with apache on this 
thread: 
https://groups.google.com/forum/#!searchin/nodejs/PHP$20mod_node/nodejs/0WJ0lau1xy4/qInWGaQw7jkJ

-- peter

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: really confused about which node_modules folder is being used by my application

2013-11-18 Thread Alex Kocharin

If you launch your application and rename (or even remove) node_modules 
later, your application will still be working because of various caches.

Answering an original question, yes, node_modules above the application 
root should work fine, although default behaviour is to look for a 
node_modules in cwd AND all folders up to the root, so if you split your 
modules between several upper folders, it'll still work.


On Monday, November 18, 2013 7:29:39 PM UTC+4, vesper8 wrote:

 I just tried that.. npm ls. And it is giving me a bunch of errors about 
 unmet dependencies.

 It's weird that my app seems to be working fine despite all the missing 
 dependencies. But I did just notice that a few things appear to be broken.

 Now the question is, why isn't it finding the node_modules that is just 
 above the application root? I thought the default behavior is to look for a 
 node_modules in the CWD, and if none is found it crawls up the root and 
 looks in those folders.

 As it stands the node_modules folder is two levels above the project root 
 so it should find it easily?

 If I'm wrong in my assumptions, then how can I point it to the folder. 
 That is, without having to modify hundreds of paths accross my project.

 On Monday, November 18, 2013 4:57:23 AM UTC-5, vesper8 wrote:

 Hello fellow programmers,

 I'm pretty new to node.js and I've just inherited a massive project 
 that's built in node and I need to prepare it for small team development.

 I apologize in advance for my newbieness.. I hope to become much better 
 at node.js in the coming months (I have no choice)

 I plan to use SVN and wanted to segment the existing project into many 
 smaller repos to lessen the chance of conflicts when being working on by 
 multiple people.

 One thing I want to do is move the node_modules out of the main 
 application repo because it causes commits and deployments to take waaay 
 too long because of how massive the node_modules folder is.

 I understand that the node_modules can be anywhere above the application 
 root so right now I've set it up so it looks like this:

 Before:
 /var/myProjects/ProjectX/node_modules/
 /var/myProjects/ProjectX/app.js
 /var/myProjects/ProjectX/everything else

 After:
 /var/myProjects/node_modules/
 /var/myProjects/ProjectX/app.js
 /var/myProjects/ProjectX/everything else

 I run my app and everything seems to be working fine. 

 Now here's my confusion. I wanted to make sure that having moved the 
 node_modules folder one level up from my application root really worked. So 
 I went ahead and renamed the node_modules folder to test.

 And low and behold.. my application doesn't break! It doesn't stop 
 working.. which has me very puzzled. Where is it loading the dependencies 
 from??

 I noticed that /home/myUser/.npm/ appears to have all the same 
 node_modules as the ones that were in my application. Is it loading it from 
 there? How can I verify this?

 Is what I did ok? Moving node_modules up one folder I mean.

 Really appreciate your time. Thank 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

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: really confused about which node_modules folder is being used by my application

2013-11-18 Thread vesper8
Yea.. I am noticing that and it is driving me crazy actually.

I was actually able to confirm (because of debug errors) that the 
application has succesfully found the node_modules folder by crawling up 
two levels. So I guess npm ls is not particularly sincere about the missing 
dependencies. Could it be that it only looks for them in the CWD the npm 
ls is run from? It, unlike node, doesn't crawl up to locate the 
node_modules.

Anyway... it found the node_modules up two folders.. which is good. I moved 
it again just to test if it would locate it again. And it's driving me 
crazy because the error text keeps refering to node_modules in the folder 
where I moved it out of. So I guess it's cached somehow.

Does anyone know how I can fully clear the cache? I am using PM2 to start 
my processes and restarting them doesn't clear that stuborn cache. Even 
stopping and deleting the processes completely and then starting them up 
again doesn't clear it.

On Monday, November 18, 2013 11:23:52 AM UTC-5, Alex Kocharin wrote:


 If you launch your application and rename (or even remove) node_modules 
 later, your application will still be working because of various caches.

 Answering an original question, yes, node_modules above the application 
 root should work fine, although default behaviour is to look for a 
 node_modules in cwd AND all folders up to the root, so if you split your 
 modules between several upper folders, it'll still work.


 On Monday, November 18, 2013 7:29:39 PM UTC+4, vesper8 wrote:

 I just tried that.. npm ls. And it is giving me a bunch of errors about 
 unmet dependencies.

 It's weird that my app seems to be working fine despite all the missing 
 dependencies. But I did just notice that a few things appear to be broken.

 Now the question is, why isn't it finding the node_modules that is just 
 above the application root? I thought the default behavior is to look for a 
 node_modules in the CWD, and if none is found it crawls up the root and 
 looks in those folders.

 As it stands the node_modules folder is two levels above the project root 
 so it should find it easily?

 If I'm wrong in my assumptions, then how can I point it to the folder. 
 That is, without having to modify hundreds of paths accross my project.

 On Monday, November 18, 2013 4:57:23 AM UTC-5, vesper8 wrote:

 Hello fellow programmers,

 I'm pretty new to node.js and I've just inherited a massive project 
 that's built in node and I need to prepare it for small team development.

 I apologize in advance for my newbieness.. I hope to become much better 
 at node.js in the coming months (I have no choice)

 I plan to use SVN and wanted to segment the existing project into many 
 smaller repos to lessen the chance of conflicts when being working on by 
 multiple people.

 One thing I want to do is move the node_modules out of the main 
 application repo because it causes commits and deployments to take waaay 
 too long because of how massive the node_modules folder is.

 I understand that the node_modules can be anywhere above the application 
 root so right now I've set it up so it looks like this:

 Before:
 /var/myProjects/ProjectX/node_modules/
 /var/myProjects/ProjectX/app.js
 /var/myProjects/ProjectX/everything else

 After:
 /var/myProjects/node_modules/
 /var/myProjects/ProjectX/app.js
 /var/myProjects/ProjectX/everything else

 I run my app and everything seems to be working fine. 

 Now here's my confusion. I wanted to make sure that having moved the 
 node_modules folder one level up from my application root really worked. So 
 I went ahead and renamed the node_modules folder to test.

 And low and behold.. my application doesn't break! It doesn't stop 
 working.. which has me very puzzled. Where is it loading the dependencies 
 from??

 I noticed that /home/myUser/.npm/ appears to have all the same 
 node_modules as the ones that were in my application. Is it loading it from 
 there? How can I verify this?

 Is what I did ok? Moving node_modules up one folder I mean.

 Really appreciate your time. Thank 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

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: How to do a PostgreSQL COPY with Node.JS?

2013-11-18 Thread Peter Rust
The brianc/node-postgres library is the main pg library for node, but the 
author, BrianC, is concerned about it growing too bloated and has been 
working recently to spin off non-core functionality into 3rd party modules. 
node-pg-copy-streams is one of these:

Instead of adding a bunch more code to the already bloated 
node-postgreshttps://github.com/brianc/node-postgres I 
am trying to make the internals extensible and work on adding edge-case 
features as 3rd party modules. This is one of those.

I don't have personal experience with either of these -- we just use 
child_process.spawn() to run the pg copy command directly (which is 
probably similar to what these do under the hood). I'm not sure if we tried 
the copy command in the node-postgres library and had trouble with it or 
if we didn't know about it or it wasn't available at the time.

-- peter

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: really confused about which node_modules folder is being used by my application

2013-11-18 Thread vesper8
Ok... so I figured out all I needed to do to clear that stuborn cache was 
make any little change to the application. Simply adding a whitespace and 
re-saving the app.js in the project root caused the app to recrawl and 
locate the node_modules folder.

I can also now confirm that it does indeed crawl up and up and up until it 
locates a node_modules folder. Which is great.. that's exactly what I 
needed to confirm. Now I can move the node_modules out of the main project 
repo and svn commits are now 10x faster.

Thanks for the help guys :)

On Monday, November 18, 2013 11:27:58 AM UTC-5, vesper8 wrote:

 Yea.. I am noticing that and it is driving me crazy actually.

 I was actually able to confirm (because of debug errors) that the 
 application has succesfully found the node_modules folder by crawling up 
 two levels. So I guess npm ls is not particularly sincere about the missing 
 dependencies. Could it be that it only looks for them in the CWD the npm 
 ls is run from? It, unlike node, doesn't crawl up to locate the 
 node_modules.

 Anyway... it found the node_modules up two folders.. which is good. I 
 moved it again just to test if it would locate it again. And it's driving 
 me crazy because the error text keeps refering to node_modules in the 
 folder where I moved it out of. So I guess it's cached somehow.

 Does anyone know how I can fully clear the cache? I am using PM2 to start 
 my processes and restarting them doesn't clear that stuborn cache. Even 
 stopping and deleting the processes completely and then starting them up 
 again doesn't clear it.

 On Monday, November 18, 2013 11:23:52 AM UTC-5, Alex Kocharin wrote:


 If you launch your application and rename (or even remove) node_modules 
 later, your application will still be working because of various caches.

 Answering an original question, yes, node_modules above the application 
 root should work fine, although default behaviour is to look for a 
 node_modules in cwd AND all folders up to the root, so if you split your 
 modules between several upper folders, it'll still work.


 On Monday, November 18, 2013 7:29:39 PM UTC+4, vesper8 wrote:

 I just tried that.. npm ls. And it is giving me a bunch of errors about 
 unmet dependencies.

 It's weird that my app seems to be working fine despite all the missing 
 dependencies. But I did just notice that a few things appear to be broken.

 Now the question is, why isn't it finding the node_modules that is just 
 above the application root? I thought the default behavior is to look for a 
 node_modules in the CWD, and if none is found it crawls up the root and 
 looks in those folders.

 As it stands the node_modules folder is two levels above the project 
 root so it should find it easily?

 If I'm wrong in my assumptions, then how can I point it to the folder. 
 That is, without having to modify hundreds of paths accross my project.

 On Monday, November 18, 2013 4:57:23 AM UTC-5, vesper8 wrote:

 Hello fellow programmers,

 I'm pretty new to node.js and I've just inherited a massive project 
 that's built in node and I need to prepare it for small team development.

 I apologize in advance for my newbieness.. I hope to become much better 
 at node.js in the coming months (I have no choice)

 I plan to use SVN and wanted to segment the existing project into many 
 smaller repos to lessen the chance of conflicts when being working on by 
 multiple people.

 One thing I want to do is move the node_modules out of the main 
 application repo because it causes commits and deployments to take waaay 
 too long because of how massive the node_modules folder is.

 I understand that the node_modules can be anywhere above the 
 application root so right now I've set it up so it looks like this:

 Before:
 /var/myProjects/ProjectX/node_modules/
 /var/myProjects/ProjectX/app.js
 /var/myProjects/ProjectX/everything else

 After:
 /var/myProjects/node_modules/
 /var/myProjects/ProjectX/app.js
 /var/myProjects/ProjectX/everything else

 I run my app and everything seems to be working fine. 

 Now here's my confusion. I wanted to make sure that having moved the 
 node_modules folder one level up from my application root really worked. 
 So 
 I went ahead and renamed the node_modules folder to test.

 And low and behold.. my application doesn't break! It doesn't stop 
 working.. which has me very puzzled. Where is it loading the dependencies 
 from??

 I noticed that /home/myUser/.npm/ appears to have all the same 
 node_modules as the ones that were in my application. Is it loading it 
 from 
 there? How can I verify this?

 Is what I did ok? Moving node_modules up one folder I mean.

 Really appreciate your time. Thank 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 

Re: [nodejs] really confused about which node_modules folder is being used by my application

2013-11-18 Thread Ryan Schmidt

On Nov 18, 2013, at 03:57, vesper8 wrote:

 I plan to use SVN and wanted to segment the existing project into many 
 smaller repos to lessen the chance of conflicts when being working on by 
 multiple people.
 
 One thing I want to do is move the node_modules out of the main application 
 repo because it causes commits and deployments to take waaay too long because 
 of how massive the node_modules folder is.

The node_modules directory should be in the same directory that contains your 
package.json file.

 I understand that the node_modules can be anywhere above the application root 
 so right now I've set it up so it looks like this:
 
 Before:
 /var/myProjects/ProjectX/node_modules/
 /var/myProjects/ProjectX/app.js
 /var/myProjects/ProjectX/everything else
 
 After:
 /var/myProjects/node_modules/
 /var/myProjects/ProjectX/app.js
 /var/myProjects/ProjectX/everything else

The purpose of having a node_modules folder in each project is so that each 
project can independently manage its own dependencies.

Imagine ProjectX uses express 2.x, and so does ProjectY. So 
ProjectX/node_modules contains express 2.x and so does ProjectY/node_modules. 
Now you plan to move to a centralized node_modules folder. What happens when 
you want to upgrade to express 3.x, which necessitates changes to your 
project’s code? Are you prepared to make those changes to all of your projects 
simultaneously?

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [nodejs] really confused about which node_modules folder is being used by my application

2013-11-18 Thread vesper8
Oh I understand the purpose. And I'm sorry if I didn't explain myself 
properly but I do not plan to have a centralized node_modules folder. I am 
still going to have one node_modules folder per project. I simply did not 
want to have it inside the same SVN repo because it makes the repo weigh 
100mb instead of 2mb, and it makes commits and deployments much longer than 
they need to be. Since the node_modules folder doesn't change or hardly 
ever changes, I prefer to isolate it and have it be in its own SVN repo.

But that's just me and how I segment my projects into multiple repos. Maybe 
it's not the best practice but it's how I learned to work when working as a 
small to medium team of developers and it's worked well so far.

Def. thanks for the feedback though I appreciate the intention

On Monday, November 18, 2013 2:31:42 PM UTC-5, ryandesign wrote:


 On Nov 18, 2013, at 03:57, vesper8 wrote: 

  I plan to use SVN and wanted to segment the existing project into many 
 smaller repos to lessen the chance of conflicts when being working on by 
 multiple people. 
  
  One thing I want to do is move the node_modules out of the main 
 application repo because it causes commits and deployments to take waaay 
 too long because of how massive the node_modules folder is. 

 The node_modules directory should be in the same directory that contains 
 your package.json file. 

  I understand that the node_modules can be anywhere above the application 
 root so right now I've set it up so it looks like this: 
  
  Before: 
  /var/myProjects/ProjectX/node_modules/ 
  /var/myProjects/ProjectX/app.js 
  /var/myProjects/ProjectX/everything else 
  
  After: 
  /var/myProjects/node_modules/ 
  /var/myProjects/ProjectX/app.js 
  /var/myProjects/ProjectX/everything else 

 The purpose of having a node_modules folder in each project is so that 
 each project can independently manage its own dependencies. 

 Imagine ProjectX uses express 2.x, and so does ProjectY. So 
 ProjectX/node_modules contains express 2.x and so does 
 ProjectY/node_modules. Now you plan to move to a centralized node_modules 
 folder. What happens when you want to upgrade to express 3.x, which 
 necessitates changes to your project’s code? Are you prepared to make those 
 changes to all of your projects simultaneously? 



-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] ReferenceError: crap is not defined

2013-11-18 Thread Rob Vig
I'm trying to learn Node... 

I saved a this in a sub dir.

var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World Node on Unbuntu\n');})
}.listen(3000, 127.0.0.1);
console.log('Server running at http://127.0.0.1:3000/');


Where the heck does it run?

 crap.js
ReferenceError: crap is not defined
at repl:1:2
at REPLServer.eval (repl.js:80:21)
at Interface.anonymous (repl.js:182:12)
at Interface.emit (events.js:67:17)
at Interface._onLine (readline.js:162:10)
at Interface._line (readline.js:426:8)
at Interface._ttyWrite (readline.js:603:14)
at ReadStream.anonymous (readline.js:82:12)
at ReadStream.emit (events.js:88:20)
at ReadStream._emitKey (tty.js:327:10)

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [nodejs] ReferenceError: crap is not defined

2013-11-18 Thread Ben Noordhuis
On Mon, Nov 18, 2013 at 8:48 PM, Rob Vig rob@gmail.com wrote:
 I'm trying to learn Node...

 I saved a this in a sub dir.

 var http = require('http');
 http.createServer(function (req, res) {
 res.writeHead(200, {'Content-Type': 'text/plain'});
 res.end('Hello World Node on Unbuntu\n');})
 }.listen(3000, 127.0.0.1);
 console.log('Server running at http://127.0.0.1:3000/');


 Where the heck does it run?

 crap.js
 ReferenceError: crap is not defined
 at repl:1:2
 at REPLServer.eval (repl.js:80:21)
 at Interface.anonymous (repl.js:182:12)
 at Interface.emit (events.js:67:17)
 at Interface._onLine (readline.js:162:10)
 at Interface._line (readline.js:426:8)
 at Interface._ttyWrite (readline.js:603:14)
 at ReadStream.anonymous (readline.js:82:12)
 at ReadStream.emit (events.js:88:20)
 at ReadStream._emitKey (tty.js:327:10)

That error message is because the REPL is trying to look up a property
called 'js' on an object 'crap' (which of course doesn't exist.)

Try `require('crap.js')` (sans backticks) or start node like this -
node crap.js

Good luck!

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: NeDB question

2013-11-18 Thread Paul Spaulding
https://github.com/louischatriot/nedb/issues


On Monday, November 18, 2013 10:24:43 AM UTC-5, Jens Christian Rodi Hansen 
wrote:

 Hi,

 I'm new to Node, trying to build a small application on node-webkit, which 
 needs a little embedded database. I found NeDB, seemed to fit my purpose.

 I add a number of documents, each containing field with an identifier, 
 which can be the same for multiple documents. It is used to group the 
 documents. Later I would like to get at list of all posible values for this 
 identifier, so I can lists these. I know how to do this in an SQL based 
 database, just selecting the unique values for a field, but I cannot figure 
 out how to get the similar done in NeDB. 

 Any quick pointers to help me get on?

 Yours,
 Jens Christian Rodi Hansen


-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: NeDB question

2013-11-18 Thread Jens Christian Rodi Hansen
Could you be a bit more specific on which of these 100 issues relate to my 
question? I do not consider this an issue/bug so creating a new would be 
inappropriate.

Yours,
Jens Christian Rodi Hansen

On Monday, November 18, 2013 9:21:36 PM UTC+1, Paul Spaulding wrote:

 https://github.com/louischatriot/nedb/issues


 On Monday, November 18, 2013 10:24:43 AM UTC-5, Jens Christian Rodi Hansen 
 wrote:

 Hi,

 I'm new to Node, trying to build a small application on node-webkit, 
 which needs a little embedded database. I found NeDB, seemed to fit my 
 purpose.

 I add a number of documents, each containing field with an identifier, 
 which can be the same for multiple documents. It is used to group the 
 documents. Later I would like to get at list of all posible values for this 
 identifier, so I can lists these. I know how to do this in an SQL based 
 database, just selecting the unique values for a field, but I cannot figure 
 out how to get the similar done in NeDB. 

 Any quick pointers to help me get on?

 Yours,
 Jens Christian Rodi Hansen



-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [nodejs] really confused about which node_modules folder is being used by my application

2013-11-18 Thread mscdex
On Monday, November 18, 2013 2:37:50 PM UTC-5, vesper8 wrote:

 I simply did not want to have it inside the same SVN repo because it makes 
 the repo weigh 100mb instead of 2mb, and it makes commits and deployments 
 much longer than they need to be.


You should be able to add node_modules to your .svnignore file and put that 
file in your svn repo and svn will not commit that directory (this is how 
.gitignore for git works also).

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] how to create a singleton

2013-11-18 Thread Reza Razavipour
A newbie question...

I have an app that connects and reuses the same connection to a remote 
database and a connection to a remote soap server.
I want to implement a singleton pattern for each of these. I am used to 
doing that in C++ and Java but want to know what the standard 
implementation for a Singleton pattern is in node.js.

Any recommendations or references.


-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Make noBackend solution by nodejs like firebase, parse

2013-11-18 Thread bodo
Hi everyone,

I want to create the server app that manages data synchronization between 
all my apps (mobile, web, desktop). I see Firebase and Parse work very well 
but I want to create myself host. Anyone has experience on that ? Or any 
suggestion ?

Thank you very much

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [nodejs] how to create a singleton

2013-11-18 Thread Jose G. Quenum
Please check Addy Osmani book, Learning Javascript design patterns. 
http://addyosmani.com/resources/essentialjsdesignpatterns/book/
It has a correct version of singleton implementation

On Nov 19, 2013, at 1:38 AM, Reza Razavipour reza.razavip...@gmail.com wrote:

 A newbie question...
 
 I have an app that connects and reuses the same connection to a remote 
 database and a connection to a remote soap server.
 I want to implement a singleton pattern for each of these. I am used to doing 
 that in C++ and Java but want to know what the standard 
 implementation for a Singleton pattern is in node.js.
 
 Any recommendations or references.
 
 
 
 -- 
 -- 
 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
  
 --- 
 You received this message because you are subscribed to the Google Groups 
 nodejs group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to nodejs+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: how to create a singleton

2013-11-18 Thread Reza Razavipour
Wonderful book, thank you.

So reading the book, if I put the code for the mySingleton class into a 
file on its own, call it single.js. 
In my main.js, I add that with a require statement, such as var singleton = 
require('./.single);
when I say, singleton.getInstance(), I get a compile error saying singleton 
does not have a getInstance function...

Do I have to add an export to the single.js file I created or what am I 
missing...

The code is as follows:

var mySingleton = (function() {

var instance;


 function init() {


 var privateRandomNumber = Math.random();


 return {


  publicMethod : function() {


  console.log(The public can see me!);


  },


  publicProperty : I am also public,


  getRandomNumber : function() {


  return privateRandomNumber;


  },


  getInstance : function() {

  if (!instance) {


   instance = init();


  }

  return instance;


  }

 };

};

return {

 getInstance : function() {


  if (!instance) {


  instance = init();


  }

 return instance;

 }

};

})();



Thanks for the help.

Reza



On Monday, November 18, 2013 3:38:09 PM UTC-8, Reza Razavipour wrote:

 A newbie question...

 I have an app that connects and reuses the same connection to a remote 
 database and a connection to a remote soap server.
 I want to implement a singleton pattern for each of these. I am used to 
 doing that in C++ and Java but want to know what the standard 
 implementation for a Singleton pattern is in node.js.

 Any recommendations or references.




-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [nodejs] Re: how to create a singleton

2013-11-18 Thread Jose G. Quenum
yeah that's right. You just need to add the line 
module.exports = mySingleton
and in the caller file require as follows
var singleton = require('./single').mySingleton

Hope that helps
José

On Nov 19, 2013, at 2:40 AM, Reza Razavipour reza.razavip...@gmail.com wrote:

 Wonderful book, thank you.
 
 So reading the book, if I put the code for the mySingleton class into a file 
 on its own, call it single.js. 
 In my main.js, I add that with a require statement, such as var singleton = 
 require('./.single);
 when I say, singleton.getInstance(), I get a compile error saying singleton 
 does not have a getInstance function...
 
 Do I have to add an export to the single.js file I created or what am I 
 missing...
 
 The code is as follows:
 
 var mySingleton = (function() {
 
 var instance;
 
 
 
 function init() {
 
 
 
 var privateRandomNumber = Math.random();
 
 
 
 return {
 
 
 
 publicMethod : function() {
 
 
 
 console.log(The public can see me!);
 
 
 
 },
 
 
 
 publicProperty : I am also public,
 
 
 
 getRandomNumber : function() {
 
 
 
 return privateRandomNumber;
 
 
 
 },
 
 
 
 getInstance : function() {
 
 if (!instance) {
 
 
 
 instance = init();
 
 
 
 }
 
 return instance;
 
 
 
 }
 
 };
 
 };
 
 return {
 
 getInstance : function() {
 
 
 
 if (!instance) {
 
 
 
 instance = init();
 
 
 
 }
 
 return instance;
 
 }
 
 };
 
 })();
 
 
 
 
 
 Thanks for the help.
 
 Reza
 
 
 
 
 On Monday, November 18, 2013 3:38:09 PM UTC-8, Reza Razavipour wrote:
 A newbie question...
 
 I have an app that connects and reuses the same connection to a remote 
 database and a connection to a remote soap server.
 I want to implement a singleton pattern for each of these. I am used to doing 
 that in C++ and Java but want to know what the standard 
 implementation for a Singleton pattern is in node.js.
 
 Any recommendations or references.
 
 
 
 -- 
 -- 
 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
  
 --- 
 You received this message because you are subscribed to the Google Groups 
 nodejs group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to nodejs+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: how to create a singleton

2013-11-18 Thread Reza Razavipour
Awesome that works wonderfully. Thanks.

One more issue that you have an idea on, is that in getInstance I have to 
make an async call. It creates a soap connection and that is only supported 
in async mode.
Any thoughts on how to structure that code?



On Monday, November 18, 2013 3:38:09 PM UTC-8, Reza Razavipour wrote:

 A newbie question...

 I have an app that connects and reuses the same connection to a remote 
 database and a connection to a remote soap server.
 I want to implement a singleton pattern for each of these. I am used to 
 doing that in C++ and Java but want to know what the standard 
 implementation for a Singleton pattern is in node.js.

 Any recommendations or references.




-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: Make noBackend solution by nodejs like firebase, parse

2013-11-18 Thread Raymond Feng
Hi, bodo.

You should check out LoopBack (https://github.com/strongloop/loopback) from 
StrongLoop http://strongloop.com/strongloop-suite/loopback/. It's an open 
source mobile backend as a service solution built in Node.js. One of the 
differentiators for LoopBack is that you own the server, run on-premise or 
deploy to cloud. 

LoopBack uses models (for example, User, Product, Inventory) to encapsulate 
data and services and exposes them as REST APIs and client SDKs (iOS and 
Android). For new data produced by mobile applications, you can create a 
black box backend in a few commands to CRUD them with your choice of the 
data store.  For existing data, LoopBack provides the facility to discover 
and access them from various data sources out of box, including MongoDB, 
MySQL, Oracle, REST services.  More information can found from the technical 
paper 
herehttp://marketing.strongloop.com/acton/attachment/5334/u-0094/0/-/-/-/-/
. 

To facilitate the mobile development, we're developing a collection of 
built-in models (server and client) for the common needs, including User, 
Application, Device, ACL, Token, Notification, and File. New features are 
being released week by week.

LoopBack is a continuing evolution of the noBackend movement, pioneered by 
one of our developers, Ritchie, who created the deployd project. It also 
takes the Enterprise use cases into the architecture from the beginning, 
including the pluggable data/service connectors to provide integration with 
existing systems. LoopBack can be used as library for your Node.js 
applications, or as a framework to create your mobile backend 
declaratively. 

You are welcome to have further discussions at the LoopBack forum: 
https://groups.google.com/forum/#!forum/loopbackjs.  

Thanks,
Raymond

On Monday, November 18, 2013 4:05:51 PM UTC-8, bodo wrote:

 Hi everyone,

 I want to create the server app that manages data synchronization between 
 all my apps (mobile, web, desktop). I see Firebase and Parse work very well 
 but I want to create myself host. Anyone has experience on that ? Or any 
 suggestion ?

 Thank you very much


-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[nodejs] Re: NeDB question

2013-11-18 Thread Peter Rust
Perhaps Paul meant to just link to the repo, meaning go read the docs, 
but accidentally linked to the issues page? Oh -- now that I look into it 
-- perhaps it is actually a missing feature that you could open an issue 
about to see if the maintainer would be open to a pull request with the new 
functionality. The NeDB API is intended to be a subset of the MongoDB API 
and Mongo has a collection.distinct() command that isn't implemented for 
NeDB yet: 
http://docs.mongodb.org/manual/reference/method/db.collection.distinct/

You could just write it in client code using _.uniq() or writing your own 
unique function -- or you could implement it inside NeDB and send a Pull 
request with the feature to get it upstreamed...

-- peter

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
nodejs group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.