Camelia, the Perl 6 bug

IRC log for #mojo, 2011-06-13

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

All times shown according to UTC.

Time Nick Message
01:02 crab moo
01:14 crab what's a good way to implement a tail -f of a logfile with mojo?
01:18 sri crab: are you serious? Oo
01:18 crab er, yes?
01:18 sri see backlog ;p
01:19 * crab looks
01:19 * marty is looking also
01:19 sri spoiler: do the seek/read shuffle from a timer
01:20 marty the problem with mojo... my small brain
01:20 sri since there is so much interest, don't make the mistake to use the event loop directly
01:21 sri like the other guy did with anyevent
01:21 sri files are always readable and will trigger events continuously, resulting in 100% cpu usage
01:23 sri just go with a plain old seek/read combo and a timer set to the frequency you need
01:23 sri and possibly IO::AIO if you need true non-blocking io
01:24 crab oh, i don't need non-blocking io
01:25 sri and if you want to get really fancy you could also use one of the inotify modules that let you add a filehandle to the event loop
01:26 crab actually, i was thinking more about the best way to stream the new data to the client
01:26 sri heh
01:26 sri ajax long polling
01:26 crab a bit of javascript that gets /stuff_i_haven't_seen_before and append()s it to the page, i suppose
01:27 crab ah, long polling. i know there are examples of that in t. i'll go look.
01:29 sri long polling is just a fancy name for a response body with unknown length
01:30 sri http://mojolicio.us/perldoc/​Mojolicious/Controller#write
01:30 sri see write and write_chunk
01:32 sri chunked is quite convenient since you get basic message framing
01:32 sri the twitter streaming api uses it for example
01:32 sri sending json objects in new chunks
01:33 sri imo the best way to do it
01:34 crab i was thinking i could have an action that does render_later and starts a timer to check for new data and write it when it arrives. if i use write_chunk, that means i never actually close the connection, right? just keep sending data whenever i have some?
01:34 crab s/close/have to close/
01:37 sri right
01:39 sri plain old ajax pull would also work i suppose, but is boring
01:39 crab :-)
02:10 tempire wonder how logio.org does it
02:21 cybertronian joined #mojo
02:21 cybertronian left #mojo
02:22 cybertronian joined #mojo
02:30 SmokeMachine left #mojo
02:32 cybertronian left #mojo
03:06 kaare joined #mojo
03:52 kaare left #mojo
04:54 bosphorus left #mojo
05:00 D4RK-PH0ENiX left #mojo
05:13 ysyrota joined #mojo
06:11 marcus tempire: node.js fairy dust
06:18 kaare joined #mojo
07:05 bosphorus joined #mojo
08:04 crab sri: seems javascript can't reliably deal with reading streaming/chunked responses cross-browser
08:05 crab so that really sucks. now i have to either make it so that only one client can access the log at a time or implement some sort of token thingy.
08:10 crab and only one client isn't going to work, anyway.
08:16 crab i wonder if i can somehow avoid opening the logfile for every request even in a multiprocess server.
08:24 crab hmm. a "forever" iframe sounds good.
08:26 gshank_ left #mojo
08:26 gshank joined #mojo
08:46 arpadszasz joined #mojo
09:13 sh9 joined #mojo
09:17 perlrocks Twitter: "[Mojolicious] Haml, Sass, because it has. Try this weekend. cpan - http://t.co/fxnAOx3" (ja) --purasiibo http://twitter.com/purasiib​o/status/80202151250493440
10:04 fmerges joined #mojo
10:09 marcus crab: what about http://plugins.jquery.com/project/reverseajax?
10:09 marcus oh, no published releases
10:10 marcus Wonder if http://plugins.jquery.com/project/Comet would work with mojolicious
10:10 marcus kinda want to try now
10:11 marcus https://twitter.com/ask/status/80204084552015872 guess sri won.
10:14 cybertronian joined #mojo
10:14 grim_fandango joined #mojo
10:14 grim_fandango left #mojo
10:24 cybertronian is now known as alnewkirk
10:31 crab marcus: i have implemented something i thought should work, but it seems the connection just gets closed after the first delayed chunk of data is sent
10:32 crab i'm installing wireshark now. i don't know any other way to try to debug it. could be me doing something wrong, could be mojo, could be nginx, could be firefox.
10:51 alnewkirk left #mojo
10:51 alnewkirk|com joined #mojo
11:19 arpadszasz left #mojo
11:39 d4rkie joined #mojo
11:51 arpadszasz joined #mojo
12:01 kaare left #mojo
12:10 d4rkie left #mojo
12:20 crab hmm, mojo flushes chunks written with write_chunk only when there's a fair bit of content
12:20 crab how can i make it flush things faster?
12:21 crab also: in my timer callback, how can i figure out if the client has gone away?
12:21 crab because otherwise i'm going to just keep running forever
12:27 sri crab: that is not true
12:28 sri we write to the kernel send buffer as fast as possible
12:29 sri if something is buffering then it must be a proxy in between or the browser
12:35 bosphoru_ joined #mojo
12:37 bosphorus left #mojo
12:41 crab sri: sorry, i was wrong.
12:41 crab i telnet'ed to the wrong port, and went through nginx rather than directly.
12:41 crab it works fine without nginx, so i just have to figure out how to make it buffer less.
12:48 sri marcus: oh i won!
12:48 sri \o/
12:52 crab sri: so how do i tell if the client has gone away so i can drop the timer?
12:53 sri crab: http://mojolicio.us/perldoc/Mo​jolicious/Controller#on_finish
13:05 crab great.
13:08 crab wtf! double-chunking can't be good.
13:08 crab would clients even know how to deal with that? i bet it's not very well tested.
13:09 sri you make very little sense atm
13:12 kaare joined #mojo
13:16 crab sri: mojo sends a chunked response through nginx, which sends the chunked response chunked again, with two Transfer-Encoding: chunked headers
13:16 sri weird
13:18 perlrocks Twitter: "mojolicious starting to understand little by little. Please Kuku" (ja) --umeyuki http://twitter.com/umeyuki​/status/80262755940184065
13:20 arpadszasz left #mojo
13:32 mattastrophe left #mojo
13:33 sh9 left #mojo
13:47 sh9 joined #mojo
13:47 d4rkie joined #mojo
13:55 SmokeMachine joined #mojo
13:57 tempire I have just received a thin brown box from Shanghai China.
13:57 * tempire dances
14:01 meraxes left #mojo
14:01 GitHub195 joined #mojo
14:01 GitHub195 [mojo] kraih pushed 1 new commit to master: http://bit.ly/mtsthj
14:01 GitHub195 [mojo/master] release preparations - Sebastian Riedel
14:01 GitHub195 left #mojo
14:02 crab i can't figure out why mojo closes my connection
14:02 sri maybe it's not mojo
14:06 perlrocks Twitter: "Mojolicious 1.43 by KRAIH - http://metacpan.org/releas​e/KRAIH/Mojolicious-1.43/" --cpan_new http://twitter.com/cpan_ne​w/status/80274734100647937
14:06 perlrocks Twitter: "Released #mojolicious 1.43, enjoy. :) http://t.co/Jkbu8pW #perl" --kraih http://twitter.com/kraih/status/80274737284120576
14:06 trcjr tempire, up early or up late?
14:06 tempire early
14:06 tempire fedex rang the doorbell
14:06 trcjr ah that explains it
14:09 crab sri: it may not be, but in that case i can't figure out what i'm doing wrong. here there's no nginx involved. MOJO_IOLOOP_DEBUG=1 shows me ACCEPTED (when i telnet), three TIMER lines, and then DISCONNECTED (at which point the telnet connection is closed)
14:09 crab and this happens approximately when i don't call write_chunk in the timer (or something related to not having data to send).
14:10 shonorio left #mojo
14:10 crab i need to find out what call to _drop_immediately causes that disconnect message.
14:10 sri crab: you did adjust the timeout right?
14:10 shonorio joined #mojo
14:11 sri an http connection defaults to 5 seconds of inactivity or so
14:13 crab that would be it, then. how do i adjust the timeout for that connection alone?
14:13 * crab greps for timeout in mojo source
14:13 sri Mojo::IOLoop->connection_timeout($tx->connection => 300)
14:13 crab or, in my case, 3000000000. whee.
14:14 sri that might not help with infrastructure in between
14:14 sri you're generally better off sending something regularly
14:14 sri like twitter does
14:17 GitHub45 joined #mojo
14:17 GitHub45 [mojo] kraih pushed 1 new commit to master: http://bit.ly/j3EWrj
14:17 GitHub45 [mojo/master] improved tests - Sebastian Riedel
14:17 GitHub45 left #mojo
14:18 sri whitespace garbage usually works best
14:21 crab good advice, thanks.
14:46 d4rkie left #mojo
14:53 marcus tempire: you order your crack cocaine from shanghai?
14:53 marcus sri: it was apache2 tho, not starman. but yeah
14:55 sri marcus: the important part is that I WON!
14:55 * sri dances
14:55 sri \o
14:56 sri o/
14:56 sri \o/
14:57 psimanx1 joined #mojo
14:57 sri can i name your next child now?
14:58 arpadszasz joined #mojo
14:59 sri how about Starman?
14:59 * purl lets all the children boogie or at http://search.cpan.org/dist/Starman/lib/Starman.pm or a bit tricky
15:01 marcus sri: I'll suggest it to my wife.
15:01 marcus think we're going with wallace or something to match eva tho ;-)
15:01 ysyrota left #mojo
15:02 marcus starman is a really hippy child name
15:03 sri NO!
15:03 sri it has to be wall-e
15:03 marcus walley
15:10 alnewkirk|com whats the standard for controller and/or model data validation here
15:11 sri then again wallace would make naming a dog easy
15:11 marcus I do want a dog too.
15:11 marcus wife wants a cat tho
15:12 marcus I like danish farmdogs
15:12 moritz alnewkirk|com: "whatever works best for you" is the standard here
15:12 marcus http://www.google.no/search?q=danish+farm​+dog&hl=no&safe=off&prmd=ivns​&tbm=isch&tbo=u&source=univ&a​mp;sa=X&ei=xyj2TY_nGYSRswbrj8zcBg&amp​;ved=0CC4QsAQ&biw=2016&bih=1260
15:12 sri well... a cat named gromit would make sense
15:12 sri since you're not going with original names either
15:14 amoore joined #mojo
15:14 * sri had a german shepherd
15:15 marcus like a black and brown one?
15:15 sri ye
15:15 marcus they call them schæfer in norway
15:15 marcus don't really like them.
15:15 sri "schaeferhund" in german
15:16 sri they are very very smart
15:16 sri really fun to play with as a child
15:16 marcus I guess it's just because my stupid uncle had a couple.
15:16 marcus not their fault really
15:18 marcus also, it's a common police dog over here. Because they are smart, I guess :)
15:19 sri here too
15:19 sri treated bad they can really go wrong though
15:20 sri heard good things about border collies recently
15:20 sri think if i ever got a dog again it would be a german shepherd or border collie
15:23 bosphoru_ left #mojo
15:26 marcus living in an apartment I think a small dog would be a better option.
15:26 marcus I'm a bit worried it'd fuck up my roomba tho :)
15:27 sri true (both)
15:27 sri http://www.youtube.com/watch?v=LQ-jv8g1YVI # cats on the other hand might make your roomba more effective
15:28 marcus :D
15:30 dekimsey joined #mojo
15:31 mattastrophe joined #mojo
15:41 sh9 left #mojo
15:43 sh9 joined #mojo
16:14 crab baaah
16:14 crab my tail -f-er works in firefox, but not in chrome.
16:14 crab websockets, where are you when i need you?
16:16 crab also: i hate the smug "comet" gurus who sprinkle mysterious pronouncements about various techniques and how they work in concise and elegant blog posts WITH ABSOLUTELY NO USEFUL DETAILS about implementation and interoperability problems.
16:23 marty long hair destroys roomba.  I know, first hand.
16:24 sri crab: sounds like what you really want is the boring solution ;p
16:24 sri ajax *cough*
16:24 * marty likes Bernese Mountain Dogs
16:25 marty what?  is ajax already on the way out?
16:25 * sri likes sauce bernese
16:25 marty :)
16:32 crab i couldn't find a good way to implement the boring thing without opening the logfile a gazillion times.
16:32 crab it IS a pretty big log file. and every request makes it bigger@
16:35 bangbang joined #mojo
16:41 sri why not have a recurring timer do the log file watching and store the most recent messages in a global array or so?
16:41 sri that would be one watcher per worker process
16:42 sri unless of course you have to watch a gazillion of log files
16:52 fmerges left #mojo
16:59 SmokeMachine left #mojo
16:59 bangbang cool
17:01 SmokeMachine joined #mojo
17:01 dekimsey1 joined #mojo
17:06 * marty is really liking the mongodb dot notation query syntax
17:06 dekimsey left #mojo
17:09 fmerges joined #mojo
17:19 crab i wonder if it's the double-chunking that confuses chrome (which just spins forever)
17:20 d4rkie joined #mojo
17:23 sri crab: is it just the header or actually applying chunked encoding twice?
17:23 sri anyway, both cases would be bugs
17:31 sh9 left #mojo
17:35 metaperl joined #mojo
17:40 stephen left #mojo
17:42 stephen joined #mojo
17:51 trone_ joined #mojo
17:55 trone left #mojo
17:56 kaare left #mojo
18:06 jwang left #mojo
18:08 sri damn, game of thrones is amazing
18:14 elb0w So pissed Ned is dead
18:15 sri all the main characters die
18:15 sri or so i heard
18:15 elb0w I think the blonde girl is around for awhile
18:16 sri hope so, great character development
18:16 elb0w Yeah too bad kahl dies
18:16 elb0w :(
18:17 sri i bet the dragon eggs will hatch or so and everything will be turned around
18:17 elb0w Why dont you offer to "help
18:17 * sri does not know the books (yet)
18:17 elb0w whoops
18:17 elb0w Yeah they do
18:17 elb0w next episode
18:17 sri \o/
18:17 elb0w :D
18:18 elb0w Hope they cut jaime lanisters head off
18:18 sri well, he's a good bad guy
18:18 elb0w Yeah
18:18 sri the king needs to die!
18:18 elb0w I hope the little girl kills the king
18:19 sri indeed
18:20 elb0w still pissed they killed ned
18:20 elb0w he was such a great char
18:21 sri hope tyrion doesn't die anytime soon
18:21 elb0w Maybe everyone in his family will die and he becomes king
18:21 sri lets hope
18:45 fhelmbe__ joined #mojo
18:45 crab sri: it's actually applying chunked encoding twice
18:45 crab and actually, both firefox and chrome seem to deal with that part correctly
18:46 sri thats' just wrong
18:47 crab it's odd, but not actually *wrong*
18:48 crab proxies are allowed to undo/redo transfer-encoding if they want, nd composing two different encodings is ok in similar circumstances.
18:48 fhelmber_ left #mojo
18:50 sri ah you're doing it wrong
18:50 sri nginx is of course using http 1.0
18:50 sri you are not allowed to send it chunked responses
18:51 sri you don't gain anything by double chunked encoding, it is just wrong
18:52 sri just stay http 1.0 compliant
18:55 bangbang left #mojo
18:59 crab hum. well, you have a point. but, it's not because of that that chrome doesn't work. chrome does the wrong thing even when talking directly to mojolicious.
19:00 perlrocks Twitter: "Starting with Komodo 7, Activestate will finally support multi-language documents. #mojolicious ep templates work fine in the alpha already!" --kappataumu http://twitter.com/kappatau​mu/status/80348928352063488
19:05 sri direct streaming with connection close would be the right choice with nginx i guess
19:05 sri what we recently added in 1.4 :)
19:08 arpadszasz left #mojo
19:18 amoore left #mojo
19:24 crab heh. so switching to write() from write_chunk() then breaks firefox :-)
19:25 crab (not that simple. works on localhost, not on the production site. god knows what's going on. but 1AM is too late to break out tcpdump.)
19:27 crab sri: wehn i figure it out, i'll work up a full example and post it
19:27 crab along with all the discoveries made en route
19:32 Kulag left #mojo
19:32 Kulag joined #mojo
19:54 sri i suppose a reverse proxy like varnish would be a better choice for long polling
19:55 sri nginx using http 1.0 to talk to backends already kinda hints at bad support for it
20:00 sri in fact any real reverse proxy seems to be a bad idea
20:12 crab i figured out why it doesn't work in chrome: the extra data that you have to send at the beginning must add stuff to the dom, it can't be inside a comment.
20:13 crab how anticlimactic
20:28 bangbang joined #mojo
20:42 shonorio left #mojo
20:48 bangbang left #mojo
21:13 moritz when I have xml elements with namespace, $dom->find() doesn't find them when I use the fully qualified tag name (ie namespace:tagname). Is that intentional?
21:15 sri moritz: yes
21:16 sri css doesn't work like that
21:21 SmokeMachine left #mojo
21:25 sri the question comes up a lot
21:26 sri if anyone sees a clean way to deal with namespaces even if it breaks the spec please send patches
21:37 arpadszasz joined #mojo
21:39 sri i suppose it could be implemented rather comfortably and spec compliant by making a list of namespaces and aliases while parsing
21:40 sri personally i have not much interest in it though
21:40 sri btw. the right css syntax for namespaces would be namespace|tagname
21:42 sri the really ugly part is to make a list of namespaces and their aliases
21:42 sri that might have to happen manually
21:42 sri depending on the xml
21:43 shonorio joined #mojo
21:49 metaperl How can I truncate the path part of a URL and set it's port to 3333? I already know how to set the port ( https://github.com/kraih/moj​o/wiki/Faq-for-the-impatient ), but ->path() returns a Mojo::Path object not a Mojo::URL object
21:50 sri not with a oneliner i'm afraid
21:51 metaperl ok, so what would I do to get the job done?
21:51 sri see Mojo::Path
21:51 sri it offers a lot
21:52 sri dump the object to get an overview
21:58 metaperl well it was not niformative enough for me :) ... but I must disconnect and go home... more later
22:03 marty Does anyone know of a good javascript library to transform a json object into a simple HTML table?
22:05 arthas left #mojo
22:05 GitHub176 joined #mojo
22:05 GitHub176 [mojo] kraih pushed 1 new commit to master: http://bit.ly/mPS2bl
22:05 GitHub176 [mojo/master] improved Mojo::Path example - Sebastian Riedel
22:05 GitHub176 left #mojo
22:06 sri if that's not enough i don't know how to make it more obvious
22:07 metaperl left #mojo
22:13 perlrocks Twitter: "Awesome, #mojolicious has reached 400 watchers on #github, more than any cpan module before, thanks everyone! :) http://t.co/WQ9AaLE #perl" --kraih http://twitter.com/kraih/status/80397519795920897
22:15 crab the mysterious watchers
22:17 sri considering we have all the names they are not that mysterious ;p
22:25 * crab wonders what would happen if he said "sorry, you need firefox 6 for my app, nothing else will work"
22:26 crab considering the number of people complaining about not being able to use ie6, i suppose nothing good would happen
22:26 sri prolly not, unless your users are in a controlled environment, like a single company
22:28 crab alas. my user's users, such as they are, are spread across the country and need to be told things like how to type their email address or where the * key is
22:42 fmerges left #mojo
22:54 metaperl joined #mojo
23:05 metaperl left #mojo
23:05 metaperl joined #mojo
23:10 jamesw joined #mojo
23:19 sri marcus: http://www.youtube.com/watch?v=PTt8_09b0QY
23:20 sri sums up the last episode pretty well
23:20 sri tyrion++ # almost forgot that scene
23:43 ndiewald joined #mojo

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