Journal of the overlooked tiny bits in young programming language. Will update weekly or two, as a way to build the habit of writing something on a regular basis. Authored by Riza and Augie as Editor In Chief.

Building A Simple Stream Media App With Elixir Phoenix Framework

Hey fellow alchemist, how’s going? Long time no see. I’m back! After loooong hiatus. I kinda missed it.

Ok, back to the topic. What will we build today? Well, I have more than one device in my house that I would like to play some movies or musics. And I hate copying stuff from one device to another. And I believe you have one of you have similar problem, or not, whatever. So today we will build some simple streaming media application using Phoenix Web Framework from Elixir language. We will build a web app that list all our media directory so then we can play literally anywhere. As long as you have modern browser and connected to the network.


First of all, we need Elixir v1.1.1 or later installed and Phoenix v1.1.0 or later. If not, please do install it first. Just go to elixir-lang.org and phoenixframework.org.

Now let’s write our pl


Create Command Line Tools

As software developers, we tend to depend on command line, especially me. Command line interface (CLI) are on fire this current time. Python, Ruby, Erlang and Elixir provide us with awesome tools on command line.

So in this article we will attempt to creating a command line tools. And I have feeling that Elixir will do great in this area.

Setting Up The Application

Let’s start with a new project using mix.

$> mix new awesome_cli
$> cd awesome_cli

Open up lib/awesome_cli.ex and you’ll see something like this:

defmodule AwesomeCli do
  use Application.Behaviour

  # See http://elixir-lang.org/docs/stable/elixir/Application.html
  # for more information on OTP Applications
  def start(_type, _args) do

Let's do me a favor to create hello world message in the project, will you?!

defmodule AwesomeCli do
  use Application.Behaviour

  # See http://elixir

Cowboy Tutorial Part 2: Creating Flat File Blog

If you follow ElixirDose blog, we did tried to create a very simple web framework over here. In that article we did serve some markdown file as the example. In this article, we take the markdown example a little bit further by creating a drop dead simple flat file blogging engine. Because the first article is little bit outdated, we will learn together how to get started with cowboy, a small, fast, and modular HTTP server written in Erlang.

Let's talk more detail about blogging engine that we will create. Our blogging engine will read through one folder that have several markdown files. No database whatsoever and it should be blazingly fast as a blog. The idea is to edit your content with your favorite text editor using markdown formatting, then you put on destination folder and viola! You've published your content. Quick and easy. We also


Functional Programming Basic Features

A couple week ago I read this article about why you should take a look at functional programming. Well, when you read and follow this blog you already did. One part that interesting about that article is the basic features of FP, which is:

  1. First-class functions
  2. Higher-order functions
  3. Closure
  4. Immutable state

This is good practice for us to learn the very basic of functional programming through Elixir. So let's start!

First-Class Functions

The basic definition of first-class functions is simply that you can store functions into a variable. You can also passes the functions around and invoked from other functions. This also known as anonymous functions in Elixir to be specific.

Let’s see the example.

add = fn num1, num2 ->
  num1 + num2

substract = fn num1, num2 ->
  num1 - num2

Phoenix Flying High: Deploying Phoenix The Final Part


If you follow along with Phoenix series in this blog, I assume you have awesome web app ready spread to the world and start to get some traffic and profit :)

We're using Phoenix version 0.4.1, postgrex version 0.6.0, ecto version 0.2.5 and Elixir version 1.0.0.

If you want to follow along, you can clone a repo from github or you always can simply use phoenix new new_project for this purposes.

Are you ready? This is how we will do:

  1. Add exrm into our project,
  2. Generate a release,
  3. Preparing the production server,
  4. Deploying our app into production server,
  5. Expose the app to the world.

Let's do it!

What Is exrm?

exrm is Elixir Release Manager. Well, that's explain everything. exrm sole mission is to help us release our Elixir applications.

How to use it? Well, that's what we will try to answer like, right now. Pretty easy, actually, just


Phoenix Part 4


This week we continue our Phoenix series. In case you missed previous three part of this series, here you go:

  1. Let's Build Web App With Phoenix And Ecto
  2. Phoenix, Ecto And Jobs Portal Project Part 2
  3. Phoenix, Ecto And Jobs Portal Project Part 3

Now we go further. We will add user registration and login. So if you want to post a new job, you need to login first. And if you don't have an account, you have to register first. You know the drill, I'm sure.

And this is the plan to tackle the issues:

  1. Add Register User Form
  2. Add Insert New User To Database
  3. Add Login Form And Query
  4. Using Session For Login Mekanism
  5. Using Phoenix Flash To Messaging User

This will be one hell of the naive approach for login mechanism. But it's ok for now, we will improve and iterate



At the end of this article, we'll be able to create a simple guessing game using Elixir. To accommodate that, we need to learn the following:

Getting User Input

It's simple enough to use IO.gets like this:

iex> IO.gets "Please enter your age "

It will return the user's input as a string. You could save it into a variable, if you wished.

Data Type Conversion

In Elixir, we can convert certain data types into other data types. For example, we can convert string/binary into integer or float, atom to list, float to list, and much more. Check the documentation here to get the full list of data type conversions. The usage is simple:

iex> binary_to_integer "22"
iex> binary_to_float "22.2"

String Concatenation and Interpolation

Let's say we have two strings that we wan


Phoenix Part 3

It's feels great when we use one framework and its owner gives us suggestions directly. That's what I got from the last article about Phoenix. Chris McCord gave us three valuable suggestions to improve our Phoenix Job Portal. In this article, we will refactor the code a bit based on his valuable suggestion:

  1. Change the "index" route helper to as: :pages, so you can do pages_path(:index) instead of index_path(:index).
  2. The Router should be updated to use the resources macro for conventional REST endpoints and conventionally named route helpers.
  3. Alias PhoenixJobs.Queriers and PhoenixJobs.Jobs to keep the controller actions tidy.

Change Index Route Helper

This change is a minor one and easy to implement. It's just a naming convention. We want to do pages_path(:index) instead of index_path(:index). To do that, we need to change as: :index to as: pages inside our route file:

get "/", PhoenixJobsThree.

Phoenix Ecto Part 2

Let's continue building our Elixir Job Portal this week. In the last article, we did following:

This week we will add a job creation feature to our app. Let's get the ball rolling!

Create Job

First, let's add a new route for creating a job by opening up web/router.ex and adding a new route for a new job.

defmodule PhoenixJobs.Router do
  use Phoenix.Router

  get "/", PhoenixJobs.PageController, :index, as: :page
  get "/new", PhoenixJobs.PageController, :new

Then open web/controller/page_controller.ex and add a new function to handle our :new route.

defmodule PhoenixJobs.PageController do
  use Phoenix.Controller

  def index(conn, _params) do
    jobs = PhoenixJobs.Queries.jobs_query
    render conn, "index", jobs: jobs

  def new(conn, _params) do
    render conn, "new"



Let's Build Web App With Phoenix and Ecto

Phoenix is the Elixir web framework targeting full-featured, fault tolerant applications with realtime functionality. Phoenix focuses on making developers highly productive without sacrificing performance. Phoenix is created by Chris McCord, available on github, and has reached version 0.3.1.

If you want to know more about Phoenix, I suggest you watch McCord's talk at ElixirConf 2014 about the past, present, and future of Phoenix here.

For this article, we will focus on how to create a web application using Phoenix, with Ecto as the persistence layer. We will build a simple job board that a user can browse for Elixir jobs and submit Elixir job opportunities.

Ok, let's get started by installing Phoenix. We will use the most recent version of Phoenix wh