RSSAmplifier

Blog

Creative Deletion

Lau Taarnskov's blog on tech

creativedeletion.comRSS feed ↗10 posts

Latest posts

A cable can improve your audio and video calls

“You’re cutting out”, “Can you repeat that?”. Connection issues can be really frustrating during audio and video calls. With work-from-home being more prevalent in 2020 and 2021, so is audio and video calls via computers. For audio and video calls over the internet, a stable connection is important. High network speeds are not necessary for audio calls. Skype was made to work with 33.6 Kbps modems…

You might not need the Calendar or Timex libraries

Five years ago Elixir code would usually have to call third party applications to handle date, time and time zones. And blog posts (including on this blog), tutorials, books, and code still point people to using third party libraries. But today for most purposes, they are no longer necessary. Since Elixir 1.3 more and more date and time functionality has been added to the Elixir time zone library.…

Adding a function to the Elixir standard library that I hope will not be used

Last week a function ( NaiveDateTime.local_now/0 ) was added to the Elixir master branch. That means it will most likely be present in the coming Elixir version 1.10. The function returns the current “local” date and time for the machine it is running on. I wrote that function and I hope you will not use it in production code! There are a few exceptions, including: If your Elixir app is an…

Tzdata library downloaded 10 million times - Elixir getting more popular?

This week the Elixir Tzdata library crossed 10 million downloads on hex - the package manager for Elixir . It is a number displayed on the hex website and a while ago I started paying attention to it. To me the most interesting thing is that most of those downloads have happened within the last 12 months. Almost a third of them have happened in the last 90 days. Tzdata has been on hex as its own…

ElixirConf 2019 talk: Date, Time, and Time Zones in Elixir 1.9

I went to ElixirConf 2019 in Aurora, Colorado, USA to give a talk: “Date, Time, and Time Zones in Elixir 1.9”. A video recording is available on YouTube: Amongst other things it covers how you can now do time zone conversions with Elixir standard library functions - without libraries such as Calendar or Timex.

How to set timestamps to UTC DateTimes in Ecto

In Ecto versions 2.1 through 3.x the Ecto.Schema.timestamps/1 feature ( updated_at and inserted_at ) has been naive_datetime by default. I highly recommend using utc_datetime or utc_datetime_usec instead. This article will show how to do that. Setting the type One way to set the timestamps type is to put the line @timestamps_opts [type: :utc_datetime] in any module where use Ecto.Schema is…

Data types, assumptions and how a spacecraft crashed

In maths and physics classes in school I was taught to always keep track of the units when doing calculations. If you do some calculation and the result is just a number - that is not good enough. How fast is a train travelling? 80? 80 what? 80 bananas? If you keep track of the units you can do all kinds of calculations and have an easier time figuring out if it is 80 meters, 80 meters per second,…

Reasons for using Elixir instead of cron

Why use multiple lines of Elixir instead of a single line of cron ? Cron has been a staple in the toolbox for developers making web applications. But with Elixir (or other languages based on the Erlang virtual machine) it is not as necessary anymore. Using Elixir over cron has some advantages, including: If your application runs, your scheduled job will run. The supervisor takes care of this. If…

ElixirConf 2016 talk in Orlando (video): The New Calendar Types in Elixir 1.3

Elixir & Phoenix Conf 2016 took place in Orlando, Florida in September. I gave a talk about the new date and time types in Elixir 1.3. It was recorded and the video is available: The slides are available here . If this subject interests you, also check out my talk from ElixirConf 2015 .

What everyone except programmers knows about dates

Ask a schoolchild to write down a date. They will likely write a month, day of the month and maybe a year too (not necessarily in that order). So will most other literate people at any age. Ask a programmer to write a date and they might write not just a date, but also add hours, minutes and seconds to it! But a date does not have hours, minutes and seconds . Most people know this. Except many…