[00:01] zooko has joined the channel [00:04] [[zz]] has joined the channel [00:05] micheil: ryah: yeah, I have no idea how to handle -- [00:05] melpad has joined the channel [00:07] pngll has joined the channel [00:08] jashkenas has joined the channel [00:10] jakehow has joined the channel [00:11] xraid has joined the channel [00:12] boaz has joined the channel [00:12] xraid has left the channel [00:13] Tim_Smart: micheil: What is this for? [00:13] micheil: node.cc [00:13] micheil: the opt parser [00:13] boaz has joined the channel [00:14] Tim_Smart: Ah ok. Are you doing it in javascript? It would probably be cleaner. [00:14] tjholowaychuk: Tim_Smart: its to low level you cant [00:14] boaz has joined the channel [00:14] tjholowaychuk: to much machinery between it and node.js [00:15] tjholowaychuk: it was just a clusterfuck of conditionals before so it is being revamped to be more approachable [00:16] Tim_Smart: Does C have a opt parser in its stdlib? [00:17] boaz has joined the channel [00:18] bpadalino: it's got a for loop and some flags you can set :( [00:18] Tim_Smart: ;) [00:19] micheil: yeah, it does, it's called getopt and getopt_long [00:19] micheil: getopt.h for the latter [00:19] sideshowcoder has joined the channel [00:19] micheil: unistd.h for the former [00:19] Tim_Smart: Interesting... http://live.gnome.org/Seed [00:20] sprout has joined the channel [00:21] MikhX has joined the channel [00:22] bpadalino: didn't know about getopt and getopt_long .. neat [00:22] muk_mb has joined the channel [00:22] tjholowaychuk: getopt is kinda useless [00:23] SubStack: agree [00:23] SubStack: but there's http://github.com/substack/node-optimist [00:23] SubStack: but that isn't c [00:24] SubStack: still, with a dictionary type you could build the same thing in c [00:25] Aria has joined the channel [00:25] bpadalino: just write a super optimized option parser inspired by ryah's http parser .. [00:25] SubStack: optimizing an option parser sounds super silly [00:26] SubStack: since it only fires up when the application starts up [00:26] tjholowaychuk: yeah that would not be wise [00:28] banjiewen_ has joined the channel [00:28] bpadalino: details, details .. [00:29] tjholowaychuk: coding with a bird in the background is the most annoying thing [00:30] micheil: woah. [00:30] micheil: argv is massive. [00:31] tjholowaychuk: ? [00:31] micheil: http://gist.github.com/623187 [00:31] micheil: massive. [00:31] dpritchett has joined the channel [00:32] ajpi has joined the channel [00:32] tjholowaychuk: i think thats just overflow [00:32] tjholowaychuk: since you have a null in there and then environment variables lol [00:32] tjholowaychuk: or something crazy like that [00:32] MikhX has joined the channel [00:32] tjholowaychuk: check argc [00:33] micheil: actually, that was an error there. [00:33] prettyrobots has joined the channel [00:33] micheil: wooo! [00:33] micheil: got -- working. [00:34] shaver: what's the state of the art for communicating between multiple node.js processes? [00:35] Tim_Smart: shaver: pgriess has a webworker module, if you are going for a more 'forking' approach. Otherwise a named UNIX socket can't go wrong. [00:35] fdfdf has joined the channel [00:35] shaver: a named unix socket can go wrong in a large number of ways [00:35] shaver: but I know what you mean [00:35] tjholowaychuk: there is dnode [00:36] tjholowaychuk: i havent used it [00:36] tjholowaychuk: so i dont know if that is even what it is for :) but something to look into [00:36] shaver: oh [00:36] shaver: hello there, dnose [00:36] JimBastard_: what you trying to do shaver ? [00:36] shaver: dnode [00:36] JimBastard_: dnode is for RMI [00:36] shaver: JimBastard_: I have a system that I can decompose into a bunch of processes [00:36] micheil: tjholowaychuk: dnode is for RPC via websockets [00:36] micheil: iirc. [00:36] dilvie has joined the channel [00:36] fdfdf: hello [00:36] tjholowaychuk: ah gotcha [00:36] JimBastard_: shaver: why? [00:37] JimBastard_: shaver: what are you trying to build [00:37] abe has joined the channel [00:37] shaver: doesn't really fit in this margin [00:37] SubStack: micheil: regular sockets and websockets too [00:37] gerred has joined the channel [00:37] Tim_Smart: shaver: Are these processes spawned from a single parent? [00:38] shaver: Tim_Smart: I'd like to be able to restart them in other orders [00:38] micheil: SubStack: yo is the author, right? [00:38] shaver: but I could probably write code to handle that [00:38] Tim_Smart: shaver: Right, so independant. [00:38] shaver: actually, most of them are worker-ish [00:38] shaver: now that I think of it [00:38] SubStack: micheil: yep [00:39] abe: hello, sorry to interrupt. does anyone know how to get accurate timing data in node [00:39] micheil: abe: not interrupting. [00:39] abe: some kind of high performance / high precision counter ? [00:39] micheil: abe: well, there's always new Date and such [00:39] JimBastard_: abe: there is a microseconds add-on [00:39] SubStack: also I wrote some ruby and perl modules for dnode too [00:39] JimBastard_: i think... [00:39] shaver: Date.now() works OK [00:39] SubStack: and jesusabdullah is writing a python one [00:39] micheil: as for anything higher in precision, it'd probably need to be a npm module [00:40] shaver: in harmony there's a nanoseconds thing [00:40] threeve has joined the channel [00:40] shaver: Date.now() can be sub-millisecond precise, and still be in-spec [00:40] shaver: but I don't know what v8 does there [00:40] Blackguard has joined the channel [00:40] shaver: (high-precision timing is a minefield, to do cross-platform :-( ) [00:40] Tim_Smart: ryah: I think http://live.gnome.org/GObjectIntrospection might have to be employed. [00:40] abe: ahh ok thanks for the help [00:41] abe: i will have to check out data.now() [00:41] JimBastard_: new Date().getTime() [00:41] abe: I have only done high precision timing on windows [00:42] shaver: don't do "new Date" [00:42] shaver: just do "Date.now()" [00:42] shaver: avoid constructing and the method dispatch [00:42] Tim_Smart: v8: Date.now() [00:42] v8bot: Tim_Smart: 1286930556608 [00:43] Tim_Smart: ms since epoch [00:43] shaver: v8: " " + Date.now() + " " + Date.now() [00:43] v8bot: shaver: " 1286930579831 1286930579831" [00:43] JimBastard_: v8: Date.getTime() [00:43] v8bot: JimBastard_: TypeError: Object function Date() { [native code] } has no method 'getTime' [00:43] cloudhead has joined the channel [00:43] JimBastard_: that makes sense [00:43] JimBastard_: v8: new Date.getTime() [00:43] v8bot: JimBastard_: TypeError: undefined is not a function [00:43] JimBastard_: v8: new Date().getTime() [00:43] v8bot: JimBastard_: 1286930610180 [00:43] JimBastard_: v8: Date().getTime() [00:43] v8bot: JimBastard_: TypeError: Object Tue Oct 12 2010 20:43:36 GMT-0400 (EDT) has no method 'getTime' [00:44] shaver: Date() returns a string [00:44] shaver: for reasons that probably only brendan recalls [00:44] shaver: and he just left, or I'd ask him (and make fun of him) [00:44] JimBastard_: i wrote it in two weeks, stop asking me questions [00:44] Tim_Smart: shaver: According to the stack trace it is an object ;) [00:44] micheil: fffuuu... it broke. [00:44] Tim_Smart: v8: typeof Date() [00:44] v8bot: Tim_Smart: "string" [00:44] shaver: Tim_Smart: no [00:44] derferman has joined the channel [00:44] Tim_Smart: String it is. [00:44] JimBastard_: v8: typeof new Date() [00:44] v8bot: JimBastard_: "object" [00:45] shaver: Tim_Smart: that's v8's method-missing message [00:45] micheil: uguh, fixed. [00:45] micheil: switch is evil. [00:45] shaver: mostly you can trace Date's madness back to java.util.Date [00:45] micheil: too evil. [00:45] SubStack: I hate switch [00:46] Tim_Smart: I like it and dislike it. [00:46] Tim_Smart: So somewhere in the middle. [00:48] abe: switch has its place but having fall through's can be error prone at times.. better to break on each clause [00:49] SubStack: better to have a hash or array of closures [00:51] abe: will have to try that one [00:52] zooko has joined the channel [00:53] abe: ok Date.now() seems ok but im sure there must be something better available to the os [00:55] micheil: ryah: okay, while writing I've also identified an issue with the current opt parser, I'll create a ticket for a later fix. [00:56] aho: (high-precision timing is a minefield, to do cross-platform :-( ) <- it's always a minefield [00:56] aho: fortunately a 1msec resolution is good enough for pretty much anything [00:56] banjiewen has joined the channel [00:57] shaver: Date.now() may not actually have 1ms resolution [00:57] micheil: ryah: or not, I think the fix is easy [00:57] shaver: even if it ends in a 1 [00:57] shaver: it's sadface [00:58] DTrejo has joined the channel [00:58] DTrejo: good evening [00:58] DTrejo: JimBastard_: hey Marak [00:59] JimBastard_: DONT BE BLOWING UP MY GOVERMENT [00:59] JimBastard_: :p [00:59] JimBastard_: sup DTrejo [01:00] JimBastard_: how did the presentation go? [01:00] DTrejo: oh it went great [01:00] DTrejo: we got 2nd and $200 [01:00] JimBastard_: who got first? max's team? [01:00] DTrejo: and they want us to present at hacker nyc or somehting like that [01:00] DTrejo: let me look up the name [01:00] DTrejo: no, it was a guy who made the getzazu thing [01:00] DTrejo: except with twilio [01:00] JimBastard_: i must have missed that [01:01] DTrejo: it calls you in the morning and tells you stuff like getzazu would [01:01] JimBastard_: ohh [01:01] abe: ok im off thanks for the help. will stick with Date.now() until something better comes around [01:01] JimBastard_: who the fuck would want to be called in the morning [01:01] JimBastard_: lol [01:01] JimBastard_: that makes sense though [01:01] DTrejo: he integrated like 9 apis [01:01] DTrejo: so yeah, I guess the judges liked that [01:02] DTrejo: JimBastard_: so I plan to use journey for routing and node-static for static files, but what about cookies and regular files? [01:02] DTrejo: should I just use node-static anyway and change the cache headers? [01:02] JimBastard_: sup? [01:03] JimBastard_: whats a regular file [01:03] paulr has joined the channel [01:03] DTrejo: excuse me [01:03] DTrejo: JSON etc [01:03] DTrejo: dynamic stuff that changes every time you talk to it [01:03] DTrejo: wow I'm bad at expressing myself [01:04] JimBastard_: just route your static files to node-static [01:04] JimBastard_: what about cookies? [01:04] DTrejo: and other things I json.stringify? [01:04] DTrejo: yeah that makes sense [01:04] JimBastard_: journey can return any contentType [01:04] JimBastard_: you can override that [01:04] DTrejo: ok [01:05] JimBastard_: you've also got full access to the request / response object [01:05] JimBastard_: inside a journey route you get this.request [01:06] DTrejo: mmk [01:06] Yuffster has joined the channel [01:07] DTrejo: JimBastard_: you mentioned that you have some sites with login functionality — what do you recommend for cookies? [01:08] JimBastard_: DTrejo: for most apps i have the luxary of a single page app, so i can just set the basic auth header once [01:08] JimBastard_: thats not really a great design though [01:09] JimBastard_: i think express and or connect has session support, but the code for it is very simple [01:09] charlenopires has joined the channel [01:09] JimBastard_: you can read though http://github.com/marak/session.js [01:09] ben_alman has joined the channel [01:09] JimBastard_: im not sure the links for express sessions, im sure someone does [01:09] JimBastard_: the technique is the same though [01:10] JimBastard_: voodootikigod has http://github.com/voodootikigod/login.js which might help [01:10] tekky has joined the channel [01:10] voodootikigod: JimBastard_: which reminds me i need to do some loving on [01:10] dnolen has joined the channel [01:10] JimBastard_: dont do loving on me please [01:11] DTrejo: thanks guys :) [01:11] voodootikigod: oh yea baby [01:13] isaacs: micheil: this is what i'm thinking as an eventual API shape: http://github.com/isaacs/node-fuse/blob/dev/hello-fuse.js [01:15] breccan has joined the channel [01:15] c4milo2: isaacs: whops !!! [01:15] isaacs: whops? [01:15] micheil: isaacs: the problem is the invocation of JS methods from C [01:15] c4milo2: isaacs: I started to work in node-fuse two days ago !. I didn't know you were working on it [01:15] micheil: without having access to use handleScope [01:16] isaacs: c4milo2: sweet :) [01:16] micheil: (or I don't think we can access HandleScope [01:16] isaacs: micheil: it's not thar hard. [01:16] c4milo2: isaacs: how is it going ? [01:16] bentruyman has joined the channel [01:16] micheil: c4milo2: we're just starting [01:16] isaacs: c4milo2: well, i can't seem to get the basic hello world to run properly on MacFUSE, which sucks [01:16] c4milo2: isaacs: but the bindings are done ? [01:16] isaacs: c4milo2: are you using the fuse_lowlevel? [01:16] micheil: isaacs: iirc, macFUSE is kinda fucked. [01:16] c4milo2: isaacs: yep [01:17] isaacs: c4milo2: nah, i'm still trying to figure it out [01:17] isaacs: micheil: it's weird, because like every other fuse FS other than "hello world" works fine. [01:17] micheil: I think we'll end up using the standard fuse bindings, it's less dependencies [01:17] isaacs: micheil: sshfs works, encfs works, the python bindings work [01:17] micheil: okay [01:17] isaacs: c4milo2: on github? [01:17] micheil: well, yeah the python bindings use the fuse.h binding. [01:17] isaacs: c4milo2: we should combine efforts. i have done almost nothing with it yet [01:18] micheil: that'll make three devs. [01:18] isaacs: micheil: but so does the hello world example program in the fuse code. [01:18] c4milo has joined the channel [01:18] micheil: hmm.. [01:18] isaacs: c4milo2: but it must use fuse_lowlevel [01:18] micheil: isaacs: maybe it's outdataed? [01:18] c4milo1 has joined the channel [01:18] isaacs: c4milo: this will blow minds. [01:18] c4milo1: isaacs: so what are you using to test it ? [01:18] isaacs: c4milo1: it's literally almost nothing right now. [01:19] isaacs: just an api sketch and an example hello world program that doens't work on anything but linux [01:19] isaacs: c4milo1: i just started reading through the fuse_lowlevel.h last night [01:19] c4milo1: isaacs: I was thinking to implement a dummy filesystem that just call syscalls of the parent file system [01:20] isaacs: c4milo1: so, there's like a million file systems i want to implement. but i want to implement them in js [01:20] isaacs: that's the rub [01:20] isaacs: so, i'm thinking, what we really need is really really good bindings to the fuse_lowlevel api [01:20] c4milo1: isaacs: ahah I want to implement ext4 to be able to mount my linux partitions on mac osx :D [01:20] mbrochh has joined the channel [01:20] isaacs: and then you can wrap that in js, so it's like the hello-fuse.js sketch i wrote [01:21] c4milo1: yes ! [01:21] c4milo1: that would be really really nice [01:21] isaacs: mostly, i want to have two things: 1. a couchdb mount that doesn't suck a lot (blocking + http = hurt) and 2. an easy way to test pathological fs behavior [01:21] isaacs: without having to like, ya know, hit my hd with a hammer [01:21] c4milo1: isaacs: are you guys working full time on this or just a few hours every day ? [01:22] isaacs: c4milo1: so, far, just a few hours last night. that's it [01:22] isaacs: and i sent some emails to some fuse mailing lists about why hello world isn't working on my mac [01:22] isaacs: i got part of the way through a node binding to fuse.h, and then realized how sucky that would be, since it means blocking everything [01:22] c4milo1: isaacs: do you have some gists ? [01:22] c4milo1: or repo [01:22] micheil: isaacs: is fuse.h blocking? [01:23] isaacs: micheil: yeah [01:23] micheil: ACTION didn't know. [01:23] isaacs: c4milo1: http://github.com/isaacs/node-fuse/ [01:23] micheil: isaacs: means I read heaps of the wrong shit yesterday.' [01:23] andrewa2 has joined the channel [01:23] isaacs: micheil: well, actually, it does some clever threading stuff, and uses the non-blocking fuse_lowlevel.h under the hood [01:23] andrewa2 has left the channel [01:23] mAritz: Tim_Smart: seriously, now you're here? i had a bunch of questions earlier about biggie-orm, but now everythings fine. but don't worry, i'll have more soon enough! :P [01:23] micheil: k [01:23] isaacs: but if you use the functions in fuse.h, they switch behavior based on the return value. [01:24] isaacs: so you'd have to like, thread that shit, and it'd go through eio-custom, to fuse.h (blocking), to fuse_lowlevel.h (nonblocking), which is dumb [01:24] isaacs: better to just wrap up fuse_lowlevel.h in javascript [01:24] c4milo1: isaacs: nod [01:24] SubStack: fuse! [01:25] isaacs: way way easier, except for the fact that fuse_lowlevel's documentation is nonexistent [01:25] isaacs: it's comments, and "look at how it's used in fuse.c" [01:25] micheil: isaacs: I'm cool with implementing that. [01:25] zooko has joined the channel [01:25] isaacs: so, my plan is, write a hello world that works on the mac using fuse.c, then write the same hello world using fuse_lowlevel, and then do the node binding, because at that point, i'll know enough about how fuse works that it'll be easy [01:25] micheil: isaacs: how do you think I learn most stuff? [01:25] isaacs: hehe :) [01:26] isaacs: not working on the mac is not cool, though [01:26] charlenopires has joined the channel [01:26] micheil: just learnt about getopt's by rewriting the node.cc ParseArgs method [01:27] bruse: do you like it? [01:27] micheil: like what? [01:27] bruse: there are probably as many methods to parse arguments as there are developers [01:27] isaacs: in fact, the hello.c program is included in the macfuse svn repo, and doesn't work on snow leopart [01:27] isaacs: *d [01:27] c4milo1: isaacs: ok so i will continue working on my stuff, perhaps we can share knowledge and experiences :) [01:27] TheEmpath has joined the channel [01:27] micheil: where would the code that sends node into repl be? [01:27] dilvie has joined the channel [01:27] isaacs: c4milo1: how does that development path sound? [01:28] isaacs: micheil: src/node.js [01:28] micheil: k [01:30] micheil: looks like I can't stop: build/default/node -e | echo "console.log('test');" [01:30] micheil: from sending node into repl. [01:30] c4milo has joined the channel [01:30] c4milo has joined the channel [01:30] isaacs: micheil: process.binding("stdio").isStdoutBlocking() [01:30] micheil: ? [01:31] c4milo: isaacs: good. the best way to learn in this case is getting hands on with the API due its poor documentation and studying another bindings (python, ruby, erlang, ocaml, etc) [01:31] isaacs: micheil: oh, wait, that doesn't work that way any more. [01:31] isaacs: c4milo: none of the other bindings use the lowlevel api [01:31] isaacs: c4milo: the macfuse svn has a "hello_ll.c" that does [01:31] isaacs: c4milo: but that doesn't work on snow leopard, either, apparently [01:31] micheil: isaacs: there is one that does.. forget where I saw it though [01:32] c4milo: isaacs: compile error or just it doesn't work ? [01:32] pengwynn has joined the channel [01:32] isaacs: c4milo: http://groups.google.com/group/macfuse/browse_thread/thread/d5eff547078b200c [01:32] hober: Aria: yt? [01:32] softdrink has joined the channel [01:32] c4milo: isaacs: looking at it .. [01:32] Aria: I am [01:33] isaacs: c4milo: my next move was going to be to check out hte encfs source and see what it does differently, because it works fine on my machine [01:33] hober: I'm seeing something funny that might be jsdom or might be at your parser's end of it. hold on, will try to make more minimal test case [01:33] isaacs: i mean, it's got its quirks, but it's actually pretty nice [01:33] sprout has joined the channel [01:34] c4milo: hey isaacs [01:34] isaacs: c4milo: yo [01:34] c4milo: isaacs: add to your compile flags this [01:34] c4milo: isaacs: -mmacosx-version-min=10.5 [01:34] isaacs: interesting. [01:35] Tim_Smart: isaacs: I might be interested in writing fuse bindings - mainly just to get more familiar with c++. [01:35] isaacs: C4MILO: OMG YES YOU ARE A GENIUS AND I <3 YOU IN AN AWKWARDLY FRIENDLY WAY!! [01:36] c4milo: isaacs: :) [01:36] isaacs: what does that do? [01:36] c4milo: thats a known issue with macfuse in Snow Leopard [01:37] isaacs: ok... [01:37] c4milo: http://www.mail-archive.com/macfuse@googlegroups.com/msg01017.html [01:37] isaacs: but i mean, in general, what does -m do? [01:37] hober: Aria: I'm essentially reading a file in, using your parser to produce a dom, doing some straightforward dom manip, and then serializing the dom to another file [01:37] Aria: Sweet. That's one thing I've been doing with it. [01:38] hober: Aria: not rocket science. what I'm seeing is, if I have an explicit tags in the source document, when I serialize some stuff ends up in that I would expect to be in [01:38] Aria: Oh yeah? Got examples? [01:38] isaacs: c4milo: ok, step 1 is down. [01:38] isaacs: c4milo: step 2 is to understand hello_ll.c [01:38] hober: If I don't have explicit tags, everything ends up in where I expect [01:39] micheil: woo. I think I'm finished this patch! [01:39] isaacs: c4milo, micheil, Tim_Smart, SubStack, anyone else interested in joining the node-fuse party: what do you think of this api? http://github.com/isaacs/node-fuse/blob/dev/hello-fuse.js [01:39] dpritchett has joined the channel [01:40] micheil: isaacs: I'll check in a moment [01:40] micheil: just doing file tidy up before landing a new opt parser for node as a pull [01:40] c4milo: isaacs: looking at it … [01:40] isaacs: basically, the idea will be that the cb can be called at any time, and all the setup will be in the fuse.mount() call, so if you have to do some http or something, it'll just be nonblockingly lovely [01:40] isaacs: and if you call the cb right away? no big deal. but either way, completely up to the implementer. [01:41] jakehow has joined the channel [01:41] jashkenas has left the channel [01:41] Evet has joined the channel [01:42] matt_c has joined the channel [01:43] hober: Aria: http://gist.github.com/623267 [01:44] Aria: Interesting! [01:46] c4milo: isaacs: it looks good but I would like to add the inode number as param also. [01:46] hober: Aria: any guesses as to where I should begin to debug that? [01:46] isaacs: c4milo: i think the inode number is managed by fuse [01:46] Aria: Well, in the tools/ in the html5 package, there's a tool to run a test case with various debugs turned on. [01:47] Aria: I was just about to go trace the parser states for some of those. [01:47] isaacs: c4milo: but it might be supplied on the info object [01:47] isaacs: c4milo: so you could track it [01:47] isaacs: c4milo: getting hello world implemented will be a huge step. from there, it's just adding more support for more functions. [01:48] c4milo: isaacs: ok. sounds reasonable. So when I can start with my ext4fuse :P [01:48] isaacs: hehe [01:48] isaacs: c4milo: if you wanna write it in C, you can do it now ;) [01:48] Me1000 has joined the channel [01:48] c4milo: isaacs: plop ahahah [01:49] hober: Aria: fwiw, it still happens if I disable all of the intermediary dom manip (adding , etc.) [01:49] Aria: ACTION nods. [01:49] isaacs: c4milo: realistically, probably some time in the next week or two, i should have the first few bits of the binding done. [01:49] c4milo: isaacs: I can do it in C but I don't want to finish it in 2012 [01:49] Aria: As it should, since that's post parse. [01:49] softdrink has joined the channel [01:49] Me1000 has joined the channel [01:49] isaacs: c4milo: i mean, the fs api is kinda huge, and fuse implements ALL of it. [01:49] hober: Aria: indeed. [01:49] isaacs: c4milo: all that's required for hello world is getattr, open, read, and readdir [01:50] isaacs: c4milo: but i wanna make it possible to write a complete fuse program in js [01:50] Aria: ACTION sighs and hates on node's argv layout. [01:50] micheil: Aria: ? [01:50] micheil: I'm working on that at the moment. [01:51] Aria: Oh, just argv[0] == node, argv[1] = script, argv[2] = what I expect argv[0] to be. [01:51] Aria: (coming from ruby) [01:51] micheil: Aria: ask ryah about it. [01:51] isaacs: Aria: ruby is wrong there, imo [01:51] micheil: if he says yes, then I change it. [01:51] isaacs: Aria: argv[0] should be $0 [01:51] isaacs: Aria: argv[1] is $1 [01:51] shaver: I think Aria's right [01:51] Aria: That's one way that works, too. That would also surprise me less. [01:51] bruse: i agree with isaacs [01:51] derferman has joined the channel [01:52] shaver: you very rarely want to treat program-name and script-file the same way as "user-provided arguments" [01:52] Aria: I really found Ruby's way to make a lot of sense, since you then almost always have to shift argv if not. [01:52] Tim_Smart: Aria: argv changes on the context. [01:52] Aria: Yeah, exactly, shaver. [01:52] isaacs: when you do "./my-node-prgram.js foo", and it's shebanged to "node", then what your'e really doing is "node my-node-program.js foo" [01:52] Aria: I haven't wanted argv[0] or [1] yet. [01:52] SubStack: Aria: you mean perl's way [01:52] Aria: Well, yes. But the 'node' and 'my-node-program.js' are special there. [01:52] shaver: I suspect that there are 10x more programs in node that have to manually skip [0] and [1] to enumerate over arguments uniformly, than that need argv[0] where it is [01:52] isaacs: Aria: i've wanted to look at argv[1] before [01:52] isaacs: Aria: it works the same as it does in a C program [01:53] shaver: process.nodePath process.scriptPath [01:53] SubStack: but then perl just took it from awk probably [01:53] isaacs: where argv[0] is the executable, and the rest is the args [01:53] whoahbot has joined the channel [01:53] shaver: the provenance is clear [01:53] shaver: it's just not useful :-) [01:53] Aria: Oh, me too. But not in the same context as user supplied args. [01:53] isaacs: Aria: take it up with posix [01:53] shaver: in C it's there for efficiency and historical reasons [01:53] Aria: And yeah, what shaver said. [01:53] shaver: node needn't follow posix here [01:53] bruse: argv[0] and argv[1] is just as user submitted as argv[n] [01:53] Aria: Yeah, it really needn't. Ruby broke with that tradition to good effect. [01:53] SubStack: posix is also synchronous [01:53] SubStack: except for when it's not [01:53] micheil: Okay, well, I'm not changing it in this patch. [01:54] isaacs: Aria: nah, it just turned all the ruby users into whiners ;P [01:54] micheil: Discuss it on the mailing list. [01:54] Aria: bruse: Sure. But do you ever use them for the same thing? [01:54] whoahbot has joined the channel [01:54] Aria: I may have to. [01:54] isaacs: userargs = process.argv.slice(2) [01:54] SubStack: AIO or some such [01:54] bruse: i guess i dont [01:54] shaver: it just makes process.argv less useful [01:54] isaacs: Aria: i want process.argv to be the actual argv of the process, for the same reason that i want request.url to be the actual url of the http request [01:54] Aria: Heh. And what do you do with this? [01:55] isaacs: Aria: well, for starters, i know that [0] is the executable and [1] is the script [01:55] shaver: except that it might not be [01:55] Aria: Sure. One could just as easily know that process.executable is the executable and process.script is the script [01:55] shaver: depending on what the caller did [01:55] isaacs: Aria: also, if there ever comes a time when i want to know what was actually supplied to the process, i'll have that [01:55] shaver: the caller of exec, I mean [01:55] isaacs: reduce magic [01:55] Aria: Yes, is this even close to a normal use case, isaacs? [01:55] shaver: but neither aria nor I are arguing that that information should be *removed* [01:55] isaacs: Aria: consider "mate" vs "mate_wait" [01:55] shaver: just that there should be a way to get "arguments to my program" [01:56] Aria: Or do most people really just want to see what came after "that thing I wrote" on the command line? [01:56] bruse: what's the point of making argv[2] into argv[0] then? [01:56] Tim_Smart: Basically the normal way to parse arguments is to loop over them and look for the stuff you want. [01:56] bruse: everyone knows what argv looks like [01:56] shaver: and it should be the easy thing, and everywhere [01:56] Aria: bruse: Eliminating two shifts for the normal case. Or a slice. [01:56] bruse: i'd be more confused if it looked different from anywhere else [01:56] isaacs: Aria: there are cases where i may want to switch behavior based on the filename of the executable. [01:56] shaver: (I think it should be called "arguments" rather than argv, too) [01:56] micheil: Aria: take it to the mailing list. [01:56] Aria: Sure, isaacs. So you switch on process.executable ;-) [01:56] micheil: that way we can have a well thought out discussion about it. [01:56] isaacs: shaver: can't. "arguments" is special, and means something different than argv [01:56] SubStack: var argv = require('optimist').argv; // it's just a hash! [01:56] shaver: isaacs: not in top-level code it doesn't have to [01:57] Aria: (yeah, though I could take it either way. argv is at least unambiguous.) [01:57] SubStack: see, no switches or any of that nonsense [01:57] shaver: arguments is a permitted variable name [01:57] isaacs: Aria: the point is that argv in node should be have like argv in C, imo. [01:57] shaver: in ES5 [01:57] isaacs: node is a js binding to C-land [01:57] andrewfff has joined the channel [01:57] Aria: Yeah, I'm asking why that's your opinion. [01:57] shaver: no, swig is a JS binding to C-land [01:57] Aria: Heh, it's a very twisted binding to C-land. [01:57] isaacs: hehe [01:57] shaver: node is an application environment [01:57] isaacs: sure [01:57] SubStack: don't write c in javascript [01:57] shaver: you can't make syscalls directly or work with C structs [01:57] Aria: It changes the API almost entirely, and in ways that largely make sense (and make common things really easy.) [01:57] isaacs: it's a binding to a few certain C libraries, to be more specific [01:57] shaver: so it's a poor binding to C-land! [01:58] Aria: I have yet to see a use for argv that doesn't involve treating [0] and [1] specialy. [01:58] shaver: yeah [01:58] Aria: And that just reeks to me. [01:58] isaacs: Aria: ruby is the only platform that shifts off argv[0, 1] [01:58] isaacs: Aria: that has always struck me as odd [01:58] SubStack: isaacs: it gets it from perl [01:58] Aria: Oh, it is odd. It's also really nice. [01:58] Aria: (and yeah, perl does similar) [01:58] isaacs: ah, ok, perl too, then [01:58] SubStack: and [1] goes into $0 [01:58] SubStack: so you can still get at it [01:58] isaacs: makes sense, since ruby is like perl in a lot of ways [01:58] aurynn: Is the crux of this argument "It's really hard to remember to shift the array" ? [01:58] Tim_Smart: node shall not mess with my argv. [01:59] murphy has joined the channel [01:59] Aria: ruby /does/ get rid of [0], which is sad. [01:59] shaver: erlang's bootargs doesn't have image-name in it, afaict [01:59] SubStack: no ruby has $0 too [01:59] isaacs: i really dig that in node, argv is the same in my program as it is in a C main() function [01:59] Aria: But one rather often wants to, say, system(argv[0], argv[2..-1]) [01:59] Aria: SubStack: Yes, it has $0. which is argv[1], not argv[0] [01:59] SubStack: anyways just process.argv.slice(2) [02:00] Aria: Yeah, I just hate having to do that. Since every single use of argv I've had has had a slice(2) on it. [02:00] Aria: Every. Last. One. [02:00] aurynn: oh no? [02:00] SubStack: Aria: use optimist! [02:00] isaacs: Aria: there's a principle of least surprise issue at work here. [02:00] bruse: java also starts its argument list on argv[2] [02:00] SubStack: your option parsing will NEVER BE THE SAME AGAIN [02:00] danielzilla has joined the channel [02:00] Aria: Hehe, yes. I'm REALLY surprised by it being [2] for the first argument to my app ;-) [02:01] isaacs: nodejs may attract many rubyists, but it is driven at it score by religious C coders [02:01] Aria: 0 and 1 I both expect. [02:01] shaver: it's also not uncommon in C to modify argv in place [02:01] isaacs: shaver: sure, and you can do that in your node app, too ;) [02:01] bruse: by the way, start programs with argc = 0 and see lots of interesting crashes [02:01] shaver: isaacs: but you can't just pass "argv + 2" and have it work, because JS arrays aren't dependent [02:02] isaacs: shaver: no, that's true. but you can do process.argv.splice(2) [02:02] bartt has joined the channel [02:02] shaver: no [02:02] shaver: you still don't get a refrence to the original array, offset [02:02] isaacs: shaver: oh, right, that'd just slice it in place. [02:02] micheil: woot! http://github.com/ry/node/pull/346 [02:02] isaacs: shaver: well, i mean, Array != array [02:02] Aria: (also, in sh, $0 is the script and $1 is the first user supplied arg) [02:03] Aria: (and 'bash' is not in the list) [02:03] Aria: (nor sh) [02:03] shaver: for context, I've been having this argument about the spidermonkey shell for like a decade now [02:03] shaver: man, longer [02:03] isaacs: Aria: $0 is /bin/bash [02:03] shaver: 15 years, almost [02:03] isaacs: Aria: unless you're in a subshell [02:03] kjftw has joined the channel [02:03] isaacs: $ echo $0 [02:03] isaacs: $ echo $0 [02:03] isaacs: . /bin/bash [02:03] shaver: yeah [02:03] Aria: aredridel@coriolis:~/Projects/html5$ ./t.sh [02:03] Aria: ./t.sh [02:03] isaacs: (stupid IRC eating my output ;) [02:03] shaver: $ sh -c 'echo $0' [02:03] shaver: sh [02:03] Aria: (that's echo $0) [02:03] shaver: sure [02:03] isaacs: Aria: right, and that's inside a subshell [02:04] isaacs: in a subshell, $0 is the name of the program you called. [02:04] Tim_Smart: test [02:04] Tim_Smart: >.> [02:04] isaacs: and if you wanna complain about that, take it over to #bash ;) [02:04] Aria: aredridel@coriolis:~/Projects/html5$ ./t.js [02:04] Aria: node [02:04] Aria: I'm just saying there's some serious sources of surprise here. [02:05] isaacs: process.argv is the argv as it appears to node. [02:05] isaacs: personally, i dig that [02:05] Aria: Yeah? What do you use it for? [02:05] langworthy has joined the channel [02:06] isaacs: Aria: yeah, but then why not mung the req.url? [02:06] isaacs: Aria: it's the same thing [02:06] Aria: Except its not. [02:06] isaacs: Aria: everyone has to figure out the hostname, and that means they have to read the req.headers.host and then append the req.url [02:06] Aria: You use the url verbatim to construct a self-reference. That's a very, very normal case. [02:06] Aria: And a very strange one for argv [02:06] isaacs: it's the same principle [02:06] chapel: hmm [02:06] Aria: Is it? [02:06] chapel: someone was talking about args? http://bitbucket.org/mazzarelli/js-opts/wiki/Home [02:06] isaacs: rather than show you what we think you're going to need, we show you exactly what is there, and let you figure it out. [02:07] isaacs: node is a lowlevel API [02:07] Aria: (args come out as an array. req.url does. .. not.) [02:07] isaacs: Aria: that's the closest analogy to a char** [02:07] micheil: Aria: seriously, just take this to the mailing list. This is not going anywhere here. [02:07] Aria: Hehe. I may well have to write this up. [02:07] isaacs: hehe [02:07] isaacs: sure [02:07] dpritchett has joined the channel [02:08] isaacs: i've gotta head back to oak land anyway. see ya :) [02:09] shaver: yeah, I guess I have to join th list now [02:09] davidwalsh has joined the channel [02:10] davidascher has joined the channel [02:10] Aria: Ooh, new node bug! [02:10] micheil: shaver: not really, we just recommend it. [02:10] Aria: require(anemptyjsfile) throws an error. [02:11] shaver: well, if I want to participate in the conversation about argv [02:11] c4milo has left the channel [02:11] micheil: Aria: no, it doesn't. [02:11] Aria: Huh. Did for me just now. [02:11] Aria: v0.3.0-pre [02:12] micheil: hmm.. [02:12] micheil: doesn't in v0.3.0-pre for me [02:12] micheil: Aria: time to git pull I think. [02:13] Aria: Indeed. Lemme see if it breaks after that. [02:13] hober: Aria: thanks for your help! [02:13] Aria: Sure thing. Still staring at it, hober. Trying to make sense of it ;-) [02:14] hober: :) [02:16] Aria: I'm just committing a tools/parse-doc.js. if you node tools/parse-doc.js anhtmlfile parser,tokenizer, you'll get the state change info from the parse. [02:17] micheil: Aria: what does this tools/parse-doc.js do? [02:17] hober: ok, thanks [02:17] micheil: and are you talking node/tools/*? [02:17] Aria: No, I'm talking html5/tools/* [02:17] micheil: k [02:18] Aria: And it parses an HTML file. [02:18] Aria: Just a testbed for working on testcases in separate files [02:20] ryah: Aria: i've been meaning to fix the argv stuff for a long time [02:20] Aria: Yea? [02:20] ryah: just never got around ot it [02:20] Aria: Hehe. [02:21] Aria: Well, count a vote for treating the first two args as it is now specially. (process.executable and process.script or process.filename being my suggestion) [02:21] ryah: Aria: yeah [02:22] ryah: process.execPath is $0 [02:22] Aria: Nice. [02:22] ryah: (except better) [02:22] Aria: (Altered from what the OS gave it? Dereferenced?) [02:22] shaver: yeah [02:22] shaver: that is great news [02:22] shaver: yay ryah [02:23] mbrochh has joined the channel [02:23] mbrochh has joined the channel [02:23] ryah: http://github.com/ry/node/blob/0fcb3bd3a9f585562c5b421314c206c9438f6cef/src/platform_linux.cc#L123-127 [02:23] hober: Aria: I've added a comment to that gist with the first bit of the output from parse-doc.js [02:23] Aria: and micheil, yes, that fixes the empty js file error. [02:23] hober: (only up 'til it looks to me like it's gone off the rails) [02:23] micheil: ryah: well, I've just fixed part of the argv stuff [02:24] Aria: sweet, hober. It looks like to me it's parsing the \n as something that belongs in the body, so it starts the body tag, rather than keeping it in head. [02:24] hober: yeah [02:24] hober: the phase transition to afterHead is before the first tag even closes [02:24] Aria: Oh, fun! Reading /proc/self/exe. I love and hate linux for such an API. [02:24] hober: no, nevermind, it's right after the first open tag [02:24] hober: so yeah, it's the \n like you thought [02:25] Aria: Hehe. (I added a debug to tokenizer.emitToken and it made it obvious.) [02:25] hober: oh, I'm passing >40% of the tokenizer tests in my elisp tokenizer btw [02:25] hober: mostly due to my test runner needing work [02:25] hober: I think the tokenizer is pretty much done [02:26] Aria: Sweet. [02:26] cardona507 has joined the channel [02:27] dguttman has joined the channel [02:28] twoism has joined the channel [02:28] micheil: ryah: http://github.com/ry/node/pull/346 [02:28] micheil: :D [02:29] dohtem has joined the channel [02:29] dohtem has joined the channel [02:30] dohtem has left the channel [02:31] micheil: hmm.. it's annoying how many issues on the github tracker aren't valid. [02:31] gf3 has joined the channel [02:31] shaver: that sounds _great_ [02:32] jameshome has joined the channel [02:32] micheil: shaver: in the sense that they ask for an api to do X when it already exists in node. [02:32] Aria: Wow, congrats, hober. You found a bug! [02:33] shaver: that sounds like a documentation or API design bug, mis-described :-) [02:33] micheil: shaver: it's definitely documented. [02:33] softdrink has left the channel [02:33] Tim_Smart: shaver: Or just humans that don't utilize C-f in browsers ;) [02:33] hober: Aria: :) [02:34] aho has joined the channel [02:34] Aria: And fixed. [02:34] micheil: like this as well. http://github.com/ry/node/issues#issue/184 [02:35] Aria: .... aaand you fixed a half dozen test cases I hadn't gotten to yet. Thank you. [02:35] micheil: if you've read the docs / played with node, you'd find out that the require function caches modules. [02:35] Aria: Yeah. Though I'd love to see what happens when you turn that off, or un-cache one. [02:35] ryah: micheil: nice [02:36] micheil: ryah: that's the other benefit of going to a third party bug tracker; people don't need to be committers to manage bugs [02:36] hober: Aria: lovely. verifying... yup, looks good [02:36] softdrink has joined the channel [02:37] Aria: Awesome! [02:37] hober: I might actually get this code into a releasable state this week [02:37] hober: thanks to that bugfix [02:37] derferman has joined the channel [02:38] ysynopsis1 has joined the channel [02:41] rcy has joined the channel [02:41] meso has joined the channel [02:41] Aria: Yay, hober [02:44] siculars has joined the channel [02:44] ossareh has joined the channel [02:46] everton has joined the channel [02:46] eisd has joined the channel [02:47] mjr_ has joined the channel [02:48] everton_ has joined the channel [02:49] eisd has joined the channel [02:50] meso has joined the channel [02:55] hober: Aria: is there any way to control the output of HTML5.serialize? [02:55] hober: e.g. downcasing element names, prettifying whitespace, that sort of thing [02:55] Aria: Not much, but what do you want? [02:55] Aria: Ah, fun. [02:56] DTrejo_ has joined the channel [02:57] dpritchett has joined the channel [02:57] jacobolus has joined the channel [02:57] seangrov` has joined the channel [02:59] hober: really just downcasing would do it for me, but it would be nice to have other such formatting options [03:01] davidwalsh has joined the channel [03:05] MikhX has joined the channel [03:05] DTrejo_: ACTION just reread his conversation with JimBastard_ and realized how little sense he was making [03:06] hober: Aria: another bug report: HTML5.serialize serialies as a non-void element, with a closing tag. [03:06] hober: it shouldn't emit a closing tag for any void element [03:06] Aria: Third parameter of serialize: {lowercase: true} [03:06] hober: sweet, thanks [03:06] Aria: Alright. Interesting. [03:06] hober: make that and , btw. [03:07] hober: jsdom's doc.outerHTML gets this right FWIW [03:07] Aria: Huh, okay. [03:07] hober: [but jsdom quotes ' and " in