bio photo

Notes on things I've learned

→ Twitter → Github

Polymorphic association in Ecto (Part I) Aug 08, 2017

Polymorphic association in database is when you have multiple tables that need to refer to the same table. For example, I have table users that contains details like profile information. I then have two tables, guards and operators which both have profile information. I need to link that to users

Piping (|>) to second argument in Elixir Nov 16, 2016

Pipe operator in Elixir is great, you can compose your functions naturally. However, there are times when you want to pipe the input to the second argument. How would you do that? Desugar iex> sum_number = fn x, y -> x - y end iex> sum_number.

Multi-tenancy with Ecto, Part 1 Nov 14, 2016

With Ecto 2.0, there is support for Postgres schema or multiple databases for MySQL. What I am trying to do here is to use Postgres schema to achieve multi-tenancy, and of course using Ecto. Disclaimer: This is mostly for my personal notes as I try to understand Ecto/Elixir

Django multi tenant issues with Celery + Postgres Mar 18, 2016

You can quickly build a multi-tenant site in Django with the help of this nifty package django-tenant-schemas. It works by assigning each tenant into its own database schema and having one public schema for anything that needs to be shared. It wraps Django's connection with its own wrapper that help

Class based Celery task Oct 13, 2015

In the previous post, I showed you how to implement basic Celery task that make use of @task decorator and some pattern on how to remove circular dependencies when calling the task from Flask view. Let's recall some part of the code. def run_task_async(): task = chain(long_run_

Celery integration with Flask Sep 08, 2015

As of Celery version 3.0 and above, Celery integration with Flask should no longer need to depend on third party extension. That's what they said. However, my experience integrating Celery with Flask especially when using Flask with blueprints shows that it can be a little bit tricky. Challenges So

Change IP address for existing nodes in CDH 5.3 Jan 12, 2015

Today I discovered way to handle changes of IP address for Hadoop cluster managed by CDH 5.3. I think this should also be applicable for CDH 5.x. Took me couple of hours to figure this one out :/ I've done this previously but it was on CDH 4.x.

Creating Brew external command Jan 03, 2015

Recently I had the need to create a homebrew external command to extend homebrew default behavior. My goal is to extend brew deps command by creating a new command brew deps-group. Executing the command will list all top-level packages in homebrew that is related to each other by common dependencies,

Kaggle: Bike Sharing Demand Part 1 Nov 03, 2014

Finally had a chance to play around with Kaggle challenge, and bike sharing demand seems to be the easiest to tackle - no domain expertise required or atleast very minimal. This is going to be Part 1 where I'll go over how I apply minimal statistical knowledge to extract features.