Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
    Jeff Lee
    thanks very much sir
    No problem. Enjoy ^_^
    Syed Faraaz Ahmad
    My blog post on writing your package in elixir, I hope it's helpful
    I'd love to get feedback for improvements
    Palash Nigam

    Hi there I completely new to elixir and I'm trying to write a wrapper for an elixir linter (credo). While running CI checks I'm getting errors while installing dependencies. This is what I get on travis CI
    erldoc.el:64:1:Error: Cannot open load file: cl-lib

    ERROR: install script from erlang-mode package failed

    dpkg: error processing package erlang-mode (--configure):

    subprocess installed post-installation script returned error exit status 1

    Setting up erlang-src (1:20.1-1) ...

    Processing triggers for libc-bin (2.19-0ubuntu6.13) ...

    Errors were encountered while processing:


    E: Sub-process /usr/bin/dpkg returned an error code (1)
    Here a link to my PR coala/coala-bears#2172 Can anyone check it tell me whats the problem?

    Chintan Mishra
    Looking at your error I feel there is an issue with your CI. Check if other projects have similar problem.
    Pedro Rivas
    Hello, I am fighting with floats.
    I retrieve floats from database convert to integer do some operations and after reconvert to floats, (better do domain operations with integers instead floats I think), I have this code:
    some_numeric_result = :erlang.binary_to_float(:erlang.float_to_binary(12.45536, decimals: 4)) that return this result 12.4554
    If I multiply this: by some_numeric_result * 10000 returns this result 124553.99999999999
    Exist some way in this world to do this simple operation and return 124554 ? I try with Erlang and Elixir way but nothing works
    I think maybe rounding this....but... round the result in each intermediate step is not a good way to do things, IMHO
    Thank you
    Chintan Mishra

    NoSQL users in Elixir have tons of redundant drivers for each NoSQL DB. This hurts the community and acts as a barrier for adoption in prod. It'd be great if people can join forces to build collaboratively. I have set up a community for NoSQL users please use it to communicate and collaborate for developing NoSQL drivers.


    Oleksandr Bratashov
    Hello guys! Tell me please, how to quit after run IO.read(:stdio, :all) ?
    Gaurav Arora
    I have installed elixir on my server instance and then installed phoenix there. My postgres is installed on another instance in different cloud provider. I can connect to my database and in interactive shell I can see the querries working. But it's not working if I try to access it via my server instance IP address, means on server localhost it's running but if I try to access via the IP address it's not working. Anybody can guide me for the changes to be made ?
    Running MyappWeb.Endpoint with Cowboy using
    how get this to my instance IP address while running mis phx.server
    What’s the error message?
    Ishizaka Tomoya
    Hi. Function defined using defp Displays the following error. (dialyzer)
    Function function_name/1 will never be called
    But using def will work fine. Is it possible to operate normally using defp ?
    James Carlson

    Hello! I am using ExAws to make presigned requests. However, I am having two problems: (a) certain properties, e.g., permissios, are not set on the uploaded image file; (b) the uploaded file is corrupted, i.e., when downloaded cannot be read. Here is the function I use to build the url:

     def make_presigned_url(bucket, path, mime_type) do
        query_params = [{"ContentType", mime_type}, {"ACL", "public-read"}]
        presign_options = [query_params: query_params]
        {:ok, presigned_url} = ExAws.Config.new(:s3) 
          |> ExAws.S3.presigned_url(:put, bucket, path, presign_options)

    And here is a typical url produced in this way:


    Finally, here is the code used to upload the file:

    app.ports.uploadImage.subscribe(function (info) {
                console.log("url = " + info.url)
            var reader = new FileReader();
                reader.onload = function(e) {
                        url: info.url, // the presigned URL
                        headers: {
                            'Access-Control-Allow-Origin': '*',
                            'Content-Type': 'image/jpeg'
                        type: 'PUT',
                        processData: false,
                        data: reader.result,
                        success: function() { console.log('Uploaded data successfully.'); }

    I need help!!! :-)
    Oh -- and despite the fact that a file is uploaded to S3 with nonzero contents, there is an error message:

    XML Parsing Error: no root element found
    Location: https://s3.amazonaws.com/noteimages/jxxcarlson/carr_fire_2.jpg?ACL=public-read&ContentType=image%2Fjpeg&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJQYJYCIAWH6DGHIQ%2F20180808%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20180808T205946Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=91f071b815f64076a4f372f20f49f55805700c4b8ebeb2ef8b4b95d9dd761434
    Line Number 1, Column 1:

    A friend made this comment: looking at hexdumps of those files shows that FF D8 is converted to C3 BF C3 98 which looks like some sort of mangled UTF8 conversion

    Upload the file using the AWS uploader and see if you get the same result
    Hi all. I'm Joao from Portugal and I'm new to Elixir and Phoenix.
    Does anyone can recommend me (if exists) a lib that acts as a Soap Client ? ... like the ruby gem Savonrb ...
    Http://hex.pm might have something
    hello everyone
    I am new to elixir and trying to do what I think is a simple task without much success. I am trying to post a JSON array through the httpotion module. I build the array as a string of json object without much success. Something like that “[{‘a’:’a1’},’a’:’a2’}]”. The post looks like. HTTPotion.post url, [headers:header, body: body]. Anyone has done something like that before?
    Deric Walintukan
    Hello! I have transactions and transfers tables. The relation is transactions can have many transfers based on transaction.id. How would I go about running an ecto.query to get all the transfers for a given transaction.id and add it to the transaction payload?

    @dwalintukan The easiest way is to use preload, if I understand your question correctly. In your ecto query, just add the preload option like this: preload: [:transfers] and then when you get a transaction by ID, it will automatically have all the associated transfers as well.


    t = Transaction.get(12) #Get transaction with ID 12
    t.transfers # This should have all its associated transfers
    @neya overdependence on preload can be harmful
    I’m pretty sure @dwalintukan can do what he needs to do without preload
    @dwalintukan try this:
    Or something like that
    Paste it here
    Ecto.Query.from(fer in Transfer, join: tn in Transaction, where: fer.transaction_id == tn.id, order_by: tn.absolute_id, select: %{title: tn.basename, localizedTitle: fer.localizedname, uuid: tn.uuid, languageId: fer.language_id}) |> Repo.all
    @mazz Thanks Michael, I didn’t know that. I guess preload needs careful consideration before usage in production. I learnt something, thank you.
    @dsignr np
    Naveen Yadav

    Not sure if this is a place to ask for review.

    Looking for feedback:

    Someone can have a look at the code, if something can be improved on, I am sure there will be many things.
    In terms of features which can be added or anything genuine feedback
    I am thinking to evolve more this project to cover as much as elixir.

    Stefan Kupresak

    Hello, everyone! Nice to meet you all.
    I'm having a fair bit of trouble understanding how can I implement a "lazy" version of a function inside a context in elixir (Phoenix)

    Basically, I'd like to add a per-connection cache, which makes sure that the query executes only once, and making it transparernt to the caller.

    For example:
    Context.fetch_data(:args) # would execute a query which would fetch me my data

    -- Now, I'd like to store this for that particular request, so when another line of Context.fetch_data/1 is reached, instead of doing an SQL Query it should just get the data from RAM

    You could store query result in a cache like ETS or cachex
    Cachex has an API that will return nil if the data is not cached
    Stefan Kupresak
    Will that be per request though?
    What if you have millions of requests?
    Stefan Kupresak
    Hmm, that's true having million of requests would be bad. Though, since request lifespan is pretty short, I wanted to somehow tie the Agent with the request process, and have it killed at the end.
    The reason is that the thing I'd like to fetch is deeply inside a loop, and I have an N+1 problem. So what I want actually is only the first call per request to be cached
    Stefan Kupresak
    So, inside that deeply recursive function there's a context call.
    Context.fetch_data which fetches the data using SQL.
    I would like it ( if possible ) to somehow tie that function with self()
    So my idea was when I use Context.fetch_data, I return a pid of an agent. Which runs the query, if the query hasn't been run, but if the query has been run it doens't do that.
    Finally, when a request comes to an end the process dies, so somehow I'd like to take down the cache with it
    One hack I wanted to use is just attach that data to assigns but - I can't really do that either, since the deep recursion I'm talking about is inside an umbrella project and doens't know
    about conn
    My last resort was just use Redis but I'd really appreciate I solve this with Elixir/Phoenix since my client is against caching query result in Redis
    hopefully my rather verbose explanation makes sense?
    You should probably ask that question at elixirforum
    Stefan Kupresak
    Yeah, I'll give that a try :)