How many time have you been bitten up by timezone in PostgreSQL? I’m not sure about you but every time I work with timezone, I get f*cked by it. Every single time, I have to reread certain resources and google search again to make sure I am understanding the behavior of it correctly.

Read More

In my previous blog post, Debugging with Tracing in Elixir, I mentioned about using recon_trace from recon to trace your function calls in your live system. After using recon_trace a few times and always needing to going back to the documentation to figure out how to use it correctly, I decided to write this post to document the common usage I came across.

Read More

Lately, I have been struggling to accomplish anything I set out to do. I want to do a lot of things. Yet, I accomplished nothing. Do you have the similar experience and struggling as well? Let me tell you the single trick I use to get better. Focus on one thing at a time.

Read More

In this post today, I’ll share about how I setup blue green deployment for my Phoenix application using nginx running on a single machine. This post is made possible thanks to this article about Custom Blue Green Deployment with Nginx And Gitlab CI. The core idea to make blue green deployment possible for Elixir releases with nginx is through:

Read More

Lately, I have been working overtime to meet the expectation I set out to achieve in work. I achieve majority of the goals I set out at the cost of losing something that is more precious than anything else. I almost reach the point of burning out. And here’s what I do next.

Read More

2020 in Review

This is my first attempt to reflect upon a year of my life, writing it down and publishing it publicly. Hopefully, sometime in the future, this post will remind my future self how I lived through 2020, one of the toughest year of most people life. Year 2020, has been great for me.

Read More

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. This post assume that you have the basic knowledge of Docker, building Elixir release and using Elixir 1.

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*fromusersWHEREroleISNULLThe index does not work for such query in Oracle database. This is because when Oracle database is inserting the new record of user where the role is NULL, it does not add the created row to the index.

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: require 'sinatra' require 'json' get '/' do content_type :json JSON({message: "Hello World"}) end How can we achive that in Elixir?

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. It is a temporary memory space for vim to store text.

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