Ringobot log - RingoJS IRC channel: #ringojs on irc.freenode.net

2010-05-21:

[04:28am] <emilis_info> ringo/httpclient changes encoding for utf-8 POST data strings
[04:41am] <emilis_info> ah... fixed already I will need to update my RingoJS modules
[08:36am] <hannesw_ is now known as hannesw.
[10:13am] <gmosx> hi
[10:15am] <oberhamsi> morning
[10:16am] <gmosx> can I ask a Rhino specific question?
[10:21am] <oberhamsi> you can always try
[10:21am] <gmosx> ok,
[10:22am] <gmosx> is there a way to catch a Java Exception from Javascript and find out the kind of the exception? ie, execute exception handling code conditional to the Java exception class?
[10:22am] <oberhamsi> i'd say that should work
[10:23am] <gmosx> can you give me an example?
[10:23am] <oberhamsi> okay
[10:23am] <oberhamsi> try {} catch (e if e instanceof java.io.IOException) maybe
[10:23am] <? oberhamsi starting shell
[10:24am] <gmosx> hmm
[10:29am] <oberhamsi> doesn't do what you need?
[10:38am] <gmosx> I don't like the java.io part...
[10:38am] <gmosx> I think I will wrap the Java exception with a Javascript exception
[10:39am] <gmosx> btw, have you tested this? does this indeed work?
[10:46am] <oberhamsi> yes, i do that in my code
[10:46am] <gmosx> ok, thanks
[10:47am] <gmosx> so I could use var IOExceptio = java.io.IOException and then e instanceof IOException to hide the java.io part... this works for me
[10:47am] <oberhamsi> yes
[10:47am] <oberhamsi> or you can do importPackage(java.io)
[10:47am] <gmosx> nah, in my case, the js alias works better...
[10:48am] <oberhamsi> ok
[10:49am] <? gmosx a
[10:49am] <? gmosx is adding support for appengine's new OAuth API
[1:01pm] <hannesw> another package idea:
[1:01pm] <hannesw> a crypto package based on google keyczar
[1:01pm] <hannesw> http://code.google.com/p/keyczar/
[1:01pm] <hannesw> including a command line tool for managing keys
[1:48pm] <emilis_info> I need a couple of FIFO queues and a lightweight key->val storage. What would you recommend to use?
[1:48pm] <emilis_info> I want to avoid MySQL, but need to store the data on disk
[1:49pm] <hannesw> emilis_info maybe have a look at berkeleystore,
[1:49pm] <hannesw> although the auto-indexing of all properties is maybe overkill for you
[1:50pm] <emilis_info> hm
[1:51pm] <emilis_info> there is no module for berkeleystore?
[1:51pm] <hannesw> it's a package
[1:52pm] <hannesw> ringo-admin install hns/berkeleystore
[1:52pm] <emilis_info> it will install the files in ringo/modules?
[1:52pm] <hannesw> no, into packages
[1:53pm] <emilis_info> uh oh
[1:55pm] <emilis_info> are packages auto-added to require.paths or do they use some other mechanism?
[1:55pm] <hannesw> they're added automatically
[1:57pm] <gmosx> hannesw> do you use jsdoc conventions for ringo? http://code.google.com/p/jsdoc-toolkit/
[1:57pm] <gmosx> for documentation I mean? or do you use a custom tool?
[1:57pm] <hannesw> gmosx i generally try to
[1:58pm] <hannesw> we have our own jsdoc module and app
[1:58pm] <hannesw> but we try to follow jsdoc tags etc
[1:58pm] <gmosx> good, the closure compilers uses jsdocs as hints, so it would be nice to stay compatible.
[2:01pm] <oberhamsi> oh someone put geoip in the webservices category, that makes no sense, it's no webservice. i put it into tools for now
[2:12pm] <hannesw> cool, didn't know about geoip!
[2:13pm] <robi42> (zumbrunn, fyi> currently no ringobot)
[2:17pm] <hannesw> oberhamsi geoip doesn't work for me
[2:18pm] <hannesw> ah, ok, you Location needs to be called as constructor
[2:18pm] <hannesw> but if you run from somewhere else than the package dir:
[2:18pm] <hannesw> Wrapped java.io.FileNotFoundException> Resource "./db/GeoLiteCity.dat" (No such file or directory) (geoip.js#135)
[2:19pm] <oberhamsi> hannesw, thanks.. fixing
[2:20pm] <hannesw> very impressive!
[2:20pm] <oberhamsi> yeah their db is good for a free one
[2:22pm] <hannesw> how often does is the db updated?
[2:22pm] <oberhamsi> not sure. last update was 1.may, next 1.june
[2:23pm] <oberhamsi> ah monthly, they say so
[2:23pm] <oberhamsi> i asked before and i thought getResources() works with relative paths. and resolves to relative-to-current-module?
[2:24pm] <hannesw> getResource() looks in the module search path
[2:30pm] <hannesw> we need some package-local resource lookup mechanism, eh?
[2:31pm] <oberhamsi> well first time i'd need it.
[2:31pm] <oberhamsi> i'm thinking of just dumping into jar/ and hardcoding that in *java
[2:31pm] <oberhamsi> ^^ as workaround for me right now,
[2:31pm] <hannesw> ? workaround for what, i don't get it
[2:32pm] <oberhamsi> can't figure out how to get it
[2:32pm] <hannesw> module.directory is your friend
[2:32pm] <oberhamsi> !! yes
[2:34pm] <hannesw> fs.join(module.directory, "../db")
[2:35pm] <oberhamsi> yep got it wasn't aware of module.directory
[2:38pm] <hannesw> well we should have something like module.resource(), which was discussed long ago on commonjs
[2:38pm] <hannesw> problem with module.directory is that it works with files only
[2:39pm] <zumbrunn> robi42> regarding the missing ringobot... thank you for pointing it out
[2:39pm] <hannesw> so not sure this would run on app engine, for example
[2:39pm] <zumbrunn> I'll get it back and jug its memory
[2:39pm] <oberhamsi> what doe y ou mean "works with files only" ?
[2:39pm] <hannesw> e.g. app engine works with webapp resources
[2:40pm] <hannesw> resource.path() currently doesn't return a valid file path there
[2:40pm] <hannesw> which is what module.directory uses internally
[2:40pm] <oberhamsi> okay i see
[2:41pm] <oberhamsi> don't use appengine myself
[2:41pm] <hannesw> added a ticket
[2:41pm] <hannesw> http://github.com/ringo/ringojs/issues/issue/66
[2:44pm] <oberhamsi> thanks. would also be nice for e.g. default db directories in apps
[2:44pm] <hannesw> yeps
[4:10pm] <hannesw_> deep httpserver API refactoring again... starting to see the light
[4:19pm] <earl> that's great
[4:25pm] <hannesw_> problem is it wasn't possible to add servlets to an existing web app context
[4:25pm] <hannesw_> so if i added cometd servlet at /cometd, it had a different session manager, or none == not good
[4:26pm] <hannesw_> now i make getContext(path, virtualHosts) a public method, and server has a root/default context
[4:27pm] <hannesw_> so you can either map jsgi apps, static content, servlets to the server directly (its default/root context)
[4:27pm] <hannesw_> or to any context you create/get
[4:27pm] <hannesw_> e.g.:
[4:27pm] <hannesw_> server.getContext(mountpoint).serveApplication({config> "ride/config", app> "app"});
[4:28pm] <hannesw_> makes sense?
[4:35pm] <earl> sounds good, yes
[4:48pm] <robi42> what was the question? (bot log on ringojs.org still down)
[4:50pm] <hannesw_> robi42 http://ringojs.pastebin.com/HZXYPaDE
[4:51pm] <robi42> thanks, sounds good indeed
[16:14] <zumbrunn> ok, logs are up-to-date again and ringobot is back in here
[16:17] <ringostarr> d70f286 Hannes Walln?fer: Make shell autocompletion a bit more enjoyable by only showing enumerable properties if there are any
[16:17] <ringostarr> 19aae64 Hannes Walln?fer: Make it possible to create a Session object directly from a ServletRequest
[16:17] <ringostarr> 26d1b42 Hannes Walln?fer: Refactor ringo/httpserver API adding Context class
[16:18] <hannesw_> ok, pushed new httpserver API
[16:19] <hannesw_> http://ringojs.org/api/master/ringo/httpserver
[16:19] <hannesw_> let me know what you think.
[16:23] <earl> mhm mhm, looks good
[16:24] <earl> so if you don't care about vhosts, you'd typically do server.getDefaultContext().addApplication(...)
[16:24] <hannesw_> yes
[16:24] <hannesw_> one thing i still dislike is that you need a separate context for static file serving
[16:25] <hannesw_> but jetty's resource handlers/servlets just don't let me do it any other way
[16:25] <earl> moduleName and functionName rocks, btw. nice naming :)
[16:25] <hannesw_> hm?
[16:25] <earl> getContext is called getContext because there can be contexts pre-defined in jetty's xml?
[16:26] <hannesw_> hm???
[16:26] <earl> :)
[16:26] <earl> k, first
[16:26] <earl> in your example above, you had a jsgi app as {config:, app:}
[16:26] <gmosx> maybe you should switch modulename/functioname to config/app as in the configuration parameters
[16:26] <hannesw_> context is called context, because... i think it's a good name
[16:26] <earl> in the docs, it's {moduleName:, functionName:}
[16:27] <hannesw_> aren't they already?
[16:27] <earl> i really prefer moduleName/functionName over config/app
[16:27] <gmosx> { moduleName: 'config', functionName: 'app' }
[16:27] <gmosx> earl: yeah I don't like config/app either...
[16:28] <gmosx> on second thought, module-name, function-name were better
[16:28] <earl> k :)
[16:28] <earl> second, getContext
[16:28] <hannesw_> oh, that's just a mistake
[16:29] <earl> ok, forget the getContext remark
[16:31] <ringostarr> 15ae9d1 Hannes Walln?fer: Update moduleName/functionName to config/app in jsdoc.
[16:31] <earl> ok, it seems that the mistake in the docs, where in the code it's actually config/app
[16:31] <hannesw_> the problem with moduleName/functionName is that it's just too verbose
[16:31] <earl> then call it module/function :)
[16:31] <earl> config is so extremely ringo specific
[16:31] <hannesw_> function is a reserved word
[16:31] <gmosx> earl: nice ;-)
[16:31] <earl> module/app
[16:32] <gmosx> anw
[16:32] <gmosx> i guess config/app is ok...
[16:35] <earl> kinda awkward for non-ringo/webapp frameworks built on top of ringo/httpserver, but well :)
[16:42] <earl> i've been working on restructuring our dist packaging (i.e. creation of tgz, zip, deb)
[16:43] <earl> the commit message of http://github.com/earl/ringojs/commit/d62c96 explains the goals and current state, if anyone's interested
[16:53] <ccwu> Hello, my full name is Cheng-Chang Wu
[16:53] <ccwu> Thanks;)
[17:05] <hannesw_> thanks ccwu
[17:05] <hannesw_> earl: dist branch looks good
[17:17] <earl> i know it's quite a bit of added complexity, but i it's worth it to make dist bundling easier
[17:18] <ringostarr> 1eeba54 Hannes Walln?fer: Fix --help, reenable --virtual-host in ringo/webapp main script
[17:18] <hannesw_> what adds complexity? the explicit picking of files/dirs i suppose
[17:20] <earl> well, mostly the makefile, i think
[17:20] <hannesw_> ah, haven't looked at that
[17:21] <earl> allows us much better control over the bundling process
[17:21] <earl> but is one additional technology needed
[17:21] <earl> also, i'm using rsync internally, so whoever does the packaging, needs that installed as well
[17:25] <gmosx> hannesw_?
[17:25] <hannesw_> yes?
[17:25] <gmosx> hannesw_: there seems to be a strange bug in the module loader
[17:25] <gmosx> I *think*
[17:26] <gmosx> if there are two modules, one for example in /api.je
[17:26] <gmosx> in /api.js
[17:26] <gmosx> and one in /a/deeper/path/api.js
[17:26] <gmosx> the second module is not loaded or something...
[17:26] <gmosx> very strange...
[17:27] <hannesw_> what's the module path, and what module ids are you using?
[17:30] <gmosx> oops my mistake...
[17:31] <gmosx> there was another /a/deeper/path/api.js in the path
[17:31] <gmosx> sorry
[17:31] <hannesw_> ok :)
[17:31] <hannesw_> np
[17:57] <ringostarr> 942f5f0 Hannes Walln?fer: minor
[19:09] <`earl> heck, this webirc thang seems to work fine :)
[21:31] <earl> hannesw_: you around?
[21:32] <hannesw_> jo
[21:33] <earl> easiest way to start a separate thread in ringo?
[21:33] <hannesw_> spawn(function() {})
[21:33] <hannesw_> very optimized, uses thread pool
[21:33] <earl> thanks, just couldn't find it :)
[21:34] <earl> i want to start a long-running thread next to a webapp
[21:34] <hannesw_> we need to document globals...
[21:34] <earl> how would i hook into the webapp?
[21:35] <earl> w/ an extension of course!, ha :)
[21:35] <hannesw_> what do you mean?
[21:35] <hannesw_> yep
[21:41] <earl> i think we need to find a nice way to reunite webapps and packages, eventually
[21:53] <earl> testing, 1, 2, 3, test
[21:54] * earl jumps up
[21:55] * earl comes down
[21:55] <earl> ...
[21:57] <earl> (sorry for the noise ...(
[21:57] <earl> ))
[22:25] <earl> ringo-cometd nicely bundles the webapp as app/ in the commonjs package
[22:45] <earl> destructuring assignment rocks so hard :)
[22:45] <earl> if we really need a unique selling point against node.js, it surely is destructuring assignment :)
[22:48] <earl> `for each (var {id, author, message} in commits) {...}` -- beautiful