Everything You Need to know about Serialization in Ruby on Rails - Part III

We had previously talked about the Serialization formats and How Serialization is implemented for storing objects in the relational database in the first two parts of the blog series. This article focuses on the various Serializers that prepare and construct API transferable data in Ruby on Rails.

Select email provider at runtime in a Ruby on Rails application

Recently we had a requirement where emails were to be delivered to a specific group of users by choosing the provider at run time. In short, we are required to deliver the emails by dynamically selecting a provider and not just through a pre-configured provider. Rails provide these Dynamic Delivery Options to override the SMTP settings per mail. But, if you have an existing application with various mailers, applying delivery_method_options will require updating individual mailer action. In this blog, we'll go through the approaches that will work without modifying any existing mailer actions. Setup Assuming that your default

Integrating The Silver Searcher with Vim's 'grepprg' (without any plugins)

Vim has a command called :grep (:help :grep), which is used for searching plain text across the project. Internally it uses the *nix grep utility to perform the search. However, the grep utility is very slow, especially for larger projects, which means you might want to use something else like ag (follow the instructions given in the official repo for installation). Understanding :grepWhen we execute let's say :grep text_to_find in Vim, it will look at the value of the option called 'grepprg' (:help 'grepprg'), replace $* with text_to_find, and then pass it to the shell for execution.

Diving Deeper Into Kotlin Standard Library Functions

When we search for "Android Development in Kotlin," we come across many articles about Getting Rid of NullPointerException, Smart Type Casts, Complete Interoperability With Java, etc.; however, there are a handful of articles that list down advance and handy Kotlin functions. These functions make development simpler & more manageable. Kotlin offers a very concise and intuitive syntax; hence it helps to avoid the boilerplate code. Kotlin's standard library has become powerful with advanced in-built methods. Therefore I thought to pen down the most useful, commonly required, and less talked Kotlin standard library functions. Let's dig deeper and find the hidden

React Design Patterns Basic to Advance - Part 1

As a Frontend developer and working on React for several months, one of the topics I have paid close attention to is Design Patterns. In this article series on React design patterns, I will share my learnings. This blog is completely about the design patterns which are widely used in React app development. So before diving deep directly into design patterns, we will look into a short introduction of React and JSX. React React is a JavaScript library for building user interfaces. It lets you compose complex UI from small and isolated pieces of code called Components. Component in React

Rails Parameters Parsing and the Case of Parameters Corruption

Rails is a developer-friendly web application framework that enables developers to do more with less code, but it isn’t always clear exactly what’s going on under the covers. One area where I’ve had a hard time was understanding how Rails parses the Request query parameters and the Form variables. So what's a query parameter? Query parameters are an optional set of key-value pairs that appear after the question mark in the URL. For example, name=contra is a query parameter in https://example.com/over/there?name=contra. And what's a form variable? When we submit a

Use case comparison between CSS Grid and Flexbox

Responsive design is a must-have in web design right now. And that can be easily achieved using CSS Grid or Flexbox. The CSS Grid Layout Module offers a grid-based layout system, with rows and columns, making it easier to design web pages without having to use floats and positioning. The Flexible Box Layout Module, makes it easier to design flexible responsive layout structure without using float or positioning. In this article, we are going to look into the differences between CSS Grid and Flexbox. Are they a replacement for each other? Do they go hand in hand together? Can they

Ember Composable Helpers

In this article, we will look into what are Ember Composable Helpers and how are those useful but before that let's have a look at what are helpers in Ember.js What is a Helper?Helpers in Ember.js can be module or function that provides templates with the ability to have additional functionality. They help in formatting the data as required by the template. ExampleLet's consider an example: We have a list of arrays of movies as given below: /** This is an array of objects of movies **/ const movies=[ { name:"Joker", isSuccessful:true }, { name:"Titanic", isSuccessful:true }, { name:"The

How to resolve the issue with JW player that keeps playing audio despite switching to another player

Recently we have introduced a live streaming feature in our application. For that, we have used a JW player as it is easy to show youtube videos first and then streaming live events. We have also implemented a feature for an alternate player option for the end-user if there is any streaming issue. For that, we have used Flow player as it is lightweight and powerful. So we have JW Player as the default player and Flow player as an alternative. We have integrated the JW player library into our application from here and the flow player library from here.

Rate limiting using Redis in a Rails app

The web is a weird place. You go to sleep thinking that you have a perfectly functional web application and the next day when you wake up, you might find yourself staring at a sudden huge spike in the number of requests. Either your app got popular overnight or you were just a victim of a DOS attack trying to bring your app server down. Usually, it's the latter. There are some popular gems like rack-attack and rack-throttle which work quite well and provides a lot of flexibility. But if you're looking to write your custom logic with minimum dependencies,