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

IRC log for #mojo, 2017-04-25

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

All times shown according to UTC.

Time Nick Message
00:00 marty joined #mojo
00:48 aborazmeh joined #mojo
02:12 Lee joined #mojo
02:50 noganex_ joined #mojo
03:40 disputin joined #mojo
03:51 inokenty-w joined #mojo
04:03 SwellJoe joined #mojo
04:04 dboehmer joined #mojo
04:12 aborazmeh joined #mojo
05:18 maschine joined #mojo
05:50 Vandal joined #mojo
06:17 Lee joined #mojo
06:20 mib_0u9lra joined #mojo
06:22 Lee joined #mojo
06:54 AndrewIsh joined #mojo
07:47 dod joined #mojo
08:02 dod joined #mojo
08:34 rshadow joined #mojo
08:45 kiwiroy joined #mojo
09:06 eseyman joined #mojo
09:35 kiwiroy joined #mojo
10:23 vytas joined #mojo
10:26 kes joined #mojo
10:27 kes Has mojo method to get time of user who make request?
10:30 batman kes: like number of seconds a request took?
10:30 coolo batman: local timezone
10:30 batman Not built in.
10:30 batman guess you need to do some geoip stuff
10:30 nic more than what the log already does?
10:31 nic oh, local to the client
10:32 batman kes: maybe you can get some inspiration from https://metacpan.org/source/JUSTIN/Mojolicious-Plugin-Log-Elasticsearch-1.162530/lib/Mojolicious/Plugin/Log/Elasticsearch.pm
10:32 nicomen you would probably need some kind of javascript, or deduce the user's time based on ip => timezone
10:33 batman another interesting question is of course... why do you want to know the local timezone?
10:34 batman i stopped caring in convos. i just render all the time information on the client side and let javascript do the conversion.
10:34 rshadow joined #mojo
11:05 nic Even in js it's looking a little clumsy.  You can get the current offset from UTC.  For something closer to timezone I think I'd take the sample for (a) now, (b) late June, and (c) late December
11:05 nic that should tell you which timeband they're in and what offset they currently have (or at least what their computer has)
11:21 karjala_ joined #mojo
11:25 tchaves joined #mojo
11:50 dod joined #mojo
12:11 itaipu joined #mojo
12:13 sri isn't that wonderful, trump is now banning laptops on flights from europe
12:14 pink_mist wouldn't actually want to bring my laptop with me to the US anyway ;)
12:16 nic people, then laptops... what next?
12:18 gizmomathboy joined #mojo
12:36 perlpilot joined #mojo
12:38 kes batman: I sent time in the SMS to notify user about when event occur in his time
12:39 kes ah, I got infinite loop when error occur at $log->on( message => sub { ... } )
12:39 nic in that case you probably need the user to specify their proper/preferred timezone in their account setup
12:41 kes http://paste.scsys.co.uk/559031
12:41 kes ok. thank you nic/batman
12:41 marty joined #mojo
12:48 kes Hm... error message stops Sentry to aggregate messages correctly
12:48 kes 500 Internal Server Error (2.623315s, 0.381/s)
12:49 kes maybe (2.623315s, 0.381/s) should not be there
12:50 nic that's how long it took to arrive at that response
12:52 kes I agree that info is useful, but should not be rendered into error message if not requested. Just like stacktrace info
12:52 kiwiroy joined #mojo
12:56 marty joined #mojo
12:58 vytas joined #mojo
13:15 cheako joined #mojo
13:26 marty joined #mojo
13:28 marty joined #mojo
13:36 maschine joined #mojo
13:40 gryphon joined #mojo
13:47 kiwiroy joined #mojo
13:49 dotan_convos joined #mojo
13:53 mcsnolte joined #mojo
14:00 salva joined #mojo
14:03 jberger I like this quote from https://www.theguardian.com/us-news/2017/apr/25/us-considers-banning-laptops-on-flights-from-uk-airports
14:03 jberger “It doesn’t match a conventional threat model. If you assume the attacker is interested in turning a laptop into a bomb, it would work just as well in the cargo hold.”
14:20 genio I've given up on them being able to make sense.
14:29 stephan48 whats the threat model(have not read the article)? laptop bombs... or are they maybe really afraid of modern terrorists being able to hack the planes?
14:29 cheako joined #mojo
14:29 stephan48 also... modern phones have big batteries mostly based on LiIon technology. same as with laptops. and they pack quite some energy. maybe ban them too(under both models)?
14:32 cheako political discussions might erode the user base.
14:34 rshadow joined #mojo
14:35 Janos joined #mojo
14:36 perlpilot joined #mojo
14:39 kiwiroy joined #mojo
14:49 vicash logic is not their strong suit
14:50 sri how come assetpack spams the log so much, even if it has nothing to do?
14:50 PryMar56 joined #mojo
14:54 sri how is it important that i see this every time i run an app specific command? https://gist.github.com/anonymous/3ef1459fff3ea42a1d2c9aa0b2755cfe
14:54 sri they are in the cache between runs
14:57 sri mojo core is very very conservative with startup log messages
14:57 sri specifically so that this doesn't happen
14:57 sri batman: what am i missing?
14:59 sri i mean, if you think it's absolutely essential to inform the user that you did work to validate the cache, make it one message "[Tue Apr 25 16:50:46 2017] Validated 23 assets, no updates were necessary"
15:01 sri startup log spam is the worst with morbo reloads
15:02 sri if you have something important to say, by all means, log it, but if you're just telling that everything is ok, keep it brief!
15:02 sri </rant>
15:05 zivester joined #mojo
15:07 coolo joined #mojo
15:08 batman sri: i don't consider "debug" messages important, so i haven't really cared much about it
15:08 batman i guess they should be silenced, unless MOJO_ASSETPACK_DEBUG is set or something.
15:08 batman care to open an issue?
15:08 * batman is on his way home
15:10 zivester joined #mojo
15:11 karjala_ What would be a good way to abort from a route handler in the middle of the subroutine (like die does) but also display a custom message to the user?
15:11 yysachinyy joined #mojo
15:11 karjala_ Because with die, all the user gets is a dinosaur
15:12 karjala_ (in production)
15:18 jberger make your own 500 page?
15:18 jberger http://mojolicious.org/perldoc/Mojolicious/Guides/Rendering#Rendering-exception-and-not_found-pages
15:19 zivester joined #mojo
15:19 jberger ok well for better or worse, here it is: https://metacpan.org/pod/release/JBERGER/Mojo-TypeModel-0.01/lib/Mojo/TypeModel.pm
15:28 disputin joined #mojo
15:29 stryx` joined #mojo
15:32 inokenty joined #mojo
15:34 yysachinyy joined #mojo
15:40 karjala_ jberger, thanks jberger
15:42 jberger np
15:59 Janos joined #mojo
16:28 yysachinyy joined #mojo
16:49 yysachinyy joined #mojo
16:53 dod joined #mojo
16:58 tchaves joined #mojo
17:17 Janos joined #mojo
17:27 dod joined #mojo
17:38 tchaves joined #mojo
17:40 miller joined #mojo
17:53 tchaves joined #mojo
18:07 Janos joined #mojo
18:08 perlpilot joined #mojo
18:09 cheako joined #mojo
18:10 gryphon joined #mojo
18:28 mgrimes joined #mojo
18:33 salva joined #mojo
18:48 kiwiroy joined #mojo
18:51 mib_jiyj07 joined #mojo
18:51 mib_jiyj07 j #minion
18:53 mib_jiyj07 oh
18:56 mib_jiyj07 I heard minion can handle jobs "described" to it from several sources ... Pg backend, in code itself, in a YAML, .INI, .json file ... is this true?
18:58 mib_jiyj07 or is there a "standard" job description format or one minion uses that can take over the world?
18:59 cheako Is there an alias for "any(['GET', 'POST']"?  It's an example and that makes me think that it's necessary to write it that way.  Is this bad practice?
19:00 dod joined #mojo
19:01 cheako Also there is no example, but for form acknowledgement I like to use "Successfully added <%= param 'name' %>." is that bad too?
19:01 jberger mib_jiyj07 what do you mean "described"
19:02 tchaves joined #mojo
19:02 jberger cheako: no there is no such alias
19:03 jberger for the most part, when I want a route to be handled by GET or POST, I usually don't mind it being handled by any method
19:03 jberger so I just use any, and for the most part, no one will call DELETE on that anyway
19:03 jberger but if they do, the get the same behavior
19:07 mib_jiyj07 do this, then do that ...so instead oc my:  $job = Minion::Job->new(id => $arb , task => "reboot_report");
19:08 jberger the job actions are described as a Perl coderef
19:08 jberger is that what you mean?
19:09 mib_jiyj07 $job->read_job_file("tuesday_reports.jobson");
19:09 jberger I don't believe that exists, no
19:10 jberger you could make it do anything you want though
19:10 jberger if you wanted to describe your actions in YAML and then have the perl coderef read and execute the YAML, that would work just fine
19:10 mib_jiyj07 yeah just wondered if a standard way of reading jobs from files or some format that could WORLD DOMINATE
19:11 jberger put something on CPAN, give it a whirl
19:12 mib_jiyj07 existed ....  Boss: "make it happen" Me: "We chose minion since it supports JJDL and YJDL standards"
19:12 mib_jiyj07 ok good
19:14 mib_jiyj07 just now together this channel invented the standard - it's been great working with this team !
19:15 mib_jiyj07 jberger++ minion++
19:21 rshadow joined #mojo
19:24 jberger I'm not aware of any such standard
19:24 jberger and there they go
19:24 jberger I have no idea what that was
19:38 PopeFelix joined #mojo
19:47 Grinnz i don't know either, but I feel like it was the beginning of the Net::FullAuto successor
19:53 ribasushi joined #mojo
19:56 PopeFelix sri, when I asked about doing asynchronous file I/O with Mojo, you said "non-blocking file I/O is mostly pointless unless you use something like IO::AIO and if you do the overhead might end up making things slower".
19:56 PopeFelix How much overhead is there with something like IO::AIO?
20:26 SwellJoe joined #mojo
20:35 sri PopeFelix: you have to test that for yourself
20:35 PopeFelix OK.
20:35 punter joined #mojo
20:35 sri depends on what you're using it for really
20:39 PopeFelix Yeah, that makes sense. I was just curious what sort of things would cause the overhead.
20:43 jberger I'm assuming that there is a fork involved
20:43 jberger or something like it
20:43 PopeFelix Threads, according to the IO::AIO docs
20:51 cheako How to force https in form_for?
20:52 pink_mist form_for url_for(...)->scheme('https'), ... ?
20:53 pink_mist maybe
20:53 pink_mist untested
20:55 cheako Not having an example makes me think I'm doing something wrong by needing it.
20:56 pink_mist nah, I think that's a pretty valid thing to want to do
20:59 cheako There should almost be an html attribute for it.
20:59 cheako The don't submit this form over unsecured link attribute.
21:15 cheako joined #mojo
21:15 maschine https is driven by your server setup
21:15 maschine not by Mojo.  or at least, it should be
21:16 cheako Not really a mojo question, but what do ppl use for server side FB graph API?
21:17 maschine your server should be set up to only accept https connections, so requiring scheme('https') or something is redundant
21:17 cheako maschine: Web server is a bad place to redirect to https, this leaves no support for clients that are compiled without ssl.
21:18 rshadow joined #mojo
21:19 cheako That would be one area where mojo could step in and provide a sub-site for https-less clients.
21:19 maschine I disagree - there are only about 3 browsers that don't support https, and they are insanely old
21:19 maschine unless you really must support Internet Explorer on Windows XP - but you're probably not going to be very secure anyway
21:27 dikim joined #mojo
21:42 jberger cheako, is the target url on the same site?
21:43 cheako yes
21:43 jberger so you are just being extra cautious?
21:43 jberger how are you serving your site?
21:44 jberger are you using a reverse proxy or are you using the application server directly?
21:44 cheako I'm not sure
21:44 cheako I don't even have a server currently
21:45 maschine can you even set up SSL using hypnotoad etc. directly without using a reverse proxy server?
21:46 jberger the browser will follow relative urls using the base url of the site it is currently on
21:46 jberger so if the page with the form was served using https it will submit the form using https
21:46 jberger maschine: yes
21:46 maschine right but just because you type https doesn't mean it will be an https connection
21:47 maschine and if the server is still listening on port 80 it's easy to get around with a simple downgrade to http
21:47 jberger anyway, so what I do is have nginx (the reverse proxy) redirect any port 80 (http) requests to 443 (https)
21:48 jberger and if you bind to only 443 and only with https then that isn't a problem maschine
21:48 maschine I think that is the way to do it.  It's just so much less painful to set up
21:48 maschine I've never used nginx before and it had it working in a couple hours
21:49 jberger I just wrote a big post about this stuff
21:49 jberger http://blog.mojolicious.org/post/157710119941/configuring-nginx-for-ssl-with-lets-encrypt
21:49 jberger you can use some of the basics from that, ignoring the LE stuff
21:49 jberger though if you are doing ssl you will need a cert
21:51 maschine mine is set up pretty much the same way, but I didn't know about your post - I pieced it all together from several different places.
21:52 maschine FYI I didn't have to do anything with a dummy app, although it's only been a week and I can't remember exactly what I did already. lol
21:54 maschine I still need to setup the cron job.. I should probably do that before there's no hope of remembering on how I generated my certificates
21:58 cheako Basically I was wondering if there was a way to generate a url for https if the page was loaded over http otherwise it doesn't mater how the url looks.
21:59 maschine following jberger's guide, it will do exactly that
21:59 maschine it will force https even if the user types http
22:00 cheako that's not waht I wanted, I was only talking about generating the correct attributes to a form tag.
22:03 jberger but why generate an absolute url for a form that's on your same site?
22:04 jberger the form just needs to go back to your site
22:05 jberger and you should serve your entire site on https
22:05 jberger or put it a different way, your application doesn't need to think about the transport at all
22:06 gryphon joined #mojo
22:13 iaw joined #mojo
22:15 iaw is it possible to force a "flush (redirect_to) to browser and exit program" after a redirect_to()?
22:17 jberger exit program?
22:17 jberger that seems pretty drastic
22:18 jnap I've created endpoints to kill the server (in debug mode) for using NYRProf but maybe that's not needed anymore
22:18 jberger I'm assuming you mean end evaluation of that request early?
22:19 jberger jnap: I have one in my configuration application for Galileo as well
22:19 jberger but those are pretty rare use-cases
22:20 jnap yeah no doubt
22:22 kiwiroy joined #mojo
22:23 jberger iaw: it seems to me from reading your mailing list post that you really have two different questions
22:23 jberger (1) can you do a response from deep inside some code and the stop evaluating further
22:23 jberger (2) can you cause a server to exit after writing to the client
22:24 jberger (1) No, not possible
22:24 jberger (2) Yes https://github.com/jberger/Galileo/blob/master/lib/Galileo/Command/setup.pm#L134
22:25 jberger though that only works for a single threaded server like daemon/morbo
22:26 jberger (which that example explicitly is)
22:26 avkhozov joined #mojo
22:28 iaw thanks, j.  it's 1 I needed, and it seems impossible :-(  pity.
22:30 iaw and knowing that it is not possible is very helpful, too.  oh well, learning about exceptions now...
22:36 Grinnz it's not impossible. you can abuse exception objects and try/catch to pop up to the top of the stack, as long as you can put something at the top that catches it and ends the response
22:36 Grinnz (only if it sees that particular exception object of course)
22:37 Grinnz i like having exception objects that encapsulate how i want to respond, so the higher level can render the response itself using that
22:38 Grinnz see Throwable
22:51 jberger from the mailing list exceptions had already been suggested, the question was (as I understood it) was there something more built-in to mojo
22:51 jberger and THAT's what the no was to
22:52 jberger I guess I was a little too strong in saying not possible
22:52 jberger it IS possible, just not in a mojo way
22:52 marty joined #mojo
22:52 jberger basically that kind of thing is very hard (impossible) to make work generically when non-blocking is considered
22:53 jberger that was supposed to be (impossible?) but meh
23:49 kiwiroy joined #mojo

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