[nodejs] Re: ANN: nodezoo.com

2012-11-26 Thread Roly Fentanes
Awesome. Are the modules cached? I noticed that some of my older modules 
are using my older username. Also curious as how the ranking works, as I 
see some modules show up higher on the list than other modules that are 
objectively better and have been updated more recently and with more Github 
stars.

ie the following show in this order when searching "youtube". But should 
show up in reverse.

https://github.com/m16a1/youtube-js
https://github.com/clonn/ydl
https://github.com/fent/node-ytdl


On Monday, November 26, 2012 6:01:53 PM UTC-7, Richard Rodger wrote:
>
> Hi All,
>
> http://nodezoo.com is a search engine for modules - please give it a spin 
> and let me know what you think.
>
> The idea is to be able to quickly compare modules to find the best one for 
> your needs. I'll be adding in more meta data over the next few days, but 
> feel free to suggest things - e.g. Github stars.
>
> The ranking algorithm is based on the number of dependencies. Modules used 
> by many other modules rank higher. There are other factors, like how 
> recently the module was updated. This is a work in progress.
>
>
> nodezoo is a module itself, so you can
> npm install nodezoo
>
> and then run it from the command line, or even: require('nodezoo').
>
>
> The search index is elasticsearch (yes, I know, Java). Everything else is 
> Node. Still working on continuous updates from the npm changes feed.
>
> have fun,
> Richard
>
>
>
>  

-- 
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: ANN: nodezoo.com

2012-11-27 Thread Roly Fentanes
On npmjs.org it gives the correct username, but when I run `npm info` on it
I get the old one, which I'm guessing is where nodezoo gets its info. Also
when I run `npm owner ls` I do get the updated username and the old one is
not there.

Strange, this might be an error with npm not updating a document in the
database if a new version hasn't been pushed since the owners were changed.

http://nodezoo.com/#q=kat
https://npmjs.org/package/kat

On Tue, Nov 27, 2012 at 6:15 AM, Richard Rodger  wrote:

> Thanks Roly - will use this in testing!
> I get the data direct from npmjs.org - could you check there to see if
> the older username is there too?
> R.
>
>
> On Tuesday, November 27, 2012 5:09:29 AM UTC, Roly Fentanes wrote:
>>
>> Awesome. Are the modules cached? I noticed that some of my older modules
>> are using my older username. Also curious as how the ranking works, as I
>> see some modules show up higher on the list than other modules that are
>> objectively better and have been updated more recently and with more Github
>> stars.
>>
>> ie the following show in this order when searching "youtube". But should
>> show up in reverse.
>>
>> https://github.com/m16a1/**youtube-js<https://github.com/m16a1/youtube-js>
>> https://github.com/clonn/ydl
>> https://github.com/fent/node-**ytdl <https://github.com/fent/node-ytdl>
>>
>>
>> On Monday, November 26, 2012 6:01:53 PM UTC-7, Richard Rodger wrote:
>>>
>>> Hi All,
>>>
>>> http://nodezoo.com is a search engine for modules - please give it a
>>> spin and let me know what you think.
>>>
>>> The idea is to be able to quickly compare modules to find the best one
>>> for your needs. I'll be adding in more meta data over the next few days,
>>> but feel free to suggest things - e.g. Github stars.
>>>
>>> The ranking algorithm is based on the number of dependencies. Modules
>>> used by many other modules rank higher. There are other factors, like how
>>> recently the module was updated. This is a work in progress.
>>>
>>>
>>> nodezoo is a module itself, so you can
>>> npm install nodezoo
>>>
>>> and then run it from the command line, or even: require('nodezoo').
>>>
>>>
>>> The search index is elasticsearch (yes, I know, Java). Everything else
>>> is Node. Still working on continuous updates from the npm changes feed.
>>>
>>> have fun,
>>> Richard
>>>
>>>
>>>
>>>
>>
>  --
> 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
>



-- 

Roly Fentanes

Software Engineer


POP•TIP

36 Cooper Sq. 6th Floor | New York, NY 10003

m: 480.200.3369 | poptip.com <http://bit.ly/poptipemailsig> |
@roly426<http://twitter.com/roly426>

-- 
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: ANN: nodezoo.com

2012-11-27 Thread Roly Fentanes
Just forced republished that module to see if that would change the
maintainers, it did. But on nodezoo it still gives the old username.

On Tue, Nov 27, 2012 at 6:36 AM, Roly Fentanes  wrote:

> On npmjs.org it gives the correct username, but when I run `npm info` on
> it I get the old one, which I'm guessing is where nodezoo gets its info.
> Also when I run `npm owner ls` I do get the updated username and the old
> one is not there.
>
> Strange, this might be an error with npm not updating a document in the
> database if a new version hasn't been pushed since the owners were changed.
>
> http://nodezoo.com/#q=kat
> https://npmjs.org/package/kat
>
>
> On Tue, Nov 27, 2012 at 6:15 AM, Richard Rodger <
> richard.rod...@nearform.com> wrote:
>
>> Thanks Roly - will use this in testing!
>> I get the data direct from npmjs.org - could you check there to see if
>> the older username is there too?
>> R.
>>
>>
>> On Tuesday, November 27, 2012 5:09:29 AM UTC, Roly Fentanes wrote:
>>>
>>> Awesome. Are the modules cached? I noticed that some of my older modules
>>> are using my older username. Also curious as how the ranking works, as I
>>> see some modules show up higher on the list than other modules that are
>>> objectively better and have been updated more recently and with more Github
>>> stars.
>>>
>>> ie the following show in this order when searching "youtube". But should
>>> show up in reverse.
>>>
>>> https://github.com/m16a1/**youtube-js<https://github.com/m16a1/youtube-js>
>>> https://github.com/clonn/ydl
>>> https://github.com/fent/node-**ytdl <https://github.com/fent/node-ytdl>
>>>
>>>
>>> On Monday, November 26, 2012 6:01:53 PM UTC-7, Richard Rodger wrote:
>>>>
>>>> Hi All,
>>>>
>>>> http://nodezoo.com is a search engine for modules - please give it a
>>>> spin and let me know what you think.
>>>>
>>>> The idea is to be able to quickly compare modules to find the best one
>>>> for your needs. I'll be adding in more meta data over the next few days,
>>>> but feel free to suggest things - e.g. Github stars.
>>>>
>>>> The ranking algorithm is based on the number of dependencies. Modules
>>>> used by many other modules rank higher. There are other factors, like how
>>>> recently the module was updated. This is a work in progress.
>>>>
>>>>
>>>> nodezoo is a module itself, so you can
>>>> npm install nodezoo
>>>>
>>>> and then run it from the command line, or even: require('nodezoo').
>>>>
>>>>
>>>> The search index is elasticsearch (yes, I know, Java). Everything else
>>>> is Node. Still working on continuous updates from the npm changes feed.
>>>>
>>>> have fun,
>>>> Richard
>>>>
>>>>
>>>>
>>>>
>>>
>>  --
>> 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
>>
>
>
>
> --
>
> Roly Fentanes
>
> Software Engineer
>
>
> POP•TIP
>
> 36 Cooper Sq. 6th Floor | New York, NY 10003
>
> m: 480.200.3369 | poptip.com <http://bit.ly/poptipemailsig> | 
> @roly426<http://twitter.com/roly426>
>
>


-- 

Roly Fentanes

Software Engineer


POP•TIP

36 Cooper Sq. 6th Floor | New York, NY 10003

m: 480.200.3369 | poptip.com <http://bit.ly/poptipemailsig> |
@roly426<http://twitter.com/roly426>

-- 
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: API changes from 0.6 to 0.8

2012-06-21 Thread Roly Fentanes
I'm in a similar situation with a module I wrote. And I think I'll just 
write a note in the readme specifying which version should be installed for 
node v0.6.x.

On Thursday, June 21, 2012 2:35:15 AM UTC-7, Diogo Resende wrote:
>
> Hi, 
>
> I have a module (node-rack) to abstract the cluster module. It was built 
> for 0.6 and I want to be able to support 0.8 too but not dropping 0.6 
> support. I noticed for example that `kill()` was renamed to `destroy()`. I 
> think this can be easy to detect but what about events? `death`event was 
> changed to `exit`.
>
> Is there a way to know what events an object supports or should I just 
> check the node version (using process.version.node) and do my changes from 
> there?
>
> I would prefer the first option as it's similar to feature detection. This 
> way I would just check for available methods and events and use the 
> preferred (and available) ones.
>
> -- 
> Diogo Resende
>
>

-- 
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: Wrap functions as streams (pipemaster)

2012-06-23 Thread Roly Fentanes
Interesting. Always like to see new stream modules.

On Saturday, June 23, 2012 3:23:26 AM UTC-7, Boris Egorov wrote:
>
> Good day 
>
> I did not found any modules to easily wrap any function to stream 
> interface, so i made my own. Point is to have an option to pipe streams to 
> different filters and transformations, without describing stream interface 
> from scratch every time.
>
> Usage:
>
>> var FuncWrapper = require('pipemaster').FuncWrapper,
>> streamFunc;
>> function asyncExample(x, callback) {
>>callback(null, x * x); // first argument is an optional error.
>> }
>> streamFunc = new FuncWrapper(asyncExample);
>> streamFunc.write(2);  // streamFunc emits '4'
>> streamFunc.write(6);  // streamFunc emits '36'
>
>
> There is another class for easy filtering, called StreamFilter for em, 
> easy filtering :)
>
>> var StreamFilter = require('pipemaster').StreamFilter,
>> streamFunc;
>> function filterAsync(item, callback) {
>> callback(null, item === 4);
>> }
>> streamFunc = new StreamFilter(filterAsync, true);
>> streamFunc.write(1);
>> streamFunc.write(4);
>> streamFunc.write(2);
>> // streamFunc emits only '4'
>
>
> Installation, as always - npm install pipemaster, github link - 
> https://github.com/dolphin278/pipemaster/
>
> Hope it would be helpful for someone :)
> --
> Boris Egorov
> skype/gtalk/nickname: dolphin278
> mobile: +7 905 728 1543
>  

-- 
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: EMFILE error in reading a lot of files

2012-07-01 Thread Roly Fentanes
Look into https://github.com/caolan/async/#queue

var q = async.queue(function(data, callback) {
  fs.readFile(data.filename, function() {
// do whatever with file data
callback();
  });
}, 250);

On Sunday, July 1, 2012 4:56:12 PM UTC-7, Adeel Qureshi wrote:
>
> I am getting the EMFILE error when I am trying to read a bunch of files to 
> search for user provided strings. I understand that its because node is 
> running out of file descriptors with too many files open but i cant seem to 
> find any good solution for this. Is there any design pattern to limit the 
> number of open files. The only thing I have come across is to increase the 
> number of open descriptors but I am hoping for a programmatic solution.
>
> Also since all i am doing here is reading the files to make a match for a 
> given string how different that is from doing an actual grep child process, 
> i didnt go that route becoz I wasnt able to figure out how to get grep 
> working .. I think i tried something like
>
> var grep = spawn('grep', [matchStr, dirPath, filePrefix]);
>
> and it didnt seemed to work. 
>
> Any comments would be appreciated.
>

-- 
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: Node.js - Rate limit exceeded when consuming friends/ids

2012-07-05 Thread Roly Fentanes
Have you tried ntwitter ? It's pretty 
good for interacting with twitter.

On Thursday, July 5, 2012 4:07:04 AM UTC-7, Sara P wrote:
>
> I am creating a node.js app that interacts with twitter REST API to get 
> user's information. I cannot get oauth to work as I'm receiving the
> rate limit warning "Rate limit exceeded. Clients may not make more than 
> 150 requests per hour". But I am able to get the results with response 
> status set to 200 OK
>
> My GET request header looks like below,
>
>
> { authorization: 'OAuth 
> oauth_consumer_key="2SrY0yqoV7u11sBZVazpFg",oauth_nonce="efvvn5fr5VWw",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1341486006",oauth_token="523050582-QizPw7WfKJVrUQ3N0SL3FDYnuO0Kv1i4W0ghjrK1",oauth_version="1.0",oauth_signature="R94taCP2bEHV1z4QV5Bm8IZx2cQ%3D"',
>
>   host: 'api.twitter.com',
>
>   accept: '*/*',
>
>   connection: 'keep-alive',
>
>   'user-agent': 'NodeJS',
>
>   'content-length': 0,
>
>   'content-type': 'application/x-www-form-urlencoded' }
>
> I am able to get my Oauth call without any problem using java and I am 
> getting this issue only with node.js. So my oauth_token seems to be valid 
> and I believe there is something wrong with my header and signed request.
>
> Can anyone please help me in finding what I am doing wrong here? I am 
> using node-v0.8.0 and using request module. I tried node-oauth and other 
> custom written ones but in vain.
>
>
> Thanks in advance.
>
>
>
>
>

-- 
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: How to count concurrent requests to my server?

2012-07-10 Thread Roly Fentanes
Response is a stream, should emit the `end` event. Are you sure it emits 
`finish`? And if there is an error it might emit `error` or `close` instead 
of `end`.

On Tuesday, July 10, 2012 2:25:15 PM UTC-7, Domenic Denicola wrote:
>
> I am trying to create a mini dashboard for my server that shows number of 
> "unfinished requests." (BTW if there's a better term for that let me know.)
>
> Here is what I have, but I don't think it's catching all the response 
> finishes:
>
> server.server.on("request", function (request, response) {
> updateRequestCount(+1);
>
> response.on("finish", function () {
> updateRequestCount(-1);
> });
> });
>
> If I log the request count to the console, it always increases, sometimes 
> going down by one, but usually going up much more than it goes down.
>
> What event can I listen to to properly count requests?
>

-- 
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: "Standard" Test Runner for Node

2012-07-16 Thread Roly Fentanes
If you can get your tests' point across clearly by using node's `assert` 
module and it's not that much difficult to structure compared to a full 
featured test framework, then consider using it.

Otherwise, mocha is the popular recent one, and my personal choice. 
nodeunit is easy to understand too, and has been around for a while. vows 
used to be the choice, there's still a lot of popular modules with their 
tests written with vows. But it's no longer maintained and it shows.

chai is often used along with these to make assertions easier to understand.

On Monday, July 16, 2012 9:56:14 AM UTC-7, Alex Young wrote:
>
> Hello,
>
> I write about Node a lot, and I often illustrate concepts using tests. 
>  However, there isn't a standard test runner for Node.
>
> So, let's say I'm writing a book about Node.  I'd like to include examples 
> using a test runner that's idiomatic, lightweight, and likely to be around 
> in a year or two.  I'm thinking Mocha or Nodeunit might be a good idea.
>
> My projects from 2010-2011 seemed to use Nodeunit, and I've switched a few 
> to Mocha with very little trouble.  Their APIs aren't directly compatible 
> but the same concepts can be readily gleaned in both.
>
> Does anyone have any strong opinions about this? What test runner would 
> you expect (or want) to see in books about Node?
>
> Thanks,
>
> Alex
>

-- 
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: Streaming combo

2012-07-20 Thread Roly Fentanes
I created a module that does this https://github.com/fent/node-kat

You want to give the option to pass a stream into the collection of streams 
to concatenate because streams do not only exist from the file system.

Reading data sequentially is the way to do it, since what you're doing is 
concatenating, order matters. Doing it in parallel would mean to keep a lot 
of those data events in memory, taking away one of the main benefits of 
using streams.

The way node-kat does it is it opens all of the files at once, with an 
opening queue, and not if the passed input is a stream already. Then, since 
it supports reading fromt a given start to a given end, it looks at each 
file's stat for the file size. Then it creates a readable stream as it 
needs them.

On Friday, July 20, 2012 7:25:32 AM UTC-7, Juan Ignacio Dopazo wrote:
>
> Hi!
>
> While learning about streams I ended up trying to write a module that 
> reads several files and concatenates them. I liked the idea of writing it 
> as a Stream mostly because of the API and how it plays along with other 
> streams:
>
> combo.createStream(['foo.js', 
> 'bar.js']).pipe(zlib.createGzip()).pipe(httpResponse);
>
> At first I thought about keeping a stack of files, creating reading 
> streams sequentially and firing only "data" events until I emptied the 
> stack. But "sequential" doesn't sound fast.
>
> I'm having trouble finding good information about streams, so I thought 
> about asking here. Do you think it makes sense to use streams in this case? 
> Should I open all streams at the same time and fire "data" events in order? 
> Or is the callback based version enough? What other advantages do streams 
> provide compared to the callback based API?
>
> Thanks,
>
> Juan
>

-- 
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: read stream returns too many null characters

2012-07-27 Thread Roly Fentanes
I don't know what is wrong with your particular code. But take a look 
at https://github.com/felixge/node-growing-file

On Friday, July 27, 2012 9:11:05 AM UTC-7, Adeel Qureshi wrote:
>
> I am reading a growing file and showing its contents in the browser .. 
> here is my implementation for reading the file
>
>  //start watching the file
> fs.watchFile(filename, {persistent:true, 
> interval:1000}, function(curr, prev){
> if(prev.size > curr.size)   
> callback(null);
> //open stream
> var stream = fs.createReadStream(filename, 
> {start:prev.size, end:curr.size, encoding:'utf8'});
> stream.on('data', function(data){
> //emit new data
> socket.emit('log', fileId, 
> data.split('\r\n'));
> });
> stream.on('error', function(err){
> if(err) throw err;
> });
> });
>
> this seems to work fine overall but for some strange reason it cant parse 
> out some lines that are added to the file and the lines dont seem to be 
> consistent .. e.g. the same line will be read fine if it shows up again but 
> every once in a while it just reads the whole line as null characters and 
> emits data as something like
>
> debug: websocket writing 
> 5:::{"name":"log","args":["coi-prod_wom201207260log",["\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u"]]}
>
> any ideas whats going on here
>
> Thanks
> Adeel
>

-- 
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: parallel findOrCreate functions with mongoose

2012-07-28 Thread Roly Fentanes
One solution could be to keep a hash of query objects. Every time before 
you run a query for find, identify the query with something like 
JSON.stringify() then check if the hash includes that query already. If it 
doesn't, create an array equal to that query id with the callback as the 
only element. It it does, add the callback to that array and return.

Something like

var queries = {};
var findOrCreate = exports.findOrCreate = function (data, callback) {
  if (!data.source) {
return callback(new ParamError('Missing account.source.'));
  }
  if (!data.external_id) {
return callback(new ParamError('Missing account.external_id'));
  }

  var query = {
source: data.source,
external_id: data.external_id
  };

  // check if this query was already searched for
  // and has not called its callback
  var queryID = JSON.stringify(query);
  var callbackList = queries[queryID];
  if (!callbackList) {
callbackList = queries[queryID] = [callback];
  } else {
callbackList.push(callback);
return;
  }
  
  // change original callback to cleanup callback list
  callback = function (err, account) {
callbackList.forEach(function (callback) {
  callback(err, account);
});
delete queries[queryID];
  };

  Account.findOne(query, function (err, account) {
if (err) {
  return callback(err);
}
if (account) {
  return callback(err, account);
}
account = new Account(data);
account.save(function (err) {
  return callback(err, account);
});

  });

};

On Saturday, July 28, 2012 6:12:40 PM UTC-7, Jaime Morales wrote:
>
> Hi,
>
> I am running into an issue trying to run multiple findOrCreate methods in 
> parallel.
>
> Here is the code:
>
> var findOrCreate = exports.findOrCreate = function (data, callback) {
>   if (!data.source) {
> return callback(new ParamError('Missing account.source.'));
>   }
>   if (!data.external_id) {
> return callback(new ParamError('Missing account.external_id'));
>   }
>
>   Account.findOne({
> source: data.source,
> external_id: data.external_id
>   }, function (err, account) {
> if (err) {
>   return callback(err);
> }
> if (account) {
>   return callback(err, account);
> }
> account = new Account(data);
> account.save(function (err) {
>   return callback(err, account);
> });
> 
>   });
>
> };
>
> The issue is that I may have multiple queries for the same 
> source/external_id combo.  I am using async.parallel to handle them.  But 
> since the callbacks in mongoose are pushed onto the next tick, I end up in 
> a situation where 
>
>1. a find is performed (pushing the create to the next tick)
>2. another find is performed for the same source/external_id (pushing 
>the create to the next tick)
>3. a create is performed (for the first find)
>4. an attempt is made to create again, but this time a duplicate key 
>error is thrown (since I already created that account)
>
> I originally tried to get around this by doing an upsert instead of find 
> or create, but that didn't work since I need access the the resulting item. 
>  I am not sure what the best way to handle this scenario is.  any ideas?
>

-- 
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] I can't understand why this happen, it's a simple code

2012-07-30 Thread Roly Fentanes
That's how javascript works. If you assign an object `a` to `b`, you're 
assigning the reference. You are not making a copy. If you modify one, the 
change will reflect on both since they both point to the same object.

On Sunday, July 29, 2012 7:39:29 PM UTC-7, 软刀 wrote:
>
>  # a.js :
>
> #! /usr/bin/env node
> // coding: utf-8
> // author: ruandao(ljy080...@gmail.com)
>
> var app = exports;
> app.yaha = 'jjj';
> app.yahajk = 'eklj';
> app.echo = function(){
>   console.log(this.yaha);
> };
>
>
> and I run in node:
>
> > yan@cpu:~$ node
> > a=require('./a');
> { yaha: 'jjj',
>   yahajk: 'eklj',
>   echo: [Function] }
>
>
>
> but why , I never assignment *app* to *exports *, it should be undefined 
> object!
> *
> *
>
> ===
>
> and again, when I wrote this:
>  # a.js :
>
> #! /usr/bin/env node
> // coding: utf-8
> // author: ruandao(ljy080...@gmail.com)
>
> var app = {};
> app.yaha = 'jjj';
> app.yahajk = 'eklj';
> app.echo = function(){
>   console.log(this.yaha);
> };
> exports = app;
>
>
> in node :
>
> > yan@cpu:~$ node
> > a=require('./a');
> {}
> > var c = {};
> undefined
> > c.yaha = 'jjj';
> 'jjj'
> > c
> { yaha: 'jjj' }
> > 
>
> why app's peoperties: *yaha, yahajk *and it's method *echo *lose
>
>
> thanks 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


[nodejs] Re: Trying to understand streams and child processes

2012-07-30 Thread Roly Fentanes
Why not try using one of the ftp modules?

http://toolbox.no.de/search?q=ftp

On Monday, July 30, 2012 4:01:43 AM UTC-7, carlton wrote:
>
> Hi there,
>
> I am trying to implent a nodejs script that connects to one of our servers 
> using sftp.
>
> So far I can connect using child process and spawning a command such as...
>
> sftp -o Port=22-o PasswordAuthentication=no-o 
> UserKnownHostsFile=/home/carlton/.ssh/known_hosts-o 
> IdentityFile=private_key-o StrictHostKeyChecking=no-o 
> BatchMode=nodeploy@46.x.x.x:/home/carlton/to_process
>
> Now this is the part that has me confused...
>
> I then need to execute commands on the ftp server (e.g. list files, rename 
> files) so I listen to the 'data' event
>
> sftp.stdout.on('data', function (data) {
> console.log('stdout: ' + data);
>
> sftp.stdin.write("ls -l\r\n");
>
> sftp.stdout.on('data', function(data){
> console.log('File list:', data.toString());
> 
>  // Parse file names here
>  
> sftp.stdin.write("rename 
> /home/carlton/FTP_test/to_process/old.php /home/ carlton 
> /FTP_test/processed/new.php\n");
> });
> });
>
> Is this the correct way to structure things (i.e. creatiung event listener 
> again for the 'data' event within the callback of the previous 'data' event 
> listener)?
> I found it hard to find any examples similar to what I need to do which 
> made me think I haven't built this as it should have been.
>

-- 
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: loading static files named 'server.js'

2012-08-07 Thread Roly Fentanes
That looks like a compile error. What does the stack trace look like? I 
doubt the error is coming from server.js

On Tuesday, August 7, 2012 12:39:28 PM UTC-7, yishayw wrote:
>
> Hi,
>
> I have a site which uses a library with a static file named server.js. 
> Node.js seems to be treating this as a file which needs to be interpreted 
> on the server side rather than a static file. Hence, I get an error: 
> 'Uncaught 
> SyntaxError: Unexpected token < '
>
> Is there any way around this? 
>
> I created a small example of the problem with code snippets below.
>
> Thanks in advance,
> Yishay
>
> Here's my server code:
>
> 
>
> /**
>  * Module dependencies.
>  */
>  var express = require('express')
>   , routes = require('./routes');
>  var app = module.exports = express.createServer();
>  // Configuration
>  
> app.configure(function(){
>   app.set('views', __dirname + '/views');
>   app.set('view engine', 'jade');
>   app.use(express.bodyParser());
>   app.use(express.methodOverride());
>   app.use(app.router);
>   app.use(express.static(__dirname + '/public'));});
>  
> app.configure('development', function(){
>   app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));});
>  
> app.configure('production', function(){
>   app.use(express.errorHandler());});
>  // Routes
>  
> app.get('/', routes.index);
>  
> app.listen(process.env.port || 3000);
> console.log("Express server listening on port %d in %s mode", 
> app.address().port, app.settings.env);
>
>
> 
>
> My index.html (under public/index.html)
>
> ==
>
> 
>  
> 
> 
> 
> 
> 
> 
> hello
> 
>
>
> ===
>
>
> And Server.js which is under the same dir
>
>
> ===
>
>
> alert('serving');
>
>
> ===
>
>
>
>

-- 
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: CSS Framework That Degrades?

2012-08-14 Thread Roly Fentanes
I second nib + stylus.

On Tuesday, August 14, 2012 2:51:20 PM UTC-7, Bry wrote:
>
> Anyone know of any Node.JS CSS modules/frameworks like stylus/less but 
> with a feature that it's style definitions degrades to browser specific 
> features.
>
> Ex: border-radius: 10px;
>
> will turn into
>
> border-radius: 10px;
> moz-border-radius:10px;
> webkit-border-radius: 10px;
>
> etc. Kinda like the Socket.IO of css frameworks?
>

-- 
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: Feature poll: Do you use the clientError event?

2012-08-29 Thread Roly Fentanes
4

On Wednesday, August 29, 2012 4:07:23 PM UTC-7, Isaac Schlueter wrote:
>
> Do you use the clientError event? 
>
> Please choose one: 
>
> 1. Yes, I use it all the time.  Please don't change it ever, thank you. 
>
> 2. I don't use it, but I'm aware of it, and I think I might someday. 
>
> 3. I don't use it, and I think it's stupid. 
>
> 4. The what now event? 
>
>
> 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] Re: `npm install -g .`, but faster...

2012-09-13 Thread Roly Fentanes
If you're running test on the install process itself, running `npm install` 
inside the package directory should do it without reinstalling every 
dependency.

If you want to test that the package works correctly when called from the 
cli, you can run `npm link`. That will create a symlink that will always 
point to the latest version.

On Thursday, September 13, 2012 7:37:35 AM UTC-7, Tony Lukasavage wrote:
>
> I have a node project I'm working on that I frequently install with `npm 
> install -g .` before running tests and such against the installed 
> executable. When I do this, there's always a few seconds of waiting for npm 
> to establish dependencies and do whatever else it does under the hood. I 
> was wondering if there was a faster way to do this? Is there some option I 
> can use to have npm forgo checking for depdendencies and just install my 
> module locally without any other checks?

-- 
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: Stream to multi-stream

2012-09-13 Thread Roly Fentanes
Do you mean pipe on stream to several streams?

On Thursday, September 13, 2012 12:33:04 PM UTC-7, Tim Dickinson wrote:
>
> Hey all.
>
> I'm looking for a module that would allow me to have one net socket 
> or other stream and layer other streams on top of it.
>
> I was thinking of writing my own module for this but if anyone knows of 
> something like this then i would look at it first before i write my own.
>

-- 
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: Streams pipe and unpipe

2012-09-18 Thread Roly Fentanes
streamA.removeAllListeners();
streamA.pipe(streamC);

Really simple way to do it but if you have other event listeners on streamA 
besides the ones added from pipe, you'll have to re-listen.

On Tuesday, September 18, 2012 2:28:04 PM UTC-7, PierreC wrote:
>
> All,
>
> There is currently no standard way to remove a pipe set between 2 streams. 
> Is there any (simple) solution/module to achieve that?
>
> The problem I am running into is as follow:
>
> streamA.pipe( streamB )
>
>
> At some point, I need to change the target of streamA from streamB to 
> streamC but without killing streamA (it is an expensive to setup 
> connection). Something along the lines of:
>
> streamA.unpipe( streamB )
> streamA.pipe( streamC )
>
>
> I have tried hacking the Stream class but without any satisfactory 
> result... Any idea?
>
> Cheers,
>
> Pierre
>

-- 
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] ANN: npm-bird - A bot that posts to twitter every time you publish to npm

2012-10-09 Thread Roly Fentanes
Hey all.

If you find yourself publishing to npm a bunch, and want a tiny bot 
to advertise your modules for you on Twitter, check out 
npm-bird
.

-- 
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: "node_modules" for private modules that need to be committed?

2012-10-10 Thread Roly Fentanes
For private github repos

git+ssh://g...@github.com:username/repo.git

On Wednesday, October 10, 2012 8:09:27 AM UTC-7, Tom wrote:
>
> I've added the node_modules folder to my .gitignore file, which works fine 
> thanks to NPM Shrinkwrap (after deploying I need to run npm install using 
> the shrinkwrap.json file).
>
> However, I've got some private modules now that I won't publish to NPM. I 
> would like to require these modules like the other modules in node_modules.
>
> Unfortunately I cannot put these modules in node_modules, because they'd 
> be ignored by git, messing with my future deployment.
>
> Where should I place these modules instead? I've been told that editing 
> the paths variable for node's module lookup is highly unrecommended.
>
> Note that these are small undocumented nonpublic modules, which is why I 
> don't want to publish them to NPM.
>
> Tom
>

-- 
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: [ANN] jsmc - Minecraft server written in Node

2012-10-31 Thread Roly Fentanes
cool. can't wait to try it.

On Wednesday, October 31, 2012 5:31:13 AM UTC-7, Conrad Pankoff wrote:
>
> Hey noders!
>
> Over the weekend/first part of this week I've started writing a Minecraft 
> server entirely in JavaScript, to experiment with different types of 
> applications in node. It's been surprisingly easy, with the help of a 
> couple of support libraries I wrote for dealing with binary stuff. Adam 
> Brady has joined me in the conquest for pure JavaScript Minecraft, adding a 
> bunch of neat features and putting up with my ranting/pickiness in merging 
> patches ;)
>
> The github repository for the project is https://github.com/deoxxa/jsmc and 
> there's a demo server running on fknsrs.biz:25565.
>
> The support libraries I wrote for this are dissolve (
> https://github.com/deoxxa/dissolve, for parsing binary data, hat tip to 
> SubStack's node-binary) and concentrate (
> https://github.com/deoxxa/concentrate for producing binary data).
>
> I'd love to hear what people think of this, so let me know!
>
> Thanks,
> Conrad
>

-- 
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: Throttling intensive IO task in node.js

2012-03-06 Thread Roly Fentanes
Use a job manager

https://github.com/flatiron/neuron

On Tuesday, March 6, 2012 8:10:44 AM UTC-7, Gollum wrote:
>
> I'm playing around with node.js, trying to re-write a particularly 
> poorly designed part of my production system at work. So far, so good, 
> I use rabbitmq for messaging, and my node.js part of the system runs 
> ghostscript command line tool to convert tiff files to pdf. Obviously 
> I need to make sure I'm not running more than some fixed amount of 
> conversions at a time. What would be the best way to do this with 
> node? I understand that maybe node.js isn't really about running heavy 
> disk IO stuff, but I'm having too much fun with it to quit. I was 
> considering just using a blocking call to execute command line 
> utilities but the thing is that some messages don't require this 
> conversion and there's no need to delay their processing.

-- 
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: Node.js Clustering and interprocess communication

2012-03-09 Thread Roly Fentanes
Take a look at https://github.com/fent/socket.io-clusterhub

It uses an in-process database that lives in the master process.

On Friday, March 9, 2012 7:54:44 AM UTC-7, Murat T. wrote:
>
> Hi,
>
> I have been developing a game since last month and there are a couple of 
> things which bothers me.
>
> I am using socket.io, and storing all the data into redis. However, most 
> of my data is temporary and doesn't need to go into redis. If in case I 
> restart the node, those temporary information in redis must be deleted 
> anyway. The reason I am storing in redis is that I want to make sure it can 
> scale in the future. Current design allows that.
>
> However, I have been doing some small benchmarks and noticed that I won't 
> need to scale node to multiple machines. If I can have 8/16 cores in one 
> server, and fork workers using clustering mechanism, everything should be 
> more than enough. So, I want to eliminate redis and store everything in 
> javascript objects, which is fine for me, since I don't need to save any 
> state. (I have somethings to save and will still use redis for those cases, 
> but for most cases I don't need it)
>
> The main reason is that I read and write a lot of small data and I need to 
> write lots of code to do that, which I don't need if only I can use simple 
> javascript objects.
>
> If I eliminate redis, I will have some objects which may have more than 
> 100.000 elements. I have been testing the performance of interprocess 
> communication, and it takes almost a second to send large objects between 
> children. (If I am not doing something wrong)
>
> So, is there any way to simplify the app or improve this performance? Do I 
> have to use a key value store for sharing large objects across other nodes. 
> I just want to have a couple of objects, read and write a lot of data and 
> share between processes.
>
> Thanks in advance,
>
>
>
>
>

-- 
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: which one is correct ?

2012-03-09 Thread Roly Fentanes
btw http://www.devthought.com/2011/12/22/a-string-is-not-an-error/

On Friday, March 9, 2012 3:30:49 AM UTC-7, Angelo Chen wrote:
>
> Hi, 
>
> Struggling to change coding practice, following has two samples, which 
> one is correct? or any other approaches available? 
>
> exports.get_user = function (id, func) { 
> var found = false 
> for (var i = 0; i < users.length; i ++) { 
> if (users[i].id === id) { 
> found = true 
> func(null, users[i]) 
> break; 
> } 
> } 
> if (!found) 
> func("NOT_FOUND", null) 
> } 
>
>
> exports.get_user = function (id, func) { 
> for (var i = 0; i < users.length; i ++) { 
> if (users[i].id === id) { 
> func(null, users[i]) 
> break; 
> } 
> if (i == users.length) 
> func("NOT_FOUND", null) 
> } 
> }

-- 
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: How do you test code which communicates with a database?

2012-03-10 Thread Roly Fentanes
Like Ian said, most people create a test database.
 
but ideally it is much faster and better to use a mocked database. It's 
easiest for couchdb since it uses http to communicate. For that you could 
use https://github.com/flatiron/nock

you don't even have to mock the connection. if you know the database module 
you're using is well tested, mock that module.

http://howtonode.org/testing-private-state-and-mocking-deps

On Saturday, March 10, 2012 4:31:21 PM UTC-7, Martin Lundberg wrote:
>
> I've got an object named UserRepository which has a method named find 
> which uses node-mysql to fetch rows from the database and I'm confused on 
> how to test this code. I've tried reading about mocks but I still can't 
> figure out exactly how to test the code. How do you  test code which talks 
> to a database?
>
> I've also read "only mock what you own" and since I don't own node-mysql 
> client I'm not sure what to do.
>
> Would really appreciate examples.
>
> Thanks,
>
> -Martin
>

On Saturday, March 10, 2012 4:31:21 PM UTC-7, Martin Lundberg wrote:
>
> I've got an object named UserRepository which has a method named find 
> which uses node-mysql to fetch rows from the database and I'm confused on 
> how to test this code. I've tried reading about mocks but I still can't 
> figure out exactly how to test the code. How do you  test code which talks 
> to a database?
>
> I've also read "only mock what you own" and since I don't own node-mysql 
> client I'm not sure what to do.
>
> Would really appreciate examples.
>
> Thanks,
>
> -Martin
>

On Saturday, March 10, 2012 4:31:21 PM UTC-7, Martin Lundberg wrote:
>
> I've got an object named UserRepository which has a method named find 
> which uses node-mysql to fetch rows from the database and I'm confused on 
> how to test this code. I've tried reading about mocks but I still can't 
> figure out exactly how to test the code. How do you  test code which talks 
> to a database?
>
> I've also read "only mock what you own" and since I don't own node-mysql 
> client I'm not sure what to do.
>
> Would really appreciate examples.
>
> Thanks,
>
> -Martin
>

-- 
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: RegXp.test() behaves inconsistently

2012-03-13 Thread Roly Fentanes
When using the g option, `lastIndex` is set on the regexp to indicate where 
the next search will begin. See 
https://developer.mozilla.org/en/JavaScript/Guide/Regular_Expressions#Advanced_Searching_With_Flags

Also, this is a Javascript question, not node.

On Tuesday, March 13, 2012 1:45:32 AM UTC-7, Yi wrote:
>
> var reg = /[^\$]*\$([^\|]*)\|?(.*)/g
> var a = '$3ec05baeef7'
> reg.test(a)
> //output: true
> reg.test(a)
> //output: false
> reg.test(a)
> //output: true
> reg.test(a)
> //output: false
> reg.test(a)
> //output: true
> reg.test(a)
> //output: false
> reg.test(a)
> //output: true
> reg.test(a)
> //output: false
> reg.test(a)
> //output: true
>

-- 
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: How to implement streams?

2012-03-14 Thread Roly Fentanes
Firstly, use `require('stream').Stream` for backwards compatibility with 
node v0.4.

Look at the stream API for the methods and properties that you'll need to 
add to your class for it to be a valid stream.
http://nodejs.org/api/stream.html

Write streams can have the pipe methods if they are also a read stream. And 
if not, you can listen to the `pipe` event and throw an error if it's 
called.

If your event emitter emits `data` events and it's all it does, there's 
some modules that make converting it into a stream easier

https://github.com/JSBizon/node-memorystream
https://github.com/dominictarr/event-stream

On Wednesday, March 14, 2012 11:59:38 AM UTC-7, Rambo wrote:
>
> I made a 'class' that connects to a stream and emits JSON objects. It 
> implements EventEmitter and emits events like 'object', 'error', etc.
> I would like to convert my class into a Readable stream because it will be 
> useful to use the pipe method. How can I do that?
>
> Is this enough?
>
> function MyClass() {}
> util.inherits(MyClass, require('stream'))
> MyClass.prototype.pause = function() {...}
> MyClass.prototype.resume = function() {...}
> ...
>
> But what if I want a writable stream, it should not have the pipe method. 
> Which is the cleanest way of implementing your own streams?
>
> 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] Re: So.. this javascript thing :)

2012-03-15 Thread Roly Fentanes
Javascript is single threaded. Anything asynchronous that happens, happens 
at the end of the execution stack.

In node, asynchronous calls are queued up, then when they are ready to call 
the callback, they do so in order. They do not get executed in the middle 
of code.

On Thursday, March 15, 2012 8:36:49 AM UTC-7, Bjorn wrote:
>
> Hi!
>
> First off, Node is great. I'm used to writing enterprise C++ servers using 
> the same evented paradigm - and Node is a really compelling and fun 
> alternative. However, the language barrier is a tough one. 
> I have a question, that while it's not directly Node related, it's been 
> brought up by my interest in Node, and I've searched *everywhere* for an 
> answer. Maybe you can help?
>
> Basically, the scenario I have that caused me to wonder was like this 
> (pseudocode) ;
>
> var outputBuffer = "";
>
> SetInterval(function() {
>   outputBuffer += "asdf";
> }, 100);
>
> websocket.onMessage(function() {
>   // reply with outputbuffer
>   send(outputBuffer); // Race condition? 
>   outputBuffer = "";  // What if SetInterval happened?
> });
>
> And the question is; what if SetInterval updates the outputBuffer between 
> the two red lines above? (which would cause me to loose one or more updates 
> since the variable is cleared after the send). In my C++ servers this is a 
> clear racecondition that needs to be protected by any number of means.
> However, I suspect the Javascript event-model sucessfully prohibits the 
> racecondition (as I've seen lots and lots of javascript that potentially 
> has this issue).
>
> How can this code be safe and not have a race condition?
>
> Cheers,
> Bjorn
>
>

-- 
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: How to catch an exception like this?

2012-03-26 Thread Roly Fentanes
Don't make a call to a module function which doesn't exist.

I really don't see this as being an actual problem. Read the module 
documentation, they'll tell you what the module exposes. If you're worried 
about it's API changing and getting a different version when deploying, use 
stricter version ranges.

On Monday, March 26, 2012 7:49:57 AM UTC-7, 0x80 wrote:
>
> I am standardizing all my callbacks to do proper exception handling, but 
> the only type of exceptions I can't seem to catch in a good way are the 
> ones illustrated below. When I make a call to a module function which 
> doesn't exist the exception is not caught anywhere even though I have the 
> uncaughtExeption handler.
>
> Can anyone explain my what is the best way to catch this, and why this 
> exception isn't reported to me? The only solution I found is to put a 
> try/catch phrase around the module function call, but this is not a proper 
> solution, because you make these kind of errors by accident. I don't want 
> to put a try/catch clause around every module function I call just to make 
> sure i don't have a typo.
>
> These kind of errors are really annoying me since I don't get any 
> notification so often I am searching in the wrong places.
>
> Errorfun is just an empty module in this example.
>
> Thijs
>
>
> var assert = require('assert');
> var errorfun = require('./errortestmodule');
> var step = require('step');
>
> process.on('uncaughtException', function(err) {
> console.log("___ UNCAUGHT _\n");
>  console.log(err.message);
>  console.log(err.stack);
> });
>
> process.on('exit', function () {
> console.log('About to exit.');
> });
>
> function callNonexistant(callback){
> setTimeout(errorfun.nonexitant, 1000);
> }
>
> function doSomethingAsync(callback){
>  step(
> function(){
> callNonexistant(this);
>  },
> function(err){
> if(err) return callback(err);
>  callback(null);
> }
> );
> }
>
> function myCallback(err, result){
> if(err) throw err;
> console.log("Finished and happy");
> }
>
>
> doSomethingAsync(myCallback);
>

-- 
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: fs.read

2012-04-01 Thread Roly Fentanes
I don't see a callback on your `writeFile`. are you sure there's no race 
condition?

On Sunday, April 1, 2012 1:25:29 PM UTC-7, Matthew Hazlett wrote:
>
> This throws an error unexpected end of file.
>
> fs.readFile(__dirname + '/' + filename, function (err, data) {
> if (err) throw err;
> console.log(data);
> });
>
> This is a oneline file created by:
>
> fs.writeFile(__dirname + '/' + filename, JSON.stringify(data));
>
> The file exists and the permissions are fine. Whats wrong?
>
>

-- 
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: Tracking NPM Package Usage

2012-04-03 Thread Roly Fentanes
Have you looked at http://toolbox.no.de/

there is also http://eirikb.github.com/nipster/

On Tuesday, April 3, 2012 6:15:38 AM UTC-7, Jeff Kunkle wrote:
>
> Having used node steadily for the past six months, one of the biggest 
> problems I have is finding quality packages. It's easy to simply find 
> packages for a particular task, but determining which are well written, 
> performant, and carefully maintained is not straightforward. And somewhat 
> related, as a developer of several open source packages I'm often left 
> wondering if anyone is actually using them. How do I decide which packages 
> to spend time on without knowing which are most used, if at all? I realize 
> I can look to see what is most depended upon at search.npmjs.org but 
> that's only a partial picture. Packages that are more likely to be 
> leveraged in end-user applications are underrepresented, if they even 
> appear there at all.
>
> Would there be any community interest in developing a basic package usage 
> tracking capability? Maybe something like a simple package/file that can be 
> included in a package to count each time the package is installed or 
> required and report the results back to a central website on some interval. 
> Such a basic capability would be incredibly valuable to developers and 
> users. Users can then quickly determine which packages are well used/tested 
> and developers get to see which of their projects are actually being used. 
> I can imagine a whole host of other useful capabilities like collecting 
> metrics on API usage for help in understanding the potential impact of an 
> API change, but all of it would be secondary to a basic usage counting 
> ability.
>
> I'm sure there will be privacy concerns, but I think we can work to 
> address them if there's enough interest in such a capability. I'm more than 
> willing to have those discussions and work on a solution if people think 
> it's worthwhile.
>

-- 
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: How to avoid callback hell?

2012-04-08 Thread Roly Fentanes
Why are you reconnecting to the db every time a user connects? If that is 
necessary, as in if the db connection depends on the user connecting, then 
define a function which given a query, connects to the db if not already 
connected, then executes the query after it connects. Then it disconnects 
from the db when the user disconnects.

Javascript isn't forcing you to nest your callbacks so much. It's flexible 
enough to let you define the ways you use asynchronous functions.

On Sunday, April 8, 2012 5:42:14 PM UTC-7, Matthew Hazlett wrote:
>
> I'm trying to write a simple app that preforms a db query when a user 
> connects to a tcp port.
>
> I can get the query working if I do everything as callbacks:
>
>  db.open(... fn() {
>  db.collection( fn() {
>   db.query(.. fn() {
>   });
>   });
>   });
>
> But as you can see this creates callback hell.
>
> What I would like to do is have a class, but being as everything is 
> async it makes it incredibly difficult to ensure all your variables are 
> set.
>
> var client;
> db.connect(connect, fn(){
>   client = connect;
> });
> client.close();
>
> Will cause an error because client hasn't been set yet.  Another thing I 
> thought of doing was chaining it all together:
>
> db.connect(connect, fn(){
>  ...
> process.nextTick(fn(){ doNext(); });
> });
>
> this gets very messy and hard to manage, how can I deal with callback hell?
>
>
>

-- 
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: How do you execute a function asynchronously?

2012-04-09 Thread Roly Fentanes
You could use just one child process that you spawn at the start of your 
app. Then every time you need to do the calculation, you tell it to. And it 
will get back to you when it's finished.

Would only work there's little chance for many calculations to be needed at 
once. Or you could spawn a few more workers as needed.

On Monday, April 9, 2012 3:34:05 AM UTC-7, Jeremy Rudd wrote:
>
> Hi all,
>
> I've got a couple of long-running functions that use BigIntegers and the 
> like for some financial calculations. These take a few seconds to execute. 
> Now a few seconds of CPU on the main node thread means all other activity 
> grinds to a halt. What's the easiest way to call these functions 
> asynchronously? ie, on another thread?
>
> Should I be making a module? Is it possible without a module? Should I be 
> using child_process? 
>
> Any pointers or tips appreciated.
> 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


[nodejs] Re: "return callback(...);" vs "callback(...); return;"

2012-04-10 Thread Roly Fentanes
I do it during the err check because it's more readable. And I assume 
everyone else is doing it for the same reason?

function somethingAsync(data, callback) {
  otherthigAsync(function(err, result) {
if (err) return callback(err);

// do something with result
  });
});

On Tuesday, April 10, 2012 4:17:27 PM UTC-7, Ken wrote:
>
> Assuming that the callback doesn't return a value, does v8 behave any 
> differently when invoking callbacks in one of these forms vs. the other?  I 
> find the first approach to be a convenient shorthand in many cases, but am 
> wondering (after observing some unexpected timings when profiling async 
> methods) if it leads to v8 doing something odd with the stack.
>
> Approach A, return the invoked callback:
>
> function foo(a, callback) {
>   var bar = ...; 
>   return callback(bar);
> }
>
> foo("derp", function(b) { ...; return; });
>
> Approach B, invoke callback, then return:
>
> function foo(a, callback) {
>var bar = ...;
>callback(bar);
>return;
> }
>
> foo("derp", function(b) { ...; return; });
>

-- 
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: How to avoid callback hell?

2012-04-12 Thread Roly Fentanes
If your function is asynchronous only sometimes, consider getting rid of
that ambiguity by using process.nextTick() on your callback in the cases
where calling it won't be async.

On Thu, Apr 12, 2012 at 2:27 AM, Jorge  wrote:

> On Apr 11, 2012, at 2:16 AM, Joe Ferner wrote:
>
> > (...) Methods with callbacks are not required to have async code in
> them, they just generally do. If you replace doIt with say a
> getUserFromCache method where 99% of the time you get cache hits and the
> function just returns the user this would be completely valid (...)
>
> You can do that but I think the consensus is that it's not a good idea
> because it complicates reasoning about your code:
>
> method(params, cb);
> doSomethingElse();
>
> Will doSomethingElse() run before or after cb() ?
> --
> Jorge.
>
> --
> 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
>



-- 
*Roly Fentanes*
r...@markover.me
480 200 3369

-- 
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: npmjs.org missing results

2012-04-17 Thread Roly Fentanes
Here's another search tool
http://toolbox.no.de/

On Tuesday, April 17, 2012 5:33:52 AM UTC-7, Alan Hoffmeister wrote:
>
> Hello guyz!
>
> I don't know if this is the rigth place, but let's get started.
> I use npmjs.org a lot for searching modules, and a ton of times I left
> it without success in my search. Let's take a quick example, try
> searching for mongoose, and this is what it's showing me:
>
> http://postimage.org/image/5mgder0jp/
>
> Everything but mongoose... Now try to search for express:
>
> http://postimage.org/image/wbodsv3il/
>
> The same. It is just with me?
>
> --
> Att,
> Alan Hoffmeister
>
>

-- 
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: An interactive console.dir() for the terminal/nodejs.

2012-04-23 Thread Roly Fentanes
this is really cool.

On Monday, April 23, 2012 1:39:44 PM UTC-7, hij1nx wrote:
>
> https://github.com/hij1nx/cdir
>
> Usage: `console.dir = require('cdir'); console.dir(object);`
>
> 
>
>

-- 
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: Queryable JSON Streams

2012-04-24 Thread Roly Fentanes
there is this
https://github.com/bevry/query-engine

not sql like, mongo like.

On Tuesday, April 24, 2012 4:18:41 AM UTC-7, manimal45 wrote:
>
> Hi, 
>
> I wanted to know if there was any existing module allowing for 
> handling json streams with an SQL like API. 
>
> For instance, let's say the module's name is querystreams, the 
> expected API would allow for code like this  : 
> var s = new StreamProducer("a stream from a thrid party outputting 
> json rows"); // 'data', {a : 1, b :2} ... 
> var filter = querystream(s, { a : 1}) ; // creates a stream which 
> outputs only rows with #.a=1 
>
> var s1 = new StreamProducer("a stream from a thrid party outputting 
> json rows"); 
> var s2 = new StreamProducer("a stream from a thrid party outputting 
> json rows"); 
> var join = querystreams.join(s1,s2, { "s1.a = s2.a && s1.b == 
> s2.b"}); // creates a stream resulting in joining s1 and s2 on the 
> given condition 
>
>
> var unsorted = new StreamProducer("a stream from a thrid party 
> outputting json rows"); 
> var sorted = querystream.sort(unsorted, {a : 'desc'}); // creates a 
> stream where values are sorted depending on the #. property 
>
>
>
>

-- 
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: Queryable JSON Streams

2012-04-24 Thread Roly Fentanes
I agree node streams are usually underused and underlooked.

If the json stream you have in mind continously prints json, you might find
this useful https://github.com/fent/node-jstream

Not sure what you mean by sorting streams.

On Tue, Apr 24, 2012 at 5:27 AM, Nuno Job  wrote:

> Yup, I share your vision :)
>
> - https://github.com/dscape/clarinet
> - https://github.com/thejh/node-jsos/issues/2#issuecomment-3548882
> (routing like idea)
> - https://github.com/substack/node-trumpet (css selectors style, but for
> html)
>
> Go build it :)
>
> Nuno
>
> On Tue, Apr 24, 2012 at 1:17 PM, manimal45 
> wrote:
> > It does not seem to support streams, does it ?
> >
> > It's a module which enables use of mongodb semantics without using
> > mongodb itself, which is a good idea on itself !
> > Though, what I wanted to know is whether or not there exists a stream
> > manipulation API.
> > Maybe something like spouts and bolts from twitter storm project :
> > - https://github.com/nathanmarz/storm
> > -
> http://www.slideshare.net/nathanmarz/storm-distributed-and-faulttolerant-realtime-computation
> >
> > I think that node.js streams are a powerful interface, usually under
> > used by module writters.
> > There ought to be some stream manipulation (grouping, sorting,
> > joining) outhere which would open the way for amazing use cases like
> > twitter's storm.
> >
> > Anyone with same vision ?
> >
> >
> >
> > On 24 avr, 14:02, Roly Fentanes  wrote:
> >> there is thishttps://github.com/bevry/query-engine
> >>
> >> not sql like, mongo like.
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >> On Tuesday, April 24, 2012 4:18:41 AM UTC-7, manimal45 wrote:
> >>
> >> > Hi,
> >>
> >> > I wanted to know if there was any existing module allowing for
> >> > handling json streams with an SQL like API.
> >>
> >> > For instance, let's say the module's name is querystreams, the
> >> > expected API would allow for code like this  :
> >> > var s = new StreamProducer("a stream from a thrid party outputting
> >> > json rows"); // 'data', {a : 1, b :2} ...
> >> > var filter = querystream(s, { a : 1}) ; // creates a stream which
> >> > outputs only rows with #.a=1
> >>
> >> > var s1 = new StreamProducer("a stream from a thrid party outputting
> >> > json rows");
> >> > var s2 = new StreamProducer("a stream from a thrid party outputting
> >> > json rows");
> >> > var join = querystreams.join(s1,s2, { "s1.a = s2.a && s1.b ==
> >> > s2.b"}); // creates a stream resulting in joining s1 and s2 on the
> >> > given condition
> >>
> >> > var unsorted = new StreamProducer("a stream from a thrid party
> >> > outputting json rows");
> >> > var sorted = querystream.sort(unsorted, {a : 'desc'}); // creates a
> >> > stream where values are sorted depending on the #. property
> >
> > --
> > 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
>



-- 
*Roly Fentanes*
r...@markover.me
480 200 3369

-- 
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: replace code in the browser while running?

2012-04-25 Thread Roly Fentanes
>From the screencast I saw I think they refresh the page.

On Wednesday, April 25, 2012 3:49:52 PM UTC-7, Mark Hahn wrote:
>
> I just saw this quote "Developers can use Meteor to build real-time 
> applications that live mostly in the browser, and even push code changes to 
> users while the application is in use" here  
> http://devopsangle.com/2012/04/25/pushing-data-not-pages-is-the-new-model-for-application-development
> .
>
> How can they do this?  If you replace a script tag it doesn't replace the 
> function in javascript, does it?
>
> I know that technically this isn't a node question, but I thought it was 
> of general interest. 

-- 
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: Writing an HTML5 DOM module in C/C++. Anyone interested?

2012-04-25 Thread Roly Fentanes
plates https://github.com/flatiron/plates
cheerio https://github.com/MatthewMueller/cheerio

On Wednesday, April 25, 2012 5:04:27 PM UTC-7, Luke Scott wrote:
>
> I'm working on a project that makes use of V8. For this project I'm not 
> using Node, but what I need is probably something people using Node could 
> benefit from.
>
> What I need is an efficient light weight "HTML5 DOM pre-processor". 
> Basically I need to expose an HTML5 based DOM to V8 without a full browser 
> stack. This would provide the "document" object (with getElementById, 
> querySelector, etc...), Level 1 DOM (perhaps Level 2), and HTML5 form 
> validation (where it can be invoked by JavaScript with something like 
> checkValidity). It would _not_ pull external resources (images, css files, 
> javascript files, etc...), execute inline JavaScript, compute styles, or 
> have events. It would simply be a way to load an HTML document on the 
> server into a DOM tree and execute external (basic) JavaScript on it (that 
> can be re-used on the client side).
>
> The purpose is to modify the DOM: Remove/add/modify elements. Example: 
> Repeating a div, populating form values, and validating input based on the 
> fields in the DOM and the set values. You could use querySelector to select 
> all the fields in the document and populate them from an external source 
> (this does two things: Populates input fields to export to the browser and 
> validates incoming input).
>
> I haven't found much in C++ as far as an HTML5 parser goes. The closest 
> I've been able to find is validator.nu, which is written in Java - 
> Mozilla has a tool that converts this parser into C++. Webkit's parser is 
> also very well integrated into the browser. Not sure about Mozilla's 
> implementation, but I imagine not as integrated as Webkit. PhantomJS uses 
> webkit, so it has a full browser stack. 
>
> I've looked at "user land" solutions such as jsdom. Someone on the jsdom 
> mailing lists recommended looking at dom.js. The problem with these 
> solutions is they live in the V8 context. This isn't as much of a problem 
> for Node.js users since the whole application is based on the V8 context... 
> But in my case I'm using a (mostly vanilla) V8 context to execute 
> sand-boxed user plugins. I need to be able to throw away a V8 
> instance/context and preserve the DOM.
>
> The goal, besides what I've mentioned above, is to create a library that 
> isn't specific to Node.js or even V8. Something like "libhtml5 + CSS3 
> selectors (non-gui ones) + input validation" that would be more appropriate 
> for html than "libxml2 + xpath".
>
> (The library would be tied to V8/Node through bindings).
>
> Is anyone interested in working on such a project?
>
> Luke
>
>

-- 
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: Getting Notification using node.js from url instead of jquery ajax in setinterval

2012-05-02 Thread Roly Fentanes
http://socket.io/

On Wednesday, May 2, 2012 6:52:57 AM UTC-7, Abhiraj Malhotra (SaaS 
Evangelist - Chalkpad Technologies) wrote:
>
> Currently i am using jquery ajax request in setinterval to pull data 
> from a php script which gets me the latest notifications for the 
> logged in user in realtime using set interval but somehow i fee since 
> setinterval has to keep on going and running the script without even 
> knowing whether there is something new to pull or not is just a waste 
> of resources and even slows down the browser sometimes for other ajax 
> requests in parallel... Can somebody help me to solve this using 
> nodejs where it automatically sends the data to the html element only 
> when there is data for him... Kind of push notification...

-- 
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: Unit Testing Functions Inside Modules

2012-05-03 Thread Roly Fentanes
If you really don't want to expose them, you could put them into a separate 
file and export them there. Then require that file with the tests and with 
the main module.

On Thursday, May 3, 2012 8:04:47 PM UTC-7, P. Douglas Reeder wrote:
>
> Writing functional tests for the functions exposed by a module is 
> straightforward, using any of the many TDD framework for Node. 
>
> However, it's not clear what the best approach is, to writing unit 
> tests for functions that are not exposed by a module. 
>
> One possibility is to write unit tests as part of the module and 
> expose one or more test methods.  However, it's not clear how unit 
> tests could then be excluded from a production module. 
>
> What is the usual approach? is it possible to write a test submodule 
> and cleanly exclude it from a production module?

-- 
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: How to make a high quality chat server?

2012-05-06 Thread Roly Fentanes
https://github.com/fent/socket.io-clusterhub

On Sunday, May 6, 2012 4:04:30 AM UTC-7, Jason.桂林(Gui Lin) wrote:
>
> I just join hackthon party, our team made a very cool chat web application 
> in 24 hours.
>
> But I know, it is a demo, It use socket.io, redis, I think it is a little 
> expensive on session. and it can't communicate with processes it make it 
> cluster.
>
> What nodejs could be use to? frontend server? core internal server?
>
> Some body said ZMQ is very fast message queue, is it help with this case?
>
>
>
> -- 
> Best regards,
>
> 桂林 (Gui Lin)
>
> guileen@twitter
> 桂林-V@weibo 
> guileen@github 
>
> 

-- 
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: Why is 'require' not doing callbacks?

2012-05-15 Thread Roly Fentanes
Even though it's IO, it is very common to require other files during 
startup, and therefore ok for it to be a synced operation.

On Tuesday, May 15, 2012 8:49:57 AM UTC-7, Guoliang Cao wrote:
>
> Hi,
>
> I'm new to Node.js and wrapping my head around the asynchronous 
> programming model. A question comes to mind is why 'require' itself does 
> not use callbacks like below. I believe IO is involved in require and a lot 
> of things can fail.
>
> require('http', 
> function(http){
>// do stuff with http
> },
> function(error) {
>console.log("Failed to load http");
> });
>
>
> Thanks,
> Guoliang Cao
>

-- 
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: recommended flow control library?

2012-05-26 Thread Roly Fentanes
+1 async

On Saturday, May 26, 2012 11:54:13 AM UTC-7, Davis Ford wrote:
>
> There does not appear to be a shortage of libraries out there that help 
> with flow control.  I'm looking for something that is well tested, 
> maintained, and has the capability to deal with parallel and sequential 
> workflows - functional programming syntactic sugar is a plus...don't care 
> about coffeescript, and documentation that is in coffeescript only is a 
> minus.
>
> https://github.com/joyent/node/wiki/modules#wiki-async-flow 
>
> I've been browsing a lot of these on github, and a number of them look 
> good, but it is quite time consuming to investigate them all, so I'd love 
> to hear any feedback from the group.  Are you using any of these (or other 
> libs not listed) -- happy with them?  Any you would recommend?
>
> Thanks in advance,
> Davis
>

-- 
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] [ANN] twice - a twitter api module for site streams

2015-02-25 Thread Roly Fentanes
Hello,

https://github.com/poptip/twice

It's a module for the twitter api. It was first made to work with site 
streams, which you'd need to request access to use. But it also supports 
all other streams.

We used this for a couple of years in production, and now we'd like to 
share it so that others can benefit from it.

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/2fec17ff-9b30-42e4-b419-e993f3e975cb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.