quando inicio o elixir no terminal ele me retorna este erro como posso resolver?

elixir -v
{"init terminating in do_boot",{‘cannot get bootfile’,’C:Program Fileserl10.3/bin/start.boot’}}
init terminating in do_boot ({cannot get bootfile,C:Program Fileserl10.3/bin/start.boot})

Elixir generate inverted / reversed map

I would like to transform the input

elems = (a, b, c)
terms = (t1, t2)

@spec contains?(term, elem) :: boolean
def contains?(term, elem), do: #implementation

to either of

%{t1 => (a, b), t2 => (c)}


%{t1 => (a), t2 => (b, c)}


t1 |> contains?(a) #=> true
t1 |> contains?(b) #=> true
t1 |> contains?(c) #=> false

t2 |> contains?(a) #=> false
t2 |> contains?(b) #=> true
t2 |> contains?(c) #=> true

My current solution is as follows

defmodule Test do
  def contains?(term, elem) do
    elem in term

  def test do
    elems = (1,2,3)
    terms = ((1,2), (2,3))
    |> Enum.into(%{}, fn elem ->
       terms |> Enum.find(&contains?(&1, elem))}
    |> reverse_map()

  defp reverse_map(map, reversed \ %{})
  defp reverse_map(map, reversed) when map_size(map) == 0, do: reversed

  defp reverse_map(map, reversed) do
    (key | _) = Map.keys(map)
    {value, map} = Map.pop!(map, key)
    reversed = Map.update(reversed, value, (key), &(key | &1))
    reverse_map(map, reversed)

With this solution I’m generating the map

%{a => t1, b => t1, c => t2}

then reversing it and collecting collisions in a list.

But I feel this intermediate map is unnecessary and a solution could exist without it.

In addition I’m not sure my implementation of reverse_map is as elegant as it could be.

language function: What is the purpose of the module in Elixir?

I am studying Elixir and found the keyword defmoduloI used to define a basic module that displayed a message:

defmodule Mensagem do    
    def escreve(msg) do
        IO.puts msg

Calling as follows:

Mensagem.escreve("Oie amigo do gato :D")


Hello cat friend: D

The way the module is defined reminded me a lot of a class and here some doubts arose.

  • What is the purpose of the module in Elixir?
  • Is a module the same as a class?
  • Can there be an instance to represent an object?

error handling – Naive SCP module in Elixir

I am trying to make a simple implementation of a scp Wrap in elixir.

The code works as intended, but I had the feeling that error conditions can be simplified. In addition to error handling, I am not the best way to add the -r mark if the source_path it's a directory with a cond keyword.

defmodule Scp do
  def scp(user, ip, source_path, destination_path, timeout \ 30) do
    scp_flags = (

    scp_flags =
      case File.dir?(source_path) do
        true -> ("-r" | scp_flags)
        _ -> scp_flags

    if File.exists?(source_path) do
      case System.cmd("scp", scp_flags, stderr_to_stdout: true) do
        {resp, 0} ->
          {:ok, resp, 0}

        {resp, exit_code} ->
          cond do
            String.contains?(resp, "Permission denied") ->
              {:error, :permdenied, exit_code}

            String.contains?(resp, "Connection timed out") ->
              {:error, :conntimeout, exit_code}

            true ->
              {:error, :errunkown, exit_code}
      {:error, :enoent, -1}

Write the Elixir module with the Ejabberd Linux installer

I am new to ELixir Module Development, I have installed Ejabberd with the Linux installer. How do I start the development of the Elixir module?

Should I compile ejabberd from the source before developing the ELixir module?

I've been through tutorials https://blog.process-one.net/elixir-sips-ejabberd-with-elixir-part-1/

Programming challenge – Elixir solution for Project Euler # 2

I have already done many of the Euler Project questions in other languages ​​before, but every time I learn a new language, I like to solve problems again in that language.

Here is my elixir version of

Find the sum of all fibbonaci numbers below 4,000,000.

stream = Stream.unfold ({0,1}, fn {a, b} -> {a, {b, a + b}} end)
Enum.reduce_while (sequence, 0, & (
AND 1 < 4000000 and rem(&1, 2) == 0 ->
            {: cont, & 2 + & 1}
AND 1 < 4000000 ->
            {: cont, & 2}
true ->
{: stop, & 2}

Can anyone find a way to make my code fit more with the elixir paradigm? Are there things that could be improved?

Security – Exposes the serial ID encrypted in Elixir

I am working on a Phoenix / Absinthe application and I thought about exposing the encrypted sequential IDs instead of the UUIDs, since they are a bit shorter.
Encryption in Elixir / Erlang seems very difficult, so I think I will eventually use the UUIDs.

Anyway, I would like to know how serious, from a security perspective, is the solution I came up with:

defmodule MyAppWeb.GraphQL.Types.EncId do
use Absinthe.Schema.Notation

defp secret_key (len \ 32) do
Application.get_env (: my_app, MyAppWeb.Endpoint)
|> Keyword.get (: secret_key_base, "")
|> String.slice (0, len)

defp pad_bytes (binary, block \ 16) do
padding_bits =
case rem (byte_size (binary), block) do
0 -> 0
r -> (block - r) * 8

<<0::size(padding_bits)>> <> binary

defp unpad_bytes (<<0, tail::bitstring>>), do: unpad_bytes (queue)
defp unpad_bytes (binary), do: binary

encrypt defp (raw_binary)
padded_binary = pad_bytes (raw_binary)

: crypto.crypto_one_time (: aes_256_ecb, secret_key (), padded_binary, true)

defp decrypt (raw_enc) make
: crypto.crypto_one_time (: aes_256_ecb, secret_key (), raw_enc, false)
|> unpad_bytes ()
|>: erlang.binary_to_term ()

def serialize (id) do
|>: erlang.term_to_binary ()
|> encrypt ()
|> Base.url_encode64 (fill: false)

def parse (% {value: enc_id}) do
try to do
{: ok, raw_enc} = Base.url_decode64 (enc_id, padding: false)
{: ok, decrypt (raw_enc)}
_ ->: error

scale: enc_id, name: "EncId" do
serialize (& __ MODULE __. serialize / 1)

parse (& __ MODULE __. parse / 1)

E-Juices: an elixir to induce happiness! – Help SEO (General Chat)

In the current scenario just to win, people have become "monsters of success" to such an extent that it has robbed them of peace of mind and happiness. Would not it be a perfect option if people could opt for certain substances that not only give them a sense of pleasure and tranquility, but also act as an alternative health product? According to the investigation, it has been shown that vaping supplies or saying; Electronic juices have greatly improved lung functions and other aspects of human health. Seeing the immense popularity of vaping products, many platforms have introduced and sell exotic flavors of e-liquids to the clients. Yes, you heard it absolutely fine! Now, people would no longer have to roam the local markets and struggle to find e-liquids as credible online stores allow you to buy your favorite brand of e-juice and give you the wonderful vaping experience like never before.

Vaping the exciting flavors of e-juices will help eliminate stains, the horrible smell of your fingers. If you have taste buds for Mango, you can also get your Chillax Mango Peach e-juice from the credible online store. Just vape and reduce your stress with the delicious mango and peach e-juice! Now with e-juices, you do not have to deal with ashtrays and lighters, since the leading online store has a variety of fantastic e-juice devices that come with unique sizes, shapes and models. With an easy-to-fill design, an extraordinary USB port charge and a built-in battery, it will provide uninterrupted and comforting vaping throughout the day.

If you are looking for a reliable online store that will serve you the best type of e juice wholesale United Kingdom Then look no further and consider Flava Hub. It is the reliable and recommended online platform that allows you to buy guaranteed quality electronic juices at competitive prices. Flava Hub has a collection of the best-selling brands of electronic juices available in a wide variety of flavors. If you want to sell an excellent range of e-juice products, you can join Flava Hub. You can place your orders and get it quickly and easily. Encourage the growth of e-juices with Flava Hub and create a positive impact on your lifestyle!

About Flava Hub:

Flava Hub is an eminent vape shop UK It provides 100% guaranteed e-juice products to customers.

For more details, visit https://flavahub.com/

Elixir pager module – Revision of stack exchange code

I wrote this Paginator module that is part of a small application that shows the Elixir Github repositories in a table.

I am new to Elixir and I am looking for improvements in the code with as much as possible. Better practices. Commenting Optimizations The use of structures for the input output. Etc.

# paginator.ex

defmodule pager

@moduledoc "" "
A module that implements functions to perform simple paging functionality.

Invoke it using the `call` function of the module that takes a structure as a parameter.

## values ​​of the Struct key

- total: the total number of records (required)
- page: the page currently in (default: 1)
- per_page: the number of records per page (default: 10)
- max_display: the number of pages displayed in the paging menu (default: 10)
- max_results: optional argument that limits the total number of records that can be paged

## Examples

iex> Paginator.call% Paginator (total: 1000)

% Paginator.Output {
first: nil,
last: 100,
next: 2,
Page 1,
pages: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
previous: nil


# The structure with the paging information that is returned.
Desmodulo of exit do
deconstruct [:page, :first, :last, :previous, :next, :pages]

@Doc """
# Struct that is passed to the module used to calculate the paging data
@enforce_keys [:total]
  Defstruct page: 1, per_page: 10, total: nil, max_display: 10, max_results: nil

@Doc """
Invokes the module. Take a structure with the entry and return a structure with the paging data
def call (data) do

data = data
|> Map.put (: max_pages, max_pages (data))
|> Map.put (: half, half (data))

page: data.page,
first: first (data),
last: last (data),
Pages: pages (data),
previous: previous (data),
next: next (data)

Returns the maximum number of pages.
@TODO: this must be an error. add test that has a total less than max_results
defp max_pages (data) make
data.total <= data.per_page ->
data.max_results! == nil and data.max_results < data.total ->
        Kernel.trunc (data.max_results / data.per_page)
true ->
Kernel.trunc (data.total / data.per_page)

# Returns the first page
defp first (data) do
if data.total> = data.per_page and data.page! == 1, do: 1, else: nil

# Returns the last page
defp last (data) do
yes data.page < data.max_pages, do: data.max_pages, else: nil

  # Returns the half value of `max_display` rounded down
  defp half(data) do
    Kernel.trunc(data.max_display / 2)

  # Returns the `pages` list. The number of list items depends on the number specified in `max_display`
  defp pages(data) do
    if data.total === nil or data.total === 0 or data.max_pages === 0 do
      Enum.to_list begin_pages(data)..end_pages(data)

  # Returns the page that the `pages` list starts on
  defp begin_pages(data) do
    cond do
      data.page + data.half >= data.max_pages ->
# at the end
data.max_pages - (data.max_display - 1)
data.page> data.half ->
# odd vs even pages
if rem (data.max_display, 2) === 0 do
data.page - (data.half - 1)
data.page - data.half
true ->

# Returns the page on which the `pages` list ends
defp end_pages (data) do
end_page = data.page + data.half
end_page> = data.max_pages ->
# at the end
data page <= data.half ->
true ->

# Returns the previous page number to the current page.
# If the current page is 1, it returns zero.
previous defp (data) do
if data.page> 1, beam: data.page - 1, else: nil

# Returns the page number that is more recent than the current page.
# If the current page is the same as the last one, it returns zero.
defp next (data) do
if data.page <data.max_pages, do: data.page + 1, else: nil

# paginator_test.exs

defmodule PaginatorTest do
use ConnCase
alias Paginator

describe "Test Paginator" do

test "page 1 of 15" do
res = Paginator.call% Paginator {total: 150}

affirm res.first == nil
affirm res.previous == nil
affirm res.next == 2
affirm res.last == 15
affirm res.pages == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

test "page 5 of 15" do
res = Paginator.call% Paginator {page: 5, total: 150}

affirm res.first == 1
affirm res.previous == 4
affirm res.next == 6
affirm res.last == 15
affirm res.pages == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

test "page 6 of 15" do
res = Paginator.call% Paginator {page: 6, total: 150}

affirm res.first == 1
affirm res.previous == 5
affirm res.next == 7
affirm res.last == 15
affirm res.pages == [2, 3, 4, 5, 6, 7, 8, 9, 10, 11]

test "page 7 of 15" do
res = Paginator.call% Paginator {page: 7, total: 150}

affirm res.pages == [3, 4, 5, 6, 7, 8, 9, 10, 11, 12]

test "page 13 of 15" do
res = Paginator.call% Paginator {page: 13, total: 150}

affirm res.pages == [6, 7, 8, 9, 10, 11, 12, 13, 14, 15]


"by page 50" test
res = Paginator.call% Paginator {page: 25, per page: 50, total: 2000}

affirm res.first == 1
affirm res.previous == 24
affirm res.next == 26
affirm res.last == 40
affirm res.pages == [21, 22, 23, 24, 25, 26, 27, 28, 29, 30]


"last page" test
res = Paginator.call% Paginator {page: 50, total: 500}

affirm res.first == 1
affirm res.previous == 49
affirm res.next == nil
affirm res.last == nil

"max display" test
res = Paginator.call% Paginator {page: 8, max_display: 5, total: 2000}

affirm res.first == 1
affirm res.previous == 7
affirm res.next == 9
affirm res.pages == [6, 7, 8, 9, 10]

      res = Paginator.call% Paginator {page: 9, max_display: 5, total: 2000}
affirm res.pages == [7, 8, 9, 10, 11]


test "maximum results - total more than max" do
res = Paginator.call% Paginator {page: 96, total: 2000, max_results: 1000}

affirm res.last == 100
affirm res.pages == [91, 92, 93, 94, 95, 96, 97, 98, 99, 100]


test "maximum results - max more than total" do
res = Paginator.call% Paginator {page: 96, total: 2000, max_results: 1000}

affirm res.last == 100
affirm res.pages == [91, 92, 93, 94, 95, 96, 97, 98, 99, 100]

test "without pages - zero total"
res = Paginator.call% Paginator {total: 0}

affirm res.first == nil
affirm res.previous == nil
affirm res.next == nil
affirm res.pages == []

test "without pages - low total"
res = Paginator.call% Paginator {total: 5}

affirm res.first == nil
affirm res.previous == nil
affirm res.next == nil
affirm res.pages == []

Guidance on microservices in Elixir using Umbrella

Hi, I'm a little developer, I have an application in Elixir / Phoenix and I need to break the monolithic code in microservices. I have researched how to perform this task using the Umbrella library to create the microservices but I am still lost in how to do this in a practical way, at first I found it easier to create a microservices application from scratch than to create microservices in an existing application, such as is my case.
I would like that someone could give me an orientation in step by step or indicate some content to help me. Thank you.