Spawnfest 2017!

Last weekend (9-10.12) I took part in SpawnFest2017 and I’ve got some thoughts to share

What is it?

SpawnFest is a hackaton (programming challenge to write a project in some limited time) that was all about BEAM – Erlang’s virtual machine. All projects have to run on top of that (so you had to write it in Erlang/Elixir/LFE or something other from this family). You could add JS for frontend, use some third-party libs, etc. This was first edition in 5 years, so I had to take a part as I’m big BEAM enthusiast.

Warning, personal stuff below!

It was my firs (organised) hackaton. 48h deadline was quite stressful, and a lot of things didn’t work. Being at beginner+ level didn’t help either. But it was so much fun! I worked with my 3 friends on silly idea that we managed to bring to life. I learned a lot about not only Elixir, but developing and working under that kind of a stress. Memes were created and we never lost good spirit. A lot of code created was poor quality, but it didn’t matter. We did something in language we’re excited about, together, in less than 48 hours. That was magical. I cannot recommend enough taking part in SpawnFest – it was well organised, everyone was welcome and all the good things I cannot describe with words. It felt really awesome! Funny thing, when this all was over I was reminded that there are winners and prizes (Judges are still voting), but for me I already got the best prize – which is experience from this event

So, what did we do?

Application to monitor plants. We planned to have thermometer and proximity sensor, but we didn’t manage to get it work in time, so we added buzzer to hydration and humidity sensors. This app (written using Nerves) communicated from Raspberry Pi to our webapp written in Elixir, that was deployed in Heroku. What was shocking – how damn fast it was! Below I’ll paste README description of short video demo that we made.

There’s Elixir app with Phoenix fronend opened, showing sensor output. Sensors are connected to raspberry pi. When sensors are dry it will show cactus, when wet it will show water drop. First there’s humidity sensor – if we spray it, the second image will change. As it was not dried properly you can see some changes later, as water drops flows down the sensor. Next there’s hydration sensor put in the glass of water – first image will change. Below the images are charts with sensors data grouped by hour.

Finally “warning” button is pressed, and buzzer turns on. “Warning” button is a switch, so pressing it again turns the buzzer off.


See you next year! 🙂

Erlang Factory Lite Rome 2017 #1

Hello for the second (and last) part of EFL Rome2017 post! You can find previous one here

Music and Message Passing Concurrency by Joe Armstrong

Here goes the big name, Joe himself. While it may suggest a lot about music, it was more about messaging and integration. Joe showed how he could remotely control Sonic Pi. He was glad that there’s an other way to control a program “than clicking a bloody mouse!”.

He did that sending properly coded messages to UDP port. And here it all started. Joe is a big supporter of messaging based communication. API suposes a programming language, so it’s not a best way – you’re tied to programming language. As the main topic emerged once again – how to integrate and there are some programming languages better to do other things – so you’d naturally like to use them for specific purposes and not be stuck with one.

You should also treat specific parts/modules/apps like a black boxes – you know nothing (even the language used) except for how to communicate (using messages, of course 😉 ) – “the protocol only matters.”

  1. Pick transport (TCP/UDP)
  2. Pick encoding (XML/JSON/YAML/etc)
  3. Pick protocol description (RFC/UBF/etc)
Some combinations for you to pick from
With the Joe himself!

Joe picked OSC over TCP/UPD with some English to describe it. OSC is a very simple encoding – and it has “simplicity by design”, as Joe said, “if you can’t create complex data structures, the interface will be simple and easy to understand”.

“if you can’t create complex data structures, the interface will be simple and easy to understand”

Which is another way worth remebering. Complicated systems are easy – you just keep adding stuff. Simple systems are difficult to make.

I think thou – if one thing should be remembered from this talk it’s fact, that we should be able to understand the system by looking on the messages going in and out.

Adopting Elixir in a 10 Year Old Codebase by Michael Klishin

While it seems like adding Elixir to some Ruby ecosystem, it was actually using Elixir in Erlang project. They did a CLI tool in Elixir as a “check” with ~8k LOC, ~750 tests and 70 CL commands available.

I will just point out good:

  1. It’s more approachable than Erlang
  2. It’s a recriutment honeypot – easier to lure people into project
  3. Has decent standard lib
  4. Potentian contributors could have not contributed if it was in Erlang

And bad things he learned:

  1. Integration with is a pain
  2. Elixir/Erlang data type mismatches
  3. String vs Binary
  4. Some Elixir libs are a one man show ( 😉 )

Overall Michael feels like Elixir was worth adopting as sees a bright future for it – and you can utilize it even without agents, macros and sweet libs. He was even more optimistic for Elixir than for Erlang itself.

A Little Replica of the Internet in Elixir by Ju Liu

He describes himself as a Mad Scientist – and, boy, he is!

Basically it was a little trivia on the Internet and his attempt to do a small replica of it’s routing system using Elixir (and nerves). He had 2 RP3s connected, simulating North America and Europe with routing links. There’s a bit of how the Internet works and how it connects – he used that common knowledge to simulate it and it worked like a charm. There a code online if you want to look at it!

This is the Internet! Be careful not to break it!

The real show started when he took the router, connected third Rasp and added Asia – it all worked! It was a nice show for the Nerves project to show what you can do with them. Funny thing – the most problems, and the slowest part was HTML+JS frontend where all the arrows where hacked as separate CSS elements – so it crashed when connection number rose. Still, great project and you can look at it on github!

Embrace the Database with Ecto by Josh Branchaud

Basically it was how to use the Ecto and how to query the database. I really don’t know if it was the high temperature in the room, or it was just quite obvious to me – but I cannot say that I didn’t find anything at all – there was one statement that I won’t say if I find true or false – because it’s strengh is that it provokes some interesting conversations:

“The database should be the ultimate gatekeeper – it should validate the data coming in”

Monitoring and Pre-emptive support: The road to five nines on the Beam by Francesco Cesarini

It was a great talk with a lot of focusing on “no single point of failure” “we need at least 2 of everything”. He showed 2 types of monitoring usefulness – you can prevent failures, or do quick post-mortems. With monitoring you can prove your innocence in 1.5 minutes – without trying to replicate the bug and trying to debug. While there’s a lot to be said – he said so many cool stories I guess you have to go and give it a listen yourself – this one seems almost identical.

And this was it – it was a great experience and possibility to talk with those people was sometimes eye-opening.

Erlang Factory Lite Rome 2017 #0

Week ago I went to Rome to take part in Erlang Factory Lite, and, as promised, here is blogpost about it (the first part)

Starting with venue – it was near the centre of the city, easy to get with decent views. While inside was quite small (not a lot of people were there as well), the outside…

What a place to take a break!


Sadly, there were no recordings, but from what I saw speakers had the same talks as in some future (and maybe past?) events, so not all is lost.

Pilgrim’s Progress to the Promised Land by Robert Virding

Opening talk by Erlang co-creator. It was a nice opening, showing learning Elixir as a pilgrimage. And it’s quite good analogy. You begin your journey influenced by some prophets. It’s important to validate their words – to decide if Elixir is the right tool for your job. Also the way of learning it is a bit like arriving to different interesting places.

Because of it’s similarity to Ruby you quickly arrive to “Village of Confusion” as things don’t seem to work they should. It’s not an OO language (Joe had different opinion here 😉 Erlang is the only OO language ).

Robert told us that people doing Erlang/Elixir are not scared of crashing things. And there are 3 ways of crashing things:

  1. Just crash
  2. Crash and clean – for example process holding database connection won’t close it if it dies
  3. Crash and restart – if process is critical to the system

Because of all this talking about crashing, you do a lot of upfront error handling – so you have it localized and easy.

“You have to accept that things go wrong it you want to build fault-tolerant systems” – Robert

Stepping into a new era: injecting Elixir in a Ruby app by Andrea Leopardi

This was the talk about replacing some parts of the existing Ruby + Python system with Elixir (and adding new ones with Elixir). This was quite full of examples (like issues going down significantly and performance going up), but I think that the most important thing is:

Prepare your system: Split it into services first, or at least one monolith service and one small (it’s a good start).

It’s the Type Theory Baby! by Michele Finelli

This was talk full with nice theory. Michele defined a formula something that is always true or false. If you depend on external (I/O, DB, etc) logical formulas are no longer eternal – so this describes functional programming.

Nice thingies:

  1. One thing to remember? Read this paper
  2. Basically wiki article around this talk
  3. Duck typing? No! It’s untyped and it’s fine!

Cook your distributed in memory KV store by Gianluca Padovani

Basically a explanation how Riak Core works with concrete idea to implement. It was with some demos how to make a distributed KV store. And it worked like charm 😉 I guess reading throu the code of this masterless cluster (nice idea btw) will be better than me describing it, but there one important quote

Always timeout!

I’ve covered 5 out of 9 talks, so there’s still material for next part, stay tuned!