#elixir-lang - 14 March 2019
« Back 1 day Forward 1 day »
[08:24:47] dminuoso: I mean yeah I guess I can just pattern match on the conn and extract the body and params manually, it'd been much nicer if phoenix didn't pretend that throwing both into one argument was "the right thing to do"
[08:25:19] Nicd-: I guess their way of looking at it is that you shouldn't have the same things in both anyway
[08:26:23] Nicd-: it's not, since Phoenix is an opinionated framework. that's the answer to your "why?"
[08:30:10] zakora: Is there a way to execute a .exs file in a project context? For example being able to call the same functions as I would inside "iex -S mix"
[08:34:00] Nicd-: zakora: moi moi :) I'm just excited to see Elixir programmers in Finland (judging by your hostname)
[08:36:12] dysfun: Nicd-: i remember from my time at nokia... <blah blah> failing test case <blah blah blah>
[10:39:08] hypercore: Nicd-: not sure where the db config file is, could only see "5432" showing up in deps/, but im pretty sure i shouldn't touch that
[11:22:05] dminuoso: Ecto queryables are constructed using `from u in "blah"`... what is that `in` inside there? Is that just a fragment of macro-based DSL?
[11:34:44] Nicd-: the former configures the release generation, the latter is for runtime config of the system
[11:34:49] hypercore: in the context of this guide? -> https://hexdocs.pm/distillery/guides/working_with_docker.html
[11:35:31] Nicd-: did you read it? https://hexdocs.pm/distillery/guides/working_with_docker.html#running-the-image
[11:35:51] Nicd-: probably best to read about Distillery config providers if you don't know how they work
[11:50:55] shmink: I was getting pissed with no autocomplete or anything working with foo.html.eex files in vscode so I created a load of snippets if anyone is interested https://gist.github.com/shmink/407b00e4e230642b6e8448bb29ea5155
[12:09:42] hypercore: Nicd-:i'm just following the guide from -> https://hexdocs.pm/distillery/guides/working_with_docker.html
[12:19:35] ElixirNoob: Hello, I am reading the "Learn functional programming with Elixir book" and I've reached chapter 4 where it tries to introduce recursion
[12:20:43] ElixirNoob: now, I've seen this practive in the previous chapters as well (i.e define multiple functions) instead of using a conditional like if or cond
[12:21:27] ElixirNoob: is there a reason for that (avoiding cond/if)? I am using to using cond from lisp and my mind always thinks that way
[12:22:18] benwilson512: ElixirNoob: pattern matching is a more broadly applicable approach. you can use if or cond with similar ease in this specific use case
[12:22:39] benwilson512: the learning material is likely working up towards pattern matching on list shapes which becomes dramatically more verbose if you don't pattern match
[12:24:09] benwilson512: pattern matching is an extremely powerful feature, even if the first sort of intro to it could be easily rendered with traditional conditionals, plenty of stuff going forward is much less ergonomic that way
[12:24:17] hypercore: should i submit a bug report for this guide? https://hexdocs.pm/distillery/guides/working_with_docker.html
[12:24:18] ElixirNoob: so you think I should try to change my mindset and stick to the pattern matching
[12:24:59] benwilson512: for learning purposes avoid them almost entirely for now and then sprinkle them back in as they make sense later
[12:26:17] dysfun: that previous function could be rewritten as a case if you prefer, this is just shorter
[12:27:01] benwilson512: ElixirNoob: case is great, function head matching is great, both compile to the same thing performance wise
[12:51:42] ElixirNoob: also has anybody read the book I mentioned ("Learn functional programming with Elixir book" by Ulisses Almeida) ? it seems very easy till now
[12:55:36] benwilson512: ElixirNoob: I have not read it. The Dave Thomas book I have read and is very good, as is Elixir in Action. The latter does a particularly good job of introducing unique Elixir / Erlang concepts related to processes
[13:25:34] hypercore: anyone got this error before? "** (RuntimeError) unknown release config setting `config_providers`"?
[13:28:21] ElixirNoob: oh well, i've tried to understand these a bit from answers to SO and stopped before my head exploded :/ so i'll definitely keep the "elixir in action" book in mind, thanks!
[13:42:27] hypercore: is this article outdated? https://dockyard.com/blog/2018/08/23/announcing-distillery-2-0
[13:46:35] hypercore: Nicd-: here are my rel/config.exs and rel/config/config.exs files -> https://paste.ubuntu.com/p/gWFJc7kc4f/
[13:48:39] Nicd-: example of working rel config: https://gitlab.com/Nicd/mebe-2/blob/master/rel/config.exs
[13:55:55] hypercore: Nicd-: hmm i moved it to :prod, but still getting the same error -> https://paste.ubuntu.com/p/qgTtrx9sTb/
[14:12:21] hypercore: rbino: cool, thanks for that. I always see "~>" in examples, so thats just what i've always used
[14:13:05] rbino: yes because ideally people should use consistent APIs in minor releases if they follow semantic versioning
[14:14:19] rbino: if you use >= a major update could break your code, while using ~> you are safe if the library author is a good person
[14:15:11] rbino: then again, the world is full of bad people (but they are all outside of the Elixir ecosystem fortunately)
[14:16:44] rbino: a small detail that bit me in the past is that ~> 1.0 gets you 1.2 if available but ~> 1.0.0 does not (it would only get you 1.0.x if available)
[14:54:18] uncle_phil: If anyone is interested in the following VSCode snippets throw a star on it and I'll turn it into an extension https://gist.github.com/shmink/407b00e4e230642b6e8448bb29ea5155
[14:54:41] cjk101010: huh. how could that happen? 15:53:51.032 [error] Postgrex.Protocol (#PID<0.427.0>) disconnected: ** (DBConnection.ConnectionError) ssl send: closed
[15:03:29] Zarathu: chrismccord: i'm writing some liveviews now in anticipation of the release. qq: are the templates all going to have to be written as ~L multi-line strings, or will there be support for files like traditional templates?
[15:05:39] cjk101010: hm, seems to be an timeout issue. setting (test-wise) :timeout to :infinity solves the problem.
[15:12:38] cjk101010: this seems wrong to me… what can I do to solve this problem correctly? I have a long-running transaction (a data import module) which can run several minutes up to an hour. I set timeout: :infinity on the Repo.transaction/2 call, but the database connection seems to break due to timeouts, on random other places
[15:13:33] cjk101010: I can solve this by setting timeout: :infinity on the repo config, but that's seems wrong to me
[15:17:22] hypercore: anyone know why i get this error when i try to run a custom command on my release? -> https://paste.ubuntu.com/p/nfvfPjwtx8/
[15:22:32] hypercore: using the cod from -> https://hexdocs.pm/distillery/guides/running_migrations.html
[15:26:00] hypercore: what's weird is that "migrate" and "seed" show up in custom commands when i run "./bin/app"
[15:32:31] cjk101010: I posted on elixirforum about my problem with the ecto timeouts: https://elixirforum.com/t/timeout-errors-with-long-running-transactions/20879
[16:04:47] chrismccord: Zarathu both are supported. You can make an `.leex` template file, or do an inline ~L
[16:05:41] hypercore: currently get this error (https://paste.ubuntu.com/p/DrgckMbPZZ/) when i try to run my app on deployment
[17:11:15] gvaughn: I want to use a POSIX named class in a regex, but can't get the syntax right. I try ~r/[:punct:]/ but get "(Regex.CompileError) POSIX named classes are supported only within a class at position 0 " Anybody know how to do this?
[19:20:34] Poeticode: for removing an associating (created with cast_assoc in their changeset), would I just clear out the foreign key column on that associated element?
[23:17:58] toothfairy__: Hi, how do I correctly do the cast_assoc? (#17) Theres a review_id in the args, https://dpaste.de/YmEK