#elixir-lang - 12 April 2019
« Back 1 day Forward 1 day »
[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
[10:26:50] camal: Hi, I am pretty new to Elixir and want to accomplish a beginner challenge on Exercism
[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:36:09] camal: I dont understand why for example I give the charlist 'GGGG' to my function the 'G' clause is never reached :/
[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: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
[14:08:44] edw: Is there a standard library that does SQL (or Unix command-line) style left/right/inner/outer joins?
[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: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.
[15:25:13] edw: Nicd-, I RtFM'ed. I get an `account not authorized for this action` error when doing a `mix hex.publish`.
[16:33:48] mitchellhenke: I don’t know, was assuming there isn’t a rule and it’s undefined behavior, but wanted to confirm
[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: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
[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: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: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: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: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:56:15] sms: Maybe you just want an Agent and a Task, one to hold the data the other one to write
[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: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: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:52:03] ryanwinchester: no idea, but it'd be my first shot. Maybe try it a few different ways and observe
[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:59:18] ryanwinchester: "The message is not sent immediately. Therefore, dest can receive other messages in-between even when time is 0."