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

IRC log for #mojo, 2015-04-17

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

All times shown according to UTC.

Time Nick Message
00:23 Ptolemarch joined #mojo
00:48 asarch joined #mojo
01:18 asarch How can you "ban" an IP address from your app?
01:19 mst have an early controller check of some sort that 401s or 500s it
01:19 mst I usually have a hash in config of IPs to kill
01:35 klapperl_ joined #mojo
01:46 davido_ joined #mojo
02:09 noganex_ joined #mojo
02:09 asarch joined #mojo
02:12 Ptolemarch joined #mojo
02:52 hshong joined #mojo
03:01 basic6 joined #mojo
03:04 inokenty-w joined #mojo
03:20 preaction use a firewall. once they've hit the app, the damage has been done
03:46 irq joined #mojo
03:59 asarch joined #mojo
03:59 basic6_ joined #mojo
04:01 Ptolemarch joined #mojo
04:17 sh4 joined #mojo
04:19 kaare joined #mojo
04:24 Oleg joined #mojo
04:48 vmbrasseur joined #mojo
04:59 asarch joined #mojo
05:22 melo joined #mojo
05:50 Ptolemarch joined #mojo
06:12 melo1 joined #mojo
06:21 dotandimet joined #mojo
06:39 batman preaction: +1
06:39 purl 1
06:44 trone joined #mojo
07:07 eseyman joined #mojo
07:14 chorny joined #mojo
07:15 AndrewIsh joined #mojo
07:29 irq_ joined #mojo
07:39 Ptolemarch joined #mojo
08:15 Vandal joined #mojo
08:23 ace joined #mojo
08:36 amon joined #mojo
08:50 ashimema joined #mojo
08:54 misty_g3ar joined #mojo
08:57 misty_g3ar joined #mojo
09:08 Insane joined #mojo
09:09 misty_g3ar joined #mojo
09:09 Insane hi all. what's wrong with this command? script: http://pastebin.com/rQV7BFCM located under lib/Application/Commands/deploy.pm http://pastebin.com/bzB4j7dC
09:12 dtscode left #mojo
09:12 dp_ joined #mojo
09:13 moritz Insane: does the package name need to be lower-case?
09:13 moritz Insane: I've never written a command module before, but in other instances, mojo does automatic name mangling
09:13 moritz (like between underscored_joined and CamelCase)
09:14 Insane http://mojolicio.us/perldoc/Mojolicious/Command says so
09:14 moritz hm, the built-in commands seem to be lower case, but under Mojolicious::Command, not Application::Command
09:15 Insane it is Mojolicious:Command
09:15 moritz you wrote "located under lib/Application/Commands/deploy.pm"
09:16 Insane as I understand, and as it was in version 5.x, you have to add push @{$self->commands->namespaces}, 'Application::Commands'; to Application.pm and store commands under lib/Application/Commands
09:28 Ptolemarch joined #mojo
09:29 drZZ joined #mojo
10:29 Insane ./application eval -V 'app->commands->{namespaces}' shows that Application::Commands is in namespaces, so Mojo knows where to find commands, but they don't work...
10:34 marcus sri: heathstone is even better on the ipad :)
10:34 marcus hearthstone*
10:47 neilhwatson joined #mojo
11:08 Insane sri, isn't there any problems around Mojolicious::Command and namespaces?)
11:13 batman Insane: maybe you need to set PERL5LIB or something? what does "perl -MMojolicious::Command::deploy\ 123" say?
11:14 Insane "Can't locate Mojolicious/Command/deploy.pm", and it shold say it, because I'm trying to register commend for single application
11:17 Ptolemarch joined #mojo
11:25 Kripton joined #mojo
11:35 jberger Insane: it doesn't look like you're namespace agrees with your package statement
11:36 jberger sorry s/namespace/file path/
11:37 Insane namespace I've added: CVUpdater::Commands, and path to deploy.pm from project root: ./lib/CVUpdater/Commands/deploy.pm
11:38 jberger and what namespace is the package statement
11:38 jberger ?
11:39 batman jberger++
11:39 Insane package Mojolicious::Command::deploy; according to this: http://mojolicio.us/perldoc/Mojolicious/Guides/Cookbook#Adding-commands-to-Mojolicious
11:41 jberger Insane: no, it has to agree with the file path
11:42 jberger like any perl class ought to
11:43 jberger (while not strictly required, this is the result when they don't match)
11:45 Insane jberger, if I change package definition to package CVUpdater::Commands::deploy; it works. but: 1. I'm unable to call application helpers via $self->helper(), 2. It worked before mojo 6.x, I have some applications in production using mojo 5.14, with custom commands organized as cookbook says
11:46 Insane s/5.14/5.49/
11:48 jberger Insane: I'm sorry to say it, but I really doubt that. this behavior (required) had existed for a long time. I've used it in Galileo since the mid 3.x series
11:49 jberger and as to helpers I see no reason why you wouldn't be able to call them
11:49 jberger though I wonder, what is $self?
11:49 jberger it's that the command?
11:50 jberger in that case you would need $self->app->helper
11:51 jberger looking at your code again, a command instance does not have a debug method
11:51 jberger that belongs to the app's logger
11:55 punter joined #mojo
12:11 Insane $self->app->helper works, my typo
12:12 Insane and looks lik Cookbook has wrong command package definition and needs to be edited
12:13 marcus HOH - HAH - WHAT IS IT GOOD FOR? ABSOLUTELY NOTHING.
12:14 marcus Insane: no it doesn't - you could name it that, as long as you put it in lib/Mojolicious/Command/spy.pm
12:15 Insane ok, but usually user wants to create command for single application, not for whole Mojo installation
12:15 marcus Not if you're writing a plugin for instance.
12:16 jberger Insane: I've written both
12:16 jberger Mojolicious::Command::nopaste for example
12:16 Insane and, for example, if I want to have a command to manage dbix::class for one application, it may not work with another
12:17 jberger Insane: that's where you use an app specific one
12:17 jberger and indeed that's what the command in Galileo is for
12:19 Insane ok ok, I shall remember to update all commands scripts when will update mojo in production...
12:19 jberger Minion does something interesting, it comes with a plugin that when used adds the Minion::Command namespace
12:20 jberger Insane++
12:54 irq joined #mojo
13:05 Ptolemarch joined #mojo
13:10 gryphon joined #mojo
13:35 cpan_mojo DOKECHIN released Mojolicious-Command-generate-lexicont-0.05
13:39 vmbrasse_ joined #mojo
13:40 good_news_everyon joined #mojo
13:40 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/vvyNp
13:40 good_news_everyon mojo/master b3d403f Sebastian Riedel: be more specific about naming commands
13:40 good_news_everyon left #mojo
13:40 sri there goes the record... 7 days without a commit :o
13:41 marcus :)
13:41 marcus how has your week been?
13:41 marcus Filled with hearthstone?
13:41 sri yea, it's quite addictive
13:41 coolo sri: adding documentation is fine even for perfect software :)
13:41 vmbrasseur joined #mojo
13:42 sri but i'm reaching the point where things get more boring i guess
13:42 marcus sri: I'm ericdraven on there fwiw
13:43 sri not found :o
13:43 ZoffixWork joined #mojo
13:44 sri think i can be found with the kraihx@gmail.com email address
13:44 ZoffixWork batman, I'm confused on what you mean. You're not willing to take the suggestion seriously, but you want to see a proof of concept?
13:45 sri made it to rank 13 for a bit, but dropping again now :)
13:45 marcus I was just draven
13:45 marcus I've sent you a friend request now
13:46 sri \o/
13:47 ZoffixWork batman, as in... I can make a proof of concept, but will I be wasting my time if you don't want the plugin to operate that way :D
13:47 sri "you've been challenged by marcus ramberg"
13:47 sri :o
13:47 marcus phear
13:47 batman ZoffixWork: what you're suggesting..... 1) is not something that will work at all 2) something i don't understand at all
13:48 batman "that will _NOT_ work"
13:57 batman ZoffixWork: about wasting time... i guess i should close the issue now, since it's really ***wasting*** my time. i don't even want the feature
13:57 batman but i find it interesting, so i'm still caring enough to spend time on it.
13:57 batman i guess if that doesn't add up to the people wanting the feature then i'm not sure what to do.
13:58 batman does that make sense, or am i just sounding very upset?
13:58 marcus sri: gg
13:58 sri :(
13:58 sri gg
13:59 marcus I'll let you have revenge later, I'm still at work :(
13:59 sri so easy to run out of cards with this deck
14:00 genio oh, it's a card-based game.
14:00 sri blizzards version of mtg basically
14:02 genio ah.  I never really got into gaming (other than playing Zelda/Metroid).
14:02 sri that counts
14:03 batman ZoffixWork: did you go...?
14:04 ZoffixWork I'm making proof of concept
14:05 marcus \o/
14:05 genio I think I have a PS3 somewhere still, but other than that, I don't even have a gaming console anymore
14:06 ZoffixWork And it works...
14:06 batman ZoffixWork: cool
14:07 ZoffixWork batman, here: https://github.com/zoffixznet/mojolicious-plugin-assetpack/tree/sprites
14:07 ZoffixWork batman, if you launch that App.pl, and view generated CSS, it'll show sprite files listed.
14:08 ZoffixWork So obviously _spritify would actually generate the sprite image and write proper CSS... and should probably be coming from a separate module
14:10 batman ZoffixWork: that's one evil hack.
14:10 batman i kind of like it though...
14:10 ZoffixWork Yeah, not as clean as it ideally should be :)
14:11 batman it's not clean at all. it's awful :(
14:11 batman but thanks for the poc. it's very helpful
14:12 batman it's a lot simpler than the space rocket i started on https://github.com/jhthorsen/mojolicious-plugin-assetpack/compare/sprites
14:13 fhelmber_ joined #mojo
14:20 batman ZoffixWork: didn't mean to be rude. sorry about the "awful" comment. what i meant was that it's a very good poc, despite of the awfulness :)
14:21 ZoffixWork :)
14:28 mattastrophe joined #mojo
14:39 neyasov joined #mojo
14:54 Ptolemarch joined #mojo
15:26 mattastrophe joined #mojo
15:58 Onigiri bahahaha "log all changes for this table" oh boy.
15:58 Onigiri How does timestamp, new::json, old::json sound? >_>
16:06 neyasov joined #mojo
16:15 neyasov joined #mojo
16:29 ajr_ joined #mojo
16:31 ajr_ Is there somewhere in the documentation that explains the various directory structures that Mojo generates, and the relationships of the names?
16:38 mishantil Onigiri: I have no idea about the context of that request, but we implemented something similar to that with postgresql-triggers. Worked perfectly.
16:39 Onigiri mishantil: that's basically what I just did
16:39 mishantil Onigiri: Even ended up with a system where we could 'replay' events that happened. Perfect data to have when debugging weird occurrences.
16:39 Onigiri A trigger on I/U/D that dumps a json'fied new/old into a table
16:40 mishantil We had 'mirrored' tables, with some extra meta-data in separate columns in the 'archive' table.
16:41 jberger ajr_: ?
16:42 jberger there is a lot on that in the Growing Guide
16:42 jberger but I'm not sure what you mean by the "relationships of the names"
16:43 Ptolemarch joined #mojo
16:45 Onigiri jberger: I read that as how does the function name get turned into the template name
16:46 ajr_ When I generated an app called Greeter, it generated a lib/Greeter and a lib/Greeter.pm, lib/Greeter/Controller/Example.pm, template/example.
16:46 ajr_ Obviously these are related, but how much is coincidence and how much is required to work?
16:52 Oleg joined #mojo
16:53 Oleg joined #mojo
17:03 ajr_ jberger; I'll go back to the Growing Guide, and see if that clarifies things.
17:19 jberger ajr_: the file structure in lib is just related to how Perl modules work
17:20 jberger as to the other relationships, yes, reread the Guides and you should understand most of it
17:27 berov joined #mojo
17:27 Grinnz_ template/ is the default templates directory, public/ is the default static files directory. there aren't a whole lot of other special cases
17:27 Grinnz_ templates/ actually i think
17:32 noganex joined #mojo
17:32 Onigiri So this json stuff in post, can I index items within the json?
17:33 Onigiri Or do I need to break them out into other columns?
17:34 Grinnz_ in postgres*?
17:34 Onigiri Yeah
17:34 Grinnz_ if you have 9.4? or newer than you can index jsonb
17:34 Grinnz_ (basically json stored in a binary format)
17:35 Onigiri I'm on 9.3.
17:35 Grinnz_ then, no :P
17:35 Onigiri Well then, heh.
17:35 Grinnz_ you should upgrade to 9.4 and make your json columns jsonb
17:35 Grinnz_ :)
17:36 Onigiri On 9.4 though, I would be able to index individual data items within it?
17:36 Grinnz_ yes
17:36 Grinnz_ http://www.postgresql.org/docs/9.4/static/datatype-json.html#JSON-INDEXING
17:37 Trelane wait wait, you can index json in 9.2
17:37 Trelane it's just harder
17:38 Grinnz_ in a roundabout way, yeah
17:39 Grinnz_ you make a function tha tparses the json and creates an index for a specific item in the json etc
17:39 Grinnz_ but thats no fun
17:40 Grinnz_ (also, i can't imagine it's very efficient)
17:41 ajr_ joined #mojo
17:52 batman zo
17:52 batman oops!
17:56 Onigiri Grinnz_: if the function is marked immutable, it's actually quite decent
18:24 * sri assumes marcus is hiding ;p
18:32 Ptolemarch joined #mojo
18:37 jb360 joined #mojo
18:51 * genio really needs to get better at writing non-blocking code
19:02 Grinnz_ genio: just pass callbacks to everything and hope for the best
19:07 asarch joined #mojo
19:17 vmbrasseur joined #mojo
19:29 * tempire looks for marcus
19:30 * genio points towards the far side of the room behind the couch
19:31 trone joined #mojo
19:31 asarch One very very stupid question: Why would you stop using a SQL data server (i.e. PostgreSQL) for a NonSQL one (i.e. MongoDB)?
19:32 asarch What would be the advantages of that?
19:36 genio asarch: http://stackoverflow.com/questions/4160732/nosql-vs-relational-database
19:36 asarch Thank you genio
19:36 asarch Thank you very much :-)
19:38 hernan604 parallel processing is one reason
19:39 mst hernan604: lol
19:39 mst hernan604: that makes no sense at all
19:39 hernan604 i dont mean its a reason to stop using relational db
19:40 hernan604 its just a reason some people might use mongodb
19:40 hernan604 no mst?
19:40 purl GO TO SLEEP
19:40 mst no
19:40 mst that makes no sense at all
19:40 hernan604 :/
19:40 mst one of the reasons mongodb does automatic sharding
19:41 mst is it's actually worse at parallelisation within a single instance than postgres by a long way
19:42 hernan604 thanks for correcting me
19:44 asarch So PostgreSQL is better than MongoDB \o/
19:45 mst mongodb's big advantage is being able to do document storage
19:45 mst postgres with the new JSONB type is pretty much able to do that
19:45 mst the auto-sharding is still interesting
19:45 mst a lot of the reasons people have adopted NoSQL stuff are basically
19:45 mst 1) "designing schemas is too much like effort"
19:45 sri mongodb is still a total mess when it comes to data loss
19:45 mst 2) "we're blaming SQL for MySQL being shit"
19:46 mst however, if you genuinely need huge scale key/value storage, then it gets useful
19:46 * sri just noticed that it is completely unreliable in single instance setups by default
19:47 Grinnz_ not mongodb, but a decent nosql db ;)
19:47 disputin joined #mojo
19:47 sri https://metacpan.org/source/MONGODB/MongoDB-v0.708.0.0/lib/MongoDB/MongoClient.pm#L84
19:47 sri it does not even wait for the journal commit
19:48 sri hahahaha
19:48 purl LOLCON 4 reached.
19:48 sri https://metacpan.org/source/MONGODB/MongoDB-v0.708.0.0/lib/MongoDB/MongoClient.pm#L72
19:48 mst asarch: for example, there's been a number of big stories of mongodb deployments being replaced by riak for the K/V part and postgresql for the analytics
19:48 sri it really defaults to w=1 and j=0
19:48 Grinnz_ "Well, you can't do SELECT blob FROM images WHERE blob CONTAINS('red car'). So while you can store the data raw in the database, you can't search it without attaching metadata.
19:48 Grinnz_ this guys comment isn't really relevant
19:48 asarch Oh
19:48 Grinnz_ if you want fulltext searching, there's a third solution for that :)
19:49 sri so, only a primary acknowledges that it has received your write, but it does not wait for it to committed to the journal xD
19:49 sri soooo mongodb
19:49 Grinnz_ and sphinxsearch is a realtime indexer that you can use like a relational DB without the relations
19:49 Grinnz_ (but with the structure)
19:50 _dave_ yeah mongo people recommend at least 3 servers for reliability last I looked O.o
19:50 sri what kind of person makes a database unreliable by default?
19:50 sri and this is *after* their big fix
19:51 mst sri: but but but benchmarks
19:51 sri yea...
19:51 Grinnz_ a person with different priorities than most of the corporate world
19:51 _dave_ As I see it, mongodb appears to be written for ease of development
19:52 genio _dave_: see mst's #1 reason above
19:52 _dave_ I did :) Sometimes you just want to store hash documents.
19:53 Grinnz_ yeah, noSQL makes store *some* things easier but you need to back it with a relational DB when you want to look up anything more complicated than by ID.
19:53 sri databases like cassandra are pretty reliable
19:54 sri it's mostly just mongodb that's bad for no good reason
19:54 sri herp derp mmapped files
19:54 * jberger remembers trying to grok "denormalization"
19:54 * jberger shudders
19:55 jberger and since there are no transactions (ie no atomic actions) you can't update all your denormalized crap anyway
19:55 * jberger finds marcus hiding behind the curtain
19:56 * sri pokes marcus
20:01 sri the one thing mongodb got right is queries as json (bson) documents
20:02 _dave_ on a different note, do any of you have opinions on javascript ui toolkits?
20:03 jberger I used bootstrap on Galileo, I've been using SemanticUI since on my small projects
20:04 mst sri: yeah, their query syntax is surprisingly non-horrible, mostly
20:05 genio I've been enjoying Ampersand for a while
20:05 Grinnz_ redis queries are "different", but once i figured them out they're very predictable
20:05 Grinnz_ you just cant nest very much in redis... heh
20:09 mattastrophe joined #mojo
20:12 mattastrophe joined #mojo
20:20 batman anyone who would like to comment on this sprite code for assetpack? https://github.com/jhthorsen/mojolicious-plugin-assetpack/pull/48/files
20:21 Ptolemarch joined #mojo
20:23 batman Grinnz_: btw. pg is good for storing json blobs.
20:24 Grinnz_ indeed!
20:26 batman http://www.reddit.com/comments/1q3skb
20:26 batman i can't find the post i wanted, but pg is faster than mongodb for "regular" queries, even on nosql documents
20:27 batman jsonb has some advantages over json, but you need to know what you want to decide on the type.
20:28 * batman wonder if assetpack has gotten too big :/
20:53 melo joined #mojo
21:03 * jberger just learned about JSON WebToken
21:03 jberger kinda nice parallel to our own session
21:24 mattastrophe joined #mojo
21:30 kaare joined #mojo
21:40 jberger is there any way to make ::Types handle a type alias?
21:41 punter joined #mojo
21:41 jberger I want to respond to xls and xlsx in the same way (screw you if you want old xls)
21:41 jberger but then I have to $c->respond_to(xls => $excel, xlsx => $excel, ...);
21:42 jberger hahaha, wow the MIME type for xlsx is awful!
21:43 Grinnz_ it's xlsx, you expected different?
21:49 jb360 joined #mojo
21:57 vmbrasseur joined #mojo
22:10 disputin joined #mojo
22:10 Ptolemarch joined #mojo
22:36 mattastrophe joined #mojo
22:59 hernan604 tempire around ?
22:59 tempire yes
23:04 shadowpaste "romel" at 217.168.150.38 pasted "is this a right way to get $self accessible inside each(sub { }) ?" (22 lines) at http://paste.scsys.co.uk/472845
23:17 romel hi everyone. the problem is that $self is not accessible inside $res->hashes->each(sub { ... }) probably because it's weakened. but i need to set session variables inside the loop. is passing $self as an argument to anonymous subroutine a right way to make it available there?
23:18 Grinnz_ "not accessible"?
23:20 Grinnz_ there should be no reason to have to pass it from that sub to the inner one
23:20 Grinnz_ you could store the controller in the delay object if needed
23:21 Grinnz_ but... that should be done automatically, if its getting closed over...
23:24 Grinnz_ romel: often the transaction disappears, not the controller, this is why the ->delay helper in DefaultHelpers keeps a reference to it (usually, you should use that when creating delays in actions)
23:25 Grinnz_ https://metacpan.org/pod/Mojolicious::Plugin::DefaultHelpers#delay
23:25 romel alright, thanks. will try it
23:29 romel doh, there was my mistake but anyways, delay helper is cool :)
23:52 Grinnz indeed it is!
23:59 Ptolemarch joined #mojo

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