profile
viewpoint
José Valim josevalim @dashbitco Kraków, Poland https://dashbit.co/ Creator of @elixir-lang. Chief Adoption Officer at @dashbitco, working on https://bytepack.io/.

elixir-ecto/postgrex 768

PostgreSQL driver for Elixir

aaronrenner/phx_gen_auth 461

An authentication system generator for Phoenix 1.5+ applications.

josevalim/enginex 452

An executable which creates a bare Rails 3 engine (which is used in Crafting Rails Applications)

elixir-ecto/db_connection 201

Database connection behaviour

devinus/markdown 81

A simple Elixir Markdown to HTML conversion library

asaaki/cmark.ex 63

Elixir NIF for cmark (C), a parser library following the CommonMark spec, a compatible implementation of Markdown.

elixir-plug/mime 62

A read-only and immutable MIME type module for Elixir

josevalim/defmodulep 55

API for defining and requiring private modules.

josevalim/lego-lang 52

A kernel language specification

pull request commentelixir-ecto/db_connection

Replace deprecated stacktraces and bump requirements

:green_heart: :blue_heart: :purple_heart: :yellow_heart: :heart:

sabiwara

comment created time in 2 hours

push eventelixir-ecto/db_connection

sabiwara

commit sha 7c2dedba49c87bb7569707321bc06776c3610e25

Replace deprecated stacktraces and bump requirements (#224)

view details

push time in 2 hours

PR merged elixir-ecto/db_connection

Replace deprecated stacktraces and bump requirements

Replace deprecated System.stacktrace() by __STACKTRACE__ to fix warnings in Elixir 1.11. Bumped minimal elixir version accordingly to 1.7 (like ecto's current release)

+14 -17

1 comment

5 changed files

sabiwara

pr closed time in 2 hours

issue commentfishcakez/connection

Implement child_spec/1 in __using__

Please do provide a PR, yes. :)

hissssst

comment created time in 2 hours

pull request commentelixir-lang/elixir

Fix copy paste mistake in String.capitalize docs

:green_heart: :blue_heart: :purple_heart: :yellow_heart: :heart:

tomekowal

comment created time in 8 hours

push eventelixir-lang/elixir

Tomasz Kowal

commit sha 62aa2ee33cb121798c72900d81f275a9d7fc9643

Fix copy paste mistake in String.capitalize docs (#10369)

view details

push time in 8 hours

PR merged elixir-lang/elixir

Fix copy paste mistake in String.capitalize docs

String.capitalize uppercases first letter. Looks like a copy-paste mistake from the function above it :)

+1 -1

0 comment

1 changed file

tomekowal

pr closed time in 8 hours

push eventtomekowal/elixir

José Valim

commit sha 1c092ccff4dfd6ebde78eb6f6dd1001b707bdaaa

Update lib/elixir/lib/string.ex Co-authored-by: Hassan Shaikley <hassan.shaikley@gmail.com>

view details

push time in 8 hours

push eventtmbb/makeup

José Valim

commit sha 19f405e50b85d44f1764b7e12345314c147f5f26

Include the C lexer

view details

push time in 8 hours

issue commentelixir-plug/plug

Proposal: Split Plug.SSL into multiple smaller plugs

Plug.SSL can call Plug.RewriteOn.init/1 in its init/1 and call Plug.RewriteOn.call/2 with the result of init in its call/2. I wouldn't change anything else only extract the rewrite_on function to a separate module.

sascha-wolf

comment created time in a day

push eventphoenixframework/phoenix_live_view

José Valim

commit sha a45e34f9930c736b2636ce4ee792ae60331d8c8d

Introduce render_inner Prior to this commit, parent @assigns in the inner content wold always be bound to the changed from their last render. This commit addresses this issue by cleaning the parent change tracking whenever @inner_content is re-rendered without having any changes. This means changing a component with a @inner_content block is now more efficient. The downside is that this is a backwards incompatible change. As the @inner_content handling got more complex, we introduced a `render_inner/2` function.

view details

José Valim

commit sha 81e1605076343eb071fb47f82168502c2495b0d7

Run formatter

view details

push time in a day

issue commentelixir-plug/plug

Proposal: Split Plug.SSL into multiple smaller plugs

I believe it is reasonable to move the rewrite rules to their own plug but I am concerned about separating HSTS and the redirect, especially because forgetting to redirect weakens the benefits of HSTS. I assume though extracting the rewrite rules will already make your life easier? :) If so, we can extract them to Plug.RewriteOn. Thanks for the proposal!

sascha-wolf

comment created time in a day

push eventphoenixframework/phoenix_live_view

José Valim

commit sha a493cd7962e22da3d2af3f8742bb66281baedaf2

Improve var tracking inside live/render

view details

push time in a day

push eventphoenixframework/phoenix_live_view

José Valim

commit sha 88bda6d1690b1326a00f45528ba127161bd97be0

Look into existing assigns to track changes

view details

push time in a day

push eventelixir-lang/elixir

José Valim

commit sha 32f9b4c2f0593e352027245872941cc5c4b53866

Update CHANGELOG

view details

push time in a day

push eventelixir-lang/elixir

José Valim

commit sha cec1a7190b5cdad658a3fa5356a4c23fd4567fe1

Make config/runtime.exs deep merge, closes #10365

view details

José Valim

commit sha 0f1200f99b40d5ace1fe87382a0f636d0635f58b

Add a note on async_stream+take

view details

José Valim

commit sha b4845e68547fed5e034159d2b90dc59b49aff261

Update iso.ex

view details

push time in a day

push eventelixir-lang/elixir

José Valim

commit sha 78c05c2db7576c2471759487271ab1b79e6e7c2a

Make config/runtime.exs deep merge, closes #10365

view details

push time in a day

issue closedelixir-lang/elixir

Keyword Lists in runtime.exs overwritten rather than deep merged

Environment

  • Elixir & Erlang/OTP versions (elixir --version):
Erlang/OTP 22 [erts-10.7.2.3] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe]

Elixir 1.11.0-rc.0 (compiled with Erlang/OTP 22)
  • Operating system: Linux (Debian) 4.19.0-10-amd64

Current behavior

Using the new runtime.exs in development, if I specify a key in either config.exs or dev.exs and also specify that key in runtime.exs, the keys are not merged, instead the key is replaced by the value defined in runtime.exs. E.g. if I specify:

config.exs:

config :my_app, :somekey, base_thing: "from config.exs"

and dev.exs:

config :my_app, :somekey, second_thing: "from dev.exs"

And start my app, then Application.get_env(:my_app, :somekey) will return:

[base_thing: "from config.exs", second_thing: "from dev.exs"]

E.g. the keys will have been merged which lines up with what I expected from here: https://hexdocs.pm/elixir/master/Config.html#config/3

If I then add to runtime.exs:

config :my_app, :somekey, third_thing: "from runtime.exs"

then Application.get_env(:my_app, :somekey) now returns:

[third_thing: "from runtime.exs"]

E.g. it's overwritten rather than merged.

Expected behavior

Based on https://hexdocs.pm/elixir/master/Config.html#config/3 I'd have expected the keys to me merged, totally possible it's by design that these don't merge but if so might be worth flagging in the upcoming documentation that config/3 behaviours slightly differently here.

Intuitively I'd have expected the above to return:

[base_thing: "from config.exs", second_thing: "from dev.exs", third_thing: "from runtime.exs"]

closed time in a day

TalkingQuickly

push eventelixir-lang/elixir

José Valim

commit sha 2c354b9709231745f34f355c58fd18329fed8206

Fallback to regular attribute lookup

view details

push time in a day

issue commenthexpm/hex

Tool for finding what pulls in a dependency

I think it belongs to Elixir indeed. We likely wouldn't track it in our issues tracker but a PR is definitely welcome!

davydog187

comment created time in a day

push eventtmbb/makeup

José Valim

commit sha 13fa4d4c14313d227efb573e720241d1f5d6eca8

Release v1.0.4

view details

push time in a day

created tagtmbb/makeup

tagv1.0.4

Syntax highlighter for elixir inspired by Pygments

created time in a day

created tagdashbitco/nimble_csv

tagv1.0.0

A simple and fast CSV parsing and dumping library for Elixir

created time in a day

push eventdashbitco/nimble_csv

José Valim

commit sha 8209dccaf6fa35fe2f40f313548eb098b84a24a3

Release v1.0.0

view details

push time in a day

push eventdashbitco/mox

José Valim

commit sha f462eee04626480ed925d37f0cf67721d3c2ca97

Release v1.0.0

view details

José Valim

commit sha d138398b12b133a6cbdc45c9ecd5002e83e04a09

Update README

view details

push time in a day

created tagdashbitco/mox

tagv1.0.0

Mocks and explicit contracts in Elixir

created time in a day

created tagelixir-gettext/gettext

tagv0.18.2

Internationalization and localization support for Elixir.

created time in a day

push eventelixir-gettext/gettext

José Valim

commit sha 9df6f4e74038c9c7c212c3248fb33cc57ae5dc22

Use compile_env if available

view details

José Valim

commit sha 525026ee2348d1aa9b5af769f2ad96c65d11624c

Release v0.18.2

view details

push time in a day

push eventelixir-gettext/gettext

José Valim

commit sha 91c0585b876d83140314e9ebc7d7a1d8ba061821

mix format

view details

push time in a day

push eventelixir-gettext/gettext

José Valim

commit sha a850ce8013be3c997143b8ed225c4081e9a412f5

Allow plural forms to be set for gettext as a whole Closes #264. Closes #179.

view details

push time in a day

issue closedelixir-gettext/gettext

Unhelpful helptext for UnknownLocaleError in mix gettext.merge

So I was trying to generate .po files for Swiss German by running mix gettext.merge priv/gettext --locale=gsw_CH. This errors, as the pluraliser does not know of gsw.

However, the error is misleading, it says:

20:39:42.885 [error] Task #PID<0.183.0> started from #PID<0.94.0> terminating
** (Gettext.Plural.UnknownLocaleError) unknown locale "gsw". If this is a locale you need to handle,
consider using a custom pluralizer module instead of the default
Gettext.Plural. You can read more about this on the Gettext docs at
https://hexdocs.pm/gettext/Gettext.Plural.html

If you read the text, and do as suggested, by creating a custom pluralizer, the problem persists. As already discussed in #179, the custom pluralizer does not work when running mix gettext.merge.

So the error message is downright misleading. I just spent quite a while banging my head on this wall.

As it turns out, simply specifying the number of plural forms works, like this:

mix gettext.merge priv/gettext --locale=gsw_CH --plural-forms=2

I think that either the error message should be changed, or there should be a fallback value (as also mentioned in #179), just my two rappen.

closed time in a day

mikl

issue closedelixir-gettext/gettext

Compile interpolation in gettext_noop

Hi,

I have MyProject.FormValidator module where I check and collect errors for a form. And I implement the Gettext for errors with dgettext_noop e.g.:

defp validate_markets([]) do 
  {:error, dgettext_noop("errors", "Need to pick at least 1 market")}
end

And use this validator module in live_view with function method:

defp display_error(errors, field) do
  ~E"""
      <span class="form__message form__message--error">
        <%= Gettext.dgettext(Web.Gettext, "errors", Keyword.get(errors, field)) %>
      </span>
  """
end

Works perfect, but I have few validation errors with interpolation with module attribute:

defp validate_markets(markets) when length(markets) > @max_markets do
  {:error, dgettext_noop("errors", "maximum %{max_markets} markets allowed")}
end

But unfortunately it not possible to use like this.

Maybe it possible to implement dgettext_noop/gettext_noop with dynamic variables like for Gettext.gettext(Web.Gettext, dynamic_variable) ? Make sense?

If it possible, I would like to help with it.

Thank you.

closed time in a day

vermaxik

issue commentelixir-gettext/gettext

Compile interpolation in gettext_noop

Hi @vermaxik! Sorry for the delay on this.

I misunderstood your original request: for me you wanted to pass the bindings to gettext_noop, which would be doable, but we can't make gettext_noop dynamic because the whole point of _noop is to see the string at compilation time, so we can generate .po files. Therefore it makes sense you were running into that error, as that is a requirement.

I apologize for sending you down the wrong path. I hope you could at least learn a thing or two about the codebase though. :)

Thank you!

vermaxik

comment created time in a day

push eventphilss/hex

José Valim

commit sha 08db1b73336230580d8be41b66a310c22268594f

Update hex.repo.ex

view details

push time in a day

issue commentelixir-ecto/ecto

Repo.preload on a list that has the same register twice duplicates the assocs that were already preloaded

As most releases, it will be out when it will be out. :)

kelvinst

comment created time in a day

created tagphoenixframework/phoenix_ecto

tagv4.2.1

Phoenix and Ecto integration with support for concurrent acceptance testing

created time in a day

push eventphoenixframework/phoenix_ecto

José Valim

commit sha d00a52ddccb4b57e4b96c92154ab602bf60feabb

Release v4.2.1

view details

push time in a day

PR closed phoenixframework/phoenix_live_view

assign_new/3 that can check/update multiple keys

This is related to #1158, I wanted to see if I could implement an assign_new/2 that can update multiple assigns using one function that returns a map or keyword list.

But of course that is not possible, because you could not possibly know in advance which keys the function would return without calling the function.

So instead, I created a version of assign_new/3 that takes a list of atoms as the second argument instead of a single atom. The function must then return either a keyword list or a map.

Examples:

@socket
|> assign(existing: "existing", existing2: "existing2", existing3: "existing3")
# no-op
|> assign_new([:existing], fn -> [existing: "updated-existing"] end)
# changes :existing2 (should it?), adds notexisting
|> assign_new([:existing2, :notexisting], fn ->
%{existing2: "changed-existing2", notexisting: "new-notexisting"}
end)
# adds :notexisting4 (should it?)
|> assign_new([:notexisting3], fn -> %{notexisting4: "new-notexisting4"} end)

Two design questions came up (as seen in the examples above):

  1. Should it should update existing keys if the function is called (because a different key didn't exist)
  2. Should it add keys present in the function result that were not specified in the test condition?

In the current implementation, I answered Yes to both.

Note that this is my first time digging into the live view code and I'm also still fairly new to Elixir. If the patch doesn't look good, adds too much complexity, or doesn't seem helpful, ok to close. :-)

+61 -0

1 comment

2 changed files

anamba

pr closed time in a day

pull request commentphoenixframework/phoenix_live_view

assign_new/3 that can check/update multiple keys

Hi @anamba! The patch looks great, awesome job!

Given our previous discussion though, we don't plan to support this feature, as I personally think writing the conditional explicit is probably easier to parse and understand all of the different scenarios.

In any case, thanks for the PR! :heart:

anamba

comment created time in a day

issue closedphoenixframework/phoenix_ecto

Phoenix.Ecto.CheckRepoStatus throws error in CLI if database "postgres" is not used

Environment

  • Elixir version (elixir -v): Elixir 1.10.4 (compiled with Erlang/OTP 23)
  • Phoenix version (mix deps): 1.5.5
  • Operating system: macos catalina
  • Browsers you attempted to reproduce this bug on (the more the merrier): chrome

Actual behavior

  1. setup fresh project mix phx.new test
  2. since I'm using heroku postgres, I'm not able to setup database with mix ecto.create. Heroku also doesn't allow you to change any database credentials. Instead I changed config in /config/dev.exs to
# Configure your database. 
config :test, Test.Repo,
  adapter: Ecto.Adapters.Postgres,
  url: "postgres://...",
  pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10"),
  ssl: true
  1. on server start mix phx.server all looks good, I've got following in CLI
/Users/michalsvrcek/workspace/elixir/test (master*) $ mix phx.server
Compiling 1 file (.ex)
[info] Running TestWeb.Endpoint with cowboy 2.8.0 at 0.0.0.0:4000 (http)
[info] Access TestWeb.Endpoint at http://localhost:4000

webpack is watching the files…

[hardsource:2a797f91] Using 1 MB of disk space.
[hardsource:2a797f91] Tracking node dependencies with: package-lock.json.
[hardsource:2a797f91] Reading from cache 2a797f91...
Hash: dd875ba43d3afcc1aac8
Version: webpack 4.41.5
Time: 153ms
Built at: 09/23/2020 3:19:34 PM
                Asset       Size  Chunks             Chunk Names
       ../css/app.css   10.7 KiB     app  [emitted]  app
       ../favicon.ico   1.23 KiB          [emitted]  
../images/phoenix.png   13.6 KiB          [emitted]  
        ../robots.txt  202 bytes          [emitted]  
               app.js   13.5 KiB     app  [emitted]  app
Entrypoint app = ../css/app.css app.js
[0] multi ./js/app.js 28 bytes {app} [built]
    + 5 hidden modules
  1. when I open http://localhost:4000
[error] GenServer #PID<0.513.0> terminating
** (Postgrex.Error) FATAL 42501 (insufficient_privilege) permission denied for database "postgres"

User does not have CONNECT privilege.
    (db_connection 2.2.2) lib/db_connection/connection.ex:87: DBConnection.Connection.connect/2
    (connection 1.0.4) lib/connection.ex:622: Connection.enter_connect/5
    (stdlib 3.13.1) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Last message: nil
State: Postgrex.Protocol
[info] GET /
[debug] Processing with TestWeb.PageController.index/2
  Parameters: %{}
  Pipelines: [:browser]
[info] Sent 200 in 67ms

Expected behavior

As talked on freenode with @ericmj and @nicd, this comes from plug Phoenix.Ecto.CheckRepoStatus, otp_app: :test which is not using Repo config, but instead trying to connect to default postgres database. I'm new to elixir, so it's hard to me to say what is expected behaviour, but I would expect it to either use config from Repo used everywhere in the app, or pop some message in CLI that will be more user friendly instead of connection error. As a newcomer to Elixir, I spent few hours trying to save this till the guys helped me on freenode.

closed time in a day

svrcekmichal

push eventphoenixframework/phoenix_ecto

José Valim

commit sha 6e1c394ad56d92deb288246228ced0f15e3aa8dd

Only check for storage if we cannot check for migrations This reduce the amount of operations for successful cases and avoid issues for when we can't check the storage in the first place. Closes #133.

view details

push time in a day

push eventelixir-ecto/ecto

José Valim

commit sha 8db270337497a2c66807235a2be9c199a1a47997

Do not accumulate previously preloaded values when element is repeated in collection, closes #3421

view details

push time in a day

issue closedelixir-ecto/ecto

Repo.preload on a list that has the same register twice duplicates the assocs that were already preloaded

Environment

  • Elixir version (elixir -v):

$ elixir -v Erlang/OTP 22 [erts-10.7.1] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [hipe]

Elixir 1.10.3 (compiled with Erlang/OTP 21)

  • Database and version (PostgreSQL 9.4, MongoDB 3.2, etc.):

PostgreSQL 12.1

  • Ecto version (mix deps):

Tested on master, the issue still there

  • Database adapter and version (mix deps):
  • Operating system:

Current behavior

So, I guess this code explains better than words:

    p1 = TestRepo.insert!(%Post{title: "1"})
    # We use the same text to expose bugs in preload sorting
    %Comment{id: cid1} = TestRepo.insert!(%Comment{text: "1", post_id: p1.id})
    %Comment{id: cid2} = TestRepo.insert!(%Comment{text: "2", post_id: p1.id})

    assert %Ecto.Association.NotLoaded{} = p1.comments

    [p1, p1] = TestRepo.preload([p1, p1], :comments)
    assert [%Comment{id: ^cid1}, %Comment{id: ^cid2}] = p1.comments |> sort_by_id

    [p1, p1] = TestRepo.preload([p1, p1], :comments)
    assert [%Comment{id: ^cid1}, %Comment{id: ^cid2}] = p1.comments |> sort_by_id

I actually implemented this integration test in my fork: https://github.com/kelvinst/ecto/blob/repeated-preload-fix/integration_test/cases/preload.exs#L27-L55

Expected behavior

The test mentioned should pass, but it actually fail with this message:

Captura de Tela 2020-09-24 às 18 07 56

As you can see in the print, it duplicates the associations that were preloaded for the second time.

Some more details I got from my investigations:

  1. It actually duplicates by the amount of repeated resources on the preload list, so if I do TestRepo.preload([p1, p1, p1], :comments) for example, it would load 3 instances of the same association on the preloaded field
  2. It just happens if it is already preloaded
  3. If you run it again, it will duplicate the instances once more

closed time in a day

kelvinst

pull request commentelixir-gettext/gettext

Update misc info

:green_heart: :blue_heart: :purple_heart: :yellow_heart: :heart:

chulkilee

comment created time in a day

push eventelixir-gettext/gettext

Chulki Lee

commit sha f5f232ba3abf555c507a15ed46fd08f44b6a3339

Update misc info (#265)

view details

push time in a day

PR merged elixir-gettext/gettext

Update misc info
  • Use SPDX short identifier for license
  • Fix github repo url
  • Update mix.lock, dropping earmark by updating ex_doc
+3 -4

0 comment

2 changed files

chulkilee

pr closed time in a day

pull request commentelixir-plug/mime

Update

:green_heart: :blue_heart: :purple_heart: :yellow_heart: :heart:

chulkilee

comment created time in a day

push eventelixir-plug/mime

Chulki Lee

commit sha 982dff19f0cfd7879d856f237212709e020529c6

Update (#40)

view details

push time in a day

PR merged elixir-plug/mime

Update
  • Use SPDX identifiers
  • Update github repo url
  • Update docs deps, dropping earmark
+6 -8

0 comment

3 changed files

chulkilee

pr closed time in a day

issue closedphoenixframework/phoenix_live_view

assign_new/2?

Would it be possible to get an assign_new/2 (map/keyword list version)?

I have a case where I'm doing paging, so I set two assigns that are related to each other (a list of objects, plus a flag indicating whether there are more available to be fetched) and in order to make it work with assign_new/3, I had to assign a tuple. Then, to avoid creating variables in the template, I had to use elem/1.

Edit: After posting, I realized why this doesn't make sense, but let me think about it a little bit more and see if there's a simple alternative.

closed time in a day

anamba

issue commentphoenixframework/phoenix_live_view

assign_new/2?

@anamba there are two possible assign_new:

assign_new(socket, foo: fn -> ... end, bar: fn -> ... end)

or:

assign_new(socket, fn -> [foo: ..., bar: ...] end)

The first is just syntax sugar for the current syntax, so not really helpful. We could make it so invoke the functions if any assign changed but I think that can be confusing.

The issue with the second is how would we know when to invoke the function? The keys are returned only when we execute the function, so we can't distinguish it before.

Given that assign_new is just a convenience for if+assign, I think for more complex cases it is best to roll your own. :) Thanks for pinging though!

anamba

comment created time in a day

issue commentphoenixframework/phoenix_html

Button data-to query string dropped

A PR to improve the docs sounds great then!

mattludwigs

comment created time in 2 days

issue commentelixir-ecto/ecto

Repo.preload on a list that has the same register twice duplicates the assocs that were already preloaded

Thanks! Is it a regression? Was it working on v3.4.x?

kelvinst

comment created time in 2 days

issue closedelixir-lang/elixir

Why I can't install elixir with erlang 23+ on FreeBSD

Trying install elixir on FreeBSD 12.1, but I couldn't manage to install it with Erlang 23+. I used pkg and also tried to make install from /usr/ports/lang/elixir but the same, it always install with Erlang 21.

Screen Shot 2020-09-24 at 21 23 18

Because I develop with Elixir 1.10.4 with Erlang 23.1 on my local machine, and I doubt maybe I will face some issues when I recompile it on my FreeBSD server.

closed time in 2 days

alaadahmed

issue commentelixir-lang/elixir

Why I can't install elixir with erlang 23+ on FreeBSD

Hi @alaadahmed ! I recommend reaching out to Elixir Forum (or similar) for support because this seems to be a FreeBSD issue in particular. Maybe you can explicitly ask it to install Erlang before? We don’t maintain the Erlang packages for FreeBSD so it is not an area we have expertise with. Thanks!

alaadahmed

comment created time in 2 days

issue commentdashbitco/nimble_csv

Transform stream to line based one before trying to parse

A PR is welcome! Although I would expose it as a separate function, as to not add overhead to the existing parse_stream. :)

LostKobrakai

comment created time in 2 days

push eventdashbitco/nimble_csv

José Valim

commit sha bc6dbed18310591f5e7c5d9ef3d78eaf3210cb7a

Document line behaviour on stream

view details

push time in 2 days

issue commentphoenixframework/phoenix_html

Button data-to query string dropped

We build a form behind the scenes and because of that the query parameters are stripped. Maybe we can automatically convert the query parameters into form inputs but that would require some extra JavaScript code. The other option is to perhaps document this behaviour so maybe it will help avoid further confusion in the future.

mattludwigs

comment created time in 2 days

issue closedelixir-gettext/gettext

[Question] Reload PO files at runtime

Hello all 👋 ,

I'm new to Elixir so first I want apologize in advance if my understanding of the problem I'm facing is not correct.

I'm working on an application that stores translations in a software localization management platform (Transifex, PhraseApp,..). We use their API to download and store the different PO files into the Phoenix priv directory (at runtime). Then in our different Phoenix views we get the translation using Gettext.dgettext(MyApp.Gettext, "app-content", my_translation_key). This works well in development thanks to code reloading, now I'm wondering if there is a way to make it work in production 🤔.

As Gettext needs to compile PO files into Elixir code I don't see how to make it refresh the new PO files I download at runtime. But this would be very convenient as otherwise we have to redeploy our application every time we create / update translation.

Do you think this is a workflow that could be implemented using the Gettext library? Maybe using a custom backend?

Thanks 🙂

closed time in 2 days

nsprod

issue commentelixir-gettext/gettext

[Question] Reload PO files at runtime

Closing this as this is a bigger change. If someone wants to work on it, please let us know!

nsprod

comment created time in 2 days

delete branch elixir-lang/elixir-lang.github.com

delete branch : jv-heroku

delete time in 2 days

pull request commentelixir-lang/elixir-lang.github.com

Heroku case

:green_heart: :blue_heart: :purple_heart: :yellow_heart: :heart:

josevalim

comment created time in 2 days

push eventelixir-lang/elixir-lang.github.com

José Valim

commit sha 2bde6f4323a1e09bbbc29aa7b082ff749cef873d

Heroku case (#1442)

view details

push time in 2 days

PullRequestEvent

pull request commentelixir-lang/elixir

Use timer function instead of manually calculating milliseconds

I think we can leave it open for a while for discussion and merge based on feedback or close if there is no activity. :)

pdgonzalez872

comment created time in 2 days

PullRequestReviewEvent

push eventdashbitco/nimble_parsec

José Valim

commit sha d660d26ce4314d4e4a4115f9505db15e1193c8e9

Improve docs

view details

push time in 2 days

pull request commentdashbitco/nimble_parsec

Add position as possible value for :line

:green_heart: :blue_heart: :purple_heart: :yellow_heart: :heart:

NickNeck

comment created time in 2 days

push eventdashbitco/nimble_parsec

Marcus Kruse

commit sha bff3c367515ff423d7384dcf2524b24b7cbed3f7

Add position (#78)

view details

push time in 2 days

PR merged dashbitco/nimble_parsec

Add position as possible value for :line

This PR extends the :line option when a parser is calling.

...
defparsecp :digits, ascii_char([?0..?9]) 
...
digits("657", line: {2, 4}, byte_offset: 6)

This is useful to setup the start of the parser to a specific {line, offset} and byte_offset.

+28 -4

0 comment

2 changed files

NickNeck

pr closed time in 2 days

pull request commentdashbitco/broadway_rabbitmq

Clarify documentation for :on_success and :on_failure

:green_heart: :blue_heart: :purple_heart: :yellow_heart: :heart:

nathanl

comment created time in 2 days

push eventdashbitco/broadway_rabbitmq

Nathan Long

commit sha cd033383e19c3c15b3bdabf40e3e2b96490c4adf

Clarify documentation for :on_success and :on_failure (#73)

view details

push time in 2 days

pull request commentelixir-lang/elixir

Use timer function instead of manually calculating milliseconds

Thanks for the PR!

I understand the pros here but given this is an example, I think it is also important to show the original value is in milliseconds and the explicit computation makes that explicit. It also doesn't introduce a dependency on a separate module the reader would have to get acquainted to.

Thoughts?

pdgonzalez872

comment created time in 2 days

issue commentelixir-ecto/postgrex

Support negative dates

I plan to migrate to Elixir's Calendar but we needed some features that were added just in v1.11. Also note that Date.to_iso9601 doesn't matter much because we use the wire format where we send just the amount of seconds since a given epoch and not a string representation.

zacharydenton

comment created time in 2 days

push eventelixir-lang/elixir-lang.github.com

José Valim

commit sha e2c27e96e3fa6bc67a1ba8a5c470a123ef37a6df

Apply suggestions from code review Co-authored-by: Fernando Tapia Rico <fertapric@gmail.com> Co-authored-by: Eric Meadows-Jönsson <eric.meadows.jonsson@gmail.com>

view details

push time in 2 days

Pull request review commentelixir-lang/elixir-lang.github.com

Heroku case

+---+layout: post+title: PaaS with Elixir at Heroku+author: José Valim+category: Cases+excerpt: A case study of how Elixir is being used at Heroku.+---++[Heroku](https://heroku.org) provides services and tools to build, run, and scale web applications. They enable developers and teams to focus on the design and craft of their apps. Heroku started development back in 2007, focused on the Ruby programming language, and since then, they have expanded to support multiple runtimes, either officially or via buildpacks.++As the platform grew, their engineering teams also adopted different languages, one of them being Elixir. In this article, we will talk about how two distinct engineering teams at Heroku, the Front-end team and the Vault team, have adopted Elixir.++![Heroku](/images/cases/heroku.png)++## First steps with Elixir++The Vault team was the first team to use Elixir inside Heroku. Their team is responsible for licensing and financial services, such as invoicing, credit card payments, etc. Most of their services are used internally at Heroku.++They had to rewrite one of their existing services and that was the perfect occasion to give Elixir a try, since the difficulties and risks were mostly known. The experiment was a success: they deployed and ran their first Elixir application in production. This paved the way to use Elixir more and more.++Later on, they had a new challenge: they had to audit a large amount of data, and they knew from experience that the Ruby implementation would take too long to finish. Given they were already ramping up their familiarity with Elixir, they chose to apply [Elixir's GenStage](https://github.com/elixir-lang/gen_stage) to the problem, which is a low-level library for data processing, and that took only a couple hours. From this moment on, they were sold on the language and the platform.++## Tackling operational complexity with Elixir++The Front-end team shares a similar story: they first used Elixir to solve a well-understood problem and took it forward from there.++The Front-end engineers are responsible for maintaining all user interfaces: the CLI, the dashboard, and a bunch of backend services that work with data. One of the features they provide to Heroku customers is analytics.++At first, they were sending their analytics to Mixpanel. However, they had some issues fetching the data, due to cross-domain concerns, and they decided to replace Mixpanel by an in-house Elixir service. The service used a [Plug](https://github.com/elixir-plug/plug), a library for building web applications, and had a single endpoint.+++<blockquote style="font-size: 24px; color: #444">+<p>We were having a lot of fun and a lot of luck with it, so we kept doing it.</p>+<p style="font-size: 20px">— Micah Woods, Lead Engineer, on migrating to Elixir.</p>+</blockquote>++They later spent most of a year focused on operational stability, and during this period, they started rewriting part of their Node.js microservices into Elixir. Today they have migrated their numerous Node.js microservices into one main Elixir application with one auxiliary service for authentication. The fact that Elixir was capable of handling everything they threw at it alongside their experience with Erlang's stability - [Heroku's router uses Erlang](https://blog.heroku.com/erlang-in-anger) - allowed them to simplify their operations considerably.++## Productivity and scalability++The Front-end team has been using Elixir for two years. The team has 21 engineers: about 4 of them doing Elixir full-time, and 8 engineers altogether doing Elixir here and there.++The first service that they built with Elixir, the analytics services, receives requests and puts them into an in-memory queue to be processed within the same VM. It handles about 3k to 4k requests per second. 99% of the response times stay with 0-1ms, occasionally 4ms. They use 3 Heroku dynos for fault-tolerance - of course, Heroku uses Heroku for their own infrastructure.
The first service that they built with Elixir, the analytics services, receives requests and puts them into an in-memory queue to be processed within the same VM. It handles about 3k to 4k requests per second. 99% of the response times stay within 0-1ms, occasionally 4ms. They use 3 Heroku dynos for fault-tolerance - of course, Heroku uses Heroku for their own infrastructure.
josevalim

comment created time in 2 days

PullRequestReviewEvent

pull request commentelixir-lang/elixir

Remove duplicated assert in quote test

:green_heart: :blue_heart: :purple_heart: :yellow_heart: :heart:

gusaiani

comment created time in 2 days

push eventelixir-lang/elixir

Gustavo Saiani

commit sha 73fc537636de5d20a55e7b8057fe446d00788182

Remove duplicate assertion (#10366)

view details

push time in 2 days

PR merged elixir-lang/elixir

Remove duplicated assert in quote test

Hi all,

this PR removes what seems to be just a duplicated assert.

Cheers!

+0 -1

0 comment

1 changed file

gusaiani

pr closed time in 2 days

create barnchelixir-lang/elixir-lang.github.com

branch : jv-heroku

created branch time in 2 days

pull request commentelixir-ecto/ecto_sql

Adds ability to skip the validation of PostgreSQL constraints on create

Glorious, thank you! :green_heart: :blue_heart: :purple_heart: :yellow_heart: :heart:

jbernardo95

comment created time in 2 days

push eventelixir-ecto/ecto_sql

João Bernardo

commit sha 1d7f4b73bfa04e02a26bba8b3ea79a457850af0f

Adds ability to skip the validation of PostgreSQL constraints on create (#271) Validation of constraints in PostgreSQL can cause large tables to stay locked for a long time (preventing writes, because it has to check all rows in order to consider the constraint as valid. PostgreSQL has a way to get around this by first creating constraints as not valid. And then running a query to validate the constraint. The validation query does not lock the table, i.e. it can be run while allowing writes in parallel. This commit implements the ability to skip validation of constraints. It does not implement the validation query. This was inspired by https://github.com/elixir-ecto/ecto_sql/pull/244. https://www.postgresql.org/docs/current/sql-altertable.html

view details

push time in 2 days

PR merged elixir-ecto/ecto_sql

Adds ability to skip the validation of PostgreSQL constraints on create

Validation of constraints in PostgreSQL can cause large tables to stay locked for a long time (preventing writes, because it has to check all rows in order to consider the constraint as valid.

PostgreSQL has a way to get around this by first creating constraints as not valid. And then running a query to validate the constraint. The validation query does not lock the table, i.e. it can be run while allowing writes in parallel.

This commit implements the ability to skip validation of constraints. It does not implement the validation query.

This was inspired by https://github.com/elixir-ecto/ecto_sql/pull/244.

https://www.postgresql.org/docs/current/sql-altertable.html

+46 -8

0 comment

7 changed files

jbernardo95

pr closed time in 2 days

issue closedelixir-ecto/ecto

Support for subquery with window?

Is there a updated version that doesn't require a fragment for windowed subquery?

The currently working version is this: https://elixirforum.com/t/problem-with-window-function/9453/16

closed time in 2 days

D4no0

issue commentelixir-ecto/ecto

Support for subquery with window?

It may be doable using the over helpers added in Ecto.Query.API and the general window functions. Also, please use the forum for questions, as a wider community will be available to help you. Thanks.

D4no0

comment created time in 2 days

issue closedelixir-plug/plug

Header defaults

I have a codebase where we define our own get_req_header_with_default/3 that's essentially a wrapper around get_req_header/2 with the third parameter being a default value to return if the header wasn't sent. Would something like this be in the scope of Plug? It would be nice to keep it in a library instead of in our own code. I can make a PR if y'all think this sounds good.

I'm also all ears if there's an easy way to set defaults in Elixir — I've only been in the Elixir world for a couple weeks and would love some obscure syntax to gobble up (with my ears?)

closed time in 2 days

bintay

issue commentelixir-plug/plug

Header defaults

Hi Ben! Because headers can be duplicated, the semantics here can differ. For example, if you have two headers, do you return the default? Or what if you have one but it is invalid? For this reason, I believe a custom function is the way to go, as it makes you consider those cases and decide what is best for you. Thanks!

bintay

comment created time in 2 days

pull request commentelixir-lang/elixir

IEX help in place with tab key

Hi @pera! Given Erlang/OTP 23+ supports the docs chunk, I would rather keep this simple and not try to traverse specs at all. So can we please rollback this particular section of the code for now? Other than that, do you believe this is ready for review? :)

pera

comment created time in 2 days

pull request commentelixir-ecto/ecto_sql

Spelling

:green_heart: :blue_heart: :purple_heart: :yellow_heart: :heart:

ericlathrop

comment created time in 3 days

push eventelixir-ecto/ecto_sql

Eric Lathrop

commit sha 14ca09491832a8e5933c71d08371bb99ae8d9400

Spelling (#272)

view details

push time in 3 days

PR merged elixir-ecto/ecto_sql

Spelling
+1 -1

0 comment

1 changed file

ericlathrop

pr closed time in 3 days

pull request commentelixir-lang/elixir-lang.github.com

Fix documentation typo

:green_heart: :blue_heart: :purple_heart: :yellow_heart: :heart:

MarceloPrado

comment created time in 3 days

push eventelixir-lang/elixir-lang.github.com

Marcelo T Prado

commit sha 63ecdb4846dcaedb7efbf341a1a1ce74d09a53ef

Fix documentation typo (#1441) Update "functionalty" to "functionality"

view details

push time in 3 days

PR merged elixir-lang/elixir-lang.github.com

Fix documentation typo

Update "functionalty" to "functionality"

+1 -1

0 comment

1 changed file

MarceloPrado

pr closed time in 3 days

issue commentphoenixframework/phoenix_ecto

Phoenix.Ecto.CheckRepoStatus throws error in CLI if database "postgres" is not used

@svrcekmichal oh, so you are running against a heroku postgres database from development? :)

svrcekmichal

comment created time in 3 days

more