Monday, 2010-06-21

*** tpb has joined #melange00:00
-lindbohm.freenode.net- [freenode-info] if you're at a conference and other people are having trouble connecting, please mention it to staff: http://freenode.net/faq.shtml#gettinghelp00:00
*** tansell-laptop has joined #melange01:49
*** sttwister has quit IRC03:07
*** lresende has joined #melange03:40
*** mithro has joined #melange04:35
*** ChanServ sets mode: +v mithro04:35
*** mithro has quit IRC04:40
*** mithro has joined #melange04:54
*** ChanServ sets mode: +v mithro04:54
*** sttwister has joined #melange07:41
*** madrazr has joined #melange08:13
*** ChanServ sets mode: +v madrazr08:13
*** MatthewWilkes has joined #melange09:04
*** sttwister has quit IRC09:10
*** madrazr has quit IRC09:55
*** sttwister has joined #melange09:57
*** arun_ has joined #melange10:11
*** Leo___ has joined #melange11:46
*** Merio has joined #melange12:21
*** ChanServ sets mode: +v Merio12:21
*** Merio has quit IRC13:27
*** Leo___ has quit IRC13:29
*** Merio has joined #melange13:29
*** ChanServ sets mode: +v Merio13:29
*** Leo___ has joined #melange14:22
*** Leo___ has quit IRC14:45
*** madrazr has joined #melange15:37
*** ChanServ sets mode: +v madrazr15:37
*** lresende has quit IRC15:43
*** madrazr has quit IRC15:43
*** Merio has quit IRC16:16
*** sttwister has quit IRC16:33
*** Leo___ has joined #melange16:46
*** sttwister has joined #melange17:14
*** Merio has joined #melange17:33
*** ChanServ sets mode: +v Merio17:33
*** sttwister has quit IRC17:47
*** sttwister has joined #melange17:59
*** dhaun has joined #melange18:06
*** sttwister has quit IRC19:24
*** sttwister has joined #melange19:26
Meriosttwister: ping :)19:39
sttwisterMerio: pong19:40
sttwisterMerio: so, what first ?19:41
MerioSo, I'm sorry but I remembered that there was some view without a model connected in the statistics module repository :)19:42
MerioSeems like it's not the case19:42
sttwisterI didn't seem to find if that's the case19:42
MerioMaybe I found a workaround during GSoC as it's not probable that I've done something hackish with python at all19:43
sttwisterWell, there should be proper support for this in Melange in the future19:44
sttwisterSo some refactoring can't hurt19:44
MerioYes I'm all for it19:44
MerioSo, what about your JSON?19:45
sttwisterwell, in the current form it might seem a bit big19:46
sttwister272K19:46
MerioI'm asking you some info because I really had no time (for obvious reasons) this week to review anything19:46
sttwisterdo you think it's big or is it acceptable ?19:46
MerioI think it could be acceptable, as it's something loaded only once during the startup19:47
Meriogoing to open it to review it in depth19:48
sttwisterok19:48
sttwisterI just commited a change to do some pretty indented output19:48
sttwisterI'm going to deploy it to appspot now19:48
Meriooh that's good :D19:49
Meriowaiting for it then ^_^19:49
*** Leo___ has quit IRC19:49
sttwisterin progress...19:50
sttwisterready19:51
sttwisterview-source:http://sttwister-melange.appspot.com/seeder/get_data19:51
tpb<http://ln-s.net/79hg> (at sttwister-melange.appspot.com)19:51
Meriogreat19:51
sttwister15k lines, heh :)19:53
Meriowow huge :)19:53
Merio16K here :)19:53
sttwisteroh yea, 16k, my bad :)19:53
Meriomultiple country list is a pain ^_^19:54
sttwisterone other solution is to remove the choices option19:54
sttwisterand add a new country data provider19:55
MerioIf it makes sense to make special distributions about countries than it could be good19:55
MerioBut doing it only for the JSON dimension no :)19:55
MerioMaybe some special distribution like "only one continent" or something like this19:56
MerioI don't want to overengineer though19:56
sttwisterWell, this is somehow achievable by using a random string provider and passing a list of countries as parameters19:57
sttwisterYou see, this is very flexible, it's just takes a bit of configuring by the user19:57
MerioGood good19:58
sttwisterso... reducing the JSON size would add more complexity to the client-side19:59
sttwisterdo you think it's worth the effort ?19:59
Merio(I'm reading here and there this is the reason why I'm slow to write :))19:59
sttwisterok :)20:00
Merionope doesn't worth it20:00
sttwisterjust a sec, I'm doing a quick prototype to see how much it would reduce the size20:01
Meriook20:01
MerioHowever I like it20:01
sttwisterso, it's 4.8k lines without including redundant properties20:02
Meriowhat do you mean by "redundant properties"?20:03
sttwisterI mean those already declared in base models20:03
sttwistercountry list still appears 14 times in this version also20:04
sttwistervs 34 times in the first version20:04
Meriowell, given that you have to handle inheritance anyway20:04
MerioThis is waaaay better :)20:05
MerioOnce you know which is the parent object it's easy to join them in Javascript20:05
sttwisteryes, perhaps20:05
sttwisteralso, it might be nice to indicate in the web interface which model the property actually belongs to20:06
Meriowhat do you mean?20:08
sttwisterlike if I want to seed students, it would be nice to point out which properties are inherited from Role for example, and which properties are student-specific20:09
Merioyup agree20:09
sttwisterok then, anything else regarding the JSON ?20:11
MerioAbout the web interface I would like to have more infos20:11
Merioabout the JSON I think excluding inherited properties it's fine20:12
MerioComplicates a bit the Javascript side but still you've to deal with that complication anyway :)20:12
sttwisteryep, well problem no. 1... I'm a JS noob :)20:13
sttwisterso I'd like you to point out firstly what libraries should I use20:13
sttwister(like using jQuery for the AJAX ? )20:13
sttwisterand maybe the JS Linq thingy20:14
MerioWell, we're using jQuery pretty much for everything20:15
MerioJSLinq is easy once you try some stuff in the website20:15
sttwisterok... anything else you think I might find useful ?20:16
Merioit's something to query a JSON using a sort of query language instead of iterating on it20:16
MerioThe best source to learn about the "advanced basics" of Javascript20:17
Meriojust a moment need to find the link :)20:17
sttwisterok, I see jLinq is already included in Melange20:19
Meriohttp://jsninja.com/Overview20:19
tpbTitle: Overview - Secrets of the JavaScript Ninja (at jsninja.com)20:19
Merioyes it is20:19
sttwistercool, thanks20:19
MerioYou can find many stuff about basic javascript in the web20:20
MerioBut no other source I've found explains really how Javascript works :)20:20
sttwisternice, I'll have a look at it right away20:20
sttwisterwhich brings me to my second questions.. what's the right way to inform Melange which JS libraries should be included for a given template20:20
Merio(praise to John Resig ;))20:21
MerioActually this is not something that really works right now20:22
MerioI've found some libraries but need to find some time for JS refactoring20:22
MerioHowever20:22
Merioif you need something "global"20:24
Merioyou can add an if switch in the base template20:24
Meriolike20:24
Meriohttp://code.google.com/p/soc/source/browse/app/soc/templates/soc/base.html#10920:24
tpb<http://ln-s.net/79il> (at code.google.com)20:24
Merioadding a new param here20:25
Meriohttp://code.google.com/p/soc/source/browse/app/soc/views/helper/params.py#5420:25
tpb<http://ln-s.net/79in> (at code.google.com)20:25
*** Leo___ has joined #melange20:25
sttwisterso I should add an entry like melangeseeder20:26
sttwisterand a coresponding .js file for it20:26
MerioThis is something that needs to be refined. I would prefer something handled by JS instead of something hardcoded in Python, unless we find some way to deal with dependencies between scripts in a nice way20:26
Meriowell not quite, maybe it's better if you create a new "package" for it, following something I've built last year20:26
MerioLet me explain20:26
Merioyou can see in soc/content/js that there are some JS files in the form of melange.*20:27
sttwisteryep20:28
MerioOk so this is some kind of attempt to rationalize our javascript files, still work in progress :)20:28
MerioThe main problem with javascript is namespace pollution20:29
MerioSo if a script declares something like "var one = 1"20:29
Merioand another declares "var one = 2"20:30
Merioand they're included in the same page20:30
Meriothen they're writing on the same variable, which is "window.one"20:30
sttwisterso you'd need to create a new namespace for each "package", right ?20:32
sttwistervia function(), is that correct ?20:32
Meriogive or take, yes.20:34
MerioSo it's sensible that everything needed by melange is something like melange.something20:34
MerioAnd that everything you need for the data seeder is in something like melange.seeder or whatever you want20:34
Meriothe construct is (function(){}())20:35
sttwisterok, so I'd create a new melange.seeder-????.js20:35
Meriowhich is something that you can find explained in depth in jsninja wiki pages20:35
Meriohttp://jsninja.com/Closures#.28function.28.29.7B.7D.29.28.2920:35
tpb<http://ln-s.net/79j7> (at jsninja.com)20:35
sttwisterand define a new melange.seeder namespace ?20:36
Meriobasically yes20:36
MerioBut since20:36
Meriomelange.js is loaded in the base view20:36
Meriothan you've already some facilities and you don't have to think about it too much20:36
MerioAt least if you're using the base template20:37
MerioDon't know if you're going to use it or not20:37
sttwisteris there any reason not to use it ?20:37
Meriodon't know, the old data seeder didn't use it, nor the html page that you can find in content/seed_db.html20:38
sttwisterI guess I'll use it20:39
MerioHowever this is not a problem20:40
sttwisterjust for blending in with the rest of the interface20:40
MerioAs you can include the javascript files anyway :)20:40
Merioso, for the skeleton of your javascript file20:40
Merioyou can see20:41
Meriohttp://code.google.com/p/soc/source/browse/app/soc/content/js/melange.tooltip-100204.js20:41
tpb<http://ln-s.net/79jG> (at code.google.com)20:41
Meriojust use lines 1-43 and 10220:41
Merio(using for example seeder instead of tooltip)20:42
sttwisteraha20:42
sttwisterand $m would be my namespace20:42
Merioevery function that you create using $m.functionname will be available from the outside as (e.g.) melange.seeder.functionname20:42
sttwister?20:42
sttwisterah20:42
sttwistergreat :)20:42
Merioyes, basically you create the namespace in lines 32-3420:43
Merioand then a shortcut on line 3920:43
sttwisterawesome20:43
Meriothat line also give a debug decorator (which I've written but not yet used opppsss :P)20:43
sttwisterheh :P20:43
sttwisterso the first step would be to make an AJAX request to get the JSON date on document load, right ?20:45
Meriothere is something more about it though20:46
Meriobecause melange.seeder theoretically should be something of "general use"20:46
MerioThat means that, for example, all the javascript that actually deals with the GUI should be in another place20:47
MerioNothing more complicated than what I've already explained20:47
sttwisterohhh yes, sounds right20:47
sttwisterthat would also be in soc/content/js right ?20:47
MerioJust to let you know, then we will do it step by step20:47
Merioyes, in the templates directory20:47
Merioif you see in the "basic package" => http://code.google.com/p/soc/source/browse/app/soc/content/js/melange-091015.js20:48
tpb<http://ln-s.net/79jb> (at code.google.com)20:48
Merioline 267 and followers define a basetemplate20:49
Meriothis is the thing I would like to change as soon as possible20:49
MerioBecause inheriting that (I'll let you know how in some minutes) will automagically get all startup variables from python automagically at load time20:50
sttwisterthat sounds cool20:51
Meriolet me look for an example one moment20:52
sttwisterok, brb just 2-3 mins, I have to go to the bathroom :)20:52
Meriook ^_^20:53
Merio(writing in the meantime :))20:53
Meriohttp://code.google.com/p/soc/source/browse/app/soc/templates/soc/organization/home.html#2020:53
tpb<http://ln-s.net/79jt> (at code.google.com)20:53
Meriohere you can find that django prints a python variable (which is actually a JSON) into a melangeContext attribute in the script tag20:54
Meriothe basetemplate takes that attribute content and creates an internal variable of it20:54
Merioin javascript20:54
MerioThis is awesome (it's the dojo way to be precise)20:54
Meriobut has a limitation... you can include only one script that uses it, otherwise there is no way to find which attribute is for which script unless you hardcode the name of the script in the javascript itself or something like that20:55
Meriobut then if you include the script with the same name two times than you have no way to find which configuration is for which instance of the script :)20:56
Merioand then here20:58
Meriohttp://code.google.com/p/soc/source/browse/app/soc/content/js/templates/soc/organization/home-091027.js20:58
tpb<http://ln-s.net/79k1> (at code.google.com)20:58
Merioyou can see the actual javascript file connected to that template20:59
MerioBasically this has been done to externalize all javascript code from the html templates, for clarity and maintanability20:59
Merio(still is a WIP :P)20:59
MerioTo use the basetemplate defined in the base melange script21:00
Merioyou should use lines 1-25 and 18721:00
sttwisterok, well this looks really good, it sure makes it all easier to understand and integrate21:00
MerioDon't know if I'm forgetting something useful to begin working on it21:01
sttwisterone quick question, how does versioning work ?21:02
sttwistere.g. melange-09015 ?21:02
sttwisterwhat's with the number ?21:02
Merioheh that's a pain :)21:03
MerioProblem is that some browsers handle caching of javascript files in weird ways21:03
MerioAt least last time that this has been tested21:03
MerioSo you update a JS file and the browser uses the cached file instead of the new one21:04
MerioSo only way is to change the name of the file :)21:04
MerioI know that there should be a way to handle that in a better way21:04
MerioI knew how to deal with it sometime ago with php21:05
sttwisteraha I see21:05
sttwisteroh, that's actually a date, right ?21:05
Meriobut still it seems that's not easy and no one really cares at the moment :P21:05
MerioIf you use hg rename you keep the history of the file21:05
Merioyes it is21:05
sttwisterok got it21:06
Meriosame problem is for things retrieved using ajax21:07
Merioprobably we're not using it everytime21:08
MerioBut it's a good thing to append ?=_"+(new Date().getTime())21:09
Meriowhen using ajax calls21:09
sttwisteryou mean things retrieved using AJAX get cached ?21:09
MerioI can't remember if this is something done by jquery by now21:09
MerioYes21:09
sttwisterwell, the information retrieved shouldn't change unless there's a change in the code21:10
Merioif you'21:10
sttwisterso getting a cached copy should still be fine in most of the cases21:10
Merioyes but still it's easy to avoid it appending a timestamp to the query string21:11
sttwistersure, that can't hurt :)21:11
Merioanother little problem is about minimization21:12
Merio(one minute I've to be afk, bbs)21:12
sttwisterok21:12
Meriook so21:13
Merioyou should check in your app.yaml whether you're using the unminimized js files21:15
Merioor the minimized one (which are in the js.min directory)21:15
sttwisterit's using the minimized ones21:17
Meriook so you should point to the unminimized ones when working on them21:17
Merioand then minimize them and change the app.yaml when deploying21:18
sttwisteryes, that makes sense21:18
MerioBut I would suggest to talk with Sverre about it21:19
sttwisterwhy, is there anything fishy about this ?21:19
MerioBecause this is something changed on April21:19
Merioand then I had little time to change code and commit so I can't remember all the details21:19
MerioWell just that IIRC minimized files should be ready in the js.min directory when deploying21:20
MerioBecause Sverre was (understandably) bothered by the fact that he had to compile the javascript on each deploy21:20
Meriocompile => minimize21:20
sttwisterand what script does the actual minimization ?21:21
Merioit's in scripts/closure.sh21:22
MerioYou need to define the source and dest directory21:22
Meriobut still I remember that Sverre did some switches to the build script21:23
Meriojust give me some minutes to find it21:23
sttwisteroh yes, I think those changes were updated on the GettingStarted wiki page21:24
Merioyep but I don't know if all switches are documented :P21:25
*** dhaun has quit IRC21:25
sttwisteraha21:25
Merio(running out of battery here! :P)21:26
sttwisterok well, anything else left to discuss ?21:26
Meriowell, I think it's better to ping Sverre on it TBH ^_^21:26
sttwisterok sure, will do21:27
MerioI think not, we just have to talk about the web interface, but we can do it next time21:27
MerioIt's better that you begin setting up javascript and do some studies on jQuery and/or the current Javascript code in Melange21:28
sttwisteryep, you've provided me with a lot of information in order to properly get started on the client-side, thanks a lot ;)21:29
Merioyw :) pls don't hesitate to contact me for any other info you may need :)21:29
sttwisterok then21:30
sttwisternice talking to you21:30
sttwisterI guess I'll see you later than :)21:30
MerioOk ^_^21:30
MerioJust put some notes on the meeting21:31
MerioStart/end and basically what we talked about, obviously no need for details :)21:31
sttwisterI took notes on-the-fly21:32
sttwister:)21:32
MerioI knew that ;)21:32
Merioso... need for a sleep... good night ^_^21:34
*** Merio has quit IRC21:37
*** Leo___ has quit IRC22:50
*** r0bby has joined #melange23:27
*** SRabbelier has quit IRC23:29
*** robbyoconnor has quit IRC23:29
*** SRabbelier has joined #melange23:34
*** ChanServ sets mode: +o SRabbelier23:35
*** r0bby is now known as robbyoconnor23:40

Generated by irclog2html.py 2.17.2 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!