Hopbot log for 2008-10-01 - Helma IRC channel: #helma on irc.freenode.net

2008-10-01:

[9:41] <hannesw> I just committed __iterator__ support for helma.file.File objects
[9:41] <hannesw> http://dev.helma.org/trac/helma/browser/helma-ng/trunk/modules/helma/file.js?rev=#L747
[9:42] <hannesw> I think it rocks!
[9:42] <hannesw> You can now loop through the lines of a file using a for-in loop
[9:42] <hannesw> or the contained file names if the file is a directory
[9:43] <zumbrunn> sweet!
[11:12] <simono> very nice
[11:17] <hannesw> just committed another new feature: read() and readln() methods in shell
[11:17] <hannesw> so it should be possible to write interactive scripts now
[11:17] <hannesw> var name = readln("Enter your name: ");
[11:17] <hannesw> var pw = readln("Enter password: ", "*");
[11:18] <hannesw> Now if only I could start working on the bugs for the 0.3 release :-)
[14:04] <leefaus> hello all
[14:04] <leefaus> i am looking to use helma to call to a server that provides a RESTful service that returns JSON objects.
[14:04] <leefaus> 1) Is this possible
[14:05] <leefaus> 2) Is there a way to convert a JSON object to a HOP?
[14:05] <leefaus> i may be mixing terms. i am a noob
[14:37] <zumbrunn> leefaus: 1) yes, it is possible
[14:37] <zumbrunn> 2) is possibel as well, but a bit trickier, since hop objects in helma 1.x by default can't have properties that are arrays or objects
[14:38] <zumbrunn> so, you need to do some custom serializing and deserializing to make that work
[14:40] <zumbrunn> (to be precise, hop objects can have such properties, but they are not persisted by default)
[14:51] <leefaus> i am looking over the couchdb scripts that are very similar to my needs.
[14:51] <leefaus> this looks very promising.
[14:51] <leefaus> thanks
[17:30] <leefaus> i have a working prototype using Helma. Very nice framework.
[17:30] <leefaus> i created a new repository called surf.
[17:30] <leefaus> inside of surf, I have a folder called Root
[17:31] <leefaus> so now I can call http://localhost:8080/surf
[17:31] <leefaus> i have an action called example.js
[17:35] <zumbrunn> you mean a function called example_action or an example.hac file, I assume?
[17:42] <leefaus> so now I can access http://localhost:8080/surf/example
[17:42] <leefaus> what i want to do is subcomponent this
[17:42] <leefaus> surf/page/example
[17:42] <leefaus> surf/component/example
[17:42] <leefaus> how do I do that?
[17:43] <leefaus> i tried just creating a directory and that didn't work
[17:43] <leefaus> do i need to create additional repos?
[17:44] <decke> helma does not use the filesystem to map the URIs
[17:45] <decke> instead you build collections and references in your objects
[17:45] <decke> it's like a really big tree of objects
[17:45] <leefaus> root.page.example?
[17:45] <decke> what should page mean?
[17:46] <leefaus> page is an object that is made up of many components
[17:46] <leefaus> a site is made up of many pages
[17:46] <decke> no that objects are all HopObjects
[17:47] <decke> and yes if you create a Prototype called Page
[17:47] <decke> you could have Root.pages.entries.comments.whatever
[17:47] <leefaus> ok.
[17:48] <leefaus> let me try that.
[17:48] <decke> http://helma.zumbrunn.com/intro/hopobjects
[17:48] <decke> each object can have children that are made of a collection of other objects
[17:49] <leefaus> site -> * pages -> * components
[17:49] <leefaus> correct?
[17:49] <leefaus> then i should be able to do surf/site and this give the Root.site object
[17:50] <leefaus> so i can access pages from there
[17:51] <leefaus> that is what i understand from the docs
[18:06] <leefaus> so if I understand correctly, I create a new folder called Sites at the same level as Root
[18:06] <leefaus> inside of Site, i create a file called type.properties
[18:06] <leefaus> what if this is not mapped to a database?
[18:06] <leefaus> how do I define the type.properties file?
[18:42] <leefaus> ok, so I am getting closer
[18:42] <leefaus> in my Root/type.properties I have sites = collection(Site)
[18:42] <leefaus> i can now access http://localhost:8080/surf/sites
[18:43] <leefaus> i get an error on this page that tells me the action is not configured.
[18:43] <leefaus> what does this mean?
[18:46] <_daniel_> as you didn't explicitly append an action to your url, helma tries to call the default action, namely main. it seems that your Site prototype does not provide a main action (i.e. a function called main_action)
[18:48] <_daniel_> put a main.hac file in your Site prototype's folder or define a main_action function in any js file of your Site prototype's folder.
[18:49] <_daniel_> now that i hopefully answered a question, i feel free to ask one myself (-; is there a way to find who is the caller of a function (even or especially if the caller is the Java context)?
[18:53] <leefaus> _daniel_: i tried as you explained, still action not found
[18:56] <_daniel_> well, blame me, i didn't see that your url was not complete.
[18:56] <_daniel_> http://localhost:8080/surf/ would look for a main action in the Root prototype
[18:56] <leefaus> that is correct.
[18:56] <leefaus> that works
[18:57] <_daniel_> http://localhost:8080/surf/sites would look for a main action in the HopObject prototype, because you defined sites to be a virtual collection of Site objects
[18:57] <_daniel_> virtual collections are represented as HopObject objects
[18:57] <_daniel_> you need to append an id to your url to access a Site instance
[18:58] <_daniel_> http://localhost:8080/surf/sites/1 would then look for a main action in the Site prototype
[18:58] <leefaus> what if there are no instances yet?
[18:58] <leefaus> if i put 1 on the end I get Object not found
[18:58] <_daniel_> well if there are no instances yet, http://localhost:8080/surf/sites points to a virtual HopObject object with a size of 0
[18:59] <_daniel_> because the instance with the id 1 does not exist yet
[18:59] * leefaus confused...
[18:59] <leefaus> so how do i get the main.hac inside of sites to work without any objects yet.
[19:02] <_daniel_> by placing it into the HopObject's folder
[19:02] <_daniel_> but usually you would not want to do this, as the action would then be callable on any object, as all objects extend HopObjects
[19:03] <leefaus> correct. so what is the correct way?
[19:03] <_daniel_> what you really want to do is to place an action into the Root prototype
[19:03] <_daniel_> what do you want the action to do? list all the Site objects?
[19:03] <_daniel_> call it listSites.hac in the Root prototype
[19:03] <leefaus> correct.
[19:05] <_daniel_> of if you feel like this should be the default behaviour for http://localhost:8080/surf/ call it main.hac in the Root prototype's folder
[19:06] <leefaus> i see where this is headed. ok.
[19:09] <_daniel_> so to sum it up: when you want to create actions for collections, place them in the collection's parent
[19:15] <leefaus> so the create_site action and skin should be in Root
[19:16] <_daniel_> yes
[19:18] <leefaus> that is kind of counter intuitive. create site is in root, but edit/delete/read are in Site
[19:22] <_daniel_> yes and no. try to see it that way: create_site is in the Root prototype because it operates on Root objects (i.e. the one and only Root objects) as it adds new Site objects to the Root object
[19:22] <_daniel_> edit/delete/read are in the Site prototype because they operate on Site objects
[19:23] <leefaus> i would argue from that statement that I am creating a site, not sites.
[19:24] <leefaus> the goal would be to have something like Site/crud.js
[19:24] <_daniel_> agreed, one site per call, but still you change the root object as the site objects are persisted to the database by adding it to the root object
[19:26] <leefaus> I thought that Root inherited from HopObject? If I am creating a new HopObject, why is it associated with root?
[19:27] <leefaus> should I be putting the Site information into the HopObject type.properties?
[19:27] <_daniel_> no.
[19:27] <_daniel_> the Site information is absolutly perfect in the Site's type.properties
[19:28] <_daniel_> and yes, all prototypes including the Root prototype inherit from HopObject
[19:28] <leefaus> I am saying that the sites = collection(Site) should be in HopObject
[19:29] <_daniel_> ah ok, sorry.
[19:29] <leefaus> would that allow me to push the create into the Site folder?
[19:29] <_daniel_> no, the sites = collection(Site) needs to be in the Root prototype's type.properties
[19:29] <leefaus> yuck.
[19:31] <_daniel_> nope, the create site needs to be outside of Site, in any case.
[19:31] <_daniel_> this is because of how the url is parsed.
[19:32] <_daniel_> as long as you do not have any instance of Site http://localhost:8080/surf is the only object you can access
[19:33] <_daniel_> http://localhost:8080/surf/sites points to the root object of prototype Root, so in any case, the action which creates new Site objects needs to be in the Root prototype
[19:33] <mindlike> anyone have any experience getting helma running with an applet?
[19:34] <_daniel_> i am sorry, this one is correct:
[19:34] <_daniel_> http://localhost:8080/surf points to the root object of prototype Root, so in any case, the action which creates new Site objects needs to be in the Root prototype
[19:35] <_daniel_> with the sites it either points to the virtual collection object for your (future) Site objects which is of the generic prototype HopObject or to an action sites in the Root prototype, if defined
[19:35] <leefaus> i guess seeing how Rails and Django do it, i am familiar with that way and it makes sense to me.
[19:35] <leefaus> this is kind of odd because it is kind of RESTful which I really like about it, but now it does not.
[19:36] <leefaus> seem possible to follow the type REST conventions
[19:37] <_daniel_> so, do i understand you right, that what you do not like is to have the create action outside the Site prototype?
[19:38] <leefaus> i don't want to have to create an additional js/hac file just for the creates
[19:39] <leefaus> there will be about 15 objects off of Root
[19:39] <leefaus> alot of duplication of code whereby the create/edit functionality will be very similar.
[19:40] <leefaus> now will need to be in separate files
[19:40] <_daniel_> again, yes and no. lets say you have defined your edit form in Site/edit.skin
[19:41] <_daniel_> and the action Site/edit.hac handles editing of Site objects
[19:41] <_daniel_> you can still reuse the skin and the code in the create action
[19:41] <_daniel_> lets assume you have Root/createSite.hac
[19:42] <_daniel_> if want to have the same form rendered as for editing, you can do that
[19:42] <_daniel_> var site = new Site(); site.renderSkin("edit");
[19:42] <_daniel_> if you want the same code for creating the site as you would have for editing an existing site, you can do that in Root/createSite.hac
[19:43] <_daniel_> site.edit_action();
[19:43] <_daniel_> and once your done you add it to the collection you've defined in Root/type.properties
[19:43] <_daniel_> root.sites.add(site);
[19:44] <leefaus> ok.
[19:44] <leefaus> I will try that path.
[19:45] <_daniel_> you only need to make sure that the form you use for editing does not have a fixed static action="" attribute
[19:45] <_daniel_> in fact an empty one like i wrote it action="" would work for creating as well as for editing
[19:46] <_daniel_> and if you want to have as little code as possible in the Root/createSite.hac
[19:46] <_daniel_> put only the following in Root/createSite.hac:
[19:47] <_daniel_> new Site().createSite();
[19:47] <_daniel_> and put all and everything into Site/createSite.hac
[19:47] <leefaus> ;) that was exactly the code I started writing. hehehe
[19:48] <_daniel_> (-:
[19:49] <decke> mindlike: talking with an applet or IN an applet? no i haven't tried either but the first shouldn't be that hard
[19:56] <_daniel_> according to http://java.sun.com/sfaq/#prevent i'd say the second is possible, if using a signed applet
[19:57] <_daniel_> for a non-signed applet you'd need to rewrite helma to not rely on accessing the file system
[20:11] <leefaus> can I do this in a skin: <% root.sites.size() %>
[20:15] <mindlike> decke what about the latter?
[20:15] <mindlike> and what makes it hard potentially
[20:15] <mindlike> they're both just loading into a jvm right?
[20:16] <mindlike> and an applet can be parameterized the same way the start script operates i presume, but i'm not a java hacker
[20:17] <decke> haven't thought about the latter yet ... what do you want to do with it?
[20:20] <mindlike> create an inbrowser proxy for ajax / flex apps
[20:20] <mindlike> to use helma and use it as a proxy for other functionality like network, file io, that only an air app (minus network) might achieve otherwise.
[20:21] <mindlike> its a synthetic project I have in mind
[20:21] <decke> sounds interesting...
[20:21] <mindlike> yeah right now you have to click on your os, unarchive, run start script
[20:22] <mindlike> and you've essentially done what I believe an applet could do
[20:22] <mindlike> but i'm not a java engineer
[20:24] <mindlike> you tie that in .. kinda like trim path junction did, with some application samples.. and you have a good candidate for trunk or merge
[20:24] <mindlike> er branch or merge
[20:24] <mindlike> well its probably a lot of work anyway
[20:25] <mindlike> but something i'm peronsally interested in trying to do with a good lean framework .. plus if the plan is to port jala modules up to ng
[20:25] <mindlike> and if you guys know of ways to make ng super lean.. then it could work
[20:25] <mindlike> in my mind
[20:26] <decke> that is hannes part and i guess he will do his best ...
[20:26] <mindlike> i'm just trying to get helma-ng running in eclipse at the moment
[20:26] <mindlike> anyone know how?
[20:27] <mindlike> is that documented anywhere?
[20:27] <decke> i'm only using helma 1.x up to now...
[20:27] <mindlike> in eclipse tho?
[20:28] <decke> yeah
[20:28] <mindlike> you know what else would be cool, a helma/drupal module/orm
[20:29] <decke> why that?
[20:29] <mindlike> because its a widely used cms here in los angeles
[20:29] <mindlike> and around the world I think
[20:29] <mindlike> but i'm biased
[20:29] <mindlike> but good question, why.. aren't they kind of competitors?
[20:29] <leefaus> so I work for Alfresco. we are looking to use Helma as our WebModule for our CMS product.
[20:30] <decke> but drupal is php isn't it?
[20:30] <mindlike> yea
[20:30] <mindlike> huge user base
[20:30] <leefaus> Alfresco is Java.
[20:30] <leefaus> LA Times is using us in the LA area.
[20:30] <mindlike> oh nice
[20:31] <mindlike> for their main site?
[20:31] <leefaus> yupp
[20:31] <mindlike> we built all of wbr.com's artist sites for past two years with drupal
[20:31] <decke> sorry but i don't see benefit from supporting a different orm
[20:31] <mindlike> http://blackrimglasses.com/archives/2008/04/15/philosophy-and-sites/
[20:31] <leefaus> so is Fox (House, Fringe, Bones) and EA
[20:31] <decke> and i think helma's orm should be flexible enough to access drupal databases
[20:31] <mindlike> and at my last company beta.lp33.tv beta/beta i made a flex media player and used drupal on the backend
[20:31] <decke> but i am not sure how caching would affecct that al
[20:32] <mindlike> so i'm thinking helma and drupal aren't muturally exclusive if you port it to my idea
[20:32] <mindlike> otherwise if its isolated to server-side uses only it'll more likely compete since they deal with content and node abstraction
[20:35] <decke> yes but that is already possible i think - at least i see no reason why it shouldn't work from a technical point ...
[20:36] <leefaus> how do i execute methods on HopObjects inside of the view. Things like root.size()?
[20:36] <mindlike> was I correct about needing a signed cert.. and thats trivial no?
[20:36] <leefaus> view/skin
[20:37] <decke> leefaus: you can only use macros ... like <% this.heyho %> which is implemented like an action but with _macro instead
[20:38] <decke> so for heyho macro you create function heyho_macro() { return this.whatever; }
[20:39] <leefaus> that seems kind of silly for little things.
[20:39] <decke> yeah but it seperates template and logic
[20:41] <mindlike> ok someone analyze this and throw me their best bet
[20:41] <mindlike> http://higgs.tachy0n.com/static/applet.html
[20:41] <decke> it's late here in europe... i have to get some sleep
[20:42] <decke> good luck... and i'm sure zumbrunn will be interested in that...
[20:42] <mindlike> oh yes I need to make a class wrapper for it
[20:42] <mindlike> which i saw an example doing with jar libs somewhere else
[20:42] <mindlike> yeah when is zum on?
[20:43] <leefaus> where does the macro get defined?
[20:43] <decke> he will get some sleep too i think ... tomorrow morning maybe... some of us are located in central europe
[20:44] <leefaus> NM, forgot the _macro
[20:44] <decke> leefaus: everywhere... for global macros you can use Global
[20:44] <decke> okay good luck then
[21:00] <bard> is there any helma-ng app already in the wild?
[21:45] <hannesw> bard: I don't think so.
[21:45] <hannesw> Helma ng is moving pretty fast
[21:46] <hannesw> there's the hibernate-blog app which is part of Robert Thurnher's hibernate branch:
[21:46] <hannesw> http://github.com/robi42/helma-ng/tree/hibernate/apps/hibernate-blog

 

 

In the channel now:

Logs by date: