[nodejs] Re: Porting node module to v8

2017-01-16 Thread Christopher Mina
I've had success resolving circular dependencies in Node by exporting the declaration of the model in one of the dependents before invoking the circular reference. For instance *a.js* var b = require('./a'); module.exports = function() { var _b = new b(); _b.initialize(); };

[nodejs] File with all data

2016-06-18 Thread Christopher Mina
Hi Sirine. Your request doesn't make much sense as it is worded. Could you please rephrase with additional Information on exactly what you're trying to do. Thanks Chris -- Job board: http://jobs.nodejs.org/ New group rules:

[nodejs] Re: Any help would be GREATLY appreciated!!

2016-05-06 Thread Christopher Mina
; var id = admin.users.insert(createUser).id; // Authorize a client with the loaded credentials, then call the // Directory API. fs.writeFile("gid.txt", "mcs" + id); }); Hopefully this works for you. Chris On Thursday, May 5, 2016 at 7:43:31 PM UTC-6, Scott

[nodejs] Re: Any help would be GREATLY appreciated!!

2016-05-04 Thread Christopher Mina
Hi. I'm not familiar with the library, but your code generally look ok. Check out this StackOverflow post, maybe it's as simple as setting the header ContentType to application/json? Would be an improper error message if so, but hey, stranger things have happened:

[nodejs] Markdown Syntax Highlighter

2016-02-26 Thread Christopher Mina
Hi. It may be a little booted for your needs, but I use code mirror. Easy to use, decent docs, lots of language plugins. Chris -- Job board: http://jobs.nodejs.org/ New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules:

Re: [nodejs] Websockets on nodejs - Managing ws instances

2016-02-23 Thread Christopher Mina
gt; > > On Monday, February 22, 2016 at 7:51:23 PM UTC-5, Christopher Mina wrote: >> >> Ok, I finally actually checked out your library to help you a litle bit >> more. >> >> It looks like your ws library on the server actually maintains a list of >> open

Re: [nodejs] Help with asynchronous method

2016-02-23 Thread Christopher Mina
cb(err); //lets hope err is null, > but if it's not null, the err will get propagated through to the final > "errors" param below.* > > > > * });}, function(errors) {res.status.(200).. ///OK});* > > Is it possible to apply async without cb param? > >

Re: [nodejs] Help with asynchronous method

2016-02-23 Thread Christopher Mina
To be clear about Emanuele's response, the async API should look like this. async.each(contents, function(content, cb) { content.save(function(err, resp) { cb(err); //lets hope err is null, but if it's not null, the err will get propagated through to the final "errors" param below.

[nodejs] Re: Spawn/Fork multiple nodejs processes (web sockets)

2016-02-23 Thread Christopher Mina
I've used NGINX as a reverse proxy / load balancer, seems to work well so far. Socket.IO has a good explanation of how to use NGINX with sticky sessions to enable websockets to work in a load balanced cluster: http://socket.io/docs/using-multiple-nodes/#nginx-configuration -Chris On

Re: [nodejs] Websockets on nodejs - Managing ws instances

2016-02-22 Thread Christopher Mina
eceived message: ' + message.data); > > switch (parsedMessage.id) { > > There a few different "case" situations like 'Stop', 'Default', etc. > > Ray > > On Monday, February 22, 2016 at 6:34:14 PM UTC-5, Christopher Mina wrote: >> >> That's correct, just a

Re: [nodejs] Websockets on nodejs - Managing ws instances

2016-02-22 Thread Christopher Mina
gt; ws instance created, ‘push’ is just adding an instance to it :). > > > On Feb 22, 2016, at 2:00 PM, Ray Jender <rayje...@gmail.com > > wrote: > > I am definitely using a particular library, ws. > Is the sockets.push(ws) a valid command for that? I could not find it > anywhere? &g

Re: [nodejs] Re: Websockets on nodejs - Managing ws instances

2016-02-21 Thread Christopher Mina
t; (1,2,3,4, etc). So the first user is showing 1, the second user is > showing 2, and so on, > > So I am confused on how the var id above can be used to send data to a > particular webpage (websocket)? > > > Thanks, > > Ray > > > > On Saturday, Febr

[nodejs] Re: Websockets on nodejs - Managing ws instances

2016-02-20 Thread Christopher Mina
Hi Ray, Whenever I use a websocket, I track the origin of the socket. In my case, I add a query param with some identifying information such as an authkey which was dynamically generated on page load and inserted into the client via javascript. When I make the request to open the socket

[nodejs] Re: Websockets on nodejs - Managing ws instances

2016-02-20 Thread Christopher Mina
Sorry about that half finished post, my last post was sent prematurely... What I was getting at is that I now have access to the authkey during the setup phase. I can use this auth key to query the database for information about that user and store it. Now I have a way to directly associated

[nodejs] Add time on existing time with moment

2016-01-30 Thread Christopher Mina
I'd suggest you don't use Moment for this purpose. Instead, you can simply parse your date into a number and then add the number of milliseconds in 5 minutes. Eg. var d = Date.parse({your date string}); d = new Date(d.getTime() + 30); see docs:

[nodejs] WebSocket connection send with multiple parameters

2016-01-03 Thread Christopher Mina
You can write your array, or any other object, to a string using JSON.stringify(value), and send that. On the server, use JSON.parse(value) to reconstruct the object. In this way, you can send highly structured information through a socket. Best of luck Chris -- Job board:

[nodejs] node_redis - embarrassingly easy question

2015-06-09 Thread Christopher Mina
At what point outside of the redis callback are you checking the value of len? As this, like most calls in JS, is async, you must wait for the call to complete and then notify your calling method via a callback function, watcher system, event system, etc. What you can't do is simply reference

[nodejs] Re: mongodb is so confusing!

2014-04-08 Thread Christopher Mina
Frank, All the other crap aside, hopefully by now you have figured out the issue. However, I'll try to be a little more crystal clear than what has been posted already. You've got a couple issues, starting at the beginning: 1) You're correct, mongod process is already running, so you're