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

2010-06-04:

[08:33] <hannesw> i just saw (to my own surprise) ringo-admin install already takes a -p/--packages option to install in a directory other than ringojs/packages
[08:34] <hannesw> seems like i even wrote that myself
[08:34] <hannesw> i think -p/--packages is not a good name, would prefer -d/--directory
[08:34] <hannesw> thoughts?
[09:44] <hannesw> gmosx i think you asked for this> ringo-admin install already has a target directory option
[09:45] <gmosx> what is the option?
[09:45] <hannesw> ringo-admin install -p/--packages DIR
[09:45] <hannesw> i think
[09:45] <hannesw> but i'd like to rename it -d/--directory
[09:45] <hannesw> had forgotten about it
[09:45] <gmosx> ah ok... will check this out, thanks...
[09:45] <gmosx> btw, I have patched narwhal-lib's assert/test files to be compatible with Ringo.
[09:46] <gmosx> so one can run commonjs compliant tests with ringo (using narwhal-libs implementation)
[09:46] <hannesw> cool!
[09:46] <gmosx> another thing> quite incredibly, ringo runs out of the box on Windows !
[09:47] <hannesw> he
[09:47] <hannesw> that's not incredible, that's the way it's supposed to be
[09:47] <gmosx> was incredible to me
[09:48] <hannesw> well it's java after all.
[09:51] <gmosx> yeah...
[10:12] <gmosx> hannesw> can you remind me something? how can I add a .jar to a command line Ringo app?
[10:12] <hannesw> addToClasspath("...")
[10:13] <hannesw> or just throw it anywhere into lib/
[10:16] <gmosx> where should I put addToClasspath ?
[10:17] <gmosx> ah found it in the docs...
[10:17] <gmosx> magic
[10:29] <rist_> hi - I'm a bit confused about th scope of functions of a JS object
[10:30] <rist_> I have this object
[10:30] <rist_> function Store(host, port, dbName, options) {
[10:30] <rist_> this.defineEntity = function(type) {...}
[10:30] <rist_> this.save = function(props, entity, entities) {..}
[10:30] <rist_> }
[10:30] <rist_> when trying to use this as store I get> "Wrapped java.lang.RuntimeException> Store does not implement 'save' method"
[10:30] <rist_> but I do expose a save() method - don't i?
[10:31] <hannesw> depends on how you call Store() - with or without new keyword
[10:31] <rist_> var store = new Store('localhost', 27017, "rist");
[10:32] <rist_> If I do:
[10:32] <rist_> for(var s in store){
[10:32] <rist_> log.info(s);
[10:32] <rist_> }
[10:32] <rist_> I get "defineEntity" and "save"
[10:32] <hannesw> and store.save shows the function?
[10:33] <hannesw> then store.save() should invoke it
[10:33] <rist_> yes store.save returns my funciton
[10:33] <rist_> mm another thing I do not really understand (just copy&pasted it) - var {Store} = require('ringo/storage/mongodbstorage');
[10:34] <rist_> why {Store} (why the curly braces)
[10:35] <hannesw> that's JS 1.8 destructuring assignment shortcut
[10:35] <hannesw> same as:
[10:35] <hannesw> var Store = require(...).Store;
[10:35] <hannesw> (so you spare yourself typeing one "Store")
[10:35] <rist_> ah
[10:36] <hannesw> ok, about the error message you get:
[10:36] <hannesw> what object do you pass to Storable.defineEntity() as first argument?
[10:36] <hannesw> that's the JS object that needs to have the save() function, and that's where your exception comes from
[10:36] <rist_> self
[10:37] <hannesw> this first argument must be something that basically implements this interface:
[10:37] <hannesw> var proxy = {
[10:37] <hannesw> all> all,
[10:37] <hannesw> get> get,
[10:37] <hannesw> query> query,
[10:37] <hannesw> create> create,
[10:37] <hannesw> save> save,
[10:37] <hannesw> remove> remove,
[10:37] <hannesw> getEntity> getEntity,
[10:37] <hannesw> getKey> getKey,
[10:37] <hannesw> getProperties> getProperties,
[10:37] <hannesw> getId> getId,
[10:37] <hannesw> equalKeys> equalKeys
[10:37] <hannesw> };
[10:37] <rist_> ah - self was undefined
[10:37] <hannesw> or this> http://ringojs.org/wiki/Store_API/
[10:37] <rist_> now I added "var self = this;"
[10:38] <hannesw> i guess we could do more aggressive error checking
[10:38] <rist_> so - save seems to work now
[10:38] <hannesw:
[10:38] <hannesw> cool
[10:38] <rist_> on to the next unimplemented method
[10:40] <gmosx> hannesw> should we add a 'process' module to be compatible with node.js?
[10:40] <gmosx> I would like to have something like
[10:40] <gmosx> process.exit() for example
[10:41] <gmosx> (but *not* make it a built in module)
[10:41] <hannesw> +1 for having an exit() somewhere
[10:41] <hannesw> we currently have ringo/shell.quit() i think
[10:41] <hannesw> but -1 for trying to follow node.js
[10:42] <gmosx> ok
[10:42] <hannesw> except if it's easy - e.g. not introducing a new top level module
[10:42] <gmosx> how about having OS.exit() (follow narwhal)
[10:42] <gmosx> no we should not introduce a buit in module...
[10:42] <hannesw> if possible i think we shouldn't do top level, non-namespaced modules
[10:42] <gmosx> hmm...
[10:42] <gmosx> ok
[11:05] <gmosx> hannesw> is there a problem if I call addToClasspath() multiple times with the same jar?
[11:26] <hannesw> gmosx no, shouldn't be a problem
[11:26] <hannesw> earl, i'm merging your packages branch to mainline
[11:26] <hannesw> ok with that?
[11:28] <gmosx> what is the packages branch?
[11:28] <hannesw> it'll make it easier to load packages from various locations
[11:28] <hannesw> such as having packages per web app
[11:28] <hannesw> or other apps
[11:29] <ringostarr> cd7a446 Hannes Walln?fer> Merge remote branch 'earl/packages'
[11:29] <ringostarr> 82bfc77 Hannes Walln?fer> Various fixes and enhancements to ringo/scheduler:
[11:52] <gmosx> ni
[11:52] <gmosx> nice
[11:52] <gmosx> hannesw> is there way to read an ENV variable?
[12:28] <robi42> gmosx, example> `>> require('system').env.JAVA_HOME`
[12:30] <robi42> (given `$JAVA_HOME`'s defined)
[12:34] <robi42> (ah, and `system`'s available globally by default, so simply `>> system.env` works as well)
[12:38] <rist_> is there any documentation of the query object in the wiki?
[12:38] <robi42> rist_, not yet
[12:38] <robi42> the query api is basically work in progress
[12:39] <rist_> so I'll inspire myself with the stuff I find in the googlestore code
[12:39] <robi42> right, that's the way to go
[12:40] <robi42> btw, maybe what's currently in hibernate storage package's even slightly ahead
[12:40] <robi42> (in respect to query api impl)
[13:46] <? gmosx loves addToClasspath()
[13:46] <gmosx> Ringo is so much more developer friendly than narwhal...
[14:05] <rist_> a philosophical question - how should I call my mongodb package? - there's already another mongodb package (just a wrapper around the mongodb driver) - should I call it mongodbstorage?
[14:08] <hannesw> i tend to call my db packages [name]store
[14:08] <hannesw> so probably mongostore
[14:08] <hannesw> but it's up to you of course
[14:10] <rist_> mongostore it is then
[14:11] <rist_> mm - or better mongodbstore
[14:20] <rist_> http://github.com/rist/mongodbstore
[14:20] <You left the chat by being disconnected from the server.
[14:20] <You rejoined the room.
[14:26] <robi42> awesome
[14:29] <rist_> es rennen im moment die simplen store tests (die vom berkelystore) durch
[14:29] <rist_> bei den query tests gibts no probleme mit den dates - die serialisier ich offenbar no falsch
[14:32] <rist_> bzw. im moment gar nit (da wird glaub ich einfach implizit die toString() aufgerufen
[14:38] <robi42> sind etwaige patches willkommen?
[14:40] <rist_> t?rlich!
[14:40] <rist_> #
[14:41] <robi42> wunderful
[14:41] <rist_> sorry - for writing in German
[14:42] <rist_> to repeat - I took the storage tests from the berkelydb storage layer and all it's basic tests run through - only date serialization seems to be broken currently
[14:43] <hannesw> rist_, cool!
[14:59] <earl> hannesw: thanks for merging packages
[14:59] <hannesw> earl thanks for improving
[14:46] <earl> hannesw: i think the manual check in setInterval if a previous invocation is running is redundant
[14:47] <hannesw> is it?
[14:47] <hannesw> it's possible. if you're sure feel free to remove it
[14:47] <earl> ScheduledThreadPoolExecutor.scheduleAtFixedRate ensures that no two commands execute concurrently
[14:47] <earl> ok, will do
[14:48] <hannesw> where does it say this?
[14:48] <earl> http://java.sun.com/javase/6/docs/api/java/util/concurrent/ScheduledExecutorService.html#scheduleAtFixedRate(java.lang.Runnable, long, long, java.util.concurrent.TimeUnit)
[14:48] <earl> "If any execution of this task takes longer than its period, then subsequent executions may start late, but will not concurrently execute."
[14:48] <hannesw> ah ok, didn't read that
[14:49] <hannesw> cool
[16:29] <ringostarr> 15bf909 Andreas Bolka: Partly revert 82bfc77
[17:16] <ringostarr> 2f76082 Andreas Bolka: Reformat
[23:42] <oravecz> has anyone tried to use a different template library (other than skin)?
[23:46] <oravecz> or does the skinning approach support conditionals?
[23:55] <hannesw_> oravecz, yes skin supports conditionals
[23:55] <oravecz> any docs on that?
[23:56] <hannesw_> i'm afraid no
[23:57] <oravecz> examples or just code?
[23:57] <hannesw_> <% if <% xxx %> yyy %>
[23:57] <hannesw_> where xxx and yyy are any macros or expressions
[23:58] <oravecz> ok, thx
[23:58] <oravecz> i was looking at moustache since it looks like it can act as a commonJS package and it allows functions to be passed and executed before rendering. But it doesn't support dor '.' notations!?
[23:58] <oravecz> http://github.com/janl/mustache.js
[23:58] <hannesw_> not sure, i tried mustache once but don't remember any specifics
[23:59] <oravecz> it seems to be the fastest and most full featured of the libraries mentioned here: http://www.viget.com/extend/benchmarking-javascript-templating-libraries/
[23:59] <hannesw_> interesting