Elixir Blog Posts

I’ve been working on my Bitcoin node a bit more over the past few weeks. Here are two new posts that (should) finish off the peer-to-peer networking portion of the project:

Limiting Peers with DynamicSupervisor Options - In which I realize that I duplicated a lot of work already done for me by the DynamicSupervisor module, and simplified my code quite a bit.

Ping, Pong, and Unresponsive Bitcoin Nodes - In which I set up a ping/pong cycle and prune dead peers from my connection pool.

3 Likes

Understanding concurrency in elixir

2 Likes

I have recently played around with Phoenix.PubSub and wrote up my findings in a blog post: https://www.pompecki.com/post/phoenix-pubsub/

2 Likes

For those interested in contributing to Elixir, here’s what I learned from my experience :smiley:
How to Contribute to Elixir: A Step-by-Step Guide

5 Likes

I just wrote a blog post “Why I’m Loving Elixir” and thought I would share

5 Likes

Here’s the FizzBuzz post I talked about previously. I basically use stream to replicate an interesting Clojure FizzBuzz solution. With a little cleanup, I actually prefer the Elixir version over the Clojure one (although being able to map over multiple collections is nice).

I also wrote a bit last week about improving my Bitcoin node’s receive loop by switching from using :gen_tcp in active mode to passive mode. This switch simplified things quite a bit and let me gut quite a bit of code from my project.

2 Likes

Nice! I feel like you’re reading my mind. I started to dive into contributing to Elixir when I thought I found a bug a couple weeks ago. I also found this Dockyard article to be very helpful.

2 Likes

Example using dynamic supervision in elixir OTP https://danbruder.com/blog/example-using-dynamic-supervision-in-elixir-otp

2 Likes

Looking forward to part 2 where hopefully we find out how trains reconstruct their state in the event of a crash and how holders of stale train pids find the newly generated processes.

2 Likes
1 Like

Hey all,

I just published a pretty massive post on using Elixir to generate guitar chords and finding “optimal” voice leading between chords. I do a deep dive into the code in the article and explain some of my ideas.

I’m pretty pumped about what I’ve got working so far, and plan to keep developing my ideas into something more useful in the future. Hopefully you think it’s as cool as I do.

10 Likes

Really cool stuff @petecorey

2 Likes

Will be reading this tonight. It’s my two favorite things Elixir and guitar!

2 Likes

:clap:this one is particularly awesome and inspiring (even though I don’t play any instrument)

reminded me of this talk, where a drum machine is built : (code: https://github.com/mtrudel/beats)
so just making sure you have seen that one…

2 Likes

Yes! That’s hands down one of my favorite Elixir talks. I’m actually using SchedEx in another side project, thanks to that talk.

3 Likes

How does SchedEx compare to Quantum that’s been around a lot longer?

2 Likes

https://engineering.tripping.com/how-to-implement-sliding-timeouts-in-your-elixir-genservers-cc5a2ed70db9

1 Like

I liked the way SchedEx is configured, seems a lot cleaner than Quantum. And also, the time_scale modules look really amazing. :slight_smile:

3 Likes

https://engineering.tripping.com/blazing-fast-elixir-configuration-475aca10011d

4 Likes

GenServer’s handle_call/3, handle_cast/2, and handle_info/2 natively support sliding timeouts. You don’t need to write any custom code.

handle_call/3

Returning {:reply, reply, new_state, timeout} is similar to {:reply, reply, new_state} except handle_info(:timeout, new_state) will be called after timeout milliseconds if no messages are received.

handle_cast/2

Returning {:noreply, new_state, timeout} is similar to {:noreply, new_state} except handle_info(:timeout, new_state) will be called after timeout milliseconds if no messages are received.

handle_info/2

Return values are the same as handle_cast/2 .

1 Like