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

IRC log for #mojo, 2015-08-18

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

All times shown according to UTC.

Time Nick Message
00:00 jontaylor joined #mojo
00:01 zivester joined #mojo
00:10 preaction i feel, sort of limited. what can i do at zombocom?
00:10 Grinnz anything in html5
00:10 bpmedley Zombocom is a state of mind, I believe.
00:11 Grinnz like mongodb?
00:17 jberger WEB SCALE!
00:19 henq joined #mojo
00:41 absolut__ joined #mojo
01:07 jzawodn joined #mojo
01:36 sopanshewale joined #mojo
01:42 PryMar56 joined #mojo
02:22 sri that seems useful http://www.depesz.com/2015/08/18/waiting-for-9-6-add-new-function-pg_notification_queue_usage/
02:29 noganex joined #mojo
03:07 inokenty-w joined #mojo
04:08 stryx` joined #mojo
04:28 hshong joined #mojo
04:38 lluad joined #mojo
04:49 stryx` joined #mojo
05:43 sopanshewale joined #mojo
05:44 jlzhang joined #mojo
05:48 jlzhang When I upload a large file to the mojolicious server, how asynchronous read this file?
05:48 jlzhang use slurp in Mojo::Upload?
05:50 bpmedley jlzhang: http://mojolicio.us/perldoc/Mojolicious/Guides/Tutorial#File-uploads <-- Have you seen this?
05:51 jlzhang my $oid = $self->mango->db->gridfs->writer->filename($self->param('example')->filename)->write($self->param('example')->slurp)->close;
05:51 Grinnz slurp reads the file all at once into a string in memory.
05:51 jlzhang I want to save the file to mongodb.
05:52 Grinnz after a file is uploaded, you will have a Mojo::Asset (from $upload->asset); you can use a loop with get_chunk to read it a piece at a time
05:52 Grinnz yeah, i think you will need it all at once to save it to mongodb
05:53 jlzhang How to use the asynchronous method?
05:53 Grinnz what asynchronous method?
05:53 arpadszasz joined #mojo
05:54 Grinnz unless there is a problem you are trying to solve, i think you are inventing one that doesn't exist
05:54 bpmedley jlzhang: Does mongoDB allow saving a file a chunk at a time?  Perhaps using a file in the file system?
05:56 sri yes, mango does support streaming files in gridfs
05:57 sri gridfs is a hack on top of mongodb that combines multiple 16mb-ish documents into larger files
05:58 sri support in the official mongodb driver for it is really bad, but it should be very comfortable with mango
05:59 jlzhang when use slurp to read file on the disk, if you hit hard IO delay, what happens?
05:59 sri you block, all file system io is blocking, always
06:01 jlzhang No asynchronous way?
06:01 sri you can fake it, with threads, like IO::AIO does, but that's actually slower most of the time
06:03 jlzhang sri: thanks a lot
06:05 dotan joined #mojo
06:11 Guest6 joined #mojo
06:11 jontaylor joined #mojo
06:15 mrallen1 joined #mojo
06:34 * sri just saw the slurp discussion on p5p, and wondered which slurping method might be the fastest
06:35 sri "do { local $/; <$fh> }" is by far the worst in my tests
06:37 sri "open ..., '<:unix'; read ... while ..." seems to be the fastest
06:38 sri sysread instead of read is very close, but seems to be slightly slower
06:39 Guest6 joined #mojo
06:40 sri actually checking the file size before slurping to find the ideal chunk size seems to be a lot slower
06:49 good_news_everyon joined #mojo
06:49 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/vsfB1
06:49 good_news_everyon mojo/master 683f4a2 Sebastian Riedel: slurp a little faster
06:49 good_news_everyon left #mojo
06:49 Guest6 joined #mojo
06:51 dod joined #mojo
06:52 sri 0.80s instead of 0.84s average for slurping a 350mb binary file 10 times
06:52 Guest6 joined #mojo
06:54 Guest6 joined #mojo
06:56 dod joined #mojo
06:59 Guest6 joined #mojo
07:03 Guest6 joined #mojo
07:16 Guest6 joined #mojo
07:20 Guest6 joined #mojo
07:24 Vandal joined #mojo
07:27 eseyman joined #mojo
07:30 worklapperl joined #mojo
07:32 berov joined #mojo
07:35 AndrewIsh joined #mojo
07:36 berov joined #mojo
07:47 Guest6 joined #mojo
08:02 odc sri, interesting... I wonder at which point does '<:mmap' become faster
08:02 dotan joined #mojo
08:05 henq joined #mojo
08:08 worklapperl Did anybody have a chance to look at my posting https://groups.google.com/forum/#!topic/mojolicious/aTE1ONLoMMc ? It would be nice to get some feedback. BTW, the problem can be reproduced with today's v6.15-8-g683f4a2.
08:26 henq joined #mojo
09:23 henq joined #mojo
09:24 meshl joined #mojo
09:29 arpadszasz joined #mojo
09:46 Lee joined #mojo
09:50 Guest6 joined #mojo
10:51 sh4 joined #mojo
11:31 henq joined #mojo
11:54 neilhwatson joined #mojo
12:00 Tripkipke joined #mojo
12:00 sopanshewale joined #mojo
12:18 Tripkipke Hey, I was wondering if any of you here could help me with a mojo plugin, basic auth plus?
12:19 Tripkipke it seems that it splits the userid:password on every colon in stead of only the first
12:27 phillipadsmith joined #mojo
12:28 chansen joined #mojo
12:36 hernanGOA joined #mojo
12:37 sopanshewale joined #mojo
12:38 marcusr it probably uses split rather than a regex.
12:40 nicomen it might not be using split correctly? my ($username, $password) = split ':', $string, 2;
12:40 Tripkipke i just checked the source, it uses  my ($auth_username, $auth_password) = ($1, $2)
12:40 Tripkipke if $auth =~ /^([^:]+):(.*)/;
12:41 nicomen think what I wrote just would work better
12:41 nicomen although the regexp seems correct
12:41 nicomen ah no
12:42 nicomen erhm yes I mean
12:42 Tripkipke it looks fine to me
12:42 Quai :'s in usernames and passwords should be url-encoded
12:42 Tripkipke i'll start by filing a bug report
12:43 Tripkipke when I tcpdump thetraffic I see half of the password
12:43 Tripkipke it cuts on the :
12:51 sopanshewale joined #mojo
12:54 Quai (I was wrong. The rfc doesnt say much about it, but it would look like nicomen's split is a better solution than the regex)
13:02 jberger Yes, I use split 2 in my code and it works well for me
13:03 jberger worklapperl: if you don't have a finish handler at all does it still leak?
13:03 jberger Generally, async is going to end up requiring some use of weaken
13:04 ajr_ joined #mojo
13:04 jberger Careful use of delays (or futures) might prevent some of it
13:04 jberger But generally
13:05 worklapperl jberger: with a finish handler no leak
13:05 worklapperl jberger: without a finish handler no leak
13:05 worklapperl sorry, the latter I mean: without a finish handler no leak
13:06 jberger So the problem is the existence of the closure over $s
13:06 jberger If you need to close over it, then weaken it, if you don't need to, just don't
13:07 jberger But it seems that you had that pretty well understood
13:08 worklapperl well, not understood, just found out by trial and error
13:10 jberger weaken is the recommended way, fwiw
13:11 worklapperl and the worrying thing is that it only leaks when the client closes prematurely
13:11 zivester joined #mojo
13:11 jberger Because trying to undef is prone to miss places
13:11 jberger No that's expected
13:12 worklapperl thanks for the recommendation, it encourages us to go with weaken
13:12 jberger Mojo has places that weaken just for that reason
13:12 mst joined #mojo
13:13 jberger worklapperl: or alternatively you can hold a strong reference to the tx
13:14 jberger And then clean it up yourself
13:14 worklapperl Do you know a sample of such code?
13:15 jberger The delay helper comes to mind
13:16 jberger Tbh, if weaken works for you there, then no need to mess with the tx
13:17 worklapperl that was just my thought as well
13:17 jberger worklapperl++
13:17 worklapperl jberger++
13:35 phillipadsmith joined #mojo
13:37 chansen joined #mojo
13:45 melo joined #mojo
13:48 jontaylor joined #mojo
13:51 Tripkipke joined #mojo
13:57 jontaylor joined #mojo
14:00 gryphon joined #mojo
14:01 jontaylor joined #mojo
14:14 bjakubski joined #mojo
14:16 cpan_mojo Mojolicious-Command-generate-lexicon-0.994 by UNDEF https://metacpan.org/release/UNDEF/Mojolicious-Command-generate-lexicon-0.994
14:21 jontaylor joined #mojo
14:22 Grinnz Use of uninitialized value in PAUSEID at ...
14:22 Tripkipke joined #mojo
14:37 PryMar56 joined #mojo
14:47 jberger sri: I finally got a chance to watch that talk you posted from IBM
14:48 jberger of course perl5 is probably a bad candidate but I wonder if someone from the perl6 community is talking with him?
14:48 jberger (for others: https://www.youtube.com/watch?v=kOnyJurioyw)
14:50 njlg joined #mojo
14:55 * cfedde looks
15:18 lluad joined #mojo
15:34 sri jberger: the fact that it works for cpython could mean that it would work for perl5 too
15:34 sri both lack garbage collection, which most folks have stated as a requirement for jit
15:39 sri hmm, i wonder if Mojo::Asset::File could be optimized with read() instead of sysread()
15:40 sri there's also sysseek() and stuff like that though
15:40 meshl joined #mojo
15:45 phillipadsmith joined #mojo
15:47 chansen joined #mojo
15:47 DadaIsCrazy joined #mojo
15:50 sri oh, i can get the slurp benchmark down to 0.66s
15:55 genio Forgive my ignorance as I'm nowhere near as versed on this as you guys.  But, when using IO::Poll/Select, don't you need to use sysread?  How do you do buffered IO and polling at the same time?
15:56 genio If I'm asking a stupid question and it's too much explanation to correct me, feel free to say shut up and I'll eventually read/understand more some day
15:57 sri this is file system io
15:57 sri which is incompatible with IO::Poll/Select
15:58 sri since it is always readable/writable
16:01 genio I guess I assumed file locking played some role in why you might not have access to the file system io sometimes.  assumption--
16:01 sopanshewale joined #mojo
16:07 good_news_everyon joined #mojo
16:07 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/vsT9q
16:07 good_news_everyon mojo/master 0473284 Sebastian Riedel: even faster slurping
16:07 good_news_everyon left #mojo
16:08 sri Mojo::Util::spurt i can't really benchmark, since writes with my current ssd are way too inconsistent
16:09 sri just trying to use something as similar as possible to Mojo::Util::slurp
16:09 mst stick it on a tmpfs so you're just benchmarking the perl stuff?
16:13 dod joined #mojo
16:18 disputin joined #mojo
16:21 bjakubski joined #mojo
16:26 eseyman joined #mojo
16:43 eitz joined #mojo
16:56 Grinnz_ joined #mojo
16:57 sopanshewale joined #mojo
17:03 berov1 joined #mojo
17:05 amon joined #mojo
17:16 CromeDome joined #mojo
17:17 neilhwatson joined #mojo
17:27 njlg joined #mojo
18:00 henq joined #mojo
18:08 henq joined #mojo
18:28 PopeFelix joined #mojo
19:37 henq joined #mojo
20:02 meshl joined #mojo
20:02 depesz joined #mojo
20:15 neilhwatson joined #mojo
20:17 eitz joined #mojo
20:24 PryMar56 joined #mojo
20:29 njlg joined #mojo
20:36 henq joined #mojo
21:18 flamey joined #mojo
21:20 cfedde how do I tell yaml to give me a more reasonable dump of these?
21:20 cfedde ---
21:20 cfedde - !!perl/hash:BCV::OCIWrapper::Result value: !!perl/scalar:Mojo::DOM Mojo::DOM::HTML=HASH(0x5e0d5c8
21:21 mst I'm unsure why you're trying to dump them or what you'd consider more reasonable
21:22 mst maybe call a to_string or similar method first
21:22 mst or if you're just trying to debug, consider Data::Printer
21:22 cfedde mst: mostly it's part of my debugging pattern.
21:22 cfedde but also the results end up in audit logs.
21:22 mst YAML records objects as objects
21:23 mst if you can produce, say, a Dumper() of whatever it is, and the YAML output
21:23 mst that might be a start towards figuring out what to do?
21:23 cfedde maybe.
21:23 mst (proximate problem is "not really sure what you're asking for")
21:23 cfedde heh.
21:23 mst people's definitions of 'reasonable' vary somewhat, after all
21:24 cfedde yeah. somehow caling 'say YAML::Dump $obj' ends up with the "!!perl/scalar:Mojo::DOM Mojo::DOM::HTML=HASH(0x5e0d5c8)" rather than the big ugly data structure I see when I say  "x $obj" in the debugger.
21:25 cfedde No biggie. I just do it for debugging purposes.
21:25 mst could I at least see the first few lines of the big ugly data structure?
21:25 mst that's exactly the Dumper output I was asking for :)
21:26 * cfedde goes hunting a pastebot.
21:26 mst ooh, heck, I see the problem, it's a reference to a blessed scalar
21:26 mst and YAML::Dump has therefore become confused
21:26 mst YAML::Dump $$obj will give you the Mojo::DOM::HTML object
21:26 mst which might be more to your taste
21:27 mst cfedde: ^^
21:27 cfedde indeed
21:28 mst I started to read the source to pass the time while you arranged the Dumper output ;)
21:29 shadowpaste "cfedde" at 217.168.150.38 pasted "dump stuff" (15 lines) at http://paste.scsys.co.uk/497254
21:30 mst cfedde: did $$obj help?
21:31 * mst suspects other than that you're looking at either "use a different YAML implementation" or "patch the one you've got to not have that bug"
21:31 cfedde mst: I'll give that a try.  At themoment I'm goiong to have to shelf the issue.  the main thing is that the blessed scalar is the value of attribute in the hash.
21:31 cfedde also stupid ETL stuff.
21:34 flamey beginner here... how do I make sure images are displayed when I run Lite app locally? (Windows, if that matters)
21:34 flamey i put this in template: <img src='./test.png' />
21:34 flamey but get 404 error
21:34 flamey the image file is in the same location as .pl (lite app) file
21:35 cfedde flamey: are you running under morbo or hypnotoad or somethign?
21:35 flamey morbo
21:35 cfedde morbo arranges to serve flat files out of a 'public' subdir.
21:36 cfedde or rather, a subdir of the project called 'public'.
21:36 flamey that worked!
21:36 flamey thank you
21:36 cfedde you'll have to make other arrangements when you run the app under a "real" web server.
21:36 mst also "./test.png" rather than './test.png' is a good idea
21:37 cfedde yeah.  HTML likes "" rather than ''
21:37 flamey why? just curious
21:37 flamey ok. i guess I'll read up on this
21:37 mst because that's how HTML works
21:37 cfedde s/likes/specifies/
21:38 flamey never had a problem with this yet, but then I'm not developer... I'll read up. thank you
21:38 mst that's because browsers are really kind to bad HTML
21:38 cfedde sometimes I wish that browsers were more strict.
21:38 mst because there are plenty of people out there who both don't know -and- don't have the sense to read up on it
21:39 cfedde infact most of the time I wish that browsers were more strict.
21:39 mst but there's no need to keep being one of them :)
21:40 cfedde maybe the browser has a switch I can turn on that says "be a pedantic asshat about standards" switch.
21:40 Grinnz_ luckily all of IE <10's horrid ideas are dying off
21:40 sri single-quoted attribute values are perfectly fine in html5
21:41 sri uncommon, but totally fine
21:41 Grinnz_ 17:36:44            <cfedde> you'll have to make other arrangements when you run the app under a "real" web server.
21:41 Grinnz_ not necessarily, you can proxy to hypnotoad running a Lite script with a public/ dir fine
21:42 Grinnz_ or any combination of such things
21:42 cfedde Grinnz_: I'm not sure but I think that almost counts as making "arangements"
21:43 Grinnz_ well, it's the same arrangements he just made, so.. :)
21:43 cfedde yeah. Us old farts that still think cgi is cool have to learn to just get over it.
21:44 Grinnz_ you can run a Lite script as a CGI script with a public/ dir too!
21:45 cfedde does that work with ./ relative paths?
21:45 Grinnz_ i think so, it uses FindBin or similar
21:45 Grinnz_ or you mean in the HTML
21:45 cfedde with morbo absolute paths resolve under 'public' but relative paths?
21:46 flamey to be honest, I'll be running mine (a simple script, I hope) on shared hosting under Apache, most likely. I know, I know.. you guys don't like shared hostings.. :)
21:46 mst I don't mind shared hosting at all
21:46 Grinnz_ on shared hosting under Apache you're pretty much stuck with CGI mode
21:46 cfedde shred hosting is fine and cheap.
21:46 cfedde shared even
21:46 sri morbo doesn't care, resolving relative paths is html
21:46 mst well, I mean, I hate it with a fiery passion while I'm setting up
21:46 flamey looks like morbo treats public/ as root. so ./ link worked for mw
21:46 cfedde shread hosting might be a problem.
21:47 mst but once it's running, meh
21:47 Grinnz_ it's not that public/ is root, it's that it looks in public/ first for static files
21:48 Grinnz_ you can add others, and such
21:49 sri in case someome cares about single-quoted attributes https://html.spec.whatwg.org/multipage/syntax.html#attribute-value-(single-quoted)-state
21:49 Adurah Interesting, but I'll never use them.
21:49 sri just a normal state, like double quoted and unquoted
21:50 flamey I had a script running on shared hosting a couple of years back, I remember I had to figure put paths and stuff, but once it was working it was fine.
21:50 flamey unfortunatelly I'm not a developer, so I don't use all this stuff on daily basis, and forget a lot quickly without practice
21:53 flamey i mean Mojolicious script
21:56 flamey I'm Perl slacker for many years. and remeber was very excited to learn of Mojolicious just when it was starting out, because of it's minimal dependencies -- because those dependencies can be a bitch to install in shared hostings, and other types of hostings were too expensive
21:58 nicomen used to b
21:58 nicomen e
21:59 sri flamey: language
21:59 nicomen now you have local::lib, fatpacker, plenv etc
22:00 Guest6 joined #mojo
22:00 flamey sri, sorry
22:03 flamey @nicomen, yes, things have changed a lot. but so did my life :)
22:11 Guest6 joined #mojo
22:14 Grinnz_ local::lib makes a shared hosting type environment manageable. but it still can't help with configuring apache or opening a different port for your perl server :(
22:17 henq joined #mojo
22:26 henq joined #mojo
22:30 jberger Mojolicious can only do so mu .... ALL GLORY TO THE HYPNOTOAD!!!!
22:32 Guest6 joined #mojo
22:32 nicomen maybe we should ship with a php script that does requests to a backend
22:33 nicomen mojolicious now for mod_php ;)
22:33 nicomen sri: sorry for language
22:33 jberger Hmmmm this might be interesting http://mobile.reuters.com/article/idUSKCN0QN24Q20150818
22:33 Adurah Wait, you can't even say backend now?
22:34 Grinnz_ i think he meant for php :P
22:34 nicomen well, someone said apache, so I took a chance ;-D
22:35 nicomen jberger: wow, wi-fi in your home? what will be next? slice bread?
22:38 Grinnz_ actually this is really good
22:38 Grinnz_ the wireless router market has been horrible for years
22:39 Grinnz_ maybe google can make a router that actually is reliable and useful
22:41 Grinnz_ it looks like wifi only of course, which means its useless for me, even the best wifi can't beat gigabit for transfer between computers
22:41 nicomen I always had working wi-fi really
22:45 flamey some hunter news commentters are bashing it with privacy concerns
22:47 Grinnz_ considering the chromecast is set up to assume anyone on your wifi should be allowed to set what it displays, thats not surprising...
22:48 Grinnz_ but i guess that's why this "guest wifi" thing is becoming popular now
22:49 sri in germany pretty much everybody uses a fritzbox, they are quite good
22:53 cfedde It has fins
22:55 sri oh my, and i just learned something new from wikipedia :o https://en.wikipedia.org/wiki/Fritz!Box#Undocumented_features
22:55 sri if only wireshark had a good os x ui
22:59 nicomen uncanny name
22:59 sri most telcos here rebrand them
23:00 njlg joined #mojo
23:00 henq joined #mojo
23:01 Grinnz_ most of the telcos here give you some abomination of a modem/router, the one i'm at now is the only decent cable company i know of
23:02 Grinnz_ well the last one i had wasnt so bad but now they're merging with time warner cable
23:02 sri where are you?
23:02 Grinnz_ US connecticut
23:03 sri that may be the only us state i know absolutely nothing about :)
23:03 Grinnz_ yeah it's the "between boston and NYC" state ;)
23:04 sri i've never even heard of your capital :o
23:04 Grinnz_ you're better off that way, it has one of the highest crime rates in the US...
23:05 Adurah Ferguson?
23:06 Grinnz_ and also, connecticut has two of the biggest non-las vegas casinos, thats why my uncle likes to visit here...
23:07 jberger Then again sri seems to assume I spend most of my time ducking a constant hail of bullets
23:10 jberger http://irclog.perlgeek.de/mojo/2014-08-25#i_9236349
23:10 sri can confirm
23:16 sri crime rates are a lot higher in the us in general though
23:18 sri germany has less than 300 homicides per year, while in the us it's north of 14000
23:20 LordVorp joined #mojo
23:20 sri with a population of 80 million (vs 300 million)
23:24 jberger Yeah, it's bad
23:25 jberger But we "gotta have urr guns. Murica"
23:28 flamey c'mon, US is very safe. it's not like ppl going aorund the streets with guns. expecially not in Connecticut
23:29 Grinnz outside of Hartford and New Haven, connecticut is ok
23:29 flamey New Haven -- that's where rich ppl live, right?
23:30 Grinnz that's where Yale is... and also ranked among most dangerous cities to live, heh
23:31 flamey i guess I'm confusing it with something
23:31 Grinnz Greenwich is where the rich people live
23:31 Grinnz and i guess New Canaan and Darien
23:31 Grinnz Darien is the next town over from me heh
23:33 flamey I lived in NYC suburbs for several years, and I'm ashamed to say I know nothing about CT :(
23:35 flamey and talking about safety.. I live in Russia now, many ppl in US seem to think it's unsafe over here :)
23:38 sri lots of dashcam footage on the internet that makes it look that way ;p
23:38 Grinnz haha
23:39 flamey and I took a drive to Germany in May (my first trip there), and was sutprised with friendliness on drunk ppl. in Russia or US I'd usually expect troubles or aggressiveness from drunks, but over there they are ... funny and friendly! :)
23:39 sri talking about safety... look at that, right off the CT coast is plum island
23:40 sri flamey: depends on the environment
23:41 sri we have lots of terrible drunk people too
23:42 sri although, pretty much everybody here drinks beer
23:43 flamey I guess we can say that about any place... but in 5 days I haven't seen single aggressing drunk person -- and I've seens many drunks! I guess it was some kind of festival season there
23:43 flamey i visited friends in Stuttgart
23:44 sri ah, the south
23:44 flamey eh, it was a nice road trip. from St. Petes to Vienna, then to Stuttgart, then back...
23:45 sri i can imagine
23:50 sopanshewale joined #mojo
23:51 jberger Is the German south like the US south?
23:54 flamey thanks for the help, guys. I gotta get some sleep. have good rest of your days/nights...
23:55 sri jberger: bavaria is our texas ;)
23:55 buu In a coincidence texas is also full of germans. and beer. and sausage.
23:57 Grinnz and guns. wait
23:58 buu and mexicaans
23:59 jzawodn joined #mojo

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