Quantcast
Channel: Questions / Help - Elixir Programming Language Forum

Struct instances do not share the key tuple

It appears that structures created with the %Struct{...} syntax do not share the key tuple. Compare: iex> Enum.map(1..1000, &%URI{port: &1}) |> :erts_debug.size() 24000 iex(68)>...

View Article


Image may be NSFW.
Clik here to view.

Evision.moments(contour) returns empty map

Hi! I’m currently trying to implement a simple point detection pipeline in order to get the points positions in an image : For that, I start by finding contours in the image, then try to use the...

View Article


How to halt stream while returning a last value

Hello, I have this example where I would like a stream transformation to return the whole input list up to the third atom, included. input = ["a", "b", "c", "d", :x, :y, "e", "f", :z, "g", "h", "i",...

View Article

When to use Credo plugins over credo custom checks

We use custom checks in one of our projects but would like to use them in other projects as well. What is the best way to package this for reusability? So far, we have tried having them as git...

View Article

How do you implement a heartbeat in a WebSockex client without hitting...

I’m building a simple WebSocket client using the WebSockex library. I want to add a basic heartbeat mechanism to keep the connection alive and detect disconnects. Since the client is pretty simple, I...

View Article


Image may be NSFW.
Clik here to view.

How to I dump an Elixir tuple into a PostgreSQL composite type?

Hello I’m using Ecto along with PostgreSQL. I’ve been trying to add a field containing a 2-tuple to an Ecto schema, but can’t seem to make it work. There is no built-in :tuple type in Ecto, so I tried...

View Article

Implementing Ecto Adapter for Dgraph db - autogenerated IDs

I’m implementing an Ecto adapter for the Dgraph graph db. I’m able to successfully insert a new record from a Schema or a Changeset. I’ve implemented the callback Ecto.Adapter.Schema.insert/6 and this...

View Article

Image may be NSFW.
Clik here to view.

Why are module names in Elixir UpperCamelCase, while the file names are...

Background I have recently found an old article about Elixir, where the author explains some conventions about Elixir, and in specific, naming and structural conventions for Phoenix projects....

View Article


Confusion about ExUnit doctests and escape codes

Hi I am dabbling a bit with parser combinators. And one of the parsers i need is one for escaped characters. When trying to write doctests for it i failed miserably. Took me quite some time to realize...

View Article


Github runners for Ubuntu 20.04 have been removed, trouble with...

I have a typst package on hex that uses rustler-precompiled, I used the github action from Explorer to create my release action. When I tried to make a new version yesterday it failed as GH decided to...

View Article

Translating SQL query with row constructors (?) into Ecto

Hi all, I have a table books with columns name and version. I want to search for books matching one of the provided pairs of (name, version). The SQL query looks like this: select * from public.books...

View Article

Best practice pattern matching specificity in functions

Is there a recommended approach or rule of thumb to determine how specific you should get when pattern matching a function’s arguments or is it purely preference? For example, let’s say the function...

View Article

Error: Cannot apply unknown utility class

After upgrading from Tailwindcss v3.3 to v4.1, I am getting the following error: $ mix assets.build ... Generated utilx app Error: Cannot apply unknown utility class: checked:border-brand-500 The...

View Article


Image may be NSFW.
Clik here to view.

Logging in different "groups"/outputs

This is a weird ask. but sometimes I want it Especially when developing a Phoneix app, you’ll have a bunch of logs spamming your console: response/request, database, your own logging etc. On top of...

View Article

Ecto query slows down when using pin operator

I’m using Ecto with SQLite, and I noticed a performance slowdown when using the pin operator (^) in a query. My database has 3 tables and 7M rows This is the query query = from(s1 in SubjectScore,...

View Article


How to insert a binary UUID?

I have troubles figuring out how to insert uuid into postgres while performing a replace_all. I either get this error: “Problem is that I either get this erro errors: Postgrex expected a binary of 16...

View Article

Issue with cache.ets file

Hello, I am trying to use livebook starting with Mix.install but it is failing with below errors : Blockquote 15:35:19.612 [error] Writer crashed (:"The pipe is being closed.\r\n") 15:35:19.647 [info]...

View Article


Image may be NSFW.
Clik here to view.

Using brod for kafka message consumption. Can run on iex, but not when I run...

I’m trying to configure brod to consume messages from a kafka cluster. When I create the client via iex I can create a consumer for the topic - no error message is show. However, when I run the app,...

View Article

Does Elixir have any modules that facilitate checking for open ports?

I recently took a course and completed a certification from INE as a Enterprise Defense Administrator. To understand the role one has to understand how an attacker learns about a network, scans for...

View Article

Image may be NSFW.
Clik here to view.

Solution to failure to install PostgreSQL when following Engineering Elixir...

I’m starting to follow the book Engineering Elixir Applications, and immediately ran into an issue installing PostgreSQL 15.2 on macOS 15.4.1: note: 'strchrnul' has been marked as being introduced in...

View Article

Seeking guidance implementing DbConnection

I’m working on an Elixir client for LanceDB (sqlite for vector storage) called ElixirLanceDB. Most of this work so far has comprised of writing Rustler NIFs over the LanceDB rust client. I’ve got...

View Article


FLAME failed with timeout in fly.io

I’m trying to setup flame on fly.io, but it failed with timeout errors. could you give me some idea if you have any? environment: Erlang/OTP 26 [erts-14.2.5.5] [source] [64-bit] [smp:8:8] [ds:8:8:10]...

View Article


Changing module of saved binary data

I run a system, where some structs are saved as binary with :erlang.term_to_binary and then deserialized with :erlang.binary_to_term. The problem is, that if I alter the struct, it does not match the...

View Article

Horde timeout error during deployments

We’re using AWS ECS to deploy our Elixir app which uses blue/green deployments. This means that whilst the deployment is occurring (and shortly after it) we are running our app across multiple nodes....

View Article

Telemetry/PromEx metrics in a cluster

Sorry if this is a daft question, but I can’t seem to find any documentation that answers my question … We’re in the process of migrating a Phoenix application from a single node to an OTP cluster....

View Article