Zotonic
Zotonic
zotonic@conference.zotonic.com
Tuesday, 2 July 2013< ^ >
Arjan has set the subject to: Zotonic - The Erlang Web Framework & CMS
Room Configuration

GMT+2
[01:07:17] cillian.deroiste leaves the room
[01:54:55] mawuli.ypa joins the room
[02:05:53] mawuli.ypa leaves the room
[02:06:07] mawuli.ypa joins the room
[02:08:09] mawuli.ypa leaves the room
[02:08:48] mawuli.ypa joins the room
[02:10:57] mawuli.ypa leaves the room
[02:11:32] mawuli.ypa joins the room
[02:15:58] mawuli.ypa leaves the room
[02:16:16] mawuli.ypa joins the room
[02:21:00] mawuli.ypa leaves the room
[02:21:23] mawuli.ypa joins the room
[02:26:03] mawuli.ypa leaves the room
[02:27:01] mawuli.ypa joins the room
[02:30:26] mawuli.ypa leaves the room
[02:33:57] Mawuli Adzaku joins the room
[02:40:27] Mawuli Adzaku leaves the room
[02:40:54] mawuli.ypa joins the room
[02:44:14] mawuli.ypa leaves the room
[02:44:35] mawuli.ypa joins the room
[02:54:45] mawuli.ypa leaves the room
[02:57:45] mawuli.ypa joins the room
[03:04:29] mawuli.ypa leaves the room
[03:04:54] mawuli.ypa joins the room
[03:09:33] mawuli.ypa leaves the room
[03:10:06] mawuli.ypa joins the room
[03:29:22] mawuli.ypa leaves the room
[03:29:43] mawuli.ypa joins the room
[03:33:20] mawuli.ypa leaves the room
[03:34:05] mawuli.ypa joins the room
[03:39:32] mawuli.ypa leaves the room
[03:39:46] mawuli.ypa joins the room
[03:46:01] mawuli.ypa leaves the room
[03:46:57] mawuli.ypa joins the room
[03:52:46] mawuli.ypa leaves the room
[03:53:05] mawuli.ypa joins the room
[03:54:06] mawuli.ypa leaves the room
[03:58:26] mawuli.ypa joins the room
[04:05:43] mawuli.ypa leaves the room
[04:09:34] mawuli.ypa joins the room
[04:20:22] mawuli.ypa leaves the room
[04:20:53] mawuli.ypa joins the room
[04:26:29] mawuli.ypa leaves the room
[04:27:03] mawuli.ypa joins the room
[04:30:58] mawuli.ypa leaves the room
[04:31:45] mawuli.ypa joins the room
[04:39:16] bronzeboyvn joins the room
[06:02:29] arcusfelis joins the room
[06:12:57] mawuli.ypa leaves the room
[06:13:47] mawuli.ypa joins the room
[07:00:30] Andreas Stenius leaves the room
[07:40:36] arjan joins the room
[07:57:57] arjan leaves the room
[08:52:36] arjan joins the room
[08:59:20] Marc Worrell joins the room
[09:02:07] <arjan> I'll roll the 0.9.2 today
[09:02:15] <arjan> been a while...
[09:02:37] <arjan> we should have a more strict release schedule
[09:03:01] <arjan> time based rather than feature based
[09:11:38] <Marc Worrell> could be a good solution for those maintenance releases
[09:11:45] <Marc Worrell> we always merge fixes there
[09:52:19] arjan leaves the room
[10:00:27] Piotr Nosek joins the room
[10:07:47] arjan joins the room
[10:21:10] Maas joins the room
[10:21:30] arjan leaves the room
[10:22:05] arjan joins the room
[10:25:08] arjan leaves the room
[10:26:32] arjan joins the room
[10:34:41] arjan leaves the room
[10:36:01] arjan joins the room
[10:41:27] arjan leaves the room
[10:42:12] arjan joins the room
[10:46:47] arjan leaves the room
[11:22:29] <Piotr Nosek> Hi everyone. Today I'm going to torment you with questions too! :D
[11:29:14] <Piotr Nosek> And the first thing is: I'm not sure how to properly implement my own model. I see the following in the behaviour: m_find_value/3, m_to_list/2 and m_value/2. First one is quite clear but I understand it is function only for reading. Is there a standard function I should implement for writing a value to DB?
[11:32:48] mawuli.ypa leaves the room
[11:33:04] mawuli.ypa joins the room
[11:35:43] mawuli.ypa leaves the room
[11:35:57] <Marc Worrell> Hi Piotr - you can use your own (z_db) functions to write things to the database. A model is only a (small) set of functions that can be called from the template and Erlang code. The Erlang interface varies greatly per kind of function.
[11:36:11] mawuli.ypa joins the room
[11:37:00] <Marc Worrell> There are some z_db functions to easily read/write to the db (z_db:insert, update, delete) using a standard 'id' primary key.
[11:37:38] <Marc Worrell> (and z_db:select/3)
[11:45:14] mawuli.ypa leaves the room
[11:45:48] mawuli.ypa joins the room
[11:45:56] mawuli.ypa leaves the room
[11:46:24] mawuli.ypa joins the room
[11:50:28] <Piotr Nosek> Cool, thanks :)
[11:51:11] mawuli.ypa leaves the room
[11:51:30] mawuli.ypa joins the room
[11:51:44] <Piotr Nosek> Does Zotonic expect ID to be integers or can it be any data type I define in DB schema? :)
[12:01:37] mawuli.ypa leaves the room
[12:02:14] mawuli.ypa joins the room
[12:03:17] <Marc Worrell> could be any - but (as usual with psql) I would advice to use normal sequence integers, also easier to insert new records.
[12:03:55] <Marc Worrell> Then you can also assume that 'id', whenever you see one, is an integer - which makes life a lot easier
[12:08:41] mawuli.ypa leaves the room
[12:08:53] mawuli.ypa joins the room
[12:15:45] mawuli.ypa leaves the room
[12:16:02] mawuli.ypa joins the room
[12:27:28] <Piotr Nosek> Can I somehow enable automatic reloading of site modules, which changes or are new?
[12:27:49] <Marc Worrell> yes, just enable mod_development
[12:28:24] <Marc Worrell> though, when you add new (or remove) observers then you need to restart the module
[12:47:43] <Piotr Nosek> Even with mod_development enabled, models are not recompiled on change. :(
[12:48:00] <Marc Worrell> oh, you want automatic recompilation?
[12:48:18] <Marc Worrell> Are you on Linux?
[12:48:36] <Piotr Nosek> Today - yes. Usually I'm on Mac.
[12:48:56] <Marc Worrell> I think that Arjan made something using inotify to automatically compile
[12:49:06] <Marc Worrell> I often leave a terminal open to type z:m().
[12:49:26] <Piotr Nosek> z:m() will recompile and reload?
[12:49:28] <Marc Worrell> That is, if Sublime Text didn't compile it already
[12:49:43] <Marc Worrell> yes, z:m() does a make:all([load]) and then also flushes the caches
[12:49:53] <Piotr Nosek> It's good enough, thanks :)
[12:50:36] <Marc Worrell> and z:ld(modulename) is a shortcut to the code module for reloading a specific module.
[12:51:06] <Marc Worrell> use: z_module_manager:restart(modulename, z:c(yoursitename)). to restart a module (and re-hook all observers etc)
[12:51:23] <Marc Worrell> z:restart(sitename) restarts a site
[13:05:48] arjan joins the room
[13:06:26] <arjan> z:m(). is verrrry slow though
[13:06:46] <arjan> the inotify method only recompiles the changed file -- way faster
[13:06:57] <arjan> but apparently nobody on mac wants that
[13:07:13] <arjan> or takes the time to implement something for mac :p
[13:08:05] <Marc Worrell> there are some C libs that do inotify like stuff on multi platform
[13:14:40] mawuli.ypa leaves the room
[13:17:41] mawuli.ypa joins the room
[13:18:36] <arjan> I dont really mind cross-platform :p its just macosx that is missing now... almost all developers are either mac or linux
[13:24:07] <Marc Worrell> python-watchdog is cross platform
[13:24:46] <Marc Worrell> https://pypi.python.org/pypi/watchdog
[13:24:59] <Marc Worrell> I tried it some time ago on Mac and it worked well
[13:25:18] arjan leaves the room
[13:29:17] arjan joins the room
[13:29:38] arjan leaves the room
[13:30:10] arjan joins the room
[13:36:01] <Piotr Nosek> How do I call m_to_list from template? Given I understand properly that m_to_list is supposed to return a list of proplists matching some condition :)
[13:36:36] <arjan> it is called when you do a for-loop
[13:36:41] <arjan> iirc
[13:36:51] <Marc Worrell> Actually, a list of whatever. It is called on a #m{} value when a list is needed in a template - indeed in a for loop.
[13:41:51] <arjan> I recall also a special filter, |make_list
[13:41:53] <arjan> to force calling m_to_list
[13:44:42] <Piotr Nosek> Hmm... following code iterates for proper count but no data is rendered:
<select name="admission">
{% for admission in m.admission %}
<option value="{{ admission.id }}">{{ admission.name }}</option>
{% endfor %}
</select>
[13:45:08] mawuli.ypa leaves the room
[13:45:22] mawuli.ypa joins the room
[13:45:52] <arjan> you can try with "print"
[13:45:55] <arjan> {% print admission %}
[13:46:04] <arjan> to see what the admission looks like
[13:46:18] <arjan> erlydtl is quite forgiving -- it does not crash on unknown values
[13:47:22] <Piotr Nosek> {1,1,<<"Some admission">>} <- tuples like this
[13:47:24] <Piotr Nosek> Ah
[13:47:39] <Piotr Nosek> I should make it proplist when returning from m_to_list, right? :)
[13:47:53] <Piotr Nosek> I thought z_db:q creates a proplist :)
[13:48:11] <arjan> no,
[13:48:21] <arjan> I think that's called z_db:q_assoc
[13:48:23] <arjan> or just :assoc
[13:48:46] <Piotr Nosek> Yes, you're right. Now I understand
[13:48:54] <arjan> z_db:assoc/2 indeed
[13:49:00] <arjan> or assoc_row if you just want one row
[13:49:47] <Piotr Nosek> Works like a charm now. Cool. :)
[13:49:48] mawuli.ypa leaves the room
[13:50:02] mawuli.ypa joins the room
[13:50:03] <Piotr Nosek> Time for some wiring now...
[13:51:03] mawuli.ypa leaves the room
[13:51:18] mawuli.ypa joins the room
[13:52:03] mawuli.ypa leaves the room
[13:52:39] <arjan> :)
[13:52:51] mawuli.ypa joins the room
[13:53:26] <arjan> wireing withing a loop can be tricky, btw
[13:53:43] <arjan> but that is why we have auto-generating ids with the #foo syntax
[13:55:20] arjan leaves the room
[13:55:44] <Piotr Nosek> Hmm... you mean that I could have problems with wired form with <select> generated by loop?
[13:55:45] mawuli.ypa leaves the room
[13:56:03] mawuli.ypa joins the room
[13:56:10] <Piotr Nosek> Or just if I rendered form elements like inputs with loop? :)
[13:56:39] <Piotr Nosek> Hmm... indeed I'll need to put wire inside loop later.
[13:58:51] bronzeboyvn leaves the room
[13:58:52] mawuli.ypa leaves the room
[13:59:10] mawuli.ypa joins the room
[14:05:59] mawuli.ypa leaves the room
[14:06:34] mawuli.ypa joins the room
[14:09:51] mawuli.ypa leaves the room
[14:10:17] mawuli.ypa joins the room
[14:17:41] mawuli.ypa leaves the room
[14:18:02] mawuli.ypa joins the room
[14:24:27] arjan joins the room
[14:25:50] arjan leaves the room
[14:28:18] arjan joins the room
[14:29:01] <arjan> with id autogeneration you can have a new ID in each loop
[14:29:15] <arjan> say if you have a variable called 'var': {% for var in things %}
[14:29:27] <arjan> then inside that loop you can generate a new id in each iteration like this:
[14:29:37] <arjan> <input id="{{ #something.var }}">
[14:29:39] <arjan> and wire it:
[14:29:49] <arjan> {% wire id=#something.var type="change" ... %}
[14:30:07] <arjan> or you can construct ids with string concatenation:
[14:30:14] <arjan> <input id="foo-{{ var }}"
[14:30:23] <arjan> {% wire id="foo-"|append:var ...
[14:32:49] mawuli.ypa leaves the room
[14:33:14] mawuli.ypa joins the room
[14:37:30] mawuli.ypa leaves the room
[14:37:58] mawuli.ypa joins the room
[14:40:11] mawuli.ypa leaves the room
[14:40:38] mawuli.ypa joins the room
[14:41:24] mawuli.ypa leaves the room
[14:41:54] mawuli.ypa joins the room
[14:46:35] mawuli.ypa leaves the room
[14:47:08] mawuli.ypa joins the room
[14:51:47] mawuli.ypa leaves the room
[14:52:45] mawuli.ypa joins the room
[14:55:43] mawuli.ypa leaves the room
[14:56:07] mawuli.ypa joins the room
[14:59:39] mawuli.ypa leaves the room
[15:00:05] mawuli.ypa joins the room
[15:05:47] mawuli.ypa leaves the room
[15:07:36] mawuli.ypa joins the room
[15:15:20] mawuli.ypa leaves the room
[15:15:45] mawuli.ypa joins the room
[15:16:43] mawuli.ypa leaves the room
[15:17:04] mawuli.ypa joins the room
[15:20:56] mawuli.ypa leaves the room
[15:21:16] mawuli.ypa joins the room
[15:25:56] mawuli.ypa leaves the room
[15:26:54] mawuli.ypa joins the room
[15:27:41] mawuli.ypa leaves the room
[15:28:58] Mawuli Adzaku joins the room
[15:29:42] Mawuli Adzaku leaves the room
[15:31:45] mawuli.ypa joins the room
[15:48:59] mawuli.ypa leaves the room
[15:49:17] mawuli.ypa joins the room
[15:58:39] mawuli.ypa leaves the room
[15:59:17] mawuli.ypa joins the room
[16:07:02] mawuli.ypa leaves the room
[16:08:42] mawuli.ypa joins the room
[16:21:27] mawuli.ypa leaves the room
[16:22:06] mawuli.ypa joins the room
[16:24:50] Piotr Nosek leaves the room
[16:30:09] mawuli.ypa leaves the room
[16:30:25] mawuli.ypa joins the room
[16:32:21] piotr.nosek joins the room
[16:37:38] mawuli.ypa leaves the room
[16:38:16] mawuli.ypa joins the room
[16:38:32] mawuli.ypa leaves the room
[16:45:49] mawuli.ypa joins the room
[16:50:03] mawuli.ypa leaves the room
[16:50:26] mawuli.ypa joins the room
[16:51:40] mawuli.ypa leaves the room
[16:52:09] mawuli.ypa joins the room
[17:02:49] mawuli.ypa leaves the room
[17:03:20] mawuli.ypa joins the room
[17:07:20] mawuli.ypa leaves the room
[17:07:36] mawuli.ypa joins the room
[17:13:17] mawuli.ypa leaves the room
[17:13:43] mawuli.ypa joins the room
[17:19:33] mawuli.ypa leaves the room
[17:19:56] mawuli.ypa joins the room
[17:21:15] mawuli.ypa leaves the room
[17:21:43] mawuli.ypa joins the room
[17:24:10] mawuli.ypa leaves the room
[17:24:26] mawuli.ypa joins the room
[17:29:14] mawuli.ypa leaves the room
[17:29:34] mawuli.ypa joins the room
[17:34:50] mawuli.ypa leaves the room
[17:35:13] mawuli.ypa joins the room
[17:39:09] mawuli.ypa leaves the room
[17:39:24] mawuli.ypa joins the room
[17:44:14] Maas leaves the room
[17:45:12] mawuli.ypa leaves the room
[17:45:35] mawuli.ypa joins the room
[17:49:21] mawuli.ypa leaves the room
[17:49:47] mawuli.ypa joins the room
[17:49:53] mawuli.ypa leaves the room
[17:50:11] mawuli.ypa joins the room
[17:57:58] mawuli.ypa leaves the room
[17:58:19] mawuli.ypa joins the room
[18:00:41] arjan leaves the room
[18:03:13] mawuli.ypa leaves the room
[18:03:30] mawuli.ypa joins the room
[18:08:47] mawuli.ypa leaves the room
[18:09:09] mawuli.ypa joins the room
[18:12:32] mawuli.ypa leaves the room
[18:12:47] mawuli.ypa joins the room
[18:14:44] mawuli.ypa leaves the room
[18:19:00] mawuli.ypa joins the room
[18:31:31] arjan joins the room
[18:31:32] mawuli.ypa leaves the room
[18:32:39] mawuli.ypa joins the room
[18:38:29] mawuli.ypa leaves the room
[18:38:45] mawuli.ypa joins the room
[18:41:12] mawuli.ypa leaves the room
[18:41:25] mawuli.ypa joins the room
[18:42:34] mawuli.ypa leaves the room
[18:43:10] mawuli.ypa joins the room
[18:46:50] mawuli.ypa leaves the room
[18:47:20] mawuli.ypa joins the room
[18:47:29] arjan leaves the room
[18:57:50] mawuli.ypa leaves the room
[18:58:04] mawuli.ypa joins the room
[19:02:59] mawuli.ypa leaves the room
[19:03:13] mawuli.ypa joins the room
[19:03:29] mawuli.ypa leaves the room
[19:04:05] mawuli.ypa joins the room
[19:17:04] piotr.nosek leaves the room
[19:50:09] piotr.nosek joins the room
[19:50:20] piotr.nosek leaves the room
[19:51:35] arjan joins the room
[19:52:10] Piotr Nosek joins the room
[19:59:10] <Piotr Nosek> Hello again. :) I have a question about tag {% wire type="submit" id="myform" postback="form_submitted" delegate="mysite" %}. I assumed "postback" is a value to be returned to handler but example handler function here: event(#submit{}, Context) does not take extra parameter for "postback" value? Is it included in Context?
[20:00:40] <Piotr Nosek> It even conflicts a bit with another example: event({postback, go, TriggerId, TargetId}, Context)
[20:01:59] <Piotr Nosek> Perhaps I should describe what I want to achieve. I need a form for adding people to database. After clicking "Submit" entity should be added to DB *and* displayed below the form dynamically.
[20:08:37] mawuli.ypa leaves the room
[20:09:12] mawuli.ypa joins the room
[20:10:13] arjan leaves the room
[20:16:36] mawuli.ypa leaves the room
[20:16:44] mawuli.ypa joins the room
[20:20:09] arcusfelis leaves the room
[20:21:47] mawuli.ypa leaves the room
[20:22:24] mawuli.ypa joins the room
[20:23:37] mawuli.ypa leaves the room
[20:26:53] mawuli.ypa joins the room
[20:29:19] mawuli.ypa leaves the room
[20:29:42] mawuli.ypa joins the room
[20:32:33] mawuli.ypa leaves the room
[20:38:22] arjan joins the room
[20:39:49] <arjan> the postback= value is indeed returned,
[20:40:08] <arjan> it is the 'message' key in the #submit{} record or in the #postback{} record
[20:40:32] <arjan> btw, a #submit{} is a special postback for form submits
[20:40:53] <arjan> what kind of error do you get?
[20:41:05] <arjan> something with function_clause?
[20:43:28] <Piotr Nosek> I didn't get any errors because so far "wire" tag didn't render anything for me. :( Do I need to include some JavaScript file to get it to work? I tried to paste into template:
<a href="#" id="link">Click me!</a>
{% wire type="click" id="link" action={fade_out target="link"} %}
and it rendered to just:
<a href="#" id="link">Click me!</a>
[20:45:28] <arjan> yes you do need some javascript
[20:45:42] <arjan> plus the {% script %} tag at the bottom of your base template
[20:46:05] <arjan> furthermore you need zotonic-1.0.js and jquery
[20:46:08] <arjan> but that's about it
[20:47:07] <arjan> zotonics js_include tpl has it all,
[20:47:17] <arjan> {% include "_js_include.tpl" %}
{% script %}
[20:47:26] <arjan> see for instance here, https://github.com/arjan/stick.im/blob/master/templates/base.tpl
[20:50:44] <Piotr Nosek> Works, thanks. :) My questions must sometimes seem stupid... :D
[20:51:29] <arjan> not at all!
[20:51:58] <arjan> that's what we're here for
[21:38:19] <arjan> released 0.9.2
[21:38:35] <arjan> google code will stop supporting zip downloads in january
[21:39:26] <arjan> So we need an alternative
[22:33:56] arjan leaves the room
[23:42:52] Piotr Nosek leaves the room
Powered by ejabberd Powered by Erlang Valid XHTML 1.0 Transitional Valid CSS!