Custom Utility Types in TypeScript

TypeScript's type system makes it very easy to add types as per our requirements. But most of the time, we may need to perform some transformations on existing types to get resultant type as per our requirements instead of adding a new one. Some common type transformations may include: Extraction of types Exclusion/Inclusion of types Setting types to required/optional Utility Types provided by TypeScript help in performing such type transformations. Utility Types are built-in and globally accessible functions available in TypeScript. Under the hood, they make use of Generics extensively. Some frequently used Utility Types are as follows:

Rails 7 supports tracking of belongs_to association

One of the most convenient features of Rails is the ability to track attribute changes. Rails 7 is releasing soon and bringing in a lot of new features as a treat for developers. One of the many features that Rails 7 is introducing, is that we can also track the associated object. This Rails ActiveRecord specific PR has added two methods for tracking the changes for the belongs_to association. In this article, we will discuss these two new methods with the help of examples. 1. association_changed?The association_changed? method tells if a different associated object has been

Quick Guide: Integrating Widevine DRM In ExoPlayer For Android

Day by day OTT platforms are getting popular and along with that, it is increasing the fear of content security breaches. Ever amazed at How do these platforms secure streaming content from piracy or content leakage? How the content distributions are being controlled? Initially, I had all these doubts and after diving deep I got introduced to DRM. What is DRM? DRM stands for Digital Rights Management. It is a system that uses various licenses, keys and encryption techniques to protect the digital contents and also ensures that only an authorized user can decrypt the file with the help of

Invite email with Add to Calendar link using C#

Have you ever organized an event where many of the registered guests didn't attend the event? To ensure maximum turnaround in an event, an email with an AddToCalendar link can be beneficial as it will help to remind the attendees once they add it to their calendar. Let's see how we can generate and add this magical link in our emails. What you’ll need? An ICS (Internet Calendar Scheduling) FileAn MVC API to download the fileAn ICS File 👀 What is that? The ICS format is a universal calendar file format that all popular calendar applications, including Microsoft Outlook, Apple

Side effects of Active Record's new feature #invert_where in Rails 7

Rails 7 is introducing a new method invert_where that will invert all scope conditions. It allows us to invert an entire where clause instead of manually applying conditions. We can either chain invert_where to a scope or to a where condition. class Account scope :active, -> { where(active: true) } end Account.active.invert_where => "SELECT \"accounts\".* FROM \"accounts\" WHERE \"accounts\".\"active\" != 1"Account.where(active: true).invert_where => "SELECT \"accounts\".* FROM \"accounts\" WHERE \"accounts\".\"active\" != 1"What are the various side effects of using invert_where?1. The invert_where method inverts all the where

Active Record Encryption in Rails 7

If you're hosting your web server in a particular region, it might be necessary to comply with the GDPR norms of that region. Anonymizing and encrypting data becomes necessary in such situations. In this blog, we will discuss the attribute encryption that Rails 7 provides right out of the box. And we will also see the Deterministic & Non Deterministic approaches. (If you're using Rails version lesser than 7, check out our previous blog here on how to write a custom encryption framework.) ActiveRecord attribute encryption in Ruby on Rails for better securityIn this blog post, we will explore a

Statistics for Data Analysis with Kotlin

Statistics is the grammar of science. - Karl PearsonData is the new oil. Just type in "Data Science" inside the Google Trends search box, and you would believe it too. The interest over time for data science has taken a boost in the recent past, for reasons as obvious as the theory of evolution and the survival of the fittest! One blog even read that the job of a data scientist is the sexiest job of the 21st century! What comes to our minds whenever we talk about which programming language to pick for data science? Let us be honest,

Understanding applications of useRef hook in React with examples

Hooks introduced in React 16.8, allow us to use stateful logic, lifecycle methods, and side-effects in Functional Components. React's official doc on Hooks is the best way to get you started with them. useRef is one such very helpful Hook that returns a mutable ref object having current property initialized with the value passed as the argument. This mutable object's value persists across multiple renders in the lifecycle of the component and can have various applications based on use-cases. In this blog, we'll understand different scenarios in which the useRef Hook can be helpful with the aid of examples.

10 Xcode shortcuts every iOS Developer should know

Whether beginner, intermediate or advanced developer, we all want to achieve our task by developing workable code. We want to accommodate changes soon to ensure efficiency too. But what if we are not too familiar with the IDE? We land up doing things that take much more time & effort than required. Xcode has a wide variety of these shortcuts, so here are some of them which helped us achieve our tasks faster: Move Line Up Command(⌘) + Option(⌥) + [ shifts the selected piece of code upward, to rearrange the current code. Alternatively, we can also use the same shortcut via Editor

React Design Patterns Basic to Advance - Part 2

In the previous article of the React Design Patterns Basic to Advance series, we became familiar with the Basic Design Patterns which are widely used in React. In this article, we will learn about the various Advanced Design Patterns in React. React design patterns basic to advanceAs a Frontend developer and working on React for several months, one of thetopics I have paid close attention to is Design Patterns. In this article serieson React design patterns, I will share my learnings. This blog is completely about the design patterns which are widely used in Reactapp deve…Kiprosh BlogsShubham JajooAdvanced Design