[00:00] isaacs: creationix: npm tag haml-js 0.2.4 stable
[00:00] creationix: ahh
[00:00] isaacs: (or whatever other tag you wanna give it, any string is acceptable)
[00:00] isaacs: but "stable" is the default magic tag
[00:00] tav has joined the channel
[00:01] isaacs: there should be an auto-tag that works like auto-activate, i think
[00:01] creationix: sweet, I've got a package in the registry
[00:01] isaacs: hooray!!
[00:01] creationix: for now, I've got it working with nvm bt making my $HOME/.node_libraries be a symlink to my $NODE_PATH
[00:02] creationix: and in fact, this is the only way to work with textmate since it gets it's env from finder
[00:02] creationix: (nvm and textmate that is)
[00:03] creationix: hmm, I see the package name needs to match the require name, not my github name
[00:06] inimino: JimBastard: oh, ok good
[00:07] JimBastard: lol
[00:07] JimBastard: thats a great irc prank
[00:07] JimBastard: i heard you if say "JimBastard" three times really fast in a row he'll come online and k line you
[00:08] JimBastard: it has to be copy paste though, like really really fast
[00:15] cerberos has joined the channel
[00:22] mikeal has joined the channel
[00:23] mikeal: so
[00:23] mikeal: what is the best module currently for working with xml?
[00:23] mikeal: i've seen a ton come and go
[00:24] mikeal: does anyone have that jsdom stuff working with jquery yet?
[00:26] isaacs: mikeal: jsdom if you need fancy, sax-js if you need lean
[00:26] derferman has joined the channel
[00:26] robinduckett: bawww
[00:26] robinduckett: shit
[00:26] robinduckett: no space left
[00:26] isaacs: mikeal: if you need even more fancy, check out the yui3 node stuff
[00:26] mikeal: doesn't have to be fast, just needs to be easy
[00:26] robinduckett: i'mma wipe my phone. I demand nodejs on iphone
[00:27] mikeal: nothing fancy, just gotta parse some xml
[00:27] robinduckett: uh
[00:27] robinduckett: woops
[00:27] robinduckett: Robins-iPhone:/ root# rm -rf usr
[00:28] scudco has joined the channel
[00:28] cerberos has joined the channel
[00:30] robinduckett: well that's fucked it
[00:31] jsilver: hey guys
[00:32] jsilver: what do you think of this idea for NodeJS
[00:32] jsilver: a data gathering interface that hits a bunch of APIs, feeds whatever, coupled with an front-end HTTP server (using node) that processes and displays the data
[00:33] jsilver: i want it to be able to handle the load of tons of incoming & outgoing information so I think node is the right fit
[00:34] joshowens: Can anyone help a newb out? I can't figure out why my code only works once: http://gist.github.com/392869
[00:35] mcarter has joined the channel
[00:36] kriskowal_ has joined the channel
[00:36] kriskowal has joined the channel
[00:36] isaacs: mikeal: if you are cool with the sax style, sax-js is pretty stable.
[00:37] isaacs: mikeal: if you wanna go myParsedObject = parser(myXMLString) then sax is not a good fit.
[00:37] mikeal: actually, i think i just found a JSON api for the server i need to talk to :)
[00:37] mikeal: and i'm all too happy not to be dicking around with xml
[00:38] isaacs: mikeal: awesoime
[00:38] isaacs: mikeal: i should build something with sax that turns xml into a simplexml-like object.
[00:39] mikeal: i did that in Python
[00:39] mikeal: there are some odd edge cases to deal with
[00:39] isaacs: ha, that's any time xml is involved.
[00:39] isaacs: it's nothing BUT edge cases
[00:39] isaacs: mikeal: can you send me the json and the corresponding xml for the server you're talking to?
[00:40] isaacs: it'd be interesting to see what this minidom would kinda look like.
[00:40] mikeal: blog.couch.io/rss
[00:40] creationix has joined the channel
[00:40] mikeal: blog.couch.io/api/read/json
[00:41] JimBastard_ has joined the channel
[00:41] isaacs: ew
[00:41] isaacs: someone should tell tumblr what json is
[00:41] isaacs: var tumblr_api_read =
[00:41] JimBastard_: damn indexzero took over my laptop and is writing IEnumerable.js right now
[00:41] isaacs: that's not json
[00:42] JimBastard_: Array.some() wrapped up nicely :-D
[00:42] JimBastard_: take that M$ fanboys!
[00:43] isaacs: mikeal: wow, they're not even *trying* to make these two data feeds reflect each other.
[00:43] isaacs: this is not "rss converted to json"
[00:43] mikeal: haha, probably not :)
[00:43] mikeal: well, actuall
[00:43] mikeal: it is a different api
[00:43] isaacs: it's "a database converted into two different things in two different ways"
[00:43] mikeal: try /api/read
[00:43] isaacs: oh, ok
[00:43] mikeal: to see XML for that api
[00:43] isaacs: http://blog.couch.io/api/read/xml
[00:44] isaacs: yeah, that makes more sene
[00:44] isaacs: *sense
[00:44] isaacs: looks like they just make attribs and child tags go in the same object space.
[00:44] isaacs: not clear what you'd get if you did baz2
[00:45] airportyh has joined the channel
[00:49] nym has joined the channel
[00:49] nym: hi!
[01:02] dekz has joined the channel
[01:04] thotypous has joined the channel
[01:05] scudco has joined the channel
[01:06] keyvan has joined the channel
[01:17] creationix has joined the channel
[01:19] robrighter has joined the channel
[01:21] saikat has joined the channel
[01:25] saikat has joined the channel
[01:25] charlesjolley has joined the channel
[01:25] Toby_ has joined the channel
[01:28] airportyh has joined the channel
[01:38] airportyh_ has joined the channel
[01:43] softdrink has joined the channel
[01:45] cerberos has joined the channel
[01:45] voodootikigod_ has joined the channel
[01:56] devinus has joined the channel
[01:56] devinus: o.m.g.
[01:57] devinus: this dude wrote "Professional Havascript"???
[01:57] devinus: JavaScript*
[01:57] devinus: http://www.nczonline.net/blog/2009/04/13/computer-science-in-javascript-linked-list/
[01:57] devinus: take a look at the add method
[01:57] devinus: >.<
[01:59] ChrisPartridge: Maybe he will write a book on nodejs ;-)
[02:00] devinus: ok good
[02:01] devinus: this is singly linked list
[02:01] devinus: >.<
[02:01] JimBastard: lol
[02:02] devinus: i had read read more of the code :]
[02:02] JimBastard: if you want some serious js cs stuff you should look at jslinq
[02:02] devinus: JimBastard: haha i did it looks awesome
[02:02] devinus: JimBastard: i also saw you trolled into oblivion on /r/programming
[02:03] inimino: man, I read that whole function just to come back here and see " this is singly linked list"
[02:03] devinus: inimino: tehehe
[02:04] devinus: god
[02:04] devinus: fucking fruit flies everywhere
[02:05] KungFuHamster: something rotten in the state of denmark
[02:05] devinus: damn their fast incubation period
[02:05] devinus: i have no idea where these demons are spawning
[02:06] creationix: probably from process pid 1
[02:06] mscdex: huhu
[02:07] JimBastard: yeah i do that devinus
[02:07] JimBastard: it happens
[02:07] creationix: devinus: we had a ton of them and then I discovered some over ripe banannas behind some stuff
[02:07] JimBastard: ienumerable
[02:07] JimBastard: just got the stub up
[02:07] JimBastard: gonna start rewriting the lib for lazy eval
[02:07] JimBastard: im soo lazy when i eval my data collections you have no idea
[02:07] devinus: JimBastard: nah, it was those trolls on /r/programming
[02:08] devinus: JimBastard: i cant even read /r/programming these days
[02:08] JimBastard: i aint iterating one step more then i have to
[02:08] JimBastard: reddit was fucked that day, the site was unresponsive and losing all my replies
[02:08] JimBastard: it went down for a full day or so
[02:08] JimBastard: still fucked up
[02:12] robrighter has left the channel
[02:12] quirkey has joined the channel
[02:15] mikeal has joined the channel
[02:17] mscdex: lazy eval ftw
[02:18] hsuh has left the channel
[02:21] mjr_ has joined the channel
[02:27] thotypous has joined the channel
[02:31] ryan[WIN] has joined the channel
[02:34] WALoeIII has joined the channel
[02:43] tmpvar has joined the channel
[02:43] tmpvar: hello
[02:44] keyvan has joined the channel
[02:45] keyvan has joined the channel
[02:47] creationix: tmpvar: hi
[02:47] creationix: I'm still trying to figure out how to read files as buffers
[02:48] creationix: I know that the secret is fs.readStream and padding it a buffer to use somehow
[02:48] creationix: s/padding/passing/
[02:57] tmpvar has joined the channel
[03:02] jdknezek has joined the channel
[03:03] creationix: strange, calling fs.readStream causes my code to abort, but there is no exception or output of any kind
[03:05] creationix: the server doesn't crash, but it closes the connection to the browser
[03:05] BryanWB has joined the channel
[03:09] thrashaholic has joined the channel
[03:10] PyroPete1 has joined the channel
[03:17] kriszyp has joined the channel
[03:23] lth_ has joined the channel
[03:29] Azeroth-Working: hrmm anyone no how to avoid this 'Error: ECONNRESET, Connection reset by peer' when working with tcp?
[03:30] Azeroth-Working: is crashing out my program when a client disconnects incorrectly
[03:32] Azeroth-Working: http://gist.github.com/393011
[03:32] saikat: i'm trying to use redis-node-client
[03:33] saikat: but i can't figure out how to get a value for a key, modify that value, and then set that modified value back as the value for the key
[03:33] saikat: i have client.get(key, function(err, value) { //do some stuff with value now what? }
[03:33] fictorial: hey
[03:33] saikat: hey fictorial
[03:33] fictorial: client.set
[03:33] saikat: i'm probably missing something really obvious
[03:34] saikat: but i don't have access to the original key
[03:34] saikat: that i got
[03:34] saikat: in the callback for client.get
[03:34] mjijackson has joined the channel
[03:34] saikat: i want to set the value back on the key that i originally called client.get on
[03:35] fictorial: use a var for the key.
[03:35] phazm: you have it in the 'key' variable, as far as referencing goes for your code
[03:35] saikat: i'm doing this in a loop though
[03:36] saikat: so won't that key var get set to something else
[03:36] joshowens: anyone have a minute to help me understand node.js?
[03:36] saikat: before my async callbacks are called?
[03:36] joshowens: I have some code that works the first time, but not for the second request
[03:36] joshowens: http://gist.github.com/392869
[03:36] saikat: fictorial: this is the code i have right now: http://gist.github.com/393017
[03:36] saikat: obviously, the sys.puts(keys[i]) is undefined
[03:37] saikat: would i do var key = keys[i] in the context right above redisClient.get?
[03:37] phazm: saikat: var key = 'my:key'; client.get(key, function(err, value) { key += 'appended'; client.set(key, function(err, value) { if(!err) { success! } }}
[03:37] fictorial: why is that obviously undefined actually?
[03:37] phazm: er
[03:37] joshowens: saikat: this might be a decent example of redis client: http://github.com/technoweenie/wheres-waldo
[03:37] phazm: scrap that
[03:38] fictorial: http://github.com/fictorial/redis-node-client/blob/master/test/test.js too :)
[03:38] saikat: fictorial: yeah i've been using test.js so far
[03:38] saikat: to figure things out
[03:38] fictorial: good, that is one of its roles in life
[03:39] saikat: maybe not obvious, but that sys.puts prints a bunch of undefineds
[03:39] phazm: s/key +=/response +=/
[03:39] saikat: phazm: but if i do a set in that function, won't it end up setting my values all on the same key?
[03:39] saikat: since i'm doing this in a loop?
[03:40] saikat: well to answer my question, it does
[03:40] saikat: if i put a "var key = keys[i];" before my redisClient.get
[03:40] saikat: and then "sys.puts(key)" inside my get callback
[03:40] saikat: it prints the last key a bunch of times
[03:41] fictorial: makes sense
[03:41] fictorial: you are calling get in a loop, firing off I/O that will callback later... but in the interim, you are moving on in the loop.
[03:41] saikat: yeah
[03:41] saikat: exactly
[03:42] jdknezek has left the channel
[03:42] saikat: i'm wondering what the proper way to be doing what i'm doing should be
[03:42] fictorial: by the time your callback fires, i=count-1.
[03:42] saikat: yep
[03:42] saikat: which is why
[03:42] saikat: keys[i] = undefined
[03:42] saikat: actually
[03:42] saikat: by the time my callback fires
[03:42] saikat: i = count
[03:42] saikat: because the loop has ended
[03:42] saikat: and that's why undefined
[03:43] phazm: maybe I don't understand... why can't you put the [i] IN the loop, not before?
[03:43] phazm: var key = ['key:1','key:2','key:3','key:4','key:5']; for(var i=0;i<5;i++){ client.get(key[i], function(err, value) { response += 'appended'; client.set(key[i], function(err, value) { if(!err) { success! } }}}
[03:43] phazm: untested, but it seems like that i would be accurate
[03:43] saikat: phazm: that is what i'm doing
[03:43] saikat: in your example, the loop will finish
[03:43] saikat: and THEN all the callbacks get called
[03:44] saikat: and key[i] doesn't mean what you want it to mean in the context of those callbacks
[03:44] phazm: I'm doing it in my script, one sec, let me see what I used
[03:44] fictorial: yes, you can certainly use a stack.. that's how redis-node-client actually works internally.
[03:44] fictorial: push in the loop before get, pop in the callback
[03:44] saikat: yeah
[03:45] saikat: that's what i was thinking of doing
[03:45] phazm: ah, I pass the [i] off to a function -- processAuction(items[0], priceToPennies(items[1]), items[2], items[3]);
[03:45] saikat: does node have partials?
[03:45] saikat: that would be another way to solve this
[03:45] saikat: i guess javascript has partials right?
[03:45] fictorial: define: partials
[03:45] fictorial: :)
[03:45] fictorial: currying?
[03:45] saikat: no, partials =)
[03:46] saikat: i believe they are different
[03:46] fictorial: define: partials then :)
[03:46] saikat: if i have a function function(foo, bar, x)
[03:46] thrashaholic: fictorial: about to dive into nodered, looks good :)
[03:46] saikat: i can get a new function x = partial(otherfunction(1))
[03:46] saikat: and x now takes two args
[03:47] phazm: saikat: I'd like to know (for my sake, in case I'm doing it wrong) what the drawback is to my implementation?
[03:47] fictorial: yeah that's currying if I'm following -- yes, that would solve your problem as well, and I think that's what phazm was talking about when he said he was passing [i] off to a function... in essence, these are both creating new scopes which is not modified.
[03:48] thrashaholic: go scope go
[03:48] saikat: fictorial: it's not quite currying
[03:48] saikat: http://www.uncarved.com/blog/not_currying.mrk
[03:49] saikat: but yeah we all agree =)
[03:49] phazm: perhaps that is a blocking implementation -- I sometimes find that my script hiccups during that point, but I assumed it was due to to another http call I was making to a fairly large page
[03:50] saikat: phazm: so the callback you are sending to client.get is processAuction?
[03:50] saikat: or rather
[03:51] saikat: actually i'm not sure how that actually is working in the context of the .get callback
[03:51] saikat: er, i mean
[03:51] saikat: how you are using it
[03:51] phazm: for (i = 0; i < auctionLength; i = i + 1) { processAuction(items[0], priceToPennies(items[1]), items[2], items[3]); } .... function processAuction(getAuctionId, getPrice, getBidder, getTimeLeft) { client.get('site:' + siteId + ':auctions:' + getAuctionId + ':id', function (err, response) { ...})}
[03:52] creationix: _ry, I'm writing a buffer based version of fs.readFile and I have a question about implementation
[03:52] fictorial has joined the channel
[03:52] phazm: saikat: does that help?
[03:52] saikat: i think so, one sec - parsing it =)
[03:52] fictorial: limechat just ate it. sorry.
[03:52] creationix: I'm thinking it would be faster to fs.stat the file first to get the size, and then read that all into one buffer in one shot?
[03:53] saikat: phazm: you are incrementing i but not sending i to processAuction?
[03:53] fictorial: phazm: yes, if you call another function then do the work there you are effectively locking in the value in some other scope so that's fine
[03:53] saikat: are those supposed to be items[i], items[i+1], etc?
[03:53] phazm: procesAuction doesn't know you're in a loop -- it just gets the values from each item in the array
[03:54] fictorial: saikat: interesting I did think these partials was currying
[03:54] fictorial: als
[03:54] saikat: yeah i did too for a long time
[03:54] fictorial: alas
[03:54] saikat: but on the bright side, i think JS hase native support for partials but not currying
[03:54] phazm: ACTION has no idea what parials or currying is :-/
[03:54] fictorial: you want "partials" then really for this... or just use a stack.
[03:54] saikat: yeah
[03:54] saikat: thanks a lot fictorial, phazm =)
[03:55] phazm: glad I could help
[03:55] fictorial: for (...) { (function (k) { client.get(k, function (...) {}) })(keys[i]) } would work I think.
[03:56] joshowens: anyone have any ideas on my code only working the first try? http://gist.github.com/392869
[03:56] fictorial: but that's a little weird :)
[03:56] fictorial: saikat: glad to help :)
[03:57] saikat: fictorial: one more question - i didn't see it anywhere but thought i would ask - there isn't any way to do what i'm doing synchronously is there?
[03:57] lth_ has joined the channel
[03:57] fictorial: serially?
[03:58] fictorial: wait for i-1 to finish before doing i?
[03:58] saikat: well, without callbacks
[03:58] fictorial: oh, no, that's the Node Way
[03:58] saikat: synchronous calls like the node readFileSync
[03:58] Azeroth-Working: hrmm anyone no how to avoid this 'Error: ECONNRESET, Connection reset by peer' when working with tcp? is crashing out my program when a client disconnects incorrectly. http://gist.github.com/393011
[03:58] saikat: it's just, trying to populate my redis DB like this
[03:58] saikat: makes node take up about as memory as my entire DB
[03:58] saikat: before filling up the DB
[03:58] bpot has joined the channel
[03:59] fictorial: I wonder if you have cycles in your references or if GC is not kicking in or some-such?
[03:59] creationix: _ry: https://gist.github.com/7d3174e77e6425cbdf88
[03:59] fictorial: or are you holding onto references to everything somehow?
[03:59] saikat: hm shouldn't be - the code i posted earlier is all i have in this script
[04:00] saikat: there could be a leak in node-compress
[04:00] saikat: taking that part out seems to reduce memory
[04:00] saikat: a lot
[04:00] phazm: just throw a flushall in there, seems to free up a bunch of memory ;)
[04:00] saikat: node.flushall?
[04:00] phazm: kidding.
[04:00] saikat: heh i wouldn't have minded it =)
[04:01] phazm: that erases your db -- or stores it in a file and erases or something, not sure
[04:01] saikat: oh right heh
[04:02] fictorial: well that's on the remote redis db -- you are talking about the local node.js memory usage.
[04:02] saikat: yeah
[04:02] saikat: well let me actually get the code working at all first
[04:02] saikat: and then i'll come bother people again
[04:03] fictorial has joined the channel
[04:03] fictorial: ACTION loathes every IRC client.
[04:03] saikat: oh you disconnected - was just saying that i'll mess around a bit more before bugging you guys again, thanks fictorial =)
[04:03] fictorial: I was just going to grab the logs on debuggable :)
[04:04] fictorial: I haven't used node-compress... can you reuse the object?
[04:04] phazm: fictorial: if you find a good one, let me know -- I'm using chatzilla, and my firefox is prone to crashing (might have something to do with my 90 addons... but I need them ALL!) and haven't found a suitable replacement yet
[04:04] saikat: i'm not actually sure - i'll have to see
[04:04] fictorial: I like LimeChat. The problem was PEBKAC.
[04:04] bmizerany has joined the channel
[04:05] phazm: ahh, okay
[04:05] phazm: I'll give that a shot
[04:05] _ry: we desperately need to write an irc client in node
[04:05] phazm: ah, would probably help if I had a mac.
[04:05] _ry: i also loath every irc client
[04:05] fictorial: saikat: I only mention that because you say that mem usage drops a lot when taking about the compression.
[04:06] fictorial: s/about/out/
[04:06] saikat: yeah, i should see if i can do that
[04:06] saikat: using one object would definitely drop the memory at least some
[04:06] saikat: _ry: isn't one of the popular web clients using node now?
[04:06] saikat: plurk or something
[04:06] _ry: i dont think that's an irc client
[04:07] saikat: ah nevermind then
[04:07] fictorial: plurk uses everything new under the sun in a slightly strange way just to blog about it. :)
[04:07] Azeroth-IsWorkin has joined the channel
[04:07] _ry: seriously- where is the web irc clients..
[04:08] phazm: let's abandon IRC and just use http://chat.nodejitsu.com/
[04:08] _ry: s/is/are/
[04:08] saikat: wait, i didn't mean plurk, i meant mibbit, and i meant websockets not node
[04:08] _ry: we need more apps
[04:08] fictorial: _ry: banned for flooding likely :)
[04:08] mrjjwright has joined the channel
[04:08] _ry: and by apps i mean cool demos :)
[04:09] technoweenie has joined the channel
[04:09] fictorial: throw out some ideas!
[04:10] _ry: take http://chat.nodejitsu.com/ and merge it with http://tinyurl.com/ircd-js
[04:10] _ry: for example
[04:11] _ry: (/me has been trying to convince scott to do it)
[04:11] fictorial: well if you go that route you don't really need an irc client from the client side right? you just need a pubsub system.
[04:11] phazm: saikat: Connections via mibbit are no longer supported on freenode. You may wish to consider using http://webchat.freenode.net instead. Further information over at http://bit.ly/19JILF
[04:11] fictorial: phazm: ding!
[04:11] saikat: heh
[04:12] saikat: any irc client that is too easy to use attracts too many people who won't put up with hard to use irc clients
[04:12] saikat: and gets banned
[04:12] saikat: no way around it
[04:12] phazmwebchat has joined the channel
[04:12] _ry: no - i want it to be an irc server itself
[04:12] _ry: so you can connect to it with an irc client
[04:12] _ry: or through http
[04:12] Azeroth-IsWorkin: is preeettty
[04:13] fictorial: _ry: ok that's different. what is missing from the ircd-js then?
[04:13] phazmwebchat: hrm
[04:13] _ry: it just need to be merged with the long poll server
[04:13] phazmwebchat: I think I prefer chatzilla
[04:13] _ry: would be a great demo
[04:13] fictorial: Azeroth-IsWorkin: yes, the CSS on that chat demo is absolutely stunning.
[04:13] _ry: maybe even useful
[04:14] fictorial: what happens to messages sent while the lp client reconnects? does the server buffer have a mru cache per channel?
[04:14] fictorial: er, lru
[04:15] tmpvar has joined the channel
[04:15] _ry: lur?
[04:15] _ry: lru?
[04:16] _ry: least recently used? yeah sure
[04:16] fictorial: least recently used -- does the long poll server drop the least recently used / eldest messages?
[04:16] fictorial: k
[04:16] _ry: keeps the last 200 messages
[04:16] fictorial: that works
[04:16] _ry: or whatever
[04:16] creationix: _ry, is it ok for fs.readFile to use fs.stat and read the whole file into one custom fit buffer?
[04:16] creationix: I've got a version and it's pretty fast
[04:16] _ry: creationix: um
[04:16] _ry: creationix: yes
[04:16] creationix: https://gist.github.com/7d3174e77e6425cbdf88
[04:16] _ry: creationix: that's how i was going to do it
[04:16] tmpvar: that sounds sexy creationix
[04:17] _ry: creationix: it needs to deal with the case that read() doesn't return the requested amount
[04:18] creationix: I was wondering if that was a possiblity
[04:18] _ry: it is
[04:18] creationix: so read only reads up to the requested amount then
[04:18] tmpvar: yeah <= the requested
[04:18] creationix: not exactly that much
[04:18] creationix: I see
[04:18] creationix: well, that complicates things, but it's still less copying for small files
[04:19] _ry: yeah
[04:20] Aria has joined the channel
[04:21] creationix: hmm, so how much does it take to test it
[04:21] creationix: maybe try to serve up an iso image or something?
[04:22] creationix: hmm, symlinks are going to be problematic too
[04:23] fictorial: Apple's Game Center is giving me heartburn.
[04:26] fictorial: unrelated: what's the deal with node.js and udp? is it on the roadmap?
[04:26] creationix: hmm, I'm not sure new Buffer(928670754) is a good idea...
[04:28] Azeroth-Working has joined the channel
[04:28] fictorial: creationix: sounds like a perfect match for mmap
[04:29] creationix: what's mmap?
[04:29] fictorial: http://en.wikipedia.org/wiki/Memory-mapped_file
[04:29] Aria: Map a file or swap region into process.
[04:29] Aria: Uses memory where it can, but is file-backed where it can't.
[04:30] creationix: that would be nice
[04:30] fictorial: 'A possible benefit of memory-mapped files is a "lazy loading", thus using small amounts of RAM even for a very large file.'
[04:30] airportyh_ has joined the channel
[04:30] creationix: _ry: process.binding('fs').read() gave me the whole 1gb file in a single chunk
[04:31] dekz has joined the channel
[04:31] creationix: it took a few seconds and used a gig of ram, but it worked
[04:31] creationix: fictorial: so ideally fs.readFile returns a mmap backed buffer?
[04:32] creationix: or would that even be possible?
[04:32] Aria: That's actually a good interface...
[04:32] Aria: Sure beats copy-into-RAM...
[04:32] fictorial: it's not always possible or desired
[04:32] _ry: cerberos: i think you should still do a loop and be prepared for the situation that it doesnt return the whole file
[04:32] _ry: sorry
[04:32] _ry: creationix: --^
[04:33] creationix: I've got the loop
[04:33] creationix: I'm just not able to test it
[04:33] creationix: _ry: https://gist.github.com/7d3174e77e6425cbdf88 udpated
[04:34] creationix: *updated
[04:34] _ry: that should be fine
[04:35] _ry: creationix: could you patch it in?
[04:36] creationix: sure, just a sec
[04:36] creationix: _ry: readFile still needs to honor the encoding string right?
[04:37] tlrobinson_ has joined the channel
[04:38] _ry: creationix: yeah, i suppose that'd be good.
[04:38] joshowens: can anyone help me work through an issue?
[04:38] _ry: you can just toString it at the end
[04:38] creationix: ok, I was about to ask that
[04:38] joshowens: I've got this code that only works on the first try: http://gist.github.com/392869
[04:39] joshowens: line 23 and 24 get called on the first request, but the next request only seems to run 24
[04:40] Aria: _ry, ever considered having buffers not convert until translated to a string, rather than storing in a specific encoding?
[04:40] joshowens: it is an analytics tracker for file downloading, I've built this before in ruby but wanted to use Node.js and mongo
[04:42] _ry: Aria: buffers are just raw data - they don't store a specific encoding
[04:43] Aria: Ah, okay. It looked like there was some munging to make it store as low order bytes in a UTF-16 string.
[04:43] Aria: I was reading the code, but hadn't worked through the logic of it all.
[04:44] joshowens: ACTION hears crickets...
[04:45] phazm: joshowens: could it be because you are calling the log function before it is defined?
[04:46] joshowens: phazm: that matters in js?
[04:47] Aria: just like in Ruby.
[04:47] BryanWB: the log function will have the value of undefined until u define it
[04:48] joshowens: bingo, that did it, thx phazm
[04:49] joshowens: and Aria/BryanWB
[04:49] phazm: np joshowens
[04:49] creationix: _ry can we please make inspect use Buffer.prototype.inspect for buffers?
[04:49] creationix: it's much easier on the eyes
[04:50] joshowens: well, that solved the issue with log, now to fix my db updating :)
[04:52] BryanWB: are the authors of tasks.js or Task.node around?
[04:55] amigrave has joined the channel
[04:55] BryanWB: ACTION is curious if anyone has thought about porting Jake to node
[04:56] ChrisPartridge: What is Jake?
[04:56] BryanWB: rake ported to narwhal
[04:57] BryanWB: http://karmaeducation.org/2010/01/15/get-started-with-jake-a-rake-clone-in-javascript/
[04:57] _ry: creationix: yes
[04:58] mde: BryanWB: http://github.com/mde/jake
[04:58] mde: It's more JS make than just a port of Rake. The Ruby DSL isn't very JavaScripty.
[04:59] ChrisPartridge: I'm getting an overload of 'things to play around with' while hanging around here
[04:59] BryanWB: mde: fair enough, i have actually used jake a good bit but never used rake and only make a little
[05:00] BryanWB: mde: so u ported it? nice!
[05:00] Aria: I'm not even sure the ruby language is very rubyish in Rake.
[05:00] mde: In Ruby, the parens for method calls are optional, so stuff looks much prettier.
[05:00] isaacs has joined the channel
[05:00] mde: I'm just using object literals, which feels a lot more JavaScripty.
[05:01] mde: Yeah, so it's not really a port of Rake, strictly speaking.
[05:01] BryanWB: mde: ah i c u haven't add the file globbing, clean tasks
[05:02] chewbranca has joined the channel
[05:02] mde: Nope, it's still very basic, it just looks for deps then runs the task.
[05:02] BryanWB: mde: after i finish my exam next week will take a stab at adding more to it
[05:02] mde: That would be fantastic.
[05:02] mde: mikeal was working on some similar command-line opts parsing, would be nice if we could get that stuff in there too.
[05:03] mde: I really just wanted something so I could do the build tasks for Geddy in JS.
[05:03] BryanWB: mde: damn github won't let me fork your project because i already have a fork of the narwhal version
[05:03] mde: Oh, stupid same-nameness.
[05:04] Aria: Yarr.
[05:06] creationix: I now see why debug builds aren't enabled by default, it takes twice as long to compile
[05:06] chewbranca_ has joined the channel
[05:06] creationix: it looks like it's making two versions of v8
[05:10] creationix: _ry: heh, it brok 100% of the test suite
[05:10] _ry: yes!
[05:10] _ry: :)
[05:10] _ry: i often do that
[05:10] creationix: I think require or something that uses fs.readFile expected the result to be a string and is trying to call replace on it
[05:10] _ry: yes
[05:11] _ry: add an encoding to that call
[05:11] _ry: wherever it is
[05:11] creationix: at Module._compile (module:351:21)
[05:11] creationix: that might be it
[05:11] creationix: hmm, no, wrong part of stack trace, but I'll find it
[05:12] isaacs: creationix: making readFile return a buffer?
[05:12] creationix: isaacs: yep
[05:12] isaacs: creationix: badass.
[05:12] isaacs: creationix: yeah, it's in the "cat" function in module.js
[05:12] isaacs: iirc
[05:12] BryanWB: is camilo aguilar around?
[05:12] BryanWB: am curious about his libvirt bindings
[05:14] creationix: ahh, much better, now it's passing tests
[05:15] mrjjwright has joined the channel
[05:15] creationix: _ry: is test-ini a known broken test?
[05:16] _ry: no
[05:16] _ry: should be working
[05:17] creationix: ok, found it, another place trying to treat the buffer as a string
[05:19] mjijackson has joined the channel
[05:20] hassox has joined the channel
[05:21] creationix: _ry: http://gist.github.com/raw/393086/27b54ab370d9ef673b9fff55f35d308f4a5dd120/fs-readFile-to-buffer.patch
[05:21] creationix: passes all tests
[05:21] creationix: now to patch sys.inspect real quick
[05:22] _ry: very good
[05:22] _ry: i shouldn't commit while drinking... but fuck it
[05:22] creationix: :)
[05:22] creationix: in that case, let me prepare a few more patches ;)
[05:24] dgathright has joined the channel
[05:26] CIA-75: node: 03Tim Caswell 07master * rc07c601 10/ (4 files in 3 dirs): fs.readFile uses a buffer internally and will return the raw buffer if no encoding is specified. - http://bit.ly/aJ9Apm
[05:27] _ry: creationix: please read the first paragraph of git-commit(1) section "DISCUSSION"
[05:27] _ry: in particular the 50 character commit line convention
[05:27] creationix: cool
[05:28] creationix: so make a separate subject line
[05:28] creationix: thanks
[05:28] saikat has joined the channel
[05:34] technoweenie has joined the channel
[05:37] isaacs: how can you detect whether or not node has tls support?
[05:38] _ry: isaacs: look in the tls tests
[05:38] isaacs: kewl
[05:38] _ry: but i think there should be a better way
[05:38] saikat: this is probably a very noobish question, but is it expected that the compressed output from deflating some data using node-compress can't be read using python's zlib library
[05:38] saikat: though both the python lib. and the node lib. use zlib.h to compress/decompress?
[05:39] saikat: is the binary format used by node somehow different and so appears corrupt to python?
[05:39] isaacs: oh, ok, so basically if var crypto = require('crypto'); doesn't throw, then you have tls
[05:39] isaacs: that seems... kludgey
[05:41] _ry: saikat: not so familiar with that lib - but - i would expect it to be usable elsewhere
[05:41] _ry: saikat: that is, data deflated with it
[05:41] saikat: hm, yeah that's what i thought - the zlib specification seems like it should be the same across languages
[05:41] saikat: seems like a bug in node-compress or in python's zlib then, thanks
[05:42] saikat: (node-compress is used for inflating in the default http client used by node, i believe)
[05:42] saikat: or actually, i guess not the default one
[05:46] stevendavie has joined the channel
[05:47] stevendavie has joined the channel
[05:48] isaacs: creationix: http://github.com/isaacs/npm/issues/closed#issue/10
[05:48] creationix: isaacs: thanks
[05:48] isaacs: looks like nvm doesn't compile with tls? or is it just that the guy doesn't have openssl or something?
[05:52] creationix: _ry: http://gist.github.com/393112
[05:52] creationix: I added the inspect hook and fixed a minor bug while I was in there
[05:54] _ry: hmm
[05:54] _ry: looks a little complicated
[05:55] _ry: can't you just add a 'if (obj instanceof Buffer)' /
[05:55] _ry: ?
[05:56] isaacs: is there ever a case where (typeof {}).replace(/^([a-z])/, function (d) { return d.toUpperCase(); }) !== "Object"?
[05:59] creationix: _ry: I can, I thought a general hook would be better in the long run
[05:59] creationix: isaacs: good question
[05:59] creationix: strings?
[06:00] _ry: creationix: i like specific :)
[06:00] _ry: easier to read
[06:00] _ry: stupid code is good code
[06:01] _ry: http://github.com/ry/node/blob/d044e2de07f147771dd68fa859165df6380264c0/src/node.cc#L1656-1788 <--
[06:01] _ry: this might be a little too stupid
[06:01] _ry: but it works!
[06:01] _ry: if cascades are slow you say - it's only 20 clauses who cares?
[06:02] creationix: well, in case of the inspect hook, it's for third part code that want's a custom inspect on their objects
[06:02] creationix: we can't enumerate on that because it's unknown
[06:02] creationix: I thought that was why buffer has an inspect method in the first place
[06:02] creationix: to start this convention
[06:02] _ry: just do the buffer exception if the issue comes up again we'll do something else
[06:03] _ry: creationix: i mean, mayber you're right - but ...
[06:04] isaacs: _ry: re slow cascades, can't you switch(){} on a string in c?
[06:04] _ry: isaacs: no
[06:04] isaacs: or is switch only for native things?
[06:04] isaacs: oh, ok.
[06:04] isaacs: does c support the reverse-switch trick?
[06:05] _ry: what's that?
[06:05] isaacs: switch (true) { (strcmp(*module, "ssl") == 0): blah blah blah; break;
[06:05] inimino: isaacs: what's that typeof thing?
[06:05] isaacs: inimino: a quote from creationix's gist
[06:05] kjeldahl has joined the channel
[06:06] isaacs: ok, gotta run.
[06:06] _ry: hmm
[06:06] _ry: not sure i understand that, isaacs
[06:06] isaacs: _ry: you could maybe also do switch(0) { case strcmp(...): ...
[06:06] inimino: ah
[06:07] isaacs: _ry: a trick i used to use in vb back in the day
[06:07] _ry: i guess you'd have lots of those?
[06:07] creationix: I don't think c allows that switch
[06:07] _ry: it'd go down the list
[06:07] _ry: until it found the match?
[06:07] isaacs: you put teh constant in the switch() and then the compares have a variable or something
[06:07] creationix: _ry: http://gist.github.com/393123
[06:07] isaacs: but it ends up being just a cascade.
[06:07] _ry: you could do that - but it's not any faster than a if cascade
[06:07] creationix: choose your version
[06:07] inimino: creationix: yeah I don't think that will ever be anything but "Object"
[06:07] isaacs: i mean, the whole benefit of a switch is that it's fast, right? but it might also be more readable.
[06:08] creationix: inimino: sure it will
[06:08] isaacs: _ry: less cruft, i guess
[06:08] inimino: creationix: when?
[06:08] creationix: value can be anything, strings included
[06:08] creationix: typeof "foo" is "string"
[06:08] isaacs: creationix: but you're putting (typeof {}) not typeof thing
[06:08] tlrobinson: mde|afk: it's literally a port of rake
[06:08] isaacs: {} is always an object
[06:08] creationix: really?
[06:08] technoweenie has joined the channel
[06:08] creationix: then that's a typo
[06:08] isaacs: ah
[06:08] inimino: hehe
[06:09] _ry: isaacs: switch is only fast if it can jump to the case
[06:09] creationix: hah, you're right, sorry about that
[06:09] isaacs: creationix: line 37 in the gist
[06:09] isaacs: _ry: right
[06:09] inimino: "typeof value" ...
[06:09] inimino: ?
[06:09] isaacs: _ry: it'd maybe be a readability benefit. i dunno.
[06:09] isaacs: ok, office time.
[06:09] isaacs: have fun
[06:09] _ry: office?
[06:09] _ry: huh
[06:10] inimino: ACTION afks too
[06:10] _ry: startup life, i guess
[06:10] micheil: _ry: I always assumed most startups were bedroom jobs ;P
[06:10] _ry: not all :)
[06:11] micheil: joking.
[06:11] micheil: :P
[06:11] creationix: _ry: ok, I updated the gist, it had a typo
[06:11] creationix: I'm off to bed
[06:13] creationix: http://gist.github.com/393123
[06:16] mscdex: _ry: what did you mean earlier about an irc client in node? adding a frontend and incorporating comet capability?
[06:16] tlrobinson: mde|afk: nevermind i didn't see your version. you should make sure it's compatible with our jake http://cappuccino.org/discuss/2010/04/28/introducing-jake-a-build-tool-for-javascript/
[06:19] BryanWB has joined the channel
[06:21] _ry: mscdex: an irc client written in code would be cool
[06:22] mscdex: ah ok, a console client then?
[06:24] _ry: node
[06:24] _ry: i meant
[06:24] _ry: well there aren't any ncurses bindings yet
[06:24] _ry: console clint would be awesome
[06:25] _ry: but mostly i meant a mibit clone
[06:31] javajunky has joined the channel
[06:32] mscdex: heh there's an ncurses binding for spiderape
[06:38] tlrobinson: surely they could have come up with a better name than spiderape, preferably one that doesn't sound like spider rape
[06:38] BryanWB has joined the channel
[06:40] tlrobinson_ has joined the channel
[06:41] mscdex: heh true
[06:46] hassox has joined the channel
[06:47] JimBastard has joined the channel
[06:47] JimBastard: spoiler alert : iron man sucked
[06:48] phazm: spoiler alert: snape kills dubledore.
[06:49] technoweenie: worse than the first iron man?
[06:51] qFox has joined the channel
[06:53] mscdex: spoiler alert: han shot first :-)
[07:10] Nohryb: hi, where/what can I touch somewhere to get chunks > 4096 bytes in the process.stdin stream data events ??
[07:11] amigrave has joined the channel
[07:15] Nohryb: I'm writing a command-line-tool to process files of ~ 1.9GB file trough stdin, it would be awesome if I could get it in bigger than that chunks, in less than 1.9GB/4096bytes (4980736) 'data' events/chunks.
[07:16] dgathright: So the 3rd param in http.createClient is an optional boolean for https. Seems that when I pass in a true flag, the request just hangs and I never get a response. Any idea what I'm doing wrong? http.createClient(80, "http://google.com", true);
[07:17] dgathright: oh, wait, the port, duh. lemme change that & try again
[07:17] ChrisPartridge: Does the url need to specify https?
[07:17] ChrisPartridge: and the port 443?
[07:18] mscdex: i would think so
[07:18] dgathright: yeah, 443 & remove the http part. Works fine. Guess I'm more tired than I thought. :)
[07:18] felixge has joined the channel
[07:18] felixge has joined the channel
[07:19] ChrisPartridge: dgathright: coffee always helps :-)
[07:19] mscdex: true :D
[07:23] teemow has joined the channel
[07:23] Nohryb: Is it possible to read process.stdin with fs.read(fd, length, position, encoding, callback) ? That would allow me specify a chunk size > 4096.
[07:27] phazm: can anyone think of a way to get a screen capture of a site via node.js?
[07:29] phazm: like to actually take the screencap, not just send one
[07:31] mscdex: you would probably just create a child process that runs a screen capture utility
[07:31] mscdex: i think there's one for webkit
[07:31] mscdex: at least
[07:31] technoweenie: you'd probably not want to run it on a unix machine, it'll have shitty fonts
[07:32] mscdex: :S
[07:35] micheil: _ry: seen? http://github.com/copiousfreetime/http-parser.rb
[07:40] joshbuddy has joined the channel
[07:42] derbumi has joined the channel
[07:43] jedschmidt has joined the channel
[07:44] mscdex: phazm: maybe this might work: http://cutycapt.sourceforge.net/
[07:44] piranha has joined the channel
[07:45] dgathright has joined the channel
[07:45] SvenDowideit has joined the channel
[07:46] phazm: that looks like exactly what I need, thanks mscdex
[07:51] lth_ has joined the channel
[07:54] SvenDowideit_ has joined the channel
[08:01] qFox: mscdex> for firefox, it has a (prori) screenshot method which you could xhr.
[08:02] SvenDowideit_ has joined the channel
[08:03] dekroning has joined the channel
[08:04] phazm: qFox: huh?
[08:09] qFox: maybe i missunderstood you...?
[08:10] jedschmidt_ has joined the channel
[08:10] qFox: firefox allows for a screenshot through one of its propriatary methods. load a website in firefox, take the screenshot onload, send back to node through xhr. repeat for url queue.
[08:10] qFox: or something.
[08:11] qFox: combined with cutycapt, you'll have two browsers to do this in :p
[08:12] qFox: or three, even, if you count safari/chrome as two
[08:12] jedschmidt__ has joined the channel
[08:13] qFox: i'm gonna write a simple pngquant front-end using node, tonight.
[08:14] phazm: could that be automated though, qFox?
[08:16] qFox: the screenshot taking? sure why not?
[08:16] SvenDowideit_ has joined the channel
[08:17] derbumi has joined the channel
[08:18] phazm: dunno -- just sounded like it was a manual process ;)
[08:18] qFox: on your own site, it'll be easy, since you can add the script yourself.
[08:18] qFox: external sites would take a bit more work (add-on or bookmarklet or other script to invoke the screenshot taking on page load)
[08:19] qFox: once the screenshot has been sent to your node app, instruct node to either change the url somehow (dont know how that works myself) or close the firefox instance and spawn a new one
[08:19] qFox: i'm sure there's an easy way to change the url
[08:19] BryanWB has joined the channel
[08:19] qFox: possibly using an addon
[08:19] phazm: just to be clear, it shows a rendering of the content based on the gecko rendering engine, not the users browser, right?
[08:20] qFox: eh..?
[08:20] phazm: I am quite lost.
[08:20] mscdex: heh
[08:20] qFox: you fire up firefox yourself (using node). i'm not sure how that question applies
[08:21] phazm: you said a script on my site
[08:21] qFox: yes.
[08:21] qFox: just a javascript you add to the source of your website
[08:21] qFox: onload you execute the screenshot taking method and send it back to node
[08:21] qFox: using ajax..
[08:22] phazm: I'm going to just take your word for it, until you have a working example - apparently my brain has decided it's too late for comprehension ;)
[08:22] qFox: hm, what step is unclear? :)
[08:22] phazm: from this line down is pretty fuzzy:
[08:22] phazm: qFox> mscdex> for firefox, it has a (prori) screenshot method which you could xhr.
[08:22] mscdex: i think phazm was looking to do batch website screenshots from a node.js server
[08:23] qFox: hehe. the start :p
[08:23] phazm: ;)
[08:23] phazm: yea, the cutycapt method should work fine, so long as it's non-blocking
[08:24] mscdex: well, for child processes it would be asynchronous to your script
[08:24] phazm: ah, okay
[08:24] qFox: mscdex> just for my own sanity, is my idea garbage? or am i explaining it wrong
[08:24] mscdex: you'd just add a listener for the 'exit' event or whatever
[08:24] mscdex: qFox: i think he was looking for something completely server-side
[08:25] qFox: hm
[08:25] phazm: I wouldn't question your sanity, qFox -- I'm sure the issue is on my end :)
[08:25] qFox: doesnt cutycapt fire up a webkit browser?
[08:25] qFox: to take the screenshot...
[08:25] qFox: or is it just a backend process that does this work...
[08:25] phazm: not visibly -- that might be how it handles it, but it's a command line util
[08:25] mscdex: not a browser, but just enough to render an image
[08:26] qFox: okay, i didnt get that at first.
[08:26] qFox: the firefox thing can be automated as well, but it sounds like cutycapt will be much less of a hassle :)
[08:26] mscdex: it does require an X server though, but you can use xvfb
[08:26] robinduckett has joined the channel
[08:27] mscdex: wkhtml2pdf doesn't require an X server, but needs x11 libs though.... and obviously only outputs to pdf though
[08:27] mscdex: *x11 client libs
[08:28] tlrobinson_ has joined the channel
[08:28] phazm: no idea what 'X' is, but it works for me on ubuntu desktop
[08:28] robinduckett: brb
[08:28] SvenDowideit_ has joined the channel
[08:29] qFox: x is the (a) graphical interface :)
[08:29] mscdex: X is what powers your desktop GUI
[08:30] phazm: and KDE, and Gnome, those are other GUIs?
[08:30] mscdex: those are window managers that run on top of X
[08:30] phazm: ah
[08:30] mscdex: or desktop environments
[08:30] mscdex: whichever :P
[08:30] mscdex: there's many parts
[08:31] N` has joined the channel
[08:32] SvenDowideit has joined the channel
[08:33] chakrit: anyone of you on forrst?
[08:33] xla has joined the channel
[08:37] felixge has joined the channel
[08:37] felixge has joined the channel
[08:38] SvenDowideit_ has joined the channel
[08:43] BryanWB has joined the channel
[08:44] SvenDowideit_ has joined the channel
[08:44] melgray has joined the channel
[08:47] Gruni has joined the channel
[08:49] SvenDowideit has joined the channel
[08:51] hellp has joined the channel
[08:52] jedschmidt: new ( require("buffer").Buffer )( 0 ).write( "", "utf8", 0 )
[08:52] jedschmidt: causes "TypeError: Offset is out of bounds"
[08:53] jedschmidt: this seems like a bug. writing nothing should just leave the buffer as is, right?
[08:53] SvenDowideit_ has joined the channel
[08:56] chakrit: utf8 bom?
[08:57] robinduckett has joined the channel
[08:57] jedschmidt: it fails for ascii too.
[08:57] robinduckett: harrow
[08:59] qFox: is it something you'd encountered in a real situation though?
[08:59] jedschmidt: qFox: just did.
[08:59] qFox: how?
[09:00] jedschmidt: parsing a string into a template.
[09:00] qFox: hm k
[09:00] jedschmidt: items at even inidices are strings
[09:00] jedschmidt: items at odd indices are variables.
[09:00] jedschmidt: two consecutive variables means the string between them is empty.
[09:01] robinduckett: that sounds vaugely familiar
[09:01] BryanWB has joined the channel
[09:01] jedschmidt: doesn't seem like something node should blow up on.
[09:01] robinduckett: i made a parsey thing that parses html here the other day
[09:02] robinduckett: and for some reason, every even index is the JS and every odd index is the HTML, even if there's no space between the ?> and the are automatically html escaped, etc.
[09:52] felixge: micheil: seems like you could get away writing this thing in assembler if it tickles your fancy
[09:52] micheil: felixge: see: http://www.railsdispatch.com/posts/security
[09:53] felixge: you should definitely us node - just for the fun of it
[09:53] SamuraiJack has joined the channel
[09:53] felixge: unless you're looking for the least amount of work
[09:53] felixge: than rails3 will imho be better at this point
[09:53] micheil: yeah
[09:53] micheil: I guess in the future if it gets traction, I can always rewrite it as a node app, when node is a little more matured (eg, post v0.2)
[09:54] saikat has joined the channel
[09:56] Tim_Smart has joined the channel
[09:58] teemow has joined the channel
[09:59] pdelgallego has joined the channel
[10:01] jedschmidt: micheil: how do you like mongo?
[10:01] jedschmidt: micheil: and why use mongohq over heroku's 3rd party stuff?
[10:05] vladb has joined the channel
[10:08] vladb: hi guys, node is crashing on me if i do multiple concurrent requests... does this sound familiar to anyone? I'm getting "Error: Stream is not writable" in limestone (sphinx search lib). The line in question is server_conn.write(request.toString(), 'binary');
[10:09] vladb: mind, all this is fine if I do one http request at a time
[10:10] chakrit: vladb: smells like bad closures
[10:11] vladb: chakrit: what do you mean?
[10:12] chakrit: hmm, what's server_conn?
[10:12] chakrit: I mean
[10:13] chakrit: It's like you have closed the Stream somewhere and accidentally re-use it in server_conn
[10:14] vladb: that's what I thought, but why would this happen only on concurrent requests, should be the same thing with just one?
[10:16] chakrit: Can you show some more code?
[10:17] vladb: sure, sec
[10:19] vladb: this is my code: http://pastebin.com/60NenJVm
[10:19] felixge_ has joined the channel
[10:19] felixge_ has joined the channel
[10:19] felixge_: 300 mb / sec
[10:19] felixge_: :)
[10:20] vladb: and this is limestone.js (prob is line 269): http://pastebin.com/VYkkqRNP
[10:22] jedschmidt: felixge: at this rate you'll be measuring in gb by tomorrow.
[10:22] chakrit: well, it seems server_conn is re-used as I've said.
[10:23] chakrit: the "connect" event could fire *after* server_conn = tcp.create has run a few times
[10:24] felixge_: 390 mb / sec
[10:24] felixge_: jedschmidt: nah, I think I maxed it out now :)
[10:24] felixge_: jedschmidt: I mean this speed is for the best-case scenario of byte sequences
[10:24] felixge_: jedschmidt: the worst-case is pretty much not optimized at all
[10:24] felixge_: jedschmidt: but that's ok - it doesn't matter for file uploads
[10:24] felixge_: :)
[10:24] chakrit: vladb: var server_conn should be moved inside the Spinx.connect function
[10:25] vladb: chakrit: wouldn't that make it unusable in other methods?
[10:26] chakrit: Hmmm
[10:26] BryanWB has joined the channel
[10:26] chakrit: Maybe , just maybe that server_conn was meant to be re-used?
[10:26] chakrit: one sec
[10:27] vladb: I assume so, definitely needed in Sphinx.query
[10:28] chakrit: Well, in that case you just can't use it concurrently.
[10:28] vladb: hmm any workarounds?
[10:29] chakrit: Hmm... one sec...
[10:29] chakrit: I think that's it.
[10:29] vladb: what is?
[10:30] chakrit: server_conn.addListener('data', callback) <-- the callback isn't guarateed to run in order
[10:30] Tim_Smart has left the channel
[10:30] chakrit: other parts of code that use callbacks as well.
[10:30] Tim_Smart has joined the channel
[10:30] chakrit: so even if it works I think it might just returned wrong results
[10:30] chakrit: A workaround might be re-requiring the limestone.js file
[10:31] chakrit: separately for each connection
[10:31] vladb: hmm
[10:32] chakrit: not sure how to do that though :(
[10:33] vladb: ah I think I finally get it. well, the problem
[10:33] vladb: I figured node scripts are respawned on each new request
[10:33] chakrit: vladb: Hope I didn't give you more questions than answers :)
[10:34] vladb: nah... maybe if I moved Sphinx.connect outside of http.createServer
[10:36] chakrit: Mmm... I don't think that'll work... do yuo control limestone.js?
[10:36] chakrit: You see on line 271 in Spinx.query
[10:37] chakrit: Everytime you call a .query, a new listener will be added.
[10:37] cerberos has joined the channel
[10:37] chakrit: and the old isn't even removed yet.
[10:38] chakrit: unless, you disconnect and then re-connect
[10:38] vladb: I was
[10:38] chakrit: which will re-create the server_conn tcp connection
[10:38] vladb: was calling limestone.connect inside createServer and disconnecting later on
[10:39] chakrit: but the server_conn is shared... so can't really use it concurrently reliably
[10:39] chakrit: Well, you can build a "queue" infront of limestone
[10:39] chakrit: to fix the server_conn problem
[10:40] chakrit: you follow?
[10:41] Tim_Smart has left the channel
[10:41] chakrit: i.e. for each call to .connect and .query, the callbacks is added to a backing queue
[10:42] chakrit: and a timer checks the queue periodically and run the .connect/.query on Sphinx
[10:42] chakrit: and then make sure that the callbacks are run in order
[10:42] chakrit: and that .connect/.query/.disconnect order is preserved.
[10:42] vladb: hmm okay
[10:43] vladb: I'll see if I figure it out or just give up and use php :)
[10:43] vladb: thanks man
[10:43] chakrit: welcome :)
[10:45] chakrit: on a side note, I think it might be easier to fork and fix limestone.js to stop sharing server_conn.
[10:46] BryanWB has joined the channel
[11:17] jan____ has joined the channel
[11:18] alex-desktop has joined the channel
[11:32] joshowens has joined the channel
[11:33] Azeroth-Working has joined the channel
[11:38] felixge has joined the channel
[11:38] felixge has joined the channel
[11:42] Tim_Smart has joined the channel
[11:42] Tim_Smart has left the channel
[11:44] BryanWB has joined the channel
[11:51] jedschmidt has joined the channel
[11:57] derbumi has joined the channel
[12:17] micheil: jedschmidt: well, heroku's mongo support is through mongohq
[12:17] jedschmidt: micheil: ah, i didn't realize that. so it's the same thing, just integrated for you?
[12:19] jcouture has joined the channel
[12:19] micheil: yeah
[12:20] micheil: jedschmidt: also, I know of mongohq being used in fairly large deployments, in cases where a dump file will be >20GB's
[12:20] micheil: although, I'd have to check for the exact sizes
[12:20] micheil: jedschmidt: I have been thinking of implementing John Nunemaker's wonderful MongoMapper in js
[12:21] micheil: (for node)
[12:23] jedschmidt: micheil: cool, checking it out now. so i guess latency isn't too bad if both heroku and mongohq are on ec2?
[12:24] micheil: yeah, latency wouldn't be too bvad
[12:24] micheil: *bad
[12:25] creationix has left the channel
[12:25] micheil: vladb: that's the first time I've seen eventEmitter used like that, generally it's initialised and then inherited into a constructor
[12:26] micheil: vladb: another thing, do you know if connection.query(...) is returning the connection object or a new object?
[12:30] creationix has joined the channel
[12:30] creationix has left the channel
[12:32] kriszyp has joined the channel
[12:36] felixge has joined the channel
[12:36] felixge has joined the channel
[12:42] mjijackson has joined the channel
[12:48] micheil: jedschmidt: did you say that there were notes with your slides on flickr
[12:51] jedschmidt has joined the channel
[12:54] mjijackson: micheil: yes. there are notes with the slides
[12:54] micheil: jedschmidt: just reviewing those slides with the notes showing ;P
[12:54] jedschmidt: micheil: ah, yeah. meaningless without notes, for sure.
[12:54] micheil: thanks; hopefully this will help me actually understand the () crazyness
[12:54] jedschmidt: micheil: hopefully it'll make more sense.
[12:55] jedschmidt: micheil: it's not that crazy! just another way of making a list.
[12:55] micheil: it is crazy :P
[12:55] mjijackson: it can get messy real quick if you don't keep everything indented properly
[12:56] micheil: ACTION goes to view these slides, flash is doing crazy stuff to my cursor; or it's the ()'s ;p
[12:57] jedschmidt: mjijackson: true of most code, i'd imagine.
[12:58] mjijackson: jedschmidt: true. only difference is that no editor on earth will help me distinguish between a binary and a ternary app! ;)
[12:58] ryan[WIN]: o hai palz
[12:59] jedschmidt: mjijackson: fair point. the ugly truth is that n can also be greater than 3...
[12:59] jedschmidt: mjijackson: though it's possible to run your app constantly to figure out your current arity.
[12:59] hellp has joined the channel
[13:00] micheil: jedschmidt: translating japanese must be a bit of a job
[13:00] jedschmidt: micheil: it's actually pretty easy in my field. just repetitive.
[13:00] jedschmidt: micheil: learning it was that hard part.
[13:01] micheil: heh, it's rather interesting to know the backgrounds from which people come into things like opensource and programming
[13:01] micheil: jedschmidt: yeah, I know learning japanese is hard. :P
[13:01] micheil: jedschmidt: I had to learn hiragana in the first years of high school
[13:03] jedschmidt: micheil: oh yeah? all my HS had was spanish, french, and russian.
[13:04] micheil: yeah, we only have the choice of japanese here, but I'd really rather try and learn german (I was but teaching yourself is hard)
[13:04] botanicus has joined the channel
[13:04] micheil: typd.in looks pretty cool as well
[13:05] jedschmidt: yeah, thank god for node, otherwise i'd still be relegated to bookmarklets.
[13:05] tbassetto has joined the channel
[13:06] charlesjolley has joined the channel
[13:07] micheil: jedschmidt: I think the best apps come from a polyglot of backgrounds
[13:07] mjijackson: jedschmidt: cool. i don't mean to sound negative btw. (fab) is a really creative piece of work. a really interesting way of looking at the whole issue of creating web apps
[13:08] jedschmidt: mjijackson: ha, no sweat. i'm looking forward to getting things stable so i can build my own stuff on it.
[13:11] davidsklar has joined the channel
[13:11] micheil: jedschmidt: I have to say, it's very.. unconventional
[13:11] micheil: jedschmidt: how would you handle complex actions within fab?
[13:12] jedschmidt: micheil: like what?
[13:12] jedschmidt: micheil: (the idea being that any complex action can be split into smaller parts...)
[13:12] micheil: well, something that interacts with a database, uses a cookie for a session and then renders a template to a user?
[13:13] micheil: traditionally you'd stick that all in one method call
[13:13] micheil: is the idea in fab to break that all into small parts (which may also have a negative effect due to emitters)
[13:14] jedschmidt: micheil: well, cookie would be a binary app. reads the cookie header, adds any relevant info to the head, and passes it upstream.
[13:14] micheil: okay
[13:14] jedschmidt: micheil: database is a unary app that queries the database based on the contents of the head/body
[13:15] micheil: database would probably be binary or ternary
[13:15] benoitc: mmm wher i'm wrong here http://friendpaste.com/IcRtbHFhXTqeBruu5x0Na the update_config is always called after first change to the file :/
[13:15] micheil: oh, okay
[13:15] jedschmidt: template is an n-ary app that turns the database response into a stream that's sent back to the client.
[13:16] micheil: benoitc: that would be correct
[13:16] micheil: jedschmidt: you'll be yet to convince me on how it works, I'll go back to the slides
[13:17] benoitc: hum so i don't know why the update is always called mmm maybe it's due to osx
[13:17] pavelz has joined the channel
[13:20] ssteinerX has joined the channel
[13:21] micheil: jedschmidt: do one thing and do it really well aproach?
[13:22] jedschmidt: micheil: yeah, i'm trying to keep things isolated so that they're predictable and easy to test.
[13:22] micheil: okay
[13:23] jedschmidt: aight, time to head home. drop a line if you have any questions, jah?
[13:23] jedschmidt has left the channel
[13:23] micheil: so in the case of the regex one, (^/home$) that just tests if req.url.match() the regex?
[13:23] micheil: oh
[13:28] jherdman has joined the channel
[13:28] Tim_Smart has joined the channel
[13:32] javajunky has joined the channel
[13:41] phiggins has joined the channel
[13:45] augustl has joined the channel
[13:46] augustl: is there a generic header parser for http-like headers? Implementing websocket, need to read headers, don't want to reinvent the wheel.
[13:48] quirkey has joined the channel
[13:49] mrjjwright has joined the channel
[13:52] robinduckett: @augustl headers.split(/([\w-_]+):\s?(.*)/g)
[13:52] robinduckett: :P
[13:53] robrighter has joined the channel
[13:53] robrighter has left the channel
[13:54] micheil: augustl: implement them on top of node's http module, I have had patches added to node to allow doing this
[13:54] micheil: augustl: btw, make sure you do websockets' to the spec if you're doing them, otherwise you'll run into issues
[13:55] mjijackson: augustl: http headers are a complex problem to solve correctly. i'm not aware of any js library that has tackled it
[13:55] felixge has joined the channel
[13:56] augustl: mjijackson: really? I thought they were just /^([^:]+):(.+)$/ :)
[13:57] augustl: micheil: currently reverse engineering it by hitting f5 in chrome, heh
[13:57] micheil: augustl: no, there is a specification, use it. It's there to help
[13:57] mjijackson: augustl: :O wow! you just solved it! right on. ;)
[13:58] robinduckett: I SOLVED IT FIRST
[13:58] robinduckett: HATEZ:(
[13:58] micheil: this is the one currently implemented in chrome: http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-75
[13:58] micheil: augustl: as for doing http header parsing, use the http library.
[13:58] augustl: mjijackson: out of curiosity, what else is there?
[13:58] micheil: augustl: then you just need to listen to the server event "upgrade"
[13:59] mjijackson: micheil: the http lib will only help with chunking the response into headers and body
[13:59] micheil: being that you'll probably implement the chrome version (draft75), then you don't need to worry about the argument that the upgrade event comes with
[13:59] micheil: mjijackson: no, it won't.
[13:59] micheil: ACTION wrote the patches to do this, I think I know about it. >_>
[14:00] mjijackson: augustl: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
[14:00] mjijackson: micheil: you mean node has support for all http headers?
[14:00] micheil: yes
[14:00] micheil: it has a http parser that is extremely fast
[14:00] micheil: and unless there an untested fringe case that breaks it handles all http headers.
[14:01] micheil: it's called http_parser, it's written in C
[14:01] micheil: it's in ry's github repo.
[14:01] micheil: _ry: ping?
[14:02] mjijackson: micheil: i think we're talking about two different things.
[14:02] micheil: augustl: one second, I'll find you the example websocket server using the upgrade event, there's also one in test/simple/http-upgrade.js
[14:02] micheil: mjijackson: how?
[14:03] mjijackson: micheil: i'm talking about actually *interpreting* the headers. you're talking about parsing them into field/value, right?
[14:03] micheil: http://gist.github.com/389202
[14:03] micheil: that is how you should be implementing a websocket server in node
[14:04] micheil: mjijackson: interpreting the values is left to you, unless it is a upgrade header, in which case node will stop after it parses the first packet (headers + possible body), then it'll unattach the ondata handlers on the stream, and leave it to you to reattach
[14:04] mjijackson: micheil: for example, the correct interpretation of an Accept header can be tricky to get right.
[14:05] micheil: mjijackson: it's up to your handler to interpret the Accept header.
[14:05] micheil: that will be in the req.headers object
[14:05] micheil: so, req.headers.accept
[14:06] mjijackson: right. that's what i mean. there's no lib for parsing/interpreting the actual header values. just for parsing them into req.headers. once they're in req.headers though there's still a lot of parsing to be done for some of them.
[14:06] mjijackson: that's all i was trying to say
[14:06] augustl: micheil: wow, tnx for that paste
[14:06] mjijackson: of course, for a websocket server the current support should be sufficient
[14:06] micheil: augustl: no worries.
[14:06] augustl: upgrade event looks nice
[14:07] micheil: mjijackson: there is for the upgrade headers
[14:07] micheil: and that's what should be used.
[14:07] augustl: so if the upgrade header is set, the upgrade event fires instead of the data event?
[14:07] micheil: augustl: it's not placed within the createServer()
[14:07] micheil: it's attached to the server, like server.listen()
[14:07] augustl: ah, that websocket implementation is using a http server as it's base server, not a raw socket.
[14:07] micheil: server.addListener("upgrade", function(){...});
[14:08] micheil: yes
[14:08] micheil: then you have access to the raw socket on the req that is passed down the upgrade event
[14:08] micheil: req in the context of upgrade is the same as the context of request
[14:09] micheil: in http.createServer the function you pass into that is actually just added as a listener to the request event
[14:10] riottaba has joined the channel
[14:10] sztanpet has joined the channel
[14:11] micheil: augustl: if you look in /test/simple/test-http-upgrade.js and test-http-upgrade2.js, you can see the upgrade event in more useful action
[14:11] micheil: (a slight partial of the websocket server implementation, actually, as it's a practical test case)
[14:13] kevwil has joined the channel
[14:13] micheil: augustl: if you don't want to implement a websocket server, I do actually have an implementation, but it does have bugs
[14:15] ineation has joined the channel
[14:15] ineation has left the channel
[14:15] ineation has joined the channel
[14:15] gf3 has joined the channel
[14:24] augustl: micheil: I would like to write my own to learn, but thanks anyway :)
[14:24] micheil: okay, no worries :)
[14:24] augustl: I would really like a low level websocket lib, though, the ones I've found are a bit too magic..
[14:24] micheil: use it as reference, it's opensource.
[14:24] augustl: like, as low level as the http and net lib bundled in node
[14:25] micheil: http://github.com/miksago/node-websocket-server/tree/development
[14:25] micheil: I'm trying to make mine a bit low-level, but also containing higher level concepts
[14:31] ceej has joined the channel
[14:32] augustl: nice
[14:32] Yuffster has joined the channel
[14:34] micheil: but yeah, it's a little broken
[14:34] micheil: I've had some issues with writable streams and such
[14:34] augustl: tnx for all the input :)
[14:34] augustl: got to go, later
[14:35] micheil: no worries, opensource is for sharing.
[14:35] augustl: :)
[14:37] bweaver has joined the channel
[14:46] paul__ has joined the channel
[14:46] tlrobinson_ has joined the channel
[14:51] robindu has joined the channel
[14:53] screen-x has joined the channel
[14:57] charlesjolley has joined the channel
[15:00] charlesjolley_ has joined the channel
[15:00] cerberos has joined the channel
[15:04] javajunky has joined the channel
[15:05] technoweenie has joined the channel
[15:05] qFox has joined the channel
[15:13] paul__ has joined the channel
[15:13] riottaba_ has joined the channel
[15:13] ineation has joined the channel
[15:14] kloeri has joined the channel
[15:18] ineation has joined the channel
[15:20] nefD has joined the channel
[15:22] riottaba has joined the channel
[15:29] bigwavejake has joined the channel
[15:32] bigwavejake: i'm new to node.js and javascript. how would I scape a webpage with node.js?
[15:33] bigwavejake: *scrape
[15:34] bigwavejake: how do I connect to a website and return the contents as a string?
[15:34] mape: bigwavejake: using a http client
[15:35] _ry: bigwavejake: there is an html parser out there
[15:35] _ry: you can load it up - manipulate it with dom
[15:35] mape: bigwavejake: http://nodejs.org/api.html#http-client-173
[15:35] qFox has joined the channel
[15:36] bigwavejake: i see now, in the docs
[15:36] bigwavejake: http.Client
[15:36] bigwavejake: ok
[15:36] bigwavejake: thanks!
[15:36] _ry: bigwavejake: http://github.com/tautologistics/node-htmlparser
[15:36] fernmicro has joined the channel
[15:37] bigwavejake: _ry, wow, awesome! thanks!
[15:38] _ry: bigwavejake: all this stuff is pretty new - expect a bit of pain :)
[15:38] _ry: bigwavejake: you might want to try this too http://github.com/tmpvar/jsdom
[15:39] sveisvei: pant™
[15:39] sveisvei: aff pain™
[15:43] batasrki has joined the channel
[15:45] _ry: anger. not sure what's wrong with idle watcher...
[15:47] mrjjwright has joined the channel
[15:47] micheil: shite. I have a feeling (Fab) is really growing on me.
[15:47] micheil: :D
[15:47] micheil: just wrote (/^\/index/, function(){}) in some frontend code..
[15:49] paul__ has joined the channel
[15:50] Marak has joined the channel
[15:51] _ry: micheil: how's websockets?
[15:51] micheil: busy working on a new frontend library
[15:51] felixge: _ry: http://github.com/felixge/node-formidable/blob/master/lib/formidable/multipart_parser.js#L203-212
[15:51] felixge: _ry: 16 mb / sec -> 400 mb / sec++ (depends on the length of the boundary string)
[15:51] felixge: _ry: thanks :)
[15:52] kriskowal has joined the channel
[15:52] gf3: rdrake: NO U
[15:52] gf3: felixge: got your streaming search working?
[15:53] felixge: gf3: yes :)
[15:53] felixge: gf3: took a while until I realized that using a simplified version of the algorithm was all I need
[15:53] felixge: basically I don't use boyer-moore to find the offset of the boundary, but just to skip data that does not have
[15:53] felixge: * not have it
[15:54] felixge: once I find some data that looks like it could contain a boundary, I switch over to my old byte-by-byte analysis
[15:54] gf3: felixge: hot. And you were able to obtain the performance you expected?
[15:54] felixge: it's not optimized for worst-case scenarios at all, but those are highly unlikely to contain with the binary data one would expect in big multipart messages
[15:55] felixge: gf3: yes!
[15:55] avidal: mmmm
[15:55] _ry: felixge: very good
[15:55] gf3: felixge: that's awesome
[15:55] JimBastard has joined the channel
[15:56] JimBastard: happy cake
[15:56] _ry: felixge: so i wonder if you can do better
[15:56] felixge: _ry: now I'm thinking about the API for this lib, and the more I think, the more I wish I could get this into node -> req.addListener('file', ...) would activate the machinery
[15:56] _ry: btw are you meaning mbyte or mbit?
[15:56] felixge: _ry: mbyte!
[15:56] felixge: _ry: it seems really plenty fast to me at this point : )
[15:57] _ry: okay
[15:57] _ry: nevermind then
[15:57] _ry: that's good :)
[15:57] _ry: i think there is another level of speed we could take it to
[15:57] JimBastard: hey guys i just read about node online on this blog and i was wondering if i could use node to build a website
[15:57] _ry: by doing the parsing in the thread pool
[15:57] _ry: and in parallel
[15:57] felixge: _ry: probably :)
[15:57] _ry: so that multiple uplaods would be parsed at the sametime
[15:58] felixge: _ry: I guess in terms of algorithm you won't get faster for the best-case, but you could optimize for worst-case a lot more
[15:58] nefD: wheee
[15:58] felixge: _ry: well, the uploads come in as very small chunks, so the parser is pretty much non-blocking / no?
[15:59] _ry: yes
[15:59] _ry: pretty much
[15:59] _ry: it might actually slow it down by going to the thread pool
[15:59] micheil: I think I may just have the beginnings of a Fab for frontend.
[15:59] _ry: there are costs involved with sending it out context switching, pulling it back
[15:59] felixge: _ry: anyway, how do you feel about req.addListener('file') / req.addListener('field')
[15:59] felixge: _ry: I think node should really support parsing form data nicely
[16:00] _ry: felixge: explain it to me - 'file' is for 'part' ?
[16:00] felixge: _ry: file is for 'file' parts
[16:00] _ry: what do the other parts look like?
[16:00] JimBastard: micheil: one day i hope to be smart enough to understand fab
[16:00] felixge: _ry: so it would probably return a file object which may have a file.streamToTmpFile() method
[16:00] _ry: x-form?
[16:00] micheil: JimBastard: check out the flickr slides
[16:00] felixge: _ry: The other parts are just strings
[16:00] JimBastard: ahaha i was there in person micheil
[16:00] felixge: _ry: So I think we should emit them as strings
[16:00] micheil: JimBastard: I did tonight, that's wheere I've learnt it
[16:00] micheil: JimBastard: oh
[16:01] _ry: felixge: buffer them?
[16:01] JimBastard: jed just makes everything seem so complicated, maybe its just me
[16:01] felixge: _ry: Yes. But only if a 'field' listener is attached
[16:01] _ry: felixge: okay
[16:01] felixge: _ry: and using a reasonable buffer size (4k) ?
[16:01] micheil: JimBastard: the slides help heaps. I've only just understood it, now I think it's awesome
[16:01] _ry: felixge: what sort of data might be in a 'field?
[16:02] JimBastard: i'll wait till there is a complex fab app i can walk through the code on
[16:02] felixge: _ry: .<
[16:17] JimBastard: one....commit....at...a..time...
[16:19] jedschmidt has joined the channel
[16:19] JimBastard: zzt looks like its gonna be cool though
[16:19] JimBastard: zztmmo
[16:19] JimBastard: if anyone wants to step up and do the websocket implementation let me know
[16:19] JimBastard: i think we gonna do websockets with a swf fall back
[16:19] _ry: felixge: you should make a little script to benchmark your parser - it'd be good for the builtbots
[16:20] _ry: like with a real http server and curl - or whatever you use
[16:20] felixge: _ry: http://github.com/felixge/node-formidable/blob/master/benchmark/bench-multipart-parser.js
[16:21] fizx has joined the channel
[16:21] _ry: cool
[16:21] felixge: _ry: I'd have to get rid of that custom assert.callbacks I'm using, but otherwise this should be ready to go :)
[16:21] fizx has joined the channel
[16:22] felixge: _ry: btw. I've tested with buffers as large as 1GB, node handles it really nicely - great job on the buffers stuff!
[16:22] _ry: the perf graphs are messed up at the moment
[16:22] _ry: but it want to start getting them displaying cool stuff
[16:23] stevendavie has joined the channel
[16:25] mjr_: _ry: does the OSX buildbot work?
[16:27] _ry: mm seems like it wasn't receving the latest commands
[16:27] _ry: but if i force a build it works
[16:28] _ry: arlo said there were some problems with the buildbots - he's going to work on it this weekend
[16:28] _ry: we could probably lose one of the linux bots
[16:28] mjr_: OK, just checking. I've barely looked at that machine. Just installed buildbot and walked away.
[16:28] _ry: it's building something now: http://buildbot.nodejs.org:8010/builders/OSX/builds/1
[16:31] saikat has joined the channel
[16:34] micheil: okay. building something that uses fab's syntax is hard. back to the original plan.
[16:34] JimBastard: LOL
[16:34] JimBastard: THAT WAS QUICK micheil
[16:35] micheil: JimBastard: let me rephrase: Building a framework that uses fab's syntax is hard
[16:35] JimBastard: hee hee
[16:35] micheil: framework being for the frontend
[16:37] JimBastard: im working on front-end frameworks for the next two months or so at work
[16:37] JimBastard: there might be an OS project behind it
[16:37] felixge: _ry: https://gist.github.com/ef6c15cc39f03d70b19b
[16:37] JimBastard: what kinda of front-end you working on
[16:37] felixge: anybody who cares about POST data / file uploads, take a look
[16:37] saikat: fictorial: so if i understand correctly, the issue was that even if the encoding is specified as "binary" as it was in my files, readFileSync returned a binary string instead of a buffer, and redis-client tried to write this binary string using utf-8?
[16:39] saikat: also, thanks for fixing that so fast =)
[16:39] bpot has joined the channel
[16:39] avidal: what's the coolest thing done with node.js so far
[16:40] mortens has joined the channel
[16:41] felixge_ has joined the channel
[16:41] felixge_ has joined the channel
[16:41] micheil: JimBastard: one that's sorta sammy, but less sammy, and more just organisation
[16:41] felixge_: _ry: headed out in a bit, any thoughts?
[16:41] micheil: JimBastard: just an idea I'm running with
[16:42] gwoo: felixge: what about using a similar object for "part" and "file"
[16:42] riottaba_ has joined the channel
[16:43] dgathright has joined the channel
[16:43] gwoo: felixge_: ^^
[16:44] felixge_: gwoo: why?
[16:44] gwoo: easier to remember
[16:44] gwoo: simpler callback
[16:44] TobiasFar has joined the channel
[16:45] javajunky: micheil: lolz… I'd love fab to work, I love it in concept, I just fail whenever I want to do something with it ;)
[16:45] micheil: javajunky: this is sorta fab on the frontend, node in node.
[16:45] micheil: *not in node
[16:46] mjijackson: felixge_: that looks good. i like the amount of fine-grained control. most of the time people can use "file", but occasionally someone might want to use "part"
[16:46] fictorial: saikat: yes, correct. It seems that binary-encoded strings and Buffers will just lead to confusion, and binary should go away. But, I haven't thought through the implications of that.
[16:47] mjijackson has joined the channel
[16:47] qFox has joined the channel
[16:47] fictorial: In fact, it seems that fs.readFile is returning a Buffer as of yesterday's patches so there you go
[16:47] fictorial: (by default)
[16:48] _ry: felixge_: mkstemp(3) do we have binding for that?
[16:48] felixge_: _ry: no binding for this yet, but I have some time I can spend on all of this
[16:48] felixge_: _ry: and we could get away with doing this step by step
[16:48] felixge_: _ry: i.e. adding 'part' first
[16:49] felixge_: _ry: or just defaulting to '/tmp/xxxxxx' for now
[16:49] _ry: i don't think buffering the whole thing is a good diea
[16:49] _ry: or?
[16:49] felixge_: _ry: buffering what?
[16:49] _ry: req.addListener('fields', function(fields, files) {
[16:49] felixge_: _ry: I think it's what most people would use
[16:50] _ry: hmm
[16:50] felixge_: _ry: this is how PHP / Rails / etc. work (afaik?)
[16:50] _ry: req.setBuffersize(8 * 1024); // optional, default 1mb ?
[16:50] _ry: ^-- this can just be a member?
[16:51] kriskowal has joined the channel
[16:51] felixge_: _ry: yes, could just be a member
[16:51] felixge_: _ry: same for the tmpDir I guess
[16:51] felixge_: *uploadDir that is
[16:52] mediacoder has joined the channel
[16:52] charlesjolley has joined the channel
[16:53] felixge_: _ry: part would also have a part.toFile(path, cb) method I guess, which would be used internally as well
[16:53] mjijackson: felixge_: yes. from the PHP manual: "Files will, by default be stored in the server's default temporary directory, unless another location has been given with the http://www.php.net/manual/en/ini.core.php#ini.upload-tmp-dir directive in php.ini."
[16:53] felixge_: _ry: this way people can decide which parts to use / not on a case by case basis
[16:54] felixge_: but still get high-level awesomeness
[16:54] felixge_: mjijackson: yeah, I wasn't so sure for Ruby, PHP I know
[16:56] towski has joined the channel
[16:57] felixge_: _ry: https://gist.github.com/ef6c15cc39f03d70b19b <- updated
[16:58] felixge_: _ry: how do you feel about this in general? Worth pursuing?
[16:58] _ry: yeah
[16:58] _ry: seems okay
[16:58] _ry: i mean
[16:59] _ry: the part thing - i'd like it to just be a stream
[16:59] _ry: not have part.streamToFile(path, cb);
[16:59] saikat: fictorial: i was also thinking about what you said about ym problem yesterday (that i could use a stack to store the keys, and then just pop off the stack when the callbacks happen)
[16:59] saikat: but wouldn't that have a problem if the callbacks didn't happen in the reverse order in which they were made
[16:59] fermion has joined the channel
[16:59] saikat: which would occur if any one of the callbacks had any kind of delay (say redis is overtaxed)
[17:00] felixge_: _ry: fine with me
[17:00] felixge_: _ry: but it would need the additional properties
[17:00] fictorial: saikat: redis always responds in the same order as submitted commands per client, so really you'd want a queue
[17:00] felixge_: _ry: I guess name + headers at a minimum
[17:00] _ry: fictorial: same with bufferToString
[17:00] _ry: felixge_: yeah
[17:00] saikat: ah ok
[17:00] _ry: er
[17:00] fictorial: _ry: sorry?
[17:00] _ry: that was for felix
[17:00] saikat: thanks
[17:00] felixge_: _ry: ok, sounds good
[17:01] _ry: felixge_: so - let's just do the part interface now?
[17:01] felixge_: _ry: yeah
[17:01] _ry: ok
[17:01] felixge_: _ry: and I guess only support for multipart
[17:01] felixge_: _ry: but I also want to make the querystring module act as a non-blocking parser
[17:01] felixge_: * streaming-parser
[17:01] _ry: ah
[17:01] _ry: um okay
[17:01] riottaba has joined the channel
[17:01] felixge_: this interface should work for both content types
[17:01] _ry: it can be a separate thing though?
[17:02] felixge_: _ry: what do you mean by separate ?
[17:02] _ry: those x-www-form things don't get very long, do they?
[17:02] _ry: i mean - it's not really a mime message
[17:02] _ry: it'd require a different parser
[17:03] felixge_: _ry: yes, it would be a different parser
[17:03] _ry: but sure - making a querystring/x-www-form/cookie parser which streamed
[17:03] _ry: would be good
[17:03] HansInEffect has joined the channel
[17:03] _ry: as long as the degenerate case was just as fast :)
[17:03] steadicat has joined the channel
[17:04] felixge_: _ry: degenerate = buffering and then parsing?
[17:04] _ry: i'm sure 99.999% of cases you'll parse it in one go
[17:04] HansInEffect: Is it possible to do "require('../someOtherDir/file')?
[17:04] felixge_: Hnasyeah
[17:05] fermion: hey all — can anyone tell me definitively if there is or isn't a way to make express behave like Rails in development mode? i.e., reload models, etc. as well as views?
[17:05] _ry: i guess the one case is a x-www-form with textarea
[17:05] HansInEffect: felixge_: I'm getting an error message trying to do that :(
[17:05] _ry: could be a couple kb
[17:05] felixge_: _ry: right, when you get CMS systems with WYSIWYG editors those fields can get quite big
[17:05] felixge_: 500kb can happen easily
[17:05] _ry: i believe it
[17:05] felixge_: anything > 100kb seems worse streaming to me
[17:05] felixge_: :)
[17:05] _ry: 500kb seems a bi much
[17:06] HansInEffect: felixge_: NM I had the directory wrong. Just some user error
[17:06] felixge_: * worth
[17:06] _ry: agreed
[17:06] _ry: although that data basically gets buffered anyway
[17:06] _ry: after you parse it
[17:06] felixge_: _ry: yeah, I don't see a big need for it either
[17:06] _ry: if so, there isn't much point in streaming it
[17:06] felixge_: _ry: It's more about API consistency I guess
[17:07] teemow has joined the channel
[17:07] felixge_: If you name something 'field' people will expect it to work
[17:07] felixge_: regardless how the form is structured
[17:07] felixge_: even so I think most people will just use 'fields'
[17:07] _ry: felixge_: oh wait
[17:07] felixge_: because that is what they are used to from other environments
[17:07] _ry: i don't want this on the req object though
[17:07] felixge_: and it's actually efficient enough for 90% of all cases
[17:07] felixge_: _ry: ?
[17:07] _ry: or do i?
[17:07] felixge_: _ry: why not?
[17:07] felixge_: _ry: it seems very natural there
[17:08] _ry: i mean, seems like it could be a separate lib
[17:08] felixge_: _ry: and it doesn't mess with the other events
[17:08] felixge_: _ry: This is part of HTTP, it belongs there
[17:08] _ry: i suppose...
[17:09] _ry: i mean i totally expect express or geddy to give that sort of nice interface
[17:09] _ry: hmm
[17:09] felixge_: _ry: I'd like to be able to write basic web apps without express
[17:09] felixge_: and parsing a form is as basic as it gets
[17:10] felixge_: _ry: if you want node to get a big adoption, then users shouldn't have to manually require modules for parsing a form - even if they are in node -core
[17:10] felixge_: I mean we shouldn't go too high level
[17:10] felixge_: but parsing forms *IS* the web
[17:10] felixge_: at least the web 2.0
[17:10] felixge_: ;)
[17:10] _ry: well, i don't loading up this parser to affect my 'hello world' numbers
[17:11] _ry: hmm...
[17:11] felixge_: _ry: it wouldn't. The parser would hook into the 'data' event only when you add a listener that requires it
[17:11] _ry: require('multipart').parseMessage(req)
[17:11] _ry: seems easy enough :)
[17:11] felixge_: _ry: similar to how you handle process signals right now
[17:11] felixge_: _ry: it looks easy because you didn't provide any interface ;)
[17:11] felixge_: _ry: and you expect your form to be multipart
[17:12] _ry: how do i know anyway if my req is multipart ?
[17:12] felixge_: People who use Rails/PHP may not even know what multipart uploads are
[17:12] _ry: in your interface?
[17:12] felixge_: they just know "form" -> $_POST + $_FILES
[17:12] felixge_: _ry: when you add the first listener it looks at the headers to determine it
[17:13] felixge_: _ry: this is the part where node should be easy for frontend developers, not Unix hackers :)
[17:13] fictorial: I got disconnected about 20x last night. Sorry to re-ask but is there / will there be support for UDP in Node.js?
[17:13] _ry: i agree it should be easy - i just don't want to complicated the interface too much
[17:14] _ry: the http server presents an interface at a certain level - the level of messages
[17:14] _ry: this is one level up
[17:14] felixge_: _ry: no, you already to chunked decoding
[17:14] felixge_: _ry: this isn't much different
[17:14] _ry: fictorial: eventually not for 0.2
[17:14] fictorial: _ry: ok, thanks
[17:14] _ry: s/eventually/eventually,/
[17:15] mjr_ has joined the channel
[17:15] fictorial: hehe -- first read that as "we're taking it out for 0.2" :)
[17:15] _ry: felixge_: chunked encoding is part of understanding the message length
[17:15] _ry: it's not payload
[17:15] felixge_: _ry: 99% of all messages (that have a body) will be multipart or form-data
[17:15] felixge_: _ry: how much is your abstraction worth if it fails to match reality?
[17:16] _ry: felixge_: for web app, yes
[17:16] felixge_: ;)
[17:16] felixge_: _ry: what other apps use http?
[17:16] _ry: rest apps
[17:16] _ry: i mean - we don't parse the url either
[17:17] felixge_: _ry: that's just because we want to be fast for hello world ;)
[17:17] _ry: but it also make sense - it's a different layer
[17:17] charlesjolley_ has joined the channel
[17:17] _ry: the 'http' lib lets you know the string in that spot
[17:17] javajunky has joined the channel
[17:17] _ry: but it doesn't help you understand it
[17:17] _ry: it gives you payload - but it doesn't parse it for you
[17:18] felixge_: _ry: I mean I absolutely agree with you on a theoretic level. But besides node, my favorite library ever is named jQuery. So when I ask myself "what would jQuery do?", then the answer is clear :)
[17:19] _ry: now - i think that's debatable whether it's the right approach
[17:19] _ry: but i think that's the status quo
[17:19] _ry: felixge_: also i might want to parse mime messages
[17:20] _ry: theoretically your parser could be used for those
[17:20] felixge_: _ry: the parser would be a module of its own
[17:20] trop has joined the channel
[17:20] felixge_: (even so right now it doesn't support nested multipart, isaacs would probably happily hack that in)
[17:20] _ry: (parsing mime would be great - and probably would introduce a whole new set of concerns)
[17:21] felixge_: anyway, the alternative would be a