Category "elixir"

Elixir Iterate over a list and append values from it to a new list

I need to parse some values from a list then recalculate them to a new one, how can that be done in elixir? def calc_points(hand) do value = []

Set request timeout at connection pool level using hackney and HTTPoison

I am using httpoison which uses Hackney under the hood to make HTTP requests. By default, Hackney uses a default connection pool which is created with - connect

Using fetch api for uploading image using presigned url amazon s3

Hi I am trying customer upload their picture to amazon s3 directly in reactjs web app. I am generating presigned url in the backend like this def get_presigned

How to use binary strings in Elixir NIF

How do I get the char* data from an ERL_NIF_TERM coming from an Elixir binary string? I see term_to_binary/1 function but it does not seem to be the right thing

How to write a multiline `do` block with the `do:` atom syntax?

For example, how would this module definition look like on one line? defmodule Lofa do def miez do IO.puts("hello") a = 27 IO.puts("bye") a

Elixir - filter list of items with overlapping dates with a given date range

I need to refactor a function that filters a list of projects by a given date range: defp filter_by_date_range(projects, %{start_date: start_date, end_date: en

Using GenStage/Flow for soft-realtime event processing

Im currently building a soft-realtime event processing system using Elixir and now Im trying to wrap my head around GenStage/Flow to understand if that is the c

After I run docker compose up, my mac returns error stating that it can't find my mix phx.server. How do I show docker where my mix.exs file is?

When I'm running Docker Compose up, I receive an error ** (Mix) The task "phx.server" could not be found Note no mix.exs was found in the current directory I b

How can I see the SQL executed during an Ecto test?

When running an Ecto test with mix test ..., the SQL executed is not shown. As far as I can tell, it is not logged to any file, either. How can I see it? (I am

How can I use Erlang with Docker to run a Phoenix application?

I want to use a docker image in production to run a Phoenix container, However, since Elixir is just a layer on top of Erlang, it feels like it might be a waste

Add / Remove key-value pairs from a Map

How to add (and remove) key-value pairs in an Elixir map? This does not work: map = %{a: 1, b: 2, c: 3} map[:d] = 4

Loop through a Map's key-value pairs

How to iterate over a map's key-value pairs in Elixir? This doesn't work: my_map = %{a: 1, b: 2, c: 3} Enum.each my_map, fn %{k => v} -> IO.puts "#

Turn postgres date representation into ISO 8601 string

I'm trying to format a Postgres date representation into a ISO 8601 string. I'm assuming that there is a Postgres function that can do it, but I found the docum

Step List With Elixir

Can someone please provide a suggestion on how to iterate a list BUT with a batch of x at a time? For example: If the functionality existed: ["1","2","3","4"

module :unicode_util not available Phoenix/elixir

I was trying the Ueberauth library for GitHub login. In the login function, I'm getting an error saying that "function :unicode_util.lowercase/1 is undefin

VM892:1 Uncaught SyntaxError: Unexpected token e in JSON at position 0

I'm presently working on a phx / phoenix API written in Elixir. And I have created a frontend for the API using React.js. However, I'm getting the below error

How to get the current url in phoenix framework

I would like to know the current url with elixir / phoenix framework, how I can get this ? Edit #1: My nginx config file: server { client_max_body_size

How to use BigQuery API from elixir code

How to use BigQuery from elixir code? I would like to use Big Query web API from elixir code. Although there is no elixir client SDK in SDK libraries page I w