[00:00] killfill: oh sorry, never mind [00:00] killfill: its utils now.. :P [00:01] jesusabdullah: I see [00:02] jchris has joined the channel [00:03] elijah-mbp has joined the channel [00:04] naturalethic: severla: well you can see that body is being parsed differently -- so it's either in your bodyDecoder, or in the client library you are using [00:05] kschzt: technoweenie, true; zk is custom replicated stuff [00:05] technoweenie: it looks a little heavy duty [00:05] technoweenie: but i'm sure it kicks ass [00:05] kschzt: yes [00:05] kschzt: what I don't like about it is that the cluster doesn't grow without you touching the goddamn xml :) [00:06] kschzt: so you can't announce a new node [00:07] rikarends has joined the channel [00:07] rikarends: released: http://ajaxorg.posterous.com/canvas-api-for-nodejs [00:07] kschzt: for this very essential root service, I am setting it up in node with mongo now with an elb/ec2 setup [00:07] kschzt: the nodes go, where is my db? and get the currently alive nodes with that service [00:09] kschzt: every time they connect. very simple. no lock service or anything, I just needed that for now [00:09] cloudhead has joined the channel [00:09] technoweenie: yea, we use redis for that [00:10] kschzt: don't actually think zk has too much future outside of JVM, and after that dies ... [00:12] kschzt: technoweenie, yeah, that works. for this discovery service it never gets very loaded [00:13] tj: ryah_: I was going a more complex route with Error.prepareStackTrace to expose the frames [00:13] tj: but this is much easier https://gist.github.com/661929 [00:13] tj: although more of a hack [00:14] rcy has joined the channel [00:14] kschzt: EyePulp, are your clients not able to heartbeat every 20s or something like that? the hb must be sent every 20s, otherwise the server kicks them out. [00:15] EyePulp: kschzt: I'm not aware of a reason they *can't* hb - it's all locally running on my dev laptop... [00:15] kschzt: eyepulp, perhaps they are stuck doing something else, not being able to hb? [00:16] EyePulp: you raise an interesting point - I did have some disconnect code checking on intervals - 15seconds or so. but I took that out (which has made things last longer before disconnecting) [00:16] kschzt: eyepulp, most of my socket.io connection failures turn out to be that [00:17] EyePulp: but I still seem to have a problem where it's sitting and doing nothing after it connects successfully (no message passing at all) and it disconnects. [00:17] mjr_ has joined the channel [00:18] EyePulp: kschzt: I'm curious what will block the HB from occurring/succeeding [00:18] EyePulp: Or I get the 200 Aborted message, after which it disconnects [00:21] kschzt: another one is that you accidentally redraw over the flashsocket div in firefox [00:21] kschzt: 200 Aborted? huh/ [00:23] kschzt: https://github.com/rocketpack you could also try this slightly out of date stuff Guillermo refuses to merge that we use, with transport fallbacks and proper status code handling :) [00:23] Tprice: anyone used https://github.com/polotek/libxmljs [00:24] Tprice: i cant get it to install [00:25] Tprice: i do "make libxmljs.node" but i get "make: *** No rule to make target `libxmljs.node'. Stop." [00:25] rauchg_: kschzt: [00:25] rauchg_: don't really refuse to merge [00:25] rauchg_: but we had transport fallback [00:25] tj: Tprice: it uses scons [00:25] rauchg_: :D [00:26] jbenesch has left the channel [00:26] cardona507 has joined the channel [00:26] kschzt: EyePulp, I'm curious too as to what your problem is, we probably also need to cover this problem [00:26] rauchg_: the problem is that it's one huge patch [00:26] jethro_ has joined the channel [00:27] tj: Tprice: read the readme :p [00:27] EyePulp: hey rauchg_ ... I'm just here whining about Socket. =) [00:27] rauchg_: kschzt: https://github.com/LearnBoost/Socket.IO/blob/master/lib/socket.js#L63 [00:27] sh1mmer has joined the channel [00:27] rauchg_: EyePulp: sup [00:27] mikeal has joined the channel [00:28] tanepiper: Server side canvas FTW! http://ajaxorg.posterous.com/canvas-api-for-nodejs [00:28] kschzt: rauchg_, it's not that huge actually [00:28] jesusabdullah: Sweet, it's out [00:28] SubStack: neat [00:29] Anti-X: you're out! [00:29] rikarends: now im tired :) [00:30] Anti-X: i'm definately out. 1:30... zzzz [00:30] jesusabdullah: nights [00:30] jesusabdullah: That looks pretty sweet [00:30] EyePulp: rauchg_: I know a lot of people are having great success with s.io, and it seems very good from the server side, but I seem to have very unpredictable connections on the client side (xhr-multipart transport). So I'm trying to figure out a whether I'm screwing up, or whether... well I just assume I'm screwing up. =) [00:30] jesusabdullah: Cute ide :v [00:31] tanepiper: have you not seen cloud9? [00:31] tanepiper: it's rather nice [00:31] jesusabdullah: I'd heard of it and all, even tried running it once [00:31] jesusabdullah: but not very hard [00:32] jesusabdullah: so I didn't get it Actually Working [00:32] rauchg_: EyePulp: there's a known issue with [00:32] rauchg_: multipart and large messages [00:32] rauchg_: which im gonna address as soon as i can [00:32] jesusabdullah: I think at the time I looked at it there were a lot of dependencies [00:32] rikarends: we just released an update [00:32] kschzt: rauchg_, the problem with the merge is that we both ended up implementing the same features :-) [00:32] rikarends: next release will be 'online' [00:32] rikarends: kinda odd to release cloud ide's offline now is it ;) [00:32] kschzt: rauchg_, which is a big failure in itself [00:33] rauchg_: kschzt: yep, but by the time i got the pull request i had written that feature :( [00:33] kschzt: exactly [00:33] EyePulp: rauchg_: this seems to be more of a disconnect over time, without any messages being passed [00:33] rauchg_: kschzt: all the others are welcome :) [00:34] scvrory: is there a better xml parsing tool for node than node-xml? i don't need the xml parsing to be asynchronous... [00:34] rikarends: node-o3-xml is a full DOM implementation [00:34] rikarends: in C [00:34] rikarends: its used in production so [00:34] Rld has joined the channel [00:34] rikarends: http://www.github.com/ajaxorg/node-o3-xml [00:35] rikarends: depends a bit what you want [00:35] kschzt: rauchg_, now we just need to check the transport fallback and the error handling is correct - no more iPhone loops because server said 502 [00:35] scvrory: well ideally i would love to use jquery to parse the xml [00:35] scvrory: or an elementtree implementation [00:35] kschzt: EyePulp, how can i reproduce your problem? [00:35] scvrory: since those are so much nicer to work with than DOM [00:36] rikarends: this thing is nearly identical to your browser DOM [00:36] rikarends: so you can run jquery XML on it [00:36] rikarends: and xpath [00:36] scvrory: ok, cool [00:36] saikat: is it possible to have wsbench not close connections? [00:36] saikat: or ab, for that matter [00:37] rikarends: scvrory: i havent actually tried running jquery xml on it, but its the standard DOM api so it technically should [00:37] EyePulp: kschzt: well... I've got a good bit of code, so I'd need to strip it down to a more useful core... [00:37] ryah_: tj: i really dislike getters and setters though [00:38] ryah_: the worst part of the langauge [00:38] ryan[WIN] has joined the channel [00:38] tj: ryah_: yup, but beats any pre-processing IMO [00:39] scvrory: rikarends: ok cool. so i take it there's no elementtree implementation? [00:39] tapwater has joined the channel [00:39] tj: ryah_: in reality though I dont think we need __line at all [00:39] ryah_: tj: pre-processing is ugly, agreed [00:39] rikarends: scvrory: not that i know of [00:39] ryah_: tj: i was going to go with __LINE__ to make it clear that it was being s///'d out [00:40] rikarends: scvrory: feel free to make one though :) [00:40] bentruyman has joined the channel [00:40] tj: ryah_: gotcha. hmm i dunno. what did that guy even want it for? [00:40] ryah_: debugging [00:40] ryah_: we do preprocess the lib/ folder currently [00:41] ryah_: to switch out assert() and debug() calls [00:41] ryah_: (they're only present in node_g) [00:41] ryah_: but it's an awful process [00:41] tj: ahh, I was wondering about those lol thought they were just stubbed out [00:41] kschzt: god damn Telecom Italia to hell, thank you, really bad service in Lazio [00:42] ryah_: tj: they're just turned into semi-colons, iirc [00:43] tj: ryah_: could use cpp for that stuff [00:43] tj: maybe [00:43] wilmoore has joined the channel [00:43] tj: might not be any better really [00:43] ryah_: tj: hm [00:43] tj: ive used it with some basic js [00:43] ryah_: i'm not sure cpp can parse js - also i wouldnt want this to get out of control :) [00:44] tj: haha yeah exactly [00:44] sideshowcoder has joined the channel [00:44] shaver: writing a pre-processor in JS wouldn't be too bad! [00:45] jashkenas: (it's not.) [00:45] rikarends: i dont think you wanna depend nodejs on nodejs :) [00:45] shaver: bootstrapping is a fine tradition [00:46] rikarends: its also annoying [00:46] Tprice: should i be writing object oriented or function oriented style code with node? [00:47] rikarends: whatever you want [00:47] rikarends: as long as you weave callbacks down to the IO layer [00:49] captain_morgan has joined the channel [00:52] rikarends has left the channel [00:52] jesusabdroolah has joined the channel [00:53] Me1000 has joined the channel [00:53] nsm has joined the channel [00:53] kschzt: EyePulp, sorry, where were we? [00:53] banjiewen_ has joined the channel [00:53] TomsB__ has joined the channel [00:54] EyePulp: kschzt: No worries - I'm trying to see if I can strip things down and still have them be usable for you to look through. [00:54] joeshaw has joined the channel [00:54] sechrist has joined the channel [00:56] MikhX has joined the channel [00:57] kschzt: EyePulp, great [00:57] TheEmpath has joined the channel [00:57] sechrist has joined the channel [00:57] sideshowcoder has joined the channel [00:57] sechrist has joined the channel [00:58] sechrist has joined the channel [00:59] sechrist has joined the channel [01:01] tapwater_ has joined the channel [01:01] sechrist has joined the channel [01:02] sechrist has joined the channel [01:05] dgathright_ has joined the channel [01:06] slickplaid: Quick question: Why is the 'client' object undefined in this function (in the disconnect)? http://pastebin.com/f17Ev6Zi [01:07] slickplaid: line 8 returns undefined [01:07] slickplaid: does the object get destroyed before that is called or immediately after before the callback? [01:07] slickplaid: ACTION is tired heh [01:07] sechrist has joined the channel [01:10] Yuffster has joined the channel [01:11] tanepiper: has anyone got debugging working in cloud9? [01:13] bencc has left the channel [01:13] mikeal has joined the channel [01:15] killfill: woot, cloud9 look greate [01:16] davidascher has joined the channel [01:16] zentoooo has joined the channel [01:16] kschzt: phew, again telecomitalia disconnected us. otherwise italy is awesome, but the telecoms (still) suck ass [01:16] mbrochh has joined the channel [01:16] mbrochh has joined the channel [01:16] markt has joined the channel [01:16] sechrist has joined the channel [01:17] scvrory: i like how o3-xml has missing semicolons... [01:18] sechrist has joined the channel [01:18] jakehow has joined the channel [01:25] kschzt: ok, Guillermo's not taking my patches was my bad. Until now. ;| [01:26] kevwil has joined the channel [01:26] dguttman_ has joined the channel [01:27] slickplaid: Quick question: Why is the 'client' object undefined in this function (in the disconnect)? http://pastebin.com/f17Ev6Zi [01:27] gsmcwhirter: is there a commonly-used well-supported mailer for node? [01:28] Aria: slickplaid: You're redefining client there with the parameter. Does disconnect have a parameter for the event? [01:28] kschzt: nice catch aria [01:29] slickplaid: In that anonymous callback function, client is undefined with or without function(client){} defined (function(){} also fails) [01:29] slickplaid: if that's what you mean, that is [01:30] Aria: That surprises me, but I don't know socket.io's API -- the above call works? (the on('message')) [01:31] slickplaid: Yeah, I can access the callback using client.whatever [01:31] Aria: Which callback? [01:31] Aria: The outer? [01:31] slickplaid: yeah the anon function [01:32] slickplaid: second parameter [01:32] Aria: You say that like there's only one. [01:32] Aria: Which second parameter of what? [01:32] slickplaid: sorry :D [01:32] Aria: There are three anonymous functions in this gist. [01:32] Aria: s/gist/paste/ [01:33] Aria: But the disconnect event has a parameter with the same name as the outer scope's client variable. [01:33] slickplaid: line 7, with and without including client in the function(here) it returns undefined [01:33] Aria: So if disconnect doesn't /have/ a parameter, you can't access the outer client. [01:33] Aria: which function(here) ? [01:33] Aria: Returns where? [01:33] slickplaid: line 7 [01:33] Aria: (there's no return anywhere in here) [01:34] Aria: I'm not sure where you're expecting something to be defined that's not -- line 8? [01:34] Aria: Is that the "return" you mean? [01:34] slickplaid: line 8 returns undefined, yeah sorry :D [01:35] Aria: Now that is odd, since there's nothing in there that could redefine client if you remove the parameter from disconnect. [01:35] slickplaid: Yeah, that's kinda my thought, too [01:35] slickplaid: i can't figure it out [01:35] Aria: Can you paste the code that should work, then? [01:36] slickplaid: works fine to call 'client' in the client.on('message', function(){ client.sessionId }); [01:36] slickplaid: but fails and returns undefined in the disconnect side [01:36] Aria: Without a parameter to the callback to disconnect? [01:36] slickplaid: sure [01:37] Aria: Now that is strange. Could you paste that? [01:37] slickplaid: yeah one sec [01:38] banjiewen has joined the channel [01:40] slickplaid: Aria: http://pastebin.com/QCcGBKh0 [01:40] davidascher has joined the channel [01:41] slickplaid: line 4, 11, 12, 13 work; line 17 fails [01:42] Aria: Okay, so the line that fails -- is it client that is undefined, or client.sessionId? [01:42] slickplaid: client returns undefined [01:42] trotter has joined the channel [01:42] slickplaid: sorry, i've mutilated the text trying to debug lol [01:42] slickplaid: s/text/code/ [01:42] Aria: Heh, yeah. Easy to do sometimes. [01:42] trotter has left the channel [01:43] Aria: if you change line 16 in that to console.log(client), it prints undefined? [01:43] mikeal has joined the channel [01:43] slickplaid: let me double check but yeah, last i checked it did [01:47] slickplaid: okay [01:47] slickplaid: console.log(client.sessionId); [01:47] slickplaid: if(users.user.hasOwnProperty(client.sessionId)) {} [01:47] slickplaid: the log returns the object correctly [01:48] slickplaid: but the if errs TypeError: Cannot call method 'hasOwnProperty' of undefined [01:49] tmpvar: level2/html === 100% passing! [01:49] Aria: WOOT! [01:49] Aria: Oh, slickplaid! That's entirely different! [01:50] slickplaid: yeah, it is [01:50] slickplaid: lol [01:50] tanepiper: tmpvar: DOM level 2 in jsdom? [01:50] Aria: That's not /client/ being undefined, that's users.user ;-) [01:50] slickplaid: been at this for about 14 hours now [01:50] slickplaid: prolly should go to bed [01:50] slickplaid: lol [01:51] tmpvar: tanepiper, yep! level2/html .. level2/core is at 56% as XML namespaces are horrible. [01:51] isaacs: coding marathons should on be done if you're having fun and don't have to actually produce anything. [01:51] isaacs: and then it's a rather gluttonous form of entertainment, energy-wise [01:52] isaacs: basically the spiritual/physical equivalent of setting one's car on fire. [01:52] isaacs: totally exciting and awesome, but not worth the cose. [01:52] isaacs: *cost [01:52] slickplaid: ah wow... i messed that up, completely calling the wrong method for that [01:52] slickplaid: ACTION facepalms [01:52] SubStack: I have been in a coding marathon for the past month [01:52] slickplaid: thanks for the help Aria :) [01:52] isaacs: slickplaid: go to sleep, man. [01:53] slickplaid: One. More. Line... :D [01:53] isaacs: whoaaaa, this is neat: https://chrome.google.com/extensions/detail/dbepggeogbaibhgnhhndojpepiihcmeb [01:54] tanepiper: server side canvas and now level 2 DOM [01:54] tanepiper: today is a good day for SSJS [01:58] tmpvar: TOTALS: 2190/3035 72% passing [01:58] tmpvar: getting there, haha [01:58] tmpvar: i bet i could marathon through the last 800 or so [01:58] tmpvar: :P [02:03] matt_c has joined the channel [02:03] isaacs: omg, srsly? 3 freaking random DNS errors in the last hour. [02:03] isaacs: whatever is going on with node's DNS stuff, it's breaking npm a lot. [02:10] derencius has joined the channel [02:11] indexzero has joined the channel [02:11] iszak has joined the channel [02:12] iszak: Spelling mistake under "net.Stream" with "This object is an abstraction of of a TCP or UNIX socket." [02:13] wilmoore has joined the channel [02:14] rkieffer has joined the channel [02:14] jesusabdroolah: of of? [02:15] iszak: yes? [02:16] iszak: seems wrong, or am I stupid? [02:16] Aria: It's wrong. [02:16] iszak: not so much spelling than structure. [02:16] rkieffer: hey gang, quick encoding question: If 'foo' is a string containing base64-encoded jpg image data, what's the 'correct' way to decode and write that data to disk? [02:17] rkieffer: fs.writeFileSync('foo.jpg', new Buffer(foo, 'base64'), 'utf8) ? [02:17] rkieffer: (that doesn't seem to be working - the resulting file doesn't parse as valid jpg.) [02:17] kschzt: whois iszak [02:18] benburkert has joined the channel [02:18] jashkenas: you probably don't want utf8, right? [02:18] jesusabdroolah: iszak: Yeah, I was thinking 'structure not spelling' so I wanted to make sure abstraction wasn't misspelled or something [02:18] jesusabdroolah: asbtraction [02:18] jesusabdroolah: :D [02:18] jethro_ has joined the channel [02:19] rkieffer: jashkenas: well, no - I want the raw binary data. but node.js docs say 'binary' is a deprecated format. :P [02:19] sh1mmer has joined the channel [02:20] bartt has joined the channel [02:21] jashkenas: is the default encoding binary? [02:22] shaver: default is utf8, I believe [02:22] jashkenas: what happens when you don't pass 'utf8' ? [02:22] shaver: utf8 [02:22] jesusabdroolah: is 'base64' a valid encoding? [02:22] shaver: that's what default means! :-0 [02:23] danielrmz has joined the channel [02:23] jesusabdroolah: shaver: nuh-uh! :| [02:23] cardona507 has joined the channel [02:23] shaver: pretty sure there's code in buffer.js that will prove me right! [02:24] kschzt: ok let's all think default is utf-8 and if not, i can crash your software by not using it. [02:24] rkieffer: Actually, fs.writeFileSync('foo.jpg', new Buffer(data, 'base64')) throws a bar arg exception. :P [02:25] rkieffer: fs.writeFileSync('foo.jpg', new Buffer(data, 'base64'), 'utf8') :P [02:25] rkieffer: hmm... just noticed I'm on node v.2.0. Wonder if that might be part of the problem? [02:26] jashkenas: perhaps ryah_ can comment. [02:27] robmason has joined the channel [02:27] Aria has joined the channel [02:28] rkieffer: *gah* bar arg -> bad arg ... getting exception either way. both with and w/out the 'utf8' arg to writeFileSync. [02:28] tmpvar: file not found? [02:29] tmpvar: lol. can't read [02:31] dannycoates has joined the channel [02:31] Aria has joined the channel [02:31] bpot has joined the channel [02:35] jgautier_ has joined the channel [02:35] TheEmpath has joined the channel [02:36] TheEmpath: hail nodies [02:36] TheEmpath: the only freenode chan where belligerents put up or shut up [02:36] TheEmpath: ACTION hugs the whole chan. [02:36] jjcm: ... [02:36] halfhalo: ACTION whips out the slappin trout [02:36] TheEmpath: <_< [02:37] TheEmpath: not on our first date [02:37] TheEmpath: sheesh [02:37] TheEmpath: no manners anymore [02:37] halfhalo: its all dem drugs man. DEM DRUGS [02:40] jgautier_: any git experts out there? [02:42] springmeyer has joined the channel [02:43] guybrush: jgautier_: just ask [02:43] jgautier_: im trying to get all the directories in this folder downloaded using git [02:43] jgautier_: https://github.com/ajaxorg/cloud9/tree/master/support/ [02:43] jgautier_: i have the "support" folder [02:43] jgautier_: but none of those linked folders [02:43] guybrush: right [02:43] guybrush: do `git submodule update --init` [02:44] jgautier_: swweet [02:44] jgautier_: kinda new to git [02:45] robmason has joined the channel [02:46] guybrush: you can clone with `git clone --recursive ` to do it automatically [02:47] jgautier_: oh ok cool [02:47] rkieffer: wierd... now running v0.3.0 and writeFileSync is hanging when I try to write this image buffer. :P [02:48] jchris has joined the channel [02:48] rkieffer: pegs the CPU. Wonder if it's stuck trying to interpret binary stream as utf8 string? [02:49] mjr_: rkieffer: that is a pretty common thing, accidentally converting a buffer into an expensive string. [02:49] rkieffer: mjr_: u see my original question, above? [02:50] rkieffer: this is not a big string/buffer. ~5-10K bytes. [02:50] mjr_: hmm. That's not good. [02:50] mjr_: Just for debugging, can you try to do the base64 conversion separately? [02:50] mjr_: instead of all on one line [02:50] rkieffer: yeah, putting together a test case. [02:51] mjr_: I've not used the buffer base64 stuff yet [02:51] robotarmy has joined the channel [02:52] mbrochh has joined the channel [02:52] mbrochh has joined the channel [02:53] jethro_ has joined the channel [02:58] mjr_: rkieffer: the thing I've seen that is similar to this is accidentally triggering inspect on a buffer. Inspect will generate a really large string out a ton of tiny parts that will grind your CPU for a long time. [02:59] mjr_: When it happens, I dunno if it is getting stuck or just taking a year, but I've never seen it make any progress. [03:00] cloudhead has joined the channel [03:01] pkrumins has joined the channel [03:04] aldosarmiento has joined the channel [03:05] muk_mb has joined the channel [03:08] mbrochh has joined the channel [03:08] mbrochh has joined the channel [03:11] tmpvar has joined the channel [03:12] ajpiano has joined the channel [03:13] rkieffer: Okay, here's a simplified test case: https://gist.github.com/662083 [03:14] willwhite has joined the channel [03:14] rkieffer: Data is uuencoded (via ruby's Base64.encode64) version of http://media.lawrence.com/img/profiles/2010/Mar/19/IMG_2028_s_jpg-1_r16x16.jpg [03:15] deepthawtz has joined the channel [03:16] severla: how do i remove/uninstall node? [03:16] Tprice: hey [03:16] jashkenas: Looks like the mysterious broofa beast in the wild... [03:16] mtodd has joined the channel [03:16] Tprice: so my js files are getting big [03:16] rkieffer: jashkenas: :) seldom seen. never heard. [03:16] Tprice: should i turn parts of it into modules? [03:20] rkieffer: So, it looks like the b64 buffer is the right size - it's length is the same as the original jpg file. [03:22] rkieffer: So how do I write a buffer to disk? writeFileSync hangs. [03:23] yeevgen has joined the channel [03:25] jashkenas: rkeiffer: I get a "Bad argument." on that as well. Node 0.2.4 [03:25] rkieffer: that goes away in 0.3.0 [03:27] dnolen_ has joined the channel [03:28] langworthy has joined the channel [03:29] ajsie: isnt it good to have a global application object in node.js? [03:29] TheEmpath: protip! [03:29] ajsie: or are all global objects bad [03:30] TheEmpath: if you extend array's prototype with a function like unique(), when you for loop through it, unique will be a key :( [03:30] TheEmpath: bad news bears! [03:30] Tprice: how should i call exports.somefunction from inside the module? [03:30] bentruyman has joined the channel [03:30] Tprice: this.somefunction? [03:31] Tprice: exports.somefunction? [03:31] shaver: exports.somefunction [03:31] shaver: is what I use [03:32] bentruyman: is module.exports the way to go now for exporting? [03:32] bentruyman: I haven't been keeping up on my commonjs [03:32] bentruyman: module.exports = exports = {}; .... [03:32] gsmcwhirter: that is what i use in 0.2.4. I think you can use just exports too [03:33] gsmcwhirter: you don't actually need to define it like that though [03:33] rkieffer: crap. does anyone here know how to write the raw data in a buffer to disk? Seems like it should be trivially easy... right? [03:33] tilgovi has joined the channel [03:33] bentruyman: gsmcwhirter: backwards compatibility? then again, this stuff changes so quick anyway [03:35] gsmcwhirter: bentruyman, *shrug* maybe. things change so quickly I haven't been worrying about much backward compatibility stuff though... I started in 0.2.0, so just using module.exports or exports directly has always worked for me [03:35] jashkenas: rkieffer: I'm doing it (raw image data) to an HTTP request, and that seems to work... (documentcloud.org/pixel.gif) but not to disk. [03:35] bentruyman: gsmcwhirter: heh, same here :-) [03:36] rkieffer: what's your res.write() look like? res.write(buf, 'utf8')? [03:36] gsmcwhirter: rkieffer, have you tried manually writing to a file descriptor w/ fs.writeSync ? [03:37] jashkenas: it's an older version of node ... but: pixel = fs.readFileSync __dirname + '/pixel.gif' [03:37] rkieffer: gsmcwhirter: nope, not yet. [03:37] jashkenas: res.end pixel [03:37] gsmcwhirter: rkieffer, not sure it will work, but might be worth a try [03:37] rkieffer: gsmcwhirter: I'll give it a whirl. [03:37] rkieffer: jashkenas: is pixel a Buffer or String? [03:38] jashkenas: rkieffer: full scoop: http://documentcloud.github.com/pixel-ping/docs/pixel-ping.html#section-9 [03:40] rkieffer: jashkenas: yeah, so I can serve the image by doing res.write(buf) (utf8 encoding I guess). [03:40] lakin has joined the channel [03:42] noahcampbell has joined the channel [03:42] masm has joined the channel [03:43] kriszyp_ has joined the channel [03:43] a_meteorite has joined the channel [03:45] Tprice: ok im going to do exports directly [03:46] iszak: How to break a forEach loop in Node.JS? [03:46] masahiroh has joined the channel [03:46] rkieffer: gsmcwhirter: writeSync is working - thx! [03:47] jethro_ has joined the channel [03:47] iszak: I thought "break;" but no nice. [03:47] tmpvar: return false ? [03:48] cce_ has joined the channel [03:54] path[l] has joined the channel [03:56] iszak: nothing. [03:56] unomi has joined the channel [03:56] gsmcwhirter: iszak, you could use a for loop instead perhaps. it is uglier, but it would let you break [03:57] shaver: throw [03:57] shaver: or use first [03:57] shaver: and return false until you want to stop, and then return true [03:57] shaver: could also do that with every, I guess [03:58] iszak: use first? :S [03:58] shaver: sorry, some [03:58] shaver: or every if you want to return true to continue, and false to end [03:59] shaver: myArray.every(function (v) { if (notDone) return true; return false; } ); [03:59] iszak: PERFECT [03:59] iszak: I think. [03:59] shaver: glad to know they please you [04:00] shaver: (I added them to JavaScript several years ago) [04:00] iszak: Basically I've got an array of IP addresses where I want to try and connect if not go to the next one - however how would I pass "true/false" to the loop from the event? [04:00] banjiewen has joined the channel [04:00] jashkenas: shaver: you work on SpiderMonkey? [04:00] shaver: oh, you want to do that asynchronously? [04:00] shaver: jashkenas: yeah [04:00] shaver: jashkenas: well, not much any more, but a little [04:00] shaver: I used to work on it more [04:01] jashkenas: shaver: thanks for those then -- glad at least a little of your work made it into ECMA5. [04:01] shaver: yeah, me too :-) [04:01] shaver: catchguards are coming back in harmony, too! [04:01] jashkenas: shaver: how about StopIteration then? You added that to FF, right? [04:01] shaver: I didn't, brendan did [04:02] shaver: I'm not sure that's how iterators will work in harmony; might use proxies instead [04:02] jashkenas: catchguards? link? [04:02] shaver: try { } catch (e if e instanceof SpecialError) { handleSpecialError(); } [04:02] shaver: not sure where it is on the ecma wiki [04:02] jashkenas: ahh, like most other langs ... nice. [04:02] shaver: that was in the ES3 proposal, when I was at Netscape, but MSFT made us cut it [04:02] shaver: because they hate freedom [04:02] jashkenas: not with the postfix if, though. [04:03] shaver: yeah, it's not just a type test [04:03] shaver: can do [04:03] rslifka has joined the channel [04:03] shaver: try { throw 5; } catch (e if e % 2 == 0) { handleEvenException(); } [04:03] shaver: or function calls, etc. [04:03] rslifka: anyone have experience with setuid? [04:03] jashkenas: seriously, postfix if? [04:03] rslifka: working on understanding how to run as non-root [04:03] rslifka: (on 80) [04:03] shaver: it was : at one point [04:03] jashkenas: you should add that to the rest of JS first... [04:03] shaver: it sort of matches array comprehensions [04:03] shaver: it's sugar, but useful sugar because it avoids needing to remember to rethrow [04:04] shaver: heh [04:09] evanmeagher has joined the channel [04:09] dannycoates has joined the channel [04:09] evanmeagher: what's the best way to deal with >1 optional arguments to a function? [04:09] evanmeagher: is it bad juju to require optional params to be packaged into an inline object? [04:10] gsmcwhirter: evanmeagher, if they are of different types, you can sorta handle it, though i don't know if it is really a "good" way [04:10] deepthawtz: JimBastard: checking out your gist... [04:10] evanmeagher: gsmcwhirter: in particular, i mean in situations where the last param is a callback [04:11] shaver: two function names [04:11] shaver: that wrap a common core [04:11] evanmeagher: it seems messy to do `if (typeof param == 'function') ...` for each optional arg [04:11] JimBastard: deepthawtz: its not ready [04:11] JimBastard: im not too happy with the API [04:12] deepthawtz: that's the part that takes the most thinking [04:12] ossareh has joined the channel [04:12] deepthawtz: it just got a lot easier to read though [04:12] deepthawtz: i like where you're going with it [04:12] yrashk has joined the channel [04:13] gsmcwhirter: evanmeagher, yeah. https://gist.github.com/662121 is how i tend to see it done, but it does get ugly [04:13] JimBastard: thanks! im gonna think on it for a few more days [14:13] frigg: VERSION [14:13] nodelog has joined the channel [14:14] hsuh has joined the channel [14:15] cferris has joined the channel [14:18] erlnoob has joined the channel [14:19] jamund_ has joined the channel [14:20] bentruyman has joined the channel [14:22] meandi has joined the channel [14:22] matt_c has joined the channel [14:24] fermion has joined the channel [14:25] EyePulp has joined the channel [14:25] margle has joined the channel [14:25] Nohryb has joined the channel [14:25] JohnDav: im getting undefined in req.body for a POST request [14:25] JohnDav: any ideas? [14:26] sivy has joined the channel [14:28] charlenopires has joined the channel [14:33] erlnoob: v8> 0.1 + 0.2 [14:33] v8bot: erlnoob: 0.30000000000000004 [14:34] erlnoob: anyone know a module that can handle arbitrary numerical values (e.g, PHP's bcmath) ? [14:35] omarkj has joined the channel [14:35] mif86 has joined the channel [14:37] Gurpartap has left the channel [14:38] mraleph: i am pretty sure there are v8 bindings for gmp [14:39] Utkarsh has joined the channel [14:39] figital has joined the channel [14:41] evanpro has joined the channel [14:44] derencius_ has joined the channel [14:44] Ori_P has joined the channel [14:46] jankoprowski has joined the channel [14:46] lgl has joined the channel [14:46] Anti-X: JohnDav, did you do what i said earlier? [14:47] Anti-X: req.body = '';req.on('data', function(chunk) {req.body += chunk});req.on('end', function() { continue here and use req.body to your heart's content [14:47] lgl: Hi! I'm trying to read a binary file, uploaded as multipart/form-data, and write it to a request (to upload it to Facebook). We're getting the data as a Buffer, and when we then do request.write(buffer, 'binary') it doesn't seem to be the correct data... Does anybody have any pointers? [14:47] robotarmy has joined the channel [14:48] JohnDav: Anti-X: got it! thanks [14:48] softdrink has joined the channel [14:49] mammut has joined the channel [14:49] aabt has joined the channel [14:49] daniellindsley has joined the channel [14:49] lgl: I'm using node-formidable, it just struck me that it might be the issue [14:50] Anti-X: lgl, buffer isn't the same as binary string, i think [14:50] Anti-X: ignore the encoding argument [14:51] Anti-X: just write(buffer) [14:51] lgl: Doesn't seem to matter, however as I read the source, that will default to ascii for the encoding (in http.js) [14:51] __mn__ has joined the channel [14:51] Anti-X: you need to specify null (or ignore) the encoding when reading the file [14:52] Anti-X: to actually make it a buffer [14:52] __mn__: any express experts in here? [14:52] stepheneb has joined the channel [15:00] lgl: __mn__: I've used it a bit, do you have a specific question? [15:00] JohnDav: Anti-X: is there a way to identify a client request by a unique session id or something ? [15:01] Anti-X: not unless you make it yourself [15:01] JohnDav: and i make the client send it with every request ? [15:01] Anti-X: npm install uuid [15:01] Anti-X: :P [15:01] JohnDav: or Math.floor(Math.random()*99999999999).toString() [15:01] JohnDav: :p [15:01] __mn__: yeah, I'm doing a dynamic auth via websockets, and I've gotten to the point where I req.session.user = message.email ... but how do I send it back without causing a page refresh? WHen I "res.redirect" inside of a socket... nothing happens client side. [15:01] Anti-X: then require('uuid').generate() [15:01] JohnDav: v8: Math.floor(Math.random()*99999999999).toString() [15:01] v8bot: JohnDav: "74602782003" [15:01] jamescarr: isnt there something that sends an object, functions and all, abck to the server? [15:02] JohnDav: v8: Math.floor(Math.random()*99999999999).toString() [15:02] v8bot: JohnDav: "3479201276" [15:02] __mn__: lgl: is this possible to do in Express? [15:02] podman has joined the channel [15:03] Anti-X: v8: {var:'value', func:function(){return false}}.toString() [15:03] v8bot: Anti-X: SyntaxError: Unexpected token : [15:03] Anti-X: v8: {var:'value', func: function(){return false}}.toString() [15:03] v8bot: Anti-X: SyntaxError: Unexpected token : [15:03] Anti-X: wot [15:04] tj has joined the channel [15:05] __mn__: I can't seem to bridge requests/response abilities between Express and websockets. [15:05] unomi has joined the channel [15:05] ajsie: JimBastard: you are there? [15:06] __mn__: which is really annoying, because for most everything I can use websockets, but for auth access I need to send normal http responses for the session. [15:06] danslo has joined the channel [15:06] podman has left the channel [15:08] Aria has joined the channel [15:10] Anti-X: v8: var elem = []; var obj = {name: 'value', func: function() {return false}}; for (key in obj) {elem.push(key + ':' + obj[key].toString())}; '{' + elem.join(',') + '}' [15:10] v8bot: Anti-X: "{name:value,func:function () {return false}}" [15:10] margle has joined the channel [15:11] tj: that canvas lib cant render a single one of my tests properly [15:11] tj: yikes [15:11] Anti-X: you need to lick it [15:16] deepthawtz has joined the channel [15:19] Me1000 has joined the channel [15:19] spetrea: can I write a multi-line string in node.js ? [15:19] halfhalo: yes [15:20] halfhalo: through the magic of \n [15:20] overra has joined the channel [15:20] gkatsev: or if you mean two lines in code, then just add a \ at the end or just close a string and use + [15:21] __mn__: anybody know how you can generate and send an HTTP response from Express without causing a page refresh? [15:21] __mn__: I need to send an HTTP response form websockets so I don't have the original "req,res" from the function. [15:22] Aria: Woot! I have a working IRCD written in Node. [15:22] Lorentz: Congrats [15:22] Anti-X: that makes you... third [15:23] Aria: Yeah? Nuts. My cursory look only found client libraries. [15:23] Anti-X: speaking of right tools for the job... [15:23] sixtus42: Aria: Ryan demoed one at jsconf 2009 [15:23] cyraxx: it seems that connection to socket.io opened from firefox via xhr-multipart never get closed correctly and just pile up in CLOSE_WAIT state. i've read somewhere that there was a bug that has been fixed in newer versions, but i'm running the very latest node from git and the very latest socket.io from git. [15:23] mtodd has joined the channel [15:23] Anti-X: a friend of mine wrote an irc bot in php [15:23] Aria: Oh, yeah, that one. I found that. [15:23] cyraxx: *connections [15:23] Aria: Hacky. [15:23] Aria: (Clever, though! It's small) [15:24] halfhalo: thats what she said [15:24] cyraxx: does anyone know what's up with that? [15:24] Anti-X: are you running the latest socket.io client? [15:24] Anti-X: not server [15:25] wilmoore has joined the channel [15:25] cyraxx: i guess so. i used the one that the latest socket.io-node delivered [15:27] EyePulp: cyraxx: how are you able to monitor the pileup of unclosed xhr-multipart connections? [15:27] EyePulp: ACTION has his own problems with socket.io [15:28] __mn__: can socket.io create a HTTP response and send it? [15:28] Anti-X: it does [15:28] Anti-X: if you're using xhr [15:28] EyePulp: __mn__: that's essentially what it does for non socket connections [15:28] Anti-X: well.. if IT's using xhr [15:28] EyePulp: er, web/flash socket [15:28] __mn__: if you're using any of the other options, can you generate an HTTP one regardless? [15:29] Anti-X: why would you [15:29] Anti-X: just disable websockets and flash sockets [15:29] __mn__: cause I can't handle authentication through sockets. I need to send a HTTP to update the session. [15:29] EyePulp: __mn__: just use jquery or any other library if you want to do normal http [15:29] Anti-X: __mn__ you know Js can set cookies too [15:29] EyePulp: __mn__: you can do auth via sockets. it's just message passing [15:29] cyraxx: EyePulp: well, first i saw that there are lots of CLOSE_WAIT connections to node from one ip. i then looked up in the webserver log which browser that ip was using and it was firefox. i then started up firefox on my machine, opened the website, reloaded it a few times (causing it to disconnect and reconnect) and i now see all the old CLOSE_WAIT connections from my ip. and there's a new one every time i reload again [15:30] __mn__: Anti-X: I did that before, but Express doesn't use cookies only, but adds a session to it. [15:30] isaacs has joined the channel [15:30] tj: __mn__: i believe there is a cookie-only session store out there as well [15:30] tj: if that is what you are looking for [15:30] cyraxx: whereas, if i do the same thing in chrome (using websockets) there's only one connection at a time, as it should be [15:30] mtodd has joined the channel [15:30] __mn__: so server-side I can update the "session.user" but I can't get the client to update it. [15:31] Anti-X: cyraxx, you should get rauchg_ to look at it when he comes in [15:31] __mn__: tj: is that more dangerous, security wise? [15:31] tj: yeah [15:31] tj: of course [15:31] Anti-X: that ff bug is annoying as crap [15:31] __mn__: tj: so how can I take advantage of sessions via sockets, or tell sockets to send a HTTP response with it? [15:32] tj: __mn__: couldnt tell you, I have not tried [15:32] __mn__: I tried using a dynamicHelper and adding a "response" into sockets, but it doesn't do anything when I "client.send()" [15:35] jchris has joined the channel [15:36] EyePulp: __mn__: what do you mean take advantage of sessions via sockets? why not just pass the session ID (stored in a cookie at the client) back with each send()? You can pass it as part of every data bundle, and then do a lookup on the serverside for every message received. [15:37] EyePulp: ACTION had to build all this out, so he's hoping there wasn't a magic hand-wavy method to do all this for him... [15:37] __mn__: EyePulp: the problem is when a user opens a new tab, or reloads the page. [15:37] Aria: Then they have the session ID, do a new send, and it still works. [15:37] bartt has joined the channel [15:37] EyePulp: __mn__: they still have a session cookie in that case [15:37] __mn__: EyePulp: They need to stay logged in, whether its via sockets or a new page. [15:38] __mn__: EyePulp: the same session ID? [15:38] jakehow has joined the channel [15:38] EyePulp: generate your own session cookie/uuid value [15:38] EyePulp: don't rely on socket's built in session id [15:38] EyePulp: since those connections might be... fragile [15:38] __mn__: EyePulp: I did that in my previous version of the app, but my friend told me to convert to Express for authentication, so I've been trying to use it. [15:38] EyePulp: __mn__: I see [15:39] __mn__: EyePulp: so creating another layer of cookies... would just counteract everything I did to use Express's built in session stuff. [15:39] Aria: So use as much of Express's session stuff as possible -- both client and server side. [15:40] __mn__: EyePulp: meaning I still don't have the same security as sessions, and it'd be pointless to use Express in the first place (as the only reason I'm using it is for auth). [15:40] Aria: Use that same session IDs. [15:40] __mn__: how do I force a new tab or a reload to use the same session ID as the previous tab or page? [15:40] __mn__: without generating my own new cookies, that is. [15:41] EyePulp: __mn__: I'm ignorant of express' session mechanism, but I'm aware of the fragility of xhr socket connections. [15:41] UHMA has joined the channel [15:41] jherdman has joined the channel [15:41] __mn__: EyePulp: its XHR, sockets, flash, or any of them. [15:42] __mn__: I need all of them, + normal HTTP reloads and new tabs, to all work together, with the same authenticity. [15:42] __mn__: or else there would be too many security vulnerabilities if I'm generating cookies for X method, and sessions for Y method, etc. [15:42] tj: __mn__: you dont really need express if you just have some auth stuff ... [15:43] tj: considering express has nothing to do with auth :p [15:43] __mn__: tj: they were cookie based though, and I assume using sessions is better? [15:43] ph^ has joined the channel [15:43] EyePulp: __mn__: if you rely on socket.io to maintain reliable identity for you, you're in trouble (at this point). You need to set an identifier of your own, (or let something else set it) and supply that value (I call mine uuid, because I'm so sneaky) with each socket send() [15:43] TomY has joined the channel [15:43] __mn__: EyePulp: Hmm, okay, so there is no way around it? [15:43] tj: __mn__: yeah you should never store anything of value in a cookie [15:44] jchris has joined the channel [15:44] __mn__: tj: I previously generated a random cookie value and had the client and server store it. Then each HTTP call the server would see if the client cookie for that username was equal to the server cookie. [15:45] bsstoner has joined the channel [15:45] EyePulp: I'd love to know another way, but this is, at the end, still a basic HTTP problem. And this is how every framework solves it. Set a unique identifier, and store all the details server side. [15:45] __mn__: every login, a new cookie would be generated on the server. [15:45] tj: lol [15:45] tj: yeah you dont want to trust the cookie [15:46] __mn__: tj: :P isn't that... essentially the same thing as what EyePulp is recommending also? (EyePulp: true, false?) [15:46] __mn__: cause it is still cookie based. [15:47] davidascher has joined the channel [15:47] EyePulp: __mn__: Other than SSL and unique session cookies (storing only a uuid) I'm not sure how one maintains state with HTTP. [15:48] EyePulp: (and ssl is just a little protection from prying eyes, not really germane to the inherent weakness of the system) [15:49] tj: __mn__: im just saying, assuming anything of importants from a cookie on the client side is a bad idea [15:49] EyePulp: tj: trusting a cookie is bad, but what is the alternative method to tracking state from a browser? [15:49] __mn__: meh, okay. We'll I'll just have to hack around it then. Thanks though. :) [15:50] EyePulp: or across HTTP ? [15:50] simme has joined the channel [15:50] ajpiano has joined the channel [15:51] EyePulp: ACTION would love to learn a better way. [15:51] kriszyp has joined the channel [15:52] caolanm: __mn__: you can encrypt and sign a cookie on the server before sending it to the client [15:52] Aria: "trusting" a cookie isn't always bad. You can sign them, to prevent tampering. Or it can be just a number in a hard to guess space (a random number from a big maximum) [15:52] caolanm: __mn__: see: https://github.com/caolan/cookie-sessions [15:52] __mn__: caolanm: thats what I was doing before, I believe. [15:52] caolanm: ah ok [15:53] caolanm: sorry I only scrolled back so far ;) [15:53] __mn__: caolanm: oh no, thanks a lot :) [15:54] marshall_law has joined the channel [15:54] __mn__: I'm trying another workaround now... [15:54] EyePulp: __mn__: see? cookies for identification, sent from the server. =) [15:55] __mn__: EyePulp: yeah, then I should've just stuck with that method originally. [15:56] Aria: Heh, yeah. "use express" isn't magic. It does the same stuff under the hood. [15:56] Aria: So unless the infrastructure there brings you something (and it well might), no need. [15:56] jankoprowski has joined the channel [15:57] EyePulp: __mn__: Though it's worthwhile to think carefully about *what* you store in a cookie. I stick with a simple generated pseudo uuid, and I'm tying that to records in a Session collection in mongo. [15:57] altamic_ has joined the channel [15:58] EyePulp: then I send the uuid as part of the json data each socket.io send() [15:58] Aria: That++ [15:58] v8bot: Aria has given a beer to That. That now has 1 beers. [15:58] Aria: v8bot-- [15:58] v8bot: Aria has taken a beer from v8bot. v8bot now has 6 beers. [15:58] __mn__: yeah, I'm gonna try have the client side simultaneously send both socket and post, so that way server side I can receive the post and update the session for the HTTP and then update it for sockets also. [15:58] EyePulp: __mn__: what? [15:59] __mn__: upon login, have the client send two requests, one via socket.io and one via post. [15:59] EyePulp: you're making it sound wayyyy harder than it needs to be [15:59] __mn__: eh, probably, but at least it'll be doubly secure then :P [15:59] EyePulp: no, it's twice as many ways to screw it up. =P [15:59] __mn__: lol! [15:59] EyePulp: =P [15:59] Aikar has joined the channel [16:00] __mn__: I'll let you know how it goes in a bit :P whether I fail. [16:00] EyePulp: is your socket connection wrapped in ssl? [16:00] __mn__: production will be [16:00] __mn__: the only issue is right now socket.io has a handshake problem with actual websockets [16:00] __mn__: all the other transports are fine. [16:01] Yuffster has joined the channel [16:01] __mn__: so other than getting an SSL for my server signed, and figuring out how to fix the ws:// || wss:// handshake issue, it will be. [16:01] wilmoore has joined the channel [16:01] Aria: Heh, EyePulp's actually right there. Twice as secure usually means doing less, not more. [16:02] EyePulp: don't double your workload needlessly. just start passing everything via your socket connection, and always tie a uuid on [16:02] __mn__: Aria: right, I agree. But then I won't have to be doing double checks after the login. [16:02] nolan_d: If you have an array that you need to finish processing with forEach before, say, a response is rendered, what's a good pattern to achieve that? [16:02] __mn__: because then I wo'nt need a UUID each time. [16:02] nolan_d: Does the forEach block such that you can render the response in the next tick? [16:03] EyePulp: you always want a uuid, and you want to check everytime something's sent in to validate the uuid. Just sayin... =) [16:03] Aria: nolan_d: The foreach is synchronous, yes. [16:03] __mn__: EyePulp: right, but then the server will automatically do it via Express for me. [16:04] nolan_d: OK, good. That's a lot less ugly than checking an index against array.length-1. :) [16:04] Aria: Or each time a socket is established, EyePulp. [16:04] cefn has left the channel [16:04] __mn__: Aria: yupe. [16:04] Aria: nolan_d: It takes some getting used to if you've used threads at all, but node only does one thing at a time. If you're in a foreach, then nothing else is happening. [16:04] bentruyman has joined the channel [16:05] EyePulp: Aria - I dunno about that - since the socket.io session ID is part of the url when using xhr based sockets, it makes me a bit leery of *not* constantly verifying the UUID [16:05] nolan_d: That's fine, this is an array of no more than 4 items, just validation errors I'm sending to flash. [16:05] nolan_d: So no major blocking concerns here. I just can't have the response rendering before I've written the errors. :) [16:05] Aria: Okay, yeah, I mean each ACTUAL socket. With XHR, that's every request. [16:06] EyePulp: socket hijacking seems trivial under anything but the best circumstances, at this point. [16:06] Aria: Yeah, you'll never run into something like that, nolan_d. Things that don't use a callback are synchronous. No surprises, no race conditions. [16:06] SamuraiJack_ has joined the channel [16:07] wilmoore has joined the channel [16:08] EyePulp: __mn__: I'd like to here how you end up doing this. I've just finished up the session/auth portion of an app, so I'm a bit bossy about the way I did it. Sorry about that. [16:08] EyePulp: s/here/hear [16:08] nolan_d: Well, doesn't forEach technically use a callback? If the function called with each array item isn't a callback then what is it? [16:08] femtoo has joined the channel [16:08] __mn__: EyePulp: Nah, bossyness is good, its an assertion of qualification. [16:08] EyePulp: hah - whether a legitimate assertion or not is... questionable [16:09] __mn__: EyePulp: I have a habbit of doing really weird things, and I'm not good with security yet... so I constantly look for advice. I like your solution... just don't want to send the UUID each socket :P [16:09] Aria: nolan_d: Okay, yeah, that's technically a callback (I forget forEach != for(x in y)) ... but it's a synchronous one. Not something node provides. [16:09] Aria: (It's a javascript thing, not a node thing) [16:10] Aria: __mn__: ... then how does it get authenticated? The connection is separate! [16:10] Aria: (Except XHR which inherits the browser stuff.) [16:10] EyePulp: __mn__: dude, the uuid is not a heavy burden on connections - it's the cheapest insurance you can buy. And if you're not on flashsockets or websockets, guess what - all your cookies are sent anyway. [16:11] Aria: Yeah. [16:11] __mn__: EyePulp: very true. [16:11] springmeyer has joined the channel [16:11] Aria: .oO(If you don't want something sent, then it shouldn't be in a cookie. not even once.) [16:11] Aria: If you're relying on something being sent "less often" as security, you're doing it wrong. [16:12] EyePulp: cookies are part of every heartbeat socket.io sends. and I'll guarantee you if you actually store *data* in your cookie, it's going to be a larger load. [16:12] mjr_ has joined the channel [16:12] __mn__: the main thing is just getting it sockets and Express auth to sync server side. [16:13] EyePulp: __mn__: use this method - if you find what you're doing hard, but it seems like a lot of other people have somehow managed to do it, there's probably an easier way to do it. Don't fight laziness - embrace it. [16:13] EyePulp: =) [16:13] __mn__: haha :D [16:14] jY has left the channel [16:14] EyePulp: here's a better question - why do all my xhr-multipart connections simply disconnect without cause after sitting idle for random lengths of time? [16:15] __mn__: hey yeah! my FF connection would just drop like a fly! [16:15] EyePulp: yeah, I'm on FF also [16:15] gwoo has joined the channel [16:15] EyePulp: maybe I should compare w/ chrome & safari [16:16] Aikar: hmm, best way to figure out why my compile failed? Configure passed all green. trying to compile 0.3.0. compile log of failure: http://aikar.co/fail.txt [16:20] __mn__: well, uh, here is an issue... I'm following Express' example auth [16:20] bsstoner has joined the channel [16:20] __mn__: where you req.session.user = user [16:20] __mn__: and then you res.redirect('back') or whatever [16:21] __mn__: and... its not even updating the session that way either? [16:22] eee_c has joined the channel [16:22] dysinger has joined the channel [16:22] __mn__: how do you send the session back? I thought res.redirect or res.send did that? [16:23] tj: __mn__: calls to writeHead() will commit the session data [16:25] sudoer has joined the channel [16:26] bpot has joined the channel [16:26] isaacs has joined the channel [16:26] aconbere has joined the channel [16:26] __mn__: thanks. [16:27] Aikar: anyone know why my compile failed? [16:28] isaacs: stephank: what'll mark the end of npm now? (got the alert from ircretary, but the log context is missing) [16:29] bartt has joined the channel [16:29] Aria has joined the channel [16:29] felixge has joined the channel [16:30] felixge: I'm getting segfaults on every test in node HEAD [16:30] felixge: OSX [16:30] felixge: anybody else as well? [16:31] mjr_: Aikar: are you updating from a previous version of node in the same dir? [16:31] Aikar: no [16:31] Aikar: looks like others are having the issue too on centos and cygwin, im on centos 5.3 [16:31] Aikar: looks like missing config.h for cygwin, maybe same for centos? [16:31] Aikar: http://groups.google.com/group/nodejs/browse_thread/thread/2d5eb964acba01c [16:32] Ari-Ugwu has joined the channel [16:32] felixge: is anybody else seeing those same errors when building head? https://gist.github.com/ac52ef05fa32ef26c326 [16:32] felixge: don't recall seeing them before, might be the segfault cause [16:32] mjr_: felixge: building on OSX now. Seems OK so far. [16:33] felixge: mjr_: cool. I'm rebuilding one more time as well [16:33] aldosarmiento has joined the channel [16:34] mjr_: Builds and tests fine for me. [16:34] mjr_: Not a clean build though, I merge in master about every day. [16:35] mjr_: Who knows what side effects the remnants of previous days has. [16:35] mraleph: scons went mad. never seen such errors before felixge [16:36] felixge: *sigh* [16:36] felixge: mjr_: still building [16:37] felixge: ok, this build seem good [16:37] felixge: I guess I didn't clean properly [16:37] felixge: the warnings still showed up [16:38] stephank: isaacs: Hah, well... There was a discussion about creating guidelines for code style, and somehow enforcing them on the NPM repository. [16:38] mjr_: That's annoying. [16:38] mjr_: Build systems take up so much time and energy. [16:38] felixge: yeah [16:38] felixge: Building software should no longer be a problem in 2010 [16:38] felixge: oh well, at least thanks to node we'll be able to write more Software than ever that doesn't need to be build [16:38] felixge: :) [16:38] mjr_: I've felt this way about every project I've ever worked on. [16:39] mjr_: Somebody ends up spending most of their time just fiddling with build systems. [16:39] ooooPsss: can I ping a website and get the response in node? [16:39] felixge: I wish node.js could be written in node.js :) [16:39] unomi has joined the channel [16:39] slickplaid: wow +1 to Cloud9 [16:39] felixge: ooooPsss: check HttpClient [16:40] mjr_: ooooPsss: ping like ICMP ping? [16:40] robmason has joined the channel [16:40] ooooPsss: mjr_: yes [16:40] stagas: ooooPsss: use spawn ping [16:40] felixge: stagas: +1 :) [16:40] mjr_: you need to shell out to do real icmp [16:40] slickplaid: or couldn't you just write the raw socket to emulate ping... [16:40] slickplaid: if you're got the time? [16:41] pgriess has joined the channel [16:41] felixge: ACTION gotta run [16:41] ooooPsss: I just want to check if the site is up or down. I'm doing it by getting the http status codes [16:41] felixge: mjr_: thanks for compiling with me [16:41] ooooPsss: maybe there's a better way? [16:41] stagas: ping won't tell you if it's up [16:42] slickplaid: httpclient, check the headers or go even lower level and use a socket to port 80 and parse the stream? [16:42] stephank: isaacs: Some context (TZ +0100), but I probably miss some as well, I was just joining: http://www.privatepaste.com/e4f752465b [16:42] stagas: you need to make sure it's not sending errors also [16:42] heavysixer has joined the channel [16:42] isaacs: stephank: oh, haha [16:43] isaacs: stephank: yeah, that kind of heavy-handed control would certainly not be javascriptlike [16:43] isaacs: JavaScript is Chaotic Neutral [16:43] stephank: Hah, that sounds about right [16:46] Gruni has joined the channel [16:47] noahcampbell has joined the channel [16:48] altamic_ has joined the channel [16:48] elijah-mbp has joined the channel [16:52] cagdas has joined the channel [16:53] mytrile has joined the channel [16:54] eee_c has joined the channel [16:54] prettyrobots has joined the channel [16:55] d0k has joined the channel [16:55] podman has joined the channel [16:55] davidascher has joined the channel [16:56] prettyrobots: How do you change NODE_PATH from within your program? [16:57] rauchg_ has joined the channel [16:57] amerine has joined the channel [16:57] isaacs: prettyrobots: require.paths.unshift("/some/absolute/path") [16:57] prettyrobots: Thank you. [16:58] isaacs: prettyrobots: or, i mean, you can set process.env.NODE_PATH, but at that point, it's too late, since the NODE_PATH env is read and parsed at startup time [17:01] prettyrobots: The former is what I want. [17:01] EyePulp: so no help in #javascript -- so let me bug you good folks for a moment...why can't I wrap console.log like this under chrome? http://pastie.textmate.org/private/vukxdsyuzrd61qviuttqg -- it doesn't seem to work. [17:02] benburkert has joined the channel [17:03] gsmcwhirter has joined the channel [17:04] hober: don't you want console.log.apply(console, arguments); ? [17:05] qFox has joined the channel [17:05] EyePulp: hober: yup - #javascript beat you by just a few seconds =) [17:05] EyePulp: but you're right [17:07] rasztasd has joined the channel [17:07] rasztasd has left the channel [17:13] robmason has joined the channel [17:14] __mn__: EyePulp: I got it to work. [17:14] EyePulp: __mn__: cool! what's it look like? [17:14] __mn__: the last half hour of it not working was because there was a res.send(200) before I even granted access. [17:15] __mn__: :P meaning I couldn't resend the 200 once I verified >.< ugggh [17:15] robotarmy has joined the channel [17:16] __mn__: basically, I have it login via a POST as normal, but this updates the socket's client session information [17:16] rikarends has joined the channel [17:16] __mn__: so the POST login I simply send(200) so it doesn't reload the page, then sockets sees the session.user [17:17] fangel has joined the channel [17:18] geronimo_ has joined the channel [17:18] jameshome has joined the channel [17:20] wilmoore has joined the channel [17:22] __mn__: but I'm using a shripadk's juggernaut version of socket.io for redis connection. It automatically handles most of the stuff for me, like keeping a memory of all the client's information. [17:22] heavysixer_ has joined the channel [17:23] siculars has joined the channel [17:23] unomi: whats the problem with nodejs vs node? [17:24] unomi: it doesn't seem as though the project will too readily apply to other languages [17:24] rikarends has left the channel [17:24] unomi: I don't really care, one way or the other, as long as the compile dependencies remain modest :p [17:25] unomi: but I am curious wrt to the motivation [17:26] heavysixer has joined the channel [17:26] jchris has joined the channel [17:28] slickplaid: has anyone done a gpg implementation in node? [17:28] langworthy has joined the channel [17:29] twoism has joined the channel [17:29] q_no has joined the channel [17:38] femtoo has joined the channel [17:39] Me1000 has joined the channel [17:40] Nohryb has joined the channel [17:41] fermion has joined the channel [17:42] __mn__: uh, node.js doesn't have setTimeout() ? [17:42] tj: yes it does [17:43] ben_alman has joined the channel [17:44] rwaldron has joined the channel [17:45] __mn__: console.log("test1"); [17:45] Aikar: anyone know why im failing to compile 0.3.0 on CentOS 5.3 - ./configure is all green lights. http://aikar.co/fail.txt [17:45] raja has joined the channel [17:45] __mn__: console.log("test1"); setTimeout('console.log("TEST2")',500); ... test1 gets printed, but not TEST2? [17:46] Aikar: i compiled 0.1.92 successfully a few months ago [17:46] Aikar: 98* [17:46] tj: __mn__: ew dont use a string lol [17:46] tj: setTimeout(function(){ ... }, 500); [17:46] __mn__: tj: thats how it is done in normal JS? ... oh, okay I'll do that then. [17:46] Aikar: yes __mn__ [17:47] Aikar: both work but function() { } is preferred [17:47] tj: you can use a function in browsers too... using a string is a nono in my books, I have never had a need for that [17:47] fangel: well - technically setTimeout allows for a string which is then eval'd.. but yeah, please dont.. :) [17:47] Aikar: as setTimeout('console.log("x")',500) is ugly lol [17:47] maushu: __mn__: For all that is holy and unholy, don't use strings. [17:47] __mn__: lol I was just going off of w3cschools :P [17:47] __mn__: **hides** [17:48] maushu: Everytime you use a string like that a kitten explodes. [17:48] Aikar: tutorials have a tendency to teach you nono's [17:48] slickplaid: mdc ftw? [17:48] mjr_: You found content on w3schools in the middle of all of those ads? [17:48] __mn__: NO!!! MUST SAVE KITTEN! [17:48] fangel: w3cschools actually have content? [17:48] Aikar: ever seen a php tutorial on mysql? lololol [17:48] softdrink: If anyone knows an awesome html/css/js interface guru in Utah, let me know. We're hiring. [17:48] JohnDav has joined the channel [17:49] maru_cc has joined the channel [17:49] deepthawtz has joined the channel [17:51] tmpvar has joined the channel [17:53] Aikar: anyone know the centos package name for libeio ? [17:54] mw_ has joined the channel [17:55] dguttman has joined the channel [17:56] Aikar: i tried the git copy and got this on configure https://gist.github.com/662858 [17:57] __mn__: Aikar: sorry I don't use centos :( [17:57] rnewson has joined the channel [17:59] podman: afternoon [18:00] fangel has joined the channel [18:01] rikarends has joined the channel [18:02] podman: i'm building a large file uploader in node.js with a desktop client that does chunking, but i'm running into some CPU usage issues and I'm not sure exactly where the problem is occurring. anyone got a minute to help? [18:02] necrodearia has joined the channel [18:03] TheEnd2012 has joined the channel [18:03] javruben has joined the channel [18:04] femtooo has joined the channel [18:04] yeevgen has joined the channel [18:05] bpot has joined the channel [18:06] podman: it must be the buffers i'm creating :\ [18:08] podman: is the only way to get the body of a request on the end of the request to collect it on the data event [18:08] podman: ? [18:09] mraleph: podman: regarding CPU usage, have you tried to run v8 profiler? [18:09] podman: mraleph: nope. i'll look into that [18:10] podman: the only possibly CPU intensive thing i'm doing is calculating the crc32 of the file chunk… if i comment that out it doesn't make a difference [18:11] mraleph: well... if you allocate a lot of things GC might bite you [18:11] podman: true [18:11] mraleph: you can start node with --trace-gc to see how often gc happens [18:12] rikarends has joined the channel [18:12] niklasfi has joined the channel [18:12] podman: mraleph: this is what i think might be the problem: https://gist.github.com/c5ae112b696be3d790cd [18:13] mraleph: yeah, that looks like an expensive piece of code to me [18:13] dmcquay has joined the channel [18:13] podman: i'm not really sure how else do to that though [18:14] meandi2 has joined the channel [18:16] mraleph: unfortunately I do not use node, so I lack knowledge... can you just store chunk somewhere without copying it's contents? or node will reuse it for the next incoming piece? [18:16] mikeal has joined the channel [18:16] niklasfi: hello. i am currently trying to gasp js and node at the same time which appears challenging to me sometimes. however i am willing to learn and i need your help. http://dpaste.com/270453/ is my code. i want to iterate over all files in a folder and the subfolders. however for that i need to call readdir and then stat on every filename returned. in my function onReadDirReturn i call stat and on onStatReturn i want to print the filen [18:17] podman: mraleph: what are you doing here then? :) [18:18] mraleph: podman: you can also try to grow body buffer more aggressively to minimize number of copys, currently you create a new one on each next chunk... [18:18] mraleph: podman: helping people with v8 issues [18:19] podman: gotcha [18:19] podman: yeah, well, the body size might be different sizes, so i'm not sure if i want to make the buffer really big if it doesn't need to be [18:19] mraleph: well [18:19] mraleph: it's trading speed for space [18:20] mraleph: and vice versa [18:20] mraleph: another idea [18:20] stagas: niklasfi: 1st of all. localize all variables and functions using var. i,e var fs = require('fs') and var walktree = function(top, callback) etc.. [18:20] podman: well, i'll try making it as big as the file chunks i'm currently sending and see how that works [18:20] mraleph: it try to use rope like datastructure [18:20] danoyoung has left the channel [18:21] stagas: niklasfi: otherwise bad things happen [18:21] mraleph: podman: instead of having single buffer, have an array of buffers [18:21] mraleph: this will allow you to avoid copying prefix over and over again [18:22] mraleph: in any case [18:22] niklasfi: stagas: ok did that good to know i remembered from past work that there was something about var but i was not able to remember, wheter it is a synonym for 'public' or 'private' [18:22] mraleph: you first have to understand where precisely your bottleneck is ;-) [18:22] jetienne has joined the channel [18:22] stagas: niklasfi: and the for(var i in names) [18:22] gkatsev: niklasfi: not using var means the var becomes global. [18:22] podman: mraleph: so, then in the end create a new buffer the size of the sum of the sizes of the array of buffers and write them all into the new buffer? [18:23] jchris has joined the channel [18:23] mraleph: well that depends on what you want to do with them later... but something like this, yes [18:23] yeevgen has joined the channel [18:23] rikarends: tj: are you around? [18:24] tj: rikarends: kinda [18:24] tj: busy, but yes [18:24] podman: mraleph: well, i first check that the chunk is valid using a crc32 check and then append it to a file on the server [18:24] rikarends: tj: saw your comments on those tests, can i run them? :) [18:25] mraleph: I think you just have to teach you functions to work with rope-style datastructure instead of buffers... [18:26] podman: gotcha [18:26] podman: reading on wikipedia [18:27] podman: O(1) on concatenation... [18:27] bradleymeck has joined the channel [18:30] mraleph: podman: for starters I would go with array of buffers instead of binary tree of buffers. [18:30] podman: i'm trying that now [18:32] rikarends has left the channel [18:33] wilmoore has joined the channel [18:33] ezmobius_ has joined the channel [18:33] stephank has joined the channel [18:36] rikarends has joined the channel [18:36] mikedeboer has joined the channel [18:37] jherdman has joined the channel [18:39] javruben2 has joined the channel [18:40] jfd1 has joined the channel [18:41] podman: bah, i guess i have to do this recursively :\ [18:41] wilmoore has joined the channel [18:42] mraleph: podman: what? [18:42] javruben has joined the channel [18:42] rikarends has joined the channel [18:43] podman: writing the array of chunks out to a file [18:43] niklasfi has joined the channel [18:44] mraleph: why not simple loop? [18:45] podman: i'll try that, but i'm not sure that'll work [18:45] podman: because it's async [18:45] mraleph: there is nothing recursive about array of chunks --- it's purely linear structure. [18:45] podman: and maybe it'll get out of order [18:45] mraleph: it should not. [18:46] podman: i could do the writing synchronously [18:47] mikeal: what did i do? [18:49] MikhX has joined the channel [18:51] agnat has joined the channel [18:51] Aikar: hmm, howcome with the default httpd example on the homepage of nodejs.org the function is being called twice? i added a console.log to it and im seeing it printed twice [18:51] podman: mraleph: well, after all of that, i'm not sure that is even the problem. [18:52] mraleph: podman: that's why I suggested profiling in the first place ;-) [18:52] podman: :) [18:52] podman: yeah, it's doing a ton of GC [18:53] claudiu__ has joined the channel [18:53] podman: pretty much for each request [18:53] gsmcwhirter has joined the channel [18:54] mraleph: rope structure can probably help you there. [18:55] mraleph: well it would be at least better than what you have now :-) [18:55] podman: i'm wondering what it's marking for GC… probably the array of chunk buffers :) [18:56] hassox has joined the channel [18:57] mraleph: podman: what do you mean? there are tons of alive objects in the heap at any given moment... [18:57] podman: actually, so it's scavenging about twice per request and mark-sweeping like every 5 requests [18:58] mraleph: that is not so bad... [18:58] mraleph: still [18:58] Aikar: figured it out, the 2nd quest is for favicon.ico [18:58] mraleph: you can probably minimize number of mark-sweeps. [18:58] podman: but, since i'm uploading a file in chunks there are tons of request a second. [18:58] mraleph: ouch [18:59] mraleph: that does not sound good :-) [18:59] podman: and then when i put it out into the world, there will be thousands (hopefully) [18:59] banjiewen has joined the channel [18:59] mraleph: big bada boom [18:59] delapouite has joined the channel [18:59] podman: ha [19:00] mAritz: isaacs: hey, is there a way to keep an installed npm package at a specific version? because the update for conductor severely changed everything and my stuff doesn't work with the new version. (and since there is no documentation on the new version, i'm not going to switch) [19:00] mraleph: hopefully we'll manage to make GC faster by that point... and ryah_ will improve buffer management on his side. [19:00] isaacs: mAritz: yeah, just specify a version in your package.json [19:00] podman: so, i'm starting to wonder if there is a better way to do this [19:00] mAritz: i did, it still updated :/ [19:01] isaacs: mAritz: { "dependencies" : { "conductor" : "1.2.3" }}, and then in your code: "require('conductor')" [19:01] podman: wondering if something like eventmachine might be better. [19:01] faust45_ has joined the channel [19:01] TheEmpath has joined the channel [19:01] mAritz: isaacs: not "conductor": "=0.1.0" ? [19:01] isaacs: mAritz: or that. the = is just ignored, though [19:01] mraleph: I would shoot for aggressive buffer growth and buffers reuse. but I am not sure :-) [19:02] podman: mraleph: well, i tried the buffer of buffers [19:02] podman: well, array of buffers [19:02] mAritz: isaacs[lunch]: nope, still updates it. :( [19:02] podman: that made zero difference [19:02] podman: well, it might have, that's not true… but nothing noticeable [19:02] mraleph: that should have made at least some difference [19:02] podman: it's still using 100% of one core [19:03] mif86 has joined the channel [19:06] jankoprowski has joined the channel [19:07] niklasfi: could someone please have another look at my code at http://dpaste.com/270484/ ant tell me how to get line 21 to work so that i get all filenames of files in all subfolders? (sorry that my line disconnected last time) [19:08] brianc: mraleph: this discussion you're having is interesting [19:09] brianc: you know any tips on how to profile node.js? or any place I could look for some documentation? I do lots of buffer concatentaions in the postgres client I'm working on [19:09] brianc: I'm figuring it's probably the biggest perf. bottlekneck [19:09] Aria: niklasfi: Where are you returning that to? fs.stat doesn't care what you return from the callback. You need to store that information somewhere. [19:10] brianc: stuff like this ends up w/ lots of little buffers which have to be concatted **** [19:10] brianc: **** [19:10] brianc: https://github.com/brianc/node-postgres/blob/master/lib/writer.js [19:10] mraleph: brianc: you can't be sure until you prove it ;-) regarding profiling... simplest way is to start you node.js application with --prof flag [19:10] AAA_awright_ has joined the channel [19:10] mraleph: run it for some time [19:11] mAritz: niklasfi: also: file is an undefined variable in line 21. [19:11] Aria: Yeah, concats are nasty. (writev coming!) [19:11] mraleph: then stop it [19:11] niklasfi: Aria: yes that is the problem. initially i did not have the 'var ' prefixes in front of the variables, but of course that is bad.. if you leave out the var in front of file... do you see where i want to be heading? [19:11] mraleph: you should get v8.log file in current directory [19:12] Aria: niklasfi: Not really. It's that you're returning data into ~nowhere that looks like the problem. Assign those inputs to something! Do something in that callback other than return. [19:12] mraleph: then you run deps/v8/tools/linux-tick-processor or deps/v8/tools/mac-tick-processor which procresses v8.log and outputs some info [19:12] brianc: ah yes mraleph thanks for the info! [19:12] mAritz: niklasfi: do you know about javascript scope? [19:12] brianc: i just checked the v8 wiki and saw thesame thing [19:12] brianc: sorry for making you repeat yourself. :) [19:13] brianc: thanks for the patience though I'll 'jfgi' next time. [19:13] niklasfi: Aria: shure. i will later on. it is just, that i am stuck at this stage since i know that later on i wil need to have access to the file name and it is not clear to me how to pass that to the funciton [19:13] mraleph: there is also node-profiler [19:13] mraleph: that provides some usefull API [19:13] Aria: Do what function, niklasfi? [19:14] Aria: er.. to what function? [19:14] brianc: mraleph: hotness [19:14] niklasfi: Aria: pass the filename of the file that i just statted to onStatReturn [19:14] mraleph: V8 profiler is evolving over time so I hope it capabilities will increase... [19:14] mAritz: niklasfi: anonymous functions are your friend. [19:14] Aria: Aah, niklasfi. Perhaps use an anonymous function instead, so it can see the parent scope as a closure? [19:15] Aria: Don't pass it, scope it. [19:15] brianc: Aria: writev? I'm new to the #node.js irc info [19:15] niklasfi: Aria: ok. i tried that and I will show you what i did... [19:15] mAritz: http://dpaste.com/270492/ [19:15] Aria: brianc: ryah_'s working on implementing writev, so that a single syscall can write a bunch of buffers. [19:16] Aria: nik: fs.readDir(top, function(err, names) { for(var i in names) { fs.stat(top+'/'+names[i], function(err, stats) { sys.log(top+'/'+names[i]+": "+sys.inspect(stats) } } } } [19:17] Aria: You're wrapping the call to onStatReturn in an anonymous function, not using the anonymous function for anything. [19:17] niklasfi: Aia: yep did that... but.. that does only return the state of file when stat has returned [19:17] niklasfi: but i want the state of file when i call the stat function [19:18] benburkert has joined the channel [19:18] mAritz: niklasfi: then you'll have to use statSync. but really, why would you want that? [19:18] Aria: You want the stat call to give you an answer before it runs? [19:18] stagas: is there a tool to replace color in a png to another? [19:18] stagas: if it's client side even better [19:19] Aria: (If you statSync, you end up waiting for the stat calls to finish before starting the next) [19:19] Aria: (Waiting sucks.) [19:19] jamund has joined the channel [19:20] mAritz: stagas: i'm not sure, but try putting the png in a canvas and then you can do: var img = canvas.toDataURL("image/png"); [19:20] yeevgen has joined the channel [19:21] mAritz: (last part copied from stackoverflow, no warranty included! ;) ) [19:21] niklasfi: well i don't want to use sync... but. the function as you can see is recursive and it is supposed to list all files in a dir and its subdirs. once i find a directory i need to find the files and folders in that subdir. so i need to pass my current working directory to the worker function [19:21] Aria: Alright. So recurse in the function that gets the stats. [19:21] Aria: Or, queue up a list, and call the function again when the prior run finishes. [19:21] bpadalino has joined the channel [19:22] podman: so, where can i find the linux-tick-processor? [19:22] Aria: podman: deps/v8/tools/ [19:22] niklasfi: Aria sure i would do that ... ok i think you need some more code to clarify what my problem ist [19:22] podman: ah, gotta download it [19:22] mraleph: it kinda requires the whole v8 [19:22] Aria: Possibly. But it's a problem I've worked with before: asynchronous directory traversal is interesting. [19:23] heavysixer: would node prevent a response from another server at the same IP but at a different port? [19:24] stagas: mAritz: thanks but I don't think it fits to what I'm trying to do [19:24] mAritz: stagas: for node there are graphic lib bindings, i believe [19:24] heavysixer: I am trying to get node to play with Rails and right now I have node running on port 4000 and requests work nicely if I just curl them or try them directly from the browser but when I request from the HTML page I get an empty body. [19:24] niklasfi: Aria: here is the complete code http://dpaste.com/270495/ [19:25] Max-Might has joined the channel [19:25] node_ has joined the channel [19:25] niklasfi: Aria: callback is supposed to be a more complex function other than sys.log of course (in the end i want to calculate an md5 sum for each file) but you get what i mean [19:26] Aria: Sure. So break it up within that, and call smaller functions to do the parts. But a couple anonymous functions are the way to go [19:27] frodenius has joined the channel [19:27] frodenius has joined the channel [19:27] Evet has joined the channel [19:27] heavysixer: oh is there a problem with jquery 1.4.3 and node.js? [19:27] heavysixer: maybe that's the issue. [19:28] niklasfi: Aria: could you give tell me what you mean exactly? i am kind of stuck right now [19:30] Aria: nik: fs.readDir(top, function(err, names) { for(var i in names) { fs.stat(top+'/'+names[i], function(err, stats) { if(stats says it's a dir) { recurse with new top } else { listofMD5s.push(computeMD5(top+'/'+names[i])) } } } } [19:30] stephank: tj: I have a bold question: can I steal the 'yaml' package name from you on npm? ;) [19:30] tmpvar: heavysixer, i believe there is an issue with jquery 1.4.3 and jsdom [19:30] tj: stephank: maybe :p [19:30] tj: yours requires compilation though [19:31] heavysixer: tmpvar: but nothing that would be prevent simple ajax functionality that you know of? [19:31] tj: id like to fix mine, some day haha [19:31] tj: remind me later tho im pretty busy ATM [19:31] stephank: okeedo [19:31] podman: mraleph: still trying to figure out how to run this… i checked out v8 and if i run mac-tick-processor, i get: /v8/tools/linux-tick-processor: line 16: scons: command not found [19:31] mraleph: you need scons as well [19:32] tmpvar: meeting, brb [19:32] yeevgen has joined the channel [19:32] podman: mraleph: that would make sense, wouldn't it [19:33] naturalethic has joined the channel [19:33] bradleymeck has joined the channel [19:33] heavysixer: maybe it's a cross-domain issue [19:33] heavysixer: i dunno. [19:34] rikarends has left the channel [19:34] niklasfi: Aria: i think your solution has the same problem: using names[i] will not work, since the for loop continues and i is names.length-1 before stat returns therefore names[i] gives the name of the last file [19:35] Aria: Oh. Doh. [19:35] Aria: Yeah. That'd have to be saved in another function. Sorry about that. [19:36] niklasfi: Aria: cool. how would i do that? [19:36] benburkert has joined the channel [19:36] Aria: nik: fs.readDir(top, function(err, names) { for(var i in names) { doStat(top+'/'+names[i]) } }; function doStat(name) {fs.stat(name, function(err, stats) { if(stats says it's a dir) { recurse with new top } else { listofMD5s.push(computeMD5(name)) } } } [19:37] rikarends has joined the channel [19:37] Aria: (You can do it with an anonymous function, too, or with Function.bind, but those both get hard to read.) [19:38] res99 has joined the channel [19:39] niklasfi: Aria: that looks like what i need.... i am (as you may have noticed) new to some of the js concepts so thank you [19:39] fangel: do it all with anonymous functions and arguments.caller.. reeeeeally maintainable, for sure.. :) [19:40] Vaevictus has joined the channel [19:40] Aria: Yeah, getting used to using closures is tricky. [19:40] Vaevictus: hey guys... i was considering picking up node.js for a TCP server, but i'm unsure of it's capability of dealing with certain datatypes and general bit wrangling [19:40] jacobolus has joined the channel [19:40] fangel: don't get me wrong.. recursion with arguments.caller is nifty, but it's hard as hell to figure out if you're not the one who wrote the code [19:41] mjr_: Vaevictus: node has a binary data type called "buffers" that give you access to individual bytes. [19:41] fangel: or if you're not quite as jacked up on Mtn. Dew as when you wrote it.. :) [19:41] Vaevictus: does anyone have any good examples or libraries for parsing binary streams and converting datatypes? [19:41] bartt: I'm having some trouble using HMACs from node's crypto module: https://gist.github.com/663052 [19:41] Vaevictus: mjr_: how hard is it, for example, to take 4 bytes and consider them a float? or toggle the endianness and make it an integer? [19:42] mjr_: Vaevictus: there are a few annoying things with JavaScript and bit twiddling though. The JS Number type is always a float, so bit shifting sometimes doesn't do what you think. [19:42] ooooPsss has joined the channel [19:42] bartt: Am I doing something wrong? [19:42] podman: mraleph: ok, finally got it running [19:43] Vaevictus: mjr_: an eight byte integer (long long) and an eight byte float (double) are very different... so ... JS and node would just butcher those things? [19:43] podman: mraleph: looks like 91.6% was in c++ "_si_cache_add_item" [19:43] mjr_: Vaevictus: there are a lot of examples out there, but here's one that I've done: https://github.com/mranney/node_pcap/blob/master/pcap.js#L124 [19:43] mraleph: podman: never heard about this beast [19:43] mjr_: Vaevictus: you can't store ints in JS that are over 53 bits. [19:44] Vaevictus: mjr_: what about floats? [19:44] mjr_: Vaevictus: in JS there are only floats. [19:44] podman: mraleph: hmm, well, that is clearly what is causing the problem [19:44] mjr_: Vaevictus: so you can't store those either. :) [19:44] Vaevictus: what are their limits? [19:44] mjr_: Well, you can store them, but they lose accuracy. [19:44] robmason_ has joined the channel [19:44] Vaevictus: ahh... well it seems node.js is an impossiblity for this project then. oh well [19:45] programble has joined the channel [19:45] programble has joined the channel [19:45] mjr_: Vaevictus: there are certainly many ways to work around this, but the native JS Number type does have limitations. [19:46] tj: Vaevictus: a buddy I work with just wrote bindings for http://gmplib.org/ [19:46] tj: not sure if that will help you [19:46] podman: mraleph: i wonder if that is a mac specific thing? [19:46] mjr_: Depending on how you need to manipulate the numbers, it migtht be fine to keep them in buffers, or there are other libs that do bignums. [19:46] joshdulac: having trouble installing nodepcap, anyone have experience resolving/installing it? [19:46] mraleph: podman: i trying to google something meaningful... nothing yet [19:46] Vaevictus: mjr_: sounds unnecessarily nasty. [19:47] mjr_: joshdulac: the version in github only works with new node. The version in npm works on 0.2.x [19:47] themiddleman has joined the channel [19:47] mraleph: podman: yep. looks like some apple code. [19:47] joshdulac: tried both on 2.0 and 3.0 [19:47] simme has joined the channel [19:47] slickplaid: What's the deal with changing sys to util? [19:47] marshall_law has joined the channel [19:47] mraleph: podman: http://www.google.com/search?q=si_cache_add_item [19:48] mjr_: joshdulac: can you gist me the error? [19:48] Vaevictus: tj: doesn't look bad, except i'll need bitswapping things... which i could write, i suppose... :| [19:48] joshdulac: mjr: sure thing, would u like me to use git/npm on 2.0/3.0 [19:48] ceej has joined the channel [19:48] joshdulac: mjr_: err, stupid question, 1 sec [19:48] mjr_: joshdulac: if you are using 0.2, then use the npm version. But if you can't make either work, just gist which ever version you would rather I look at. :) [19:49] podman: mraleph: it looks like others have asked about this in this channel before although i don't think anyone has gotten an answer [19:49] podman: i wonder if this would work better on linux for some reason? [19:49] mraleph: podman: this looks like a reverse dns lookup [19:49] mraleph: or something like this [19:50] mjr_: slickplaid: the name "util" better matches what is in there. The deprecation warnings are a bit annoying, for sure. [19:50] deepthawtz has joined the channel [19:50] slickplaid: right on [19:50] mraleph: at least we know that this is part of libinfo [19:50] bartt has joined the channel [19:51] podman: mraleph: it's not the url.parse function, is it? [19:51] mraleph: podman: dunno. as I said I lack the knowledge of node internals. [19:51] joshdulac: mjr_: i overrode my path, give me a minute [19:52] podman: i guess i'll dig a little deeper [19:52] mjr_: joshdulac: I'm heading to lunch. If you don't get me in IRC, please open an issue on github, and I'll look at it later. [19:53] Evet has joined the channel [19:54] mraleph: podman: please keep us posted. I am curious :-) [19:54] rasztasd has joined the channel [19:54] benburkert has joined the channel [19:55] yeevgen has joined the channel [19:55] rasztasd: hi, how can i print an html element? im using an http object from require('http'), can i add '' or other html code to response.write, or reponse.end? [19:55] Vaevictus: wc [19:56] Vaevictus has left the channel [19:59] necrodearia has joined the channel [19:59] Yuffster has joined the channel [20:01] mAritz: mape: how do you merge your js files with connect-assetmanager? doesn't seem to be in the handlers and is only once mentioned as possible. [20:01] yeevgen has joined the channel [20:02] mape: mAritz: It is built into the asset manager, so it always gets minified unless you add debug: true [20:02] Anti-X: AssMan [20:02] mape: And if you want to add YUI compress or uglifyjs you need to add the handlers [20:02] Anti-X: as some dailywtf article so eloquently put it [20:03] mAritz: mape: how much of a size decrease does yui/uglify get over normal minification? [20:03] mAritz: (and thanks for the fast answer :) ) [20:03] rasztasd has joined the channel [20:04] mape: mAritz: No worrys, hmm quite a bit, I wouldn't use YUI since it is pretty slow, Uglify is really nice but I'm having issues with its optimizations on IE [20:05] mape: mAritz: Let me do a quick check [20:05] dgathright has joined the channel [20:05] modular has joined the channel [20:06] stagas: woo imagemagick does it pretty well [20:06] stagas: it even lets you select the color position in pixels to be replaced which is what I needed [20:08] mape: mAritz: 157.8K (52.6K gzip) vs 118.6K (37.6K gzip) using UglifyJs [20:08] dilvie has joined the channel [20:09] dilvie: Is there a good GeoIP lookup module for node? [20:09] mape: That is jQuery and a plugin + some client code [20:09] dilvie: I need to find the location of the client and pass it to the web server to set default form values. [20:09] path[l] has joined the channel [20:09] mape: dilvie: use google api thingy? [20:09] mape: unless you have to do it backend [20:09] dilvie: mape: Does that work from the server side? [20:10] dilvie: I need it back-end. [20:10] mape: Then no [20:10] dilvie: ah, that sucks. =) There's no way to specify an IP to look up to the google service, huh? [20:11] mAritz: mape: so best would be to use uglify for anything but IE?! [20:11] mape: mAritz: More or less, or figure out why it breaks and patch uglify ;) [20:11] rasztasd has joined the channel [20:11] mape: Not sure why no one else had the issues I had [20:11] isaacs: mjr_: hey [20:11] mape: But haven't had the time to isolate the issue, think it is caused by latest core jquery though [20:11] mAritz: mape: haha, not enough time :( [20:11] isaacs: mjr_: that "unexpected operator" is weird [20:11] mjr_: hey isaacs [20:11] Ori_P has joined the channel [20:12] isaacs: mjr_: line 7? don't grok. [20:12] mjr_: I got that message on all of the instances that I built today [20:12] isaacs: yeah, strange [20:13] dilvie: jquery core problem? [20:13] joshdulac: mjr: i posted the issue here https://github.com/mranney/node_pcap/issues/issue/6 [20:13] yeevgen has joined the channel [20:13] mape: dilvie: I'm having issues with UglifyJs compressing core jquery. Throws errors in IE [20:14] mape: But since there are no issues on github I'm assuming there is something wrong on my end [20:14] Utkarsh has joined the channel [20:14] dilvie: hmm [20:14] modular: let's say i have a data stream accessible over http. it spits out 10 lines of plain text, 1 line at a time, with a 5 second delay after each line. [20:14] mAritz: mape: the assetmanager is awesome! thanks :) [20:14] mjr_: joshdulac: that's the 0.2 -> 0.3 Buffer API change issue. If you instead ran "npm install pcap", does it work? [20:14] joshdulac: 1 sec [20:15] mape: mAritz: Let me know if there is something that doesn't make sense [20:15] modular: is there some way i can pull this data stream into the browser using ajax or something similar, and start displaying the data as soon as the first line is sent, instead of waiting for all 10? [20:15] mAritz: I will! :) [20:15] teemow has joined the channel [20:16] naturalethic: modular: yes [20:16] joshdulac: mjr_: still fails: https://gist.github.com/663109 [20:16] joshdulac: thats on 2.4 though, should i install 2.0 to try npm [20:16] benburkert has joined the channel [20:16] naturalethic: modular: think of facebook chat or meebo [20:17] mjr_: isaacs: check that gist from joshdulac [20:17] isaacs: joshdulac, mjr_: that's weird [20:17] isaacs: joshdulac: try doing this: npm install npm@pre [20:18] naturalethic: modular: http keep alive [20:18] modular: i tried to wrap this in socket.io, but it was just too buggy between browsers, and i don't need 2 way communication. and jquery's ajax implementation waits for the whole http request to end before letting me get the dat. [20:18] isaacs: joshdulac: and then: npm cache clean ; npm install pcap [20:18] mjr_: isaacs: perhaps a permissions problem on his machine? [20:18] garrensmith has joined the channel [20:18] isaacs: mjr_: naw, then it'd get an EPERM [20:19] joshdulac: isaacs: still no good https://gist.github.com/663116 [20:19] cloudhead has joined the channel [20:19] naturalethic: modular: either hack xmlhttprequest object yourself or find a differently library that supports this -- you might start with the ajax file uploader tools, which some might use this mechanism to inform the browser how much of the file has been sent [20:19] isaacs: it's failing wiht ENOENT [20:20] isaacs: joshdulac: gist this: npm config ls [20:22] joshdulac: https://gist.github.com/663120 [20:22] ezmobius has joined the channel [20:23] joshdulac: isaacs: https://gist.github.com/663120 [20:23] joshdulac: isaacs: the userconfig at /home/bourne/.npmrc does not exist [20:24] isaacs: joshdulac: that shouldn't matter. [20:24] benburkert has joined the channel [20:24] isaacs: yeah, this is so so normal [20:25] mjr_: isaacs: do you still shell out for tar, or did you build that in node? [20:25] isaacs: mjr_: i still shell out to tar [20:25] isaacs: so that's what's failing [20:25] halfhalo: ACTION wants a tar module badly [20:26] [[zz]] has joined the channel [20:26] isaacs: halfhalo: yeah, i have a half-finished one, and there's another that someone else wrote in coffeescript [20:26] isaacs: tar is dying wiht ENOENT for some reason. which implies to me that it's failing to write the data to the temporary directory [20:26] podman: mraleph: so, i think it's lazy code compliation [20:26] isaacs: joshdulac: is there any /tmp/node-* folders? [20:27] aconbere has joined the channel [20:27] mraleph: podman: whoa. why? [20:27] joshdulac: nothing /tmp/node [20:27] mraleph: podman: do you load and eval code all the time? [20:27] joshdulac: isaacs: there is /tmp/npm.* [20:27] isaacs: joshdulac: hmm.... [20:28] podman: mraleph: i not in my code anyway [20:28] ph^ has joined the channel [20:28] isaacs: joshdulac: what's in there? [20:29] podman: actually, maybe it's these: code-creation,LoadIC,0x10519bdc0,74,"db" [20:29] podman: code-creation,LoadIC,0x10519be20,74,"collectionName" .. stuff like that [20:29] joshdulac: isaacs: https://gist.github.com/663135 [20:30] mraleph: mmm. I thought you saw that 99% of time is spent inside some strage function from libinfo [20:30] podman: yeah, i'm having a hard time correlating that to the v8.log [20:31] mraleph: you are trying to read it with your own eyes? [20:31] mraleph: well [20:31] mraleph: there [20:32] mraleph: there are several types of events there [20:32] rasztasd has joined the channel [20:32] isaacs: joshdulac: hmm… anything else npm or pcap related in /tmp? [20:32] isaacs: joshdulac: that tmp folder is just what was used to install npm [20:33] mraleph: tick-processor processes tick events, it should provide good information about places where application spends time [20:33] joshdulac: isaacs: ah, nothing else related to node, npm, or pcap in /tmp [20:33] isaacs: hmm… ok [20:34] pquerna: wasn't there something to dump all the remaining open things pending in the vent loop? [20:35] joshdulac: mjr_: u still here? [20:35] mjr_: hey [20:35] mjr_: a bit busy, be back in a min [20:35] joshdulac: kk [20:35] q_no has joined the channel [20:36] jameshome has joined the channel [20:37] joshdulac: isaacs: as im installing at user bourne [20:37] nichdiekuh has joined the channel [20:38] joshdulac: should the /tmp be owned by bourne [20:38] isaacs: joshdulac: yeah, but usually tmp is 0666 anyway [20:38] isaacs: er, 0766 [20:38] joshdulac: isaacs: ah true [20:38] rasztasd has joined the channel [20:38] admc has joined the channel [20:39] dnolen_ has joined the channel [20:43] isaacs: joshdulac: ok, let's try isolating the problem, got a second to try a few more things? [20:43] mattly has joined the channel [20:43] joshdulac: isaacs: sure =) [20:43] rasztasd has joined the channel [20:43] joshdulac: isaacs: thx for your help, btw [20:43] isaacs: joshdulac: npm cache clean pcap ; npm cache add pcap@latest [20:43] isaacs: np [20:43] isaacs: so, that should fail with the same error. if it doesn't, the world is broken. [20:43] isaacs: up is down, etc. [20:43] Ori_P has joined the channel [20:44] creationix has joined the channel [20:44] joshdulac: all seemed good: https://gist.github.com/663155 [20:45] creationix: anyone here know how to make bitbake recipies? [20:45] isaacs: noooooo!!!! [20:45] isaacs: well, shit. we broke causality. [20:45] isaacs: there goes the universe. [20:45] joshdulac: the earth just switched its magnetic field [20:45] joshdulac: north is south, and vice versa [20:45] isaacs: on the bright side, `npm install pcap@0.2.1` should work fine now [20:45] isaacs: since it's loaded into the cache [20:46] rikarends has left the channel [20:46] joshdulac: nope, tar failed again [20:46] isaacs: hmmm.... [20:46] isaacs: ok, i think i know where this must be happening then... [20:47] joshdulac: go on... [20:47] mAritz: what do you guys think is a reasonable artificial delay for login checks? and should I add one for correct logins as well or set it lower or leave it out? [20:48] isaacs: so, the install process goes like this: 1. put it in the cache (which puts a tgz and an unpacked "package" folder at .npm/.cache/pcap/0.2.1/package{/,.tgz}) [20:48] rasztasd has joined the channel [20:48] isaacs: 2. unpack the .npm/.cache/pcap/0.2.1/package.tgz to .npm/pcap/0.2.1 [20:48] isaacs: er, .npm/pcap/0.2.1/package [20:48] isaacs: 3. run the "build" command on .npm/pcap/0.2.1/package [20:49] isaacs: so, do this: cd /usr/local/lib/node/.npm/pcap [20:49] isaacs: anything there? [20:49] joshdulac: sry 1 sec [20:50] isaacs: np [20:50] joshdulac: indeed [20:50] joshdulac: everything is in /usr/local/lib/node/.npm/pcap/0.2.1/package [20:51] hojberg has joined the channel [20:52] isaacs: very very interesting [20:52] isaacs: but the tar was failing [20:52] gsmcwhirter: oh, isaacs, wanted to thank you for a very smooth npm publishing process [20:53] isaacs: gsmcwhirter: nice :) [20:53] isaacs: joshdulac: i'm so completely intrigued now. [20:53] joshdulac: lol, then here is root access to my system (jk) [20:53] isaacs: haha [20:53] isaacs: that'd be easy [20:54] joshdulac: hmm [20:54] joshdulac: i got an ubuntu server with rackspace [20:54] joshdulac: let me try it there [20:55] isaacs: joshdulac: what does this say? tar ztf /usr/local/lib/node/.npm/.cache/pcap/0.2.1/package.tgz [20:55] joshdulac: listed all the files in node_pcap recursively [20:56] isaacs: w. t. f. [20:57] benburke_ has joined the channel [20:57] SubStack has joined the channel [20:58] mikeal has joined the channel [20:58] pkrumins has joined the channel [20:58] joshdulac: ./logictrace npm install pcap [20:59] joshdulac: haha [20:59] isaacs: pcap isn't even a very big packag [20:59] pkrumins: i'm in SF right now [20:59] pkrumins: going to hackers and founders meeting [21:00] benburk__ has joined the channel [21:00] pkrumins: anyone is gonna be there who wishes to meet with me? [21:00] rasztasd has joined the channel [21:00] isaacs: pkrumins: where's that at? [21:00] floyd has joined the channel [21:01] pkrumins: isaacs: it's at yelp [21:02] pkrumins: isaacs: http://www.hackersandfounders.com/calendar/15001653/ [21:04] pkrumins: isaacs: 706 mission street [21:04] garrensmith: does the objects "prototype" become the objects __proto__ upon contruction? [21:06] isaacs: garrensmith: the constructor's prototype. yes. [21:07] garrensmith: isaacs: why when creating an object do we do object.prototype.newFunction = function () {} [21:07] isaacs: garrensmith: because you don't know what you're doing, maybe? i dunno. [21:07] isaacs: it should be Constructor.prototype.method = function () {} [21:07] garrensmith: isaacs: hehe possibly [21:07] tj: garrensmith: the prototype prop only really exists for perf reasons [21:07] isaacs: if you're monkeying wiht this.prototype, then i have no idea what you're u pto. [21:07] tj: and I guess to aid in classical approaches [21:07] garrensmith: isaacs: thats what I mean, thats what I'm doing [21:08] matheeeny has joined the channel [21:08] isaacs: garrensmith: yeah, no clue, then [21:08] garrensmith: thanks tj, so to create a "class" the objects new functions get created on the prototype [21:08] isaacs: garrensmith: you're just typing jibberish [21:09] garrensmith: lol [21:09] garrensmith: its ok I get it [21:10] isaacs: and tinkering with this.__proto__ is kinda silly, too, unless you just mean to set this.__proto__ = someObject [21:10] isaacs: if you're doing this.__proto__.something = somethingElse, then you're setting it for EVERY member of that class. [21:13] matheeeny has joined the channel [21:13] rasztasd has joined the channel [21:14] ph^ has joined the channel [21:16] jdalton has joined the channel [21:18] robmason has joined the channel [21:19] jesusabdroolah has joined the channel [21:22] felixge has joined the channel [21:22] felixge has joined the channel [21:22] felixge: Is there are proper way to escape arguments to be passed to a child process? [21:22] pkrumins has joined the channel [21:22] pkrumins has joined the channel [21:22] SubStack has joined the channel [21:22] felixge: Assuming you have to go through sh / bash, rather than invoking the process directly [21:24] Gehhilfe has joined the channel [21:29] joshdulac: felizge: what do you mean by escape arguments [21:30] joshdulac: like if you need to grep "example" /tmp/* [21:30] joshdulac: you want to escape the quotes in the argument? [21:30] shaver: my rule is: if it's not a letter or a number, it gets a \ [21:31] isaacs: felixge: like spawn("sh", ["-c", theCommand]) ? [21:31] joshdulac: and be careful of your input, don't allow arbitrary input from the user to be injected into the command [21:31] jfd1 has joined the channel [21:31] joshdulac: you can use [21:32] felixge: joshdulac: I have to deal with arbitrary user input :) [21:32] zomgbie has joined the channel [21:32] zomgbie_ has joined the channel [21:32] felixge: isaacs: yeah, and I want to escape arguments in theCommand [21:32] felixge: shaver: that rule is too aggressive, I'm pretty sure it will break stuff [21:33] shaver: don't think so [21:33] joshdulac: child.exec('ping 127.0.0.1'), function (error, stdout, stderr) { util.print(stdout); }); [21:33] felixge: here is what I've been using so far: https://gist.github.com/c14f3cd6be352597ac93 [21:33] shaver: I certainly haven't found any [21:33] shaver: whitelist > blacklist for security, certainly [21:33] Gruni has joined the channel [21:33] felixge: shaver: how many commands have you executed this way? We're almost up to ~1 million :) [21:33] isaacs: felixge: you can also just json encode [21:34] felixge: isaacs: if you teach curl to json_decode? :) [21:34] shaver: many millions, I'm sure, since I used it to test a bunch of 1000+ node clusters for 2 years [21:34] isaacs: felixge: spawn("sh", [ "-c", cmd + " " + args.map(JSON.stringify) ]) [21:34] shaver: including needing to propagate file redirections and history events [21:34] felixge: shaver: compelling argument [21:34] isaacs: felixge: spawn("sh", [ "-c", cmd + " " + args.map(JSON.stringify).join(" ") ]) [21:34] isaacs: felixge: where "args" is an array of string argumnets [21:34] rasztasd has joined the channel [21:35] shaver: the not-a-letter-or-number-means-backslash rule is also easy to reason about and implement [21:35] isaacs: felixge: everything gets quoted, quotes get escaped [21:35] isaacs: of course, then you get \uFACE [21:35] felixge: isaacs: I don't think bash can deal with utf8 encodes ;) [21:35] isaacs: yeah [21:36] shaver: bash can definitely deal with utf-8 [21:36] isaacs: shaver: but not utf8-encodes [21:37] shaver: oh [21:37] shaver: yes, quite not [21:37] joshdulac: why use the spawn when u can use child.exec [21:37] isaacs: joshdulac: if you want the streams [21:37] shaver: or env var expansion [21:37] saschagehlich: hmm did anyone ever have problems with redis-node-client connecting to redis? I've got a setup with 2 servers, one of them can connect the redis server, the other one is getting a ETIMEDOUT after a while... [21:38] shaver: or ~ expansion (!) [21:38] herbySk74 has joined the channel [21:38] joshdulac: hmm [21:39] joshdulac: ill have to read the docs when its not 2am then :X [21:39] isaacs: felixge: hey, looks like v8's JSON.stringify doesn't actually escape utf8 any more. [21:39] shaver: also, because node is too fast and you want to add some process forking to slow it down and make your php-using colleagues feel better [21:40] shaver: sounds like a spec-conformance fix [21:41] felixge: shaver: your escaping mechanism breaks utf8 [21:41] shaver: hmm [21:41] shaver: oh, well [21:42] shaver: you have to escape chars, not bytes [21:42] shaver: but if you're escaping bytes you can lose anyway [21:42] shaver: I do believe [21:42] shaver: because what looks like a ] can be the low byte of a two-byte UTF-8 char, no? [21:42] felixge: isaacs: seems like JSON.stringify() looks good [21:43] isaacs: felixge: yeah, i wouldn't rely on it being air-tight or secure, but it's definitely handy for trusted input [21:43] felixge: isaacs: I don't have that luxury :) [21:43] herbySk74: v8: JSON.stringify({s:"�lt� k��"}) [21:43] v8bot: herbySk74: "{"s":"\ufffdlt\ufffd k\ufffd\ufffd"}" [21:43] isaacs: felixge: then also run it in a child process with reduced permissions [21:43] felixge: shaver: I don't think ] has a utf-8 significant byte? [21:43] isaacs: felixge: like, process.setuid("nobody") or whatever [21:44] shaver: felixge: ah, true [21:44] felixge: isaacs: security is a secondary concern, not getting failure on the tool is more important [21:44] shaver: felixge: high bit has to be set [21:45] felixge: shaver: can I directly pass bytes as shell arguments? [21:46] shaver: sure, IFS tokenization is quite simple [21:46] shaver: then it's up to the command to deal with [21:46] metad has joined the channel [21:47] felixge: shaver: I need something that works with every command [21:47] felixge: it's kind of hard to believe that there is no proper solution to this :) [21:47] rasztasd has joined the channel [21:48] shaver: put a \ before every character that isn't a letter or number [21:48] niklasfi has left the channel [21:48] shaver: since you only see UCS-2 characters in JS, it's easy to do there [21:49] shaver: unless you worry about surrogates, but JS doesn't! :-) [21:49] felixge: shaver: as I said this breaks "Hello Überworld" [21:49] felixge: ;) [21:49] isaacs: v8>Array.prototype.map.call("~!@#$%^&*()'", function (c) { return c.match(/[a-zA-Z0-9]/) ? c : "\\c" }) [21:49] v8bot: isaacs: ["\c", "\c", "\c", "\c", "\c", "\c", "\c", "\c", "\c", "\c", "\c", "\c"] [21:49] path[l] has joined the channel [21:49] isaacs: v8>Array.prototype.map.call("~!@#$%^&*()'", function (c) { return c.match(/[a-zA-Z0-9]/) ? c : "\\" + c }) [21:49] v8bot: isaacs: ["\~", "\!", "\@", "\#", "\$", "\%", "\^", "\&", "\*", "\(", "\)", "\'"] [21:49] shaver: felixge: how so? [21:50] isaacs: v8>Array.prototype.map.call("~!@#$%^&*()'", function (c) { return c.match(/[a-zA-Z0-9]/) ? c : "\\" + c }).join("") [21:50] v8bot: isaacs: "\~\!\@\#\$\%\^\&\*\(\)\'" [21:50] mAritz: mape: i have a problem: i'd like to manage my js files with subfolders. (i'll use a clientside mvc (backbone.js) and putting controllers in a controllers folder just makes sense) however there doesn't seem to be an option to merge files including subfolders, correct? [21:50] isaacs: v8>Array.prototype.map.call("~!@#$%^hello@world\uFACE&*()'", function (c) { return c.match(/[a-zA-Z0-9]/) ? c : "\\" + c }).join("") [21:50] v8bot: isaacs: "\~\!\@\#\$\%\^hello\@world\龜\&\*\(\)\'" [21:50] shaver: felixge: utf-8 characters don't get broken up if you work on characters [21:50] felixge: shaver: https://gist.github.com/663268 [21:50] mape: mAritz: just set the root dir and then use relative paths for all the files? [21:51] mape: That won't work with the wild card though [21:51] mAritz: yeah, but then i'd have to list them all or write some code that collects them first. :/ [21:51] isaacs: felixge: so, yeah, bash can actually handle just raw utf8 if you set it up righ. [21:51] isaacs: *right [21:52] isaacs: felixge: seriously, try the JSON.stringify approach. i'd be curious if you have a case where that doesn't work. [21:52] shaver: what are the bytes in escape(str)? [21:52] mape: mAritz: Hmm yeah, would love a patch that allows for wildcarding dirs of files, or keep poking me and I'll add it [21:52] isaacs: felixge: also, shouldn't that be "\\$1"? [21:52] isaacs: \1 would be a backref in the regexp, not in the replace [21:52] shaver: I can't tell where that's failling down [21:52] shaver: yes [21:52] mAritz: hm, nah. i kinda need it now, so i'll just code some collectorcode :/ [21:52] isaacs: felixge: also, you need to capture it with () [21:53] mape: mAritz: should be easy enough, just collect them and supply that array to the files part of the manager [21:53] felixge: isaacs: oh, shoot [21:53] shaver: v8: "foo".replace(/([^o])/g, '\\$1') [21:53] v8bot: shaver: "\foo" [21:53] felixge: isaacs: that does seem to work [21:53] shaver: huzzah [21:54] felixge: shaver: not there yet, a single double quote breaks the fun :) [21:55] felixge: ignore me [21:55] rwaldron has joined the channel [21:55] felixge: not enough beer for tonight [21:55] felixge: I need /g [21:55] felixge: in the regex [21:55] felixge: :) [21:55] felixge: ok this is starting to look promising :) [21:56] felixge: shaver: ok, I'll give it a try [21:56] felixge: shaver: lets see if it survives user contact :) [21:56] shaver: heh, let's [21:57] jdalton has joined the channel [21:57] felixge: shaver: If it works I'll be very happy, this is really elegantly simple. [21:57] mraleph has joined the channel [21:57] jdalton has left the channel [21:57] hellp has joined the channel [21:59] micheil has joined the channel [22:01] rnewson has joined the channel [22:02] ajsie has joined the channel [22:02] dAnjou has joined the channel [22:02] hassox has joined the channel [22:04] ajsie: why did ryan create node.js btw? [22:04] d3x7r0 has joined the channel [22:04] ajsie: it was from company or private interest? [22:05] dAnjou has left the channel [22:05] felixge: ajsie: afaik he was dissatisfied with the performance of ruby servers [22:05] felixge: then he wrote his own ruby web server called ebb [22:05] felixge: and then he decided the problem was ruby itself [22:05] tj: and then hates js :p [22:06] felixge: And then there must have been a magic moment of V8, non-blocking I/O forming node.js in his mind [22:06] ajsie: felixge: good sum up =) [22:06] felixge: ajsie: ryan could probably tell it better :) [22:07] ajsie: he is very talented knowing so many different language [22:07] ajsie: s [22:08] stephank: ryan wrote ebb? Hmm, another link for the mental graph. [22:08] tj: that was how i found node way back [22:08] tj: when it first started [22:08] rasztasd has joined the channel [22:08] ajsie: is there a performance benchmark between javascript and ruby? [22:08] micheil: ACTION was late to the party. Found the project after JSConf 09' [22:08] ajsie: have never seen a such benchmark [22:09] tj: ajsie: I did some lightweight io stuff quite a while back (months and months) but ruby was faster actually [22:09] tj: at that time at least [22:09] micheil: ajsie: you can't accurately benchmark them really [22:09] ajsie: micheil: what project? ebb? [22:09] micheil: node. [22:09] ajsie: okay .. i heard about it 4 months ago [22:10] shaver: v8 is monstrously faster than ruby, for actual computation [22:10] felixge: tj: that must have been a very weird benchmark [22:10] ajsie: when i was in the ruby channel a dude entered and boasted about something called node.js [22:10] shaver: mostly you're not computationally-bound in web services, though [22:10] felixge: tj: I'm pretty sure v8 was faster than ruby the moment it was released [22:10] shaver: you're waiting on I/O or databases or the network [22:10] tj: felixge: I cant remember what I did exactly, and im just talking io not heavy computation of v8 vs ruby [22:10] tj: it was thin vs node [22:10] felixge: ajsie: do you remember his name? [22:10] felixge: :) [22:11] niklasfi1 has joined the channel [22:11] ajsie: felixge: no .. why? [22:11] tj: it made me sad, so I never published it haha [22:11] ajsie: it was u? =) [22:11] felixge: tj: that's not comparing language speed [22:11] tj: felixge: no i know, it was just server a and server b transfering the same file [22:11] ajsie: all guys defended ruby and spit at him .. he said "Rails is so over,, node will kicks Rails butt" etc [22:12] felixge: ajsie: no [22:12] micheil: you could be like some of the libev users.. who say they need to write machine code for the speed of it.. [22:12] ajsie: was an entertaining fight =) [22:12] felixge: ajsie: I'm just wondering if his name was JimBastard :) [22:12] micheil: ajsie: perhaps jim. [22:12] JimBastard: what did i do [22:12] ajsie: yeah [22:12] ajsie: it rings a bell [22:12] ajsie: it was you JimBastard that boasted about node.js in the ruby channel right? [22:12] felixge: JimBastard: there are rumors spreading about somebody trolling the poor ruby folks :) [22:12] niklasfi1: i have done "sudo aptitude install ssl" on my ubuntu machine however "./configure" still returns: /home/niklas/Desktop/develop/node/node-v0.3.0/wscript:188: error: Could not autodetect OpenSSL support. Make sure OpenSSL development packages are installed. Use configure --without-ssl to disable this message. [22:13] ajsie: "Rails days are over .." that kind of speech [22:13] JimBastard: YOU CAN ONLY BUILD WEB APPLICATIONS WITH MYSQL AND RUBY ON RAILS DONT BE STUPID [22:13] micheil: isn't it ssl-dev and openssl? [22:13] benburke_ has joined the channel [22:13] stephank: niklasfi1: you need libssl-dev [22:13] micheil: that one. [22:13] javruben has joined the channel [22:13] tj: felixge: not bashing node or anything, was just suprised by the outcome [22:13] tj: when I have some time I will re-do some of that and see where it sits now [22:13] felixge: tj: it depends on what you're doing [22:14] felixge: tj: node is very slow pushing large strings [22:14] ajsie: JimBastard: btw, is nodejitsu ready? i see you have a login page [22:14] felixge: so if this was before buffers, yes - node is likely to have lost any benchmarks outputting files [22:14] niklasfi1: stephank: thank you! [22:14] sprout has joined the channel [22:14] stephank: niklasfi1: np, have fun :) [22:14] tj: ya I cant remember what I was testing, I think I had some small files, and jquery was one of them I remember that, so about 64k [22:14] niklasfi1: stephank: will do! [22:14] JimBastard: ajsie: indexzero is a little scared to launch lol [22:15] felixge: tj: I'm not a node fanboy : ). I regularly call out people for using node just because it's sexy right now, not because it's a good fit for their needs [22:15] ajsie: JimBastard: then let me test it out first and report =) [22:15] JimBastard: he doesnt want other people deploying apps until better logging is in place [22:15] JimBastard: im working on it i promise [22:15] tj: felixge: I would use it regardless, love working with js [22:15] tj: im not saying ruby is the shit lol [22:16] ajsie: JimBastard: you have to read Get Started by DDH...it basically tells you to launch before its ready .. the result will be great! [22:16] ajsie: :D [22:16] felixge: o_o [22:16] JimBastard: you dont have to tell me [22:16] JimBastard: im yelling at indexzero everyday [22:16] halfhalo: I love working with node, but I still use rails for most of my web stuff. server stuff I'm switching to node or rake though [22:16] ajsie: =) [22:16] JimBastard: my shits been ready for a week [22:17] ajsie: halfhalo: im working on a kickass backend framework for node.js .. you'll switch over entirely when im finnished =) [22:17] ajsie: JimBastard: haha [22:17] micheil: JimBastard: why not get indexzero's shit together then? [22:18] JimBastard: micheil: i see what you did there, you used words to make a sentence [22:18] micheil: oh yeah? [22:18] JimBastard: :-) [22:18] micheil: :P [22:18] ajsie: JimBastard: estimated time accessment? [22:18] ajsie: assessment [22:18] ajsie: there [22:18] halfhalo: ONE MAGJILLION MINUTES [22:19] JimBastard: i think there is only one blocking bug that might already be fixed [22:19] JimBastard: im going to dive into it in a few [22:20] ajsie: JimBastard: wanna see what you are going to offer me as a node dev working on a new backend framework [22:20] JimBastard: you dont actually need to login ajsie to see the deployment UI [22:20] JimBastard: http://www.nodejitsu.com/#/deploy [22:20] ajsie: thats why i've been yelling for christmas [22:21] ajsie: love your stack: vows, ubuntu, couchdb [22:21] ajsie: exactly as mine [22:23] charlenopires has joined the channel [22:24] ajsie: JimBastard: what have you used for the frontend? I've seen /#/ in the uri in a lot of sites [22:24] JimBastard: ajsie: im using https://github.com/marak/machine.js [22:24] stepheneb_ has joined the channel [22:24] JimBastard: i was messing around with http://maraksquires.com/route.js/ a bit [22:24] JimBastard: but thats pretty much dead [22:24] stepheneb has joined the channel [22:25] ajsie: okay [22:25] antris: it's not hard to make url handling yourself [22:25] StanAngeloff has joined the channel [22:25] JimBastard: not really [22:25] JimBastard: the cross browser onhashchange event can get tricky, but there are libs for that [22:25] ajsie: antris: yeah but why reinvent the wheel [22:25] JimBastard: if you dont care about that its very easy [22:26] antris: there's not even that much inventing [22:27] ajsie: nothing is impossible in programming.. the question is you want to do it in 1 day, 1 hour or 1 min [22:27] antris: i'm working on a platform that uses hash urls [22:27] antris: coding the basic handling took 15min [22:27] antris: we've expanded it according to our needs [22:27] johngbrooks has joined the channel [22:27] antris: but we get exactly what we want [22:28] ajsie: yeah sometimes you have to do that if you really need 100% customization [22:28] mikedeboer has joined the channel [22:28] ajsie: thats why im building my own backend framework for node [22:28] antris: it's not like we had to [22:28] ajsie: dont like today's backend frameworks not focusing in Restful + ROA [22:28] antris: it's just more reliable code a simple thing yourself [22:28] jfd1 has joined the channel [22:28] antris: to* [22:29] antris: + the code size is smaller [22:29] antris: so quicker page loads [22:29] halfhalo: if you want smaller code set the font size to 1! [22:30] antris: :D [22:30] antris: yeah [22:30] antris: ctrl + - would prolly work for most companies marketing departments [22:31] ajsie: JimBastard: I think you have to somehow integrate it with Cloud9 to get full effect with nodejitsu .. a lot of people will be using the hosted version soon i think .. maybe create a Deploy button and it is deployed in Nodejitsu? [22:31] rcy has joined the channel [22:31] benburkert has joined the channel [22:35] mAritz: mape: uglifyjs breaks my js if i have a debugger statement, does that help? [22:37] scvrory has joined the channel [22:37] bruse: is Cloud9 really a good editor? [22:38] mAritz: bruse: test it. for me personally it didn't really work last time I checked, but they are coding like crazy and probably fix a billion things per day. [22:38] JimBastard: ajsie: which hosted version? [22:38] bruse: right [22:38] bruse: i tried it out a month or so ago and wasnt amazed [22:38] JimBastard: i created a script to start up multiple cloud9 editors [22:39] ajsie: he said soon [22:41] scvrory: i'm using o3-xml and when i use parseFromString it returns null [22:41] scvrory: and i know the xml is valid because i ran xmllint on it [22:41] mAritz: mape: is there a way to specify the order in which the files are merged? :/ [22:42] rikarends has joined the channel [22:43] mAritz: hm, okay... seems like they get merged in order of definition. works for me. sorry for the highlight :D [22:43] javruben: ETA for hosted cloud9 is this month - private beta [22:43] javruben: but I'll be posting invites here [22:43] rikarends: scvrory: can you somehow get me that xml file so i can debug it? [22:44] ezmobius: back [22:44] ezmobius: wrong room [22:44] javruben: the cloud9 editor has improved a lot since a month ago, and that will go on for the coming weeks [22:44] rikarends: i actually stopped cursing a week ago or something when using it :) [22:44] bruse: that's good to hear [22:44] javruben: its already good enough now to use daily, it wasnt so a month ago [22:45] scvrory: rikarends: i think i'm just going to use a c++ xml parser [22:45] bruse: 2010-09-26 seems to be when i tried it [22:45] rikarends: scvrory: o3-xml IS libxml C++ [22:45] rikarends: scvrory: you just dont notice it because we have precompiled binaries in the module [22:46] scvrory: no i'm aware of that it's just too annoying to debug, i'd rather just write the parser itself using libxml++ [22:46] scvrory: and have it return the appropriate junk [22:46] rikarends: well usually its easy if you have a clear in / out failure case [22:47] scvrory: i just want a library in ANY other language that is as good as python's lxml :( [22:47] rikarends: xml in? fail? > fixable [22:47] rikarends: you can also try o3-fastxml btw [22:47] rikarends: its a completely different xml parser [22:47] scvrory: why doesn't this throw an exception when it fails anyway [22:47] rikarends: its supposed to [22:47] rikarends: i have noticed node not throwing exceptions lately too [22:47] niklasfi1: what happens if i do fs.read(length=1MB) if the file-size is smaller than 1MB? [22:48] rikarends: perhaps something changed in top level exception handling [22:48] overra has joined the channel [22:51] saschagehlich: does someone have a regex that makes a normal string with special chars to a string that is a valid filename under unix and windows? [22:52] shaver: you can't do it in the general case for windows [22:52] rikarends: scvrory: i have created the 'does not throw exceptions' issue on our lib, tomorrow someone will see to it [22:52] shaver: because you need to know the code page for the system [22:53] ph^ has joined the channel [22:53] saschagehlich: shaver: okay... but for unix? :) [22:53] shaver: only chars that are illegal in POSIX pathnames are / and \0 I think [22:54] felixge: shaver: : also ? [22:54] echosystm has joined the channel [22:54] shaver: you can have : in POSIX filenames [22:54] felixge: shaver: ':' being the path separator [22:54] felixge: shaver: indeed [22:55] felixge: shaver: scary [22:55] shaver: and ? [22:55] shaver: you can have anything but / and NUL (\0), IIRC from filesystem work [22:56] metad has joined the channel [22:57] tyfighter has joined the channel [23:01] Epeli has joined the channel [23:03] banjiewen_ has joined the channel [23:06] ajpiano has joined the channel [23:10] echosystm: anyone know of a guide/documentation for making NPM modules? [23:10] echosystm: wait, nevermind [23:11] teemow has joined the channel [23:17] MikhX has joined the channel [23:17] scvrory: rikarends: thanks, sorry i'm not willing to share my xml :P wish i could help [23:18] aurynn has joined the channel [23:18] rikarends: Yeah its fine. I would like to get a look at all that secret government project data though [23:18] rikarends: i think the 'does not throw error' part is easy enough to fix in isolation, maybe that can help you on your way [23:18] rikarends: ;) [23:26] hellp has joined the channel [23:27] marshall_law has joined the channel [23:27] tanepiper: is LOLLERZ from SA forum here? [23:27] modular has joined the channel [23:29] tg: 91 [23:30] rauchg_ has joined the channel [23:31] podman has left the channel [23:34] [[zz]] has joined the channel [23:35] Moominpapa: I'm trying to get my head around vows. [23:35] jamescarr: mph [23:36] Moominpapa: Is there any equivalent to a "setup" function, that gets run for every test? [23:36] Moominpapa: topics are cool, but hurting my head... [23:38] rikarends_ has joined the channel [23:38] echosystm: is there any standard way to do exceptions in nodejs packages? [23:38] sprout has joined the channel [23:39] jamescarr: I fire an error event [23:39] jamescarr: and let the user listen for error [23:39] jamescarr: s [23:40] echosystm: whats the msot common way though? [23:45] xla has joined the channel [23:47] PokeBot has joined the channel [23:47] softdrink has joined the channel [23:51] jameshome has joined the channel [23:55] StanAngeloff_ has joined the channel [23:56] modular: anyone want to test my first node.js project? [23:57] modular: it's a domain name finder... http://impossibility.org/