Elixir Blog Posts

Well, Thanks for the information. :bouquet:

1 Like

That is a great approach :clap: .

I appreciate that. However, I have a doubt on this. Will that be a duplication of state? As we are saving state for every request? What makes difference with GenServer state ?

Thank you.

1 Like

The stash used is a public ets table… There is one state in the server, and one copy in an ets table, under a given key (Here I use the worker uuid). The solution does not survive a reboot, but the read/write are fast enough.

I start worker from a master GenServer, linked to each worker and trapping exit.

So when a worker dies with :normal reason, I delete stash entry from the exit call_back of the master GenServer. This is how I clean up old state…

2 Likes

11 posts were split to a new topic: Opinionated vs modular web frameworks

Be careful with saving the entire state to a stash: the point of restarting the process, rather than just doing a try/catch, is to start from a clean slate so the system can recover from a bad state. When possible it’s better to recompute things or refetch them from database during the process startup.

See for instance The Onion Layer Theory and On Erlang, State and Crashes.

6 Likes

The workers I have in this example are db-less… they hold dynamic state for a game of go.

For something related to retrieve state from db, there is this excellent talk.

2 Likes

Gotcha… :smile:

1 Like

Hi there, I am new to Elixir and like to share a post about my first impressions of getting started and a basic example application that might be interesting for others just starting with Elixir. All feedback is welcome!

Cheers
Jorin

4 Likes

A post was split to a new topic: Choosing Elixir’s Phoenix to power a real-time Web UI

Hey all,

I wrote a bit this week about my struggles in finding a fast, safe way to do a hex dump from within an Elixir application. The articles goes through a few possibilities, presents their drawbacks, and then lands on a final DIY solution.

Check it out, and let me know what you think!

3 Likes

Here’s a tangentially related follow-up to my last post. I’ve been working on this for a while, and publishing a lot of content leading up to it. Check out my newest article on “Connecting an Elixir Node to the Bitcoin Network”.

It’s a big article that covers a lot of ground, but I’m extremely excited about it. Let me know what you think. Hopefully someone finds it interesting or helpful. I’m sure I’ll continue down this vein in future articles.

1 Like

Building a distributed chatroom with Raxx.Kit

http://crowdhailer.me/2018-05-01/building-a-distributed-chatroom-with-raxx-kit/

Step by step walk through to building a multi-node chatroom based on the Raxx micro-framework.

Bonus: No websockets needed, HTTP/2 supported by using Ace server.

4 Likes

https://medium.com/@jpiepkow/arbitrary-code-execution-safely-with-lua-and-elixir-3de78d0d1c85

2 Likes

Another alternative is to use Luerl which a complete standard Lua 5.2 implemented in Erlang. Can be truly sandboxed if necessary. https://github.com/rvirding/luerl Yes, it’s by me. I could not add a comment to the blog post.

4 Likes

I actually do use luerl and the sandbox implimentation in the develop branch in the blog post, unless you ment something else?

2 Likes

Yes, that’s what I meant.

4 Likes
2 Likes

Hi everyone! I have been casually learning Elixir for a while and I also started blogging about it recently. I’d love to use it in production some day. My first article is an introduction to Plug. Enjoy!

https://www.pompecki.com/post/plugs-demystified/

9 Likes

I’ve been playing with property-based testing in my personal projects lately. I found a perfect opportunity to put it to use when writing a decoder for the Bitcoin BIP-39 encoder I previously built and wrote about.

Property testing actually found a bug in my original implementation that I definitely wouldn’t have caught through manual testing! This was an eye opening experience for me for sure.

Check out the full article for more of an explanation, and a runthrough of the decoder’s implementation: Reversing BIP-39 and the Power of Property Testing.

Hopefully someone else finds all of these Bitcoin-related articles interesting. I know I do.

7 Likes

I have blogged because I have been asked the questions of “is Elixir good for my project” many times recently:

8 Likes