Questions tagged [elixir]

Elixir is an open-source, dynamic, compiled, general purpose functional programming language. It was designed to be fully compatible with the Erlang platform and is well suited to writing fault-tolerant, distributed applications with soft real-time guarantees and the ability for hot-code-swapping.

Filter by
Sorted by
Tagged with
1 vote
1 answer
30 views

Authenticity error when trying to install Rebar

I'm using Elixir 1.8.1 and am now seeing this error under our Gitlab CI: * creating /root/.mix/archives/hex-2.0.6 * creating /root/.mix/rebar ** (Mix) Could not install Rebar because Mix could not ...
kepler's user avatar
  • 1,632
0 votes
1 answer
25 views

How to handling Database Issues in a GenServer and the Impact of Max Restarts in Elixir Supervisor

I have an application that displays messages on a website. These messages are shown after performing some calculations using my service. My main question is related to the behavior inside the ...
AungMyoOo's user avatar
0 votes
1 answer
30 views

How to generate or remove single field after I've already used generator in Phoenix

I used the phx.gen.html generator to create a table and related controller and view data using this command: mix phx.gen.html TestBeds TestBed testbeds name:string version:string note:string developer:...
William's user avatar
  • 4,520
0 votes
0 answers
32 views

How to get the loss history using Elixir's Axon library?

I'm trying to use the Axon library. I've been reading the documentation (https://hexdocs.pm/axon/Axon.Loop.html) and can't find how I can get an array of the history after the model is run. I can see ...
Loading...'s user avatar
1 vote
1 answer
43 views

Phoenix 1.7 welcome page assets not showing properly

Background I have a a fresh umbrella project with a Phoenix app inside. To create the app I used the following commands: mix new test_app --umbrella cd test_app/apps mix phx.new.web web_interface --...
Flame_Phoenix's user avatar
0 votes
1 answer
20 views

Fresh new 1.7 Phoenix app inside umbrella fails build

Background I have a fresh umbrella app and I am trying to create a Phoenix app inside it. However, even though I can create the Phoenix app inside the umbrella, I cannot build it successfully. Problem ...
Flame_Phoenix's user avatar
2 votes
0 answers
49 views

Failed to connect to raw.githubusercontent.com port 443: Connection timed out

Operating system and version: Ubuntu 22.04 LTS When installing Erlang on my Ubuntu system getting issue of raw.githubusercontent.com port 443: Connection timed out. asdf install erlang 25.1 (or ...
Puneet Garg's user avatar
2 votes
0 answers
35 views

Elixir opaque structure

I tried using the @opaque attribute to create an Opaque type but dialyzer will only catch if I try to peak at the struct and will not prevent someone outside the module to do create a %XXX{} struct. ...
doobdargent's user avatar
1 vote
2 answers
35 views

Elixir Phoenix: Using `for` and `as` on a login form element using new heex syntax?

Versions: Elixir 1.14.4 Phoenix 1.7.2 Noob here on both Elixir and Phoenix. I am really struggling to learn that framework. I am trying to go through a user authentication tutorial with a newer ...
tokosh's user avatar
  • 1,742
1 vote
0 answers
42 views

Rebar3 Docker "Rebar dependency inets could not be loaded for reason no such file"

I was trying to setup Dockerfile for my application but this application also creates some Erlang scripts at runtime with Rebar3. The issue is when i execute rebar3 new escript <name> at runtime,...
MePP's user avatar
  • 11
0 votes
1 answer
35 views

Stripe processing fee

I am struggling to find stripe processing fee. As per my research, stripe processing fee can be found in balance transaction object. BalanceTransaction object can be expand in PaymentIntent within ...
uzair aslam's user avatar
0 votes
1 answer
46 views

HTTPoison timeout error while upload big file

I am trying to upload file by multipart form with my API. This works fine locally. However when I deploy into the server it thrown and error calling the HTTPoison request for file size >30MB. I don’...
tmariaz's user avatar
  • 55
1 vote
1 answer
41 views

"application.get_key > modules" will return :undefined

I want to get a list of the modules in a certain namespace at the compile time, as a macro. defmodule MyApp.MyModuleLoader do defmacro __using__(opts) do quote bind_quoted: [opts: opts] do ...
mondichuk's user avatar
1 vote
1 answer
56 views

How to list all the modules of a certain submodule via macro?

There're modules in a certain directory and sub-directories of my project which I want to parse and save into a variable at compile time via a macro defmodule MyApp.MySubmodules.Mod1 do @doc "...
Marco C. Stewart's user avatar
0 votes
1 answer
36 views

How to run a lot of one-time tasks individually or in batches with some interval between each other?

I want to run 500 tasks either a) in a series of 8-10 ones with a detay between each batch; or b) one by one but with a delay between each task Each series (a) or an individual task (b) shouldn't ...
Marco C. Stewart's user avatar
4 votes
2 answers
51 views

How to properly create, observe and destroy lots of pre-defined jobs at runtime?

I plan to create a web service which will allow the users to spawn a large number, let's say 3k-5k, of certain types of jobs. There'll be a few different, pre-defined types of jobs. defmoudle Job1 do ...
mondichuk's user avatar
1 vote
0 answers
26 views

How can i use PrismJS with Phoenix? [closed]

I've tried the code in this tutorial but it didn't work.(That was kind of expected since phoenix changes a lot) And i've also tried to include the script in root.html.heex but these didn't work. Any ...
Snek's user avatar
  • 131
3 votes
1 answer
64 views

DynamicSupervisor.start_child(...) ----> error > already started

I have this code: defmodule MyApp.JobRunner do use DynamicSupervisor alias MyApp.MyWorker def start_link(_arg) do DynamicSupervisor.start_link(__MODULE__, :ok, name: __MODULE__) end ...
Koklushkin's user avatar
1 vote
2 answers
90 views

A child for DynamicSupervisor – long-running jobs

Let's say I have a simple module defmodule MyWorker do def do_long_running_work(a, b, c) do # ...... end end And DynamicSupervisor defmodule MyDynamicSupervisor do use DynamicSupervisor ...
Koklushkin's user avatar
1 vote
1 answer
78 views

Elixir/Phoenix LiveView documentation for conditional rendering attributes like :if

I can't find it for the life of me. Does Phoenix have documentation for these attributes used with templates? Sigh. // where is documentation? <div :if={length(@items) == 0}> 0 result. </...
Jonathan Lightbringer's user avatar
0 votes
0 answers
31 views

When rendering a view no function clause matching in Ecto.assoc_loaded?/1 error

I'm rendering a view but it is throwing error while association loading. Not sure what I'm missing. Been breaking my head but unable to find solution. Matter of fact it was working fine before with ...
tmariaz's user avatar
  • 55
0 votes
1 answer
37 views

Failing to Understand ssl_opts in Elixir Phoenix Ecto's Postgres Adapter

So I have installed the Percona Postgres Operator and Distribution on Kubernetes. Everything works fine, I can do the check mentioned on their installation site by using the ssl certificate generated ...
paulrusu's user avatar
  • 117
0 votes
1 answer
45 views

Deprecated Ecto.DateTime casting with newer version of Elixir

I have an older version of Elixir code which use Ecto.DateTime.cast(). However since the release of Ecto 3.x, Ecto.DateTime is deprecated. I have the following code and I'm wondering how to convert to ...
tmariaz's user avatar
  • 55
0 votes
0 answers
19 views

to make a handle event that handles a toggle button responsible for adding or removing permissions from a role while creating or editing a role

I have a phoenix live component that adds and edits new roles, the component also has toggles for adding and removing permissions from a role while editing or creating a role I tried using permission ...
Enrique's user avatar
0 votes
3 answers
94 views

Why is the value prefixed with "Elixir."?

Working with maps provide me with an unexpected outcome in VS Code: The expected outcome, when picking a property out of the maps, is prefixed with "Elixir.", followed by the expected ...
Seanf's user avatar
  • 3
2 votes
1 answer
86 views

How can I use the sigil_p (~p) to create asset URLs which contain the digest hash?

I want to improve this working code to make it more idiomatic. I wish to refactor it and use ~p if possible. I added this config (the cache_manifest bit) to my dev environment (it was in prod by ...
Chris Vilches's user avatar
2 votes
0 answers
39 views

Count items in Phoenix's Presence in constant time

I'm using Phoenix with LiveView and I have this code in one of my views. The part where I update the socket to include the def handle_info(%{event: "presence_diff", payload: _payload}, ...
Chris Vilches's user avatar
0 votes
3 answers
95 views

Convert YYYY-MM-DD HH:mm:SS to utc

I have a string input having the following format YYYY-MM-DD HH:mm:SS 2022-04-14 15:30:00 How can I convert this string to utc format in elixir. Ideally I should look something like this 2022-04-...
Alkari's user avatar
  • 116
1 vote
1 answer
80 views

Process send_link doesn't work when the parent process dies, even after unlinking

I have Process.send_after(self(), {:do_thing, type, x, z, 0}, 60_000) Then if the parent process dies that never happens So I tried {:ok, pid} = Task.start_link(fn -> ...
bezzoon's user avatar
  • 1,701
0 votes
1 answer
38 views

how to make variable from pattern match of macro call available afterwards?

The following code has no problem: assert {:ok, %{ "a" => var_a, ...... } = my_func() assert false === is_empty(...
Will-i-Am-Davidon's user avatar
0 votes
0 answers
28 views

How can I take downloaded files from browser's cache into my code?

I would like to testing my site to ensure that some versions of documents and images are present when some user-agents are going to my site. I'm preparing now wallaby with geckodriver and chromedriver ...
Dimitri's user avatar
  • 611
0 votes
1 answer
49 views

Issue with the logic of the factorial function in the code, the function is not correctly calculating the factorial of the input integer n. Elixir

The problem I'm having is that the loop doesn't seem to run and print the original "result" value. defmodule M do def factorial_(n) do result = 1 for i <- 1..n do result =...
a.c_hairy_limon's user avatar
0 votes
0 answers
53 views

adding three.js to phoenix live view project

I'm trying to add three.js as a dependency to my Phoenix Project. At the moment, I've vendored a minified three.js version in /assets/vendor/three.min.js From there I added the following to my app.js: ...
Chris Rad's user avatar
0 votes
0 answers
46 views

How to write a treesitter query that matches only if import is present

I use nvim and nvim-treesitter, and I want to apply syntax highlighting to SQL strings in elixir files. But only when the corresponding SQL function is imported, since I don't want to match any 'ol ...
Link0's user avatar
  • 645
2 votes
1 answer
115 views

'mix: command not found' error when installing Erlang/Elixir using asdf

Fast summery: Installed Erlang/Elixir using asdf in Debian 11. Getting 'mix command not found' errors. Tried: Checked compatibility: https://hexdocs.pm/elixir/master/compatibility-and-deprecations....
Emily's user avatar
  • 2,099
0 votes
1 answer
64 views

How do i create LiveViews in phoenix

I have the following code for a simple live view which used to work on my other computer but i cannot seem to get it to work anymore: defmodule ProjectWeb.CounterLive do use Phoenix.LiveView def ...
Snek's user avatar
  • 131
0 votes
1 answer
37 views

Mapping slices of an Nx tensor

If I have a function that expects an Nx tensor of a specific shape, and I have a larger tensor that includes slices of that shape, is there an efficient way to map some function over those slices? The ...
David Maze's user avatar
  • 124k
1 vote
1 answer
97 views

How do I make my code asynchronous (Elixir)

I have a "statistic.txt" file which can contain from 0 to 819.2 million lines with numbers [-4 billion; +4 billion]. I need to count the number of groups of 5 lines, in which the 3rd number ...
ACULUS's user avatar
  • 23
0 votes
1 answer
25 views

Take a fs path as a param in phoenix

So i want a route that can take a fs path as a parameter like this: GET "/test/*fs_path", FsController, :fsc this pattern that i used here: *fs_path does match fs paths however it just ...
Snek's user avatar
  • 131
1 vote
0 answers
40 views

How to reposen 405 of TRACE response in elixir ( Phoenix Framework )

I want to handle the any TRACE method api call to 405 status code, "Unhandle Method" with a response body. Now it is behave like elixir default behaviour is itself by return 501 NOT ...
AungMyoOo's user avatar
0 votes
0 answers
72 views

How to fix "Plug.Conn.AlreadySentError" when running tests in Phoenix?

I'm getting a "Plug.Conn.AlreadySentError" when running tests in my Phoenix application. Specifically, the error message says: test index lists all user (DbserviceWeb.UserControllerTest) ...
Shubham Belwal's user avatar
0 votes
0 answers
52 views

Unable to deploy phoenix with edeliver which throws an compile_env/4 error

I am trying to deploy the app with edeliver. However during the .... I get the following error. Not sure what is it actually means. Though in the dev environment it works fine. mix compile - ...
tmariaz's user avatar
  • 55
1 vote
1 answer
223 views

Connect elixir livebook to running phoenix application

Why I want to do it? Allow all business logic functions to be available to the data scientists Environment Nginx as reverse proxy Phoenix application (without docker, mix release and systemd) ...
Joe Eifert's user avatar
  • 1,286
0 votes
0 answers
17 views

Gradient does not recognize type of TypedStruct structures

Background I have a module that uses TypedStruct to create structs. This is the code: defmodule Shared.Data.Authorization do @moduledoc """ Saves authorization details for a user. ...
Flame_Phoenix's user avatar
0 votes
1 answer
55 views

Phoenix crate a RESTful API, error message: no function clause matching

I am learning how to use Phoenix to create RESTful API. My steps as follows: step1: use mix task create database schema and some code mix phx.gen.context AnimalAdmin Animal animal name:string email:...
xingxing liu's user avatar
0 votes
1 answer
58 views

Get missing keys from ArgumentError when using @enforce_keys

Problem I have an example struct: defmodule Foo do @enforce_keys [:title, :description] defstruct @enforce_keys end If I create a struct without one of the keys while using Kernel.struct!/2, I ...
Colin Burr's user avatar
1 vote
1 answer
48 views

Ecto Multi.run returns clause matching anonymous fn/2 error

I have the following Ecto.Multi but it throws an error. I'm running on Phoenix 1.6.15 with Ecto 3.9.2. Not sure what I'm doing wrong... Code: result = Multi.new() |> Multi.run(:...
tmariaz's user avatar
  • 55
1 vote
1 answer
217 views

How to allow Phoenix handle multiple domains?

A web application in Phoenix. Nginx is used as a reverse proxy. At the moment, as it normally will, the web application handles requests for a single domain. If I point DNS of other domains to the ...
Duminamonri's user avatar
1 vote
0 answers
230 views

Elixir Phoenix Liveview Form Submission Problem With Disabling Submit Button

In a liveview, I have a form that is defined like this: <.form let={f} for={:user} action={Routes.user_path(@socket, :create)} phx-change="validate_changeset" phx-debounce="blur"...
paulrusu's user avatar
  • 117

1
2 3 4 5
188