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.

enter image description here

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.

Elixir was designed with programmer productivity as a core concept and features:

  • Concise friendly syntax
  • Simple meta-programming with Macros
  • Scale facility and process orientation
  • Awesome documentation and testing built-in
  • Polymorphism with Protocols

Learning

Packages

Popular Elixir Projects

Books

Screencasts

Community

9482 questions
5
votes
2 answers

How to test the broadcast made to a channel from different channel or controller?

I have a driver channel which broadcasts their location to a vendor channel. defmodule MyApp.DriverChannel do #... def handle_in("transmit", payload, socket) do MyApp.Endpoint.broadcast! "vendors:lobby", "track", payload …
Vysakh Sreenivasan
  • 1,719
  • 1
  • 16
  • 27
5
votes
2 answers

Accepting a date in Phoenix JSON API

In Phoenix I have this model schema "events" do field :start_time, Ecto.DateTime field :end_time, Ecto.DateTime belongs_to :calendar, Weozo.Calendar timestamps end @required_fields ~w(calendar_id start_time end_time) @optional_fields…
Fredrik
  • 4,161
  • 9
  • 28
  • 31
5
votes
1 answer

Getting error using 'belongs_to' in Ecto phoenix.gen.html

I'm making an model that I want to create in relationship to my user model. Following from http://www.phoenixframework.org/v0.13.1/docs/ecto-models#section-data-relationship-and-dependencies used the phoenix.gen.html as follows: W:runcible>mix…
5
votes
1 answer

Parametrizing node name in Elixir Exrm

I want to use Exrm with Erlang distributed on a single machine. I need to create multiple releases that differ only with node name. I know, I can configure node name in rel/vm.args, but it will be static. Can I somehow generate multiple releases…
tkowal
  • 9,129
  • 1
  • 27
  • 51
5
votes
1 answer

What is syntax for byte_size in pattern matching?

How to match and what syntax is to check byte_size equal 12 length pattern in handle_info()? Can I use both patterns in handle_info(), eg. first that will check string for new line, second with byte_size? Example code without byte_size pattern: def…
luzny
  • 2,380
  • 7
  • 30
  • 64
5
votes
4 answers

Running a Phoenix application release with exrm crashes

I am trying to create a release of a stock Phoenix application (based on Elixir and Erlang) using exrm. The first release for the dev mix environment is created fine, but crashes when run using ./rel/my_app/bin/my_app console. This happens running…
mavenastic
  • 51
  • 4
5
votes
3 answers

Elli with Elixir Basic usage issue

I am using elli https://github.com/knutin/elli in my Elixir application. The sample code is provided below. It is quite basic, every time it is run, I only get "Internal Server Error". I am not sure what I am doing wrong. Can any one please help…
Alpha Sierra
  • 123
  • 4
5
votes
2 answers

Elixir Ecto : multiple joins and reusable/composable queries

In Ecto you can make reusable/composable queries like so : defmodule AModel #... def anonymous(q), do: q |> where([am], is_null(am.user_id)) end end See more examples on this blog post. However, I face a problem using multiple…
ProxyGear
  • 835
  • 1
  • 10
  • 26
5
votes
2 answers

Why does the value rest contain the value "llo"

I am working through the Elixir getting started documentation and have come across something that I don't understand the output. In the example below, I don't understand why rest ends up being "llo" or for that fact how the first result, results to…
Brettski
  • 19,351
  • 15
  • 74
  • 97
5
votes
2 answers

Plug, use option passed at init with Plug.Router syntax

I am using Plug and I would like to understand. My code looks like: defmodule Numerino.Plug do use Plug.Router use Plug.Debugger plug :put_resp_content_type, "application/json" plug :match plug :dispatch def init options do …
Siscia
  • 1,421
  • 1
  • 12
  • 29
5
votes
1 answer

Phoenix Framework: Send rendered template in JSON response

I have a template for the top navigation of my app in top_navigation.html which holds the "Sign in", "Sign up", and when logged in, the "Sign out" links. <%= if logged_in?(@conn) do %>
  • <%= link "Sign out", to: session_path(@conn, :delete),…
  • David Cole
    • 53
    • 4
    5
    votes
    3 answers

    Enum over Elixir data, including nesting, and display the keys / vals in EEx?

    I have a Phoenix app in which I need to display User's profiles in EEx / HTML, but each User's profile has varying fields, including nested data. This would be simple to do if every user's profile had the same fields, as I could just print them…
    Robin Johnson
    • 309
    • 2
    • 10
    5
    votes
    1 answer

    Running integration/acceptance tests for an umbrella app in elixir

    I have a project that consists of an Umbrella App. The child apps under the umbrella consist of a core/main/domain application a delivery app, a database backed repository and an in memory repository. I would like to write a few integration tests…
    Peter Saxton
    • 4,466
    • 5
    • 33
    • 51
    5
    votes
    1 answer

    Phoenix Framework: How to Route Custom Media Type?

    In the Phoenix Framework, how does one route a custom media type in Accepts? Phoenix's own code comments indicate the following is all that is necessary—plus a recompile of deps, though the need for that escapes me. But, this seems not to…
    Yuri Gadow
    • 1,814
    • 2
    • 16
    • 26
    5
    votes
    1 answer

    Assets in prod environment, and file upload

    I'm trying to wrap my head around how static assets work in a production environment, the documentation seems rather scares, but it could just be me. According to http://www.phoenixframework.org/docs/deployment i should run MIX_ENV=prod mix…
    MartinElvar
    • 5,695
    • 6
    • 39
    • 56