If you are a video person, and have 24 minutes to spend with, just jump over to this ElixirConf 2020 - Debugging Live Systems on the BEAM talk by Jeffery Utter. This article is a downgraded version of the video 😂. I wrote this before the video is published. Then, I came across it and learn a lot more from there.

Read More

Recently, I have been looking into improving our access management to our EC2 instances in Naluri and came across EC2 Instance Connect features. While experementing with it, I have learn a thing or two about ssh. In this post, we are going to cover the following topics: Which private keys ssh is using?

Read More

Updates (12th August 2020): Fix my mistake on using bin/app restart. Updates (7th October 2020): Include the reason why bin/app restart doesn’t work In my previous post “Building Elixir/Phoenix Release With Docker”, I wrote about how I build Elixir release with Docker and extract the tarball. Today, I am going to share how I deploy Elixir release to the production server.

Read More

This is a short post about how I build my Elixir/Phoenix releases with Docker and extract the tarball that will be deployed to production. In this approach, we are just building the release with Docker. We are not building the image to run our application in a Docker container.

Read More

I once gave a talk about GenServer in a local Elixir meet up in 2019. To prepare for the talk, I have done a lot of research and readings. With additional experience working with GenServer in a production environment, I have come to realize that there are a lot of caveats when using GenServer.

Read More

The past months, I have been working on a feature which deal with grouping records by date and summing up values. I have learn a couple of date functions in PostgreSQL that are very useful when it comes to grouping records together based on datetime column. In this post, we will go through a bit of the context of the feature I work on, and we will walk through the process of implementing it.

Read More

Updates (4th June, 2020): Adding in another potential causes: logs The company I am currently working for, uses AWS infrastructure extensively. For instance, we build our Elixir/Phoenix application release on a seperate EC2 instance. Sometimes, if our engineers are unlucky, their build process will failed because of the lack of disk space in our build server.

Read More

While migrating this website from Jekyll of Hugo, I faced an issue where my /tags resulting in a 404 Not Found after deployment. It turned out that /tags is ignored by git when I build my site. I then found out the following line in my ~/.gitignore_global: tags This is the file that I ignore after start using ctags in vim.

Read More

Lately, I am exploring the use of OCR in Expendere (my expense tracking application) and came across Tesseract OCR. At the time of writing this blog post, there is no native binding of Tesseract OCR in Elixir. However, there are two Elixir wrapper available on GitHub: tesseract-ocr-elixir tesseract-elixir Both wrapper use System.

Read More

TLDR: Use Phoenix.Controller.send_download/3 to send binary as download to your users. In Phoenix, there are a couple ways of to send file to your users. The most straightforward one is to programmatically create a file and send it to user using Plug.Conn.send_file/5. For example: def export(conn, _params) do # Create file filename = "test.

Read More

If you are like me, having countless side projects and jumping from one to another from time to time, you might also experience ending up losing track of what you should do on each side projects. Keeping track of tasks in all of your side projects isn’t easy without using any project management software.

Read More

Oracle database does not index a row if all the indexed columns are NULL For instance, let say we have a users table where we index role column to improve the query performance. SELECT * from users WHERE role IS NULL The index does not work for such query in Oracle database.

Read More

In the previous post, we had briefly discuss about the solution of Part 1. It is fairly straightforward. I thought Part 2 is going to be easy too. But man, I was wrong. It is a bit tricky. My initial solution takes around 17 seconds to compute the answer. I made it 34x faster by changing the data structure.

Read More

Advent of Code (AOC) 2018 has finally arrived. This is the first time I participate in AOC. Last year, when I first heard of AOC, I wanted to participate in it. But due to heavy workload from university, I just give up on doing it. This year, it’s different, I had graduated and working remotely.

Read More

Markdown is great for formatting our writing to be publish as HTML. If you’re a developer, you probably used Markdown before. README of GitHub repositories are mostly written in Markdown. While developing web applications, there will be static pages such as about page and FAQ page. Most of the time, we have to write it in HTML, which can be unpleasant.

Read More

It is interesting to learn things from scratch. Coming from Ruby background, I was curious what is the equivalent of Sinatra in Elixir. It’s called Plug. It is what Phoenix build on top of. Using Sinatra, we can write a quick and simple web server with the following code:

Read More

Starting from Elixir 1.4, we don’t need to specify our application lists in application. It is automatically inferred from our dependencies. (Check the release notes here) Do note that it only automatically infer the application lists if the :applications key is empty. If you had already declared your it in your mix.

Read More

Recently, I have been using jekyll to make notes. I use jekyll-compose gem to create post using command line. However, the auto open generated file features isn’t working in my machine after the setup. After a few times on manually opening the generated files in vim, I decided to write a quick shell script to solve this issue.

Read More

Another story about fixing bug. This story is related to the native web API fetch, which is used to make request. Backstory After serveral days of having my first production application online, my client inform me that, the application has a bug, again. The button was not working as expected for one of the users.

Read More

While I was refactoring the code base of my client application, I came accross a code block, similar to this: arr = [] data.each do |d| status = d['status'] next if IGNORED_STATUS.include? status arr << d['value'] end I think, “Ha, I can replace each with map here.” I go ahead, and make the changes.

Read More

Ruby fetch

Today, when I am refactoring a CLI I wrote, I came across a code block where I check whether an index exists in an array (turns out I don’t actually need it, I can just access the array and check if the value is nil). I went to search of Ruby Array documentation to see if such method exists.

Read More

Register in Vim

For the past months, I have started to use vim in some occasions. One day, I came across a vim video, “Let Vim Do the Typing”{:target=”_blank”}, and discover the use of register in vim. Basically, the concept of register in vim is very similar to the register in our computer.

Read More

I have been working on a project which uses Vue.js for front end. I came across a scenario where we need to allow user to add more entry in their form. Initial Approach The first thought that come to my mind will be get the div#id of the element and append it dynamically through javascript

Read More

Ruby .() notation

In Ruby, .() is a syntatic sugar for call method. class Person def call "Hello World" end end Person.new.() #=> Hello World In this example, we declare a Person class and call method in the class. With this, we can later execute Person.new.() to call the call method. Note that, we need to initialize the Person object first by calling new, since the call is a instance method.

Read More