Nerves Project January Update
See what the Nerves core team and community have been working on recently and where you can learn more about Nerves at upcoming training events - http://embedded-elixir.com/post/2018-01-02-nerves-update/
Logging from headless Nerves machines to Papertrail
I wrote a little how-to on setting up logging to Papertrail from a headless Raspberry Pi running Nerves.
https://timgilbert.wordpress.com/2017/12/31/logging-from-headless-nerves-machines-to-papertrail/
AC8: Creating a DSL for our router
Building the http://Alchemist.Camp website, Part 8.
Let’s write some macros and make a nice router DSL like Phoenix has!
What I Learned During the Advent of Code
I learned quite a bit after completing this year’s Advent of Code challenges with Elixir. Check it out!
Pattern matcher for Protocols
Just blogged about how one could pattern match function clauses against the implementations of the protocol.
http://rocket-science.ru/hacking/2018/01/03/pattern-matcher-for-protocols
AC7: Creating controllers for a Cowboy web server
Building the http://Alchemist.Camp website, Part 7. It’s time to make controllers.
Our router was starting to look like a kitchen sink so we factored a controller out of the app and started pulling some code into a framework. This required the use of simple macros.
Elasticsearch
Elasticsearch is a new Elixir library for interacting with Elasticsearch. Highlights include:
-
No DSLs. Interact directly with the
Elasticsearch
JSON API through simpleget/put/post/delete
functions. - Zero-downtime index (re)building. Via an included mix task.
- Dev Tools. Helpers for running Elasticsearch as part of your supervision tree during development.
It’s based on protocols and behaviours, so it’s both simple and flexible.
Cloak v0.4.0 Released!
Cloak makes it easy to encrypt data in your Ecto schemas. This new release adds several new features, including support for AES.GCM encryption.
https://github.com/danielberkompas/cloak/releases/tag/v0.4.0
IntelliJ Elixir v7.2.0
Enhancements
-
mix
runs will be faster as they will no longer check to see if the SDK is updated.
Bug Fixes
- Avoid problems with read and write locks when updating Elixir SDK on-demand by instead updating them when any project is open using a project converter.
-
JetBrains/intellij-community@9adbba0 added
@NotNull
toOrderRootType.getOrderRootType
, whichJavaDocRootType.getInstance
calls, which means any Small IDE usingintellij-community
since 4 months ago, including the newest CLion cannot haveJavadocOrderRootType.getInstance
safely called. -
Path changes were not being written back to disk because the
projectSdksModel.apply()
was being called before theeditor.apply()
, which would have copied to theeditor’
s path changes to theprojectSdksModel
.
Winners for @spawnfest were announced!
Check it out: https://spawnfest.github.io/winners/ Congratulation @micmus, @bondalex & @andrewdryga!! You won, big time!
IntelliJ Elixir v7.1.0
Enhancements
-
Elixir Facet in Small IDEs
- Preferences > Languages & Frameworks > Elixir can set the Elixir Facet SDK for the Project Module used in Small IDEs as a per-project settings.
- Preferences > Languages & Frameworks > Elixir> SDKs can add, delete, and configure Elixir SDKs as per-application settings.
- Preferences > Languages * Frameworks > Elixir > Internal SDKs can add, delete, and configure Erlang SDK for Elixir SDKs as per-application settings.
-
Configure SDK before running
mix
when importing mix projects, so that themix
path does not need to be configured separately from the SDK path.-
The
mix
path no longer needs to be setup independently from the Elixir SDK.
-
The
-
Add Local shared
credo
inspection, so the thecredo
inspection works for Code > Code Cleanup.-
Show Mix ExUnit in context menu in Elixir Facets, so that
- Run ‘Mix ExUnit …’
- Debug ‘Mix ExUnit …’
- “Create “Mix ExUnit …’”
test
directory and it is Marked as a Test Sources Root. It will appear green in Rubymine if already marked. To mark it, do the following:-
Right-Click
test
directory - Select “Mark Directory as > Test Sources Root”
-
Show Mix ExUnit in context menu in Elixir Facets, so that
Bug Fixes
-
Protect access to
JavadocOrderRootType.getInstance()
so that it doesn’t cause an error in Small IDEs where its Extension Point is not defined. - If the explanation tooltip is empty, fallback to the message for the credo annotator instead.
-
Check if
SdkAdditionalData
isnull
before gettingErlangSDK
as it can benull
in certain scenarios in Rubymine. -
Fix
isConfigurationFromContext
, so that it works on Mix ExUnit Run Configurations generated from directories. Check if theprogramParameters
andworkingDirectory
match by just generating another configuration from the context as this ensures the logic matches and includes support forPsiDirectory
.
Elixir Users' Survey 2017
I’ve just published this year’s Elixir Users’ Survey. If you’d visit this link and fill it out for me I would sincerely appreciate it! :)
Raxx 1.0.0-rc.2 released
https://hex.pm/packages/raxx/1.0.0-rc.2
Raxx is a simple, functional foundation for web applications. It’s role is as an alternative to plug.
This release adds typespecs throughout to work with dialyzer.
.iex.exs to the rescue
Blogged about .iex.exs
file tuning and project-specific iex
configurations goodness.
— http://rocket-science.ru/hacking/2017/12/29/iex.exs-to-the-rescue
Unit Testing Phoenix Controllers with Mox
Here’s a walkthrough for unit testing Phoenix controllers using Mox, from installation to basic mocking strategies
https://spin.atomicobject.com/2017/12/27/elixir-mox-introduction/
[pt-br] Elixir practice: encontrando todos os anos bissextos do século 20
Elixir practice: encontrando todos os anos bissextos do século 20 com Elixir.
Implementing a peer-to-peer network in Elixir - Part 1: The Server
This is the first of three posts that will guide you through the implementation of a simple peer-to-peer network in Elixir.
On this post we’ll be creating the server and will learn how to use the Ranch library.
Implementing a peer-to-peer network in Elixir - Part 1: The Server
Elixir “with” syntax and guard clauses
In this blog post we will take a look at a simple example of refactoring Elixir code using with
syntax (called a “special form” in the documentation), and guard clauses.
(Ab)using Ecto as Elixir data casting and validation library
I just put together a fairly detailed write-up on how I use Ecto as generic data types casting and validation library. If you are looking for a way to create table-less form with Phoenix, validate user commands, create sign up or contact forms that do not map directly to database tables, it might come in handy:
(Ab)using Ecto as Elixir data casting and validation library