The web in a box - a next generation web framework for the Perl programming language

IRC log for #mojo, 2015-04-02

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

All times shown according to UTC.

Time Nick Message
00:00 mattastrophe joined #mojo
00:12 hernan604 is there some "plugin" for mojo that will give me an admin ?
00:12 hernan604 and some standard pg tables
00:12 hernan604 and some oauth login
00:12 hernan604 ?
00:13 marty joined #mojo
00:14 Grinnz what?
00:15 Grinnz those are all very different things, and i dont even know what the first thing meant
00:17 hernan604 hehe
00:18 hernan604 i think i meant a basic app with all those things
00:18 sri a django built on top of mojolicious
00:19 hernan604 maybe but not so complex, only basic usual things
00:19 good_news_everyon joined #mojo
00:19 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/jhvn
00:19 good_news_everyon mojo/master ed26e91 Sebastian Riedel: add button_to helper to Mojolicious::Plugin::TagHelpers
00:19 good_news_everyon left #mojo
00:19 jberger unchained!
00:29 good_news_everyon joined #mojo
00:29 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/jhJW
00:29 good_news_everyon mojo/master cd7900e Sebastian Riedel: test more method variations
00:29 good_news_everyon left #mojo
00:33 jabberwok how about the book title:  "WordPress, PHP, and MySQL unchained, unplugged, unlinked and queued for deletion."
00:36 Grinnz hernan604, unfortunately none of those things are "basic", though they may be usual
00:37 Grinnz pg tables are highly dependent on the application's function
00:37 Grinnz there is a oauth plugin for mojo, though: https://metacpan.org/pod/Mojolicious::Plugin::OAuth2
00:40 hernan604 Grinnz: ok
00:41 hernan604 i took a quick look at padrino
00:42 hernan604 and thought maybe there could be some plugin to give me this basic admin and login automaticaly configured
00:42 Grinnz i don't know anything about padrino's setup
00:43 Grinnz something like that you'll have to make some assumptions about the application, though
00:43 hernan604 http://www.padrinorb.com/
00:44 hernan604 from what i understand it uses "Sinatra"
00:44 Grinnz yes, sinatra is what Dancer is based on and is more analogous to Mojo
00:44 hernan604 and adds "admin", and some other things on top of it
00:45 Grinnz something like that is definitely possible as a plugin
00:45 hernan604 its really nice... if i were rubysy i would use it
00:45 hernan604 rubyst*
00:48 preaction isn't there RapidApp? and a few other mojolicious-based applications on the cpan?
00:51 hernan604 rapidapp is catalyst
00:53 hernan604 leaving now
00:53 hernan604 cyall later
00:55 mattastrophe joined #mojo
01:03 zivester joined #mojo
01:37 jberger there is Ado
01:38 jberger is that in the right vein?
01:53 serentiy I love pubsub and websockets..  this is the most elegant solution I have ever seen.  Why didnt this exist 10 years ago?
01:54 klapperl joined #mojo
01:54 Grinnz :)
02:02 sri (:
02:03 * sri remembers trying pubsub with mongodb... it was so horrible
02:04 sri but with a reliable database it's a lot of fun
02:04 genio I get to have fun soon converting a large DB from SQL Server to Pg
02:08 linagee joined #mojo
02:08 linagee is there an easy way to keep trying to reconnect to a websocket? :-/
02:09 linagee I got this far: $tx->on(finish => sub{ print "websocket killed!! trying to reconnect....\n"; });
02:09 linagee maybe inside of there... $ua->websocket(URL => handler_sub);  ??? (but I'm inside of the handler sub already...)
02:10 linagee I tried calling a reference to the handler sub. it seemed to kind of work, but $tx->send doesn't work on subsequent connections....
02:11 sri wow, google is removing the cnnic root cert from chrome :o http://googleonlinesecurity.blogspot.de/2015/03/maintaining-digital-certificate-security.html
02:12 sri not feeling sorry for china after the shit they pulled with github though
02:14 Zoffix What's happening with China?
02:17 noganex_ joined #mojo
02:19 linagee am I in the wrong channel? :(
02:19 jberger linagee: that depends, what are you looking for?
02:19 linagee jberger: Mojo websocket help
02:20 jberger that's been three topic much of the day actually
02:20 jberger the topic
02:20 purl it has been said that the topic is saying the thing that is not true
02:21 linagee jberger: I figured out how to sense that my websocket is disconnected. just trying to do something about it now. :-/
02:22 jberger linagee: the client establishes the websocket concern
02:22 jberger damn, connection
02:22 linagee jberger: websocket client
02:22 linagee jberger: Mojo::UserAgent
02:22 purl Mojo::UserAgent is probably not optimized for fast blocking requests or awesomesauce for async. or awesomesauce for async.
02:23 jberger the pattern you mention isn't wrong, but you have to do it on the JavaScript side
02:23 linagee jberger: client side websocket. I'm commanding a websocket from perl.
02:23 jberger oh
02:24 jberger well whatever side establishes the connection is the client I suppose
02:24 linagee the server side was suprisingly easy. just copied chat example and will modify as needed.
02:24 jberger and it needs to handle reconnection
02:24 linagee (and yes, I realize usually it javascript connecting using websockets. I'm using them for a client side perl thing.)
02:25 jberger it's perfectly fine to use a perl client
02:25 jberger if you want to reconnect using the sub you are already in, try the __SUB__ token
02:27 jberger then again, generally you might just want a handler separately from the message and finish handler (I'd have to map that our to see if that is practical in practice)
02:27 linagee https://gist.github.com/linagee/e9cb743dcd97a5762e03
02:28 linagee ^^^ this works, but I can't send out the connection once its tried to reconnect.
02:29 sri the recurring timer doesn't remove itself
02:30 linagee wow, I think that might actually be the problem, lol. (because, it actually just seems slower on reconnects...)
02:31 linagee (after more testing I see this, anyway. I thought it just wasn't sending.)
02:32 linagee sri: ah, I'm just throwing away its return handle too, heh. so I want to capture that, then later ->remove it
02:35 asarch joined #mojo
02:35 linagee awesome. I killed the recurring loop after it wants to reconnect. works!!!
02:36 linagee sri: thanks!
02:37 linagee now that I know how to keep the websocket reconnecting, I'd like to see if I can keep it alive. is sending just a small bit of data every few seconds really ugly? (are there better ways?)
02:37 linagee (is that server side?)
02:43 GabrielVieira joined #mojo
02:45 Grinnz linagee, a "heartbeat" message seems like an appropriate way to keep-alive a websocket
02:46 Grinnz linagee, "few seconds" is probably faster than necessary though
02:46 Grinnz you can set the inactivity timeout higher as well
02:46 linagee Grinnz: I see it happening exactly at 15 second intervals. I think this must be a hard coded number somewhere... hah.
02:47 Grinnz see what happening?
02:47 linagee or maybe I just shouldn't worry about it and then send every 13 seconds or something
02:48 Grinnz https://metacpan.org/pod/Mojolicious::Plugin::DefaultHelpers#inactivity_timeout
02:48 Grinnz that defaults to 15 seconds
02:48 linagee do I just $self->inactivity_timeout(some number); inside my server side websocket function?
02:48 linagee (testing that now....)
02:48 Grinnz yes
02:48 linagee ah! and it worked!
02:49 linagee I got it to do 2 minutes instead. (I realize there is a reason for timeouts, don't want too many stale connections hanging around)
02:49 Grinnz a heartbeat at half the inactivity timeout is probably a good starting point
02:50 linagee cool thanks!
02:50 hshong joined #mojo
02:51 linagee I love that I don't have to worry about SockJS/Socket.IO/etc. hah. (when you're designing both ends of this.)
02:51 Grinnz websockets are pretty easy in JS now too.
02:51 Grinnz very similar, in fact
02:52 Grinnz you make a websocket object, set a onmessage callback, do send(), and a onclose callback, etc...
03:02 * sri would like a blog example in core
03:02 genio erge _sf_orgs with (HOLDLOCK) as target using( select ? Id, ? Name, ? Phone) as source on target.Id=source.Id when matched then update set target.Name=source.Name, target.Phone=source.Phone when not matched then insert (id,name,phone) values(source.id,source.name,source.phone)
03:02 genio crap, sorry about that.  paste error
03:02 sri but single process in-memory storage sucks even as an example
03:03 genio There really should be a shorter upsert syntax
03:14 frederico joined #mojo
03:15 cpan_mojo XML-Loy 0.38 by Nils Diewald - http://metacpan.org/release/AKRON/XML-Loy-0.38 (depends on Mojolicious)
03:24 sri best i can do for a core version of the blog example :/ https://gist.github.com/anonymous/9ad82499d9a85a8d2b8e
03:24 sri real difference to the Mojo::Pg version is examples/blog/lib/Blog/Model/Posts.pm
03:33 genio Possibly a really dumb question:
03:33 genio Is it best to create a helper like that for multiple models or deal with your needed models in the controller?  controller A only needs Model B, but Controller B needs Model A and B.
03:34 genio I've been creating a helper for each model, but somehow feel dirty not just using it in the controller where it's necessary
03:48 sri i create helpers
04:00 bpmedley joined #mojo
04:01 berov joined #mojo
04:07 inokenty-w joined #mojo
04:17 kaare joined #mojo
04:27 k-man joined #mojo
04:32 Oleg joined #mojo
06:01 dotandimet joined #mojo
06:19 dod joined #mojo
06:24 dod joined #mojo
06:48 melo joined #mojo
06:49 trone joined #mojo
06:50 mattastrophe joined #mojo
06:54 OmarOthman1 left #mojo
07:02 Vandal joined #mojo
07:16 dod joined #mojo
07:20 avkhozov Hi, anyone used $DBDPG_DEFAULT with Mojo::Pg?
07:21 avkhozov I have an issue with it, $DBDPG_DEFAULT does not replaced with default DB value.
07:22 avkhozov Sample http://pastie.org/10069167
07:23 juikuen joined #mojo
07:25 eseyman joined #mojo
07:45 fhelmber_ joined #mojo
08:18 riche joined #mojo
08:23 sri hmm
08:24 sri i wonder how the button_to helper should handle the csrf token :S
08:25 sri i guess it can't really do anything about it
08:33 good_news_everyon joined #mojo
08:33 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/jj93
08:33 good_news_everyon mojo/master f010e09 Sebastian Riedel: actually use the form_for helper
08:33 good_news_everyon left #mojo
08:35 sri rails adds csrf token magic, padrino doesn't
08:47 amon joined #mojo
08:54 * sri shrugs
08:58 sri thoughts?
08:58 purl "I'm never here, I'm never here, I'm never here  /  never a bird, or a flower in the tree, or the pain of the respect thereof..."
09:03 melo joined #mojo
09:18 sri perhaps button_to is too dangerous
09:21 jberger if you add the token, people don't have to validate it right?
09:21 sri no, but it creates a session
09:22 jberger the problem is cookie notification?
09:23 sri cookie notification?
09:24 jberger "this site uses cookies" when the site author doesn't realize that they are
09:24 sri that certainly is a concern
09:25 sri considering one of the examples is "%= button_to 'Test' => 'http://example.com/test' => (class => 'menu')"
09:26 sri latest padrino seems to have optional csrf token support for button_to
09:26 sri by passing an options hash with csrf_protect: 1 or so
09:27 sri and before you ask... no... we have no options hash
09:29 dod joined #mojo
09:31 sri removing button_to means i have to do this :( https://gist.github.com/anonymous/90f1dd8f54e6eec6ce65
09:40 alnewkirk joined #mojo
09:44 trone joined #mojo
10:03 frederico joined #mojo
10:56 Kripton joined #mojo
11:19 neilhwatson joined #mojo
11:24 ribasushi joined #mojo
11:24 KCL joined #mojo
12:05 ver joined #mojo
12:12 mattastrophe joined #mojo
12:58 bramirez joined #mojo
13:01 jberger so spitballing
13:02 jberger if there were a stash value "csrf_protect" that could be set to true, form_for could simply add the field
13:03 jberger that fixes the button_to problem and makes form_for easier (for some value of easier)
13:07 genio form_for   and then    csrf_field isn't that hard.
13:08 genio ohh, missed the button_to part
13:18 zivester joined #mojo
13:48 gryphon joined #mojo
14:12 Ptolemarch joined #mojo
14:14 sri jberger: another reserved stash value :S
14:14 nicomen use a namespace?
14:15 jberger sri: yeah, I knew that that would be a tough point
14:15 mattastrophe joined #mojo
14:15 jberger I think nicomen might have a point
14:15 sri because it's fun to type ->render('security.csrf.protect' => 1)?
14:16 nicomen ->internal_stash?
14:17 nicomen ->stash('mojo')->{stuff}?
14:20 sri think i'd rather not have button_to :S
14:20 genio ->bag
14:20 jberger nicomen->slap_with_fish
14:20 good_news_everyon joined #mojo
14:20 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/vev59
14:20 good_news_everyon mojo/master 1251d41 Sebastian Riedel: remove button_to again
14:20 good_news_everyon left #mojo
14:21 genio On a more serious note, is it terrible to just have form_for and button_to always place the CSRF token field there?
14:22 sri sucks for crud apps https://github.com/kraih/mojo-pg/commit/25f8ba8ce71338382a0ecb7dd3116f5ac5a141f0
14:22 sri but i really don't want a more messy stash
14:22 sri i wish we were better at crud
14:24 genio does having a CSRF field there break something if you're not actually checking for CSRF?
14:24 sri it creates a session
14:25 sri which may get you in legal trouble if it happens when you're not aware of it
14:25 sri cookies and stuff
14:26 sri not to mention the overhead in general
14:26 sri for a button, that may not even need csrf protection
14:33 GabrielVieira joined #mojo
14:39 asarch joined #mojo
14:40 zackiv31 joined #mojo
14:42 Ptolemarch joined #mojo
15:21 mattastrophe joined #mojo
15:35 GabrielVieira joined #mojo
15:37 sh4 joined #mojo
16:01 Ptolemarch joined #mojo
16:05 dotandimet joined #mojo
16:13 sri rails doesn't actually use buttons, but normal links tied to a form with javascript
16:14 jberger still have to handle a form-like route, which is open to csrf just the same though, right?
16:14 sri yes, the form of course handles the csrf token
16:17 sri csrf protection is global in rails all routes and all forms get it
16:18 sri even ajax requests
16:19 Grinnz_ sounds like rails :P
16:30 PotatoGim^Home joined #mojo
16:32 disputin joined #mojo
16:41 till93 joined #mojo
16:41 cpan_mojo Mojolicious-Plugin-AssetPack 0.4601 by Jan Henning Thorsen - http://metacpan.org/release/JHTHORSEN/Mojolicious-Plugin-AssetPack-0.4601
16:42 till93 Hello, is it safe to call $c->render() in $c->delay() without return? Or can it happen that the following code (after render) is executed?
16:44 batman till93: only if code inside the same block also render()
16:44 Grinnz_ render() does not return, so yes, it will continue execution
16:46 cpan_mojo Mojolicious-Plugin-AssetPack 0.4602 by Jan Henning Thorsen - http://metacpan.org/release/JHTHORSEN/Mojolicious-Plugin-AssetPack-0.4602
16:46 till93 ok thanks
16:48 Oleg joined #mojo
16:52 sri anyway, interest in better crud features does seem pretty limited, so i'll just stop now
16:53 Grinnz_ it's the interest in html generation thats lacking for me :P
16:56 sri you just like typing <form action="<%= url_for('foo')->query(_method => 'delete') %>" method="POST">?
16:56 Grinnz_ sure, except just with an actual url :P
16:57 sri like <form action="http://127.0.0.1:3000/myform/<%= $id %>?_method=DELETE" method="POST">?
16:58 Grinnz_ well, except that stuff is all done by js
16:58 Grinnz_ so i dont need the urls to be in the template
17:05 Grinnz_ also, URLs dont need to include the host unless you're doing strange things or websockets :P
17:06 * Grinnz_ wonders if $SIG{__DIE__} being called from evals will ever be "removed" as indicated in the perldocs
17:11 sri that would be funny, because a lot of code depends on it
17:12 Grinnz_ funny indeed...
17:12 sri two places in mojolicious alone
17:13 mst yeah, I suspect that should probably just be removed from the docs
17:22 jberger that's in the perldoc?
17:22 Grinnz_ "Because this promotes strange action at a distance, this counterintuitive behavior may be fixed in a future release."
17:22 Grinnz_ referring to it catching eval die()s
17:25 mst pretty much every stack tracer in existence uses it
17:25 Grinnz_ heh
17:26 Grinnz_ maybe we just need to add a eval_but_not_weird { }, that doesn't touch $@ or $SIG{__DIE__} or anything
17:29 cpan_mojo Mojolicious-Plugin-LinkEmbedder 0.22 by Jan Henning Thorsen - http://metacpan.org/release/JHTHORSEN/Mojolicious-Plugin-LinkEmbedder-0.22
18:10 Ptolemarch joined #mojo
18:23 berov joined #mojo
18:55 dod joined #mojo
19:30 mattastrophe joined #mojo
19:49 dotandimet joined #mojo
20:06 mattastrophe joined #mojo
20:38 cpan_mojo Mojo-Pg 2.03 by Sebastian Riedel - http://metacpan.org/release/SRI/Mojo-Pg-2.03
20:40 jayis left #mojo
20:45 mattastrophe joined #mojo
20:48 mattastrophe joined #mojo
21:18 Ptolemarch joined #mojo
21:51 punter joined #mojo
22:24 sri this framework is getting a lot of buzz recently, wonder if there is something to steal https://github.com/labstack/echo
22:25 jberger facebook hasn't even had the decency to put a closure notice on the friendfeed homepage!
22:25 jberger http://friendfeed.com/
22:27 sri hahahahaha... exactly what i was thinking about the new facebook offices https://twitter.com/ptone/status/582764080219320323
22:31 jberger nice one
22:32 jberger having worked in an open floor plan for a while (and not even quite that open) I don't know how you are expected to get anything done in that kind of a space
22:33 jberger I wish they would stop bs-ing ("promotes camaraderie", "modern look") and say what it really is, its cheap
22:33 Grinnz_ yeah... cubicles work for reasons :)
22:34 jberger we had low-wall cubes
22:34 jberger you could see heads
23:24 KCL_ joined #mojo
23:28 oetiker the way to get your mojo apps to work on cloud foundry https://github.com/oetiker/sourcey-buildpack
23:29 disputin joined #mojo
23:33 basic6 joined #mojo
23:35 zivester joined #mojo
23:49 disputin joined #mojo

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