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] Re: HTTP client request headers (lowercase) issue

2012-12-01 Thread Dan Milon
AFAIK outgoing headers are not lowercased. Do you have a test case? danmilon. On Sat, Dec 1, 2012 at 10:01 PM, Cristian Bullokles wrote: > Looks like this change stills in v0.8.15 of node.js, I'm trying to > authenticate to an OAuth provider and I've the same problem. My provider is > not able t

Re: [nodejs] Re: HTTP client request headers (lowercase) issue

2012-12-01 Thread Dan Milon
Rogers wrote: > by default node.js sends headers in lowercase. by spec, HTTP headers are > caseless. if someone does not treat them that way you email them and ask them > why they suck at HTTP. > > On Dec 1, 2012, at December 1, 20124:50 PM, Dan Milon > wrote: > >> AFA

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] 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], any

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] Does events gets executed sync'd or async'd?

2013-01-11 Thread Dan Milon
sync. https://github.com/joyent/node/blob/master/lib/events.js#L123 danmilon On 01/11/2013 06:21 PM, Eric wrote: > Hi guys, > > Newbie question here: when a code calls emitter.emit(event), does the > listeners get executed synchronously or asynchrounsly? > > Thanks for the help, > > Eric. > >

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 T

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 01/1

Re: [nodejs] basic dependency question

2013-01-14 Thread Dan Milon
s/A/node_modules/B/node_modules/C <-- C-0.0.1 here > node_modules/A/node_modules/C <-- C-0.0.2 here > > > On Mon, Jan 14, 2013 at 5:49 PM, Dan Milon <mailto:danmi...@gmail.com>> wrote: > > Dependencies (aka `require`s) are resolved synchronously. > > So the f

[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: http://

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 l

Re: [nodejs] Re: Data validation

2013-01-22 Thread Dan Milon
inside the validation process instead of prefetching it? > > -- > Att, > Alan Hoffmeister > > > 2013/1/22 Dan Milon mailto:danmi...@gmail.com>> > > comments inline. > > On 01/22/2013 01:56 PM, Alan Hoffmeister wrote: > > Well, generaly I

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] http://www.youtube

[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 * **Accumulates

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 sophist

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 lea

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

[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: https://github

Re: [nodejs] core dump analysis & debugging

2013-02-01 Thread Dan Milon
ilon. On 02/01/2013 01:21 PM, Ben Noordhuis wrote: > On Fri, Feb 1, 2013 at 12:39 AM, Dan Milon > 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 smar

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 >

Re: [nodejs] core dump analysis & debugging

2013-02-01 Thread Dan Milon
08 PM, Ben Noordhuis wrote: > On Fri, Feb 1, 2013 at 5:27 PM, Dan Milon > wrote: >> $ ulimit -c unlimited >> >> $ node -e 'process.abort()' Aborted (core dumped) >> >> $ ls -a ./ ../ >> >> Any idea? >> >> BTW, could you

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

Re: [nodejs] Node.js webserver hangs

2013-02-05 Thread Dan Milon
Many. Take a look at https://github.com/lloyd/node-toobusy danmilon. On 02/05/2013 06:53 PM, Gustavo Machado wrote: > Hello, a rather theoretical question. > > What are the possible causes for a server to stop responding to the > most simple requests? How can one troubleshoot this kind of probl

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 > mailto:mar

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] 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 nodeconf,

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"

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 key

Re: [nodejs] Re: Re - Reusing the schema validation both on client side and server side

2013-03-01 Thread Dan Milon
See assurance [1]. We're using it both on the server and client. Actually we've created a shared repo exposing a function for each entity that needs to be validated, and a make target to fetch it from the repos that need it. [1] https://github.com/danmilon/assurance On 03/01/2013 02:28 PM, Sri

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 ent

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 w

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 22:42

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 read()

Re: [nodejs] Re: New Streams confusion

2013-03-26 Thread Dan Milon
like >>> on top of them. You never need to worry about data events, or >>> what state different streams are in. You can seek to different >>> positions in the stream, read just a certain number of bytes, >>> whatever. It's just super simple and super powerfu

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

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

2013-04-05 Thread Dan Milon
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 w

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

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 ans

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 yoursel

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

2013-04-09 Thread Dan Milon
8.12 > > 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: >> >>

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 wrote: > Hey, > > I'm trying to create a streaming parser/transformer for a special web proxy > project. The 'streams2' stream.Transform base class makes this quite easy,

Re: [nodejs] Superemitter - EventEmitter prototype - Really fast!

2013-06-17 Thread Dan Milon
`.on` seems a pretty heavy operation given that it crafts a new function every time. In the real world I assume it's a pretty hot path (take data listeners for http for example). It would be interesting to provide a real-world test, with `.on` benchmarked too. On 06/18/2013 03:38 AM, Tim Smart wr

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] 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) mailto:lars.magnus.s...@gmail.com>> wrote:

Re: [nodejs] Node and developing on multiple machines

2012-06-23 Thread Dan Milon
I dropped sshfs for some interval'ed rsync because of editors hanging when they have to scan directories stat everything and stuff. On 06/23/2012 09:05 AM, alFReD NSH wrote: John, mark. Don't you guys have any problem with the latency? -- Job Board: http://jobs.nodejs.org/ Posting guideline

[nodejs] Hook.io performance

2012-07-01 Thread Dan Milon
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

Re: [nodejs] Hook.io performance

2012-07-01 Thread Dan Milon
would require that throughput. Always good to get more input to shape the API. On Sun, Jul 1, 2012 at 3:18 PM, Dan Milon <mailto:danmi...@gmail.com>> wrote: Hello, I am using hook.io <http://hook.io> for some project. Today i thought of measuring how fast hook.io <

Re: [nodejs] Hook.io performance

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

Re: [nodejs] Hook.io performance

2012-07-01 Thread Dan Milon
g. 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 Milo

Re: [nodejs] Web scraping and Memory leaking issue

2012-07-03 Thread Dan Milon
en 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 page

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

2012-07-03 Thread Dan Milon
will ask you to write your next 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 c

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 traff

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 () {

[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

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 req

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 [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 the benefi

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: http://j

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

2012-07-14 Thread Dan Milon
. 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] 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] [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 programmaticall

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

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

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 fi

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

2012-08-08 Thread Dan Milon
That will work, indeed, but it annoys me that indentation and code readability gets fucked up. You have to follow code traces in order to understand the ordering of execution. I already use async for other cases. Do you find any of its control flow functions helpful for the if/else problem?

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 wrote: That will work, indeed, but it annoys me that indentation and code readability gets fucked up. You have to

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

2012-08-08 Thread Dan Milon
are also a lot of async libraries I know. 2012/8/7 Dan Milon mailto:danmi...@gmail.com>> I am wondering which are the different patterns to handle cases like var results if (cond) { async1(function (err, res) { results = res }) } else {

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 wrote: I don

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 want

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

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: 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 wrote: > On Thursda

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

2012-08-20 Thread Dan Milon
Thats what PHP thought about deprecation also. See where this got them. On Mon, Aug 20, 2012 at 6:59 PM, Arnout Kazemier wrote: > I really dont get why people want to depricate functions just because they > dont agree with the api signature. > > This is a useful function, it doesnt hurt anyone i

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 wrote: > Hi everyone! > > I have this scenario: Express, Socket.io and MongoDB. > > The problem: reward points to the user on ho

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 w

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 neve

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 O

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 use

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 t

[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: http://jobs

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

[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: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guide

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

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 <mailto:danmi...@gmail.com>> wrote: > > Hello, &

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 wrote: > On Mon, Oct 1, 2012 at 1:50 PM, Pedro Teixeira > wrote: > > http://redis.io/topics/persistence > > Too complicated and/or not reliable enough. > > At *any* point in time, I want to have the

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 wrote: > On Thu, Oct 4, 2012 at 1:37 AM, NodeNinja wrote: > > Doing some tests on windows with node v0.8.11 > > -

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 an

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

2012-10-05 Thread Dan Milon
ase 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 wrote: >> >>> greelkorke ment using a job queue where jobs are

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

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

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 > > http://www.citusdata.c

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

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

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

2012-10-29 Thread Dan Milon
of the browser session (but this is immaterial) - the point is every > unique user would get challenged. I'm not seeing this at all - any new > client can access a resource without a challenge. > > Again, any help much appreciated ! > > Thanks. > > > > On Thursday,

  1   2   >