Elixir Docker multi-stage image file not found
Stack Overflow » Elixir
by kusiaga
10M ago
I create a simple Elixir app without Phoenix, I am able to run it without Docker. When I want to dockerize the app using multi-stage build, I got an issue /app/_build/prod/rel/todo_app/releases/0.1.0/../../erts-14.0.2/bin/erl: exec: line 12: /app/_build/prod/rel/todo_app/erts-14.0.2/bin/erlexec: not found Here is the dockerfile FROM elixir:1.15.1 as build ENV MIX_ENV=prod COPY lib ./lib COPY mix.exs . COPY mix.lock . RUN mix local.hex --force && \ mix local.rebar --force && \ mix deps.get && \ mix release # Copy the production.env.exs file to the cont ..read more
Visit website
The erlport.erlang module doesn't seem to exist
Stack Overflow » Elixir
by A. Lavie
10M ago
The ErlPort docs for making calls to Erlang functions in Python requires importing erlport.erlang and using the call function. It seems that in erlport 0.6 (the version that pip3 install) there is no erlport.erlang module. I've searched around a bit and am not sure how to go about this, as most of the erlport docs/issues are pretty outdated. The repo and package themselves haven't gotten me anywhere. I am attempting to make calls to erlang functions from a Flask app. Erlport seems to be the best tool for this as recommended by this answer and quite a few others ..read more
Visit website
Doing pagination without id in group by Ecto
Stack Overflow » Elixir
by Junaid Farooq
10M ago
I have table Orders and Table TRDs. each order can have multiple TRDs, and every trd has an account_id. What I am trying to do is: to get all the orders, with trds but TRD grouped by account id. I am using Scrivener for pagination base_query = from(order in Order, left_join: trd in TradingRestrictionsDiscrepancy, on: trd.order_id == order.id, left_join: account in Account, on: trd.account_id == account.id, group_by: [ order.id, trd.account_id, trd.event_time ], select: %{ order_id: order.id, account_id: trd.account_id, trd_even ..read more
Visit website
Ecto create unique index with nulls
Stack Overflow » Elixir
by spinners
11M ago
I'm trying to create a unique index with an ecto migration for a PostgresDB. def change do create table(:categories) do add(:name, :string) add(:parent_id, references(:categories), null: true) timestamps() end create(index(:categories, [:parent_id])) create( unique_index(:categories, [:name, :parent_id], name: :unique_categories_name_parent_id) ) end However, this does not work when the parent_id is NULL. I know that PostgresSQL 15 supports NULLS NOT DISTINCT but my db is on v13. This there a way to ensure unique name field with NULL parent_id here ..read more
Visit website
Float to string without scientific notation?
Stack Overflow » Elixir
by Filip Haglund
11M ago
Is there a good way to convert floats to strings in Erlang/Elixir, without scientific notation, and without specifying how many decimal digits I want? Neither of these do what I need. :erlang.float_to_binary(decimals: 10): gives trailing zero decimals float_to_binary(100000000000.0, [short]).: prints scientific notation ..read more
Visit website
Getting `null value in column "id" of relation table_name` when I try to save something to the database in Phoenix
Stack Overflow » Elixir
by neurodynamic
11M ago
Every time I try to run a Repo.insert with this particular table, I get an error about the id being null (null value in column "id" of relation table_name), but the id isn't supposed to be set manually anyway, so why would I need to set it explicitly ..read more
Visit website
What would be an idiomatic and semantic way to make integration tests on this Elixir GenServer?
Stack Overflow » Elixir
by Zoey
11M ago
I'm building several worker with GenServer and I would like to implement both unit and integration tests on each worker. For the first worker I built, this is the implementation code defmodule CotacoesETL.Workers.Pesagro.BoletinsFetcher do @moduledoc """ Todos os dias esse Worker visita a página da `Pesagro` e busca novos boletins do Mercado Agrícola, a fim de atualizar nossa base de dados. """ use GenServer alias Cotacoes.Handlers.CotacaoHandler alias CotacoesETL.Adapters.Pesagro.Boletim alias CotacoesETL.Integrations alias CotacoesETL.Integrations.PesagroAPI require ..read more
Visit website
Elixir Phoenix How to change and retain class using %JS{} in this modal text editor example
Stack Overflow » Elixir
by William
11M ago
The code below lets a user click on a list item (called a testbed.note) and as a result a modal pops up whereby they can either preview or edit the content. The problem is if the user keeps the editor open and the modal closes, the next time the modal is opened it does so in the "edit" state. In the code, the user should NEVER be able to open the modal and have it default to the edit state. In other words, each time the modal launches it should always be in preview mode. I tried placing %JS{} code to toggle the class when the user clicks the submit button. It didn't work. I have linked a video ..read more
Visit website
Guard to check each character in the string
Stack Overflow » Elixir
by lorem1213
11M ago
My function takes a string and I need to check each individual character is either "0" or "1". How to do that? I have tried this: defguard is_bit_string(str) when is_binary(str) and byte_size(str) == 1 and binary_part(str, 0, 1) in ["0", "1"] defguard is_bit_string(str) # byte_size(str) == 1 and when is_binary(str) and binary_part(str, 0, 1) in ["0", "1"] and is_bit_string(binary_part(str, 1, byte_size(str) - 1)) But turns out gaurd can't be recursive(ig as i get following error: (C ..read more
Visit website
OpenTelemetry Propagation in Erlang/Elixir - an example
Stack Overflow » Elixir
by user1453428
11M ago
I have a gRPC API and want to add Otel based tracing to it. Every request to this API contains trace/span ID, but I am struggling to properly emit child span. Here is an example from iex: require OpenTelemetry.Tracer alias OpenTelemetry.Tracer :otel_propagator_text_map.extract([{"traceparent", "00-00000000000000001f28325aa9c79b59-37ab46991f7a64e1-00"}]) _parent = :otel_tracer.current_span_ctx() span_ctx = Tracer.start_span("otel-test") Tracer.set_current_span(span_ctx) # start doing some work :timer.sleep(100) # work done Tracer.end_span(span_ctx) Not sure what is wrong here but I don't s ..read more
Visit website

Follow Stack Overflow » Elixir on FeedSpot

Continue with Google
Continue with Apple
OR