<    April 2017    >
Su Mo Tu We Th Fr Sa  
 2  3  4  5  6  7  8  
 9 10 11 12 13 14 15  
16 17 18 19 20 21 22  
23 24 25 26 27 28 29  
00:01 kblake joined
00:02 jkreeftmeijer joined
00:11 Ioyrie joined
00:13 duane joined
00:16 kblake joined
00:17 cp__ joined
00:18 fernandomm joined
00:25 rschmukler joined
00:34 codestorm joined
00:38 rschmukler joined
00:40 kblake joined
00:43 whharris joined
00:44 josevalim joined
00:49 rschmukler joined
00:51 PhatLe joined
00:55 rschmukler joined
00:56 nomicflux joined
00:58 griffinbyatt joined
01:04 codestorm joined
01:07 PhatLe joined
01:10 rschmukler joined
01:11 PhatLe joined
01:20 junsuijin joined
01:24 rschmukler joined
01:26 codestorm joined
01:26 marcdel joined
01:31 chavito joined
01:39 tomterl joined
01:40 nii236 joined
01:40 Scramblejams joined
01:41 potatosalad joined
01:53 josevalim joined
01:56 rschmukler joined
01:59 griffinbyatt joined
02:02 duane joined
02:03 jkreeftmeijer joined
02:07 lessless joined
02:08 rschmukler joined
02:19 rschmukler joined
02:27 sfbw joined
02:31 griffinbyatt joined
02:31 griffinbyatt joined
02:32 raycoll joined
02:36 Exuma joined
02:37 <Exuma> Hey, can someone explain to me when I might use ETS? I'm struggling to figure out how this is different from just storing the state in a GenServer
02:38 nomicflux joined
02:38 claudevandort joined
02:39 duane_ joined
02:45 <alisdair> ets can support concurrent reads
02:45 <alisdair> genservers have to serialize reads
02:46 milad joined
02:46 <Exuma> ahhh
02:46 <Exuma> hmm
02:46 <Exuma> Ok here is a dumb question
02:47 <Exuma> I'm trying to build a fun side project to learn elixir (coming from ruby). I want to build a very basic A/B testing platform
02:47 <Exuma> so you would create an experiment, which each experiment would hold some state (settings about the experiment)
02:47 <Exuma> and then it would run x trials, say 500, where something will happen (a few http requests)
02:47 <Exuma> so... would it be normal to make a new genserver for each experiment?
02:48 <Exuma> Ive watched so many videos and tutorials, and now that it comes time to actually design it with all I know, I'm kind of like durrrrrr uhhhh
02:49 <Exuma> I'm basically going to ask people to rate a few choices, and i want to track their votes for each experiemnt. then output the data on another part of the app
02:52 <alisdair> so one thing that's important to remember is that a gen_server isn't the same as an object
02:53 <alisdair> typically you only use a genserver to atomically update state
02:53 <Exuma> hmm
02:54 <alisdair> or to control access to a limited resource like a tcp connection
02:54 <Exuma> can you give a brief example of an atomic update?
02:54 bionj joined
02:54 kronicdeth joined
02:55 tolerablyjake joined
02:55 <alisdair> sure, so if you wanted a counter for example
02:55 meandi_2 joined
02:56 <alisdair> and you wanted to make sure every read returned the same value or a higher value
02:56 <alisdair> you could put the counter in a gen server
02:56 <kronicdeth> Is there a default Poison encoder for Ecto.UUID columns? I'm getting no function clause matching in Poison.Encoder.BitString.chunk_size/3
02:56 <Exuma> Ohhh I see
02:56 <Exuma> Hmm I see
02:57 <Exuma> So is a Genserver ever used as just like a generic data store?
02:57 <Exuma> I am trying to "think in terms of processes"
02:57 <Exuma> obviously there are multiple experiments, and each experiment might have 500 trials. so that has to get stored somewhere
02:57 <Exuma> also there might be 50 variations, so thats stored somewehre too
02:58 <Exuma> As of right now, I'm kind of thinking of a GenServer as like a generic place to store state, but maybe that is wrong
02:58 <Exuma> (state that persists across web requests)
02:58 sevenseacat joined
02:59 <alisdair> you could use it for that
02:59 <alisdair> you could also use ets for that though
02:59 <alisdair> however, if your workload is write heavy it's probably better to use a gen server
03:00 <alisdair> (not for performance reasons, just because it's easier to write generally)
03:00 <Exuma> Oh, I see
03:01 <Exuma> What would I use workers for, hypothetically
03:01 <alisdair> doing things concurrently
03:01 <Exuma> Would 1 worker be per 1 trial (out of 500)
03:01 josevalim joined
03:01 <Exuma> ok, so basically saving things
03:01 <Exuma> to the experiment
03:01 <alisdair> maybe
03:01 <alisdair> a pretty common example is web servers
03:01 <alisdair> you'd have one process per client
03:02 <Exuma> Ok, I see. So a genServer is serial reads, and ETS is concurrent reads
03:02 <alisdair> or if you are writing a thing that makes a bunch of http requests, you'd probably have one process per connection
03:02 <Exuma> what about writes
03:02 <alisdair> writes are serial for both
03:02 <alisdair> basically a gen server can only process a single message at a time
03:02 <alisdair> any messages it receives during processing just sit and wait until it's free
03:03 <alisdair> while an ets table is special and can handle multiple readers at a time
03:03 <Exuma> aahh ok, so if were talking about a very simple operation then, like adding a few numbers, multiple workers wouldnt even be that useful then. its only really useful where an amount of time is involed, like a complicated calculation or http request
03:03 <alisdair> yeah
03:04 <alisdair> if you had a pipeline of tasks you want to perform on an incoming data stream you generally want to perform every task in each process, rather than each task in it's own process
03:05 <alisdair> so you only send a few messages per item in the data stream
03:05 <Exuma> Ok, lets say I use 1 genserver per experiment. Where would I store those names of genservers? do I just create them dynamically with a name based on some sort of unique key or something?
03:05 <Exuma> so that I can "find" it again
03:05 <alisdair> you usually register them with a name or id
03:05 <alisdair> since elixir 1.4 there's a built in registry you can use
03:05 <kronicdeth> You probably want to use the Registry in 1.4, you can have a key that's not an atom then
03:05 <kronicdeth> such as something unique about the experiment
03:05 racycle joined
03:06 <Exuma> I see. Can I also read from the regsitry and just increment to a next ID like a primary key?
03:07 <Exuma> I think I am seeing how this works a lot more now, I appreciate the help by the way
03:09 <Exuma> Also 1 more side question, how is a registry different from ETS? Arent they both key value stores
03:12 chrismccord joined
03:14 <alisdair> registry is just some nicer interfaces to ets, basically
03:14 <Exuma> Ok cool
03:16 Cohedrin joined
03:16 harfangk joined
03:20 kblake joined
03:24 <Exuma> thanks again!
03:24 <Exuma> time to go read and figure dis out
03:44 marcdel joined
03:57 Cohedrin joined
03:58 wong2 joined
03:59 cschneid_ joined
04:00 sfbw joined
04:05 jkreeftmeijer joined
04:09 josevalim joined
04:12 potatosalad joined
04:12 raycoll joined
04:15 raycoll joined
04:21 raycoll joined
04:21 rschmukler joined
04:26 raycoll joined
04:28 raycoll joined
04:29 bionj joined
04:32 raycoll joined
04:35 kblake joined
04:36 gvaughn joined
04:37 raycoll joined
04:41 PhatLe joined
04:43 raycoll joined
04:44 Cohedrin joined
04:47 raycoll joined
04:52 raycoll joined
04:55 raycoll joined
04:58 PhatLe joined
04:59 raycoll joined
05:01 sfbw joined
05:04 raycoll joined
05:05 rschmukler joined
05:09 dec0n joined
05:10 raycoll joined
05:16 raycoll joined
05:17 josevalim joined
05:19 raycoll joined
05:19 rschmukler joined
05:21 sevenseacat joined
05:23 raycoll joined
05:28 codestorm joined
05:35 josevalim joined
05:35 raycoll joined
05:39 PhatLe joined
05:42 wsieroci_ joined
05:44 raycoll joined
05:50 icanhazbroccoli joined
05:55 cemilowski joined
05:57 rschmukler joined
05:59 raycoll joined
06:00 griffinbyatt joined
06:01 josevalim joined
06:01 sfbw joined
06:05 raycoll joined
06:07 jkreeftmeijer joined
06:11 raycoll joined
06:11 dani0_ joined
06:14 raycoll joined
06:17 PhatLe joined
06:18 PhatLe_ joined
06:24 gvaughn joined
06:25 manukall joined
06:28 imush joined
06:28 tuacker joined
06:35 PhatLe joined
06:38 jkreeftmeijer joined
06:39 imush joined
06:40 mark_66 joined
06:42 lessless joined
06:43 ivan joined
06:47 squallstter joined
06:49 Lyubo1 joined
06:52 voltone joined
06:52 bionj joined
06:52 the_voice- joined
06:53 Ray`_ joined
06:55 cxadams_ joined
06:55 nighty-_ joined
06:55 thijser joined
06:55 vans163 joined
06:56 ensyde joined
06:56 capin joined
06:56 xsmalbil joined
06:56 jamick joined
06:57 owickstrom joined
06:57 phansch joined
06:57 whodidthis joined
06:57 siruf joined
06:57 Xikeon joined
06:58 amontalenti joined
06:58 C0deMaver1ck joined
06:58 ernie joined
06:58 dormiens joined
06:58 M_D_K joined
06:59 foli joined
06:59 povilas joined
06:59 chrisml joined
07:00 bigkevmcd joined
07:01 MononcQc joined
07:04 sfbw joined
07:04 stephen_m joined
07:04 craigp joined
07:04 acscherp joined
07:06 dongo joined
07:12 cemilowski joined
07:18 PhatLe joined
07:18 cemilowski joined
07:18 ZippoWeb2 joined
07:19 steffkes joined
07:19 steffkes joined
07:19 Hawkheart joined
07:23 m00dy joined
07:25 m00dy joined
07:27 bionj joined
07:31 codestorm joined
07:33 colrack joined
07:34 milad joined
07:42 dani0_ joined
07:44 asabil joined
07:45 rschmukler joined
07:52 tuacker1 joined
07:54 lessless joined
07:55 dani0_ joined
07:55 vmoravec joined
08:00 cschneid_ joined
08:04 ddd_ joined
08:04 sfbw joined
08:05 craigp joined
08:06 mattyw joined
08:07 craigp joined
08:08 akeating joined
08:09 akeating joined
08:10 akeating joined
08:13 gvaughn joined
08:15 Havvy joined
08:18 Guest67 joined
08:19 lessless joined
08:20 <tuacker> has anyone here recommendations for a lib to parse some xml?
08:22 HansTrashy joined
08:23 <HansTrashy> Hey, quick question, how do i tell distillery to include erlang modules?
08:24 <HansTrashy> I use the eldap module and in dev everything works, but after deploying with edeliver the server fails: function :eldap.open/2 is undefined (module :eldap is not available)
08:24 gokr joined
08:25 codestorm joined
08:26 <gazler> HansTrashy: What Elixir version?
08:27 <HansTrashy> 1.4.1
08:28 <gazler> HansTrashy: You may need to add it in to your `extra_applications` config
08:28 <gazler> "Applications that are part of Erlang or Elixir that are required at runtime, such as :logger, must be added to the :extra_applications list. All extra applications will be included in the application list."
08:29 <gazler> https://github.com/elixir-lang/elixir/blob/v1.4/CHANGELOG.md#application-inference
08:30 PaReeOhNos joined
08:32 m00dy joined
08:32 jkreeftm_ joined
08:33 <HansTrashy> gazler: im trying right now, ty
08:34 dignifiedquire joined
08:35 <HansTrashy> gazler: thank you, its working now :)
08:37 marr joined
08:41 nighty- joined
08:41 meandi joined
08:46 Ayey_ joined
08:46 cschneid_ joined
08:49 dbarrett joined
08:51 lessless joined
08:51 steffkes joined
08:51 steffkes joined
08:52 robinsjdotcom joined
08:52 gregman_ joined
08:53 InternetFriend joined
08:57 nd__ joined
09:04 ctp joined
09:05 sfbw joined
09:08 mbwe joined
09:09 asabil joined
09:09 lexmag joined
09:13 beatpanic joined
09:16 m00dy joined
09:17 m3tti[m] joined
09:17 hexkey[m] joined
09:17 TheGillies joined
09:17 logos[m] joined
09:17 seequ_ joined
09:17 krigare[m] joined
09:17 notriddle joined
09:17 technikhil[m] joined
09:17 wilo[m] joined
09:17 dp[m] joined
09:17 M107262[m] joined
09:17 mindflayer[m] joined
09:17 malteof[m] joined
09:17 nolan_d joined
09:17 bin7me[m] joined
09:17 uhoreg joined
09:17 OAK0[m] joined
09:17 M-Quora joined
09:17 spawnthink[m] joined
09:17 M-nickgal joined
09:17 m00dy joined
09:18 gmcabrita joined
09:18 lessless joined
09:20 codestorm joined
09:24 ctp joined
09:27 flaviodesousa joined
09:38 Apostolos joined
09:46 Philip123466 joined
09:50 Guest94 joined
09:54 jkreeftmeijer joined
10:01 steffkes joined
10:01 steffkes joined
10:01 gvaughn joined
10:04 codestorm joined
10:06 sfbw joined
10:12 m00dy joined
10:13 akdilsiz joined
10:13 <akdilsiz>
10:20 m00dy joined
10:22 squallstter joined
10:24 dani0_ joined
10:30 squallstter joined
10:36 jkreeftmeijer joined
10:44 <smeevil_> o/
10:51 squallstter joined
10:55 InternetFriend joined
10:56 lessless joined
10:57 PhatLe joined
10:58 PhatLe joined
10:58 codestorm joined
10:58 craigp joined
10:58 squallstter joined
10:58 PhatLe joined
10:59 m00dy joined
10:59 PhatLe joined
11:00 cschneid_ joined
11:00 PhatLe joined
11:01 PhatLe joined
11:02 PhatLe joined
11:02 m00dy joined
11:02 PhatLe joined
11:03 PhatLe joined
11:03 greengriminal joined
11:04 PhatLe joined
11:04 griffinbyatt joined
11:05 PhatLe joined
11:07 sfbw joined
11:08 cemilowski joined
11:18 steffkes joined
11:18 steffkes joined
11:19 akeating joined
11:19 milad joined
11:23 dimitarvp joined
11:23 akeating joined
11:24 eddd joined
11:25 PhatLe joined
11:25 jkreeftmeijer joined
11:28 PhatLe joined
11:29 dani0_ joined
11:29 PhatLe joined
11:30 PhatLe joined
11:31 PhatLe joined
11:31 PhatLe joined
11:32 PhatLe joined
11:33 cevado joined
11:33 PhatLe joined
11:34 PhatLe joined
11:35 PhatLe joined
11:38 hellomika joined
11:40 <hellomika> 1
11:41 <halluxcat> 2
11:41 <hellomika> cat vs keyboard :)
11:43 harfangk joined
11:48 <sevenseacat> who won?
11:50 gvaughn joined
11:50 lexmag joined
11:50 <hellomika> cat seems pleased with herself, I'd say she won
11:52 codestorm joined
11:52 m00dy joined
11:52 sfbw joined
11:53 inoas joined
11:58 squallstter joined
12:00 m00dy joined
12:01 sfbw joined
12:03 meandi joined
12:04 cristianR_ joined
12:05 griffinbyatt joined
12:11 asabil joined
12:12 hq1 joined
12:12 hq1 joined
12:12 cristianR_1 joined
12:14 duane joined
12:16 rschmukler joined
12:23 nbg joined
12:27 dani0_ joined
12:30 hellomika joined
12:31 sfbw joined
12:32 akeating joined
12:42 akeating joined
12:45 squallstter joined
12:46 codestorm joined
12:49 steffkes joined
12:56 lessless joined
13:02 ramortegui joined
13:03 akeating joined
13:10 alxnlssn joined
13:11 rschmukler joined
13:12 vmoravec joined
13:13 proteusguy joined
13:23 m00dy joined
13:24 claudevandort joined
13:27 maxbeizer joined
13:30 io_bora joined
13:30 bionj joined
13:31 robinsjdotcom joined
13:31 farhad joined
13:33 lessless joined
13:34 eddd joined
13:35 griffinbyatt joined
13:37 DeadTrickster joined
13:38 gvaughn joined
13:38 akeating joined
13:38 cemilowski joined
13:40 codestorm joined
13:40 m00dy joined
13:43 fhd_ joined
13:44 fhd_ left
13:44 dani0_ joined
13:44 fhdhsni joined
13:50 cevado_ joined
13:51 asabil joined
13:51 colrack joined
13:53 squallstter joined
13:54 gvaughn joined
13:56 [0__0] joined
13:57 InternetFriend joined
13:59 seggy joined
14:01 asabil joined
14:04 renl joined
14:05 <renl> hi anyone encountered this? when using nerves_uart after building escript it break with :erlang.++({:error, :bad_name}, '/nerves_uart')
14:06 <renl> how does this line executable = :code.priv_dir(:nerves_uart) ++ '/nerves_uart' break when the project is compiled into an escript?
14:07 tuacker joined
14:08 io_bora joined
14:08 willyk joined
14:09 chrismccord joined
14:11 InternetFriend joined
14:16 dani0_ joined
14:18 drincruz joined
14:19 cemilowski joined
14:22 jadlr joined
14:22 NeverDie joined
14:26 bionj joined
14:26 praveen joined
14:26 chavito joined
14:34 codestorm joined
14:36 rschmukler joined
14:40 racycle joined
14:40 pat_js joined
14:41 jkreeftm_ joined
14:43 potatosalad joined
14:46 squallstter joined
14:49 ashp joined
14:50 dani0_ joined
14:52 PaReeOhNos joined
14:56 gazler joined
14:56 PhatLe joined
14:57 chrismccord joined
14:59 <drewolson> benwilson512 is there somewhere i can read about adding to the `errors` key from resolvers in absinthe?
14:59 squallstter joined
15:00 dani0_ joined
15:00 <drewolson> benwilson512 does just returning a tuple with `{:error, ...}` do the right thing? if so, can the second item in the tuple be a map?
15:01 m00dy joined
15:04 raycoll joined
15:05 uamana joined
15:05 bitmod joined
15:07 jerel joined
15:08 m00dy joined
15:18 PhatLe joined
15:18 m00dy joined
15:24 cschneid_ joined
15:24 potatosalad joined
15:24 m00dy joined
15:25 m00dy joined
15:27 <iFire> so I have a database how should I cache the queries?
15:27 milad joined
15:27 <iFire> I guess the question is how do I make it faster :)
15:29 codestorm joined
15:30 io_bora joined
15:30 m00dy joined
15:31 cdg joined
15:31 m00dy joined
15:32 rschmukler joined
15:32 NeverDie joined
15:36 Exuma joined
15:37 <Exuma> Is there a way to make a phoenix project without all this extra support for channels? I don't use websockets hardly ever, and its so deeply intwined in all this code, I don't even know what to remove (particularly in endpoint file)
15:37 <gazler> bitwalker: I've just encountered something with distillery that may be of note. I have a plugin which generates an escript file, and am also using exrm_deb. Order is significant as my plugin needs to run before exrm_deb. Anyway, the plugins run in reverse order by the looks of things.
15:37 <gazler> Which makes sense because they are probably prepended.
15:39 <bitwalker> gazler: good catch, mind opening an issue? I'll try to get some fixes out today
15:39 steffkes joined
15:39 <gazler> bitwalker: Sure, no problem. Just wanted to check it was intentional first.
15:39 <jadlr> Exuma, in the endpoint file there is only line that is specific to the generated channel. Something like "socket "/socket", MyProject.Web.UserSocket"
15:40 <bitwalker> gazler: yeah definitely not intentional, just incidental :)
15:40 <gazler> bitwalker: Do they need reversing here? https://github.com/bitwalker/distillery/blob/master/lib/mix/lib/releases/plugins/plugin.ex#L166
15:40 <Exuma> Are: socket / pubsub / channel all basically different words for the same thing
15:40 jschneck joined
15:41 <Exuma> oh crap.... i was looking in the wrong endpoint file. damn
15:41 <Exuma> time to add ignore paths to vim ahhahaha
15:42 <bitwalker> gazler: I'd rather do it in the config handling
15:42 <jadlr> Exuma, i generated a phoenix 1.3 project and there is no pubsub stuff in the endpoint. Only a socket for there generated channel and a socket for the code reloading (you probably wanna keep that)
15:43 <jadlr> Exuma, delete the channel folder in lib/web and test and the channel_case.ex and you should be 'channel-free'
15:43 bionj joined
15:43 <Exuma> thanks! can i delete pubsub out of my mix.exs and deps, or is that used by livereload
15:43 <gazler> bitwalker: You want me to change https://github.com/bitwalker/distillery/blob/master/lib/mix/lib/releases/config/config.ex#L179 (and 186) to ++ []?
15:44 <gazler> bitwalker: If not then I'll just raise an issue!
15:44 <jadlr> Exuma, that I don't know
15:44 <Exuma> ok ill experiment
15:44 <adamkittelson> pubsub is used by channels but it isn't just another name for them, it can be used independently as a way to subscribe processes to messages that may be broadcast from any node in the cluster
15:45 <jadlr> Exuma, you could also delete the function "def channel do" in web.ex
15:45 <Exuma> what about priv/static/js/app.js and web/static/js/socket.js
15:47 milad joined
15:47 <iFire> bitwalker: what the state of distillery and windows services?
15:47 <iFire> what is*
15:49 <jadlr> Exuma, I'm looking at the 1.3 project layout where that stuff is in assets. You should be safe to delete the socket.js file. The app.js is your JS which will be processed by brunch
15:49 <Exuma> hmm i see
15:49 <Exuma> yeah, I'm looking at app.js and don't really see what this is for yet
15:49 squallstter joined
15:49 <bitwalker> iFire: there is support in master for windows, but it has not been released yet
15:49 <bitwalker> on hex that is
15:50 <Exuma> whats the difference between priv/static/css|js and web/static/css|js
15:50 <bitwalker> I'd love to get some feedback from other people though, so if you have time, please give it a shot
15:50 <jadlr> Exuma, priv is the output folder (processed JS) the other is where you write you JS
15:50 <Exuma> ah, I see. now this makes more sense
15:51 <Exuma> ah ha!
15:51 <Exuma> sweet
15:53 rschmukler joined
15:55 robinsjdotcom joined
15:56 <Exuma> what is all this stuff at the top of the compiled app.js? Inside the closure
15:56 amclain joined
15:57 <chrismccord> Exuma as jadlr said, delete the channels dir, then remove the `socket` mount from your endpoint
15:58 <chrismccord> it's not intwined as you implied
15:58 <Exuma> Ah, thanks Chris. Yeah I was accidentally looking at the wrong endpoint file (in dist)
15:59 <Exuma> So far all of this is great, the only part that I'm still wondering about is where all this js in app.js comes from and what its for. I see a few functions which probably come from phoenix_html to submit delete request forms (i'm guessing), but what is all this stuff above it?
15:59 io_bora joined
16:01 davidw joined
16:05 elixir1932 joined
16:05 <elixir1932> Quick question. What does the pipe character do in the following code: `new_results = [result|results]`?
16:06 <elixir1932> I can't seem to find it in the elixir getting started guide
16:06 <alisdair> on the right side of a match pattern it constructs a list by prepending `result` to the list `results`
16:06 <alisdair> on the left side it would match the first item in the list
16:06 <ciawal> http://elixir-lang.org/getting-started/basic-types.html#lists-or-tuples
16:07 <elixir1932> thanks!
16:07 <alisdair> that's a pretty idiomatic way to collect results in an iterative way in elixir (via prepending to a list of results)
16:07 cevado joined
16:08 mattyw joined
16:08 <elixir1932> alisdair: so if I want to sort the list in the order in which items were added, it would be most efficient to construct list this way, then reverse?
16:08 <alisdair> yeah, exactly
16:09 <elixir1932> alisdair: cool, got it.
16:09 <alisdair> it's not necessarily most efficient (body recursion can be more efficient for certain operations/meanings of efficient) but it's generally a good approach
16:09 mattyw joined
16:10 <elixir1932> alisdair: can you expand on how body recursion would be more efficient? (still learning! :))
16:11 <elixir1932> alisdair: wait, I think I asked another question not too long ago and someone (maybe you?) responded about efficiency of body recersion...
16:11 <alisdair> http://ferd.ca/erlang-s-tail-recursion-is-not-a-silver-bullet.html
16:11 <alisdair> that's a pretty good article, better than i can do ;)
16:12 <Exuma> http://culttt.com/2016/06/06/understanding-recursion-tail-call-optimisation-elixir/
16:12 <Exuma> elixir1932 there is one i read yesterday that was good
16:12 <Exuma> (basic) but good
16:14 akeating joined
16:16 akeating_ joined
16:17 juan_ joined
16:17 ejpcmac joined
16:18 gmcabrita joined
16:21 praveen joined
16:22 jeffweiss joined
16:23 vmoravec joined
16:23 codestorm joined
16:28 racycle joined
16:33 frefity joined
16:36 gk_1wm_su joined
16:36 meh` joined
16:37 gk_1wm_su left
16:37 wwwd joined
16:38 griffinbyatt joined
16:40 rschmukl_ joined
16:41 <nox> LCMCO could be a sort of silver bullet.
16:41 akeating joined
16:42 <nox> (Last Call Modulo Cons Optimisation.)
16:42 <nox> This requires some quite heavy changes in BEAM's GC though.
16:43 MaSven joined
16:43 <benwilson512> nox: just the man I need
16:44 <benwilson512> (maybe)
16:44 <benwilson512> do you have a sense of what would suite a large tree structure in Elixir better, a tree of Records of a tree of maps? the tree is essentially AST, and processing the tree involves walking the vast majority of nodes in a pass to annotate it with various forms of metadata
16:45 greengriminal joined
16:45 <benwilson512> there are several dozen such passes
16:45 rschmukler joined
16:45 <nox> Does it matter if it's slow or not?
16:45 <nox> Is the AST quite formal, or are you experimenting and have no idea how it will look like in the end?
16:45 <benwilson512> the actual context is the graphql implementation I'm one of the co-authors of, and processing trees happens on every HTTP request
16:45 <benwilson512> so faster is better
16:46 <benwilson512> you can cache some of the work, but some of it is unavoidable to do each time
16:48 <wwwd> I'm trying to parse a list of colors from a "colors.json" file to be used in a Phoenix select tag. If I do "File.read("../static/resources/colors.json") in iex I get {:ok, "[\"apricot\"...\"]" which I can then parse with "Code.string_to_qoeted". On the other hand, if I try and use "File.read" in my controler I get an error. What am I doing wrong?
16:48 <ljarvis> what's the error?
16:48 <ciawal> you should use Poison.decode
16:48 <ciawal> not Code.string_to_qoeted!
16:49 <ciawal> but you probably just have the wrong file path?
16:49 <benwilson512> note that it's an `{:ok` tuple
16:49 <wwwd> {:error, :enoent}
16:49 <wwwd>
16:49 <ljarvis> that too, but presumably it's a wrong path issue?
16:49 <benwilson512> yea
16:49 <ciawal> yes, that means the file doesn't exist
16:49 <ciawal> you should use the application root helper
16:49 <ciawal> but I forget where it is
16:50 <ciawal> Mix.Project.app_path
16:50 <micmus> the simples solution would be to put it in priv and use Application.app_dir(app_name, "priv/path/to/file")
16:50 <micmus> always works
16:50 <ciawal> you could consider reading this at compile time also
16:51 <micmus> benwilson512: are the maps with fixed keys or are you adding new keys
16:51 <wwwd> If I open iex in the file my /controllers and past it the exact code it reads it.
16:51 <ljarvis> that's not the same app path
16:51 <ciawal> the working directory is not the controller script's directory
16:51 codestorm joined
16:52 <ciawal> you should just do as micmus said, ljarvis
16:52 squallstter joined
16:52 <ljarvis> hm?
16:52 <wwwd> Ok! I'll give that a try...thanks!
16:53 <ciawal> whoops, I meant wwwd
16:53 <ciawal> sorry
16:53 uamana joined
16:54 <wwwd> ciawal: Are you asking me about the maps?
16:54 odogono joined
16:54 refriedchicken joined
17:00 tuacker joined
17:01 cevado joined
17:12 <benwilson512> micmus: fixed keys
17:12 <benwilson512> micmus: its' basically a question of records vs structs
17:13 <wwwd> micmus: "colors = get_colors(File.read(Application.app_dir(maize, "priv/resources/colors.json")))" is telling giving me "web/controllers/pet_controller.ex:16: undefined function maize/0" Did I miss understand what you were telling me?
17:14 <micmus> benwilson512: up to 32 keys, maps are basically two tuples - one for keys, one for values, so it should be pretty much the same compared to records.
17:14 <ciawal> wwwd: :maize
17:14 <ciawal> if that's your app name…
17:14 <micmus> ^
17:14 <benwilson512> micmus: right, I suppose what I'm wondering is if the records would be a lot more compact since the keys aren't really stored
17:15 <wwwd> Ah! Damn!!!
17:15 <micmus> benwilson512: it might be slightly slower, since you have to find the key instead of having the index right there, but I'm not sure it's significant
17:15 <benwilson512> micmus: I'm sure in isolation it isn't, but I'm wondering if with all the tree walking / pattern matching I'm doing if a tuple wouldn't be faster
17:15 <benwilson512> however rewriting the code to use records would be a massive undertaking
17:15 <micmus> benwilson512: yeah, it might be less memory - though the keys tuple can be reused between different maps
17:16 akeating joined
17:16 <micmus> the one in maps
17:16 <benwilson512> micmus: very good point on reusing the keys tuple w/ maps
17:16 <alisdair> i don't think they can be
17:16 dani0_ joined
17:16 <alisdair> unless your keys are heap binaries
17:17 <benwilson512> I could probably do a proof of concept and see how it goes
17:17 pesnk joined
17:17 <benwilson512> the structures are all 100% internal so I'm not super concerned from an API perspective
17:17 <micmus> alisdair: %{map | :key => new_value} won't allocate a new tuple for keys, it will only copy the values tuple
17:19 <benwilson512> right so that's an overall good question
17:19 <benwilson512> what's the relative memory cost of doing
17:19 <benwilson512> %{small_map | key: value} vs tuple |> set_elem(3, value) or whatever the tuple function is
17:20 <benwilson512> the whole tuple is copied as far as I understand it, how much of the map is copied?
17:24 <micmus> up to 32 keys a map is basically something like {keys, values}, where keys & values are a tuple. Keys are sorted and values are under the index of the appropriate key. The map update (unless adding new keys) will copy the values tuple & allocate a new map value. It's slightly more costly compared to a record - you first need to find the right index in the
17:24 <micmus> values tuple and allocate the additional wrapping structure of the map itself.
17:24 icanhazbroccoli joined
17:24 greengriminal joined
17:25 <benwilson512> ok
17:25 threedee joined
17:25 <benwilson512> I'll spike a version w/ records just to see what it gets me
17:25 praveen joined
17:25 Gum joined
17:27 imush joined
17:30 gk_1wm_su joined
17:31 praveen joined
17:31 gk_1wm_su left
17:38 racycle joined
17:39 claudevandort joined
17:40 gk_1wm_su joined
17:42 gk_1wm_su left
17:44 lexmag joined
17:44 josevalim joined
17:50 eddd joined
17:57 squallstter joined
17:58 ikcerog joined
17:59 <OliverMT> Is that how large maps were before as well micmus ? Explains why large maps were slow befor
17:59 <OliverMT> E
17:59 Cohedrin joined
18:02 jkreeftmeijer joined
18:03 <benwilson512> yea
18:06 eddd joined
18:08 ZippoWeb2 joined
18:08 duane joined
18:10 <micmus> OliverMT: yup, that was the only implementation in OTP17 - there was no division for big and small maps
18:10 steffkes joined
18:10 steffkes joined
18:16 Exuma joined
18:22 Matus_ joined
18:24 s_kilk joined
18:34 NeverDie joined
18:37 gk_1wm_su joined
18:38 gk_1wm_su left
18:39 msantos joined
18:40 griffinbyatt joined
18:40 <wwwd> So again, trying to return a list of colors from a file to use in a select...This "{:ok, colors} = get_colors(File.read(Application.app_dir(:maize, "priv/resources/colors.json")))" gives me a very attractive list which I am trying t to use in "render(conn, "new.html", changeset: changeset, colors: colors)". However, this gets me "** (ArgumentError) assign @colors not available in eex template." Am I trying to pass colors correctly?
18:40 <wwwd> Or more accurately, what am I doing wrong? ;)
18:42 praveen joined
18:48 <wwwd> It seems like it should go on the conn.assigns but I can't figure out how to get it on there...
18:49 eddd joined
18:53 squallstter joined
18:56 greengriminal joined
18:56 <ciawal> wwwd: you need to give it to the render call
18:58 <wwwd> ciawal: Like this "render(conn, "new.html", changeset: changeset, colors: colors)"?
18:58 <ciawal> yes
18:58 <wwwd> That was my first try.
18:59 kyrix joined
19:01 <ciawal> look at new.html
19:02 dani0_ joined
19:02 gk_1wm_su joined
19:02 potatosalad joined
19:03 gk_1wm_su left
19:05 squallstter joined
19:07 cevado joined
19:07 <wwwd> Ah, thank you! I was trying to put it in form.html!
19:14 eeeeew joined
19:18 craigp joined
19:21 Exuma joined
19:24 <vans163> anyone run into this {badfun,#Fun<Elixir.Gzf.Panel.Ws.1.387643>} (on the erlang side) when the func is declared on the elixir side
19:25 <vans163> (on the elixir side) ** (BadFunctionError) expected a function, got: #Function<1.387643/1 in Gzf.Panel.Ws>
19:25 <vans163> Func(Value) is how its being called on the erlang side, and Func on the elixir side is == fn(v)-> v end
19:26 <vans163> the elixir side func references some scoped variables.. maybe thats why?
19:27 <vans163> scoped_var = another_arg; fn(v)-> scoped_var end
19:30 greengriminal joined
19:31 drewolson joined
19:31 Exuma joined
19:32 <vans163> it seems when i remove that scoped_var the func works fine
19:32 chrismccord joined
19:34 duane_ joined
19:34 praveen joined
19:36 cevado joined
19:39 greengriminal joined
19:40 griffinbyatt joined
19:42 hahuang65 joined
19:43 Exuma joined
19:54 josevalim joined
19:57 milad joined
19:57 vegax87 joined
20:00 willyk joined
20:01 Uniaika joined
20:11 steffkes joined
20:11 steffkes joined
20:14 cdg joined
20:20 Ilyes512 joined
20:21 <Ilyes512> hey guys. why does deleting a row twice result in an error instead of returning an tuple {:error, ?}. https://hexdocs.pm/ecto/getting-started.html#deleting-records
20:22 <Ilyes512> I get this error instead of the expected tuple: (Ecto.StaleEntryError) attempted to delete a stale struct:
20:22 <Nicd-> did you use delete!() with exclamation mark?
20:22 m_m joined
20:23 <Ilyes512> no
20:24 <Nicd-> you're deleting from the same struct twice?
20:24 <Ilyes512> so I first got a struct by doing: user = Acme.Accounts.user |> Acme.Repo.get(1)
20:24 <Ilyes512> yes
20:25 <Ilyes512> I call this twice (with the first one succeeding) Acme.Repo.delete user
20:25 <Nicd-> there's an answer here: https://groups.google.com/forum/#!topic/elixir-ecto/Q3xTHVuRCeQ
20:25 <Nicd-> "The issue is that we don't really know if it was deleted. IIRC You could have something in your database that forbade the delete and we would get no results while the entry is still there. We don't know the reason (that's why it is an exception and not a changeset error)."
20:28 <Ilyes512> hmm
20:28 <Ilyes512> "could have something in your database that forbade" how?
20:29 <cmk_zzz> Ilyes512: foreign key constraint for example
20:29 <Ilyes512> like a fk constraint? Would that not throw a mysql error?
20:29 <Ilyes512> (in my case mysql)
20:30 s_kilk joined
20:30 <Ilyes512> i still find it strange that it throws an error instead of a tuple {:error, msg}
20:31 <Ilyes512> wait... if it was deleted it would return with "No errors; 0 rows affected" that would not be an error hmm
20:31 Antiarc joined
20:32 ejpcmac joined
20:38 <lagbox> good question Ilyes512
20:41 griffinbyatt joined
20:43 guacamole joined
20:43 bionj joined
20:44 cristianR_ joined
20:45 potatosalad joined
20:46 <vans163> is it just me, or are dynamic functions in elixir not supporting outer scoped variables?
20:46 <vans163> outer=5; dynamic = fn()-> outer end; now call dynamic() from erlang and you get badfun.
20:46 <vans163> but doing the same thing in erlang and calling from erlang no error
20:50 asabil joined
20:53 milad joined
20:54 squallstter joined
21:00 <OliverMT> are you doing dynamic.() from somewhere where outer is in scope?
21:03 <vans163> OliverMT: outer is not in scope. yes
21:03 <vans163> I tested in erlang shell, unsetting via f/1 everything works, calling it from inside spawn works.
21:03 <vans163> **no, outer is not in scope.
21:05 <vans163> https://gist.github.com/anonymous/ad85682deff2a9ced48d03e6692eb090
21:09 <OliverMT> to me that is more logical
21:09 <OliverMT> lambda functions shouldnt capture outside scope :D
21:09 bambanx joined
21:09 milad joined
21:11 maxbeizer joined
21:11 <vans163> if the function is immutable, it shoudnt hold refs to things, it makes sense for anything outside the functions scope to be copied into the function itself
21:11 <vans163> im not sure if the way the erlang code is calling the elixir code, it would break on erlang and elixir funcs. or if its an elixir thing
21:12 <vans163> elixir doesnt support (fn()-> :ok end)() so maybe the way it handle these types of funcs is different
21:13 PhatLe joined
21:22 hipertracker joined
21:23 Antiarc joined
21:28 <iFire> vans163: you can put it inside a struct
21:29 <iFire> and pass the struct
21:29 ejpcmac left
21:32 guacamole joined
21:39 strykerkkd joined
21:42 griffinbyatt joined
21:43 <drewolson> benwilson512 have you considering exposing a batch API similar to https://github.com/Shopify/graphql-batch for absinthe? i think it works out quite nicely (in ruby)
21:47 Exuma joined
21:48 <sorentwo> drewolson: There has been discussion about it in the past, and it looks like there is some ecto specific work for it underway https://github.com/absinthe-graphql/absinthe_ecto/blob/master/lib/absinthe/ecto.ex
21:48 <drewolson> sorentwo ah, thanks. the current batching mechanism is fine, too, but i enjoyed working with graphql-batch, and it seems that's also similar to facebook's dataloader
21:49 <sorentwo> Within the app I've been working on I built up my own "preload" resolver, but it only works for one "resolution" at a time.
21:50 <drewolson> sorentwo in a ruby example i was working on, i built my own "has many" resolver that uses postgres window functions to efficiently load the first "page" of data for all parent objects. it was nice to work with graphql-batch while doing that.
21:50 Ilyes512 joined
21:51 <drewolson> i may do something similar in ecto and elixir
21:51 <sorentwo> drewolson: That sounds pretty great. Is that example public anywhere? I'm a fan big fan of window functions.
21:51 <drewolson> one sec, i'll gist it
21:52 <drewolson> https://gist.github.com/drewolson/12e08e8bb24bdce474b05dc2edcf1826
21:52 <drewolson> the `Page.new` at the end is my light weight "learn as i go" version of relay connections
21:53 <drewolson> purely for learning the concepts
21:53 <drewolson> but you could simply fulfill with the list of models rather than wrapping it in anything
21:53 <drewolson> basically i was trying to figure out how to efficiently load relay connections lazily in batch
21:53 <drewolson> and i think window functions are the answer if you're using postgres
21:53 <Exuma> is there a way i can redirect "/" to some other path, like i can in rails, ?
21:54 <drewolson> the most annoying part of the code is sanitizing the sql :)
21:54 <Exuma> using phoenix
21:54 <sorentwo> Something I've found especially useful in Ecto is that you can specify the preload query, which has helped for joins etc, and is marginally helpful in ordering and limiting.
21:55 <drewolson> would that allow you to limit the number of results per foreign key in a single query, though? i'd guess no?
21:56 m_m joined
21:56 <sorentwo> It lets you limit the number of results total, not per-key. You could use a window function for that, like you were doing though.
21:57 <drewolson> yep. i think i'd probably use the same approach in ecto.
22:02 jerel joined
22:03 <drewolson> Exuma: you'd just have an entry in your router like `get "/", PageController, :index`
22:03 <drewolson> just pick the controller and action you want
22:04 <drewolson> unless you want an actually HTTP redirect
22:04 <Exuma> what I mean is, how would I redirect so that I don't technically have "/"
22:04 <Exuma> so it would redirect
22:04 <Exuma> / to /experiments
22:04 <drewolson> i'd probably just redirect from a controller itself.
22:04 <Exuma> ok, i figured as much
22:04 <drewolson> i'm not sure if you can do that directly in the router
22:04 lexmag_ joined
22:05 <Exuma> thanks for your help
22:05 <drewolson> np
22:06 <Exuma> is there a way i can redirect to a route helper path
22:06 <Exuma> so i can say experiments_path, it seems it only accepts "/path" as a string
22:07 <Exuma> nevermind
22:07 <Exuma> I see, i just pass in conn twice
22:07 <Exuma> to the path() method
22:11 robinsjdotcom joined
22:12 steffkes joined
22:17 ctp joined
22:20 milad joined
22:25 praveen joined
22:26 Exuma joined
22:33 duder joined
22:39 jushur joined
22:46 jhack joined
22:46 hipertracker joined
22:50 kronicdeth joined
23:00 rschmukler joined
23:01 icecreamcohen joined
23:04 refriedchicken joined
23:06 hellomika joined
23:14 milad joined
23:19 PhatLe joined
23:28 rschmukler joined
23:42 nomicflux joined
23:44 hellomika joined
23:48 pankracy joined
23:49 codestorm joined
23:52 claudevandort joined
23:52 steffkes joined
23:52 steffkes joined
23:57 hahuang65 joined
23:59 rekyuu_ joined