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

IRC log for #mojo, 2017-06-16

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

All times shown according to UTC.

Time Nick Message
00:49 aborazmeh joined #mojo
00:53 suede joined #mojo
01:14 PopeF joined #mojo
01:19 karjala_ joined #mojo
02:22 PopeF joined #mojo
02:24 xdg joined #mojo
02:24 xdg joined #mojo
02:26 xdg joined #mojo
02:32 noganex joined #mojo
02:47 cheako joined #mojo
03:02 PopeF joined #mojo
03:21 aborazmeh joined #mojo
03:25 cheako joined #mojo
04:04 dboehmer joined #mojo
04:12 cheako joined #mojo
04:24 maschine joined #mojo
05:43 dod joined #mojo
05:50 dod joined #mojo
06:36 dod joined #mojo
06:46 salv0 joined #mojo
06:52 AndrewIsh joined #mojo
06:58 inokenty-w joined #mojo
07:03 genioweb joined #mojo
07:30 trone joined #mojo
07:33 Petru_ joined #mojo
09:05 rshadow joined #mojo
09:32 kiwiroy joined #mojo
09:36 karjala_ joined #mojo
11:09 coolo_ joined #mojo
11:09 szarate joined #mojo
11:26 kes joined #mojo
11:26 kes hi
11:26 purl niihau, kes.
11:26 kes is this OK that '$c->req->url->to_abs' returns Mojo::URL object?
11:27 nic yes
11:27 CandyAngel Yup
11:28 CandyAngel A lot of methods in Mojolicious return an object so you can chain methods like that
11:28 CandyAngel For example, I personally prefer to build URLs like this: Mojo::URL->new->scheme('http')->host('google.com')
11:29 cng joined #mojo
11:30 pink_mist does google still accept using http as scheme?
11:30 CandyAngel It would be annoying to call ->to_abs and then have to put that in a Mojo::URL object to manipulate it
11:30 pink_mist I get redirected to https
11:32 pink_mist CandyAngel: if it's an accessor and you didn't give it a new value, it would return the current value though (not that ->to_abs is an accessor)
11:32 pink_mist (but ->scheme and ->host are)
11:32 CandyAngel Yeah
11:33 pink_mist kes: anyway, ->to_abs returns what it's documented to return
11:34 kes in documentation example it shows string:
11:34 kes # "http://example.com/foo/baz.xml?test=123"
11:34 pink_mist because it stringifies to that
11:35 pink_mist kes: but that's not the part of the docs that tell you want it returns, it's the bit with my $abs = ...
11:35 CandyAngel I don't think any documentation says an object there. It does also say that it "clones $url and turns it into absolute"
11:35 pink_mist and $abs is an object
11:36 kes I will use: $c->req->url->to_abs .""
11:36 CandyAngel Why do you want to do that?
11:36 CandyAngel If anything, do ->to_abs->to_string..?
11:36 CandyAngel Or ->to_unsafe_string if you have userinfo set
11:38 kes CandyAngel +1. I always thought that to_string returns 'path' and to_abs returns domain+path
11:38 tchaves joined #mojo
11:38 kes and miss that it is implicitly stringifies
11:39 CandyAngel Why do you want it to stringify immediately? That's unlikely to be needed
11:39 CandyAngel ONly time I've needed that was when I was passing it to some other function which didn't trigger stringification itself (PDF::Reuse I think)
11:39 kes I put url into hash I want to dump
11:39 kes http://paste.scsys.co.uk/564447
11:39 CandyAngel In that case, call to_string in that call
11:40 CandyAngel $object->something($abs->to_string)
11:40 kes And was surprized to get Mojo::URL
11:40 CandyAngel Ah, I see what's happening
11:41 CandyAngel But yeah, use ->to_string, not ."" so it's clearer what you are doing
11:41 kes I got this:
11:41 kes http://paste.scsys.co.uk/564448
11:41 CandyAngel I guess this is inside a bigger hash?
11:42 kes yes
11:42 kes It will be good if doc will be explicit too
11:42 CandyAngel That it returns an object?
11:43 kes that we require to call ->to_string to get string
11:44 kes or NOTICE: ref $url->to_abs eq 'Mojo::URL'
11:44 CandyAngel It already is explicit
11:44 CandyAngel if $url is an object and you clone it, you get another object
11:44 nic You should assume that X does not transform into Y unless the docn says so
11:46 kes yes, I should. But I was confused by example ( sorry
11:46 CandyAngel No worries, it happens
11:46 sri i'm all for documenting argument and return value types.... but so far nobody could come up with documentation best practices that would work for us
11:50 CandyAngel How about tutorials, but covering specific module use? That's the only place I could see "you need to call to_string on after to_abs to get a string" ever being in the Mojo docs :P
11:51 CandyAngel I mean, without the weird englishness
11:52 sri no, i mean pseudo code method signatures in the docs with type information
11:52 pink_mist sri: how about instead of the current "my $abs = $url->to_abs" instead having "my $url_abs = $url->to_abs"? ... thereby indicating that both $url objects?
11:52 pink_mist +are
11:54 nic to_abs: Mojo::URL -> string
11:54 pink_mist nic: but that's WRONG
11:54 purl pink_mist is channeling thoth!
11:55 sri stop channeling thoth!
11:55 purl fuck you, sri
11:55 sri oO
11:55 CandyAngel :|
11:55 nic first: Mojo::Collection(x) -> string -> (y) -> x
11:56 CandyAngel And the robot rebellion begins
11:56 sri that escalated quickly
11:56 nic scraping my memory of type theory lectures
11:56 nic but it wouldn't be very readable for a lang like perl
11:59 CandyAngel There are languages where that is readable?
12:00 CandyAngel I don't think that would have helped kes :P
12:00 nic in functional programming that is bread & butter
12:00 nic indeed
12:01 nic maybe just a tag indicating the type of the return value
12:01 pink_mist like I suggested?
12:02 pink_mist or did you mean something else?
12:02 stryx` joined #mojo
12:02 pink_mist do remember that accessor can return different types depending on how they're used
12:02 pink_mist *accessors
12:03 kes may I ask another question. Where I should hook to get all response headers?
12:04 kes I subscript to around_dispatch and after $next->() dump $c->res->headers->to_hash
12:04 kes But still do not have: Content-Length and Date headers
12:05 kes *subscribe
12:44 irqq joined #mojo
12:55 perlpilot joined #mojo
13:01 maschine joined #mojo
13:42 PopeF joined #mojo
13:48 kes Why body is empty? http://paste.scsys.co.uk/564450
13:48 kes how to read raw data from request?
13:55 PopeF joined #mojo
14:02 marty joined #mojo
14:04 gryphon joined #mojo
14:07 stryx` joined #mojo
14:24 PopeF joined #mojo
14:46 Pyritic joined #mojo
14:53 PopeF joined #mojo
14:53 PopeF0 joined #mojo
15:13 Pyritic joined #mojo
15:32 VVelox joined #mojo
15:54 good_news_everyon joined #mojo
15:54 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vHx97
15:54 good_news_everyon mojo/master 2c914f3 Sebastian Riedel: mention returned objects consistently
15:54 good_news_everyon left #mojo
15:54 sri interesting, committed and pushed that with the new git atom integration
15:54 sri quite comfortable
15:55 sri doubt i'll use it much though
16:02 PryMar56 joined #mojo
16:10 Grinnz sri: typo https://github.com/kraih/mojo/commit/2c914f3a8100d72e39e78d5422bb9a88c6804ca1#diff-87ba00fb1a09b2dc316966f191fbfca1R275
16:10 Grinnz "cloned form"
16:10 Grinnz (this isn't even my cloned form!)
16:11 good_news_everyon joined #mojo
16:11 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vHx7U
16:11 good_news_everyon mojo/master 5966034 Sebastian Riedel: fix typo in description
16:11 good_news_everyon left #mojo
16:11 sri :p
16:12 arcanez is there even a module to check for errors like that? it's a spelling error, but form is also a word
16:12 Grinnz "intent checker"? :P
16:18 jabberwok (setq dwim-mode t)
16:18 arcanez yeah, emacs could probably do it
16:18 arcanez vim.. probably not
16:45 cheako joined #mojo
16:57 rshadow joined #mojo
16:59 jberger wow "vim vs emacs meme" image search is really disappointing
16:59 disputin joined #mojo
17:00 Grinnz both editors too old for memes :P
17:00 pink_mist https://img.devrant.io/devrant/rant/r_83706_36LLz.jpg not enough? :P
17:01 jberger http://s2.quickmeme.com/img/2d/2d95cc80f9a2a2578a8f632eebecddcc1c12e5b08ab85f81a5d401670d5f36c1.jpg was probably my favorite
17:02 jberger but still meh
17:02 Grinnz hah
17:04 Armen emacs is great
17:04 Armen all it's missing is a decent text editor
17:04 jberger Armen++
17:05 jberger which I guess means its time for: https://cdn.meme.am/cache/instances/folder353/500x/54592353/winter-is-coming-brace-yourself-emacs-vs-vim-comments-are-coming.jpg
17:07 kivilahtio joined #mojo
17:08 arcanez I really wanted to use an actual IDE like Atom or something but I edit remotely too often
17:10 arcanez where atom can spell sublime or textmate
17:12 sri i use atom for editing big projects, and vim for single files
17:12 Grinnz i use vscode remotely, with sshfs
17:12 Grinnz once i worked out the quirks in keeping sshfs connected it works great
17:13 sri i don't like sshfs because search in project is pretty much unusable
17:14 Grinnz thats what git grep is for :P
17:43 sri the perfect trump tweet, it has been found https://twitter.com/realDonaldTrump/status/495384828427374592
17:45 pink_mist 0_o
17:45 pink_mist how the
17:45 perlpilot joined #mojo
17:46 pink_mist oh, 2014 :P
17:46 jberger There's a Trump tweet for all Trump occasions
17:46 pink_mist had me going there
17:46 sri hahaha
17:47 jberger I actually prefer the ones that he lists a policy/action that he opposes which he has since done as president
17:50 Grinnz heheh
17:51 Grinnz "For every trump tweet, there is an equal and opposite trump tweet"
17:51 jberger https://twitter.com/realDonaldTrump/status/265916267586809856
17:51 perlpilot I don't think I've seen a Trump v. Trump like Jon Stewart did for George W Bush
17:52 jberger https://twitter.com/realDonaldTrump/status/522108442514038784
17:52 jberger I'll stop, but this is a fun subreddit: https://www.reddit.com/r/TrumpCriticizesTrump/top/?sort=top&t=all
17:52 Grinnz ahh thats the subreddit i was looking for, thanks
17:53 Grinnz perlpilot: Colbert did one
17:53 Grinnz at least one
17:53 purl at least one is, like, NO THERE CAN ONLY BE ONE, HIGHLANDER
17:53 Grinnz https://www.youtube.com/watch?v=WpKiP_gmDS8
17:55 trone joined #mojo
17:56 disputin joined #mojo
17:57 jberger last one: http://www.nbcnews.com/politics/white-house/how-donald-trumps-old-tweets-haunt-him-today-n766366
17:58 jberger (from me at least)
18:09 stryx` joined #mojo
18:48 cheako joined #mojo
18:55 trippeh joined #mojo
18:56 rshadow joined #mojo
19:32 CandyAngel Decisions decisions
19:32 CandyAngel Should I multi-stage the sessions handshaking or not :P
19:43 Petru_ joined #mojo
19:55 salv0 joined #mojo
20:33 genioweb joined #mojo
20:54 irqq_ joined #mojo
20:59 irqq_ joined #mojo
21:10 maschine joined #mojo
21:18 marty joined #mojo
21:53 jhawley031 joined #mojo
22:47 sri hmm, i guess there's a pretty simple way to get rate limits with buckets into minion
22:50 sri with a traditional leaky bucket algorithm
22:51 sri very similar to my original attempt https://github.com/kraih/minion/compare/expiring_locks
22:52 sri but every named lock can have multiple rows in the table
22:52 sri each row representing a token taken out of the bucket
22:52 sri and expiring individually
22:53 sri actually makes the stored procedure much simpler, and only requires one
22:56 Grinnz unlikely to be an easy port to sqlite though :P
22:57 sri can you acquire an exclusive lock in sqlite?
22:57 Grinnz exclusive locks are just a lock on the whole file
22:57 sri then i think you could just implement it as a series of sql statements
22:57 sri i mean, it's not really complicated
22:58 sri just a delete on the expires timestamp followed by a select count(*) on the lock name, followed by an insert
22:58 sri just needs to be exclusive
22:58 Grinnz mm, alright
22:59 Grinnz yeah, thats pretty easily implemented as an exclusive transaction
22:59 sri :)
22:59 Grinnz but keeping those open is dangerous
23:04 * Grinnz really likes redis's features in that area
23:04 sri i wish there was an oreilly style cookbook for algorithms like leaky bucket...
23:05 sri researching algorithms can be so annoying, what should be explained in two sentences and a 5 line redis hack is instead pages upon pages of gibberish https://en.wikipedia.org/wiki/Leaky_bucket
23:06 Grinnz heh
23:07 Grinnz this is why im glad i didn't go into a masters program at my college... i could never do all this abstract algorithms stuff
23:26 disputin joined #mojo
23:32 tchaves joined #mojo
23:42 schelcj joined #mojo
23:43 sri yea, it seems to work very well
23:43 sri i guess minion will be getting locks after all
23:59 disputin joined #mojo

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