Race conditions are always surprising, which can occur in production and are difficult to reproduce. They can cause duplication of records in the database. Most of the time the locking mechanism is taken care of by the Rails framework. Users don't have to manage it; especially optimistic locking using the lock_version column. In case of transactions and race around conditions, we can prevent these issues with Pessimistic Locking in ActiveRecord. It locks a record immediately as soon as the lock is requested(uses database row-level locking). Race conditions happen when two users read and update a record at the
Nearly every project/app needs an alert popup. It is an essential UI element to: Provide information/warning to the user before performing any actionHandle user interaction to perform any actionNotify the user on completion of an actionThe default alert popup is very simplistic. Nowadays, we see a unique style and attractive UI in popups rather than showing a classic native/default one. What do you show in a popup? Title, message, image, and action buttons. Isn't it? But if you want to make your custom alert popup, it requires a lot of effort as you need to manage UI
Dead code is code that is never executed. It can be a commented out block of code, a method that's no longer called, or an unreachable return statement. It often reflects functionality that no longer exists. Dead code has absolutely no upside and it costs us money, time, and maintenance headaches. It's possible to identify the unused block of code in smaller projects. But in larger projects, it is not as straightforward. It is a delicate process and requires absolute surety of the deadness status to avoid any unexpected breakdowns. A few tools are present that can aid us in
In the previous article, we went through How NOT IN works with NULL values. We also learned how we can overcome this restriction. In this article, we will look at alternative ways to handle NULL values with SQL functions. So basically when we use != or NOT IN in query, it ignores the records with NULL values for fields. User.where("state != ?", 'active') SELECT * FROM users WHERE state != 'active' OR User.where("state NOT IN (?)", ['active']) SELECT * FROM users WHERE state NOT IN ('active') The above queries will consider records with state having a NOT NULL value,
In most of the recent frameworks, you must have came across concept called Component. Component has became integral part of JS development these days. Those are independent and reusable bits of code, which make your code looks much more cleaner and maintainable. Here in this article, we will look into “Contextual Component” to write more flexible and expressive interfaces for your components in Ember.js framework. Problem: While working on one of the Ember.js application, we came across a requirement of adding a drop-down in the project. There were already two drop-down components, but they were very tightly coupled
In the previous post, we looked at how Ruby's top-level acts as a wrapper of the Object class. And that the definitions you put in the top-level act as if they were put in the Object class itself. But, there was one thing that I left out in that blog post, because it deserves its own attention. Module extensionIf you have a module: module Foo def bar :bar end endand you extend it in the top-level: extend Fooyou'd expect that it would extend the Object class because of what we saw in that previous post. But you'd be wrong! Object.
It was the day we were moving. I was observing how the "Packers and Movers" professionals packed our furniture. For example, the King size bed shown below had to be accommodated within a space of about 6-7 inches inside a van. While I kept wondering how they'd manage this, they dismantled the bed. And in went the camel through the needle's eye very neatly. That's when I realized the computing world is not very different from the real world. They dismantled the bed for transportation and then reassembled at the destination. Similarly, in the computing world, we deconstruct objects or
We are crafting a .NET framework based CRM web application. In our application, we have many time-consuming asynchronous processes running in the background. For that, we did azure function orchestration using azure storage queues and tables. Soon, we ran into limitations of complexity; as the application started to grow. With the application, orchestration also started to grow. Because of that, we faced significant challenges such as Error Handling, Unmanageable Code. Thus to overcome those challenges, we started using the Durable Azure Function. This article aims to explain how to achieve Orchestration using a Durable Function, an extension of the Azure
In the current era, it is tough to remain stuck in the same way of doing things. Eventually, we all need to learn, transition and evolve. The same goes for technology as well. That doesn't mean we need to rewrite or redesign what we have developed in the past. Instead, we can start implementing new ways in conjunction with the current one, thus making it interoperable. SwiftUI has been a significant change that came in much after storyboards in Xcode. Ever since the announcement, everyone has been inquisitive about playing with SwiftUI. What is SwiftUI? According to the official Apple
Code reviews are important to deliver quality and well-crafted software. But what if the PR lingers in the review queue waiting for reviewers for an extended period? We faced a similar issue in one of our team where few stories were delayed due to pending reviews from the members. In this article, I would like to share about how we improved the Code and Functional Review process resulting in high quality and happiness. *This process was identified and implemented for one of the projects and every project could have minor customization based on the nature and requirement of the project.