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

2008-09-01:

[16:21] <hamen> hi all
[16:22] <zumbrunn_> hi hamen
[16:22] <hamen> i began with helma today :) pretty funn
[16:22] <zumbrunn_> :-)
[16:22] <hamen> i make the addressbook tutorial
[16:22] <hamen> i'm trying to improve it
[16:23] <hamen> it's just a curiosity but "is there a way to create a link to homepage?"
[16:24] <hamen> i mean... without use a absolute path; just "link to home" and it figures out how to do it, as in RoR
[16:24] <zumbrunn> root.href()
[16:25] <hamen> <a href="<% root.href() %>">Home</a> ?
[16:25] <zumbrunn> no, it's js, not a macro
[16:26] <zumbrunn> but you could write a macro that returns root.href()
[16:27] <zumbrunn> home_macro = function(){return root.href()}
[16:27] <zumbrunn> and then use <a href="<% home %>">Home</a>
[16:28] <hamen> uhmm... ok. i try to add it to Root/macros.js
[16:29] <zumbrunn> you would need it in the prototype for which you are rendering the skin
[16:29] <zumbrunn> not in the Root prototype
[16:30] <zumbrunn> since most likely, you are not on the root/home page when you want to generate a link like that, right?
[16:30] <hamen> i want such a navigation bar. home link must be present on every page
[16:30] <zumbrunn> so, in HopObject/macros.js for example
[16:31] <hamen> i mean... as general template same for every page
[16:35] <hamen> cute. i got it. i put it in Global/macros.js and the link in Global/html.skin. it works
[16:35] <hamen> thank you :)
[16:36] <zumbrunn> yeah, with that syntax we used, it would have to be in Global/macros.js anyway
[16:36] <zumbrunn> otherwise the correct syntax would need to be <a href="<% this.home %>">Home</a>
[16:38] <zumbrunn> (only global macros do not need the "this." prefix)
[16:38] <hamen> uhmm... it broke it: Object not found. [Unhandled Macro: this.home]
[16:39] <zumbrunn> if you use "this.home" you need to have the macro inside a prototype
[16:39] <zumbrunn> like HopObject
[16:39] <zumbrunn> not in Global
[16:40] <hamen> what kind of solution, u suggest? i'm at beginning and wanna start "with right foot"
[16:42] <zumbrunn> often, using macros specific to one prototype is cleaner from the point of view of the code structure
[16:42] <zumbrunn> but using global macros always looks cleaner in skins
[16:43] <hamen> so is structure vs look!? :)
[16:43] <zumbrunn> sometimes
[16:43] <zumbrunn> in this case, I think it is anyway justifiable to make it a global macro
[16:43] <zumbrunn> since the result is not relative to the page where you are
[16:44] <zumbrunn> root.href() is always the same anywhere
[16:44] <hamen> nice :) thank you and... it could sound as a threat, but... u will see me often ;)
[16:45] <zumbrunn> I hope so :-)
[16:52] <hamen> lol
[16:52] <hamen> i guess i gotta change password :P
[16:53] <hamen> everywhere
[16:53] <zumbrunn> why?
[16:54] <zumbrunn> nothing came thtough the channel, if that's what you mean
[16:55] <hamen> well... i got the wrong chat tab... i'm trying to identify, but i forgot the password. it's more than 1 year since last login
[16:55] <decke> i am wondering is there no simple way of using xml in helma?
[16:55] <zumbrunn> decke: e4x :-)
[16:55] <decke> i just found that overkill freaky xml-helma object mapping things that are quite too much for an 3 line xml file
[16:56] <decke> i need to parse an xml file and access the properties
[16:56] <decke> is that possible with e4x?
[16:56] <zumbrunn> new XML(foo)
[16:56] <zumbrunn> where foo is the file content your read
[16:57] <zumbrunn> ...you read
[16:59] <decke> judging from the docs that is meant for object mapping isnt it?
[16:59] <zumbrunn> which docs?
[17:00] <decke> http://helma.zumbrunn.com/reference/Xml.html
[17:00] <zumbrunn> Xml != XML
[17:00] <decke> oh cute little differences...
[17:01] <decke> and what is XML then? part of JS? or E4X? does it have documentation too?
[17:02] <zumbrunn> part of E4X, yes
[17:02] <decke> seems like i have to learn E4X then...
[17:02] <zumbrunn> http://www.ecma-international.org/publications/standards/Ecma-357.htm
[17:03] <zumbrunn> http://www.faqts.com/knowledge_base/index.phtml/fid/1784
[17:04] <decke> ah that's great...
[17:04] <zumbrunn> http://rephrase.net/days/07/06/e4x
[17:04] <zumbrunn> http://jwopitz.wordpress.com/2008/02/27/better-documentation-for-as3s-xml-class-e4x/
[17:05] <zumbrunn> if you find any better resources, let me know
[17:07] <zumbrunn> http://developer.mozilla.org/en/E4X
[17:08] <zumbrunn> that mozilla page lists the resources I mentioned earlier as well
[17:09] <zumbrunn> so for the future, I guess http://developer.mozilla.org/en/E4X will suffise
[17:15] <hamen> another trivia: how to add a "Create new" link in my navbar? link gotta call action "create" for Person object
[17:17] <decke> interesting side note: works great except when you do something like: new XML("<?xml version=\"1.0\"?><node>...</node>");
[17:18] <decke> that would throw: TypeError: The processing instruction target matching "[xX][mM][lL]" is not allowed.
[17:19] <decke> E4X doesn't support parsing XML declaration (<?xml version=...?>) (see bug 336551 ).
[17:19] <decke> seems that they are aware of it *g*
[17:22] <zumbrunn> hamen, that would be this.href('create')
[17:22] <zumbrunn> again, this is js ...so you might need to wrap it in a macro
[17:23] <zumbrunn> on the other hand, how about just using "./create" ?
[17:48] <hamen> tnx. i'll try both
[17:50] <hamen> function create_macro(){
[17:50] <hamen> return this.href('create');
[17:50] <hamen> }
[17:50] <hamen> i got an error: Macro error in create: TypeError: Cannot find function href in object [object GlobalObject
[17:50] <zumbrunn> try it in HopObject instead of Global
[17:52] <hamen> /[Unhandled Macro: create]
[17:52] <zumbrunn> <% this.create %>
[17:52] <hamen> [Unhandled Macro: this.create]
[17:52] <hamen> :-/
[17:53] <zumbrunn> you have the create_macro in HopObject now?
[17:53] <hamen> yes
[17:53] <zumbrunn> hmm
[17:55] <zumbrunn> how are you rendering the skin?
[17:55] <zumbrunn> using this.render(foo) ?
[17:56] <hamen> nope
[17:56] <zumbrunn> this.render() renders a skin in the context of "this" (a hopobject of some kind, like a person)
[17:58] <zumbrunn> you are doing this with the tutorial, right?
[17:58] <zumbrunn> with the Global/html.skin ?
[18:00] <zumbrunn> personally, in an app of mine, I would make html.skin a HopObject skin
[18:00] <zumbrunn> not a global one
[18:00] <zumbrunn> I guess it is a global skin in the tutorial in order to demonstrate the difference
[18:01] <hamen> finally i managed it in Global, as home link. it works, but i guess it's pretty bad :-/
[18:01] <zumbrunn> "as home link" ?
[18:01] <hamen> root.href(), remember?
[18:01] <zumbrunn> yes
[18:02] <hamen> now i have <% create %> in html.skin, calling create_macro in Global/macros.js
[18:02] <hamen> create_macro returns return root.href('create');
[18:02] <zumbrunn> oh, yeah that works
[18:02] <hamen> how does it look?
[18:03] <hamen> shitty? :-/
[18:03] <zumbrunn> as long as what you want is "/create"
[18:03] <hamen> i'm pretty worried about write bad code
[18:03] <zumbrunn> it will break when you need it to be /somethingselse/create
[18:03] <hamen> actually i want to understand how to call (and pass args) a method from another controller
[18:04] <hamen> i guess it's my RoR experience
[18:09] <hamen> anyway this solution seems to work even if i'm on other pages, i.e. /addressbook/3/edit
[18:09] <hamen> i always hava link to "create" and it still works fine
[18:10] <zumbrunn> yes, but it points to /addressbook/create, right?
[18:10] <zumbrunn> which is what you want in this case
[18:11] <hamen> yep
[18:11] <zumbrunn> but if what you would need is /addressbook/3/create, then you would have to make it a macro of your prototype, not global
[18:12] <hamen> i get it. i need more study ;)
[18:13] <zumbrunn> the difference is the context of the functions, what "this" refers to
[19:44] <bard`> hello all :) I'm wondering if there are special tricks to work on hopobjects from an async function. if I set properties on one, they don't survive a restart (even if I use hop.persist() just after setting the property).
[21:58] <zumbrunn> bard: I don't know if that is the currently expected behavior or a bug
[21:59] <zumbrunn> either-way I suggest you file a bug for this
[23:51] <bard> I'll have a try on the mailing list first...

 

 

In the channel now:

Logs by date: