<  February 2017   >
Su Mo Tu We Th Fr Sa  
          1  2  3  4  
 5  6  7  8  9 10 11  
12 13 14 15 16 17 18  
19 20 21 22 23 _2_4 25  
26 27 28
00:06 danecando joined
00:09 sillyotter joined
00:17 josevalim joined
00:19 PaReeOhNos joined
00:20 srxa joined
00:21 <flippant> hi
00:21 <flippant> es6 has really nice syntax for objects like
00:21 <flippant> const really_long_var = 1;
00:21 <flippant> const my_obj = {really_long_var};
00:21 <flippant> does elixir have anything like this yet?
00:22 <flippant> right now I need to do %{really_long_var: really_long_var\}
00:22 <flippant> kind of annoying
00:22 systemfault joined
00:30 <FMJaguar_> I type it out currently, but I think this discussion is about that topic: https://groups.google.com/forum/#!topic/elixir-lang-core/NoUo2gqQR3I
00:31 coatezy joined
00:32 DTZUZU joined
00:34 icecreamcohen_ joined
00:34 FIFOd joined
00:41 <benwilson512> flippant: there is a library for something like that
00:41 <benwilson512> it has been discussed a fair bit
00:41 <benwilson512> you can't do it exactly like that because that'd be a tuple
00:43 travis-ci joined
00:43 <travis-ci> elixir-lang/elixir#13638 (master - 3625f0d : José Valim): The build passed.
00:43 <travis-ci> Change view : https://github.com/elixir-lang/elixir/compare/c08aa189b1dd...3625f0d8be4c
00:43 <travis-ci> Build details : https://travis-ci.org/elixir-lang/elixir/builds/204807854
00:43 travis-ci left
00:44 DLSteve joined
00:44 <flippant> thanks for the link
00:45 harfangk joined
00:45 <ivan> so, is there a place to post Elixir-related security bulletins? if not, there should be one
00:48 milad joined
00:48 <rbino> is there a pattern to "supervise" a module that consists only of stateless function? to avoid propagating errors all the way to the top application
00:48 <rbino> do I just use a GenServer with an empty state or there is something more specific?
00:51 hahuang65 joined
01:03 rkazak joined
01:06 sillyotter joined
01:10 potatosalad joined
01:11 refriedchicken joined
01:12 keathley joined
01:17 cherrot joined
01:22 PaReeOhNos joined
01:24 nighty joined
01:25 Duckily joined
01:30 codestorm joined
01:43 milad joined
01:44 idahogray joined
01:46 cherrot joined
01:49 zvrk joined
01:56 r00tl3ss joined
02:00 potatosalad joined
02:02 bobbypriambodo joined
02:04 bobbypriambodo joined
02:04 <Cohedrin> is there a good way to start another app inside a mix app from the command line?
02:05 <Cohedrin> inside a mix project*
02:05 <Cohedrin> for example I have a phoenix application for my mix project, and I'm deploying it to heroku
02:06 <Cohedrin> I have another service, in a situation similar to whats described here https://elixirforum.com/t/run-separate-process-from-mix/1133/4
02:06 codestorm joined
02:06 <Cohedrin> however, I would prefer not to run the seconday app inside the same dyno as the web app, but run it from another dyno
02:07 <Cohedrin> but I can't figure out a good way to start the seconday app from the command line to suit the Procfile's needs
02:07 <Cohedrin> any advice on how I should go about doing this?
02:09 <fowlduck> looking for opinions on the best way to authenticate an API. I'm tempted to just use a simple token + SSL, but maybe request signing with a date is better (like AWS)?
02:09 <fowlduck> just so the requests expire
02:09 <Cohedrin> depends on the use case
02:10 <Cohedrin> is this something where users sign up for tokens, or is this an internal service?
02:10 <fowlduck> internal service, for now
02:10 <fowlduck> which makes me lean towards a simple token
02:10 <Cohedrin> most common pattern is just to have API_SECRET and API_TOKEN
02:10 <fowlduck> eh?
02:11 <fowlduck> can you elaborate?
02:11 <Cohedrin> where secret is the actual authenication token
02:11 potatosalad joined
02:11 <Cohedrin> and api token is whats used to identify the requester
02:11 <Cohedrin> if its only an internal service, then you don't need the token part
02:11 <Cohedrin> i.e. if there is only 1 reuqester
02:12 <fowlduck> there will be multiple accounts, it's shared
02:12 <fowlduck> so, I guess a token per account
02:13 <fowlduck> and add different access levels to tokens in the future if I need it
02:13 <Cohedrin> yeah I mean basically what I'm suggesting is what every major payment provider or similar uses
02:14 <Cohedrin> checkout braintree or similar's api docs for a more detailed explanation
02:18 <fowlduck> yeah, looks like stripe just uses it as the user in basic auth
02:19 <fowlduck> https://stripe.com/docs/api/curl#intro
02:19 myronmarston joined
02:22 bobbypriambodo joined
02:29 rhnonose joined
02:38 systemfault joined
02:40 wong2 joined
02:41 potatosa_ joined
02:41 tomterl joined
02:42 chrismccord joined
02:49 marcdel joined
02:49 codestorm joined
02:50 raycoll joined
02:50 chriswarren joined
02:52 PaReeOhNos joined
02:59 karmajunkie joined
03:16 cherrot joined
03:24 myronmarston joined
03:24 kau joined
03:41 wtetzner joined
03:56 r00tl3ss joined
04:05 Cthalupa joined
04:06 codestorm joined
04:13 jerel joined
04:17 icecreamcohen joined
04:19 fhoffmann joined
04:19 squall joined
04:22 PaReeOhNos joined
04:23 srxa joined
04:25 raycoll joined
04:25 milad joined
04:28 racycle_ joined
04:32 devbug joined
04:41 r00tl3ss joined
04:50 tekhneek joined
04:50 <tekhneek> Something wrong with this:
04:50 <tekhneek> if ExImageInfo.seems? File.read!(file) in [:jpg, :tiff] do
04:50 <tekhneek> IO.puts "got an image"
04:50 <tekhneek> end
04:50 <tekhneek> ? maybe I'm not understanding the best way to check if a list of atoms matches a result
04:51 <tekhneek> should return either :jpg, :tiff etc from ?seems, and tested against the same file it works but I never get a message saying I have an image
04:51 <tekhneek> nevermind :o g'night. I'm a dork.
04:56 BombAw joined
05:00 alex88 joined
05:07 srxa joined
05:08 raycoll joined
05:17 raycoll joined
05:21 <kaylined> is there a way to generate controllers, like you can with models?
05:21 imack joined
05:24 <Nicd-> kaylined: maybe with mix phoenix.gen.html/json --no-model?
05:24 <Nicd-> see https://hexdocs.pm/phoenix/Mix.Tasks.Phoenix.Gen.Html.html and https://hexdocs.pm/phoenix/Mix.Tasks.Phoenix.Gen.Json.html
05:29 <kaylined> Thanks, will check it out.
05:30 raycoll joined
05:30 chriswarren joined
05:52 Tica2 joined
05:53 PaReeOhNos joined
05:54 <kaylined> Getting this error, when trying to do real_path in a template: undefined function page_path/2 according to the guide that should be included automatically with App.web, :view
05:56 milad joined
05:57 icanhazbroccoli joined
06:01 gvaughn joined
06:02 <rkazak> @kaylined: why don’t you load it into iex and look for it, the method…
06:02 <rkazak> @kaylined: there maybe online help.
06:02 r00tl3ss joined
06:03 <kaylined> The only resource referring to it is the docs
06:06 adam_s joined
06:06 <adam_s> hello
06:07 <adam_s> I am starting an elixir app with `iex -S mix phoenix.server` -- does anyone know how or where I would provide a "+A" argument to increase async threads?
06:07 <adam_s> the program is IO heavy
06:10 dec0n joined
06:17 zhangji joined
06:20 devbug joined
06:44 refriedchicken joined
06:46 gokr joined
06:47 bobbypriambodo joined
06:51 Cohedrin joined
06:52 refriedchicken joined
06:54 gokr left
06:54 bobbypriambodo joined
06:55 gvaughn joined
06:55 bobbypriambodo joined
06:56 refriedchicken joined
06:57 codestorm joined
06:58 refriedchicken joined
07:03 devbug joined
07:03 cherrot joined
07:10 r00tl3ss joined
07:17 tomaz_b joined
07:18 <rkazak> @adam_s: iex --erl +A 100
07:23 PaReeOhNos joined
07:23 <Nicd-> rkazak: they left already
07:24 <rkazak> Yes, I saw after I posted. also it’s +A100 no space …
07:24 <rkazak> oh well… :)
07:24 k77 joined
07:31 devbug joined
07:31 jerel joined
07:41 systemfault joined
07:44 r00tl3ss joined
07:48 tuacker joined
07:49 gvaughn joined
07:58 craigp_ joined
08:00 Guest67_ joined
08:07 dignifiedquire joined
08:09 bigkevmcd joined
08:09 martin_langhoff joined
08:18 ZippoWeb joined
08:19 <OliverMT> elixir con us page says
08:19 <OliverMT> More information to be posted in January.
08:19 <OliverMT> haha
08:21 lizzin joined
08:23 cherrot joined
08:27 <fredsir> anyone know when videos from lonestarelixir will be available?
08:27 DeadTrickster joined
08:31 codestorm joined
08:31 mark_66 joined
08:32 nd__ joined
08:39 milad joined
08:43 gvaughn joined
08:45 rokf joined
08:47 stephen_m joined
08:48 PaReeOhNos joined
08:49 flaviodesousa joined
08:58 dch_ joined
08:58 mattyw joined
09:01 inoas joined
09:02 rhnonose joined
09:05 HendrikPeter joined
09:12 laurocaetano joined
09:12 josevalim joined
09:13 vmoravec joined
09:19 martin_langhoff joined
09:19 cdg joined
09:26 codestorm joined
09:26 storm_ joined
09:27 Antiarc joined
09:37 gvaughn joined
09:42 terlar joined
09:45 martin_langhoff joined
09:50 terlar joined
09:58 k77 joined
09:59 lexmag joined
10:00 marr joined
10:01 <smeevil> o/
10:02 zenware joined
10:07 fantomik joined
10:10 somethingwenwron joined
10:20 codestorm joined
10:28 <m1dnight_> Im thinking about mmaking muy plugins for my slackbot GenEvents
10:28 <m1dnight_> But it seems like you can't put those in a supervisor, right?
10:28 <m1dnight_> So I would need to wrap all of them in a GenServer process?
10:28 <m1dnight_> Which makes me thing that my own publish/subscribe system is a bit simpler
10:29 craigp_ joined
10:29 <m1dnight_> https://github.com/m1dnight/slackbot/blob/master/lib/slack/slack_manager.ex
10:29 <m1dnight_> This is my current approach
10:31 <m1dnight_> So if I made all the plugins (which are now my own kind of event listeners) eventhandlers, they could subscribe to the manager and my slack process could notify when there is a message and all the listeners would respond
10:31 <m1dnight_> But then I would lose my genserver/supervisor approach
10:31 gvaughn joined
10:32 mpsag joined
10:33 <OliverMT> just a style comment
10:34 <OliverMT> API should be at the top of the file :P
10:34 <somethingwenwron> Can someone tell me the steps I should take to get Phoenix to display stacktraces on errors? Right now I am just getting "Something went wrong". It used to work, but for some reason not anymore. Running Mix.env from IEx return :dev and my dev.exs has debug_errors: true for the endpoint config. What else should I check?
10:34 <PaReeOhNos> m1dnight_: Could you use GenStage? Then the plugins could just become consumers and can be supervised easily as well?
10:34 <m1dnight_> Oh, that's something I have not yet looked into
10:34 <m1dnight_> Thanks for the tip, PaReeOhNos
10:35 srxa_ joined
10:42 travis-ci joined
10:42 <travis-ci> elixir-lang/elixir#13641 (master - f3e5226 : Michał Muskała): The build was broken.
10:42 <travis-ci> Change view : https://github.com/elixir-lang/elixir/compare/3625f0d8be4c...f3e5226ead3c
10:42 <travis-ci> Build details : https://travis-ci.org/elixir-lang/elixir/builds/204921346
10:42 travis-ci left
10:46 codestorm joined
10:49 pbrooko joined
10:50 vmoravec joined
10:56 rahul joined
10:57 <rahul> join
10:57 <Nicd-> part
11:08 simonoram joined
11:08 srxa joined
11:09 gmcabrita joined
11:15 <fnux> Hello ! I want a process to listen on a socket, what's the best way to do it ? I have a supervisor starting the process, then the process send itself a message in init/1 to start the "loop"... looks weird, it is okay ?
11:15 <fnux> Thanks !
11:17 codestorm joined
11:18 Guedes joined
11:18 <OliverMT> if its a genserver that is how you do it
11:19 <nox> OliverMT: What?
11:23 terlar joined
11:24 <OliverMT> you cant start the loop and ack the tcp at the same time
11:24 <OliverMT> unless I'm misunderstanding what he's asking
11:25 gvaughn joined
11:28 edwinvdgraaf joined
11:29 <PaReeOhNos> fnux: I wrote this lib which does basically that. Can't comment on the quality of the code so don't take it as exactly how it SHOULD be done, but it gives you an idea https://github.com/manageplaces/Stompex
11:31 <fnux> Thank you!
11:41 edwinvdg_ joined
11:41 nighty- joined
11:44 cemilowski joined
11:59 edwinvdgraaf joined
12:09 chrismccord joined
12:10 shankardevy joined
12:11 codestorm joined
12:18 chriswarren joined
12:20 gvaughn joined
12:22 milad joined
12:25 edwinvdgraaf joined
12:25 cemilowski joined
12:28 milad joined
12:28 milad joined
12:29 jigawatt joined
12:32 <the_voice_> Hi all
12:32 <the_voice_> Long time
12:33 nighty joined
12:33 <smeevil> o/
12:37 chriswarren joined
12:41 simonoram joined
12:48 laurocaetano joined
12:48 mattyw joined
12:51 meh` joined
12:52 srxa_ joined
12:54 <nox> OliverMT: I would use enter_loop rather than send messages to myself because I used start.
12:54 <OliverMT> I couldnt get it to work
12:54 <OliverMT> dont remember why, but it was with fishcakez help as well
12:55 chriswarren joined
12:59 <fishcakez> nox: we dont have enter_loop
12:59 <nox> Why?
12:59 <fishcakez> No one ever asked for it
13:02 <fishcakez> For socket stuff there is connection lib that has easier abstraction, compared to enter_loop
13:05 codestorm joined
13:13 fowlduck joined
13:14 gvaughn joined
13:17 <hansihe> just did a json parser nif completely in safe rust code, it manages to beat jiffy in everything i have thrown at it so far https://gist.github.com/hansihe/57b24af8e3604714f7577debb8d3bb24
13:18 <benwilson512> nice!
13:18 <benwilson512> I'm rather impressed how well poison compares tbh
13:19 <nox> hansihe: Did you write a new Rust JSON parser?
13:19 <hansihe> nox: yes
13:19 <nox> y tho
13:19 chriswarren joined
13:19 <hansihe> haha
13:19 <benwilson512> hansihe: er wait, I assumed you were integrating a known rust parser
13:19 <benwilson512> rust *json parser
13:20 <nox> benwilson512: I'm not sure Rust has JSON parsers that can be interrupted in the way BEAM wants it.
13:20 <benwilson512> ah
13:20 <hansihe> the parser needed the ability to yield at any time in the input stream
13:20 <hansihe> yeah
13:20 <hansihe> i looked, but I didn't find any
13:21 <benwilson512> hansihe: how much unsafe code?
13:22 <hansihe> zero
13:22 <benwilson512> nice
13:22 <nox> benwilson512: hansihe said "in safe rust code".
13:22 <benwilson512> ok ok ok I haven't had coffee yet
13:22 <nox> hansihe: Do you plan to release it in crates.io separate to the NIF?
13:22 <benwilson512> brb
13:22 t-ce joined
13:23 <hansihe> well, there is one piece of unsafe code to convert a u32 to [u8; 4] without adding the byteorder crate as an dependency, but I think that's fairly benign
13:23 <hansihe> nox: yeah, I was planning on it
13:23 <hansihe> https://github.com/hansihe/rust_iterative_json_parser/tree/master/src
13:23 <hansihe> that's the source
13:24 <hansihe> it needs to be cleaned up a bit, but I think most of it is fairly understandable
13:24 <hansihe> tokenizer.rs and parser.rs are where stuff happens
13:24 <nox> hansihe: Why not depend on byteorder?
13:24 <nox> hansihe: Or just do maths..?
13:25 <nox> hansihe: [v >> 24 as u8, v >> 16 as u8, v >> 8 as u8, v as u8]
13:25 <hansihe> yeah
13:25 <hansihe> that's probably a better idea
13:25 <hansihe> just to avoid the unsafe code
13:26 <nox> hansihe: Why did you redefine Range?
13:27 simonoram joined
13:27 <hansihe> nox: because I didn't think enough about it before doing it mostly
13:27 <nox> :)
13:28 <hansihe> I can't say I have a better reason :)
13:31 laurocae_ joined
13:32 <nox> hansihe: Nice anyway.
13:32 alex88 joined
13:32 <hansihe> thanks!
13:32 <nox> hansihe: You may want to use itoa and dtoa, and to not do "*" in Cargo.toml.
13:33 <nox> hansihe: And to use the log crate instead of your ad-hoc log_token function.
13:33 edwinvdgraaf joined
13:34 <hansihe> yep, will try to get most of that cleaned up before a release
13:37 <OliverMT> bitwalker: how long do you recon I can be lazy and stay on exrm?
13:37 <OliverMT> bitwalker: elixir version bumps deprecating stuff maybe?
13:37 <nox> hansihe: A bit unfortunate that the requirement for arbitrary yielding points mean that we can't ever use serde from BEAM.
13:38 <* nox> fancies serde.
13:41 <hansihe> nox: yep, I would have much rather wanted to use something that already exists
13:42 BombAw joined
13:43 <nox> hansihe: Might want to join #serde on the Mozilla network, dtolnay might have ideas about how to share some work.
13:43 bigkevmcd joined
13:44 <hansihe> nox: I already am it seems
13:44 <nox> hansihe: Oh right. :D
13:46 <hansihe> might want to show it off in there I guess?
13:49 cemilowski joined
13:50 milad joined
13:50 milad joined
13:57 chriswarren joined
13:59 codestorm joined
14:01 <nox> hansihe: dtolnay always have neat ideas.
14:05 codestorm joined
14:08 gvaughn joined
14:13 <OliverMT> how do I "stop" the beam from elixir?
14:13 <OliverMT> I am running an exrm command and after the module I want to run has run.. it just runs forever since I am starting the main app
14:13 <OliverMT> err, *safely* stop
14:13 <OliverMT> or is it fine to just init:stop(). ?
14:14 wtetzner joined
14:14 <Nicd-> OliverMT: System.halt/1
14:15 <Nicd-> dunno how exrm will react
14:19 <benwilson512> :init.stop()
14:19 <Nicd-> System.halt(:hammertime)
14:22 <OliverMT> System.halt(0) should do
14:22 <OliverMT> testing now
14:26 srxa joined
14:28 BombAw joined
14:29 <benwilson512> I know for sure that :init.stop does the whole proper supervision based shutdown process
14:29 <benwilson512> no idea about System.halt
14:29 <benwilson512> FYI
14:29 chriswarren joined
14:31 <OliverMT> yeah system halt goes to erlang.halt
14:31 <Nicd-> I have failed you :(
14:36 <m1dnight_> Are there any people from Belgium in this channel? I was thinking about starting an Elixir Meetup.
14:36 <m1dnight_> (I know this is a long shot :p)
14:37 ethelward joined
14:37 <ethelward> Hi
14:37 <ethelward> I need some help with reading a file
14:37 <m1dnight_> What's the issue ethelward
14:37 <ethelward> I'm doing a standard `x = File.read! "myfile"`
14:37 <ethelward> But myfile is ~50MB big
14:38 <m1dnight_> That should fit in memory easily.
14:38 <ethelward> And the File.read just eats my RAM up to my 16GB, where I just have to kill it
14:38 <m1dnight_> hrm
14:38 <m1dnight_> Try streams.
14:38 <ethelward> What di I miss?
14:38 <ethelward> *did
14:38 <m1dnight_> How many lines does it contain..? Seems like an awful lot of memory for a 50mb file. That's out of my expertise tbh :p
14:38 cristianR_ joined
14:38 <cristianR_> Hi
14:38 <ethelward> m1dnight_: it's a FASTA file (genomic data), so basically a whole lot of A, T, G & C :p
14:39 <m1dnight_> Oh
14:39 <ethelward> standard text file otherwise
14:39 <m1dnight_> Try a stream
14:39 <m1dnight_> File.stream!("myfile") |> ...
14:39 greengriminal joined
14:40 <m1dnight_> And if you don't have that many newlines (e.g., it's one single line) you should read by byte
14:40 <ethelward> Nah, unfortunately it's cut in a lot of relatively small (~100chars) lines
14:40 <m1dnight_> Okay, give that a shot and see how it goes
14:41 <ethelward> So basically, `content = File.stream!("file.fasta") |> Stream.run`
14:41 <ethelward> ?
14:41 <m1dnight_> Don't you want to process the data, too?
14:42 <ethelward> m1dnight_: no, I receive it from an uploaded file and I just want to store it in a PgSQL BLOB
14:42 <m1dnight_> http://elixir-lang.org/getting-started/enumerables-and-streams.html Give this a read if you've got the time.
14:42 <m1dnight_> oh, yeah that should do it I guess
14:42 maxbeizer joined
14:43 danecando joined
14:43 <cristianR_> Is there a way to tell Poison to decode numbers as strings? Alternatively, is there a way to convert all numeric values in a map (nested) into strings?
14:45 <benwilson512> ethelward: er so
14:46 <benwilson512> ethelward: to start off with
14:46 <benwilson512> literally just doing x = File.read!("path/to/file") uses up all your ram?
14:46 travis-ci joined
14:46 <travis-ci> elixir-lang/elixir#13644 (master - 2c147f4 : Lau Taarnskov): The build was fixed.
14:46 <travis-ci> Change view : https://github.com/elixir-lang/elixir/compare/f3e5226ead3c...2c147f4cc6ba
14:46 <travis-ci> Build details : https://travis-ci.org/elixir-lang/elixir/builds/204985166
14:46 travis-ci left
14:46 <benwilson512> if you just open an iex session and do that one line it happens?
14:46 <ethelward> benwilson512: yes, indeed
14:46 <ethelward> It what was surprising me
14:46 <ethelward> Especially for a 50MB file :p
14:48 chriswarren joined
14:48 <ethelward> At first, I was suspecting some weird interaction with Phoenix uploaded files (I'm a beginner, so I don't have a full understanding of the whole stack), but I have the same result when doing a simple File.read! in a clean iex shell
14:49 <benwilson512> ethelward: that is indeed weird, I just generated a 50mb file
14:49 <benwilson512> and read it in
14:49 <benwilson512> with no particular issue
14:49 <benwilson512> does it happen with small files?
14:49 <ethelward> benwilson512: Trying it...
14:50 <benwilson512> basic stuff: what operating system, elixir / erlang version?
14:50 <ethelward> benwilson512: elixir 1.4.2/erlang 19.2, gentoo
14:51 <benwilson512> how are you measuring memory usage?
14:51 <ethelward> benwilson512: htop
14:51 <benwilson512> just for fun
14:52 <benwilson512> open a new iex session and type
14:52 <benwilson512> :observer.start
14:52 <benwilson512> and then click on the load charts tab
14:52 <benwilson512> then open your file
14:52 craigp_ joined
14:52 <benwilson512> did it happen w/ small files btw?
14:53 <ethelward> Nope, OK with small files (10KB)
14:53 <Nicd-> ethelward: what memory column are you looking at in htop?
14:53 <ethelward> But 3GB of RAM to read a truncated 20MB version of the file
14:53 <ethelward> Nicd-: I'm just looking at the general RAM use
14:54 <benwilson512> ethelward: what does observer report WRT ram usage
14:54 <Nicd-> the bar or the number? try looking at the RES column for the BEAM process
14:54 <ethelward> benwilson512: currently recompiling erlang with wxwidgets (gento... :/)
14:55 <ethelward> Nicd-: will do
14:55 <benwilson512> ah
14:55 <ethelward> Oh, that's weird...
14:55 nanohest joined
14:55 <Nicd-> what is?
14:55 <ethelward> When I create a phoney file (dd if=/dev/urandom of=test bs=1M count=20)
14:55 <ethelward> It just reads it instantly...
14:55 <ethelward> So it seems that my FASTA file is actually the problem
14:56 <benwilson512> interesting
14:56 <benwilson512> is it available anywhere?
14:56 <ethelward> benwilson512: I'll upload it, let me a minute
14:56 <benwilson512> as a side note, why store it in postgres vs something like S3?
14:56 marciol joined
14:56 <Nicd-> ethelward: can you take a screenshot of htop showing BEAM when you have opened the file?
14:57 <ethelward> benwilson512: because public research, so we don't have the right to do anything not self-hosted
14:57 <ethelward> Data protection and so on
14:57 <benwilson512> ah
14:57 <ethelward> benwilson512: https://files.odena.eu/msy.fasta (self-signed certificate for the website)
14:58 chriswarren joined
14:58 <benwilson512> woooow
14:58 <benwilson512> same issue
14:58 <benwilson512> ok
14:58 <benwilson512> well sorta
14:59 chrismccord joined
14:59 <benwilson512> it may be because it's all valid UTF8
14:59 <benwilson512> the debug printing in IEX is causing the issue
14:59 <benwilson512> one sec
14:59 <ethelward> Yes, it should be UTF8
14:59 codestorm joined
14:59 <ethelward> Well, ASCII technically, therefore UTF8
14:59 <benwilson512> right yup
15:00 <ethelward> So it's trying to read it up as a string instead of a binary blob ?
15:00 <benwilson512> no no so
15:00 josevalim joined
15:00 <benwilson512> my theory so far
15:00 <benwilson512> is that the reading in goes fine, it's that IEX by default prints the inspected representation as the return value
15:00 <benwilson512> which if it's valid text
15:00 <benwilson512> it will try to display the full text
15:00 <benwilson512> so what's killing us is trying to print it to console
15:01 <benwilson512> the upload scenario may have a similar scenario on some level, I don't know enough yet to say
15:01 <ethelward> Mmh, interesting
15:01 <benwilson512> one sec, should be easy enough to test
15:01 <benwilson512> so in iex do
15:02 <benwilson512> x = File.read!("msy.fasta"); nil
15:02 chriswarren joined
15:02 <ethelward> Seems to work
15:02 <Nicd-> it's the debug print
15:02 <benwilson512> josevalim: does inspect not place limits on the display of printable binaries?
15:02 <Nicd-> you can run it in an exs script and it's fine
15:02 <Nicd-> 66.9 MB memory usage
15:02 <ethelward> Nice catch :)
15:02 gvaughn joined
15:02 <josevalim> benwilson512: strings? afaik no
15:02 <benwilson512> josevalim: ah
15:03 <ethelward> I *may* have an IO.inspect somewehre near the upload...
15:03 <josevalim> benwilson512: because the formatting is relatively cheap, unless we are doing something wrong
15:03 <benwilson512> josevalim: well, if it's a 50mb ascii string
15:03 <benwilson512> things go horribly horribly wrong hahaha
15:03 chriswarren joined
15:03 <ethelward> No, I don't but phoenix show the debug log in iex
15:03 <ethelward> *shows
15:03 <ethelward> Which may be the problem...
15:03 gvaughn joined
15:03 <benwilson512> ethelward: yeah, if it's a file upload I don't think it shows the file contents
15:03 <benwilson512> but
15:03 <micmus> it might be the query logging
15:04 <josevalim> benwilson512: :binary.copy("a", 50 * 1024 * 1024)
15:04 <benwilson512> oooh yeah
15:04 <josevalim> takes a long time in my terminal
15:04 <ethelward> micmus: yep
15:04 <josevalim> i will look into it
15:04 gvaughn joined
15:04 <benwilson512> josevalim: right, but :binary.copy("a", 50 * 1024 * 1024); nil is nice and fast
15:04 <benwilson512> so it's definitely inspect related
15:04 <josevalim> benwilson512: yup. inspect(:binary.copy("a", 50 * 1024 * 1024)); nil
15:05 <benwilson512> ah yea
15:05 <josevalim> benwilson512: maybe we need to have a large limit for printable
15:05 <josevalim> large limit for binaries
15:05 <benwilson512> seems reasonable
15:05 <benwilson512> 1k?
15:05 <benwilson512> you can always limit: false
15:05 <benwilson512> or IO.puts it
15:05 <benwilson512> or limit: :infinity rather
15:06 <josevalim> benwilson512: are you willing to PR?
15:06 <benwilson512> josevalim: ya sure
15:06 <josevalim> if so I will leave it on your capable hands
15:06 <micmus> Maybe we should use limit * 100 for binaries
15:06 <benwilson512> ethelward: we're on it ;)
15:06 <ethelward> benwilson512: josevalim micmus thank a lot, guys :)
15:06 <josevalim> benwilson512: we can add printable_limit and make it 1k, yeah
15:06 <micmus> or limit * 1024 and say that the limit is in KB for binaries
15:06 <josevalim> it will apply to both strings and char lists
15:06 <ethelward> And thank for the language, too!
15:07 <ethelward> +s
15:08 <josevalim> benwilson512: for tracking purposes: https://github.com/elixir-lang/elixir/issues/5817
15:08 jerel joined
15:10 laurocaetano joined
15:16 <alisdair> i'm running into some roadblocks with ecto. what's the best place to ask about whether what i am trying to accomplish is even feasible?
15:17 <josevalim> alisdair: here? :)
15:17 <josevalim> benwilson512: there is a problem with String.printable?
15:17 <micmus> if short here, for longer things forum or ecto ml
15:17 <josevalim> benwilson512: we cannot count bytes because splitting on bytes may make it non-printable
15:17 <nox> josevalim: What are we discussing about?
15:17 <alisdair> alright. so i'm trying to expose a preexisting db via plug/ecto
15:17 <benwilson512> josevalim: right I was just about to remark that
15:17 <alisdair> but there's 700 tables
15:18 <alisdair> so i don't want to write schemas/changesets for all of them
15:18 <nox> josevalim: It's constant time to find the closest code point boundary though.
15:18 <benwilson512> printable_limit is a limit of what, bytes? codepoints?
15:18 <josevalim> alisdair: schemaless queries?
15:18 <alisdair> right, i know about those. i am trying to use them
15:18 <josevalim> nox: how?
15:18 bvcosta joined
15:18 <alisdair> but i am running into problems with `where` now
15:18 <josevalim> alisdair: where in where? :P
15:18 <benwilson512> nox: the scenario is, right now if a string is printable we debug print the whole string. this turns out to be not a great idea if the string is very large, in the tens of MB or more
15:19 cherrot joined
15:19 <alisdair> how do i express something like `SELECT x, y, z FROM foo WHERE x >= $1` in ecto without a schema?
15:19 <nox> benwilson512: But why copy?
15:19 <alisdair> and where i want to build the WHERE clause from a query parameter like `?x=gte.1`
15:19 <micmus> josevalim: we can split on couple more bytes to make sure we have full code-points within the limit, or that wouldn't work?
15:19 <benwilson512> nox: no need to copy? we just need to select the first N somethings of the string
15:19 <nox> josevalim: Go backwards at most 3 bytes,
15:20 <nox> josevalim: and find a code unit that corresponds to a start of code point.
15:20 <josevalim> alisdair: from f in "foo", where: f.x >= ^val, select: {f.x, f.y, f.z}
15:20 <nox> josevalim: It's explained how in Unicode, and it's designed for it.
15:20 <alisdair> josevalim: right, but i want to populate the `f.x` part from a query param
15:20 <josevalim> alisdair: tell me more
15:20 <alisdair> and the `>=` part for that matter
15:21 <benwilson512> alisdair: field(f, ^dynamic_column) does that help?
15:21 <josevalim> nox: i know it is explained somewhere :P i am asking if you have a link or something or ref impl
15:21 <micmus> ^foo will put the value in variable foo as a param, and use that param in a query
15:21 <benwilson512> josevalim: are we trying to avoid checking if the whole string is printable?
15:21 <benwilson512> or is that part ok?
15:21 <alisdair> i want to convert a http request like `GET /foo?x=gte.1` to `SELECT * FROM foo WHERE x >= 1`
15:21 <josevalim> benwilson512: we should avoid that too
15:21 <alisdair> benwilson512: maybe, i read the docs for field but i don't see how i could use it here
15:22 <benwilson512> let's pause on the sttring discussion for a moment
15:22 <benwilson512> we do have a github issue afterall
15:22 <benwilson512> it doesn't interleave well w/ alisdair's question
15:22 <micmus> alisdair: ah, with that the only way would be to match on the "condition" and generate a different query
15:23 <micmus> I don't think we allow dynamic operators in the query syntax
15:25 <alisdair> there's a finite number of operators, so i thought maybe something like `def gte(table, column, value), do: field("table", column) >= value` would work
15:26 <alisdair> but i'm not sure how to express that in a format acceptable to `where:`
15:26 <benwilson512> almost done
15:26 <micmus> I would go for something like:
15:26 <josevalim> alisdair: you need to kind of do ast translations
15:27 <micmus> def condition(query, "gte", field, value), do: where(query, [q], field(q, ^field) >= ^value)
15:27 <micmus> and use as query |> condition("gte", :x, 5)
15:28 <alisdair> what's `[q]` in that function?
15:28 <benwilson512> basically
15:28 <benwilson512> https://www.irccloud.com/pastebin/NSoGcr9e/
15:28 <benwilson512> alisdair: same thing as when you do from
15:28 <benwilson512> it's the alias of the table
15:28 <alisdair> ok, so just the table name from query
15:28 <benwilson512> it's really just position btw
15:29 <benwilson512> it can be called `x` in one thing and `y` in another, it's just about order
15:29 <benwilson512> in my version `defp comparison` handles whether you're also doing equality or not for the gt lt
15:30 <alisdair> is comparison an ecto thing? where is it documented?
15:30 <benwilson512> oh no sorry
15:30 raycoll joined
15:30 <benwilson512> that's an exercise left to the readedr
15:30 <benwilson512> one sec
15:30 <alisdair> oh ok
15:31 <micmus> hmm... maybe we should have a comparison function
15:31 <benwilson512> https://www.irccloud.com/pastebin/JP5Z8Ii8/
15:31 <benwilson512> micmus: may be useful
15:31 <micmus> where: compare(f.x, :gt, ^x)
15:31 <benwilson512> yea
15:31 <benwilson512> or in this case
15:31 <benwilson512> compare(field(f, ^field), :gte, ^val))
15:32 <benwilson512> too many closing parens but you get the idea
15:32 greengriminal joined
15:33 racycle_ joined
15:33 <alisdair> okay, i think i have enough to get started here. thanks for the help jose, micmus and ben
15:43 <todder> i've tried several iterations of this many_to_many ecto schema, but am struggling. comments/concerns would be much appreciated.
15:43 <todder> https://gist.github.com/stvnjacobs/1837d9e2b3bbbbfbb7deffcb36ea1049
15:44 Uniaika joined
15:46 <benwilson512> todder: does a project have many owners?
15:47 <benwilson512> ah yes clealry nvm
15:47 <todder> that is the intention.
15:47 jmiven joined
15:48 <benwilson512> todder: oh so your last issue
15:48 <benwilson512> is because in your schema
15:48 <benwilson512> or actually all of them
15:48 <benwilson512> you either need to have aliased your schema names
15:48 <benwilson512> like User
15:48 <benwilson512> or you need to have YourProjectName.User
15:48 tomazb joined
15:49 <benwilson512> should be many_to_many :owners, ProjectBoard.User, join_through: ProjectBoard.ProjectOwner
15:49 <benwilson512> for example
15:49 <todder> benwilson512: i will give it a shot. thank ya.
15:49 dimitarvp joined
15:50 johanw joined
15:51 <josevalim> alisdair: sorry, i had to leave. but look into Ecto.Query.dynamic, it may help
15:52 <josevalim> benwilson512: i think we should introduce String.printable?/2 with codepoints and say that n counts codepoints
15:53 <josevalim> benwilson512: that's the simplest solution. we cannot simply split on the binary at n bytes and then try to adjust with utf-8 because we are not sure even if it is a utf-8 encoded binary
15:53 codestorm joined
15:56 <josevalim> micmus: i think we need to stop adding issues to Ecto
15:56 <josevalim> s/issues/feature requests
15:57 <micmus> we already have a backlog, so you're probably right
15:57 <josevalim> because that is going to end-up with one of us closing it in 2 months saying there is no interest / nobody tackled
15:57 <josevalim> if people want/need a feature, then we can help them contribute
15:57 <josevalim> but I don't want to build a backlog for features other people need
15:58 <josevalim> if they are not willing to contribute it themselves
15:58 dch_ joined
15:58 <marciol> fair
15:59 <the_voice_> very fair
16:00 myronmarston joined
16:00 <alisdair> so i shouldn't open my 'ecto can't handle situations where you need to load balance multiple dbs' issue?
16:01 icecreamcohen joined
16:04 <todder> benwilson512: i remember this error. it didn't like that because it tries to find user_id when there is only owner_id in the join table. is that a place to add the :join_keys option?
16:05 <todder> updated gist with the error in a comment.
16:05 <the_voice_> We have an elixir meetup planned in Israel in a bit over a month from now. It's an introduction to Elixir meetup, we are thinking of doing a presentation "Why Elixir?" and then another one in which we show how other companies are using it.
16:05 simonoram joined
16:05 <the_voice_> Any suggestions?
16:05 franco joined
16:06 <the_voice_> We are working on the assumption that 90% of the audience will know almost nothing about Elixir other than it's syntax is "similar" to ruby
16:11 <icecreamcohen> the_voice_: what do you have so far?
16:11 <icecreamcohen> I’ve given a talk along the same lines
16:11 <the_voice_> We haven't written the presentations yet, we have a month.
16:11 <micmus> alisdair: the solutions I've seen for this were having multiple repo modules and balancing between then
16:11 <micmus> s/then/them
16:12 <the_voice_> I'll probably write it next week. I want to keep it pretty simple, mostly present the benefits of using elixir without bashing other languages, why we are betting on elixir etc..
16:12 <icecreamcohen> I focused on Perfomance, Developer Happiness, Reliability, (almost) free concurrency
16:12 <icecreamcohen> I also compared and contrasted Java, Go, and Elixir’s approaches to concurrency
16:12 imack joined
16:13 <the_voice_> Right, that is beyond me as I have no idea how Java and Go handle concurrency :)
16:13 <icecreamcohen> Java is threads, Go is CSP (goroutines)
16:13 <icecreamcohen> Threads is actaully a solution for parallelism, so they had to bolt on concurrency in 1.6, I think.
16:13 <icecreamcohen> sorry, Java 6
16:14 <micmus> José introductory talk is very good.
16:14 <the_voice_> I'll take a look at that too
16:14 <the_voice_> I watched it previously, a while back
16:14 <micmus> (surprise, surprise)
16:15 <alisdair> micmus: i need to dynamically add/remove dbs tho. i think repos have to be statically defined, right?
16:15 <micmus> yeah :(
16:15 <icecreamcohen> so, Jose gave a talk here, and it was quite good
16:15 <icecreamcohen> but, people didn’t believe him
16:15 <icecreamcohen> (but he was actually right)
16:16 <icecreamcohen> it sounded too good to be true.
16:16 <micmus> alisdair: the area of dynamically handling dbs was alwas problematic with ecto. I have some ideas, but they require major refactorings
16:18 rorymckinley joined
16:20 <rorymckinley> I need to do HMAC comparison in (my first) Phoenix app - and I need to do constant time string comparison. I have come across the SecureCompare module, but was wondering if anybody knows of functionality that may already be available in elixir?
16:21 <bitwalker> OliverMT: I would say you should be good until we get Windows support added to Distillery, there is still breathing room :)
16:22 karmajunkie joined
16:22 refriedchicken joined
16:22 cdg joined
16:24 wong2 joined
16:25 <icecreamcohen> rorymckinley: I don’t know of anything, but that seems like it’s easy enough to implement.
16:26 <icecreamcohen> I’ll try and send you a gist
16:26 <rorymckinley> icecreamcohen: When it comes to security I always prefer something that has community exposure rather than rolling my own, if I can. many eyeballs and all that :). Let em try SecureCompare and see if I come right :) - no need to go to any trouble just yet!
16:27 <icecreamcohen> yeah, but you’re asking for constant time compare
16:27 <icecreamcohen> that’s just “don’t short circuit”
16:28 <rorymckinley> I am overly paranoid :)
16:28 skunkwerks joined
16:29 <icecreamcohen> well, i’m going to try and then look at secure compare’s implementation.
16:30 srxa_ joined
16:31 <icecreamcohen> ok, that’s not the way I’d do it.
16:32 <m1dnight_> Hey guys. I'm having some strange behaviour with distributed applications.
16:32 <icecreamcohen> rorymckinley: his implementation is severely slow.
16:32 <m1dnight_> https://github.com/m1dnight/eightball, this one in particular.
16:33 <m1dnight_> What I do is, I have node A which is the main one, and B and C as optional. When I crash A, B takes over. When I crash B, C takes over. When I then start A back, it errors out with the message that the PID already exists.
16:33 <m1dnight_> So Im under the impression that C won't shut down fast enough. However, I do see that the stop function is called.
16:33 <m1dnight_> But it seems that the global pid register is not being synced fast enough.
16:33 <m1dnight_> I already tried by increasing the heartbeat time from 0 to 5000, but that still does not help.
16:34 <m1dnight_> specific error:
16:34 <m1dnight_> --app : Could not start application eightball: EightBall.start({:takeover, :c@anorak}, []) returned an error: already started: #PID<5187.112.0>
16:35 <m1dnight_> So the start function is called with :takeover, which is what you would expect, and stopped is being called on the C node, but still.
16:36 tuacker joined
16:38 <josevalim> > But it seems that the global pid register is not being synced fast enough.
16:39 <josevalim> m1dnight_: is there anything you can invoke during takeover to force the flushing of the global?
16:39 <m1dnight_> That could be an idea. I just thought I made a fundamental mistake. If you catch my drift. I'll see if I can make it do something like that. I'll report back!
16:39 <m1dnight_> There's also the sys.config I can try
16:41 <icecreamcohen> rorymckinley: his EQ isn’t constant time; he short circuits if the string lengths don’t match.
16:45 <micmus> icecreamcohen: AFAIK short circuiting on different lengths is pretty common in secure comparison functions.
16:46 <icecreamcohen> interesting; I think the python one doesn't.
16:46 <icecreamcohen> does one care about speed in this case?
16:47 <m1dnight_> hrm, I think I must have something pooped. I followed this simple examply Chris McCord (https://dockyard.com/blog/2016/01/28/running-elixir-and-phoenix-projects-on-a-cluster-of-nodes) and in that case too, it errors out on "pid already running"
16:48 marciol joined
16:48 adam- joined
16:48 refriedchicken66 joined
16:48 <micmus> for hashes that doesn't matter much anyway, since they are all the same size
16:48 <icecreamcohen> true
16:49 <icecreamcohen> I was slightly appalled at the implementation though
16:49 <micmus> m1dnight_: that's probably the issue that termination is asynchronous
16:49 <icecreamcohen> convert to list, zip lists, compare tuples
16:49 <m1dnight_> No, not the issue is at startup. It's like the nodes don't ping eachother; i.e., they assyme they have to start the application
16:49 <micmus> yeah that sounds wired
16:50 <micmus> m1dnight_: do you know if the takeover command is sent after the other node terminates or after it starts terminating?
16:51 <m1dnight_> Well, now I start the first application, which triggers a normal start. When I fire up the second application it also fires up with a normal start and then errors out (while the other application keeps running)
16:51 <m1dnight_> http://imgur.com/a/JsbJs (text was too hard in this case)
16:52 <micmus> what's your config?
16:52 <m1dnight_> oh deer.. gimme a sec.
16:53 <m1dnight_> oh no, still broken good, sec
16:53 <m1dnight_> https://hastebin.com/tojajenidu.scala This is the config
16:53 <m1dnight_> I took that one from the link I posted earlier, the article by chris mccord
16:53 <micmus> You need to configure the distributed application too
16:53 <micmus> http://erlang.org/doc/design_principles/distributed_applications.html#id83485
16:54 wsieroci joined
16:55 racycle_ joined
16:56 <tristan__> why are you using distributed applications
16:56 marciol joined
16:56 <micmus> m1dnight_: the app from the article is not a distributed application in the OTP sense. It's an application running on multiple nodes
16:56 <m1dnight_> tristan__: because I want to learn how that works :p
16:57 <m1dnight_> Oh okay. Then I got it right the first time with 3 seperate configs per node.
16:57 <m1dnight_> back to the original error :p I'll try clearing the global table
16:58 <tristan__> ah, doing MononcQc 's 8ball example
16:59 <m1dnight_> Dnno who that is, honestly. I just recoded the eightball from learn you an erlang.
17:00 <micmus> he's is the author of LYSE
17:00 <m1dnight_> Oh yes then! :p
17:01 Guedes joined
17:01 Guedes joined
17:02 amclain joined
17:02 slackbotgz joined
17:05 markholmes joined
17:06 marciol joined
17:07 <denym_> Hey there, I am fairly new to elixir and tried to write some code and learned about lexical scope just now. When you look at my gist you girls/guys surely know whats wrong. But how can I solve that the variable code is a complete string of all the files that are in the array `files`? https://gist.github.com/dennym/fc9d73b1549c16713b714708f21c6e0b
17:09 davidw joined
17:10 <dimitarvp> denym_: I can't see where `code` is defined. Furthermore, what error are you getting? Or it's not an error, just not your expected output?
17:14 <denym_> dimitarvp: sorry about that, was a missing a line while c&p. Updated my gist.