Elixir Blog Posts

Good article, but the premise seems a bit unneeded? :slight_smile:

iex(1)> 0b0001_1101
29
iex(2) 0b0001_1101_1001
473

Although the matching capability of that is awesome! That would be useful in Elixir if it didnā€™t already waste _ in numbers (instead it should have used ' as is more common). :slight_smile:

1 Like

@OvermindDL1 @jackmarchant, what are the main challenges with Elixir Umbrella Apps?

1 Like

@greyhwndz The main challenge is that umbrella apps are often used as a means to organise code and split domains/contexts and nobody can get this right the first time so it ends up being harder to refactor than it would have been if everything was in the same app.

Each app in the umbrella can have its own configuration and mix project which just adds more complexity without any benefit, unless youā€™re actually deploying it separately, and I havenā€™t seen this before in practice - maybe someone does it though.

3 Likes

https://medium.com/@marcio_lopes/how-to-purge-rows-from-tables-to-s3-from-a-elixir-application-using-ports-4d760507eae6

3 Likes

https://medium.com/@adolfont/elixir-brasil-2019-and-other-elixir-news-939bf52dfea9

2 Likes

Thank you! Iā€™ve forgotten to write it :sweat_smile:
Iā€™ll update the article later.

As far as I know integer to bitstring on erlang/elixir is used :binary.encode_unsigned/1. Right?

iex(1)> :binary.encode_unsigned(0b1101_1001)
<<217>>
iex(2)> ~b(1101_1001)
<<217>>

I think most of cases are covered by :binary.encode_unsigned/1 and 0b literal you mentioned.
It has difference about heading 0s. 0b aligns the size as 8bit, ~b keeps its size.

iex(23)> bit_size(:binary.encode_unsigned(0b000_1000))
8
iex(24)> bit_size(~b(000_1000))
7

Thatā€™s I needed.

2 Likes

Wrote an article about the new Elixir 1.9 Registry function select/2 and my experience contributing

13 Likes
7 Likes

@rozerosie Welcome to the forums! Great article! You think it will be updated to mix release once Elixir 1.9 is released? :slight_smile:

1 Like

Iā€™m not sure weā€™ll need to update it actually. We cover how to generate the release inside of a docker container and get that release out after it was built, so it should work however you get mix release :crossed_fingers:

3 Likes

Beginnerā€™s level write-up about pattern matching

https://medium.com/@micaelnussbaumer/pattern-matching-in-elixir-cbfb584df30

3 Likes

Weā€™ve gotten a fair bit of interest in this post, so @oestrich is going to run Mondayā€™s Twitch stream on it; heā€™ll be showing how he deploys to Grapevine w/ Distillery and Docker. Catch it Monday Noon EDT at https://www.twitch.tv/smartlogictv if youā€™re interested!

4 Likes

I put together a new post in my ā€œliterate commitsā€ style where I go about building the simplest possible Phoenix application from the ground up, one commit at a time.

Check it out: Minimum Viable Phoenix

Iā€™m pretty excited about this format, and Iā€™m interested to know what people think!

8 Likes

Configuring Distillery

Latest post from Eric over at the SmartLogic blog:
ā€œFollowing up on our last post about generating an Erlang release through Docker, letā€™s talk about how we configure Distillery to generate the actual release. Here again Iā€™m using the example of the scripts I use to deploy Grapevine, to give us a real example to look at.ā€

5 Likes

These are always fun ones to read! ^.^

EDIT:

No clue what a .DS_Store line is doing in your .gitignore file or what it is for? I donā€™t see it listed in any of my .gitignoreā€™s that Iā€™ve grabbed from a large variety of git projects. Should detail why it is there and what it has to do with Elixir?

2 Likes

DS_Store is a macOS file that contains folder information. Usually included in global gitignore files!

2 Likes

Ah, yeah, system-specific junk files like the macos stuff should not go in project .gitignore files, thatā€™s like the Windows icon cache file litter too which that post left out in that case. Should set that globally by putting it in a global gitignore file, like echo .DS_Store > ~/.gitignore_global and make sure git uses it as the global gitignore via git config --global core.excludesfile ~/.gitignore_global.

7 Likes

Hmm. I thought git respected a .gitignore in the home folder by default. I have a few things in there (TODO, .DS_Store) and donā€™t recall ever setting anything in the config.

1 Like

Hmm, it wasnā€™t on any of my systemsā€¦ Let me check the help file. ^.^;

core.excludesfile

In addition to .gitignore (per-directory) and .git/info/exclude , Git looks into this file for patterns of files which are not meant to be tracked. ā€œ~/ā€ is expanded to the value of $HOME and ā€œ~user/ā€ to the specified userā€™s home directory. Its default value is $XDG_CONFIG_HOME/git/ignore. If $XDG_CONFIG_HOME is either not set or empty, $HOME/.config/git/ignore is used instead. See gitignore(5).

Ooo, Iā€™m very sure it used to not have a default, but now apparently the default is $XDG_CONFIG_HOME/git/ignore falling back to $HOME/.config/git/ignore. :slight_smile:

4 Likes

Today I have found this article:

Enjoy.

9 Likes