Guru on Rails

A day a problem solved, a year we become the Pro

Tue 11 Jun 2019

Design Patterns

Have you ever heard Template Method pattern? We thought we know it but we might be wrong. I just found a secret, a meaning of this pattern. Template method supported by inheritance. So what is temp...


Tue 26 Feb 2019

Uncategorized

Requirement: Check if the input string has balanced chars. More details please have a look at the "Result" section below. This a an interview challenge in "XYZ" company. 1. Solution. I apply single...


Sun 24 Feb 2019

SQL

1. Searching the products which have duplicated names. Product.select("name, count(*) as num").group(:name).having("num > 1") SELECT name, COUNT(*) FROM products GROUP BY name HAVING COUNT(*) &g...


Sun 17 Feb 2019

Uncategorized

This is a challenge from "XYZ" company. My solution is using message queue for "POST". For "GET", it's just a challenge, not applying in real project. Because pub/sub system would be better than de...


Mon 24 Dec 2018

Software Architecture Best Practices Performance

Rabbitmq and Sneakers would bring to us a ton of benefits. That is one of many solution for improving performance by placing synchronous work into a background work asynchronously. However, we can ...


Tue 18 Dec 2018

Design Patterns

factory_bot.rb require 'set' require 'active_support/core_ext/module/delegation' require 'active_support/deprecation' require 'active_support/notifications' require 'factory_bot/definition_hierarc...


Thu 01 Nov 2018

Problem Solving

I'm sitting here at Trung Nguyen coffeeshop in Vietnam near the Airport. I'm solving a problem for traversing tree. Some ideas just came up, I really want to write it down. We are totally wrong abo...


Wed 24 Oct 2018

Data Structures

You might know, algorithm almost needs data structure. Any data structure is born with at least one reason. What problems does it solve? Speaking of hash table, it's efficient for complex structure...


Tue 23 Oct 2018

Blockchain

Transactions move value from transaction inputs to transaction outputs. An input is a reference to a previous transaction's output, showing where the value is coming from. An output is a specific ...


Sat 20 Oct 2018

Problem Solving

Problem solving is the essential skill. So what is the good way to improve this skill? So many developers with good problem solving skill tell us that we need to train this one on daily basic. Howe...