« Back to channel list

#elixir-lang - 12 June 2019

« Back 1 day Forward 1 day »
[00:01:04] hypercore: Ankhers: just to be clear, the only advantage of storing the template in the db is that i don't have to restart the app if i want to use a newer template version?
[00:01:19] hypercore: (i say "only", but it is quite a big advantage admittedly)
[00:01:20] ankhers: newer or make modifications to. But yet.
[00:01:34] ankhers: yes, rather.
[00:02:54] gvaughn: has joined #elixir-lang
[00:02:58] ankhers: Someone else can speak to the effectiveness of EEx.eval_string vs compiled templates. But it may also be possible to compile the templates somehow. I would just need to look into it.
[00:03:20] hypercore: to dynamically compile them you mean?
[00:03:44] ankhers: Yeah. It should be possible. Like I said, I would just need to look into it.
[00:03:56] hypercore: didn't really think about the performance costs of doing it dynamically actually, good point
[00:04:40] ankhers: I need to go for a bit. I will be back in 30-60 minutes if you still want some help.
[00:05:57] hypercore: Ankhers: ok no problem, thanks for all the advice, it's been very helpful
[00:14:58] adkron_: has joined #elixir-lang
[00:23:33] tnez: has joined #elixir-lang
[00:36:20] dsr: has joined #elixir-lang
[00:41:22] greengriminal: has joined #elixir-lang
[00:41:55] proteusguy: has joined #elixir-lang
[00:50:23] toure: has joined #elixir-lang
[00:55:21] Sgeo__: has joined #elixir-lang
[00:59:20] gvaughn: has joined #elixir-lang
[01:04:31] gvaughn: has joined #elixir-lang
[01:07:25] theWhisper__: has joined #elixir-lang
[01:20:25] Havvy: has joined #elixir-lang
[01:24:59] adkron_: has joined #elixir-lang
[01:41:40] tomterl: has joined #elixir-lang
[01:55:19] sebboh: has joined #elixir-lang
[01:57:40] adkron_: has joined #elixir-lang
[02:06:31] mdbm: has joined #elixir-lang
[02:06:46] sevenseacat: has joined #elixir-lang
[02:07:47] ariedler: has joined #elixir-lang
[02:12:56] Adkron: has joined #elixir-lang
[02:30:16] Adkron: has joined #elixir-lang
[02:37:14] adkron_: has joined #elixir-lang
[02:42:17] Sgeo_: has joined #elixir-lang
[02:43:08] dsr: has joined #elixir-lang
[02:47:42] Adkron: has joined #elixir-lang
[02:51:28] adkron_: has joined #elixir-lang
[03:09:49] orbyt_: has joined #elixir-lang
[03:10:50] proteusguy: has joined #elixir-lang
[03:25:45] wsieroci: has joined #elixir-lang
[03:27:21] blassin2: has joined #elixir-lang
[03:39:00] isHavvy: has joined #elixir-lang
[03:48:34] Moogly: has joined #elixir-lang
[03:51:34] DukeDave: has joined #elixir-lang
[03:51:53] uranoss: has joined #elixir-lang
[03:56:12] tnez: has joined #elixir-lang
[04:00:05] TechDragon: has joined #elixir-lang
[04:02:50] duoi: has joined #elixir-lang
[04:03:56] adkron_: has joined #elixir-lang
[04:12:21] Sgeo__: has joined #elixir-lang
[04:18:10] mdbm: has joined #elixir-lang
[04:48:19] ur5us: has joined #elixir-lang
[05:02:33] Sgeo: has joined #elixir-lang
[05:02:45] voltone: has joined #elixir-lang
[05:08:04] gvaughn: has joined #elixir-lang
[05:19:35] adkron_: has joined #elixir-lang
[05:39:00] harfangk: has joined #elixir-lang
[05:57:20] Sgeo: has joined #elixir-lang
[05:57:43] proteusguy: has joined #elixir-lang
[05:58:39] theWhisper_: has joined #elixir-lang
[06:19:00] Sgeo_: has joined #elixir-lang
[06:26:28] tuacker: has joined #elixir-lang
[06:35:31] gde33: has joined #elixir-lang
[06:37:44] adkron_: has joined #elixir-lang
[06:45:51] Sgeo__: has joined #elixir-lang
[06:47:09] gvaughn: has joined #elixir-lang
[06:48:53] ur5us: has joined #elixir-lang
[07:04:58] flaviodesousa: has joined #elixir-lang
[07:15:44] fredsir: has joined #elixir-lang
[07:23:58] ndee: has joined #elixir-lang
[07:26:36] sangoma: has joined #elixir-lang
[07:31:02] serafeim: good morning
[07:36:43] hypercore: has joined #elixir-lang
[07:55:36] adkron_: has joined #elixir-lang
[08:00:00] dtzuzu: has joined #elixir-lang
[08:01:31] pmarreck: has joined #elixir-lang
[08:03:10] Brend: has joined #elixir-lang
[08:03:10] rfv: has joined #elixir-lang
[08:13:23] PragTob: has joined #elixir-lang
[08:28:28] lexmag: has joined #elixir-lang
[08:29:30] ur5us: has joined #elixir-lang
[08:35:39] gvaughn: has joined #elixir-lang
[08:39:20] Sgeo_: has joined #elixir-lang
[08:43:12] wonko7: has joined #elixir-lang
[08:55:26] serafeim: i like elixir very much and would be really nice to use all these shiny features but the problem is that i mainly work on boring crud apps for internal use in a public sector organization. do you have any recommendations on how could i use some shiny-elixir features on such apps ?
[08:58:27] Nicd-: I use ETS for caching, that's the first obvious thing
[09:00:22] lexmag: has joined #elixir-lang
[09:05:33] rawtaz: you mean https://elixir-lang.org/getting-started/mix-otp/ets.html
[09:05:35] theWhisper__: has joined #elixir-lang
[09:07:16] serafeim: Nicd-: yes until now i don't use any caching
[09:07:17] rawtaz: serafeim: if you use LiveView you can have your client UI written on the server side and you will then also be able to just do validation on the server, which i think is a huge win for CRUD apps
[09:07:52] serafeim: rawtaz: i've thought about using liveview however the fact that it hasn't been released yet is a blocker for me
[09:08:01] rawtaz: ok. too bad :) i understand though
[09:08:15] serafeim: also i haven't seen a thorough example on using it to do the form-validation as you mention
[09:08:23] rawtaz: Nicd-: do you have any idea how long it might be before LiveView is released?
[09:08:47] serafeim: it'd be excellent if that form validation would be integrated properly with the elixir forms
[09:10:13] adkron_: has joined #elixir-lang
[09:15:33] serafeim: Nicd-: do you use any specific packages for ets caching ?
[09:18:19] Nicd-: serafeim: only Ex2ms for easier match specs
[09:18:29] Nicd-: rawtaz: sorry I'm not on the liveview team
[09:18:50] Nicd-: but liveview is already available as a prerelease to scratch your itch
[09:19:20] sevenseacat: ie. don't use it in production just yet unless you have a death wish
[09:20:03] Nicd-: eh, depends on the reliability level you need
[09:20:45] serafeim: Nicd-: oh well i took a look at ex2ms but didn't undedrstand many things; probably i need to know more about ets first
[09:23:41] lessless: has joined #elixir-lang
[09:26:22] Nicd-: match specs are really annoying to write
[09:26:29] Nicd-: ex2ms allows to just write elixir code instead
[09:32:10] Nicd-: small example from my codebase (not the best because the ex2ms version is also terse but it's better than the spec at least) https://www.irccloud.com/pastebin/jSdN8Dnr/
[09:38:49] theWhisper_: has joined #elixir-lang
[09:45:24] theWhisper__: has joined #elixir-lang
[09:55:17] serafeim: Nicd-: what are match specs ?
[09:55:39] Nicd-: a spec that tells ETS which items to find from the table
[09:55:43] serafeim: they seem like a really complicated thing. what does it have to do with caching ?
[09:56:03] serafeim: Nicd-: so it's something like the cache key that redis or memcached has ?
[09:56:27] Nicd-: it's like a query you give to a database
[09:56:38] serafeim: can't i use just a simple value like in redis ?
[09:57:05] Nicd-: yes if you use some wrapper library that abstracts things
[09:57:27] Nicd-: the ETS API is a bit user hostile IMO
[09:58:03] serafeim: i'll take a look at it and see what happens
[09:58:32] serafeim: the thing is that i don't need caching yet and i'm afraid of premature optimization
[09:59:38] Nicd-: then don't use it :D
[09:59:51] Nicd-: my blog engine's DB module for some ETS examples: https://gitlab.com/Nicd/mebe-2/blob/master/lib/engine/db.ex
[10:00:01] Nicd-: (nicer now that it has Ex2ms)
[10:01:58] serafeim: thanks Nicd-
[10:02:17] serafeim: i really can't understand what's the purpose of that db module. is this something found in a phoenix app normally ?
[10:02:31] Nicd-: it's not a Phoenix app
[10:02:42] Nicd-: my blog engine stores blog posts in ETS
[10:03:33] serafeim: oh. is this a common practice ?
[10:04:45] Nicd-: can't say, I haven't looked at other blog engines
[10:05:13] Nicd-: usually blog engines tend to store posts in an SQL database I guess
[10:05:48] Sgeo_: has joined #elixir-lang
[10:05:49] serafeim: Nicd-: yes that's what i believe also
[10:06:02] serafeim: Nicd-: i thought that ETS was something temporary
[10:06:17] serafeim: Nicd-: i.e will the ETS entries be saved after a reboot ?
[10:06:19] Nicd-: it is, in the sense that it's not persisted to disk
[10:06:33] serafeim: Nicd-: so what happens in your blog when the server reboots ?
[10:06:43] Nicd-: my blog posts are in files, they are rendered into ETS for faster reading
[10:06:48] Nicd-: so ETS is only a kind of a cache
[10:07:11] serafeim: Nicd-: so when the application is started it reads everything from these files and puts it to ets ?
[10:07:33] Nicd-: yes (it renders Markdown into HTML also at that time)
[10:07:47] serafeim: is this done through the crawler module ?
[10:08:39] serafeim: and i guess you have a worker module that calls this when you add a new article ?
[10:09:34] Nicd-: when I make changes I call `Mebe2.Engine.Worker.refresh_db()`
[10:11:36] serafeim: Nicd-: cool! seems nice i'll keep it for further reference
[10:12:46] Miyu-saki: Little thought, but Elixir as an Elm replacement with WASM.
[10:13:42] Miyu-saki: Server-client communication being done over distributed EVM.
[10:14:09] Nicd-: problem 1: BEAM distribution has no security
[10:14:35] Miyu-saki: Yeah, I'm reading on it right no.
[10:14:54] Nicd-: works well if you want to give every client RCE
[10:16:45] Miyu-saki: Nicd-: You can do it over TLS at least.
[10:16:52] Miyu-saki: According to https://www.erlang-solutions.com/blog/erlang-distribution-over-tls.html
[10:17:22] Nicd-: yeah but each node is trusted
[10:17:31] Nicd-: a frontend client cannot be a trusted node
[10:17:32] Miyu-saki: Yeah. The next problem to solve is the RCE.
[10:17:54] Miyu-saki: And I have no idea how to do that.
[10:18:08] Miyu-saki: Since I just started ~5 days ago.
[10:18:17] Miyu-saki: Is there a way to restrict RCE?
[10:18:47] dysfun: just don't
[10:18:53] dysfun: you don't want to go down this path
[10:19:17] Nicd-: BEAM allows you to call any functions on the remote node and send any message. basically you can do anything
[10:19:30] dysfun: cluster nodes are trusted
[10:19:37] dysfun: do not make things you don't trust trusted, period
[10:20:02] dysfun: and firewall everything down
[10:22:57] Nicd-: firewall? surely a cookie is enough. no one can guess it, it's the same combination as on my luggage
[10:23:12] ur5us: has joined #elixir-lang
[10:23:26] dysfun: yes, a cookie transmitted over plaintext will be fine
[10:23:31] dysfun: don't worry
[10:23:43] dysfun: put your feet up and pretend it's all fine
[10:23:44] Miyu-saki: something something, just use NAT.
[10:23:52] gvaughn: has joined #elixir-lang
[10:23:54] Nicd-: over ipv6
[10:24:23] dysfun: i hear attackers have ipv6 addresses these days
[10:24:34] dysfun: it used to be a good way to avoid traffic
[10:28:16] adkron_: has joined #elixir-lang
[10:28:55] voltone: has joined #elixir-lang
[10:33:41] m1dnight_: Nicd-: that blog if yours is hella fast :) nice
[10:34:01] Nicd-: it used to be much faster but then I added features :D
[10:34:27] Nicd-: could get it back to µs scale possibly but I have other things to do
[10:35:32] m1dnight_: Ah, if you have some PRs i can maybe lend q ✋
[10:37:56] m1dnight_: And by pr's i mean issues :p i always confuse the two.
[10:57:27] serafeim: Nicd-: is the blog running somewhere ?
[10:57:28] griffinbyatt: has joined #elixir-lang
[11:04:39] wsieroci: has joined #elixir-lang
[11:04:45] Miyu-saki: Uh, any thoughts on using Elixir for a website without Apache/nginx/whatever?
[11:06:27] m1dnight_: Phoenix doesnt need a webserver
[11:06:35] m1dnight_: And phoenix can do ssl.
[11:06:50] m1dnight_: I dont see a problem?
[11:08:44] Miyu-saki: I'm asking if it's a good idea to do this or not. Like,which is the preferred configuration?
[11:11:09] adkron_: has joined #elixir-lang
[11:12:07] Miyu-saki: I already have nginx setup, and I don't mind configurng it to add Elixir, for example. Should I still use nginx, or just serve directly from Elixir?
[11:13:09] m1dnight_: I prefer to have apache do my ssl amd whatnot. Phoenix only serves http for me
[11:13:20] m1dnight_: One place to manage your certs, domains, etc.
[11:13:40] m1dnight_: (apache, nginx, whatever your preference is)
[11:13:55] m1dnight_: serafeim: https://blog.nytsoi.net/
[11:15:00] Nicd-: m1dnight_: well one plan was to move from ETS to atomics or similar
[11:15:49] m1dnight_: What are atomics? Never heard of it.
[11:16:21] Nicd-: well not atomics apparently
[11:16:22] m1dnight_: Ah found it on erldocs, wilk give it a read
[11:16:28] Nicd-: the globals thingie
[11:16:48] Nicd-: persistent_term
[11:20:10] proteusguy: has joined #elixir-lang
[11:22:54] serafeim: ha ha well it's not that fast i get like ~ 100 ms for the homepage
[11:23:39] serafeim: while for a django project i've made i get < 500 ms (https://sxolesls.hcg.gr/)
[11:23:45] serafeim: oops. < 50 ms i mean
[11:25:42] serafeim: for another (non public) elixir/phoenix project i get like < 10 ms in the homepage
[11:28:20] adkron_: has joined #elixir-lang
[11:32:01] Nicd-: server response time and browser render time are different things 🤷
[11:32:38] serafeim: Nicd-: yes probably it depends on where everything is hosted
[11:32:44] Nicd-: I get 100ms waiting time for your own link so I guess it's all relative. even just pinging my server takes 58ms from here so it can't be faster than that
[11:33:23] serafeim: Nicd-: yes definitely. my link is running on more or less in a server with which i share a switch :)
[11:33:25] lexmag: has joined #elixir-lang
[11:34:39] Nicd-: in that case I have websites running on localhost that are even faster than that
[11:34:44] tnez: has joined #elixir-lang
[11:35:03] drincruz: has joined #elixir-lang
[11:39:47] voltone: has joined #elixir-lang
[11:43:23] adkron_: has joined #elixir-lang
[11:47:12] helpa-bot: has joined #elixir-lang
[11:49:41] helpa: has joined #elixir-lang
[11:50:25] Adkron: has joined #elixir-lang
[12:09:07] nickjj: why does Repo.insert's upsert functionality also modify the inserted_at time by default?
[12:12:08] ericmj: nickjj: do you use `on_conflict: :replace_all`?
[12:15:08] nickjj: ericmj, for now i was just reading the docs but i did plan to do that yeah
[12:15:22] nickjj: because the alternative seems to be having to whitelist every column except inserted_at
[12:15:54] ericmj: yeah, that sounds like the behavior you want
[12:15:58] nickjj: but i'm having difficulty thinking of a use case where if a conflict happened and an update occurred, you would want the inserted_at to be modified
[12:16:27] ericmj: if you don't want everything to be replaced then you shouldn't use `:replace_all` :)
[12:18:15] nickjj: right, :replace_all_except_inserted_at is what i'm after
[12:18:31] nickjj: guess i'll bite the bullet and whitelist every column - inserted_at
[12:19:15] ericmj: you can automate that with the schema reflection functions
[12:19:32] sevenseacat: has joined #elixir-lang
[12:19:38] ericmj: `MySchema.__schema__(:fields) -- [:inserted_at]`
[12:20:13] nickjj: -- is a shortcut for removing a key from a map?
[12:21:36] ericmj: it removes matching elements from a list
[12:21:55] nickjj: ah, i just played with it in iex, i didn't know __schema__ returned a list
[12:21:58] nickjj: cool, thanks
[12:22:32] lexmag: has joined #elixir-lang
[12:23:54] lexmag: has joined #elixir-lang
[12:24:19] blassin: has joined #elixir-lang
[12:32:13] duane: has joined #elixir-lang
[12:36:20] hypercore: hey guys, anyone have any improvements/advice about ankhers ideas for creating templates for Product.category? (convo starts about 14 hours ago in irc)
[12:37:13] dysfun: maybe you could gist it
[12:37:23] hypercore: basically we came to the conclusion that adding the template into the database was the best option (details above), but weren't really sure about performance problems
[12:37:26] hypercore: sure no problem
[12:38:04] hypercore: so i have a Product schema, and each product has a category (e.g. smartphone, laptop, monitor, etc)
[12:38:27] hypercore: and i want to create different templates depending on this Product category
[12:39:16] hypercore: (not talking about rendering a list of key-value properties for each category template, but the layout itself would be slightly different depending on the category
[12:40:34] hypercore: my first two options appeared to be either store every single category property in my "products" table, but this end up with having thousands of columns, which seems pretty dumb
[12:42:07] hypercore: the other option was to store these properties in a jsonb field in the Product, and then render it to my lib/my_app_web/templates/product_templates/smartphone.html.eex file, but this causes issues if i want to change or update the properties that a particular category has
[12:42:50] hypercore: e.g. if smartphone has property "batterysize" and i want to change it to "batterycapacity", then in my smartphone.html.eex template, all instances of @product.batterysize would break
[12:43:19] hypercore: i.e. versioning of these templates would create lots of issues
[12:44:34] hypercore: so ankhers suggested i store all templates in a "templates" table (i.e. Template.layout, Template.properties), and then just render the particular category template version for each product instance
[12:45:15] hypercore: this would be having differing templates for the same category, but it solves most of the other problems and so far i can't think of any better improvements to this option
[12:46:03] hypercore: only question i have is that it would require me to render the templates dynamicially (using EEx.eval_string), and i'm not sure if this would put an unreasonable load on my server
[12:46:37] dysfun: i would say you should be more worried about the contents of the eex templates and less about the parsing
[12:47:01] hypercore: dysfun: can you elaborate?
[12:47:31] dysfun: parsing templates is relatively cheap
[12:47:45] dysfun: and you can figure out some sort of cacheing thing if need be
[12:48:17] hypercore: ok so you think this strategy is pretty water-tight?
[12:49:09] dysfun: no, i think there are all sorts of problems with it, not least of which is if an attacker were somehow able to write their own template and insert it into the db
[12:49:22] dysfun: but i think it can be made to work
[12:49:27] hypercore: personally i would feel more comfortable if the templates were stored in lib/my_app_web/templates/product_templates, but that's only because that's where i've always stored my templates
[12:50:01] hypercore: i think the only downside with this is i have to restart the server for sellers to be able to use new/updated templates (but this isn't a huge problem for me)
[12:50:08] dysfun: why do you need to put the templates in the database again?
[12:50:31] hypercore: dysfun: so i don't have to restart the app everytime i update/create a template
[12:50:45] hypercore: (because templates are compiled)
[12:51:06] dysfun: there are other ways of dealing with that
[12:53:05] dysfun: you can compile code with the compiler api
[12:53:12] dysfun: you can load code
[12:53:42] dysfun: you just need some way of knowing you should. perhaps you wouldn't want a file watcher, but maybe some action in a web control panel?
[12:54:15] hypercore: dysfun: maybe i'll just skip the dynamic loading, because it also means my templates would not be synced with my git repo
[12:54:50] hypercore: if i do it all in development, i can properly keep track of my templates in git, they're compiled, and it reduces some of the security issues that might arise
[12:55:02] dysfun: it's the easy path
[12:55:36] uberbrodt: has joined #elixir-lang
[12:57:30] hypercore: dysfun: so then my schemas would look like: Product -> id | name | properties:jsonb | template_id:int, Template -> id | name:"smartphone-ver-1" | "smartphone-ver-1.html.eex"?
[12:59:59] wsieroci: has joined #elixir-lang
[13:06:09] gvaughn: has joined #elixir-lang
[13:08:51] Sgeo__: has joined #elixir-lang
[13:27:12] Adkron: has joined #elixir-lang
[13:35:50] wsieroci: has joined #elixir-lang
[13:46:47] Adkron: has joined #elixir-lang
[13:47:57] gvaughn: has joined #elixir-lang
[13:53:27] dysfun: er eex templates get compiled to functions in a module
[13:54:56] hypercore: what is this in response to?
[13:55:12] dysfun: your last message
[13:56:49] thurloat: has joined #elixir-lang
[13:58:28] hypercore: dysfun: i'm lost xD
[13:58:31] adkron_: has joined #elixir-lang
[13:58:41] hypercore: i was just asking about how my schema's would look
[13:59:26] dysfun: right, you wouldn't index them by filename, but my module and function name
[14:00:33] hypercore: oh i see what you're saying, but wouldn't that also just be stored as a string in the db? why not just store the template file name as a string instead?
[14:00:59] hypercore: that line above was meant to be my migration table, sorry if that wasn't clear
[14:02:19] hypercore: do you mean controller module and controller action name?
[14:02:30] dysfun: no, view module and view action name
[14:04:21] hypercore: dysfun: not sure i follow, why not just store the template name, and then in my product/show.html.eex template, do something like <%= render ProductView, @product.template.name %>?
[14:05:03] hypercore: or more like <%= render ProductView, @product.template.name, props: @product.properties %>
[14:05:30] dysfun: ACTION shrugs
[14:05:48] dysfun: i don't spend much time with views
[14:08:00] hypercore: dysfun: regarding the :on_delete option for "add :product_id, references(:products), on_delete: ...", what does it mean exactly?
[14:08:26] dysfun: it indicates what should happen to the record should the product it points to be deleted
[14:08:27] hypercore: that when you delete the referenced product, that action will happen to the current table?
[14:08:41] hypercore: oh ok great, thanks
[14:10:08] voltone: has joined #elixir-lang
[14:11:02] hypercore: well, guess i'll try this all out and see how it goes. thanks for your help dysfun
[14:11:16] Adkron: has joined #elixir-lang
[14:17:42] nduro: has joined #elixir-lang
[14:19:38] Guest84: has joined #elixir-lang
[14:22:52] greengriminal: has joined #elixir-lang
[14:24:03] Sentreen: Is there an easy way to temporarily exclude a bunch of modules from being compiled?
[14:24:28] Sentreen: Context: I am in the middle of a huge refactor effort, which means I am breaking a lot of things until I can bring my code up to date
[14:24:38] dysfun: comment it out
[14:24:48] Sentreen: However, I'd still like to run unit tests etc while I refactor
[14:25:22] Sentreen: The project is a bit too large for that :/. Right now I'm moving files, but it's pretty clunky
[14:25:34] dysfun: you could conditionally compile depending on e.g. Mix.env
[14:27:02] Sentreen: you mean changing elixirc_paths based on Mix.env?
[14:27:46] dysfun: no, i mean if Mix.env == :dev do ; defmodule ... do; ... end ; end
[14:28:50] Sentreen: Oh, that's a good idea. I didn't realise I could access Mix.env at compile time that way
[14:34:13] wsieroci: has joined #elixir-lang
[14:38:48] ishw0r: has joined #elixir-lang
[14:56:25] aalmazan: has joined #elixir-lang
[15:01:12] drrty: has joined #elixir-lang
[15:08:09] hypercore: if i want my Products to have videos/images associated with them, what's the best way of defining this in the schema/db?
[15:09:29] hypercore: should i have a "videos/images" table where each row points to a Product, or should i just store this info in my "props" json field?
[15:09:45] hypercore: i.e. Product.props = %{videos: [], images: []}
[15:11:05] benwilson512: hypercore: you probably want real associations
[15:21:12] hypercore: benwilson512: seperate tables for videos and images, or a single one?
[15:21:33] benwilson512: hypercore: depends on whether you want / need separate kinds of metadata for videos vs images
[15:21:39] benwilson512: I'd probably just do one
[15:25:21] hypercore: benwilson512: great, thanks
[15:27:56] wsieroci: has joined #elixir-lang
[15:28:49] hypercore: benwilson512: how would you recommend defining the schema/migration by the way? never done one for videos/images before
[15:29:16] hypercore: something like "id | src | product_id"?
[15:31:47] benwilson512: hypercore: I'd definitely check out arc / arc_ecto which is a handy library for managing stuff like that
[15:32:11] Saukk: has joined #elixir-lang
[15:32:48] benwilson512: plus it'll help you do stuff like store the contents on s3 in production but on disk locally
[15:35:33] icecreamcohen: has joined #elixir-lang
[15:37:19] hypercore: benwilson512: wow that's way more complex than my current set up, but i suppose it makes things a lot easier in the long run
[15:39:38] icecreamcohen: has joined #elixir-lang
[15:44:37] Duponin: /buffer 14
[16:04:25] wsieroci: has joined #elixir-lang
[16:13:20] cbw[m]: has anyone updated to phx 1.4.7? im getting an error in phoenix when i run my tests, wondering if anyone else is getting it: `** (CompileError) lib/phoenix/router/console_formatter.ex:86: unknown key :plug_opts for struct Phoenix.Router.Route`
[16:13:59] chrismccord: cbw[m] : weird. Can you try running mix clean and rerun your tests?
[16:15:34] cbw[m]: chrismccord: ran `mix deps.clean --all && mix test` and still getting it.
[16:16:18] chrismccord: cbw[m] only in test env? Runninng in dev and prod compiles fine?
[16:16:45] chrismccord: cbw[m] to be clear, `mix clean` or simply `rm -rf _build` is what I'm asking
[16:16:48] chrismccord: (not deps clean)
[16:17:51] cbw[m]: chrismccord: i also did `mix clean`. Also getting it compiling for dev
[16:18:20] cbw[m]: gonna downgrade just to be doubly sure this is what happened
[16:18:20] chrismccord: cbw[m] can you blow away _build as a sanity check? I cannot recreate this
[16:20:42] cbw[m]: chrismccord: yeah i did that. So it looks like dependabot only updated the hex.lock file and not the mix.exs file. That might be causing some issues?
[16:21:36] cbw[m]: I'll see if I can recreate in a phx_new
[16:21:56] chrismccord: cbw[m] : not sure how that happens. So mix points at 1.4.6 but mix.lock pionts at 1.4.7?
[16:23:56] chrismccord: cbw[m] actually that is fine. If mix is `~> 1.4.6`, you'd grab 1.4.7 which is expected. So nothing to see there
[16:23:58] cbw[m]: chrismccord: That's right. I fixed that but i'm still getting the issue. I can also recreate in a new phx.new app
[16:24:28] chrismccord: cbw[m] what elixri vsn?
[16:25:06] cbw[m]: ACTION sent a long message: < https://matrix.org/_matrix/media/v1/download/matrix.org/YiKIOrITGsfovNifgYNTXjOU >
[16:25:53] warmwaffles: has joined #elixir-lang
[16:26:17] chrismccord: cbw[m] is this only on your build sever or also locally?
[16:26:58] cbw[m]: This is locally, i'll try our build server
[16:27:16] chrismccord: cbw[m] : nah, locally is fine. I wanted to make sure it wasn't something cached on the build server
[16:29:19] cbw[m]: chrismccord: i downgraded to 1.4.6 and i still get this error on a fresh phx app... hmm
[16:29:34] chrismccord: just tested on elixir 1.8.1 and all green
[16:29:50] chrismccord: cbw[m] : can you look inside your deps/phoenix/lib/phoenix/router/route.ex?
[16:30:06] chrismccord: that compile error line doesn't make sense because our %Route{} struct definitely has that key
[16:30:48] chrismccord: cbw[m] can you double check your deps folder contains this? ie :https://github.com/phoenixframework/phoenix/blob/v1.4/lib/phoenix/router/route.ex#L27
[16:32:11] Disorganized: has joined #elixir-lang
[16:34:08] cbw[m]: chrismccord: Yeah it def does, so this is odd
[16:34:23] cbw[m]: chrismccord: I'm happy this isn't an issue with the new release, so i'll let you go since this seems like some issue with my box
[16:34:52] chrismccord: cbw[m] : an you for sure `rm -rf _build` ?
[16:35:12] chrismccord: I mean if the deps code is there and there is no dangling beam files, then it can't be possible
[16:36:32] cbw[m]: I'm very sure i did `rm -rf _build`... i also created a brand new phx app
[16:36:46] cbw[m]: i reverted that commit and it works now, wtf
[16:37:45] cbw[m]: here is my diff https://gist.github.com/cadebward/10b16b5e29c736decd49f759a3ca4788
[16:40:03] cbw[m]: `mix deps.update phoenix` brings the error back :O
[16:43:13] pera: has joined #elixir-lang
[16:44:57] chrismccord: we renamed :opts to :plug_opts in this release https://github.com/phoenixframework/phoenix/commit/857de9a761fb4abda3bbb474ebb3abe58d0d54f8
[16:45:08] cbw[m]: chrismccord: figured it out, i had phx 1.5.0-dev installed as a mix archive, once i removed that it was fine
[16:45:30] chrismccord: but the only way that compiler error happens if is there is a build artifact hanging somewhere, which is really odd and doesn't make sense if you blew away everything
[16:45:57] chrismccord: cbw[m] : ahhh. So you ran `mix archive.install hex phx` instead of `mix archive.install hex phx_new` ?
[16:46:35] chrismccord: cbw[m] : that means phoenix 1.5.0-dev would be loaded on every mix command, system wide, which brings sanity back to this at least :D
[16:46:37] cbw[m]: and it was giving me the warnings that i was redefining modules
[16:46:52] chrismccord: glad we got it sorted out
[16:47:19] cbw[m]: glad nothing is broken :D thanks
[16:49:50] jnoon2: has joined #elixir-lang
[16:58:38] hypercore: has joined #elixir-lang
[16:58:50] icecreamcohen: has joined #elixir-lang
[17:03:46] BitBot: has joined #elixir-lang
[17:04:00] lexmag: has joined #elixir-lang
[17:10:23] icecreamcohen: has joined #elixir-lang
[17:11:48] tuacker: has joined #elixir-lang
[17:14:41] drincruz: has joined #elixir-lang
[17:15:23] duane: has joined #elixir-lang
[17:15:31] BitBot: has joined #elixir-lang
[17:17:29] drincruz_: has joined #elixir-lang
[17:20:41] ankhers: hypercore: re: security with eex in database. This is one of the reasons I originally suggested something like mustache.
[17:25:52] Disorganized: has joined #elixir-lang
[17:26:21] janlindblom: has joined #elixir-lang
[17:26:36] hypercore: Ankhers: might just go with the hard-coded templates, that way i can also store it in my git repo
[17:27:09] hypercore: and it saves having to deal with some of the hassles dynamic templates would cause
[17:30:40] ankhers: Either way works.
[17:41:08] shany: has joined #elixir-lang
[17:41:55] shanthi: has joined #elixir-lang
[17:46:49] hypercore: Ankhers: thanks for all the help yesterday by the way, i was seriously stuck
[17:54:58] squall: has joined #elixir-lang
[17:55:43] sangoma: has joined #elixir-lang
[17:59:16] squall: has joined #elixir-lang
[18:05:34] vaer-k: has joined #elixir-lang
[18:09:22] ankhers: hypercore: Not problem.
[18:38:20] gde33: has joined #elixir-lang
[18:40:15] voltone: has joined #elixir-lang
[18:56:51] Disorganized: has joined #elixir-lang
[19:05:41] either|or: has joined #elixir-lang
[19:12:56] ctp_: has joined #elixir-lang
[19:15:13] vaer-k: has joined #elixir-lang
[19:15:55] icecreamcohen: has joined #elixir-lang
[19:22:09] icecreamcohen: has joined #elixir-lang
[19:37:48] wonko7: has joined #elixir-lang
[19:39:20] Gazler: has joined #elixir-lang
[19:43:46] Disorganized: has joined #elixir-lang
[19:54:00] mahmudov: has joined #elixir-lang
[19:54:53] pera: has joined #elixir-lang
[19:59:41] nickjj_: has joined #elixir-lang
[20:00:51] icecreamcohen: has joined #elixir-lang
[20:03:37] Jikan: has joined #elixir-lang
[20:05:56] subsonik: has joined #elixir-lang
[20:17:02] nickjj: has joined #elixir-lang
[20:22:58] AJA: has joined #elixir-lang
[20:23:20] Axsuul: has joined #elixir-lang
[20:25:54] ajal: has joined #elixir-lang
[20:28:32] ajal: has left #elixir-lang: ()
[20:30:26] BitBot: has joined #elixir-lang
[20:42:36] pera: has joined #elixir-lang
[21:02:06] tuacker: has joined #elixir-lang
[21:02:46] tuacker: has joined #elixir-lang
[21:03:36] tuacker: has joined #elixir-lang
[21:10:28] DTZUZO: has joined #elixir-lang
[21:12:25] feld: if I have [{"title", [], ["This is my title"]}] and I want to return only the "This is my title" part, how do I do that?
[21:16:06] Disorganized: has joined #elixir-lang
[21:19:03] sebsel: [{"title", [], [title]}] = thing; title
[21:19:22] sebsel: where you can change ; for a new line if you want
[21:20:38] ndee: has joined #elixir-lang
[21:28:05] feld: I think we've gone inception a bit. Too many layers of "title" to grok
[21:28:44] ur5us: has joined #elixir-lang
[21:29:22] feld: let's try this again because i think there's a misunderstanding
[21:29:50] feld: Floki.find(html, "title") function produces [{"title", [], ["This is my title"]}] . All I want is the "This is my title" part. How do I get that from the result?
[21:35:28] sebsel: Floki.text/2? https://hexdocs.pm/floki/Floki.html#text/2
[21:36:08] adkron_: has joined #elixir-lang
[21:40:39] feld: I mean, I guess I can pipe it through Floki.text in this scenario but it doesn't help me in others
[21:40:55] feld: How do you reference that last element? I mean, hashes of hashes of arrays in Perl are simpler than this
[21:43:02] sebsel: Well since it's a tuple, you know that it's not the last element, but the third. Then you can do elem({:a, :b, :c}, 2) to get :c
[21:44:30] sebsel: otherwise: pattern match
[21:46:12] sebsel: you know that it's not the last => it's easier to think of it as the third element than as the last, because tuples won't grow in size once defined
[21:49:15] __charly__: has joined #elixir-lang
[21:49:46] Guest84: has joined #elixir-lang
[21:50:41] Guest84: has joined #elixir-lang
[21:51:29] Guest84: has joined #elixir-lang
[21:52:06] Guest84: has joined #elixir-lang
[21:53:01] Guest84: has joined #elixir-lang
[21:53:46] Guest84: has joined #elixir-lang
[21:54:31] Guest84: has joined #elixir-lang
[21:55:21] Guest84: has joined #elixir-lang
[21:56:06] Guest84: has joined #elixir-lang
[21:56:49] Guest84: has joined #elixir-lang
[22:30:04] Disorganized: has joined #elixir-lang
[22:37:52] Disorganized: has joined #elixir-lang
[22:43:45] nickjj: can someone help me reverse something from the hex.pm source code?
[22:43:55] squall: has joined #elixir-lang
[22:44:09] nickjj: if you check out the creation action in the login controller at https://github.com/hexpm/hexpm/blob/master/lib/hexpm_web/controllers/login_controller.ex#L14
[22:44:23] nickjj: it pattern matches on the username and password -- pretty standard so far
[22:45:01] Sgeo: has joined #elixir-lang
[22:45:08] nickjj: but if you goto https://hex.pm/login , inspect the username element , delete it and submit the form with no username field , technically there should be no username in the params but that create action still matches it and throws a 400 -- how is that happening?
[22:45:52] nickjj: i would have anticipated an error 500 to be thrown because no pattern was matched
[22:46:12] drincruz_: has joined #elixir-lang
[22:46:47] nickjj: i have a feeling a generic 400 is being thrown from somewhere else but i can't figure out where or how
[22:47:47] ericmj: phoenix raises ActionClauseError on clauses that don't match
[22:48:16] ericmj: ActionClauseError implements Plug.Exception which converts the exception to a 400 status
[22:48:42] lexmag: has joined #elixir-lang
[22:49:56] nickjj: ah, so as long as you have a generic 400 set up in your error handlers, you're good to go?
[22:49:57] drincruz: has joined #elixir-lang
[22:51:21] ericmj: wdym error handler?
[22:53:08] nickjj: something to explicitly handle that in a phoenix ErrorView
[22:53:51] ericmj: yeah, you need to handle all errors in ErrorView
[22:53:57] greengriminal: has joined #elixir-lang
[22:56:42] nickjj: thanks, that's really perfect then -- i almost went down a very bad path
[22:57:28] nickjj: i mean, with that 400 catch in place, you could aggressively pattern match on map elements in your actions and if people try to mess around with your HTML by removing stuff, it's all handled in 1 spot with a sane default generic response
[23:00:50] notzmv: has joined #elixir-lang
[23:02:12] drincruz: has joined #elixir-lang
[23:03:17] thurloat: has joined #elixir-lang
[23:04:59] pera: has joined #elixir-lang
[23:13:11] Disorganized: has joined #elixir-lang
[23:32:55] mozzarella: has joined #elixir-lang
[23:33:00] Disorganized: has joined #elixir-lang
[23:41:10] vaer-k: has joined #elixir-lang
[23:48:39] Disorganized: has joined #elixir-lang
[23:56:23] ariedler: has joined #elixir-lang