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

IRC log for #mojo, 2016-05-06

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

All times shown according to UTC.

Time Nick Message
00:19 punter Should this work? Should it display "hello" at url = /admin/hello ?
00:19 punter http://pastebin.com/XvgtaFYe
00:19 punter Because it just sits there and waits when I browse to /admin/hello
00:20 punter and ends with an error 502 bad gateway
00:21 punter If I place the $self->render command inside authorize method, before the return 1, I get it on my browser.
00:22 punter shouldn't return 1 mean that the hello method should also be executed?
00:24 disputin joined #mojo
00:24 punter hello never gets executed (I checked the logs)
00:24 punter Why??
00:24 punter What am I doing wrong?
00:26 sri looks fine
00:29 punter then it's a mystery
00:36 punter i think i might have found the problem
00:47 punter here it is: http://pastebin.com/pbfbmVr3
00:48 esh joined #mojo
00:48 punter sri: I nailed the problem - seems weird
00:49 upasana joined #mojo
00:51 upasana_ joined #mojo
00:54 bobkare joined #mojo
01:06 disputin joined #mojo
01:28 dvinciguerra_ joined #mojo
01:28 tchaves joined #mojo
02:09 tchaves1 joined #mojo
02:13 Kripton joined #mojo
02:14 tchaves joined #mojo
02:16 noganex_ joined #mojo
02:20 tchaves1 joined #mojo
02:32 tchaves joined #mojo
02:51 asarch joined #mojo
03:24 henq joined #mojo
04:45 mmp joined #mojo
04:59 irqq joined #mojo
05:30 Adura_ joined #mojo
06:00 inokenty-w joined #mojo
06:23 punter joined #mojo
06:25 punter sri: I solved yesterday's problem, the one with "under" - it seems around_action should ALSO return true or false, depending on whether we want further methods to run.
06:32 bwf joined #mojo
07:01 dod joined #mojo
07:05 dod joined #mojo
07:23 AndrewIsh joined #mojo
07:54 dod joined #mojo
08:00 Vandal joined #mojo
08:05 panshin joined #mojo
08:14 trone joined #mojo
08:30 osfabibisi joined #mojo
09:20 irqq joined #mojo
09:23 meshl joined #mojo
09:33 panshin joined #mojo
10:12 kaare joined #mojo
10:18 punter joined #mojo
10:23 inbioz joined #mojo
10:23 andy joined #mojo
10:55 dvinciguerra_ joined #mojo
11:07 tchaves joined #mojo
11:18 Lee_ joined #mojo
11:19 irqq_ joined #mojo
11:20 Gedge joined #mojo
12:00 ivi joined #mojo
12:09 mgrimes joined #mojo
12:21 dod joined #mojo
12:36 HtbaaPi joined #mojo
12:56 ramortegui joined #mojo
13:03 gizmomathboy joined #mojo
13:18 Adura_ left #mojo
13:19 Adura joined #mojo
13:31 kaare_ joined #mojo
13:31 dantti_laptop joined #mojo
13:33 kaare joined #mojo
13:35 cpan_mojo Mojolicious-Plugin-RoutesAuthDBI-0.430 by MCHE https://metacpan.org/release/MCHE/Mojolicious-Plugin-RoutesAuthDBI-0.430
13:43 kaare_ joined #mojo
13:59 jberger sri: so I think I've come up with the dequeue query I need
13:59 jberger and interestingly, it doesn't conflict with Minion that I can tell
13:59 perlpilot joined #mojo
14:00 jberger so I'm going to start on this as Minion::Backend::PgExtra or something
14:00 jberger might not ever be for cpan
14:01 sri jberger: my interest is dwindling
14:01 jberger ok
14:15 * gtodd sets up his first ruby app
14:16 gtodd errm rails
14:25 gtodd and errm well ... WOW ...   I would say perl / mojolicious are a little more errm lightweight
14:27 jberger that isn't really a fair comparison, though of course you can make it
14:27 jberger a more fair comparison is rails to catalyst, though even that isn't as precise
14:30 sri rails is like 200k lines of code
14:30 sri can't compare that to an 8k framework like mojolicious
14:33 pink_mist what I'm wondering is "why does rails need so many lines?"
14:39 andy joined #mojo
14:42 gtodd jberger: yes ... I have never installed a local rails app
14:43 gtodd sri: it's more that I'm wondering why people use "the whole ball of wax" i.e. rails so frequently for what are fairly simple little apps
14:43 cfedde use what you know
14:44 cfedde use what your coworkers use.
14:44 cfedde usualy the choices are social layer rather than technical. as long as the technology is good enough.
14:46 gtodd yeah I guess if catalyst was the mandated environment and the tooling was there then I would autogenerate a massive application to serve a few pages
14:46 batman i don't see what catalyst can that mojo can't...
14:47 cfedde often the choices are ones of legacy too.
14:49 gtodd cfedde: yes .... here this app used something called "bundler" (a sort of carton cpanm thing?) and rvm and a ruby style library builder (akin to Alien::  I guess) to install to create a surprisingly large installation ... 50 or more gems probably 20-30 native libraries that ruby then uses FFI to access etc.  it seems excessibe and weird but ... it's all automated so :)
14:51 cfedde gtodd: kinda like my basic path when putting together a perl for a vm.  It includes Task::Kensho.  It's easier to just add it than it is to pick and choose which modules are actualy used.
14:52 gtodd yes ...  it only is excessive and weird for me :)
14:53 cfedde lazy trumps minimal.
14:53 sri batman: quite the contrary, mojolicious can do more than catalyst
14:54 sri a lot
14:54 gtodd and I'm missing half the fund because usually all of the above is done inside a Docker container deployed to a  VM in the cloud or something
14:54 batman sri: exactly... just got a bit confused about jberger comments about comaparing catalyst to rails...
14:54 Lee gtodd: http://oldmanyellsat.cloud/ ?
14:54 sri yea, i don't know what jberger meant either
14:55 gtodd half the fun none of the funds
14:55 gtodd Lee: yes
14:55 batman i guess catalyst is a lot *better* at adding boilerplate to your app ;)
14:55 batman hehe
14:55 ivi joined #mojo
14:56 gtodd oh cool .... I have a locally compiled libV8 so my rails app can use libsass
14:56 cfedde It's probably easier to continue to support a catalyst app than to rewrite it in something else.
14:57 batman cfedde: rewriting apps are... not a good strategy. what you do is to move functionality to a new codebase over time instead.
14:57 gtodd not sure the app uses CSS in any meaningful way but ... *you never know* when you might want to have a bunch of CSS ... errm SASS
14:57 cfedde batman: seems legit
14:57 jberger yeah, it was a bad comparison, I just meant more of a full stack (meaning comes with model bindings) but rails comes with an actual model
14:57 jberger so it isn't really comparable either
14:58 * jberger retracts
14:58 batman catalyst is not full stack at all.
15:00 cfedde full stack, webscale, cloud ready, buzzword complient, agile, new and improved.
15:01 ribasushi cfedde: https://www.youtube.com/watch?v=hkCR-w3AYOE ?
15:01 cfedde https://www.youtube.com/watch?v=AtK_YsVInw8
15:03 inbioz joined #mojo
15:12 disputin joined #mojo
15:17 PryMar56 joined #mojo
15:27 disputin joined #mojo
15:36 inbioz joined #mojo
15:40 inbioz joined #mojo
15:49 inbioz joined #mojo
15:50 dod joined #mojo
16:15 gtodd cfedde: it's true all the automation and tooling and containers that go under this rails app allows for lazy  wheee!!  ...  until it starts dumping core and well
16:15 gtodd :-\
16:17 bpmedley Around 150 book downloads.. :)
16:21 gtodd heh .. I wonder which of the 160 gems local native libraries and C extensions (ruby's XS) caused this core dump ...  :-\
16:21 gtodd => Notice: debugger option is ignored since Ruby 2.0 and it will be removed in future versions.
16:21 gtodd ok I know this is a mojo channel ... so I will stop .... it's just well  .... ARGH!!!
16:24 cfedde gtodd: that's when your coverage testing helps so much.
16:53 * sri wonders if there's a cpu yet fast enough to handle chrome
16:54 sri i swear it stutters every now and then even on xeon workstations
16:54 cfedde for me it's not so much chrome as all the crappy javascript that is running in all the crappy tabs I have open. Also Slack should be taken out and shot.
16:56 inbioz joined #mojo
17:02 Kripton joined #mojo
17:11 disputin joined #mojo
17:18 vicash Slack is a big offender. i have uninstalled it actually.
17:18 vicash also using noscript on firefox reduces so much CPU usage
17:34 pink_mist isn't Slack a poor man's irc?
17:35 sri more like rich man's irc
17:37 stigo joined #mojo
17:37 vicash ircbro
17:37 vicash it is IRC with images and emoji
17:38 Grinnz_ and a mobile-friendly client, and a persistent interface, and...
17:39 vicash and a copy of Basecamp I think. i remember using Basecamp in 2011 and it had pretty much the same features.
17:39 Grinnz_ not as successful marketing, if so :P
17:39 vicash it wasn't VC funded i think.
17:40 vicash i bet soon when you post you feel sick to your gut about a manager, you will see an ad for constipation medication from an Ad network there
17:40 Grinnz_ lol
17:43 pink_mist ok, so it's a poor man's Convos :P
17:45 sri 🤔
17:56 pink_mist I ... don't think that's a character in unicode 0_o
17:56 vicash pink_mist: i have been trying to find it too
18:00 pink_mist oh wait, I found it: http://unicode-table.com/en/1F914/ ... but none of my fonts know it :(
18:02 vicash pink_mist: it is a mac thing. i can print it on the mac terminal but not on the linux terminal
18:03 bpmedley vicash: what is TERM set to?  Which terminal app?
18:04 vicash bpmedley: on mac i use iTerm and Linux is using gnome-terminal. both have TERM set to xterm
18:04 vicash bpmedley: perl -e 'print "\xf0\x9f\xa4\x94\n"; '
18:05 pink_mist perlbot gave this: <perlbot> Error: U+1F914 (f0 9f a4 94): no match found
18:05 pink_mist which was why I thought it wasn't a character
18:11 bpmedley Craziness.  I wonder what font would be needed in linux for viewing.
18:15 jberger bpmedley: I recommend installing symbola for unicode-spanning fonts
18:15 jberger http://users.teilar.gr/~g1951d/
18:17 bpmedley Coolness
18:19 vicash bpmedley: ttf-ancient-fonts on Debian clones
18:22 disputin joined #mojo
18:22 sri that's what the emoji looks like on os x https://imgur.com/VtE62sB
18:24 sri hmm, retina scaling makes for huge screenshots
18:24 disputin joined #mojo
18:24 sri so, after one week with the new macbook, i can say that i totally love it
18:26 preaction is it a little one or a big one?
18:26 sri little
18:27 preaction no performance problems? i've started wanting a little one, but i keep worrying about power...
18:27 sri got the core m7, and it's a beast
18:29 vicash left #mojo
18:30 vicash joined #mojo
18:30 sri if you're coming from an air or mbp 13, i don't think you'll notice anything but the lack of fan noise
18:31 preaction i got the 2012 MBP 15" Retina, so it's a bit of a size drop
18:31 sri ah, i guess you might notice a difference coming from a quad core
18:32 preaction this thing works just fine though, so i imagine it'll stick around the house. i just need to be a bit more mobile if i'm carting the lappy to work and back every day...
18:32 sri doesn't get more mobile than this
18:32 preaction so i can do my video encoding on this thing, and the rest on the tiny thing
18:32 preaction yeah. a couple people at the QAH had the tiny ones, and i got extremely jelly
18:33 preaction i mean, the ipad with a keyboard is great, but it's not a machine for development...
18:33 sri if you're ok with the 12" screen, there's only the keyboard you have to get used to
18:34 sri personally, after a week i don't want to use another keyboard anymore
18:34 preaction and if they refresh the mac mini this year, i'll pick up a couple of those and then my computing power can stay at home
18:34 sri but some people will hate it
18:34 preaction is it really that different?
18:34 sri yea, very different
18:35 sri super shallow, but has a mechanical clicky keyboard feel to it
18:35 preaction interesting
18:37 sri i wouldn't worry too much about the performance, unless you want to play new 3d games on it
18:37 Grinnz i bet it plays overwatch fine!
18:39 sri so far i've played some civ beyond earth on it, and that was pretty smooth
18:40 preaction i'm not hardcore vidya anymore, so that'll likely be fine
18:41 sri playstation remote might be really nice with the macbook
18:49 sri preaction: geekbench suggests that the core m7 is about as fast as your mbp in single core benchmarks, and half as fast in multi-core
18:50 preaction so, basically fine then in most circumstances, thanks
18:50 sri it's very close to the current rmbp 13
19:01 bpmedley What do y'all use for javascript with respect to widgets, routing, and layout?  And, do they work well with mojo?
19:19 punter I use Angular, works great with Mojo.
19:19 irqq joined #mojo
19:20 punter Everything is AJAX JSON
19:22 bpmedley punter: cool.  Does angular do layout?
19:23 punter bpmedley: it has a templating mechanism, if that's what you mean
19:24 punter bpmedley: and you can split a page in partials. So you can have a grand HTML template to display logo header and footer, and display smaller html bits inside depending on route
19:24 bpmedley punter: perhaps would be better to ask if angular has a grid system
19:24 punter bpmedley: I don't know
19:25 bpmedley That's sweet.  Do the angular routes use ajax?
19:26 punter Yes, more than jQuery does - for example, by default, AJAX POST requests have their data in JSON format rather than the a=1&b=2
19:27 bpmedley May i ask what apps you work on with them?
19:27 punter Check out perlmodules.net - it's all Mojo & Angular
19:28 punter it's a SPA - single page application - all the HTML of all the templates loads when you first come into the website
19:28 punter everything from then on is AJAX requests
19:28 bpmedley Sweet.  RSS for cpan..
19:29 punter and the HTML gets cached in the browser for future visits, until it's modified on the server
19:29 stephan48 punter: care to include a noscript machanism? :)
19:29 punter What do you mean, stephan48 ?
19:29 punter what's a noscript mechanism?
19:30 punter bpmedley: you get email notifications too, if you register
19:30 stephan48 punter: a info for users wo do not have JS enabled
19:30 punter stephan48: is there anyone without JS enabled?
19:30 punter I could include that.
19:31 punter Should I write <noscript>This page requires JavaScript to be enabled on your browser</noscript> ?
19:32 stephan48 punter: yes - I block JS per default and only allow it when i deem it necessary
19:32 stephan48 yes f.e.
19:32 punter ok i'll do it
19:32 stephan48 thank you for taking care of the weird folks in the world :)
19:32 stephan48 (or the security concious)
19:35 punter I have a Mojolicious question: How can I get the stash from inside a method that doesn't have access to $c ?
19:35 punter that method didn't have ($c) as an argument
19:35 punter but I need to get something from the stash
19:36 Grinnz_ what is the method called on?
19:36 pink_mist if you make it a helper, it'll get $c passed in
19:36 punter what do you mean 'on' ? It's called by some runmode
19:37 Grinnz_ methods are called on an object or class
19:37 Grinnz_ so what object or class?
19:37 pink_mist punter: methods are always called on objects or classes. otherwise they're functions.
19:37 punter oh, it's on a database class
19:37 Grinnz_ pass the controller object in
19:37 punter I don't want to do that... it gets messy
19:37 Grinnz_ then you won't be able to access the controller object's stash :P
19:37 pink_mist punter: if you need access to it, you need to pass it in
19:37 pink_mist punter: there's no getting around that
19:38 punter I'll set a global variable and set it equal to $c
19:38 pink_mist wtf
19:38 Grinnz_ nooooo
19:38 pink_mist are you insane?
19:38 punter No? Why not?
19:38 Grinnz_ controllers are not global, they are per request
19:38 Grinnz_ you can have many requests handled simultaneously
19:38 punter Only one per proces, no?
19:38 Grinnz_ no
19:38 * bpmedley weeps at globals
19:38 punter oh right, it's non-blicking
19:39 preaction that's the entire point of mojolicious, to be nonblocking
19:39 punter ok i see, and that's why there can be no other way other than pass $c around
19:39 pink_mist well you could use closures and callbacks
19:40 punter in what way?
19:40 punter like?
19:40 pink_mist but then you'd need to pass teh callback around anyway.
19:40 pink_mist so it seems silly beyond reason
19:40 pink_mist *the
19:41 preaction why does the database class need access to the stash? can't you just give the value in the stash as input?
19:41 jberger punter: what are you trying to get from the controller?
19:42 punter Here's what I'm trying to do:
19:42 jberger I have often used helpers which pass the $app to the say the model, sri goes even futher and has helpers that pass the db instance
19:43 jberger https://github.com/kraih/mojo-pg/blob/master/examples/blog/lib/Blog.pm#L16-L17
19:43 punter I have a Redis server, that I use as a memcached replacement. What I want is, when I "get" from Redis, I want to cache what I got inside the stash, so if I want to "redis-get" the same thing 10 times, i only ask it once from Redis
19:43 punter 10 times in the same request, I mean
19:43 pink_mist so wrap your redis call in a helper with access to the stash
19:44 jberger punter: but those are going to be separate requests, right?
19:44 jberger also, you are putting caching in front of your caching
19:45 jberger that makes cache invalidation twice as hard :-P
19:45 punter jberger: what i want is: if in the same web request I ask 10 times for the same thing from redis, I want redis to be asked only once
19:45 punter The problem is this:
19:45 jberger punter: right, so on those 10 requests each has a different stash
19:45 jberger the stash doesn't survive between requests
19:46 punter I use an ORM (RDBO), so I want to write $row->expensive_method 10 times in the same web request
19:46 pink_mist jberger: he said the same web request
19:46 bpmedley jberger: i think punter is saying one GET/POST and multiple redis requests
19:46 jberger pink_mist: ah, your're right, I misread
19:46 punter jberger: 10 redis requests, not 10 web requests
19:47 pink_mist as I said: 21:43 <pink_mist> so wrap your redis call in a helper with access to the stash
19:47 jberger what pink_mist said ^^
19:47 punter Then the syntax would get somewhat messier
19:47 punter I think
19:48 pink_mist why?
19:48 punter To write $db_row->expensive_method looks cool
19:48 pink_mist instead of $redis->query(@args); you'd do: $c->helper(@args);
19:48 pink_mist possibly passing in $redis too, unless that's global
19:49 punter pink_mist: but I write $redis->query(@args) INSIDE the class of $db_row
19:49 pink_mist well WHATEVER it is you're trying to call that you want to cache in the stash
19:50 punter I guess I'll have expensive_method accept an optional $c parameter which will enable the cache of the cache
19:50 punter ok
19:50 punter :-)
19:53 cpan_mojo Minion-5.06 by SRI https://metacpan.org/release/SRI/Minion-5.06
20:06 meshl joined #mojo
20:14 osfabibisi joined #mojo
20:42 meshl joined #mojo
20:52 jberger so I just got to work out the sql for "insert this array into a row by unique id and on conflict merge the arrays distinctly"
20:52 jberger postgres <3
21:39 bpmedley https://www.reddit.com/r/perl/comments/4h2ayx/beta_mojolicious_book/?ref=share&amp;ref_source=link <-- Is this worth an upvote?
21:56 kaare joined #mojo
22:17 dave joined #mojo
22:27 frogz joined #mojo
22:27 frogz Not sure if I ask in here, or where. Was wondering how I'd bind an array using Mojo::Pg. Something like, $db->query('select * from table where id in (?)', @array);
22:29 preaction frogz: you probably want an arrayref, so \@array
22:30 Grinnz_ where id = ANY (?), with a bound arrayref, should work in postgres
22:31 Grinnz_ in mysql, you gotta form a string of ?s and use IN :)
22:31 frogz Thanks! That worked.
22:45 disputin joined #mojo
22:46 PryMar56 joined #mojo
22:57 disputin joined #mojo
23:10 disputin joined #mojo
23:23 disputin joined #mojo

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