Camelia, the Perl 6 bug

IRC log for #mojo, 2012-11-13

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

All times shown according to UTC.

Time Nick Message
00:04 marcus joined #mojo
00:12 SmokeMachine_ joined #mojo
00:58 laouji joined #mojo
01:07 hlin joined #mojo
01:17 Mike-PerlRecruiter_ joined #mojo
01:43 cafe__ joined #mojo
01:58 d4rkie joined #mojo
03:00 motoboi joined #mojo
03:03 duncanthrax joined #mojo
03:30 noganex_ joined #mojo
03:54 Foxcool joined #mojo
05:24 Vandal joined #mojo
06:09 spleenjack joined #mojo
06:49 dpetrov_ joined #mojo
06:56 yakudza joined #mojo
07:09 Molaf joined #mojo
07:19 coff joined #mojo
07:35 dod joined #mojo
07:45 mire_ joined #mojo
07:55 batman joined #mojo
08:03 dod joined #mojo
08:10 nicomen joined #mojo
08:12 dod joined #mojo
08:24 fhelmber_ joined #mojo
08:46 Vandal joined #mojo
08:47 batman joined #mojo
09:05 dod1 joined #mojo
09:15 dod joined #mojo
09:23 cosmincx joined #mojo
09:25 Averna joined #mojo
09:44 Britzel_ joined #mojo
09:46 mire_ joined #mojo
09:47 mire__ joined #mojo
10:02 Vandal joined #mojo
10:49 dod joined #mojo
10:52 Vandal joined #mojo
10:57 sr joined #mojo
10:59 dotan joined #mojo
11:08 dod joined #mojo
11:29 chesti joined #mojo
11:29 chesti hi
11:30 chesti can someone tell me what i`m missing, i have db connection problem
11:31 chesti after some time my mojolicuios app lose connection to database execute failed: MySQL server has gone away
11:31 chesti how to prevent it?
11:32 chesti i thought DBI  connect_cached will handle that bit it`s not
11:32 batman chesti: use DBIx::Class
11:32 batman chesti: you need catch that error and then reconnect
11:33 batman i've struggle with it many times. DBIC fixes all that and a ton of other weird things
11:33 chesti can you point som web documentation?
11:33 batman https://metacpan.org/module/DBIx::Class
11:34 batman if you -only- want to catch that single problem you need to set $dbh->{RaiseError} = 1; put every db thingy inside eval, check for the exception message and then reconnect and retry what you just did.
11:34 chesti hmm i se that`s an object mapper for db
11:34 batman that is pure evil. i like to use evil that other has made for that. not my own
11:35 batman chesti: it's much more. it's a fix-many-weird-mysql-bugs-layer as well
11:35 chesti :D
11:35 chesti nice to know...
11:35 batman chesti: if you don't want to use the mapper, then you can always do my $schema = DBIx::Class->connect(...); $schema->storage->dbh_do(sub { my($storage, $dbh) = @_ ... });
11:36 batman dbh_do() wraps up all the evilness, so you don't have to
11:36 batman it's worth it. trust me.
11:36 Britzel_ chesti: Take a lokk at DBIx::Class, it's worth doing so. BTDT 1 year ago and never looked back, never wrote a line of SQL since then.
11:36 Britzel_ Ok, it's a steep learning curve if you have never used an ORM, like me.
11:36 batman Britzel_: and life is good.
11:37 Britzel_ batman: indeed :)
11:37 chesti thats true, i never did ORM before...
11:37 batman chesti: start with the basics: install it, and use dbh_do(), then go on with the documentation
11:37 chesti i`ll do that...
11:38 Britzel_ Once you get the hang of it, you will never give it away again. Especially if it comes to related table with foreign keys and such.
11:38 chesti hope i won`t need such complication in my project
11:38 chesti ;)
11:39 chesti i see that i have to switch to that
11:39 batman indeed. i never can remember how to do join in mysql <=> sqlite <=> postgresql
11:39 chesti always something to learn... that will kill me someday :)
11:39 batman chesti: do you like to admin your database or make programs?
11:39 batman chesti: that is true. we all die, but let's have a bit of fun on the way there ;)
11:40 Britzel_ what? Learning is the best part of life :) I love learning something new... and I do so nearly every day.
11:41 Britzel_ Ok, it's not _the_ best part of life, but one of the better parts :)
11:41 batman Britzel_: haha
11:43 chesti i like to amin my system, databases and programmming are only an add
11:44 chesti yes laerning is the best part of life but to appreciate it you have to have some brake
11:45 batman chesti: ok. i like to program. that's why i like DBIC so much: it helps me to program instead of worry about the database.
11:45 batman (even if you like databases it helps you)
11:46 chesti if it works for you than it should for me as well
11:46 chesti i feel convinced
11:47 batman chesti: best thing i've heard in a while: "if it works for you than it should for me as well"
11:47 batman that's amazing! :)
11:47 chesti one thing i`m affraid of is that if i can compile it easly
11:48 chesti i see dependences list of this module is quite big
11:48 batman chesti: do you use "cpanm" ?
11:48 chesti not on a environment without direc internet connection
11:48 batman oh. that sucks.
11:48 chesti i have to copy, than install
11:49 batman chesti: what os are you on?
11:49 chesti that`s why i picked mojo
11:49 chesti it`s dependences free
11:49 chesti redhat
11:50 batman ther should be a package for dbic on redhat... can you search with yum for dbix-class or something?
11:50 bobkare dbic seems cool as long as you only want trivial SQL. I know a bit too much SQL so to me it's a horrible pain since it always seems to stop me from just doing the query I know will do what I want
11:51 batman bobkare: that's not true. you can do any sql with dbic
11:51 batman bobkare: $schema->resultset('User')->search(\ "MY RAW SQL");
11:51 batman i think you're wrong, but i won't spend time discussing that
11:52 bobkare I seem to recall something about that not working very well since the result then didn't look like it expected
11:52 coff Perhaps DBIC has some 'general resultset' container it can throw random queries into?
11:53 batman chesti: the package is named "perl-DBIx-Class" (i think...)
11:53 bobkare a resultset doesn't necessarily have the same structure as any of my tables
11:53 chesti i`ll find it
11:53 batman coff: yeah. just define whatever you want inside __PACKGE__->table(...);
11:53 chesti tx
11:54 batman bobkare: that's insane if the resultset doesn't match you table or view.
11:54 batman bobkare: but it's your problem. i need to get some work done here.
11:54 chesti joined #mojo
11:54 bobkare no, it's not my problem. I simply ditched dbix and went for something simpler
12:06 chesti joined #mojo
12:06 chesti re
12:06 chesti i looked at  DBIx::Class package
12:06 chesti and i see that has also many dependences...
12:07 chesti that`s sux
12:08 chesti so that will require time to implement...
12:09 ver joined #mojo
12:11 nicolaas joined #mojo
12:12 nicolaas hello .. do you know if there is a built in way to render partially all templates of a subfolder ?
12:13 Vandal joined #mojo
12:14 batman chesti: can't use dbic if you're afraid of dependencies :(
12:26 Vandal joined #mojo
12:27 mire__ joined #mojo
12:33 motoboi joined #mojo
12:38 lammel2 joined #mojo
12:40 chesti batman: i eraly afraid to use it when i look on dependencies either package or sources...
12:40 Britzel_ chesti: When you need to install it manually, yes, that would be a pita. But who does this?
12:41 chesti i do...
12:41 Britzel_ No chance to connect the box temprarily to the net?
12:41 Britzel_ +o
12:41 chesti on a secure environment i have no option to get conncection
12:42 chesti outside
12:42 Britzel_ I see
12:42 chesti now i have only :
12:42 chesti perl + mojo+ DBI installed there
12:43 chesti perl is new, system one was too old for mojo
12:43 Vandal joined #mojo
12:44 Britzel_ CPAN and all it's modules are at the core of Perl. It has saved me tons of time over the years.  Installing modules by hand is a major PITA, but when that#s your situation you only have two options: Do it and live through the pain, or refrain from using that module and capture the connection failures manually.
12:44 chesti do you recall any workaround for DBI itself to make it reconectable?
12:45 Britzel_ You could tkae a look at DBIx::Class source and see how its done there. Otherwise, no I don't recall, because I use it as a black box. It just works. (i.e. reconnects on loss of connection).
12:45 Britzel_ *take
12:45 sri just use your own minicpan mirror
12:47 chesti i`m looking at mysql_auto_reconnect option for DBD::mysql
12:47 chesti but i`m not sure if that will work ok with mojo
12:48 cosimo joined #mojo
12:48 Britzel_ Why should Mojo bother? it's totall DB agnostic.
12:49 chesti yes but if i open connection by DBI it last
12:49 chesti until mojo server is up
12:50 Britzel_ I get my DB scheme from a Mojo helper, which in turn uses DBIx::Class->connect(ion). You could encapsulate the auto reconnect stuff tehre and return a stored handle when connection is available, or reconnect and return the new handle.
12:50 chesti hmm ok
12:50 Britzel_ You have to consider the deployment case, which server will yourapp run under? Is it preforking like with Hypnotoad? In that case you must make your DB handles fork aware.
12:50 * sri wonders when cpantesters will be back
12:50 Britzel_ Lemme see if i can find the link...
12:51 chesti i`ll write check inside handler
12:51 Britzel_ chesti: http://toroid.org/ams/etc/mojolicious-db-handles
12:51 chesti it`s morbo now but later i plan to use hypnotoad
12:53 chesti that link you paste
12:53 chesti thats most like i do that
12:53 chesti but it last some time and while inactive connection is dropped and would not reconnect
12:55 Britzel_ DBIx::Class connection does ping the SQL server, AFAICR. So it checks if the connection is still up, and reconnects on failure. You would have to do that or something similiar, I would say.
12:56 nic chesti: relying on a db connection that you've left open is dangerous
12:57 nic it's only safe if you _never_ use compound transactions (BEGIN .. COMMIT)
12:58 murray joined #mojo
12:58 chesti i think so
12:58 chesti what`s starnge i thought that connection_cached will do it for me...
12:59 chesti in doc there is : "The cached database handle is replaced with a new connection if it has been disconnected or if the ping method fails."
12:59 chesti i need only to do soem selects
12:59 chesti and display it on website
12:59 nic if you're only doing selects then using auto-reconnect is safe
13:00 nic ie all you need is plain ol' DBI with the auto-reconnect option
13:02 d4rkie joined #mojo
13:03 Vandal joined #mojo
13:08 murray Hi.  I'm trying to learn a bit & build myself a mojolicious server that will handle HTTP CONNECT methods … with a view to playing with a mojolicious server that can act as an ssl proxy.  I've been googling and such, but coming up a bit blank (googling for "http connect" tends to find the wrong thing).  Any pointers?
13:08 batman what is HTTP CONNECT?
13:09 murray http://www.ietf.org/rfc/rfc2817.txt
13:09 Britzel_ murray: see https://github.com/kraih/mojo/wiki under deployment
13:09 murray Britzel_: thanks
13:15 murray Britzel_: So I'm thinking I most likely want to implement "websocket" controller, and have that read the incoming "request" and then implement whatever it wants to do with that?  Aka, Mojo's "websocket" lets you write a more generic server that listens on a port … where as get/post etc sit above that, and give you the http bits, above and beyond the simple tcp socket connection.  Or have I totally mis-understood you?
13:16 murray … off to read the src for web sockets and see what I can learn …
13:16 sri unless you understand the protocol basics you're gonna have a bad time
13:16 sri websockets != sockets
13:16 duncanthrax_work joined #mojo
13:17 murray sri: right .. I'm off to try and educate myself on web sockets some more.  :)
13:17 sri Mojo::UserAgent has correct CONNECT handling for HTTPS proxies, on the server side there is no high level api
13:17 sri you can prolly chain together low level apis to do it, but that requires *a lot* of knowledge
13:18 Mike-PerlRecruiter_ joined #mojo
13:18 murray sri : sure, but I want that, plus the other side : I want to write my own mojo server that another Mojo client could connect to and send CONNECT req's
13:18 murray this may be insane .. i'm likely guilty of many newbie traps, but that's what I'm trying to educate myself about further
13:19 murray writing the server to let clients CONNECT to … not the other half of that, being the Mojo::UserAgent which I know already has the full support for making the ssl connections.
13:19 sri so far i've only built CONNECT proxies on the lowest level
13:19 murray sri: ok, thanks .. at least I know I'm not just failing to google the obvious / simple answer :)
13:20 sri i would link to it, but github seems down
13:20 murray github up for me, fwiw
13:20 sri it's included in the examples directory
13:20 murray tho no use, if you need to find the link :)
13:20 murray gotcha, I have a clone of the mojo.git will go hunt
13:20 murray thanks
13:20 sri connect-proxy.pl
13:21 nic https://github.com/kraih/mojo/blob​/master/examples/connect-proxy.pl
13:21 sri hmm, from here github is unreachable :S
13:22 nic they've disconnected you from all the dangerous stuff till your new mac settles down
13:22 murray yay for distributed websites ;)
13:23 sri last hop is xe-1-0-1.er1.iad10.us.above.net, then it goes dark
13:23 nicolaas sorry to ask again (just in case) : is there a way to render partially all templates of a subfolder ? or should i iterate over them with a file browser function ?
13:24 sri my new mac is not here yet :/
13:24 sri should arrive during the next 3 hours
13:25 nicolaas sri: what model ?
13:25 sri macbook air 13"
13:25 nicolaas cool !
13:25 sri yes \o/
13:26 nicolaas but i found out it wasn't very comfortable to write code on portable computers
13:26 nicolaas laptops *
13:26 nic they're good for looking at pictures tho
13:26 nicolaas :)
13:26 * sri has been writing all his code on laptops since 2003
13:27 nic sri: If you'd been using a real computer you'd have had all that finished round about 2009
13:27 batman sri: me to.
13:27 nic then three years of holiday spending the money you saved
13:27 batman only one of my 20 co-workers get it :)
13:52 nic chesti: Don't pass options to DBD::mysql directly unless you really have to
13:55 chesti what i should be aware of...?
14:03 batman i'm using rand in my code. do i need to run srand in each fork to make a new seed?
14:05 avenj batman: yes, I believe so
14:05 batman ok
14:06 avenj .. for certain definitions of "need" I guess, but they'll share seeds if srand() isn't called, yes
14:06 graf see https://metacpan.org/module/​Mojolicious::Plugin::OnFork
14:06 batman thanks
14:11 sh4 joined #mojo
14:13 mire__ joined #mojo
14:19 * sri would advice against using Mojolicious::Plugin::OnFork
14:21 sri macbook air arrived \o/
14:21 * sri will be away for "a bit"
14:21 lammel2 happy unwrapping... seems like it's christmas already for some ;-)
14:24 graf sri: technical reasons or just offended?
14:28 Vandal joined #mojo
14:35 chesti joined #mojo
14:38 ruz joined #mojo
14:41 nic there are never any technical reasons
14:41 nic not really
14:45 yakudza joined #mojo
14:45 Vandal joined #mojo
14:46 sh4|2 joined #mojo
14:52 Vandal joined #mojo
15:00 mattastrophe joined #mojo
15:04 baton8 joined #mojo
15:53 memowe_ joined #mojo
15:54 knshaum joined #mojo
15:57 marty joined #mojo
15:59 chesti bye
15:59 chesti end of workday :)
16:22 xaka joined #mojo
16:38 mire__ joined #mojo
16:52 rem_lex| joined #mojo
17:16 baton8 joined #mojo
17:19 dod joined #mojo
17:37 * sri loves his new macbook air
17:37 sri full mojolicious test run went from 23 to 13 seconds
17:40 sri oh, and my standard mojolicious rps test went from 1700 to 2800 :)
17:42 sri actually, closer to 3000 :)
17:43 Adura You made the code more efficient because of your Mac...!
17:49 jayallen joined #mojo
17:52 sri gotta love how it's not even getting warm after 30 minutes of compiling stuff
17:53 sri i got the sandforce ssd though, so no filevault :S
18:02 coff joined #mojo
18:46 inokenty joined #mojo
18:53 batman joined #mojo
18:57 tempire sri: which hdd?
18:58 sri tempire: toshiba 128gb
18:59 sri it's faster than the samsung without encryption though
19:05 dpetrov_ joined #mojo
19:14 marty joined #mojo
19:31 GabrielVieira joined #mojo
19:35 xaka joined #mojo
19:37 dpetrov_ I have an helper which authenticate the user and return the user or render an error otherwise
19:38 dpetrov_ is it safe in my function to call just my $user = $self->authenticate ?
19:38 dpetrov_ or that make no sense
20:16 sh4 joined #mojo
20:24 mire__ joined #mojo
20:30 Polarn joined #mojo
20:31 marty dpetrov_:  That sounds risky to me.  I think you might want to return true or false and test for success before setting the username.
20:32 marty dpetrov_:  Here is a good example of how to do authentication.   http://search.cpan.org/~madcat/Mojoli​cious-Plugin-Authentication-1.14/lib/​Mojolicious/Plugin/Authentication.pm
20:33 vel joined #mojo
20:34 marty sri: congratulations on your new mac air.  \o/
20:35 lukep joined #mojo
20:39 dpetrov_ marty: thanks
20:39 dpetrov_ sound risky to me as well
20:40 sri marty: thanks \o/
20:42 dpetrov_ sri: is at an air or pro?
20:42 sri air
20:42 dpetrov_ that's just a new one right? you have already so it wont make sense to ask if you like it :)
20:43 sri best computer i've ever owned
20:43 sri had a pro before
20:44 dpetrov_ isnt the display little too small or the great resolution makes it enough
20:44 dpetrov_ (I am thinking buying one of those)
20:44 sri i've had a 13" before too, works best for me
20:44 dpetrov_ okey :) thanks
20:51 rem_lex|pivo joined #mojo
21:00 batman https://metacpan.org/source/SRI/Mojolici​ous-3.57/lib/Mojolicious/Routes.pm#L165 <-- would it be an idea to do die $@ instead of die $e?
21:01 batman i'm getting die 1; when the module could not be found...
21:13 xaka joined #mojo
21:19 sri batman: umm, why would "1" be a ref?
21:19 sri batman: make a test case to prove that your solution is better
21:21 sri die $@ seems completely pointless
21:24 batman weird indeed
21:24 batman checking it out now
21:25 batman maybe it got ancient mojo @work
21:26 batman no... that's not it
21:28 batman not sure why i got die 1; earlier
21:28 batman can't seem to reproduce it :(
21:28 sri perhaps a real "die "1\n";"
21:29 batman no, it was because i was trying to load a module which did not exist
22:28 dabudabu joined #mojo
22:45 motoboi joined #mojo
22:52 DaTa fuck google
22:54 xaka DaTa: because n4 is sold out? )
22:55 jzawodn joined #mojo
22:56 DaTa no, because google groups requires me to login
22:57 memowe joined #mojo
22:58 DaTa ok, signing out completly works
23:18 jayallen joined #mojo
23:23 Adura joined #mojo
23:26 Adura joined #mojo
23:39 Averna joined #mojo
23:52 good_news_everyone joined #mojo
23:52 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/U5LSRg
23:52 good_news_everyone mojo/master 4a0d212 Sebastian Riedel: tweaked example
23:52 good_news_everyone left #mojo

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