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

IRC log for #mojo, 2016-04-01

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

All times shown according to UTC.

Time Nick Message
00:07 disputin joined #mojo
01:24 Kripton joined #mojo
01:56 bpmedley https://gist.github.com/brianmed/0e2cb254cf6f35b1f6587b1fb320eb73 <-- I'm trying to use IO::Poll to detect when the pipe is closed in the parent via a CTRL-C or similar.  However, I'm probably doing something wrong because my code is not working.  Any ideas on how to detect the close on the pipe in the parent?
02:07 mattp_ bpmedley: why not use mojo::reactor instead?
02:07 bpmedley mattp_ : Can you show me?
02:18 mattp_ bpmedley: you'd still fork, but instead of what youve written with IO::Poll, you should be able to use $reactior->io($handle) for read/write
02:18 jb360 joined #mojo
02:19 bpmedley I'm not sure how to the $reactor->io to give me the condition when the pipe is closed..
02:19 bpmedley how to *get
02:26 geheimnis` joined #mojo
02:27 mattp_ bpmedley: hmm
02:28 mattp_ the anyevent answer is to use an on_error callback with anyevent::handle (https://metacpan.org/pod/AnyEvent::Handle) I believe
02:29 s1037989 Quick question about CPAN (let me know if I need to ask elsewhere)... when I publish a module and get a CPAN tester failure note, to fix it do I have to bump the package version, or can I just fix it and keep it at the same version?  Or...  how do I test my packages well enough so they stop failing CPAN testers?
02:30 bpmedley mattp_ : Interesting.  I wonder how that is implemented.
02:30 mattp_ im not sure what the equivalent for mojo::reactor is. you can attach a generic $reactor->error() handler, but it seems you cannot associate errors with specific handles or events
02:30 mattp_ that should fire on a failed write to closed pipe though
02:35 iamb it's been a while...doesnt closed pipe on the reader end just give you eof? so POLLIN and empty read?
02:35 bpmedley iamb : I'm not 100% sure.. that could be true.
02:36 iamb i haven't used Mojo::Reactor, but if i recall that correctly looks like you can use use ->io and watch for readable, maybe read the handle to verify it's eof
02:43 mattp_ iamb: ah you may be correct
02:44 noganex_ joined #mojo
02:44 bpmedley Woohoo... seems to work in os x.
02:46 bpmedley And Linux exits with an error.. wooohoo..
02:48 asarch joined #mojo
02:52 jberger bpmedley: Did you look at my forkcall?
02:52 jberger That's how it works (watches for close of a pipe in the parent)
02:52 bpmedley No, sorry, I didn't think to.. perhaps a link?
02:53 jberger https://metacpan.org/source/JBERGER/Mojo-IOLoop-ForkCall-0.17/lib/Mojo/IOLoop/ForkCall.pm#L86
02:53 bpmedley Hrmm
02:55 bpmedley I wonder if that will work as elegantly in the child.  I'm trying to get the child to exit when parent goes away.
02:55 jberger That i don't know, but you can try
03:20 jberger Hahaha https://lkml.org/lkml/2016/3/31/1108
03:28 Grinnz lol
03:30 mcsnolte joined #mojo
04:06 Guest-ru joined #mojo
04:10 cpan_mojo Qiniu-0.04 by FUKAI https://metacpan.org/release/FUKAI/Qiniu-0.04
04:26 tim_ joined #mojo
04:29 inokenty-w joined #mojo
05:10 Guest-ru hi,
05:10 Guest-ru i have $route->over()->over()...
05:10 Guest-ru How do break next over() condition if previous return false?
05:45 cpan_mojo Qiniu-0.05 by FUKAI https://metacpan.org/release/FUKAI/Qiniu-0.05
06:02 sri oh no, it's april 1st
06:02 * sri hides under table until it's over
06:13 * anparker want under a table too. Is there some space left?
06:17 sri no, go away!
06:21 * sri turns desk into a fort
06:21 * iamb donates blankets
06:22 iamb good luck. stay safe out there today.
06:44 trone joined #mojo
07:18 AndrewIsh joined #mojo
07:47 osfabibisi joined #mojo
08:21 Vandal joined #mojo
09:11 sri wonder how file permissions will work with ubuntu for windows
09:13 sri first reports say everything is 777 Oo
09:23 batman oh. that's not too cool
09:23 batman i would think it would be possible to "bridge" ntfs permissions
09:24 batman would be sweet if that resulted in a better ntfs driver in linux :-)
09:24 mishanti1 sri: I'm more interested in interrupts etc, since (from my limited understanding) windows don't really do that in any way or form that resembles what linux does.
09:24 mishanti1 Like, as far as I can tell some signal handlers ar created as separate _threads_ when fired.
09:25 mishanti1 s/ar\s/are /
09:25 mishanti1 Heh, wonder how backgrounding tasks will work.
09:25 mishanti1 Daemonization and such.
09:26 sri yes, lots of open questions
09:26 mishanti1 from docs --> "SIGINT is not supported for any Win32 application. When a CTRL+C interrupt occurs, Win32 operating systems generate a new thread to specifically handle that interrupt."
09:27 mishanti1 "This can cause a single-thread application, such as one in UNIX, to become multithreaded and cause unexpected behavior."
09:27 sri seems all fixable though
09:27 sri well, you can't really go by current behavior
09:27 mishanti1 Yeah, I do not doubt that they are focusing on this. If they actually get this rolling they have _much_ to gain.
09:28 sri the syscall translation layer could do a lot
09:28 sri it's right in the kernel
09:52 jontaylor joined #mojo
10:16 cpan_mojo Mojolicious-Plugin-CHI-0.13 by AKRON https://metacpan.org/release/AKRON/Mojolicious-Plugin-CHI-0.13
10:41 bd in a lite app I have a template in my __DATA__ section that i want to render to a string, how can i do this?
10:43 nic I have an 'under' in my app that puts (template => 'x') in the stash
10:43 nic I was supposing that would set a default for that part of the app, overrideable per route
10:44 nic In one of its routes I try to override using ->to('Dev::Db#table', template => 'y', ...
10:44 nic but the template used on that route is still 'x'
10:46 nic So I'm now thinking that maybe the per-route usage doesn't override existing stash entries
10:46 nic I guess I should make a minimal test case ;)
10:56 punter joined #mojo
10:56 ribasushi jberger: remember you were laughing at me for doing length ref $foo? https://github.com/dbsrgits/dbix-class/pull/98#issuecomment-204347775
10:56 ribasushi ( not an apr 1st )
10:59 ribasushi relevant piece of code: https://metacpan.org/source/JESSE/Scalar-Defer-0.23/lib/Scalar/Defer.pm#L16
11:00 nic Is there some advantage/usecase for using a falsey class name?
11:02 ribasushi nic: "lazy attempt to pretend this is a plain string, without resorting to tie"
11:02 tchaves joined #mojo
11:03 pink_mist I don't think I understand what's meant by that
11:03 nic So by design they want the ref($a) test to give a false value?
11:03 pink_mist "lazy attempt to pretend this is a plain string" ... but classnames are always plain strings ... "without resorting to tie" ... what?
11:03 nic pink_mist: scalar
11:04 ribasushi nic: yes, both ref() and blessed() returning '0' which in plain boolean ctx will be false
11:04 pink_mist if defined blessed $foo; #foiled
11:04 kaare joined #mojo
11:04 ribasushi pink_mist: hence "lazy attempt"
11:05 dod joined #mojo
11:05 nic So length(ref $a) is just for folks who need to know if it's really an object just trying to hide its being an object?
11:07 ribasushi more or less
11:07 pink_mist nic: nah, checking for an object should be done with blessed(), not with ref()
11:08 nic ribasushi: thanks for sharing; good to know there's code out there doing that
11:09 nic pink_mist: you're missing the point, blessed and ref are analogous in this scenario; they hit corresponding edge cases, by design
11:18 bd seems like my mojolicious was to old, there is render_to_string now
11:20 pink_mist 0_o how old was it? I thought that one had been around for several years
11:21 pink_mist ah, seems it was added in 5.0? in 2014?
11:36 batman bd: giving away the version you're running is _very_ important, unless "mojo version" tells you you're up to date.
11:37 nic hmmm, my minimal example (setting default template in an under) works perfectly
11:37 nic so my real app must have some breakage
11:38 nic A (sysadmin) team I used to work with followed standard practice of obscuring the infrastructure the company was running on
11:39 nic So the front-end web servers declared themselves as "Commodore 64"
11:40 nic This got picked up by the press (must have been a dull time for news) and our CEO went nuts
11:40 icege joined #mojo
11:57 Kripton joined #mojo
12:08 jberger Oh that's a fun thing though
12:09 nic :)
12:10 * jberger proposes a Commodore 64 server farm announcement to $boss
12:12 cpan_mojo Mojolicious-Plugin-CGI-0.27 by JHTHORSEN https://metacpan.org/release/JHTHORSEN/Mojolicious-Plugin-CGI-0.27
12:17 batman yay! just what i wanted to do today.......................... ^^^^ :(
12:17 nic One day you're going to have to stop beating on about CGI -- it's never going to catch on
12:18 batman http://cdn.meme.am/instances/500x/62898520.jpg
12:19 batman nic: it could be the most painful module i've written.
12:19 nic :)
12:19 batman even worse than the really old and *overdesigned* modules i got :/
12:21 batman i think maybe the most important lessen i've learned from mojo is that that you should go for simple and less is always more
12:21 batman sri: thank you.
12:21 batman (referring to my old code. not the cgi plugin)
12:22 batman i still do stupid things, but not as often (i hope)
12:22 nic Yeah, we have a lot to thank sri for.  I think they're called 'intangible assets'
12:22 batman yeah... and i don't mean that as an april fools joke :)
12:23 batman like https://www.facebook.com/badlandgame/photos/a.302647193179295.64447.246432418800773/860834150693927/?type=3&amp;theater ;)
12:23 nic It's past UTC 12:00; no more April foolery for another year
12:34 jberger nic: you do realize it is still morning in the USA right?
12:41 nic yeah, they don't use UTC
12:41 nic yet
12:42 nic Anyway, what I really meant to ask... Is the 'prankery stops at midday' rule international?  I'm guessing it was invented by teachers :)
12:43 batman nic: not in norway. the evening news will probably have a joke
12:58 Jonis it's so grim up here we need something to cheer us up
12:58 Jonis it snowed yesterday :(
12:59 jberger nic: yeah that sounds like a teacher ploy
13:02 VVelox joined #mojo
13:03 dvinciguerra__ joined #mojo
13:06 VVelox Any one have some suggested reading for looking at writing a video streamer using Mojoliciouis? What I am finding is stuff on using websockets and Mojo::IOLoop::Stream, neither of which appears to be what I am looking for if I want to connect the output of ffmpeg to the output of the requested route.
13:19 batman VVelox: maybe you can use Mojo::IOLoop::ReadWriteFork? just make sure you suppress STDERR
13:19 batman ...if "ffmpeg" is an executable
13:19 mishanti1 Jonis: Suffering helps remind us we are still alive. So it really is a good thing.
13:21 jberger VVelox: http://mojolicious.org/perldoc/Mojolicious/Guides/Rendering#Streaming
13:21 VVelox batman: Yup. ffmpeg is. And thanks! that is actually what I am looking for.
13:22 VVelox Sweet. Thanks. Will have to look at and compare the two.
13:23 batman VVelox: (for now) it will send STDERR and STDOUT to the same "read" event. this can be avoided by doing $fork->start(program => sub { close STDERR; exec ffmeg => @args });
13:23 batman not the best solution, but that's how i made it :/
13:23 batman i will take a PR for additional stdout/stderr events
13:24 nic mishanti1: Did you watch Humans?  That's pretty much a straight quote
13:24 jberger VVelox: you are trying to transcode?
13:25 jberger does ffmpeg send the transcoded output to STDOUT?
13:26 nic VVelox: I don't want to discuss too much, but is your work iPlayer-related?
13:26 batman jberger: oh. that's true. maybe it would be better to use ForkCall and make ffmpeg write to a filehandle
13:26 VVelox jberger: it can do either a file or STDOUT and was wondering what I need to be sure to target on the writing a quick streaming helper module for it.
13:27 VVelox But after this have been looking at HTML5 and it looks like it will be fairly easy to begin writing something like subsonic, but with the features I want.
13:27 VVelox The only tricky part appears to be playlist handling.
13:28 VVelox nic: Nope.
13:28 nic k
13:29 batman VVelox: have you thought about using cvlc (vlc from command line) instead of ffmpeg?
13:30 batman maybe you could stream data from directly from vlc, instead of starting ffmpeg
13:31 asarch joined #mojo
13:31 genio cvlc was able to get some really badly encoded videos fixed up for me.
13:33 woz joined #mojo
13:34 woz Good day all. Has anyone tried using Mojo::UserAgent with NTLM auth ?
13:34 genio A while back, but I failed at making a plugin for the auth.  I think I've seen someone else had more success lately though
13:35 nic I see Mojo::UserAgent::NTLMAuth
13:37 genio nic: I'm not seeing that on metacpan.  http://irclog.perlgeek.de/mojo/search/?nick=&amp;q=ntlm
13:38 nic look on github
13:41 woz Ah, thanks, I only checked CPAN. Didn't think to check GitHub
13:50 dod joined #mojo
13:53 dod joined #mojo
13:54 nic woz: Just bear in mind there's usually a reason for it not being (yet) on CPAN
14:01 mcsnolte joined #mojo
14:13 jberger we did recently fix a bug that was causing NTLM to fail
14:13 jberger use a VERY recent Mojolicious
14:20 woz joined #mojo
14:20 jberger woz: you may have missed: "we did recently fix a bug that was causing NTLM to fail, use a VERY recent Mojolicious"
14:21 jberger that said NTLM is terrible and should be avoided if possible
14:27 PryMar56 joined #mojo
14:31 mishanti1 nic: Humans? Can't say I have. Haven't had a tv for many years. *checking tv.com*
14:31 jb360 joined #mojo
14:32 mishanti1 nic: Thanks for the tip though. Seems like a cool concept for a show.
14:35 VVelox batman: Never really been that fond of VLC. I've found it a bit hit and miss. Although it is awesome for ripping DVDs that mencoder does not like for what ever reason.
14:36 batman ok
14:46 bwf joined #mojo
14:50 woz joined #mojo
14:50 woz Thanks Joel
14:50 woz Yes it is utterly horrible, unfortunately I have to talk to some systems that use it :(
14:52 VVelox Similar to RADIUS... bad tech ideas stick around forever
14:52 jberger woz: NTLM requires a single connection over multiple requests. As far as I'm aware the HTTP spec only states that keep alive is an optimization not a requirement
14:52 jberger so the idea that a "subprotocol" would require a behavior like that is ... very strange
15:15 woz joined #mojo
15:15 woz Eww, is *that* how it works?
15:16 jberger yes
15:16 jberger and the bug we fixed was that for error statuses we were closing the connections
15:17 jberger NTLM requires some 4xx statuses in the protocol handshake (yeah)
15:17 jberger so mojo would close the connection
15:17 punter joined #mojo
15:18 jberger we fixed the bug (order of operations issue) but in essence we viewed that as a performance optimization not a fix for NTLM
15:18 Grinnz_ 11:17:17           <jberger> NTLM requires some 4xx statuses in the protocol handshake (yeah)
15:18 Grinnz_ I just threw up a little in my mouth
15:22 jberger yeah
15:23 jberger Grinnz_: in some sense it is like a 401 (in fact it uses that code)
15:24 jberger but there are 2 different 401 request/response cycles before getting authorized and getting the final resource, for 3 total req/res trips
15:24 jberger but here's the kicker, they HAVE to be on the same TCP connection
15:24 Grinnz_ /o\
15:27 jberger IMO the fact that it ever works with a standard HTTP client is only accidental
15:27 jberger and it should only ever be attempted with a custom NTLM client
15:28 jberger but since it does usually work (because of keep alive) I guess it is tacitly accepted
15:28 woz Anyone got the Mojo::UserAgent::NTLMAuth repo URL - my github search foo seems to be weak today
15:28 * genio glares at MS.
15:33 jberger woz here is the discussion before: http://irclog.perlgeek.de/mojo/2016-03-12#i_12173382
15:33 jberger not that long ago actually :-P
15:33 jberger feels longer ago than that
15:33 jberger jasanj is around sometimes
15:34 jberger perhaps when (s)he come back they have additional info
15:34 jberger here is a NTLM article: http://www.innovation.ch/personal/ronald/ntlm.html
15:35 jberger I like that the author includes this: "Also note that this scheme is not an http authentication scheme - it's a connection authentication scheme which happens to (mis-)use http status codes and headers (and even those incorrectly)."
15:35 lluad joined #mojo
15:37 jberger oh, but now that I read through it again
15:37 jberger jasanj's code had serious bugs when used for non-blocking
15:41 dvinciguerra joined #mojo
15:43 genio Re-watching the MS demo for Bash on Win 10... do people actually say "vie" instead of the individual letters V I ?
15:44 lluad I've always called it that.
15:45 dod joined #mojo
15:45 genio I guess I'm the oddball then :) definitely not the first time
15:52 jberger I usually pronounce it "vim"
15:53 jberger but I guess that doesn't matter much either
15:53 jberger (as in rhymes with "him")
15:55 woz joined #mojo
15:55 woz Sorry had a meeting - thanks!!
15:56 woz I can live with blocking in this instance
15:59 genio I say all three letters. v i m
16:18 disputin joined #mojo
16:22 vicash genio: i am with you on the individual letters 'V I' as opposed to 'vie', but I started using vi in the late 90s...
16:23 odc saying the 3 letters is ridiculous!
16:37 nicomen do you guys say e,d also when talking about vi's predecessor?
16:38 Kripton joined #mojo
16:39 pink_mist 'vi' is 'vi', not 'v i' to me ... because in swedish there's no problem pronouncing 'vi' as a word; it actually is one of our pronouns, meaning 'we'
16:40 jberger nicomen: who still talks about ed?
16:40 jberger :-P
16:40 jberger I honestly am not sure I've ever pronounced it out lout
16:40 jberger loud
16:40 pink_mist and 'vim' is a detergent :P
16:41 nicomen jberger: dunno, I don't talk about vi either :-P
16:41 pink_mist oh wait, seems the detergent changed name to 'cif'
16:41 nicomen seriously though, I say "vee" in Norwegian, and "v i" in English ;)
16:42 pink_mist ... which is more difficult to pronounce as it's hard to say whether the c should be a k or an s
16:42 Adurah Just call it 6.
16:42 nicomen pink_mist: that brand is spelled "jif" here, and pronounced "yeeff"
16:43 pink_mist nicomen: I think it went vim -> jif -> cif here
16:43 pink_mist so it used to be called jif too
16:43 pink_mist but not anymore
16:43 pink_mist nice idea for a name for a vim fork though :P
16:44 nicomen heh: http://en.wikipedia.org/wiki/Cif
16:45 pink_mist ah, 'handy andy' is another of its names I see .. also useful :P
16:47 jberger I think we are officially off target ;p
16:48 pink_mist wait, there was a target? :P
17:05 kamyl joined #mojo
17:06 marty joined #mojo
17:08 woz joined #mojo
17:22 genio odc: Heh.  I think it's well established at this point that I am, indeed, ridicuous!
17:24 jberger topic :-P
17:27 odc genio, i can't even contradict you since i saw took over LWP::ghttp
17:27 odc wow!
17:28 odc old-school to the last
17:32 PanzerBjorn joined #mojo
17:33 PanzerBjorn I have an interesting question. I'm serving multiple domains with my Mojo instance, and I want to keep templates for different domains in their own folders. Is there a way I can set the "template root" in my under() method where the host names are parsed out?
17:35 PanzerBjorn Right now I explcitly set the site folder in my calls to render() such as: $self->render($self->siteinfo->folder . "/some/template/folder/index") - which is more verbose than I'd like.
17:35 jberger PanzerBjorn: you can't set globals that way I wouldn't think
17:36 PanzerBjorn (siteinfo is a helper method that gets/sets a state variable to a site object which has information about the site and a factory for making the siteinfo object from the hostname)
17:36 jberger since it isn't localized to the request, what's to prevent another request coming in and changing it before you render
17:36 jberger why not write a wrapper helper for render?
17:36 batman i think i would rather make a... what jberger just said :-)
17:36 jberger $c->site_render('template/path')
17:37 batman render_site_template("template", ...); => render("$prefix/template", ...);
17:37 PanzerBjorn Yeah, I thought about writing a render helper too, but just wanted to check and see if the template root path could be manipulated first.
17:37 jberger helpers are cheap
17:37 jberger order bugs are expensive
17:37 jberger :P
17:37 * batman stops talking when jberger does :)
17:38 disputin joined #mojo
17:39 PanzerBjorn Now to figure out how to create a helper that can accept all of the params from render...
17:39 PanzerBjorn Oh, I should be able to just capture everything from @_ after shifting off $self and toss them in, okay.
17:40 pink_mist just pass those straight through?
17:40 pink_mist yeah
17:40 PanzerBjorn Just been a couple years since I've really done a lot of Perl work, esp with OO Perl. I don't get to use Perl on my day job usually.
17:42 perlpilot PanzerBjorn: you should make it a point to use perl at your day job anyway  ;)
17:43 PanzerBjorn Let's just say the environment I'm hired to work in isn't conducive to use of Perl.
17:44 pink_mist it's a python shop, isn't it?
17:44 perlpilot well, you have my sympathy then
17:45 genio odc: Yea, that was done to help the LWP team be able to pull cruft out of the main dist that's no longer useful and makes testing no fun.
17:45 jberger PanzerBjorn: perhaps you could use the before_render hook? http://mojolicious.org/perldoc/Mojolicious#before_render
17:45 jberger I've never used that one myself but the description actually sounds like it your's is a reasonable use case
17:46 genio but I think I made too many changes too fast to be useful to that team, so I have stopped paying attention to it.
17:46 odc heh
17:47 odc not very nice of them
17:47 PanzerBjorn No, I work on Windows apps on my day job.
17:48 jberger PanzerBjorn: well then this is your lucky week :-P
17:48 PanzerBjorn Why's that?
17:48 jberger did you not see the news?
17:48 genio no, no, no.  Don't get me wrong.  They aren't not being nice.  It's just a widely used, old thing that takes maintaining patience requiring kid gloves.
17:48 PanzerBjorn That Microsoft acquired Xamarin?
17:49 jberger PanzerBjorn: http://www.theverge.com/2016/3/30/11331014/microsoft-windows-linux-ubuntu-bash
17:49 odc isee, like perl :) @ genio
17:49 genio I think I've provided them with many useful things.  Once they're able to review and bring in what they feel is useful, then I will be able to help out more by providing more updates.
17:49 jberger PanzerBjorn: linux userspace in native windows via a system-level translation layer
17:49 jberger it actually seems quite promising
17:49 jberger (not a VM, can fork)
17:49 genio until then, it's spinning wheels
17:50 PanzerBjorn Um, that's GOT to be an April Fool's joke.
17:50 jberger I thought so too, but its was posted 2 days ago
17:50 jberger and is a partnership with Canonical
17:50 PanzerBjorn So they got a headstart? ;D
17:51 jberger tbh, I have been worried about april fools since then
17:51 jberger but it would be a pretty bad joke
17:51 PanzerBjorn If I really got a reliable bash shell in Windows without the outdated and troublesome Cygwin, I would be in disbelief.
17:51 VVelox jberger: interesting, maybe the CLI on windows will start to suck less
17:51 jberger "oh that thing you guys were excited about for two days, yeah, it was a joke, our command line still sucks"
17:51 PanzerBjorn Windows has plenyt of other problems that adding a Linux command line won't fix, though.
17:52 jberger PanzerBjorn: the idea might be not to fix them but just phase it out
17:52 VVelox Heh. Use to use cygwin at the first place I did IT at for backing up windows machines using SSH and rsync.
17:52 PanzerBjorn Plus I won't be able to rely on having Bash for Windows 7 and 8 users which are still the lion's share of the market.
17:52 jberger WindowsX (vs OSX)
17:52 jberger no there would be a long transition time certainly
17:53 VVelox PanzerBjorn: Aye. The security stuff on it just makes me cringe. Totally managed to pointlessly over complicate Kerberos and LDAP.
17:53 PanzerBjorn I have to hand it to Microsoft for ONE thing though, and it's what I've invested my career in: XAML, WPF and MVVM. Okay, that's three things, but they all work together. Best damn UI framework ever invented and so powerful and simple to use that MVVM is rapidly becoming the standard design methodology for the web too.
17:55 PanzerBjorn The bitter irony is that Microsoft already abandoned it a couple years ago because of a lack of uptake in the developer community. And like a cult film it's gotten hugely popular since. Now Microsoft is in an awkward position.
17:55 VVelox hah!
17:56 jberger Microsoft abandoned WPF?
17:56 PanzerBjorn They officially announced discontinued support and development on it in April 2014.
17:56 jberger 2 jobs ago I was involved in a truly terrible abomination built on WPF/XAML
17:56 PanzerBjorn I thought it was going to be the end of my career.
17:57 jberger wow
17:57 jberger that just screws that project over even more
17:57 PanzerBjorn Yeah, there's a lot of REALLY BAD WPF projects out there, written by WinForms devs who never bothered to learn, understand and appreciate MVVM.
17:57 * jberger is glad he left
17:57 jberger this project was a Python layer that generated XAML on the fly
17:58 PanzerBjorn I was just at Shutterfly for 3 months working on their WPF abomination, written entirely like a WinForms app and not leveraging any part of the WPF framework.
17:58 jberger it was ... I don't know a strong enough word ... horrific?
17:58 PanzerBjorn Sounds horrific. XAML is typically compiled.
17:58 jberger yes
17:58 jberger it involved some awful hacks
17:58 PanzerBjorn I mean that sounds like writing and compiling C++ on the fly. ;D
17:59 PanzerBjorn Which doesn't make a lot of sense, because you can bake-in plenty of flexibility to a XAML page.
17:59 jberger they were basically trying to do what is now thought of as reactive front-end in browser terminology
17:59 PanzerBjorn Oh dear, the WPF framework supports that quite easily natively.
17:59 jberger think data-binding, components and all
18:00 jberger but they did it via generating XAML
18:00 PanzerBjorn That's... The wrong way of going about things. ;D
18:00 jberger welcome to the entire way that company does things
18:00 jberger it was also built on Python 2.6.5 (with choice backports)
18:00 jberger this being a BRAND NEW PROJECT
18:00 PanzerBjorn I need to buy more gold stars for people. There's really a lot of special folks out there. =/
18:01 jberger that whole thing was a special kind of bad
18:01 PanzerBjorn Maybe I should end my career as a dev and go into the special training field, teach devs how to MVVM. It's such a simple thing that engineers always want to over-complicate. Harmony comes from simplicity, not over-engineering.
18:03 jberger PanzerBjorn: do you have a link or something about WPF discontinuation?
18:04 PanzerBjorn Not off the top of my head, no. It was announced by the now fired Windows 8 App Team.
18:04 disputin joined #mojo
18:04 PanzerBjorn And Microsoft may have buried the article since they were all fired.
18:04 jberger all I see is this: http://blogs.msdn.com/b/dotnet/archive/2014/11/12/the-roadmap-for-wpf.aspx
18:04 jberger which doesn't seem to say it is dead
18:04 PanzerBjorn WPF is now in a state of limbo somewhere between officially unsupported and unofficially still being worked on.
18:06 PanzerBjorn Ah, good article, thanks for linking it. That was around the time the Win8 Apps Team was let go.
18:07 PanzerBjorn Internally there's a lot of debate at Microsoft about whether to keep the WPF torch going and getting fully behind it again, or letting Xamarin take the lead role in the spotlight. Personally I have really not liked Xamarin because it fails to achieve all it claims to do, and is not a graceful system to work with...
18:08 jberger that sounds like a perfect direction for Microsoft to go then ...
18:09 PanzerBjorn lol
18:09 jberger just one of these days, I'd love to see a marketing team actually ask a development team what is possible before selling it to the world
18:09 PanzerBjorn Good thing I stay on top of Angular, Bootstrap and various other web techs then. So I always have a career path to bail from Microsoft.
18:10 jberger I don't mean that there cna't be some push to greatness, but still
18:10 * jberger has been liking Vue.js
18:10 PanzerBjorn Yeah, synergy is nice when it happens. Sadly most decisions are made in vacuums.
18:10 jberger I never could wrap my head around Angular
18:10 jberger probably my failing all in all
18:10 PanzerBjorn Angular is embracing MVVM, so it's natural and untuitive to me.
18:10 PanzerBjorn intuitive, rather
18:11 woz joined #mojo
18:11 PanzerBjorn Make your model, make your view, write converters, create templates, hook them up, done.
18:11 jberger the zero to something curve is just so sharp, I'm sure its great once you get over that hump (I know several people that love it)
18:11 jberger but I can't get over that hump it seems
18:12 PanzerBjorn It's just about getting the concept into your head. It's hard to move from MVC to MVVM, took me a couple years of working on it full time before the light flicked on.
18:12 jberger I don't really think that's the problem, Vue.js seems to make perfect sense to me
18:13 PanzerBjorn Well, Angular 1.x actually made a lot of mis-steps, which is why we have Angular 2.0 on the horizon to correct for them.
18:13 jberger preaction (another Angular user) commented when I showed it to him that it had all the things that he used from Angular and didn't have the rest
18:13 jberger Angular 2.0 looks nice-ish, but I'm still not to the point where I want to compile my html before serving it
18:14 jberger s/html/javascript/
18:14 PanzerBjorn Compile? I don't compile any of mine. o.O
18:14 jberger all the examples are in whatever-script
18:14 jberger the pure javascript examples are quite a bit more complex
18:14 PanzerBjorn Bwuh? I just use raw HTML, JS and CSS for my Angular SPAs and pages.
18:15 PanzerBjorn Oh, well, I also use jQuery extensively, try to avoid raw JS. Sometimes I use Handlerbars too.
18:15 jberger typescript, that's the thing
18:15 PanzerBjorn Hah, I thought typescript was a font system. =D
18:16 lluad joined #mojo
18:16 jberger hmmmm maybe after learning Vue.js reading the pure javascript form of Angular 2.0 not seem quite as bewildering
18:21 marcus jberger: angular is satan and must be burnt at the stake or whatever.
18:21 batman it's been a while since i looked at angular, but it was far too easy to make spagetti
18:21 batman haha
18:21 jberger a wild marcus appears!
18:21 PanzerBjorn jberger used Sarcasm - it's super-effective!
18:22 marcus A wild PanzerBjorn also used Sarcasm
18:22 PanzerBjorn Spaghetti is delicious.
18:22 jberger http://img.memecdn.com/spaghetti-dog_o_1194622.jpg
18:23 PanzerBjorn MemeCDN... What has our society come to?
18:23 PanzerBjorn When the aliens invade, this is what we'll be remembered for.
18:27 PanzerBjorn Ubuntu in my Windows... Wow. Well, it's a shame I have to upgrade to Win10 to get that. =/
18:28 nicomen You could upgrade straight to Ubuntu
18:28 nicomen smaller install too
18:30 PanzerBjorn Agreed, make it so!
18:30 PanzerBjorn Anyway, jberger and batman... I just found out the hard way that a helper only helps where you're explicitly calling render. Many of my controller methods just let Mojo sort out the template by controller and action. =/
18:31 PanzerBjorn Nothing keeps me from adding explicit render calls, of course, but that's less elegant.
18:31 jberger PanzerBjorn: how are you prepending the path in that case?
18:31 batman nicomen++ # hehe
18:31 PanzerBjorn Um, I'm not, silly. ;D
18:32 PanzerBjorn That's why I asked if there's a way to change the template root for a given request in the under() for it..
18:32 jberger so you are just starting to implement this multi-tenant thing?
18:32 PanzerBjorn This... version of it, yes.
18:32 jberger well as I said just yesterday, I typically don'
18:32 jberger t use the the automatic rendering, just personal preference
18:33 jberger did you investigate the before_render hook I mentioned?
18:33 PanzerBjorn Before I was running separate instances of Mojo for each domain on a different port and letting the nginx handle sorting out the domains. But I realized that's lame since I'm using the same controllers and shared resources for each site.
18:33 jberger PanzerBjorn: honestly I think that's a perfectly sane thing to do
18:34 PanzerBjorn What, having 18 copies of the same git repo and each time you make an update you have to do 18 deployments and restarts?
18:34 jberger no
18:35 jberger having a reusable app
18:35 jberger deployed 18 times
18:35 PanzerBjorn Oh, then you mean the opposite is the sane thing? Pulling it all together into one big project?
18:35 jberger ?
18:36 jberger if they use the same controllers and shared resources why are there 18 repos?
18:36 PanzerBjorn There's one repo for each site. Because each site has some of its own resources and uses its own templates.
18:36 jberger can't that be configuable though?
18:36 jberger in the deployment configuration?
18:37 PanzerBjorn In the new repo, there's just one Mojo to rule them all, and each site has separate folders under public and templates.
18:37 jberger a repo for the app and 18 repos of individual templates/content+config
18:37 PanzerBjorn Deployment configuration right now is pulling git 18 times and restarting Mojo 18 different ways by hand.
18:38 jberger PanzerBjorn: that's what ansible is for
18:38 PanzerBjorn Sounds like a sysadmin tool. ;)
18:38 jberger yep
18:38 PanzerBjorn I'm an engineer, I don't get paid to do that kind of stuff.
18:38 PanzerBjorn Somebody who makes far less than me gets to do the janitorial work.
18:38 jberger so its better to rewrite your app to multi-tenant?
18:39 PanzerBjorn Sure. Makes it way easier to maintain on the dev side, too. One repo, all sites.
18:39 jberger I'm not saying you're wrong, you know your own return on investment better than I will
18:39 jberger but it strikes me as using the wrong tool
18:39 jberger as an outside observer
18:39 PanzerBjorn If I need to update a controller, I don't have to manually copy the code across 18 other repos.
18:40 jberger again, you would only have one repo of the app
18:40 jberger then you'd have repos for your per-site content and configuration
18:40 PanzerBjorn So what would I wind up with 18 of in your scenario? 18 Mojo startup modules?
18:41 jberger the app would read the site configuration and set the template and static paths
18:41 jberger no
18:41 jberger 18 template directories
18:41 PanzerBjorn That's what I have now.
18:41 jberger 1 mojo app
18:42 PanzerBjorn So how do you get 1 Mojo app to be 18 different Mojo instances?
18:42 jberger start it with a different config file
18:43 PanzerBjorn Mojo has config files?
18:43 jberger ummm
18:43 PanzerBjorn May seem like a stupid question, but seriously. I was not aware.
18:43 jberger technically Mojo apps have a config method, but there are plugins for loading config into it from files or elsewhere
18:44 PanzerBjorn I put my configs in my startup module.
18:44 jberger the canonical one is Mojolicious::Plugin::Config which is a core module
18:45 jberger or Mojolicious::Plugin::JSONConfig if you prefer
18:45 PanzerBjorn So in $self->config() you can set the template/public path?
18:47 PanzerBjorn I don't see options for that in hypnotoad's configure params.
18:47 PanzerBjorn Maybe I'm not understanding where, in your concept, the site folder magic happens.
18:49 jberger no, then you'd use the config in your app to set the template path
18:50 jberger if (my $template_path = $app->config('template_path') { $app->renderer->paths([$template_path]) } or whatever
18:50 jberger that's just off the top of my head of course
18:51 PanzerBjorn Ahhh, I see. So those get set really at the top-level, hence why you can't tweak them on a per-request basis and expect it to not get munged for another request.
18:51 jberger see for example my Galileo config loader method: https://github.com/jberger/Galileo/blob/master/lib/Galileo.pm#L38-L116
18:52 jberger right
18:52 PanzerBjorn Makes sense. But the render_site helper works too. ;)
18:52 nicomen make a render helper replacement for instance?
18:53 PanzerBjorn 3Already did that, nicomen. We were just discussing alternatives.
18:53 nicomen oh
18:53 nicomen I think I had a wrapper for all requests previously
18:54 nicomen let me check
18:54 jberger nicomen: the problem is automatic rendering
18:54 jberger which is why I suggested cleaning things up in a before_render or at least trying since I've never actually used that
18:54 jberger then I asked PanzerBjorn to take a step back and consider if modifying the app to be multi-tenant is really what is required
18:55 jberger which is where we are at now
18:57 nicomen I think I just used the layout stash value
18:57 PanzerBjorn I will read-up on before_render before I go any further. The helper approach is working for now.
18:58 nicomen and around_Action, but before_render is best for exactly that I would guess
19:04 PanzerBjorn Interesting, I'm not sure I fully understand what magic is going on around before_render - it seems to think that a template path will be provided as 'template' => '[path]' in its arguments but when I call render() I just send the path as the only argument, without a hash name.
19:05 PanzerBjorn Does render() automagically turn the single path argument into 'template' => '[path argument]' behind the scenes?
19:07 jberger yes
19:07 jberger you can set the template stash key rather than call render at all
19:08 jberger render is mostly just convenience
19:08 PanzerBjorn So it's just a convenience wrapper to setting the stash value more or less?
19:08 PanzerBjorn (It can also take other stash values as paramrs and set those, also convenient)
19:13 jberger https://github.com/kraih/mojo/blob/master/lib/Mojolicious/Controller.pm#L165-L166
19:20 thowe_work DateTime Duration is broken....
19:20 PanzerBjorn That's a bold and strident statement.
19:21 thowe_work it thinks the difference between today and March 31st 2018 is 1 year, 11 months, and 1 day.
19:21 thowe_work It reports the same difference from now until April 1 2016.
19:22 stephan48 got a Proof of Concept?
19:22 Grinnz_ um, what time zone?
19:22 Grinnz_ also what does this have to do with mojo?
19:23 thowe_work Grinnz, Yeah, I started there too, but time zones aren't 20 days apart...
19:23 pink_mist excellent question
19:23 thowe_work er 30 days
19:23 s1037989 Grinnz_: Smartest people are in this room!  :D
19:23 Grinnz_ thowe_work: it _is_ april 1 2016
19:23 thowe_work sorry, I meant to say 2018
19:23 Grinnz_ lol
19:23 PanzerBjorn Everyone knows that to master Mojo, one's Perl-fu must be beyond mastery.
19:24 stephan48 oh we are not in #perl-help?
19:24 thowe_work I was just throwing it out there...
19:24 batman jberger: have you looked at https://github.com/kraih/mojo/issues/941#issuecomment-204529246 ?
19:24 stephan48 and I already questioned why I see so much mojo specific talk
19:24 thowe_work I should ask in Perl-help
19:24 batman jberger: nevermind the comment...
19:24 pink_mist stephan48: lol
19:24 stephan48 thowe_work: what would interest me is a PoC
19:25 thowe_work stephan48, I'll see if I can put together a one-liner
19:27 dvinciguerra joined #mojo
19:29 Grinnz_ http://fpaste.org/348400/14595389/
19:33 Grinnz_ also keep in mind... "durations" are a very weird thing. this kind is dependent on the dates and time zones in question
19:39 thowe_work I couldn't get it very small, this example is clearer.  Essentially this shows if I change the date by one day, Duration changes the difference by almost a month
19:39 thowe_work https://gist.github.com/thowe/e21f21bdae779f60dda9e1c95ff47dc5
19:42 s1037989 thowe_work: IIRC, DateTime is indpendently doing a subtractions of year, and of month, and of day -- 3 separate subtractions.
19:42 s1037989 It's not looking at the collection as a whole.  May be a poor explanation.  Also may be incorrect.
19:43 s1037989 For me, I feel that I have discovered that DateTime isn't very DWIM, where I is me specially.  :)
19:43 Grinnz_ thowe_work: in_units does what you want
19:44 Grinnz_ thowe_work: as the documentation says somewhat confusingly, ->days will return the number of days left after subtracting any full weeks
19:46 thowe_work yes, in_units is what I want.
19:46 thowe_work Grinnz, I totally missed the part about "weeks".
19:46 Grinnz_ yeah. I missed it until looking closer with your example
19:46 thowe_work Grinnz_
19:48 thowe_work Thanks!
19:54 thowe_work Awesome, I feel better now.  And my contract display works again.
19:58 thowe_work which is a Mojo thing, so I'm going to call it on-topic
20:00 dod joined #mojo
20:12 woz joined #mojo
21:03 disputin joined #mojo
21:43 haarg joined #mojo
21:52 perlpilot joined #mojo
21:53 haarg joined #mojo
21:53 Vitrifur joined #mojo
21:57 disputin joined #mojo
21:59 bpmedley VVelox : Did you decide on a video approach?
22:18 good_news_everyon joined #mojo
22:18 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vVlft
22:18 good_news_everyon mojo/master 5f47058 Sebastian Riedel: let Mojo::JSON generate canonical JSON objects again (closes #665)
22:18 good_news_everyon left #mojo
22:18 sri oops
22:18 thowe_work \o/
22:18 sri wrong issue
22:18 thowe_work _o_
22:23 cfedde /o\
22:24 thowe_work That one reminds me of that Jackie Chan meme where he's all like "WTF?!"
22:24 cfedde \o\
22:24 cfedde /o/
22:24 thowe_work Hey...  Ho...
22:25 bpmedley \o/
22:35 lluad joined #mojo
22:36 vicash hi. Suppose I click on a link that goes to an exception. I want to place a back button on the exception page that goes back to the page that the user clicked the bad link on. what function can I use to detect that ? $tx->req->referrer() ?
22:37 punter joined #mojo
22:37 thowe_work I use $self->req->headers->referrer
22:39 thowe_work given the non-blocking example here: http://mojolicious.org/perldoc/Mojo/Pg/Database#query ...
22:39 thowe_work how would I get  the results outside that sub if it was a select query?
22:39 s1037989 vicash: What about using Javascript?  http://stackoverflow.com/questions/8814472/how-to-make-an-html-back-link
22:40 Grinnz_ thowe_work: what do you mean outside that sub? if you mean directly after, the query hasn't been run yet at that point
22:40 vicash s1037989: i want to generate the link using Mojo within the template itself
22:40 bpmedley VVelox : https://github.com/brianmed/sparky/blob/master/lib/Sparky/Dashboard.pm#L727
22:40 pink_mist thowe_work: you need to use callbacks or delays for things like that
22:41 thowe_work Grinnz_, Honestly, I don't know what I mean when looking at the non-blocking stuff.  I don't get it.
22:41 bpmedley thowe_work : We can help
22:41 Grinnz_ thowe_work: think of it like this: the callbacks you pass are stored and run at some later time
22:42 thowe_work I couldn't point to the callback in this example...
22:43 thowe_work what is the callback?
22:43 Grinnz_ the coderef you create with the sub {} syntax
22:44 thowe_work OK, so that's stored and run at a later time.  Fine.  When it's done, how to I do things with my results?
22:44 bpmedley thowe_work : My understanding is that the callback is a perl code reference that is executed by the event loop after the I/O has been accomplished.
22:45 bpmedley thowe_work : The connection is still present when your callback is executed, so you can generate JSON, HTML, etc at your leisure.
22:45 Grinnz_ Mojo::IOLoop->start, in this example, blocks and runs the event loop until it's done. the event loop will run that query and once it gets the results it will call that coderef
22:45 Grinnz_ from that coderef, you continue your program logic (hence "continuations")
22:46 Grinnz_ when there's a lot of steps involved this leads to "callback hell" which delays can help you avoid, by presenting them as a sequence of coderefs instead of nested coderefs
22:46 thowe_work I'm sure what you guys are saying would make sense if I wasn't missing some bit of context...
22:47 bpmedley thowe_work : Perhaps if we make a smallish CRUD example via Mojolicious::Lite that could help?
22:47 thowe_work Maybe if this example had something useful in place of the "...".
22:47 Grinnz_ the "..." is where you do stuff with $results
22:48 bpmedley thowe_work : I'd be happy to spend some time to make an example.
22:48 thowe_work You are using these words like callbacks and continuations and I don't know what they mean.
22:48 pink_mist ... how about looking at the examples included with Mojo::Pg?
22:48 Grinnz_ a callback is a coderef which the event loop stores and executes at the appropriate time. that's it
22:49 Grinnz_ or more generally, "code which will be called back once it's done"
22:49 pink_mist thowe_work: https://metacpan.org/source/SRI/Mojo-Pg-2.25/examples
22:49 thowe_work OK, I understand those words, more or less, but what part of this example I linked to is "the coderef"?
22:49 Grinnz_ the sub {}
22:49 vicash How do I detect if the current schema access of a page is HTTP or HTTPS ? I need to set my websocket schema appropriately otherwise it doesn't work in Firefox.
22:50 thowe_work Grinnz, OK, so...  where do the values that are apparently in @_ come from?
22:50 Grinnz_ $db->query sets it up so the event loop will pass those values in when it calls the callback
22:51 thowe_work huh?
22:51 vicash thowe_work: i think you need more fundamental information on concurrent programming
22:52 Grinnz_ https://metacpan.org/source/SRI/Mojo-Pg-2.25/lib/Mojo/Pg/Database.pm#L143
22:52 Grinnz_ ->query uses a callback itself, for the reactor's io() method to watch the DBD::Pg handle
22:53 Grinnz_ when that handle gets data, the reactor calls that callback, which ->query has set up to call your callback
22:54 bpmedley vicash : http://mojolicious.org/perldoc/Mojo/Message/Request#is_secure <-- perhaps?
22:54 vicash bpmedley: cool. let me try that.
22:55 thowe_work there is suddenly a thing called a reactore that I am apparently supposed to already understand?
22:55 Grinnz_ thowe_work: sorry, I thought you wanted the details. the important thing is *something* calls the callback once the results are ready
22:55 bpmedley https://gist.github.com/brianmed/2baef304379fd2370e5e9d98fe73f9ee
22:56 Grinnz_ the reactor is just the implementation of the event loop
22:56 thowe_work where did ($db, $err, $results) come from?
22:56 Grinnz_ they are passed by Mojo::Pg's callback
22:57 thowe_work always those three things?
22:57 Grinnz_ yes
22:57 thowe_work Is $results the result object from the query?
22:58 Grinnz_ it's the same Mojo::Pg::Results object you get normally
22:58 pink_mist in other words: yes
22:58 thowe_work so instead of returning to an lvalue, it's passed forward into the coderef...?
22:58 Grinnz_ right
22:58 Grinnz_ because nonblocking code can't "return" in the normal sense, because it hasn't happened yet
22:59 bpmedley https://metacpan.org/source/SRI/Mojo-Pg-2.25/lib/Mojo/Pg/Database.pm#L143 <-- thowe_work , I think here
22:59 thowe_work so it is only in that scope, so from within that coderef I must then render if I want to use that data for my template?
23:00 Grinnz_ right, but if you're doing this in a Mojolicious rendering context, there are helpers for that
23:00 bpmedley thowe_work : I think I've heard "contexts" instead of scope.  I'd like a correction on that if I'm wrong.
23:00 bpmedley How many contexts are there?
23:02 thowe_work is there an example of an app that uses this method?  Also, the reason I am looking at this is that I have a query that takes about 20 seconds to run...  Is this the preferred method for handling that kind of thing?
23:02 Grinnz_ thowe_work: what I do a lot of times is have the common rendering code in another method, which then I can call from either the callback or elsewhere
23:02 Grinnz_ so the callbacks don't get too complex
23:03 pink_mist thowe_work: I already linked to examples
23:03 bpmedley thowe_work : Sounds a perfect use case.
23:03 pink_mist 00:49 <pink_mist> thowe_work: https://metacpan.org/source/SRI/Mojo-Pg-2.25/examples
23:03 bpmedley *like a
23:03 Grinnz_ pink_mist: the example blog doesn't use any nonblocking queries unfortunately
23:03 pink_mist oh it doesn't? 0_o huh
23:05 Grinnz_ thowe_work: the simplest way, though more complicated to fully explain, is to use the delay helper: https://metacpan.org/pod/Mojolicious::Plugin::DefaultHelpers#delay
23:05 Grinnz_ you would want to do basically the part after # Non-blocking request, but your second callback would get "my ($delay, $err, $results) = @_;"
23:05 thowe_work Grinnz_, I would like to see an example of what you mean there when you said "in another method, which then I can call from either the callback or elsewhere"
23:06 Grinnz_ thowe_work: i just meant splitting the code out into another function
23:06 vicash bpmedley: the is_secure() did not work since I am reverse proxying through nginx, but setting a header 'X-Forward-Proto' in nginx that has the value of $scheme and checking for that worked correctly.
23:07 bpmedley Sweet.  Deployment is always a delicate thing.
23:07 Grinnz_ thowe_work: I don't really have any examples of that in public code
23:07 thowe_work Grinnz_, Oh, I see
23:10 bpmedley thowe_work : We could create an example, if you want.  I have some time.
23:12 thowe_work I'm starting to think that the background to understand the logical style of loops, etc...  isn't provided in the Mojo docs.  It must be gotten elsewhere.
23:13 bpmedley thowe_work : I believe your statement is accurate.
23:13 thowe_work concurrent programming, as vicash mentioned.
23:13 thowe_work can you suggest a source(s)?
23:14 bpmedley thowe_work : Sorry, no, I googled, tinkered, and read code.  Then I created horribly looking apps that blocked.. now, the apps I create only sometimes block.. :-0
23:15 thowe_work I am also often confused by the examples...  I can never tell what methods and variables are arbitrary examples, and which are part of the API...
23:16 thowe_work like here, I'm not sure what to make of "tx" : https://metacpan.org/pod/Mojolicious::Plugin::DefaultHelpers#delay
23:16 thowe_work or, for that matter, $c...  Is that a controller object?
23:17 thowe_work Oh, I think the preceding paragraph actually says.
23:17 bpmedley Correct, those are amazingly helpful.  Are you sure you don't want to create a test app to tinker with?
23:17 bpmedley http://mojolicious.org/perldoc/Mojo/Transaction/HTTP
23:17 thowe_work bpmedley, I probably do, but at this point I couldn't
23:18 bpmedley Ok, so, I'd be happy to create one and we can learn together.  I have some time.
23:20 thowe_work in that delay example, it shows: "my $delay = Mojo::IOLoop->delay(sub {...}, sub {...});"  I don't know what it expects me to know would go where the "..." is.
23:21 bpmedley At this point, I think a small working example that is built up would be a good choice to target.
23:21 thowe_work I'm game
23:22 thowe_work Shall we make an example github project?
23:23 thowe_work How would you like to proceed, and what would you like me to do?  I could put together a little database or something.
23:23 bpmedley https://gist.github.com/brianmed/4f6e26af5ec56fd0f6b469fb30373ed3 <-- How is this?  we can git clone this
23:24 thowe_work are you brainmed on github?
23:24 bpmedley yuppers
23:24 thowe_work I assume
23:24 s1037989 bpmedley: thowe_work: Try cloud9: http://c9.io  It allows you to pair code like a Google Doc.  It's a web-based collaboration IDE, and also an Ubuntu container to execute all your code.
23:24 lb lib/Foo.pm dist.ini README.md t/*.t
23:26 bpmedley thowe_work : have you git cloned?
23:26 thowe_work Oh, not yet, just a sec...
23:26 pink_mist lb: did someone do ls?
23:27 sri curious nobody linked to the cookbook yet
23:27 sri thowe_work: http://mojolicious.org/perldoc/Mojolicious/Guides/Cookbook#REAL-TIME-WEB
23:28 bpmedley s1037989 : Sounds cool; however, I'm not sure how to use c9.io.
23:28 thowe_work you want me getting the gist?
23:29 bpmedley thowe_work : Please
23:29 s1037989 bpmedley: Understandable.  Add it to your list to check out sometime.  I think you'll find it well worth a look and mostly self-explanatory.  It integrates with Github too.
23:29 sri also http://mojolicious.org/perldoc/Mojolicious/Guides/FAQ#What-is-the-difference-between-blocking-and-non-blocking-operations
23:29 bpmedley sri : I'm wondering if thowe_work would benefit more from running live examples..
23:30 * thowe_work is still tryign to figure out how to clone a gist....
23:30 s1037989 A huge benefit is that it creates a uniform environment between you and your pair(s).  It's web based so follows you everywhere.  It stays running in the cloud.  Anyway, just food for thought for some day...  :D
23:31 thowe_work nm, got it
23:31 bpmedley $ git clone https://gist.github.com/brianmed/4f6e26af5ec56fd0f6b469fb30373ed3 async
23:31 bpmedley s1037989 : Sounds like the superior solution if I knew how to use it.
23:31 s1037989 bpmedley: You especially might want to think about it with respect to liveperl.us...  Might be a great next stepping stone to help people get started.  Having a Cloud 9 account ensures everyone has an environment that you can rely on when it comes to tutorials.
23:31 thowe_work I wouldn't want to spend my time figuring out how to use a new tool when I'm trying to figure out a code example
23:31 bpmedley thowe_work : perl eg.pl daemon
23:32 bpmedley s1037989 : wowzers, that's awesome
23:32 thowe_work this shebang lione needs to go
23:32 thowe_work er line
23:32 bpmedley :)
23:32 s1037989 Let me know if you wanna play around sometime and get some pointers and do some test pair programming.
23:33 bpmedley thowe_work : What shebang would work well for you?
23:34 thowe_work I tend to use #!/usr/bin/env perl
23:35 thowe_work anyhoo, running example
23:35 bpmedley Ok, did you start the daemon?
23:35 thowe_work yes
23:35 bpmedley How many perl process are running via daemon?
23:35 thowe_work I only see one
23:36 s1037989 bpmedley++  You're a good teacher!  It's great to have you with us!
23:36 bpmedley Perfect.. And, if you would run: $ curl http://127.0.0.1:3000
23:37 thowe_work I still only see one.  How is it you are expecting me to see the number of perl processes?
23:37 bpmedley $ ps -ef | grep daemon
23:37 PanzerBjorn left #mojo
23:37 thowe_work OK, except I was grepping perl
23:37 bpmedley I assumed a unix 'esque OS.. are you running one?
23:37 bpmedley cool
23:37 thowe_work I was doing "ps -aux | grep perl"
23:37 bpmedley What did the curl output?
23:38 thowe_work but that doesn't mean I would catch something short lived
23:38 bpmedley Gotcha.  "daemon" runs a foreground server.. really sweet.
23:38 thowe_work the date, localtime, as expected
23:38 bpmedley How many requests can you handle per second with this?  Just guess..
23:39 thowe_work I tend to use morbo, but this is fine
23:39 bpmedley Hrmm.. different question..
23:39 thowe_work per second?  maybe 20?
23:39 bpmedley Does this block?
23:39 thowe_work I would think it would block, yes
23:39 bpmedley Do you have ab?
23:40 thowe_work if that's a cli prog, it's not in my path
23:40 bpmedley $ ab -n 1000 -r -l -c 50 http://127.0.0.1:3000/
23:40 bpmedley Hrmmm.. one sec..
23:40 thowe_work I can install
23:41 bpmedley Ok!
23:41 thowe_work hm, not found.  Where do I get it?  Perl thing?  Can be installed with cpanm?
23:41 bpmedley Moment
23:42 thowe_work brb
23:44 bpmedley $ date > when.time && for i in $(seq 1 100); do curl http://127.0.0.1:3000 & done && date >> when.time
23:44 bpmedley $ cat when.time
23:47 thowe_work the for loop went around a bit, the cat when.time produces two lines of date output
23:47 bpmedley Are they the same date, per chance?
23:48 thowe_work one second apart
23:48 bpmedley Cool, so assume 1.5 seconds and 100 requests..
23:48 bpmedley So, concurrent requests in one perl process.. :)
23:49 thowe_work is that a question?
23:50 thowe_work if so I would have to say "2"
23:50 bpmedley So, two seconds?
23:50 bpmedley I assumed that the first date was in the middle of a second or somesuch.
23:50 thowe_work you lost me, I was ssuming two requests per process
23:51 bpmedley However, there is only one process, right?
23:51 thowe_work So you are asking me how many requests per second?
23:51 thowe_work in one process?
23:52 bpmedley In this scenario, yes.
23:52 bpmedley Perhaps run the "benchmark" 3 times and average?
23:53 thowe_work I'm not sure because I don't know what part you are expecting me to get my answer from...  What happened when I ran the loop?  or What do I surmise from the output file?
23:54 bpmedley Sure.  The first line is the start time and the next line is the end time, I believe.
23:54 thowe_work Or the output from the window running the daemon?]
23:54 thowe_work Oh...  I see.  I guess it's at least 100 a second then
23:54 bpmedley So, imbetween the start time and end time we can curl 100 times via a background process.
23:54 bpmedley Pretty sweet, eh?
23:55 thowe_work I don't think I see that many requests in the window running the daemon.  I think many of the requests were dropped on the floor
23:55 bpmedley Hrmm.
23:55 bpmedley Would you mkdir log?
23:55 thowe_work just a sec...
23:56 thowe_work yeah, it's probably about 100
23:56 bpmedley Cool.  So, is it close to 80, 90, or 100?
23:57 thowe_work I should have started in tmux or something, but about that given the window size and how many times I paged up
23:57 thowe_work let's call it 100
23:57 bpmedley Sweet.  So, we got 100 requests in ~1 second, 1.5, or two?
23:59 thowe_work it looks like less than 1.5, more than 1
23:59 bpmedley And that is with one process?
23:59 thowe_work this is only one process as far as I know

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