Camelia, the Perl 6 bug

IRC log for #mojo, 2013-08-07

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

All times shown according to UTC.

Time Nick Message
00:11 dvinciguerra joined #mojo
00:12 asarch joined #mojo
00:16 jberger joined #mojo
00:25 shmuel joined #mojo
00:51 egopro joined #mojo
01:34 amirite_ joined #mojo
01:52 bc547 joined #mojo
01:58 d4rkie joined #mojo
02:13 amirite joined #mojo
02:18 amirite joined #mojo
02:57 dvinciguerra joined #mojo
03:35 basic6 joined #mojo
03:39 preflex_ joined #mojo
03:44 StinkfooT joined #mojo
04:15 dqw joined #mojo
05:07 dotandimet joined #mojo
05:15 egopro joined #mojo
05:22 egopro joined #mojo
05:44 Britzel joined #mojo
06:06 dotandimet joined #mojo
06:41 denisboyun joined #mojo
06:41 amirite_ joined #mojo
06:41 dpetrov_ joined #mojo
06:46 amirite joined #mojo
06:54 d4rkie joined #mojo
06:57 egopro joined #mojo
06:57 Britzel joined #mojo
07:14 nicolaas joined #mojo
07:16 basiliscos joined #mojo
07:20 trone joined #mojo
07:40 denis_boyun joined #mojo
07:54 denis_boyun__ joined #mojo
07:57 arpadszasz joined #mojo
08:03 dod joined #mojo
08:27 sh4 joined #mojo
08:42 basiliscos joined #mojo
08:54 alnewkirk joined #mojo
08:56 bd i am writing a tiny webfrontend for cisco switches, modificationon the switches is done using telnet. i'd like to reuise existing telnet sessions and not open a new one for each request
08:58 bd is there a place where i can keep thos net::telnet::cisco objects, becaus IIUC when I use them in a controller they get deleted once that actionahs finished
09:00 bd would something like app->helper(cisco => MyTelnetCollection->new();) work?
09:03 nic What about having the MyTelnetCollection as an attribute (of the app)?
09:05 buu bd: How are you running the app?
09:07 bd buu: daemon or morbo
09:07 bd buu: i'd be fine if forks would have "duplicate" connections
09:07 buu ah
09:08 buu bd: I mean its all just perl, right? Just stick the connection in a global someplace
09:09 bd nic: so the app object only gets instanciated once, right?
09:10 nic hmm, well, if you're running hypnotoad with 4 children, it gets instantiated 4 times initially, and then every time a child restarts
09:10 SmokeMac_ joined #mojo
09:11 bd ok, thats fine too. i guess I use an attribute then
09:19 ver joined #mojo
09:20 KindTwo joined #mojo
09:26 sri nic: that's incorrect, it gets instantiated once in the manager process before any workers have been spawned
09:26 KindTwo joined #mojo
09:26 nic sri: but isn't it lazy evaluation?
09:27 nic so it's not instantiated till the first request
09:27 sri that's incorrect
09:27 nic I must have misunderstood how attribute defaults work then
09:28 sri the documentation also says that hypnotoad preloads the application
09:29 nic yep, that doesn't tell us anything about attribute defaults being instantiated though
09:29 sri nobody asked a question about attribute defaults
09:29 nic It depends how you read the question
09:30 sri "nic: so the app object only gets instanciated once, right?"
09:30 nic I think you're reading 'app object' as the object of the app rather than the object we've been discussing _in_ the app
09:32 dod joined #mojo
09:39 sri bd: so what did you mean?
09:40 dod joined #mojo
10:02 bd sri: i am not sure anymore ;)
10:10 dod joined #mojo
10:31 denisboyun joined #mojo
11:00 avkhozov joined #mojo
11:06 maxhq joined #mojo
11:07 bowtie_ joined #mojo
11:33 dqw joined #mojo
11:58 Vandal joined #mojo
12:09 dqw2 joined #mojo
12:18 denis_boyun joined #mojo
12:27 olav joined #mojo
12:39 asarch joined #mojo
12:40 espent joined #mojo
12:48 fhelmber_ joined #mojo
12:57 rem_lex joined #mojo
13:08 dvinciguerra joined #mojo
13:12 ladnaV joined #mojo
13:17 d4rkie joined #mojo
13:19 dqw joined #mojo
13:21 andrefs joined #mojo
13:40 alester joined #mojo
13:43 Britzel_ joined #mojo
13:47 * marty waves
13:49 espent joined #mojo
13:52 bd sri: so the original problem I want to solve is, my tiny app makes telnet connections to cisco switches. now I'd like to reuse these connections and where do I have to "put" these objects so that they don't get deleted once the request is done
14:08 arthas joined #mojo
14:11 gryphon joined #mojo
14:22 batman i'm doing basic auth and it works nicely, but sometimes it looks like the browser does not send the Authorization header.
14:22 batman any idea what might cause that?
14:23 batman i have nginx in the middle, but i don't see how the server matter since this is the request headers...
14:24 dotandimet joined #mojo
14:30 btyler joined #mojo
14:39 dod joined #mojo
14:51 bluescreen joined #mojo
15:14 hotsnow joined #mojo
15:18 hotsnow I use mojo template to with js to alert msg with url, it seems that it will chang the url encode. for example  '&' will change to &
15:22 arpadszasz joined #mojo
15:28 diegok batman: your browser is chrome?.. I think it happen to me some times.... just telling me 403 without asking me again for user/pass...
15:28 diegok ^ till I've hit refresh
15:32 batman i think it's some internal cache thingy... maybe it won't send the Authorization until i've asked for it...
15:32 batman not sure
15:33 batman i made a work around, so i will never know
15:37 amirite_ joined #mojo
15:42 amirite joined #mojo
16:16 tempire where's the module that determines whether to use EV or not
16:19 basiliscos joined #mojo
16:20 tempire ah, Mojo::Reactor
16:22 btyler joined #mojo
16:36 rem_lex|pivo joined #mojo
16:44 amirite_ joined #mojo
17:06 basiliscos joined #mojo
17:17 amirite joined #mojo
17:22 amirite_ joined #mojo
17:33 dvinciguerra joined #mojo
17:36 dotandimet joined #mojo
17:37 sri tempire: MANGOCAST!
17:38 tempire I just started working in Perl this week at work.
17:38 tempire No more javascript.
17:38 * sri wonders if he should promote mojolicious, mango and the yet to be named job queue as a full stack solution
17:38 tempire So it's possible I will regain some motivation for technology.
17:38 sri Oo
17:39 * tempire knows nothing of this upcoming job queue
17:40 maxhq joined #mojo
17:40 sri app->thingy->enqueue('MyApp::Jobs::Foo' => 23); package MyApp::Jobs::Foo; use Mojo::Base 'Thingy::Job'; sub run { my ($self, $num) = @_; ... }
17:40 sri the most minimalsitic job queue you can imagine, backed by mango
17:42 sri mojo thingy worker mongodb://127.0.0.1:27017/thingy
17:43 sjn joined #mojo
17:43 sri it's such a common problem with mojolicious being evented, having something that just works will be nice
17:44 sri and i get to design a pretty dashboard :)
17:47 sri getting workers to manage themselves is quite fun
17:51 sri only problem i have atm is synchronizing time
17:51 sri the mongodb command to get the server time is sadly serverStatus... which is disabled on mongohq :(
17:54 stephan48 sri: sounds cool
17:56 sri eval command would also work, to get the time through javascript on the server... but also disabled :S
17:56 trone joined #mojo
17:57 stephan48 you mean the server time of the mongodb srv?
17:57 sri yes
17:58 sri without a synchronized time you can't have timeouts
17:58 stephan48 maybe make it possible to change the way how its retrieved and ask mongohq nicely to provide an alternative cmd?
17:58 asarch joined #mojo
17:58 sri that's not how it works
17:59 stephan48 in what regard?
18:00 sri in every regard
18:01 sri you seriously think mongohq will patch all their sandbox servers to add a proprietary command because i asked nicely?
18:01 btyler joined #mojo
18:02 sri and all the other free mongodb hosters will do the same?
18:04 tianon but... but... you're THE sri!  they'
18:04 tianon ll do it if YOU ask!
18:04 tianon you probably wrote the core of their backend web servers, right? :)
18:06 stephan48 sri: an other advantage could be that the user could override the retrieval sub, that in this cases they could just return the local time... instead having ntp or other means taking care of syncing the time
18:07 sri i'd rather find a clever solution that always works
18:08 stephan48 okey
18:09 sri and i think i have one
18:10 sri i let the server generate an _id field and extract the time from that value
18:13 sri only downside is that it's 3 operations
18:13 sri insert/find_one/delete
18:21 bluescreen joined #mojo
18:22 btyler reading some log, re promoting mojolicious/mango/to-be-named job queue as a full stack...yes! totally!
18:24 btyler a 'batteries included' modern web stack in perl would be pretty awesome, imo
18:30 tm joined #mojo
18:32 sri ah
18:33 sri when you insert a bson_ts(0,0) it sets the second value to the current server time
18:33 sri no need to count on the auto generated oid
18:33 sri still 3 operations though
18:34 sri but doing it every few seconds to sync shouldn't be too bad
18:34 sri oooh
18:35 sri i could actually use an update operation and set it on the document representing the current worker!
18:35 sri update the timestamp to a new 0,0 one
18:37 sri awww
18:37 sri doesn't work on update :(
18:38 denisboyun joined #mojo
18:38 sri it's a planned feature
18:39 sri $collection->update({_id => $oid}, {'$set' => {heartbeat => bson_ts(0, 0)}});
18:39 sri that would have been pretty sweet
18:40 mire_ joined #mojo
18:43 tm left #mojo
18:44 dotandimet joined #mojo
18:45 sri btyler: other question is how to promote it, perhaps a few recipes in the mojolicious guides
18:47 dotandimet joined #mojo
18:47 sri i don't want to go too crazy with recipes using 3rd party modules in core
18:48 sri on the other had are both spinoff projects... not really 3rd party
18:49 btyler yeah, for sure. I think the biggest thing is having a few fairly complete and nice looking demo apps. I know when I started looking at mojolicious, it was an experience of "woah this is super awesome, I wonder what an app built with this looks like"... I went searching, and the only example I could find was an (admittedly nifty) app for showing photos from international cat shows
18:49 sri the job queue dashboard could actually be an example app
18:50 btyler sounds cool to me - plenty of opportunities for real-time goodness
18:50 sri real-time stats, restarting jobs
18:52 sri https://jira.mongodb.org/browse/SERVE​R-1650?page=com.atlassian.jira.plugin​.system.issuetabpanels:all-tabpanel # only planned for 2.7 :(
18:54 btyler mojolicious/mango/queue + some perl-to-javascript compiler and you're 2/3rds to meteor in perl, heh
18:54 btyler except with sane server code
18:58 sri guess 3 operations to get the server time is not too bad if i only sync every 5 mins or so
19:00 sri oh, there's a simpler solution actually
19:01 sri i let all workers update a heartbeat value in their status document, and all other workers keep track of it, and when it doesn't update for a few minutes the worker is dead and gets cleaned up by the first to notice
19:02 sri the workers themselves use Mojo::Util::steady_time so local time jumps don't matter
19:02 sri \o/
19:06 sri no wait, jumps forward in time can still mess things up :/
19:11 hesperaux joined #mojo
19:16 rem_lex| joined #mojo
19:40 kthakore sri: what is the default timeout for websockets? They seem to close so quickly to me. And then I have to restart it a lot
19:57 espent joined #mojo
19:58 amirite joined #mojo
20:02 sri http://pastie.org/8216291 # guess i'll go with something like this to get the server time until they add something better
20:11 sri suppose ->remove($oid) would be neat in addition to ->find_one($oid)
20:18 perlite_ joined #mojo
20:26 amirite_ joined #mojo
20:31 amirite joined #mojo
20:32 tm joined #mojo
20:40 amirite_ joined #mojo
20:45 tm left #mojo
20:54 phillipadsmith Wondering how to work around / re-think this problem I've hit: I have a route that handles a HTML or JSON request with $self->respond_to(). I have a helper in the app where I am using $self->render( template => 'mail', format => 'html', partial => 1 ) and, if that helper is called within the route, the route renders the 'html' section of the respond_to,
20:54 phillipadsmith which is obviously not correct for a JSON request. If I remove the $self->render() section from the helper, everything works fine.
20:57 buu phillipadsmith: What should the helper be producing during a json request?
20:58 phillipadsmith buu: Well, it should do the same thing, but the route that is calling it should just return the JSONP response.
21:00 phillipadsmith buu: basically, the helper (maybe this is bad use for a helper?) checks to see if an message has been sent and -- if not -- it sends it, but uses that $self->render() to provide a string of HTML for the message (send via another service).
21:00 phillipadsmith s/send/sent by/
21:01 phillipadsmith Really, I'm just looking for a fast way to provide a string of HTML to the app and thought I would use the inline templates to do that; maybe that's just tripping things up.
21:03 phillipadsmith I was reading http://mojolicio.us/perldoc/Mojolicio​us/Guides/Rendering#Partial_rendering and that seemed to be the idea that I was after. HTML string for a message with some interpolation of data.
21:03 buu phillipadsmith: I'm trying to understand what's going on. Are you using $self->render in a helper to produce html that shouldn't be sent as part of the response?
21:03 phillipadsmith buu: correct
21:04 sri looks like the format gets merged into the stash and affects all following render/respond_to calls
21:04 sri perl -Mojo -E 'a(sub { $_->render(text => "lala", format => "foo", partial => 1); say r $_->stash })->start' get /
21:04 sri can't decide if it's a bug or feature
21:04 * phillipadsmith doesn't much care, as long as there's a way around it! :)
21:04 sri but considering that i'm busy with the job queue i tend towards feature unless there's a good proposal for a change
21:05 buu If its being merged into the stash can you manually override it before calling respond_to ?
21:06 phillipadsmith Can I adjust this block to send the proper response? https://gist.github.com/phillipadsmith/cb​64bf208748e48be858#file-gistfile1-pl-L24
21:06 phillipadsmith buu: that's what I'm wondering...
21:06 sri i suppose it's not much of a problem since everybody uses the include helper these days anyway
21:07 phillipadsmith sri: not following re: include helper …?
21:08 sri http://mojolicio.us/perldoc/Mojolicious/Gu​ides/Rendering#Including_partial_templates
21:09 phillipadsmith sri: yep, have read that, but just not groking the application/context in this case… anyway, going to try to set the stash value in respond_to() ...
21:20 phillipadsmith storing the $self->stash('format') value and then re-assigning it after the helper is called seems to do the trick, but gives a warning "Careful, "format" is a reserved stash value."
21:26 punter joined #mojo
21:27 punter left #mojo
21:36 lukep joined #mojo
22:22 amirite joined #mojo
22:56 Dandre joined #mojo
23:09 sh4 joined #mojo
23:26 gryphon joined #mojo
23:30 asarch joined #mojo
23:46 dsteinbrunner joined #mojo
23:50 marty joined #mojo

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