When developing Elixir in VSCode with the ElixirLS extension, there is an issue where your elixir installation does not get detected. This happens when you have installed elixir (and erlang) with the asdf version manager, which is quite common, since there are no good repositories for elixir in debian land.
The reason for this might be that asdf gets loaded in your *rc file but not in your .profile, which means it appears in the terminal that elixir is accessible but when starting VSCode your path is different and still missing asdf.
The solution is then to add asdf to your .profile file like:

. $HOME/.asdf/asdf.sh

You might need to logout of your session for this to take effect.

⌘

I just ordered the CM4 Processor Module Adapter for the MNT Reform.

Apparently this makes the Reform more than twice as fast as the default configuration, while keeping the power draw roughly the same. It still comes with 4GB of RAM, which is pretty low, but more than enough for my usecase.

I am excited for this, because it means there could be other CM4-compatible modules with even better specs that I could use with this!

⌘

This is an alternative to converting the type into a string and checking against that. This version survives refactors of class names much better.

Select Case msg.GetType()
    Case GetType(ClassA)
    Case GetType(ClassB)
    Case Else
End Select
⌘

With newer versions of Elixir, the trusty Timex-Library is less and less needed, but there is no build-in solution for displaying fuzzy timestamps like 5 min ago in the standard library. So here is a quick and dirty solution which might blow up in your face.

def from_now(%DateTime{} = later) do
    now = DateTime.utc_now()
    diff = DateTime.diff(now, later)
    do_from_now(diff)
end

def from_now(%NaiveDateTime{} = later) do
    now = NaiveDateTime.utc_now()
    diff = NaiveDateTime.diff(now, later)
    do_from_now(diff)
end

def from_now(_), do: "never"

def do_from_now(diff) do
    cond do
      diff <= -24 * 3600 -> "in #{div(-diff, 24 * 3600)} days"
      diff <= -3600 -> "in #{div(-diff, 3600)} hours"
      diff <= -60 -> "in #{div(-diff, 60)} minutes"
      diff <= -5 -> "in #{-diff} seconds"
      diff <= 5 -> "now"
      diff <= 60 -> "#{diff} seconds ago"
      diff <= 3600 -> "#{div(diff, 60)} minutes ago"
      diff <= 24 * 3600 -> "#{div(diff, 3600)} hours ago"
      true -> "#{div(diff, 24 * 3600)} days ago"
    end
end
⌘

The normal way of putting a single change in a change function does not work here, because modifying a column like this cannot be done by Ecto. So we need to drop an existing index first and then modify the column with the references function which will re-create that same index.

def up do
  drop(constraint(:address, "address_person_id_fkey"))

  alter table(:address) do
    modify(:person_id, references(:person, on_delete: :nothing), null: false
  end
end

def down do
  drop(constraint(:address, "address_person_id_fkey"))

  alter table(:address) do
    modify(:person_id, references(:person, on_delete: :delete_all), null: false
  end
end
⌘
⌘

All HttpClient methods used to make HTTP requests that don’t return an HttpResponseMessage implicitly call EnsureSuccessStatusCode on your behalf.

Well, Microsoft, you definitely didn’t anticipate how patchy some APIs are implemented.

⌘

I have spent a few hours trying to import a backup of my old mails from Thunderbird into Synology and I’m willing to admit defeat for now. While I have no problem using the outdated version of Roundcube the my DiskStation ships with, I have a very real anger directed at arbitrary settings of 32MB and 20 files that keep me from importing my mails without going bonkers.

I came as far as debugging the UI while uploading and skipping their stupid-ass checks on the client, but there seems to be a limit of 32MB imposed by the server as well. So now I have a folder of eml files on my server in case I need these emails again, but I might not bother importing them into my DiskStation.

⌘

My PineTime is dead. I have charged it with a 2A charger which, according to the manual, is way too much for the watch. The allowed charge is 1A, so I probably fried the electronics.

⌘

When trying to upload pictures to the site, I noticed that the filepicker would start crashing and I could not open it even from the app drawer. The reason was most likely a faulty update in the Synology Drive’s document provider. After removing the Drive app, the file picker started working again. πŸ‘

⌘