PageRenderTime 76ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/data/irc-logs/raw/2010-11-21.txt

https://github.com/Marak/node-stats
Plain Text | 1852 lines | 1852 code | 0 blank | 0 comment | 0 complexity | 16f3e0604e28f71070d558fcbf65258f MD5 | raw file
  1. [00:04] mscdex has joined the channel
  2. [00:06] ilpoldo has joined the channel
  3. [00:07] vdrab has joined the channel
  4. [00:07] saml has joined the channel
  5. [00:08] tapwater has joined the channel
  6. [00:08] saml: so module loading is not asynchronous!
  7. [00:08] Aria: Nope.
  8. [00:09] tanepiper: not yet anyway
  9. [00:10] tanepiper: it's still not commonjs standard, athough there is a spec out there for it
  10. [00:11] Aria: As much as commonjs /is/ a standard.
  11. [00:11] c4milo has joined the channel
  12. [00:11] saml: so things can block during loading
  13. [00:11] saml: is there a way to preload stuff before event loop even starts?
  14. [00:11] Aria: Sure. Put it at the top ;-)
  15. [00:12] SvenDowideit_ has joined the channel
  16. [00:13] atmos has joined the channel
  17. [00:14] zimbatm has joined the channel
  18. [00:15] henrikh has left the channel
  19. [00:18] tanepiper: cloudhead: ping
  20. [00:19] galaxywatcher has joined the channel
  21. [00:20] monokrome: Anyone know what to do about "ReferenceError: StopIteration is not defined"
  22. [00:20] jashkenas: monokrome: don't use StopIteration outside of firefox.
  23. [00:20] monokrome: Only reason that I'm using it is because someone in here told me to :/
  24. [00:21] jashkenas: Idle question: Why is it that Node includes ["node", "path/to/script.js"] in process.ARGV? Why isn't it preferable for ARGV to just include the actual arguments passed?
  25. [00:21] jashkenas: monokrome: you can feature-detect it if you like: http://documentcloud.github.com/underscore/docs/underscore.html#section-5
  26. [00:22] tanepiper: jashkenas: nope, expected behaviour for args
  27. [00:22] tanepiper: for example, python does the same thing
  28. [00:22] jashkenas: Ruby does not -- it just gives you the real arguments.
  29. [00:23] jashkenas: I mean, does anyone use the first two args for anything productive, or is there a lot of process.ARGV.slice(2) going on here?
  30. [00:23] jashkenas: (not that I'm suggesting it should be changed and break things ... just curious if there's a use-case.)
  31. [00:25] tanepiper: well i've never coded ruby, but other languages i have always have the full arg string as an array, including the calling program
  32. [00:25] jashkenas: tanepiper: have you personally ever used the first two args?
  33. [00:27] tanepiper: personally, no, but if it's there i'm sure others do. unix geeks do weird things
  34. [00:30] tanepiper: hmm, this is the weirdest damn bug in cradle :(
  35. [00:31] tanepiper: saves fine for existing documents, crashes on saving new ones
  36. [00:31] confoocious has joined the channel
  37. [00:35] tanepiper: ahh bloody depricated features
  38. [00:38] Tim_Smart has joined the channel
  39. [00:38] charlenopires has joined the channel
  40. [00:39] teemow has joined the channel
  41. [00:40] teemow has left the channel
  42. [00:40] RevoOf has left the channel
  43. [00:40] noahcampbell has joined the channel
  44. [00:41] monokrome: path doesn't have a method for converting the path to an absolute path?
  45. [00:42] sstephenson: fs.realpath
  46. [00:42] monokrome: ah
  47. [00:43] monokrome: you'd think it'd be: path.real :)
  48. [00:43] monokrome: thank you
  49. [00:44] cloudhead: tanepiper: sup
  50. [00:45] Tim_Smart: monokrome: Not really, path are just utility functions, whereas realpath is a syscall
  51. [00:45] Tim_Smart: fs contains the file system syscalls
  52. [00:45] tanepiper: cloudhead: nothing, fixed it in the end - my code was randomly still using an insert somewhere
  53. [00:46] cloudhead: ah : )
  54. [00:46] tanepiper: npm version wasn't telling me, just saying Object didn't have query
  55. [00:46] tanepiper: but head version told me it was depricated so i was able to trace it
  56. [00:46] cloudhead: oh
  57. [00:46] cloudhead: yea, it's @latest on npm
  58. [00:46] kriszyp has joined the channel
  59. [00:48] cloudhead: Is there a way I can use `global` to set global vars?
  60. [00:48] cloudhead: doesn't seem to work
  61. [00:49] tanepiper: global.foo = 'bar'; not working for you?
  62. [00:50] jashkenas: global should work.
  63. [00:50] arpegius has joined the channel
  64. [00:51] maushu: Dammit, I wonder if I'm making my project way too interfacy.
  65. [00:53] masahiroh has joined the channel
  66. [00:54] cloudhead: jashkenas: tanepiper: so I should be able to access the same object in all required() modules?
  67. [00:54] jashkenas: yep.
  68. [00:54] cloudhead: ok, guess I'll try that again
  69. [00:54] jashkenas: I use it for making tests easier... global[key] = value for key, value of require('assert')
  70. [00:55] jchris has joined the channel
  71. [00:59] killfill has joined the channel
  72. [01:00] cloudhead: jashkenas: k I got it. The weird thing is if you console.log(global), it'll look empty no matter what..
  73. [01:02] InsDel has joined the channel
  74. [01:03] tanepiper: cloudhead: you can also do exports.foo = bar
  75. [01:03] tanepiper: then use module.parent.exports
  76. [01:03] isaacs: ryah: hey, i figured out a workaround. it sucks a lot, though
  77. [01:04] isaacs: ryah: just doing the readStream.resume() on a process.nextTick in utils.pump makes it work, but it also makes pump() really slow.
  78. [01:05] isaacs: ryah: the problem seems to be that write() returns false, and then somehow emits "drain" before the readStream is actually paused.
  79. [01:05] killfill has joined the channel
  80. [01:05] isaacs: but that seems like it makes no sense.
  81. [01:06] isaacs: the flow seems to be: write() returns false, writeStream emits "drain", readStream resumes, readStream gets paused
  82. [01:06] isaacs: and then at that point, it's halted.
  83. [01:07] isaacs: i'm looking at the code, though, and it does not do that.
  84. [01:07] isaacs: I notice that I am confused. My mental model is making inaccurate predictions.
  85. [01:13] ryah: isaacs: hm
  86. [01:13] isaacs: ryah: sense makes this none, right?
  87. [01:14] isaacs: the fact that wrapping the readStream.resume() in a nextTick actually works is really strange.
  88. [01:14] isaacs: also, it's not a solution, because it makes things crazy slow
  89. [01:14] ryah: i'm afraid my house might be blown down
  90. [01:14] ryah: :(
  91. [01:14] aubergine has joined the channel
  92. [01:14] isaacs: little pig little pig...
  93. [01:15] dnolen has joined the channel
  94. [01:16] aubergine_ has joined the channel
  95. [01:16] isaacs: ryah: have the semantics chaned at all wrt write() returning false, or "drain" being emitted?
  96. [01:16] ryah: isaacs: can you turn on the debug output and see what it looks like - you have to set -DDUMP_DEBUG in build/c4che/default.build.py
  97. [01:16] ryah: isaacs: in the CPPFLAGS
  98. [01:16] ryah: and recompile
  99. [01:17] isaacs: right, i just added a bunch of process.binding("stdio").writeError in utils.js
  100. [01:17] isaacs: and my own logging in npm, as well. seems to confirm
  101. [01:17] ryah: so that it looks like this
  102. [01:17] ryah: CPPFLAGS = ['-DDUMP_DEBUG', '-DHAVE_OPENSSL=1', '-DEV_FORK_ENABLE=0', ...
  103. [01:17] isaacs: sure, i'll try that
  104. [01:18] killfill has joined the channel
  105. [01:18] ryah: build/c4che/default.cache.py i meant
  106. [01:18] tilgovi has joined the channel
  107. [01:18] isaacs: right
  108. [01:21] jchris has joined the channel
  109. [01:23] unomi has joined the channel
  110. [01:25] isaacs: yeah, it's definitely ending on a write() returning false, and then pausing, and never draining
  111. [01:26] aubergine_ has joined the channel
  112. [01:26] JimRoepcke has joined the channel
  113. [01:28] isaacs: ok, an equally hacky, but much faster solution: don't pause() the readStream unless write() returns false twice.
  114. [01:28] isaacs: and don't resume() the readStream unless i'ts actually been paused.
  115. [01:30] mjr__ has joined the channel
  116. [01:30] isaacs: my suspicion there is that write() is returning false when it shouldn't.
  117. [01:32] jchris has joined the channel
  118. [01:36] ryah: yeah
  119. [01:36] ryah: stream._writeWatcher.queueSize would be interesting to see
  120. [01:36] ryah: since that determines when it returns false...
  121. [01:36] isaacs: interesting
  122. [01:37] ryah: https://github.com/ry/node/blob/15d5378684e630e341d674c7f67aecb76bd802c6/lib/net.js#L337
  123. [01:38] atmos has joined the channel
  124. [01:40] isaacs: ryah: yeah, at least some of the time, the writeWatcher.queueSize is 0, but it's still returning false.
  125. [01:41] ryah: ok
  126. [01:41] ryah: well that's not good :)
  127. [01:43] isaacs: var ww = writeStream._writeWatcher ; ww = ww ? ww.queueSize : "writeWatcher is falsey" ; x("pump PAUSE "+ww);
  128. [01:43] isaacs: and i'm seeing: "pump PAUSE 0" and then it never returns from that state.
  129. [01:43] bmizerany has joined the channel
  130. [01:47] tilgovi has joined the channel
  131. [01:47] isaacs: ryah: is it possible that the IOWatcher.flush() is flushing out the queue, so even though the queueSize WAS >64kb, it's no longer?
  132. [01:47] bsstoner has joined the channel
  133. [01:47] erlnoob has joined the channel
  134. [01:49] aubergine_ has joined the channel
  135. [01:49] ryah: yes
  136. [01:50] ryah: that might be it.
  137. [01:50] SvenDowideit has joined the channel
  138. [01:54] evanmeagher has joined the channel
  139. [01:55] isaacs: yes, that is it.
  140. [01:55] isaacs: hooray for one line fixes!!
  141. [01:55] ryah: :)
  142. [01:56] ryah: is there somehow you can reverse engineer a simple test?
  143. [01:56] ryah: these sort of things are super difficult to find - it's good to have tests
  144. [01:57] saschagehlich has joined the channel
  145. [01:57] isaacs: ryah: https://gist.github.com/708366
  146. [01:58] isaacs: lightening!!
  147. [01:58] isaacs: the gods approve of this patch!!
  148. [01:58] isaacs: is ther a way to cork a writeStream?
  149. [01:59] isaacs: you could cork it, write 64*1024+1 bytes, uncork, write 1 byte, and that'd at least have a very high probability of encountering the problem.
  150. [01:59] isaacs: another option would be to stub out a fake IOWatcher that *always* flushes everything
  151. [01:59] isaacs: (by throwing it away)
  152. [02:00] halfhalo has joined the channel
  153. [02:00] halfhalo has joined the channel
  154. [02:04] cjm has joined the channel
  155. [02:04] polotek: whew
  156. [02:04] polotek: that was harder than it should've been
  157. [02:04] polotek: ryah: https://github.com/polotek/node/commit/2dd8dc962c804934107123dcb892b1a7c1d1c7a7
  158. [02:05] isaacs: yeah, writing tests for the repl is a bit of a chore
  159. [02:06] isaacs: polotek: when hacking on the repl, i usually pipe &2 to a different terminal, or a file, so that you can actually get debug output without screwing up what you're doing
  160. [02:06] isaacs: makes it a lot easier
  161. [02:07] polotek: isaacs: thx
  162. [02:07] polotek: I think the main problem was that I testing errors coming from the repl. testing for bad output is harder than testing for good :)
  163. [02:10] [[zz]] has joined the channel
  164. [02:16] polotek: haha, I'm screwing all kinds of stuff
  165. [02:16] polotek: can someone help me sort out this git stuff?
  166. [02:16] polotek: I had 2 commits for the repl stuff
  167. [02:16] polotek: and pushed them to my github fork
  168. [02:16] polotek: but then I decided to squash them into one
  169. [02:17] polotek: I did that locally and that's fine
  170. [02:17] polotek: but how do I update the github fork now?
  171. [02:17] polotek: it rejects my push because I changed the commit history
  172. [02:18] polotek: do I just --force ?
  173. [02:19] isaacs: yeah, just --force
  174. [02:19] isaacs: use the force
  175. [02:19] polotek: cool, that worked
  176. [02:20] isaacs: polotek: another option would be to pull from origin, revert the two commits in a new commit, and then apply the squashed commit, and push that
  177. [02:20] isaacs: but that's dumb
  178. [02:21] polotek: isaacs: this worked the way I wanted. killed the 2 commits at origin and rewrote the history
  179. [02:22] isaacs: yep
  180. [02:22] isaacs: for repos that serve as upstreams to a lot of people, --force pushes are not polite.
  181. [02:23] isaacs: because if i'd pulled from you, and made a bunch of changes, and then try to pull from you again a month after you've rebased out a commit i have in my history, then all the sha's change, and it's this big gnarly rebase.
  182. [02:23] isaacs: but it's unlikely that that's a big deal anyway
  183. [02:24] polotek: isaacs: yeah I hear
  184. [02:24] polotek: that's why I wanted to be sure what I was doing
  185. [02:26] alek_br has joined the channel
  186. [02:29] jchris has joined the channel
  187. [02:30] sivang: I now how to use nodelad!
  188. [02:30] sivang: jchris: ! :)
  189. [02:30] sivang: *know
  190. [02:30] evanmeagher: if a script times out on the line below, what could it be a symptom of?
  191. [02:30] evanmeagher: https://github.com/ry/node/blob/master/lib/net.js#L574
  192. [02:32] jamescarr has joined the channel
  193. [02:32] jamescarr: why does console have time and timeEnd methods?
  194. [02:32] jamescarr: I didn't know that console functioned as a stopwatch!
  195. [02:33] jamescarr: console.time('foo'); console.time('bar'); console.timeEnd('bar'); console.timeEnd('foo');
  196. [02:34] polotek: wtf. github pull requests aren't as clear as I thought they were
  197. [02:34] cainus_: hey all...any express users in here? the hello world example doesn't respond to http requests, and I'm wondering if the example's out of date, or if I'm just a total failure
  198. [02:34] sudoer has joined the channel
  199. [02:35] Aria: did you expect cherry-picks polotek?
  200. [02:35] jamescarr: cainus_, type express -v from the command line
  201. [02:35] cainus_: 1.0.0rc4
  202. [02:35] polotek: Aria: I thought I'd be able to pick 1 or more commits to include in the request
  203. [02:36] cainus_: it seems to be running... no errors, but it doesn't respond... I tried a few ports as well as accessing from localhost to make sure its not firewall related or something
  204. [02:36] sivang has left the channel
  205. [02:36] Aria: Yeah, that's cherry-picking. In general, not something to do if you can topic-branch instead.
  206. [02:37] jamescarr: cainus_, what port is it running on?
  207. [02:37] polotek: Aria: yeah I'll probably do that next time.
  208. [02:37] polotek: Anyway
  209. [02:37] polotek: ryah: http://groups.google.com/group/nodejs-dev/browse_thread/thread/952f369abb8bdbd2
  210. [02:38] cainus_: tried 3000, and 8080
  211. [02:38] jamescarr: gist the code
  212. [02:38] cainus_: it's the example at the top of http://expressjs.com/guide.html
  213. [02:39] cainus_: http://expressjs.com/guide.html#Creating-An-Application is a better link
  214. [02:39] jamescarr: it works
  215. [02:40] jamescarr: did you run localhost:3000 ?
  216. [02:40] agnat has joined the channel
  217. [02:40] cainus_: yeah wget localhost:3000
  218. [02:40] jamescarr: also, did you install via npm?
  219. [02:40] cainus_: yes via npm
  220. [02:41] cainus_: "Connecting to localhost|127.0.0.1|:3000... failed: Connection refused."
  221. [02:41] jamescarr: well, you should probably just upgrade. TJ released express 1.0 a co uple days ago
  222. [02:41] jamescarr: also, are you SURE your server is running? :)
  223. [02:41] cainus_: I put a sys.print("got here") just before the last line even and it got there
  224. [02:42] cainus_: and it's in ps
  225. [02:42] jamescarr: just do a npm install express and try again :)
  226. [02:44] cainus_: nope... still no luck
  227. [02:44] jamescarr: how are you running it?
  228. [02:44] jamescarr: node app.js ?
  229. [02:44] cainus_: heh must be something I'm doing
  230. [02:44] cainus_: yeah
  231. [02:45] jamescarr: replace the last line with app.listen(3000, function(){ console.log('running on port 3000');});
  232. [02:45] jamescarr: ?
  233. [02:45] jamescarr: and try again?
  234. [02:46] cainus_: wow that worked
  235. [02:46] cainus_: ??!?
  236. [02:47] cainus_: it needs the callback?
  237. [02:47] jamescarr: the server running?
  238. [02:47] jamescarr: no, it doesnt need a callback
  239. [02:47] cainus_: yeah it responds now
  240. [02:47] jamescarr: the callback just gets called on server startup
  241. [02:47] cainus_: but the only diff is the callback
  242. [02:47] jamescarr: take it out, rerun, and try again
  243. [02:48] jamescarr: but leave app.listen(3000) in
  244. [02:48] cainus_: refused without the callback
  245. [12:48] frigg: VERSION
  246. [12:48] nodelog has joined the channel
  247. [12:52] Wizek: tanepiper: Yes, I think. But what is nto?
  248. [12:52] tanepiper: not
  249. [12:52] tanepiper: typo :)
  250. [12:53] Wizek: tanepiper: Chrome sends GET, so I quess it is
  251. [12:53] Wizek: *guess
  252. [12:53] Nohryb has joined the channel
  253. [12:53] Wizek: tanepiper: But how does that help me?
  254. [12:54] Wizek: Also, how can I access the request body with Node?
  255. [12:54] arpegius has joined the channel
  256. [12:54] tanepiper: are you building a website?
  257. [12:55] Wizek: tanepiper: I'm mainly experimenting and learning Node, but yes, if I find it suitable, I'll use it
  258. [12:55] tanepiper: you might be better looking at an existing framework build on top of nodejs
  259. [12:55] SubStack: connect is a good place to start I think
  260. [12:55] tanepiper: expressjs, geddy, meryl (personally i use expressjs)
  261. [12:56] tanepiper: indeed, express is built on connect so you have the power of both :)
  262. [12:57] Wizek: Well, I have bad experience with frameworks for node. First, npm doesn't work in Cygwin, and I found the documentation lacking of most of these, so I feel there is nowhere to start
  263. [12:57] SubStack: http://expressjs.com/
  264. [12:58] arpegius has joined the channel
  265. [12:58] SubStack: Wizek: it seems to be possible to install npm on top of cygwin
  266. [12:59] SubStack: http://elegantcode.com/2010/11/08/taking-baby-steps-with-node-js-introduction/
  267. [12:59] arpegius has joined the channel
  268. [13:02] mikedeboer has joined the channel
  269. [13:03] Wizek: SubStack: I've done just that, and it halted with error
  270. [13:04] Wizek: SubStack: http://prntscr.com/17bkd
  271. [13:04] Wizek: So even after extensive seraching, I couldn't get npm onto my cygwin
  272. [13:04] rajeshsr has joined the channel
  273. [13:05] SubStack: http://groups.google.com/group/npm-/browse_thread/thread/561e1c54b8da6b90
  274. [13:06] SubStack: which links to the solution here: https://github.com/isaacs/npm/issues/issue/79/#comment_301690
  275. [13:09] Locke23rus has joined the channel
  276. [13:13] delapouite has joined the channel
  277. [13:20] rkieffer has joined the channel
  278. [13:24] Wizek: SubStack: The solution links here: https://github.com/ry/node/wiki/Building-node.js-on-Cygwin- <-- which has been deleted. I don't know what step 4 is, or what to add to that conf.
  279. [13:25] SubStack: here it is: https://github.com/ry/node/wiki/Building-node.js-on-Cygwin-(Windows)
  280. [13:26] fly-away: hi2all
  281. [13:26] kriszyp has joined the channel
  282. [13:26] fly-away: is there some books or papers about nodejs programming patterns?
  283. [13:27] mscdex: node builds fine on cygwin
  284. [13:28] mscdex: the only thing i did was build and install gcc4.4.3 instead of 3.x which is what cygwin still has
  285. [13:28] mscdex: the rest is the same as plain linux
  286. [13:28] mscdex: configure, make, make install
  287. [13:28] liar has joined the channel
  288. [13:28] mscdex: i've never tried npm though
  289. [13:28] Wizek: SubStack: WOW! Thanks a lot! I can't believe I was once so close to this solution, but gave up and tried another thing! lol. Ty very much
  290. [13:29] SubStack: succeeding is hard
  291. [13:30] cnu has joined the channel
  292. [13:32] masahiroh has joined the channel
  293. [13:37] Wizek: tanepiper: So, now I have express, and connect inside, back to the initial issue: how does express help me with what I do?
  294. [13:38] jashkenas has joined the channel
  295. [13:43] kaichen has joined the channel
  296. [13:46] Wizek: Like, how can I access the request body (from server), either with express, or with plain Node?
  297. [13:47] stephank has joined the channel
  298. [13:50] rkieffer: anyone here know what the status of http://nodul.es/ is? Is that being actively developed?
  299. [13:53] rkieffer: One thing the npm world desperately needs is a place for community feedback - e.g. comments & ratings.
  300. [13:53] kaichen has joined the channel
  301. [13:58] niko has joined the channel
  302. [14:02] iszak has joined the channel
  303. [14:02] iszak has joined the channel
  304. [14:07] saschagehlich: does anyone know a really good video search engine with an api where you can set which video sites should be crawled?
  305. [14:07] pagameba has joined the channel
  306. [14:17] atmos has joined the channel
  307. [14:23] spetrea has joined the channel
  308. [14:25] mklappst1hl has joined the channel
  309. [14:29] ntelford has joined the channel
  310. [14:32] matjas has joined the channel
  311. [14:36] iszak: Hmm, that is unusual. I can access http.ServerResponse however I cannot access http.ServerRequest.
  312. [14:40] Wizek: How do I access request body from Node?
  313. [14:40] iszak: in createServer?
  314. [14:40] Wizek: ye
  315. [14:40] iszak: the second parameter.
  316. [14:40] iszak: in the callback
  317. [14:42] Wizek: iszak: With that I can send a response. But I mean when a request comes in, and I can hev it's url with request.url, and it's method with request.method, but how to get it's body?
  318. [14:42] Wizek: iszak: Like if it's a PUT
  319. [14:43] iszak: oh right.
  320. [14:43] liar has joined the channel
  321. [14:44] fangel: Wizek: you need to do a bind on the data and end-events of the http.ServerResponse..
  322. [14:45] fangel: Wizek: ie var body = ''; req.on('data', function(chunk) { body += chunk; }); req.on('end', function() { /* now the PUT'ed file is in the variable 'body' */ });
  323. [14:45] ooooPssss has joined the channel
  324. [14:46] iszak: i don't actually know how to get the data.
  325. [14:47] iszak: fangel, the data event.
  326. [14:48] fangel: check http://nodejs.org/docs/v0.3.1/api/http.html#http.ServerRequest - my example should work..
  327. [14:49] Wizek: fangel: Wow, nice
  328. [14:49] Wizek: ty
  329. [14:50] wdperson has joined the channel
  330. [14:51] fangel: np
  331. [14:52] MattJ has joined the channel
  332. [14:52] iszak: I must say the whole event driven design certainly makes your brain work.
  333. [14:53] fangel: I guess.. I don't find it that hard anymore, so give it time :)
  334. [14:53] _mql has joined the channel
  335. [14:54] iszak: Not so much hard.
  336. [14:54] SubStack: unfamiliar
  337. [14:54] SubStack: my brain hurts when I try to write procedural code anymore
  338. [14:55] SubStack: C macros are a poor substitute for higher-order combinators
  339. [14:56] iszak: heh.
  340. [14:57] iszak: I guess when you write low level JS you're still writing OO.
  341. [14:57] cognominal has joined the channel
  342. [14:57] mbrochh has joined the channel
  343. [14:57] sveimac has joined the channel
  344. [14:58] _mql: Hey! In an express.js app, how would you protect entire actions from being executed when the there's no user assigned to the current session (I'm looking for some sort of ensure_authorized/authenticated filter)
  345. [15:00] sveimac_ has joined the channel
  346. [15:01] _mql: Would I implement my own middleware for that… that prematurely sends a 401-response when the user is not logged in? How could this work for certain but not all routes…?
  347. [15:03] mbrochh: _mql, i saw examples for this... you can define some helper functions that check for authorization and add them to the route's parameters or so
  348. [15:03] _mql: I guess some code snippets regarding express.js authentication / authorization would already help. I'm going to not use an auth-framework, since I want to do the authorization logic (which will be straight-forward) myself.
  349. [15:04] faust45 has joined the channel
  350. [15:04] mbrochh: _mql, http://expressjs.com/guide.html#Route-Middleware read on from there
  351. [15:05] _mql: mbrochh: yeah that would be helpful.
  352. [15:05] iszak: we need monolithic libraries.
  353. [15:05] mbrochh: _mql, never tried it but looks simple enough :)
  354. [15:05] _mql: Mhh sure. I shouldn't be that lazy with reading the docs ^^
  355. [15:06] derren13 has joined the channel
  356. [15:06] _mql: But you can't remember some code snippets that implement such a authentication middleware?
  357. [15:06] SamuraiJack has joined the channel
  358. [15:07] iszak: It's hard to believe express js is the BEST we've got.
  359. [15:07] tanepiper: Zope used to be the best Python had
  360. [15:08] tanepiper: it was a few years before Django, Pylons, etc
  361. [15:08] iszak: If anyone wants to create a monolithic library I'm down for that.
  362. [15:08] iszak: Be more than happy to contribute.
  363. [15:08] iszak: more so "use at will".
  364. [15:10] _mql: Do you guys think it would make any sense (for a single-page web-app) to do the whole client/server communication via websockets, making the http layer obsolete?
  365. [15:10] saschagehlich: how can I do sth like "for i in [0...count]" in jade?
  366. [15:12] _mql: I'm already using web-sockets for realtime syncing text fragments.. but for all other actions I still use RESTful HTTP as usual...
  367. [15:12] rkieffer: saschagehlich: Use a script tag
  368. [15:12] rkieffer: I don't think jade does for loops like that - just the "each" enumeration.
  369. [15:13] saschagehlich: okay
  370. [15:14] _mql: Not sure if should go with just sockets ;) — http://substance.quasipartikel.at/ is the implied app I'm working on…
  371. [15:15] sstephenson: in an eco template, you can write exactly that: <% for i in [0...count]: %> ... <% end %>
  372. [15:15] iszak: I don't see the point in templating languages for node.js
  373. [15:16] SubStack: iszak: I have something interesting planned on the web frameworks front
  374. [15:16] iszak: SubStack, elaborate?
  375. [15:17] SubStack: I'm thinking it will merge routes, sessions, and dnode continuations
  376. [15:17] iszak: ...thinking or it does?
  377. [15:17] SubStack: thinking as in not entirely certain how it will work yet
  378. [15:18] SubStack: I have some notes and a few hypothetical code snippets is all at this point
  379. [15:18] SubStack: it's in my queue
  380. [15:18] iszak: eh, doesn't sound like what I want.
  381. [15:18] SubStack: what do you think would be super useful?
  382. [15:19] iszak: I would like to see an implemention of something like Zend Framework in Node.JS
  383. [15:19] SubStack: what does zend do that others don't?
  384. [15:19] Aikar: node is a lil young for that
  385. [15:19] iszak: well it emphasis's decoupling of components.
  386. [15:19] Aikar: the api is changing too much
  387. [15:19] SubStack: I want frameworks that play to node's strengths instead of just copying what other languages have
  388. [15:19] iszak: I know.
  389. [15:19] Aikar: all zend is is a collection of libraries
  390. [15:20] iszak: SubStack, yeah of course, no point going against the grain.
  391. [15:20] iszak: Aikar, indeed however it does provide MVC if you want to.
  392. [15:20] Aikar: so i think your more looking for an mvc in node lol
  393. [15:20] iszak: ZF is MVC.
  394. [15:20] herbySk has joined the channel
  395. [15:20] SubStack: Decoupling eh? My latest big project is just 4+n processes that all talk together over the network
  396. [15:21] Aikar: really its not much code to do it
  397. [15:21] SubStack: it's a webapp too
  398. [15:21] iszak: Aikar, but to do it right.
  399. [15:21] iszak: I don't know, I just feel a lot of the things we do in Node.JS is low level and for developing web apps that primitive things should be taken care off with convention over config approach.
  400. [15:21] SubStack: and you can kill any one of those processes and the rest of the system that doesn't directly depend on it remains operational
  401. [15:22] Aikar: app.get(':controller?/:method?:/?blah',function(req,res) { /handle/ });
  402. [15:22] Aikar: node isnt exactly tailored for throwing up basic websites
  403. [15:22] SubStack: and once the killed process comes back up all of the other processes know about it
  404. [15:22] Aikar: and id say the opposite, id say its more high level O.o
  405. [15:22] iszak: of course not, nor should it be restricted to just that.
  406. [15:23] Aikar: node isnt trying to be an httpd server
  407. [15:23] iszak: I don't see it wouldn't.
  408. [15:23] SubStack: oh right, and it launches tomorrow ;)
  409. [15:25] c4milo has joined the channel
  410. [15:25] Aikar: SubStack: what you use for IPC? I wrote up a parser based on the Node Network Protocol doc someone put up, so i figured a TCP link between the processes with nnp will be effecient
  411. [15:25] iszak: the good thing about doing it like zend framework is we can feed back the components into the community.
  412. [15:25] Aikar: thats what people are doing iszak
  413. [15:25] herbySk has joined the channel
  414. [15:25] Aikar: look at npm
  415. [15:25] Aikar: a giant collection of 'components'
  416. [15:25] SubStack: Aikar: dnode, which I wrote
  417. [15:25] Aikar: ah
  418. [15:26] iszak: Aikar, but it's only dribs and drabs here and there.
  419. [15:26] iszak: nothing like ZF.
  420. [15:26] Aikar: iszak: because node is a baby... zend is many years of building
  421. [15:26] SubStack: being able to throw around continuations like nobody's business is a very powerful technique, I found
  422. [15:26] Aikar: give it time
  423. [15:26] iszak: zend framework != zend, indeed.
  424. [15:26] iszak: Well I'm ready to start now.
  425. [15:27] Aikar: i know very well zend != zf im a PHP dev for 8 years :P i was justing it as short reference
  426. [15:27] Aikar: just using*
  427. [15:28] iszak: those ZF guys get really touche feeling about that.
  428. [15:28] Aikar: but really tho, have you looked at express js?
  429. [15:29] iszak: Yeah.
  430. [15:29] Aikar: express makes things extremely simple. you can build an mvc design on top of it within an hr of coding
  431. [15:30] iszak: it's not so much the MVC thing.
  432. [15:30] iszak: although it is.
  433. [15:30] iszak: it's just having all the components I need there, I don't want to have to go out and find middleware, it's time consuming to test them also.
  434. [15:30] Aikar: well if your just looking for a "large collection of prebuilt librarys", as i said before, node is just too young its slowly building up a library
  435. [15:30] iszak: But they'll be fragmented.
  436. [15:30] iszak: you'll still have to go and find them.
  437. [15:30] SubStack: what, node has a crazy number of libraries
  438. [15:31] SubStack: considering how young it is
  439. [15:31] Aikar: well you wont see that probally for years
  440. [15:31] rkieffer has left the channel
  441. [15:31] iszak: You're being very negative Aikar.
  442. [15:31] Aikar: no, im being realistic :/
  443. [15:31] iszak: Instead of saying it won't for ages, why not start now?
  444. [15:31] aconbere has joined the channel
  445. [15:31] SubStack: if you don't have something, build it
  446. [15:31] Aikar: because it would be silly
  447. [15:31] Aikar: node is changing too much
  448. [15:32] iszak: so stick to the stable versions.
  449. [15:32] SubStack: and share it so everybody else can benefit
  450. [15:32] iszak: 0.2.x, 0.4.x
  451. [15:32] SubStack: and help you fix bugs and such
  452. [15:32] Aikar: but yeah, you can start building stuff you need and feel free to release to public
  453. [15:32] SubStack: it's so easy too, just throw up a github project and npm publish
  454. [15:32] sveimac has joined the channel
  455. [15:33] iszak: SubStack, but then how do you sift through the crap from the good modules?
  456. [15:33] iszak: it takes time.
  457. [15:33] SubStack: not really
  458. [15:33] Aikar: look at the code, understand the code, use the code, make judgement
  459. [15:33] SubStack: if it's on npm, it's probably good to go
  460. [15:33] iszak: why doesn't it?
  461. [15:33] iszak: I am sure that's not the case.
  462. [15:33] SubStack: you can just npm install package and pow you're up and running
  463. [15:33] mbrochh has joined the channel
  464. [15:33] iszak: Aikar, and with something as large as a database adapter it's going to take MUCH longer.
  465. [15:34] Aikar: iszak: i think its safe to say anyone who is playing with node is likely not your run of the mill hello world php dev
  466. [15:34] iszak: but what's to say they're not the run of the mill hello world js dev
  467. [15:34] SubStack: node is bad for boring crud apps, it's true
  468. [15:34] Aikar: those kind of 'newbies' wouldnt even know how to compile node :3
  469. [15:34] SubStack: it's great for experimental new hotness though
  470. [15:34] iszak: apt makes it easy.
  471. [15:34] itissid has joined the channel
  472. [15:35] iszak: or synaptic, you guys are making excuses that there won't / isnt any crap code in rpm / node modules.
  473. [15:35] itissid: Hey whats the best HTML DOM parser in NODE?
  474. [15:35] iszak: Good question, go search for all the HTML DOM parsers, try them out, and then bam you know.
  475. [15:36] Aikar: your asking for someone else to build a 'high quality large collection of librarys'. if you want that, then build it :/ its almost like your demanding someone here write it
  476. [15:36] iszak: exactly what I'm talking about ^ how do we know the "good" from the "bad".
  477. [15:36] itissid: I could... or someone who did the hard work can tell me...
  478. [15:36] SubStack: itissid: well jsdom is the only one on npm, so I bet it's that one
  479. [15:36] iszak: Aikar, no I'm not asking anyone to build it, I am just looking for people who want to, I am more than happy to help develop it.
  480. [15:36] iszak: but best != good.
  481. [15:36] iszak: atleast in this case, best == only.
  482. [15:37] ashleydev has joined the channel
  483. [15:37] SubStack: being on npm is a good fitness signal
  484. [15:37] SubStack: since it indicates that somebody took the time to package it correctly and intends for other people to use it
  485. [15:37] iszak: It's a false sense of security though.
  486. [15:38] iszak: it doesn't promise it's maintained either.
  487. [15:38] kjeldahl_ has joined the channel
  488. [15:38] iszak: where as it we had something like ZF we could ensure everything is kept up-to-date.
  489. [15:38] SubStack: you could say the same thing about /any/ positive heuristic
  490. [15:38] iszak: You're right.
  491. [15:42] iszak: I don't see why people wouldn't be against creating a collection of libraries, it'll be a good thing for Node.js
  492. [15:42] itissid: Well i figured that if someting is compatible with the latest version of node.. then its probably well maintained...
  493. [15:42] iszak: well done :)
  494. [15:43] femtoo has joined the channel
  495. [15:44] jchris has joined the channel
  496. [15:46] itissid: jsdom is v0.3.0 compatible
  497. [15:49] mu-hannibal has joined the channel
  498. [15:50] jherdman has joined the channel
  499. [15:50] EGreg_ has joined the channel
  500. [15:50] skiz has joined the channel
  501. [15:50] unomi: next up: npm rate package +1 "Good, but not great, version 0.68 had an issue with foo. See http://blah for details"
  502. [15:56] aho has joined the channel
  503. [16:03] bnoordhuis has joined the channel
  504. [16:03] Wizek: if a variable returns [Function], How can I see the function itself?
  505. [16:04] jchris has joined the channel
  506. [16:04] SubStack: see?
  507. [16:04] bnoordhuis: v8: f = function() { return "foo"; } f.toString()
  508. [16:04] v8bot: bnoordhuis: SyntaxError: Unexpected identifier
  509. [16:04] SubStack: the source? if it's not a builtin, you can .toString()
  510. [16:04] bnoordhuis: v8: f = function() { return "foo"; }; f.toString()
  511. [16:04] v8bot: bnoordhuis: "function () { return "foo"; }"
  512. [16:05] SubStack: yep
  513. [16:07] itissid: The node REPL behaves sort of wierdly if I copy paste stuff... Especially with comments and empty lines... Does some one know what to do about this?
  514. [16:08] itissid: Like instead of the > prompt it just shows the ...
  515. [16:08] itissid: after pasting
  516. [16:14] Nevtus has joined the channel
  517. [16:14] Nevtus has joined the channel
  518. [16:15] dtrasbo has joined the channel
  519. [16:19] Gregor has joined the channel
  520. [16:20] cognominal has joined the channel
  521. [16:22] _mql: I've just put together some thoughts regarding an application that exclusively uses websockets for client/server communication, rather than AJAX. The following link should work on current webkit-browsers that support websockets. http://substance.quasipartikel.at/#load/e91fad537283dbd1fa8ae5a5b7dac6cd — would be great to hear your thoughts on this. The document shown can be edited collaboratively in realtime, but only existing content-n
  522. [16:26] dnolen has joined the channel
  523. [16:29] mpoz2 has joined the channel
  524. [16:31] unomi: _mql, awesome
  525. [16:31] unomi: I was
  526. [16:33] _mql: thanks! :) a lot of work ahead, though......
  527. [16:34] kkaefer: hm
  528. [16:34] kkaefer: apparently node's buffer fails on 0 terminated strings
  529. [16:34] _mql: anyways… regarding websocket-only apps, what's your opinion?
  530. [16:34] _mql: could this make sense?
  531. [16:35] unomi: I think it depends on the target group
  532. [16:35] unomi: I think it makes as much sense as canvas reliant or webworker reliant apps
  533. [16:36] _mql: sure.. for the editor i imply a websocket capable browser.. so in this case it would fit.
  534. [16:36] unomi: in terms of no http, there is no need to stay married to it.
  535. [16:36] _mql: renderers for that document can be browsed as usual through http clients.
  536. [16:36] rajeshsr has joined the channel
  537. [16:37] unomi: there is a lot of existing infrastructure for it though, proxies, firewalls etc could be an issue, but again, that is all about the market/target group, and not really a technical issue per se
  538. [16:37] _mql: that's the service for the pre-rendered output http://substance.quasipartikel.at/documents/e91fad537283dbd1fa8ae5a5b7dac6cd.html
  539. [16:38] _mql: k I wonder if there is any higher level framework for bigger websocket apps (server+client)
  540. [16:38] _mql: don't want to duplicate work (i'm super-new to node.js and socket servers, that's why i'm asking)
  541. [16:39] unomi: are you talking about something like socket.io or?
  542. [16:40] _mql: not really. i'm already using socket.io already… i wonder how communication is done by others. how they call the right methods on the server/client (i call it routing, based on the message)
  543. [16:40] unomi: besides going thru a different transport, are there other issues that need solving? I am a bit ignorant regarding this
  544. [16:41] unomi: ah, well, you might want to look at how tunguska works
  545. [16:41] dilvie has joined the channel
  546. [16:41] unomi: it is used by persevere for inter-multinode and browser event communication
  547. [16:42] unomi: https://github.com/kriszyp/tunguska
  548. [16:43] unomi: http://www.sitepen.com/blog/2010/07/19/real-time-comet-applications-on-node-with-tunguska/
  549. [16:43] _mql: ah thanks… I ask myself if i could abstract on('message') in some way… https://github.com/michael/substance/blob/master/server.js#L303
  550. [16:44] _mql: unomi: thanks that will be a good read!
  551. [16:45] unomi: the globbing style hubs that tunguska uses is similar in intent
  552. [16:45] unomi: as I read it anyway.
  553. [16:46] unomi: in that, your server will listen to the 'register' hub, and clients can send to it
  554. [16:46] unomi: likewise your clients can listen to it, and get 'new user joined' etc
  555. [16:51] matjas has joined the channel
  556. [16:52] johan_bouveng: hello, any tip on how to catch errors in a good way with mongodb+mongoose?
  557. [16:52] johan_bouveng: especially when a insert fails.
  558. [16:52] johan_bouveng: http://pastie.org/1315390
  559. [16:57] _mql: unomi: jeah that make sense. I'll play through various use-cases to get i better idea what i want. But I guess, creating my own little layer of abstraction for that would make sense anyway.
  560. [17:01] prettyrobots has joined the channel
  561. [17:01] rauchg_ has joined the channel
  562. [17:03] _mql1 has joined the channel
  563. [17:03] arpegius has joined the channel
  564. [17:08] Aikar: anyone know of any eta on FD passing between processes being fixed in master?
  565. [17:10] olivvv_ has joined the channel
  566. [17:10] _mql1: I wonder how I could implement authentication with secure websockets eventually… (Just in case someone can point me to some code/resources)
  567. [17:13] SubStack: holy crap my dnode ssl example just started working with the latest socket.io
  568. [17:14] SubStack: _mql1: you can pass secure : true to socket.io and also .setSecure() on the http instance
  569. [17:14] softdrink has joined the channel
  570. [17:17] saschagehlich: is there a jade plugin / function that shortens strings after a specific amount of characters?
  571. [17:17] SubStack: just call .slice()
  572. [17:17] _mql1: SubStack: ah thanks… one question: if i don't want to support fallbacks (that are provided by socket.io) wouldn't it make more sense to instead use the raw api? However using a regular node.js tcp server doesn't seem to be enough.
  573. [17:18] SubStack: /the/ raw api?
  574. [17:18] nsolsen has joined the channel
  575. [17:18] SubStack: oh the `net` stuff?
  576. [17:18] _mql1: yes
  577. [17:19] _mql1: and on the client side… if i just want to support FF4, webkit I could just use the official websocket api.
  578. [17:19] _mql1: however I didn't get it to work with net.createServer…..
  579. [17:20] SubStack: but why would you go out of your way to avoid fallbacks?
  580. [17:20] mikeal1 has joined the channel
  581. [17:23] AAA_awright has joined the channel
  582. [17:24] _mql1: I'm just trying to keep dependencies at a minimum. And a polling fallback for example doesn't make really sense for a app that sports truly realtime editing..
  583. [17:24] SubStack: why keep dependencies at a minimum?
  584. [17:24] SubStack: you can just npm install everything you need
  585. [17:24] SubStack: it's not like you have to do any /work/
  586. [17:25] _mql1: SubStack: I don't need to support older browsers, so I'm trying to stay as close to the metal as possible.
  587. [17:25] SubStack: well you can have realtime editing in browsers that don't even have websockets, it's just slower is all
  588. [17:25] _mql1: SubStack: yeah the main problem is the client-side that needs an additional socket.io.js file
  589. [17:25] SubStack: _mql1: that doesn't seem to follow
  590. [17:26] programble has joined the channel
  591. [17:26] SubStack: _mql1: not in the latest socket.io, which registers a default route
  592. [17:26] SubStack: just do <script src="/socket.io/socket.io.js"></script>
  593. [17:27] SubStack: "The client-side files are served automatically by Socket.IO-node."
  594. [17:28] _mql1: SubStack: supporting older browsers is tricky on so many levels. I just want to keep testing efforts at a minimum…
  595. [17:28] SubStack: well you don't /have/ to support them
  596. [17:29] SubStack: socket.io is really easy to get something running with
  597. [17:29] _mql1: SubStack: I'm aware of that, but it is an additional .js file that needs to be run by the client (potentially making problems (in terms of not exactly understanding how the internals work, which is in general a problem with frameworks)
  598. [17:30] mjr_ has joined the channel
  599. [17:30] _mql1: SubStack: that's true… I guess I'll keep using it. Just wanted to ask how easy it is to drop it, if I dont need it.
  600. [17:30] SubStack: you don't need to understand the internals
  601. [17:30] SubStack: that is the point of abstractions like socket.io
  602. [17:30] jbaron has joined the channel
  603. [17:31] SubStack: they've been independently tested and lots of hours have gone into making sure they work properly
  604. [17:32] confoocious has joined the channel
  605. [17:32] confoocious has joined the channel
  606. [17:32] SubStack: don't let bullshit frameworks like rails ruin all abstractions for you
  607. [17:33] _mql1: SubStack: Sure, you are probably right :) — I may be too wary.
  608. [17:33] SubStack: I too know the pain of leaky abstractions, but socket.io is pretty watertight in my usage
  609. [17:34] mu-hannibal has joined the channel
  610. [17:34] SubStack: ACTION wrote a further abstraction on top of socket.io even
  611. [17:35] tylerstalder has joined the channel
  612. [17:35] _mql1: I guess I'll create my own little abstraction (facet) that my client code can call — just to preserve the option of switching the implementation at some point.
  613. [17:35] SubStack: that's a good way to mitigate transitions
  614. [17:35] _mql1: SubStack: Seen. I'd like to have a look on it. Do you have it online?
  615. [17:35] c4milo has left the channel
  616. [17:36] SubStack: http://github.com/substack/dnode
  617. [17:36] jbaron: Anyone using Redis with node ?
  618. [17:36] SubStack: oh I should update the readme
  619. [17:37] SubStack: the web usage is quite a bit simpler now that it has default routes with connect
  620. [17:37] trotter has joined the channel
  621. [17:38] jacobolus has joined the channel
  622. [17:38] SubStack: the new style is in examples/connect
  623. [17:38] SubStack: and you can use express too since it subclasses connect
  624. [17:38] sudoer has joined the channel
  625. [17:38] _mql1: SubStack: Ahh it may be the case that this is exactly what I'm looking for.
  626. [17:38] SubStack: ^_^
  627. [17:39] technoweenie has joined the channel
  628. [17:39] _mql1: did you have a look at the link i posted before? http://substance.quasipartikel.at/#load/e91fad537283dbd1fa8ae5a5b7dac6cd
  629. [17:40] SubStack: reading
  630. [17:40] _mql1: SubStack: So how much do you think this applies to dnode?
  631. [17:40] _mql1: take your time :)
  632. [17:40] olivvv_: hi
  633. [17:41] olivvv_: what is the link between socket.io and expressjs ?
  634. [17:41] herbySk has joined the channel
  635. [17:41] olivvv_: is socket.io builtin ?
  636. [17:42] SubStack: olivvv_: no link besides both using the node http libs
  637. [17:42] SubStack: they play nicely together as a result of being based on the same base libraries though
  638. [17:42] SubStack: _mql1: seems like you've had some of the same ideas I've had
  639. [17:42] felixge has joined the channel
  640. [17:42] felixge has joined the channel
  641. [17:42] SubStack: I've settled on using continuations for authentication though
  642. [17:43] SubStack: like this: https://github.com/substack/dnode/blob/master/examples/auth/server.js
  643. [17:43] olivvv_: in fact Im trying to define the stuffs I need to start coding. I d like some mvc alike structure plus stuff to handle nicely chat features
  644. [17:44] itissid has joined the channel
  645. [17:44] olivvv_: so I guess jquery template + expressjs + socket.io
  646. [17:44] SubStack: olivvv_: express has a scaffolding type thing
  647. [17:45] SubStack: I don't use it, but if you type `express pow` it'll make a pow/ directory with goodies inside
  648. [17:45] olivvv_: I ve the doc there, I dont see what you are referring to
  649. [17:45] SubStack: well just try it
  650. [17:45] rauchg_: olivvv_: express is routing + nice IncomingMessage / OutgoingResponse extensions + templating caching / hooks
  651. [17:45] mikew3c_ has joined the channel
  652. [17:45] SubStack: a rauchg_ appears!
  653. [17:45] olivvv_: I mean I know what scaffolding from php frameworks exprerience
  654. [17:46] rauchg_: connect is middleware, like support for serving static images
  655. [17:46] rauchg_: that would change from framework to framework
  656. [17:46] dnolen has joined the channel
  657. [17:46] _mql1: SubStack: Ah, this is particularly helpful :) Need to experiment with it. We are likely to talk again.. soon? :)
  658. [17:46] rauchg_: socket.io doesn't care about either, it's a different request/response cycle
  659. [17:46] rauchg_: since it tries to keep connections "open"
  660. [17:47] itissid: hey is the jsdom author here?
  661. [17:47] olivvv_: rauchg_:connections "open" ---> thats what is required for a chat, isn'it ?
  662. [17:47] SubStack: _mql1: oh and message routing is the whole reason why I wrote dnode, reading the last item on your notes page
  663. [17:48] olivvv_: I want to be able to create a chat, but for the rest I d like some simple mvc thinking
  664. [17:48] rauchg_: olivvv_: correct
  665. [17:48] ajpi has joined the channel
  666. [17:48] SubStack: rauchg_: you'll be in SF next week right?
  667. [17:48] rauchg_: in reality, the connection being open or not is decided by Keep-Alive
  668. [17:48] olivvv_: I m so noob I dont know what is alredy available in node and what needs to ne added
  669. [17:48] rauchg_: but we want to minimize headers overhead
  670. [17:48] rauchg_: SubStack: correct
  671. [17:49] rauchg_: also, support websocket
  672. [17:49] rauchg_: serve the flash policy, prevent connection starvation and other nice thingies
  673. [17:49] SubStack: yeah I like the new flash policy stuff
  674. [17:49] SubStack: also https just started working with my dnode example!
  675. [17:50] SubStack: you must've fixed something
  676. [17:50] mikedeboer has joined the channel
  677. [17:50] rauchg_: yep
  678. [17:50] rauchg_: how we get the ws location
  679. [17:50] rauchg_: wss
  680. [17:51] SubStack: oh right then I broke it by porting to connect
  681. [17:51] rauchg_: be careful of `master` though, lots of experimental stuff
  682. [17:51] SubStack: I'm running the npm version here
  683. [17:51] rauchg_: k
  684. [17:51] galaxywatcher has joined the channel
  685. [17:52] prettyrobots has joined the channel
  686. [17:52] rauchg_: 0.7 will support multiplexing
  687. [17:52] rauchg_: you'll be able to initialize multiple io.Socket per window
  688. [17:52] SubStack: oh nice
  689. [17:52] rauchg_: and they'll go through the same channel
  690. [17:52] mAritz has joined the channel
  691. [17:55] Aikar: o.o your opting into jquery template lol?
  692. [17:56] _mql1: SubStack: Tight! Using the same interface for communication in the browser and on the server, is exactly what I was looking for.
  693. [17:56] SubStack: :D
  694. [17:56] SubStack: also I wrote some articles on substack.net about it
  695. [17:56] _mql1: reading through it.. right now.
  696. [17:56] Aikar: olivvv_: you should look at the other languages, ie EJS for more traditional templating
  697. [17:56] SubStack: the latest should be a pretty good crash-course
  698. [17:56] Aikar: jquery looked so bad
  699. [17:57] Aikar: EJS is like php, no extra lang to learn
  700. [17:57] olivvv_: Aikar:I m afraid of any templating system that contains logic
  701. [17:57] Aikar: so dont use logic in it lol
  702. [17:57] olivvv_: ok
  703. [17:57] Aikar: but thats a silly saying :3
  704. [17:57] olivvv_: I thought jquery template was logic free and not ejs
  705. [17:57] Aikar: always found templating engines to be rather silly, why restrict yourself
  706. [17:57] SubStack: yeah I like knowing that I can turn my templates into a horrible mess even though I shouldn't
  707. [17:58] rauchg_: olivvv_: use https://github.com/visionmedia/jade
  708. [17:58] Aikar: do what you need to do to get the job done cleanly
  709. [17:58] SubStack: Aikar: I agree!
  710. [17:58] SubStack: it's the programmer's responsibility to keep everything tidy, not the technology
  711. [17:58] Aikar: thats why ill be opting to EJS, ill put most my code in controller, but if i want to put some logic in my view, then i can!
  712. [17:58] Aikar: exactly
  713. [17:58] rauchg_: (html (head (title "Hello")))
  714. [17:58] SubStack: power, responsibility, etc
  715. [17:59] olivvv_: SubStack:true too
  716. [17:59] olivvv_: In fact I want something as close as possible to a view file in a php framework
  717. [17:59] olivvv_: no meta language
  718. [17:59] Aikar: olivvv_: EJS is that then
  719. [17:59] rauchg_: jade is that too
  720. [17:59] Aikar: EJS is exactly like PHP (but diff open tags, actually configurable)
  721. [17:59] SubStack: rauchg_: lisper!
  722. [17:59] Aikar: jade is special syntax
  723. [17:59] Aikar: it doesnt use <html> blah
  724. [17:59] rauchg_: true
  725. [17:59] rauchg_: xml sucks
  726. [17:59] rauchg_: agreed
  727. [17:59] rauchg_: :D
  728. [17:59] rauchg_: use jade :P
  729. [18:00] SubStack: ACTION has been using jade lately
  730. [18:00] Aikar: i also hate the concept of learning another syntax/language to get the job done :P so i dont want to use stuff like that lol
  731. [18:00] rauchg_: jade's compiler/parser/lexer separation is a thing of beauty
  732. [18:00] rauchg_: so you can do whatever you want with jade
  733. [18:00] SubStack: it's really simple
  734. [18:00] Aikar: http://codeangel.org/articles/simple-php-template-engine.html hits the point dead on
  735. [18:00] rauchg_: for example
  736. [18:00] rauchg_: i extended jade for
  737. [18:01] rauchg_: i18n in a way that is not intrusive
  738. [18:01] rauchg_: (no __() bs)
  739. [18:01] rauchg_: realtime with zero-coding (nodestream)
  740. [18:01] _mql1: SubStack: To be honest, I always somehow disliked how http works. URL-based routing and stuff (url-encoding query params in GET requests, etc.) in an RMI scenario things feel much better. However I can't tell at the moment where new problems occur. Caching may be an issue.
  741. [18:01] rauchg_: and assets compilation in s3 without altering our templates
  742. [18:01] rauchg_: or adding any middleware
  743. [18:01] rauchg_: :D
  744. [18:02] Wizek: What parse error means? http://prntscr.com/17cdi
  745. [18:02] isaacs has joined the channel
  746. [18:02] SubStack: _mql1: yeah synchronizing objects for local access can be a bother
  747. [18:02] Aikar: invalid syntax
  748. [18:02] isaacs: ryah: 2320497 :(
  749. [18:02] rauchg_: Wizek: an error in node's http parser
  750. [18:02] rauchg_: happened to me with http multipart
  751. [18:02] SubStack: _mql1: also if you're not careful you can make a real mess of callbacks going every which way
  752. [18:02] SubStack: but I seem to have gotten the hang of it after a few projects
  753. [18:02] olivvv_: this jade syntax is interesting, but shouldn t that be handled rather by an ide ?
  754. [18:03] Wizek: Aikar: With what? It doesn't give me code line
  755. [18:03] _mql1: SubStack: purely data-driven single-page web app scenarios are painful when done using ajax.
  756. [18:03] Aikar: Wizek: what rauchg_ said is correct, looks like bad http data
  757. [18:03] rauchg_: Wizek: it's not *your* code being parsed, but the http request
  758. [18:03] Wizek: oh
  759. [18:04] rauchg_: or looks like response
  760. [18:04] rauchg_: are you using http.createClient ?
  761. [18:04] rauchg_: isaacs: what's 2320497 ?
  762. [18:04] _mql1: SubStack: Anyways, I have to find out :) saying good bye to http for a while (at least regarding the substance doc-editor project)
  763. [18:04] isaacs: rauchg_: http://github.com/ry/node/commit/2320497
  764. [18:05] SubStack: _mql1: well with dnode you don't have to just use flat RMI either, your functions can just return (in the CPS sense) hashes full of functions, which is just the javascript way of doing OO anyhow
  765. [18:05] SubStack: and the functions embedded in those hashes can pull the same trick and so on
  766. [18:05] ircretary has joined the channel
  767. [18:05] SubStack: AS IF BY MAGIC
  768. [18:06] arpegius has joined the channel
  769. [18:06] SubStack: it hurt so much to write the code that makes that possible
  770. [18:06] Wizek: rauchg_: yes I do
  771. [18:06] rauchg_: Wizek: what kind of server are you accessing
  772. [18:06] johan_bouveng: ACTION throws a unicorn at ryah 
  773. [18:06] rauchg_: i had to use net.Stream and parse myself
  774. [18:07] rauchg_: https://github.com/LearnBoost/Socket.IO-node/blob/master/tests/transports.xhr-multipart.js#L34
  775. [18:07] rauchg_: because i got that same error
  776. [18:07] Aikar: anyone know about the status of passing FD's between processes being fixed?
  777. [18:09] Wizek: rauchg_: I'm building a simple proxy with node, so that eny HTTP request comes in is forwarded to CouchDB, and the responses are passed back to the requester.
  778. [18:09] BHSPitMonkey has joined the channel
  779. [18:09] _mql1: SubStack: yeah I love javascript in this regards :) Using Sockets in Java et. al. used to be painful. Now with JSON, JavaScript, and those implied anonymous functions it makes all sense. =)
  780. [18:09] BHSPitMonkey: Just released my first node.js application! :D
  781. [18:10] BHSPitMonkey: http://aslville.com
  782. [18:10] Wizek: rauchg_: How do I find out where is the bug at?
  783. [18:10] mikeal1 has joined the channel
  784. [18:11] rauchg_: Wizek: ask mikeal1
  785. [18:11] jacobolus has joined the channel
  786. [18:11] mikeal1: ask me what?
  787. [18:11] mikeal1: i know all!
  788. [18:11] rauchg_: haha specially about http.Client
  789. [18:12] rauchg_: and CouchDB
  790. [18:12] mikeal1: until we merge the refactor :)
  791. [18:12] mikeal1: then i'll have to learn http.js all over again :)
  792. [18:12] rauchg_: he's getting a Parse Error
  793. [18:12] rauchg_: trying to build a proxy to couchdb
  794. [18:12] mikeal1: hrm....
  795. [18:13] mikeal1: are you doing keep-alive?
  796. [18:14] paulwe has joined the channel
  797. [18:14] stagas: BHSPitMonkey: nice
  798. [18:16] isaacs: wow, you know, when sys.pump doesn't work even a little, npm just breaks so so badly.
  799. [18:16] isaacs: it's a testament to the stability of that utility
  800. [18:16] rauchg_: sys.pump does more harm than good
  801. [18:16] Aikar: ...
  802. [18:16] mikeal1: sys.pump is depecated
  803. [18:16] mikeal1: long live Stream.pipe!
  804. [18:17] Aikar: mt
  805. [18:17] mikeal1: sys.pump doesn't really do anything, it just proxies events
  806. [18:17] mikeal1: but it gets blamed for all problems with streams
  807. [18:18] Wizek: mikeal1: Well, tbh idk. :]
  808. [18:18] Wizek: mikeal1: if it is default, then I do
  809. [18:18] rauchg_: mikeal1: it's an awkward interface for error handling
  810. [18:18] svnlto has joined the channel
  811. [18:18] mikeal1: it's not an interface at all for error handling :)
  812. [18:18] isaacs: mikeal1: i prefer Stream.pipe(), but npm has to be 0.2.x compatible
  813. [18:18] nolan_d: Is there any way to make Node's DNS library look up hosts in /etc/hosts? Or is my system misconfigured?
  814. [18:19] nolan_d: It's failing to resolve localhost.
  815. [18:19] mikeal1: i've been against the callback parameter since the beginning
  816. [18:19] rauchg_: when it comes to error handling i should say
  817. [18:19] mif86 has joined the channel
  818. [18:19] mikeal1: and I'm glad to see Stream.pipe finally got rid of it
  819. [18:19] isaacs: yeah, most of the time, what i really want is the childProcess.on("exit" anyway
  820. [18:19] eee_c1 has joined the channel
  821. [18:19] mikeal1: so, we should forward the errors on so that it helps you deal with errors
  822. [18:19] mikeal1: there is a thread about that
  823. [18:20] isaacs: yeah
  824. [18:20] nolan_d: Seems like it used to work but now it isn't. Node-xmpp started failing to resolve localhost and I thought it was a bug in the library, but it seems to be a misunderstanding on my part.
  825. [18:20] isaacs: i have to listen to errors on both streams.
  826. [18:20] isaacs: oh, also... pumping child processes into one another. this is not a well-solved problem, i dont' think
  827. [18:20] mikeal1: yeah, we can make that better
  828. [18:20] mikeal1: we have a good solution on the list
  829. [18:20] isaacs: oh? did i miss that?
  830. [18:20] isaacs: or just forget it?
  831. [18:20] mikeal1: error handling
  832. [18:20] mikeal1: not child processes
  833. [18:20] nolan_d: Also, "ping localhost" works but "host localhost" fails, so maybe Ubuntu just has a broken config on desktop installations? *shrug*
  834. [18:20] isaacs: oh, ok
  835. [18:20] mikeal1: what is the issue with child processes?
  836. [18:21] mikeal1: Wizek: keep-alive is turned on when you have connection:keep-alive
  837. [18:21] isaacs: well, let's say you wanna do something like the following: cat package.tgz | gzip --decompress --stdout | tar -xpf - -C /some/target/path
  838. [18:21] mikeal1: set in the headers
  839. [18:21] isaacs: mikeal: totally a use case i have in npm
  840. [18:22] mikeal1: you can't pipe stdout to stdin between the streams?
  841. [18:22] isaacs: mikeal: so, to do that, you do fs.createReadStream("package.tgz").pipe(gzipCP.stdin) ; gzipCP.stdout.pipe(tar.stdin)
  842. [18:22] isaacs: but, errors are not handled well
  843. [18:23] isaacs: so, i ALSO have to listen to the readStream.on("error"), and listen for teh gzipCP's exit event, and the tar's exit event
  844. [18:23] paulwe_ has joined the channel
  845. [18:23] mikeal1: so
  846. [18:23] isaacs: because child process errors aren't stream errors, they're just exits with non-zero codes
  847. [18:23] mikeal1: should child process exit(1) cause an error event?
  848. [18:23] isaacs: probably not
  849. [18:23] mikeal1: i think they should
  850. [18:24] Wizek: mikeal1: I don't.
  851. [18:24] isaacs: because, for instance, you may want to do something like: which foo || echo "no foo"
  852. [18:24] mikeal1: it's equivolent to a socket error
  853. [18:24] isaacs: no, it's not
  854. [18:24] rauchg_: isaacs: you should write a tarball parser
  855. [18:24] isaacs: rauchg_: yeah, i have like 40% of one
  856. [18:24] isaacs: it almost works
  857. [18:24] mikeal1: you can always add a handler for the error event
  858. [18:24] rauchg_: nice
  859. [18:24] mikeal1: or maybe it should be an option on child processes
  860. [18:24] isaacs: rauchg_: but i keep finding other things to do with my sundays :)
  861. [18:24] rauchg_: hopefully one day you won't be dealing with child processes anymore
  862. [18:24] rauchg_: :D
  863. [18:25] mikeal1: cp.errorOnExit(true)
  864. [18:25] isaacs: mikeal: sure, kinda like the set -e in a bash script
  865. [18:25] mikeal1: this is a pretty common use case
  866. [18:25] isaacs: (that's what set -e does ina bash script, it causes the script to die on any errors)
  867. [18:27] isaacs: rauchg_: there are a lot of creative things npm could do if it could read the tar files directly. like not unpack them unnecessarily, for instance.
  868. [18:27] isaacs: most of the time, i unpack them just so i can read the package.json file. it'd be cool if i could just peek inside
  869. [18:27] isaacs: maybe make like a "package manifest" as well, so it'd be easy to see what's in the package without walking dirs, etc.
  870. [18:28] isaacs: generate and test checksums before unpacking
  871. [18:28] isaacs: (like, of each file)
  872. [18:28] rauchg_: indeed
  873. [18:29] isaacs: right now, npm has about the "red ropes and bouncer" level of security. that would let us get to the the "mechanized bank" level.
  874. [18:29] paulwe_ has joined the channel
  875. [18:30] rauchg_: in fact, you probably dont even need to write a complete parser to look for the json :P
  876. [18:30] rauchg_: and you use the command line one when you really need unpacking
  877. [18:30] isaacs: well, sure, but if you're gonna write a parser, i mean, *write a parser*, you know?
  878. [18:31] davidvanleeuwen has joined the channel
  879. [18:31] isaacs: tar's not a very hard format.
  880. [18:31] Patrick has joined the channel
  881. [18:32] isaacs: you've got a block of header, optionally padded with \0 chars, then the file bytes, and you know how many bytes are in the file
  882. [18:32] evanmeagher has joined the channel
  883. [18:32] isaacs: there isn't even an index or anything to worry about.
  884. [18:32] isaacs: it's an append-only format
  885. [18:32] rauchg_: right but the `tar` command does more than parsing, all the filesystem stuff. if you intend to replace the command 100% thats harder
  886. [18:32] isaacs: nah, it's pretty easy, actually
  887. [18:33] isaacs: it's nothing that doesn't map pretty clearly onto the fs operations we have
  888. [18:33] isaacs: and then i could get around all the CLI irregularity bs between different versions of tar
  889. [18:34] rauchg_: true
  890. [18:34] rauchg_: and it's be a nice side-projet
  891. [18:34] rauchg_: to have
  892. [18:34] isaacs: yeah
  893. [18:34] rauchg_: node-tar
  894. [18:34] rauchg_: we can call it nodetard
  895. [18:34] stephank: I think that already exists?
  896. [18:34] rauchg_: npm ERR! 404 Looks like 'nodetard' is not in the npm registry.
  897. [18:34] isaacs: stephank: yeah
  898. [18:34] stephank: no, I mean just a tar module for node
  899. [18:35] rauchg_: ah
  900. [18:35] isaacs: but is coffeescript, and depends on stuff.
  901. [18:35] isaacs: npm's can't
  902. [18:35] Wizek: How do I get a return out of a long callback-stack?
  903. [18:35] isaacs: Wizek: return values are not valuable. pass in a callback, and pass the value to that.
  904. [18:35] temp01 has joined the channel
  905. [18:35] Wizek: like, if there are anon functions passed as arguments also
  906. [18:36] isaacs: Wizek: instead of return, you do "return cb(null, some value)", and instead of throw you do "return cb(new Error(blah))"
  907. [18:36] isaacs: where "cb" is the callback you received
  908. [18:36] isaacs: you got a gist or pastie of what you're dealing with?
  909. [18:38] skampler_ has joined the channel
  910. [18:38] cjm has joined the channel
  911. [18:40] olivvv_: so I m trying to start with socket.io, here is my code : http://pastie.org/1315604
  912. [18:40] olivvv_: this html client side look correct
  913. [18:40] olivvv_: but i dont see anything happening
  914. [18:40] c4milo has joined the channel
  915. [18:41] Guest14155 has left the channel
  916. [18:41] olivvv_: Dunno if i m even supposed to ''see'' anything
  917. [18:42] slaskis has joined the channel
  918. [18:42] rauchg_: olivvv_: you're not really telling socket.io to connect to port 8080
  919. [18:42] rauchg_: new io.Socket(null, { port: 8080 });
  920. [18:42] webchat has joined the channel
  921. [18:43] rauchg_: oh it uses document.location.port nevermind
  922. [18:43] rauchg_: it should guess it
  923. [18:43] rauchg_: oh
  924. [18:43] rauchg_: you're not calling socket.connect()
  925. [18:43] rauchg_: boom
  926. [18:44] agnat has joined the channel
  927. [18:44] jpld has joined the channel
  928. [18:44] jpld has joined the channel
  929. [18:44] markwubben has joined the channel
  930. [18:46] ossareh has joined the channel
  931. [18:47] olivvv_: ok so now the console told me that there is a client connected
  932. [18:47] Wizek: isaacs: then take a look at this situation: I have a http.createServer, in which I have a request.on('end' ... to which an anon func is passed which contains an http.createClient, which in turn also contains a request.on('end' ... to which an anon func is passed which tries to response.end(reply). What is this response.end trying to do? For one, I'm trying to reach out to another server, and pass it's response to my original client
  933. [18:47] olivvv_: but why is there no ouptut from console.log('message') ??
  934. [18:47] isaacs: Wizek: need code.
  935. [18:48] isaacs: Wizek: describing code in words is guaranteed to be nothing but miscommunication.
  936. [18:48] spetrea has joined the channel
  937. [18:48] isaacs: it's like giving relationship advice over the radio. entertaining, but ultimately does more harm than good.
  938. [18:48] Wizek: isaacs: okay
  939. [18:48] olivvv_: mmh okay gonna dive more
  940. [18:49] Wizek: 1 moment
  941. [18:49] isaacs: gist.github.com is your friend.
  942. [18:49] isaacs: or pastie.org
  943. [18:49] InsDel has joined the channel
  944. [18:50] c4milo has left the channel
  945. [18:50] Wizek: http://pastebin.com/TPnNSpCA
  946. [18:51] Wizek: isaacs: pastebin?
  947. [18:51] isaacs: orthat
  948. [18:51] isaacs: :)
  949. [18:51] isaacs: text file on a server works, too :)
  950. [18:51] halfhalo: its a trap
  951. [18:51] mjr_: someone should make a code pasting service call adaste, because it surrounds your code withi ads.
  952. [18:51] Nohryb has joined the channel
  953. [18:53] Wizek: mjr_ or insert ads in your code, e.g. replaces comments
  954. [18:53] isaacs: Wizek: so...
  955. [18:53] isaacs: it looks like the callback to connectTo expects to get a response.
  956. [18:54] isaacs: but the way you're attaching it to response.on("end"), it'll never get an argument
  957. [18:54] aconbere has joined the channel
  958. [18:54] isaacs: Wizek: line 20, you're passing in a function that expects an arg. line 64, you're setting up that function to be called without any such argument.
  959. [18:55] isaacs: is that the confusion?
  960. [18:55] ossareh has joined the channel
  961. [18:55] isaacs: Wizek: also, line 21 (commented out) is calling response.end, but you never called response.writeHead
  962. [18:56] derRichard has joined the channel
  963. [18:56] derRichard: hi
  964. [18:57] Wizek: hmm, let me try inserting response.writeHead
  965. [18:57] derRichard: how can i bin my module to the global object? why does this simple example not work? http://codepad.org/8MzHdNPf
  966. [18:58] isaacs: mjr_: hey, i just updated the npm install.sh script so it should be more portable
  967. [18:59] isaacs: Wizek: fix the much much huger problem i mentioned first.
  968. [18:59] Wizek: isaacs: SyntaxError: Unexpected identifier
  969. [18:59] isaacs: Wizek: about not getting any kind of argument, and expecting one
  970. [18:59] mjr_: isaacs: is that what was kicking out the shell error?
  971. [18:59] mjr_: even though it worked anyway
  972. [18:59] isaacs: mjr_: yeah
  973. [18:59] isaacs: derRichard: require() returns an object, it doesn't inject into the global
  974. [19:00] derRichard: isaacs: but why does it work when i do > require("sys");
  975. [19:00] isaacs: derRichard: you have to assign things to vars locally. commonjs modules aren't just a global scope dump, because that's the worst mistake ever made in browser-based js, and we preferred not to repeat it.
  976. [19:00] derRichard: after that i can use "print"
  977. [19:00] isaacs: derRichard: you can use "print" without doing that.
  978. [19:00] mjr_: isaacs is holding it down in #node.js
  979. [19:00] isaacs: hehe
  980. [19:00] mjr_: ACTION flashes node gang sign to isaacs 
  981. [19:01] derRichard: isaacs: damn
  982. [19:01] isaacs: derRichard: note: global print() is deprecated, and will go away.
  983. [19:01] Wizek: isaacs: should it be onDataEnd.call(body)? or would onDataEnd(body) work?
  984. [19:01] isaacs: Wizek: response.on("end", function () { onDataEnd(body) }) instead of just response.on("end", onDataEnd)
  985. [19:02] mikeal1 has joined the channel
  986. [19:02] isaacs: Wizek: or, if you prefer, response.on("end", onDataEnd.bind(null, body))
  987. [19:02] jchris has joined the channel
  988. [19:02] arpegius has joined the channel
  989. [19:03] Wizek: isaacs: done, but I don't get why do I need to wrap onDataEnd in an anon fn, it is a function itself, isn't it?
  990. [19:03] olivvv_: rauchg_:i got the client to send a message to the server, but how do I answer from the server ?
  991. [19:03] isaacs: Wizek: because the "end" event handler doesn't get an argument.
  992. [19:03] rauchg_: conn.send()
  993. [19:04] isaacs: Wizek: that's why onDataEnd isn't getting the reply
  994. [19:04] rauchg_: on('connection, function(conn){ conn.send('woot!'); });
  995. [19:04] derRichard: bye
  996. [19:04] derRichard has left the channel
  997. [19:04] isaacs: Wizek: it's not about named vs anon functions. get that out of your head.
  998. [19:04] isaacs: Wizek: the anonymity of the function is irrelevant.
  999. [19:04] micheil has joined the channel
  1000. [19:05] caolanm has joined the channel
  1001. [19:05] isaacs: Wizek: the important thing is to trap the argument that you want to pass to it, because otherwise it won't get it
  1002. [19:06] olivvv_: rauchg_:yeah, thx ! another question about expressjs, can it work with mustache.js ?
  1003. [19:08] rauchg_: olivvv_: it could yeah
  1004. [19:08] rauchg_: it ships with ejs, jade and haml
  1005. [19:08] rauchg_: but you can add it easily
  1006. [19:09] Wizek: isaacs: hmm, okay. But it still throws a syntaxError mentioned above
  1007. [19:09] olivvv_: okay, then I'll play now with mustache and will try to add expressjs later
  1008. [19:10] isaacs: Wizek: pastebin the new code, please.
  1009. [19:10] Wizek: http://prntscr.com/17cld
  1010. [19:11] isaacs: Wizek: not the error. the code that is throwing the error.
  1011. [19:13] adambeynon has joined the channel
  1012. [19:14] matjas has joined the channel
  1013. [19:14] micheil: hmm, I wonder if it'd be possible to JSON.parse a Buffer?
  1014. [19:14] isaacs: micheil: should work. JSON.parse does a toString() first
  1015. [19:14] micheil: (rather than JSON.parse(buf.toString())
  1016. [19:14] isaacs: and Buffer#toString converts to utf8
  1017. [19:14] isaacs: yeah
  1018. [19:15] micheil: I'm meaning have it actually just work on the memory of the buffer
  1019. [19:15] isaacs: v8: JSON.parse({toString:function () { return "{'foo':'bar'}" }})
  1020. [19:15] v8bot: isaacs: SyntaxError: Unexpected token ILLEGAL
  1021. [19:15] isaacs: ah, nvm
  1022. [19:15] oal: Hey, I'm trying to use Mongoose with Express.js. Then I do this._id the id is returned as "Lélåz’Õ,.¤" but I'd like to see it as "4ce9654ae5442b9d09000001". How can I make that happen?
  1023. [19:15] Wizek: isaacs: http://pastebin.com/rVMBtupt
  1024. [19:15] isaacs: Wizek: line 21. look at the end of the line. missing )
  1025. [19:17] italic has joined the channel
  1026. [19:17] Wizek: isaacs: Wow! :D
  1027. [19:18] Wizek: isaacs: it works, thanks :P But I still hate Node.js's error msgs, they are rarely helpful...
  1028. [19:18] isaacs: Wizek: well, to be fair, the "unexpected identifier" is a pretty standard JS error.
  1029. [19:21] robotarm_ has joined the channel
  1030. [19:23] temp01 has joined the channel
  1031. [19:23] dnolen has joined the channel
  1032. [19:24] Wizek: isaacs: well, ye, thinking about it from retrospect, it is logical now, but those errors sometimes to confuse me. Do you know an easy way to replicate the whole header too? Not just the body
  1033. [19:25] isaacs: Wizek: sure. just send the response.header object from the upstream request to the downstream's response.writeHead
  1034. [19:25] isaacs: response.writeHead(upstream.statusCode, upstream.header)
  1035. [19:26] isaacs: and then you can just sys.pump(upstream, response)
  1036. [19:26] isaacs: to send the body
  1037. [19:28] Wizek_ has joined the channel
  1038. [19:29] micheil: wow. v8's JSON methods are in javascript, not C
  1039. [19:29] Wizek_: isaacs: Got dc'd
  1040. [19:29] Wizek_: micheil: Why is that suprising?
  1041. [19:29] micheil: well, I was expecting it to be in C
  1042. [19:30] micheil: minds you, the javascript code looks slightly weird
  1043. [19:30] micheil: like, return %ParseJson(s);
  1044. [19:30] jashkenas: micheil: got a link for that?
  1045. [19:30] micheil: it's in the V8 source code
  1046. [19:31] micheil: or in node, deps/v8/src/json.js
  1047. [19:32] micheil: also..
  1048. [19:32] adambeynon has joined the channel
  1049. [19:32] micheil: v8: JSON.parse.length
  1050. [19:32] v8bot: micheil: 2
  1051. [19:36] micheil: like..
  1052. [19:36] micheil: v8: JSON.parse('{"a":"B"}', function(h, n, v){ if(n.toString() == "[object Object]"){ return n; } else { return n+"G";} })
  1053. [19:36] v8bot: micheil: {"a": "BG"}
  1054. [19:37] tylerstalder has joined the channel
  1055. [19:38] micheil: wow, and at stringification time you can actually pad stuff to a specific length.
  1056. [19:39] Wizek: isaacs: Have you responded anything? I dc'ed
  1057. [19:40] lstrojny has joined the channel
  1058. [19:40] lstrojny has left the channel
  1059. [19:40] lstrojny has joined the channel
  1060. [19:41] sudoer has joined the channel
  1061. [19:41] laktos1 has joined the channel
  1062. [19:41] lstrojny: Hi everybody
  1063. [19:41] laktos1: hey
  1064. [19:41] laktos1: is the cloud9 team here?
  1065. [19:42] herbySk has joined the channel
  1066. [19:42] lstrojny: Is there a known issue with node 0.3.1 not handling POST data in HTTP requests correctly? I have a strange issue with the data and end event never taking place in an POST request
  1067. [19:42] micheil: hmm.. cloud9, that's Ajax.org, or O3..
  1068. [19:43] micheil: javruben: see above.
  1069. [19:43] isaacs: Wizek: logs at http://nodejs.debuggable.com/
  1070. [19:43] isaacs: gotta ru
  1071. [19:43] isaacs: n
  1072. [19:48] laktos1: micheil: does cloud9 have a irc channel?
  1073. [19:48] laktos1: was wondering then cloud9 will be offered as a service
  1074. [19:48] laktos1: when
  1075. [19:48] micheil: I don't think so.
  1076. [19:48] micheil: I'm not sure.
  1077. [19:49] micheil: try contacting them on twitter, http://twitter.com/Cloud9IDE
  1078. [19:49] matjas has joined the channel
  1079. [19:49] micheil: or email them: info@cloud9ide.com
  1080. [19:50] laktos1: micheil: yeah thanks
  1081. [19:51] itissid: Hey I have a javascript for gathering text from a page I want to make it work with node... http://pastebin.com/eLSrrFtN I tried using jsdom but it just does not work... I unit tested it in my chrome browser and it works perfectly....
  1082. [19:53] dnolen has joined the channel
  1083. [19:54] micheil: itissid: for something like that, jsdom should work.
  1084. [19:55] micheil: jashkenas: actually. looks like I was wrong JSON.parse is only exposed in JS, the JS code for it is to allow the end developer to extend it.
  1085. [19:56] Nohryb has joined the channel
  1086. [19:57] tanepiper: micheil: what's the second argument in JSON.parse?
  1087. [19:57] itissid: micheil, tell me something case node does not import webkit and it uses CommonJS people have to write all this stuff from scratch... Like jsdom?
  1088. [19:57] itissid: *'cause
  1089. [19:58] Wizek: micheil: So, ultimately it is written in c?
  1090. [19:58] micheil: yeah
  1091. [19:58] itissid: Because I dont quite understand that part
  1092. [19:58] micheil: (to wizek)
  1093. [19:58] pfarrel has joined the channel
  1094. [19:59] micheil: itissid: well, node doesn't actually have anything todo with webkit or even browsers. All that's shared is v8, which is just a javascript interpreter.
  1095. [19:59] micheil: tanepiper: JSON.parse.toString()
  1096. [19:59] micheil: erm
  1097. [19:59] micheil: tanepiper: JSON.parse(source, reviver)
  1098. [20:00] micheil: reviver is a function, and has three args: holder, name, value
  1099. [20:00] tanepiper: oh, is it for defining a structure?
  1100. [20:00] tanepiper: like cls= in python simplejson.parse?
  1101. [20:00] micheil: umm...
  1102. [20:01] micheil: I don't think so.
  1103. [20:01] micheil: reviver is like a callback on each value
  1104. [20:01] micheil: v8: JSON.parse('{"a":"B"}', function(h, n, v){ if(n.toString() == "[object Object]"){ return n; } else { return n+"G";} })
  1105. [20:01] v8bot: micheil: {"a": "BG"}
  1106. [20:02] tanepiper: yea, that is kind of similar
  1107. [20:02] pfarrel: Hey, I'm having a bit of trouble getting node working properly on my machine, and couldn't find anything relevant when googling. Is this the right place to ask?
  1108. [20:02] micheil: tanepiper: I'm actually wondering if it's easily possible to write a JSON.parse to work on Buffers
  1109. [20:02] micheil: (rather than strings)
  1110. [20:02] micheil: pfarrel: sure.
  1111. [20:03] dnolen_ has joined the channel
  1112. [20:03] tanepiper: http://docs.python.org/library/json.html check Extending JSONEncoder:
  1113. [20:04] pfarrel: Basically I downloaded and built it on my ubuntu 10.10 VM. The build went fine and I can run some example apps fine. Running make test shows about 140 tests failing though. Is this right?
  1114. [20:07] micheil: hmm, that's interesting... v8 has two things called CharacterStreamUTF16Buffer and UTF8Buffer
  1115. [20:07] micheil: pfarrel: that isn't right.
  1116. [20:07] micheil: pfarrel: what are the failures?
  1117. [20:08] micheil: pfarrel: and what version of node?
  1118. [20:08] jamescarr_ has joined the channel
  1119. [20:09] jamescarr_: what do they call the "object stuff" in Es5? Like Object.freeze, getters/setters, etc
  1120. [20:09] jamescarr_: ?
  1121. [20:09] admc has joined the channel
  1122. [20:09] pfarrel: micheil: I had originally grabbed the latest from git, but went back to try the most recent stable, the same thing happened with both of them though.
  1123. [20:09] micheil: jamescarr: objects.cc?
  1124. [20:09] micheil: of
  1125. [20:09] micheil: oh.
  1126. [20:09] pfarrel: micheil: I only went back to try running node's own tests when i noticed that the websocket library's tests were mostly failing
  1127. [20:10] micheil: Objects
  1128. [20:10] micheil: which.. websocket library?
  1129. [20:10] pfarrel: micheil: https://github.com/miksago/node-websocket-server this one
  1130. [20:11] micheil: pfarrel: that one doesn't have any tests..
  1131. [20:11] micheil: ACTION is still to write them.
  1132. [20:11] InsDel has joined the channel
  1133. [20:11] mikeal1 has joined the channel
  1134. [20:11] jamescarr_: micheil, oh btw, I had a "vision" while driving to St.Louis today
  1135. [20:12] pfarrel: Oh, oops. Well, either way, all of the examples were crashing with stream errors, so I figured something must have been up with node
  1136. [20:12] jamescarr_: distributed WebWorkers :)
  1137. [20:12] rawberg has joined the channel
  1138. [20:12] micheil: jamescarr: in ECMA262 5th edition, Object Objects is what an object is called, and those methods are called Properties of the Object Constructor
  1139. [20:12] micheil: jamescarr: speak to me in a couple of days, and ask me about XEE
  1140. [20:12] jamescarr_: essentially have a websocket server with servers running as clients, when a new WebWorker is create the server creates a new server instance with the script runnin on it
  1141. [20:12] micheil: pfarrel: okay, well, I'd need to know the exact errors, not just "stream errors"
  1142. [20:13] jimt has joined the channel
  1143. [20:13] micheil: jamescarr: dnode?
  1144. [20:14] pfarrel: micheil: Ok, I'll just give installing node on a different machine a go and if I run into the same thing I'll get back to you with some specifics. Thanks
  1145. [20:15] SubStack: jamescarr_: like a preforking server?
  1146. [20:15] jamescarr_: SubStack, yeah
  1147. [20:16] jamescarr_: basically, creating a new WebWorker will run the specified script on a whole new server instance
  1148. [20:16] confoocious has joined the channel
  1149. [20:16] confoocious has joined the channel
  1150. [20:16] jamescarr_: I mean, physical server
  1151. [20:16] SubStack: could be appropriate for some cpu-intensive types of jobs
  1152. [20:16] jamescarr_: not just spinning up a new process on the same machine
  1153. [20:16] bbttxu has joined the channel
  1154. [20:16] saikat has joined the channel
  1155. [20:17] SubStack: wait, so provisioning a whole new system just to handle a request?
  1156. [20:17] jamescarr_: well, it could be running already I guess
  1157. [20:17] SubStack: well, in the mean time you can use work queues
  1158. [20:17] lstrojny: here is what util.inspect says about the request: http://pastebin.com/Q1WkBdZY there are no post data included but the browser says, there are some
  1159. [20:17] SubStack: like this: https://github.com/substack/node-waitlist
  1160. [20:18] tanepiper: i remember doing that stuff 10 years ago with JINI, it was horrible :(
  1161. [20:18] jesusabdullah: jini?
  1162. [20:18] tanepiper: http://www.jini.org/wiki/What_is_Jini%3F
  1163. [20:19] SubStack: tanepiper: well in fairness anything to do with java is horrible
  1164. [20:19] tanepiper: we would fire up instances of servers different processes that were overloaded
  1165. [20:19] jesusabdullah: go innernet go innernet go
  1166. [20:19] jamescarr_: tanepiper, well, camel is a good way to distributed processing in java imho
  1167. [20:20] jamescarr_: since it makes it invisible to the domain
  1168. [20:20] cjm has joined the channel
  1169. [20:20] tanepiper: jamescarr_: oh? well, i don't really do java anymore
  1170. [20:20] tanepiper: except Android stuff
  1171. [20:20] jamescarr_: I still do the ol' JEE dance
  1172. [20:20] tanepiper: even then, i'd rather have nodejs on android (or a palm pre 2)
  1173. [20:20] SubStack: poor palm
  1174. [20:21] jamescarr_: it's really not too bad as long as you use the right tools rather thaan fuck around with the low level APIs
  1175. [20:21] swistak_ has joined the channel
  1176. [20:21] nlacasse has joined the channel
  1177. [20:21] jamescarr_: I can do an hour with camel, CXF, and Spring on java that I've seen whole teams spend months doing with just plain "do it yourself" java :)
  1178. [20:21] micheil: hey.. cool, the scanner/parser in v8 can take in something which calls' itself a Stream
  1179. [20:22] tapwater has joined the channel
  1180. [20:23] mAritz1 has joined the channel
  1181. [20:23] dnolen has joined the channel
  1182. [20:24] jesusabdullah: uuugh that jini page has enterprise-speak
  1183. [20:24] SubStack: anything todo with java has it
  1184. [20:24] jesusabdullah: I'd feel a lot better about these things if they used normal phraseology
  1185. [20:24] SubStack: jesusabdullah: VMs are worse
  1186. [20:25] jacobolus has joined the channel
  1187. [20:25] jesusabdullah: A novel virtualization abstraction technology which leverages the bullshit and herpderp of enterprise features of x
  1188. [20:25] jesusabdullah: ACTION rolls his eyes.
  1189. [20:26] jesusabdullah: If anyone needed to do the 'banned words" thing, it's people that write "enterprise" documentation
  1190. [20:26] jesusabdullah: RIP "architecture"
  1191. [20:26] SubStack: enterprise documentation should use words like "engage" and "steady as she goes"
  1192. [20:27] jesusabdullah: Yes it should
  1193. [20:27] jesusabdullah: substack++
  1194. [20:27] v8bot: jesusabdullah has given a beer to substack. substack now has 1 beers.
  1195. [20:27] stalled has joined the channel
  1196. [20:27] Wizek: What is the fastest and easyest way to make node serve html files according to the folder structure?
  1197. [20:28] jesusabdullah: connect's static provider is pretty easy
  1198. [20:28] jesusabdullah: I haven't tried it with subfolders, but I would imagine it works
  1199. [20:28] lstrojny: regarding the http.ServerRequest issue I have. I've ruled out the proxy in between (nginx), no behavior change without the proxy
  1200. [20:28] lstrojny: the strange thing: it used to work for me
  1201. [20:29] Wizek: jesusabdullah: and if I don't have connect?
  1202. [20:29] SubStack: Wizek: var connect = require('connect'); var server = connect.createServer(connect.staticProvider(__dirname + '/static')).listen(8080)
  1203. [20:29] SubStack: Wizek: it's hideous otherwise
  1204. [20:29] SubStack: and error-prone
  1205. [20:29] skiz has joined the channel
  1206. [20:29] jamescarr_: learn something new every day
  1207. [20:29] jamescarr_: I didn't know that you can return a new object instance in the ctor
  1208. [20:30] lstrojny: here is my post data handler code: http://pastebin.com/Jhy5ztmv
  1209. [20:30] jamescarr_: for example, function Pont(x,y){ return [x,y]; }; var p = new Point(2,3); p == [2,3];
  1210. [20:30] jamescarr_: contrived, but you get it
  1211. [20:31] jesusabdullah: Wizek: npm install connect :D
  1212. [20:31] jesusabdullah: Wizek: As substack showed, it's a one-liner, which is pretty radtastic
  1213. [20:32] lstrojny: jamescarr_: used that for fibnacci numbers so that the initial fib(1,2) call returns an object with two properties num and next where next is a function for the next number in the row
  1214. [20:32] Wizek: jesusabdullah: Yeah, but won't I have to rewrite my current code then? It is written in plain Node
  1215. [20:32] SubStack: Wizek: connect just extends the http module, so probably not
  1216. [20:32] jesusabdullah: First: What's wrong with a little code reorganization? ;) Second, why would you expect connect to shit on your current code?
  1217. [20:33] Wizek: So you say all I have to rewrite is http.createServer to connect.createServer?
  1218. [20:34] jesusabdullah: Maybe? I haven't honestly done much with connect. It's pretty slick though, and probably easiest for you to get going
  1219. [20:35] Wizek: or isn't express better if we are at it?
  1220. [20:35] jesusabdullah: Try reading up on connect, and see what you think maybe--I mean, in order to make an informed decision that's the right thing to do
  1221. [20:35] SubStack: Wizek: maybe another call someplace but pretty much
  1222. [20:35] SubStack: express is only different :p
  1223. [20:35] jesusabdullah: It might be--read about express too if the idea of more framework interests you
  1224. [20:36] jesusabdullah: Literacy is a pretty awesome thing, if you think about it--we have this ability to make ourselves informed by seeking out records instead of convincing someone to tell us about it
  1225. [20:36] jesusabdullah: <3 the future
  1226. [20:36] Wizek: jesusabdullah: Well, I'm kind of afraid of frameworks instead of being interested by them. They have less support, less documentation, smaller userbase, so I have less place to look for help
  1227. [20:39] olivvv_: hi again. any mustache user here ?
  1228. [20:39] Wizek: SubStack: okay, installed connect. Now, where should I put my htmls?
  1229. [20:40] olivvv_: how do I include the template code from another file ?
  1230. [20:41] Wizek: SubStack: What is the path relative to?
  1231. [20:41] skiz has joined the channel
  1232. [20:42] maushu has joined the channel
  1233. [20:42] maushu: http://sivers.org/obvious
  1234. [20:42] SubStack: Wizek: in my one-liner, to the directory that your server.js is in
  1235. [20:42] SubStack: __dirname
  1236. [20:42] SubStack: __dirname + '/static' in that case
  1237. [20:44] Wizek: SubStack: wow, it looks like it works, Yaj! :D
  1238. [20:44] Wizek: SubStack: ty
  1239. [20:46] jimt has joined the channel
  1240. [20:48] Craig` has joined the channel
  1241. [20:48] Craig`: hey guys
  1242. [20:50] Wizek: SubStack: Ookay, so. Without connect, createserver needed to be passed a function, and provided 2 arguments to it. now, connect doesn't need that function
  1243. [20:51] jimt has joined the channel
  1244. [20:51] SubStack: Wizek: you can use .use()
  1245. [20:51] Wizek: SubStack: How do I insert this staticProvider without breaking all my request.on() etc...?
  1246. [20:51] SubStack: server.use(function (req, res) {})
  1247. [20:51] heap has joined the channel
  1248. [20:51] SubStack: I could be a little wrong about that but I think that could work
  1249. [20:52] Wizek: SubStack: What does use do?
  1250. [20:52] Aria has joined the channel
  1251. [20:52] SubStack: Wizek: the same as the stuff inside createServer()
  1252. [20:52] dnolen_ has joined the channel
  1253. [20:53] Craig`: yesterday i was trying to view inside of my minecraft level.dat file but the only output i got was to do with Buffer, my code is, http://pastie.org/1315868 .. cheers
  1254. [20:54] zimbatm has joined the channel
  1255. [20:54] tanepiper: working on nodecraft?
  1256. [20:55] Wizek: SubStack: Error: server already opened
  1257. [20:55] Wizek: SubStack: Doesn't let me "use" it
  1258. [20:55] Craig`: well just wanting to get started with node and i love minecraft.. wanting an inventory editor firstly tanepiper
  1259. [20:55] _mql1: SubStack: with DNode, how can I bind a method to on('connection') and access the client object?
  1260. [20:55] Craig`: :)
  1261. [20:55] SubStack: Wizek: well you can server.listen() after you .use()
  1262. [20:56] mr_daniel has joined the channel
  1263. [20:56] Craig`: sorry for slow typing just changed to dvorak
  1264. [20:56] _mql1: SubStack: looking for the equivalent of socket.on('connection', function(client) {..}
  1265. [20:56] altamic has joined the channel
  1266. [20:56] SubStack: _mql1: 2 ways: in the constructor argument function or in the connect/listen callback
  1267. [20:56] Wizek: SubStack: Nah, the problem was I tried to make it listen twice ^^
  1268. [20:57] SubStack: both of which get the client object as their first argument and the connection object as the second
  1269. [20:57] SubStack: _mql1: but! the client object isn't ready in the constructor version right away, so you have to do conn.on('ready', function () { you can use client now in here })
  1270. [20:58] _mql1: SubStack: ah, and that client object is the same one as in socket.io? I've seen DNode(function(client)) but I can't access client.sessionId for some reason...
  1271. [20:58] Craig`: output from my program is http://pastie.org/1315877
  1272. [20:58] SubStack: the reason why is that the constructor function needs to tell the other side about what methods it has before it gets an active handle on the client's methods
  1273. [20:58] Craig`: any ideas?
  1274. [20:58] SubStack: because otherwise there would be deadlock
  1275. [20:59] SubStack: _mql1: no, it's the symmetric remote object handle that the methods are exposed on
  1276. [20:59] SubStack: you can do conn.id
  1277. [20:59] SubStack: conn is the second arg
  1278. [20:59] _mql1: ah ok
  1279. [20:59] _mql1: seen
  1280. [21:00] _mql1: I'm keeping a client hash of registered clients in my code, so I need to access this unique client id
  1281. [21:00] _mql1: will try conn.id
  1282. [21:00] Wizek: SubStack: Now it works, but it serves the same files over and over, no matter if I restart node, or do a ctrl+f5
  1283. [21:00] SubStack: yep I do it that way often too
  1284. [21:01] arpegius has joined the channel
  1285. [21:01] Wizek: SubStack: How can I tell it to watch for rile changes?
  1286. [21:01] SubStack: Wizek: it serves the same static files after you modify them?
  1287. [21:01] Craig`: i edited the console.log to console.log(data + ":)"); .. and now weird chars are outputted... i guess im going about parsing the dat file wrong
  1288. [21:01] Wizek: SubStack: +
  1289. [21:01] Craig`: someone help? :)
  1290. [21:01] SubStack: Wizek: connect watches for file changes automatically, something else must be amiss
  1291. [21:01] Wizek: SubStack: I have an idea
  1292. [21:03] sh1mmer has joined the channel
  1293. [21:03] ajcates has joined the channel
  1294. [21:05] mscdex: Craig`: well, "weird characters" would be expected with data like that in that Buffer
  1295. [21:05] mscdex: it's converting the buffer object to a string
  1296. [21:06] Rixius has joined the channel
  1297. [21:07] prettyrobots has joined the channel
  1298. [21:07] olivvv_: so reading a file is an asynchroneous thing in node, right ? doesnt that create the risk to build very big files if we tend to avoid to include code from other files ?
  1299. [21:10] mscdex: olivvv_: i'm not sure what you mean. you can read files async or sync in node. you can also require() your own modules
  1300. [21:11] olivvv_: where is that documented, couldn t find it in the official doc
  1301. [21:11] micheil: require() is synchronous
  1302. [21:12] mscdex: yeah
  1303. [21:12] micheil: fs.* is asynchronous unless it's got the word Sync at the end
  1304. [21:13] micheil: olivvv_: the only thing that you may notice is that you use a lot of memory processing large files
  1305. [21:13] micheil: and in which case, it may be better to use a fs.createReadStream
  1306. [21:13] _mql1: SubStack: just for understanding… with dnode, is the socket.io api hidden from the interface? I'm taking about client.on('message', function(){ … }), client.on('disconnect', function(){ … }) those things… that was the client object I confused with the first argument of the DNode constructor.. I'm just wondering if this api is still there somewhere or hidden by design.
  1307. [21:14] Wizek: Anyone here who used CouchDB with JavaScript XHR API?
  1308. [21:14] petercooper has joined the channel
  1309. [21:14] SubStack: _mql1: the socket.io stuff is completely hidden so that the interface is the same for websockets and network sockets
  1310. [21:14] SubStack: _mql1: client/remote is the object that the other side of the connection is hosting
  1311. [21:15] SubStack: it has nothing to do with socket.io
  1312. [21:15] _mql1: SubStack: ah i see. however I can rely on conn.id to by my unique client identifier...
  1313. [21:15] SubStack: _mql1: yes
  1314. [21:15] _mql1: SubStack: sure.. clear so far :)
  1315. [21:15] olivvv_: micheil:I m really a noode. so you are saying that require can be used to include files as well ? do I have to pass a path ?
  1316. [21:15] SubStack: it is actually also independent from the socketio id
  1317. [21:16] ncursestest has joined the channel
  1318. [21:16] micheil: olivvv_: require() is for loading in common.js style modules.
  1319. [21:16] Craig`: mscdex, i see, can you help me parse the dat file? although im not even sure of its form..
  1320. [21:16] micheil: it allows you to have multiple files of code, and you require("path") to load them.
  1321. [21:16] olivvv_: micheil:i want to include a template file
  1322. [21:16] micheil: in which case you'll need fs.readFile or similar.
  1323. [21:17] micheil: one of the fs.* functions
  1324. [21:17] olivvv_: okay so that will be asyncroneous ?
  1325. [21:17] olivvv_: does that make it complicated to achieve mvc ?
  1326. [21:18] Wizek: Is there anyone here familiar with XHR, or more specifically CouchDB's api?
  1327. [21:18] olivvv_: I m try to understand how things should work with node, how to make a real app
  1328. [21:18] SubStack: Wizek: well some people in this channel work at couchone, so yes
  1329. [21:19] _mql1: SubStack: kk, that's fine, as long as I know how it works ;) I'm about to drop my destructive controller actions (exposed via http) in favor of dnode remote functions. Great effort!
  1330. [21:19] unomi has joined the channel
  1331. [21:19] swistak_ has left the channel
  1332. [21:19] Wizek: hmm, nice. I don't see how to get started using their HXR API, which is located at /_utils/scripts/couch.js
  1333. [21:20] Wizek: I think it will be var db = new CouchDB()
  1334. [21:20] swistak_ has joined the channel
  1335. [21:20] Wizek: but then, idk what 2 arg should be passed
  1336. [21:21] Wizek: it requaires "name" and "httpHeaders"
  1337. [21:21] sh1mmer: is there a way to enumerate the code in a function from REPL?
  1338. [21:21] sh1mmer: rather than just that fact it's a function?
  1339. [21:21] aj_ has joined the channel
  1340. [21:22] Craig`: the structure of the dat file is http://www.minecraftwiki.net/wiki/Alpha_Level_Format .. but im still in need of help for how to actually get the contents of the file, and not just Buffer
  1341. [21:23] aj_: Hi, I have a http server listenting on a socket. And I want another http server listening on a port to connect to the first socket http server. How should I do?
  1342. [21:23] sh1mmer: Craig`: what is your question?
  1343. [21:24] sh1mmer: I think I missed the beginning
  1344. [21:24] aconbere has joined the channel
  1345. [21:24] sh1mmer: Craig`: you saw the minecraft server someone is building in node already, right?
  1346. [21:24] Craig`: im wanting to parse dat file my current program just outputs Buffer info
  1347. [21:25] Craig`: sh1mmer, nope
  1348. [21:25] sh1mmer: Craig`: the buffer is the file
  1349. [21:25] sh1mmer: Craig`: unless you give node an encoding to use it defaults to the binary representation, which is a buffer
  1350. [21:25] sh1mmer: the buffer is just hex
  1351. [21:25] Craig`: i have no node experience and figure thisll be decent intro
  1352. [21:26] sh1mmer: Craig`: https://github.com/welterde/nodecraft
  1353. [21:26] Craig`: sh1mmer, i have no idea how to get started
  1354. [21:26] sh1mmer: Craig`: go read the preview of my book ;)
  1355. [21:26] sh1mmer: Craig`: http://developer.yahoo.com/blogs/ydn/posts/2010/11/announcing-a-node-js-book-project/
  1356. [21:26] sh1mmer: introduces some node core concepts and some 101 code
  1357. [21:27] sh1mmer: you are biting off a somewhat harder project to start on
  1358. [21:27] sh1mmer: I'd recommend you build a web server and so on a little first
  1359. [21:27] sh1mmer: because there is a lot more stuff on the net about that to read
  1360. [21:27] Craig`: ah am i?
  1361. [21:27] xslashxr has joined the channel
  1362. [21:28] aubergine_ has joined the channel
  1363. [21:28] sh1mmer: minecraft is hard because you are reverse engineering all of the stuff Notch is doing
  1364. [21:28] sh1mmer: he doesn't document that
  1365. [21:28] sh1mmer: I know other people are but it's hard work, I know I was looking at doing it myself
  1366. [21:28] sh1mmer: I'm not saying you shouldn't
  1367. [21:28] sh1mmer: but you'll need a fair amount of knowledge of packet sniffing, and working with binary
  1368. [21:29] baoist has joined the channel
  1369. [21:29] Craig`: well i really need to do something, i mean im wanting to get good with node and build some awesome stuff just i never get around to making anything and you learn best by making things :3
  1370. [21:29] Nohryb has joined the channel
  1371. [21:29] sh1mmer: for sure
  1372. [21:29] sh1mmer: I built a (very crappy) DNS server
  1373. [21:29] sh1mmer: which was a total learning experience
  1374. [21:29] jherdman has joined the channel
  1375. [21:29] Craig`: i need some projects starting from very bottom - where i am now
  1376. [21:30] sh1mmer: so build a web server and serve some web sites
  1377. [21:30] SubStack: build a MUD!
  1378. [21:30] SubStack: that's what I'm doing for some reason right now
  1379. [21:30] jakehow has joined the channel
  1380. [21:30] sh1mmer: ooh that would be cool
  1381. [21:30] Craig`: sorry, mud?
  1382. [21:31] SubStack: one where to beat monsters you have to write programs and analyze source code
  1383. [21:31] sh1mmer: Multi-User Dungeon
  1384. [21:31] sh1mmer: ACTION is old
  1385. [21:31] Craig`: sh1mmer, where should i get started, tuts etc
  1386. [21:31] matjas has joined the channel
  1387. [21:31] sh1mmer: Craig`: that link to the book is a place. It walks through some core concepts
  1388. [21:32] SubStack: Craig`: playing one for a couple minutes is pretty much all you need to know
  1389. [21:32] Craig`: sh1mmer, reading pdf now
  1390. [21:32] sh1m has joined the channel
  1391. [21:33] sh1m_ has joined the channel
  1392. [21:33] sh1m_: ACTION mutters about public wifi
  1393. [21:33] stagas: we need a js infocom parser
  1394. [21:33] aliem has joined the channel
  1395. [21:34] Wizek has joined the channel
  1396. [21:34] Craig`: ah that reminds me i had a few things i wanted to make with node but jsdom didnt work properly for me
  1397. [21:35] sh1mmer: Craig`: what didn't work?
  1398. [21:35] sh1mmer: Craig`: you should look at some of the stuff Dav Glass is doing
  1399. [21:35] sh1mmer: he's really pushing the boundaries with jsdom
  1400. [21:35] Craig`: googling him
  1401. [21:36] jchris has joined the channel
  1402. [21:37] zimbatm has joined the channel
  1403. [21:37] mscdex: Craig`: I'm not familiar with minecraft
  1404. [21:38] craiggles has joined the channel
  1405. [21:38] craiggles: sorry about that
  1406. [21:39] aliem has joined the channel
  1407. [21:40] craiggles: sh1mmer, you didnt say anything else did you?
  1408. [21:40] sh1mmer: no
  1409. [21:41] sh1mmer: mscdex: it's a bit addictive. I stopped playing because it was becoming minecrack.
  1410. [21:43] mscdex: i saw someone create a 16-bit ALU in minecraft, that's about it though
  1411. [21:43] mscdex: it was on youtube i think
  1412. [21:45] sh1mmer: yeah, but it's just really fun making stuff
  1413. [21:45] unomi has joined the channel
  1414. [21:45] unomi has joined the channel
  1415. [21:45] sh1mmer: they made a cpu now
  1416. [21:45] sh1mmer: which is just a bit too much work I htink
  1417. [21:46] sh1mmer: I have actual useful projects to do
  1418. [21:47] craiggles: tbh im interested in having a dynamic world, depends on the status of another program, could be site traffic or whatever
  1419. [21:48] unomi: that would be kind of interesting :)
  1420. [21:49] unomi: things catch on fire when the cpu load is too high
  1421. [21:50] mscdex: this was the video i saw: http://www.youtube.com/watch?v=LGkkyKZVzug
  1422. [21:51] unomi: yeah, but isn't it scripted?
  1423. [21:51] unomi: I doubt people go around placing them block by block
  1424. [21:51] mscdex: craiggles: i'm interested in the same. i am waiting on scenejs to add some missing features yet though
  1425. [21:52] craiggles: speaking of fire my newly generated world had a huge patch of trees on fire thanks to lavafall
  1426. [21:52] mscdex: unomi: i'm sure there's an editor or something that makes it easy
  1427. [21:52] hoffa_ has joined the channel
  1428. [21:52] craiggles: mscdex, awesome, well i have to learn the basics before i even attempt anything
  1429. [21:52] itissid: Hey is jsdom not able to parse IFRAMES?
  1430. [21:53] Aria: jsdom doesn't do any parsing.
  1431. [21:53] Aria: It's up to the html parser you use with it.
  1432. [21:53] itissid: i mean process it using jQuery
  1433. [21:53] itissid: I am getting a weird error
  1434. [21:53] Aria: Which?
  1435. [21:53] unomi: thats pretty crazy mscdex
  1436. [21:54] itissid: this._contentDocument = new HTMLDocument();
  1437. [21:54] itissid: ReferenceError: HTMLDocument is not defined
  1438. [21:54] itissid: its in jsdom core HTML
  1439. [21:54] itissid: It goes away if i ignore the IFRAME node
  1440. [21:54] Aria: Hrm.
  1441. [21:54] Aria: Sounds like a bug!
  1442. [21:54] agilandfast has joined the channel
  1443. [21:54] itissid: Yeah
  1444. [21:55] itissid: Are yo by chance the author of it?
  1445. [21:55] itissid: tmpvar
  1446. [21:55] craiggles: sh1mmer, i thought it was bad practice to emit var? (reading your pdf atm)
  1447. [21:56] sh1mmer: emit var?
  1448. [21:57] craiggles: ee = new EE(); .. you dont do, var ee = ... etc
  1449. [21:57] sh1mmer: oh, yeah I should probably fix that.
  1450. [21:57] sh1mmer: there are various obvious typos through that
  1451. [21:57] sh1mmer: which is why it's a preview
  1452. [21:57] sh1mmer: :)
  1453. [21:58] sh1mmer: declaring variables in the global scope is actually unnecessary, but a good habit
  1454. [21:58] craiggles: :)
  1455. [21:58] arpegius has joined the channel
  1456. [21:58] micheil: sh1mmer: actually, remember that thing about no global scope..
  1457. [21:59] sh1mmer: micheil: you still owe me feedback ;)
  1458. [21:59] sh1mmer: I'm waiting for that email
  1459. [21:59] CIA-95: node: 03Ryan Dahl 07master * rc321e98 10/ lib/stream.js : stream.pipe should remove listeners on dest close - http://bit.ly/bpvKcB
  1460. [21:59] CIA-95: node: 03Ryan Dahl 07master * r5890272 10/ src/node.js : Print friendly error message when main module is ENOENT - http://bit.ly/9nBv8Z
  1461. [21:59] Aria: I'm not, but I've worked with it a bit intimately.
  1462. [22:00] CIA-95: node: 03Ryan Dahl 07writev * r798224b 10/ lib/net.js : No longer using END_OF_FILE - http://bit.ly/cBfRt4
  1463. [22:00] Aria: Let me look, itissid
  1464. [22:00] patricka_ has joined the channel
  1465. [22:01] micheil: sh1mmer: https://github.com/ry/node/blob/master/src/node.js#L321-323
  1466. [22:02] sechrist: mikeal: does request work with http://user:pass@domain uris? I'm trying to use it to auth with couch and it's just failing out
  1467. [22:02] itissid: Aria, Thanks... I will send you a script that grabs plain text out of a web page
  1468. [22:02] rcy has joined the channel
  1469. [22:02] itissid: You will see that it does not work on the iframe...
  1470. [22:03] Aria: ... Which version are you using, itissid?
  1471. [22:03] Aria: (of JSDOM, I mean)
  1472. [22:03] sh1mmer: micheil: pseudo-global then
  1473. [22:04] itissid: 0.1.20
  1474. [22:04] itissid: via NPM
  1475. [22:04] sh1mmer: micheil: if you dump stuff in the main event loop without putting it in a closure, it is like being in global scope which is the point of the sandboxing functions, no?
  1476. [22:05] micheil: I believe so.
  1477. [22:06] craiggles: just finished the pdf sh1mmer
  1478. [22:09] jchris has joined the channel
  1479. [22:09] ajpiano has joined the channel
  1480. [22:10] itissid: Aria, http://pastebin.com/21JcknX4 is my JS implementation that works in chrome on iframes
  1481. [22:11] AAA_awright_ has joined the channel
  1482. [22:11] patricka_ has joined the channel
  1483. [22:11] Aria: Hrm. do you have a traceback where it fails?
  1484. [22:11] itissid: I ported it to work with jsdom it dint work
  1485. [22:11] jashkenas has joined the channel
  1486. [22:11] braddunbar has joined the channel
  1487. [22:12] itissid: Yeah
  1488. [22:12] itissid: one sec
  1489. [22:12] itissid: http://pastebin.com/39ELkPFD
  1490. [22:14] itissid: I changed line 1400 to new (core.HTMLDocument)()
  1491. [22:14] sh1mmer has joined the channel
  1492. [22:14] itissid: Where the error was
  1493. [22:15] itissid: but it is not processing the IFRAME text
  1494. [22:15] ryah: what's with this tendency to smash all the code together
  1495. [22:15] ryah: style, people.
  1496. [22:15] sh1mmer: ryah: context?
  1497. [22:15] bruse: clearly you're a better coder if you do more in less lines
  1498. [22:16] CIA-95: node: 03Ryan Dahl 07master * r6063ea6 10/ lib/path.js : fix style in path.js - http://bit.ly/b7nrKb
  1499. [22:16] ryah: sh1mmer: --^
  1500. [22:16] micheil: ryah: hmm, in src/node.js, would it be an idea to move some of the lazy-loaded variables to the top and stuff?
  1501. [22:17] sh1mmer: oh yeah
  1502. [22:17] sh1mmer: I really hate that
  1503. [22:17] micheil: ryah: like. https://github.com/ry/node/blob/master/src/node.js#L372
  1504. [22:18] unomi: might want to add some jsDoc @nnotations as well
  1505. [22:19] micheil: unomi: we don't use JSDoc. (afaik)
  1506. [22:19] heavysixer has joined the channel
  1507. [22:20] CIA-95: node: 03Ryan Dahl 07master * rc11f3f8 10/ src/node.js : simplify lazy constant loading - http://bit.ly/ct8l11
  1508. [22:20] ryah: micheil: ---^
  1509. [22:20] ryah: unomi: nah.
  1510. [22:21] Wizek: How can response.on('end' not fire when I accessed my node connect.createServer through Browser?
  1511. [22:21] Wizek: it sends the request, and don1t get a response
  1512. [22:21] micheil: ryah: hmm, that'd be slower, surely?
  1513. [22:21] micheil: boolean check vs function call
  1514. [22:22] sh1mmer has joined the channel
  1515. [22:22] ryah: i dont care if it's slow
  1516. [22:22] ryah: it's not in the hot path
  1517. [22:23] micheil: oh, okay
  1518. [22:23] ryah: "slow"
  1519. [22:24] ryah: function call overhead is 10 microseconds
  1520. [22:24] micheil: hmm.. I wonder if it'd be fairly easy / interesting to write a JSON parser to work on Buffer's
  1521. [22:24] micheil: ryah: true, it was probably an over-optimization or premature one.
  1522. [22:25] Aria: itissid: What sort of failure with that fix? (Can you try HEAD)
  1523. [22:25] micheil: supposedly v8's JSON parser can take a CharacterStream*
  1524. [22:25] hassox has joined the channel
  1525. [22:26] derferman has joined the channel
  1526. [22:26] itissid: Well it says no HTML node present
  1527. [22:26] jchris has joined the channel
  1528. [22:26] micheil: with a json parser that operates on a Buffer / mem index, you wouldn't need to first convert it to a v8 string, then back to an object
  1529. [22:28] itissid: Aria, The script I sent you is a proof of concept on how one can actually do Iframe processing
  1530. [22:29] mscdex: Wizek: what browser?
  1531. [22:29] Wizek: mscdex: Tried Chrome and FF
  1532. [22:29] itissid: Aria, http://pastebin.com/6HJ0fBNW jsdom port
  1533. [22:30] elijah-mbp has joined the channel
  1534. [22:30] mscdex: Wizek: oh wait, you don't want response, you want request
  1535. [22:30] mscdex: Wizek: request.on('end', ....);
  1536. [22:31] mscdex: :-)
  1537. [22:31] itissid: You can call that last script http://pastebin.com/sa9fZFfu
  1538. [22:32] Wizek: mscdex: already done that, but sometimes it doesn't fire, so it leaves the browser to wait for a response, abnd doesn't kill the connection
  1539. [22:32] jchris has joined the channel
  1540. [22:33] sh1m has joined the channel
  1541. [22:34] CIA-95: node: 03Silas Sewell 07master * r11b2ee7 10/ (15 files): Various doc tweaks (2-spaces vs tabs, EOL-whitespace, repl prompt, "world" vs "World", etc...) - http://bit.ly/9nJVGb
  1542. [22:34] mscdex: Wizek: can you gist the code?
  1543. [22:34] Wizek: mscdex: yep
  1544. [22:35] Wizek: mscdex: is pastebin good also, I don't have git account
  1545. [22:35] Wizek: ?
  1546. [22:35] mscdex: Wizek: you don't need a github account: gist.github.com
  1547. [22:35] micheil: ryah: where we reference manpages, would it make sense to link to something that's from say, gnu c stdlib or something?
  1548. [22:37] micheil: ryah: for example, when we use readlink(2), we link to something like: http://www.linuxmanpages.com/man2/readlink.2.php
  1549. [22:37] sh1m_ has joined the channel
  1550. [22:37] unomi has joined the channel
  1551. [22:37] ryah: micheil: sure
  1552. [22:37] ryah: maybe not that website though
  1553. [22:38] ryah: kernel.org or something...
  1554. [22:39] Wizek: mscdex: https://gist.github.com/709239
  1555. [22:39] micheil: (that was just from a quick google search)
  1556. [22:39] Aria: itissid: It'd be easier if you used gist instead of pastebin. It's really hard to download code from there.)
  1557. [22:39] ryah: herbySk: are you there?
  1558. [22:40] micheil: http://www.kernel.org/doc/man-pages/online/pages/man2/readlink.2.html
  1559. [22:40] micheil: works just as well.
  1560. [22:40] Wizek: mscdex: What this does, is forwards each request it gets on the /db/ subfoder to CouchDB, and returns the db's answer
  1561. [22:40] Wizek: mscdex: basically a proxy
  1562. [22:40] Wizek: mscdex: Now, some requests go through, some do not
  1563. [22:41] herbySk: yes
  1564. [22:41] herbySk: ryah: yes
  1565. [22:41] aconbere: vows is mindbendingly different from other testing tools
  1566. [22:41] aconbere: just saying
  1567. [22:41] Wizek: mscdex: you can make a quick dummy server to listen on port 5984 to emulate CouchDB and console.log() everything it gets
  1568. [22:42] ph^ has joined the channel
  1569. [22:42] micheil: ryah: https://github.com/miksago/node/issues/issue/14 (on the todo list)
  1570. [22:43] ryah: herbySk: remember this patch you had that had a really simple requireNative - kind of a bootstrapper
  1571. [22:43] ryah: herbySk: why did we revert that?
  1572. [22:44] herbySk: you did not like the way how repl was made to work with it
  1573. [22:44] Wizek: mscdex: It seems like only PUT and DELETE requests go through, and GET ones stuck
  1574. [22:44] Wizek: I used curl to test that
  1575. [22:44] itissid: Aria, hold on.... ok I will make a gist of 2 scripts.. One that works on plain chrome debugger... And the second a port to jsdom that does not quite work..
  1576. [22:45] herbySk: ryah: (there are other ways to make it, as well, for example, REPLServer having parameter to pass a function to be used as 'require')
  1577. [22:45] herbySk: ryah: but to the quick solution I did, you said 'too cute' and reverted it all then
  1578. [22:47] ryah: herbySk: okay
  1579. [22:47] mraleph has joined the channel
  1580. [22:48] mscdex: Wizek: i don't have any problems with GET for a plain http.Server
  1581. [22:48] mscdex: Wizek: maybe it has to do with Connect?
  1582. [22:48] mscdex: i don't know
  1583. [22:48] AndroUser2 has joined the channel
  1584. [22:50] Wizek: you mean, if you do a GET to /db/anything/goes/here/ it is forvarded to localhost:5984/anything/goes/here/ ?
  1585. [22:50] craiggles: whats some starter programs i should be making with node?
  1586. [22:50] Wizek: mscdex ^
  1587. [22:50] Tim_Smart has joined the channel
  1588. [22:50] mscdex: Wizek: no, i mean just a plain http.Server. i don't have npm or connect installed to try your code
  1589. [22:51] arpegius has joined the channel
  1590. [22:51] Wizek: mscdex: You have cygwin?
  1591. [22:51] mscdex: yeah, but i'm testing this on linux :p
  1592. [22:51] Wizek: mscdex: than getting npm is as 1 loc
  1593. [22:51] bnoordhuis: craiggles: chat apps are probably the new blogs
  1594. [22:51] mscdex: i know heh
  1595. [22:52] mscdex: brb
  1596. [22:52] AAA_awright_ has joined the channel
  1597. [22:52] Wizek: mscdex: Oh noes! My savior became afk!
  1598. [22:52] craiggles: bnoordhuis, thanks ive always wanted to make chat app, im just looking for best place to start learning, i doubt i can just learn from the docs
  1599. [22:53] bnoordhuis: craiggles: there are some examples out on the interwebs
  1600. [22:53] bnoordhuis: craiggles: you might also like howtonode.org
  1601. [22:54] craiggles: on howtonode atm
  1602. [22:54] craiggles: i dont really want to look at examples, rather try and build my own
  1603. [22:55] micheil: man.. what's with error's in repl and "..."
  1604. [22:55] bnoordhuis: craiggles: who's stopping you? :)
  1605. [22:55] itissid: Aria,
  1606. [22:55] Evet has joined the channel
  1607. [22:55] itissid: Aria, https://gist.github.com/709246
  1608. [22:55] unomi_ has joined the channel
  1609. [22:56] itissid: I have created a Unit test case with 2 files to demo the problem...
  1610. [22:56] craiggles: bnoordhuis, no one ofc i just dont know where to start..ive been wanting to become a good programmer for ages, just i never get around to doing anything
  1611. [22:57] bnoordhuis: craiggles: 'good programmer' - are you just starting out?
  1612. [22:57] Aria: nicely done, itissid.
  1613. [22:57] Aria: Let me see.
  1614. [22:57] jchris has joined the channel
  1615. [22:58] rwaldron has joined the channel
  1616. [23:00] itissid: Aria, Thanks so much
  1617. [23:00] Wizek: I have a http.createServer(). If a client connects to it, how can I access the header of the request?
  1618. [23:00] aurynn has joined the channel
  1619. [23:01] Wizek: like. header.url will tell me the url, but how do I get for example the content-type?
  1620. [23:01] mpoz2 has joined the channel
  1621. [23:01] Aria: itissid: do you get " window.document.body.appendChild(jQueryTag);" ?
  1622. [23:01] Nohryb has joined the channel
  1623. [23:01] craiggles: bnoordhuis, i know saying that makes me sound novice im keeping explanations short - just switched to dvorak, im not entirely new, been doing web dev for around a year but only html/css, no server side..learned ruby for a few months..then ive been learning js recently (language itself not dom) but in the whole year i have nothing to show which is terrible
  1624. [23:02] itissid: Aria, come again?
  1625. [23:03] Aria: What error do you get when it doesn't work?
  1626. [23:03] sh1mmer has joined the channel
  1627. [23:03] bnoordhuis: craiggles: i've got to warn you that node is pretty close to the metal (and event driven, which is a paradigm that needs some getting used to), so it might not be the easiest thing to pick up when you're just starting
  1628. [23:04] bnoordhuis: craiggles: not that i want to discourage you, mind you :)
  1629. [23:04] bnoordhuis: craiggles: just be prepared for something of a learning curve
  1630. [23:04] Aria: Or it could be awesome
  1631. [23:04] craiggles: i wouldnt say im just starting out programming, just that i havent had a real project
  1632. [23:04] itissid: Aria, refresh https://gist.github.com/709246 I have attached a backtrace
  1633. [23:05] Wizek: I have a http.createServer(). If a client connects to it, how can I access the header of the request?
  1634. [23:05] craiggles: im fine with a learning curve i just want to actually do something.
  1635. [23:05] Wizek: like: header.url will tell me the url, but how do I get for example the content-type?
  1636. [23:05] itissid: Aria, Its in the comments in the file 1
  1637. [23:05] ryah: herbySk: im bringing back the simple requireNiatve
  1638. [23:05] Wizek: *request.url
  1639. [23:05] Aria: okey...
  1640. [23:05] craiggles: start learning, build stuff :)
  1641. [23:05] Aria: I don't get that with jsdom HEAD
  1642. [23:06] bnoordhuis: craiggles: then start banging out code and yell if you run into issues, folks are generally pretty helpful around here
  1643. [23:06] herbySk: ryah: and the repl fix? will you use some better one?
  1644. [23:06] itissid: Aria, do you get the entire text of the html page in the script?
  1645. [23:06] itissid: The javadoc page?
  1646. [23:07] ryah: herbySk: im going to special case it
  1647. [23:07] craiggles: bnoordhuis, yeah that is the best way about it, ill tell you my problem i talk about where i want to end up too much, rather than doing something about it, ie now
  1648. [23:07] itissid: Its quite big
  1649. [23:07] Aria: I don't.
  1650. [23:07] itissid: So you would get >100 lines of text to know for sure..
  1651. [23:07] itissid: Like in the first case..
  1652. [23:08] itissid: Aria, May be i am doing it wrong with jsdom.... If you look at the first file I had to hack a special case for I frames...
  1653. [23:08] Aria: Hm. I think I see what's up. Time to read more
  1654. [23:08] itissid: Which works..
  1655. [23:08] Aria: jsdom should be very similar
  1656. [23:09] itissid: Aria, I did try the special case.. JS DOM says no "HTML node in document...."
  1657. [23:09] mape: Anyone one can do with node processes running out of memory and crashing?
  1658. [23:10] mape: Just keep less in memory or handle crashes nicely and restart?
  1659. [23:10] Aria: Hm.
  1660. [23:10] mape: Eh.. Anyone know what one *
  1661. [23:10] TooTallNate has joined the channel
  1662. [23:10] bnoordhuis: mape: v8 has a build switch that bumps the heap to 1.9 GB, i think
  1663. [23:11] bnoordhuis: it's normally limited to 1.0GB
  1664. [23:11] mape: bnoordhuis: Yeah.. I shouldn't be using 1GB though, only keeping some object/arrays around and socket.io
  1665. [23:11] mape: Nothing close to that size in data cached
  1666. [23:12] Wizek: Why doesn't node have a request.writeHead?
  1667. [23:12] TooTallNate: Fire up VLC to the network stream: "http://tootallnate.net:5555/stream.ogg" for some Node-powered Floyd!
  1668. [23:12] bnoordhuis: mape: is your app leaking memory then?
  1669. [23:12] mape: bnoordhuis: Seems like it, not sure what the best of debugging is...
  1670. [23:13] bnoordhuis: mape: if you don't mind me spamming with links to my own projects - http://github.com/bnoordhuis/node-profiler
  1671. [23:14] stagas: mape: the smartest thing to do with node apps is make them restartable :)
  1672. [23:14] admc has joined the channel
  1673. [23:14] Wizek: Or, does node.js have a request.writeHead in any shape?
  1674. [23:14] Wizek: for http.createClient
  1675. [23:14] stagas: mape: ie crash-friendly
  1676. [23:15] mape: yeah
  1677. [23:16] justin_ has joined the channel
  1678. [23:16] mape: stagas: means I have to move stuff to db though
  1679. [23:16] mape: which is slower
  1680. [23:16] bnoordhuis: Wizek: why request.writeHead? don't you mean response?
  1681. [23:17] Wizek: bnoordhuis: no, requests also have header
  1682. [23:17] bnoordhuis: Wizek: you want to read request headers? request.headers['header_name']
  1683. [23:18] Wizek: bnoordhuis: No, I want to specify response headers for a POST method
  1684. [23:18] itissid: Aria, node.contentDocument is what the problem is. I have attached a port of my processRecursive() function https://gist.github.com/709246
  1685. [23:18] itissid: 3rd file
  1686. [23:18] Wizek: bnoordhuis: like 'content-type': 'application/json'
  1687. [23:20] bnoordhuis: Wizek: req.request('POST', 'url', {'Content-Type':'application/json'})
  1688. [23:21] stagas: mape: until stuff get more stable, and mem issues are resolved somehow, it's safe to assume that a complex app will crash at some point
  1689. [23:22] bnoordhuis: micheil: http.clientrequest.request() is rather poorly documented right now, something for your to do list?
  1690. [23:22] unomi has joined the channel
  1691. [23:22] micheil: bnoordhuis: check: http://github.com/miksago/node/issues
  1692. [23:22] micheil: if it's not there, add it
  1693. [23:23] [[zz]] has joined the channel
  1694. [23:24] itissid: tmpvar in here?
  1695. [23:24] polotek has joined the channel
  1696. [23:24] polotek: #yajl
  1697. [23:24] polotek: dammit
  1698. [23:25] itissid: AKA Elija Insua...
  1699. [23:26] pfarrel: micheil: is there a combination of clients and servers in the node-websocket-server/examples folder that should work together?
  1700. [23:26] Wizek: bnoordhuis: TypeError: Object #<a ClientRequest> has no method 'request'
  1701. [23:26] micheil: node-websocket-server is only a server, there are no clients in it.
  1702. [23:27] micheil: and those examples should be taken with a grain of salt.
  1703. [23:27] pfarrel: well, there two client html files
  1704. [23:27] pfarrel: *there are
  1705. [23:27] micheil: they aren't "clients" really, they just open a websocket connection to a given port, as described in the various websocket specifications
  1706. [23:27] bnoordhuis: Wizek: gist of your code?
  1707. [23:27] ryah: fff
  1708. [23:28] pfarrel: micheil: I know, I'm just wondering should any of the example html files work in conjunction with any of the example servers. To test a setup
  1709. [23:28] CIA-95: node: 03Ryan Dahl 07master * rbb6d468 10/ src/node.js : requireNative doesn't depend on rest of module system - http://bit.ly/aHClEF
  1710. [23:28] pfarrel: just to do a websocket hello world basically
  1711. [23:28] Wizek: bnoordhuis: https://gist.github.com/709277
  1712. [23:28] micheil: all they do is open a websocket connection: var ws = new WebSocket(uri)
  1713. [23:29] micheil: anything in them that actually references "storage" is also broken.
  1714. [23:29] polotek: micheil: https://github.com/polotek/node/commit/ca64a72e0eedf88ddfd0de00a10350e232b87a9f
  1715. [23:30] micheil: polotek: https://github.com/polotek/node/commit/ca64a72e0eedf88ddfd0de00a10350e232b87a9f#L0R72
  1716. [23:30] pfarrel: oh ok, i've been trying to figure out why my setup wasnt working for a while now. oops
  1717. [23:30] ryah: process.compile is gone now
  1718. [23:30] pfarrel: I couldnt find an issue relating to them, or the problem I was having in the issue tracker
  1719. [23:30] micheil: ryah: oh?
  1720. [23:31] ryah: and me too
  1721. [23:31] micheil: ah, I see.
  1722. [23:31] ryah: byte
  1723. [23:31] bnoordhuis: Wizek: it would appear you are not using http.createClient() to create the client
  1724. [23:32] Wizek: bnoordhuis: Don't I? then what is this: var connectAddr = http.createClient(port, ip); ?
  1725. [23:32] Wizek: bnoordhuis: line 61
  1726. [23:32] bnoordhuis: Wizek: at least... you hand it off to connect? try to get it working with vanilla node first would be my advice
  1727. [23:33] Wizek: bnoordhuis: This is plain Node. You can run this part of the code without connect
  1728. [23:33] sh1m has joined the channel
  1729. [23:33] itissid: Bug request for jsdom https://github.com/tmpvar/jsdom/issues#issue/82 let me know if you can triage and/or solve it
  1730. [23:34] Wizek: bnoordhuis: Only using connect one bit with createServer, to serve html files
  1731. [23:34] polotek: micheil: you want me to remove the apply?
  1732. [23:34] bnoordhuis: Wizek: hah, you're right - i should learn to read
  1733. [23:34] micheil: polotek: it does look slightly odd
  1734. [23:34] micheil: normally I've seen it used with EventEmitters, so why not show that?
  1735. [23:34] polotek: Cat.super_.call(this)
  1736. [23:34] polotek: ?
  1737. [23:34] bnoordhuis: request.request returns the actual request object
  1738. [23:35] micheil: events.EventEmitter.call(this);
  1739. [23:35] bnoordhuis: you need to use that
  1740. [23:35] micheil: util.inherits(someClass, events.EventEmitter)
  1741. [23:35] cloudhead has joined the channel
  1742. [23:35] polotek: micheil: You're saying it would be a more relevant example?
  1743. [23:35] polotek: I'll buy that
  1744. [23:35] micheil: yes
  1745. [23:35] kvirdi has joined the channel
  1746. [23:35] micheil: and, it'll look saner because it's no longer abstract
  1747. [23:35] bnoordhuis: micheil: good work on the documentation project - that's usually the kind of stuff nobody wants to do
  1748. [23:36] kvirdi: need help in installing node.js on windows vista
  1749. [23:36] kvirdi: can any one help?
  1750. [23:36] Wizek: kvirdi: Use cygwin
  1751. [23:36] polotek: micheil: I mainly wanted to show how to use super_
  1752. [23:36] bnoordhuis: kvirdi: or a linux vm
  1753. [23:36] polotek: but honestly I don't think any one does :)
  1754. [23:36] davidc_ has joined the channel
  1755. [23:36] kvirdi: kapil@kapil-PC ~/node-v0.2.5 $ ./configure Checking for program g++ or c++ : /usr/bin/g++ 2 [main] python 1268 C:\Dev\cygwin\bin\python.exe: *** fatal error - unabl e to remap C:\Dev\cygwin\bin\cygcrypto-0.9.8.dll to same address as parent: 0x18 F10000 != 0x6D750000 Stack trace: Frame Function Args 002791E8 6102749B (002791E8, 00000000, 00000000, 00000000) 002794D8 6102749B (61177B80, 00008000, 00000000, 6117
  1756. [23:37] kvirdi: i am using cygwin
  1757. [23:37] Wizek: kvirdi: https://github.com/ry/node/wiki/Building-node.js-on-Cygwin-(Windows)
  1758. [23:37] micheil: polotek: to be honest, I had to check node's source to see where you were getting super_ from
  1759. [23:37] polotek: probably better to be explicit
  1760. [23:38] Wizek: bnoordhuis: request.request returns this: /test/?_id=undefined&_rev=undefined
  1761. [23:38] micheil: polotek: maybe document it like: "The parent object that the inheriting object inherits from is set to a variable on that object as super_"
  1762. [23:38] Wizek: bnoordhuis: But I know there was more to the request header rhan this
  1763. [23:38] micheil: (obviously, write it far better then that.)
  1764. [23:38] bnoordhuis: Wizek: that's from console.log() i take it?
  1765. [23:39] bnoordhuis: request.request() returns a ClientRequest object
  1766. [23:39] micheil: just say that what ever is inherited from is stored as a property called super_
  1767. [23:39] polotek: micheil: er, not much clearer
  1768. [23:39] micheil: (if you are to document super_
  1769. [23:39] kvirdi: i followed instructions from https://github.com/ry/node/wiki/Building-node.js-on-Cygwin-%28Windows%29
  1770. [23:39] pfarrel: http://pastebin.com/3PbnzSyL Getting this error with pretty much anything I do. Any ideas?
  1771. [23:39] micheil: (my wording is way off atm)
  1772. [23:40] Wizek: bnoordhuis: there is no request.request(), but request.request
  1773. [23:40] Wizek: bnoordhuis: and yes, I used console.log(request.request)
  1774. [23:40] bnoordhuis: Wizek: console.log(request.request('POST', '/test', {'Content-Type':'application/json'})) <- this is wrong
  1775. [23:41] bnoordhuis: Wizek: client = request.request('POST', '/test', {'Content-Type':'application/json'})
  1776. [23:41] bnoordhuis: Wizek: then: client.on('response', callback) // etc
  1777. [23:41] stagas: kvirdi: it works every time for me, try deleting cygwin entirely and install everything again
  1778. [23:41] kvirdi: ok thanks >> stagas
  1779. [23:42] bnoordhuis: pfarrel: what version of node are you using? that node-websocket-server was probably written for an older version
  1780. [23:43] tylerstalder has joined the channel
  1781. [23:43] pfarrel: bnoordhuis: Oh I feel like an idiot. I just noticed it says to use node 0.1.98 and I'm on the latest git head of node
  1782. [23:43] bnoordhuis: pfarrel: no worries, easy mistake to make
  1783. [23:44] mape: pfarrel: you shouldn't have to go that far back though
  1784. [23:44] micheil: actually, node-websocket-server works on both HEAD and 0.2.5
  1785. [23:44] technoweenie has joined the channel
  1786. [23:44] EyePulp has joined the channel
  1787. [23:44] mape: If anything you should use the latest stable
  1788. [23:44] Wizek: bnoordhuis: Same error: TypeError: Object #<a ClientRequest> has no method 'request'
  1789. [23:44] micheil: or, atleast, it definitely worked about 1-2 weeks ago on HEAD
  1790. [23:44] bnoordhuis: micheil: not this version. flush() is no longer part of net.Stream
  1791. [23:44] micheil: so, that's 0.3.1, and flush was removed?
  1792. [23:45] bnoordhuis: micheil: yes... unless the writev revert put it back in
  1793. [23:45] micheil: I'd say: Expect errors if you are running it on 0.3.1, as the api there is unstable
  1794. [23:46] pfarrel: So, would it be a safe bet to drop back to node 0.2.5?
  1795. [23:46] micheil: I'll fix it up in the next few days, unless someone what's to pull request me.
  1796. [23:46] micheil: pfarrel: considering 0.2.5 is the current stable release, yes
  1797. [23:46] bnoordhuis: flush() is back actually...
  1798. [23:46] bnoordhuis: pfarrel: if you `git pull --rebase` and recompile, you have a fair chance it'll work
  1799. [23:47] Wizek: bnoordhuis: and as I said, same error
  1800. [23:47] hoffa__ has joined the channel
  1801. [23:48] polotek: do folks always rebase when pulling upstream changes?
  1802. [23:48] jashkenas: when is the 0.3 series going to be considered stable?
  1803. [23:48] micheil: i don't think it is
  1804. [23:48] micheil: 0.4 iirc, is going to be the next stable release
  1805. [23:49] micheil: I think ryah was going with odds as unstable, evens as stable
  1806. [23:49] polotek: that's how mongodb and a few other projects do things
  1807. [23:49] polotek: I find it a bit confusing
  1808. [23:49] bnoordhuis: polotek: i do, i hate merge commits, they clutter the history
  1809. [23:49] bnoordhuis: Wizek: then you're probably doing it wrong :)
  1810. [23:49] bnoordhuis: Wizek: let me see if i can code up a quick example for you
  1811. [23:50] micheil: bnoordhuis: what, no way man, just a git reset --hard HEAD^^^^^^^^^^^^^^^^^^^ && git pull should get you by.
  1812. [23:50] micheil: :P
  1813. [23:50] Aria: polotek: It's a good idea.
  1814. [23:50] polotek: Aria: which? rebasing?
  1815. [23:50] polotek: or even stable versions?
  1816. [23:50] Aria: Yeah.
  1817. [23:50] Aria: Both, but I meant rebasing
  1818. [23:51] pfarrel: Sweet, not getting constant explosions now. Thanks guys. I guess it hadn't quite sunk in for me how fluid the node api is, when it was saying that flush was missing I just assumed something huge must be broken.
  1819. [23:53] nooder has joined the channel
  1820. [23:54] admc has joined the channel
  1821. [23:55] polotek: micheil: https://github.com/polotek/node/blob/a0c4d8c9f9009b03cc1b306fd8804c571c3cd83b/doc/api/util.markdown
  1822. [23:56] polotek: pfarrel: 0.2.x has been pretty stable for a long time now
  1823. [23:56] polotek: 0.3.x is breaking lots of new ground
  1824. [23:56] Evet has joined the channel
  1825. [23:56] micheil: polotek: I guess that works, but what's with the animals? :D
  1826. [23:56] polotek: micheil: your college cs intro courses didn't use animals all the time?
  1827. [23:57] micheil: polotek: actually, they didn't
  1828. [23:57] polotek: it's the first thing that pops into my head when thinking inheritance
  1829. [23:57] micheil: (I've actually only done one so far)
  1830. [23:57] polotek: Animal -> Cat
  1831. [23:57] polotek: or perhaps
  1832. [23:57] micheil: Father -> Son
  1833. [23:57] polotek: Vehicle -> Car
  1834. [23:57] polotek: micheil: haha, I guess.
  1835. [23:57] micheil: well, yeah, they aren't really that practical..
  1836. [23:58] polotek: I'm trying to help out man. If you've got suggestions I'll take em ;)
  1837. [23:58] micheil: also, it can probably be written as: util.inherits(constructor, super)
  1838. [23:58] polotek: micheil: it's tricky
  1839. [23:58] micheil: rather then util.inherits(constructorFunc, superConstructorFunc)
  1840. [23:58] polotek: I think it needs to be clear that the arguments are constructor functions
  1841. [23:58] polotek: what is "super"
  1842. [23:58] googol has joined the channel
  1843. [23:59] micheil: well, constructors in javascript are functions
  1844. [23:59] polotek: micheil: I know, I mean in terms of clarity to newbs
  1845. [23:59] micheil: v8: (new String).constructor
  1846. [23:59] v8bot: micheil: function String() { [native code] }
  1847. [23:59] micheil: v8: typeof (new String).constructor == "Function"
  1848. [23:59] v8bot: micheil: false
  1849. [23:59] polotek: small 'f'
  1850. [23:59] micheil: yeah. I did that wrong, but you get the point.
  1851. [23:59] micheil: v8: typeof (new String).constructor == "function"
  1852. [23:59] v8bot: micheil: true