Maxwell: One HTTP Client to Rule Them All

Maxwell is a Elixir HTTP client which allow developers to customize its behavior with middleware. If you’re familiar with Faraday or Plug, then you’ll love it.

https://medium.com/@zhongwencool/maxwell-one-http-client-to-rule-them-all-dc0ccd9f2f7b#.sh3pdu97n

Deploying Elixir Applications with Distillery

Dive into this high level overview of the process of deploying an Elixir application with Distillery.

Deploying Phoenix on Ubuntu with Gatling

How To for an automated Phoenix deployment on Digital Ocean

There aren’t many detailed posts on how to deploy Phoenix apps to production, yet. This article is a step by step description of what I did to ship my first Phoenix app. I hope it will be a handy resource if you are searching for an easy way to achieve an automated deployment to a single server and leverage hot upgrades.

https://dennisreimann.de/articles/phoenix-deployment-gatling-ubuntu-digital-ocean.html

Tips for Getting Started with Elixir & IEx

https://www.promptworks.com/blog/getting-started-with-elixir-and-iex

A few tips for getting started with Elixir and IEx. This is for people who have been looking for an easy way to get started or who aren’t that comfortable with IEX yet.

Discriminated unions (algebraic data types) in Elixir

Elixir already has product-type, tuples, which allow to aggregate several values in to one. But it lacks a sum-type, which allows to create a structure with a fixed set of values and guards all of them are handled. DiscUnion solves this.

With it, you can create a structure with a finite set of values, and have compile-time warnings if you try to use a wrong value or miss handling one case:

shape.ex:

defmodule Shape do
  use DiscUnion

  defunion Point
  | Circle in float()
  | Rectangle in any * any
end

solver.ex:

defmofule Solver do
  use Shape

  def calc_area(shape) do
    Shape.calc shape do
      Point in _        -> 0.0
      Circle in r       -> :math.pi * r * r
      Rectangle in w, h -> w*h
    end
  end
end

If there would be a typo in Rectangle in solver.ex or this line would be missed completely, app would not compile and UndefinedUnionCaseError or MissingUnionCaseError would be raised.

For more complete example see tennis kata example (which also creates a structure that does not allow creating invalid state of the game - thanks to using ADTs).

Measuring and visualizing GenStage/Flow with Gnuplot

http://teamon.eu/2016/measuring-visualizing-genstage-flow-with-gnuplot/

Follow-up to last post about tuning GenStage/Flow, now describing how to measure and visualize pipeline progress.

Elixir Phoenix App deployed into a Load Balanced DigitalOcean setup

I documented a high-availability configuration I did for a Phoenix app over DigitalOcean and I just published about it step-by-step. I am looking forward to learn more tips and tricks, so if you’re a seasoned Elixir developer with more experience, let me know how I can improve this setup in the comments sections of the post.

'New' Phoenix React Redux Starter Kit

I’m working on a ‘new’ phoenix starter kit, using react and redux for the front end. I use a fractal approche for the organisation of the react code.

I created 5 branches (4 branches + master). master is the base. The other branches contain : ecto, user support, multi language support, and user + multi language support.

You can have more detail about it here : https://github.com/rsilvestre/phoenix-react-redux-starter-kit

HTTP Streaming in Elixir

http://big-elephants.com/2016-12/http-streaming-in-elixir/

Storing Nested Associations with Phoenix Forms

http://blog.heartbeathq.com/storing-nested-associations-with-phoenix-forms/

Introducing CERBAS

CERBAS - A starting point API server and web proxy backed by redis data structure memory no sql database.

Clients connect to CERBAS by storing requests from any language in redis. CERBAS dispatches elixir functions.

Also includes a Plug based proxy server with some examples.

A plus is a cronjob function handler ( via crontab syntax like file).

It’s a starting point for your API needs ( customize it to fit your needs ).

Find it on GitHub

Tensor, the Vector/Matrix/Tensor library has reached v1.0!

With the recent addition of Numbers and some improvements of the documentation, Tensor now has reached version 1.0.0!

For people that do not yet know about it:

Tensor is a library that allows you to work with sparse Vectors, Matrices and higher-order Tensors, with the following nice features:

  • An implementation of the Access protocol, so you can do mymatrix[42][3].
  • It supports the arithmetic functions you would expect from vectors, matrices and tensors. These are implemented using Numbers, which means that they work on any numeric type.
  • What is even more, Tensor itself implements Numbers’ Numeric behaviour, which means that anything that does number arithmetic can now do (elementwise) vector/matrix/tensor arithmetic! It also means that you can nest matrices ad infinitum!
  • A sparse implementation: Only elements deviating from the default element of a data structure are stored. This means that e.g. a nearly-empty 10000x10000 element matrix takes up only a neglegible amount of memory.
  • While you can work with numbers, you can store anything inside: Using it as a representation of a game board (a matrix for chess, or a 3-dimensional tensor for a Rubik’s Cube), for instance, is something that is very possible.
  • Functions to rotate, transpose, transform, combine, separate, map over and reduce vectors/matrices/tensors.

Here are some examples from the Readme:

Vectors

iex> vec = Vector.new([1,2,3,4,5])
#Vector-(5)[1, 2, 3, 4, 5]
iex> vec2 = Vector.new(~w{foo bar baz qux})
#Vector-(4)["foo", "bar", "baz", "qux"]
iex> vec2[2]
"baz"
iex> Vector.add(vec, 3)
#Vector-(5)[4, 5, 6, 7, 8]
iex> Vector.add(vec, vec)
#Vector-(5)[2, 4, 6, 8, 10]

Matrices


iex> mat = Matrix.new([[1,2,3],[4,5,6],[7,8,9]],3,3)
#Matrix-(3×3)
┌                          ┐
│       1,       2,       3│
│       4,       5,       6│
│       7,       8,       9│
└                          ┘
iex> Matrix.rotate_clockwise(mat)
#Matrix-(3×3)
┌                          ┐
│       7,       4,       1│
│       8,       5,       2│
│       9,       6,       3│
└                          ┘
iex> mat[0]
#Vector-(3)[1, 2, 3]
iex> mat[2][2]
9
iex> Matrix.diag([1,2,3])
#Matrix-(3×3)
┌                          ┐
│       1,       0,       0│
│       0,       2,       0│
│       0,       0,       3│
└                          ┘

iex> Matrix.add(mat, 2)
#Matrix-(3×3)
┌                          ┐
│       3,       4,       5│
│       6,       7,       8│
│       9,      10,      11│
└                          ┘
iex> Matrix.add(mat, mat)
#Matrix-(3×3)
┌                          ┐
│       2,       4,       6│
│       8,      10,      12│
│      14,      16,      18│
└                          ┘

Tensors

  iex> tensor = Tensor.new([[[1,2],[3,4],[5,6]],[[7,8],[9,10],[11,12]]], [3,3,2])
  #Tensor(3×3×2)
        1,       2
          3,       4
            5,       6
        7,       8
          9,      10
            11,      12
        0,       0
          0,       0
            0,       0
  iex> tensor[1]
  #Matrix-(3×2)
  ┌                 ┐
  │       7,       8│
  │       9,      10│
  │      11,      12│
  └                 ┘

You can find it on Hex.pm and on GitHub.

And here in the Elixir Forum.

db2kafka - RDBMS to Kafka pump

We just released the first cut of db2kafka, a tool that helps migrate MySQL-using apps to Kafka without having to rethink transactions, etcetera.

Code on https://github.com/PagerDuty/db2kafka and hex.pm

SearchQL: Parse search queries in Elixir

https://github.com/usecanvas/searchql

Best parts of "What's New in Ecto 2.0"

Plataformatec’s official book about the newest Ecto revamp is finally out and it’s a must-read for any serious Elixir/Rails developer.

Read more on Phoenix on Rails blog

Morse: Morse code encoder and decoder

https://github.com/sotojuan/morse

MapDiff: A small library that computes the difference between two maps

Hello everyone,

I wrote a small library today called MapDiff. It returns a map listing the (smallest amount of) changes to get from map_a to map_b:

iex> foo = %{a: 1, b: 2, c: %{d: 3, e: 4, f: 5}}
iex> bar = %{a: 1, b: 42, c: %{d: %{something_else: "entirely"}, f: 10}}
iex> MapDiff.diff(foo, bar)
%{changed: :map_change,
  value: %{a: %{changed: :equal, value: 1},
    b: %{added: 42, changed: :primitive_change, removed: 2},
    c: %{changed: :map_change,
      value: %{d: %{added: %{something_else: "entirely"},
      changed: :primitive_change, removed: 3},
    e: %{changed: :removed, value: 4},
    f: %{added: 10, changed: :primitive_change, removed: 5}}}}}

This is mainly useful if you have two maps describing the state of something, where replacing all of the old state and then filling in the new is too slow, which means that only replacing the things that actually are changed is better.

ExMustang slackbot 0.2 with several responders such as howdoi, uptime, isup, insult, etc.

ExMustang is a slackbot that uses Hedwig framework and implements several responders. While the responders have been primarily tested with Slack, they should work with other adapters as well.

Source code

Morphix 0.0.4 -- now with `:safe` atomorphifification!

Morphix is a tiny library of utility functions for working with enumerable objects.

The atomorphify and atomorphiform functions will convert the string keys of a map into atoms. This worries some people because atoms are never garbage collected, so both methods now take a :safe flag that will prevent them from creating new atoms.

Usefull for partial application of a structure over a large JSON message – only atomize the strings you know you want to access, but keep the whole object.

https://hex.pm/packages/morphix

Tuning Elixir GenStage/Flow pipeline processing

How to use Flow to implement parallel pipeline processing and be confident about performance.

http://teamon.eu/2016/tuning-elixir-genstage-flow-pipeline-processing/

Previous page Next page