<     May 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 24 25 26 27  
28 29 30 31
00:02 Cohedrin joined
00:09 wpcarro joined
00:11 hakunin joined
00:11 hakunin joined
00:12 icanhazbroccoli joined
00:12 Cohedri__ joined
00:19 wpcarro joined
00:23 rschmukler joined
00:39 elgenie_ joined
00:42 wpcarro joined
00:48 hakunin joined
00:53 rschmukler joined
00:54 cschneid_ joined
00:55 rschmukler joined
00:57 icecreamcohen_ joined
01:03 wpcarro joined
01:09 steffkes joined
01:11 pbj joined
01:12 pbj_ joined
01:13 rschmukler joined
01:17 jerel joined
01:21 danneu left
01:29 Ioyrie joined
01:33 griffinbyatt joined
01:34 rschmukler joined
01:34 pbj joined
01:39 tomterl joined
01:42 whharris joined
01:50 petejkim joined
01:53 Sid05 joined
01:53 cschneid_ joined
01:54 <Sid05> hello
01:59 icanhazbroccoli joined
02:01 <* wsmoak> waves at Sid05
02:03 <Sid05> I solved Project Euler #8 in Elixir ( https://github.com/sngeth/project_euler/blob/master/8.exs ), but i'm trying to get advice if there is a more terse way to get the product of a sequence of integers... maybe list comprehensions?
02:04 <Sid05> Sorry if this is belongs more on Stack Overflow, but maybe someone is bored ;-)
02:07 praveen joined
02:08 <asonge> Sid05: so, if isn't exactly idiomatic elixir
02:08 <asonge> i'd use a guard to detect if the length is 4
02:09 <Sid05> Yes, i agree ironically in my previous commit, i had refactored it to to the if lol
02:10 <Sid05> also just noticed that 4, shouldn't be hardcoded
02:10 <asonge> Sid05: and does size need to be dynamic, so is it if length(nums) == size?
02:10 <asonge> right
02:11 <Sid05> so the problem gives an example where size of 4 adjacent digits, thhe answer is 5382, and with product of 13 adjacent digits it should be 23514624000
02:11 <Sid05> so really it can be a hardcoded 13
02:11 <Sid05> or take in a size argument, correct
02:12 <asonge> btw, are you trying for a speed improvement or?
02:12 akeating joined
02:12 <asonge> or maybe just something very, erm, expressive and cool?
02:13 <Sid05> speed isn't much of a concern, just trying to apply different constructs if more appropriate
02:13 <asonge> (there's also a function max, so max=max(product,max) is a thing)
02:14 <Sid05> so yeah expressive, cool. or terse/yet understandable. i guess im trying to get rid of the recursion...
02:15 <Sid05> but recursion might be the most idiomatic way for this proble, figure i'd get some input though
02:15 <asonge> Sid05: you can also, instead of using recursion, use Enum.scan/3, and scan from 1 to length(foo)-4, and then use an accumulator of {list, max}, reducing the head off the list and always returning the max.
02:16 <asonge> also, to convert the string of digits into a list of numbers, you can turn it into a character list and subtract ?0 from each digit.
02:17 markw_ joined
02:18 <asonge> i wonder if i can 1-line this.
02:19 <Sid05> hmm very cool tips, definitely good food for thought i overlooked
02:24 pbj joined
02:28 <asonge> Sid05: oh, check out chunk/3 :)
02:28 <asonge> Enum.chunk/3*
02:28 <asonge> got a 1-liner now. kinda.
02:28 <Sid05> I think I tried chunk but got messed up in how to reduce an enum of an enum
02:29 <asonge> you can't embed anything with an & inside of a & capture
02:29 <asonge> so you have to use an anonymous function
02:29 <asonge> but other than that...
02:29 <asonge> you just nest
02:30 <asonge> Sid05: let me know if you want to see the 1-liner
02:31 <asonge> though this is one of the slower methods.
02:31 wong2 joined
02:33 <Sid05> sure, go for it
02:34 griffinbyatt joined
02:34 <asonge> (fn nums, size -> Enum.chunk(nums, size, 1) |> Enum.map(fn digits -> Enum.reduce(digits, &*/2) end) |> Enum.max() end).('0123456789' |> Enum.map(&(&1-?0)), 4)
02:36 <asonge> oh, i can shrink this as well.
02:36 gregn joined
02:38 <asonge> i really want to get rid of that intermediate reduce tho.
02:40 <Sid05> That was more of what I had in mind when i tried to solve it, very cool thanks
02:42 <asonge> np, if you want hints dropped for other solutions and you get stuck, ask away. i love playing with elixir. i tend to learn a lot with this stuff.
02:44 wpcarro joined
02:45 sfbw joined
02:46 mika__ joined
02:49 milad joined
02:49 milad joined
02:52 icanhazbroccoli joined
02:53 <Sid05> Btw, I don't see chunk/3 in the APi docs only a chunk/2 and chunk/4
02:53 nomicflux joined
02:54 <Sid05> oh the leftover is an optional arg
03:05 ssswitch joined
03:09 steffkes joined
03:09 steffkes joined
03:15 <cmk_zzz> in phoenix can I have optional routes? Ie. get "/some/path/:optional_year/:optional_month/:optional_day"?
03:16 <asonge> cmk_zzz: you could just route to the same action multiple ways.
03:18 <cmk_zzz> asonge: yes, smart. I'm porting a python app to elixir and trying to keep as close to the original as possible.
03:19 <asonge> cmk_zzz: the thing that immediately strikes me with something like an optional route would be behavior of stacking them together :)
03:19 <asonge> you can do a wildcard match to allow a lot of the rest of the path to match, but you won't get binding
03:21 <cmk_zzz> asonge: here it is simpler as basically the entire "date" specification is optional. so it could have been /some/path/:date ie. instead of /some/path/2017/01/01 it would be /some/path/2017-01-01
03:21 <cmk_zzz> I wrote that app in 2007, time to move on:)
03:21 <asonge> did it support partial matching, or did all the optionals have to match?
03:22 <asonge> if this was django, you had regex that is well specified (but also huge/slow)
03:23 <cmk_zzz> it had partial matching. this was with python pylons. So you specified routing as /some/path/:year:int/:month:int/:day:int and it would call your controller as control(year, month, int). you could also specify defaults for each optional
03:24 <cmk_zzz> I ported it to python pyramid but never went to production with it. Trying again with elixir
03:25 griffinbyatt joined
03:27 InternetFriend joined
03:30 gregn joined
03:32 pbj joined
03:36 wpcarro joined
03:45 icanhazbroccoli joined
03:48 bambanx joined
03:52 sp4rrow joined
03:56 rschmukler joined
03:56 sp4rrow joined
04:02 kansi joined
04:02 WhiskyRyan joined
04:03 rodolfojcj joined
04:06 griffinbyatt joined
04:07 sfbw_ joined
04:08 justelex_ joined
04:09 rkazak joined
04:13 <wwwd> I have both Phoenix 1.2 and 1.3 installed. I installed Phoenix 1.3 with "mix archive.install https://github.com/phoenixframework/archives/raw/master/phx_new.ez" I created a project with "phx.new project" successfully. Now if I run "phx.new some_project" and answer yes to depencies the sytem hangs at "* running cd assets && npm install && node node_modules/brunch/bin/brunch build". Does anyone happen to know what I might have broken?
04:13 <wwwd> ...And how I might fix it?
04:19 mika__ joined
04:20 <asonge> wwwd: it might be npm going slow or something? do you have an npm running?
04:20 <asonge> or is the beam just kinda hanging?
04:27 <wwwd> asonge: I have npm 4.2.0 installed but to my knowledge I don't have anything using it at the moment.
04:28 <asonge> wwwd: you know what step of that it might be on? see if node is running at all?
04:29 <wwwd> Sorry, your suggesting that I check if node is running while the "phx.new" is hung?
04:29 <asonge> yes
04:30 <asonge> if it is running those things, knowing where to look depends on what is running
04:30 <asonge> you can abort at this point and run those commands yourself, btw
04:34 <wwwd> I ran top and don't see anything that looks like node. Is that "top" an effective way to see if it is running or is there a better command?
04:35 notdaniel joined
04:38 icanhazbroccoli joined
04:41 <wwwd> asonge: Also, doesn't this suggest that something is broken and should be fixed?
04:42 <asonge> ps aux | grep node
04:42 <asonge> it might, or it might not
04:42 <asonge> if you can reproduce it, that would be helpful. that means just ctrl+c and then run the commands yourself and see.
04:48 <wwwd> asonge: here is the results of the above commands: "20679 0.0 0.0 4508 712 ? Ss 23:42 0:00 sh -c cd assets && npm install && node node_modules/brunch/bin/brunch build
04:48 <wwwd> " and "20783 0.0 0.0 14224 992 pts/18 S+ 23:43 0:00 grep --color=auto node". And to be clear I should cd into the assets folder and run "npm install" and "node node_modules/... build" individualy?
04:48 <wwwd> Is that correct?
04:58 hakunin joined
05:06 <wwwd> asonge: So it "node build" returned "23:58:58 - info: compiled 6 files into 2 files, copied 3 in 712 ms". When I ran "mix phx.server" I reported "Could not find "rebar", which is needed to build dependency :fs
05:06 <wwwd> I can install a local copy which is just used by Mix
05:06 <wwwd> Shall I install rebar?" When I accepted the local rebar installation I got "* creating /home/john/.asdf/installs/elixir/1.4.2/.mix/rebar" and "* creating /home/john/.asdf/installs/elixir/1.4.2/.mix/rebar3" Is it possible that "asdf" is causing a conflict somewhere?
05:07 dec0n joined
05:10 steffkes joined
05:10 steffkes joined
05:13 rschmukler joined
05:19 WhiskyRyan joined
05:24 gvaughn joined
05:24 milad joined
05:30 robinsjdotcom joined
05:31 rschmukler joined
05:31 icanhazbroccoli joined
05:33 <asonge> i doubt it? it looks like something just locked up in the vm somewhere, possibly some bug
05:33 <asonge> you are running on bleeding edge though :/
05:36 sfbw joined
05:37 imack joined
05:43 dec0n joined
05:45 WhiskyRyan joined
05:49 wpcarro joined
05:49 elgenie joined
05:50 om joined
05:51 <wwwd> True but if I run "mix phoenix.new wtf" I get '* error command failed to execute, please run the following command again after installation: "npm install && node node_modules/brunch/bin/brunch build"'. So it seems like it is not limited to Phoenix 1.3.
05:52 akeating joined
05:58 rschmukler joined
05:58 craigp joined
05:58 <wwwd> Oh well, there is always tomorrow!
06:02 r00tl3ss joined
06:04 rkazak joined
06:06 wpcarro joined
06:06 sp4rrow_ joined
06:12 pbj joined
06:16 icanhazbroccoli joined
06:21 micmus joined
06:24 robinsjdotcom joined
06:27 peterpp joined
06:32 rschmukler joined
06:37 sfbw joined
06:41 squalloser joined
06:43 embik joined
06:45 WhiskyRyan joined
06:49 jkreeftmeijer joined
06:50 jkreeftmeijer joined
06:53 jkreeftm_ joined
06:53 hbraun joined
06:53 tuacker joined
06:54 jkreeftmeijer joined
06:55 icanhazbroccoli joined
06:56 craigp joined
06:58 r00tl3ss joined
07:01 Guest67 joined
07:03 l14n joined
07:04 steffkes joined
07:06 raek left
07:09 robinsjdotcom joined
07:09 hakunin joined
07:12 robinsjdotcom joined
07:13 gvaughn joined
07:13 r00tl3ss joined
07:16 robinsjd_ joined
07:20 akeating joined
07:20 mika__ joined
07:20 pbj joined
07:24 mattyw joined
07:26 ZippoWeb joined
07:27 yourname joined
07:30 InternetFriend joined
07:30 ZippoWeb joined
07:32 mark_66 joined
07:35 robinsjdotcom joined
07:36 icanhazbroccoli joined
07:38 sfbw joined
07:40 jkreeftmeijer joined
07:42 robinsjdotcom joined
07:50 asabil joined
07:54 inoas joined
07:56 apotry joined
08:01 cemilowski joined
08:10 <steffkes> guys, i'm pretty sure i've seen a better/shorter version of the following somewhere .. but i'm not able to find it anymore, is anyone able to help?
08:10 <steffkes> https://pastebin.com/f86M8bzG
08:10 <steffkes> that basically works .. but i feels kinda clunky
08:11 <steffkes> the initial structure is a list of maps (loaded from a json file) which i want to convert into an Employee struct. and get a map (from the list) so that it's easier to access it by its identifier
08:11 PaReeOhNos joined
08:13 ZippoWeb joined
08:13 rschmukler joined
08:16 hbraun joined
08:20 pbj joined
08:23 colrack joined
08:24 clemlais joined
08:24 <steffkes> I've read about the capture and stuff, now i'm just not entirely clear about how to apply them in my case (if so at all)
08:35 chrismccord joined
08:37 eddd joined
08:38 jkreeftmeijer joined
08:39 sfbw joined
08:39 marr joined
08:43 akeating joined
08:46 eddd joined
08:53 milad joined
09:01 gvaughn joined
09:02 jadlr joined
09:04 Guest67_ joined
09:05 <jadlr> Hey all, in elixir `Enum.reduce/3` is implemented by delegating to `:lists.foldl` is there a reason for not having something that delegates to `:lists.foldr`? Maybe `reduce_right`
09:07 <Nicd-> reverse + reduce?
09:08 dignifiedquire joined
09:08 rschmukler joined
09:09 <jadlr> I would like something that perfoms like foldr.
09:09 <Nicd-> is there a difference?
09:10 jkreeftm_ joined
09:12 hakunin joined
09:12 <jadlr> I don't now about the erlang implementation, but I would guess so
09:13 <Nicd-> what kind of difference? I mean vs reverse + reduce
09:13 <jadlr> Also I like being able to prepend to a result list in an order preserving reduce instead of doing `result ++ [item]`
09:14 rory joined
09:15 milad joined
09:16 milad joined
09:17 <jadlr> Nicd-, I don't know. I'm just interested in the reason why there is nothing like `foldr`
09:18 <Nicd-> probably people just reverse before reducing
09:18 <Nicd-> there's at least this in the Erlang docs: "foldl/3 is tail recursive and is usually preferred to foldr/3."
09:19 <jadlr> I found this on the topic: ecursive and is us
09:19 <jadlr> woops, sorry
09:19 <jadlr> http://erlang.org/pipermail/erlang-questions/2012-May/066634.html
09:21 <Nicd-> so probably it's not implemented because it would be easy to write badly performing code
09:22 <Nicd-> maybe :P
09:24 <jadlr> I think that is not true. If you reduce a list into a list and want it order-preserving you have to append to the list (++ copies its left operand). If you use foldr you can prepend to the result list.
09:25 <Nicd-> why can you not reverse and then reduce?
09:25 <jadlr> You can...but it takes time for long lists.
09:25 <jadlr> It's not for free
09:26 <Nicd-> but the foldr implementation would have to reverse the list anyway
09:26 hbraun joined
09:27 qqwy joined
09:27 <jadlr> As Ulf Wiger wrote in that link I posted, that does not seem to be the case
09:27 <qqwy> Good morning!
09:27 rory left
09:29 <Nicd-> good morning qqwy
09:30 <Nicd-> how is the weather in the netherlands today?
09:30 <qqwy> It's quite good, for the time of the year :-)
09:30 <qqwy> How is it over there?
09:33 <Nicd-> pretty good! sun is shining and it's getting warmer. I took a picture for you: https://photos.jottacloud.com/share/31tdo725/vPtWnGMupw_1sfHs9IYPmoNOD1uPaRc4AYMHmGMb-Z0rSAV3C0tKUcktdMYu-nwA.VyUr6nYJ_v2B5_W4DEEqZA
09:33 <Nicd-> jadlr: eh, I'll have to defer to people that know more
09:34 jkreeftmeijer joined
09:35 <jadlr> Nicd-, no worries. Thanks for the discussion
09:37 lexmag joined
09:38 milad joined
09:38 pbj joined
09:40 cschneid_ joined
09:41 sfbw joined
09:44 craigp joined
09:50 milad joined
09:56 gvaughn joined
10:01 milad joined
10:03 jkreeftmeijer joined
10:03 milad joined
10:13 gmcabrita joined
10:28 PaReeOhNos joined
10:30 wpcarro joined
10:31 ctp joined
10:31 gregn joined
10:42 sfbw joined
10:50 nickjj_ joined
10:53 mika__ joined
10:56 milad joined
10:56 milad joined
10:57 pbj joined
11:00 bitmod joined
11:01 DarkArcher207 joined
11:14 hakunin joined
11:22 milad joined
11:23 bin7me joined
11:23 ZippoWeb joined
11:24 ctp joined
11:25 cevado joined
11:26 nighty-- joined
11:27 icanhazbroccoli joined
11:27 <bitmod> where is everyone?
11:27 <Nicd-> what do you mean where?
11:27 <bitmod> Nicd-: channel seems less active than usual
11:28 <Nicd-> this isn't a very active hour usually
11:28 <Nicd-> most active is from 18 to 01 UTC+2
11:29 chrismccord joined
11:29 <andman> + elixirconf europe
11:32 InternetFriend joined
11:33 elgenie joined
11:35 icanhazbroccoli1 joined
11:38 asabil joined
11:40 milad joined
11:40 cschneid_ joined
11:44 jkreeftmeijer joined
11:47 dimitarvp joined
11:59 mdsadiq joined
12:00 <mdsadiq> Hi
12:00 nomicflux joined
12:00 qqwy joined
12:01 mdsadiq left
12:04 jkreeftmeijer joined
12:06 pbj joined
12:08 pbj joined
12:09 ZippoWeb joined
12:12 r00tl3ss joined
12:13 milad joined
12:16 akeating joined
12:18 icanhazbroccoli joined
12:19 pbj joined
12:19 akeating joined
12:23 milad joined
12:24 m1dnight1 joined
12:27 <bitmod> Ankhers: you there?
12:27 chrismccord joined
12:42 jeznet3 joined
12:42 josevalim joined
12:42 wpcarro joined
12:42 flaviodesousa joined
12:43 sfbw joined
12:45 PaReeOhNos joined
12:45 hylh joined
12:47 r00tl3ss joined
12:50 <bitmod> Nicd-: which authentication package would you recommend?
12:50 sfbw joined
12:51 wpcarro joined
12:53 cevado_ joined
12:53 lexmag_ joined
12:55 <Nicd-> I don't know, I wrote my own on top of comeonin
12:56 hakunin joined
12:57 chrismcc_ joined
12:58 rschmukler joined
12:58 pbj joined
12:59 pbj_ joined
13:04 ramortegui joined
13:08 milad joined
13:09 rschmukler joined
13:10 m1dnight1 joined
13:11 mark_66 joined
13:14 gmcabrita joined
13:14 guan joined
13:14 vikram__________ joined
13:14 teadrop_ joined
13:14 CStorm joined
13:14 joshdholtz joined
13:14 zpconn__________ joined
13:14 aaronjensen joined
13:14 gregn joined
13:20 milad joined
13:23 LBRapid joined
13:26 CStorm joined
13:26 gmcabrita joined
13:27 joshdholtz joined
13:27 zpconn__________ joined
13:27 guan joined
13:27 hakunin joined
13:27 aaronjensen joined
13:27 teadrop_ joined
13:27 vikram__________ joined
13:28 drewolson joined
13:28 ssswitch joined
13:29 <iFire> Nicd-: would it be a good idea to port this to elixir https://github.com/joyent/node-aperture
13:29 wpcarro joined
13:35 milad joined
13:35 milad joined
13:37 r00tl3ss joined
13:39 jeznet3 joined
13:40 rschmukler joined
13:42 milad joined
13:45 chrismccord joined
13:48 gvaughn joined
13:49 fernandomm joined
13:53 iamvery joined
13:58 tuacker1 joined
14:01 sfbw joined
14:04 wpcarro joined
14:05 InternetFriend joined
14:13 ZippoWeb joined
14:13 wpcarro joined
14:15 maxbeizer joined
14:18 maxbeizer_ joined
14:19 wpcarro joined
14:23 cschneid_ joined
14:23 TheNet joined
14:23 PaReeOhNos joined
14:27 chrismccord joined
14:27 j0ni joined
14:29 jimt joined
14:29 LastWhisper____ joined
14:33 <Ankhers> bitmod: what's up?
14:33 rkazak joined
14:35 asabil joined
14:37 Vooch joined
14:37 ctp joined
14:39 <* kansi> says hi
14:40 <kansi> i am trying to generate a new phoenix app and I have version 1.3.0-rc.1 installed but I see the old dir structure
14:41 j0ni joined
14:41 <kansi> what am I missing
14:41 <Ankhers> It is now phx.new, not phoenix.new
14:42 <bitmod> Ankhers: hey just wondering what you're using momentjs for and if you recommend it?
14:44 milad joined
14:48 rschmukler joined
14:50 <Ankhers> bitmod: The app I am building deals a lot with time, specifically timezones. This is the first time I have used it. But previous colleagues of mine have used and suggested it. Also googling for javascript timezone, moment.js is one of the first things that pop up.
14:50 <Ankhers> I mean, I would use it again. But I'm not a big JS person.
14:51 <kansi> Ankhers: thx that worked. but my mix does show phx in its autocomplete
14:51 milad joined
14:55 <bitmod> Ankhers: ah ok, thanks. I'm also thinking about using it for an app. Just curious, have you deployed your app yet?
14:58 <Ankhers> bitmod: It is currently in beta. I have it running on EC2 Container Service. But I think we are planning on moving to Google Container Engine before production launch.
14:59 <bitmod> Ankhers: nice, that's what i'd planned on doing, putting it on kubernetes eventually once it's ready. i'd be interested in knowing how the deployment on GCE goes, you plan on doing a write up?
15:00 d10n-work joined
15:01 <Ankhers> I wasn't. But if you or anyone else are interested, maybe I can come up with something.
15:04 <Ankhers> I hae to first figure out a good way to cluster on GCE.
15:05 <bitmod> Ankhers: i'd definitely be interested, haven't seen many posts about deploying elixir/phoenix to GCE out there
15:05 <acetoxy> google container engine?
15:05 <bitmod> yeah
15:06 <acetoxy> we do. we package our apps with distillery and put them in an image based on alpine
15:07 TheNet joined
15:07 jopecko joined
15:09 <bitmod> acetoxy: oh sweet, have you written any posts on the process? also why choose alpine linux over e.g. ubuntu / coreos?
15:10 <acetoxy> bitmod: the images are based on alpine just to make them small, debian would be simpler
15:10 <acetoxy> and we just created the cluster in the UI
15:11 <acetoxy> and then wrote some kubernetes config until it worked
15:11 <acetoxy> we haven't written anything about it
15:11 <Ankhers> acetoxy: Do you do any Elixir clustering?
15:11 <acetoxy> been thinking about starting a blog
15:12 maxbeizer joined
15:13 ZippoWeb joined
15:13 <bitmod> acetoxy: it'd be great to see what you're doing, and there aren't too many out there on the topic
15:13 <acetoxy> Ankhers: yes, not sure if we're using https://github.com/mrluc/peerage or our own thing for service discovery
15:14 <bitmod> here's your first reader
15:14 <acetoxy> bitmod: yeah, that would have been useful for us too ;)
15:15 <Ankhers> acetoxy: I hadn't seen this yet. Thanks!
15:15 <bitmod> acetoxy: i bet it would have xP
15:16 <bitmod> doesn't GCE handle service discovery by the way?
15:16 <acetoxy> Ankhers: there's also https://github.com/bitwalker/swarm
15:16 <bitmod> https://cloud.google.com/compute/docs/metadata?hl=en
15:19 Vooch joined
15:19 <Ankhers> acetoxy: Why did you use peerage over swarm?
15:21 <acetoxy> not sure which one we're using
15:22 <acetoxy> I haven't been involved in that project for almost two months now :)
15:22 <Zarathu> chrismccord: i'm too excited for 1.3 ;/
15:23 <adamkittelson> I vaguely recall some talk last year about improvements to :global coming in erlang 20, I'm not seeing anything about that in the readme for the RC today though, did that get bumped to erlang 21 or am I just missing it?
15:25 milad joined
15:28 akeating joined
15:31 icecreamcohen joined
15:31 Vooch joined
15:31 cschneid_ joined
15:32 cevado joined
15:36 tuacker joined
15:37 LastWhisper____ joined
15:37 elgenie joined
15:40 r00tl3ss joined
15:41 pbj joined
15:43 <rschmukler> Is it preferable not to use GenStage as a queue for a worker pool? ie. when min and max demand should both be 1? How do I go about configuring demand such that only one event is only ever sent to a worker?
15:44 sfbw_ joined
15:44 mwbrown joined
15:45 rkazak joined
15:47 iamd3vil[m] joined
15:48 jopecko joined
15:48 meh` joined
15:51 chrismccord joined
15:55 jeznet3 joined
15:55 fantomik joined
15:57 jesses joined
15:57 amclain joined
16:01 rozap joined
16:02 justelex_ joined
16:06 <vans163> adamkittelson: yea.. such as scaling erlang to 1000 nodes vs 100~
16:06 <vans163> no mentions
16:07 notdaniel joined
16:10 <linduxed> in a phoenix app, in the lib/app_name.ex file, there's a list of `children`
16:10 ultra|lazer joined
16:10 <linduxed> this list will contain function calls to worker() or supervisor()
16:11 <linduxed> this list is then passed to, for instance, Supervisor.start_link/2
16:11 <linduxed> what i don't understand is the following:
16:11 <linduxed> what is worker() and supervisor()?
16:12 <linduxed> i can't find any documentation for them
16:12 <linduxed> they're listed as types over here https://hexdocs.pm/elixir/Supervisor.html
16:12 <linduxed> but they're not types when they're in the code in the `children` list
16:12 <linduxed> they're some sort of functions
16:12 <linduxed> i can't seem to find the documentation for them
16:13 ZippoWeb joined
16:13 meandi_2 joined
16:14 <iamd3vil[m]> linduxed: They are convenience for generating supervisor spec. Docs are here: https://hexdocs.pm/elixir/Supervisor.Spec.html
16:15 wpcarro joined
16:16 <linduxed> ah, now i see them
16:16 <linduxed> thanks, i already scanned that page previously. apparently i should have read that page closer
16:18 cevado joined
16:23 akeating joined
16:28 <Ankhers> I upgraded my app from phoenix 1.2 to 1.3-rc. Now when I run `mix phx.routes`, it complains that `MyAppWeb.Web.Router or MyAppWeb.Router` does not exist. Does anyone know why this is?
16:28 jeffweiss joined
16:28 <Ankhers> The router is located at MyApp.Web.Router.
16:30 steffkes_ joined
16:30 steffkes_ joined
16:31 wpcarro joined
16:31 <Ankhers> And as far as I can tell, I have the same structure as a newly generated `phx.new --umbrella` app.
16:32 WhiskyRyan joined
16:33 w1gz joined
16:34 <hexkey[m]> I have a qustion: is there any 'good' way to implement a quicksort?
16:35 <hexkey[m]> I know that I'm fighting against the language, but I want to try anyway
16:35 <drewolson> hexkey[m] do you just want to sort something? or are you doing it as a learning exercise?
16:36 <hexkey[m]> for fun pretty much
16:36 <drewolson> hexkey[m] regardless, you can implement it quite nicely with recursion
16:36 <nox> It sorts in place,
16:36 <nox> so no.
16:37 <hexkey[m]> I'm comparing sorting algs by time for a project. I already am including a part about how Linked Lists are not my friend here, for sure.
16:37 <hexkey[m]> I want to see how much I can improve it despite that.
16:37 <drewolson> nox: in "is place" a requirement? or just a desired property of the implementation?
16:38 gem joined
16:38 <nox> drewolson: I think there are better algorithms, if you aren't going to do that in place.
16:38 elgenie joined
16:38 <drewolson> agreed :)
16:39 <hexkey[m]> I know. I already have several others I'm including. Qs is the last one I'm trying to 'improve'
16:39 WhiskyRyan joined
16:40 <hexkey[m]> I'm trying to go for extra points (for creativity)
16:41 <nox> hexkey[m]: Seems fine. :)
16:41 jkreeftmeijer joined
16:41 papachan joined
16:42 <hexkey[m]> I've already found that selecting a random pivot doesn't do much, because it requires walking thru the list in O(n) time (I think).
16:43 <hexkey[m]> multithreading it definately helped, but I'm trying to find one or more additions that feel less like 'cheating'
16:44 <drewolson> hexkey[m]: this works, i make no guarantees about its speed https://gist.github.com/drewolson/035bcc98f731108e7644562670444344
16:45 <drewolson> but it see that you're already into optimization, not asking for algorithm help
16:45 <drewolson> *i see
16:48 <hexkey[m]> yeah. optimizing quicksort w/ a linked list is turning out to be an interesting challenge.
16:48 cevado joined
16:48 refriedchicken joined
16:48 bungoman joined
16:49 <drewolson> if i recall correctly, purely functional data structures (the book) touches on quicksort
16:49 rschmukler joined
16:50 wpcarro joined
16:52 shymega joined
16:53 refriedchicken66 joined
16:54 refriedchicken33 joined
16:57 <craigp> I was playing with writing sorts a while back, here's one quicksort implementation https://gist.github.com/craigp/e7902635ffbb3ad58a99986e70f871af
16:57 <craigp> I wrote it another way that was faster on smaller lists but way slower on bigger lists, but I never got to the bottom of why
17:03 <asonge> craigp: there's probably a few reasons. you have to think not only about the complexity of the operations you're using, but the values of the "n" in those computations. O(n) for really small values of n might be faster than an O(log n) algorithm for large values of n. when large lists get faster in one implementation, it's a sign of there being better
17:03 <asonge> "complexity", but each step of the operation possibly being more expensive.
17:04 <asonge> craigp: the fastest sorts, though, are probably going to be tail call recursive and not use much of the Enum functions
17:04 elgenie joined
17:04 milad joined
17:06 <craigp> hmm .. they were both quicksort implementions, but whereas that one used Enum.partition, the other one was just pure recursive functions.. at the time I assumed the difference was something about how erlang's `foldl` was implemented (which Enum.partition uses internally)
17:06 <asonge> craigp: yeah, but Enum.partition is going to be O(n) worst case...
17:07 <craigp> my knowledge of these things is fairly shallow I'm embarrassed to admit :)
17:08 <craigp> I mean, I understand what you're saying about the complexity for small vs large values etc
17:08 <asonge> i barely know what i'm talking about here as well, but you're not working with memory-adjacent arrays in C, so the algorithmic complexity might come out straightforwardly by just using the algorithm
17:10 rkazak joined
17:15 NeverDie joined
17:18 lexmag joined
17:19 ZippoWeb joined
17:21 refriedchicken joined
17:22 steffkes joined
17:22 asabil joined
17:24 rschmukler joined
17:25 mika__ joined
17:28 hashpuppy joined
17:29 <besc> So you can only start an application once - not multiple times. What I'm working of is kind of similar to a database connection, but more complex and needs more supervision and some nested supervisors. Are there any resources or projects I could look at here?
17:39 elgenie joined
17:39 r00tl3ss joined
17:40 JuanMiguel joined
17:45 notdaniel joined
17:46 __0xAX joined
17:48 jopecko joined
17:55 squalloser joined
17:57 cdg joined
17:59 cschneid_ joined
18:01 mika__ joined
18:04 wpcarro joined
18:12 PaReeOhNos joined
18:28 iamvery joined
18:30 <drewolson> is the partition/2 function totally missing from the Enum docs? https://hexdocs.pm/elixir/Enum.html#content
18:31 <hexkey[m]> I seem to remember it being depreciated
18:31 jushur joined
18:32 mika__ joined
18:33 <havenwood> drewolson: https://hexdocs.pm/elixir/Enum.html#split_with/2
18:34 <havenwood> drewolson: It was renamed to avoid confusion with the Flow.partition/2 function.
18:43 jkreeftmeijer joined
18:44 icecreamcohen joined
18:48 imack joined
18:48 DarkArcher207 joined
18:52 JEG2 joined
18:57 wpcarro joined
19:03 <drewolson> havenwood: thanks
19:07 OtherAllan joined
19:29 refriedchicken joined
19:29 wpcarro joined
19:37 markw_ joined
19:44 jkreeftmeijer joined
19:59 icanhazbroccoli joined
20:05 sfbw joined
20:16 the_voice_ joined
20:29 elgenie joined
20:36 refriedchicken joined
20:38 asabil joined
20:45 icecreamcohen joined
20:52 <linduxed> in a phoenix project, i have a worker started (one of the supervised children defined in lib/app_name.ex) that uses the database with Ecto
20:52 <linduxed> i have a controller test that works fine, up until the point where is worker is called
20:53 <linduxed> or well, casted toward
20:53 <linduxed> but yeah, you get the point
20:53 rschmukler joined
20:53 <linduxed> i get an error like this "** (DBConnection.OwnershipError) cannot find ownership process for #PID<0.405.0>"
20:53 <linduxed> i'm sure you've seen variations of this before
20:54 rkazak joined
20:54 <linduxed> if i've understood things correctly, i need to use Ecto.Adapters.SQL.Sandbox.allow/4 to allow this worker to communicate through the same connection
20:54 <linduxed> my problem is two-fold:
20:55 <linduxed> 1. i don't know how to obtain the PID of that worker
20:55 <linduxed> 2. i'm not sure that's it or if i should do something more
20:56 asabil joined
20:56 PaReeOhNos joined
21:04 laut joined
21:07 mika_ joined
21:15 PaReeOhNos joined
21:15 <linduxed> hmmm, found this for #1, seems good https://www.amberbit.com/blog/2016/5/13/process-name-registration-in-elixir/
21:15 mika_ joined
21:15 sfbw joined
21:17 nhooyr joined
21:27 pbj joined
21:28 nomicflux joined
21:28 Vooch joined
21:35 johnhamelink joined
21:36 eddd joined
21:37 DarkArcher207 joined
21:43 cschneid_ joined
21:44 sillyotter joined
21:46 jkreeftmeijer joined
21:47 Vooch joined
21:49 WhiskyRyan joined
21:50 <jesses> Hi everyone, I've been working on a Platform-as-a-Service for Elixir apps for the past 6 months and just launched the beta. Would anyone be interested in a beta invite? You can find more about it at www.gigalixir.com
21:50 refriedchicken joined
21:56 mika_ joined
21:57 wpcarro joined
22:00 strykerkkd joined
22:02 sixstone joined
22:03 codestorm7 joined
22:03 <codestorm7> benwilson512: any reason absinthe_ecto isn't on hex?
22:04 PaReeOhNos joined
22:08 pbj joined
22:09 Vooch joined
22:13 milad joined
22:15 <steffkes> uhm, if i get a empty value i could do "param = value || nil", but in case value = "" it does return the empty string. how do i get around this?
22:15 <steffkes> i mean, beside comparing value == "" .. which is kinda ugly :/
22:20 <ljarvis> steffkes: that wil return the empty string
22:20 <ljarvis> "" || nil would return ""
22:20 <ljarvis> you want "" to act like nil?
22:21 <steffkes> ljarvis: i know it does, probably i phrase the question poorly. so next try: i'd like to get the same behaviour as nil || "foo" would
22:21 <steffkes> yeah, that's basically it
22:23 <ljarvis> steffkes: i would probably just have a function like: check(""), do: nil; check(value), do: value
22:25 pbj joined
22:26 <steffkes> uhm okay .. that's not exactly it. my situation is: i do get a map which is using real_name and name as two of their keys. i basically wanna use the first (kinda) name i get. preference: real_name then name. if real_name would be nil, i could do map["real_name"] || map["name"] .. but the go with an empty string for it. where this approach does not work anymore
22:26 <steffkes> and i guess i could not even pattern-match this, can i? because if "" || nil returns "" i'd think it would match in a pattern to
22:27 <ljarvis> right, i'm saying you should pattern match against "" and treat it like nil
22:27 <asonge> steffkes: "" isn't falsy.
22:27 <steffkes> asonge: i assumed so
22:27 <asonge> using a case is a little more verbose, but it's much more readable, and case statements are still expressions
22:28 milad joined
22:28 milad joined
22:30 <steffkes> i can go with that .. just no idea how to express that as a case statement?
22:32 <asonge> %{real_name: name} when name!=="" and name!==nil -> ...
22:32 <asonge> guards <3
22:33 PaReeOhNos joined
22:34 milad joined
22:34 <steffkes> uhm :/
22:35 josevalim joined
22:35 <ljarvis> steffkes: if you're doing a lot of this and want to ignore nil/"" values and go to the next key, you could just write a function like https://gist.github.com/leejarvis/26274c36486cef3a3bf40f75b7e21bbe
22:36 <ljarvis> probably better ways to write it but really depends on what you're doing, and we don't have any scope of that
22:44 <asonge> steffkes: https://gist.github.com/asonge/5c303ac4414b0cb3c2c5121ab898b057 here's how to do it with a function pretty quickly
22:48 <steffkes> thanks ljarvis & asonge, i should have been able to come up with something similar myself
22:49 <steffkes> probably time to head for some sleep
22:49 <asonge> np, most people don't really know exactly what guard clauses can do
22:49 <steffkes> it's more the way i'm (still) thinking .. coming from other languages
22:50 <steffkes> which is almost always the reason for some ideas i do have in mind .. trying to express them (close to) 1:1 in Elixir .. which often is the wrong way
22:50 <asonge> you pick it up eventually. i just like to play around and think of the most outlandish ways to do something for fun.
22:51 dimitarvp` joined
22:56 milad joined
23:04 sfbw joined
23:04 onegrx joined
23:06 NeverDie joined
23:11 eddd joined
23:19 NightMonkey joined
23:20 griffinbyatt joined
23:21 wpcarro joined
23:25 mika_ joined
23:28 dastagg joined
23:34 icecreamcohen joined
23:35 sp4rrow joined
23:37 NeverDie joined
23:44 mika_ joined
23:44 cschneid_ joined
23:48 jkreeftmeijer joined