Real-Time Form Validation with Phoenix LiveView
Discover how you can build LiveView forms that validate changes and provide real-time feedback to users.
https://blog.appsignal.com/2021/09/28/real-time-form-validations-with-phoenix-liveview.html
ThinkingElixir 066: Tracing Production with Kai Wern Choong
In episode 66 of Thinking Elixir, we talk with Kai Wern Choon about his experience tracing performance problems in production. We talk about what “tracing” means in a BEAM system, available tools like recon, great resources for learning how the tools work and general approaches for troubleshooting live production Elixir systems. Kai also shares his Livebook notebook setup for demonstrating tracing techniques in an interactive way.
https://thinkingelixir.com/podcast-episodes/066-tracing-production-with-kai-wern-choong/
Deploy livebook to fly.io using a couple clicks
Fly.io has a handy GraphQL API we can use to both create and deploy apps. This app will be deploying a livebook using only your fly auth token.
https://github.com/lubien/fly-together
Deploy Phoenix to Gigalixir using Elixir Releases
A guide on deploying your Phoenix app to Gigalixir using Elixir releases. Uses runtime config (Elixir 1.11+), automated database migrations, and esbuild (Phoenix v1.6) setup.
https://staknine.com/deploy-phoenix-to-gigalixir-using-elixir-releases/
Injecting and Discovering Dependencies in OTP Supervisors
Blogpost presents several patterns for discovering sibling processes in OTP supervisors.
https://dev.to/miros/injecting-and-discovering-dependencies-in-otp-supervisors-352m
Faster test execution in Elixir
Faster testing?
Try to use setup_all to prepare the data once and re-use it in tests.
Use tags to have a better context and be able to exclude some tests.
Prepare a processing pipeline to check the quick tests first, and when they do not fail, take care of the more time-demanding tests.
More on: https://bartoszgorka.com/faster-test-execution-in-elixir
Creating Test Data with ExMachina
Learn how to use ExMachina to create test data for Elixir applications.
ThinkingElixir 065: Meet Core Team Member Aleksei Magusev
In episode 65 of Thinking Elixir, we talk with Elixir Core Team Member Aleksei Magusev about how he got involved in Elixir, what it’s like being on the Core Team, some of his contributions, areas in Elixir that interest him, and even his tips for learning a new programming language! He also shares some of his interests outside of computing. Meet Aleksei!
https://thinkingelixir.com/podcast-episodes/065-meet-core-team-member-aleksei-magusev/
What Are Atoms in Elixir and How To Monitor Them With AppSignal
In this post, we’ll show you what atoms are in Elixir, why you should monitor them, and how to do so with AppSignal:
Trans 2.3.0 released
This release incorporates some interesting new functionality:
- Allow using embedded schemas for structured translations. This is now the preferred way of using Trans
- Allow translating entire structs using the new translate/2 function
- Raise if a translation does not exist when using the new translate!/3 function
- Documentation imrovements
Additionally:
- Trans now requires Elixir 1.7 or higher
- Tests have been migrated from CircleCI to GitHub Actions
- Trans dependencies have been updated to avoid compilation warnings
Thank you.
What I do with Elixir is only made possible by the work and good will of others. I wanted to write a post to show my gratitude to the community.
Build a reactive real-time Markdown-based website with Phoenix LiveView and PardallMarkdown
PardallMarkdown is a reactive publishing framework, where you can see it in action in a video tutorial. As opposed to static website generators (such as Hugo), with PardallMarkdown, you don’t need to recompile and republish your application every time you write or modify new content. The application can be kept running indefinitely in production, while it watches a content folder for changes and the new content re-actively gets available for consumption by your application.
ElixirConf EU 2021 - short write-up from Michał Buszkiewicz
Now, that the dust after #ElixirConfEU2021 has settled, Michał Buszkiewicz wrote a short review about this event. ➡How was it? ➡How did he feel as a speaker? ➡What was the most interesting? ➡Is it worth it to go for next year’s ElixirConf EU 2022 event? Read more: https://curiosum.com/blog/elixirconf-eu-review-event #elixirlang #myelixirstatus #elixirconf #elixirconfeu
Wallaby gets a Twitter account!
Wallaby, the library for concurrent browser tests for your Elixir web apps, now has a Twitter account! Make sure to follow to keep up on the latest changes and news!
Introducing Aino, a new HTTP Framework
For the last few weeks I’ve been experimenting with a new take on Elixir HTTP frameworks. Aino is built on top of Elli and loosely based around Ring from Clojure.
Dynamic Queries in Ecto
The macro EctoQuery dynamic/2 allows you to build query fragments and interpolate them into one large query.
We get easy-to-manage query building in an accessible way. It allows you to control the parameters from the user and transparently create filtering of data stored in the database.
Check on: Dynamic Queries in Ecto
Application Code Upgrades in Elixir
Let’s look at what happens during an application code upgrading process in Elixir. https://blog.appsignal.com/2021/09/14/application-code-upgrades-in-elixir.html
ThinkingElixir 064: OTP Certificate Woes with Bram Verburg
In episode 63 of Thinking Elixir, we talk with Bram Verburg about an important root certificate expiring at the end of September and how this impacts your Elixir and Erlang projects! Bram helps explain where this IS and IS NOT a problem. He also explains the different update options available. We also get Bram’s security perspectives from his years of focused study and contributions in the Elixir and Erlang communities. A great resource for understanding the current certificate situation and for protecting your Elixir projects!
https://thinkingelixir.com/podcast-episodes/064-otp-certificate-woes-with-bram-verburg/
Arrays - Fast and versatile arrays with swappable implementations
While not as prevalent as in imperative languages, arrays (collections with efficient random element access) are still very useful in Elixir for certain situations. However, so far a stable and idiomatic array library was still missing, meaning that people often had to resort to directly using Erlang’s not-so-idiomatic :array module.
Arrays aims to be this stable, efficient and idiomatic array library.
Arrays
Arrays is a library to work with well-structured Arrays with fast random-element-access for Elixir, offering a common interface with multiple implementations with varying performance guarantees that can be switched in your configuration.
Using Arrays
Some simple examples:
Constructing Arrays
By calling Arrays.new or Arrays.empty:
iex> Arrays.new(["Dvorak", "Tchaikovsky", "Bruch"])
#Arrays.Implementations.MapArray<["Dvorak", "Tchaikovsky", "Bruch"]>
iex> Arrays.new(["Dvorak", "Tchaikovsky", "Bruch"], implementation: Arrays.Implementations.ErlangArray)
#Arrays.Implementations.ErlangArray<["Dvorak", "Tchaikovsky", "Bruch"]>
By using Collectable:
iex> [1, 2, 3] |> Enum.into(Arrays.new())
#Arrays.Implementations.MapArray<[1, 2, 3]>
iex> for x <- 1..2, y <- 4..5, into: Arrays.new(), do: {x, y}
#Arrays.Implementations.MapArray<[{1, 4}, {1, 5}, {2, 4}, {2, 5}]>
Some common array operations:
- Indexing is fast.
- The full Access calls are supported,
-
Variants of many common
Enum-like functions that keep the result an array (rather than turning it into a list), are available.
iex> words = Arrays.new(["the", "quick", "brown", "fox", "jumps", "over", "the", "lazy", "dog"])
#Arrays.Implementations.MapArray<["the", "quick", "brown", "fox", "jumps", "over", "the", "lazy", "dog"]>
iex> Arrays.size(words) # Runs in constant-time
9
iex> words[3] # Indexing is fast
"fox"
iex> words = put_in(words[2], "purple") # All of `Access` is supported
#Arrays.Implementations.MapArray<["the", "quick", "purple", "fox", "jumps", "over", "the", "lazy", "dog"]>
iex> # Common operations are available without having to turn the array back into a list (as `Enum` functions would do):
iex> Arrays.map(words, &String.upcase/1) # Map a function, keep result an array
#Arrays.Implementations.MapArray<["THE", "QUICK", "PURPLE", "FOX", "JUMPS", "OVER", "THE", "LAZY", "DOG"]>
iex> lengths = Arrays.map(words, &String.length/1)
#Arrays.Implementations.MapArray<[3, 5, 6, 3, 5, 4, 3, 4, 3]>
iex> Arrays.reduce(lengths, 0, &Kernel.+/2) # `reduce_right` is supported as well.
36
Concatenating arrays:
iex> Arrays.new([1, 2, 3]) |> Arrays.concat(Arrays.new([4, 5, 6]))
#Arrays.Implementations.MapArray<[1, 2, 3, 4, 5, 6]>
Slicing arrays:
iex> ints = Arrays.new(1..100)
iex> Arrays.slice(ints, 9..19)
#Arrays.Implementations.MapArray<[10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]>
Rationale
Algorithms that use arrays can be used while abstracting away from the underlying representation. Which array implementation/representation is actually used, can then later be configured/compared, to make a trade-off between ease-of-use and time/memory efficiency.
Arrays itself comes with two built-in implementations:
-
Arrays.Implementations.ErlangArraywraps the Erlang:arraymodule, allowing this time-tested implementation to be used with all common Elixir protocols and syntactic sugar. -
Arrays.Implementations.MapArrayis a simple implementation that uses a map with sequential integers as keys.
By default, the MapArray implementation is used when creating new array objects, but this can be configured by either changing the default in your whole application, or by passing an option to a specific invocation of new/0-2, or empty/0-1.
iex> words = Arrays.new(["the", "quick", "brown", "fox", "jumps", "over", "the", "lazy", "dog"])
#Arrays.Implementations.MapArray<["the", "quick", "brown", "fox", "jumps", "over", "the", "lazy", "dog"]>
Implementations provided by other libraries:
-
ArraysAja adds support for Aja‘s
A.Vector, which is an implementation of a ‘Hickey Trie’ vector. For most operations, it significantly outperformsErlangArrayandMapArray.
Is it fast?
yes 🎂
I’m proud to finally present a stable release of this library for you all. Work on Arrays started a few years back but was on the backburner because of other projects. Now, I finally had some time to get back to it.
The library is heavily documented, specced and (doc)tested. I’m very eager to hear your feedback! 🙂
~Marten/Qqwy
How to Read Data of Ethereum Smart Contract
The function of reading Ethereum Smart Contract by Ethereumex and ExABI!
