Phoenix 1.4 Chat Server Series Overview

Started a new Phoenix 1.4 Chat Server project to go over new changes. It will use:

  • Webpack 4
  • SCSS
  • Babel
  • Phoenix 1.4 channels
  • Cowboy 2

The initial overview is here

Even intervals to schedule your task

Created a library Every to use with periodic tasks when you need to schedule you task at even intervals, for example every 5 minutes, every minute, every hour, every 2 hours, every day and so on. And can be used with Process.send_after/3.

# Lets say we want to trigger our task every 5 minutes and current time is 12:02
# so next call will be at 12:05, 12:10 ... 12:55 ...
Process.send_after(self(), :work, Every.minutes(5, nil))

# If we want to trigger every minute
Process.send_after(self(), :work, Every.minute())

# If we want to trigger every hour
Process.send_after(self(), :work, Every.hour())

# If we want to trigger every 2 hours
Process.send_after(self(), :work, Every.hours(2, nil))

# If we want to trigger every day
Process.send_after(self(), :work, Every.day())

Managing fault tolerance in Elixir with supervision trees

I just published a post today ‘Robust compute for RDF queries: Managing fault tolerance in Elixir with supervision trees’.

The post briefly reviews the process model of Erlang (and Elixir) and introduces the following abstractions in Elixir: GenServer, Supervisor, and DynamicSupervisor.

It then develops a demo Elixir application that can be used to query DBpedia for random resources and save the results into GenServer processes. It goes on to show how processes can be created under OTP supervision trees both statically and dynamically and how they are automatically recreated when they error.

ElixirWeekly: The Elixir Community Newsletter, covering community news you easily miss, shared on ElixirStatus and the web, in one email every Thursday.

Five tips for unit testing in Elixir

This is the first part of what will be a series on unit testing in Elixir, including some ideas about what a unit test in Elixir is exactly and some tips for writing unit tests.

http://devonestes.herokuapp.com/unit-tests-in-elixir-part-1

Iteraptor now works with MapSets as well

Iteraptor is a tiny library to iterate/map/reduce/filter deeply nested structures in Elixir.

Starting with v1.3 it iterates through MapSet as well (besides lists, maps, and keywords.)

to_flatmap → from_flatmap transform will return list for what was mapset since there is no way to understand it was originally a mapset based on the flat structure.

Morphix 0.4.0 release

Morphix is a tiny library of functions to perform transforms on maps and arrays. Functions include converting strings to atoms in maps, flattening nested data structures, and removing nils from maps. This latest update (0.4.0) adds removing nils from lists, nested lists, lists nested inside maps, etc.

https://github.com/philosodad/morphix

SQL Joins with Ecto

A review of SQL joins and how to do them in Ecto.

The power of Git hooks

Never again commit console logs into your codebase with git hooks!

Check out how in this blog post.

ElixirMix Podcast 023 - “Beyond the DSL” with Arjan Scherpenisse

In this episode of Elixir Mix, the panel talks with Arjan Scherpenisse who is the technical co-founder at BotSquad. Arjan lives in the Amsterdam area of the Netherlands. Also, he is currently working with Miracle Things. Check out today’s episode where the panel and Arjan talk about his article and his latest projects.

Podcast Episode

Shameless plug: Check out @elixirstatus' other community project:

Credo, a new static code analysis tool that acts as a code linter, but also focusses on teaching coding practices and code consistency.

Gossip Websocket Sync Protocol

I recently started extending Gossip, a chat network for text based games, with other services. When expanding these, I wanted to keep them up to date on any changes that occurred on Gossip’s backing data.

For this I came up with a sync protocol that lives on top of the standard socket, that gets enabled for higher privileged applications. This was really cool to write, so I hope everyone checks it out!

https://blog.oestrich.org/2018/10/gossip-sync-protocol

Hot Code Reloading in Elixir

In this edition of Elixir Alchemy, we’ll dive into hot code reloading to see how Erlang’s code server handles seamless code upgrades in Elixir. To understand how all this works, we’ll start at the module level and work our way up. Let’s get started! https://blog.appsignal.com/2018/10/16/elixir-alchemy-hot-code-reloading-in-elixir.html

Easily hook into your function calls with Interceptor

This post talks about how we used Interceptor to easily replace the deprecated ExStatsD by the recommended Statix library: https://medium.com/onfido-tech/interceptor-easily-intercept-your-elixir-function-calls-3fb17ee18826

EventBus v1.6.0 is out

Update EventBus.Model.Event struct optional attribute type specs to allow nil values

Update type names and docs for the consistent naming convention (Note: there is no logic or method name change)

Update the Travis script to prevent breaks on merges:

  • Include dialyzer warnings
  • Include coverage
  • Include credo checks

https://github.com/otobus/event_bus

https://github.com/otobus/event_bus/wiki

Cachex v3.1 and the Return of Distributed Caches

Cachex v3.1 has just been released, with support for running a cache across Erlang processes (and physical machines).

Check it out!

Getting Started with Ecto Part 1: Installing and Configuring Ecto

Part 1 of Getting Started with Ecto covers how to install and configure Ecto. Check it out and share it.

https://edgardev.com/getting-started-with-ecto-part-1/

Announcing Slax -- An Elixir SAX Parser

I wrote a blog post announcing a new Hex package for SAX parsing of XML documents.

Slax uses the Erlang library :erlsom to do the actual parsing and provides some Elixir niceties to make it a little easier to work with. I plan to follow up with another blog post around some of the implementation details early next week.

Applying SPARQL.ex to RDF shapes

I just published a new post today ’Working with SHACL and Elixir: Applying SPARQL.ex to RDF shapes’:

This post follows up on my last post about querying RDF using the Elixir packages SPARQL.ex and SPARQL.Client.ex.

Here I focus on a simple use case with SHACL and an RDF shape used to provide a template description for the result graph. That is, instead of using a specific SPARQL query we will generate SPARQL queries from the RDF shape that defines the valid result graphs.

Spandex 2.4.0: Now with support for decorators!

Spandex 2.4.0 has been released, adding support for function decorators to easily create traces and spans based on function calls.

For example:

defmodule MyThing do
  @decorate span()
  def do_something_complicated(arg1, arg2) do
    # ...
  end
end

This will generate a span called MyThing.do_something_complicated/2 that reports how long the function took to execute and reports errors that are raised.

https://github.com/spandex-project/spandex/releases/tag/v2.4.0

Compact Sparse Merkle Trees

CSMT package implements the Compact Sparse Merkle tree whitepaper. Bargad framework utilizes CSMT for its Verfiable Map mode of operation.

CSMT Package

ElixirMix Podcast 022 - “Pattern Matching” with Kate Travers

In this episode of Elixir Mix, the panel talks to Kate Travers. She was a student/apprentice with Flatiron School and now is on staff as a software engineer! We talk about adopting Elixir at Flatiron School and how Pattern Matching is a super power. Kate has been speaking on the topic too.

Podcast Episode