Where communities thrive


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

    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:

    erlang-mode

    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
    @ChintanMishra_twitter
    Looking at your error I feel there is an issue with your CI. Check if other projects have similar problem.
    Pedro Rivas
    @frobs
    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
    @ChintanMishra_twitter

    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.

    https://gitter.im/Elixir-NoSQL-Hub/Lobby

    Oleksandr Bratashov
    @abratashov
    Hello guys! Tell me please, how to quit after run IO.read(:stdio, :all) ?
    Gaurav Arora
    @gauravarora1729
    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 http://0.0.0.0:4000
    how get this to my instance IP address while running mis phx.server
    Michael
    @mazz
    What’s the error message?
    Ishizaka Tomoya
    @ghostrick
    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
    @jxxcarlson

    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)
        presigned_url 
      end

    And here is a typical url produced in this way:

    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=91f071b815f64076a4

    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.readAsBinaryString(info.fileValue);
    
                reader.onload = function(e) {
                    $.ajax({
                        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

    Michael
    @mazz
    Upload the file using the AWS uploader and see if you get the same result
    Oliveira
    @jricardooliveira
    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 ...
    Michael
    @mazz
    Http://hex.pm might have something
    Subrahmanyam
    @d-subrahmanyam
    hello everyone
    Samoko
    @samoko
    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
    @dwalintukan
    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?
    Neya
    @dsignr

    @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.

    So,

    t = Transaction.get(12) #Get transaction with ID 12
    t.transfers # This should have all its associated transfers
    Michael
    @mazz
    @neya overdependence on preload can be harmful
    I’m pretty sure @dwalintukan can do what he needs to do without preload
    Michael
    @mazz
    @dwalintukan try this:
    Or something like that
    Michael
    @mazz
    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
    Neya
    @dsignr
    @mazz Thanks Michael, I didn’t know that. I guess preload needs careful consideration before usage in production. I learnt something, thank you.
    Michael
    @mazz
    @dsignr np
    Naveen Yadav
    @navyad

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

    Looking for feedback:
    https://github.com/navyad/moviematch

    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
    @dev-cyprium

    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

    Michael
    @mazz
    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
    @dev-cyprium
    Will that be per request though?
    Michael
    @mazz
    What if you have millions of requests?
    Stefan Kupresak
    @dev-cyprium
    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
    @dev-cyprium
    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?
    Michael
    @mazz
    You should probably ask that question at elixirforum
    Stefan Kupresak
    @dev-cyprium
    Yeah, I'll give that a try :)