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

IRC log for #mojo, 2015-01-03

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

All times shown according to UTC.

Time Nick Message
00:11 espent joined #mojo
00:16 sri hmm, i could have answered his question
00:20 sri only change affecting cookies in those releases was the switch from localhost to 127.0.0.1
00:20 sri his tests prolly depended on that
00:23 Nemix__ he posted the question to list if he doesn't check here
00:51 disputin joined #mojo
01:41 skittles joined #mojo
01:43 asarch joined #mojo
01:44 * Grinnz files POE::Loop::Mojo_Reactor into "list of things to do this weekend when not watching netflix"
01:45 punter joined #mojo
02:04 zivester joined #mojo
02:17 jberger Grinnz: you watching Friends too?
02:37 Grinnz haha, dexter atm, i have a few seasons to catch up on
02:39 mst ah
02:39 mst read the books
02:39 mst the books are amazing
02:46 klapperl_ joined #mojo
03:34 * jberger seems to have wasted an evening trying to get the exception page to render Devel::StackTrace objects better
03:39 noganex joined #mojo
04:29 jberger this is the best I can do, and I still hate it: http://pastie.org/9810497
04:31 jberger unifying two interfaces around overloading, which neither support
04:31 jberger bah humbug
04:31 jberger (I can still use bah humbug, right)
04:33 jberger OH!
04:33 jberger I'm an idiot
04:50 jberger there I hate this one less: √
04:50 jberger stupid mac
04:50 jberger http://pastie.org/9810508
04:50 preaction √+
04:51 jberger √(preaction)
06:59 rem_lex joined #mojo
07:47 irq joined #mojo
08:21 meredith joined #mojo
08:31 Vandal joined #mojo
09:01 dod joined #mojo
09:17 amon joined #mojo
09:46 batman Grinnz_: what is it supposed to do? (Mojo::APNS pr)
09:49 Eke- joined #mojo
09:51 Insane joined #mojo
09:52 Insane hi all, what is the best way to render something and stop working on request? e.g. if there is an error inside controller, I wish it ro render error page and don't do anything else (even if there is another render call next in the code)
09:53 Insane I can write something like $c->render('error') if error; $c->render('page'); and want Mojo to render error and stop. But it will render error and also render page after
09:56 meredith you should just need to return() from the action either after or while calling $c->render()
09:57 Insane ok, will try it
10:03 Eke- joined #mojo
10:08 Insane meredith, no luck: http://pastebin.com/JgcQLXyh ReadJSON fails with die;, but controller still renders 'success'
10:17 meredith oh, since there's a semicolon after your try/catch, i take it you're using Try::Tiny. a return inside that catch block only returns from that little catch block. flow continues to the second render.
10:18 meredith this is a common pattern for handling it:  http://pastebin.com/BSPDu0vK
10:25 Insane yeah, it works, thx!
10:41 firnsy joined #mojo
10:50 firnsy joined #mojo
10:59 Eke- joined #mojo
11:01 Insane joined #mojo
11:08 firnsy joined #mojo
11:10 juikuen joined #mojo
11:28 alnewkirk joined #mojo
11:54 dod joined #mojo
11:56 basiliscos joined #mojo
12:05 batman sri: have you thought about how to do slave/master queries with mojo::pg?
12:05 batman i'm thinking just making two objects and then use them when appropriate...
12:05 batman but i get a bit "confused" by looking at https://metacpan.org/pod/MojoX::Mysql
12:06 denis_boyun joined #mojo
12:08 Eke- joined #mojo
12:22 sri batman: no
12:23 sri and the correct terminology is primary/secondary these days
12:34 * sri is still annoyed that no good solution has been found yet for encoding JSON https://gist.github.com/anonymous/1a6cf290e3e200dd9e71
12:53 batman sri: "no" as in "not interested" or "haven't thought about it" ?
12:53 batman thanks for the terminology correction
13:03 hahainternet sri: what sort of 'good solution' are you talking about?
13:07 sri batman: both
13:07 sri hahainternet: one that looks good
13:07 batman sri: thanks. i feel the same way :)
13:07 hahainternet sri: i think it's very hard to aesthetically mix sql, perl and json together
13:07 hahainternet i'm not so sure it is possible to get 'nicer', but i bet you'll find it before the day is out :p
13:07 sri it's just sql and perl
13:08 sri you never see the actual json
13:12 sri hahainternet: that seems rather unlikely
13:12 hahainternet sri: you have to deal with its existence though, so that means encode_json etc
13:12 hahainternet sri: every time i come in here, and think 'oh an interesting challenge'
13:13 hahainternet by the end of the day, you have finished it and moved on to another
13:13 hahainternet so don't count yourself out yet :p
13:13 mst sri: I've seen one project switch to the clumsier names in a thread full of trolls but I think everybody else is too busy actually doing work to object to 'master/slave' being shorter
13:13 sri i'm on this one for 4 days now :(
13:13 sri mst: well, postgresql uses master/standby
13:14 dod joined #mojo
13:14 hahainternet well postgres doesn't really have 'slaves' as such
13:14 hahainternet it just has WAL receivers and the like
13:14 mst pg uses 'standby' for a machine awaiting to take over from the master, because it's not yet actually running
13:14 hahainternet sri: ok i've gone through each, A is currently the most aesthetic due to single call etc
13:15 mst this is a useful distinction
13:15 hahainternet sri: my only complaint with a is the additional parameters passed
13:15 hahainternet it's a little ugly passing options // 0
13:15 mst whereas a bunch of americans struggling with middle class guilt is less useful, and not a reason for me to type more
13:15 hahainternet shouldn't //0 be internal?
13:15 hahainternet mst: unusual as usually americans prefer to type less
13:16 hahainternet removing bits of every word they can, 'aluminum' really? ugh how classless :p
13:16 mst hahainternet: //0 is perfectly reasonable, since undef() for NULL is a DBI standard
13:16 hahainternet there's nothing wrong with it, but i'm judging the options based on aesthetics
13:16 sri hahainternet: best i can do is the new B https://gist.github.com/anonymous/bd4224a6f8f851ebbd00
13:17 hahainternet and // in the middle of an expression is a bit ugly
13:18 sri big problem is also that there's not much inspiration out there yet
13:18 purl okay, sri.
13:19 * sri kicks purl
13:19 * purl kicks sri
13:19 denis_boyun joined #mojo
13:19 * sri kicks purl
13:19 purl NEWSFLASH: LAMER ATTACKS INFOBOT. FILM AT 11
13:19 hahainternet oh that reminds me
13:19 hahainternet i gotta continue that tcl bot
13:19 hahainternet ugh
13:19 hahainternet and i left my tea far too long so it has a bit too much bitterness
13:20 hahainternet first world, first world problems!
13:22 sri there's only really Anorm so far http://stackoverflow.com/questions/19599346/inserting-json-objects-in-postgresql-json-fields-with-anorm
13:23 sri i guess linq would qualify too
13:24 mst I should summon up enough caring to write something at some point
13:25 * mst shrugs
13:25 mst sri: note that I talked aristotle into http://p3rl.org/SQL::Concrete::Dollars
13:25 mst may be of interest some of your users as 'the smallest possible amount of SQL mangling'
13:26 hahainternet mst: aren't you a northerner?
13:26 hahainternet i seem to remember someone complaining i sounded too much like you
13:28 mst aye
13:28 irq_ joined #mojo
13:30 ryozi joined #mojo
13:32 sri hmmm
13:32 sri i could actually get away with this patch for Minion::Backend::Pg https://gist.github.com/anonymous/f535136fdf0eacce4594
13:32 irq_ joined #mojo
13:33 sri $db->json($arg1)->query('insert into...', $arg2, $arg3) does look a little awkward though
13:36 mst oh, THAT's what it's doing
13:36 mst moving one argument before the rest of the query had made all the examples completely confusing to me
13:36 sri the branch with docs does make it a little more obvious https://github.com/kraih/mojo-pg/compare/json
13:37 mst seems like exporting ej() instead of encode_json() would save just as much typing and be much more obvious
13:37 sri hahahaha
13:37 purl LOLCON 4 reached.
13:37 sri you can actually import the j() function from Mojo::JSON
13:37 mst right, so, honestly, I'd just do that.
13:38 sri what's really verbose is the json decoding
13:38 mst eh, just ship it down the wire without decoding it and let the browser sort it out
13:39 mst (I've not thought about decoding yet)
13:39 sri decoding is super simple to do nicely
13:39 sri https://github.com/kraih/mojo-pg/compare/json#diff-ebed6d285154b1c54f7957a4e94cbf6cR30
13:40 sri decodes json/jsonb fields automatically
13:40 sri and you can do ->no_json->hashes to get the raw values
13:41 mst right
13:41 sri the big problem has always been encoding json
13:41 mst so, personal opinion, that plus j() is as good as you're going to get
13:41 sri only handling json decode automatically feels inconsistent though :S
13:43 sri hmm
13:43 sri wonder if it would feel less inconsistent if json decoding was opt-in
13:43 mst have you considered just always encoding a hashref?
13:43 mst that's probably the primary use case anyway
13:43 sri mst: yea, i got worried that DBD::Pg might want to do something special with hashrefs in the future
13:44 mst well, I -really- hate the idea of changing the argument order to not actually save any typing over j()
13:44 sri in the case of minion it also wouldn't work, since it specifically allows all kinds of json values as job result
13:45 mst sure. but three extra characters for the non-simple case doesn't really upset me
13:45 sri the problem actually reminds me of Mango::BSON
13:46 sri the solution i used there was wrapper objects with constructor functions... use Mango::BSON ':bson'; encode_bson({foo => bson_time(1360626536748)})
13:47 mst right
13:48 mst which you effectively already have
13:48 mst oh, hrm
13:48 mst sri: what about having a way to generate a registered query with type hints
13:48 mst so, uh, something like
13:49 mst $db->query_helper(add_job => 'INSERT ...' => qw(json int str));
13:49 mst then
13:49 mst $db->add_job($args, $pri, $name);
13:49 mst (making shit up as I go along, obviously)
13:50 sri yea, tempire made a similar suggestion, but it always ended up way too verbose
13:50 sri i was just thinking, hashref would work well for type hints too
13:51 sri $db->query('insert into...', {json => $arg1}, $arg2, $arg3)
13:51 mst oh. also. how come you've started using map in void context instead of postfix for?
13:51 dod joined #mojo
13:52 sri habit i guess
13:52 mst I'm sure you used to poke people for doing that
13:53 mst I know I always have, so if you'd ever done it in the catalyst codebase I'd've complained at you
13:53 jberger mst: there used to be a performance penalty for that, but it's gone now
13:56 batman i agree on mst's comments regarding j()
13:56 dod joined #mojo
13:56 batman at least compared to $db->json($arg1)->query('insert into...', $arg2, $arg3)
13:56 batman and i think $db->query('insert into...', {json => $arg1}, $arg2, $arg3) is nicer than the json() method.
13:57 batman it should be forward compatible as well. just do {raw => $arg1} or something if DBD::Pg decides to use hash as input...
13:57 sri batman: yea
13:58 mst or \{...}
13:58 * mst hifdes
13:58 batman :D
13:58 * mst hides # DAMNIT FINGERS
13:58 batman i dislike refs in general. (just refs, not hash/array/scalar-refs)
13:58 sri oh, i think this might be a valid map in void context ;p https://github.com/kraih/mojo/blob/master/lib/Mojo/UserAgent.pm#L108
13:59 batman jberger: do you have time to test readwritefork?
14:00 mst sri: I'd write 'if (...) { ... for qw(...); }'
14:00 mst sri: but that one, yeah, I'm not going to complain about
14:00 jberger batman: sure, in just a minute
14:00 mst whereas the ones in the json branch made me sad
14:00 batman sweet!
14:00 jberger sri++ # nice find
14:00 * sri kinda likes ->query(..., {json => ...})
14:01 batman mst: i agree i most cases. it looks like a typo if map doesn't return...
14:01 * sri wonders if json decoding should be opt-in or opt-out
14:02 sri ->query(...)->json->hashes
14:02 sri ->query(...)->no_json->hashes
14:02 sri (never liked the name no_json...)
14:02 batman i think ->json makes sense, but i might regret that in some years from now :)
14:03 batman opt-in that is
14:03 sri there's a certain kind of consistency with $tx->res->json
14:03 mst also
14:03 mst it occurs to me that, actually, json is a special case
14:03 mst of "per-type encoding/decoding behaviour"
14:03 batman i agree
14:04 sri right... if necessary ->json could be extended with more constraints... like limiting decoding to certain field names
14:05 sri ->json('foo')->hashes
14:05 mst sri: I was also thinking I'd like to encode/decode to DateTime, ot Time::Moment, or whatever
14:06 sri ah
14:06 mst so I'd argue that it's more a helper system, if you see what I mean
14:07 batman mst++
14:07 sri i'd like to avoid a pluggable system for now :S
14:09 sri but of course, it's good that this api doesn't get in the way
14:09 batman sri: maybe you could make something similir to the validator system? $pg->add_decoder(json => sub { ... }); $db->query(...)->as('json')
14:10 mst which is totally fair, but the fact you probably won't avoid it forever probably matters in terms of the opt-in/opt-out etc. question
14:10 mst right
14:10 sri batman: something like that is totally possible
14:11 sri batman: you need to register pg types too though
14:11 batman such as..?
14:11 sri json and jsonb
14:12 sri oh well... no point bikeshedding now... i just want json for now anyway ;p
14:13 Eddy joined #mojo
14:20 jberger but I want to paint the shed green!!!
14:29 sri not a day goes by where i don't with perl had an "in" operator
14:30 sri if 'foo' in @values
14:31 asarch joined #mojo
14:37 stephan48 yea
14:45 sri https://github.com/kraih/mojo-pg/commit/5ec44181a536288f229077e084abe90d0422c7d6
14:45 sri allright, that looks nice
14:45 sri everyone++
14:47 sri just that _decode method does seem a bit big and could use some golfing
14:54 batman https://ssl.thorsen.pm/swagger2 # if anyone would be interesting in seeing how the Perl based Swagger2 editor looks live
15:01 batman sri: what about just ->decode instead of ->json ?
15:02 batman since you're already using the "pg_type" data anyway
15:08 stephan48 yewa
15:08 stephan48 yea*
15:17 sri batman: i don't like the name decode
15:17 batman what do you think about the idea?
15:17 sri but i wouldn't mind a more generic name
15:17 mst batman: wait until later to bikeshed the pluggable version
15:18 sri ->query(...)->decoded->hashes
15:18 sri ->query(...)->decoded->array
15:18 zivester joined #mojo
15:18 batman mst: i can't resist :/
15:19 sri i'm ok with bikeshedding the method name
15:19 sri future proofing this api is a good idea
15:21 jberger http://www.quickmeme.com/img/aa/aa55a5bb1c429c07dbe22f9a44222a4192886d9fcfa58a3a75ba848ba0a3471e.jpg
15:23 Akron joined #mojo
15:25 sri ->query(...)->expand->hashes
15:26 sri ->query(...)->extend->hashes
15:26 sri ->query(...)->upgrade->hashes
15:26 mst inflate
15:26 mst explode
15:27 sri ->query(...)->augment->hashes
15:28 preaction unpack?
15:28 purl unpack is, like, kind of like hell
15:30 batman i like explode() and upgrade()
15:35 Eke- joined #mojo
15:51 punter joined #mojo
16:09 sri hmm
16:12 sri DBD::Pg uses pg_expand_array
16:12 sri so ->expand would be consistent with that
16:15 batman makes sense
16:16 * batman dislike uploading yet another "i hope i've fixed windows" release to cpan
16:16 batman or bsd, hehe
16:17 mst batman: that's what devrels and cpantesters are for
16:18 batman what do you mean? can i upload to cpantesters without making a new release?
16:18 lb _
16:19 sri that's literally what dev releases are
16:23 batman but i still have to wait over night for cpantesters to pick it up...?
16:24 juikuen joined #mojo
16:28 mst well, yes. hence why it's important to have at least one pet windows user who'll test things for you.
16:31 Eke- joined #mojo
16:31 batman ok :)
16:31 batman thanks for the info
16:34 batman i wonder if there's a way i could use azure...
16:35 batman i guess it's possible, would be cool if it was as easy as travis :)
16:43 batman off topic: anyone with android here? i'm curious if there's a way i can easily wrap my html app.
16:44 batman i don't want an app in google play. i just want to wrap my web page, so i don't have to launch chrome/firefox all the time
16:45 batman i tried to search for a widget, but couldn't find any
17:04 sri batman: you can add links to the android main screen
17:05 batman but that would just open firefox/whatever..?
17:05 sri they do start the browser, but every browser window is a new task in the task manager, so it's pretty nice
17:06 sri every browser window is basically its own app
17:06 batman ok. cool. i'll try it out
17:06 sri (in lollipop)
17:06 sri it's pretty awesome
17:08 sri http://www.androidpolice.com/wp-content/uploads/2014/11/nexus2cee_2014-11-10-22.50.54.png
17:08 sri you can even customize the titlebar color
17:08 sri there was a nice article somewhere
17:08 sri aah
17:08 sri http://updates.html5rocks.com/2014/11/Support-for-theme-color-in-Chrome-39-for-Android
17:10 sri think you can even color the urlbar now
17:11 asarch joined #mojo
17:25 Eke- joined #mojo
18:16 dennis joined #mojo
18:39 dod joined #mojo
19:26 jberger sri: why do list_workers and list_jobs take limit and offset unconditionally? It makes it very difficult to list all
19:26 * jberger is tinkering with an api and possibly web interface to administering minion
19:27 denis_boyun joined #mojo
19:28 sri jberger: because depending on backend it can be a really fricking expensive operation, and people may not be aware of it beforehand
19:29 sri if you're listing all jobs, you're prolly doing it wrong anyway
19:29 sri good web gui will always do paging
19:29 jberger I suppose I want it paginated
19:29 mst accepting an explicit 'limit => undef' or 'limit => -1' for all might be ok
19:29 mst I agree that requiring users to think about it is good
19:30 jberger first, I'm exposing it as a json api
19:34 sri that doesn't really make a difference
19:35 mst list_workers(limit => ~0)
19:37 sri i have to disagree about that special case, i don't see a good reason to add it
19:37 psandin joined #mojo
19:38 mst I suspected you were going to say that
19:38 mst hence ~0 :)
19:38 sri with collections of indefinite size i'd expect this https://developer.github.com/v3/#pagination
19:39 psandin I've got a question about the cookie jar for mojo user agent. I've got this block of code: https://gist.github.com/psandin/bf10abca6cec45b1261a
19:39 jberger sri: any preference between /api/job/:id vs /api/job?id=   ?
19:39 psandin with the goal being to login in and then start mechanizing post login actions, but my cookies disapper on the second request
19:39 sri jberger: first
19:39 mst jberger: I would argue that the former is correct
19:40 mst and the latter is not
19:40 sri the job is the resource
19:40 mst right
19:40 mst ergo the second one is Just Wrong (tm)
19:40 jberger good then we are all agreed
19:41 sri jberger: if you want to show numbers, then there's ->stats btw.
19:41 jberger I'm using this a bit as a self-tutorial in designing an api and then skinning it with a web frontend. Something that I'm needed to investigate for $work
19:41 jberger sri: got that one
19:41 jberger that was easy
19:42 sri jberger: if you're looking for inspiration, this one is super sleek http://learnboost.github.io/kue/
19:42 jberger sri: nice
19:43 sri you prolly already know the python stuff :)
19:43 sri (not that celery flower is very pretty...)
19:46 sri anyway, kue is interesting because it also uses a rest api to get all the data
19:46 sri https://github.com/LearnBoost/kue/blob/master/lib/http/index.js#L50
19:47 sri one of the more pleasant to read express.js apps
19:51 sri btw. when you're restarting jobs on travis, the new docker stack is quite a bit faster
19:52 sri only waiting like 10-20s for the job to restart now
19:57 jberger cool
20:02 mikegrb psandin: so the first request succeeds and the cookies show in the jar but they aren't used on the second request?
20:03 psandin yeah, it gets to the no cookies sent die, if I add a p $ua->cookie_jar->all before the second request it looks like the cookie is parsed and in the jar
20:04 mikegrb and it soudns like dumping the cookie jar after the second request shows it empty?
20:05 jberger psandin: I love Data::Printer, but it does sometimes lie to you :(
20:05 psandin yeah
20:05 psandin it does? how, and what would be more truthful?
20:06 jberger sometimes it gives undef when it shouldn't, it seems to read data structures "too early" sometimes
20:06 jberger if DDP is giving nothing, try with Data::Dumper
20:06 jberger there is a helper built-in
20:06 jberger $c->render(text => $c->dumper($thing))
20:11 psandin same thing with dumper it's there and looks good before hand, and isn't there after
20:12 psandin using MOJO_USERAGENT_DEBUG=1 it looks like the cookie header isn't even being included in the request
20:17 mikegrb do mojo cookiejars auto-persist across requests with the same ua instance, ala WWW::Mechanize? I've never had to care about cookies yet when using Mojo::UA to scrape
20:19 jberger sri: https://github.com/jberger/Minion-Command-minion-monitor/blob/master/lib/Minion/Command/minion/monitor.pm
20:20 psandin might be some bad mojo (ha) with the expire time. print (($ua->cookie_jar->all)[0])."\n"; warns 'Use of uninitialized value in gmtime at /Library/Perl/5.16/Mojo/Date.pm line 71.' and the expire time gets rendered as the epoch
20:20 jberger I would require whatever version of Mojo fixes the param method, then in defiance of that idiot presenter, use $c->param in list context
20:20 mikegrb jberger: I like defiance, especially of twits
20:21 jberger psandin: are you playing with that time or the cookie comes with an expiration time that causes the errors
20:21 jberger ?
20:23 psandin it came that way from the server, but I'm thinking about setting the expire time to try and fix it
20:27 psandin setting the expire time fixed the warnings and got the cookie added to the requst
20:28 jberger psandin: good to know
20:28 sri psandin: you did not show us the actual cookie yet
20:29 jberger sri/others: I could use DELETE /api/worker/:id to remove, but what verb would I use to retry?
20:29 sri jberger: PATCH?
20:29 purl We don't need no stinking patch! or a little wrong, which i just noticed after pushing. fixing now
20:30 jberger purl: no, PATCH is <reply>We don't need no stinking patch!
20:30 purl okay, jberger.
20:31 sri purl: no, PATCH is <reply> Patches welcome!
20:31 purl okay, sri.
20:31 sri jberger: PATCH?
20:31 purl Patches welcome!
20:31 jberger I guess most of those routes should be GET
20:31 jberger sri: botsnack :-P
20:31 purl thanks jberger :)
20:31 jberger purl stole your botsnack
20:31 purl :)
20:32 sri :O
20:34 psandin I'm happy for now, but here's the cookie as printed by MOJO_USERAGENT_DEBUG=1 Set-Cookie: rack.session=session_id_here; domain=.roll20.net; path=/; expires=Sun, 18 Jan 2015 20:32:33 -0000; secure; HttpOnly
20:37 Insane did anyone try to deal with google oauth2 and mojo? is there any examples I can look at?) I've found couple of plugins on cpan, but can not understand how it works w/o references
20:39 sri psandin: that Expires value looks invalid to me
20:44 sri we could theoretically handle that format i believe, but you'll have to give a good reason
20:45 Akron joined #mojo
20:46 jberger hey hey, I can remove jobs via delete :-)
20:46 jberger guess its time to start writing some tests
20:47 jberger and retry via patch
20:47 jberger yummy
20:49 jberger the only thing I might still want would be enqueue
20:50 jberger maybe list the tasks too
20:50 neyasov joined #mojo
21:00 Akron joined #mojo
21:35 Eke- joined #mojo
21:48 jberger post json to /task/:task to enqueue a new job: https://github.com/jberger/Minion-Command-minion-monitor/blob/master/lib/Minion/Command/minion/monitor.pm#L46-L58
21:49 jberger GET /task/:task is an alias for GET /jobs?task=:task
21:49 jberger seems sane
21:50 preaction wouldn't it be more like /api/job/<id>/task/<task_index>?
21:50 jberger (oh and all these urls are preceded by /api/)
21:50 preaction are tasks contained in jobs?
21:50 jberger jobs are instances of tasks
21:51 preaction oh, steps must be what i'm thinking about then
21:51 batman jberger: it's super important that GET is _never_ used to alter any information.
21:51 jberger batman: right
21:51 preaction i would post to /job to enqueue a new job. post to /task to make a new task
21:52 jberger preaction: you cannot create a new task
21:52 batman reason: GET is very easy to spoof
21:52 batman jberger: if you just started now, this could be a good idea to look at swagger2 if you're interested.
21:52 preaction then don't allow post to /task
21:52 jberger hmmmmm
21:53 jberger so I'm imagining that /task/:task is the resource representing the ability to do a job
21:53 jberger and /job/:id is the actual job
21:54 preaction yes
21:54 jberger but this might be born out of symmetry with the backend internals and not RESTfulness
21:54 Grinnz no, that makes sense to me
21:55 jberger so when I create a new instance of a task, I post to /tasks/:task, it returns to me the id of a job instance
21:55 batman jberger: also, a rule of thumb is to only use query params if they are optional. (regarding /job/:id vs /job?id=)
21:55 jberger which is accomplishing that task
21:55 preaction post to /job and it returns the id of the job. you can then call get /job/:id to get it
21:55 jberger batman: that's a good way to think of it, thanks
21:55 jberger preaction: so what task does it do then?
21:56 jberger I guess that could be part of the json body you send it
21:56 jberger hmmmm
21:56 preaction the task_id in the json blob you sent
21:56 jberger preaction: no it is not
21:56 purl i already had it that way, jberger.
21:56 jberger preaction: task name you mean?
21:56 preaction whatever
21:56 purl rumour has it whatever is left over I just deal with myself, or something
21:57 preaction the idea being you're working with jobs, not tasks
21:57 preaction post /job: create new job. put /job/:id: update job info.
21:58 jberger preaction: I see your point
21:59 jberger anyone else have an opinion on posting to /task/:task vs /job where :task is then in the json body?
21:59 Grinnz what preaction says is generally the RESTful idea
21:59 jberger preaction: is very good, I know that
21:59 jberger s/://
22:00 jberger preaction: ok so lets say I do what you suggest
22:00 jberger I still probably need /tasks to list the available tasks
22:00 jberger (though, I guess that's not necessary)
22:00 preaction most likely yes
22:00 preaction how else would they know what name to use as part of creating a new job?
22:01 jberger and GET /task/:task is currently an alias for GET /jobs?task=:task
22:01 jberger is ^^ sane/useful
22:01 preaction there's some... i hesitate to say spec, but convention, where you add URLs detailing the options you can do with the current resource
22:01 preaction facebook made it, iirc
22:02 preaction action specs maybe?
22:02 preaction does doing /jobs?task=:task get you the task info, or the jobs that are built from that task?
22:02 jberger so I guess GET /task/:task should probably be more like documentation than a list of the current tasks for that type
22:02 preaction i would guess the latter
22:03 jberger yes, the latter
22:03 purl the latter is better
22:03 jberger thanks purl
22:03 preaction GET /task would be the list of all tasks. GET /task/:task_id (name, id, whichever) would be a single task's details
22:03 Grinnz GET /tasks/:task i would generally expect to be infomration about that task (structure or something?)
22:04 jberger I'm starting to think that same way
22:05 jberger the problem is that that information is not available
22:05 jberger maybe I just don't have a /task/:task
22:05 Grinnz well, you could have /tasks/:task/jobs
22:06 Grinnz to get the jobs of that task
22:06 jberger eh, I've already got /jobs with a task filter
22:06 preaction i wouldn't do more than one representation though. either /jobs or /tasks/:task/jobs
22:06 jberger (that is how the internal api works)
22:06 Grinnz right but if you wanted a redirect like that
22:06 jberger Grinnz: redirect is generally bad in REST no?
22:06 * Grinnz shrugs
22:07 Grinnz not redirect really, just the same info, is what i meant
22:08 Grinnz but /jobs with a task filter is perfectly reasonable
22:12 Grinnz oh yeah, batman, it was this one: https://github.com/jhthorsen/mojo-apns/pull/5 it was supposed to change the IO::Socket::SSL prereq to version 1.84 but it looks like it got lost
22:13 batman oh! that's weird. i'll make a new release now Grinnz
22:14 jberger preaction/Grinnz: https://github.com/jberger/Minion-Command-minion-monitor/commit/a1965d2fea5d593c43ec19febc0cd66ed5c1c552
22:16 batman Grinnz: https://github.com/jhthorsen/mojo-apns/commit/f26d458011236f7b71249e3495fcd2d7f2ddcb48
22:16 * batman will be back tomorrow
22:17 Grinnz :)
22:18 jberger batman: did you have a good holiday?
22:20 bobkare joined #mojo
22:23 denis_boyun joined #mojo
22:26 sri jberger: i don't see why the api would be dealing with tasks
22:26 sri they are just a property of the jobs
22:27 sri you filter jobs by tasks, but that's about it
22:28 * sri wouldn't expect anything more than ?task=foo
22:31 sri hmm, might be fun to have task info in the stats
22:31 batman jberger: it had a rough start: was sick for five days. but i had a great time since 24th of december
22:32 sri like tasks => {foo => 23, bar => 1, baz => 3}
22:32 batman luckily i have vacations until thursday, so i can hack :)
22:32 batman jberger: how was yours?
22:33 sri maybe later
22:40 neyasov joined #mojo
22:42 woz joined #mojo
22:42 jberger batman: very nice. I didn't have nearly so much vacation as you though
22:43 jberger sri: almost all the task endpoints are gone again
22:43 jberger just GET /tasks remains, returning a list of available tasks
22:43 batman yeah. telenor is pretty nice that way. ~seven weeks of vacation: five + easter + christmas
22:43 sri that seems reasonable
22:43 woz joined #mojo
22:44 jberger seven weeks!
22:44 woz_ joined #mojo
22:44 batman jberger: good. got to see any fireworks? :)
22:44 sri you americans are crazy with your lack of vacation days
22:45 jberger only on tv, going in to the city for new years is crazy
22:45 preaction we're also crazy with our lack of medical leave
22:45 sri indeed!
22:45 jberger lack of medical *
22:45 batman oh. i got five seconds of live fireworks.... ;)
22:45 jberger batman: hahaha
22:46 batman totally worth it ;D
22:46 Grinnz i got 4 days off, and took one more because i couldn't breathe through my nose
22:46 Grinnz :)
22:46 sri watch the video of the dubai fireworks, what they did with the tower is crazy
22:46 batman sri: yeah. they are indeed crazy
22:46 * jberger refrains from making a joke about 5 seconds of worth it :)
22:47 batman dubai has the record in spending money on fireworks. I think it was about $16.000.000 if i did the math right...
22:48 batman ...during one day
22:49 sri yea, all those LEDs!
22:51 Grinnz lol
22:55 jberger look what my wife found in the store, AND DIDN'T BUY!
22:55 jberger http://imgur.com/TpAwGIC
22:55 Grinnz hahah
22:56 jberger tempire ^^
22:56 neyasov joined #mojo
22:57 sri lol
22:57 sri that has tempire written all over it
23:02 elsanchez joined #mojo
23:02 Eke- joined #mojo
23:19 jonquest joined #mojo
23:20 Grinnz woo i got a pass on win32 on cpantesters
23:20 Grinnz http://www.cpantesters.org/cpan/report/69d9d4bd-6bf5-1014-a907-928e80f94389
23:20 Grinnz with some interesting warning :P
23:44 Grinnz hmm... I suppose a POE loop backend would have to be based on Mojo::IOLoop and not Mojo::Reactor, so that it shares the reactor with Mojo
23:46 Eke- joined #mojo
23:52 Nemix__ so in either case I can use my POE components as part of mojo applications?
23:57 neyasov joined #mojo

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