Elixir Blog Posts

I recently started blogging and just wrote my first blog post about Elixir!

In this post, I go through a common occurrence in large codebases: seemingly unrelated files being recompiled every time you change a module. It contains a deep dive on why this happens, how to fix and how to permanently prevent such long (re)compilation chains from showing up again.

The iteration time between making changes and observing changes should be as fast as possible. The slower it is, the more it impacts your productivity. If you suffer from long recompilation chains, I highly suggest you take the time to read the post!

3 Likes

For the sake of completion:
Part 2 of implementing bar types from Advances in Financial Machine Learning book, in Elixir!

Happy to hear any thoughts or comments!

Preparing Financial Time Series for ML in Elixir, Part 2: Information-Driven Bars — With Explorer & More NIFs!

https://medium.com/@yairoz/preparing-financial-time-series-for-ml-in-elixir-part-2-information-driven-bars-with-explorer-c59ccb996a68

1 Like

We wanted to use the Jina embeddings v2 model for an Elixir project but it’s not supported out of the box in Bumblebee.
Here, I describe how to implement and verify the Jina model so we can run it in Elixir.

Spoiler alert: it’s probably less work than you expect.

3 Likes

implementing more code from ‘Advances in Financial Machine Learning’ in Elixir. The labeling step, using the Triple Barrier Method:
The Triple Barrier Method: Labeling Financial Time Series for ML in Elixir

I had an issue with esbuild subprocess staying around as “zombie” and I finally found a solution I wanted to share with you:

At first I tried to exit when stdin was closed but it was not working, I found a workaround which uses an interval to send a SIGNULL signal to the parent to check if it is alive.

You should check for the closure of stdin to detect the parent closing the port. E.g. that’s how the bun package does it: bun/priv/wrapper.js at main · crbelaus/bun · GitHub

I tried, but it does not work reliably.

const cleanup = async () => {
  // Dispose the watch context properly
  console.log("--- dispose");
  await ctx.dispose();
  process.exit(0);
};

process.stdin.resume();
process.stdin.on("close", () => cleanup());

await ctx.watch();

This seems to work just fine for me.

1 Like

This works on my local machine but not on our shared dev server. With this I still find some zombie processes after a few days of people working on the project.

I recently made some optimizations at work that saved more than 40% CPU at peak time. The post explains how I identified and fixed the bottleneck

Blog - ETS vs Redis

2 Likes

I wrote an article about how we’re using Elixir’s Mix tasks, Sourceror, and Igniter to streamline project and dependency setup on client projects:

1 Like

I have been trying to exercise my writing muscles, getting past the barrier of finishing it up and posting it online. Therefore I chose a small subject for it, namely how default function arguments work in Elixir.

1 Like

I wrote an article a little while back about transforming a typical Python for loop to Elixir pipelines or comprehensions - essentially how to go from imperative to functional. The filter, map, reduce rubric should be useful for anyone who isn’t used to Elixir comprehensions.

3 Likes

I wrote a short blog post of Improving SEO with Wallaby + Image + LiveBook. I hope it is useful :blush: :smiling_face_with_three_hearts:

3 Likes

A blog post about the challenges of deploying an application that scales in Kubernetes using releases

https://medium.com/@chargio/moving-from-a-single-pod-to-multiple-pods-in-k8s-with-a-simple-elixir-application-69b0f1cb71e8

I wrote a tiny blog post about:

  1. how to print out the type info of an Elixir variable and
  2. how to allow regexes in NimbleOptions definitions
2 Likes

Fly.io’s globally distributed network is great for routing users to the closest server but what if you want to connect them to a specific machine? I wrote how to use their fly-replay header and sticky sessions to do that in Phoenix.

3 Likes
1 Like

As soon as we make an effort to write asynchronous tests in a large enough application, we bump into the concept of “ownership”. What do we even need it for? And What Does NimbleOwnership Do Anyway? | Alex Martsinovich

3 Likes

Why FLAME is a compelling choice, particularly for those needing modular scaling?
Check this out: Effective Scaling Strategies for Image Processing Workloads | Curiosum