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

IRC log for #mojo, 2014-12-21

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

All times shown according to UTC.

Time Nick Message
00:07 sri 1223 views Oo
00:10 sri memes are serious business
00:25 sri sooo... why would $dbh->ping block?
00:26 sri with DBD::Pg
00:37 akhasanov joined #mojo
00:51 sri what an odd bug https://groups.google.com/forum/#!topic/mojolicious/HFAD62-Hr2A
00:52 sri the $t->ua->max_connections(0); actually matters
00:52 sri sooo... $dbh->ping only blocks if the test user agent uses a new connection for each request Oo
00:53 sri and it only affects non-blocking
00:59 sri that fricking keep-alive connection shouldn't make a difference... it's so odd
01:11 sri $dbh->{pg_async_status} is 0, so everything should be clean
01:30 asarch joined #mojo
01:35 akhasanov joined #mojo
01:56 tempire ooh
01:56 tempire never heard of elixir before
01:56 tempire but a modern language that uses the erlang vm
01:56 tempire That's interesting.
02:03 tempire So how long do we have to wait for DBI support of postgres 9.4 json types?
02:03 klapperl_ joined #mojo
02:04 mst tempire: don't be a dick
02:04 mst postgres used ? as an operator years ago for hstore
02:04 mst nobody complained
02:04 mst you can trivially work around it
02:05 tempire You seem awful sensitive today.
02:05 * tempire sprinkles glittler
02:05 tempire glitter, even
02:06 mst stop insulting people I like for mistakes that weren't their fault then
02:06 mst I'm pulling the workaround for you
02:06 tempire There's no insults here.
02:07 tempire You'd be hard pressed to ever find an insult coming from me.
02:07 tempire Misunderstandings, though, certainly.
02:08 mst "so how long do we have to wait for a problem that existed five years ago, and is trivially avoidable now, to be fixed, but I'll call that 'support' because I'd rather shit on the DBI team than learn SQL" is how that reads to people who know the DBI contribs
02:09 tempire That's quite a few added words.
02:09 mst yes. subtext does that
02:09 mst welcome to social skills
02:09 mst they confuse me too
02:10 mst http://agaton.scsys.co.uk/~matthewt/jsonb
02:10 mst solved
02:10 tempire You're assuming an attitude and subtext that's not there.  I'll leave it at that.
02:11 mst I'm inferring it from your communication style. it's only an assumption if you don't understand why that's how people will read your words.
02:11 mst be nicer next time.
02:33 woz joined #mojo
03:13 ___adam_ joined #mojo
03:23 ___adam_ joined #mojo
03:23 ___adam__ joined #mojo
03:33 ___adam_ joined #mojo
03:56 noganex_ joined #mojo
04:09 bobkare joined #mojo
04:10 sri mst: be nice in this channel
04:14 * sri is wondering the same thing as tempire
04:18 sri in fact, i think we need to be more strict around here about attitude
04:18 sri this is a place where beginners should feel welcome
04:22 woz joined #mojo
04:26 akhasanov joined #mojo
04:27 sri perhaps a totally fresh start on freenode would be good for this channel
04:28 Grinnz well the main benefit of freenode is the userbase... depends on how you get people to go there
04:28 sri bring back some of the original character
05:01 sri how odd
05:02 sri it looks like DBD::Pg handles that have been used non-blocking get their connections killed
05:03 jberger ?
05:03 * jberger really wants the pg rest api to show up for 9.5
05:04 sri that test case from earlier, it works because $dbh->ping doesn't block
05:04 sri but it doesn't return a true value
05:04 sri it returns 0 after an async operation
05:05 sri i suspect the $ua->max_connections(0) setting makes a tiny timing difference
05:05 sri this might mean that handles can't be reused after an async operation
05:07 sri this hints at deeper DBD::Pg problems
05:14 sri the lack of keep-alive connections appears to delay queries enough for the server to kill the database connections
05:15 sri if a cached dbh that has been used for an async operation before gets ->ping called it just blocks forever
05:15 sri very very unfortunate
05:15 jberger I'm not sure I follow the problem, but the result sounds bad
05:16 jberger sri: well you were waiting for the other shoe to drop
05:16 sri https://groups.google.com/forum/#!topic/mojolicious/HFAD62-Hr2A
05:24 irq joined #mojo
05:32 irq_ joined #mojo
05:39 sri hmm, you can actually call $dbh->ping just fine right after an async query
05:41 sri hahaha, i might know what's going on :)
05:45 sri yea, got it :D
05:46 jberger something fixable?
05:46 sri somethign that makes me want to smash my head into the table repeatedly
05:47 sri when perl loses the last reference to an io object it CLOSES the file descriptor
05:47 jberger :o
05:47 sri we wrap the postgres descriptor into and IO::Handle
05:48 sri sooo, when the reactor releases the object, the last reference is lost, and the DBD::Pg descriptor gets closed by perl
05:49 sri IO::Handle doesn't actually have a DESTROY method, it's perl magic
05:51 jberger sri: that seems like a terrible thing in this case
05:54 jberger can you be sure to keep a strong reference somewhere?
05:55 ___adam_ joined #mojo
05:56 sri i have multiple solutions
05:56 sri trying to figure out which one sucks least now
06:01 jberger joined #mojo
06:06 sri https://github.com/kraih/mojo-pg/compare/b94da8531e98a9da9197dfb8cf29e4591ad9c8b4...4a3d2e43f6a20f216d93f5b2521715faf65e9bfd
06:07 ___adam_ joined #mojo
06:11 woz joined #mojo
06:39 davido_lt joined #mojo
06:45 sri i can't actually replicate it with a one-liner though Oo
07:00 rem_lex joined #mojo
08:00 woz joined #mojo
08:11 Vandal joined #mojo
08:39 dod joined #mojo
08:40 dod joined #mojo
08:42 neyasov____ joined #mojo
08:49 amon joined #mojo
09:49 woz joined #mojo
10:10 basiliscos joined #mojo
10:15 dod joined #mojo
11:22 sugar joined #mojo
11:32 bobbyjoe joined #mojo
11:38 woz joined #mojo
11:50 sugar_ joined #mojo
12:14 denis_boyun joined #mojo
12:19 woz joined #mojo
12:49 dod joined #mojo
13:00 dvinciguerra joined #mojo
13:12 damaya joined #mojo
13:12 damaya Hey all, just wondering how I can strip HTML in a Mojolicious template?
13:14 damaya I have a variable I am passing to the template that happens to contain HTML :/
13:23 denis_boyun joined #mojo
13:30 nicomen just like you would strip html in regular perl I believe?
13:34 nicomen $ perl -wlE 'use Mojo::DOM; my $d = Mojo::DOM->new("<div><h1>Test</h1></div>"); $d->all_contents->map(sub { $_->strip }); print $d;'
13:34 nicomen Test
13:36 sugar__ joined #mojo
13:39 damaya nicomen, ok I was using HTML::Restrict to do it
13:39 damaya I was wondering if there might be a method without creating a new Mojo::DOM object
13:40 damaya in template I could do % my $d = Mojo::DOM->new($var); % $d->strip; %= $d->all_content;
13:40 damaya that works
13:41 damaya s/all_content/all_contents;
14:08 bobkare joined #mojo
14:30 akhasanov joined #mojo
14:37 mst sri: might be worth appointing somebody to police you and I then, since nobody else seems to call us on it and we just piss each other off when we try
14:48 woz joined #mojo
14:59 human39 joined #mojo
15:04 mst tempire: for the record, I don't think you were guilty of malice, just casual thoughtlessness about how your words could be perceived, and I've seen contributors put off by less, so I tend to call it out reflexively
15:04 mst tempire: of course, inevitably my words were imperfect too, so that may not have been as clear as it might've been, sorry
15:06 jberger mst++
15:07 jberger on the original point, is there a fix proposed?
15:07 jberger also you mentioned a trivial work around, what would that look like?
15:09 mst they're working on allowing \-ing of special characters
15:10 mst jberger: uh, I linked it
15:11 mst basically having \? and \: behave the way one needs them to
15:11 mst (is the fix)
15:11 mst the workaround is http://agaton.scsys.co.uk/~matthewt/jsonb
15:11 human39 joined #mojo
15:13 akhasanov joined #mojo
15:14 jberger oh indeed you did. I was half asleep :l
15:48 zivester joined #mojo
15:48 sri tempire: the actual workaround is "local $db->dbh->{pg_placeholder_dollaronly} = 1; $db->query('SELECT * FROM mytable WHERE lseg1 ?# lseg2 AND name = $1', 'foo');"
15:51 mst sri: adding the word 'actual' doesn't make the answer I gave any less valid
15:52 sri mst: stop picking fights, i have no interest
15:53 mst sri: then you meant 'an alternative workaround', which that absolutely is.
15:53 mst the one I supplied, which I got from the postgres developers, is more portable to the environments I care about though
15:54 mst since a lot of SQL generation/assemble code relies on having non-explicitly-numbered placeholders
15:55 mst being able to to get a bunch of $sql, @bind sets, assemble the SQL with join, and the binds with array concatenation, is a common/useful pattern
15:55 mst which is why when I asked on #postgresql they suggested the function approach since dollaronly can't do that
15:55 mst if you -don't- need that, the dollaronly approach should be fine, yeah
15:56 mst tempire: ^^ better analysis of which will work best when
16:07 jberger sri: mst apologized to tempire, I think we can de-escalate no?
16:07 * nicomen hands out a round of soft packages
16:08 nicomen s/packages/presents/
16:11 mst excellent
16:11 mst "facedesking safety device"
16:12 * jberger throws a sno-cone at nicomen
16:14 Grinnz_ joined #mojo
16:20 woz joined #mojo
16:47 sri i guess it would be better if Mojo::Pg only used dollar placeholders internally
16:49 mst I don't honestly see what you'd gain
16:51 sri and done
17:18 good_news_everyon joined #mojo
17:18 good_news_everyon [mojo] jberger created url (+1 new commit): http://git.io/8RjU1Q
17:18 good_news_everyon mojo/url 9293d3a Joel Berger: added url method to Mojo::DOM
17:18 good_news_everyon left #mojo
17:19 jberger sri: I thought I would loop back around to this
17:19 jberger I still think it is useful, I know that you think deprecating val is precedent against it
17:19 akhasanov joined #mojo
17:29 jberger for discussion I have opened: https://github.com/kraih/mojo/pull/723
17:40 irq joined #mojo
19:17 tempire interesting. sailsjs framework includes a command that generates REST api with search, paginate, sort, filter, create, destroy, update, and associate, with websocket support.
19:18 tempire well. It's not exactly rest. But I really like the idea of generating a generic api.
19:23 mst have you looked at WebAPI::DBIC ?
19:23 mst also Plack::App::RapidApp::rDBIC
19:27 sri tempire: i like the idea
19:32 sri a generic super hackable app that covers the most commonly needed building blocks
19:33 mst I've attempted to design one those several times, with ... mixed ... results
19:34 woz joined #mojo
19:34 sri first problem of course is to pick a model layer
19:35 sri ideally it would come with a guide that explains what's going on
19:35 sri perhaps even the steps to build it manually
19:41 * sri wonders if Mojo::Pg should contain a pg_placeholder_dollaronly example for json stuff
19:41 sri local $db->dbh->{pg_placeholder_dollaronly} = 1;
19:42 sri not exactly pretty... but useful information
19:45 sri oh, perhaps i mention it as a postgresql:// URI example
19:46 sri hmm
19:58 cooper joined #mojo
20:43 brainbuz joined #mojo
20:45 woz joined #mojo
21:01 skittles joined #mojo
21:06 basiliscos joined #mojo
21:06 skittles Can I do include partials in mojo tempates?
21:12 meredith there is an include helper if that's all you're asking   http://tinyurl.com/oz6k45p
21:14 skittles thanks.
21:31 ___adam_ joined #mojo
22:05 skittles ok so I have route /g/:title for instance, and it is coming up as an unfound route.
22:07 cooper joined #mojo
22:08 skittles can I have the placeholder be a variable to where it can be changed on the client side and the app just retrieves the value?
22:14 alnewkirk joined #mojo
22:15 preaction do: bin/yourapp routes; # to see your routes
22:16 preaction yes, placeholders are supposed to take the place of actual URL words
22:16 preaction what URL are you trying to get to match at /g/:title
22:33 woz joined #mojo
23:15 zivester joined #mojo
23:15 Eddy joined #mojo
23:17 jnbek joined #mojo
23:18 jnbek joined #mojo
23:20 jnbek joined #mojo
23:22 damaya Hi fellers!
23:23 preaction that tree wasn't going to cut itself
23:23 damaya :)
23:23 damaya How are you today preaction ?
23:23 preaction besides felling trees, i'm fine
23:23 damaya preaction: strong winds?
23:24 preaction no, i sharpened my axe
23:24 damaya preaction: I live in Portland, OR where there's a lot of old trees. Every time the wind is strong, trees come down everywhere. It's kind of scary. At least you knew it was coming down :D
23:25 damaya preaction: You live on land?
23:25 preaction you don't need to ping me for everything you say, we are the only two people talking. do you have a mojo question?
23:25 Grinnz preaction, but i like pinging you
23:25 damaya haha, I'm so used to doing that, bad habit sorry
23:26 damaya oh yeah, I do!
23:27 damaya I will paste my code somewhere, brb
23:29 damaya http://pastebin.com/wykztJ2a
23:29 damaya In that code, I am trying to use Mojo::IOLoop to do the requests non-blocking.
23:31 preaction that doesn't look like it will work, since you assume they're blocking, so they can return the right result
23:50 damaya yeah :/
23:51 damaya I wonder if I can have two IOLoops each loop around the two calls, so they happen in order.
23:54 skittles joined #mojo
23:55 damaya Hi skittles
23:56 skittles hi damaya lol
23:57 preaction you can create a new ioloop. when one ioloop is running, all others are not
23:59 skittles I got the url preaction lol. I am making a return to perl, so I ask questions and then solve the issue after like 5 min for some reason.

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