Camelia, the Perl 6 bug

IRC log for #mojo, 2010-11-17

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

All times shown according to UTC.

Time Nick Message
00:02 diegok joined #mojo
00:39 sri marcus: better than colloquy?
01:22 crab ok, i decided to keep it simple. if an admin does "act as user 'x'", the effective privileges are just x's privileges, not union(x-privileges, admin-privileges).
01:22 crab oops
01:29 crab man, i really hate favicon.ico. browsers keep requesting it, and all my bridges get run just to serve a 404.
01:29 crab and my logfiles fill up.
01:57 alnewkirk left #mojo
02:06 perlrocks Twitter: "@kraih the Mojolicious::Lite routes in Mojolicious are bloody freaking awesomesauce :D #perl #mojolicious" --perlninja http://twitter.com/perlnin​ja/status/4716954241736704
02:07 sri crab: you really shouldn't debug log in production
02:10 crab it's not production
02:11 sri ah
02:12 crab i need to (figure out how to) write some "multipart" helpers.
02:13 crab for example: a helper to create a certain kind of form which has a button to show and hide it, such that the relevant css and javascript are also placed in the appropriate places on the page
02:13 crab it'll be nice.
02:15 mrSln left #mojo
02:15 baton8 left #mojo
02:20 baton8 joined #mojo
02:37 perlrocks Twitter: "RT @kraih: Here are some examples for what you can do with the new #mojolicious routes syntax. http://bit.ly/9G79Rh #perl" --tempiretech http://twitter.com/tempiret​ech/status/4724848408395777
02:38 MojoGuest685 joined #mojo
02:42 MojoGuest685 left #mojo
02:44 stephen left #mojo
02:46 stephen joined #mojo
02:53 skaurus joined #mojo
02:53 skaurus hi all)
02:53 stephen Hello skaurus
02:54 skaurus sri: why are you deleting expires from signed cookie in Mojolicious::Session::load?
02:54 skaurus i'm set cookie for a year and after click it already one-hour cookie :)
03:22 skaurus left #mojo
03:30 tempire Anyone else get this error when using Test::Mojo's get_ok?
03:30 tempire "Use of uninitialized value $data in hash element at /Users/glen/.perlbrew/perls/perl-5.12.​1/lib/site_perl/5.12.1/Mojo/Command.pm line 172"
03:50 polvo joined #mojo
03:50 y0j left #mojo
03:52 sri tempire: never seen
03:53 sri skaurus: that might be a bug
03:55 sri hmm, but i'm unsure
03:56 sri usually you would want to refresh the expires value and not inherit some old one
04:04 tl joined #mojo
04:05 stephen left #mojo
04:05 tholen42 left #mojo
04:19 y0j joined #mojo
04:19 daviddelikat joined #mojo
04:22 y0j left #mojo
04:33 y0j joined #mojo
05:21 perlrocks left #mojo
05:21 perlrocks joined #mojo
05:27 MojoGuest503 joined #mojo
05:27 MojoGuest503 From: http://www.google.co.jp/search?hl=ja&clien​t=safari&rls=en&q=websocket+demo&a​q=f&aqi=g1&aql=&oq=&gs_rfai= (1 hits)
05:27 MojoGuest503 left #mojo
05:39 perlrocks Twitter: "RT @kraih: Here are some examples for what you can do with the new #mojolicious routes syntax. http://bit.ly/9G79Rh #perl" --zakame http://twitter.com/zakame/status/4770492456116224
05:51 tempire left #mojo
06:30 ltriant left #mojo
06:42 perlrocks Twitter: "MojoX:: Redis: an asynchronous Redis implementation for Mojolicious / No time to wait http://bit.ly/cBeaFR" (ja) --wPerlnews http://twitter.com/wPerlne​ws/status/4786332127731712
06:46 koban joined #mojo
06:53 marcus Sri: way better imo.
07:09 kaare joined #mojo
07:13 kvorg left #mojo
07:18 ysyrota joined #mojo
07:20 sri hmm, the os x version looks horrible
07:28 snearch joined #mojo
07:40 tholen joined #mojo
07:41 tholen left #mojo
07:41 tholen joined #mojo
07:51 snearch left #mojo
08:08 kaare Can I have Test::Mojo make a post call with json content?
08:08 kaare Perhaps I should get my first cup of coffee, but I don't see it.
08:10 breaker313 joined #mojo
08:11 sri sure you can, just encode the json yourself
08:14 sri $t = $t->post_ok('/foo', {'Content-Type' => 'application/json'}, Mojo::JSON->new->encode({lalala => 23}));
08:15 sri or just $t->post_ok('/foo', Mojo::JSON->new->encode({lalala => 23})) in case you don't care about content type
08:16 mrSln joined #mojo
08:16 kaare sri: Thanks. I had a hunch, but couldn't get it right
08:20 daviddelikat left #mojo
08:43 spleenjack joined #mojo
09:01 kvorg joined #mojo
09:08 kvorg left #mojo
09:11 yko joined #mojo
09:34 stephan49 left #mojo
09:45 otaviof joined #mojo
09:46 otaviof left #mojo
09:51 stephan48 joined #mojo
09:57 yko sri: you told me, that i can build my own connection for tx and use it like $tx->connection($socket)
09:58 yko as far as i understamd it's supposed that if tx has own connection, client should use it: http://bit.ly/cnKVlZ Right?
10:00 yko but looking deeper i see that Client overrides tx's connection anyway http://bit.ly/9dUwSr . did i missed something?
10:02 sri yko: yes you did miss something
10:02 yko thanx
10:03 sri yko: https://github.com/kraih/mojo/blob/master​/t/mojolicious/websocket_lite_app.t#L157
10:03 sri there's the test
10:03 yko thanks again
10:04 sri sure
10:04 sri btw. Skyline sucks
10:06 yko hmm. dunno what do you mean :)
10:06 sri totally deserves its 4/10 on imdb
10:06 sri http://www.imdb.com/title/tt1564585/
10:06 yko oh... movie
10:06 yko i like 13. but end sucks
10:08 sri green lantern trailer looks interesting
10:08 sri http://trailers.apple.com/​trailers/wb/greenlantern/
10:08 yko hm. I mean movie with Statham, but Thirteen from  House MD i like too :)
10:09 sri haha
10:09 sri not heard about 13 yet
10:09 yko well, there's already dvdrip with russian translation :p
10:10 yko argh, hate quicktime
10:12 yko looks nice. damn, i miss Babylon 5 :(
10:13 yko and those days when i had time to watch tv
10:13 sri who doesn't? :(
10:13 yko hm, there's alot of people who even don't know about...
10:15 yko today hunging in vkontakte is a trend, not plaing games on Poisk 1.01, loaded from audio tapes. huh
10:43 rhaen hello world!
10:44 rhaen sri: glad to be back!
10:44 rhaen It's an awesomeplace to hang out!
10:51 yko ...especially while someone doesn't force you to write tests :D
11:08 robn joined #mojo
11:12 kvorg joined #mojo
11:14 marcus Green lantern looks cool
11:16 stephan48 left #mojo
11:16 stephan48 joined #mojo
11:18 * sri waves
11:18 stephan48 left #mojo
11:27 sri an actually good new scifi movie would be cool for a change
11:28 baton8 sri, Interception 2010 is good one
11:28 sri you mean inception
11:28 baton8 yap
11:28 sri didn't like it that much :S
11:29 * sri demands aliens or evil robots
11:30 marcus Evil alidn
11:30 marcus Aliens
11:30 sri evil alien robots!
11:31 marcus Megamind!
11:31 sri actually Skyline too... except for the "actually good" part
11:31 stephan48 joined #mojo
11:32 sri evil alien robots sums up the entire plot...
11:34 sri hope Battle: Los Angeles will be better
11:36 arthas joined #mojo
11:57 kvorg left #mojo
12:03 stephan49 joined #mojo
12:03 stephan49 left #mojo
12:13 robn left #mojo
12:32 breaker313 left #mojo
13:04 crab sri? suppose i organise my routes like this:
13:05 crab my $auth = $r->bridge->to('auth#check_user_is_logged_in'); my $admin = $auth->bridge->to('auth#check_user_is_admin');
13:06 crab and create various routes under those two bridges, including a /:controller/:action route under $admin
13:06 crab it works fine. now suppose i want non-admin users to be able to post to, say, /users/:theirownid/password to change their password. how would you do that?
13:07 crab (keeping in mind that i want admins to be able to post to the same thing in order to change other people's passwords, of course)
13:12 crab maybe i need to introduce a new bridge on /users/:id that checks for is_admin()||is_user_themselves() and put things under that?
13:19 crab left #mojo
13:19 crab joined #mojo
13:33 forwardever joined #mojo
13:36 baton8 left #mojo
13:42 mrSln1 joined #mojo
13:44 mrSln left #mojo
13:49 forwardever left #mojo
13:52 baton8 joined #mojo
13:56 memememomo_ is now known as memememomo
13:57 lee7 left #mojo
14:00 memememomo is now known as memememomo_
14:02 lee7 joined #mojo
14:07 forwardever joined #mojo
14:09 daviddelikat joined #mojo
14:23 tempire joined #mojo
14:27 snearch joined #mojo
14:48 tholen left #mojo
14:55 spleenjack left #mojo
15:06 kaare left #mojo
15:15 otaviof joined #mojo
15:16 crab foo
15:31 dotan joined #mojo
15:33 yko baz
15:37 crab yko: any opinion about my question above?
15:41 yko hmm
15:41 * yko didn't read it
15:41 yko :)
15:41 yko one momen
15:41 yko t
15:43 yko i suppose that 'check_user_is_logged_in' will return true on admin too
15:43 yko because admins are people (users) too. well, in most cases...
15:44 yko so i'd build /users/:theirownid/password after auth#check_user_is_logged_in bridge and would check if user is admin and changes another user's pass or it's user and changes own password
15:45 crab yes, check_user_is_logged_in returns true if anyone is logged in
15:45 yko but, actually i'd build separate routes for admin-changing-somebody's-password and for users-change-their-passwords
15:45 crab why?
15:46 yko hmm. because they are different. i'd have internal sub (not action) for change pass. for ex chpass($username, $pass, $repeat)
15:47 yko and two actions /admin/changepass and /profile/changepass that will be using chpass(...) after corresponding checks (rights, etc)
15:48 yko and even if we walk deeper along this foxhole, i'd suppose that i wouldn't allow admin to change somebody's pass, only preform some 'reset' operation, that will send pas to users email
15:49 yko but i think soon sri will wake up and say that i'm wrong
15:57 spleenjack joined #mojo
16:09 koban left #mojo
16:19 forwardever left #mojo
16:27 otaviof left #mojo
16:32 fhelmber_ joined #mojo
16:55 crab hmm. i want some examples of how to use MojoX::Validator
16:56 su-bzero_ crab: Try to see tests for MojoX::Validator at github.
16:58 crab yeah. that's what i'm reading.
16:58 und3f[A] is now known as und3f
17:23 yko left #mojo
17:23 su-bzero_ left #mojo
17:23 su-bzero joined #mojo
17:24 crab su-bzero: if i create a new MojoX::Validator, does it take param values from the request object by itself?
17:28 su-bzero crab: Don't know, you should kick vti for this kind of questions. /query vti
17:31 crab *** vti is away: I am not available
17:32 crab well, i'll soon find out.
17:33 ysyrota crab: try just /msg vti
17:37 ysyrota left #mojo
17:41 forwardever joined #mojo
17:44 und3f su-bzero, hello
17:45 dotan crab: you could read the source...
17:48 su-bzero und3f: Hello!
17:48 dotan crab: since MojoX::Validator is a subclass of Mojo::Base, it gets new() from there, and it doesn't populate anything automatically - you need to pass it the params in the call to validate
17:51 spleenjack left #mojo
17:51 forwardever the validator plugin uses $self->req->params->to_hash; see https://github.com/forwardever/mojox-validator/​blob/master/lib/Mojolicious/Plugin/Validator.pm
17:52 forwardever correct link (original vti) https://github.com/vti/mojox-validator/blob​/master/lib/Mojolicious/Plugin/Validator.pm
17:55 crab thank you!
17:55 crab i didn't realise there was a plugin.
18:00 dotan crab: yep, it lets you call validate from the app, and adds helpers
18:08 arthas left #mojo
18:09 dotan left #mojo
18:16 otaviof joined #mojo
18:19 otaviof left #mojo
18:27 alnewkirk joined #mojo
18:28 jamesw left #mojo
18:36 stephen joined #mojo
18:43 vel joined #mojo
18:43 spleenjack joined #mojo
18:49 tholen joined #mojo
18:59 tholen left #mojo
19:06 crab huh
19:07 crab so ::Validator wants to show users things like EQUAL_CONSTRAINT_FAILED. bah.
19:08 jamesw joined #mojo
19:09 forwardever crab: you can define custom error messages for each field, you can also customize error messages per type, see docs
19:11 crab where in the docs should i look? i didn't see anything about this.
19:11 forwardever e.g. $validator->field('foo')->l​ength(3,20)->message('Name can have between 3 and 20 characters, you entered 2');
19:13 forwardever a commit for better default error messages was rejected by vti, as he is looking for more clear programming I think ( https://github.com/vti/mojox-validator/pull/4)
19:14 forwardever crab: look under messages also: https://github.com/vti/mojox-validato​r/blob/master/lib/MojoX/Validator.pm
19:15 crab thanks.
19:15 forwardever e.g. my $validator = MojoX::Validator->new( messages => {REQUIRED => 'This field is required'});
19:58 sri yko is right
19:59 sri oh damn, he's not here :(
19:59 und3f hello
20:00 und3f sri, is it normal that Mojo::Client serves request 2 times longer with installed Epoll?
20:00 sri no idea
20:04 sri und3f: same with kqueue
20:05 sri IO::Poll uses quite a bit less real time for some reason
20:06 und3f :|
20:06 sri thats client side only i think though
20:07 sri my server benchmark makes kqueue look better than poll
20:08 sri und3f: it's only client right?
20:08 und3f sri, yes, just client
20:08 sri and it is a stand alone script?
20:11 crab sri: were you just saying yko is right to confound him, or was it an answer to my question about routes too?
20:12 sri both ;p
20:14 und3f sri, yes, tried on ojo oneliner
20:15 sri und3f: ok, no idea why
20:17 kvorg joined #mojo
20:17 und3f sri, "Just don't hold it that way" (c) Steve Jobs
20:18 rhaen moin
20:22 crab i don't think having two routes is right if i'm organising things RESTfully
20:23 fhelmber_ left #mojo
20:23 crab /users/32/password is the (write-only) resource representing user 32's password, and changing it means POSTing to it whether you happen to be the admin or user 32.
20:24 sri und3f: haha
20:26 sri und3f: a single connection is pretty much the worst benchmark for non blocking code though
20:53 avkhozov joined #mojo
20:53 avkhozov left #mojo
20:54 avkhozov joined #mojo
20:54 avkhozov left #mojo
20:55 MojoGuest310 joined #mojo
20:55 MojoGuest310 From: http://www.google.nl/search?sourceid=ch​rome&ie=UTF-8&q=websockets+demo (1 hits)
20:55 MojoGuest310 left #mojo
20:57 avkhozov joined #mojo
20:59 avkhozov left #mojo
21:05 crab my code works pretty nicely now. yum.
21:06 perlrocks Twitter: "If you planning to use #Mojolicious for fast HTTP requests don't forget to setup "timeout" of Mojo::IOLoop." --und3f http://twitter.com/und3f/status/5003742562754560
21:06 und3f sri, check-host checks now are ~200%-300% faster :)
21:10 ltriant joined #mojo
21:14 sri und3f: what did you change?
21:16 sri different ioloop timeout may cost more cpu
21:16 sri i think i know whats going on btw
21:17 und3f sri, i setup timeout to 0.01
21:17 sri kqueue and epoll don't react once sockets are connected
21:17 sri while poll does
21:18 und3f sri, with poll on all servers got no CPU overload
21:18 sri thats what i just said
21:18 und3f sri, it doesn't cost much cpu
21:19 und3f sri, average load is still at 0.0. CPU usage peak at 3%
21:20 sri 0.1 seems ok
21:20 und3f i use 0.01 :P
21:21 sri 1.3% cpu usage here
21:21 sri while idle
21:28 sri und3f: the timeout should only matter with epoll, not poll
21:30 vel left #mojo
21:30 und3f sri, put it does
21:30 sri must be platform specific then
21:30 und3f sri, check google.com on check-host. Before minimal time were 0.3 seconds
21:30 und3f sri, now 0.03
21:31 und3f sri, all servers are under Debian
21:31 sri that sucks
21:31 und3f debian sucks?
21:31 sri makes non blocking connect look really bad
21:32 sri seems so
21:32 und3f :|
21:32 sri if poll doesn't trigger a read on connected
21:32 und3f sri, same under gentoo..
21:32 und3f sri, seems like it doesn't
21:33 und3f sri, so packages like MojoX::Redis are worse than blocking variants
21:33 und3f in such case
21:33 snearch left #mojo
21:33 sri naah
21:34 sri if you keep a connection queue it's no problem
21:34 sri you don't use a fresh conenction for every command do you?
21:34 sri then you would be screwed anyway
21:37 und3f sri, every command on same connection
21:37 und3f sri, one instance of MojoX::Redis mean one connection
21:37 sri then you rarely connect anyway
21:38 und3f sri, for web app i connect on every request
21:38 sri oh, thats very bad
21:38 und3f sri, because connections are dropped by timeout
21:38 und3f by Redis server
21:38 sri set a higher one
21:39 und3f thats for me, not for all users..
21:39 sri ?
21:41 und3f sri, must i write in MojoX::Redis documentation that this module will slow down request on every connection, so don't drop connection with Mojo server?
21:42 sri umm, thats should be common sense
21:42 sri connect is never cheap
21:43 und3f but with Mojo it is 10-20 times expensively
21:44 sri ...
21:44 und3f :(
21:44 und3f Don't hold it that way!!!
21:44 sri for almost half an hour i'm trying to explain it to you :S
21:44 * sri gives up
21:45 und3f :)
21:47 und3f i could add timer with ping command to MojoX::Redis to support connection
21:47 crab sri: you use riak, right?
21:47 crab or were you just playing with it?
21:48 sri just playing
21:48 sri but i will use it for a big project in january
21:54 crab do you have to talk to it via http? (persistent connection?)
21:57 GitHub7 joined #mojo
21:57 GitHub7 mojo: master Sebastian Riedel * b3302dd (1 files in 1 dirs): improved responsiveness of Mojo::IOLoop - http://bit.ly/9KXkht
21:57 GitHub7 left #mojo
21:58 sri thats should be a more sensible default
21:58 sri crab: yes
21:58 sri und3f: 0.01 is a little too fast
22:01 crab hm. what a strange thought.
22:04 sri strange thought?
22:04 MojoGuest189 joined #mojo
22:04 MojoGuest189 heya
22:04 crab yeah. to be using HTTP to talk to the data store.
22:04 sri how so?
22:04 MojoGuest189 does this client connect directly to irc server or go through gateway?
22:05 sri gateway
22:05 MojoGuest189 ok
22:05 crab sri: in the sense that it's foreign to me, not that it's bad.
22:05 sri ah
22:06 MojoGuest189 /whois sri
22:06 MojoGuest189 :<
22:06 sri i like using http for talking to databases a lot
22:06 MojoGuest189 /leave
22:06 MojoGuest189 left #mojo
22:06 sri makes testing and stuff very very easy
22:07 sri all you need is curl basically or a mojo oneliner
22:08 perlrocks Twitter: "Thanks to @kraih #Mojolicious IOLoop is much sensible now by default." --und3f http://twitter.com/und3f/status/5019364453515265
22:08 und3f I love to twitt :P
22:08 crab riak looks approximately the nicest of the various nosql things i've looked at. i think i'll investigate it more deeply soon.
22:08 sri und3f: you mean tweet ;p
22:08 und3f sri, right :P
22:08 sri !tweet i love to tweet!
22:08 perlrocks sri: http://twitter.com/perlroc​ks/status/5019534788403201
22:08 crab maybe find something i can use it for, though not having a "proper" schema is also strange to me.
22:09 sri crab: riak-search is the most awesome thing i've seen in the no-sql world yet
22:09 crab yes, it looks nice.
22:10 sri a http based key/value store with fulltext indexing and dead simple scaling
22:10 sri seems pretty flawless to me :)
22:11 und3f i need to sleep
22:11 und3f for sure i need to sleep
22:11 sri sleep is for the weak
22:11 und3f strong one uses timer?
22:11 und3f instead of sleep :)
22:11 sri !
22:12 und3f but i need to sleep
22:12 crab i think i'll miss joins very much
22:12 sri !tweet sleep is for the weak, the strong ones use a timer! #perl #mojolicious
22:12 perlrocks sri: http://twitter.com/perlroc​ks/status/5020566754951168
22:12 perlrocks Twitter: "sleep is for the weak, the strong ones use a timer! #perl #mojolicious --sri" --perlrocks http://twitter.com/perlroc​ks/status/5020566754951168
22:13 sri crab: you can link values in riak
22:14 sri you get a header pointing to the linked values then
22:14 memememomo_ is now known as memememomo
22:15 memememomo is now known as memememomo_
22:15 sri crab: https://wiki.basho.com/display/RIAK/Links
22:16 sri you can build all kinds of structures with that
22:17 sri you can join them with a special REST query into a single multipart response :)
22:17 sri http://blog.basho.com/2010/02​/24/link-walking-by-example/
22:18 crab like i said, i won't miss joins at all.
22:18 crab ;-)
22:18 sri :D
22:18 sri i've recently made an optimization to Mojo::Client specifically for that
22:18 sri it now tries much harder to keep multipart data in memory
22:24 daviddelikat left #mojo
22:43 forwardever left #mojo
22:48 und3f good night
22:48 und3f is now known as und3f[A]
22:52 stephen Here's an inane question.
22:52 stephen Right now I'm running Mojolicious in standalone mode.
22:52 stephen Everything's single-threaded.
22:53 stephen Is there a way to run it (with another web server, etc.) so that multiple requests can be handled at the same time?
22:54 sri the standalone server is non blocking
22:54 sri it can handle multiple requests at the same time
22:54 stephen OK, so it's probably a CPU-binding issue I'm running into.
22:54 sri are you using DBI?
22:54 stephen DBIx::Class
22:55 sri there's your problem :)
22:55 sri DBI blocks everything
22:55 stephen Possibly, but that's not what I'm seeing.
22:55 sri yes, for DBI a different kind of server makes more sense
22:56 sri something like Apache/FastCGI or Starman
22:56 sri a one request per worker server
22:57 stephen It's not the DBI-heavy queries that seem to be causing a problem. It's ones that access the file system.
22:57 sri thats blocking too
22:57 sri you could use MojoX::AIO though to make those non blcoking
22:58 sri using a more stupid server might be easier though
22:58 stephen (reading docs)
22:59 sri any blocking syscall will block the standalone server
23:00 stephen Right.
23:03 stephen Would running with daemon_prefork help?
23:04 sri daemon_prefork is dead
23:04 stephen So it goes.
23:04 stephen So psgi or fastcgi are the way to go?
23:04 sri hypnotoad wouldn't help you either, since it is a pool of non blocking workers
23:05 sri yea, some old school stupid prefork server
23:05 sri one request per process
23:06 stephen Awright, thanks, I'll look into that.
23:10 sri actually hypnotoad can be configured that way... but you'll be better off using blocking syscalls exclusively
23:10 sri like Starman does
23:13 sri this is really where http databases like riak shine
23:13 crab how is hypnotoad going?
23:13 sri slowly, still some problems i need to meditate about
23:14 sri but getting there
23:17 stephen Reading about psgi/plack
23:19 sri should be as easy as "starman script/myapp"
23:20 sri unless your script is horribly outdated, in which case you'll have directory detection problems
23:22 stephen Somewhat, but I can update it.
23:22 sri many psgi servers seem to break $0 sadly :S
23:24 vel joined #mojo
23:27 vel left #mojo
23:35 spleenjack left #mojo

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