Re: [nodejs] How to report errors from streams

2013-06-17 Thread Dan Milon
You can wrap `spawn` in a `setImmediate`, so that others get a chance to attach their events. On 06/18/2013 04:19 AM, Ryan Schmidt wrote: Per previous threads, I'm implementing a transform stream around a particular command line program for use in a web service. How should the stream report

Re: [nodejs] stream.Transform events

2013-04-13 Thread Dan Milon
You're explicitly asking it not to emit an end event by passing end: false to pipe. On 14 Απρ 2013, at 12:01 π.μ., Ruud r.bij...@gmail.com wrote: Hey, I'm trying to create a streaming parser/transformer for a special web proxy project. The 'streams2' stream.Transform base class makes

Re: [nodejs] Intalling an older version of Node via package manager on linux

2013-04-09 Thread Dan Milon
I assume you're on archlinux. No, the repositories hold only the latest version. If you have previously installed a previous version you can $ pacman -U /var/cache/pacman/pkg/nodejs-... You might wanna hold the package so it doesn't get automatically updated. Or use nvm if you find

Re: [nodejs] Intalling an older version of Node via package manager on linux

2013-04-09 Thread Dan Milon
install version 0.8.12 I already have a newer version installed (v0.10.3) how do I uninstall the newer version before installing the old version? Thanks NodeNinja On Tuesday, April 9, 2013 12:59:34 PM UTC+5:30, Dan Milon wrote: I assume you're on archlinux. No, the repositories hold only

Re: [nodejs] Re: [ANN] GrayGelf: Fully compliant Graylog2/GELF client and server

2013-04-05 Thread Dan Milon
try it shortly. BTW, why do you not using winston anymore? Using anything better instead? четверг, 4 апреля 2013 г., 19:31:48 UTC+7 пользователь Dan Milon написал: See https://github.com/danmilon/winston-graylogger But I ended up moving away from winston, so I don't use it anymore

Re: [nodejs] Re: [ANN] GrayGelf: Fully compliant Graylog2/GELF client and server

2013-04-05 Thread Dan Milon
Yes. I'll try to release it during the weekend if you'd like. On 5 Απρ 2013, at 1:03 μ.μ., Alexey Kupershtokh alexey.kupersht...@gmail.com wrote: Have you made it able to send data to the Graylog2 in your fork? пятница, 5 апреля 2013 г., 16:58:19 UTC+7 пользователь Dan Milon написал

Re: [nodejs] Server Timestamp

2013-04-05 Thread Dan Milon
If all you need is time elapsed since epoch, you dont wanna do that. Nor `+new Date()`. They are way more expensive than a plain `Date.now()`. https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/now On 05/04/2013 07:02 μμ, Herman Junge wrote: console.log(new

Re: [nodejs] Re: Server Timestamp

2013-04-05 Thread Dan Milon
Read the documentation. Date.now(), Date#getTime(), etc return the number of milliseconds since epoch. Whereas php's time() returns seconds. Hence the 3 digit difference. Math.round(Date.now() / 1000) That converts from ms to s. On 05/04/2013 09:56 μμ, Tolgay Toklar wrote: Thanks for

Re: [nodejs] Re: [ANN] GrayGelf: Fully compliant Graylog2/GELF client and server

2013-04-04 Thread Dan Milon
See https://github.com/danmilon/winston-graylogger But I ended up moving away from winston, so I don't use it anymore. Anyway, it's a 50-liner. On 04/04/2013 04:48 πμ, Alexey Kupershtokh wrote: Hello again Marc :) I'm investigating a possibility to use https://github.com/flite/winston-graylog2

Re: [nodejs] Re: New Streams confusion

2013-03-26 Thread Dan Milon
Jackson @mjackson On Mon, Mar 25, 2013 at 1:50 PM, Dan Milon danmi...@gmail.com wrote: You're right, my bad. But still, data stay in the buffer until someone tries to `.read()`. So, if you're being passed a stream that you dont know whether the first `readable` event has fired, you can

Re: [nodejs] Re: New Streams confusion

2013-03-25 Thread Dan Milon
readable is emitted after you've actually started reading. In your example, you dont ever `response.read()`, so no readable event is ever emitted. As you said, streams start in paused state and ready to be read. On 03/25/13 22:28, Michael Jackson wrote: Is it correct to assume that a Readable

Re: [nodejs] Re: New Streams confusion

2013-03-25 Thread Dan Milon
You're right, my bad. But still, data stay in the buffer until someone tries to `.read()`. So, if you're being passed a stream that you dont know whether the first `readable` event has fired, you can try to actually read from it. If it returns null, then you wait for `readable`. On 03/25/13

Re: [nodejs] Re: New Streams confusion

2013-03-25 Thread Dan Milon
That's not guaranteed to work. You're assuming that `stream.read()` will return the whole internal buffer, which is not documented anywhere. The right approach is to call `.read()` until it returns null. Something like that: function collectStream(stream, cb) { var bufs = [] function

Re: [nodejs] Missing execSync in NodeJS

2013-03-14 Thread Dan Milon
On 03/14/2013 11:02 PM, Mikeal Rogers wrote: That's a great oppertunity? but it's not in line with the structure and goals of node.js. Node has synchronous file operations. The reason it has sync file operations is that there are many cases where you actually **want** to stop the entire

Re: [nodejs] MongoDB / Mongoose - prevent field update

2013-02-22 Thread Dan Milon
It's up to you to filter and validate the input. (ok, mongoose has some basic validation but that won't help you here). here's what I do. Hope that helps: ```javascript // User.UPDATE_ATTRS is an array of the permitted attributes // for updating. // // filter returns an object with only those

Re: [nodejs] 0.9x: writeable stream: objectMode

2013-02-15 Thread Dan Milon
Judging from the code Aaron linked, neither does v0.8 know how to convert the object into a buffer. It relies on #toString(). On 02/16/2013 12:45 AM, Nathan Rajlich wrote: Aaron, I'm a little confused at exactly what you're trying to do, but if you have a Readable stream outputting objects of

Re: [nodejs] Process mongodb records

2013-02-08 Thread Dan Milon
In case you're using just mongodb-native: http://mongodb.github.com/node-mongodb-native/api-generated/cursorstream.html On 02/08/2013 05:47 AM, Benjamin Clos wrote: Mongoose.js allows for streaming of records as it finds them and is useful for iterating over large populations. -- -- Job

Re: [nodejs] Re: nodeconf videos?

2013-02-08 Thread Dan Milon
Well, almost. I can go to the doctor for free, but I've paid taxes in order to do so. I get 1000 free minutes from my carrier, but I'm paying for a subscription. etc. My point is, many times what we get for free now, is the result of us paying in the past. This has nothing to do with

Re: [nodejs] Re: abuse notification due to make test

2013-02-07 Thread Dan Milon
Verify the hash of whatever you downloaded. http://nodejs.org/dist/v0.8.19/SHASUMS.txt On 02/07/2013 06:30 PM, Sven Knuth wrote: another try before giving up: I started the nodes.js self test with make test. ( I think it is an self test, because I didn't found a description of the test)

Re: [nodejs] Re: What happens to hook.io?

2013-02-06 Thread Dan Milon
«No. Even if I did, you wouldn't understand.» Obviously the guy is not in a mood for explanations. Let's all move on. On 02/06/2013 07:40 PM, Mark Hahn wrote: I can't tell from the docs what this is used for. Can you explain? On Wed, Feb 6, 2013 at 2:07 AM, Marak Squires

Re: [nodejs] Valid character encodings for source code

2013-02-04 Thread Dan Milon
The OP meant the actual file encoding. eg, if you have a source file containing Greek characters and save it in iso-8859-7 format (which should display just right if read with the same encoding), node will try to read it in utf and fail. (ie � characters in strings, etc) danmilon. On 02/04/2013

Re: [nodejs] core dump analysis debugging

2013-02-01 Thread Dan Milon
/2013 01:21 PM, Ben Noordhuis wrote: On Fri, Feb 1, 2013 at 12:39 AM, Dan Milon danmi...@gmail.com wrote: I was wondering if it is possible to use a core dump from a node process running on linux as a post mortem debugging mechanism. Would smartos' MDB understand a core dump coming from

Re: [nodejs] core dump analysis debugging

2013-02-01 Thread Dan Milon
$ ulimit -c unlimited $ node -e 'process.abort()' Aborted (core dumped) $ ls -a ./ ../ Any idea? BTW, could you point me to the actual code of process.abort in the source? danmilon. On 02/01/2013 05:52 PM, Ben Noordhuis wrote: On Fri, Feb 1, 2013 at 4:38 PM, Dan Milon danmi...@gmail.com

Re: [nodejs] core dump analysis debugging

2013-02-01 Thread Dan Milon
wrote: On Fri, Feb 1, 2013 at 5:27 PM, Dan Milon danmi...@gmail.com wrote: $ ulimit -c unlimited $ node -e 'process.abort()' Aborted (core dumped) $ ls -a ./ ../ Any idea? BTW, could you point me to the actual code of process.abort in the source? danmilon. Check what

Re: [nodejs] Re: Javascript Class Specification for the next generation of JS class system, hope to discuss with you.

2013-01-31 Thread Dan Milon
Kinda offtopic: I see a lot of people here mention OOP and classes are flawed. Does anyone have some reading to suggest about OOP and its issues? Maybe some comparison with functional programming. danmilon. On 01/31/2013 10:10 PM, Diogo Resende wrote: +1. Java people should really read and

Re: [nodejs] How to future proof password hashes?

2013-01-31 Thread Dan Milon
Yes, the buffers will be identical. danmilon. On 02/01/2013 12:41 AM, Harald Hanche-Olsen wrote: I'd like to store user password hashes in a database. When a new password is created, I get some bytes from crypto.randombytes to use as salt, then feed the salt and password to crypto.pbkdf2

[nodejs] core dump analysis debugging

2013-01-31 Thread Dan Milon
I was wondering if it is possible to use a core dump from a node process running on linux as a post mortem debugging mechanism. Would smartos' MDB understand a core dump coming from a linux machine? Thanks, danmilon. -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines:

Re: [nodejs] Graceful exit on SIGINT/SIGTERM

2013-01-30 Thread Dan Milon
You can easily override the default signal handlers. See http://nodejs.org/docs/latest/api/process.html#process_signal_events you could do: ``` function gracefulExit() { db.close(process.exit) } process.on('SIGINT' gracefulExit).on('SIGTERM', gracefulExit) ``` Obviously it can be more

[nodejs] [ANN] assurance - validation sanitization library

2013-01-28 Thread Dan Milon
I'd like to announce _assurance_, a library for input validation sanitization. It's been built with network APIs in mind, but it can be used for CLI programs too. ## Features * Provides a **clean** **pretty** API * Returns meaningful error **objects**, not error messages *

Re: [nodejs] ANN: node-pcre

2013-01-26 Thread Dan Milon
Not really relevant, but this reminded me of Mads Ager's talk [1], from the V8 team, when V8 was a new thing. He talks about how they started with pcre internally, but then decided to write their own regex engine. Anyway, I found it interesting, you might wanna check it out. [1]

Re: [nodejs] Re: Data validation

2013-01-22 Thread Dan Milon
comments inline. On 01/22/2013 01:56 PM, Alan Hoffmeister wrote: Well, generaly I don't wait for the db to throw a duplication error to warn the user that he needs to pick up another username. But of course, if the form is 100% valid I still need to take care about his username at the db

Re: [nodejs] Re: Data validation

2013-01-22 Thread Dan Milon
process instead of prefetching it? -- Att, Alan Hoffmeister 2013/1/22 Dan Milon danmi...@gmail.com mailto:danmi...@gmail.com comments inline. On 01/22/2013 01:56 PM, Alan Hoffmeister wrote: Well, generaly I don't wait for the db to throw a duplication error to warn

[nodejs] get failing host from getaddrinfo ENOTFOUND

2013-01-17 Thread Dan Milon
When you get a `getaddrinfo ENOTFOUND` error, is there a way to get the host that failed? It's coming from node-stripe, for whatever reason my dns fails and I'm catching it on uncaughtException. I could wrap the stripe calls, but thats a mediocre solution. Thanks, danmilon. -- Job Board:

Re: [nodejs] basic dependency question

2013-01-14 Thread Dan Milon
Dependencies (aka `require`s) are resolved synchronously. So the flow is: A -- B -- C A -- C Also modules are cached. [1] ie, they are not loaded twice. A and B see the same version of C. [1] http://nodejs.org/docs/latest/api/modules.html#modules_caching Hope this helps, danmilon. On

Re: [nodejs] basic dependency question

2013-01-14 Thread Dan Milon
here node_modules/A/node_modules/C -- C-0.0.2 here On Mon, Jan 14, 2013 at 5:49 PM, Dan Milon danmi...@gmail.com mailto:danmi...@gmail.com wrote: Dependencies (aka `require`s) are resolved synchronously. So the flow is: A -- B -- C A -- C Also modules are cached. [1] ie

Re: [nodejs] node + raspi + Internet of Things (IoT)

2013-01-11 Thread Dan Milon
There was a similar thread some months ago, and a separate list [1] was created for further discussion. There hasn't been any activity lately, but you might wanna check with these guys also. [1] https://groups.google.com/forum/?fromgroups#!forum/iofthings danmilon. On 01/11/2013 11:47 AM, Paul

Re: [nodejs] Xcode and Node.js

2012-12-20 Thread Dan Milon
Offtopic: On 12/21/2012 01:06 AM, Ryan Schmidt wrote: JavaScript is interpreted, not compiled. That's not true. The language by itself does not require the VM to either interpret or compile the code. V8 in fact does compile the code into an intermediate format called Hydrogen. (not assembly).

Re: [nodejs] What's the default value of a buffer

2012-12-07 Thread Dan Milon
Its just allocated space, there's no default. It defaults to whatever the previous process which owned that chunk of memory wrote there. danmilon. On 12/08/2012 04:14 AM, Goddy Zhao wrote: var buf = new Buffer(1); console.log(buf[0]); The above code will print a random value of buf[0],

Re: [nodejs] Do ZLib stops the js main loop?

2012-12-05 Thread Dan Milon
It doesnt look like they wait for the previous ones to complete. Its just more load, so the threads queue up, hence the high latencies. danmilon. On 12/05/2012 12:24 PM, 長島徹 wrote: Hello. I found a strange behavior. I want to get the method to avoid the behavior. I compress a data

Re: [nodejs] Re: Should stream.pipe forward errors?

2012-11-28 Thread Dan Milon
Technically you could explicitly add each stream to its own domain. danmilon. On 11/29/2012 02:47 AM, Mikeal Rogers wrote: with domains, these will all get trapped in the same domain because they are all event emitters, if they throw. i tried forwarding errors through pipe chains but it

Re: [nodejs] Creating a stateful server using node.js

2012-11-01 Thread Dan Milon
Sounds like you need a database, not? Is there a particular reason you wont use a regular generic external database? You could even use embedded levelDB https://github.com/rvagg/node-levelup danmilon. On 11/01/2012 12:02 PM, Arindam Mukherjee wrote: I am trying to write a distributed monitoring

Re: [nodejs] Re: process.env - documentation?

2012-11-01 Thread Dan Milon
I totally agree with Tim SL here. I think the argument: If you google'ed you'd find out is invalid. The same argument could be used for almost every question in this mailing list. To keep away from over-documenting I agree with Tim, at least there should be a link to an online man page. But I

Re: [nodejs] Problem with using socket.io

2012-11-01 Thread Dan Milon
Probably the browser (for some reason) did not fetch the socket.io.js file, so the global variable io does not exist. Make sure the server returns the file, and the client can talk to the server. danmilon. On 11/01/2012 11:12 PM, _Kili_ wrote: Hi, I am beginner with node.js and just trying to

Re: [nodejs] Socket.io, answer WELL, don't lock.

2012-10-31 Thread Dan Milon
have sent you to the 'ws' issue tracker right away. -- Martin Cooper and I also didn't know much about the path variable. Op woensdag 31 oktober 2012 15:22:29 UTC+1 schreef Dan Milon het volgende: You didnt post any issues, but posted a plz help

Re: [nodejs] Re: Sample code to add basic authentication to node http server

2012-10-29 Thread Dan Milon
a challenge. Again, any help much appreciated ! Thanks. On Thursday, 25 October 2012 14:36:19 UTC+1, Dan Milon wrote: Basic Auth does not use cookies. After you provide the credentials, its up to the browser to stop sending the Authentication header. Usually that happens after

[nodejs] [ANN] passbookster: An iOS passbook generation library

2012-10-29 Thread Dan Milon
I'd like to announce Passbookster. Passbookster allows you to create iOS passbook passes. It provides both a stream and callback API. Great care has been taken on performance. Node crypto module does not currently support PKCS#7 signing, so openssl is spawned internally, but a PR to add this

Re: [nodejs] Re: Server-to-Server Communication

2012-10-27 Thread Dan Milon
IMO socket.io/engine.io aim for server-client communication. But it would be interesting to see some numbers. danmilon. On 10/28/2012 12:49 AM, Marak Squires wrote: Use https://github.com/learnboost/engine.io On Sat, Oct 27, 2012 at 2:31 PM, Jacob Groundwater ja...@nodefly.com

Re: [nodejs] Re: Sample code to add basic authentication to node http server

2012-10-25 Thread Dan Milon
Basic Auth does not use cookies. After you provide the credentials, its up to the browser to stop sending the Authentication header. Usually that happens after a browser restart. Try private browsing. danmilon. On 10/25/2012 04:16 PM, gng wrote: Sorry, I should have been more specific: I have

Re: [nodejs] Re: Use of Node / Express / MongoDB for a e-commerce website?

2012-10-25 Thread Dan Milon
Still, postgres foreign tables do not support SQL transactions, which you'd need for an e-commerce product. But its definitely interesting. On 10/25/2012 06:58 PM, Stephen Handley wrote: re: the idea of using sql for some transactions and mongo for an object store

Re: [nodejs] nodejs zlib performance

2012-10-25 Thread Dan Milon
Thats out of node's scope. If you've got too much work to do, and too few cores, well, shit get scheduled. Plus, there are a lot of processes already fighting for some CPU juice. Essentially what you're talking here is CPU scheduling. danmilon. On 10/26/2012 02:49 AM, Jimb Esser wrote: That is

[nodejs] npm registry down

2012-10-22 Thread Dan Milon
curl -v https://registry.npmjs.org * About to connect() to registry.npmjs.org port 443 (#0) * Trying 23.23.147.24... Connection refused * couldn't connect to host * Closing connection #0 curl: (7) couldn't connect to host Anyone got a mirror? -- Job Board: http://jobs.nodejs.org/ Posting

Re: [nodejs] npm registry down

2012-10-22 Thread Dan Milon
Thanks for the info! Pitty npm isnt deployed in many areas. On Mon, Oct 22, 2012 at 9:58 PM, Forrest L Norvell forr...@newrelic.com wrote: On Monday, October 22, 2012 at 11:55 AM, Dan Milon wrote: curl -v https://registry.npmjs.org * About to connect() to registry.npmjs.org port 443 (#0

Re: [nodejs] Re: How to properly coordinate a sole task between multiple processes on many servers

2012-10-05 Thread Dan Milon
greelkorke ment using a job queue where jobs are put, and handed to workers. If you want to do it only with mongo, you'll need to use some lock document, that is set and unset by the first process which tries to initiate a task. All other processes which try to grab the lock while its held by

Re: [nodejs] Re: How to properly coordinate a sole task between multiple processes on many servers

2012-10-05 Thread Dan Milon
offers no atomic operations so this was the only reliable way to do it. It works quite well. In the usual case it just grabs the task, does it, and moves on. Collisions are rare, but they may be more frequent as the cluster grows in size. On Fri, Oct 5, 2012 at 9:21 AM, Dan Milon danm

Re: [nodejs] Array reads faster than Buffer reads ???

2012-10-04 Thread Dan Milon
Curious, shouldn't V8 be able to inline the readUInt8 function call, or there's more than that? On Thu, Oct 4, 2012 at 1:43 AM, Ben Noordhuis i...@bnoordhuis.nl wrote: On Thu, Oct 4, 2012 at 1:37 AM, NodeNinja aeon6f...@gmail.com wrote: Doing some tests on windows with node v0.8.11

Re: [nodejs] Re: Game hiscores: flat files or database?

2012-10-01 Thread Dan Milon
Then you should read again about Mongo. danmilon. On Mon, Oct 1, 2012 at 3:56 PM, Felix E. Klee felix.k...@inka.de wrote: On Mon, Oct 1, 2012 at 1:50 PM, Pedro Teixeira pedro.teixe...@gmail.com wrote: http://redis.io/topics/persistence Too complicated and/or not reliable enough. At

[nodejs] Validating input in express handlers

2012-09-25 Thread Dan Milon
Hello, I question myself how I should validate input all the time, but still i haven't found the right way. Using an orm's validation tools feels wrong. Eg mongoose. It ties validation with the underlying database. node-validator is quite limiting. The way it throws errors is hard to deal

Re: [nodejs] Validating input in express handlers

2012-09-25 Thread Dan Milon
Hello Jonny, It is a public API, nothing to do with forms or rendering pages. Do you have any other suggestion? Thanks, danmilon. On 09/25/2012 10:31 PM, Jonathan Buchanan wrote: On 25 September 2012 14:33, Dan Milon danmi...@gmail.com mailto:danmi...@gmail.com wrote: Hello, I

[nodejs] repl with async ops

2012-09-19 Thread Dan Milon
Hello, I am trying to create a repl, that will mostly call async ops. How can i pause it until the async operation is over? Something like the mongo repl. Thanks, danmilon. -- Job Board: http://jobs.nodejs.org/ Posting guidelines:

[nodejs] How the browser should communicate with our API

2012-09-17 Thread Dan Milon
Hello Community, Sorry for going off topic, but I'm sure there are people here who could help me. Although most of the stuff described below are build in node, my question is more of an architectural one. I'm developing a public HTTP backend API for a service. On top of that, there is a web app

[nodejs] Parsing multipart/mixed

2012-09-04 Thread Dan Milon
Hello, I am issuing HTTP requests to a third party API, through node, and the response has content-type multipart/mixed. Do you know if there is a parser module for this, or how i could use the multipart parser of node-formidable to achieve this? Thanks, danmilon. -- Job Board:

Re: [nodejs] Nodejs Restify and Express

2012-08-30 Thread Dan Milon
UTC+8, Dan Milon wrote: You mean both on the same process? Yeah as long as its a different port. If you are asking which one to choose, for an (rest) API server, its not an easy answer. I first tried restify, but it didnt compute etags out of the box which i found

Re: [nodejs] [Ann] UglifyJS 2.0

2012-08-30 Thread Dan Milon
Out of topic, but you gave me the clues. Do you know where i can read up about AST trees for javascript? Thanks a ton, danmilon. On 08/30/2012 12:27 AM, Marcel Laverdet wrote: Just curious why you need the comments in the AST at all? If you've got the start position length of every token in

Re: [nodejs] Nodejs Restify and Express

2012-08-27 Thread Dan Milon
You mean both on the same process? Yeah as long as its a different port. If you are asking which one to choose, for an (rest) API server, its not an easy answer. I first tried restify, but it didnt compute etags out of the box which i found strange for a rest API server. Plus i did not make

Re: [nodejs] Windows - USB Install - Modules

2012-08-24 Thread Dan Milon
Since this is an application, and you are going to ship it to customers, why not have node_modules pre installed on the usb drive? On 08/24/2012 05:20 PM, MikeB_2012 wrote: I am trying to create a small app nodejs-based app that runs on a USB drive (that will be inserted in to various Windows

Re: [nodejs] shrouding the javascript source via encryption

2012-08-23 Thread Dan Milon
As you probably understand, there will always be a step between decrypting and parsing that your code will be plaintext. At the end of the day, it is your code but running on some other dudes computer who has full control over it. So as it concerns javascript and particularly v8, you will

Re: [nodejs] Why `fs.exists` has signature `(exists)` instead of `(err, exists)` ?

2012-08-22 Thread Dan Milon
Isaac, i am curious why you believe fs.exists should stay as is. I found your previous mail kind of autarchic. Some communication/reasoning will surely make each side understand better the pros/cons. danmilon. On 08/23/2012 12:32 AM, Isaac Schlueter wrote: Yeah, Jimb, I'm not sure I know

Re: [nodejs] How would you solve this: how many minutes connected

2012-08-20 Thread Dan Milon
What about socket.io .on('connect'), .on('disconnect'). You can get the time range user is logged, and then sum up these in db. On Tue, Aug 21, 2012 at 3:09 AM, Filipe fili...@gmail.com wrote: Hi everyone! I have this scenario: Express, Socket.io and MongoDB. The problem: reward points to

Re: [nodejs] Re: Can't install socket.io or run now.js on windows 7 x64

2012-08-16 Thread Dan Milon
node-redis can either use a javascript parser, or the one from hiredis. The latter is a little faster, but if it does not compile under windows, ignore the dependency and go for the native parser. (which is the default). danmilon. On Thu, Aug 16, 2012 at 4:54 PM, Bert Belder bertbel...@gmail.com

Re: [nodejs] a pakage that exports few modules

2012-08-13 Thread Dan Milon
I believe there is no performance drop if you require a huge library and only use a small part of it. I mean, code memory is a small part of the total memory you use. danmilon. On 08/13/2012 01:02 PM, Osher E wrote: Hi all most modules have an entry point, which is by default index.js. But

Re: [nodejs] Re: [ANN] New release of node-webkit - run node.js apps on desktop

2012-08-10 Thread Dan Milon
since the latest version of appjs there is a shared context between node/webkit so you can use node calls inside the client side code. Example here https://gist.github.com/3312818 danmilon. On 08/10/2012 03:57 AM, Zhao Cheng wrote: On Thu, Aug 9, 2012 at 11:16 PM, Tim Caswell

Re: [nodejs] Domain for every worker?

2012-08-10 Thread Dan Milon
How did you implement this exactly? (gist?) You should be able to create a domain inside the slave code that will fire whenever this specific slave throws. danmilon. On 08/10/2012 03:01 PM, Honigbaum wrote: Hello, my node.js application uses the cluster module for forking workers and I

Re: [nodejs] Domain for every worker?

2012-08-10 Thread Dan Milon
/3313918 Or is it a problem that I assign ever domain to the same var? Torben Am Freitag, 10. August 2012 14:32:03 UTC+2 schrieb Dan Milon: How did you implement this exactly? (gist?) You should be able to create a domain inside the slave code that will fire whenever this specific

Re: [nodejs] Domain for every worker?

2012-08-10 Thread Dan Milon
to the documented domain#bind method. Good luck. danmilon. On 08/10/2012 05:16 PM, Honigbaum wrote: Ah, you're right. You mean like this https://gist.github.com/3313918 Am Freitag, 10. August 2012 15:40:04 UTC+2 schrieb Dan Milon: That is wrong. The domain creation should be at the code of the slave

Re: [nodejs] Re: mongodb client

2012-08-08 Thread Dan Milon
Well, mongo-node-native is the de facto implementation of the protocol, but there are lots of wrappers arround it (without schemas or ORM) that just make the API easier to handle. On 08/07/2012 10:15 PM, john.tiger wrote: On 08/07/2012 01:48 AM, Martin Wawrusch wrote: We use mongoose and

Re: [nodejs] Re: loading static files named 'server.js'

2012-08-08 Thread Dan Milon
Why use IIS with node? You sacrifice everything, for what? On 08/08/2012 11:38 AM, yishayw wrote: I figure it out, the solution was in my IIS configuration. I changed web.config so that all occurrences of 'server.js' were replaced with 'nodejs_server.js'. I then renamed all my node.js server

Re: [nodejs] Re: How do you handle if/else with async inside

2012-08-08 Thread Dan Milon
Indeed, you cannot get anything less than +1 indentation. Thanks for your input! danmilon. On 08/08/2012 04:54 PM, Tim Caswell wrote: On Wed, Aug 8, 2012 at 4:13 AM, Dan Milon danmi...@gmail.com wrote: That will work, indeed, but it annoys me that indentation and code readability gets fucked

[nodejs] How do you handle if/else with async inside

2012-08-07 Thread Dan Milon
I am wondering which are the different patterns to handle cases like var results if (cond) { async1(function (err, res) { results = res }) } else { async2(function (err, res) { results = res }) } // here need to do something with results. The problem is obvious, but i cannot

Re: [nodejs] How do you handle if/else with async inside

2012-08-07 Thread Dan Milon
True, that works on this simplified case, but there is more logic, depending on the cond, etc. I recall reading a blog post about having async if. like if (cond, trueFn, falseFn, doneFn) That was interesting. On 08/07/2012 07:47 PM, Mark Volkmann wrote: On Tue, Aug 7, 2012 at 11:35 AM, Dan

Re: [nodejs] [ANN]: node-nat-pmp: A Node.js implementation of the NAT Port Mapping Protocol

2012-08-05 Thread Dan Milon
Unfortunately my router does not support it, but the module seems very neat. Although, security-wise it doesn't seem very nice allowing any app to open any ports. There should be some approval. On 08/06/2012 01:39 AM, Nathan Rajlich wrote: If you've wanted to forward your ports

Re: [nodejs] string encoding

2012-08-02 Thread Dan Milon
for me, text is exit\n I guess you are on windows, so text is exit\r\n The readline module might help you. On 08/02/2012 04:15 PM, Danil Gazizov wrote: I'm confused of how to compare string const with variable. Look at this simple example where keyboard input compares with const string. I

Re: [nodejs] node-mongodb-native problems with sort

2012-07-14 Thread Dan Milon
of this. Dan Milon. On 07/13/2012 11:20 PM, Jeremy Darling wrote: try: col.find({username:username}, {}, {sort: {date: -1}}, function(err, records){ console.log(records); }); 1st param is the query, 2nd param is options object, sort is an object under the options object as entered in the Mongo CLI

Re: [nodejs] how to display the value of a variable in the deugger?

2012-07-12 Thread Dan Milon
http://nodejs.org/api/debugger.html repl i On 07/12/2012 10:47 AM, josh wrote: // test.js var i=0; debugger; // node debug test.js // n(next) // backtrace= #0 test.js:2:1 // i = i not defined how to display the value of i? -- Job Board:

Re: [nodejs] CGI example needed

2012-07-08 Thread Dan Milon
You wouldn't use node as a cgi script (at least for the web part). Technically you can, but you would lose all the benefits (async/nonblocking io) since you let apache or any http server for the matter enforce the concurrency model. Afaik, the cgi server will pull up node processes for each

Re: [nodejs] CGI example needed

2012-07-08 Thread Dan Milon
Yeah, You should read up nodejs.org tutorials / blogs to learn more ;) danmilon. On 07/09/2012 12:54 AM, Tim Johnson wrote: * Dan Milon danmi...@gmail.com [120708 10:27]: You wouldn't use node as a cgi script (at least for the web part). Technically you can, but you would lose all

[nodejs] stream.pause with tcp

2012-07-06 Thread Dan Milon
protocol pause? Thank you, Dan Milon. -- 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

Re: [nodejs] Re: MMO game node balancing multi servers

2012-07-05 Thread Dan Milon
Your requirement to be able and spin up more servers of the same game requires a lot of sharing between each of these servers, because they need (eventually) to be in the same state. The only advantage of this over having a single server for each game is that you load balance incoming traffic

Re: [nodejs] Parallel Async Calls and Parallel Errors

2012-07-05 Thread Dan Milon
I believe a streaming API would be more appropriate for such a task. Something like: var deleter = new Deleter('~'); deleter.on('error', function (err) { console.error(err) }) deleter.on('file', function (fileName) { console.log('deleted ' + fileName) }) deleter.on('end', function () {

Re: [nodejs] Web scraping and Memory leaking issue

2012-07-03 Thread Dan Milon
to start again. This way you have a constantly low memory footprint and the same performance. Hope i helped, Dan Milon. [1] https://github.com/caolan/async/#queue On 07/03/2012 01:42 PM, ec.developer wrote: Thanks for cheerio =)) Have removed the jsdom with cheerio. Now after 6000 pages

Re: [nodejs] devil's advocate: why would I choose nodejs over MVC + IIS?

2012-07-03 Thread Dan Milon
code in node ;) Hope I've helped, Dan Milon. On 07/03/2012 08:56 PM, Justin Collum wrote: Had a discussion with a friend about Nodejs the other day. We are both C# / MVC / ASP.NET devs, with about 10 years experience. He asked me why someone would choose Nodejs over IIS + MVC . My argument

[nodejs] Hook.io performance

2012-07-01 Thread Dan Milon
the underlaying mechanisms hook.io uses for IPC (please enlighten me), but isn't this performance quite low? Or is there something wrong with the test? Thanks, Dan Milon. [1] https://gist.github.com/3029842 -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki

Re: [nodejs] Hook.io performance

2012-07-01 Thread Dan Milon
target? You could probably just use redis, or 0mq with a node.js driver. On Sun, Jul 1, 2012 at 3:45 PM, Dan Milon danmi...@gmail.com mailto:danmi...@gmail.com wrote: Hey Marak, Thanks for the valuable info. The use case is: I have a few hooks that receive messages

Re: [nodejs] Hook.io performance

2012-07-01 Thread Dan Milon
. It doesn't seem like a good idea to use dnode ( or even the node net module ) to pass that many messages on start. If you want to use node, you'll probably need to bring in an add-on that links to a more robust messaging protocol. On Sun, Jul 1, 2012 at 4:11 PM, Dan Milon danmi...@gmail.com

Re: [nodejs] Node and developing on multiple machines

2012-06-22 Thread Dan Milon
That wont work for binary modules. Is it such an overkill to just install global modules on the fly as you need them? on any computer. On 06/23/2012 01:00 AM, Elijah Insua wrote: dropbox On Fri, Jun 22, 2012 at 2:52 PM, Ralphtheninja (Magnus Skog) lars.magnus.s...@gmail.com

Re: [nodejs] cluster API is amazing

2012-06-17 Thread Dan Milon
That's why you should never use MemorySession for express, socket.io. Generally, any connection related data cant go in memory. Bradley Meck bradley.m...@gmail.com wrote: Multiple connections can be made that keep state in a non-transactional/distributed location. This can lead to things where

Re: [nodejs] Re: Unloading a module from require

2012-06-14 Thread Dan Milon
What is the use case of unloading a module? On 06/14/2012 10:02 AM, yogesh agrawal wrote: delete require.cache is not good way to unload. Some times module doesn't get unloaded after deleting it from cache. Modules api lacks unload method :( On Thu, Jun 14, 2012 at 11:28 AM, Ben

Re: [nodejs] don't pass stdout to child_process.fork

2012-05-26 Thread Dan Milon
«By default the spawned Node process will have the stdin, stdout, stderr associated with the parent's.» child_process.fork(modulePath, [args], [options]) «There is a deprecated option called customFds which allows one to specify specific file descriptors for the stdio of the child process.

Re: [nodejs] [ANN] MeshCraft: Collaborative Concept Map Editor

2012-05-25 Thread Dan Milon
That is interesting! Idea: ability to export mesh as image or some other format. On 05/25/2012 09:03 AM, Axel Kittenberger wrote: With MeshCraft you can organize your concept maps (and notes, presentations, texts, etc.) in a mesh using your browser. GitHub source:

Re: [nodejs] Re: How to keep a queue active after a request is made in node.js amqp?

2012-05-17 Thread Dan Milon
Oh ok, i get it now. Well, i cannot guarantee about the publish method (but i find it highly unlikely that it needs to reinstantiate the queue). But on my app, i subscribe to a queue, and it works as expected (fires callback when a message is delivered). Could you write a gist to test it? On

[nodejs] rabbitmq flooding nodejs app

2012-03-07 Thread Dan Milon
Hello everyone, I'm facing the following problem. I just have set up a rabbitmq queue, and my node app is subscribed to that queue (via node-amqp). When a message arrives, the app does an insert and a few updates on a mongodb (via mongoose). Now the problem comes when there are say 1

  1   2   >