IRC Logs for #cmvt Thursday, 2013-04-18

prologicDanielBaird:  ping?00:43
DanielBairdi found a centos 6.4 box from puppet labs, that doesn't have puppet on it :) thanks for the download bandwidth, puppet labs00:44
prologicGerhard and I were talking about Angular JS this morning :)00:45
prologicthere are some concerns around the fact that it produces invalid and non-standard HTML that can't be validated :)00:45
DanielBairdactually you can add data- in front of the custom attributes.  then they validate00:46
DanielBairdor i think x- works as well.00:46
DanielBairdhowever, validation that complains about unrecognised attributes or even unrecognised tags, when the browser's handling of unrecognised attrs etc is clearly specified in the html standard, is not especially worrying.00:47
DanielBairdbut that tag is replaced with a div tag before the leaflet lib actually runs on it.  so it's valid html at *some* point in it's lifetime :)00:49
DanielBairdember js on the other hand only uses validatable html source, but it embeds its html tempates inside <script> tags.  that means they always validate (because script tags can contain any old text) but all the tags in the template contents aren't checked at all.. which is much worse from the point of view of hte persn who wants the validator to help them write good markup00:52
*** gw has joined #cmvt01:02
gwHey all01:02
prologichey gerhard :)01:02
gwI can ably find in the standard that a browser should ignore invalid attributes01:03
gwand it's values...01:03
gwand that user agents are free how to do this....01:03
DanielBairdif you really care about it, I can switch my angular stuff over to use the data- prefixed attributes.  attributes starting with data- are described in the html5 standard01:05
DanielBairdi think we can be confident that Google's javascript framework won't be broken by future browser evolutions though.01:06
gwwell it wouldn't be the first project google abandons01:06
prologicHasn't Google abanonded AngularJS?01:07
prologicand given it up to the community?01:07
DanielBairdi also considered ember and knockout.. but all of the js frameworks are at most a couple of years old.  is there a favourite js framework you guys like?01:07
prologicIt was originally intended for apps and mobile apps01:07
prologicbut never got used that way01:07
gwwell usually  we stick with plain html and jquery ...01:08
gwcauses the least trouble and if you are careful you still have a useful site even if javascript fails for some reason...01:08
gwand you usually can feed a site like this unmodified to a search engine indexer01:08
prologicOriginally Gerhard convinced me that the way we should go is to use Twitter Bootstrap for the widgetry and plain jQuery for any client-side behavior (AJAX, Events, User Interactions, etc)01:08
prologicEven AngularJS uses jQuery anyway :)01:09
prologicI also considered doing the client-side in ExtJS 4 + GeoExt 201:09
prologicbut nobody likes that (too heavy weight) :)01:10
DanielBairdif we are using leaflet, we have to assume js is working fine01:10
gwand it seems bit weird to do half of the tempting on the server and the other half on the client01:10
prologicThis is true01:10
prologicwell we're not doing any tempting server-side at this point01:11
DanielBairdif we're doing ajaxy loading of map layers, we need to have js handling of loading times, alerts etc01:12
prologicI did read an article on writing good structured HTMl/CSS + jQuery web apps that don't' end up being sphageti01:12
prologiclemme see if I can find it again01:12
gwso there are a couple of concerns....01:13
gwand  there are some concerns like invalid markup, rewriting the page to make it rewritable for the other scripts that rewrite it into the final state, undefined behaviour of browsers01:14
DanielBairdalso, so far i'm writing in coffeescript rather than js.  that's more likely to be a problem than angluar i suspect01:14
gwthere are a quite a few things to run on the browser to turn this page into something that works ;)01:15
prologicI don't think Coffeescript is so much of a problem tbh01:18
prologicIt's just a Python-like language that compiles to Javascript01:18
prologicJust a nicer way to write Javascript I guess01:18
gwand it compiles into rather clean javascript if you want01:18
gwnot necessary lie some obfuscated thing01:18
prologicI'm pretty sure it does01:18
DanielBairdit sounds like you guys are worried about things that aren't actually problems with angular.  we have to admit javascript as a requirement.  Angular is just a bunch of JS tools that let you hook stuff up, more or less the same as if you'd used jQuery events to update a map ehwne someone chooses a different thing from a dropdown.01:18
DanielBairdyes coffeescript is a kind of python-ish js alternative.01:19
DanielBairdangular can totally use entirely valid html.01:19
DanielBairdhere's the data- spec:
gwso .. what's the big advantage of angular then?01:23
DanielBairdmuch less typing to get your app finished01:23
DanielBairdi'm currently using it for two things, which are probably the main two things this project will want01:25
DanielBairdone is two-way data binding, which is when you have two items on the page that are both bound to the same piece of information.  When one changes, the other is updated with the new info.01:26
DanielBairdfor example, a leaflet map has a zoom level, and i can two way bind that to a dropdown.  then when you zoom the map, the dropdown changes magically,  or when you choose a new zoom level in the dd, the map zooms magically.01:27
DanielBairdthe other is for wrapping the leaflet map in a more useful abstraction layer.  so when you choose a particular climate layer you need to pick a year, a model, a scenario, etc.  Then based on that info we have to do a backend call to get a raster map, or a set of vector map features.01:29
DanielBairdso there's a process of transforming the various user selections into one or more ajax requests, and rather than write giant change handlers on each of the dropdowns, I'll let the dropdowns change individual data points on the map, then separately write a thing that determines what to fetch, checks caching, etc and then sets the Leaflet map up right.01:31
DanielBairdperhaps it will be more obvious how it works when i commit the current setup i have.  then you can at least look at the html and see if you are still upset by non-standard tag attributes etc01:32
gwso instead of wirinting event handlers assigning values to something it is like writing getters and setters and wiring them up with the elements?01:35
DanielBairdit's a bit simpler than that but yes the map-handler will look a bit like a traditional objectish type thing01:37
DanielBairdyou bind to data using those non-standard attributes we were talking about :)01:37
DanielBairdor you can drop a plain text template thing in like this {{ data }}01:38
DanielBairdbut usually you bind input elements and they use attrs01:38
gwnot the data directly I assume01:39
DanielBairdin angular the data referred to is in a "scope" which the angular docs get pretty excited about, but is really just a JS object.  it replaces the role of the model in traditional heavier frameworks01:40
DanielBairdyou write a controller when you describe what happens when things change in the scope you care about01:41
DanielBairdyou can have multiple scopes, a.k.a. buckets of data, on a page, so you can have a "user" scope that informs your login / logout / account stuff in the corner of the page, and a different scope object for the things your actually showing on the main part of the page01:43
DanielBairdangular also uses the current scope to find the handler that you said a button should trigger when clicked.01:44
DanielBairdyes compared to other js frameworks, angular is much more declarative.01:47
gwthe other bad part is, that they do name-based binding ....01:47
DanielBairdit feels uch more like writing html than writing yet another mvc layer01:47
DanielBaird* much01:47
DanielBairdyes that's true.  typos just stay there and don't get bound.01:48
DanielBairdi agree that maintence is important.. so far the biggest problem afaict will be in the map handler.  the rest is relartively easy to manage given enough comments in the sourece01:50
DanielBairdtwitter bootstrap uses less to compile all of its CSS, so as a bonus i was able to grab the bookstrap source and pull in the stuff i'm using at the Less level01:51
DanielBairdand coffeescript and less are both Node.js powered, so less doesn't add any more dev requirements than you already have with coffeescript01:52
gwand both can be complied into something to work with in a traditional way01:52
gwif you want to get rid of it01:52
DanielBairdyes that's true, you can doctor the js or css directly in an emergency01:53
DanielBairdor i suppose if you want to abandon the source for good01:53
gwso nothing new to learn for anyone used to plain js and css01:53
DanielBairdso here's what we should do, i think.01:54
gwboth do pass through block-comments01:55
DanielBairdyeah the right sort of comment will survive.  I would normally do a minify of everything before launch, but i can write the makefile / fab tasks to generate a non-minified version alongside for debugging.  i htink coffee can also insert comments that point to the corresponding lines in teh coffeescript.01:56
gwchange a compiler flag is not a big issue :)01:57
DanielBairdanyway.. i'll commit the current front end fo you guys to look through.  maybe I can talk you through the thing later.  then you can decide what else we need to worry about with respect to future maintainablility01:57
prologicwe'll wait for AL?01:58
DanielBairdbig al is coming?01:59
gwlunch participants :)01:59
DanielBairdlol Al really is a person01:59
DanielBairdprologic i'm knocking up a vagrantfile, you might need to chip in some dependency installation stuff for your parts02:00
DanielBairdbye for now, enjoy your lunches.  i'll el tyou know when there's something to try02:01
gwcu later02:02
DanielBairdgah, frickin no package for Node on centos03:05
DanielBairdoh well i'll dl the source and build it03:05
DanielBairdi'm working on the vagrant file03:30
DanielBairdcurrently installing node from source03:31
DanielBairdit's annoying to have to write but once this is done, we will always have a known good config for testing deps etc03:31
DanielBairdcrap forgot the -y arg for yum install03:34
DanielBairdmy frustration level is slowly creeping up03:34
DanielBairdokay it works for my stuff.  i'll commit the vagrantfile.  you should install virtualbox and vagrant: http://vagrantup.com04:23
DanielBairdhg add filename; hg commit -m "message"; hg push that what i should be doing?04:35
DanielBairdoh righ tit worked04:35
prologichg add04:36
DanielBairdyou can check out the vagrantfile now.. i'll work on my fab file04:36
prologichg commit04:36
prologichg push04:36
DanielBairdcool same as git.04:36
prologicthe irc notifier bot isn't here04:37
prologicI shut my home machine down last night04:37
prologicbecause of storms04:37
DanielBairdonce you have vagrant and virtualbox, you can try out the vagrant machine.  look in the vagrant file, most of it is bash script04:37
DanielBairdi think the centos box has python 2.6 but you'll need to add yum install whatevber for the other dependencies.04:38
DanielBairdit'll take a while to dl the centos image, but it caches it.  it'll also take ages compiling node, sorry can't avoid it afaick04:38
DanielBaird* afaict04:38
DanielBairdcan you run your bot on a free amazon ec2 box or something?04:39
DanielBairdor have you used up your free year already04:39
*** ircnotifier has joined #cmvt04:39
prologicthere we go04:40
DanielBairdgreetings ircnotifier.. a/s/l?04:40
DanielBairdoops sorry force of habit04:40
prologicamazon ec2 is not free :)04:40
prologicforce of habit?04:41
prologicI have an Intel Xeon server in the US anyway04:41
prologicI _could_ run it up there, but I'm not for the moment04:41
prologicit _was_ just a quick prototype because the project died04:41
prologicbut it's turned out that my little bot is actually really useful :)04:41
prologicI'm not really sure how terribly useful this vagrant stuff is personally04:42
DanielBairdnp if you were still in the ec2 honeymoon year, it's nice to have a constant server somewhere04:42
prologicI for one don't need to run up a virtual box vm just to test things out04:42
DanielBairdthink of it as testable dependency documentation04:42
prologic*nods* I see what you're saying04:43
prologicand where you're coming from04:43
prologicbut I already have quite good dependency testing04:43
prologicfrom the Python side of things04:43
DanielBairdyour other option is to install node and coffeescript and less onto your system04:43
prologicmap server just have to be installed however04:43
prologicI already have nodes installed04:43
prologicand npm04:43
prologichave you committed your new ui yet?04:44
DanielBairdyou will be fine then.. but the next guy along might be against it04:44
DanielBairdnot yet i wanted to make sure my fab tasks built a working htdocs directory04:44
prologicyeah that's fine04:45
prologicI don't mind per say04:45
DanielBairdbut anyway the vagrant machine has a /vagrant directory that syncs to the project root.  so it's looking at the same codebase, and you can completely ignore vagrant04:46
DanielBairdthen once in a blue moon, run vagrant up and see if it still deploys on a fresh machine at a different root path than on your dev box04:47
DanielBairdi think i don't have fab.. pip install fab will get it?04:48
DanielBairdyou can never tell with those python tools04:49
DanielBairdah okay it's pip install fabric04:50
DanielBairdif i run "fab" which i guess runs the default test task, i get:04:52
DanielBairdNo module named pytest04:52
DanielBairdoh wait that was the old dir04:53
DanielBairdno still same problem in the latest repo04:54
prologicpip install fabric04:54
prologicyes I haven't setup fab to pre-install anything yet04:55
prologicyou'll need to: pip install pytest04:55
prologicand pip install pytest-cov04:55
DanielBairdoh pytest isn't a normal python thing?04:55
prologicI'm working on automating the python dependeices04:55
prologicI've also installed less and coffeescript04:56
DanielBairdcoo, fab worked and passes 1 test04:56
DanielBairdcool again, my frontend fab task ran properly.  i screwed up the path but still, nice to see it doing something04:58
DanielBairdpython question05:06
DanielBairdi'm writing the "all" task that will do all the things05:06
DanielBaird(all the front end things)05:07
DanielBairdit takes args like this:05:07
DanielBairdthe other defs are the same:05:07
DanielBairdso when i invoke coffee() from all(), should i include the asterisk?05:08
DanielBaird    coffee(*args)05:08
DanielBairdor leave it off:05:08
DanielBaird   coffee(args)05:08
prologic>>> def f(*args):05:19
prologic...     print args05:19
prologic>>> def g(*args):05:19
prologic...     f(*args)05:19
prologic>>> g(1, 2, 3)05:19
prologic(1, 2, 3)05:19
prologic*args detonates a packed tuple05:20
prologicso if you pass *args that's fine05:20
*** gw has quit IRC05:20
prologicIf you do this however:05:21
prologic>>> def f(args):05:21
prologic...     print args05:21
prologic>>> def g(*args):05:21
prologic...     f(*args)05:21
prologic>>> g(1, 2, 3)05:21
prologicTraceback (most recent call last):05:21
prologic  File "<stdin>", line 1, in <module>05:21
prologic  File "<stdin>", line 2, in g05:21
prologicTypeError: f() takes exactly 1 argument (3 given)05:21
prologicNotice the TypeError?05:21
prologicyou're trying to pass in *args (which becomes a single argument, which gets unpacked when the function is called into 3 arguments05:22
prologic>>> def f(*args):05:23
prologic...     print args05:23
prologic>>> def g(args):05:23
prologic...     f(*args)05:23
prologic>>> g(1, 2, 3)05:23
prologicTraceback (most recent call last):05:23
prologic  File "<stdin>", line 1, in <module>05:23
prologicTypeError: g() takes exactly 1 argument (3 given)05:23
prologic>>> g((1, 2, 3))05:23
prologic(1, 2, 3)05:23
DanielBairdso the splat means pack or unpack, whichever direction it's going05:26
DanielBairdso my fab file is working, i'm about to do a huge commit of my sketchy ui05:27
DanielBairdi added htdocs to the fab clean, so move your htdocs somewhere else if you don't want it hosed05:27
DanielBairdi've got a version number thing going on too that i haven't made work properly, and i also don't handle the optional deploy path thing05:28
DanielBairdbut you;ll see that in the fabs i've written05:28
DanielBairdanyway brb gotta commit a hundred lines05:28
DanielBairdoh before i do, is there a .hgignore file?05:28
DanielBairdgoogle says yes.. okay i'll add .DS_Store and htdocs to that05:29
prologicthat's fine05:33
prologicI can help make the optional parts work05:33
prologicas well as a versioning scheme based not he repository id05:33
prologicor latest tag05:33
prologicyes there is a .hgignore file05:34
ircnotifier52e03d9882a1 by Daniel Baird: New UI, and fab files to build it into a htdocs dir.05:35
prologicwonderful :)05:36
DanielBairdi realised after i asked that not only did hg suppport .hgignore files, but we already had one05:36
DanielBairdthis is humble but cool05:36
DanielBairdlike the fonz05:36
DanielBairdwell no i guess he wasn't humble05:36
DanielBairdand also i forgot you were a young whipper snapper who won't remember the Fonz anyway.  and you should stay off my lawn05:37
ircnotifier45616ac14a24 by Daniel Baird: removed leftover compiled css05:39
prologicI'm not that young :)05:39
prologicand I do know the Fonz :)05:39
prologicand the stay off my lawn :)05:40
prologicwife will be picking me up soonish05:41
prologicand I"m not here tomorrow05:41
DanielBairdnp.. are you pulling down the new stuff?05:41
prologicnot yet :)05:41
prologicwill shortly05:42
DanielBairdtoday i mean.. or waiting to tomorrow05:42
prologicI will in a sec05:42
prologicI'm not here tomorrow05:42
prologichave a wedding to go to on the weekdn05:42
DanielBairdi think if you run05:42
DanielBairdfab clean frontend.all05:42
DanielBairdyou'll get a new htdocs dir that you can serve from, and it will work05:42
DanielBairdcool np05:42
DanielBairdin other news i've been feeling really super cold today, and my office mates think i'm crazy.  so it's possible i have a feever and will eb home tomorrow05:43
DanielBairdno, shit, friday tomorrow i'm not working anyway.  i wasted a sick day!!!!!!05:43
DanielBairdcan you let gerhardt know there's something to look at.  he might need help getting coffee / less / node working05:44
ircnotifier689916489824 by prologic: Added build task and project backend requirements.txt dependency list (used by pip)05:44
ircnotifier152d64292220 by prologic: Automated merge with
DanielBairdor i can email him05:45
ircnotifier0030288bacd5 by prologic: Hide any output except warnings for build task05:46
prologicyeah nps05:47
prologicI'll let him know05:47
DanielBairdalright i'm bailing.  see you on monday.  i should maybe walk you and g through the source so you can see how it works05:48
prologicyeah nps05:51
ircnotifier32754f70b39a by prologic: Hide stdout/stderr for build task05:53
*** gw has joined #cmvt06:35
*** DanielBaird has joined #cmvt07:22
*** DanielBaird has quit IRC07:30
*** DanielBaird has joined #cmvt07:57
*** DanielBaird has quit IRC08:01
*** DanielBaird has joined #cmvt08:58
*** DanielBaird has quit IRC09:03
*** DanielBaird has joined #cmvt09:59
*** DanielBaird has quit IRC10:03
*** DanielBaird has joined #cmvt10:59
*** DanielBaird has quit IRC11:04
*** DanielBaird has joined #cmvt12:00
*** DanielBaird has quit IRC12:04
*** DanielBaird has joined #cmvt13:00
*** DanielBaird has quit IRC13:05
*** gw has quit IRC13:31
*** DanielBaird has joined #cmvt13:58
*** DanielBaird has quit IRC14:24
*** DanielBaird has joined #cmvt14:54
*** DanielBaird has quit IRC15:03
*** DanielBaird has joined #cmvt15:49
*** DanielBaird has quit IRC15:53
*** DanielBaird has joined #cmvt16:19
*** DanielBaird has quit IRC16:23
*** DanielBaird has joined #cmvt16:50
*** DanielBaird has quit IRC16:54
*** DanielBaird has joined #cmvt17:20
*** DanielBaird has quit IRC17:24
*** DanielBaird has joined #cmvt18:21
*** DanielBaird has quit IRC18:25
*** DanielBaird has joined #cmvt18:51
*** DanielBaird has quit IRC18:55
*** DanielBaird has joined #cmvt19:45
*** DanielBaird has quit IRC19:50
*** DanielBaird has joined #cmvt20:38
*** DanielBaird has quit IRC20:42
*** DanielBaird has joined #cmvt21:08
*** DanielBaird has quit IRC21:12
*** DanielBaird has joined #cmvt21:39
*** DanielBaird has quit IRC21:43
*** DanielBaird has joined #cmvt22:09
*** DanielBaird has quit IRC22:14
*** DanielBaird has joined #cmvt22:39
*** DanielBaird has quit IRC22:43
*** DanielBaird has joined #cmvt23:10
*** DanielBaird has quit IRC23:14
*** gw has joined #cmvt23:22
*** gw has quit IRC23:23
*** DanielBaird has joined #cmvt23:40
*** gw has joined #cmvt23:42
*** DanielBaird has quit IRC23:45

Generated by 2.11.0 by Marius Gedminas - find it at!