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

IRC log for #mojo, 2016-04-19

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

All times shown according to UTC.

Time Nick Message
00:00 sri http://instantrimshot.com/classic/?sound=rimshot&play=true
00:21 gizmomathboy in a route like /first/:name/rest, is name accessible in the stash for the controller and action set for it? Would it also be accessible in the stash in the template?
00:21 jberger regarding an optional dependency, I always used this when I've needed: https://metacpan.org/pod/File::MimeInfo
00:21 jberger usually because what I actually need is https://metacpan.org/pod/File::MimeInfo::Magic
00:23 jberger gizmomathboy: yes the stash is available for the entire request
00:24 gizmomathboy jberger, thanks mucho... access via $self-stash{} or am I missing something in the docs?
00:24 gizmomathboy hmm...looks like $self-stash('name')?
00:24 jberger $self->stash('name') in the action (where $self is a Mojolicious::Controller) or stash('name') or even $name in the template
00:24 jberger $self->stash->{name} works too
00:25 gizmomathboy ah, that is what I was missing (in the template/controller parts)
00:25 gizmomathboy and now back to tinkering
00:25 jberger note also that $c is the controller instance in the template (if you ever need that)
00:25 jberger but helpers become function in the templates too
00:26 gizmomathboy do I initialize the db and dbh in the app pm? (specifically using sqlite)
00:27 gizmomathboy which doesn't matter from the looks of the mojo::* db stuff
00:27 bpmedley gizmomathboy: By initialize do you mean the schema, or do you mean the db handle?
00:28 gizmomathboy bpmedley, the db handle. Not sure where to put the my $sql->Mojo::blah::dsn and then the $db=$sql->dbh
00:28 bpmedley helper sql => sub { state $sql = Mojo::SQLite->new('sqlite:_videos.sqlite') };
00:28 bpmedley Change _videos.sqlite as appropriate
00:29 gizmomathboy in MyApp.pm?
00:29 gizmomathboy or in the startup script?
00:29 bpmedley That's in my Mojolicious::Lite app..
00:29 gizmomathboy thanks mucho...
00:30 Grinnz in a startup method, $self->helper(sql => ...)
00:30 sri Mojo::* db modules tend to include example apps
00:30 sri https://github.com/kraih/mojo-pg/tree/master/examples/blog
00:31 gizmomathboy sri, thanks. I hadn't got to digging that deep yet (as well as tests...)
00:31 sri the docs cover it too though http://mojolicious.org/perldoc/Mojo/Pg#DESCRIPTION
00:32 sri at least for Mojo::Pg, not sure others have cought up yet
00:32 sri s/o/a/
00:33 jberger sri: speaking of examples, I don't recall if you saw (it was during your hiatus I think) that I did the chat example using a reactive framework: https://gist.github.com/jberger/c4515eb8399f356736528dbc5af115f2
00:34 jberger not that it should be included in the docs, just for fun
00:34 sri neat
00:52 tchaves joined #mojo
00:57 tchaves joined #mojo
01:59 tchaves joined #mojo
02:14 asarch joined #mojo
02:31 zivester joined #mojo
02:36 noganex joined #mojo
02:52 thowe odd comments by some guy on reddit concerning rjbs stepping down...  I don't think I had ever seen a negative word about Rik ever before that.
03:01 jberger thowe: reini is a known ... dissident
03:02 thowe I've just been looking for who this guy is, and I remember him as being the guy who sat next to me at the Perl6 tutorial at YAPC last year.
03:02 jberger That's the nicest word i could come up with right now
03:03 jberger thowe: yeah he was there at the restaurant one night with you me and mst and others
03:03 thowe He left an impression.  I now think it was an accurate one.
03:05 jberger He likes to yell about things "getting worse"and everyone being incompetent
03:05 jberger But seems not to contribute much in order to fix the problems
03:05 thowe He seemed a bit contrary.  I actually remembered him as being the one unpleasant person I spent any time near the whole week.
03:06 Adura rjbs was responsible for mlehmann going full fork? hehe
03:06 jberger mlehmann was always going to go walkabout
03:07 jberger And Coro was bound to break someone
03:07 thowe He made some comments recently (I think it was hime) about how function signatures were done all wrong and his fork did them better.  More efficiently, I think was the claim.
03:07 jberger *sometime
03:07 jberger thowe: reini is very concerned with memory usage
03:08 thowe I'm nobody to judge, but I did wonder why he didn't simply send some patches if he thought he knew better.
03:08 jberger He works on underpowered systems deploying a legacy management cgi app
03:08 genio Just click on his nick in reddit and you'll see that most of his posts are pretty negative.
03:08 jberger He has his reasons, unfortunately he can't see that almost no one else has his problems
03:09 jberger And instead he just yells at everyone (and then acts like he didn't get it)
03:09 thowe there's something to be said for testing on different environments, but why not contribute the code back if he really believes in its worth?
03:09 jberger Because he wants to mutate the language to his needs
03:10 jberger He is the guy always pushing for type annotations to assist the compiler in making the memory profile smaller
03:10 jberger Dude its a dynamic language
03:11 jberger Anyway he wants perl to change as much if not more than everyone else
03:11 genio and his incessant attacks on those who step up and do their best to help out is just... well, he's not a very tolerable thing in my opinion.
03:11 jberger Just in the direction that only benefits him
03:11 jberger And the direction no one else is interested in
03:11 Adura Highly effective voter.
03:11 thowe Maybe he should try luna or something.
03:11 jberger genio: yeah
03:11 mattp_ jberger: im not sure that is true
03:12 jberger Well this is me just trying to glean what i can out of his rants
03:12 jberger Possible I've missed some nuance
03:14 mattp_ p5 performance and memory usage is not great, and has been getting worse, not better. id like to think most people care about that to some extent
03:15 thowe My one personal interaction with him left me thinking he was bitter, or had an attitude.  He was very concerned with correcting things on my laptop screen.
03:16 Adura Were you not using i3? heh
03:16 thowe i3?
03:17 Adura Tiling window manager, heh.
03:18 thowe ah, no.  Openbox, usually.  I'm too picky about my window dimensions for a tiling wm.
03:18 sri do we have to do drama every single day?
03:23 thowe Somehow I feel a good-natured quip won't be received in the spirit it is given right at the moment.
03:25 thowe anyone use bootstrap 3 tabs?  and load them via AJAX?
03:33 jberger sri: agreed, and even more so, it is off topic here anyway
03:35 thowe It's my fault.  I brought it up (out of genuine curiosity).  I am duly abashed.
03:37 jberger thowe: not just you, i engaged, mea culpa
03:39 jberger thowe: re tabs, no but that sounds like a thing that you would have to reinitialize
03:40 jberger Using some js that they provide
03:41 thowe looks like you need to bind a function to the show.bs.tab event(?)  I'm extrapolating from an example from an earlier version...
03:41 thowe earlier version of bootstrap that is
03:42 jberger That's the kind of api that they would likely change between versions
03:45 thowe I think the old event was just "show"
03:46 mtj joined #mojo
03:48 thowe I need a blog...  Then when I build little test mojo lite apps for figuring these things out I can post them.  A bit like crayon drawings on the fridge coming from me, but maybe they would help someone.  Like future me.
03:50 thowe Too often I see the examples done with php or asp
04:11 hernan604 joined #mojo
04:40 hernan604 joined #mojo
04:56 asarch Which one is better, SFTP or FTPS?
04:56 thowe better?
04:57 asarch Well, I guess both are the same, aren't they?
04:57 thowe without typing myself silly, sftp.
04:57 thowe ftps is just ftp over SSL
04:57 thowe or TLS as the case may be
04:58 asarch Thank you!
04:58 asarch Thank you very much :-)
04:58 thowe um, sure.  You sure you're in the right channel?
04:59 asarch Well, I am configuring an application deploy in Buddy and the wizard asks about which protocol I want to use
05:00 preaction you want to use SFTP. anything FTP(S?) needs to die. die. die. die.
05:01 asarch Bingo
05:01 asarch I knew SFTP but not FTPS and I thought it was "a better" protocol, that's why I asked
05:01 preaction ... though, if it weren't for that whole ascii/binary thing, in the ipv6, no-NAT, world, FTP could make a comeback
05:02 tyldis FTPS has it's uses for high speed transfers of already encrypted data
05:02 preaction FTP comes from a time where there were no firewalls and no NAT. that time is not this time.
05:03 asarch Those were the days in the VAX time
05:05 tyldis 95% of the time you would want SFTP, but there is still a valid usecase for FTPS. Like when transferring data that is already encrypted and you only need to protect the login. Doing SFTP is expencive computing for large data.
05:06 tyldis I guess AES extensions on CPUs will help, but is not widespread enough yet.
05:07 preaction sure, but where do you have a computer that can handle incredibly fast network i/o but can't handle the encryption? network i/o is always going to be slow
05:07 asarch That's why some tools hangs when I transfer large data across the LAN with SFTP...
05:07 arpi joined #mojo
05:08 tyldis asarch: Check CPU usage. You can tell SSH to use other ciphers that are easier on the CPU that the default ones, though.
05:09 asarch I will
05:09 tyldis preaction: Already at gigabit you will hit CPU limitations when doing SFTP on most hardware
05:09 asarch How could I know what ciphers are supported by a SSH server?
05:10 tyldis asarch: I don't think you can query it, you just have to try. Unless google tells you something else ;) But fourcc or blowfish should be fast and is widely supported
05:10 asarch Ok
05:12 tyldis arcfour I mean, not fourcc
05:13 sri that is rather off topic
05:14 sri and worst of all, boring
05:15 tyldis Well good morning to you too ;)
05:15 sri can we just do drama again? ;p
05:15 sri o/
05:17 tyldis On topic, anyone else using mojo for microservices architecture?
05:19 tyldis Oh, forgot to put the drama spin on it.
05:19 arpadszasz joined #mojo
05:20 preaction yes
05:20 tyldis preaction: What's your aproach? JSONRPC or something heavier?
05:21 preaction what?
05:21 tyldis How do you interact with them? :)
05:21 preaction with JSON
05:21 tyldis Ah, plain RESTful
05:22 tyldis How do you deploy?
05:22 melo joined #mojo
05:23 preaction ansible is the current plan
05:26 tyldis Was thinking the same myself, with haproxy in front to ensure scaling and availability
05:26 tyldis Just curious to see what others are doing
05:27 sri hey, i have a postgresql quiz
05:27 sri https://gist.github.com/anonymous/fe4996e033379a21571d33a9e0d463ae
05:27 sri i want to get that data structure efficiently out of the table
05:28 bpmedley https://github.com/brianmed/Videos ... http://bmedley.org/videos_developers.gif
05:28 preaction if i had a choice between any of the devops things, i'd have probably picked rex, because perl is nicer than yaml when i need to do programming
05:29 bpmedley I've been working on a smallish app that can play videos via ffmpeg.  I hope to try and add offline transcoding.
05:29 tyldis bpmedley: Extra points for choosing the perfect video!
05:30 Vandal joined #mojo
05:31 bpmedley I'm trying to think of a few apps that people would wanna use and spread Perl / Mojolicious joy.  I'm thinking that's one way to generate more interest outside the Perl echo chamber.
05:32 tyldis sri: Most efficient or backwards compatible? IIRC the last few PGs aquired some new skills when it comes to aggregation which would make that easier
05:32 sri tyldis: most efficient, it's for minion, which requires postgres 9.5
05:34 * sri is curious if queue stats are possible without ruining performance
05:35 inokenty-w joined #mojo
05:35 tyldis If you are still pondering that later on I might try to make an efficient swing at it. Off to breakfast and then listen to Conway for the day :D
05:36 sri sure, there's no deadline, it's for this function https://github.com/kraih/minion/blob/master/lib/Minion/Backend/Pg.pm#L147-L165
05:36 sri s/function/method/
05:43 sri my first thought was to start with a query like this
05:43 sri select queue || '_' ||state::text || '_jobs', count(queue || state) from minion_jobs group by queue, state
05:43 sri to get "default_active_jobs => 123" and the like
05:43 sri but that already kills the performance
05:44 sri from 200/s down to 91/s
05:44 sri testing with https://github.com/kraih/minion/blob/master/examples/minion_bench.pl
05:55 sri not actually sure yet what i want to do with named queues
05:55 sri maybe they should just stay the way they are now, merely a tag that decides which worker pool handles a job
05:56 sri fine grained queue stats are more of an enterprise feature i guess
05:57 sri i mean, it seems fun to know the latency for every named queue, but who really needs that
06:19 tyldis Seems like a fun little task, so I'll try to find an hour or two to look at it
06:19 tyldis But don't wait out
06:19 tyldis Off to Damians API class.
06:31 salva joined #mojo
06:59 dod joined #mojo
07:05 dod joined #mojo
07:09 AndrewIsh joined #mojo
07:15 trone joined #mojo
07:17 punter joined #mojo
08:01 dod joined #mojo
08:04 mtths_ joined #mojo
08:24 pierrick joined #mojo
08:30 cpan_mojo Mojolicious-Plugin-RoutesAuthDBI-0.413 by MCHE https://metacpan.org/release/MCHE/Mojolicious-Plugin-RoutesAuthDBI-0.413
08:41 Atog bpmedley that Videos app is really neat, i'll definitelly learn a lot from that one
08:41 Atog and incidentally discovered cpanminus!
08:43 Atog joined #mojo
09:05 cpan_mojo Mojolicious-Plugin-RoutesAuthDBI-0.414 by MCHE https://metacpan.org/release/MCHE/Mojolicious-Plugin-RoutesAuthDBI-0.414
09:12 osfabibisi joined #mojo
09:46 Shaeto joined #mojo
09:52 bpmedley Atog++ # thanks
09:52 berov joined #mojo
09:54 CHYC sri: https://gist.github.com/chy-causer/86b08c6d658b9db6595b8df96cbfe18b
10:13 Shaeto joined #mojo
10:23 Shaeto1 joined #mojo
10:52 Shaeto joined #mojo
11:00 Shaeto joined #mojo
11:04 dvinciguerra joined #mojo
11:07 tchaves joined #mojo
11:13 tempus71 joined #mojo
11:16 Shaeto left #mojo
11:21 tempus71 hello, there is a line of code in the Growing Guide that I don't understand at this point http://mojolicious.org/perldoc/Mojolicious/Guides/Growing#Application-class
11:21 tempus71 $logged_in->get('/protected')->to('login#protected');
11:22 tchaves joined #mojo
11:22 tempus71 looks like in the controller is missing a 'sub protected {..}'
11:28 Lee tempus71: you don't need to define a sub in a controllers, mojo will by default serve login/protected.html.ep if it exists
11:29 kaare_ joined #mojo
12:02 batman does anyone remember what the Devel:: module is called which prints out the perl code that you are going to run?
12:03 Lee Peek?
12:04 Lee you mean the ops?
12:04 batman yeah, ops
12:04 batman not Devel::Peek
12:04 Lee oh
12:04 batman i want to see the compiled source code
12:04 pink_mist Devel::Trace?
12:05 batman maybe it's not a devel module at all...
12:06 batman ah! B::Deparse. sorry for the confusion :(
12:06 Lee was just going to say probably something in the B namespace :D
12:08 ribasushi batman: ::Deparse shows you source though, not actual vm-level ops, B::Concise is the answer to your original question unless you actually want the source
12:09 ribasushi -MO=Deparse -e ...   vs -MO=Concise,-exec -e ....
12:17 mdom Mhh, i have a cgi programm i want to port to mojolicious ... it reads from a pipe and should send every line as fast as possible to the requesting program. Mojo::IOLoop::ForkCall seems to wait until the forked process finishes, Mojo::IOLoop::ReadWriteFork seems to work but i have to manage the read buffer myself and send a chunk every time i find a newline?
12:17 batman ribasushi: cool! haven't seen that before. thanks :)
12:17 mdom Ot is there a better way to send data from a pipe?
12:19 batman you could just open the file and use Mojo::IOLoop::Stream directly, but you still need to fix the buffer issue manually
12:19 batman buffer issue = figure out when a newline is there
12:19 mdom Mhh, why do i even care to send just chunk with newlines? It doesn't really matter ... let me test with Mojo::IOLoop::ReadWriteFork
12:19 batman but why do you really need to know when there's a newline?
12:19 batman haha :D
12:19 mdom batman: :)
12:20 ribasushi batman: also in case you are golfing something - keep in mind that ';' itself is an operator, and it can have tangible effects https://github.com/dbsrgits/dbix-class/commit/05a5ca4b9
12:20 batman mdom: https://github.com/jhthorsen/mojo-ioloop-readwritefork/blob/master/example/tail.pl <-- probably overkill for what you want, but please have a look
12:20 batman ribasushi: no, i was wondering why $i = 0; use more memory once i use it as a key in a hash.
12:21 batman the answer was PVIV vs IV
12:21 ribasushi batman: for this you in fact need Data::Peek, but yes ;)
12:21 ribasushi errr Devel::Peek
12:22 batman yeah, just wasn't sure if could see something like $h->{"$i"} vs $h->{$i} using Deparse
12:22 batman long shot, but i wanted to check it out
12:22 batman Devel::Peek did give me the answer up front, i just wanted to see if i could get more information
12:23 mdom batman: Maybe you should add a note why this example is a bad idea?
12:24 mdom batman: What's the advantage of using Mojo::IOLoop::ReadWriteFork versus just opening the pipe by myself with open and then just use Mojo::IOLoop::Stream when i don't want to write something to the pipe and just read?
12:24 batman mdom: i don't see any benefit.
12:25 mdom Ah, okay, thanks!
12:25 batman i don't have any experience with reading from a pipe using Mojo::IOLoop::Stream though...
12:38 mdom Let's see, it's not really production relevant
12:50 mdom batman: Mhh, it takes a long time and then it just sends everything at the same time. I call autoflush on the opened fh ... any other idea?
12:51 batman mdom: no idea. it's very difficult to say anything unless you show some code
12:51 mdom Oh, sure, wait a sec
12:52 mdom http://fpaste.scsys.co.uk/510918
12:56 batman maybe the browser reads too little data
12:57 batman some browsers don't start showing lines on screen before receiving *enough* lines/bytes
12:58 batman mdom: try adding warn $bytes; inside the "read" event to see if you really read in chunks
13:00 mdom It's curl on the other side
13:01 mdom It worked with the old CGI.pm script that set $|=1 and just used print
13:01 mdom But let's see what warn $bytes shows
13:01 batman mdom: if you can't try what i suggest, then i can't help you.
13:01 ramortegui joined #mojo
13:02 batman s/can't/won't/
13:03 mdom Mhh? Sorry, i'm testing it right now, i just wanted to give more context while the script is running
13:07 mdom Okay, i don't get any bytes with warn and curl returns with Illegal or missing hexadecimal sequence in chunked-encoding
13:08 batman right. i'm not sure if you're creating the stream object correctly. wait a sec...
13:08 Kripton joined #mojo
13:10 batman mdom: maybe you need to do $stream->start ?
13:10 mdom Uh!
13:11 mdom No, some result
13:12 mdom same
13:17 HtbaaPi_ joined #mojo
13:28 jberger mdom: perhaps this example will help you
13:28 jberger https://github.com/jberger/Mojolicious-Plugin-TailLog/blob/master/lib/Mojolicious/Plugin/TailLog.pm
13:31 woz joined #mojo
13:45 asarch joined #mojo
13:50 PryMar56 joined #mojo
13:51 Atog joined #mojo
13:52 mdom jberger: That seems to work but still sends everything in one big response... it is possible to configure how often read is called or how big the buffer is?
13:55 mdom Mhh, and it's not working when called as cgi ... wah! I probably have to debug it more, i come back when i have checked strace and tcpdump... :)
14:00 mdom Maybe it's a problem with calling it as cgi...
14:01 gizmomathboy joined #mojo
14:10 woz joined #mojo
14:15 jberger mdom: How are you sending your response?
14:15 jberger I think I'd need to see some code at this point
14:17 jberger mdom: wait, you are serving it in a cgi environment?!
14:18 jberger IOLoop features don't work using the cgi server
14:18 jberger You might be able to force it to work ... maybe ... but I wouldn't recommend it
14:21 woz joined #mojo
14:25 woz joined #mojo
14:28 jabberwok what is a good resource that explains the difference between a session and a cookie, and how they work with javascript that runs in the user's browser? i have been going over this for six months and just cannot get a grasp on it
14:29 genio http://stackoverflow.com/questions/359434/differences-between-cookies-and-sessions
14:30 Atog joined #mojo
14:32 woz joined #mojo
14:38 jberger jabberwok: in mojo the session is implemented as a cookie
14:39 jberger It is data that is json encoded then b64 encoded then hmac signed and passed to the client as a cookie
14:39 genio A sufficiently secured cookie can store the session.
14:40 jberger Then the client sends it back to the server in subsequent requests (as cookies do)
14:40 woz joined #mojo
14:40 jberger From that the server can act more "stateful"
14:41 jberger woz: your client is frequently reconnecting
14:41 jberger Can you please sort that out
14:41 PopeFelix On another topic, I'm still trying to figure out this sequential delay() business. I'm using ->begin() now, but it's still only executing the first step.
14:42 genio Can you provide a sample of your code?
14:42 PopeFelix working on that right now.
14:42 jberger You need to call it in the first step to "enqueue" the second step
14:42 jberger And so on
14:43 bpmedley jabberwok: were those explanations enough?
14:43 PopeFelix So ..  sub { my $delay = shift; .... $delay->begin() } ?
14:44 PopeFelix use 5.016;
14:44 PopeFelix use Mojo::Util qw/slurp/;
14:44 PopeFelix use File::Temp;
14:44 PopeFelix use FindBin qw($Bin);
14:44 PopeFelix use Mojo::IOLoop;
14:44 PopeFelix use Mojo::JSON qw(encode_json decode_json);
14:44 PopeFelix use Mojo::UserAgent;
14:44 PopeFelix my $ua = Mojo::UserAgent->new;
14:44 PopeFelix my $COUNT         = 5;
14:44 PopeFelix my $MIN           = 0;
14:44 genio Please don't paste in the channel
14:44 jberger PopeFelix: don't paste in the channel
14:44 PopeFelix my $MAX           = 100;
14:44 PopeFelix my $COLS          = 1;
14:44 PopeFelix my $BASE          = 10;
14:44 PopeFelix my $url = Mojo::URL->new(q{https://www.random.org/integers/})->query(
14:44 PopeFelix num    => $COUNT,
14:44 PopeFelix min    => $MIN,
14:44 PopeFelix max    => $MAX,
14:44 PopeFelix col    => $COLS,
14:44 PopeFelix base   => $BASE,
14:44 PopeFelix format => 'plain',
14:44 PopeFelix );
14:44 * Grinnz_ suspects an accidental middle click
14:44 PopeFelix my $delay = Mojo::IOLoop->delay;
14:44 PopeFelix my @transactions;
14:44 PopeFelix my $transaction_count = 10;
14:44 PopeFelix my @steps;
14:44 PopeFelix for ( 1 .. $transaction_count ) {
14:44 PopeFelix my $count = $_;
14:44 Lee oh the suspense...
14:44 PopeFelix my $url = $url->clone->query( [ quux => int rand 100 ] );
14:44 PopeFelix say qq{Push TX $count: $url};
14:44 genio heh
14:44 PopeFelix my $code = sub {
14:44 PopeFelix my ($delay) = @_;
14:45 PopeFelix my $mock = $delay->data->{mock};
14:45 PopeFelix say qq{Execute TX $count: $url};
14:45 PopeFelix my $tx = $mock->get($url);
14:45 PopeFelix my $url = $tx->req->url;
14:45 PopeFelix say qq{Got TX $count: $url};
14:45 PopeFelix push @transactions, $tx;
14:45 PopeFelix };
14:45 PopeFelix push @steps, $code;
14:45 PopeFelix }
14:45 PopeFelix say scalar @steps, q{ steps};
14:45 PopeFelix was kicked by jberger: PopeFelix
14:45 PopeFelix joined #mojo
14:45 PopeFelix $delay->wait;
14:45 PopeFelix }
14:45 PopeFelix for ( 0 .. $#steps );
14:45 PopeFelix let me try that
14:45 PopeFelix ack
14:45 PopeFelix I'm so sorry.
14:45 PopeFelix I know, I know. That was a mistake, sorry.
14:45 PopeFelix Grinnz_ would be correct.
14:45 PopeFelix I did say I was sorry for the accidental paste.
14:46 jberger PopeFelix: i just kicked you to make it stop
14:46 Grinnz_ PopeFelix: due to flood protection we only got your messages just now
14:46 PopeFelix ahhh
14:46 PopeFelix OK, cool.
14:46 jberger Apology accepted, thanks
14:46 genio We've all been guilty of that one from time to time :)
14:46 bpmedley PopeFelix: perhaps try a delay with your paste.. ;)
14:46 PopeFelix :)
14:46 * genio or at least likes to think so to make himself feel better :)
14:47 Grinnz_ this is why i put random gibberish from irc in my paste buffer most of the time
14:47 genio luckily IRSSI seems to ask you if you really wanted to paste those 4593485246 lines.
14:47 * jberger plugs Mojolicious::Command::nopaste
14:48 PopeFelix Yeah, it'd be nice if xchat did that.
14:48 Grinnz_ weechat also asks over 5 lines or so
14:48 PopeFelix And hey, putting begin() in the code block helped!
14:48 jberger PopeFelix: I'm sure there's an xchat plugin for it
14:48 PopeFelix That did the trick.
14:48 jberger Not calling begin is useful to short circuit a set of steps
14:48 Grinnz_ the thing is, xchat is a gui app, you can paste whatever you want in the chat bar
14:48 Grinnz_ it's only when you hit enter that it would have a chance to intercept
14:49 Grinnz_ i.e. you can't accidentally enter a line into chat unless you hit enter :P
14:49 PopeFelix Sure, but you could intercept the input buffer before you send it to the IRC server.
14:50 Grinnz_ also, middle click isn't paste there usually ><
14:51 PopeFelix Not middle click, but an accidental paste. If you paste and don't see anything in the chat bar because there was a newline at the end, you might well be fooled into thinking that there's nothing in the paste buffer and thus blithely type away and hit enter, only to discover with horror that you had, in fact, flooded the channel with many many lines of code.
14:53 Grinnz_ hmm, hexchat on linux at least shows pasted newlines within the line
14:53 PopeFelix Yeah, I'm on a Mac.
14:56 PopeFelix So back to a thing you said yesterday, jberger - why shouldn't I use nonblocking calls inside delay()? Or did I misunderstand you?
14:56 jberger ?
14:56 jberger must have misunderstood
14:56 PopeFelix I.E., inside one of the steps, $ua->get($url, $callback)
14:57 jberger what I said was you almost never want $ua->get($url, sub { ... }) inside of a delay
14:57 jberger you almost always want $ua->get($url, $delay->begin)
14:57 jberger that is still non blocking
14:57 PopeFelix OK. I think I understand.
14:57 jberger because begin returns a callback
14:57 PopeFelix Ah, ok.
14:58 jabberwok bpmedley: yes thanks, it's just there are so many pieces+parts in these web systems that it's hard to tell the players without a scorecard
14:58 bpmedley I agree.  When i started all i had was nc and curl.. :)
15:02 woz joined #mojo
15:13 woz joined #mojo
15:30 meshl joined #mojo
15:31 disputin joined #mojo
15:35 woz joined #mojo
15:35 disputin joined #mojo
15:54 PopeFelix I think delay() is not what I want here. What I think I'm really trying to do - and I realize this is a very artificial sort of thing - is to make a number of non blocking requests, but to make sure they're executed in order.
15:55 PopeFelix A problem much better suited for blocking requests, i think.
15:58 PopeFelix So while I'm still interested in how it's done, it's more for academic reasons at this point.
15:59 PopeFelix A much more immediate question - how do I handle an exception thrown inside a nonblocking request?
15:59 batman PopeFelix: delay() does exactly that: making sure they are executed in order
16:00 batman blocking/non-blocking doesn't matter when it comes to the question of order.
16:00 PopeFelix batman, then I'm doing something wrong.
16:00 PopeFelix And it's probably related to trying to set up the requests in a loop.
16:03 batman push @steps, sub { $ua->get(shift(@url), shift->begin) } for @url; Mojo::IOLoop->delay(@steps, sub { warn "done!" });
16:03 batman ^ that code does not check anything, but will do a series of GET requests in the order of @url.
16:04 PopeFelix batman, I'll try that, thanks.
16:05 lluad joined #mojo
16:15 woz joined #mojo
16:15 PopeFelix batman, that worked to get the requests sequentially.
16:18 batman isn't that the same as "in order" ?
16:18 PopeFelix But - and I realize I failed to mention this - what it doesn't do is get me access to the transactions.
16:18 PopeFelix batman, yes
16:19 batman it does. my ($delay, $tx) = @_; inside each of the callbacks
16:19 PopeFelix ok, let me try that
16:19 batman pretty sure all of this is documented...
16:20 PopeFelix batman, I've been through the docs that I've found. I may not have found the right one, of course, but nothing in the docs has told me what I wanted to know.
16:21 batman ok
16:22 woz joined #mojo
16:30 woz joined #mojo
16:38 woz joined #mojo
16:38 * sri wonders how decent the cpus in the new macbook are
16:39 woz Sorry about the reconnects - I'll drop for now. Forgot I left Limewire running
16:43 PopeFelix sri, I've got an "Early 2015" model, has a 3.1 GHz Core i7.
16:43 sri PopeFelix: you mean a macbook pro
16:43 PopeFelix sri, Yes, a pro
16:43 PopeFelix Sorry, you wanted a regular macbook?
16:44 genio I hope my machine holds out a few more years.  I don't want to buy a new one.
16:44 sri i mean http://www.apple.com/macbook/
16:44 sri that one use core m3/m5/m7
16:45 PopeFelix Yeah, I'm looking at that now.
16:45 sri been using a macbook air for a very long time now... looking for a replacement
16:45 genio the logic board on that thing is tiny
16:45 PopeFelix No idea.
16:46 sri hmm, the upgrade from m3 to m7 is an extra 300 euro :o
16:46 genio 'spensive!
16:47 sri yea, and it's only 1.1ghz vs 1.3ghz
16:47 sri weird thing is, there is pretty much no information on the web about the m3 1.1ghz, looks like apple got a special deal from intel for a new chip
16:47 PopeFelix But you get an extra shiny Apple logo, and an official Apple authorization to lord it over all your Apple using friends.
16:48 Grinnz_ at a guess, the m7 has more cores
16:48 sri nope
16:49 Grinnz_ oh, it says they're all dual core
16:49 Grinnz_ weird
16:49 PopeFelix It has more m's.
16:49 sri it overclocks higher
16:49 sri to 3ghz instead of 2ghz
16:53 PopeFelix So this is weird. Two separate machines, and the first request is always "connection refused": http://paste.scsys.co.uk/510933
16:55 Grinnz_ PopeFelix: the get is not executed until after that sub ends, since it's done non blocking
16:55 Grinnz_ the next step will receive the $tx that you want to check
16:56 PopeFelix henna
16:56 PopeFelix erg
16:56 PopeFelix hmmm
16:57 PopeFelix so I need to insert a dummy step? That doesn't seem right.
16:57 PopeFelix no, wait
16:58 Grinnz_ the first sub sets up the first ->get, the next will get the previous $tx and set up the next ->get, the last one will only get a $tx
16:58 Grinnz_ at least, that's one way to do it
16:59 PopeFelix OK
16:59 PopeFelix oh, i see that now!
17:00 PopeFelix not sure how to get the last step, though...
17:02 SmokeMachine Hi there! I'm having a problem with minions... I'm enqueueing 100 parameters to a queue but it receives only 9...
17:03 SmokeMachine on database all 100 parameters are there...
17:03 SmokeMachine but the function only receives 9...
17:03 SmokeMachine is that right?
17:04 gryphon joined #mojo
17:09 SmokeMachine Is that a bug, a feature, a error on my code or another thing?
17:10 PopeFelix SmokeMachine, though I'm not familiar with minions, I would suspect an error in your code.
17:11 SmokeMachine But on database, it has all the parameters
17:11 jberger SmokeMachine: what backend are you using?
17:12 SmokeMachine Pg
17:12 jberger that sounds very surprising
17:14 SmokeMachine I changed the data... Put it in a array... And the array still have 9 parameters...
17:15 pink_mist can you make a reproducible test-case?
17:15 SmokeMachine I'm going to do that in a minute...
17:16 PopeFelix Grinnz_, any idea how to get this last TX out of delay()?
17:16 Grinnz_ just add another ste
17:16 Grinnz_ step*
17:17 PopeFelix yeah, that's what just occurred to me. :)
17:23 punter joined #mojo
17:27 trone joined #mojo
17:30 kaare_ joined #mojo
17:31 dod joined #mojo
17:35 meshl joined #mojo
17:43 disputin joined #mojo
17:44 sri minion don't care
17:46 mdom jberger: Yeah, i'm realizing cgi isn't optimal (and not even working), but it seemed easier than start another daemon for one ten line script and configure proxy etc ... But it's probably the right way to solve this problem ... *baeh*
17:48 jberger mdom: you already are using CGI for your other stuff?
17:49 jberger you could try this: https://metacpan.org/pod/Mojolicious::Plugin::CGI
17:53 trone_ joined #mojo
17:53 meshl joined #mojo
18:11 sri ah, the verge has geekbench results for the new macbook
18:12 sri 2944 single core, 5842 multi core
18:12 sri that's not too bad
18:13 sri little slower than a rmbp from 2014
18:14 bpmedley sri: Are you contemplating buying the hardware, or the os?  Said another way, would you consider a linux laptop?
18:14 batman joined #mojo
18:14 sri pure linux definitely not
18:15 sri ubuntu windows is a little tempting
18:16 sri but then i need all new design software too...
18:16 bpmedley Gaw, vendor lock in.. :)
18:17 sri was considering the microsoft surface book
18:19 sri sweet design, love how they put a secondary gpu in the keyboard dock
18:20 jberger sri: what about that one you were looking at the other day, with the attachable GPU tower?
18:20 genio sri: A few people here at work have them and I have heard absolutely _nothing_ negative about the surface books
18:20 genio (other than price)
18:20 sri the razer one, yea, can't get that in germany ;p
18:21 jberger must be able to get around that these days
18:21 sri genio: yea, the price is pretty steep
18:21 genio They seem to be pretty solid and very user friendly, though.
18:27 sri there were a few windows laptops i was considering, dell xps 13 (awesome display, but bad industrial design... you have to pry it open with two hands), hp spectre (weird hinges, and don't trust hp), razer blade stealth (not available in germany, huge bezel, no support in germany), microsoft surface book (awesome design, but doesn't close fully and is a dirt magnet, very high price)
18:28 mdom jberger: No, but there's an apache serving static files and with mod_cgi ... so i just used that. But as i said i can just add some proxy rules and start hypnotoad, it way easier now with systemd.
18:29 genio sri: Have you thought about getting a cheaper windows laptop to see if you can do your development work well on it?  Maybe one of those Asus machines that don't look half bad
18:29 sri the macbook air served me well, what i need is basically just a better display and bigger ssd
18:29 genio then craigslist it (or the German equivalent thereof) if you like it to get a better machine?
18:30 genio ah, right. you like the small and light design.
18:30 sri genio: i know i can do my development work with ubuntu windows
18:30 genio The bash for windows thing?
18:30 sri also, i could just install windows on the macbook ;p
18:31 sri (that is if i owned a license, which i still don't)
18:31 genio I'd suggest you really put effort into trying that before going in head-first.  Bash for Windows may ultimately end up being awesome, but it's got quite a few problems as far as Perl goes for the moment
18:31 sri crazy how i havn't owned a windows license since windows xp
18:36 genio It ships with Perl 5.18 and the File::Find that ships with the Perl is not able to deal with the confusing directory separator problem, so you can't install modules without altering File::Find manually.  You can't install any other versions of Perl via Perl::Build or perlbrew because /dev/null is messed up.  I'm hoping they'll have the /dev/null issue worked out on the next release
18:36 Grinnz_ essentially, "perl thinks it's linux, but it doesn't act enough like linux yet"
18:37 genio Then I'll be able to test it out quite a bit more.  After fixing the File::Find issue, most modules installed without a problem and it works pretty well.
18:37 kaare joined #mojo
18:37 sri yea, i imagine it will take a year or two for everything to work
18:37 disputin joined #mojo
18:38 genio It'd be nice to have perlbrew working properly on there so I could test with that and strawberry Perl all in one box.
18:41 sri hmm, looking through the geekbench results, that new macbook is not bad at all in comparison https://browser.primatelabs.com/mac-benchmarks
18:43 sri core m3 sounds slow somehow, but does look competitive
18:45 sri guess if the m7 upgrade was cheaper i'd just take that and be done with it :D
18:48 genio hrm.  My MBP from mid 2012 isn't doing too badly on that list.
18:48 sri yea, processors have not improved much in the last few years
18:49 sri you can see how intel has mostly focused on reducing power consumption
18:51 genio it feels a lot snappier after I put the SSD in it around new years time, too.  I think I'll keep it around until I break it somehow
18:52 sri i heard pcie ssd vs sata ssd also makes a noticeable difference
19:04 SmokeMachine that was my code's problem... thanks!
19:05 pink_mist SmokeMachine: 0_o what was?
19:07 SmokeMachine I am "partitioning" my data and enqueueing every part... in 2 different places on my code... on the first one I was enqueueing on queue "process_line" and on the last one on "process_lines" and only the last one exists...
19:08 SmokeMachine the last one was only enqueueing the last 9 lines...
19:11 sri if someone here has a spare windows 10 license, i'd really like to try ubuntu windows in bootcamp (and maybe test some mojolicious stuff in the future)
19:15 asarch joined #mojo
19:15 PopeFelix SmokeMachine, that's happened to me more times than I care to admit.
19:16 SmokeMachine is there a possibility to receive an error when enqueueing to a non existent queue?
19:25 PopeFelix jberger, I owe you an apology. I'm reading over the docs for Mojo::IOLoop::Delay, and there, clear as day in the synopsis, is the " sub { ... ; $delay->begin->(); }" business.
19:37 genio sri: I have a windows 7 ultimate OEM license for a machine I built a long time ago that I'm no longer using.  I believe you'd be able to upgrade to win10 with that.
19:37 genio I can send you that info when I get home if you like
19:38 genio I do not have any office licenses or anything else of use.
19:41 sri genio: \o/
19:41 sri os license is all i need for testing
19:42 genio Well, sir, you will have a license in a couple of hours
19:42 genio how you'll get the media I'm not quite sure.
19:43 genio I guess I could rip that disk and make it available to you or even ship it if you can't find one directly from MS
19:43 sri no need
19:44 sri some googling told me i can just download a windows 10 iso from microsoft and activate it with a windows 7 key
19:45 genio ah, perfect!
19:47 jberger PopeFelix: no problem
19:56 disputin joined #mojo
20:25 dod joined #mojo
20:54 disputin joined #mojo
20:58 thowe_work joined #mojo
21:31 asarch joined #mojo
21:33 asarch joined #mojo
21:45 basic6_ joined #mojo
21:49 basic6_ could it be that hypnotoad repeats a post request after a worker has been restarted automatically (accepts limit reached)?
21:49 sri no
21:50 basic6_ i must be doing something wrong, but my browser is sending 10 post requests and when running in hypnotoad, the app responds to 11 post requests (it logs the 10th requests twice) for some reason. does not happen in morbo
21:53 genio sri: I just found the box. \o/
21:53 genio PM you the key?
21:53 sri yes \o/
21:55 genio hope that works for you
21:55 genio If necessary, I can ship the box+disc
21:56 sri thanks, the key should be enough :)
21:56 sri genio++
21:57 Trelane joined #mojo
21:58 genio I'm off to the gym.  Leave me a message if I fat-fingered the key or something and I'll get back to you tonight when I return
21:59 sri gotta find out how to use it correctly though, don't want to waste it on a the old laptop if i can't use it again on the new one in the next few months
22:04 disputin joined #mojo
22:17 basic6_ in one case, i get "Stopping worker 123" followed by "Worker 123 stopped". does that mean that this worker is killed my the hypnotoad master because it did not send a heartbeat? i do not see a "has no heartbeat" error in my log though.
22:18 sri workers are restarted in regular intervals
22:19 basic6_ but in this case, the worker 123 is aborted, it does some of its work but then it's apparently killed (it does not finish its work) and another worker restarts doing the same job
22:20 basic6_ the worker might block for maybe up to 5 seconds waiting for something but not even close to 20 seconds
22:29 hernan604 joined #mojo
22:51 bpmedley basic6_: What do you mean by "does not finish its work"?
22:51 bpmedley My understanding is that the workers are gracefully stopped..
22:53 bpmedley http://bmedley.org/mojo.pdf <-- Comments are welcome and desired.. a Photo app chapter was added.  I believe I need to add websockets, IOLoop, helpers, and database use..
23:05 mtj joined #mojo
23:18 basic6_ bpmedley: the worker logs that it has received some data. it then stores this data in a remote location (takes a bit but not long). then it's apparently killed because it does not log that it's done (this is usually where i see "Stopped worker"). right after this, a new worker appears, receives the *same* data from the same post request
23:19 bpmedley Aha, so you're wondering which timeout has transpired?
23:19 basic6_ this is causing data corruption in the remote location
23:19 basic6_ yes
23:20 basic6_ i have tried increasin the timeouts to 300 but that didn't seem to help
23:20 bpmedley http://mojolicious.org/perldoc/Mojo/Server/Hypnotoad <-- Which timeouts?
23:21 basic6_ i tried heartbeat_timeout, inacitivity_timeout and graceful_timeout, all 300
23:21 basic6_ if i may ask - is this expected behavior that the post request is received a second time by a new worker?
23:23 basic6_ well i guess i was already told no it isnt earlier. but then i wonder why it's being processed twice
23:23 melo joined #mojo
23:23 bpmedley How many seconds elapse before the worker is stopped?
23:25 basic6_ counting from the last request that worker finished - maybe 5, usually less
23:26 basic6_ the "storing data in remote location" part is blocking and maybe that has something to do with it but it doesnt seem to ever take more than 5 seconds, so it wont reach the 20s default limit
23:27 bpmedley basic6_: I'd have to see a smallish example that exhibits the issue.
23:29 basic6_ bpmedley: i understand, but this whole thing is a bit complex so it will take me a while to write a small example. also i'd have to see if this still happens if i replace my remote location with something simple like a file that could be used in the example
23:30 bpmedley basic6_: In answer to your query, this is the 1st I've heard of the data restart problem..
23:30 bpmedley of *a
23:33 basic6_ ok, me too. and maybe there is something else happening that i havent figured out yet, it was already suggested to me that hypnotoad does not repeat the post request (send it to a new worker), but the fact is that i see it being processed twice.
23:44 thowe joined #mojo
23:45 sri_ joined #mojo
23:46 sri_ basic6_: it's usually a reverse proxy timing out
23:46 sri_ hypnotoad tends to tell you about timeouts in the logs
23:47 basic6_ sri thanks for the tip - i do in fact use a reverse proxy, however i'm now accessing the hypnotoad server port directly and get the same errors
23:49 basic6_ well i was thinking of timeouts because it logs "Stopping worker 123" (note that it also logs "Worker 123 stopped", same pid). i cannot find a timeout error in my log
23:49 absolut_todd joined #mojo
23:51 basic6_ however, i've just replaced my remote location with a local file and now i haven't yet reproduced the error (it's a bit random unfortunately). i think there may be a connection but i cant figure out how this storing data action could lead to a new worker receiving the same data again
23:51 sri_ it doesn't say gracefully?
23:52 basic6_ correct. in almost all of the cases, it says "Stopping worker 123" (not gracefully)
23:52 sri_ hypnotoad version?
23:52 sri_ or rather, mojolicious version
23:54 basic6_ Mojolicious 6.57
23:54 sri_ then that log message can only happen during an immediate server shutdown
23:55 basic6_ ok... and since i'm not shutting it down during my tests, some of the workers are being shut down?
23:56 sri_ no
23:56 sri_ you are shutting down the server
23:56 sri_ there is no other way that could happen, of the information you provided is incorrect
23:56 sri_ s/of/or/
23:59 basic6_ hold on, before every test, i reload hypnotoad (hot deployment). maybe that takes a while, and while the new test is already running, some old worker is being stopped...
23:59 sri_ at the very least your test setup sucks then
23:59 basic6_ but that old worker probably wouldnt be handling new requests i guess

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