#elixir-lang - 06 May 2019
« Back 1 day Forward 1 day »
[05:07:37] uplime: is there a way to pattern match a list with multiple values? I phrased that badly, but basically something like [(?\t or ?\n or ?\ ) | str]
[10:37:05] nickjj: Nicd-, i was reading a bit about module attributes, for something like a regexp that i'm calling a decent amount of times, would i see a performance improvement for using a module attribute + referencing it in the function instead of just inlining the regexp into a function?
[10:38:18] Nicd-: I think that if you have a function that always returns the same thing, the compiler may optimise it in some way. like `def foo(), do: @blah`
[10:38:27] nickjj: the docs hint that module attributes being called in a function have some optimizations that can happen at compile time but i'm not sure how that applies to something like a regexp in practice
[10:53:38] dysfun: oh god, part of my search term was 'elixir string' and of course i can't find anything now
[10:53:40] mdbm: dysfun, lol the code is not very readable yet for me... with time I can detect it easier... also all this new concepts make me tired
[10:55:38] Randyr: Hi. Rather than rendering some kind of page, I would like to just redirect on 404 (Phoenix). This doesn't seem possible in the error_view though. Where would I go about doing this?
[10:55:41] dysfun: and the main thing to remember about genserver etc. is all the handle_* you're supposed to return new state
[10:56:50] Randyr: Isn't the fallback controller only defined for each controller specifically? How would the router know about it?
[11:00:29] dysfun: but if you were going to use a different name, metadata (which are not as good as constants because they can't be used outside of the module) are a good way
[11:03:37] mdbm: josevalim, if by convention you always use the module name for naming your process, it will not benefit in readability? (i'm really just beginning with elixir heh)
[11:04:01] dysfun: i'm not convinced it's much better either tbh, it's pretty clear it's a name from context
[11:05:25] dysfun: maybe you work on lovely codebases where you're at a level to worry about such things
[11:10:48] dysfun: josevalim: is there documentation about the precise format elixir accepts for strings? the syntax reference does not detail for example which escape sequences are processed
[11:13:25] mdbm: dysfun, the function call: DirWalker.next(dir_walker) returns a list of paths such as ["C:/$Recycle.Bin/S-1-5/$IF.pdf"] (but I will always have one file in the list)
[11:15:39] dysfun: ACTION really should write that "how to debug elixir" blogpost for the blog he still hasn't written
[11:18:56] mdbm: just very tired, was in hospital all day yesterday due to bug sting bite near my eye, I can barely see my screen. I take 9 pills every day for anti allergy and I think I'm not 100% right now
[11:19:49] mdbm: I was careless just one day then if it hit my eye, I would have lost an eye, or damaged all life
[11:20:25] mdbm: I did a google search on it and I read a lot of testimonials of bikers who have eye damage all life because of bugs hitting their eye while driving
[11:49:29] benwilson512: hypercore: maybe make a forum post? liveview is still pretty new so you may want a larger audience for the question
[11:50:06] hypercore: benwilson512: never used the forum before actually, i'll give that a shot, thanks
[11:50:51] dysfun: ACTION wishes he had more time to keep up with elixir and didn't have to rely on hearing the more interesting developments from coworkers
[11:59:25] serafeim: i also have a question: it seems the current trend in deployment is using distillery or something. however using it seems like a PITA for me; also notice that I am develping in windows and will deploy in linux
[12:00:17] serafeim: so let's say that I just deploy in prod by copying the source code and running MIX_ENV=prod mix phx.server (i'll run the command through supervisord but that's the general idea).
[12:00:32] serafeim: will I have any problems with that setup ? will I have any security considerations ?
[12:05:26] Nicd-: Serafeim: Mix loads code on demand I think, so the first time certain code paths are hit will be slower
[12:05:47] Nicd-: also Distillery provides helpful tooling such as remote_console. but you can do that manually as well
[12:06:28] Nicd-: I used to run my projects with mix for a time, there is no security risk that I know of
[12:07:02] Nicd-: one problem is that if you upgrade the version of Erlang/Elixir on the server, you may not be able to reboot your services anymore
[12:37:03] dysfun: i mean normally i'd be quite happy to just try it in iex, but i'm generating code
[12:38:31] nickjj: is it expected that i need to explicitly set MIX_ENV=test mix test if i'm running tests against an already running elixir container that was launched where i never explicitly set MIX_ENV (which i guess defaults to dev)?
[12:38:46] nickjj: seems if i run mix test without setting MIX_ENV=test then it tries to use my dev settings
[13:46:32] hypercore: hi jose, could i get a quick opinion on how you would personally solve the issue of js libraries not re-instantiating elements on a liveview re-render?
[13:47:05] Nicd-: hypercore: probably would be best to link the forum post for context if you are asking here
[19:30:41] benwilson512: aight folks, dumb question time: jaro distance pronunciation. `dgaro` or `yaro` ?
[19:33:37] Uniaika: Since he's american, I would say "Djaro", like I would pronounce Jeans, benwilson512
[19:54:52] beatpanic: hello, very basic question about the Time module. Given a ~T[21:00:00] or an iso8601 time "21:00:00" is it possible to remove the last `:00` with the Time module? thanks
[20:06:00] beatpanic: josevalim: Yeah sure, I was wondering if there would be a lazier way :) thanks!
[21:07:53] nox: http://beam-wisdoms.clau.se/en/latest/indepth-beam-file.html#beam-compact-term-encoding TIL OTP20 had breaking changes