Camelia, the Perl 6 bug

IRC log for #mojo, 2010-07-07

| Channels | #mojo index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:21 Alias joined #mojo
00:53 GitHub101 joined #mojo
00:53 GitHub101 mojo: master Sebastian Riedel * 07b5293 (1 files in 1 dirs): fixed a test - http://bit.ly/9KFBzF
00:53 GitHub101 left #mojo
00:56 GitHub158 joined #mojo
00:56 GitHub158 mojo: master Sebastian Riedel * 7170975 (1 files in 1 dirs): cleanup - http://bit.ly/95b56k
00:56 GitHub158 left #mojo
00:57 ask-_ joined #mojo
00:58 ask_ joined #mojo
01:06 ashleydev joined #mojo
01:16 xantus yay, its starting to come together
01:16 xantus you drop a script tag on a page
01:16 xantus it long polls to /remote-console
01:17 xantus and registers the client in couchdb
01:17 xantus you go to /console/ and enter the client id
01:17 xantus and you get a bespin editor that you can hit a button to eval code on the client browser
02:09 Alias__ joined #mojo
03:19 yakudzo joined #mojo
03:44 janus joined #mojo
03:44 ashleydev joined #mojo
05:38 Alias joined #mojo
05:42 gabiruh joined #mojo
06:04 Su-Shee joined #mojo
06:09 Su-Shee_ joined #mojo
06:27 ysyrota joined #mojo
06:39 memowe Gooooooooooooood morning mojo!
07:11 esskar joined #mojo
07:11 esskar moin
07:11 esskar sri: mojolicious needs a compare-sheet between catalyst, dancer, ...
07:13 memowe Pony: X   X   X   V   X
07:13 memowe Fun: X   V   X   X   X
07:13 memowe :)
07:25 nagual joined #mojo
08:12 marcus memowe++
08:23 marcus sri: is Mojo::Template streaming output?
08:25 marcus that's one of my biggest gripes about template toolkit.
08:39 marcus it's clobbering time!
08:40 yko joined #mojo
08:44 Alias That TT doesn't stream?
08:49 marcus Alias: yeah
08:52 yko i don't think that streaming templates possible, according to mojo rendering process
08:53 yko If i get you right about streaming and templates, shure
08:55 yko And even if that would be possible, its overhead :D
08:55 marcus yko: ok, that was totally ambiguous to me.
08:55 marcus yko: what do you mean it's overhead?
08:55 marcus it means returning content to the end user more quickly
08:56 yko You want to throw content into user part by part, right?
08:56 marcus yes
08:56 marcus so that the user doesn't have to wait for the entire template to render
08:56 marcus before getting some content.
08:57 yko ok. now look: first you need to send user <html> <head .... blablabla
08:57 yko usually, it contained into the very beginning of layout, right?
08:57 marcus hmm?
08:58 marcus let's say I have a search page, with sidebars generated on the right hand side, for instance
08:58 marcus with streaming, the browser can actually render the main results, even before you've returned the results for the sidebar
08:59 yko But anyway, first lines of output - it's first lines of mojo layout.
09:00 yko speaking in context of default generated 'app', it would be '<!doctype html><html>'
09:00 marcus sure.
09:00 marcus that's usually the first lines of a html document.
09:00 yko so, to send those lines to user, you need to render layout
09:00 yko in mojo, at least. right?
09:00 marcus the layout wrapper, yea?
09:00 yko yes
09:01 marcus sure
09:01 marcus but only the first part of it
09:01 marcus until it hands over control to the template.
09:01 yko okay. but actually, mojo doesn't know which layout you will use, before rendering all nested templates :)
09:01 marcus uhm, actually I think it determines that in the compile state?
09:01 yko nope
09:02 marcus ouch
09:02 marcus that's a problem then.
09:02 yko i can change $self->stash('laoyut' => 'blah') in templates
09:03 tabbi joined #mojo
09:03 yko look at 'layout' helper. all what it does - just $self->stash('layout' => shift) :D
09:04 * yko goes and check that assumption ^)
09:04 yko damn, im right :D
09:04 tabbi hi, i have a strange problem here: i wanted to use MojoX::Renderer::Mail, but if I "use" it in MyMojoApp.pm I geht the following error when i try to start the daemon:
09:04 tabbi Can't locate object method "new" via package "MyMojoApp" at /usr/local/share/perl/5.10.0/Mojo/Server.pm line 25.
09:05 tabbi if i comment the use there isn´t this error
09:05 yko perl -c MyMojoApp.pm first :)
09:06 tabbi MyMojoApp.pm syntax OK
09:14 yko you should check if MojoX::Renderer::Mai installed and it can be loaded
09:14 yko mb try perl -MMojoX::Renderer::Mai -e 'print "OK"'
09:22 marcus hmm, maybe I should try using HTML::Zoom
09:24 spleenjack joined #mojo
09:29 memowe marcus: maybe you should try loading your sidebar ajaxy :)
09:30 yko momowe++
09:30 yko or load search results with ajax :D
09:46 marcus that sucks
09:46 marcus I hate pages that do that
09:47 yko actually yes, that requires you to have own history manager
09:47 yko and non-js fallback
09:48 marcus well, how can you do a non-js fallback without waiting for the content? ;)
09:49 yko <a href='non-ajaxlink' onclick='return load_content($(this).attr("href") + "/ajax"'>
09:49 yko whatever, just forget it :)
09:49 marcus but if you're loading your sidebar with ajax...
09:49 marcus and you want to provide a fallback, you have to wait for the sidebar content anyways.
09:50 yko yes
09:50 yko dont think it's possible to send streaming output with mojo at the moment, but better ask kraih
09:51 marcus Think I'll try using Template::Alloy
10:24 esskar joined #mojo
10:25 esskar sri: http://www.perl-community.de/ba​t/poard/thread/15208#ms_139615 <- flowers ;)
10:25 garfield http://xrl.us/bhq3qc
10:34 * marcus spends 1 sri on a beer.
10:37 yko joined #mojo
10:48 tabbi joined #mojo
10:50 yko joined #mojo
11:00 sri marcus: streaming is pretty muvh impossible with normal template systems
11:00 sri and i'm not sure you gain much by doing it
11:01 marcus sri: template-alloy supports it
11:01 sri don't forget you need to send the headers first
11:01 marcus varnish streams content, and it's pretty noticable with cache misses
11:02 marcus (when using ESI)
11:02 sri so most of your logic needs to be done anyway
11:03 sri marcus: whats the actual gain?
11:03 marcus sri: percieved better performance for the end user.
11:03 sri but why?
11:04 marcus what do you mean?
11:04 sri why does it look faster
11:04 sri i don't buy it
11:04 marcus ok for example on this page: http://www.startsiden.no/tvguide
11:04 dotan joined #mojo
11:04 garfield [ TVGuide ]
11:05 sri i can totally see splitting up template rendering into multiple smaller steps actually slowing down everything
11:05 marcus with streaming, it can show the headers before the web service has returned any channel, and as it's sax parsing the web service that returns channels and event,s it can start rendering boxes
11:05 Foxcool joined #mojo
11:05 marcus but why would you need to split up template rendering into multiple smaller steps?
11:05 marcus you just need to output the result as the template is processed
11:06 marcus rather than put it in a scalar first and then push it out when the entire template has been rendered
11:06 sri layout is processed after page
11:06 marcus yeah, yko said that
11:06 marcus which makes it impossible to do with layout
11:06 sri i don't buy it
11:06 marcus with [% PROCESS header.tt %] ... [% PROCESS footer.tt %] it's fine
11:09 sri how do you handle encoding?
11:09 sri chunk wise?
11:18 lee7 joined #mojo
11:21 spleenjack joined #mojo
11:25 sri the main problem i see is the potential disparity between generated chunks and the potential maximum size of a chunk, every small chunk is a huge context switch
11:26 sri you might see the loading bar a little earlier, but big chunks will make it end faster
11:27 sri if an error occurs your user might end up with half a page
11:31 marcus sri: end users care less about the loading bar than what they are seeing on the screen
11:31 marcus once you can see content you start interacting.
11:31 marcus specially if there's more than one page of it.
11:32 marcus which is actually a huge problem with things like unobtrusive javascript
11:32 marcus since it's not appled until document.ready
11:38 marcus applied
11:44 tabbi yko: i´ve found the mistake: I said "use MojoX::Renderer::Mail" before "use base 'Mojolicious';". saying it afterwards works good!
11:46 sri marcus: users don't interact with half a page
11:46 sri marcus: they will start looking and get annoyed waiting ;p
11:46 sri wondering why there's a delay
11:50 marcus sri: that's not what we see in user testing.
11:52 sri marcus: can i see you user test?
11:55 marcus sri: I don't have anything to hand out. Talking about observing users in a testing lab
12:00 sri ok
12:01 sri i don't see it being worth all the risks and constraints
12:03 sri you basically have to break out of the whole request/response model
12:05 sri headers need to be ready before you start rendering, then you render the first chunk and switch context to the server, wait for it to finish writing, switch back, start work on the model layer, finish rendering
12:09 marcus php for instance operates without an output buffer by default
12:10 sri so it makes apache buffer
12:10 sri you can't prevent io delay, it just happens
12:11 sri but apache also has one process per connection
12:11 sri (different can of worms)
12:15 * marcus takes sri's can of worms and goes fishing
12:15 dotan marcus: isn't IO delay negligible compared to database access on the server's end and html/css/javascript layout on the other?
12:16 marcus dotan: yes, I think so. Typically the reason to do this is being able to render some content while waiting for database access on the server's end
12:16 marcus or content from a remote service for instance.
12:18 sri marcus: but you get quite a bit of overhead with chunked encoding
12:19 sri (since you can't know the content length in time)
12:19 sri so many constraints
12:20 sri well, you can theoretically do it in mojolicious by working with callbacks exclusively
12:21 sri and rendering your templates in partials
12:22 sri shouldn't be too hard to create a test case
12:23 sri and actually try it side by side
12:23 sri the code won't be pretty though
12:24 sri you depend on context switching unless you have control the whole process like php
12:24 sri *over
12:25 marcus well, fastcgi does control the whole process?
12:25 sri the more i think about it the more certain i am it's a bad idea ;p
12:26 dotan php has control over the whole process? Isn't it basically the same as a CGI with $| = 1; ?
12:26 sri it is
12:28 sri fastcgi can control the whole process
12:29 sri it's not the lowest common denominator web frameworks have to be designed around though
12:30 sri and you have no idea how the web server will handle fastcgi
12:30 sri there are servers that buffer chunked output from scripts
12:31 sri this is all stuff you can only build for one specific setup
12:31 sri there are no standards to make sure it works somewhere else
12:33 sri i think the fcgi spec actually forbids chunked encoding
12:41 marcus http://www.python.org/dev/peps/p​ep-0333/#buffering-and-streaming
12:41 garfield [ PEP 333 -- Python Web Server Gateway Interface v1.0 ]
12:41 garfield http://xrl.us/bhq4jw
12:51 sri marcus: ?
12:52 diegok joined #mojo
12:52 sri we allow the same, but it doesn't help in any way
12:55 esskar "Nachteil ist vermutlich das es zu Mojolicious noch kein Buch gibt. "
12:55 sri marcus: btw i've just checked a few web servers, all buffer fastcgi output so far
12:55 sri "to speed things up"
12:56 sri because small chunks ruin performance ;p
12:56 sri so far all even buffer the whole output from fastcgi
12:57 * sri nods at esskar
13:04 sri oooh, monkey island 2 for iphone is now available :)
13:07 marcus and ipad
13:07 marcus varnish serves content chunked tho
13:10 sri marcus: well, i think mojolicious support for it is as good as it can be
13:11 marcus how does this work for web sockets tho?
13:11 sri ?
13:12 marcus they're basically a stream, aren't they?
13:12 sri they are something entirely different
13:12 sri and websockets can't be done via cgi/fastcgi by design
13:13 marcus http://uxmyths.com/
13:13 garfield [ UX Myths ]
13:14 vel joined #mojo
13:14 marcus sri: It could be useful to be able to stream to a web socket from a template tho
13:14 sri i doubt that
13:14 marcus <% while(<blocking stuff>) { %> do some output <% } %>
13:15 sri no
13:15 marcus less overhead than rendering a new partial for each <blocking stuff> ?
13:15 sri you don't stream shit over websockets usually
13:16 sri you build nice little messages
13:16 marcus I'm a little tea pot, short and stout o/o
13:17 diegok joined #mojo
13:17 sri <blocking stuff> already turns me off
13:17 sri i don't see the point
13:18 sri the overhead for rendering a partial is minimal if it has already been compiled
13:19 sri btw. websockets are not optimized for pushing around huge amounts of data
13:20 sri they provide low latency connections for small bi directional messages
13:20 sri sending your data in small chunks is a huge performance killer
13:21 sri what you really want is to bundle all your data into one big chunk
13:21 sri and then try to write it at once
13:22 sri marcus: http://uxmyths.com/post/7177​81129/myth-18-flash-is-evil # yea, that site totally convinced me :D
13:22 garfield [ UX Myths - Myth #18: Flash is evil ]
13:22 garfield http://xrl.us/bhq4va
13:22 stephan48 you mean like sending to client: "there are some new data avaible over there" after a request from client and then the client hits a get action or somewhat like that to get the data?
13:23 sri stephan48: i'm not sure what you mean...but no
13:23 stephan48 fine :)
13:23 sri ;p
13:24 Foxcool joined #mojo
13:27 sri marcus: actually i'm not even sure how you imagine direct rendering to work
13:27 marcus like sending a mail to your client and telling him 'there is new data', and then he goes to the shopping mall and picks it up.
13:27 marcus sri: outputting content to stdout as it is generated?
13:27 marcus sri: given that Template::Alloy supports it..
13:28 sri it's not that simple
13:29 marcus it never is..
13:33 sri it is theoretically possible to pass in a scalar ref, but i don't see a gain...
13:36 marcus no pain, all gain
13:36 marcus or something.
13:37 marcus sri: the way alloy does it is 'Defaults to false. If set to true, generated template content will be printed to the currently selected filehandle (default is STDOUT) as soon as it is ready - there will be no buffering of the output.
13:37 marcus guess that'd fuck up mojo, given that headers haven't been written yet.
13:37 tab joined #mojo
13:37 sri umm, that wouldn't work like at all
13:38 sri we don't ever directly write to anything
13:38 yko I hope you remember that Mojolicious "is now officially frozen for the 1.0 release" :)
13:38 sri yko: of course
13:39 sri marcus: thats just not how things work
13:39 marcus sri: it would work inside a mod_perl handler
13:40 sri because you have a direct client connection and total control
13:40 marcus indeed
13:40 sri and that costs you
13:41 marcus sucky sucky, five dollah?
13:45 sri marcus: anyway, what are you doing while your process is blocking to write the first part of the template?
13:45 sri your argument earlier was that you want to do something else in the meantime
13:46 sri that would require yet another process and ipc later
13:46 sri direct writing is a blocking operation (if it's possible)
13:48 marcus sri: waiting for a http response?
13:50 sri marcus: ohoh, mixing blocking and non blocking io?
13:51 sri there is no way you can combine mod_perl direct writing and a non blocking http client without wasting resources
13:52 sri and a lot of scheduling trouble
13:52 marcus http://search.cpan.org/~andremar/WWW-Cur​l-Simple-0.100181/lib/WWW/Curl/Simple.pm is the client we're using atm.
13:52 garfield [ WWW::Curl::Simple - search.cpan.org ]
13:52 garfield http://xrl.us/bhq442
13:52 marcus doing a series of parallel requests.
13:52 sri oh, i've written the parallel curl api for perl ;p
13:54 marcus andreas is the one who switched to it
13:54 marcus abcsok.no used to use http://search.cpan.org/~marclang/ParallelUs​erAgent-2.57/lib/LWP/Parallel/UserAgent.pm
13:54 garfield [ LWP::Parallel::UserAgent - search.cpan.org ]
13:54 garfield http://xrl.us/bebgkk
13:56 sri that doesn't change anything though
13:56 sri it costs
13:56 marcus everything costs something.
13:57 sri so we agree ;p
14:04 marcus I still think it has a mission
14:04 marcus but it might be better to do it in the cache than in the app server
14:17 tab left #mojo
14:31 awnstudio joined #mojo
14:50 sri marcus: the only valid reason i see for writing partial responses would be allowing browsers to start fetching images/css earlier
14:53 sri it's still damn hard though, you basically need to add scalar ref rendering support to Mojo::Template and add chunked encoding awareness to MojoX::Renderer
14:53 sri marcus: patches welcome if you do it for that reason :)
15:03 sri but i doubt anyone is insane enough to actually do it ;p
15:04 sri since you need to use ->res->body(sub {...}) to context switch between server binding and app
15:06 sri http://stackoverflow.com/questions/3027435/is-t​here-a-way-to-flush-html-to-the-wire-in-sinatra
15:06 garfield [ Is there a way to flush html to the wire in Sinatra - Stack Overflow ]
15:06 garfield http://xrl.us/bhq5he
15:06 sri same problem different language
15:06 sri and same solution
15:20 dotan left #mojo
15:40 yko joined #mojo
15:58 vel joined #mojo
16:40 ashleydev joined #mojo
16:52 su-bzero_ joined #mojo
16:54 GitHub139 joined #mojo
16:54 GitHub139 mojo: master Sebastian Riedel * f383c73 (2 files in 2 dirs): cleanup
16:54 GitHub139 mojo: master Sebastian Riedel * d89ebeb (2 files in 2 dirs): Revert "cleanup" ...
16:54 GitHub139 mojo: master commits 7170975...d89ebeb - http://bit.ly/a88xcj
16:54 GitHub139 left #mojo
16:54 yko gg
16:54 sri oops
17:02 vel joined #mojo
18:12 yko joined #mojo
18:30 sri http://rails-wargames.peepcode.com/ # damn...we need a mojolicious version :o
18:30 garfield [ Untitled document ]
18:40 yko ++
18:40 spleenjack joined #mojo
18:40 sri http://www.apple.com/mobileme/news/2010/07/​preview-the-new-mobileme-calendar-beta.html # this is how web apps should look like
18:40 garfield [ Apple - MobileMe - News - Preview the New MobileMe Calendar Beta ]
18:40 garfield http://xrl.us/bhq59u
19:04 vel joined #mojo
19:34 ash_ joined #mojo
19:35 ash_ i have a question i can't seem to find the answer to in the docs (maybe i am looking in the wrong place?) how do you set a error route? so if there are no matches to the routes it uses that?
19:39 spleenjack left #mojo
19:46 yko what do you mean 'error route'?
19:47 yko 550 default error page?
19:47 yko 500 even
19:47 ash_ yeah, or 404
19:48 ash_ (or both?)
19:48 yko look at 'templates/exception.html.ep' and 'templates/not_found.html.ep'
19:48 yko this is default pages for 500 and 404
19:48 ash_ can you add controller logic to them also? (just curious)
19:50 yko hmm, never thought about that.
19:52 yko It looks like you can redefine Mojolicious::Controller::render_exception subroutine and process exceptions there
19:53 sri why would you add controller logic?
19:53 yko hmm. actually int looks like you can have sub render_exception separate in every controller
19:53 yko sri always goes that way :D
19:53 ash_ more just curious
19:54 ash_ maybe you want to tell them why it was a 500?
19:54 ash_ i duno
19:54 * sri is a pragmatist
19:54 yko sri++
19:54 sri thats template logic
19:54 sri you can access the exception object
19:56 sri if you look at the exception template generated by default you can see it even renders different results based on run mode
19:56 yko wow. really? didnt know that
19:56 yko mojo++
19:57 * yko never opened exception.html.ep
19:57 yko :)
19:57 sri http://github.com/kraih/mojo/blob/master/li​b/Mojolicious/Command/Generate/App.pm#L190
19:57 garfield [ lib/Mojolicious/Command/Generate/App.pm at master from kraih's mojo - GitHub ]
19:57 garfield http://xrl.us/bhq6hd
19:58 yko aahh... app mode. i thought cgi/daemon/etc
19:58 yko sorry
19:58 sri Oo
19:58 yko yeah, i saw that code. it's really nice
19:58 sri what would be the point of cgi/daemon?
19:59 yko i dont konw, that why i was surprized.
19:59 yko you always can design something unexpected and shiny :)
19:59 sri ;p
20:00 yko for example some bricks on 500 page in CGI mode :D
20:00 yko with Bender quote
20:01 * yko red article about Futurama yesterday
20:01 yko never saw that ser. :-[
20:02 sri :o
20:03 yko can i serve static file from outside root?
20:06 sri i guess you can ->serve_static('../../../etc/passwd')
20:06 yko :'(
20:07 yko hehe
20:07 yko but ye, that's good
20:07 sri it's not considered a feature though
20:08 yko actually i can localize static->root from controller. but that's ughly
20:08 yko and can be painfull, i think
20:09 sri you shouldn't really serve files from outside the home directory
20:09 sri only valid use case i could think of would be an upload directory or so, but even that could be inside public
20:09 yko i shuldt, ye. but i will
20:10 yko sri - that's case of upload dir :)
20:16 vel joined #mojo
20:29 yko argh... better way for correct file downloading is to set up routes lilke ':id/(*name)' and just throw static file by id or handle this through nginx/apache somehow
20:29 yko setting 'Content-disposition', 'attachment; filename="' ... dowsn't look nice for me
20:49 spleenjack joined #mojo
22:03 xantus hey hey
22:08 * sri waves
22:09 xantus anyone want to collab on a mojo backend for socket.io?
22:09 xantus http://socket.io/
22:09 garfield [ LearnBoost labs ]
22:09 xantus we already have what we need
22:09 xantus just need to combine it all, and make it awesome
22:10 * sri is still writing docs
22:11 xantus :o
22:12 xantus rails-wargames
22:13 xantus http://www.yankodesign.com/201​0/07/07/my-ipad-has-a-camera/
22:13 garfield [ iPad Cam-Case by Chet Rosales � Yanko Design ]
22:13 garfield http://xrl.us/bhq6zp
22:15 ltriant joined #mojo
22:16 dotan2 joined #mojo
22:41 xantus I ganked the wargames page, maybe I'll play with that some time
22:45 xantus Oh, I bought a car today
22:45 xantus 2004 325i bmw
22:45 xantus only 51k miles
22:46 dotan2 left #mojo
22:55 * sri thinks about buying a quad for fun :)
22:56 xantus I have one in Washington
22:57 xantus 400cc Suzuki Eiger
22:57 sri not sure if i would get to use it often enough with the weather around here though
22:58 xantus got it a few years ago for 5k
22:58 xantus should have sold it instead of leaving it
22:59 sri was thinking about something more sporty
23:00 sri like a yamaha raptor
23:00 xantus yeah, mine is a utility 4x4
23:00 xantus still goes 55mph
23:00 xantus lol
23:00 xantus really fast
23:00 xantus for a util quad
23:10 sri :)
23:10 sri Zzz
23:11 xantus wait!
23:11 xantus :)
23:11 sri :O
23:11 xantus btw, I have a mojo project that I can show you later
23:12 xantus its a js console into remote browsers
23:12 sri sweet
23:12 xantus the console app and the remote browers long poll mojo
23:12 xantus and you can eval js on the clients, and get the results
23:12 xantus eventually it'll be a better debugger
23:12 xantus its useful when you want to debug a device that doesn't have a keyboard
23:13 xantus well, a real one
23:13 xantus ok, that is all :)
23:13 sri \o/
23:13 xantus it uses bespin
23:13 sri soooo tired
23:13 xantus nn
23:13 sri nn
23:14 sri :)
23:30 ashleydev_ joined #mojo

| Channels | #mojo index | Today | | Search | Google Search | Plain-Text | summary