Logs for the RingoJS IRC channel,
as logged by ringostarr.
2010-05-20
[09:25] <gmosx> good morning
[10:00] <hannesw> hey gmosx
[10:00] <gmosx> first of all, congrats for 0.5
[10:00] <gmosx> now that 0.5 is out, I am wondering if we can get more compatible with Jack Response helpers...
[10:00] <gmosx> ie,
[10:01] <gmosx> support Response.notModified(), Response.unauthorized() etc...
[10:15] <gmosx> ?
[10:21] <gmosx> hey robi
[10:22] <robi42> hey gmosx
[10:23] <robi42> gotta leave, tho (at the airport, just checking the net shortly) :)
[10:24] <gmosx> ok, bye
[10:25] <hannesw> gmosx: yes! to a large part, it's just naming
[10:25] <hannesw> i actually like the static Response method scheme jack is using
[10:25] <gmosx> yeah, it's just naming, but it would be great to use the same names ;-)
[10:26] <gmosx> the static Response scheme comes from Nitro ;-) I pushed the change to Jack ;-)
[10:26] <hannesw> ok, cool.
[10:26] <gmosx> I think it is slightly better that what ringojs webapp is using...
[10:26] <hannesw> yes, i wouldn't mind moving to that. but i'd like to hear what others think about it
[10:26] <gmosx> we can have it both ways, ie:
[10:27] <gmosx> exports.notModified = Response.notModified = function () {...}
[10:27] <hannesw> i prefer it one way. two ways equals confusion
[10:27] <gmosx> ok
[10:27] <gmosx> I think Response.notModified is better...
[10:27] <gmosx> if you agree I can provide the patch, just let me know...
[10:28] <gmosx> another thing...
[10:28] <gmosx> can we have something like narwhal/hash in the standard library in Ringo?
[10:29] <gmosx> in many apps I add narwhal-lib just to use this simple file...
[10:29] <gmosx> some kind of hash utility (with something like Hash.update) would be very useful in the standard library...
[10:30] <hannesw> i'll have a look
[10:30] <gmosx> thanks
[10:48] <gmosx> hannesw: how does require("subprocess").system work? what kind of array should I pass?
[10:48] <gmosx> I can't get it to work, I had to use this workaround:
[10:48] <gmosx> var command = function (cmd) {
[10:48] <hannesw> gmosx, i think the documentation is slightly broken
[10:48] <gmosx> java.lang.Runtime.getRuntime().exec(cmd).waitFor();
[10:49] <gmosx> }
[10:49] <hannesw> it's system("ls", "-l")
[10:49] <gmosx> why do I split this in multiple strings?
[10:50] <hannesw> i think it's easier that way, isn't it?
[10:50] <hannesw> each string is an argument
[10:50] <gmosx> I would expect
[10:50] <gmosx> system("ls -l") to work though...
[10:51] <gmosx> and still system("ls", "-l") didn't work for me (I don't remember the exact error though :()
[10:51] <hannesw> it works for me
[10:52] <gmosx> ok, will check again...
[10:55] <gmosx> i remembered the problem:
[10:55] <gmosx> I am using:
[10:55] <gmosx> exec("rm", "-rf", FS.join("root", "WEB-INF", "packages"));
[10:56] <gmosx> and my app stops responding
[10:56] <gmosx> btw this is a command line app
[10:56] <gmosx> not an appengine application
[10:56] <gmosx> a simple tool...
[10:56] <gmosx> seems like some kind of infinite loop
[10:56] <gmosx> any ideas?
[10:57] <hannesw> what is exec?
[10:57] <gmosx> and btw, I most certainly would expect exec(str) to work
[10:57] <gmosx> exec = require("ringo/subprocess").system
[10:57] <gmosx> i mean system(str) to work
[10:59] <gmosx> this is the code:
[10:59] <gmosx> http://gist.github.com/407365
[11:03] <hannesw> works for me
[11:04] <gmosx> !!
[11:05] <gmosx> it doenst work for me...
[11:06] <gmosx> I get an infinite loop or something, the app does not exit...
[11:07] <gmosx> perhaps this helps: I have the app in the PATH and I am using it on a different directory (to the one the app resides)
[11:10] <hannesw> gmosx can you do a "kill -3 PID" with PID being the ringo process id
[11:10] <hannesw> and post the output somewhere?
[11:11] <gmosx> ok wait a bit...
[11:11] <hannesw> the output from ringo app that is
[11:12] <gmosx> here you are:
[11:12] <gmosx> http://gist.github.com/407383
[11:15] <hannesw> thanks
[11:20] <hannesw> ok, i think i got it
[11:22] <gmosx> whats the problem?
[11:24] <oberhamsi> FYI geo ip lookup package http://bitbucket.org/oberhamsi/geoip/src easiest wrapping i ever did
[11:25] <hannesw> gmosx: the command is not really hanging
[11:26] <gmosx> what happens then?
[11:26] <hannesw> it's just that subprocess spawns threads to read the process output, and these processes are not marked as daemon threads
[11:26] <hannesw> so they prevent ringo from exiting once the script is run.
[11:26] <gmosx> ah...
[11:26] <hannesw> you can just add something like java.lang.System.exit(0);
[11:26] <hannesw> and the script will terminate
[11:26] <gmosx> hmm a better solution? ;-)
[11:27] <gmosx> I don't like to add java.lang.* stuff
[11:27] <hannesw> better solution is to fix it
[11:27] <gmosx> ;-)
[11:27] <hannesw> you can do require("ringo/shell").quit()
[11:27] <gmosx> ok
[11:27] <hannesw> but i think that's actually less likely to stay the same
[11:28] <gmosx> ok, will wait for the fix then...
[11:28] <gmosx> while you are it, maybe you can add support for system(str) too?
[11:29] <gmosx> another thing...
[11:29] <gmosx> can I add to placeholders in Request?
[11:29] <gmosx> request.getParams
[11:29] <gmosx> request.postParams
[11:29] <gmosx> that for the moment return .params
[11:29] <gmosx> and in the future we can implement them?
[11:30] <hannesw> btw, fs.removeTree should do the same as "rm -rf"
[11:30] <hannesw> what do you mean by placeholders?
[11:31] <gmosx> ie, I will add something like
[11:31] <gmosx> Request.prototype.getParams = Request.prototype.params
[11:31] <gmosx> and in the future we can implement them...
[11:31] <gmosx> I can use .getParams now in my app, and will be compatible with the future change...
[11:38] <hannesw> well params is a getter property, and getParams would be a method i guess
[11:38] <hannesw> so simple = won't work
[11:39] <hannesw> but you could use the code from the getter as getParams I guess
[11:39] <hannesw> and Request.prototype.xxx probably won't work because i think Request.prototype === Object.prototype
[11:40] <hannesw> that was required by JSGI 0.2, not sure if it still is for JSGI 0.3
[11:40] <hannesw> single string subprocess is fixed btw
[11:55] <gmosx> thanks for substring...
[11:55] <gmosx> I can use the code from the getter indeed...
[11:55] <gmosx> anw, brb...
[12:54] <oberhamsi> gmosx, did you mean getParams =function or getParams = getter for GET params?
[12:55] <oberhamsi> if the latter we talked about having req.GET and req.POST i think
[12:55] <gmosx> getParams = getter for GET params
[13:29] <hannesw> oberhamsi thinking about refactoring berkeleystore
[13:29] <hannesw> i think you have thought about that, didn't you?
[13:30] <oberhamsi> not about refact
[13:30] <oberhamsi> i just wanted to put cursor access and count in :)
[13:30] <hannesw> ah ok
[13:30] <oberhamsi> but for example.. are you sure we want to index all properties?
[13:31] <hannesw> no, that's one thing i want to change :)
[13:31] <oberhamsi> okay :)
[13:31] <hannesw> also, maybe, multi-property indexes
[13:31] <hannesw> but we have to also use them of course
[13:31] <hannesw> any ideas how to do cursors and count? (well count isn't that hard i guess)
[13:32] <oberhamsi> cursors.. the problem i had with that was
[13:32] <oberhamsi> that i don't know how to close the actual cursors
[13:32] <oberhamsi> i mean: when do i close them. i can't be sure the user might touch the cursor again.
[13:33] <oberhamsi> so user would have to close it itself.. hm good enough i guess
[13:33] <hannesw> right
[13:33] <oberhamsi> what do you want to change/refactor?
[13:34] <hannesw> well i want to implement range queries, sorting (same as googlestore and hibernate)
[13:34] <hannesw> and improve indexing
[13:34] <oberhamsi> range queries +1
[13:35] <hannesw> so basically support offset/limit/orderBy, and do it efficiently
[13:35] <oberhamsi> okay. well. i read the java docs first, then i looked at your hibernate storage
[13:36] <oberhamsi> and i didn't expect it to do so much.. joining cursors, extra indizes, etc
[13:37] <oberhamsi> i'd be content if it does efficient what berkeley does efficient. but some things - sort, offset - are just slow in berkeley
[13:37] <oberhamsi> but i think you have bigger plans ;)
[13:38] <hannesw> well, we'll see
[13:40] <oberhamsi> would be strange to re-add all the relational stuff that berkeley intentionally left out
[13:41] <oberhamsi> e.g.: results are sorted by primary key, maybe sec key. if you use orderBy() it will fall back to js implementation like filestore
[13:41] <hannesw> ok, i see your point
[13:41] <oberhamsi> ok :)
[13:41] <hannesw> still efficient slicing is a must
[13:42] <hannesw> sorting by index might be cheap as well, at least if we als query by that index
[13:42] <oberhamsi> yes that would be range queries i guess
[13:43] <oberhamsi> and using index for sort order would be nice to have.. if our impl understands that and app dev doesn't have to deal with it
[13:44] <hannesw> one idea i'm having is to simply throw an exception for queries where no index exists
[13:45] <hannesw> that way devs are forced to create the indexes they need
[13:45] <oberhamsi> yes, that sounds good.
[13:48] <oberhamsi> btw the jsdoc addition.. if you could take a look. sent pull req
[13:49] <hannesw> ah, good
[13:49] <hannesw> is it working?
[13:49] <oberhamsi> yes
[13:49] <hannesw> stupid question i know, but i just don't understand everything going on here :)
[13:50] <oberhamsi> neither do i. trial & error and lots of testcases
[13:51] <oberhamsi> but works for defineProperties(this) in closure as well as defineProperties(Foo.prototype) ..
[13:58] <oberhamsi> well if you'd just take the lead in berkeley, i'll see what i can help with. at least testing&bugfixes.. i have apps running on berkeley
[14:13] <hannesw> oberhamsi, cool, i will