Exvalibur → Module-based validators
Starting with v0.8.0 Exvalibur accepts module-based validatiors:
defmodule Validator do
use Exvalibur, rules: [
%{
matches: %{currency_pair: <<"EUR", _ :: binary>>},
conditions: %{foo: %{min: 0, max: 100}},
guards: %{num: num > 0 and num < 100}}]
end
Validator.valid?(%{currency_pair: "EURUSD", foo: 50, num: 50})
#⇒ {:ok, %{currency_pair: "EURUSD", foo: 50, num: 50}}
Validator.valid?(%{currency_pair: "USDEUR", foo: 50, num: 50})
#⇒ :error
The Primitives of Elixir Concurrency: a Full Example
The Primitives of Elixir Concurrency: a Full Example
Let’s finally put in practice what we’ve seen about concurrency primitives in Elixir!
In this article we see how to use spawn, send and receive to make multiple concurrent HTTP requests, merging the results in a single one. Then we see how to refactor our code with Task, which makes everything easier.
The most passionate will find a small challenge at the end.
Walk Through of Phoenix Live View
With LiveView’s preview out, Elixir Schools got a walk-through on the what, why, and how of building real-time features without writing JavaScript.
Integrating Phoenix LiveView
For the SmartLogic TV stream this week, I worked on integrating LiveView into an existing application replacing a previously static admin dashboard.
How to Create a Counter with Phoenix LiveView
Last Friday, Phoenix LiveView was publicly released, allowing you to create cool applications that live update the frontend code without you writing any Javascript. This video and post cover how to set up an Elixir application for Phoenix LiveView and then how to create a counter that you can increment and decrement with all the state managed in the backend.
https://dennisbeatty.com/2019/03/19/how-to-create-a-counter-with-phoenix-live-view.html
Accessing Neo4j from Elixir with Bolt and Cypher
I just published a post today ‘Property graphs and Elixir: Accessing Neo4j from Elixir with Bolt and Cypher’.
The post shows how to access Neo4j graph databases from Elixir using the ‘bolt_sips’ package and how to query graphs using the Cypher query language.
It then shows how to create a simple graph (modified from an RDF graph) and how to import graphs and to parse out graphs from GraphGists.
And just as we can query Neo4j property graphs with Cypher, in previous posts I also showed how Elixir can be used to query RDF graphs with SPARQL. It is therefore rather intriguing to consider what role Elixir could play in moving data between these two graph worlds.
Analysis of JSON parser for Elixir
https://medium.com/@kanishkablack/analysis-of-json-parser-for-elixir-d1aed8332ce7
Well, Elixir is been moved into production in serious environments. One of the major deployment, I came across is JSON API or JSON related endpoints on Elixir application.
We have observed that, Poison used to be and still being used as JSON parser in many major modules. Now, Jason is default in phoenix application, for its performance upgrades.
This is good for small scale application, but when the application has to process 5MB/sec and when application have to process about 4–5TB/data a day. Even Jason falls short.
ElixirMix Podcast 043 - Using GenServers and Tasks Together to Create Fault-Tolerant Apps with Jack Marchant
In this episode of ElixirMix, the panel talks with Jack Marchant about his perspectives on GenServers, Tasks, and Supervisors with a unique comparison to React. We talk about coming to Elixir from PHP, finding programmers, Nerves and more!
AWS IoT Core, Elixir, and Nerves: A Crash Course
https://www.verypossible.com/blog/aws-iot-core-elixir-and-nerves-a-crash-course
Build on a solid foundation of Nerves, quickly write robust firmware in Elixir, and rocket through the clouds with AWS. Along the way this post will expose you to some of the biggest pieces of the IoT puzzle.
Event Sourcing With Elixir - Part 3
In Part 3 of this series on Event Sourcing we’ll build our first feature!
Solving the "Cannot return null for non-nullable field" error in an Absinthe GraphQL API
Solving the “Cannot return null for non-nullable field” error in an Absinthe GraphQL API when using Kronky and Elixir: https://link.medium.com/z1bmdO5Y6U
Iteraptor.Array
Iteraptor package update.
Iteraptor.Array is a naïve implementation of Array, the idea borrowed from MapSet. It wraps a list into a structure with an internal map %{index => value}. where index ∈ [0, length).
It implements Access behaviour. It could be useful if the structure requires deep access and an intermediate term is a list: simply wrap it with Array and voilà.
THINGS YOU COULD DO WITH MIX - PART 1
https://www.theguild.nl/things-you-could-do-with-mix/
Mix, is something that everybody that uses Elixir has definitely used. But you might have not discovered the power (and fun!) this little tool can bring to your workflow.
Most tutorials will show you to create the task itself as that is very straightforward, but let’s not do that. Let’s write a test first!
Decoding Dialyzer - part 1
I decided to start a new series about better understanding Dialyzer. The first post in the series goes through understanding the no_return and call warnings.
Hey Process, there is a Message for you!
Hey Process, there is a Message for you!
Messages are a fundamental part of concurrency in Elixir. In this article I introduce how messaging between processes works. We play with simple examples to see how a process sends and receives messages.
Elixir Umbrella Applications and Testing with Mox
I’ve written a post about umbrella applications and testing with Mox. Check it out at: https://simplabs.com/blog/2019/03/13/elixir-umbrella-mox.html
Test Suite as a Complexity Measuring Tool
In this post, I want to discuss how to measure our module’s external complexity with our test suite.
To demonstrate that:
- I used StreamData to write a property-based test for a Fibonacci function.
- I wrote two different implementations for the Fibonacci function, to explain the differences between internal and external complexity.
Finally, I reached a conclusion that different test styles are just different perspectives of understanding our code, and this idea aligns with the idea of complexity measurement pretty well.
https://dsdshcym.github.io/blog/2019/03/12/test-suite-as-a-complexity-measuring-tool/
Elixir's If and Elixir's Do
I saw a single line of if statement in Elixir and it excited me enough to write an article about it.
Cool CLIs in Elixir (part 2) with IO.ANSI
After writing about how to use IO.write/2 to build cool command line interfaces, I decided to follow it up with a post about IO.ANSI. We walk through working with color, cursor movement, and covering the entire terminal.
https://dennisbeatty.com/2019/03/12/cool-clis-in-elixir-part-2-with-io-ansi.html
