Camelia, the Perl 6 bug

IRC log for #mojo, 2013-11-02

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

All times shown according to UTC.

Time Nick Message
00:06 basic6 joined #mojo
00:15 dqw113 joined #mojo
00:19 good_news_everyone joined #mojo
00:19 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/-8wA6A
00:19 good_news_everyone mojo/master 6a9315d Sebastian Riedel: one more link
00:19 good_news_everyone left #mojo
00:19 basic6 joined #mojo
00:27 exonity joined #mojo
00:27 sri https://www.youtube.com/watch?v=1coLC-MUCJc # async i/o in python
00:34 * jberger_ is worried sri might leave us for python :'(
00:35 * jberger_ reminds sri that the mop is going to be fun!
00:35 * jberger_ builds a big wall between sri and python while he is looking at the mop
00:36 sri :o
00:40 jberger_ don't you love it when you are dreading doing something you've done bunch of times, and then you remember that you wrote a module for it, and then go shopping instead
00:40 jberger_ https://metacpan.org/pod/Mojoli​cious::Plugin::InstallablePaths
00:49 sri :)
01:09 dqw113 joined #mojo
01:42 russum joined #mojo
01:47 asarch joined #mojo
01:56 punter joined #mojo
01:59 johnny5_ joined #mojo
02:05 johnny5_ joined #mojo
02:10 dqw113 joined #mojo
02:31 abhishekisnot joined #mojo
02:43 duncanthrax2 joined #mojo
03:14 beyondcreed joined #mojo
04:12 dqw113 joined #mojo
04:51 preflex_ joined #mojo
05:02 KindTwo joined #mojo
05:07 gblade joined #mojo
05:11 kanishka joined #mojo
05:13 jlzhang joined #mojo
05:26 jlzhang hi, all
05:27 jlzhang I have a question about Bridge.
05:29 jlzhang I have written a user login page in https://gist.github.com/anonymous/7275869
05:30 jlzhang and the routing page https://gist.github.com/anonymous/7275819
05:33 jlzhang I want to do Authentication in the bridge.
05:33 jlzhang but the routing is too big now
05:35 jlzhang how can I easily to add the Bridge before the routing?
06:19 dqw113 joined #mojo
06:42 jnbek joined #mojo
07:02 jamesw joined #mojo
07:11 d4rkie joined #mojo
07:25 dod joined #mojo
07:32 kanishka joined #mojo
07:39 kanishka joined #mojo
07:39 kanishka left #mojo
07:45 nebojs4 joined #mojo
07:45 nebojs4 Hi all !
07:48 nebojs4 lol i understand strange exemple names in mojo:lite , Bender , sri ...
07:50 nebojs4 i got a question for you guys, is there any document describing the directory structure of a mojolicious project. I want to make mine in a state of the art way :p
07:53 tianon "mojo generate app" ;)
07:55 nebojs4 sorry i found
07:55 nebojs4 http://mojolicio.us/perldoc/Mojo​licious/Guides/Growing#PROTOTYPE
07:55 nebojs4 yep tianon thanks
07:56 nebojs4 i generated it but dunno where to put things :)
08:00 dod joined #mojo
08:01 Vandal joined #mojo
08:14 trone joined #mojo
08:15 batman nebojs4: what don't you understand? did you create a lite or full app?
08:22 hrupp joined #mojo
08:47 exonity joined #mojo
08:52 rem_lex|pivo joined #mojo
09:07 denis_boyun joined #mojo
09:12 basiliscos joined #mojo
09:28 basic6_ joined #mojo
09:38 basiliscos joined #mojo
09:48 nebojs4 joined #mojo
09:48 nebojs4 sorry away batman
09:48 nebojs4 :p
09:49 nebojs4 yep i create a full app
09:50 batman https://metacpan.org/pod/release/SRI/Mojolicious-4​.53/lib/Mojolicious/Guides/Growing.pod#Differences
09:50 batman look at the tree
09:55 Vandal joined #mojo
10:03 basiliscos joined #mojo
10:14 denis_boyun_ joined #mojo
10:46 exonity joined #mojo
10:51 dqw113 joined #mojo
10:57 nebojs4 hey do you know how i can call a template file which is in my template directory ?
11:05 nebojs4 i used $self->render(template => 'login' ) ; but doesn't find my template file login.html.ep in template dir ...
11:49 denisboyun joined #mojo
11:59 exonity joined #mojo
12:06 punter joined #mojo
12:13 denisboyun joined #mojo
12:39 dqw114 joined #mojo
12:40 denis_boyun_ joined #mojo
12:55 nebojs4 joined #mojo
13:00 marcus plu: wtf, you work for metaquark now? :-D
13:00 marcus plu: that is so awesome
13:01 marcus plu: Say hi to Thomas from me.
13:01 marcus (and jonas)
13:26 * jberger_ considers renaming App::SimpleSlides to App::MojoSlides
13:27 jberger_ SimpleSlides made sense when it was a plugin, but now as a standalone app, I kinda want to use the word Mojo somewhere
13:27 * jberger_ really needs to stop building the presentation platform and start writing him presentation using it :-/
14:00 marcus jberger_: "Never make a module with Simple in it's name" is a rule that's worked well for me.
14:01 jberger_ :-)
14:01 marcus its name and that has ...
14:09 jberger_ rename accomplished
14:10 jberger_ also #fragement for slide overlay implemented
14:10 jberger_ might be almost time for an alpha release
14:11 jberger_ "Warning: This software is in alpha form at best. It may eat baby kittens at any moment."
14:16 exonity joined #mojo
14:18 dqw114 joined #mojo
14:32 sri jberger: in my experience it doesn't make sense to discuss incomplete pull requests
14:40 jberger_ sri: what I meant to say is "This patch is both overengineered and unnecessary"
14:40 jberger_ but I guess that wasn't very clear
14:46 sri i'm strongly opposed to multiple inheritance, but odds are he will just not answer at all, so any good argument might just be wasted
14:50 sugama joined #mojo
14:50 sugama joined #mojo
15:05 powerman joined #mojo
15:13 russum joined #mojo
15:18 * sri wonders how integrated into mojolicious a good job queue should be
15:21 sri was considering going as far as "app->queue->add_job(foo => sub { my ($queue, @args) = @_; my $app = $queue->app; ... }); app->queue->enqueue(foo => 'bar');" and "./myapp.pl queue worker"
15:22 sri (with a plugin and command)
15:24 arpadszasz joined #mojo
15:27 sri i'm unsure about a) making the mojolicious application always available and b) closures as jobs/classes as jobs/both
15:29 sri tight coupling of course has a few advantages, such as shared configuration, model helpers just being available...
15:30 sri originally i was pretty sure i wanted classes for jobs only... but since i talked to stevan yesterday about concurrency/parallelism patterns... i'm starting to wonder if something simpler might be better
15:32 sri those closures feel more like they are part of your app, the mental model is easier
15:35 lammel2 joined #mojo
15:37 batman sri: wanna use Mandel for this? will the queue have support for many backends?
15:37 batman backends = storage systems
15:37 sri nope
15:37 batman (nope) x 2 ?
15:37 sri yea
15:37 batman will mango be the backend?
15:38 * sri nods
15:38 batman i would really like if you did the coupling like you did with Validation
15:38 batman it's super sweet because it melts with your webapp, but can also be used without it
15:39 batman i would very much avoid having the app available in the queue
15:39 sri i do have a low level api that's mostly mojolicious independent
15:39 sri with the usual api my $job = $queue->reserve;...
15:41 sri but reusability is not really a goal, i want to make the pattern more approachable
15:41 sri low level api is pragmatic... just so i can have better test coverage ;p
15:41 batman ;)
15:43 batman the queue system at work is mostly very good. i really only regret allowing priority on the queue elements
15:43 batman that was really stupid. (and noone use it anyway)
15:43 sri i will definitely have priority
15:43 batman haha!
15:44 batman i think it's a really bad idea. i would rather have different queues with weight
15:45 sri you have a job name and priority, that's the same
15:45 batman job name? or queue name?
15:45 sri my jobs have names
15:46 sri or rather a "type"
15:46 batman weird. i'm looking forward to seeing the design
15:46 batman design/code/whatever
15:51 sri aside from time sync, the basic queue is pretty simple
15:57 sri also not sure yet if i should use a capped collection to inform workers that there are new jobs waiting or just sleep and pull
15:57 sri perhaps an optimization for later
15:58 batman capped collection ++
15:58 batman that also sucks at work: i'm using mysql instead of redis
15:58 batman sleep and pull is not aweful, but it's not sweet either
16:00 sri problem with capped collections is that if you have 1k idle workers, they all would suddenly wake up and ddos the database server
16:01 batman is 1k enough to ddos the server?
16:02 sri and of course it's another moving part
16:02 batman but i agree on make it work and then optimize
16:02 sri it's an example, what it actually could do to your database server is up to your imagination
16:04 batman it's annoying that i app->defaults(layout => ...) bit me that often... maybe i need to add a helper :)
16:06 batman (bit me when rendering json without - format i guess)
16:06 hummeleBop joined #mojo
16:08 sh4 joined #mojo
16:10 sri hmm, i can't find any other job queues that actually sync time... perhaps i'm overengineering
16:11 bowtie_ joined #mojo
16:18 batman does not seem important in real life either ;)
16:23 jwb joined #mojo
16:34 jwb hi, is there an equivalent to Catalyst::Plugin::UploadProgress in mojolicious? I saw something in the upload_lite_app.t, but in version 2.03. Would you still recommend to use it?
16:37 beyondcreed joined #mojo
16:37 bpmedley What's wrong with a plugin and helper for the job queues?  Perhaps having an official plugin that sets an api standard?
16:41 nebojs4 joined #mojo
16:51 lammel2 left #mojo
17:03 lammel2 joined #mojo
17:04 lammel2 joined #mojo
17:05 lammel2 left #mojo
17:07 gblade joined #mojo
17:07 gblade left #mojo
17:30 sri jwb: functionality is still there, but undocumented
17:31 sri http://mojolicio.us/perldoc/Mojo/Message#progress
17:31 sri closest you will get documentation wise
17:32 sri everything else you'll have to build yourself
17:34 sri i never wrote a cookbook recipe because a solution that scales would require a database and get pretty big
17:34 sri like the catalyst plugin, which is actually not very good
17:36 sri oh, my bad... the catalyst plugin uses a cache, so it's not that bad
17:36 sri s/cache/pluggable cache/
17:37 sri the fastmmap example still sucks
17:37 denisboyun joined #mojo
17:48 denis_boyun__ joined #mojo
17:57 sugama joined #mojo
18:01 * sri is starting to like the tight coupling idea for the job queue... it means you can easily factor out slow tasks without too much work
18:03 sri sending an email is getting too slow in that one action... turn it into a app->queue->add_task(confirmation_mail => sub {...})... while using the same model and helpers
18:04 sri later on perhaps app->queue->namespaces for task classes to be picked up automatically
18:05 sri hmm, perhaps even allow app->task->run(email_confirmation => 'sri@cpan.org') for testing right from within your app
18:06 sri run a task without queueing
18:06 sri s/task/queue/
18:07 sri anyway... good app integration would make testing jobs very simple
18:07 sri since you always have $t->app->queue with the full functionality
18:09 sri after all... you don't want to spin up worker daemons just to test your app
18:12 stephan48 so that means its possible to have task processing taken care of in seperate workers?(f.e. for tasks in cgi)
18:16 sri what use would a job queue be if it didn't do that?
18:16 powerman sri: it's unclear what you call the task - is it slow blocking code which should be run in separate process, or slow non-blocking code which should be run in background (so we won't have to wait until it completes before doing ->render()), or?
18:16 mst Bender, trust sri
18:16 Bender OK, mst
18:16 sri powerman: i'm talking about a job queue
18:17 sri what i'm calling a task is the code for a job
18:20 powerman but which sort of tasks should be queued? what is use-case for these queues?
18:20 sri blocking background operations
18:20 powerman and they'll be run in separate process(es)?
18:22 sri think resque
18:26 human39 joined #mojo
18:28 powerman I see
18:41 powerman joined #mojo
18:47 mire joined #mojo
19:15 Mike-PerlRecruiter_ joined #mojo
20:01 jberger_ sri: after watching guido's Tulip talk, it keeps bringing me back to your with::coro hackery
20:15 denis_boyun joined #mojo
20:19 punter joined #mojo
20:23 beyondcreed joined #mojo
20:28 jberger_ hic sunt dracones: can an eval string have a __DATA__ handle?
20:32 moritz looks like no
20:39 * jberger_ is attempting perhaps my most evil hack ever
20:40 powerman sri: what you think about ssl session restore feature?
20:40 hummeleBop joined #mojo
20:40 mst jberger_: it can't, but if you put a one-shot coderef in @INC you can get a string with __DATA__ that way
20:41 mst jberger_: look inside Eval::WithLexicals for sort-of prior art
20:41 powerman keep-alive is cool, but if connection will be closed (because of reaching ua->max_connections or because server closes it) it would be nice to be able to reopen ssl connection to that server faster
20:41 jberger_ why am I not surprised that mst has an idea on this one :-P
20:41 jberger_ then again, perhaps I'm only looking at this because I rewatched "the __END__ of everything: at lunch today
20:42 jberger_ s/:/"/
20:42 sri powerman: doesn't sound particularly exciting to me
20:43 sri premature optimization perhaps
20:44 powerman sri: for downloading few urls that's not important, but when you work with API (REST/JSON-RPC over HTTP/SOAP) you may need to do huge amount of http(s) requests, and ssl handshake may noticeable slowdown it
20:46 mst jberger_: oh, was it you who wrote a slide/presenter system in Mojo ?
20:46 powerman and if such API use some sort of auth and implemented correctly it usually use https
20:46 d4rkie joined #mojo
20:46 jberger_ yes, and now I'm trying to be able to still use __DATA__ templates though my config script is being eval-ed \m/
20:47 mst where does it live repo-wise?
20:47 jberger_ mst: https://github.com/jberger/App-MojoSlides
20:48 mst I shall probably have a look at that tomorrow.
20:48 jberger_ this is iteration number 2, which hopefully sucks less than iteration 1 did, but I'm not promising much
20:48 jberger_ and this one is only a few days old
20:49 mst I needed a new slide system anyway, and it's a good excuse to play with Mojolicious
20:49 jberger_ mst: note also that I over-abuse the templating system as a matter of habit
20:49 jberger_ you don't need to use nearly as many tag helpers as I do in the examples
20:49 mst since it's code that only I'll need to run, so I don't care what the rest of the world thinks
20:49 * jberger_ should probably stop doing that in examples, so he can stop apologizing for the examples
20:50 jberger_ mst: there is one talk in the wild that uses the old system
20:50 jberger_ http://mojolicious-introduction.herokuapp.com/
20:50 mst also, it strikes me as amusing to use Mojolicious to present a talk that'll at least partially be about a Web::Simple app
20:50 jberger_ ha!
20:50 jberger_ anyway, the source for that talk is at: https://github.com/jberger/MojoliciousIntroduction
20:52 jberger_ I wrote it as a means to not have to give a talk about Perl in either LaTeX or Javascript (or **gasp** powerpoint)
21:00 sri powerman: what's the actual performance gain? what are the downsides?
21:01 powerman sri: I don't think there are any downsides (except extra code lines and complexity added for implementing this feature) - it's standard ssl behavior implemented in all browsers and ssl libs AFAIK.
21:02 sri those are downsides
21:03 sri atm. i have a strong aversion to adding code to Mojo::UserAgent itself for example, since there's a huge refactoring still planned
21:03 powerman performance gain will be saving 2 or 3 (don't remember, I've implemented ssl proto in pure perl long time ago) RTT because of less packets send/received while ssl handshake and saving cpu for some cryptography
21:04 jberger_ hehe, almost got it :-)
21:04 sri if it's code in Mojo::IOLoop::Client chances might be better, but it all depends on cost vs gain
21:04 powerman and to make it work we'll need to keep ssl session in cache for some time after connection will be closed
21:07 powerman real performance gain will be only in some (probably rare) use-cases, but it's just one of features most people expect to work "by default" - like keep-alive
21:07 powerman just because most ssl clients including browsers has it
21:07 sri keep-alive is a huge performance boost for pretty much every use case
21:07 powerman sure
21:08 sri anyway, it's hard to argue about hypothetical features without having any idea how complex the code would actually get or benchmarks
21:09 d4rkie joined #mojo
21:10 powerman in my app I need to do hundreds api calls per second using https, so I've just run wireshark to find out is keep-alive and ssl session restore works in Mojo… keep-alive works, session restore doesn't work. so I decide to ping you about this, just in case (maybe it already implemented and doesn't work because of some bug, who knows? :))
21:12 powerman probably in near future using SPDY will became another one feature like ssl session restore which will be expected to work by default
21:13 sri we will never support SPDY
21:15 sri maybe HTTP/2 in 2015/2016... we'll see... https://github.com/kraih/mojo/issues/423
21:16 sri powerman: oh, i thought you wanted to work on it... if that's not the case then it's a definitive no for ssl session reuse
21:19 jberger_ mst: https://github.com/jberger/App-MojoSlides​/blob/master/ex/presentation_from_data.pl # \o/
21:31 jberger_ actually that hack ended up being sadly less evil than I thought it would be
21:34 sri jberger: stop doing that tag thing!
21:34 sri we made helpers cheap for a reason, remember? :p
21:35 * sri bonks jberger on the noggin
21:35 sri now it's either real tags or tag specific helpers
21:36 sri %= p 'It works!'
21:37 sri %= div 'jberger is in trouble!'
21:44 jberger_ true, true
21:44 jberger_ I should just make a little plugin that wraps all of the tags
21:45 jberger_ sri: looking at TagHelpers, did you specifically reserve the names of the standard HTML tags?
21:45 jberger_ if so that was a wise thought
21:46 sri yes, that was intentional
21:46 punter joined #mojo
22:00 sri jberger: would be funny if you made it scrape the html5 spec and generate helpers dynamically :D
22:01 sri (i'm not serious!)
22:04 jberger_ actually mst has a list in Web::Simple
22:04 jberger_ I've just stolen that
22:07 gryphon joined #mojo
22:12 basiliscos joined #mojo
22:28 jberger_ sri: yikes, it actually barfs on Mojolicious versions before we redid the helpers!
22:29 jberger_ hmmm, or that might be something I did :-P
23:07 jberger_ sri: title helper :-(
23:10 sri aww
23:10 sri that one was an accident
23:15 jberger_ actually there are several now
23:15 jberger_ and a few core keywords too
23:15 jberger_ perl core that is
23:15 jberger_ map
23:17 jberger_ my current list: link, map, param, select, time, title
23:20 russum joined #mojo
23:25 jberger_ sri: perhaps I shouldn't even try to wrap this many, perhaps I should just wrap the few I'm likely to need an be done with it
23:25 jberger_ all the h's
23:25 sri yea, use the most common ones
23:25 jberger_ p div
23:25 jberger_ tables
23:28 jberger_ what the heck is a details tag
23:30 sri well then
23:30 sri lets check a few websites :)
23:30 sri perl -Mojo -E 'say g("mojolicio.us")->dom->find("*")->type->uniq'
23:32 sri a custom div helper might make sense, considering how they always have a class or id
23:32 sri div '#foo#bar.baz.yada'
23:34 jberger_ sri: ooh I like that idea
23:34 jberger_ selector-like
23:37 sri hmmmm
23:37 sri actually the tag helper could to that too :D
23:37 jberger_ as I'm paring down, its starting to feel a little arbitrary
23:37 sri %= tag '#foo'
23:38 sri <div id="foo" />
23:39 jberger_ personally I would prefer that just for a div helper in that case
23:40 jberger_ however
23:41 jberger_ if we made it such that if the second arg to tag started with # or . it would apply id or class to that tag
23:41 jberger_ then it wouldn't be such a leap to say that if the first argument did, the default tag is div
23:42 jberger_ but then again, from a documentation driven design standpoint that would be a tough sell
23:42 sri yea
23:42 sri not worth the trouble
23:42 jberger_ ... in mojo core that is :-)
23:50 jberger_ what would div '#foo#bar.baz.yada' create? <div id="foo", id="bar", class="baz bat" />
23:50 jberger_ ?
23:50 jberger_ what does multiple # mean
23:51 jberger_ no comma obviously
23:52 jberger_ http://stackoverflow.com/a/5685221/468327
23:52 jberger_ http://www.w3.org/TR/selectors/#id-selectors
23:54 jberger_ interesting, multiple class tags is "explicitly non-normative"
23:56 jberger_ anyway, I think _tag cannot do multiple id tags
23:57 marty sri++ on tight coupling job queue.  sounds far out man

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