« Back to channel list

#elixir-lang - 19 July 2019

« Back 1 day Forward 1 day »
[01:10:04] ur5us: has joined #elixir-lang
[01:20:11] ur5us: has joined #elixir-lang
[01:35:49] hypercore: rawtaz: thining about building one, but i'm not sure the schema i should use
[01:40:57] oetjenj: has joined #elixir-lang
[01:52:35] ariedler: has joined #elixir-lang
[02:03:30] tomterl: has joined #elixir-lang
[02:08:16] rshetty: has joined #elixir-lang
[02:13:48] drrty: has joined #elixir-lang
[02:13:49] mdbm_: has joined #elixir-lang
[02:40:45] greengriminal: has joined #elixir-lang
[02:42:38] oetjenj: has joined #elixir-lang
[02:43:20] oetjenj: has joined #elixir-lang
[02:44:07] oetjenj: has joined #elixir-lang
[02:44:52] oetjenj: has joined #elixir-lang
[02:45:37] oetjenj: has joined #elixir-lang
[02:46:27] oetjenj: has joined #elixir-lang
[02:47:09] oetjenj: has joined #elixir-lang
[02:48:09] oetjenj: has joined #elixir-lang
[02:48:50] oetjenj: has joined #elixir-lang
[02:49:23] Saukk: has joined #elixir-lang
[02:50:22] oetjenj: has joined #elixir-lang
[02:50:32] iamvery: has joined #elixir-lang
[02:51:02] oetjenj: has joined #elixir-lang
[02:52:35] Sgeo__: has joined #elixir-lang
[03:24:25] greengriminal: has joined #elixir-lang
[03:27:24] oetjenj: has joined #elixir-lang
[03:28:24] oetjenj: has joined #elixir-lang
[03:33:56] notzmv: has joined #elixir-lang
[03:34:06] siwatpru: has joined #elixir-lang
[03:43:01] siwatpru: has joined #elixir-lang
[03:51:55] siwatpru: has joined #elixir-lang
[03:52:25] orbyt_: has joined #elixir-lang
[04:15:07] mdbm_: has joined #elixir-lang
[04:43:58] rshetty: has joined #elixir-lang
[04:44:40] proteusguy: has joined #elixir-lang
[04:55:50] mdbm: has joined #elixir-lang
[04:56:59] rshetty: has joined #elixir-lang
[04:59:43] jeffro: has joined #elixir-lang
[05:11:52] mdbm_: has joined #elixir-lang
[05:13:08] _rshetty_: has joined #elixir-lang
[05:31:45] rshetty: has joined #elixir-lang
[05:38:41] serafeim: is there a way to have something like "1 transaction per request" in phoenix ? i mean through a plug or whatever ?
[05:39:29] serafeim: i.e start my transaction before any controller code is executed and after everything finishes properly commit my transaction
[05:40:02] serafeim: yes, i know all the implications of this but i also know that this is something that i absolutely need.
[05:45:39] sangoma: has joined #elixir-lang
[05:46:18] ariedler_: has joined #elixir-lang
[05:46:34] Sgeo_: has joined #elixir-lang
[05:48:40] jsehop982: has joined #elixir-lang
[05:49:28] aksu: has joined #elixir-lang
[05:50:17] absolutejam: has joined #elixir-lang
[05:55:47] zakora: has joined #elixir-lang
[06:00:59] mdbm__: has joined #elixir-lang
[06:04:11] ur5us: has joined #elixir-lang
[06:10:53] oetjenj: has joined #elixir-lang
[06:16:06] tuacker: has joined #elixir-lang
[06:22:24] gvaughn: has joined #elixir-lang
[06:23:15] za1b1tsu: has joined #elixir-lang
[06:29:54] oetjenj: has joined #elixir-lang
[06:30:44] oetjenj: has joined #elixir-lang
[06:31:28] oetjenj: has joined #elixir-lang
[06:32:14] oetjenj: has joined #elixir-lang
[06:32:59] oetjenj: has joined #elixir-lang
[06:33:43] oetjenj: has joined #elixir-lang
[06:34:24] oetjenj: has joined #elixir-lang
[06:35:26] oetjenj: has joined #elixir-lang
[06:36:09] oetjenj: has joined #elixir-lang
[06:36:54] oetjenj: has joined #elixir-lang
[06:38:42] iamvery: has joined #elixir-lang
[06:43:34] oohnoitz: has joined #elixir-lang
[06:50:12] ndee: has joined #elixir-lang
[06:53:40] oohnoitz: has joined #elixir-lang
[07:04:10] absolutejam: has joined #elixir-lang
[07:06:24] siwatpru: has joined #elixir-lang
[07:17:07] Sgeo__: has joined #elixir-lang
[07:32:06] Sgeo_: has joined #elixir-lang
[07:39:00] lexmag: has joined #elixir-lang
[07:43:17] mdbm: has joined #elixir-lang
[07:44:55] zakora: has joined #elixir-lang
[07:45:55] absolutejam2: has joined #elixir-lang
[07:51:58] oohnoitz: has joined #elixir-lang
[08:03:09] kayront: has joined #elixir-lang
[08:10:27] gvaughn: has joined #elixir-lang
[08:12:24] PragTob: has joined #elixir-lang
[08:22:57] rkleef: has joined #elixir-lang
[08:26:51] josevalim: micmus, nox: do you know where is the constant in the VM for an empty list?
[08:27:13] nox: It's NIL
[08:27:20] nox: josevalim: Probably erl_term.h
[08:27:48] nox: josevalim: https://github.com/erlang/otp/blob/master/erts/emulator/beam/erl_term.h#L285-L288
[08:27:52] josevalim: #define NIL ((~((Uint) 0) << _TAG_IMMED2_SIZE) | _TAG_IMMED2_NIL)
[08:29:15] nox: josevalim: It's Term::NIL in nam :P
[08:29:37] nox: and that just stores a Word::NIL, because I'm trying to have separate types for machine words and the actual terms.
[08:38:05] Gazler: has joined #elixir-lang
[08:58:22] serafeim: i'll ask again if anybody has any idea: is there a way to have something like "1 transaction per request" in phoenix ? i mean through a plug or whatever ? i.e start my transaction before any controller code is executed and after everything finishes properly commit my transaction
[09:09:21] jeffro: has joined #elixir-lang
[09:09:22] faridgh: has joined #elixir-lang
[09:13:33] mdbm: in my routes, I defined a scope:
[09:13:34] mdbm: scope "/admin", MyAppWebWeb, as: :admin do
[09:13:58] mdbm: and it has a session controller for login/logout/...
[09:14:02] mdbm: resources "/sessions", Admin.SessionController, only: [:new, :create, :delete]
[09:14:36] mdbm: the problem is that the admin scope needs authentication (pipe_through [:browser, :authenticate_user, :admin_pages])
[09:14:41] mdbm: so I cannot access the login page
[09:15:06] mdbm: I could move the :new action to another scope I guess, but I'd like to have the admin layout and if possible, the url has /admin
[09:16:24] mdbm: so the problem: I have put the admin login page into the admin scope => access to admin scope needs authentication => I cannot access my admin login page because not already authenticated
[09:16:52] serafeim: mdbm: don't pipe these through the :authenticate_user
[09:17:31] mdbm: serafeim, well the admin section of my website need authentication, ALL except the login page ofc
[09:17:36] serafeim: pipe them only through the :browser
[09:18:03] serafeim: mdbm: you can put the authenticate_user plug in your controller
[09:18:36] mdbm: serafeim, just to achieve what I want, I need now to use the plug in every admin controller... well I guess there's no magic, maybe the only way
[09:19:44] mdbm: serafeim, would have been nice to be able to specify plug per route (get/resources/...) or to exclude some
[09:20:05] mdbm: serafeim, that way, for the login page, I could exclude the authentication but still keep the layout for example
[09:20:28] serafeim: but you can do that in your controller file for example `plug :authenticate_user when action in [:new, :create, :show, :edit, :update, :delete]
[09:20:52] serafeim: i'm not sure if that's also possible in the routes definition but it is enough for me
[09:21:09] mdbm: serafeim, yeah, but now I need to add that in every admin controller, and it is not in just one place. I liked to have that directly in the route file, it's like configuration
[09:21:54] serafeim: well another simple solution would be to move the SessionController out of amdin
[09:21:57] serafeim: out of admin
[09:22:09] serafeim: a session is for the whole app not only for the admin
[09:22:32] serafeim: at least that's the normal thing to do
[09:22:43] mdbm: serafeim, yeah but it gets annoying with naming then, I have a login page specific for admin, which looks raw and with the admin layout, and ofc I have a login page for the site visitors, with a nicer design.
[09:23:24] serafeim: mdbm: sorry i'm not so experienced with phoenix routes :|
[09:24:22] mdbm: serafeim, well at least two reasons to have separate: one example: on successful login, you redirect to different templates (admin are redirected to the CMS, visitors to their user's profile for example.
[09:24:57] mdbm: so it seems to me that the controller must be different, or I will have conditions in the controller based on user type...
[09:29:59] mdbm: serafeim, hah, I remember it was possible to create nested scopes... I will play with that now
[09:32:45] blassin278262: has joined #elixir-lang
[09:38:23] mdbm: serafeim, it seems to work, this is amazing: https://pastebin.com/zWXUnn53
[09:42:55] serafeim: mdbm: nice !
[09:49:09] DTZUZO: has joined #elixir-lang
[09:59:28] craigp: has joined #elixir-lang
[10:03:29] faridgh: has joined #elixir-lang
[10:06:20] flaviodesousa: has joined #elixir-lang
[10:07:40] Havvy: has joined #elixir-lang
[10:10:46] absolutejam2: has joined #elixir-lang
[10:15:44] iamvery: has joined #elixir-lang
[10:23:53] jeffro: has joined #elixir-lang
[10:33:22] faridgh: has joined #elixir-lang
[10:41:37] lexmag: has joined #elixir-lang
[10:52:07] nox: josevalim: Why were you looking for NIL btw?
[10:53:17] gvaughn: has joined #elixir-lang
[10:54:31] faridgh: has joined #elixir-lang
[10:58:21] Neil: has joined #elixir-lang
[10:58:46] Neil__: has joined #elixir-lang
[11:00:13] hackmykack: has joined #elixir-lang
[11:01:49] hackmykack: Hi guys ... was wondering if anyone can help me with copying a file
[11:02:14] hackmykack: I am trying to preserve modes, timestamps etc
[11:02:24] hackmykack: But not sure how to do this
[11:04:43] iamvery: has joined #elixir-lang
[11:05:50] josevalim: nox: i am going to propose a mapsets and implement intersection/subtract as NIFs
[11:05:52] josevalim: on top of maps
[11:09:18] nox: josevalim: glhf
[11:09:37] nox: Good luck have fun.
[11:09:56] nox: I don't know what that stand what?
[11:10:05] josevalim: that sentence means :P
[11:10:21] josevalim: what that stands for would have been better :D
[11:10:30] nox: I was so close.
[11:15:10] nox: josevalim: OH BTW
[11:15:17] nox: josevalim: A silly idea I got when reading BEAM code,
[11:15:43] nox: josevalim: beam_load.c handles each literal separately, allocating a new blob for each of them,
[11:16:09] nox: josevalim: I think it would be nicer if it just allocated a single blob for all them, and stored the literals as a tuple in that blob.
[11:16:38] micmus: nox: there are some additional literals that are dynamically allocated by the loader
[11:17:16] nox: micmus: But those are never referred to as a literal index, right?
[11:17:23] micmus: like funs that don't capture the environment or tuple keys for literal map construction
[11:18:03] micmus: nox: e.g. `make_fun` for a function that does not capture the environment is transformed into `mov x0 <literal>`
[11:18:42] nox: Wait it actually does store all literals in a single table at the end,
[11:18:44] nox: never mind.
[11:18:56] nox: https://github.com/erlang/otp/blob/master/erts/emulator/beam/beam_load.c#L4936-L4939
[11:19:31] dysfun: i feel so sorry for you all, reading all that c
[11:20:55] nox: Nah it's fun.
[11:21:07] nox: Though it's lunch time and I have URL parsing issues to solve when I come back.
[11:24:58] dimitarvp: has joined #elixir-lang
[11:40:09] hackmykack: has left #elixir-lang: ()
[11:48:28] josevalim: micmus, nox: do you know what all subtags in a map mean?
[11:48:51] josevalim: MAP_HEADER_HAMT_HEAD_ARRAY / MAP_HEADER_HAMT_HEAD_BITMAP / MAP_HEADER_HAMT_NODE_BITMAP
[11:49:09] josevalim: i assume the array is when the bucket is full?
[11:56:42] nox: josevalim: No damn clue I left before maps became interesting.
[11:57:50] josevalim: i don't understand why there are three types. according to the paper it should be two
[12:02:25] Phylock: has joined #elixir-lang
[12:04:11] ubert: has joined #elixir-lang
[12:17:52] mdbm: Where can I place two functions that traverse and prepare errors, and convert them into html?
[12:17:54] mdbm: https://pastebin.com/PzSaiSjg
[12:18:25] mdbm: now they are in one of my controllers, but I think it would be nice to extract those functions from it, to make the controller lighter, and these functions are reusable
[12:23:29] DTZUZO: has joined #elixir-lang
[12:29:27] micmus: josevalim: maybe it has something to do with collisions, but not sure. I've never really looked at the OTP implementation
[12:31:38] felipevolpone: has joined #elixir-lang
[12:31:45] felipevolpone: has joined #elixir-lang
[12:41:13] gvaughn: has joined #elixir-lang
[12:42:32] voltone: has joined #elixir-lang
[12:51:38] mdbm: I created a helpers module in the /controllers, does the job defmodule MyAppWeb.Controllers.Helpers do...
[12:59:38] BombStrike: has joined #elixir-lang
[13:08:05] duane: has joined #elixir-lang
[13:15:34] feld: has joined #elixir-lang
[13:48:31] drincruz: has joined #elixir-lang
[13:51:28] gvaughn: has joined #elixir-lang
[13:52:23] hypercore: has joined #elixir-lang
[13:52:33] hypercore: guys how do i build a comment system?
[13:52:42] hypercore: (e.g. schema definitions, etc)
[14:02:48] greengriminal: has joined #elixir-lang
[14:10:29] rawtaz: hypercore: what part about it is unclear? obviously you make a table for comments..
[14:16:16] duane: has joined #elixir-lang
[14:18:21] klaw: has joined #elixir-lang
[14:18:28] klaw: has left #elixir-lang: ()
[14:18:47] wgwz1: has joined #elixir-lang
[14:19:14] hypercore: rawtaz: not totally sure all the columns i need
[14:20:02] hypercore: this is what i have so far: %Comment{id, user_id, text, reply_of, timestamps()}
[14:25:28] Disorganized: has joined #elixir-lang
[14:38:45] rawtaz: whats the reply_of meant to contain?
[14:40:59] faridgh: has joined #elixir-lang
[14:50:25] hypercore: rawtaz: if you reply to another person comment
[14:52:30] absolutejam2: has joined #elixir-lang
[14:54:31] Cthalupa: has joined #elixir-lang
[14:54:42] craigp: has joined #elixir-lang
[15:01:18] jeffro: has joined #elixir-lang
[15:04:00] zigpaw: has joined #elixir-lang
[15:20:16] aalmazan: has joined #elixir-lang
[15:21:03] ishw0r: has joined #elixir-lang
[15:25:28] tuacker: has joined #elixir-lang
[15:28:21] vaer-k: has joined #elixir-lang
[15:29:59] mdbm: has joined #elixir-lang
[15:30:15] vaer-k: Hi, I'm just getting into elixir with emacs and I found the alchemist package for emacs, but their website that contains the documentation for it is down because the domain was not renewed. Is this project legit or abandoned?
[15:30:35] vaer-k: alchemist-elixir.org
[15:31:16] rawtaz: hypercore: i would probably name that foreign key comment_id instead, as it better encapsulates what it references. you can have a comment in your code/schema if you want to be more elaborate
[15:31:23] rawtaz: but thats just what i'd do
[15:33:03] nox: josevalim: What you doin with the maps btw?
[15:35:45] hypercore: rawtaz: smart
[15:35:55] hypercore: what other columns am i missing?
[15:39:45] rawtaz: hypercore: i dont know that you are missing any. you seem to be overcomplicating this. you need to store commend's IDs, their text, a reference to what post or whatever they belong to, and possibly if they belong to another commend (is a reply)
[15:40:13] rawtaz: hypercore: so are they comments to a post? add a post_id. im not sure what else they belong to, as it is now
[15:40:19] ankhers: vaer-k: I'm still using alchemist right now. I have been meaning to move to using lsp though. I just haven't made the time to do it.
[15:41:26] jmiven: has joined #elixir-lang
[15:44:34] vaer-k: Ankhers: wow I didn't know about lsp-mode, thanks for sharing
[15:47:19] josevalim: nox: i think i replied above? :D
[15:47:24] josevalim: nox: i am going to propose a mapsets module
[15:56:42] nox: josevalim: Sorry…
[15:57:56] sangoma: has joined #elixir-lang
[15:58:21] oetjenj: has joined #elixir-lang
[15:58:55] ankhers: vaer-k: https://elixirforum.com/t/emacs-elixir-setup-configuration-wiki/19196 Might be of some help setting Emacs up for Elixir.
[16:05:36] patientplatypus: has joined #elixir-lang
[16:06:19] patientplatypus: i have elixir phoenix on the backend with graphql integration. im trying to send a request from the frontend (react/next/apollo) and im getting empty parameters in elixir
[16:06:31] patientplatypus: [info] OPTIONS /api/graphiql
[16:06:31] patientplatypus: [debug] Processing with Absinthe.Plug.GraphiQL
[16:06:31] patientplatypus: Parameters: %{}
[16:06:33] patientplatypus: Pipelines: [:api]
[16:06:45] patientplatypus: im not really sure how to debug the request
[16:06:53] patientplatypus: does anyone have any suggestions?
[16:07:36] patientplatypus: im more or less following the get_dogs example here https://github.com/apollographql/react-apollo
[16:08:24] patientplatypus: and ive checked in the graphql admin panel that my request should return valid data
[16:10:13] wsieroci: has joined #elixir-lang
[16:11:09] Nicd-: that looks like an OPTIONS request aka CORS preflight
[16:11:25] Nicd-: or does GraphQL use OPTIONS as well?
[16:11:50] warmwaffles: has joined #elixir-lang
[16:11:59] patientplatypus: i think youre right that its a problem with options
[16:12:02] patientplatypus: but im not sure how to fix
[16:12:04] patientplatypus: check this out:
[16:12:24] patientplatypus: https://gist.github.com/patientplatypus/aa86c879b7a5a8ad3616a9f21d609b5a
[16:12:57] patientplatypus: do you know if the problem is on the frontend or backend?
[16:13:04] patientplatypus: ie why is it passing an option
[16:13:05] Nicd-: what is the problem?
[16:13:14] Nicd-: looks like that first request is going through fine
[16:13:29] patientplatypus: the first request was made in the console
[16:13:35] patientplatypus: sorry for not making that explicit
[16:13:47] patientplatypus: the second request is from the frontend
[16:14:05] Nicd-: again it looks like CORS preflight request to me
[16:14:21] Nicd-: so you need to set up CORS on your backend
[16:14:22] patientplatypus: could be? would that be a frontend or backend issue?
[16:16:58] warmwaffles: patientplatypus, https://github.com/mschae/cors_plug
[16:17:04] warmwaffles: cors plug for all your goodness needs
[16:17:14] patientplatypus: sure...im looking now
[16:18:27] patientplatypus: i understand the need for CORS but that doesnt prevent me from wanting to hunt the inventor down and beat him with a rubber hose
[16:30:39] patientplatypus: oh btw that was totally the problem. thanks a bunch you guys save me like 20 30 minutes or more. much love
[16:30:56] lexmag: has joined #elixir-lang
[16:31:07] Saukk: has joined #elixir-lang
[16:36:42] ryotsu: has joined #elixir-lang
[16:38:44] lexmag: has joined #elixir-lang
[16:41:07] lexmag: has joined #elixir-lang
[16:46:25] lexmag: has joined #elixir-lang
[16:51:39] orbyt_: has joined #elixir-lang
[17:00:17] mdbm_: has joined #elixir-lang
[17:01:58] feld: has joined #elixir-lang
[17:08:31] Disorganized: has joined #elixir-lang
[17:16:59] nox: josevalim: So what are you doing with maps?
[17:17:01] nox: ACTION is kidding.
[17:17:35] josevalim: i was bale to implement intersection for small and mixed maps
[17:17:47] josevalim: but large maps is beyond me
[17:17:48] nox: Baal? The Egyptian god?
[17:17:53] nox: Or the Goa'Uld?
[17:21:55] iFire: has joined #elixir-lang
[17:27:46] jnoon24[m]: anyone know with cnodes, ei.h, if i should include the pid (self()) in the message send to the cnode and have the cnode send back to it, or if the erlang_msg.from is sufficient? to me, erlang_msg.from appears to be too broad like joe@hostname. it seems to work though, im just not sure how
[17:30:10] mdbm_: has joined #elixir-lang
[17:36:39] jeffro: has joined #elixir-lang
[17:47:08] greengriminal: has joined #elixir-lang
[17:55:57] jeffro: has joined #elixir-lang
[18:00:37] Sgeo__: has joined #elixir-lang
[18:01:01] mahmudov: has joined #elixir-lang
[18:01:29] felipevolpone: has joined #elixir-lang
[18:07:13] absolutejam2: has joined #elixir-lang
[18:12:59] feld: has joined #elixir-lang
[18:30:58] greengriminal: has joined #elixir-lang
[18:34:33] feld: has joined #elixir-lang
[18:37:04] feld: has joined #elixir-lang
[18:37:26] sangoma: has joined #elixir-lang
[18:51:03] feld0: has joined #elixir-lang
[18:55:10] oetjenj: has joined #elixir-lang
[18:55:43] oetjenj: has joined #elixir-lang
[18:56:27] oetjenj: has joined #elixir-lang
[18:57:23] oetjenj: has joined #elixir-lang
[18:57:30] Disorganized: has joined #elixir-lang
[18:57:45] ilmu1: has joined #elixir-lang
[18:58:12] oetjenj: has joined #elixir-lang
[18:58:49] oetjenj: has joined #elixir-lang
[19:29:19] oetjenj: has joined #elixir-lang
[20:22:00] laut: has joined #elixir-lang
[20:34:26] jeffro: has joined #elixir-lang
[20:36:42] sirn: has joined #elixir-lang
[21:13:09] jeffro: has joined #elixir-lang
[21:23:32] lexmag: has joined #elixir-lang
[21:27:05] Disorganized: has joined #elixir-lang
[21:37:37] sangoma: has joined #elixir-lang
[21:41:52] dmin7b5: has joined #elixir-lang
[21:42:08] notzmv: has joined #elixir-lang
[21:43:03] jnoon24[m]: nevermind on my last question... it looks like erlang_msg.from actually has the pid info, just didnt see it when printing to stdout
[21:54:10] jeffro: has joined #elixir-lang
[21:57:35] Sentreen: has joined #elixir-lang
[22:03:04] Sgeo_: has joined #elixir-lang
[22:04:33] orbyt_: has joined #elixir-lang
[22:13:11] sangoma: has joined #elixir-lang
[22:15:22] Disorganized: has joined #elixir-lang
[22:19:03] greengriminal: has joined #elixir-lang
[22:38:53] greengriminal: has joined #elixir-lang
[22:51:09] DTZUZO: has joined #elixir-lang
[23:04:55] absolutejam2: got my live animations working properly with live view
[23:07:39] sangoma: has joined #elixir-lang
[23:32:02] inoas: has joined #elixir-lang
[23:32:05] inoas: Code.required_files/0 and Code.unrequire_file/1 respectively
[23:33:06] inoas: why aint it require_files / unrequire_files for symmetry of singular/plural and persence/past
[23:33:22] inoas: [Code] Code.loaded_files/0 and Code.unload_file/1 have been deprecated in favor of Code.required_files/0 and Code.unrequire_file/1 respectively
[23:36:54] Phylock: has joined #elixir-lang
[23:37:16] craigp: has joined #elixir-lang
[23:57:34] Phylock: has joined #elixir-lang