profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/Eiji7/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.

Eiji7/ecto 0

A toolkit for data mapping and language integrated query.

Eiji7/elixir 0

Elixir is a dynamic, functional language designed for building scalable and maintainable applications

Eiji7/elixir_quick_reference 0

Quick reference for the Elixir programming language and standard library.

Eiji7/exqlite 0

An Sqlite3 Elixir library

startedadoptoposs/mjml_nif

started time in a month

issue commentelixir-lang/elixir

kw list parsing error (releases.exs)

Parenthesis are not required if you wrap Keyword using <kbd>[</kbd> and <kbd>]</kbd> characters it would work as expected.

Simple example of raise:

IO.inspect :example,
  sample: case true do
    true -> true
    _ -> false
  end,
  something: true

Example solution:

IO.inspect :example, [
  sample: case true do
    true -> true
    _ -> false
  end,
  something: true
]
bryanhuntesl

comment created time in 2 months

issue commentelixir-nx/livebook

Livebook returns 404 Not Found for portal images

@josevalim Looks like you forgot to include image files in your commit. :smile:

Eiji7

comment created time in 2 months

issue openedelixir-nx/livebook

Livebook returns 404 Not Found for portal images

Environment

$ elixir --version
Erlang/OTP 24 [erts-12.0.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit]

Elixir 1.12.1 (compiled with Erlang/OTP 24)
$ asdf current
elixir                           1.12.1-otp-24     /home/…/.tool-versions
erlang-prebuilt-ubuntu-20-04     24.0.2            /home/…/.tool-versions
  • Operating system:
$ uname -a
Linux archlinux 5.12.1-arch1-1 #1 SMP PREEMPT Sun, 02 May 2021 12:43:58 +0000 x86_64 GNU/Linux
$ cat /etc/os-release 
NAME="Arch Linux"
PRETTY_NAME="Arch Linux"
ID=arch
BUILD_ID=rolling
ANSI_COLOR="38;2;23;147;209"
HOME_URL="https://archlinux.org/"
DOCUMENTATION_URL="https://wiki.archlinux.org/"
SUPPORT_URL="https://bbs.archlinux.org/"
BUG_REPORT_URL="https://bugs.archlinux.org/"
LOGO=archlinux
  • Livebook version:
$ git log
commit 0209ed5a26e4b01e84ee6a4ae61aff2b5442a5e7 (HEAD -> main, origin/main, origin/HEAD)
Author: josevalim <josevalim@users.noreply.github.com>
Date:   Tue Jun 8 12:55:31 2021 +0000

    Update assets
  • How have you started Livebook (mix phx.server, livebook CLI, Docker, etc):

mix phx.server

  • Browsers that reproduce this bug (the more the merrier):

Tried with Chrome and FIrefox

  • Include what is logged in the browser console:

GET http://localhost:4000/images/portals.png 404 (Not Found) Image (async) |   |   -- | -- | --   | eval | @ | phoenix_live_view.js?2c90:1   | T | @ | phoenix_live_view.js?2c90:1   | eval | @ | phoenix_live_view.js?2c90:1   | T | @ | phoenix_live_view.js?2c90:1   | eval | @ | phoenix_live_view.js?2c90:1   | T | @ | phoenix_live_view.js?2c90:1   | eval | @ | phoenix_live_view.js?2c90:1   | eval | @ | phoenix_live_view.js?2c90:1   | value | @ | phoenix_live_view.js?2c90:1   | value | @ | phoenix_live_view.js?2c90:1   | value | @ | phoenix_live_view.js?2c90:1   | value | @ | phoenix_live_view.js?2c90:1   | value | @ | phoenix_live_view.js?2c90:1   | eval | @ | phoenix_live_view.js?2c90:1   | value | @ | phoenix_live_view.js?2c90:1   | value | @ | phoenix_live_view.js?2c90:1   | eval | @ | phoenix_live_view.js?2c90:1   | eval | @ | phoenix.js?31bb:1   | value | @ | phoenix.js?31bb:1   | eval | @ | phoenix.js?31bb:1   | value | @ | phoenix.js?31bb:1   | eval | @ | phoenix.js?31bb:1   | value | @ | phoenix.js?31bb:1   | eval | @ | phoenix.js?31bb:1   | decode | @ | phoenix.js?31bb:1   | value | @ | phoenix.js?31bb:1   | conn.conn.onmessage | @ | phoenix.js?31bb:1

GET http://localhost:4000/posts/elixir/1/images/portal-drop.jpeg 404 (Not Found)   | Image (async) |   |   -- | -- | -- | --   | morphChildren | @ | morphdom-esm.js?fad8:663   | morphEl | @ | morphdom-esm.js?fad8:505   | morphdom | @ | morphdom-esm.js?fad8:720   | eval | @ | markdown.js?4436:58   | Promise.then (async) |   |     | __render | @ | markdown.js?4436:53   | Markdown | @ | markdown.js?4436:44   | eval | @ | index.js?a224:57   | eval | @ | phoenix_live_view.js?2c90:1   | eval | @ | phoenix_live_view.js?2c90:1   | eval | @ | phoenix.js?31bb:1   | value | @ | phoenix.js?31bb:1   | eval | @ | phoenix.js?31bb:1   | value | @ | phoenix.js?31bb:1   | eval | @ | phoenix.js?31bb:1   | value | @ | phoenix.js?31bb:1   | eval | @ | phoenix.js?31bb:1   | decode | @ | phoenix.js?31bb:1   | value | @ | phoenix.js?31bb:1   | conn.conn.onmessage | @ | phoenix.js?31bb:1

GET http://localhost:4000/posts/elixir/1/images/portal-list.jpeg 404 (Not Found)   | Image (async) |   |   -- | -- | -- | --   | morphChildren | @ | morphdom-esm.js?fad8:663   | morphEl | @ | morphdom-esm.js?fad8:505   | morphdom | @ | morphdom-esm.js?fad8:720   | eval | @ | markdown.js?4436:58   | Promise.then (async) |   |     | __render | @ | markdown.js?4436:53   | Markdown | @ | markdown.js?4436:44   | eval | @ | index.js?a224:57   | eval | @ | phoenix_live_view.js?2c90:1   | eval | @ | phoenix_live_view.js?2c90:1   | eval | @ | phoenix.js?31bb:1   | value | @ | phoenix.js?31bb:1   | eval | @ | phoenix.js?31bb:1   | value | @ | phoenix.js?31bb:1   | eval | @ | phoenix.js?31bb:1   | value | @ | phoenix.js?31bb:1   | eval | @ | phoenix.js?31bb:1   | decode | @ | phoenix.js?31bb:1   | value | @ | phoenix.js?31bb:1   | conn.conn.onmessage | @ | phoenix.js?31bb:1

  • Include what is logged to the server console:
[debug] ** (Phoenix.Router.NoRouteError) no route found for GET /images/portals.png (LivebookWeb.Router)
    (livebook 0.1.2) lib/phoenix/router.ex:402: LivebookWeb.Router.call/2
    (livebook 0.1.2) lib/livebook_web/endpoint.ex:1: LivebookWeb.Endpoint.plug_builder_call/2
    (livebook 0.1.2) lib/plug/debugger.ex:136: LivebookWeb.Endpoint."call (overridable 3)"/2
    (livebook 0.1.2) lib/livebook_web/endpoint.ex:1: LivebookWeb.Endpoint.call/2
    (phoenix 1.5.9) lib/phoenix/endpoint/cowboy2_handler.ex:65: Phoenix.Endpoint.Cowboy2Handler.init/4
    (cowboy 2.9.0) /home/eiji/livebook/deps/cowboy/src/cowboy_handler.erl:37: :cowboy_handler.execute/2
    (cowboy 2.9.0) /home/eiji/livebook/deps/cowboy/src/cowboy_stream_h.erl:306: :cowboy_stream_h.execute/3
    (cowboy 2.9.0) /home/eiji/livebook/deps/cowboy/src/cowboy_stream_h.erl:295: :cowboy_stream_h.request_process/3
    (stdlib 3.15.1) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
[debug] ** (Phoenix.Router.NoRouteError) no route found for GET /posts/elixir/1/images/portal-list.jpeg (LivebookWeb.Router)
    (livebook 0.1.2) lib/phoenix/router.ex:402: LivebookWeb.Router.call/2
    (livebook 0.1.2) lib/livebook_web/endpoint.ex:1: LivebookWeb.Endpoint.plug_builder_call/2
    (livebook 0.1.2) lib/plug/debugger.ex:136: LivebookWeb.Endpoint."call (overridable 3)"/2
    (livebook 0.1.2) lib/livebook_web/endpoint.ex:1: LivebookWeb.Endpoint.call/2
    (phoenix 1.5.9) lib/phoenix/endpoint/cowboy2_handler.ex:65: Phoenix.Endpoint.Cowboy2Handler.init/4
    (cowboy 2.9.0) /home/eiji/livebook/deps/cowboy/src/cowboy_handler.erl:37: :cowboy_handler.execute/2
    (cowboy 2.9.0) /home/eiji/livebook/deps/cowboy/src/cowboy_stream_h.erl:306: :cowboy_stream_h.execute/3
    (cowboy 2.9.0) /home/eiji/livebook/deps/cowboy/src/cowboy_stream_h.erl:295: :cowboy_stream_h.request_process/3
    (stdlib 3.15.1) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
[debug] ** (Phoenix.Router.NoRouteError) no route found for GET /posts/elixir/1/images/portal-drop.jpeg (LivebookWeb.Router)
    (livebook 0.1.2) lib/phoenix/router.ex:402: LivebookWeb.Router.call/2
    (livebook 0.1.2) lib/livebook_web/endpoint.ex:1: LivebookWeb.Endpoint.plug_builder_call/2
    (livebook 0.1.2) lib/plug/debugger.ex:136: LivebookWeb.Endpoint."call (overridable 3)"/2
    (livebook 0.1.2) lib/livebook_web/endpoint.ex:1: LivebookWeb.Endpoint.call/2
    (phoenix 1.5.9) lib/phoenix/endpoint/cowboy2_handler.ex:65: Phoenix.Endpoint.Cowboy2Handler.init/4
    (cowboy 2.9.0) /home/eiji/livebook/deps/cowboy/src/cowboy_handler.erl:37: :cowboy_handler.execute/2
    (cowboy 2.9.0) /home/eiji/livebook/deps/cowboy/src/cowboy_stream_h.erl:306: :cowboy_stream_h.execute/3
    (cowboy 2.9.0) /home/eiji/livebook/deps/cowboy/src/cowboy_stream_h.erl:295: :cowboy_stream_h.request_process/3
    (stdlib 3.15.1) proc_lib.erl:226: :proc_lib.init_p_do_apply/3

Current behavior

Portal images does not loads after fresh git clone (I can see all other images)

Expected behavior

All images should load

created time in 2 months

issue commentelixir-nx/livebook

Format Elixir cells

ok, makes sense

Benjamin-Philip

comment created time in 2 months

issue commentelixir-nx/livebook

Format Elixir cells

@josevalim I would like to add my 2 cents here :-)

  1. The conflict problem is not really related to livebook - it's more about team cooperation. Firstly usually 2 people should not edit same cell and such situation should be nothing more than edge case.

  2. Obviously it does not mean we should not do anything about it. However we can do it simple (or maybe I do not see something?) … Just store in memory original cell and after save broadcast a message to all users editing this cell.

With this we can add something like simple alert notifying that cell was changed (optionally show extra data like author and content of changes) and give a user to decision if we want to for example:

  1. Reload original content (maybe with simple diff like on git merge conflict?)
  2. Overwrite changed cell
  3. Cancel editing

I believe that the rest is about making internal organization decisions in team. One or two times people can simply cancel editing cell and that's completely fine. However if that would happen more often then team should do something about its organization.

Also I believe that's not really a problem of formatting, but about any kind of content conflict. I think that for 2 or more editing users we should have a forked git project and push changes to a separate branches, so we avoid all conflict problems.


Maybe in future we could have some kind of simple git support in livebook? If current livebook directory (in UI) is within a git project then maybe we should consider adding option to change/create branch and an option to automatically push changes on save?

Benjamin-Philip

comment created time in 2 months

issue commentelixir-lang/elixir

line in comments is not used in Code.quoted_to_algebra/2

@josevalim A small update … I tried same code with opts suggested by documentation:

opts = [
  literal_encoder: &{:ok, {:__block__, &2, [&1]}},
  token_metadata: true,
  unescape: true
]

source = """
defmodule Example do
  # something
  def sample, do: :ok
end
"""

{:ok, quoted, comments} = Code.string_to_quoted_with_comments source, opts

algebra = Code.quoted_to_algebra quoted, comments: comments

algebra |> Inspect.Algebra.format(80) |> IO.puts()

and the result is:

defmodule Example do
  # something
  def sample,
      [do: :ok]
end

It's really close to original, but still do keyword in function declaration is different. Am I doing something wrong?

Eiji7

comment created time in 2 months

issue commentelixir-lang/elixir

line in comments is not used in Code.quoted_to_algebra/2

Oh, my bad then. I was thinking that it would "just work". I read documentation carefully and now see why those options are important. Many thanks!

Eiji7

comment created time in 2 months

issue openedelixir-lang/elixir

line in comments is not used in Code.quoted_to_algebra/2

Hi, I'm too excited with latest changes and just can't wait for release candidate for next Elixir version. :smiling_imp:

Environment

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

Elixir 1.13.0-dev (c6145d0) (compiled with Erlang/OTP 23)
  • Operating system:
$ uname -a
Linux archlinux 5.12.1-arch1-1 #1 SMP PREEMPT Sun, 02 May 2021 12:43:58 +0000 x86_64 GNU/Linux

$ cat /etc/os-release
NAME="Arch Linux"
PRETTY_NAME="Arch Linux"
ID=arch
BUILD_ID=rolling
ANSI_COLOR="38;2;23;147;209"
HOME_URL="https://www.archlinux.org/"
DOCUMENTATION_URL="https://wiki.archlinux.org/"
SUPPORT_URL="https://bbs.archlinux.org/"
BUG_REPORT_URL="https://bugs.archlinux.org/"
LOGO=archlinux

Current behavior

line in comments is not (properly) used in Code.quoted_to_algebra/2, see:

iex> source = """
defmodule Example do
  # something
  def sample, do: :ok
end
"""

iex> {:ok, quoted, comments} = Code.string_to_quoted_with_comments source
{:ok,
 {:defmodule, [line: 1],
  [
    {:__aliases__, [line: 1], [:Example]},
    [do: {:def, [line: 3], [{:sample, [line: 3], nil}, [do: :ok]]}]
  ]},
 [%{line: 2, next_eol_count: 1, previous_eol_count: 1, text: "# something"}]}

iex> algebra = Code.quoted_to_algebra quoted, comments: comments
{:doc_force,
 {:doc_cons, {:doc_group, "# something", :self},
  {:doc_cons, :doc_line,
   {:doc_group,
    {:doc_cons, {:doc_string, "defmodule", 9},
     {:doc_force,
      {:doc_cons,
       {:doc_cons,
        {:doc_group,
         {:doc_cons, {:doc_cons, " ", {:doc_nest, "Example", :cursor, :break}},
          " do"}, :self},
        {:doc_nest,
         {:doc_cons, :doc_nil,
          {:doc_cons, :doc_line,
           {:doc_group,
            {:doc_group,
             {:doc_cons, {:doc_string, "def", 3},
              {:doc_force,
               {:doc_cons,
                {:doc_cons,
                 {:doc_group,
                  {:doc_cons, {:doc_cons, " ", {:doc_nest, {...}, ...}}, " do"},
                  :self},
                 {:doc_nest,
                  {:doc_cons, :doc_nil, {:doc_cons, :doc_line, {...}}}, 2,
                  :always}}, {:doc_cons, :doc_line, "end"}}}}, :self}, :self}}},
         2, :always}}, {:doc_cons, :doc_line, "end"}}}}, :self}}}}

iex> algebra |> Inspect.Algebra.format(80) |> IO.puts()
# something
defmodule Example do
  def sample do
    :ok
  end
end

Expected behavior

The output should be as same as from source variable.

created time in 2 months

issue commentelixir-nx/livebook

Deterministic Anchor Tags

@josevalim (…) We need to remove any character that is not valid in ID/anchor tab. For example, what is the anchor for a title of ## Hello José=!?:? You can see what GitHub does as a reference. (…)

Here is specification for HTML 4:

ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").

Source: https://www.w3.org/TR/html4/types.html#type-id

and here is specification for HTML 5:

3.2.3.1 The id attribute

The id attribute specifies its element's unique identifier (ID). [DOMCORE]

The value must be unique amongst all the IDs in the element's home subtree and must contain at least one character. The value must not contain any space characters.

Source: https://www.w3.org/TR/html5-author/global-attributes.html#the-id-attribute

Which one we would follow?

Here is a regular expressions for id validation:

# HTML 4
~r/^[A-Za-z]+[\w\-\:\.]*$/

# HTML 5
~r/^[^\s]+$/
Steven0351

comment created time in 3 months

issue commentelixir-nx/livebook

Collapse cells

In that case personally I suggest to limit visible LOC to 20-30 in livebook and make it scrollable. Here I choose max number of 20-30, because we should avoid writing longer functions. Since it's intended to typically write a code snippets then I guess that the typical max function length is best for us. For those who need or want to write a whole module scroollable content should be fine.

imsekun

comment created time in 3 months

issue commentelixir-nx/livebook

Allow a mechanism to pass environment variables to notebooks

How about importing *.env files? I don't see a need to update environment variables often and if there is a need to update them we may simply import such file again. Also we can combine mentioned inputs with such file allowing to edit it.

# Contents of example livebook.env file
MY_VARIABLE="value"
josevalim

comment created time in 3 months

issue commentelixir-nx/livebook

Consider adding HTML kbd styles

Looks good for me.

Eiji7

comment created time in 3 months

issue commentelixir-nx/livebook

Consider adding HTML kbd styles

What do you think about setting also box-shadow to 1px 1px 1px color where color is for example black, gray or #777?

Eiji7

comment created time in 3 months

issue commentelixir-nx/livebook

Consider adding HTML kbd styles

Looks like it's a bug in Earmark: pragdave/earmark#356.

Eiji7

comment created time in 3 months

issue commentelixir-nx/livebook

Consider adding HTML kbd styles

ok, things are going to be interesting …

This is content of saved file (same input):

# Test HTML

## Test section

<kbd >
Ctrl
</kbd>

and here is how it looks after opening file: screen

Eiji7

comment created time in 3 months

issue commentelixir-nx/livebook

Consider adding HTML kbd styles

Oh, is that so? Please take a look at this screen screen

Eiji7

comment created time in 3 months

issue openedelixir-nx/livebook

Consider adding HTML kbd styles

I have few use cases for mentioning keyboard shortcuts, for example:

<kbd>Ctrl</kbd>+<kbd>A</kbd>

Unfortunately currently in LiveBook there is no difference between them and rest of text. Of course markdown would be helpful here, but a different look may took attention of the reader which is important in such use case.

I would like to have some simple, but nice looking styles like on this site: https://auth0.github.io/kbd/

Github also have a custom look for it, see: <kbd>Ctrl</kbd>+<kbd>A</kbd>. For more information take a look at HTML TAGS.

Since it's only about few simple CSS rules I believe it could be added in no time. Looking forward for your opinion.

created time in 3 months