An webcrawler project written in elixir
Tagged with “Elixir” (11)
While uploading the picture of the bread I noticed that somewhere in the upload process the page would just turn blank and the upload would fail without any error message.
When I checked the server process in
journalctl, I realized that the elixir process gets killed because it’s exhausting the memory of my (admittedly undersized) VPS. Since I do some processing (mostly dithering and resizing) of all uploaded images, it takes up to 400MB at one point.
Sometimes that’s less than is available so the
OOM Killer (badass name) steps in and kills the process.
Write interactive & collaborative code notebooks in Elixir
Let’s check out new features in this release. Like many of the past Elixir releases, this one has a strong focus on developer experience and developer happiness, through improvements to debugging, new debugging tools, and improvements to term inspection. Let’s take a quick tour.
@preloads [ :list, :user, :syndications, :images, :links_from, :links_to, tags: [ :notes, notes_published: Note |> where_published() |> order_by(desc: :updated_at), notes_unpublished: Note |> where_unpublished() |> order_by(desc: :updated_at) ] ]
Is this a normal preload? Looks a bit.. funny.
TSQL >= 2012
SET @query = FORMATMESSAGE('SELECT %s FROM SOME_TABLE', @somevariable);
Modular ActivityPub library in Elixir
This looks very interesting, I’ve not seen much ActivityPub in the Elixir space apart from Pleroma.
How to use subdirectories in the template directory in phoenix, add the
pattern option in app_web.ex:
use Phoenix.View, root: "app_web/templates", pattern: "**/*"
This is a pattern for preloading in Elixir that I have adopted for a few projects. I’m sharing it here for reference. The idea is to have one place to define your preloads instead of in every query.
@preloads [:listens] defp with_preloads(query), do: preload(query, ^@preloads) def preload_artist(artist), do: Repo.preload(artist, @preloads)
with_preloads can be used to enhance an query with preloads:
def list_artists do Artist |> with_preloads() |> Repo.all() end
Whereas preload_artist() is used to preload a single object, for example, after getting a single artist:
def get_artist!(id), do: Repo.get!(Artist, id) |> preload_artist()
Hm. The instructions for installing Elixir on Ubuntu from https://elixir-lang.org/install.html do not seem to work anymore. Trying to install
esl-erlang wants to download a gigabyte of dependencies like icons, java and graphics-drivers lol.
For now, the solution is to do
apt install elixir erlang-dev erlang-parsetools erlang-xmerl build-essential to get mirage to compile.
When developing ELixir applications, I’d like to have an easy way to manage versions. A tool that makes this very easy is git_ops. It is an elixir/hex package which sets up a workflow of versioning your project and git commits using conventional commits.
Conventional commits uses a few easy.. well, conventions to make your commits parseable and actionable.
Here’s how I set up git_ops in my projects.