Ten years of Elixir! And OTP/Elixir release bonanza! 2022 edition
Let’s celebrate Elixir’s 10th anniversary. Robert will facilitate an interactive session where we share some stories about our Elixir journeys. Then a Livebook going over the latest in OTP and Elixir releases.
Testing in Phoenix LiveView - A Beginner's Guide (By a Beginner) - @dino_coder
As someone relatively new to the world of LiveView, testing highly interactive applications has been somewhat of an enigma. This talk will give a broad overview of just how simple it can be to use the LiveViewTest module for writing a range of different tests, as well as tips for avoiding brittle or flaky tests.
Creating Note taking app using LiveView and GenServer
In this blog I have demonstrated how to create a Note taking app (similar to MacOS) using GenServer and LiveView. https://abulasar.com/creating-note-taking-app-using-liveview-and-genserver-part-1
Highlighting the current page link in the Navbar menu in Phoenix LiveView
How to highlight the current menu in navbar in LiveView? https://abulasar.com/highlighting-the-current-page-link-in-the-navbar-menu-in-phoenix-liveview
Adding Infinite scroll in Phoenix LiveView App
How easily we can achieve Infinite scrolling in Liveview with Javascript Hooks. https://abulasar.com/adding-infinite-scroll-in-phoenix-liveview-app
Fetching data from external Graphql API service in Phoenix LiveView
This blog post is about querying and fetching data from external graphql api in phoenix liveview. https://abulasar.com/fetching-data-from-external-graphql-api-service-in-phoenix-liveview
5 Questions to 9 Elixir Developers for the 10th Anniversary of Elixir Language
On May 24, we all celebrated the 10th anniversary of Elixir!
It was on this occasion that we asked our Elixir developers about how they started their adventure with Elixir language, how long it took to learn Elixir to feel confident in this language, what advice that they would give to developers who want to learn the Language, and what sources they use for learning Elixir and everyday work.
If you’re curious about how #CuriousPeople do it, check out this blog post!
https://curiosum.com/blog/questions-to-elixir-developers-10th-anniversary-of-elixir-language
Elixir Meetup #6 ▶ hosted by Curiosum ▶ Gustavo Oliveira & Adolfo Neto
6th Elixir Meetup hosted by Curiosum ▶ http://curiosum.com
We discussed 2 presentations of our Elixir experts:
-
Gustavo Oliveira: TDD with Liveview simpler than you imagine! Description: We have been discussing TDD for over 10 years ago, and how good amazing is this tool for companies and developers. In this presentation, you will learn how to use TDD with Liveview and how easy, simple, fast and reliable you can build your apps using simple techniques.
-
Adolfo Neto: Learning Erlang and Elixir through Exercism and Advent of Code Description: There are numerous authorization libraries for Phoenix Framework - I will show you why none of those does it right and how we’re crafting the ecosystem’s first access control library that integrates seamlessly with both Plug and LiveView and perhaps more than that.
Lazy Sequences in Elixir and Erlang
In the article, we demonstrate and compare standard primitives for working with lazy sequences in Elixir and Erlang. While Elixir’s ones seem pretty well known, the ones from Erlang seem a bit underrated.
https://dev.to/savonarola/lazy-sequences-in-elixir-and-erlang-3mne
How LiveView got rid of dangling processes in tests – and how we can do the same
Before LiveView 0.13, testing LiveViews with database operations sometimes resulted in a big wall of red text. Then in LiveView 0.13 they were gone. I always wondered how that was fixed. I finally took a deep dive to find out.
https://germanvelasco.com/blog/how-live-view-got-rid-of-dangling-processes-in-tests
ThinkingElixir 103: Vaxine.io and CRDT DBs with James Arthur
In episode 103 of Thinking Elixir, James Arthur shares his project Vaxine.io, an Elixir layer built on top of a CRDT based distributed Erlang database called Antidote DB. We cover what CRDTs are and introduce how they work. We learn more about Antidote DB, the CURE protocol and especially the Vaxine.io project that adds Ecto types and makes it more approachable to Elixir applications. As applications become more global, the need for strongly consistent distributed writes is more important.
A Guide to Phoenix LiveView Assigns
Let’s demistify LiveView assigns and see how they work in practice. https://blog.appsignal.com/2022/06/14/a-guide-to-phoenix-liveview-assigns.html
OLEDVirtual 1.0.0 released
Today, OLEDVirtual 1.0.0 got released. It is a library to mock the oled library for local development.
Now you can code interactions with an OLED screen without building a Nerves firmware and deploying it into the device for each change.
It also comes with a MultiDisplay module to power both the real OLED screen and the virtual display at the same time, which is great if you want to keep a display preview in your web interface using e.g. Phoenix LiveView (guide included).
- Hex: https://hex.pm/packages/oled_virtual
- Documentation: https://hexdocs.pm/oled_virtual/
- GitHub: https://github.com/pappersverk/oled_virtual
Dealing with idempotence in Elixir projects with the Ecto sandbox: benefits and points to consider
As a QA team, we quickly faced a challenge encountered by all teams when they build their test automation solution: successfully controlling our environment and restoring our initial dataset in order to respect the idempotence of executions. To manage this, we chose to activate the Ecto sandbox for our Cypress tests. In this article, we will focus on the benefits of this sandbox as well as the things to look out for from a QA perspective.
wxErlang Hello World
In this post I explore wxErlang, a binding for wxWidgets. https://hidnasio.github.io/elixir/wxerlang/2022/06/08/wx-erlang-hello-world.html
TypeCheck v0.12.0 released
Version 0.12.0 of TypeCheck has been released! 🚀
Additions:
Per-dependency configuration
The default options used are now fetched from the application configuration.
This means that you can configure a default for your app as well as for each of your dependencies(!) by adding config :app_name, :type_check […] to your configuration file(s).
(This configuration can then further be overridden per module, which was already possible in earlier versions.)
Building types and checks for external functions
If you want to use types from modules outside of your control, until now you had to manually recreate them. Now, the TypeCheck.External module allows fetching the ‘normal’ types and specs from a compiled module. Specifically:
-
TypeCheck.Externalmodule, with functions to work with typespecs in modules outside of your control.-
fetch_specto build a TypeCheck type from any function that has a@spec. -
fetch_typeto build a TypeCheck type from any@type. -
enforce_spec!to wrap a call to any function that has a@specwith a runtime type-check on the input parameters and return value. -
applyandapply!to wrap a call to any function with the function spec type that you give it.
-
iex> TypeCheck.External.enforce_spec!(Kernel.abs(-13))
13
iex> TypeCheck.External.enforce_spec!(Kernel.abs("hi"))
** (TypeCheck.TypeError) At lib/type_check/external.ex:175:
`"hi"` is not a number.
This functionality is still very new, so we consider it to be a little experimental. In the near future, it might be integrated further with the rest of the library. For instance, we might add syntactic sugar to make ‘type overrides’ easier.
I want to take this opportunity to thank @orsinium greatly. Both the idea and the implementation of this functionality is his work! :star_struck:
Defstruct!
TypeCheck.Defstruct.defstruct!, a way to combine defstruct, @enforce_keys and the creation of the struct’s type, reducing boilerplate and the possibility of mistakes. (c.f. #118 )
Example:
defmodule User do
use TypeCheck
use TypeCheck.Defstruct
defstruct!(
name: "Guest" :: String.t(),
age: _ :: non_neg_integer()
)
end
is syntactic sugar for:
defmodule User do
use TypeCheck
use TypeCheck.Defstruct
@type! t() :: %User{
name: String.t(),
age: non_neg_integer()
}
@enforce_keys [:age]
defstruct [:age, name: "Guest"]
end
Fixes:
- Long-standing issue where Dialyzer would sometimes complain in apps using TypeCheck is resolved. (c.f. #95)
-
Creation of the new
maybe_nonempty_listtype will no longer get stuck in an infinite loop on creation. (c.f. #120)
This new release is just in time for ElixirConf.EU where I will be speaking about TypeCheck. I look forward to see a lot of you there (live or virtually)!
There will also be stickers! 😊
As always, you can find TypeCheck on Hex.PM, on GitHub and on the Elixir forum.
ThinkingElixir 102: Machine Learning in Elixir with Sean Moriarity
In episode 102 of Thinking Elixir, Sean Moriarity, the author of Genetic Algorithms in Elixir, lays out Machine Learning in the Elixir space. We talk about where it is today and where it’s going in the future. Sean talks more about his book, how that led to working with José Valim which then led to the creation of Nx. He fills us in on recent ML events with Google and Facebook and shows us how Elixir fits into the bigger picture. It’s a fast developing area and Sean helps us follow the important points even if we aren’t doing ML ourselves… because our teams may still need it.
Elixir Code Smells with Lucas Vegi and Marco Tulio
In this episode we talk with Lucas Vegi, professor at UFV and PhD student at UFMG, and Marco Tulio Valente, professor at UFMG, about the paper entitled Code Smells in Elixir: Early Results from a Grey Literature Review
English subtitles available
https://www.elixiremfoco.com/episode?id=lucas-vegi-e-marco-tulio
Is the test LiveView immutable or not?
Someone from my Testing LiveView course recently asked me about the immutability of the view we get from live/2 in LiveView tests. It’s not the first time someone’s asked me that question, so I wanted to try to clarify things a bit.
I hope this helps others too!
https://www.germanvelasco.com/blog/is-the-test-liveview-immutable-or-not
