Guru on Rails

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

Thu 18 Jul 2019

Performance Best Practices SQL

If we work on a complex system, queries are pretty complex with a ton of subqueries, we would encounter the problem of optimization of query. In order to achieve a goal, we have many ways to do. So...


Tue 02 Jul 2019

AngularJS Javascript Problem Solving MERN Stack

Below is Angular code but you can do it simple, just focusing on the encodeURIComponent. Read the link below to get to know the reason.  get html() { return this.viewTrustDocx; } private get viewTr...


Thu 27 Jun 2019

Uncategorized

Actually, in my opinion there is nothing best. Anything has its own advantages and disadvantages. It depends on the context we apply the proper technology, design patterns, best practices etc. Some...


Tue 25 Jun 2019

Javascript Design Patterns

Observer The Observable pattern is one that allows an object, called subject, to keep track of other objects, called observers, interested in the subject state. When the subject state changes, it n...


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...