« Back to channel list

#elixir-lang - 12 April 2019

« Back 1 day Forward 1 day »
[00:09:11] craigp: has joined #elixir-lang
[00:09:20] jmiven: has joined #elixir-lang
[00:29:04] jmiven: has joined #elixir-lang
[00:37:59] schainks: has joined #elixir-lang
[00:40:19] lauromoura_: has joined #elixir-lang
[00:44:39] orbyt_: has joined #elixir-lang
[00:58:45] ur5us: has joined #elixir-lang
[01:04:23] drincruz: has joined #elixir-lang
[01:06:38] carldd: has joined #elixir-lang
[01:11:31] `Beam`: has joined #elixir-lang
[01:26:04] sevenseacat: has joined #elixir-lang
[01:44:05] cagomez: has joined #elixir-lang
[01:52:05] tomterl: has joined #elixir-lang
[01:58:19] theWhisper_: has joined #elixir-lang
[02:04:35] kyrylo: has joined #elixir-lang
[03:15:23] Cthalupa: has joined #elixir-lang
[03:21:12] carldd: has joined #elixir-lang
[03:31:34] griffinbyatt: has joined #elixir-lang
[03:48:32] mbuf: has joined #elixir-lang
[04:08:46] gvaughn: has joined #elixir-lang
[04:16:00] wsieroci: has joined #elixir-lang
[04:23:34] pera: has joined #elixir-lang
[04:27:23] kapil____: has joined #elixir-lang
[04:50:06] voltone: has joined #elixir-lang
[05:11:37] wsieroci: has joined #elixir-lang
[05:13:12] iamvery: has joined #elixir-lang
[05:18:12] gvaughn: has joined #elixir-lang
[05:18:38] iamvery: has joined #elixir-lang
[05:24:34] iamvery: has joined #elixir-lang
[06:04:01] l14n: has joined #elixir-lang
[06:05:43] Avinash: has joined #elixir-lang
[06:05:47] wsieroci: has joined #elixir-lang
[06:16:38] kapil____: how to hide id from url in phoenix: `http://abc34.localhost:8888/funds/4` ?
[06:20:49] gvaughn: has joined #elixir-lang
[06:23:14] mwbrown: has joined #elixir-lang
[06:28:39] Nicd-: don't put the ID in the URL
[06:28:46] Nicd-: that has nothing to do with Phoenix specifically
[06:45:05] kapil____: i has to put id, but i want it to hard to guess for users
[06:45:27] Nicd-: then use UUID for example
[06:46:26] kapil____: i want to use id in database,
[06:47:30] Nicd-: why not use UUID in URL and database?
[06:49:26] Phylock: has joined #elixir-lang
[06:59:41] wsieroci: has joined #elixir-lang
[07:05:59] christhekeele: has joined #elixir-lang
[07:06:02] euphidime: has joined #elixir-lang
[07:06:09] jaydoane: has joined #elixir-lang
[07:06:12] pmbauer: has joined #elixir-lang
[07:06:12] chazlever: has joined #elixir-lang
[07:06:12] darach_____: has joined #elixir-lang
[07:06:13] DukeDave: has joined #elixir-lang
[07:06:24] andersh_: has joined #elixir-lang
[07:06:27] nyaray: has joined #elixir-lang
[07:06:32] timwis: has joined #elixir-lang
[07:06:39] whatyouhide: has joined #elixir-lang
[07:06:48] jevy: has joined #elixir-lang
[07:07:55] Soni: has joined #elixir-lang
[07:12:47] lexmag: has joined #elixir-lang
[07:22:05] l14n: has joined #elixir-lang
[07:22:29] CapNemo: has joined #elixir-lang
[07:22:35] josevalim: The Phoenix.Param protocol allows you to control what goes in the URL
[07:22:49] josevalim: You could for example apply Base64 or something
[07:23:26] josevalim: But any cheap mechanism of hiding then IDs will be easily reversible by anyone with programming experience
[07:24:21] josevalim: I’d rather focus on proper authorization rules (i.e. folks can only access what they should) than on concealing ids
[07:26:56] k1nd0f: has joined #elixir-lang
[07:31:50] kapil____: josevalim: thanks a lot
[07:39:02] DarkSeid: has joined #elixir-lang
[07:48:24] l14n_: has joined #elixir-lang
[07:50:52] lexmag: has joined #elixir-lang
[07:53:46] wsieroci: has joined #elixir-lang
[08:00:41] lexmag: has joined #elixir-lang
[08:15:17] wonko7: has joined #elixir-lang
[08:19:37] DarkSeid: has joined #elixir-lang
[08:20:26] PragTob: has joined #elixir-lang
[08:24:54] kyrylo: has joined #elixir-lang
[08:28:10] kyrylo_: has joined #elixir-lang
[08:28:42] KeyJoo: has joined #elixir-lang
[08:30:05] msantos: has joined #elixir-lang
[08:33:31] asabil: has joined #elixir-lang
[08:47:50] wsieroci: has joined #elixir-lang
[09:01:19] iamvery: has joined #elixir-lang
[09:06:46] iamvery: has joined #elixir-lang
[09:09:27] asabil: has joined #elixir-lang
[09:11:38] iamvery: has joined #elixir-lang
[09:16:56] iamvery: has joined #elixir-lang
[09:18:26] Notimik: has joined #elixir-lang
[09:22:21] iamvery: has joined #elixir-lang
[09:23:26] voltone: has joined #elixir-lang
[09:31:04] Notimik: has joined #elixir-lang
[09:32:47] Siyfion: has joined #elixir-lang
[09:41:41] wsieroci: has joined #elixir-lang
[09:47:31] Notimik: has joined #elixir-lang
[09:49:00] gremly_: has joined #elixir-lang
[09:55:55] l14n_: has joined #elixir-lang
[09:57:34] asabil: has joined #elixir-lang
[10:00:58] asabil: has joined #elixir-lang
[10:02:31] asabil_: has joined #elixir-lang
[10:05:27] gremly_: has joined #elixir-lang
[10:08:26] gremly_: has joined #elixir-lang
[10:13:43] lexmag: has joined #elixir-lang
[10:13:48] asabil: has joined #elixir-lang
[10:17:25] camal: has joined #elixir-lang
[10:18:10] camal: Hi is someone around and can help me with Charlist? I cant solve it :/
[10:18:50] Saukk: has joined #elixir-lang
[10:20:24] netrino: has joined #elixir-lang
[10:26:10] dysfun: camal: what about charlists?
[10:26:50] camal: Hi, I am pretty new to Elixir and want to accomplish a beginner challenge on Exercism
[10:27:08] camal: The challenge is to translate DNA to RNA
[10:27:19] camal: my function gets a charlist like 'ABCD'
[10:27:32] camal: AFAIK it is just a list of Codepoints under the hood
[10:27:44] camal: so I thought I will pattern match on this to get the head
[10:27:56] camal: some like [h | t] = dna
[10:28:16] camal: I thought a would bind the value 'A' to it but it is the Interger value 65
[10:28:43] camal: the problem more or less for me now is, that I have a case condition and want to match against 'G' for example
[10:28:50] camal: case h do \
[10:29:16] camal: I think in this case I should transform my head value back to a char?
[10:30:05] nox: 'A' is just [65].
[10:31:19] griffinbyatt: has joined #elixir-lang
[10:32:21] camal: maybe I need to refrace it
[10:32:32] camal: when my code looks like this
[10:32:38] camal: dna = 'ABCD'
[10:32:47] camal: [h | t] = dna
[10:32:52] camal: case h do
[10:32:59] dysfun: please use a pastebin in future
[10:33:05] camal: ah, sorry
[10:33:11] camal: will use it now :)
[10:33:24] dysfun: yeah, it'll give magic things like indentation and not annoying people :)
[10:34:24] camal: https://pastebin.com/zZXyiCvN
[10:34:53] nox: 'G' is a charlist, not a char.
[10:35:40] wsieroci: has joined #elixir-lang
[10:35:42] camal: so G is actually [65] in my case match?
[10:36:09] camal: I dont understand why for example I give the charlist 'GGGG' to my function the 'G' clause is never reached :/
[10:37:41] sevenseacat: what do you get when you run it?
[10:43:28] dysfun: camal: yes, it's [65]
[10:44:17] camal: sevenseacat: ** (CaseClauseError) no case clause matching: 71
[10:44:57] camal: so in my charlist I have just 'G'. I can this value and it is 71. Why is the match with 'G' is not working ist mostly my confusion :)
[10:45:51] camal: iex(6)> h == 71
[10:45:52] camal: iex(7)> h == 'G'
[10:46:25] camal: shall I change my case condition to check the int values? I feel this is somekind of ugly due to the reader needs to know what I am doing
[10:47:37] dysfun: there is character syntax, i just can't remember what it is
[10:47:39] griffinbyatt: has joined #elixir-lang
[10:48:18] asabil: has joined #elixir-lang
[10:51:36] asabil: has joined #elixir-lang
[10:52:10] camal: I got it working with <<h::utf8>>
[10:52:14] camal: has left #elixir-lang: ()
[10:55:44] dysfun: see sevenseacat's answer
[10:56:18] dysfun: iex(1)> ?G
[10:57:06] dysfun: oh they left
[11:01:26] iamvery: has joined #elixir-lang
[11:21:12] asabil: has joined #elixir-lang
[11:25:08] asabil: has joined #elixir-lang
[11:29:45] wsieroci: has joined #elixir-lang
[11:37:36] tnez: has joined #elixir-lang
[12:17:05] InfinityFye: has joined #elixir-lang
[12:22:31] lexmag: has joined #elixir-lang
[12:54:12] knack: has joined #elixir-lang
[13:09:44] `Beam`: has joined #elixir-lang
[13:12:50] gvaughn: has joined #elixir-lang
[13:18:59] lauromoura__: has joined #elixir-lang
[13:21:09] k1nd0f: has joined #elixir-lang
[13:37:19] __charly__: has joined #elixir-lang
[13:42:36] drincruz: has joined #elixir-lang
[13:48:49] k1nd0f: has joined #elixir-lang
[13:52:22] DTZUZO: has joined #elixir-lang
[14:01:13] k1nd0f: has joined #elixir-lang
[14:01:14] duaneb: has joined #elixir-lang
[14:01:32] Notimik: has joined #elixir-lang
[14:05:42] gvaughn: has joined #elixir-lang
[14:08:44] edw: Is there a standard library that does SQL (or Unix command-line) style left/right/inner/outer joins?
[14:09:42] Nicd-: dunno what you mean with Unix command-line
[14:09:50] Nicd-: Ecto is the most used DB tool
[14:10:05] Nicd-: it in turn uses lower level DB libraries depending on the DB
[14:10:31] edw: `join(1) -- relational database operator`
[14:11:41] edw: Not really talking DBs necessarily. Sometimes you just want to read two files and do a join based on columns n and m tables t and u.
[14:11:50] hgkjhb: has joined #elixir-lang
[14:12:43] edw: For example, I have a file with unnormalized country name and click count and then a table that maps unnormalized country name to two-letter iso country.
[14:13:05] edw: And I want {iso-country, click-count}.
[14:13:26] edw: Firing up a database would be overkill.
[14:15:39] thurloat: has joined #elixir-lang
[14:18:53] k1nd0f: has joined #elixir-lang
[14:20:41] edw: I guess I'll write something up myself.
[14:20:54] wsieroci: has joined #elixir-lang
[14:23:45] samrose_: has joined #elixir-lang
[14:26:04] d10n-work: has joined #elixir-lang
[14:30:38] `Beam`: has joined #elixir-lang
[14:31:11] edw: Nicd-: Just wrote up outer join:
[14:31:21] edw: https://www.irccloud.com/pastebin/oWQnyqlx/
[14:45:22] dimitarvp: has joined #elixir-lang
[14:46:44] ayr-ton: has joined #elixir-lang
[14:50:46] pera: has joined #elixir-lang
[14:53:44] orbyt_: has joined #elixir-lang
[15:03:59] davidw: has joined #elixir-lang
[15:05:23] mahmudov: has joined #elixir-lang
[15:13:37] Saukk: has joined #elixir-lang
[15:22:15] AnimalClatter: has joined #elixir-lang
[15:23:01] edw: How does one get authorized to publish a public repository package on hex.pm?
[15:24:04] Nicd-: there's instructions on the site
[15:24:15] Nicd-: didn't realise you were talking about flat files with your last question
[15:24:27] Nicd-: edw: https://hex.pm/docs/publish
[15:25:13] edw: Nicd-, I RtFM'ed. I get an `account not authorized for this action` error when doing a `mix hex.publish`.
[15:25:35] Nicd-: did you confirm your email?
[15:26:50] edw: This is me: https://hex.pm/users/edw
[15:28:05] Nicd-: I guess you need to ask them for help
[15:32:27] sriehl: has joined #elixir-lang
[15:32:42] edw: Figured it out: name already exists.
[15:35:20] `Beam`: has joined #elixir-lang
[15:35:44] joshproehl: has joined #elixir-lang
[15:44:47] greengriminal: has joined #elixir-lang
[15:52:14] proteusguy: has joined #elixir-lang
[15:56:17] wonko7: has joined #elixir-lang
[16:02:39] edw: Left/inner/right/outer joins implemented here: <https://hexdocs.pm/relate>
[16:18:43] pera: has joined #elixir-lang
[16:26:43] proteusguy: has joined #elixir-lang
[16:27:41] jeffro: has joined #elixir-lang
[16:28:32] mitchellhenke: How do multiple implementations of the same protocol/type get reconciled?
[16:29:46] torwegia: has joined #elixir-lang
[16:30:17] proteusguy: has joined #elixir-lang
[16:30:53] Nicd-: don't know if that's possible
[16:31:29] snapet: has joined #elixir-lang
[16:32:48] nox: How would it?
[16:33:20] aalmazan: has joined #elixir-lang
[16:33:48] mitchellhenke: I don’t know, was assuming there isn’t a rule and it’s undefined behavior, but wanted to confirm
[16:36:31] serafeim: has joined #elixir-lang
[16:39:49] nldm: has joined #elixir-lang
[16:49:04] nldm: has joined #elixir-lang
[16:52:10] nldm: has left #elixir-lang: ()
[16:54:16] proteusguy: has joined #elixir-lang
[17:05:34] proteusguy: has joined #elixir-lang
[17:06:00] serafeim_: has joined #elixir-lang
[17:07:32] lexmag: has joined #elixir-lang
[17:38:14] harrow: has joined #elixir-lang
[17:49:02] pera: has joined #elixir-lang
[17:49:46] DarkSeid: has joined #elixir-lang
[17:56:26] bind: good morning, I have a strange thing going on with mix inside a docker image ... (or maybe I am doing something really dumb...)
[17:57:31] bind: https://hastebin.com/mojamuyiki.sh
[17:58:19] bind: I am using the vanilla elixir 1.8.1 docker image to run a bash script passed from stdin where I want to execute mix local.hex
[17:58:44] bind: the command after the mix invocation is not being called anymore
[18:01:19] bind: when I switch out mix for sleep it works again
[18:01:36] bind: when I check the return code of mix it is 0
[18:03:37] bind: it also happens with bash itself.. maybe it is just one of those fridays..
[18:04:08] asabil: has joined #elixir-lang
[18:06:12] bind: thank you for listening :D
[18:08:02] hypercore: has joined #elixir-lang
[18:17:15] Sgeo__: has joined #elixir-lang
[18:18:53] umamaistempo: has joined #elixir-lang
[18:38:21] k1nd0f: has joined #elixir-lang
[18:39:22] kyrylo: has joined #elixir-lang
[18:42:11] squall: has joined #elixir-lang
[18:47:38] wsieroci: has joined #elixir-lang
[18:49:58] jeffro: has joined #elixir-lang
[19:01:12] k1nd0f: has joined #elixir-lang
[19:11:58] Phylock: has joined #elixir-lang
[19:13:12] kyrylo: has joined #elixir-lang
[19:35:48] jeffro: has joined #elixir-lang
[19:41:39] wsieroci: has joined #elixir-lang
[19:43:23] asabil: has joined #elixir-lang
[19:50:45] BitBot: has joined #elixir-lang
[19:50:47] jesopo: has joined #elixir-lang
[19:51:12] orbyt_: has joined #elixir-lang
[19:51:49] DarkSeid: has joined #elixir-lang
[19:55:29] work_: has joined #elixir-lang
[20:03:06] asabil: has joined #elixir-lang
[20:05:27] kyrylo: has joined #elixir-lang
[20:14:37] kyrylo: has joined #elixir-lang
[20:31:15] Uniaika: has joined #elixir-lang
[20:34:15] BitBot: has joined #elixir-lang
[20:35:39] wsieroci: has joined #elixir-lang
[20:57:53] mim7: has joined #elixir-lang
[21:19:27] lexmag: has joined #elixir-lang
[21:22:02] mim7_: has joined #elixir-lang
[21:25:49] lomex: has joined #elixir-lang
[21:26:00] mim7: has joined #elixir-lang
[21:29:35] wsieroci: has joined #elixir-lang
[21:29:49] __charly__: has joined #elixir-lang
[21:55:53] DTZUZO: has joined #elixir-lang
[22:09:02] ariedler: has joined #elixir-lang
[22:23:39] wsieroci: has joined #elixir-lang
[22:40:01] mrus: What would be the Elixir way of starting a thread that keeps looping in order to process stuff? I thought about building a GenServer that gets casted once from within the application.ex and then casts to itself from within handle_cast in order to create an endless loop. But is that the best way to do it in terms of performance?
[22:41:14] tristanm_: a genserver already is a loop
[22:42:06] sms: mrus: What's being processed by the Genserv in this case
[22:42:46] sms: Do you have all the data upfront?
[22:43:31] sms: But yes that's right, the Genserv stays alive solong as your application is running depending on how you supervise it
[22:43:54] mrus: sms: writing binary data to a bus. Yupp, all the data is present upfront and it needs to write that data over and over - until an external event tells it that the data changed. Then it needs to take the new data and write that over and over.
[22:44:21] sms: Oh, that's not too bad then
[22:46:24] mrus: I'm trying to understand where I'd do the actual writing of the data... as I said, in other languages I'd most likely launch a thread that loops and uses some mutex for the data, so another thread could modify it.
[22:48:13] mrus: so, assuming I have the GenServer... would I do it the way I described it above? Or would I simply call a function from init() which then calls itself?
[22:48:40] sms: Well you could have the Genserv hold the binary data and have handle_calls to stop/change it
[22:49:53] mrus: and where would the write_to_bus(data) happen?
[22:49:56] tomku: has joined #elixir-lang
[22:50:16] sms: As for the actual writing I believe you'd have to spin up another Task maybe
[22:50:42] sms: I'm pretty sure if you build that into the Genserv you'll lose control of it for the time it's looping
[22:51:02] mrus: ah, you mean spwan fn -> .. end?
[22:51:28] mim7: has joined #elixir-lang
[22:51:42] sms: Yeah or use Task it's your call
[22:52:25] mrus: and then I'd launch the task from the GenServer's init?
[22:52:55] sms: Yeah that would work
[22:53:54] mrus: okay, so then I could store the task's pid in the state returned by init and, as soon as I receive a call, I could takte the pid from within the state, kill it and just launch a new task with the new data
[22:54:24] mrus: however, that task would be unsupervised, right? So.. if it would die.. it would die unnoticed, right?
[22:55:47] sms: That is true yeah
[22:56:15] sms: Maybe you just want an Agent and a Task, one to hold the data the other one to write
[22:56:50] nineczar: has joined #elixir-lang
[22:56:54] sms: Then you could have them coupled in the supervisor
[22:57:17] mrus: ah, i see
[22:57:32] mrus: will read up on this, thank you! That sounds like a better approach.
[23:10:58] isHavvy: has joined #elixir-lang
[23:17:42] wsieroci: has joined #elixir-lang
[23:25:27] jeffro: has joined #elixir-lang
[23:28:07] mim7: has joined #elixir-lang
[23:31:05] ryanwinchester: mrus: use a dynamic supervisor for the task
[23:31:52] ryanwinchester: mrus: https://hexdocs.pm/elixir/Task.html#module-dynamically-supervised-tasks
[23:33:29] mrus: ryanwinchester: thanks! Already trying the code with little success so far. I guess I need to browse for some more extensive examples on this topic.
[23:36:49] kyrylo: has joined #elixir-lang
[23:47:37] mrus: could it be that the example here is wrong in regard of the handle_cast return? https://hexdocs.pm/elixir/Task.Supervisor.html#async_nolink/3-examples
[23:47:59] mrus: can handle_cast really return :reply?
[23:48:09] ryanwinchester: @mrus tbh, I'd probably just do something like this: https://gist.github.com/ryanwinchester/d2a840539387c6ae4e4d486be19aafe1
[23:49:43] mrus: ryanwinchester: thank you! Would you do that even with a write interval that's in the range of milliseconds?
[23:51:42] orbyt_: has joined #elixir-lang
[23:52:03] ryanwinchester: no idea, but it'd be my first shot. Maybe try it a few different ways and observe
[23:52:51] ryanwinchester: I mean, I don't see why not, though
[23:54:49] ryanwinchester: There's also stuff like https://github.com/SchedEx/SchedEx
[23:55:35] sms: Oh, I guess a dynamic supervisor would work actually
[23:56:18] sms: ryanwinchester: If you call a loop from a genserver it basically locks right?
[23:57:30] sms: I was just thinking when I wrote a timed genserv you couldn't really control it, assumed I/O would be the same
[23:58:14] ryanwinchester: @sms there's an example of it in GenServer docs: https://hexdocs.pm/elixir/master/GenServer.html#module-receiving-regular-messages
[23:58:25] ryanwinchester: look at the code example
[23:58:50] jeffro: has joined #elixir-lang
[23:59:18] ryanwinchester: https://hexdocs.pm/elixir/master/Process.html#send_after/4
[23:59:18] ryanwinchester: "The message is not sent immediately. Therefore, dest can receive other messages in-between even when time is 0."
[23:59:42] sms: Ahh yeah, that's what I mean though, you can't receive other messages on a timer
[23:59:50] sms: But is that the same thing if you're looping some I/O