« Back to channel list

#elixir-lang - 06 July 2019

« Back 1 day Forward 1 day »
[00:01:47] mahmudov: has joined #elixir-lang
[00:10:56] orbyt_: has joined #elixir-lang
[00:28:54] wsieroci: has joined #elixir-lang
[00:34:39] OvermindDL1: Should be able to just alter table and use the timestamp macro?
[00:34:50] OvermindDL1: It's pretty simple, just sets fields
[00:45:54] jeffweiss: has joined #elixir-lang
[00:46:32] jeffro_: has joined #elixir-lang
[00:54:46] introom: has left #elixir-lang: ("WeeChat 1.6")
[01:00:12] ariedler: has joined #elixir-lang
[01:03:42] jeffro_: has joined #elixir-lang
[01:06:20] ariedler: has joined #elixir-lang
[01:14:07] jeffweiss: has joined #elixir-lang
[01:15:33] tomterl: has joined #elixir-lang
[01:22:21] wsieroci: has joined #elixir-lang
[02:09:40] jeffro_: has joined #elixir-lang
[02:14:44] jeffweiss: has joined #elixir-lang
[02:16:01] wsieroci: has joined #elixir-lang
[02:49:15] lessless: has joined #elixir-lang
[02:53:00] jeffweiss: has joined #elixir-lang
[03:09:41] wsieroci: has joined #elixir-lang
[03:25:18] conceivably: has joined #elixir-lang
[03:43:19] jeffweiss: has joined #elixir-lang
[03:58:51] jeffweiss: has joined #elixir-lang
[04:03:06] wsieroci: has joined #elixir-lang
[04:10:29] jeffro_: has joined #elixir-lang
[04:50:44] cmk_zzz: I need help with Phoenix form. I have a row of checkboxes in a table. Each represent an id. On submit I want to get a list of checked ids, [1,2,3,4]. But I can't figure out how to do this. Any ideas?
[04:55:15] lauromoura: has joined #elixir-lang
[04:55:28] DTZUZO: has joined #elixir-lang
[04:56:46] wsieroci: has joined #elixir-lang
[05:11:54] jeffro_: has joined #elixir-lang
[05:27:02] jeffro_: has joined #elixir-lang
[05:39:52] iamvery: has joined #elixir-lang
[05:50:20] wsieroci: has joined #elixir-lang
[05:58:28] gvaughn: has joined #elixir-lang
[06:00:25] jeffweiss: has joined #elixir-lang
[06:24:22] jeffweiss: has joined #elixir-lang
[06:26:38] absolutejam4: has joined #elixir-lang
[06:27:25] foggyboi: has joined #elixir-lang
[06:32:36] wsieroci: has joined #elixir-lang
[06:43:30] troido: has joined #elixir-lang
[06:53:46] tuacker: has joined #elixir-lang
[07:10:00] gvaughn: has joined #elixir-lang
[07:22:14] thomasfedb_: has left #elixir-lang: ("Leaving")
[07:27:39] Riba: has joined #elixir-lang
[07:27:46] jeffro_: has joined #elixir-lang
[07:52:58] jeffro_: has joined #elixir-lang
[07:54:03] proteusguy: has joined #elixir-lang
[08:08:12] mdbm: has joined #elixir-lang
[08:10:08] lexmag: has joined #elixir-lang
[08:12:08] serafeim: is there a difference between 1. `with z <- 3, y <- z, do: z+y`, 2. `with z <- 3, y = z, do: z+y` and 3. `with z = 3, y = z, do: z+y` ? the result i get is the same in all cases (6).
[08:12:47] dysfun: not with that example
[08:12:52] serafeim: i'd like to understand what's the difference when i use `=` instead of `<-` with `with`. if there's a difference :)
[08:12:53] dysfun: the = is conditional
[08:13:01] serafeim: dysfun: meaning ?
[08:13:05] mdbm: I want to make a quiz, so visitors are presented questions they must answer. I have to remember somehow which questions have already been answered, in order to avoid asking them the same answer multiple times. If I do server-side rendering, where do I store the list of already answered questions for each visitor(session) ? Where do I store this "session data"? I'm very confused guys plz help:'(
[08:13:29] dysfun: you know how = crashes if it doesn't match?
[08:13:33] serafeim: mdbm: in your database maybe ?
[08:13:36] serafeim: dysfun: yes of course
[08:13:37] dysfun: well it still does in a with block
[08:14:09] dysfun: it allows you to mix assertions with conditional matching
[08:14:14] serafeim: dysfun: so using `<-` it will return the non-matched value. while using `=` it will raise the not match exception ?
[08:14:24] mdbm: serafeim, so I use the database as a temporary session cache? they must not create accounts, so the database is sued as a store for temporary session data, that's okay to do?
[08:14:31] serafeim: dysfun: cool i understand now
[08:14:37] dysfun: you know you can play around at the repl and try stuff, right?
[08:14:44] serafeim: dysfun: yes i already do it
[08:15:19] serafeim: mdbm: i guess you can do it. i didn't know you didn't want to create accounts
[08:15:37] serafeim: mdbm: the problem with the default elixir session storage is that there's a limit to how much data you can save there
[08:15:37] mdbm: serafeim, actually that shouldn't matter much if I want to creat accounts or not
[08:16:04] dysfun: default *plug* session storage
[08:16:12] serafeim: dysfun: yes that's what i wanted to write :)
[08:16:15] mdbm: serafeim, but, what about processes/OTP GenServers/and so on? They can be used as session data cache for each visitor?
[08:16:19] serafeim: s/elixir/phoenix/ :)
[08:16:33] dysfun: no, it really is plug
[08:16:37] serafeim: dysfun: l o l
[08:16:39] mdbm: dysfun, is this for me or for serafeim ?
[08:17:12] dysfun: i'm correcting serafeim's talking to you
[08:17:37] serafeim: dysfun: phoenix decided to use the plug default for session storage. couldn't it decide to use something completely difference? after all you as a developer talk to the framework
[08:18:01] serafeim: so its phoenix default session storage which is plug default session storage
[08:18:05] dysfun: they could, but plug already had a solution they considered acceptable
[08:18:15] serafeim: dysfun: i agree
[08:18:28] mdbm: dysfun, how does the plug session storage work? I.e. where does it really store session data?
[08:18:39] serafeim: mdbm: in the actual key
[08:18:39] dysfun: mdbm: in a cookie
[08:18:57] mdbm: so in the user's computer
[08:19:00] mdbm: not on the server
[08:19:41] mdbm: then the storage is pretty limited as serafeim mentioned. i.e. for my quiz idea, I need to store all questions answered, but what if there are really many questions and the ID's are long UUID
[08:20:00] serafeim: mdbm: yes you can't use that session storage
[08:20:38] mdbm: so what about a GenServer process? Is it another viable alternative to the database?
[08:20:41] serafeim: mdbm: but you could use the ETS storage: https://phoenixframework.org/blog/sessions (although its not recommended)
[08:21:06] dysfun: it's for reasons like this people like SPAs i guess
[08:22:10] mdbm: dysfun, but what about server process? sorry to insist, but I thought that was a way to use Erlang/OTP's power. And if I udnerstood, it's state in server's memory that is actually scalable horizontally
[08:22:38] mdbm: (i.e. one process available/shared by multiple machines)
[08:22:40] dysfun: but why would you when your communication is all http posts?
[08:23:11] mdbm: dysfun, I don't understand the link with http posts, what do you mean
[08:23:17] serafeim: for the session, you'll get a cookie like this `SFMyNTY.g3QAAAAGbQAAAAtfY3NyZl90b2tlbm0AAAAYakFJV1V4a0ZjWmFMVmMxSlhwMFN3cEdQbQAAAAxhdXRob3JpdHlfaWRkAANuaWxtAAAADmF1dGhvcml0eV9uYW1lbQAAAAEgbQAAAAtwZXJtaXNzaW9uc2wAAAABbQAAAAlzdXBlcnVzZXJqbQAAAAd1c2VyX2lkYQFtAAAACHVzZXJuYW1lbQAAAARyb290.1jyWUwbKspIiNY1GJ5E4UMOWIA4BWTxIKkYz8wTXDbA`. if you take the part between the dots and base64 decode it you'll see your
[08:23:19] serafeim: session data :)
[08:23:28] dysfun: memory is for what you are working on now. you're not working on it between requests
[08:23:28] serafeim: try it its very enlightening
[08:23:59] mahmudov: has joined #elixir-lang
[08:24:26] mdbm: dysfun, I can use the memory for session data, if I maintain a key in a structure in memory to identify the session data for each visitor
[08:24:54] mdbm: dysfun, I guess it's a terrible idea but in that case I'd try to know why
[08:24:55] dysfun: but all you're doing is managing a cache, and cache management is one of the hard problems of computer science
[08:25:42] mdbm: dysfun, and if I sue a database for this, it's a cache as well. is data in a database easier to handle/manage than data in a server process?
[08:26:09] mdbm: *in memory managed by a server process
[08:26:26] dysfun: no, the database would be acting as data *persistence*
[08:26:50] mdbm: I need to persist data until the session dies
[08:27:08] dysfun: another hard problem
[08:27:43] dysfun: it's just html forms right?
[08:27:49] serafeim: why not just use the database ?
[08:28:05] mdbm: dysfun, there ahve been quiz applications before we talked about stateful frontend applications. How do these applications remember which questions users have answered in a session
[08:28:19] serafeim: when the user firsts visit the page start a session, give it an id and save it to the database. then you can keep everything to your db.
[08:28:22] dysfun: mdbm: usually they shove them in hidden input fields ime
[08:28:37] serafeim: finally run a scheduled task once per day that would delete old sessions
[08:28:40] mdbm: dysfun, hahaha, forgot about that technique :D good old days
[08:29:00] serafeim: but you can use a session why bother with all this ?
[08:29:05] dysfun: you just have a single action, check which data you have
[08:29:19] dysfun: trust me, it's *less* effort this way
[08:29:26] dysfun: (that one was for serafeim )
[08:30:43] mdbm: serafeim, if you suggest me to store this session data in a database, then I gotta know why this is preferred to session data in memory handled by a server process, it's more efficient to read memory from a process than query a db
[08:31:08] serafeim: mdbm: yes of course its more efficient. do you need that efficiency ?
[08:31:10] dysfun: it's more efficient to do neither and just do it old school
[08:31:37] serafeim: mdbm: the database is a trusted and more controlled solution. it is well tested and you know its working.
[08:32:26] serafeim: of course if you want to experiment then do the server process. or do whatever else you like. but for a prod app i'd trust the tried solutions
[08:32:44] gde33: has joined #elixir-lang
[08:32:53] BeerLover: has joined #elixir-lang
[08:34:36] serafeim: all i'm saying is to use the easiest solution each time. don't bother with things that you probably won't need
[08:34:46] serafeim: unless you are experimenting ofcourse
[08:34:56] mdbm: dysfun, yeah I should go old school or SPA, you're absolutely right. But can you share your opinion on why it's hard otherwise (i.e. what make the other solutions talked about hard: maintain/manage session data stored in db or in memory handled by a process). It's very interesting
[08:34:59] dysfun: right, and i think you'll find my solution was the easiest
[08:35:37] dysfun: your solution requires a garbage collection process
[08:36:02] serafeim: dysfun: your solution is keeping the data in a hidden input ?
[08:36:17] dysfun: many of them, but yes
[08:36:21] mdbm: serafeim, yes that's his solution, I completely forgot we did this way before SPA's
[08:36:51] dysfun: well with SPAs you don't have this problem, you can just shove it in localStorage
[08:36:58] serafeim: dysfun: well i find this more difficult to implement than saving things in the database and running a proc that would delete old data
[08:37:29] mdbm: dysfun, sessionStorage*, actually, not even in a html5 storage mechanism, if I use React, I can just keep in state
[08:37:48] dysfun: is emitting a few form fields really so difficult?
[08:37:59] dysfun: i mean, you already do it for the visible elements
[08:38:43] serafeim: no but why do it when i can save in the database ?
[08:39:10] mdbm: it's not difficult, but not very clean? usually you end up with some custom unmaintainable sh*t cobbled together the more your state gets complex
[08:39:27] dysfun: but why save in the database?
[08:40:05] dysfun: the database is the place for data you need to access later
[08:40:36] mdbm: dysfun, exactly, that's why he suggested the DB to persist data across user requests
[08:40:59] mdbm: as you said, it requires a garbage collector thing
[08:41:05] dysfun: no, i mean if you look at the user story, it's transient data
[08:42:25] serafeim: well the database can also be used for transient data i don't think theres a law forbidding that
[08:42:34] mdbm: dysfun, you could go for old school session data (session files server side as we seen in traditional php applications), but it's not scalable accross mulitple servers. storing in db gives you more flexibility in that sense
[08:43:30] dysfun: does nobody consider the full impact of changes anymore?
[08:43:44] mdbm: dysfun, what changes in this case?
[08:44:17] dysfun: shoving transient data in a database
[08:58:20] gvaughn: has joined #elixir-lang
[08:58:36] jeffro_: has joined #elixir-lang
[09:14:40] jeffro_: has joined #elixir-lang
[09:17:00] iamvery: has joined #elixir-lang
[09:23:46] mdbm: serafeim, was reading more about the session plug here: https://phoenixframework.org/blog/sessions
[09:23:48] mdbm: they do not explicitly mention that the actual session data resides IN the cookie, seems to me important information even if it might be obvious for some
[09:25:20] mdbm: serafeim, then I'm also surprised that Phoenix doesn't come with a session storage mechanism (like storing session data in files as php/apache does). Or are these system really considered as obsolete?:-/
[09:26:18] mdbm: dysfun, you know any reason why we do not have a session server-side storage mechanism in Phoenix?
[09:29:22] dysfun: probably to discourage people from putting too much in the session
[09:29:43] jeffro_: has joined #elixir-lang
[09:30:02] dysfun: ^ pure speculation
[09:36:10] mdbm: dysfun, and using live view doesn't bring a solution for storing state I guess, I only heard about it
[09:36:15] Riba: has joined #elixir-lang
[09:37:41] serafeim: mdbm: i agree that this should be mentioned there. i've stumbled upon it (trying to save too many data to the session) to actually leanr about it :)
[09:38:12] dysfun: up to a point. live view
[09:38:17] dysfun: solves some of the problem
[09:38:24] mdbm: dysfun, how does it solve it?
[09:38:43] dysfun: well it maintains a server process on the other side in the form of a channel
[09:38:51] serafeim: mdbm: it has ETS storage through. and you can probably implement a custom database (or redis or whatever) backed one
[09:39:14] mdbm: serafeim, you said earlier ets storage is not recommended, and now it's used for live view?
[09:39:43] serafeim: mdbm: that's what it says there; i haven't used it :)
[09:40:10] mdbm: dysfun, so it brings a complete session management system with it? in this process? garbage collected and all?
[09:40:43] dysfun: mdbm: it's not a session management system
[09:41:37] mdbm: yeah I was asking if it includes one, I know its purpose is to have dynamic pages without refresh, like a spa
[09:45:14] jeffro_: has joined #elixir-lang
[09:45:14] mdbm: and that it works through web sockets I guess, but I can't really picture how web sockets/channels brings an alternative to the state storing
[09:46:40] Sgeo__: has joined #elixir-lang
[09:47:37] dysfun: because there is literally a process on the other side
[10:01:31] mdbm: I guess I just have to try
[10:01:39] mdbm: thanks guys for the chat, gtg, bbl
[10:25:30] jeffro_: has joined #elixir-lang
[10:26:11] jeffweiss: has joined #elixir-lang
[10:43:44] absolutejam4: has joined #elixir-lang
[10:45:02] sangoma: has joined #elixir-lang
[10:46:37] gvaughn: has joined #elixir-lang
[10:50:21] sangoma: has joined #elixir-lang
[11:01:25] iamvery: has joined #elixir-lang
[11:08:41] mahtob: has joined #elixir-lang
[11:09:36] jeffro_: has joined #elixir-lang
[11:15:36] ur5us: has joined #elixir-lang
[11:39:17] d0zingcat: has joined #elixir-lang
[11:39:44] mahmudov: has joined #elixir-lang
[11:41:48] gvaughn: has joined #elixir-lang
[12:09:20] Phylock: has joined #elixir-lang
[12:25:47] dsr: has joined #elixir-lang
[12:28:09] ur5us: has joined #elixir-lang
[12:35:06] gvaughn: has joined #elixir-lang
[12:49:32] absolutejam4: has joined #elixir-lang
[13:14:44] jeffro_: has joined #elixir-lang
[13:16:19] ur5us: has joined #elixir-lang
[13:20:17] sangoma: has joined #elixir-lang
[13:26:05] jeffro_: has joined #elixir-lang
[13:30:24] jeffweiss: has joined #elixir-lang
[13:33:11] ur5us: has joined #elixir-lang
[13:34:42] griffinbyatt: has joined #elixir-lang
[13:36:00] serafeim: for anybody interested this got some trend in HN: https://news.ycombinator.com/item?id=20357055
[13:36:25] serafeim: it also has comments from IRC friends :)
[13:41:16] jeffro_: has joined #elixir-lang
[13:59:56] jmiven: has joined #elixir-lang
[14:03:04] mahmudov: has joined #elixir-lang
[14:13:09] wonko7: has joined #elixir-lang
[14:16:54] jeffro_: has joined #elixir-lang
[14:23:28] gvaughn: has joined #elixir-lang
[14:30:53] sangoma: has joined #elixir-lang
[14:44:39] jeffweiss: has joined #elixir-lang
[14:46:21] mdbm: has joined #elixir-lang
[15:00:27] jeffro_: has joined #elixir-lang
[15:04:15] tuacker: has joined #elixir-lang
[15:08:07] lessless: has joined #elixir-lang
[15:09:01] jeffweiss: has joined #elixir-lang
[15:21:55] tuacker: has joined #elixir-lang
[15:39:44] wsieroci: has joined #elixir-lang
[15:55:52] jeffweiss: has joined #elixir-lang
[16:11:21] jeffro_: has joined #elixir-lang
[16:11:50] gvaughn: has joined #elixir-lang
[16:13:13] gvaughn: has joined #elixir-lang
[16:14:40] lexmag: has joined #elixir-lang
[16:21:50] jeffweiss: has joined #elixir-lang
[16:27:59] mahmudov: has joined #elixir-lang
[16:34:22] lexmag: has joined #elixir-lang
[16:36:47] orbyt_: has joined #elixir-lang
[16:42:35] lexmag: has joined #elixir-lang
[16:47:31] PragTob: has joined #elixir-lang
[16:55:26] Matt51: has joined #elixir-lang
[17:04:42] lao-tzu: has joined #elixir-lang
[17:12:49] jeffro_: has joined #elixir-lang
[17:22:48] griffinbyatt: has joined #elixir-lang
[17:29:21] za1b1tsu: has joined #elixir-lang
[17:34:11] orbyt_: has joined #elixir-lang
[17:44:51] Gika: has joined #elixir-lang
[17:57:02] absolutejam4: has joined #elixir-lang
[18:18:51] Matt60: has joined #elixir-lang
[18:38:24] gffranco: has joined #elixir-lang
[18:38:56] serafeim: anybody using nerves ?
[18:49:32] jeffro_: has joined #elixir-lang
[18:55:09] jeffweiss: has joined #elixir-lang
[19:01:07] sangoma: has joined #elixir-lang
[19:07:28] absolutejam4: has joined #elixir-lang
[19:12:19] ankhers: I asked the other day but I think I missed someones response. Is there a suggested way to add timestamps to a table after the initial migration in ecto?
[19:20:50] nickjj: Ankhers, they responded with:
[19:21:04] nickjj: <OvermindDL1> Should be able to just alter table and use the timestamp macro?
[19:21:04] nickjj: <OvermindDL1> It's pretty simple, just sets fields
[19:25:41] ankhers: nickjj: Thanks.
[19:25:56] ankhers: OvermindDL1: The problem is there are already fields in there and it violates the not null contraint.
[19:44:34] absolutejam1: has joined #elixir-lang
[19:53:00] jeffro_: has joined #elixir-lang
[20:00:33] jeffro_: has joined #elixir-lang
[20:09:34] jeffro_: has joined #elixir-lang
[20:33:01] sangoma: has joined #elixir-lang
[20:34:34] ariedler: has joined #elixir-lang
[20:36:09] gde33: has joined #elixir-lang
[22:07:51] lessless: has joined #elixir-lang
[22:10:22] jeffro_: has joined #elixir-lang
[22:13:09] Exuma: has joined #elixir-lang
[22:34:16] orbyt_: has joined #elixir-lang
[22:39:41] dimitarvp: has joined #elixir-lang
[22:41:45] ephemera_: has joined #elixir-lang
[22:57:41] jeffweiss: has joined #elixir-lang
[23:02:27] shritesh: has joined #elixir-lang
[23:21:47] shritesh: has joined #elixir-lang
[23:36:21] nickjj: is it better to pretty much always use hd/1 instead of List.first/1 to get the first item in a list?