[00:01] hassox: right [00:01] hassox: technoweenie: just updated that page to show a basic link [00:03] technoweenie: ok well i'll check it out [00:03] technoweenie: twitter-node was my first http server app [00:03] technoweenie: no it wasnt [00:03] technoweenie: its a client app, i meant wheres-waldo, the thing i'm finishign up now :) [00:04] technoweenie: hmm i've noticed node.js slowing down when i bench it [00:04] technoweenie: -n 10000 -c 10 [00:04] technoweenie: and it gets toa bout 6000 and hangs [00:04] hassox: yeah I get that too [00:04] hassox: you're on osx right? [00:04] technoweenie: yea [00:04] hassox: I get that with rack too [00:05] technoweenie: oh? maybe osx sucks, i can live iwth that [00:05] technoweenie: i was gonna get this shit running on the cloud tonight but i don tknow if i feel like fucking with that right now [00:06] hassox: it's changed though. It used to be when I was doing ab with node, that it would never stop but now it doing the same thing rack is doing [00:07] technoweenie: ah [00:07] technoweenie: http://github.com/technoweenie/wheres-waldo/blob/master/lib/api.js#L97-108 [00:07] technoweenie: thats the kind of nested callback shit i wanted to get away from [00:14] technoweenie: hey is it possible/recommended to close the response and then doing some processing [00:15] technoweenie: say i get a POST with some data, can i close early with "200 OK" and then insert that data into a queue or whatever [00:17] hassox: technoweenie: I think it is [00:17] hassox: technoweenie: responding to the client as quickly as possible is something I think is worthwhile [00:17] blackdog` has joined the channel [00:18] hassox: chain even has built in callbacks to do exactly this ; [00:18] hassox: ;) [00:21] technoweenie: its a freakin redis call, not sure it matters, but what hell [00:25] inimino: technoweenie: would a client expect a subsequent GET request to have updated content? [00:25] technoweenie: hm probably [00:28] jan____: gnight [00:29] inimino: later jan____ [00:32] technoweenie: hmm the redisclient lib isnt very stable yet though [00:32] jamiew has joined the channel [00:32] technoweenie: that can probably be fixed up [00:33] mattly has joined the channel [00:36] cloudhead has joined the channel [00:39] isaacs_mobile has joined the channel [00:39] technoweenie: lifo: hey i'll probably rewrite my waldo project w/ cramp to compare the two. [00:49] brosner has joined the channel [00:59] sprsquish has joined the channel [01:11] jamiew_ has joined the channel [01:13] achew22 has joined the channel [01:25] sudoer has joined the channel [01:27] markwubben has joined the channel [01:46] un0mi has joined the channel [01:55] hassox has joined the channel [01:56] cloudhead has joined the channel [01:56] alex-desktop has joined the channel [01:57] jed has joined the channel [01:59] tisba_ has joined the channel [02:08] jamiew_ has joined the channel [02:09] isaacs_mobile has joined the channel [02:15] inimino has joined the channel [02:16] FoxFurry has joined the channel [02:17] inimino has joined the channel [02:17] webben has joined the channel [02:24] rolfb has joined the channel [02:41] un0mi has joined the channel [02:46] mattly has joined the channel [02:51] jamiew_ has joined the channel [02:56] brosner has joined the channel [02:58] micheil: hmm.. Paperboy looks good [03:18] rtomayko has joined the channel [03:19] jed has joined the channel [03:26] hassox has joined the channel [03:27] steadicat has joined the channel [03:28] aguynamedben has joined the channel [03:31] rtomayko has joined the channel [03:36] un0mi has joined the channel [03:38] aguynamedben has joined the channel [04:14] bjartek has joined the channel [04:17] bpot has joined the channel [04:44] micheil has joined the channel [04:46] micheil has joined the channel [04:47] JoePeck has joined the channel [04:58] micheil: I wish I knew more about process.inherits [05:08] isaacs: hey, anyone here feel like having an opinion? [05:08] Pilate: i have lots of them [05:08] isaacs: let's say you install a package called "foo". foo has a "lib" folder inside it, along with the main "foo" module. [05:08] isaacs: require("foo") gives you the main foo module, but you watn something out of the libs. [05:08] isaacs: what makes more sense: [05:08] isaacs: a) require("foo/bar") [05:09] isaacs: b) require("foo/package/lib/bar") [05:09] isaacs: c) something else? [05:09] isaacs: must not add anything to the require() function. just a question of folder structure. [05:11] technoweenie: require foo/bar [05:11] technoweenie: i have lib/index.js as the 'foo' module [05:11] technoweenie: foo/lib/index [05:11] technoweenie: foo/lib/bar.js [05:12] isaacs: technoweenie: suresure [05:12] isaacs: so you'd like to alias foo/lib to a "foo" folder that contains foo/lib/* [05:13] isaacs: as well as aliasing the foo/lib/index (or whatever you tell me to use) as require("foo") [05:17] un0mi has joined the channel [05:39] Yuffster has joined the channel [05:47] spoob has joined the channel [05:56] micheil: I wish I could work out the best way to work with Queue and make it class based [06:03] isaacs: micheil: should probably be its own thing [06:03] isaacs: ie, divorced from npm [06:03] isaacs: what are you getting stuck on? [06:03] micheil: umm.. sorry? [06:04] micheil: npm.. node package manager, right? [06:05] micheil: looks like there's two queue's [06:06] micheil: http://github.com/miksago/Queue.js [06:07] micheil: I've got a queue system, although, the flow should be: [06:07] micheil: node-smtp <-> DataPump <-> Queue [06:07] micheil: although I can't access and mixin the prototype properties correctly [06:10] micheil: hmm.. there's no such thing as while ... else in javascript, is there? [06:13] micheil: actually. I /don't/ need Queue, I need a data pump. [06:22] scudco has joined the channel [06:29] micheil: does this make sense? http://gist.github.com/279826 [06:31] r11t has joined the channel [06:34] jtoy has joined the channel [06:39] steadicat has joined the channel [06:40] hassox: micheil: nice :) [06:40] hassox: that's pretty cool :) [07:04] micheil: hassox: good api? [07:04] hassox: having not used it yet, it looks pretty nice ;) [07:05] hassox: micheil: would you emit an event on push? [07:05] micheil: i could do that [07:06] hassox: then the _process could just be a callback on that event yeah? [07:06] micheil: it's basic sp that i can buffer data [07:06] hassox: is it really Pump.prototype.process.call(this); [07:06] hassox: ? [07:06] felixge has joined the channel [07:06] hassox: or is it this.process.call(this) [07:06] micheil: oh. damn [07:06] micheil: good find [07:06] hassox: or just [07:06] hassox: this.process() [07:08] micheil: new version pushed [07:09] micheil: ACTION is eating a piece of epic uxebu chocolate.. [07:09] hassox: dude I'm not picking here... just trying to understand from the pov of a js noob [07:09] hassox: is this.process.call(this); == this.process() ? [07:09] micheil: no [07:10] hassox: how are they different? [07:10] micheil: I've got to ensure the scopes are fine [07:10] hassox: when you call a function on an object, isn't this set to the object? [07:10] micheil: I have run into scoping issues before, so I'm playing on the safe side [07:10] hassox: does the emit("data", packet) belong on the process or on the push? [07:11] micheil: process [07:11] hassox: why? [07:11] hassox: again.. not to pick [07:11] micheil: the stream automatically tries to empty [07:11] hassox: just want to gr0k [07:11] micheil: so if you initialize a new Pump with: var MyPump = new Pump(); [07:12] micheil: it will automatically have that data event [07:12] micheil: although, you can pass in an optional handler that will process the data [07:13] hassox: what's the _running about? I don't see you setting that anywhere [07:13] micheil: reload. [07:13] micheil: I forgot to set it [07:14] isaacs: ryah: http://github.com/isaacs/node/commit/7cc41cfb9c4fa370d34d237809d5d79c562dbb56 [07:14] hassox: :) [07:14] hassox: micheil: yeah I like it [07:15] hassox: I can think of a couple of places where that will be handy for me [07:15] micheil: so hopefully that should act as a tidy pump for any form of data [07:15] un0mi has joined the channel [07:18] micheil: eg, streaming files, network sockets, etc [07:19] hassox: yeah [07:19] hassox: i like [07:20] micheil: I'm going to remove the Queue.js project and create a new simple thing called node-pump, just to make deployment easier [07:21] micheil: I'm actually working on rewriting node-smtp's core to ensure that data is consistently executed and parsed [07:21] hassox: :D [07:21] hassox: sweet [07:21] hassox: I have to catch a train [07:21] hassox: ttyl [07:22] micheil: hmm.. eventEmitter callbacks are called within the scope of the emitter right? [07:27] micheil: looks like it.. [07:29] felixge: doing some mass-connection tests again [07:29] felixge: up to 20k and counting [07:29] felixge: :) [07:32] rictic has joined the channel [07:33] isaacs: felixge: nice! [07:34] felixge: moving this to a beefy ec2 machine now [07:34] felixge: vm ran out of ram (512 mb0 [07:34] felixge: :) [07:37] felixge: nice, they got 68 GB Ram machines [07:37] felixge: now we're talking [07:37] felixge: :) [07:42] piranha has joined the channel [07:47] scudco has joined the channel [07:51] felixge: ok [07:51] felixge: running out of sockets after 28k connections [07:51] felixge: bummer [07:52] cadorn has joined the channel [07:53] micheil: ack.. why am I getting seg faults.. [07:53] felixge: micheil: what ya doing? [07:53] micheil: working on node-smtp [07:53] micheil: rewriting the internal packet pump [07:55] felixge: ah, forgot to extend the port range [07:55] felixge: :) [07:56] felixge: holy smokes [07:56] felixge: 64510 connections well and alive! [07:56] micheil: okay... there we go, it was my drain event [07:59] micheil: that's better.. got it to queue a bit. [08:01] DamZ has joined the channel [08:01] scudco has joined the channel [08:05] mikeal has joined the channel [08:09] spoob: felix; are you just testing how many ports the Linux kernel can have open, or are you doing useful things on each connection? [08:11] kennethkalmer: micheil: afternoon ! [08:12] isaacs: whoa! str.match(reg) returns an object with an index telling you where it matched! [08:12] isaacs: jed was looking for that [08:13] spoob: ironic that a search function wasn't found [08:14] spoob: and if it's not ironic, then it's Alanironic [08:16] isaacs: spoob: that's definitely Alanironic [08:16] isaacs: not ironic. [08:16] spoob: i oughta know, yeah yeah! :) [08:18] erichocean has joined the channel [08:18] steadicat has joined the channel [08:19] micheil: kennethkalmer: arvo [08:19] zmoog has joined the channel [08:20] micheil: ken [08:20] kennethkalmer: doing well today ? [08:20] micheil: .. kennethkalmer I'm reworking the internal pump, I think it can be done better then the Queue one I've had in there [08:20] micheil: although, I've hit a small road block at the drain event [08:20] micheil: anyway, gotta cook some dinner, bbl [08:20] kennethkalmer: you are so way ahead of me on that aspect of the code [08:21] kennethkalmer: enjoy ! [08:21] qFox has joined the channel [08:21] micheil: kennethkalmer: if hassox comes back when I'm absent, could you tell him that the Pump is broken. [08:21] micheil: (it causes seg faults atm) [08:21] kennethkalmer: sure thing [08:21] micheil: cheers [08:21] kennethkalmer: ciao ! [08:30] felixge: spoob: Ihttp://gist.github.com/243632 [08:30] felixge: spoob: I'm opening http connections that send out "Hello\n" every 10 seconds [08:31] felixge: so I wouldn't say that this is super useful, but its decent enough [08:35] steadicat has joined the channel [08:36] scudco has joined the channel [08:39] un0mi has joined the channel [08:51] inimino has joined the channel [08:55] FoxFurry has joined the channel [08:57] FoxFurry has joined the channel [08:58] FoxFurry has joined the channel [09:03] spoob: felix; I don't get this +(new Date) [09:04] spoob: you didn't call the Date() constructor function, and I don't know what value it is being added to? [09:15] felixge: spoob: its a shortcut for getting the current datetime in ms [09:15] spoob: Yep I just don't understand how the shortcut works :) [09:15] felixge: well (new Date) is the same as (new Date()) [09:16] felixge: and the '+' is merely a hackish typecast operator :) [09:16] spoob: is that true for all functions? eg var Fred = funtion(){}, new Fred will invoke the function? [09:16] spoob: so + is the same as (int) ? [09:16] felixge: spoob: it is true for all functions. [09:17] felixge: spoob: but Fred() is not the same as 'new Fred' of course [09:17] spoob: ok, that's a bit uncomfortable as the lack of () should mean it doesn't call the function [09:17] felixge: well its not "calling" the function [09:18] spoob: so the constructor isnt invoked? [09:18] felixge: it creates a new object using Fred's prototype, then applies Fred as the constructor function against it and then returns the resulting object [09:18] felixge: but its not the same as calling the function because if Fred was to have a 'return value' it would be ignored [09:18] felixge: if you call it as a constructor [09:19] felixge: anyway, leaving out the () when using 'new' is just a convenience shortcut found in many languages [09:19] felixge: like PHP for example *g* [09:19] spoob: i'll try some experiments. So any hints for what the longer form of the typecast is, that the + is being a hack? :) [09:19] felixge: it doesn't change the meaning at all [09:19] felixge: Well, afaik JS has no real typecast operators [09:19] spoob: so is it short for 0+x or ""+x or... ? [09:19] felixge: it's short for 0+x [09:20] felixge: yes [09:20] felixge: I didn't realize how confusing this actually is until now : ) [09:20] spoob: "0Mon Jan 18 2010 19:47:27 GMT+1030 (CST)" [09:20] felixge: I think I saw it in the jQuery core and started using it [09:20] spoob: if it's 0 + then 0 gets added to a string rather than converting to a number [09:20] felixge: interesting [09:20] felixge: :) [09:21] spoob: jresig is a complete bastard for that kind of Javascript hackmagic [09:21] felixge: hah [09:21] felixge: yeah [09:22] felixge: I don't even know if this goes through some internal 'Date.toInt()' function or if its just magic unique to the date object [09:22] spoob: yep, so we're both now at the same questions that puzzled me. :) [09:22] spoob: 1) does the Date constructor get called, and 2) What is Date being added to? [09:23] felixge: I don't have any hopes of ever understanding JavaScript completely.:) [09:23] felixge: 1) it does get called [09:23] felixge: 2) No idea [09:23] spoob: {}+(new Date) works [09:23] spoob: so it's being added to an object? [09:24] felixge: god, I don't even want to know [09:24] felixge: :) [09:24] felixge: that's really creepy [09:25] spoob: it's kind of like stepping onto a chrunchy turdnugget in the language, isn't it [09:26] un0mi has joined the channel [09:27] felixge: interesting [09:27] felixge: (new Object)+(new Date) [09:27] felixge: does not work [09:27] felixge: "[object Object]Mon Jan 18 2010 10:24:12 GMT+0100 (CET)" [09:27] spoob: NaN+(new Date) doesn't work either [09:30] spoob: Number(new Date) does work [09:30] felixge: lol [09:31] felixge: funny given that Number is typeof 'function' [09:33] spoob: ok, I think that's enough poking around in the back regions of Javascript for me. some things are better not to know [09:33] spoob: i just couldn't understand what you were doing :) [09:35] spoob: function Smeg(){ puts("hi"); } [09:35] spoob: Smeg = function, Smeg() = "hi" [09:35] spoob: new Smeg = "hi", new Smeg() = "hi" [09:36] spoob: Apparently Brainfuck is quite easy to pick up after learning Javascript [09:37] felixge: haha [09:38] hassox has joined the channel [09:41] kennethkalmer: micheil: kennethkalmer: if hassox comes back when I'm absent, could you tell him that the Pump is broken. [09:41] hassox: kennethkalmer: thanx mate [09:41] spoob: hassox: Pump is broken [09:41] hassox: what's wrong with it? [09:41] kennethkalmer: hassox: (it causes seg faults atm) [09:41] hassox: spoob: !! Thanx!! [09:42] hassox: oh [09:42] hassox: that's not awesome :( [09:43] spoob: i'm sort of blinking at the idea that Javascript can cause seg faults. [09:43] hassox: hehe [09:49] inimino has joined the channel [09:50] inimino has joined the channel [09:50] inimino has joined the channel [09:51] inimino has joined the channel [09:51] inimino has joined the channel [09:52] inimino has joined the channel [09:52] teemow has joined the channel [09:53] inimino has joined the channel [09:54] inimino has joined the channel [09:55] inimino has joined the channel [09:55] inimino has joined the channel [09:56] inimino has joined the channel [09:57] inimino has joined the channel [09:57] inimino has joined the channel [09:58] inimino has joined the channel [09:59] inimino has joined the channel [09:59] inimino has joined the channel [10:00] inimino has joined the channel [10:03] inimino has joined the channel [10:04] inimino has joined the channel [10:05] inimino has joined the channel [10:06] inimino has joined the channel [10:08] inimino has joined the channel [11:00] micheil: ACTION made an epic bbq stir fry for dinner.. [11:00] micheil: (and is back) [11:08] micheil: hassox: yeah, I'm using them at the moment, and I can't get drain events working, they keep seg faulting [11:08] hassox: bugger :( [11:08] hassox: I wonder why? [11:08] hassox: it looked fine? [11:08] hassox: i mean [11:08] hassox: it looked fine [11:12] un0mi has joined the channel [11:14] micheil: I'm not sure, but it receives the first packet, then segfaults [11:14] micheil: just continually calls pump.drain [11:21] micheil: ryah: is there any way to get more information about something that's causing a segfault [11:23] micheil: hassox: got the bitch. http://gist.github.com/279945 [11:23] hassox: rock on! [11:24] micheil: segmentation fault due to calling .length on a undefined thing [11:25] keeto has joined the channel [11:28] jan____: anyone here on Leopard without the Snow? [11:28] dnolen has joined the channel [11:32] micheil: not i [11:33] micheil: okay.. so I've got it not segfaulting now, but it's not queueing.. [11:33] micheil: I think [11:34] micheil: hmm.. theoretically two continued packets should contain the same status codes.. [11:53] charlenopires has joined the channel [11:55] micheil: hmm... aria2 downloader looks interesting [12:00] blackdog` has joined the channel [12:03] hassox: micheil: got a sec? [12:06] hassox: anyone http://github.com/ry/node/blob/master/lib/http.js#L236 [12:07] hassox: is that line setting up a prototype chain for ServerResponse through OutgoingMessage ? [12:07] hassox: i.e. is ServerResponse "inheriting" from OutgoingMessage ? [12:07] micheil: umm.. [12:07] micheil: one sec [12:08] tiglionabbit has left the channel [12:08] micheil: it's calling OutgoingMessage scoped to ServerResponse [12:08] micheil: I think [12:09] hassox: what does that mean? [12:09] hassox: is it setting up a prototype chain? [12:09] micheil: just checking some docs [12:09] hassox: i.e. does ServerResponse's prototype == an outgoingmessage? [12:09] hassox: oh [12:09] hassox: kk [12:09] micheil: (my net connection's slow atm, slow as in dailup) [12:10] micheil: god, even though I can read these docs, it's like a doc spewed them.. no offence to MDC [12:11] micheil: "With call, you can write a method once and then inherit it in another object, without having to rewrite the method for the new object." [12:11] hassox: what dox are you reading? [12:11] hassox: sure... but how does that apply to a constructor function? [12:11] hassox: OutgoingMessage has a whole bunch of stuff setup on it's prototype [12:12] micheil: https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Function/call [12:12] micheil: https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Function/apply [12:12] tlrobinson has joined the channel [12:13] micheil: both do very similar, although in slightly different ways [12:15] hassox: ah i see [12:15] hassox: there's also sys.inherits(ServerResponse, OutgoingMessage); [12:15] hassox: that sets up the prototyp inheritance [12:15] hassox: the call just runs the obejct through the outgoingmessage constructor to catch all the this.foo = stuff [12:31] [k2] has joined the channel [12:35] micheil: man that was weird. [12:35] micheil: yeah [12:39] micheil: hassox: I think I have pump working again [12:40] hassox: :) [12:40] hassox: i have a use for this bad boi ;) [12:41] micheil: woah. actually, drain was still borked [12:42] farciarz84 has joined the channel [12:43] micheil: I need a while(...) {...} else {...} [12:43] soveran has joined the channel [12:44] felixge_ has joined the channel [12:45] hassox: erm... [12:45] hassox: where is http.ServerRequest defined? [12:46] mediacoder: hmm lib/http.js? [12:47] micheil: fuck [12:48] hassox: bioe [12:48] hassox: nope [12:48] hassox: can't find it in there [12:48] hassox: nor http.Server either :\ [12:48] micheil: note to self: An eventEmitter listener emitting it's own event causes segmentation faults [12:49] hassox: server is defined in C [12:49] hassox: micheil: ahh [12:49] micheil: yeah [12:49] hassox: but where is the request defined [12:51] micheil: okay.. that's freaky [12:52] hassox: what [12:52] micheil: what was causing the segmentation fault was this: eventEmitter.addListener() seems to scope the callback to the emitter [12:53] lifo has joined the channel [12:53] micheil: so by listening to the drain event, and calling this.emit("drain"); it went recursively crazy [12:53] micheil: I think that's a bug, but I'm not sure [12:54] mediacoder: yea, i think drain is borked atm [12:54] micheil: no, not drain, eventEmitter [12:54] micheil: drain is my own event name [12:54] mediacoder: ah, ok, sorry.. we were talking about borked sendHeaders drain [12:54] mediacoder: (yesterday) [12:55] hassox: damn not being able to read C [12:55] micheil: yeah, this is some custom code.. and um.. yeah [12:55] micheil: C++ is rather similar to JS [12:55] hassox: mediacoder: micheil if I want to add a method to the http.ServerRequest prototype, how do I do it? [12:55] micheil: just a bit more complicated ;P [12:55] hassox: I can't find it in the JS [12:56] mediacoder: hass http://github.com/ry/node/blob/master/lib/http.js#L235-244 [12:56] mediacoder: hassox: [12:56] hassox: not the response [12:56] hassox: the request [12:57] mediacoder: argh [12:57] mediacoder: :-) ..gotta get some sleep [12:57] hassox: ;) [12:57] hassox: there's no request... [12:57] hassox: damnit [12:57] hassox: it's an incoming message [12:57] mediacoder: what about incomingmessage? [12:58] JimBastard has joined the channel [12:58] hassox: IncomingMessage [12:58] hassox: yeah that's the one [12:58] JimBastard: ACTION ducks [12:58] hassox: weird [12:58] hassox: hehe [13:07] JimBastard: have i said how awesome mustache is today? [13:11] micheil: kennethkalmer: I think I've solved the issues with the pump... [13:11] mediacoder: is awesome mustache? or mustache awesome? ..actually both by __jan :-D [13:12] JimBastard: mustache owns [13:12] JimBastard: protip : {{{ }}} triple stash [13:14] lifo_ has joined the channel [13:17] micheil: hmm.. setTimeout is implemented wrong. [13:19] Nikkau has joined the channel [13:20] rolfb has joined the channel [13:24] hassox: micheil: JimBastard is it possible to re-open a function? [13:24] hassox: that is, is it possible to get inside a constructor function? [13:29] hassox: either that, or is it possible to re-open an object as a literal? [13:33] micheil: umm.. not possible to re-open a function persay [13:33] micheil: hassox: what are you wanting to do? [13:34] hassox: wanting to setup a getter / setter in a prototype [13:34] micheil: that does ..? [13:34] hassox: and use a private variable for storing the working value [13:34] hassox: lazy evaluation [13:34] hassox: 1 sec and I'll show you [13:34] hassox: I think I have something but not sure how ... acceptable it is [13:37] alex-desktop has joined the channel [13:38] hassox: micheil: http://gist.github.com/280011 [13:40] JimBastard: http://askawizard.blogspot.com/2009/12/object-container-or-type.html [13:40] JimBastard: ? [13:41] micheil: y'know there isn't any such thing as private variables [13:42] hassox: micheil: what do you mean [13:42] hassox: you can't access my little scriptname thingy there can you? [13:43] un0mi has joined the channel [13:43] micheil: you can, it's difficult but possible [13:45] micheil: woah. [13:45] hassox: yeah [13:45] micheil: setTimeout appears to be an event emitter [13:46] micheil: nodejs, please, stop fucking with my head.. [13:47] pmuellr has joined the channel [13:48] micheil: hahaha, that is awesome: process.Timer(delay, repeatDelay) [13:50] micheil: node's timers _are_ eventEmitters [13:50] micheil: epic. [13:51] micheil: epic: http://gist.github.com/280018 [13:53] micheil: time to write a patch for node's timers. [13:58] micheil: ryah: Node's timers are currently implemented in a way that diverges from the spec for timers, I believe. [14:04] hassox: micheil: how bad is this? http://gist.github.com/280030 [14:05] hassox: and does doing it like that make object creation slower? [14:13] JimBastard: am i missing something? how can i serve image files from node? im doing the correct mime type lookup but something is still wrong [14:13] JimBastard: encoding error? [14:20] micheil: hassox: that makes me twitch. [14:20] micheil: probably [14:20] micheil: you'd need to setEncoding to binary [14:20] hassox: micheil: it doesn't work anyway ;) [14:20] hassox: it doesn't seem like there's any way to do it without setting an intermediate value on the request object [14:24] micheil: just for brainfuck: Object.freeze(GLOBAL); [14:24] inimino: ACTION chuckles at "Alanironic" [14:26] inimino: felixge_: btw you don't even need the parens... I usually use "+new Date" [14:27] JimBastard: micheil i dont get what im suppose to call setEncoding on [14:27] JimBastard: in what scope will it be defined [14:27] JimBastard: resp? req? this? [14:28] micheil: resp [14:29] JimBastard: has no method 'setEncoding' [14:30] micheil: I dunno then [14:31] inimino: felixge_: and I notice spoob is gone, but for the record, it's not adding (new Date) to anything, it's just unary plus, equivalent to Number(new Date) [14:32] inimino: js> +"42" [14:32] gbot2: inimino: 42 [14:33] inimino: btw, there's now an evalbot in the channel :) [14:36] rolfb: how much can it do? [14:37] inimino: does what a spidermonkey can [14:37] rolfb: js> new Date(); [14:37] gbot2: rolfb: Mon Jan 18 2010 09:31:43 GMT-0500 (EST) [14:37] pdelgallego has joined the channel [14:38] rolfb: that's not MY timezone :P [14:39] hassox_ has joined the channel [14:41] stevestmartin has joined the channel [14:43] Booster has joined the channel [14:48] hassox has joined the channel [14:51] micheil: js> process.exit(); [14:51] gbot2: micheil: Error: ReferenceError: process is not defined [14:51] micheil: aww.. [14:51] micheil: woot! got test-timers passing [14:52] lifo has joined the channel [14:54] cloudhead has joined the channel [14:57] micheil: ryah: are you about? [15:06] aguynamedben has joined the channel [15:11] evilclone has joined the channel [15:14] micheil has joined the channel [15:16] hassox: ryah: how to be finding out if the request is http or https? [15:17] micheil: req.protocol or something [15:22] stevestmartin: any code style guidelines around?, looking at some of the existing projects they vary greatly [15:22] deanlandolt has joined the channel [15:23] felixge_: stevestmartin: not yet, but it'd be nice to have [15:23] stevestmartin: the idea to conform to the commonjs specs? [15:23] hassox: nope [15:23] hassox: stevestmartin: not nope to you [15:23] hassox: micheil: nope to you... it's not there and I don't see it in the source :\ [15:23] felixge_: stevestmartin: does commonjs make style proposals? [15:24] micheil: stevestmartin: code guidelines as to? [15:24] stevestmartin: no, but they do specify modules etc.. [15:24] micheil: stevestmartin: code style guidelines as to what specifically? [15:25] stevestmartin: mainly organization of modules / requires [15:25] micheil: there's nothing to say you must write your code way XYZ, however, there is a partially unwritten rule with file structures [15:25] micheil: eg: /lib/ /tests/ /docs/ etc [15:26] stevestmartin: i see some projects that have a single exports.object , some that have a bunch treating the file as if it were a implicit object [15:27] stevestmartin: just trying to get an idea if there is an unwritten convention for that sort of thing, or if everyone pretty much does what they please [15:27] cloudhead has joined the channel [15:28] steadicat has joined the channel [15:28] deanlandolt: stevestmartin: it depends on how you want your module's public api to look like [15:29] micheil: stevestmartin: there is a thread on the mailing list about modules, check that out [15:29] stevestmartin: guess thats the part im getting at ;) , that there is no set way that API should look [15:30] hassox: micheil: I don't think it's defined :\ [15:30] micheil: as for what the code actually is, no one really cares [15:31] micheil: I use a mixture of explicit and implicit constructors, prototypical inheritance, etc [15:33] inimino: stevestmartin: "exports.foo = ..." is probably the most straightforward and best approach [15:33] inimino: stevestmartin: as many times as necessary for various constructors, functions, etc... [15:33] micheil: although, you can do things like var foo = exports.foo = ... [15:34] stevestmartin: although i was under the impression that it should be a single object per file [15:34] micheil: no [15:34] inimino: sure [15:34] inimino: no [15:34] inimino: "exports" is the single object [15:34] micheil: require(lib/smtp) => [client, server] [15:35] stevestmartin: yeah ive seen things like require(http) and things like require(myapi).Server [15:35] inimino: you can attach as much to it as you want [15:36] stevestmartin: i know stupid debate, but if there was a convention its always nice to follow it ;) [15:36] hassox: I can't believe you can't get hold of the scheme :\ [15:37] stevestmartin: no i get it [15:37] inimino: stevestmartin: require(http) is the most convenient for the user IMO [15:37] inimino: hassox: well, there's only extremely limited support for TLS currently anyway [15:37] hassox: inimino: that doesn't really matter... [15:38] hassox: since I can put node behind nginx and it can do a reverse proxy [15:38] hassox: looking after the encrypting stuff [15:38] inimino: until recently you couldn't get the remote port either [15:38] hassox: I sttill need to be able to get at the protocol used [15:38] inimino: how would it know that nginx is using SSL...? [15:39] hassox: I believe it will set a header... [15:39] hassox: Im going to look at how rack does it [15:39] inimino: bbiab [15:39] inimino: well, then you can test for the header yourself [15:39] inimino: k [15:39] inimino: ACTION is afk [15:45] micheil has joined the channel [15:56] kennethkalmer: hi guys [15:56] micheil: heya [15:56] micheil: kennethkalmer: do you think we should add a package.json to node-smtp? [15:56] kennethkalmer: we could, what packaging system ? [15:56] kennethkalmer: kiwi ? [15:57] micheil: no, commonjs [15:57] micheil: http://wiki.commonjs.org/wiki/Packages/1.0 [15:57] kennethkalmer: my bad [15:57] micheil: it looks like jquery, dojo and others are taking it up [15:57] micheil: and it does look good [15:57] micheil: there's also been a proposal on the ML for node to have that as a module format [15:58] kennethkalmer: i have no objections [15:58] micheil: okay [15:59] micheil: I'll wrap up my work on the new data pump and then add it in [15:59] kennethkalmer: please drive the project, i'm still running around with my training wheels on :) [15:59] charlenopires has joined the channel [15:59] micheil: when are you going to do a pull request? [15:59] un0mi: I can't quite figure out what it means for node.js or commonjs that jquery is using package.json [15:59] un0mi: how can that be leveraged in practice? [15:59] kennethkalmer: well, after I'm done with the callbacks [16:00] kennethkalmer: which is where I need some guidance atm, spotting a pattern here [16:00] kennethkalmer: http://github.com/kennethkalmer/node-smtp/blob/smtp-server/lib/smtp/server.js#L52-67 [16:00] micheil: un0mi: it's just a statistic of the adoption of the spec [16:00] un0mi: I still don't get it :) [16:01] kennethkalmer: coffee anyone ? [16:01] un0mi: I mean, what does it matter if they share the same spec if they are incompatible [16:01] micheil: kennethkalmer: hell yes [16:02] mediacoder: not that im addicted to coffee..i also really like coffee-script :-) [16:02] un0mi: #c0ff33 [16:02] stevestmartin: un0mi: because you can use your package manager to install them, and use them in your project [16:02] kennethkalmer: ACTION emits coffee [16:02] micheil: shit that was weird [16:03] micheil: someone I know from school randomly asked me "how's the coffee" like a second after I send yes to getting coffee [16:04] un0mi: stevestmartin: if that is the case, then it is wonderful, but I am still not sure how that actually could happen, if you are building a cms or site leveraging say jquery, how will you get from node.js packages using package.json to deploying jquery scripts ? [16:05] alexiskander has joined the channel [16:05] un0mi: I mean, I suspect that we want to end up with a yui style dependency loader [16:06] stevestmartin: yeah, and maybe you just want to require jqueries selector engine in your client side project, you could [16:06] stevestmartin: i think the idea is its supposed to be like ruby gems, etc.. [16:06] micheil: yeah [16:06] micheil: sorta like ruby gems [16:07] stevestmartin: anyone deploy anything large yet? this stuff is facinating but im sure the specs change so quickly its probably hard to keep up [16:07] micheil: not the ratified specs [16:08] micheil: and the node.js api doesn't change that quickly [16:08] stevestmartin: i started with a basic web app, then noticed jsgi, and probably should start it over lol [16:08] micheil: although, there are a few things that could be added before I'd deploy a large app [16:08] stevestmartin: yeah i noticed no package management yet, but its still a very new project [16:09] stevestmartin: but its small and fast, its hard not to be interested [16:09] micheil: jsgi? [16:09] micheil: I've heard of it, but can't think of it right now [16:09] stevestmartin: yeah its a commonjs spec [16:09] stevestmartin: pretty much rack for commonjs [16:10] micheil: :/ link? [16:10] micheil: ACTION is lazy at 3am [16:11] stevestmartin: http://wiki.commonjs.org/wiki/JSGI/Level0/A/Draft2 [16:12] un0mi has joined the channel [16:13] micheil: #sins [16:13] micheil: erm [16:13] un0mi: :( [16:13] micheil: I typed something I was reading.. [16:13] stevestmartin: http://github.com/kriszyp/jsgi-node/ [16:13] stevestmartin: looks like someone already started making an adapter [16:13] un0mi: stevestmartin: sorry, got disconned, lost everything after: your client side project, you could [16:14] stevestmartin: un0mi: i think the idea is its supposed to be like ruby gems, etc.. [16:15] DamZ_ has joined the channel [16:15] stevestmartin: ACTION needs to do some more reading on this Promise stuff [16:17] farciarz84 has left the channel [16:19] JoePeck has joined the channel [16:20] un0mi: stevestmartin: http://developer.yahoo.com/yui/3/examples/yui/yui-loader-ext.html [16:23] stevestmartin: yeah i seen that, i think jquery is working on something like that too [16:23] micheil: jquery has a module loader [16:23] stevestmartin: id like to see how the commonjs spec accounts for stuff like that, ive seen some concerns about require() on the client side, cant say i disagree [16:24] micheil: well, not yet, but there was word they were getting one, I think it'd LabJS they are going with [16:40] stevestmartin has joined the channel [16:40] ryah: micheil: ping [16:40] micheil: pong [16:40] ryah: what's the timer issue? [16:40] micheil: ryah: with setTimeout, and the like, are you going to have them allow data to be passed in? [16:40] micheil: setTimeout(func, delay, ...param); [16:41] ryah: shrug, i don't think that's supported in all browsers [16:41] micheil: commonjs's proposal has it, although after a quick chat with the folks in #commonjs, it seemed that it was being removed from spec [16:42] inimino: only Firefox has it [16:42] ryah: http://www.w3.org/TR/Window/#window-timers [16:43] JoePeck: inimino: Safari/WebKit has it, so I expect v8 might in Chrome [16:44] JoePeck: yup, it was in chrome [16:44] micheil: ryah: HTML5 has it [16:44] inimino: ah [16:44] micheil: I mean, it's not essential, it is nice though [16:45] JoePeck: +1 [16:45] micheil: (although, all I was using it for was setting the context of a .apply) [16:45] inimino: micheil: ah [16:46] ryah: micheil: sure. i'll accept a patch for it. [16:46] piranha has joined the channel [16:47] micheil: let me see where I put it.. [16:47] ashb: hmmm - someone did a benchmark for the performance hit of using with(){} didn't they - anyone else remember this? [16:47] JoePeck has joined the channel [16:48] micheil: ryah: so you want param's added? [16:48] gwoo has joined the channel [16:51] micheil: ryah: do you want me to bring timers in line with the reactor spec? [16:53] inimino: ashb: I recall it was about 10x slower [16:54] ashb: inimino: yeah - i was looking for hte post/figures tho [16:54] ryah: micheil: reactor spec? [16:54] ashb: its not so much a spec at the moment [16:54] micheil: ryah: http://wiki.commonjs.org/wiki/Reactor/A [16:55] ashb: also i haet java style bnames [16:55] ryah: micheil: oh. no. [16:55] micheil: okay [16:55] micheil: well, the code I'm using is forward compatible [16:55] ashb: wow that proposal is directly incompattibnle with FF isn't it? [16:56] micheil: ryah: what's the go with the warnings when running tests.. [16:57] micheil: deprecated conversion ... [16:57] ryah: micheil: ? [16:57] micheil: http://gist.github.com/280175 [16:58] inimino: ashb: I think it was on the mailing list [16:58] ashb: ah perhaps yes [16:58] ryah: micheil: those should be fixed at some point [16:59] micheil: okay [17:00] micheil: ryah: http://gist.github.com/280177 [17:01] micheil: (I've really gotta fix up my fork of the node github repo [17:01] ashb: inimino: if course the problem is 'with' is hard to search for [17:02] inimino: ashb: http://groups.google.com/group/nodejs/browse_thread/thread/9977053f0f132bc1/a962426d1eaf5391?hl=en&lnk=gst&q=felix+import%28%29#a962426d1eaf5391 [17:02] inimino: yes [17:02] ryah: micheil: is that just fixing whitespace? [17:03] micheil: ugh. [17:03] n8o has joined the channel [17:03] micheil: one sec. I'm going to recreate my node checkout. [17:05] micheil: man.. even on a 1MiB connection cloning node's tree is massively slow [17:05] JoePeck: someone can also fix the typo at the bottom of node.js => "// end annonymous namespace" [17:05] micheil: actually. I lied, 57KiB [17:05] micheil: buggar. [17:05] JoePeck: top and bottom, heh [17:06] micheil: JoePeck: fix it and create a patch file. [17:07] bpot has joined the channel [17:08] JoePeck: micheil: here you go => http://gist.github.com/280184 [17:08] JoePeck: I haven't yet forked node, so I couldn't commit to my own [17:08] micheil: JoePeck: send it to ryah [17:08] micheil: not me. [17:08] micheil: my fork is borked atm, so I can't commit either [17:08] JoePeck: ryah: Fix some typos in src/node.js http://gist.github.com/280184 [17:11] micheil: ryah: I'll have the proper patch in a few mins' [17:12] CIA-78: node: 03Joseph Pecoraro 07master * rfd183bd 10/ src/node.js : Fixed typo in comments. - http://bit.ly/8MHdFC [17:12] CIA-78: node: 03Joseph Pecoraro 07master * r820ca71 10/ LICENSE : Updated out of date LICENSE file. - http://bit.ly/6nHyqC [17:14] micheil: ryah: do you want tests added for the optional params? [17:15] micheil: ryah: patch: http://gist.github.com/280177 [17:16] ryah: micheil: yes [17:16] micheil: okay. [17:20] micheil: just waiting for them to run.. [17:22] micheil: ryah: looks like it tests fine. I'll just create a patch for it [17:26] micheil: ryah: http://gist.github.com/280200 [17:28] ryah: micheil: 2 things - test should folow node's js style [17:28] un0mi has joined the channel [17:28] ryah: and you're creating at least two extra objects now for each timeout [17:29] ryah: cn you special case when there are no parameters, so that there are no extra objects [17:29] micheil: ack [17:29] micheil: yeah, textmate defaults to tabs [17:29] JoePeck: micheil: you can enable "soft tabs" in textmate [17:29] micheil: not by default. [17:30] ryah: i.e. if (arguments.length > 2) { (do your thing) } else { timer.addListener("timeout", callback); } [17:30] ryah: and add a comment explaining that :) [17:31] ryah: and factor that code into a subroutine [17:31] Yuffster has joined the channel [17:31] ryah: ACTION is so picky! [17:31] micheil: yeah, just added [17:32] micheil: hangon, subrountine? [17:32] micheil: you mean as per your I.e. [17:32] micheil: ? [17:32] micheil: righteo.. tabs -> spaces in tests. [17:33] micheil: arguments.length check added. [17:35] micheil: ryah: updated, does it pass your pickyness? http://gist.github.com/280200 [17:35] scudco has joined the channel [17:37] ryah: micheil: 2 things- subroutine, and test multiple params, and update docs [17:40] micheil: ACTION reruns tests [17:40] micheil: ryah: is it possible to run just one test, instead of the full suite? [17:40] salax has joined the channel [17:40] ryah: micheil: ./node test/mjsunit/test.js [17:41] micheil: ah [17:41] kriszyp has joined the channel [17:41] micheil: ACTION has been using `make test` [17:41] micheil: righteo multiple params passes [17:46] micheil: hmm.. how do you revert a commit in git? [17:47] ryah: git reset --hard HEAD^ [17:49] micheil: for some reason I always have stuff in staging on a fresh checkout [17:49] micheil: might be a mac thing [17:50] jed has joined the channel [17:53] DamZ has joined the channel [17:54] ryah: so, about 90 more github watchers and node will be on the top 10 [17:55] ryah: :) [17:56] micheil: ryah: finally got the patch done: http://gist.github.com/280200 [17:58] Pilate: +1 [17:59] micheil: hmm.. [17:59] bry has joined the channel [17:59] micheil: ryah: I might have a pull request instead [17:59] ryah: micheil: make a subroutine - function addTimerListener (timer, callback, args) { if (arguments.length > 3) { ... } else { timer.addListener("timeout", callback); } } [18:00] micheil: okay [18:02] steadicat has joined the channel [18:02] micheil: ryah: I just got my fork of node back online, so I'll send a pull request when done [18:04] steadicat has joined the channel [18:04] ryah: micheil: i like gist better [18:04] micheil: oh, okay [18:06] micheil: righteo, added subrountine.. I'll just create the patch and update the gist [18:07] JoePeck: ryah: since you accepted my last patch, you might be interested in this one => http://gist.github.com/279121 isaacs mentioned it on the mailing list, but this is the gist version [18:07] ryah: JoePeck: already got it [18:08] JoePeck: ohh, I see there were two commits [18:08] JoePeck: cheers [18:09] mattly has joined the channel [18:10] micheil: ryah: http://gist.github.com/280200 [18:11] aguynamedben has joined the channel [18:11] aguynamedben has joined the channel [18:14] Yuffster has joined the channel [18:15] mattly has joined the channel [18:18] micheil: ryah: is that patch good? [18:21] ryah: micheil: yeah looks good. [18:22] micheil: okay [18:26] ericflo has joined the channel [18:33] rictic has joined the channel [18:39] BBBB has joined the channel [18:41] un0mi has joined the channel [18:42] charlenopires has joined the channel [18:42] CIA-78: node: 03Ryan Dahl 07master * raeb7d6d 10/ (6 files in 3 dirs): [18:42] CIA-78: node: Add process.IdleWatcher [18:42] CIA-78: node: With priorities. Will be used for process.nextLoop(). - http://bit.ly/6V0Ezj [18:42] CIA-78: node: 03Ryan Dahl 07master * r8abeffa 10/ (4 files in 4 dirs): [18:42] CIA-78: node: Add process.nextTick() [18:42] CIA-78: node: This is a replacement for the common hack: [18:42] CIA-78: node: setTimeout(cb, 0); [18:42] CIA-78: node: It's much more efficient. - http://bit.ly/7PLdfn [18:43] CIA-78: node: 03Micheil Smith 07master * r6e3d12f 10/ (doc/api.txt src/node.js test/mjsunit/test-timers.js): Allow optional params to setTimeout, setInterval - http://bit.ly/8iMQr2 [18:46] aho has joined the channel [18:51] [mighty]Mike has joined the channel [18:52] [mighty]Mike: starting to look at the docs and see a reference to src/process.js, but don't have such a file in my git clone [18:55] sudoer has joined the channel [18:56] inimino: [mighty]Mike: I think everything that was there is now in src/node.js [18:57] aurynn has joined the channel [18:57] [mighty]Mike: okay, that's what I figured, but the it's not clear in the changelog :) [18:57] [mighty]Mike: or maybe it is and I missed it [18:57] [mighty]Mike: but thanks [19:02] charlenopires_ has joined the channel [19:02] micheil: something awesome just happened. I theoretically sent an email using only node-smtp. so both the server and client at once [19:03] micheil: (note, that I don't think it did send the email, but either way, it shows that the apis are working) [19:09] un0mi has joined the channel [19:14] scudco has joined the channel [19:18] piranha has joined the channel [19:19] technoweenie has joined the channel [19:22] isaacs has joined the channel [19:29] ollie_ has joined the channel [19:32] JojoBoss has joined the channel [19:33] felixge has joined the channel [19:35] JojoBoss has left the channel [19:37] JojoBoss has joined the channel [19:47] isaacs has joined the channel [19:47] felixge has joined the channel [19:47] un0mi has joined the channel [19:51] felixge: ryah: yt? [19:51] ryah: felixge: hey [19:51] felixge: ryah: thanks for saving the world from my C++ mess :) [19:52] felixge: ryah: I got a question about the setTimeout API extension so [19:52] felixge: it seems like we would be much better of providing a 'util' module of some kind that has a function that makes it easy to do currying like that with any callback [19:52] felixge: not just the setTimeout one [19:53] piranha__ has joined the channel [19:53] ryah: felixge: yeah - it's just that html5 supports that style of passing params with setTimeout [19:53] felixge: oh [19:54] felixge: in that case nvm [19:54] felixge: I'm ok with following HTML5 (aka not-quite-as-bad-as-xhtml-but-getting-there) [19:54] felixge: :) [19:56] felixge: ryah: on an unrealted note: the client I did the mass-connection test for wants to do some massive long-polling / streaming thingy. I'm wondering if I should recommend them to build on the net2 branch instead of ry/master [19:57] ryah: felixge: the api differences wont mbe much [19:57] ryah: work on master now [19:57] ryah: hopefully i'll have that merged by the end of the week.. but we'll have to see how it goes [19:57] felixge: ryah: Ok. I guess they were mainly afraid of the load characteristics changing [19:58] ryah: i'll present some benchmarks when i mergeit [19:58] felixge: ryah: The cool thing is that they'll have a fallback solution in place if there are problems, so I think it will be quite a cool use case [19:58] felixge: without them going crazy if something doesn't work out [19:58] felixge: but I think it'll work [20:00] felixge: ryah: either way, they come from Java and they basically couldn't believe how simple & awesome node is [20:00] felixge: happiest tech faces I've seen in a long time :) [20:02] un0mi has joined the channel [20:03] ryah: :) [20:05] felixge: ryah: btw. please let me know if you have anything you need help with, haven't seen those challenges in the mailing list for a while :) [20:05] stevestmartin: what all is going on in the net2 branch? [20:06] felixge: it could also be stuff like creating a benchmark suite or something [20:06] felixge: I guess I did have that buildbot thing I never followed up with [20:06] felixge: I should work on that [20:07] mikeal has joined the channel [20:11] piranha: hi guys, can I emit my own events? If so, where I can read about that? [20:11] ryah: piranha: yes. eventEmitter.emit("blah") [20:12] piranha: ryah: ah, and eventEmitter.connect('blah', myfunc)? [20:12] piranha: ok, thanks :) [20:13] technoweenie: hey piranha i have a lib w/ an example that might help [20:14] piranha: technoweenie: cool, I'd like to read :-) [20:14] technoweenie: http://github.com/technoweenie/twitter-node/blob/master/lib/index.js [20:14] charlenopires has joined the channel [20:14] technoweenie: the readme has an example on how to setup listeners [20:14] technoweenie: i also wrote this helper to test listeners: http://github.com/technoweenie/wheres-waldo/blob/master/test/helpers/temp_listeners.js [20:15] piranha: thanks [20:15] technoweenie: http://github.com/technoweenie/wheres-waldo/blob/master/test/api_test.js#L101-109 [20:15] JojoBoss: Anyone got a preferred DB they like to use that works well with node? I've been planning out a web project that was going to use Java, however I stumbled upon node while i was planning and have pretty much decided to drop the Java idea and use node, but I wasn't sure how solid the DB modules are. [20:16] aurynn: the DB modules are still pretty young [20:16] technoweenie: there's a dbslayer one right? [20:16] technoweenie: dbslayer is an http layer over a cluster of mysql dbs [20:16] JojoBoss: I started toying with couchdb however it doesnt have all that great security and I would require some user login stuff. [20:17] technoweenie: tbh i think node.js is a bit immature for that stuff still [20:17] technoweenie: the redis client seems pretty flaky [20:17] JojoBoss: How fast is it though? MySQL is a pretty bulky DB as I recall. [20:18] technoweenie: slower than native myself [20:18] technoweenie: mysql [20:18] technoweenie: http://devthought.com/blog/2009/12/accessing-a-mysql-database-from-nodejs/ [20:18] technoweenie: nytimes uses it [20:18] JojoBoss: hrmmm, i really liked the way couchdb works as far as JSON REST. [20:19] technoweenie: theres a mongodb lib for node. i havent played with it all yet though [20:20] JojoBoss: hrmm [20:21] aurynn: there's a postgres library, as well [20:23] JojoBoss: I'm kind of fond of the idea using a DB i haven't used before, and i've used MySQL and Postgres. I was also toying with the idea of using an Exist DB however Exist seemed dignificantly heavier then couchdb and some of the others. [20:23] aurynn: it really depends on your use-case. [20:24] aurynn: Do you need relational? Postgres. Would key-value suffice? You probably don't want SQL, then :) [20:26] JojoBoss: I think for some things I would require a relational db but not for everything. Some of the more bulky things wouldn't actually need relational. [20:27] mediacoder: JojoBoss: im not a couchdb expert, but iirc the security model is pretty good..you can auth, validate, etc [20:27] un0mi has joined the channel [20:28] hassox has joined the channel [20:28] technoweenie: mongo would be a good middle ground [20:29] hassox: Morning folks [20:29] technoweenie: its not sql but its still collections of documents with indexing, querying, and partial updates [20:29] JojoBoss: yeah, i was just downloading it and about to install it to give it a try [20:30] mediacoder: JojoBoss: if you like to experiment, go full node-- there some interesting storage implementations.. awesome.. dirty [20:31] technoweenie: go half node, no one ever goes full node [20:31] JojoBoss: I do indeed like to experiment. :-D I'll tinker with those as well then [20:31] technoweenie: http://www.funnyordie.com/videos/bce7b31cef/tropic-thunder-film-clip-nobody-goes-full-retard-from-ilike2party [20:31] JojoBoss: heh [20:33] isaacs: anyone got a clever way to profile node scripts? [20:34] isaacs: trying to figure out where i'm losing performance. [20:34] ryah: isaacs: --prof ? [20:34] isaacs: heh, that'd probably do it [20:35] ryah: isaacs: search the mailing list. i think i've written about how to use it before [20:35] isaacs: hrm, how do you use that? [20:35] isaacs: oh, ok [20:36] eddanger has joined the channel [20:38] isaacs: ryah: node --prof [20:38] isaacs: Error: Cannot read /Users/isaacs/Documents/src/js/mojito/--prof [20:38] isaacs: searching group turns up nothing (doesn't mean it's not there, just that google groups search bites) [20:39] egorFiNE has joined the channel [20:39] okito has joined the channel [20:39] ryah: node --prof myscript.js [20:40] egorFiNE: hi! I think I've found a bug in http module, in file upload handling code. Seems if I do not emit request.pause() straight in request handler of http module, I am randomly not able to parse multipart uploads [20:40] ryah: deps/v8/tools/mac-tick-processor v8.log [20:40] egorFiNE: can someone please help me verify this? [20:40] isaacs: ryah: bug? [20:40] isaacs: $ node --prof examples/sugar-hello-world.js [20:40] isaacs: Error: Cannot read /Users/isaacs/Documents/src/js/mojito/--prof [20:40] ryah: egorFiNE: ping felixge [20:40] felixge: ryah: pong [20:41] ryah: isaacs: node --prof -- myscript.js [20:41] egorFiNE: felixge: hello! [20:41] egorFiNE: I am pasting a test case at pastie now [20:41] isaacs: ryah: yay, that works, thanks! [20:42] felixge: egorFiNE: interesting, I'll check it out [20:43] egorFiNE: felixge: http://pastie.org/783749 [20:43] egorFiNE: I have to perform request.pause() straight in the beginning, set handlers and then resume() [20:43] felixge: egorFiNE: k. I'm in the middle of something - but I'll take a look in the next ~20 min [20:44] egorFiNE: even with that, file uploads randomly fail onlygetting 248 bytes or so; I tried debugging and found out that http request module emits "body" too early [20:44] egorFiNE: to reproduce, open the :8000 and attach a big png file (like 256k); small files are okay [20:44] egorFiNE: felixge: sure! I'll be here available for you to investiage [20:44] egorFiNE: * investigate :) [20:44] hassox has joined the channel [20:45] mikeal has joined the channel [20:58] hassox has joined the channel [21:00] felixge: egorFiNE: ok, what am I supposed to observe? [21:00] egorFiNE: observed behavior: upload hangs [21:01] felixge: egorFiNE: didn't happen :) [21:01] egorFiNE: OR request is fired in a cycle [21:01] felixge: on 400gb chrome [21:01] egorFiNE: indefinite cycle [21:01] felixge: can I upload any file? [21:01] egorFiNE: well, I test with a few files: small text files are ok, 256k png is not [21:02] egorFiNE: to make things worse, comment out "request.pause()" [21:02] felixge: just did a 25mb file [21:02] felixge: which worked fine [21:02] egorFiNE: hm, okay, my configuration: Mac OS X 10.6.2, browser = safari; I tested on 0.1.24, 0.1.25 and master git [21:02] felixge: egorFiNE: not loosing any data without the pause/resume either [21:02] egorFiNE: about 90% repeatable if request.pause() is commented [21:02] felixge: let me try safari [21:03] felixge: egorFiNE: nope, no luck [21:03] felixge: I'm on 10.6.2 as well [21:03] piranha has joined the channel [21:03] egorFiNE: hmm, now I don't observe it neither [21:03] felixge: egorFiNE: anything else that could be special about your setup? [21:04] egorFiNE: let me see [21:04] felixge: egorFiNE: 180mb avi - no problem either [21:04] felixge: :) [21:04] egorFiNE: ACTION :-O  [21:05] egorFiNE: it was absolutely repeatable on the listed versions of node and I have spent about 30 minutes nailing this down to not fired body event of http [21:05] egorFiNE: now absolutely works [21:05] egorFiNE: I don't like it :) [21:05] erichocean has joined the channel [21:06] egorFiNE: yes, got it [21:07] egorFiNE: here's what triggers it [21:07] egorFiNE: add the following line as the first one in the onRequest handler: [21:07] egorFiNE: template = posix.cat("template.html").wait(); [21:08] egorFiNE: felixge: ping, just to make your client bounce in dock :) [21:08] un0mi has joined the channel [21:08] felixge: egorFiNE: huh, that asks for loosing packages :) [21:08] felixge: I mean events at least [21:09] felixge: not a problem with multipart so [21:09] felixge: the http upload will already be received by node [21:09] felixge: but you don't have your event handler attached yet [21:09] egorFiNE: so is that a bug in node.js or in the code? [21:09] felixge: I think its expected behavior [21:09] felixge: and the problem is in your code [21:10] egorFiNE: seems like so [21:10] egorFiNE: now I understand [21:10] egorFiNE: perhaps, docs needs to be a little bit expanded ? [21:10] fictorial has joined the channel [21:10] fictorial has joined the channel [21:10] egorFiNE: because event-driven programming like that is not completely intuitive [21:10] felixge: egorFiNE: well, the docs say you probably shouldn't use wait [21:10] isaacs: jazzychad: hey, since querystring parsing is now in node (and using exactly the same code) can we deprecate querystring.node.js? [21:12] egorFiNE: felixge: okay, got it. thanks for your help! :) [21:13] felixge: egorFiNE: np, let me know if you find anything else that could be a bug in multipart so [21:13] felixge: I really want the module to be rock solid [21:13] felixge: :) [21:13] piranha has joined the channel [21:14] egorFiNE: felixge: is there anything about implied unicode/binary encodings in the file upload code? I mean I was never able to really manipulate binary data in browser's javascript; how about node? [21:15] felixge: egorFiNE: it should be completely binary-safe [21:16] felixge: I use it with video and image files all the time [21:16] felixge: egorFiNE: basically node uses some cool hack to make v8 accept binary data in strings without trying to interpret them as utf8 [21:16] egorFiNE: good to know [21:17] felixge: egorFiNE: may I ask what you're working on? [21:17] egorFiNE: right now I'm making myself a micro LiveJournal client to post to my blog. the previous one I wrote in perl about ten years ago and it feels like it's time to upgrade :) I use home-crafted client because I have used to a certain formatting [21:18] egorFiNE: but this is now; more generally, my company is now working on a queue server in node.js [21:18] felixge: egorFiNE: cool, so your client supports file uploads? [21:18] egorFiNE: message passing gateway and event queue for our service http://pushme.to/ [21:19] egorFiNE: with mongodb storage, servers hangover, clustering, etc [21:19] felixge: egorFiNE: cool, that looks fun [21:19] felixge: :) [21:19] felixge: how do you make many with pushing little messages like this arround? [21:19] egorFiNE: I am thinking that we might release that code in open source, because our core business is not based on this [21:19] felixge: I want to know, I pushed 40 million+ messages today :D [21:19] egorFiNE: as for the LJ client, yes, I attach images to postings ;) images of beautiful ladies :) [21:19] egorFiNE: felixge: wow [21:19] deformated has joined the channel [21:20] onar has joined the channel [21:20] felixge: egorFiNE: not really, it was just that benchmark for testing how many connections node could handle [21:20] felixge: egorFiNE: not real world traffic :) [21:20] egorFiNE: felixge: we don't make money yet, it's a startup. the service has been a #3 application is italian app store, though, and got absolutely positive feedback [21:20] felixge: yeah, I like it a lot [21:20] egorFiNE: so maybe one day we'll push 40 millions and make some buck out of it :) [21:20] felixge: is the iphone app free? [21:21] egorFiNE: felixge: sorry missed a point - you like a lot what exactly?:) [21:21] egorFiNE: not free, but we'll make it free in about week or two [21:22] felixge: I like the concept [21:22] felixge: nice & simple [21:23] egorFiNE: ah, thanks:) [21:23] egorFiNE: yes, it is. simple as hell, yet very handy - people use it a lot [21:24] felixge: egorFiNE: do you guys have funding? [21:25] egorFiNE: yep [21:25] egorFiNE: despite recession [21:26] felixge: nice [21:27] felixge: you guys go rock it :) [21:27] felixge: good luck [21:27] egorFiNE: thanks :) you, too! node.js surely has a bright future and thank you for it! [21:28] felixge: egorFiNE: Thank ryah, I just did the multipart module :) [21:28] egorFiNE: ah ok :) [21:28] egorFiNE: I know who to ping about the multipart then ) [21:30] felixge: egorFiNE: yip, feel free anytime :) [21:32] isaacs: wow, function calls are expensive. [21:33] piranha has joined the channel [21:33] felixge: isaacs: you got scammed! :) [21:33] felixge: isaacs: recursive stuff or just plain calls? [21:33] isaacs: just a lot of calls. [21:33] isaacs: some recursive AOP stuff, but even taking that out, that wasn't the worst of it. [21:33] isaacs: and [21:33] isaacs: "A [21:34] felixge: isaacs: I think the local scopes are what makes them expensive [21:34] isaacs: and AOP is so awesome, it's worth the cost. [21:34] isaacs: yeah [21:34] felixge: isaacs: what are you working on? [21:34] isaacs: mojito [21:34] felixge: what's that? [21:34] isaacs: http://github.com/isaacs/mojito/blob/master/examples/sugar-hello-world.js [21:35] isaacs: it's basically just a dsl for setting up routing and chaining of functions that handle a request. [21:35] isaacs: similar to my simple-node-server project, but less wonky and ugly in the api [21:36] felixge: looks nice [21:36] isaacs: thanks [21:36] isaacs: but it's about half as performant as just a vanilla node baseline. [21:36] felixge: huh, wow [21:36] felixge: suprising [21:36] isaacs: i profiled it, and it looks like all the time is being spent in various function calls. [21:36] isaacs: so i think i just need to streamline more. [21:37] isaacs: maybe get rid of the whole walker/chain thing [21:37] felixge: isaacs: how many function calls / request are we talking about here? [21:38] felixge: btw. are you the time is spent "calling" the functions, or "running" the functions? [21:38] isaacs: not sure exactly [21:38] isaacs: but nothing's synchronous, and it seems like they run pretty fast. [21:40] isaacs: felixge: http://gist.github.com/280399 [21:40] isaacs: looks like walker_done and walker_next are the worst offenders [21:41] felixge: isaacs: not sure how to read these logs [21:41] felixge: isaacs: if the 0.7% thingy is true, its unlikely your functions are causing 50% overhead [21:43] isaacs: hm [21:43] isaacs: i can't see how to separate "startup time" with "run time" on these [21:43] isaacs: unless i just had ab run for a whole lot of time [21:44] isaacs: to factor it out [21:44] rolfb has joined the channel [21:44] isaacs: skip to the "[Bottom up (heavy) profile]:" bit [21:44] isaacs: note that 56% of the overall time was spent just compiling and running node.js, which would be all my requires. none of those happen at request time, though [21:45] isaacs: also, all the time on the event loop is just the second it took me to switch tabs and kick off ab [21:46] isaacs: ok, running again with 10x the requests, maybe that'll make it more clear.. [21:50] isaacs: maybe i should skip all the clever FP shiz and instead just construct a stupid array and walk down it with a for loop. [21:50] isaacs: way less fun that way, but might be faster. [21:51] DamZ has joined the channel [21:53] hassox has joined the channel [21:53] isaacs: otoh, maybe it's simply unrealistic to hope to get baseline-esque performance after layering a pretty JS dsl on top of node's http server, and i should quit whining and take my 5000 requests per second and just be ok with that. [21:54] stevestmartin: anyone know how v8 handles anonymous functions? is it smart enough to realize its creating the same function over and over again? [21:54] ryah: stevestmartin: doubtful [21:55] stevestmartin: thats what i was thinking [21:56] stevestmartin: i was thining isaacs issue may be related to that, havent looked at is code, but most people when writing pretty DSLs go anonymous function happy not realizing they may potentially be creating the same function 100s of times [21:56] inimino: stevestmartin: spidermonkey has some optimizations around that, wouldn't be surprised if V8 did also [21:56] inimino: yes from a glance it looked like his was closure-happy [21:56] isaacs: stevestmartin: that's why i use named functions and only recreate them if i'm actually going to use the newly minted scope. [21:56] hassox: ryah: quick q mate... can I get the scheme anywhere? [21:57] isaacs: stevestmartin: i use closures in the example pages, but it's certainly not creating the same fn over and over. [21:57] ryah: hassox: ? [21:57] hassox: ryah: for the request... how do I know if it's https or http (i.e. is it possible with what's there) [21:58] stevestmartin: isaacs: like i said, i hadnt looked at the code, just first thing that came to mind when you said you were trying to make a nice DSL, and getting a drastic perf drop from baseline ;) [21:58] isaacs: stevestmartin: yeah, it's a valid suggestion [22:01] mikeal has joined the channel [22:06] JojoBoss has joined the channel [22:10] isaacs: i am making heavy use of call/apply. i wonder if maybe that's slowing down the function calls considerably [22:12] deformated: i wondered the same but i never checked it [22:14] ryah: a benchmarking module would be nice [22:20] isaacs: ryah: i've got a pretty basic one in my node-playground [22:20] fictorial: hey guys - long time.. wondering if anyone has any bright ideas about IPC for node processes running on the same host on or on the same private LAN. my first thought was amqp but there's just a starter project (node-amqp). [22:20] isaacs: it's just an A-B test. [22:21] fictorial: I suppose I could write something in well, node. heh [22:21] isaacs: wow, so, apparently, function.call is about 3x as fast as function.apply, which is about 3x as fast as calling a function directly. [22:21] isaacs: oh, wait, invalid test. [22:21] isaacs: whoops. [22:22] isaacs: call IS significantly faster than apply, but direct is much faster. [22:22] ryah: fictorial: yes :) [22:22] isaacs: i was doing a global lookup by returning "this" [22:23] fictorial: ryah: hey, yes what? to doing something small and custom? [22:23] ryah: no, i have ideas [22:23] fictorial: oh, do tell! :) [22:25] ryah: well - net2 has a lot of ipc which will be worked into later versions [22:25] fictorial: playing catch up on node.js happenings... is that a branch? [22:25] ryah: i'm going to be beefing up amqp support soon [22:25] ryah: yeah [22:26] ryah: (probably this week) [22:26] fictorial: nice [22:26] ryah: (assuming i can get it to compile on solaris!) [22:27] felixge: ryah: Q: Lets say I have 1000 open long-polling requests, what's the most efficient way to send the same messages to all of them at the same time? [22:27] felixge: Right now I'm just iterating over all response objects [22:27] felixge: Which I guess is the fastest way [22:27] felixge: but it would be nice to have something even faster :) [22:28] fictorial: (multicast sounds right but I am no expert on that) [22:28] isaacs: yup, function.apply. tha'ts the performance murderer. [22:28] felixge: isaacs: makes sense, harder to optimize fo [22:28] felixge: * for [22:28] isaacs: yeah [22:28] isaacs: i'm only using it because "this" is very readable. but passing in the scope as the first arg is an acceptable compromise. [22:29] isaacs: i got back about 25% of the lost perf by changing one line of code :) [22:30] technoweenie: yes, rad language features are always slow :) [22:30] stevestmartin: isaacs: nice, ill have to keep that in mind [22:30] isaacs: if node weren't so damn fast, it wouldn't've been a problem ;) [22:31] ryah: felixge: shrug. that's what i do [22:31] technoweenie: hey fictorial you wrote the redis client right? do you use it in production? [22:31] felixge: ryah: k, thanks [22:32] felixge: I'm benchmarking the latency involved of sending a message to a few thousand clients at the same time right now [22:32] fictorial: technoweenie: yes, that's me. no, I don't yet. I'm a long time sufferer of analysis paralysis. I cannot seemingly pull the trigger and get into production with my project. [22:32] fictorial: ACTION researches too much and forgets to engineer [22:34] sudoer has joined the channel [22:34] technoweenie: yea, it seemed a little flaky to me [22:34] technoweenie: i'd lose the connection [22:34] technoweenie: it'd bitch about being in the wrong connection state [22:35] technoweenie: i'll probably look at it though [22:35] fictorial: hmm I have not heard of this [22:35] fictorial: yeah, please let me know [22:35] fictorial: it should try to reconnect but maybe there's a corner case missed [22:36] rictic1 has joined the channel [22:40] felixge: technoweenie: use dirty [22:40] felixge: :) [22:40] felixge: ACTION needs to work on his pitch [22:40] technoweenie: i like redis, i can move to ruby really easily w/ it [22:41] felixge: technoweenie: ah right, what do you need this "ruby" for? [22:41] felixge: :) [22:42] felixge: just kidding, very legit reason to go with redis : ) [22:42] technoweenie: yea i'm not ready to move everything over to node.js yet [22:42] technoweenie: it took me way too long to write this simple app [22:42] felixge: ACTION needs a better way to get other people to test his code  [22:42] felixge: hehe [22:42] felixge: yeah I wouldn't write a big web app on top of node yet either [22:42] felixge: but small ones are fun [22:42] ryah: me neither [22:43] felixge: working on a little task manager with a gmail/ajax interface and nice keyboard bindings [22:43] technoweenie: yea, this is a tiny app that i can use on lots of projects [22:43] technoweenie: its pretty rad, i just need it deployed somewhere [22:44] jan____: felixge: and dirty for storage? [22:44] felixge: jan____: yip [22:44] jan____: rad [22:44] jan____: show me :) [22:44] felixge: jan____: I'll try to stop by some time this week :) [22:44] jan____: felixge: cool, can you try thursday? :) [22:45] felixge: jan____: sure [22:45] jan____: ftw. [22:45] felixge: jan____: I'll ping you on thrusday [22:45] jan____: cool :) [22:52] ryah: erichocean: ping [22:52] erichocean: ryah: pong [22:52] deanlandolt has joined the channel [22:53] ryah: erichocean: why did you remove the __OpenBSD__ symbols in dtoa_config.c [22:53] erichocean: is than in udns? [22:53] ryah: in v8 [22:54] erichocean: hmm, no idea [22:54] erichocean: probably a mistake [22:56] erichocean: hmm, looking at the commit history, it shows I didn't remove them [22:56] erichocean: http://github.com/erichocean/node/commit/2b57c7a94f0c681c0484f1b2798ad1a2d74eedd1 [22:56] erichocean: that's the only change I made [22:59] charlenopires has joined the channel [23:07] r11t has joined the channel [23:09] isaacs: felixge: re other people testing your code, i'm planning on using dirty with mojito. [23:10] hassox: isaacs: dirty? [23:10] isaacs: maybe, i should have called it martini instead, since it'll be dirty :) [23:10] isaacs: hassox: felixge's key/value store [23:10] hassox: linkage? [23:10] isaacs: http://github.com/felixge/dirty [23:10] isaacs: oops, guessed wrong: http://github.com/felixge/node-dirty [23:11] isaacs: but i need to rewrite mojito again. can't rely on scope, it's too slow. that's why code is the best teacher :) [23:12] isaacs: (scope as in function context/"this", not object visibility) [23:12] hassox: churs [23:14] isaacs_mobile has joined the channel [23:17] stevestmartin has joined the channel [23:20] JojoBoss has joined the channel [23:21] felixge: isaacs: let me know how going dirty works out for ya :) [23:21] stevestmartin: are issues being tracked using github? [23:21] felixge: ACTION gn8 [23:22] un0mi has joined the channel [23:22] inimino: stevestmartin: the mailing list is probably preferred [23:23] stevestmartin: i dont have one, i was just glancing, figured good way to get my feet wet is by messing with some bugs [23:24] stevestmartin: but for example #20 build failing on OS X 10.6 is invalid, im running 10.6 and had absolutely no issues compiling and installing [23:26] inimino: can anyone close issues? [23:26] inimino: I'd suggest closing it if so :) [23:28] stevestmartin: nope, or else i would have :P [23:49] _ry has joined the channel [23:53] hassox: guys... [23:53] hassox: should I use getters / setters for lazy loading? [23:53] hassox: or are they butt slow / not recommended etc?