--- Log opened Thu Jun 06 00:00:19 2013
00:03 -!- mode/#Node.js [+o piscisaureus_] by ChanServ
00:04 < mscdex> ChrisPartridge: that depends on QT/QPrinter I suppose, which I am not familiar with
00:28 < garthk> substack: https://gist.github.com/garthk/5718391 shows the damage. npm install; npm test to see it live.
00:30 < substack> garthk: what happens when the doctype isn't present?
00:31 < hotnikks> what does "this" refer to within app.js? if i launch node app.js
00:32 <@mbalho> process
00:32 < hotnikks> thx
00:33 < garthk> substack: ha! Works fine, now.
00:33 < garthk> substack: nice workaround, that.
00:35 < substack> garthk: ok I'll add a failing test for doctypes
00:35 < substack> it's just one of those kludgey special cases that I'm not handling yet
00:36 < garthk> substack: np. I've fixed a busted test and updated the README to indicate narrower failure scope.
00:37 < Styles> Hey, do you guys have any examples of using node.js for server side to com w/ dbs?
00:37 < substack> garthk: can you turn that into a proper pull req/
00:39 < garthk> substack: sorry; that was on a gist, not hyperstream. I can't do pull requests for the time being; can't go into details.
00:39 < garthk> s/a gist/the gist/
00:40 < mechanicalduck> hi
00:40 < mechanicalduck> What unit testing framework would be best for node js applications?
00:40 < mechanicalduck> And what integration test framework I should use?
00:40 < mechanicalduck> And what is recommended if I want to use the unit / integration test framework for both, node.js and local js code?
00:41 < substack> "local js code"
00:41 < substack> do you mean "browser code"?
00:41 < mechanicalduck> yes
00:42 < mechanicalduck> there is still browser code, even for node js applications?
00:42 < Styles> Found my answer, https://github.com/visionmedia/express/
00:42 < jesusabdullah> mechanicalduck: the same way your php site still has browser code
00:46 < mechanicalduck> jesusabdullah: but server- and browser-code can be shared? should one test the code for server and for browser then?
00:46 < mechanicalduck> jesusabdullah: how do you know that I am doing php btw? :)
00:47 < substack> michaeldeol: http://github.com/substack/tape
00:47 < substack> you write a test this way
00:47 < substack> then you can do `node test.js`
00:48 < substack> or you can do `browserify test.js > bundle.js` and drop a `` in a page
00:48 < substack> or you can just do `browserify test.js | testling`
00:48 < substack> which runs your test in a real (not phantom blech) headless browser locally
00:49 < substack> why do people even use phantom when it's so trivial to spin up a headless chrome or firefox with xdg-open
00:49 < substack> *xdg-run rather
00:49 < substack> I DIGRESS.
00:50 < substack> also do these things: npm install -g browserify; npm install -g testling
00:50 < jlord> jesusabdullah: haha yeah, it's so awesome that the AD folks gifted that footage to the world :)
00:50 < jesusabdullah> jlord: put some ER footage behind his doctor
00:54 -!- mode/#Node.js [+o TooTallNate] by ChanServ
00:54 < harbhub> hey fellas
00:54 < harbhub> can bignumber.js do gigantic number crunching?
00:54 < harbhub> i want to use it to make my own RSA
00:54 < harbhub> :)
00:54 < harbhub> will it handle those massive numbers?
00:55 < deoxxa> harbhub: very, very slowly, yes
00:56 < harbhub> oh
00:56 < harbhub> deoxxa, so how do i do the handshake quickly?
00:56 < jesusabdullah> harbhub: just have a big ol' [LOADING] screen
00:56 < harbhub> you know, the discrete logarithm handshake
00:56 < deoxxa> require("crypto")
00:56 < deoxxa> lol
00:56 < hotnikks> can someone please link me to the process object that "this" refers to within app.js?
00:56 < harbhub> deoxxa, crypto does that handshake!?
00:56 < deoxxa> harbhub: doesn't it have enough bits and pieces there to do it?
00:57 < harbhub> not sure
00:57 < deoxxa> hotnikks: become one with http://nodejs.org/docs/latest/api/all.html and be true to yourself
00:57 < harbhub> i wanted to use my SSL and socketio
00:57 < ChrisPartridge> hotnikks: nodejs docs... click "Process"
00:57 < harbhub> to send back-and-forth
00:58 < hotnikks> thx
00:58 < harbhub> i want to use 2048 bit for super-security
00:58 < hotnikks> also, why dont people typically save the return to http.createServer?
00:58 < deoxxa> just in case someone discovers another universe where there are enough electrons to crack 1024 bit?
00:58 < hotnikks> im making my app.js idempotent a la http://taylor.fausak.me/2013/02/17/testing-a-node-js-http-server-with-mocha/
00:59 < hotnikks> so that i can require it from my tests, then call .listen(testPort)
01:04 < hotnikks> why do people call .apply*( after changing the port?
01:05 < hotnikks> err after calling listen
01:05 < hotnikks> this.server.listen.apply(this.server, arguments);
01:12 < Stereo> Hi everyone
01:13 < Stereo> I'm writing my first ever piece of node.js code, and there's something about scope I don't seem to get, and haven't been able to google
01:14 < sitapati> word
01:14 < Stereo> hmm, it looks like a bug in the library I'm trying to use :)
01:15 < ChrisPartridge> Stereo: gist/pastebin the relevant code if you're stuck
01:16 < Stereo> I'm stuck trying to phrase my question :)
01:16 < Stereo> ok, so I'm using a module called esri2geo - https://github.com/calvinmetcalf/esri2geo/blob/master/README.md
01:16 < Stereo> I did a var esri2geo = require("esri2geo");
01:16 < mechanicalduck_> qunit can't be used in CLI, too?
01:17 < Stereo> and it should, as far as I understand, export a function called toGeoJSON()
01:17 < Stereo> but calling toGeoJSON() gives me a "has no method 'toGeoJSON'" error
01:18 < Stereo> sorry, that's what esri2geo.toGeoJSON(data); gives me
01:18 < Stereo> calling plain toGeoJSON gives me "ReferenceError: toGeoJSON is not defined"
01:19 < gkatsev> Stereo: actually, you should do `var toGeoJSON = require('esri2geo');`
01:19 < gkatsev> Stereo: https://github.com/calvinmetcalf/esri2geo/blob/master/esri2geo.js#L179
01:19 < Stereo> aah
01:19 < gkatsev> the actual function gets exported
01:19 < gkatsev> they should've said that in the README. It's not clear.
01:19 < Stereo> thank you gkatsev
01:19 < Stereo> now I get a better error :)
01:19 < gkatsev> np
01:22 < Stereo> now I get from inside that module, RangeError: Maximum call stack size exceeded. I'm really beginning to think it's not a very newbie-friendly module :)
01:22 < Stereo> I'll try feeding it an url instead
01:22 < gkatsev> heh
01:25 < Stereo> ok, that doesn't work either, it chokes on the json
01:26 * gkatsev wasn't impressed with the code
01:26 < Stereo> hah
01:26 < Stereo> I thought it was a simple enough conversion, and wouldn't write a parser and use the excuse to try out node.js
01:27 < gkatsev> hrh
01:27 < gkatsev> heh
01:28 < gkatsev> Stereo: try https://github.com/odoe/esritogeojson ?
01:28 < gkatsev> (http://odoe.net/blog/?p=187)
01:29 < Stereo> oh, cool
01:29 <@mbalho> Stereo: what esri format are you trying to convert?
01:29 < Stereo> esri json
01:31 < Stereo> mbalho: it looks like this: http://wsinspire.geoportail.lu/arcgis/rest/services/inspire/au/MapServer/find?searchText=a&layers=6&f=pjson
01:32 <@mbalho> Stereo: do you need to reproject?
01:34 < Stereo> mbalho: not even
01:35 < Stereo> I'll try to get the one gkatsev found to work, and if it doesn't, apply a different kind of lazy and hack a converter myself
01:35 <@mbalho> Stereo: it might be because thats 13.5 mb of json
01:36 <@mbalho> Stereo: which can cause issues cause JSON.parse isnt streaming
01:37 < garthk> substack: FFS. Now I'm getting the offset errors without the doctype. :/
01:37 < Ned_> is there any way to npm install such that it'll only do something if it's not already installed?
01:37 < garthk> I added another stylesheet.
01:37 < Stereo> ah, the json is indeed a bit big
01:37 < Ned_> (i.e. I don't want it to upgrade, just install it if it's not installed)
01:37 < kmiyashiro> Ned_: bash it
01:37 < Stereo> Ned_: script something around npm list?
01:38 < Ned_> Stereo: I was hoping for something .... simpler :p
01:38 < garthk> substack: replaced with everywhere; worked. Might just be voodoo, though.
01:38 < Stereo> what, that's easy as pie :)
01:38 <@mbalho> Stereo: i just tested your data with https://raw.github.com/Esri/geojson-utils/master/src/jsonConverters.js and it worked
01:38 < Stereo> npm list | grep foo || npm install foo
01:39 < Ned_> Stereo: yes, I have a list of packages to check though
01:39 <@mbalho> Stereo: just call .toGeoJson with each result
01:39 < Ned_> Stereo: also, what if the package is installed as a dep of another ?
01:39 < Stereo> wow, how do you guys find all these things?
01:39 < Ned_> the output isn't super parsable
01:41 < Stereo> Ned_: yes, you'd have to write a wonderful regular expression
01:42 < kmiyashiro> a beautiful one
01:42 < Ned_> Stereo: well, it turns out npm ll -json
01:42 < Ned_> is more parsable
01:42 < Ned_> seems like a more robust way to do it
01:42 < Stereo> ah, yes, most probably
01:44 < Ned_> Stereo: npm ll -json | perl -MJSON::XS -e '$/=undef; print join("\n", keys decode_json(<>)->{dependencies}) . "\n"'
01:44 < Ned_> yeah, that's pretty ugly
01:44 < Ned_> but functional
01:44 < Ned_> :/
01:47 < Stereo> Ned_: I was hoping you'd do it with node.js
02:03 < Stereo> ah, mbalho, that thing you found uses a lot of esri libraries. You said you got it to work?
02:17 < ufcman> hello
02:17 < ufcman> anoyone around
02:17 -!- mode/#Node.js [+o TooTallNate] by ChanServ
02:17 < ssafejava_> eh lo
02:17 < ufcman> looking for some help
02:17 < ssafejava_> ufcman: shoot.
02:17 < ufcman> ok i have a node sever
02:18 < ufcman> wich gets user name and pass
02:18 < ufcman> im im trying to get paypal after a pament paypal will send a usename and pass to the server
02:18 < ufcman> and write to file
02:19 < ufcman> did i lose u
02:19 < ufcman> lol
02:20 < ssafejava_> No, still here, just waiting for what the issue is :)
02:20 < ChrisPartridge> ufcman: is this part of the paypal api, where they send a http request to you after a payment?
02:20 < ufcman> ok in the js file on server i have to put username and pass manually
02:20 < ufcman> i want paypal to write to it after payment
02:21 < ssafejava_> So you're having your users give you their paypal username/pass?
02:21 < ufcman> so i dont have to do it manually
02:21 < ufcman> no
02:21 < ufcman> a diffrent user and pass
02:21 < ssafejava_> Okay. After a successful payment, if you have a webhook url set in the button / redirect that sent the user to paypal, paypal will send you an IPN
02:22 < ssafejava_> That shouldn't contain a username/pass, but it can contain any arbitrary data you want, so you can uniquely identify the transaction
02:22 < ssafejava_> So you can define that as just another route, and write to file accordingly
02:23 < ufcman> ok well heres the deal
02:23 < ufcman> now how will the ipn write to my js
02:24 < ufcman> thats the hard part
02:24 < ChrisPartridge> ufcman: its a http request
02:24 < ssafejava_> You just define it as any other route, and read the query string
02:25 < ssafejava_> So, Paypal will hit a route like this: http://yourwebsite.com/ipn?mc_gross=19.95&protection_eligibility=Eligible&address_status=confirmed&payer_id=LPLWNMTBWMFAY&tax=0.00
02:25 < ssafejava_> and you read the querystring to get the info you need.
02:25 < ssafejava_> There's a lot more info about it here. https://developer.paypal.com/webapps/developer/docs/classic/ipn/integration-guide/IPNIntro/
02:25 < ufcman> ok now adding a code to read quary
02:26 < ssafejava_> ufcman: Try google, plenty of answers. Here's one for free. http://stackoverflow.com/questions/6912584/how-to-get-get-query-string-variables-in-node-js
02:26 < ufcman> ok thats will get sring
02:27 < ufcman> now where the hell it getting it form
02:27 < ufcman> lol
02:27 < ChrisPartridge> its getting it from the query string, from the http request paypal have sent you?
02:27 < ufcman> im just blank right now
02:27 < ssafejava_> Paypal hits your server with that url. It's kind of similar to someone opening up a web browser and entering that url I put up there a few messages back. Because that entire url is sent to your server upon the request, it's easy to read it.
02:28 < ufcman> ok ill look at this
02:28 < ufcman> thanks for the info
02:29 < ufcman> guys
02:29 < ufcman> just got stuck
02:29 < ssafejava_> np.
02:49 < sgronblom> I'm having trouble trying to install some node packages. Getting this "error rolling back ERROR: ENOTEMPTY" when npm apparently is trying to rm -rf some node_modules dir of an installed package.
02:49 < sgronblom> Or actually it's rmdir, instead of rm -rf
02:53 < jmav_> ?
02:53 < ssafejava_> you could delete the dir yourself and run another npm install, it'll just replace the contents
02:58 < Ned_> Stereo: and miss an opportunity to do some Perl ? ;-)
03:00 < sgronblom> even if I remove the whole node_modules dir and run npm install again I get the same error every time
03:15 < trindaz> Form validation with express - what's my best option? I just had a very lousy experience with express-form
03:15 < trindaz> I can't believe I'm 3 hours in to finding an elegant way to validate a signup form for duplicate usernames
03:17 < trindaz> Mongoose errors aren't "parsable" for meaningful messages back to the user AFAIK, and express-form makes you throw an error in custom validation functions to indicate that a field is not valid - which breaks when you have it inside a mongoose callback (I also tried using it with coalan/async to get outside my mongoose callback but that swallows errors!)
03:17 < trindaz> the Chaos that is my signup form
03:18 < deoxxa> weird, i've never had that problem coding things like that by hand
03:18 < trindaz> creating an outright solution isn't a problem per se - but I don't want to have half my validation code using a form validation framework and the other half manual
03:19 < trindaz> So I could do it manually, but I want a beautiful, elegant solution!
03:19 < trindaz> am I missing something obvious with validation frameworks?
03:20 < krunc_> join #ace
03:23 < hotnikks> so jshint is complaining that "process" is not defined (im accessing process.argv). how can i let the linter know that its a legit var?
03:24 < hotnikks> do i have to declare it as a global?
03:24 < hotnikks> ya that seems to do it
03:24 < hotnikks> thanks self
03:25 < trindaz> krunc_ : I should join #ave?
03:25 < trindaz> *ace?
03:25 < trindaz> for the form validation stuff?
03:26 < krunc_> trindaz: no, I miss typing the / , I was trying to join ace
03:26 < trindaz> cheers
03:26 < krunc_> tho noever have sen a single active user in there or cloud9's channel... I relly want to figur eout how to hide the scroll bar on the ace editor, untill the content scrolls and it is required
03:27 < substack> garthk: I could update trumpet to make all tags self-closing
03:27 < substack> right now they only work when you set opts.special explicitly
03:28 < tilleps> trindaz: I'm in the same boat
03:28 < garthk> substack: aah, and there's no way to pass the opts.special through hyperstream to trumpet?
03:29 < substack> I don't think so
03:29 < trindaz> tilleps - I'm working on a validator now I'm writing from scratch to solve all our problems. What's yours exactly? I've found the support for custom validation functions is crazily bad.
03:30 < tilleps> I was about to start writing one, looking into the best way to go about it
03:32 < substack> garthk: making a failing test case for doctypes now
03:32 < substack> then I'll make one for self-closing tags
03:34 < timoxley> substack "making a failing test case for doctypes now"
03:34 < timoxley> what was wrong with my failing test case!
03:34 < deoxxa> timoxley: the pull request didn't pass CI
03:34 < substack> timoxley: you had one for doctypes?
03:35 < deoxxa> (god i hope that made you angry reading that, timoxley)
03:35 < substack> yeah your patch broke the other code
03:35 < deoxxa> it broke the tests
03:35 < deoxxa> so it wasn't merged
03:35 < timoxley> substack what. it was a failing test case.
03:35 < substack> but you also had a fix
03:35 < timoxley> nope
03:35 < timoxley> did I
03:36 < substack> the fix broke existing tests that weren't new
03:36 < timoxley> oh
03:36 < substack> yes
03:36 < timoxley> if I did
03:36 < timoxley> I didn't mean to commit that
03:36 < substack> you reverted the other fix
03:36 < timoxley> https://github.com/timoxley/node-trumpet/commit/06e98f3864ffb04049f26e5a9686e711c9ae5493
03:36 < deoxxa> wait substack you're not just joining in and trolling with me? this actually happened?
03:36 < deoxxa> now i feel like a jerk
03:36 < timoxley> hahah
03:36 < substack> deoxxa: yes
03:37 < substack> oh hang on!
03:37 < substack> timoxley: whoops sorry
03:37 < substack> I had your .patch confused with another one
03:37 < substack> https://github.com/substack/node-trumpet/pull/10.patch
03:37 < substack> looks legit, thanks
03:37 < substack> applying this now
03:51 < johnnode_> How do we apply new changes of a .js file without restart the whole app(express + moogoose) & still keep all the sessions?
03:52 < deoxxa> johnnode_: oh you were so close to asking the right question there
03:55 < merpnderp> strange, it appears that nowhere on the interwebs does anyone talk about using browserify/watchify with fileify. I can't figure out what arguments to use on the CLI to use fileify with watchify.
03:57 < johnnode_> deoxxa: Sorry for any inconvenience. Can somebody help me? I am just new with nodejs and I always to restart the server whenever some change need to be applied.
03:57 < px_> try nodemon
03:58 < johnnode_> I know that there a node-supervisor but maybe it just good for development not production? Am I right?
03:59 < arnorhs> johnnode_: forever is pretty popular.. you can also use supervisor in production, depending on your needs
04:00 < arnorhs> there's nothing magic about running in production
04:01 < johnnode_> px_: thank you but this is what it state on description: "Monitor for any changes in your node.js application and automatically restart the server - perfect for development"
04:01 < johnnode_> \
04:02 < px_> should be fine for production too
04:02 < px_> I use nodejitsu and heroku though to deploy so they handle that for me, not sure what is best
04:02 < merpnderp> Anyone know how to use fileify on the CLI with browserify?
04:03 < johnnode_> but what if I have a global.something which it should be keep all it's value for the next restart
04:03 < arnorhs> johnnode_: you do what people always do, store session data in some backing store
04:04 < arnorhs> it's very popular to use redis for that purpose
04:04 < arnorhs> you basically should design your app so that everything still works fine for end users when the server is restarting
04:05 < arnorhs> and yeah, restarting your node process each time you make a change is what everybody does
04:05 < px_> what is this global used for
04:07 < johnnode_> px_: i use global.SSs for some security transaction
04:07 < px_> sounds like you want sessions then
04:08 < johnnode_> let say, i only allow an authenticated user to access some file with a valid session which is an item of global.SSs
04:08 < px_> there are packages for sessions and they can use various backend stores for storing the sessions
04:08 < px_> would probably be a good idea to use one of those
04:10 < johnnode_> px_: do you mean something like redis?
04:10 < px_> could be, or mysql etc
04:11 < px_> if you use the packages they can do all the heavy lifting you just put the pieces together
04:12 < johnnode_> px_: thank you very much.
04:14 < substack> merpnderp: use brfs instead https://github.com/substack/brfs
04:14 < substack> fileify was a browserify v1 thing, completely deprecated
04:17 < merpnderp> substack: thanks a million. I knew I had read that browserify would do this before, but I got the module plugin name wrong. Thanks again :)
04:17 < johnnode_> arnorhs: thanks for your help. Can you give me some advice for designing my app.
04:24 < merpnderp> substack: that is retardedly cool. Espeically with watchify going.
04:36 < johnnode_> I want whenever my app crashes by some mistake it has to save all the sessions, safety close any connection to the db (mongo) & dump all the exception to a log-with-date-format-name.log file? what is the best for me?
04:37 <@nexxy> johnnode_, programming is probably a good idea
04:37 < Zolmeister> johnnode_: Well, start by using mongo as the session storage location. Second if mongo is setup to be in 'safe' mode, then it should be good. Lastly, you should be logging std out to a log file in /var/log
04:38 < ckknight> If anyone has a minute to look over a templating engine I wrote, check this out: http://ckknight.github.io/egs/
04:38 < julianduque> nexxy: epic answer :p
04:40 < Zolmeister> ckknight: does it support reverse inheritance?
04:40 < Havvy> Reverse inheritance?
04:40 < Havvy> extends & block?
04:40 < Havvy> Or include?
04:41 < Zolmeister> ah, yes I see it, extends and block
04:43 < Havvy> Zolmeister: Why do you call that reverse inheritance?
04:44 < Zolmeister> Havvy: from django (though I kinda made it up)
04:44 < Havvy> I just call it template inheritance.
04:46 < Zolmeister> Havvy: well, it can go both ways no? inherit from parent, or inherit from child (but I guess that has another name)
04:47 < Havvy> You could also call them metatemplates.
04:47 < ckknight> Havvy: how is it different from regular inheritance?
04:47 < ckknight> you can have regular inheritance, up a chain, and you can include partials
04:47 < Havvy> ckknight: I don't call anything 'inhertance' without a word before it.
04:48 < Havvy> Except the class of inheritance systems out there.
04:48 < Havvy> We have classical, prototypical, and template inheritance.
04:49 < ckknight> egs has template inheritance where you put an <% extends 'name' %> at the top, and then any code has to be inside blocks where the parent specified
04:53 < substack> garthk: doctypes work now
04:56 < garthk> substack: sweet. Thanks!
05:11 < krunc_> man, is there an easy way to output a object as the whole object ina jade template (I'm basically trying to pass a backend object to a front end on in a script tag)
05:11 < krunc_> if I do #{obj} i get [object Object]
05:12 < ckknight> JSON.stringify?
05:12 < krunc_> oh, lol
05:12 < krunc_> Im losing it today
05:13 < krunc_> thank you sir
05:40 < krunc_> whats the easiest way to do multiple 'rooms' in a socket.io simple chat
05:40 < ningu> socket.io supports rooms, doesn't it?
05:43 < ningu> so... ruby webapps don't support concurrency out of the box, and must be run under passenger in order to serve real world traffic. and there is no nginx+passenger package in ubuntu, so you have to compile nginx with passenger support built in. what a pain.
05:43 < ningu> I'm glad I don't normally have to deal with this :P
05:43 < krunc_> ningu: yeah, looking into that now
05:44 < ckknight> ningu: ...fun
05:50 < raphael> guys, something I've been banging my head against: I'm using baucis in my app but it fails because it complains that the model it is supposed to use is not defined (the error message is 'MissingSchemaError: Schema hasn't been registered for model "Session"'). However if I log the content of mongoose.modelNames prior to calling baucis I can see that the mode is there.
05:50 < raphael> Also if I log the content of modelNames in baucis I can see it's mepty
05:50 < raphael> Also if I log the content of modelNames in baucis I can see it's empty
05:51 < raphael> somehow baucis is resetting the mongoose variable, how can I avoid that?
05:53 < SomeoneWeird> raphael, do you have to call .sync() or something on it? I know you have to for sequelize
05:53 < ningu> raphael: did you register the models?
05:53 < raphael> SomeoneWeird, don't think there is such a thing for mongoose
05:54 < SomeoneWeird> what ningu said
05:54 < raphael> Yeah I did register and I can see in the list
05:54 < raphael> but somehow the mongoose variable that baucis uses doesn't have it
05:56 < raphael> So if I put that line in the code right before I call baucis: console.log("Models:", mongoose.modelNames()), I get:
05:56 < raphael> Models: [ 'LocalAccount', 'ServiceAccount', 'Session', 'User' ]
05:56 < raphael> 'Session' is in there
05:57 < raphael> but if I put the same line in baucis where it complains that array is empty
06:02 < krunc_> hmm, strange I'm putting '.in(roomid)' before my emit calls, but they are still getting send to to all rooms
06:02 < krunc_> oh wait, maybe itsbecause im testin gwith same user id
06:03 < krunc_> maybe I should re think this
06:03 < krunc_> not sure if I shoul dbe using rooms or namespacing
06:03 < mscdex> or both
06:03 < krunc_> possibly, lol
06:03 < mscdex> :-D
06:03 < krunc_> tho I dont think I ened both,yet
06:04 < krunc_> just trying to avea separate chat for each documnet being viewed
06:05 < krunc_> ok, definitely doign something majorly wrong, haha, let me start over
06:12 < raphael> ugh found the issue: I had installed baucis first *then* mongoose which caused baucis to install its own private copy of mongoose, nice little gotcha ;)
06:47 < motaka2> should I read node.js or java as a second language? I already know php, js. css
06:49 < substack> motaka2: node isn't a language
06:49 < substack> category error
06:50 < ningu> node is a platform
07:00 < motaka2> substack: What ever
07:01 < ningu> motaka2: with that attitude no one here is going to give you advice
07:01 < substack> motaka2: setting goals is a very personal process and you haven't provided adequate elaboration or context to answer your question
07:01 < substack> what do you want out of computing more broadly?
07:02 < Havvy> JavaScript is a platform. Node.js is an environment. To be more specific.
07:02 < Havvy> s/platform/language
07:02 < ningu> Havvy: yeah, 'platform' is pretty vague
07:02 < jesusabdullah> my couch is a platform
07:02 < Havvy> (Why'd I even write platform?)
07:02 < ningu> but I still think it's reasonable to call node.js a platform
07:02 < ningu> environment is better though
07:03 < ningu> I guess I meant cause it has a library, etc.
07:03 < motaka2> ningu: substack Havvy I am sorry for saying "Whatever". Mu bad english. I want to migrate to west and I want to learn something with which I can get a job. I have heard that PHP is dying - so I want to learn something useful in west
07:03 < ningu> motaka2: where are you?
07:03 < Havvy> JavaScript is definitely popular at the moment.
07:03 < motaka2> ningu: Iran
07:04 < ningu> motaka2: just curious, how does someone from Iran get a visa to the US? where do you go for the interview?
07:04 < substack> motaka2: what kinds of problems are you interested in solving?
07:04 < substack> ningu: there are more countries than america you know
07:04 < ningu> substack: the no-income problem
07:04 < ningu> substack: huh? what does that have to do with my question?
07:05 < ningu> substack: there is no US consulate in Iran.
07:05 < ningu> substack: oh, he said 'west' not US
07:05 < ningu> but I wasn't assuming he was going to the US, I've just been trying to get an answer to that specific question and thought he might know
07:05 < substack> motaka2: part of the problem here is that intrinsic interest matters a huge amount
07:09 < motaka2> substack: I love web programming, I mean programms which can be functional in a browser
07:09 < motaka2> ningu: Swithzeland embassy is US deputy in iran
07:10 < ningu> motaka2: ah, very interesting, thanks :)
07:12 < motaka2> ningu: Persian are different from arabs. We usually admire american way of life, but in west they think all middle easterns are arabs while persians hate arabs! (I dont think it is good but that's the way it is)
07:13 < substack> motaka2: what kinds of things do you want to build?
07:14 < ningu> motaka2: I know the difference, don't worry :)
07:16 < medice> is it poor REST to create resources such as /map/{mapid}/layer/1/ ?
07:16 < algesten> why would it be poor?
07:16 < medice> well, most examples never seem to delve in to such structures
07:16 < motaka2> substack: I love developping CMS systems, Forums , chatsrooms etc
07:16 < medice> but it would be unique url
07:17 < algesten> yes.
07:17 < algesten> it looks good.
07:17 < AAA_awright> medice: REST doesn't comment on how your form your URIs, all it says is that URIs are opaque - they're not supposed to mean anything at all, except that it uniquely labels a resource
07:17 < ningu> motaka2: people often use node.js for chatrooms, using socket.io or similar modules
07:18 < AAA_awright> medice: Nonetheless it's probably good API form to use /layer/1 instead of prefixing it with something
07:18 < algesten> AAA_awright: though it's pretty common to introduce a level of user friendliness.
07:19 < AAA_awright> http://www.w3.org/TR/webarch/#uri-opacity http://www.w3.org/TR/cooluris/
07:20 < Havvy> medice: It'd be better to provide ?layer=1&map={mapid}
07:21 < medice> Havvy: that wouldn't really be a proper resource url / id but a search functionality
07:21 < medice> as i understand it
07:22 < algesten> medice i like your scheme.
07:22 < AAA_awright> In my applications, the path component identifies the fundemental resource, and the query component specifies how to format it, or different ways of formatting it, e.g. ?start=20130605&limit=10
07:22 < AAA_awright> i.e. the path component identifies a non-information resource, and the query identifies an information resource
07:22 < medice> yeah..
07:22 < Havvy> URLs like /map/{mapid}/layer/1 is nice for browsers. It's not so nice for a REST API.
07:23 < algesten> Havvy, I fail to see the difference? An API is always implemented against with a user. Guessable URLs are the best.
07:23 < Havvy> Because preferably, I'd like to just pass a map of key -> val and a constant URL to a request function.
07:24 < AAA_awright> Havvy: REST tends to work best with URIs like , where class is a namespace and id is a number or some similar long-lived identifier. Though again, that's not a requirement, REST only says they're opaque.
07:24 < algesten> Havvy, so you're talking out of the perspective of liking tools where you pass a {} map to some library?
07:24 < medice> well, i guess just using layers/{layerid} for resource ids and layers/?map=foo for searchign index
07:24 < Havvy> algesten: Yes.
07:24 < substack> REST is annoying
07:24 < substack> I like it much better when endpoints merely "speak http"
07:25 < AAA_awright> When you start using query parameters, form-encoding doesn't specify an order, and note that is a different resource than
07:25 < AAA_awright> So I wouldn't suggest that
07:25 < AAA_awright> substack: HTTP is inherently RESTful
07:25 < Havvy> How is layer=1,map=x a different resource than map=x,layer=1?
07:25 < medice> oh well, it's not like i really need to conform to anything in particular
07:25 < AAA_awright> Havvy: The strings don't compare
07:26 < Hounddog> i was just thinkinghow is rest not speaking http
07:26 < algesten> huh?
07:26 < AAA_awright> Hounddog: Well, HTTP is one implementation of REST, there can be other RESTful protocols
07:26 < Hounddog> AAA_awright: sure, but it just depends how you implement it
07:27 < Havvy> AAA_awright: But you should be treating query parameters as a map.
07:27 < AAA_awright> Hounddog: It's hard to violate REST without violating HTTP too... for instance, using GET to perform a non-safe action is a violation of RFC 2616
07:27 < Hounddog> AAA_awright: anyway, lets not get into that... too big a topic :)
07:28 < AAA_awright> Havvy: That's now how URIs work though. The query component of the URI is an opaque string. HTML is what specifies the ?a=1;b=2 syntax, it's called application/x-form-urlencoded
07:29 < AAA_awright> (More common is the ?a=1&b=2 syntax)
07:30 < Havvy> Well, you have to parse the query at some point...
07:30 < Havvy> And make it non-opaque
07:31 < substack> AAA_awright: "REST" is a baroque thing with lots of moving parts
07:31 < substack> so is http but in different ways
07:31 < AAA_awright> That's done by the server that issued the URI, but you can't ask clients to do the same, they're not supposed to give it any meaning, only use URIs that they've been given
07:31 < AAA_awright> substack: REST is rather well-defined to me, how much have you read?
07:32 < Havvy> To give an example, Mediawiki's API /api.php does everything based on what query parameters you send it.
07:33 < AAA_awright> You can do that, but those aren't used to identify a resource - you can POST that data
07:33 < substack> AAA_awright: REST designs have too many routes for my tastes
07:33 < AAA_awright> substack: How do you mean
07:33 < substack> especially when they start paving over connections that are inherently stateful
07:33 < Havvy> AAA_awright: The resource is /api.php
07:33 < substack> CRUDy things
07:34 < AAA_awright> Havvy: That's the URI, the resource is a script that performs various tasks with data it's sent
07:34 < AAA_awright> If you go to , the resource is a database record identifying a wiki page, right
07:35 < AAA_awright> substack: That's generally what HTTP is designed for?
07:35 < Havvy> AAA_awright: Yes.
07:36 < Havvy> But That resource isn't an API
07:36 < AAA_awright> substack: I take it you've seen http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm right?
07:42 < AAA_awright> Havvy: I guess technically it's RESTful but api.php isn't what I would call "strictly" RESTful because it doesn't reduce the actions down to nomial form, everything is done with POST (iirc) even when you could more semantically meaningful methods like GET or PUT.
07:42 < AAA_awright> er, normal form
07:50 < marchtemp> Guys, how do I make files/modules accessible in the browser?
07:51 < AAA_awright> marchtemp: Just serve it as a static file? Or are you looking to do something, maybe you want browserify?
07:51 < marchtemp> AAA_awright: Just a static file.
07:51 < ningu> marchtemp: are you using express?
07:51 < marchtemp> ningu: Yes.
07:52 < ningu> marchtemp: use express.static then. the template express app by default serves files out of public/
07:52 < substack> marchtemp: I use http://github.com/jesusabdullah/node-ecstatic
07:52 < marchtemp> I'm trying to figure out how socket.io exports its client code. It seems to be a clean way to do that.
07:52 < substack> var ecstatic = require('ecstatic')(__dirname + '/static')
07:52 < ningu> marchtemp: socket.io does it on its own
07:53 < substack> http.createServer(function (req, res) { if (req.url === '/') { res.end('beep boop\n') } else ecstatic(req, res) })
07:53 < substack> most of my apps look something like that
07:53 < sinclair|net> gah, express
07:53 < marchtemp> I see. Thanks everyone.
07:53 < substack> marchtemp: don't do what socket.io does
07:54 < substack> marchtemp: do this instead: either make your code just work in both node and the browser by not doing needless IO
07:54 < substack> or else have a separate entrypoint for browser code and node code
07:55 < sinclair|net> substack: what does that mean?
07:55 < substack> marchtemp: like https://github.com/substack/shoe/blob/master/package.json#L5-L6 except this field is called "browser" now
07:55 < substack> https://gist.github.com/shtylman/4339901
07:56 < sinclair|net> substack: wouldn't it make more sense to abstract node and the browser away with common interface for whatever it is that you are doing?
07:56 < substack> sinclair|net: it depends
07:56 < substack> what you shouldn't ever do
07:57 < substack> is put in a bunch of inline checks to detect whether you're in node or the browser
07:57 < substack> that always breaks
07:57 < sinclair|net> sure
07:58 < ningu> substack: because you can't detect it reliably, or because it makes the code unmaintainable?
07:58 < marchtemp> Is it a good idea to use Express generators?
07:58 < sinclair|net> ningu: unmaintainable
07:58 < substack> ningu: both
08:02 < substack> marchtemp: generating code that you will then edit by hand is always a bad idea
08:02 < sinclair|net> ningu: in things like C++, they support conditional #define that the preprocessor picks up on and compiles conditionally, for example you can have blocks of WIN32, or UNIX/LINUX specific code. this allows the developer to pick and choose which compilation target
08:02 < ningu> sinclair|net: I know that. I was just wondering specifically what reason substack had in mind. I wasn't disagreeing at all.
08:03 < ningu> conditional #define is not something you can actually get rid of, though, afaik
08:04 < sinclair|net> ningu: if things are not defined, the preprocessor omits them from the compilation.
08:04 < ningu> sinclair|net: I know what the C preprocessor is and what #ifdef's are and what autoconf is.
08:05 < sinclair|net> ningu: yup
08:05 < ningu> I just meant that given the variety of *nix environments, that is a case where you can't actually eliminate that kind of logic, you can just minimize it
08:06 < sinclair|net> ningu: i don't want to get into a conversation about TypeScript
08:06 < KamiPhuc> excuse me, I'm new here. I want to ask for your advices.
08:07 < ningu> well, sure, I don't either, but I don't see how it's relevant :P
08:07 < ningu> KamiPhuc: don't ask to ask
08:07 < KamiPhuc> sorry, I'm beginning
08:08 < AAA_awright> sinclair|net: Supposedly that's going away in favor of simply optimizing out code blocks that will never be executed because it's if(0) or something
08:08 < KamiPhuc> I have a web system running in php. it can get data from social networks. I want to run some datamining algorithms on those data.
08:09 < KamiPhuc> I'm afraid that PHP is just not good enough for algos. so, I want to ask that, should I use Node.js or Python/R/Java to get thing done?
08:09 < sinclair|net> KamiPhuc: any programming language is entirely algo's
08:09 < ningu> KamiPhuc: do you want it to run in real-time, or what?
08:10 < jesusabdullah> yeah, like, what kind of algorithms are you talking about here?
08:10 < KamiPhuc> yes, in real-time, coz my web app creates charts & data visualization in realtime
08:10 < jesusabdullah> for numerical stuff, if it's lots of small calculations node can do it, look up the ndarray library
08:11 < jesusabdullah> and there are other numerical libs which will definitely run in the browser
08:11 < sinclair|net> KamiPhuc: i would look at C# / F#, particularly F#, it is geared up for mining, data transformations and projections
08:11 < KamiPhuc> some clustering and classification algos
08:11 < jesusabdullah> ndarray probably does too
08:11 < jesusabdullah> KamiPhuc: python has really good support for this stuff
08:11 < jesusabdullah> KamiPhuc: R would take work interfacing but obviously can also do stats
08:11 < sinclair|net> KamiPhuc: also, you will spend less time developing whatever it is that you need with C# / F# than you would doing it in node
08:12 < jesusabdullah> KamiPhuc: you just gotta figure out what you want to do, how "big" the problems are, what tradeoffs you need to make
08:12 < KamiPhuc> :)
08:12 < nathan7> I should toy with R
08:12 < jesusabdullah> R is cool
08:12 < nathan7> My dad was really enthusiastic about it a while ago
08:12 < jesusabdullah> haha nice
08:12 < KamiPhuc> tks, @jesusa and @nathan, @sinclair (sr I don't know how to mention)
08:13 < jesusabdullah> all good
08:13 < jesusabdullah> I can give more advice if I know what specific algorithms you're running
08:13 < KamiPhuc> I'm wondering, if I use Python/R and then bridge it with PHP, would it be slower?!
08:14 < KamiPhuc> @jesusa: I have researched a lot about this, but I'm doing it right now. If I do, I will definitely ask for ur advice. Of course if u don't mind, and I know that u're free to do that
08:15 < substack> http://c2.com/cgi/wiki?CodeGenerationIsaDesignSmell
08:15 < substack> from earlier
08:30 < samantha> hi guys
08:30 < samantha> anyone works ard socket.io
08:30 < samantha> ?
08:31 < booyaa|foo> recruiting ppls?
08:31 < jesusabdullah> booyaa|foo: lolwut
08:32 < booyaa|foo> samantha's last msg
08:32 < booyaa|foo> jesusabdullah: :D
08:32 < jesusabdullah> aha
08:32 < sambarino> what does ard mean? i have used socket.io but haven't worked on the actual code base
08:33 < samantha> when i console.log(socket) i get object Object
08:33 < samantha> why it's so?
08:34 < sambarino> isn't that normal? usually it will say that but have an arrow you can click to view the object contents
08:35 < nathan7> ({}).toString() === '[object Object]'
08:38 < gildean> console.log(util.inspect(socket));
08:38 < gildean> http://nodejs.org/api/util.html#util_util_inspect_object_options
08:38 < sambarino> oh yeah, the arrow is only there on the chrome console, not the terminal console
08:42 < Dharmeh> how to connect memcache to nodejs
08:43 < gildean> tho current versions do the util inspect by default when you pass an object to console.log
08:43 < gildean> or something like the util.inspect
08:43 < gildean> iirc 0.6.x still coerses objects to strings
08:44 < Stark_> Hello everyone
08:45 < Stark_> I am newbee to node.js, and run the node file from terminal but how can I run it through browser
08:46 < nathan7> node does not run in the browser.
08:47 < sinclair|net> anyone using appjs?
08:47 < gildean> sinclair|net: i've played around with it
08:49 < sinclair|net> gildean: i like appjs
08:49 < sinclair|net> i think its cool
08:51 < gildean> sinclair|net: it is pretty cool, they're taking way too long to dev the new version tho'
08:51 < gildean> someone with c++ skills should go and clone or fork the dev-branch and push it along
08:52 < deoxxa> i have sea++ skills
08:52 < deoxxa> i contribute towards global warming
08:52 < gildean> deoxxa: you have a beard like a sailor, that's for sure
08:52 < deoxxa> yarrrr
08:53 < yawnt> deoxxa: ¡
08:53 < deoxxa> ǝbɐnbuɐן ǝʌıʇɐu ʎɯ uı buıʇıɹʍ ɹoɟ noʎ ʞuɐɥʇ
08:54 < yawnt> :|
08:54 < deoxxa> (uɐıןɐɹʇsnɐ)
08:54 < Havvy> sinclair|net: Do you know when the next version of TypeScript will be released?
08:54 < thealphanerd> good evening all
08:55 < rynkan> appjs looks awesome
08:55 < yawnt> deoxxa: lol
08:55 < yawnt> i laughed
08:55 < thealphanerd> you guys might get a kick out of this presentation I gave yesterday
08:55 < yawnt> must be tough for you guys.. all the time with your head upside down
08:55 < thealphanerd> https://ccrma.stanford.edu/~mborins/420b
08:55 < thealphanerd> nexxy: you in particular D
08:56 < yawnt> deoxxa: http://i.imgur.com/HxWnY1b.jpg
08:56 < rynkan> thealphanerd: what is this presentation-api that your using?
08:57 < thealphanerd> https://github.com/hakimel/reveal.js
08:57 < thealphanerd> you can write the entire thing in a single markdown file
08:57 < deoxxa> what an angry turtle
08:57 < thealphanerd> unfortunately I didn't learn that until after doing it all by hand
08:57 < thealphanerd> sigh
08:57 < rynkan> thealphanerd: cool thanks
08:58 < thealphanerd> no problem
08:58 < thealphanerd> it has some really awesome features that rely on node too
08:58 < gildean> another cool presentation tool is impress.js http://bartaz.github.io/impress.js/#/bored
08:58 < thealphanerd> I feel like it could be hacked to do real time presentations with others… so that only the presetner can change the slides forward
08:59 < thealphanerd> or something like that
08:59 < thealphanerd> or better the ability to switch between a guided mode and a free search mode
08:59 < thealphanerd> ahhh impress.js is a prezi clone
08:59 < thealphanerd> cool
09:01 < rynkan> its to awesome for my taste
09:01 < rynkan> like it simple :)
09:01 < samantha> had anyone tried lodash
09:01 < samantha> ?
09:01 < samantha> having issues with ._filter
09:02 < deoxxa> how about just [].filter
09:02 < samantha> deoxxa: what is that for?
09:03 < ningu> samantha: you don't need lodash for that
09:03 < deoxxa> my brain hurts
09:03 < ningu> samantha: anyway, post your code at pastebin.com if you want us to look at it
09:03 < ningu> deoxxa: probably because it's upside down too
09:03 < samantha> wait
09:05 < samantha> this is paste bin url http://pastebin.com/5bGe55H2
09:05 < samantha> before entering filter i console.log out the result and it return an array
09:06 < samantha> within filter it just return empty array
09:06 < ningu> samantha: _.filter is for objects, not arrays
09:07 < ningu> samantha: just use taxis.filter(function(taxti) { ... })
09:08 < sinclair|net> Havvy: soon i think, the codeplex repo already has a 0.9 build, which means i need to update my code :(
09:08 < samantha> ningu: did you see my taxis output before filter?
09:08 < ningu> samantha: yes, but that doesn't change my advice
09:08 < samantha> so that output is array am i right?
09:09 < thealphanerd> rynkan: reveal can be easily set to be very simple… no flash. Just way cleaner to make slides in markdown imho
09:09 < sinclair|net> Havvy: are you using TypeScript nowadays ?
09:09 < samantha> but filter only accept objects?
09:09 < Havvy> sinclair|net: I'm still waiting on 1.0
09:09 < ningu> samantha: _.filter is intended for objects, I'm not sure what it does for arrays (which are also objects). just use the regular .filter method
09:09 < sinclair|net> Havvy: might as well get started sooner rather than later, its still quite useable, i haven't had any issues with it at all
09:10 < samantha> return taxis.filter(function(taxi){ return taxi.isAvailable(); })
09:10 < ningu> samantha: yes
09:10 < samantha> also return empty
09:10 < ningu> samantha: ok, so taxi.isAvailable() is returning false.
09:10 < samantha> ahh..
09:10 < sinclair|net> Havvy: tho, the TS 0.9 alpha compiler was significantly slower than 0.8.3
09:10 < Havvy> sinclair|net: Decides, my current task is rewriting PHP into Python.
09:11 < Havvy> Yeah...I don't care about the speed of the compiler.
09:11 < deoxxa> https://github.com/mattdiamond/fuckitjs/blob/master/fuckit.js#L49-L57 best javascript method ever
09:11 < samantha> ningu: i just return taxi still output empty array
09:11 < sinclair|net> Havvy: its slower on first compiler, but the compiler is smart, and secondary compiles are lightning quick
09:13 < sinclair|net> Havvy: the idea is to keep a compiler instance running
09:14 < samantha> ningu: any idea?
09:14 < ningu> samantha: I see. you have an array, but you aren't using numbers to index your array values
09:15 < ningu> if you want to use keys like 'taxi123' you should use an object
09:15 < samantha> ningu: what do you mean?
09:15 < ningu> if you want an array, do array.push() or whatever
09:20 < swair> i'm trying generators in node (http://wiki.ecmascript.org/doku.php?id=harmony:generators), i run with the harmony flag still get this error
09:20 < swair> let [prev, curr] = [0, 1]; SyntaxError: Unexpected token [
09:20 < swair> this comes in the fibonacci example on the wiki
09:20 < swair> i've also declared the strict mode
09:21 < Havvy> swair: V8 doesn't have all of harmony.
09:22 < swair> Havvy: oh. do you know if this works in spidermonkey?
09:22 < Havvy> I don't.
09:22 < swair> ok
09:22 < Havvy> !mdn harmony
09:22 < Havvy> :/
09:23 < Havvy> https://developer.mozilla.org/en-US/docs/Web/JavaScript/ECMAScript_6_support_in_Mozilla
09:23 < swair> thanks!
09:24 < jameshowe> does anyone know (issacs?) whether https://github.com/joyent/node/issues/5504 also affects v0.8?
09:49 < rynkan> Yey Sweden! (national holiday)
09:49 < brainv> how can i download the cookie using request client?
09:52 < ChrisPartridge> brainv: check the headers
09:53 < brainv> ChrisPartridge requests.headers didn't return any cookie
09:55 < ChrisPartridge> brainv: gist your code please
09:56 < brainv> ChrisPartridge https://gist.github.com/brainv/5720493
09:58 < ChrisPartridge> brainv: and no set-cookie in the response headers?
09:59 < brainv> ChrisPartridge i update with sample response.headers value
09:59 < brainv> ChrisPartridge https://gist.github.com/brainv/5720493
10:00 < ChrisPartridge> brainv: do you control the http server?
10:00 < brainv> ChrisPartridge nope
10:00 < brainv> ChrisPartridge it's our partner http server
10:00 < ChrisPartridge> brainv: hm, perhaps try mimick a user agent, see if you get a cookie then
10:00 < brainv> ChrisPartridge ok let me try it
10:02 < RLa> damn sql needs macros
10:03 < Havvy> RLa: SQL is the assembly of CRUD meets Relational Database
10:04 < RLa> i have triggers here too
10:05 < standoo> hello
10:08 < accc> fu ssl-certs
10:08 < sinclair|net> RLa: use T-SQL
10:10 < RLa> you assume some certain sql dbms
10:10 < RLa> i have 2 different ones here
10:14 < sinclair|net> RLa: SQL doesn't need macros
10:19 < brainv> ChrisPartridge this works response.request.headers
10:27 < jameshowe> brainv: that's the cookie that you sent to the server, not what the server sent to you
10:53 < brainv> jameshowe any idea to get the cookie that was sent to me?
10:53 < jameshowe> response.headers['set-cookie']
10:53 < ChrisPartridge> brainv: it will be in the response headers, if it sent one
10:59 < brainv> jameshowe ChrisPartridge, this is weird still no response.headers['set-cookie']
11:00 < jameshowe> then the server isn't sending you a cookie
11:04 < brainv> jameshowe ChrisPartridge seems you're right. need to hit my head on the wall.
11:04 < jameshowe> ___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__
11:04 < jameshowe> _|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|
11:04 < jameshowe> ___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__
11:04 < jameshowe> _|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|
11:04 < jameshowe> ___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__
11:04 < jameshowe> _|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|
11:04 < jameshowe> ___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__
11:05 < jameshowe> that may not have worked...
11:05 < yawnt> A FIREWALL
11:06 < ChrisPartridge> brainv: haha, so you got them in the end? or its just not sending them?
11:08 < brainv> ChrisPartridge hopefully, generating my email spam now to ask WHY THE ARE NOT SENDING ANY COOKIE.
11:09 < jameshowe> well usually a server only sends it back when it needs changing
11:09 < ChrisPartridge> brainv: what are you trying to do?
11:09 < jameshowe> a session cookie should only ever be set once for example
11:10 < brainv> ChrisPartridge i'm trying to bypass the paypal "like" checkout/redirect of their system because they can't provide an api as of the moment
11:10 < Siyfion> If I'm using AngularJS for the frontend code and Express for the backend API, is there any reason why I shouldn't store session-state? I know it's anti-REST.. But is that a big deal?
11:12 < brainv> ChrisPartridge but you know what, even on the browser (dev console) i'm not able to get any cookie from the response
11:13 < brainv> but the checkout thing works (on the browser), maybe be there;s something to do with the header i pass, or did i miss any option param?
11:13 < Siyfion> brainv: Just caught the end of this.. What's up? you're expecting a cookie to be set but it's not?
11:14 < Siyfion> brainv: If it's a CORS request, you need to set a flag to enable cookies to be stored, could that be it?
11:16 < brainv> Siyfion ooh! that make sense. CORS might be the problem
11:17 < Siyfion> brainv: heh, lucky guess :D
11:17 < brainv> let me experiment, i'll update you guys when there's blood on my head already.
11:27 <@konobi> jameshowe: please refrain from that nonsense
11:27 < jameshowe> sorry, was not intentional
11:31 < olalonde> are function declarations also moved to the top?
11:31 < olalonde> i forgot the name for this
11:31 < olalonde> hoisted?
11:31 < sinclair|net> konobi: TypeScript ftw right?
11:33 < sdjkghf> quick question: in my model file, user.js i would like to add an 'addUser' method -- should i do this as export.add = function(email, pass) or is there an alternative way to use params
11:43 < sdjkghf> ANYONE !
11:43 < werle> sdjkghf: what are you using ?
11:44 < sdjkghf> express, mongoose
11:44 < sdjkghf> werle: express, mongoose
11:45 < werle> sdjkghf: you should use the `method()` function on your `Schema` instance
11:45 < werle> sdjkghf: http://mongoosejs.com/docs/api.html#schema_Schema-method
11:45 < Siyfion> UserSchema.methods = { addUser: function(email, pass) {} }
11:46 < sdjkghf> werle Siyfion Thank you - do you think it's worth adding a new layer to sit on top of mongoose layer
11:46 < werle> if you were to define it on the `exports` object then you would need to require that module and possibly enumerate through each property on the exports object. for (var method in object) { if ('function' === typeof) object[method]schema.method(method, object[method]) }
11:47 < werle> sdjkghf: I find myself doing it all the time
11:47 < werle> sdjkghf: I usually find myself creating a Model constructor wrapping the mongoose model/schema creation
11:48 < sdjkghf> yeeeh i've been considering using "user-service.js" so all data stuff is hidden away
11:48 < werle> yeah something like that
11:49 < sdjkghf> werle: cheers for the help. I'll give this a go now.
11:50 < werle> sdjkghf: cheers dude
12:00 -!- mode/#Node.js [+o piscisaureus_] by ChanServ
12:07 < olalonde> var a = b = 1; is the same as var a = 1; var b = 1; or var a = 1; b =1; ?
12:07 < olalonde> i guess the former
12:08 < olalonde> the latter*
12:08 < olalonde> nvm
12:08 < deoxxa> olalonde: the latter
12:08 < deoxxa> olalonde: yeah
12:09 < olalonde> that's what i thought
12:09 < olalonde> but for some reason jshint is giving me an error
12:09 < deoxxa> you could do something silly like `var a, b = a = 1;'
12:09 < olalonde> right
12:09 < olalonde> var server = oauth2 = oauth2orize.createServer();
12:09 < Siyfion> werle: I don't usually wrap it if I'm honest..
12:09 < olalonde> var server = oauth2 = oauth2orize.createServer();
12:09 < olalonde> oops
12:10 < olalonde> "Variable oauth2 was not declared correctly"
12:10 < olalonde> but I do have var oauth2; outside of my function
12:10 < olalonde> maybe jshint is not happy with variables outside the function scope?
12:10 < olalonde> weird
12:10 < werle> Siyfion: its always good to be honest :)
12:10 < deoxxa> olalonde: linters are derpy
12:11 < werle> deoxxa: super derpy
12:12 < olalonde> the error disappears if I do:
12:12 < olalonde> var server = oauth2orize.createServer();
12:12 < olalonde> oauth2 = server;
12:12 < olalonde> well I guess it does avoid confusion a bit
12:29 < booyaa|foo> hey `3rdEden you learning vim or about to make some awesome muscle memory build vim training website?
12:32 < `3rdEden> booyaa|foo: Already have to much vim muscle memory and i'm just researching some vim parsers a brain fart that i just had :p
12:32 < RLa> i'm writing my first native module
12:34 < whatadewitt> hello nodeJS! i was curious about mysql and how i should implement it in a simple application i am building... is anyone experienced here?
12:35 < sinclair|net> whatadewitt: mysql is too difficult
12:35 < Havvy> whatadewitt: Pick a sql library and use it?
12:35 < Havvy> Or read its source
12:35 < Havvy> Presuming you mean 'use SQL'
12:36 < whatadewitt> mysql is my comfort zone, coming from php originally
12:36 < whatadewitt> havvy: i'm concerned about possibly creating too many connections
12:37 < RLa> is there documentation in nice format about node and v8 headers?
12:37 < Havvy> Don't.
12:37 < whatadewitt> im curious if the best practice is to always just create a connection, run my query, close the connection
12:37 < guor> documentation... haha
12:37 < RLa> if you use node-mysql, use pool
12:37 < whatadewitt> or if i should have just a single connection object that exists while the user is on the page
12:37 < RLa> guor, something extracted from header files
12:38 < guor> I doubt it for v8
12:38 < RLa> i'm now stuck on how to turn v8 String into char*
12:40 < guor> oh
12:40 < guor> use *AsciiValue(string)
12:41 < lemonsparrow> I know fairly good knowledge of jquery and js... I am completely and completely new to node.js dont know anything.. any good ebook or tutorial which will teach me node.js from scratch.. from installation in windows to complete dynamic application building
12:41 < guor> or string->WriteOneByte(&buffer)
12:42 < guor> uh. forget the &
12:43 < RLa> guor, how you find docs? :)
12:43 < guor> ... I don't
12:43 < guor> I just happened to know
12:43 < gildean> lemonsparrow: well, first of go to http://nodejs.org/ and download the windows installer, then run the example on the front page, that should give you some idea how it works
12:43 < RLa> i found String class from v8 but looks like no method to get raw char*
12:44 < RLa> oh
12:44 < lemonsparrow> gildean: ok
12:44 < lemonsparrow> gildean: is ryan dahl in here ?
12:44 < guor> RLa, a good way to find out stuff is to take a look at the unit tests
12:44 < gildean> yeah, ryah is here, tho' i haven't seen him speak in a while
12:44 < guor> test/cctest/test-api.cc
12:45 < RLa> nice
12:45 < RLa> hm, i have no cctest directory
12:45 < c4milo> RLa: there is no method to get a raw char
12:46 < RLa> most C libs use raw char :/
12:46 < c4milo> RLa: you could do something like String::Utf8Value xml(args[0]->ToString()); char *mystring = (char *) *xml;
12:47 < c4milo> RLa: yeah, casting usually works
12:49 < RLa> now trying to find Utf8Value
12:49 < RLa> damn grep is slow today
12:50 < bnoordhuis> grep is an aws-hosted cloud service now
12:50 < bnoordhuis> RLa: what are you trying to do?
12:50 < RLa> trying to get some idea where to look for most useful methods for writing native extensions
12:51 < bnoordhuis> RLa: addons.markdown?
12:51 < bnoordhuis> i slaved over that
12:51 < bnoordhuis> and not just me
12:52 < jameshowe> RLa: you've got http://izs.me/v8-docs/main.html right?
12:52 < guor> RLa, I meant v8/test/cctest
12:52 < RLa> oh thanks
12:52 < RLa> bnoordhuis, i already completed hello world :)
12:53 < bnoordhuis> RLa: okay, good :) if you have questions, don't hesitate
12:54 < deoxxa> if you hesitate, it shows fear
12:54 < RLa> i now found lots of code using String::Utf8Value
12:54 < RLa> i see you do not have to manually free/delete it
12:54 < bnoordhuis> deoxxa: and fear is the mind killer
12:55 < deoxxa> also it attracts wolverines
12:55 < jameshowe> everything should be either stack allocated, or used with a HandleScope so the garbage collector knows about it
12:56 < bnoordhuis> Persistent handles are the exception - but they're undergoing some drastic changes in v8 right now
12:56 < jameshowe> the clue's in the name there though
12:57 < bnoordhuis> jameshowe: quite. :) it's not just persistent handles though
12:58 < jameshowe> bnoordhuis: btw, do you know if https://github.com/joyent/node/issues/5504 affects Node 0.8?
12:58 < bnoordhuis> jameshowe: see e.g. https://github.com/v8/v8/commit/4081b34 - it's like old people always say, everything changes, nothing stays the same :(
12:58 < bnoordhuis> jameshowe: re #5504, probably not. it's caused by weak interaction between a streams2 bug and libev-less libuv
12:58 < bnoordhuis> v0.8 doesn't have streams2 and still uses libev
12:59 < jameshowe> good to know, thanks
13:00 < emilsedgh_> anyone got experience with a working headless webkit on 0.10? i tried phantom, phantom-node and chimera and they all fail due to various reasons :(
13:09 -!- mode/#Node.js [+o MI6] by ChanServ
13:14 < pirho_> is `npm publish` SUPER slow in v1.2.25 (bundled with node v0.10.10) for anyone else?
13:33 < porjo> Anyone know how to specify an include path for system libarry when running 'npm' ? (on linux)
13:33 < booyaa|foo> pirho_: dunno will test later this afternoon gonna publish another module
13:34 < booyaa|foo> porjo: do you mean var foo = require('foo')?
13:34 < alexandernst_> I have NodeJS running behind NGINX in a reverse proxy configuration. A small hello world works as expected, but if I try to upload a file (settting the form's target to a iframe) the callback of "createServer" is called only when the file is uploaded, and I'd like to be able to see when the upload starts (said in another way, how can I make the "createServer" callback to fire when the upload starts)?
13:34 < pirho_> ta, it does indeed work, it's just painstakingly slow
13:34 < ChrisPartridge> emilsedgh: did you try build chimera from source? what OS?
13:34 < pirho_> alexandernst_: http://gist.github.com/
13:34 < porjo> booyaa|foo: no. I'm building 'zmq' module but my zeromq system libraries are in a non-standard location, so npm says it can't find them
13:34 < pirho_> post your code
13:35 < booyaa|foo> porjo: ah doesnt zmq allow you specify an env var where your install lives?
13:35 < booyaa|foo> prolly best to raise an issue with the module author
13:36 < alexandernst_> pirho_: In fact I'm just using an example from node-upload-progress ( https://github.com/phstc/node-upload-progress/tree/master/examples/progress )
13:37 < RLa> bnoordhu1s, what happens if i throw std::runtime_error from native function?
13:37 < bnoordhu1s> RLa: node will terminate
13:37 < alexandernst_> pirho_: accessing my server with ip+port works fine (as in, I see the progress). But if I access it via mydomain.com I can't see the progress (but once done, the file does appear in the server)
13:37 < RLa> with segfault or some informative error message?
13:38 < bnoordhu1s> RLa: no, just the default 'terminated' message you get on an uncaught c++ exception
13:38 < alexandernst_> pirho_: that means that perhaps nginx is doing something wrong when working as reverse proxy?
13:38 < pirho_> alexandernst_: http://wiki.nginx.org/HttpProxyModule#proxy_buffering
13:38 * bnoordhu1s is afk
13:38 < pirho_> i'm only guessing but this looks like it could be a problem if it's on
13:38 < alexandernst_> pirho_: yes, I do have buffering off
13:39 < alexandernst_> pirho_: this is my nginx config: http://pastebin.com/3nEdmqXR
13:40 < pirho_> hmm
13:40 < pirho_> do the files necessarily need to go straight to node?
13:40 < pirho_> that directive only does responses apparently
13:41 < pirho_> alexandernst_: http://stackoverflow.com/a/12310121
13:41 < alexandernst_> pirho_: well... I guess yes :(
13:41 < alexandernst_> pirho_: well, that's a shame :(
13:44 < pirho_> alexandernst_: http://wiki.nginx.org/Faq#Can_I_disable_the_buffering_for_upload_progress.3F_.2F.2F_How_can_I_display_upload_progress_on_the_client_side.3F
13:45 < alexandernst_> This functionality is planned for a future release of Nginx.
13:45 < alexandernst_> :O
13:45 < alexandernst_> I guess it's something.
13:45 < pirho_> there is a module though
13:45 < pirho_> depends how much you want it ;)
13:46 < alexandernst_> I really don't want to use a module so maybe I'll just deploy on production without progress and wait for NGINX to support that natively :)
13:46 < pirho_> thanks for the heads-up BTW, we were considering proxying through nginx too but this is a deal-breaker
13:46 < alexandernst_> :P
13:46 < alexandernst_> I'll contact Igor and ask him if/when will that be available. He usually replies via twitter
13:48 < alexandernst_> pirho_: oh
13:48 < alexandernst_> pirho_: look at that: http://trac.nginx.org/nginx/roadmap
13:48 < alexandernst_> Unbuffered upload
13:49 < alexandernst_> so I guess it's around the corner
13:49 < pirho_> only 11 months ;)
13:50 < alexandernst_> xD
13:50 < alexandernst_> around the corner
13:55 -!- mode/#Node.js [+o piscisaureus_] by ChanServ
14:02 < mscdex> porjo: you can set CFLAGS and the like, which should wqork
14:03 < jorn> heyho, i'm sure there are quite some experienced developers in here who use a mac… i'm searching for an easy way to install node and npm, preferably through brew (so it remains up to date, etc.). There are tons of pages you find on google but they're all pretty old.
14:04 < jorn> so is there a less than 1 year old recommended install procedure for mac os x?
14:05 < alexwhitman> https://github.com/joyent/node/wiki/Installation#installing-on-mac
14:05 < algesten> how about "brew install node"?
14:05 < jorn> alexwhitman: have that open, wouldn't ask here if it included a pointer to brew
14:05 < jorn> algesten: that doesn't link npm on my system
14:06 < algesten> that's strange.
14:06 < algesten> it does for me.
14:06 < algesten> princess$ ls -la /usr/local/bin/npm
14:06 < algesten> lrwxr-xr-x 1 martin staff 30 5 Jun 18:00 /usr/local/bin/npm@ -> ../Cellar/node/0.10.10/bin/npm
14:07 < jorn> algesten: ah ok, then it might be a conflict on my install
14:07 < algesten> jorn: sounds like it
14:07 < jorn> algesten: thanks, this helped me a lot ;)
14:07 < algesten> jorn: no worries :)
14:07 < PCChris> Hello. What is the correct way to gracefully exit node on Windows when ^C is received?
14:08 < mscdex> PCChris: process.on('SIGINT', function() { }); ?
14:09 < PCChris> mscdex, that seems to not fire on Windows
14:09 < mscdex> PCChris: what node version?
14:09 < PCChris> mscdex, 0.10.7. I'll see if I can make a minimum working example real quick to ensure it's not just my code.
14:11 < mscdex> PCChris: it works for me
14:12 < PCChris> mscdex, http://pastebin.com/273v6LDa
14:12 < PCChris> This is in Cygwin on Win8 (when running from command prompt ^C doesn't do anything)
14:12 < mscdex> don't use cygwin :-)
14:13 < mscdex> also
14:13 < mscdex> you're blocking the event loop
14:13 < mscdex> with your busy loop
14:13 < PCChris> hmm...ok
14:13 < mscdex> replace that while loop with something like `setTimeout(function(){},999999);`
14:15 < PCChris> mscdex, same result, unfortunately
14:16 < mscdex> PCChris: i dunno then, i don't have cygwin installed to test. cygwin isn't supported anyway
14:16 < mscdex> PCChris: try installing the msvc version
14:17 < PCChris> mscdex, I installed using the Microsoft Installer file. Mostly I'm just mildly annoyed that node won't die when I send ^C, and instead continues to run in the background until I forcibly kill it.
14:18 < PCChris> I suppose this would often be desirable, but I can't manage to make it behave any other way.
14:18 < mscdex> PCChris: so with the long timeout replacing the while loop, you're not seeing your console.log being executed?
14:19 < PCChris> mscdex, Yup
14:19 < PCChris> mscdex, You're running on Linux?
14:20 < mscdex> PCChris: no, i tested on Windows :-)
14:20 < mscdex> although i have v0.10.9 installed, but that shouldn't matter i don't think
14:20 < PCChris> mscdex, huh. How were you sending it the SIGINT? It doesn't seem I can send one from Windows command prompt.
14:20 < mscdex> PCChris: pressing ctrl+c on the keyboard
14:21 < mscdex> PCChris: FWIW this is what I used: https://gist.github.com/mscdex/30387921b2cd49c68d5f
14:22 < mscdex> PCChris: what Windows version are you using?
14:22 < PCChris> mscdex, Ok. Sorry, I don't know what happened before, but it *IS* working from command prompt now. Just doesn't work correctly in Cygwin but that's no big deal.
14:22 < mscdex> ah
14:22 < mscdex> :-)
14:22 < PCChris> mscdex, Thanks so much. I feel dumb now.
14:22 * mscdex shakes a fist at cygwin
14:22 < PCChris> lol
14:27 < jorn> algesten: thanks for the hint, seems i had an old partial install from a year or so ago, runs like a charm now ;)
14:27 < algesten> jorn: excellent! new node.js is always better than old ;)
14:27 < jorn> ;)
14:35 < rhalff> hm, I never realized this was possible: itle, head, style, script { display: block; } or is it only chrome?
14:40 < rhalff> cool, which means you can just use contenteditable on any script tag in your html :-)
14:45 < tjholowaychuk> anyone have a simple example of how to use streams 2, not to implement them
14:45 < wathek> I've created a new js file that I'm using to get result. My question is can I interrupt the called function on first callback ?
14:45 < pirho_> tjholowaychuk: seen this ? http://dailyjs.com/2013/04/01/streams-streams-streams/
14:46 < tjholowaychuk> pirho_ that's implementing them though
14:46 < tjholowaychuk> the node docs sort of cover a similar thing
14:47 < tjholowaychuk> i just want to read N bytes with a callback, trying out .once("readable") and some other
14:47 < tjholowaychuk> hackery
14:47 < tjholowaychuk> but it seems wrong
14:48 < pirho_> flux
14:48 < pirho_> would be a more appropriate name for node
14:48 < pirho_> at times like these
14:49 < Havvy> pirho_: I once named a project flux.
14:50 < Havvy> Unfortunately, flux never worked.
14:50 < pirho_> :(
14:50 < pachet> fluxed
14:50 < pirho_> ({)
14:50 < Havvy> :{(
14:50 < rook2pawn> in http.createServer how do i obtain access to the stream? the latest docs show that server = http.createServer responds to .on('connect', function(req,ctlsocket) but the latest version is giving me null for the second argument
14:52 < pirho_> http://nodejs.org/api/http.html#http_http_incomingmessage
14:52 < pirho_> .socket
14:52 < pirho_> which is a strea
14:52 < pirho_> http://nodejs.org/api/net.html#net_class_net_socket
14:53 < jameshowe> is isaacs online?
14:53 < thanpolas> Mongoose problem... i have a problem setting up a nice flow for testing using mongoose, i am doing a mongoose.connection.db.dropDatabase() call on each test to reset the db... however this methods will clear all index and structure created using Schema() ... any sensible workaround / flow for this?
14:55 < rook2pawn> its not a duplex stream, and what does the second link have to do with anyhting
14:56 < jas-> Are there any authors of the connect sessionCookie middleware in this chan?
14:57 < pachet> tjholowaychuk seen https://github.com/TooTallNate/node-stream-parser?
14:57 < pachet> specifically the _bytes helper method
14:58 < tjholowaychuk> hmm
14:58 < tjholowaychuk> i'd be curious why core doesn't have similar
14:58 < tjholowaychuk> it seems really difficult to use
14:58 < tjholowaychuk> on its own
14:59 < sandfox_> dim question, what does anyone use to interface with git from nodejs….?
15:00 < pachet> tjholowaychuk yeah it can get a little arcane in places
15:00 < pachet> shrug
15:01 < wathek> I've created a new js file that I'm using to get result. My question is can I interrupt the called function on first callback ?
15:06 < thanpolas> tjholowaychuk: any clue how to restore indexes after removing all collections in mongoose in teardown for tests?
15:06 < tjholowaychuk> thanpolas nope we haven't used mongoose in over a year now
15:06 < tjholowaychuk> we found orms too restrictive
15:07 < thanpolas> right
15:08 < pachet> like a dog sweater
15:09 < merpnderp> I wish I was so badass I had outgrown orms.
15:09 < tjholowaychuk> there are lots of downsides to avoiding them
15:09 < tjholowaychuk> less though :D
15:10 < SomeoneWeird> anyone know of any good indexing/search libs?
15:10 < SomeoneWeird> (apart from reds)
15:11 < merpnderp> tjholowaychuk: after looking through your code, I imagine that the downsides are not real obstacles to you.
15:11 < RLa> SomeoneWeird, text search?
15:11 < SomeoneWeird> RLa, yeah
15:11 < RLa> elasticsearch mayme
15:11 < RLa> or some lucene binding
15:11 < tjholowaychuk> merpnderp ohhh they are haha, mostly with initialization, it's not hard at all to forget properties and end up with inconsistent data
15:12 < tjholowaychuk> if you're not funneling them all through some function
15:12 < tjholowaychuk> but that's mostly our own organizational issues
15:12 < SomeoneWeird> RLa, hmm yeah, i'd rather something that's not using an external db though
15:12 < `3rdEden> SomeoneWeird: Lunr
15:12 < tjholowaychuk> and even simple things like not having date strings converted back to Dates for you
15:12 < `3rdEden> http://lunrjs.com/
15:12 < tjholowaychuk> is kind of annoying
15:12 < thanpolas> tjholowaychuk: how can you 'forget properties' ? in initialization or usage?
15:12 < SomeoneWeird> `3rdEden, winning! thanks
15:13 < tjholowaychuk> thanpolas if you an insert without some helper function to add say .updated_at / .created_at etc
15:13 < tjholowaychuk> just simple things like that
15:13 < addisonj> hrm... those all knowledgeable in http, I am writing an API that allows me to acquire a resource on a network, in the event that the API can't fulfill the request, what would be the proper status code?
15:14 < SomeoneWeird> addisonj, depends on the reason it can't
15:14 < `3rdEden> SomeoneWeird: we're using it at Nodejitsu to make our documentation searchable (which is compiled from markdown), pretty sweet tiny library
15:14 < RLa> addisonj, do not use http codes for that
15:14 < addisonj> SomeoneWeird: no resources left to allocate
15:14 < SomeoneWeird> `3rdEden, yeah, looks pretty good, :)
15:15 < scathen^C> hey all, I am trying to create a 'keep me logged in' checkbox for authentication, but cant get the session to die on browser close. I have tried req.session.cookie.expires = false; but while that changes a few variables in req.session.cookie it has no effect? any ideas?
15:16 < addisonj> RLa: looking more over the status codes, I think you are right, nothing much to describe that in http
15:16 < rook2pawn> in http://nodejs.org/api/all.html#all_event_connect_2 it says proxy.on('connect',function(req,ctlSocket)Â but im not getting a second argumen
15:16 < RLa> addisonj, i usually use something like jsend
15:17 < rook2pawn> where proxy = http.createServer(...)
15:18 < randomlurker> Hey
15:19 < randomlurker> I'm trying to build a basic api with nodejs
15:19 < randomlurker> I want to know, what's the nodejs counterpart of python dir()?
15:20 < randomlurker> !help
15:20 < alexwhitman> what does dir() do in python?
15:20 < pachet> randomlurker : there's not a direct analogue
15:21 < pachet> alexwhitman lists names in a module
15:21 < SomeoneWeird> fs.readDir?
15:21 < pachet> randomlurker : var foo = require('foo'); Object.keys(foo)
15:21 < pachet> will get you the property names
15:22 < randomlurker> pachet, SomeoneWeird : thanks, I'll try it out
15:22 < pachet> but its possible to have a module export a function, or an array, or any object really
15:22 < missinglink> randomlurker not familiar with python dir() but it seems it imports functions in to the global namespace while in node you assign the name of the import with require()
15:22 < pachet> randomlurker so the utility of finding the properties in the object being exposed as the exports for that module is kind of circumstantial
15:23 < pachet> randomlurker also fs.readDir is not what you want
15:24 < randomlurker> missinglink: as far as I understand it, dir() shows the variables, functions et al available for the particular object
15:24 < rynkan> if i wanted to create an express webapp with an restapi, what would i use?
15:25 < rook2pawn> is there a way to access the stream on http.createServer without the HTTP incomingMessage (req) class? for example when connecting from net.connect
15:25 < randomlurker> pachet thanks, I think property names just might do the job
15:25 < missinglink> randomlurker. I see, then yes pachet is correct. var foo = require('foo'); Object.keys(foo). The only object added to your scope is 'foo' nothing is added to the global namespace and object.keys will give you any properties of foo
15:25 < randomlurker> great! thanks guys
15:27 < pachet> rynkan nothing keeping you from doing it in express
15:27 < rynkan> pachet: cool
15:29 < missinglink> rynkan worth checking the npm registry before you roll it yourself, there are a bunch of modules like this that may save you some time https://npmjs.org/package/restify
15:29 < rynkan> missinglink: oh man, didn't know about npmjs, awesome thanks!
15:30 < rook2pawn> something along the lines of http.createServer().on('connection',function(req) { req.pipe(stream) })
15:34 < bLUEE> quick question on mongoose: http://pastebin.com/njRTYZqF here comparePassword is a method on a given User, but I am trying to define: addUser on the whole model/Schema - is that correct way to it ?
15:34 < bLUEE> werle: hey again
15:36 < missinglink> bLUEE try #mongoosejs
15:36 < werle> bLUEE: hey whats up
15:37 < werle> bLUEE: both will work, but you should aim for consistency
15:37 < jas-> Does anyone know about connect's session store and handling the regeneration of the sid?
15:37 < werle> bLUEE: and questions like that should belong in #mongoosejs as you may get help faster
15:37 < bLUEE> werle: understood -
15:38 < bLUEE> werle: but what i was trying to ask is that comparePassword has a user object in it.. but addUser does have a user, it seems 'wrong' to do that ?
15:39 < jas-> Is there a channel for connect? or more specifically the connect-session module?
15:39 < werle> bLUEE: you should make the `addUser` method static
15:39 < werle> `schema.static(name, fn)`
15:39 < bLUEE> werle: right! thats more clear. thank you
15:40 < werle> bLUEE: np!
15:40 < bLUEE> werle: thats better distnction between user object methods and ones on the schema
15:42 < werle> yeah def
15:42 < scathen^C> grrrr, couldn't figure out why my cookie wasn't expiring on browser close. new chrome version decided it wanted to run in the background......
15:52 < RLa> damn segfaults
15:53 < RLa> still trying to get my native extension working
15:54 < bnoordhuis> RLa: what kind of segfaults?
15:55 < RLa> nah, already made debug build and got backtrace with gdb
15:55 < RLa> i have some object null
15:59 < RLa> have to make code more null-proof
16:04 < shredding> I'm reading the logs files from heroku with --tail, how can I stream the output into my app?
16:05 < shredding> atm it's just outputting one read and thats it:
16:05 < shredding> http://pastebin.com/wvzfD1pX
16:08 -!- mode/#Node.js [+o TooTallNate] by ChanServ
16:32 < rynkan> wow hacking node in win is actually OK
16:34 < SomeoneWeird> so i'm bored and I wanna write a library
16:34 < SomeoneWeird> someone give me ideas
16:35 < RLa> help write me rapidxml-based feed parser?
16:37 < SomeoneWeird> RLa, yeah uh I don't touch anything that has "xml" in its name
16:37 < RLa> yeah, the parsing code is quite verbose
16:38 < Havvy> SomeoneWeird: XMLHttpRequest
16:38 < SomeoneWeird> Havvy, i don't do frontend stuff :P
16:38 < Havvy> Granted, that only has XML in name only.
16:39 < SomeoneWeird> so got any ideas? :P
16:40 < Havvy> SomeoneWeird: You could fix the one bug in https://github.com/Havvy/simple-irc-socket
16:40 < werle> tjholowaychuk: hey dude is there way to have switch statements in ejs?
16:41 < RLa> SomeoneWeird, i now need a function to find line nr based on pointer into char*
16:41 < RLa> werle, isn't that plain js?
16:42 < rynkan> SomeoneWeird: qr-generator
16:44 < RLa> hm, is MIT compatible with Boost License?
16:48 < ExxKA> Using the request librari, is there a simple way to reset the session?
16:59 < rump> wathek: get it worked out?
17:04 -!- mode/#Node.js [+o TooTallNate] by ChanServ
17:05 < olalonde> for those of you maintaining node modules with git
17:05 < olalonde> do you git tag every version you npm publish?
17:12 < AAA_awright> olalonde: Definitely
17:12 < AAA_awright> That's absolutely essential, even
17:26 < rynkan> is there a git-for.dummies-guide out there?
17:27 < vampi-the-frog> did you google?
17:27 < rynkan> seem to not transition well from svn at all
17:27 < vampi-the-frog> http://danielmiessler.com/study/git/
17:27 < icebox> rynkan http://git-scm.com/book
17:28 < rynkan> went trough http://people.gnome.org/~newren/eg/git-for-svn-users.html but well it does what its supposed to do but its not like i learned a thing
17:28 < rynkan> icebox: great, thanks :)
17:29 < werle> RLa: yeah it is but it yields errors
17:29 < werle> RLa: I'm just using if statements instead
17:30 < wathek> rump, hey man thank you for your help yesterday
17:30 < wathek> rump, unfortunatly not it didn't work
17:30 < wathek> :(
17:30 < rump> yeah sorry i couldnt figure it out
17:30 < rump> you just gonna use the blocking php script?
17:31 < RLa> werle, maybe you can create stand-alone test case and submit an issue :)
17:31 < RLa> tho switch is not so popular
17:31 < RLa> at least i do not like and use it :)
17:31 < werle> RLa: I think I just will :)
17:32 < wathek> rump, I'm out of ideas :(
17:37 < garbagegod> Question, I'm using mongoose to save a user with a CRUD api, when the PUT is called it first checks to see if the users group_id is changed. If so, it makes sure that its a valid group_id by fetching it, and then continues to update the user
17:38 < garbagegod> But this results in my having to have the code for the rest of the user save logic inside the conditional for if they have changed the users group and if they haven't
17:38 < garbagegod> Is there a better way?
17:38 < garbagegod> Because model.findOne() is asynchronous (obviously...)
17:39 < rump> garbagegod: yer better off pasting code
17:42 < accc> hi nodels
17:44 < jjmpsp> new to this, sup guys
17:45 < kmiyashiro> walcome
17:45 < accc> hi
17:48 < jjmpsp> Just trying to make sense of NodeJS... By looking at the docs I see http.createServer([requestListener]), but how am I meant to know which parameters I can use in the callback? By googling I can see sample code with the callback of function(request, response){} - Why isn't this in the docs? And where could I find this info rather than googling for sample code or logging objects in the console each time i write a line of code?
17:49 < jjmpsp> so for example, is the 'request' object documented?
17:49 < rump> jjmpsp: notice how in the docs it says The requestListener is a function which is automatically added to the 'request' event.
17:50 < rump> so if you scroll down to Event: 'request' it gives the callback as function (req, res)
17:51 < jas-> jjmpsp: because it can be an object data type i.e. {port: 2345}, or it can be an anonymous function i.e. http.createServer(function(req, res) { ... }, or its argument can be a function name i.e. function test(req, res) { ... }; http.createServer(test)
17:52 < jjmpsp> Ohhh right that makes sense! Thank you for the explanation. I'm loving node already :)
17:53 < jas-> jjmpsp: Sorry, I should clarify as the object usually precedes an anonymous callback i.e. http.createServer(opts, function(req, res) { ... })
18:02 < rook2pawn> when i net.connect to an http.createServer, how can i get access to the underlying stream? the server.on('connection', function(stream){..} works for net.createServer.. but not for http.createServer
18:04 < whatadewitt> i have passport running and i'm able to authenticate, but if the user enters an incorrect username or password i can't seem to display that to the user
18:04 < whatadewitt> it's as if i cannot access the request in the localstrategy
18:04 < whatadewitt> has anyone ever had an issue like this?
18:06 < cahaha> hey
18:06 < cahaha> im working on file based cached
18:06 < cahaha> to retrieve settings from a remote service
18:06 < cahaha> and cache it on the fs
18:06 < cahaha> what's the best place to store the files?
18:07 < mscdex> rook2pawn: req.connection
18:07 < cahaha> on the cwd?
18:08 < olalonde> would be nice if npm publish had an --auto-tag options that would create a git tag :)
18:08 < substack> rook2pawn: what are you trying to do?
18:09 < icebox> olalonde, there is no problem adding a tag to a past commit
18:09 < olalonde> I know
18:09 < olalonde> would just be cool if npm publish would tag automatically
18:09 < olalonde> so I don't forget
18:12 < olalonde> https://github.com/isaacs/npm/issues/3524 :)
18:12 < RLa> cahaha, make it configurable :)
18:13 < RLa> cahaha, var location = require('config.json').location;
18:13 < cahaha> what should be the default location?
18:13 < cahaha> if none is set?
18:14 < RLa> make it cwd then
18:15 < cahaha> are there any conventions about it?
18:24 < rook2pawn> substack: i have a stream that i want to sit behind a http server that connects via shoe, but with a fall-through from an ordinary net.connect()
18:34 -!- mode/#Node.js [+o piscisaureus_] by ChanServ
18:36 <@MI6> joyent/libuv: Timothy J Fontaine v0.10 * f84becc : build: make HAVE_DTRACE=0 should disable dtrace - http://git.io/PY1zPA
18:38 < olalonde> ahh npm version
18:38 < olalonde> nice :)
18:40 <@ryah> :)
18:40 < ThePrimeMedian> I have a file that I want to execute on demand. So Im calling it an "action". when I trigger an action, say: app.listener.emit('user.registered'); I am fs.readFile'ing the file '/actions/user.registered.js', how to execute the code I just grabbed? (thats part of JS i never got... is it something .apply?
18:41 < olalonde> ThePrimeMedian: why not use require() ?
18:42 < ThePrimeMedian> olalonde: can you require in realtime? I thought that was just on compile
18:42 < olalonde> ThePrimeMedian: you can require anywhere. but it is advised to require at the top because require is sync and it will slow down node.js
18:43 < olalonde> once you required the file once every subsequent require should return a cached version
18:43 < rump> when you require just export a function
18:43 < rump> then you can call it whenever you wantz
18:43 < ThePrimeMedian> duh! why dont I just load all the actions at compile time... then call them... lol
18:43 < ThePrimeMedian> thanks guys.. it's been a long day
18:47 < olalonde> :)
18:48 < olalonde> you can keep an index.js file in your actions folder with: module.exports = { action1: require('./action1'), action2: require('./action2'), etc. } then all you need to do is var actions = require('./actions'); actions.action1(blabla);
18:49 < ThePrimeMedian> olalonde: yup, thats what I am doing now. ;) cheers
18:49 < olalonde> cheers
18:53 < Brad_> hey guys
18:53 < Brad_> anyone active here
18:53 < JohnMcLear111> no
18:54 < ThePrimeMedian> Brad_: just ask away, and someone should be able to help.
18:54 < dshaw_> #nodeup Promises by Promisers show staring in 5 minutes
18:54 < JohnMcLear111> ThePrimeMedian oh no you gave away our secrets..
18:54 < ThePrimeMedian> LOL
18:54 < ThePrimeMedian> join /nodeup
18:54 < ThePrimeMedian> lol.
18:54 < ThePrimeMedian> oops.
18:54 < rho> :)
18:57 < dshaw_> ThePrimeMedian: :)
18:57 < ThePrimeMedian> dshaw_: ;) back @ u
18:57 < jesusabdullah> ltns TheJH
18:58 < Snugug> I'd like to run npm install, but pass it a path where my package.json file is. Something like npm install --path=foo/bar where package.json lives in foo/bar and it will run npm install as if it were there. Can I do that?
18:59 < jesusabdullah> Snugug: run it in a subshell with the right location? In node you can pass a "cwd" parameter to the child_process.spawn call
18:59 < jesusabdullah> Snugug: something like, var npm = spawn('npm', ['install'], { cwd: './path/to/my/libary' });
19:00 < Snugug> jesusabdullah: Thanks, I'll give that a try
19:03 < Snugug> Can I use spawnCommand and use spawn's native cwd options?
19:03 < Snugug> (Sorry, was meant for #yeoman)
19:04 < jesusabdullah> aha
19:04 < jesusabdullah> I've not used yay oh man
19:04 < rynkan> anone using win on a second drive?
19:04 <@isaacbw> you can't make good web apps without cool vector logos throughout your tool stack
19:05 < Snugug> jesusabdullah: Yah, building generators. Surprisingly fun, but not as transparent as I'd have liked
19:05 < rynkan> was about to format so i got ubuntu as primary but i dont think win will stop bitching about that (sorry for going out of topic)
19:06 < jesusabdullah> yeah windows is kind of a turd sometimes!
19:06 < jesusabdullah> oh man when I have money
19:06 < Snugug> Interestingly enough, I can just call `spawn` directly, and that works. If anyone was interested in my question as well
19:06 < jesusabdullah> y'know, in that far off hypothetical future where I have money
19:06 < jesusabdullah> I'm-a buy a windows box again
19:09 < s5fs> jesusabdullah: what!
19:10 < mscdex> node.js rules!
19:10 < jesusabdullah> s5fs: I see making a windows box webdev-ready as a challenge >:)
19:10 < shredding> Can anyone tell how to read an infinite stream from stdout?
19:10 < jesusabdullah> s5fs: also I miss video games
19:10 < daniel_z> Hello. How can I mock an entire HTML respone for nodejs testing. I was trying to use the nock module, but i made id mock only jsons... thanks.
19:10 < s5fs> jesusabdullah: it's always games that bring people back
19:10 < shredding> I'm stuck here: http://stackoverflow.com/questions/16967318/read-node-js-by-line-from-endless-stream
19:10 < jesusabdullah> s5fs: well honestly I could play the games I want to play between mac and xbox
19:11 < s5fs> jesusabdullah: i'm waiting for the windows store to open here in town, but it's taking forever. i'm not that enthused anymore, when win8 dropped and they store was under construction i was super curious.
19:11 < jesusabdullah> haha
19:11 < jesusabdullah> yeah
19:11 < mscdex> shredding: what are you actually trying to do?
19:11 < jesusabdullah> I've seen the win8/metro stuff, it's "okay" but not all that mind-blowing
19:12 < shredding> mscdex: I want to make a visual fronted for heroku logs.
19:12 < s5fs> jesusabdullah: it's the lack of a decent shell that kills windows for me. i've been using services for unix and cygwin and stuff but it's just not the same.
19:12 < jesusabdullah> way I see it, metro is just like "chrome apps" except fullscreen
19:12 < shredding> Basically, heroku logs --tail produces an endless stream of logs.
19:12 < jesusabdullah> oh yeah s5fs that's the real pain point
19:12 < shredding> mscdex: See http://stackoverflow.com/questions/16967318/read-node-js-by-line-from-endless-stream
19:12 < s5fs> jesusabdullah: my kid loves win8 but she knows nothing else (really). it's got some neat features for casuals but i don't know if it's unix dev-ready. windows dev, sure, you're married to the platform anyways.
19:13 < jesusabdullah> s5fs: so the challenge is to throw enough stuff like msys and unxutils on it that it "feels" complete
19:13 < shredding> I have as well tried "readable", but it never gets called (i'm on .10.8
19:13 < mscdex> shredding: ok, so just keep a string buffer and keep stuffing incoming data into it until you detect a newline
19:13 < s5fs> jesusabdullah: i'm sticking with linux, not saying it's less effort but when i'm done it's at least a real unix system.
19:13 < s5fs> plus i like to keep close to my deployment target
19:13 < jesusabdullah> yeah s5fs my devbox will always be either linux or mac
19:13 < shredding> mscdex: Somehow I do not get the callback function to be called repeatedly.
19:13 < shredding> Using the "old" 'data' event, it gives me one output and that's it.
19:14 < mscdex> shredding: you want .spawn() not .exec()
19:14 < shredding> Using the new 'readable' event on streams, never gets called.
19:14 < s5fs> jesusabdullah: if you go windows you may as well just become a sharepoint developer
19:14 < jesusabdullah> SHAREPOINT
19:14 < jesusabdullah> YES
19:15 < s5fs> the product stinks, nothing works and there's no way to measure your effectiveness. enterprise as fuck!
19:15 < jesusabdullah> naw s5fs, nsis installers
19:15 < jesusabdullah> someday I'm gonna write a minigame on top of an nsis installer
19:15 < jesusabdullah> "INSTALLER: THE GAME"
19:15 < s5fs> man i haven't heard anyone mention nsis in forever
19:15 < s5fs> haha, perfect platform for a choose-your-own-adventure game
19:15 < s5fs> "next"
19:16 < shredding> mscdex: I have tried spawn, with it, 'data' isn't called either.
19:16 < s5fs> jesusabdullah: anyways, with oracle packaging crapware in their java update packages installers are already something of a game
19:17 < brainwarped> is node.js the only way to get a live twitter feed on your site?
19:17 < jesusabdullah> s5fs: exactly, you basically click around in circles until you "make it"
19:17 < jesusabdullah> s5fs: "installing... installing... /!\ALERT/!\ You have encountered a ~~GRUE~~"
19:17 < accc> simple ajax do it too
19:18 < s5fs> jesusabdullah: that's a super idea though, i hope you go through with it. hope it works in wine!
19:18 < jesusabdullah> I think you can compile nsis installers in linux
19:18 < daniel_z> Hello people.... How can I mock an entire HTML response for nodejs testing. I was trying to use the nock module, but i made id mock only jsons... thanks alot.
19:18 < jesusabdullah> daniel_z: nock can do non-json
19:18 < jesusabdullah> daniel_z: read moar
19:19 < daniel_z> moar ? :)
19:19 < daniel_z> manual something ?
19:19 <@nexxy> s5fs, \o
19:20 < daniel_z> I already have the response I want in a file. I used curl -o
19:20 <@nexxy> omg! s5fs Carter is going to be @ PDXNode tonight
19:20 <@nexxy> the guy that runs VoiceBox
19:20 <@nexxy> the node-powered karaoke bar
19:21 < shredding> mscdex: How would it look with spawn? I can't get it to work.
19:21 < mscdex> shredding: one sec
19:21 < daniel_z> how can I stick it to nock... :/ jesus help me
19:22 < shredding> From what i understand, it should work like: http://pastebin.com/g90023ED
19:22 < shredding> But it doesn't.
19:23 < patrickod> are there any viable alternatives to socket.io at the moment in node.js? Having serious issues with memory leaks and ghost connections at the moment.
19:23 < shredding> patrickod: Have you had a look onto meteor? It's not stable though.
19:24 < patrickod> shredding meteor is an entire framework for app development yes? with messaging included
19:24 < shredding> patrickod: yes, I'm learning it atm.
19:24 < patrickod> I'm just looking for the push notification part of socket.io. This is to be integrated with existing apps.
19:26 < s5fs> nexxy: yeah i saw that!
19:26 < mscdex> choose your own callback, turn to line #104
19:26 < s5fs> patrickod: can you elaborate on the memory leaks?
19:27 < s5fs> patrickod: I'm using sio as well and we're getting wonky performance on some browsers (but not all) and I'm curious if your experience mimics mine at all
19:27 < s5fs> I don't yet have performance metrics though, that's coming next week (I hope)
19:27 < patrickod> s5fs nothing browser related.
19:28 < mscdex> shredding: something like this: https://gist.github.com/mscdex/f5ae1ddc02f1fed65a5d
19:28 < patrickod> the socket.io server instances' memory usage grows continuously, keeping connections open when it shouldn't
19:28 < mscdex> shredding: obviously you'll want to handle `heroku.on('exit')` and stuff too...
19:28 < patrickod> it seems that it's not cleaning up after closed sessions.
19:29 < shredding> mscdex: That's basically the same problem that i had: lineParser never gets called.
19:30 < mscdex> shredding: is the process exiting? is there anything on stderr?
19:31 < shredding> mscdex: If I change spawn to exec, it does exactly one retrieval.
19:31 < shredding> on('error') isn't called either.
19:33 < shredding> mscdex: With spawn, the close function is closed.
19:33 < eddyb> bnoordhuis: about a week later, I'm trying to do some stats on the HeapSnapshot v8 provides, and I'm failing at getting a balance between memory usage (>2GB when memory-heavy) and speed (3k out of 1.3mil nodes in an hour, when not memory-heavy) :(
19:34 < mscdex> shredding: oh wait, i missed something
19:35 < eddyb> bnoordhuis: how is one supposed to find a memory leak in this ocean of heap nodes? (you don't have to answer that, mostly rhetorical) :-<
19:35 < mscdex> shredding: ok, https://gist.github.com/mscdex/f5ae1ddc02f1fed65a5d
19:36 < shredding> mscdex: What should be args?
19:36 < mscdex> shredding: an array of each argument after the actual executable
19:37 < shredding> Ah, i see.
19:38 < shredding> mscdex: It's now working for the first time, but it's not updating.
19:39 < shredding> So, basically it's what I got with exec.
19:40 < mscdex> shredding: dunno then, i am not familiar with heroku or its utilities
19:40 < mscdex> shredding: but exec() buffers everything until the process exits
19:42 < shredding> mscdex: Yes, i have read that.
19:42 < shredding> Basically it should just work with your code.
19:43 < shredding> Anyway, thank you very much.
19:47 <@isaacbw> I yell at my code until it stops being a brat
19:49 < jas-> isaacbw: lol
19:53 < olalonde> mmmm child_process.exec isnt working very well here
19:53 < olalonde> it never calls the callback
19:53 < ckknight> works fine for me
19:54 < olalonde> weird
19:54 < ckknight> paste up what you have?
19:54 < olalonde> first time i run into this bug as well
19:55 < olalonde> https://gist.github.com/5724408
19:56 < ckknight> olalonde: maybe it's just taking so long?
19:56 < olalonde> not the problem
19:56 < ckknight> olalonde: you may want to switch to child_process.spawn
19:56 < olalonde> afaik
19:56 < ckknight> so you can stream in the stdout and stderr
19:56 < olalonde> yes that's what im doing now
19:56 < olalonde> i wish spawn could parse arguments though :(
19:57 < olalonde> not a big deal in this case
19:57 < ckknight> olalonde: yeah, it bothers me that there's a separation of ways to do it
19:58 < ckknight> I'd rather they both take strings or both take an array of strings
19:58 < ckknight> or each take either
20:01 < olalonde> weird
20:02 < olalonde> ah i think i know the problem :)
20:02 < olalonde> when testing i was using `db-migrate` but i should really be using `node_modules/bin/db-migrate`
20:02 < olalonde> haha
20:02 < olalonde> different versions
20:02 < olalonde> damn it
20:04 < rud> hmm anyone using node-mongodb-natives ? i just don't understand how to reference to the instantiated client, so that i can later reuse it.. all sample codes i find are one-shot use only :/
20:05 <@isaacbw> sounds like you need to brush up on javascript
20:05 < accc> nop, sry
20:08 < jesusabdullah> rud: I mean presumably you could just assign it to a variable?
20:08 < shredding> olando: I have discussed a very similar problem a few minutes ago.
20:08 < shredding> We did not come to a solution as well.
20:09 < rud> jesusabdullah: that's what i thought too, but .. no luck for me, i mean the whole connecting process is fine .. (like https://runnable.com/UW3TwmTkq498AAAZ/connect-to-mongodb-using-mongodb-native-node-js )
20:09 < \mSg> j
20:09 < \mSg> j
20:09 < \mSg> oops
20:10 < rud> jesusabdullah: i wonder if i should memoize the passed "db" instance for later reuse, because as far as i can see i think i can only mongoClient.connect()
20:10 <@konobi> olalonde: check out sqitch
20:10 < rud> i mean "connect" is the only exposed method
20:11 < jesusabdullah> rud: Yeah, just hold onto the reference to db
20:11 < jesusabdullah> rud: You can save that any ol' place, whatever's convenient
20:11 < olalonde> konobi: sqitch?
20:11 < rud> jesusabdullah: yup that's the plan :)
20:11 < rud> ty i'll try to memoize db instead
20:11 < olalonde> konobi: ah, looks nice
20:12 < olalonde> konobi: it's language agnostic right?
20:13 <@konobi> yup
20:14 < calvinfo> anyone here used node-amqp for lots of data over a long period of time?
20:15 < olalonde> konobi: can you also run node scripts? sql alone wont cut it in some occasions
20:16 <@konobi> olalonde: not sure
20:18 <@konobi> checking
20:21 < algesten> calvinfo: i certainly intend to. we just embarked on such a project. don't tell me there's trouble :)
20:21 < calvinfo> we have been seeing a lot of errors :\
20:22 < calvinfo> the lib itself is sort of a mess at this point, and we're not sure where the problems are happening
20:23 < algesten> this is my feeling to. i looked into the code the other day because i couldn't get it to gracefully drop the connection. it keeps reconnecting.
20:23 < algesten> and i'm a bit horrified at the state of it.
20:23 < calvinfo> I'm tempted to move over to something like redis or zeromq
20:23 <@konobi> olalonde: seems just SQL... but that makes sense... what else would you need to run to migrate?
20:24 < innociv__> What is "play"? I keep hearing it, but trying to google "play", well, you can imagine how that goes. What a terrible name
20:24 < RLa> which project you recommend as example of good mocha tests?
20:24 < algesten> calvinfo: node needs a first class amqp implementation.
20:24 <@isaacbw> innociv__: for node?
20:25 < innociv__> I don't think so
20:25 < innociv__> I think it's something like node
20:25 <@isaacbw> then probably scala's play framework
20:25 < innociv__> But fuck if I can figure that out since I can't google it
20:25 < innociv__> There we go
20:25 < olalonde> konobi: some things are difficult to do with sql or not possible. like if you create a new "admin" table and want to add user's who have is_admin = true to it
20:25 < RLa> you mean play framework that was ruined by scala?
20:25 < olalonde> konobi: or if you want to move some files in your db to amazon s3
20:25 < olalonde> konobi: etc.
20:26 < olalonde> konobi: would be nice if it allowed you to run arbitrary scripts
20:27 <@konobi> olalonde: it's just SQL... you can add is_admin = true from there. as for files from db to s3... that's a different ballgame, since you'd have to do that ahead of time
20:27 < innociv__> RLa, ruined how?
20:28 < RLa> play 1 was pretty much perfect java mvc framework but then they decided to rewrite it in scala
20:28 < olalonde> konobi: you can move data from one table to another just with SQL?
20:29 < RLa> i have lots of java programmers complaining about it
20:29 <@isaacbw> just sounds like typical java developers
20:29 < RLa> no, this is different
20:30 <@konobi> olalonde: yes
20:30 < RLa> scala is too complex for easy usage, and compilation of it takes lots of time
20:30 < innociv__> I see
20:30 < RLa> feels like c++ :D
20:32 < othiym23> a lot of people I know and like seem to like Scala, which surprises me
20:33 < othiym23> I will say that Play2 and Akka servers are incredibly fast once compiled, and the JVM still scales better than just about anything except straight C++ or C
20:33 < s5fs> patrickod: thanks for sharing, my issues are purely client-side (thus far)
20:34 < RLa> play 1 was the most dev-friendly java web framework i ever saw
20:35 < RLa> the other was wicket :)
20:48 < s2013> is express the most popular framework
20:50 < othiym23> for web apps? probably
20:51 < innociv__> I've never really used express. Just socket.io. I've still been using php for static pages.
20:52 < ckknight> express works pretty well, though there are some things I tend to swap out when using it, such as its default routing system
20:54 < s2013> what i mean was is there anyway to prototype rapidly with node.js like it is with rails for example
20:54 < s2013> im trying to get more and more into node.js
20:55 < innociv__> Why can't you prototype rapidly with it?
20:55 < innociv__> There's no compile or anything
20:56 < s2013> what i mean is for example in rails i can create models, controllers, views, setup associations fairly rapidly and get something going
20:56 < s2013> is node.js similar?
20:56 < othiym23> s2013: look at Sails.js, Tower or Geddy
20:56 < s2013> ok let me check it
20:56 < othiym23> they include convention-over-configuration, and some have command-line generators like you're used to with Rails
20:56 < s2013> oh ok
20:56 < s2013> i thought express was a mvc framework but i wanst sure
20:57 < othiym23> it is, but it's not as elaborate a framework as Rails
20:57 < othiym23> it's patterned more on Sinatra
20:57 < RLa> express is sinatra-like framework
20:57 < ckknight> s2013: there's no need for a "controller", due to the capability of closure
20:57 < ckknight> closures*
20:57 < RLa> yeah
20:57 < ckknight> instead there's just a function executed when a route is accessed
20:57 < othiym23> ckknight: closures and controllers are pretty much orthogonal concepts
20:57 < s2013> oh ok. so express cant be used for more etnerprise level applications?
20:57 < s2013> i know my questions are very newbish
20:58 < othiym23> I wouldn't say that
20:58 < ckknight> s2013: not true at all
20:58 < othiym23> there are several large enterprise apps out there built on Express
20:58 < s2013> oh cause sinatra is for very light weight stuff
20:58 < othiym23> but they tend to be large in terms of traffic served instead of complexity of the applications
20:58 < s2013> same with flask for python
20:58 < ckknight> othiym23: I'm saying that first-class functions make requiring complex controller classes unnecessary
20:58 < s2013> oh ok
20:58 < ELLIOTTCABLE> Anybody use Typekit? It seems to be broken for me. ಠ_ಠ
20:59 < s2013> another thing.. i use windows to develop is that going to pose a major problem
20:59 < ckknight> s2013: no
20:59 < othiym23> ckknight: there are other reasons to have controllers in MVC apps, though, it's just that Node frameworks tend to eschew them
20:59 < s2013> ok cool
20:59 < s2013> any good video/screencast you guys recommend for newbie?
20:59 < s2013> i am decent in javascript
20:59 < s2013> so that might help i guess
20:59 < ckknight> othiym23: yeah, my point is that there's less incentive to use them due to the power of first-class functions
21:00 < ckknight> othiym23: since the functions are "good enough" and you wouldn't need to make a class structure for the typical case
21:04 < othiym23> ckknight: I get what you're saying, but there's more to controllers in Rails or in most big MVC frameworks than just what first-class functions can provide
21:04 < othiym23> they provide structure, for one thing
21:04 < ckknight> yeah
21:04 < othiym23> which tends to be much more ad hoc in Node
21:05 < othiym23> which isn't bad, it's just different
21:05 <@nexxy> oh it's bad
21:05 <@nexxy> bad... to the bone
21:05 < nater_> list
21:05 < deoxxa> babababababbaaaaaaad
21:05 <@nexxy> BAD TOTHEBONE
21:07 < othiym23> it's impossible to come up with onomatopoeia for that guitar riff
21:07 < othiym23> also it's super hard to spell "onomatopoeia"
21:12 < robertkowalski> isaacs: regarding that "find user by email"-ticket: i can open the view in my browser on http://registry.npmjs.org/-/user-by-email/bla@bla.de - but where i get that view for my dev-couch for development?
21:13 < robertkowalski> isaacs: did not find it on https://github.com/isaacs/npmjs.org
21:23 < rhalff> join /ratpoison
21:24 < jesusabdullah> that is not a channel
21:24 < jesusabdullah> also ratpoison is ancient get with the times and use stumpwm at least
21:24 * rhalff typo...
21:34 < s5fs> jesusabdullah: says the future windows guy ;-)
21:35 < s5fs> i fail every time i jump to a tiling wm, don't have the patience for it right meow, still too busy learning other stuffs i guess
21:37 < olalonde> is there any library that can help me do complex conditionals with multiple async functions?
21:37 < olalonde> for example
21:38 < accc> the async module maybe
21:39 < brainwarped> olalonde: http://yepnopejs.com/ and or modernizr?
21:39 < olalonde> somelibrary([is_logged_user, 'or', [ is_admin, 'and', is_user_admin ]], function (err, authorized) {});
21:39 < robertkowalski> isaacs: sorry for bugging, everything ok i got it. the vhost for the dev couch is listening exactly on 127.0.0.1 and using localhost does not work.
21:39 < olalonde> im looking for something like that
21:40 < olalonde> each function is async and should return a callback with true/false
21:40 < brainwarped> olalonde: definitely checkout yepnope, as someone who hasnt used it.
21:40 < context> id question why something as is_logged_user / is_admin is async
21:41 < context> wouldnt it be user.is_admin() ? or something similar
21:41 < context> or just... user.admin
21:41 < s5fs> or user.roles()?
21:41 < olalonde> context: most of them are not but some might be
21:42 < context> if all you are doing is checking roles id make an easier way of checking them... not different methods for them
21:42 < context> user.is_all('admin', 'logged') or user.is_any('admin', 'logged')
21:43 < olalonde> i cant do it that simple unfortunately… i have many different cases
21:43 < olalonde> for example, a user can only edit an order if he is part of the users who have access to that order
21:44 < context> and having method for every different role is very limiting, not to mention making maintenance later on a nightmare
21:44 < olalonde> actually, if he is a member of one of the clients who have access to that order
21:44 < olalonde> etc.
21:44 < context> so... user.has_access(order) - or - order.user_can_access(user)
21:44 < context> or... check_access(user, order)
21:45 < olalonde> yes
21:45 <@MI6> joyent/node: isaacs v0.8 * bf16141 : npm: Upgrade to 1.2.27 - http://git.io/df6HxQ
21:45 < olalonde> i need to use such a library for the code in check_access
21:45 <@MI6> joyent/node: isaacs v0.10 * 4d13fcf : npm: Upgrade to 1.2.27 - http://git.io/xmUoqw
21:45 < olalonde> since it needs to do some db calls
21:49 < olalonde> here's how my code looks so far
21:49 < olalonde> still no async madness yet
21:49 < olalonde> https://gist.github.com/5725269
21:49 < olalonde> maybe i should find a way to make everything sync
21:50 < ningu> olalonde: dunno what you're doing but that's a bad idea :P
21:50 < olalonde> ningu: what is?
21:51 < ningu> making everything sync
21:51 < olalonde> ah
21:51 < olalonde> see gist
21:51 < ningu> unless it's a one-off script or something
21:51 <@isaacs> robertkowalski: yeah, it's a bit weird
21:51 < olalonde> no no haha i mean. try to avoid using async calls during authorization
21:51 < olalonde> somehow
21:51 <@isaacs> robertkowalski: IP address is one, and localhost is the other, or something like that
21:51 <@isaacs> robertkowalski: but you can get the data using req.couch.get(...) or something
21:51 <@isaacs> robertkowalski: and that'll just be whatever's configured
21:52 < ningu> olalonde: oh, well it looks like your methods use callbacks but are not actually async
21:52 < olalonde> yes for now...
21:53 < olalonde> but async foo is coming
21:53 < olalonde> maybe i should not pass a callback if the arity of the function is 1
21:53 < olalonde> that would simplify a bit
21:53 < ningu> olalonde: are you using express?
21:53 < olalonde> yes
21:54 < ningu> olalonde: why not just do something like, app.get(whatever, require_user, handler);
21:54 < ningu> you can chain as many as you want
21:54 < olalonde> I know.. the problem is I need
21:54 < olalonde> app.get((require_user OR require_admin), handler);
21:54 < olalonde> I could do require_user_or_require_admin
21:55 < olalonde> but there must be an async library out there that does what im looking for
21:55 < ningu> not really clear to me what the issue is
21:55 < olalonde> well i might just create one
21:55 < olalonde> not really an issue, just trying to make my code more beautiful :)
21:58 < ningu> olalonde: sure
21:58 < ningu> but it still sounds like something to me that's amenable to normal express route chaining
21:59 < olalonde> it is
22:01 < olalonde> bool({"or": [ fn1, fn2, { "and": [fn3a, fn3b] }, fn4 ])(function (err, bool) { }); that would be neat
22:01 < olalonde> i think im going to write this library :D
22:01 < ningu> olalonde: oh, ok
22:02 < ningu> yeah, dunno if it's out there already
22:02 < ningu> seems like it should be
22:03 < olalonde> bool("? OR (? AND (? OR NOT ?))", [ fn1, fn2, fn3, fn4 ])(function (err, bool) { });
22:03 < olalonde> that would be cool too
22:03 < olalonde> yes thats what i though
22:07 < olalonde> ahhh i guess I could simply do:
22:07 < trypwire> hey all. how do I keep a process alive after spawning a child_process?
22:08 < olalonde> async.series([fn1, fn2, fn3], function (err, res) { if (res[0] && res[1] || res[2] }
22:08 < olalonde> mmmm
22:08 < werle> @trypwire what are you executing?
22:08 < olalonde> but it requires waiting for all async calls
22:09 < trypwire> werle: executing a python script that prints some stuff out to stdout
22:09 < othiym23> olalonde: if you use promises with e.g. Q, you can short-circuit some of that and still come up with a nice terse syntax
22:10 < werle> @trypwire why does it need to keep running after outputs to stdout
22:10 < ningu> olalonde: no, async shortcircuits on the first error
22:10 < trypwire> werle: er no, the process that spawns the child process seems to exit immediately
22:10 < olalonde> would still be nice to have a library that can "lazy load" the function.. only call them if they are needed to complete the boolean expression
22:10 <@xyxne> trypwire, it's probably out of things to do
22:11 < trypwire> xyxne: the main thread? it is. how do i keep it alive though?
22:11 <@xyxne> add some listeners to the process you spawned or something
22:11 <@xyxne> then it will stay up listening for stuff
22:11 < werle> @trypwire are you checking stderr?
22:11 < werle> @trypwire nothing is written to stdout?
22:12 < trypwire> mm… i wasn't checking stderr
22:13 < werle> @trypwire its always a good idea to check the `err` object and handle it if exists fucntion (err, stderr, stdout) { if (err) throw err; }
22:13 < trypwire> werle: thanks
22:14 < werle> @trypwire happing noding
22:14 <@xyxne> except you should never throw
22:14 < werle> @xyxne +1
22:14 <@xyxne> unless you're using domains or somethig fancy
22:14 < werle> @xyxne +1 again dude
22:15 <@xyxne> :P
22:18 < trypwire> werle: the problem is that the argument to the child process is a filepath which has spaces in it
22:18 < trypwire> werle: i'm getting execvd no such file or directory
22:18 < trypwire> execvp*
22:18 <@xyxne> you can send args in an array
22:18 <@xyxne> idk how that's handled internally but it might be worth trying
22:18 < trypwire> i am
22:18 <@xyxne> ah
22:32 < Guest49144> I'm pretty sure my node host is running my server on two different machines with two different times, which means that Date.now() is inconsistent. Is there a good way to get a reliable timestamp in node?
22:33 < taaz> Guest49144: setup ntp on those machines
22:33 < Guest49144> I'm not in control of them.
22:33 < Guest49144> I just upload my code to my host and it deploys to a machine or, as I believe is what I'm seeing, multiple machines.
22:34 <@isaacbw> tell your host to stop being so terrible
22:35 < s5fs> Guest49144: fetch the time from somewhere else and keep it in memory or something
22:36 <@MI6> joyent/node: Timothy J Fontaine v0.10 * f1b878c : build: add pkgsrc rule - http://git.io/xuj0cQ
22:39 < owen1> any idea why 'complete' event never called (using kue) - http://pastebin.com/YMnVBzHm
22:43 < jfroma> What would be the best way to bundle an script that does something very quick and closes for osx? This one https://github.com/jfromaniello/ss-to-db
22:44 < jfroma> I want it on a single osx app icon that you drop in Applications no npm install -g
22:46 < ningu> jfroma: something you run with npm script?
22:46 < ningu> jfroma: you could run it every time the app starts and have it abort if it's already run
22:46 <@isaacbw> you can make it directly executable with a hashbang
22:46 <@isaacbw> I don't know how mac os x does icons
22:47 <@isaacbw> the solution really has nothing to do with node
22:47 < ningu> isaacbw: well, the npm script business does
22:47 < ningu> that can be referenced in package.json
22:47 <@isaacbw> I don't think he wanted to use npm script
22:47 < ningu> but yeah making it an os x friendly icon is different
22:48 < ningu> jfroma: if you install locally the binary will be in node_modules/.bin
22:48 < ningu> so node_modules/.bin/ss-to-db
22:48 < jfroma> @isaacbw already hashbang, just want to bundle my app in an osx kind of app. I know it has nothing to do with node, but you guys are always kind
22:50 < jfroma> Now it works with install -g, I can use it everywhere etc.
22:50 < rwaldron> Raynos pfft https://github.com/jshint/jshint/issues/1123#issuecomment-19079285 you're welcome ;P
22:52 < Raynos> rwaldron: :(
22:52 < rwaldron> I went to Dave because the "...contains YieldExpression is false" semantics didn't seem right
22:52 < rwaldron> he just confirmed ;)
22:52 < rwaldron> anyway, thanks again for pushing on that one
22:52 < rwaldron> got a good spec bug out of it!
22:53 < rwaldron> Raynos ^
22:53 < rwaldron> :)
22:53 < Raynos> :D
22:53 < Raynos> generators are exciting
22:53 < rwaldron> I agree :)
22:53 < ningu> Raynos: I don't like the gas smell
22:53 < rwaldron> I'm glad you're digging into them early
22:59 < rynkan> node-modules where should i install them? seems wrong to have them in every project?
22:59 <@isaacbw> no, that's not wrong
22:59 <@isaacbw> that's how npm and node are designed
23:00 < rynkan> so, i'm to view them like jar-libs?
23:00 < Stumbler> when my net server chunks its write output, how is my client supposed to know when the last chunk of a write operation has been received? o.O
23:00 < kuja> rynkan: they are locally installed dependencies
23:01 <@isaacbw> rynkan: sure, that's an alright analogy
23:01 < kuja> you CAN have them be globally installed if you want, but meh
23:01 < rynkan> kuja, isaacbw: cool, then it makes sense
23:01 < mscdex> Stumbler: it depends. you should have some kind of protocol in place
23:01 < Stumbler> like a termination character, and just collect the chunks until that character has been read?
23:02 < mscdex> Stumbler: some kind of delimiter or a fixed length field for example
23:03 < mscdex> Stumbler: i often use my own TLV packets in cases like that
23:03 < Stumbler> alright then, I think I know how I can resolve this- I just wondered if there was a built in mechanism in place.
23:03 < mscdex> Stumbler: nah, TCP is a stream and you can receive chunks in any size
23:05 < Stumbler> *sad face* I should have thought of that. lmao. oh well, I guess that's what shortcuts do to 'ya :D
23:05 < Stumbler> thanks for the input
23:05 < rynkan> need to know how to pimp out my vim like the ninjas all over github
23:06 < mscdex> Stumbler: here's a module i wrote awhile back for this kind of thing: https://github.com/mscdex/xfer
23:07 < Stumbler> thanks, I'll look into it
23:07 < wc-> so im coming from python and am used to poking around in things with that repl
23:07 < wc-> when i put a debugger; in my script
23:08 < wc-> what is this console i get?
23:08 < wc-> all i want to do is print x
23:08 < wc-> or the equivalent
23:08 < wc-> x is a parameter to a function
23:09 < wc-> if i type repl i get to where i want (i think)
23:10 < wc-> is there some way to show all the attributes on an object?
23:10 < wc-> similary to python's x.__dir__
23:10 < wc-> or something
23:10 < wc-> x.__attrib__, been a while
23:12 < Stumbler> I'm sure there's a better way than what I do, but since no one else is responding… console.log( object ); often shows the output of the object, but in cases where it doesn't, I often write a for loop for( var attribute in object) and console.log(attribute)
23:13 < wc-> i just discovered node --debug-brk
23:13 < wc-> with node-inspector
23:13 < othiym23> Stumbler: what about console.dir or console.log(util.inspect(object))?
23:13 < wc-> so now i can actually get node-inspector open before my express app has passed the debugger statement
23:14 < Stumbler> well there 'ya go. a better solution. :)
23:14 < ningu> wc-: Object.keys(foo) to do it programmatically
23:14 < othiym23> wc-: be aware you still need to call debugger somewhere you can reload the node-inspector window and pull all the modules into scope before interactive breakpoints will start working
23:15 < wc-> ya right now i have a debugger; statement somewhere
23:15 < wc-> and hit continue then wait to hit that
23:15 < wc-> anyone played around with airbnb's rendr?
23:15 < othiym23> it would be nice not to have to do that, but the fact that node-inspector works is sort of a miracle as is ;)
23:29 < jschall> before rendering a photo page, i'm checking a couple things against a database. but, the same checks have to be made for the photo itself when the browser requests it - is there any way to quickly and securely encode that data in a query string in the image tag? do I want "hmac"? i see a function to create one but not one to read/verify it.
23:30 < azbyin> hi all.. anyone else having a problem installing the jsDAV module ?
23:32 < azbyin> sorry, it was actually libxml
23:32 < s5fs> azbyin: "works for me"
23:33 < azbyin> s5fs, jsDAV or libxml ?
23:33 < s5fs> jsDAV, lemme libxml real quick
23:34 < s5fs> azbyin: libxml fails for me too, build.sh can't find node-waf
23:34 < azbyin> wasn't waf removed completely from node 0.8 onwards? or was that from 0.9 onwards
23:34 < s5fs> not sure, but it's gone now. makes me think this is an old module.
23:35 < othiym23> azbyin: node-waf was gonz0rs from 0.9 on, yeah
23:36 < azbyin> uh, ok. I'm actually trying to get cloud9 working but their repo is broken badly.. lots of reference to old crap that doesn;t 'work' on newer node+npm
23:36 < azbyin> anyone here have any experience deploying cloud9 locally?
23:44 < deoxxa> azbyin: cloud9 is a *disaster*
23:44 < azbyin> lol, really? ok. atleast ace editor is good.
23:45 < deoxxa> azbyin: i seem to remember there being a "download this and just run it" package at some point - i never managed to get the actual installation process to work
23:46 < azbyin> well, it apparently works if one is using 0.6 <= node approx. <= 0.8
23:46 < azbyin> so yeah, old stuff
23:48 < azbyin> i got to know of cloud9 from bespin (the original mozilla editor). I had used it loong ago and went looking for the project again. bespin->skywriter->(merged into ace). atleast ace turned out to be a really good editor (possibly due to the mozilla folk's involvement)
23:49 < deoxxa> azbyin: cloud9 is a cool thing to use, but not so cool to run
23:51 < jschall> before rendering a photo page, i'm checking a couple things against a database. but the same checks have to be made for the photo itself when the browser requests it - is it a good idea to sign that data and place it in the query string in the img tag to reduce latency?
23:51 < jschall> is there a better place to ask? i tried #web
23:52 < azbyin> yeah.. i needed only an editor and that too for only showing syntax highlighted xml. instead of a simple