Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles on Trending Technologies
Technical articles with clear explanations and examples
How to set the edit mode of Textbox using FabricJS?
In this tutorial, we are going to learn how to enable the edit mode of a Textbox using FabricJS. Just as we can specify the position, colour, opacity and dimension of a textbox object in the canvas, we can also edit the text in our Textbox. This can be enabled or disabled by using the editable property. Syntax new fabric.Textbox(text: String, { editable : Boolean }: Object) Parameters text − This parameter accepts a String which is the text string that we want to display inside our textbox. ...
Read MoreHow to check if the IText object has stroke using FabricJS?
In this tutorial, we are going to learn about how to check if the IText object has stroke using FabricJS. The IText class was introduced in FabricJS version 1.4, extends fabric.Text and is used to create IText instances. An IText instance gives us the freedom to select, cut, paste or add new text without additional configurations. There are also various supported key combinations and mouse/touch combinations which make text interactive which are not provided in Text. Textbox, however, which is based on IText allows us to resize the text rectangle and wraps lines automatically. This is not true for ...
Read MoreDifference between document load and DOMContentLoaded events in JavaScript
In JavaScript, understanding when to use DOMContentLoaded versus load events is crucial for optimal web performance. Both events help determine when different parts of a webpage have finished loading, but they trigger at different stages of the loading process. DOMContentLoaded Event The DOMContentLoaded event fires when the HTML document has been completely loaded and parsed, without waiting for stylesheets, images, and subframes to finish loading. This makes it ideal for DOM manipulation scripts that don't depend on external resources. Syntax document.addEventListener("DOMContentLoaded", function(e) { console.log("DOM is ready"); }); Example: DOMContentLoaded Event ...
Read MoreExplain Passport in Node.js?
Passport is a popular Node.js authentication middleware that provides flexible authentication strategies. It handles user authentication, password encryption, and session management with minimal code complexity. Passport offers over 500 authentication strategies including local authentication, OAuth (Google, Facebook), JWT tokens, and more. It integrates seamlessly with Express.js and popular databases like MongoDB. Key Features Authentication Strategies: Passport supports multiple authentication methods through strategy plugins. The most common is passport-local for username/password authentication. Password Security: Automatically handles password hashing and verification using secure algorithms, protecting user credentials from being stored in plain text. Session Management: Maintains user ...
Read MoreHow to convert JSON results into a date using JavaScript?
JSON is a powerful data format to exchange data from server to client and vice versa. Many times JSON data is received in a String format and we need to convert it to a usable JSON object. In this process, it's an important requirement to convert string data into Date format. In this article, we will learn how to convert JSON results into a Date string using JavaScript. The JSON objects contain the date like this − { name: "John", time: '/Date(1559072200000)/' } And the result will be − ...
Read MoreGroup strings starting with similar number in JavaScript
In JavaScript, you can group strings that start with the same number by extracting the first part before the decimal and comparing consecutive elements. This is useful when working with version numbers, decimal classifications, or any structured string data. Problem Statement Given an array of number strings like this: const arr = ["1.1", "1.2", "1.3", "2.1", "2.2", "3.1", "3.2", "3.3", "4.1", "4.2"]; console.log("Input array:", arr); Input array: [ '1.1', '1.2', '1.3', '2.1', '2.2', '3.1', '3.2', '3.3', '4.1', '4.2' ] We need to group all strings starting with the same number into ...
Read MoreRecursion example in JavaScript to display numbers is descending order?
In this article, we will display numbers in descending order using recursion in JavaScript. Recursion is a programming technique where a function calls itself to solve smaller instances of the same problem. Input-Output Scenario Let's look at an input-output scenario where we need to print numbers in descending order from a given number to 1: Input = 10 Output = 10 9 8 7 6 5 4 3 2 1 What is Recursion? The process of a function calling itself is called recursion. The function which calls itself is known as a recursive ...
Read MoreConvert 2d tabular data entries into an array of objects in JavaScript
Converting 2D tabular data into an array of objects is a common requirement when working with datasets. This transformation groups rows by a unique identifier and creates objects with dynamic properties. Problem Overview Suppose we have an array of arrays representing tabular data: const arr = [ ["Ashley", "2017-01-10", 80], ["Ashley", "2017-02-10", 75], ["Ashley", "2017-03-10", 85], ["Clara", "2017-01-10", 90], ["Clara", "2017-02-10", 82] ]; We need to transform this into an array of objects where each unique name becomes a ...
Read MoreSplit a range of number to a specific number of intervals JavaScript
In this problem statement, our task is to write a function that splits a range of numbers into a specific number of intervals using JavaScript. We need to provide the start value, end value, and the number of intervals. Understanding the Problem The problem requires creating a function that divides a numerical range into equal intervals. The inputs are the starting number, ending number, and desired number of intervals. The output should be an array of subarrays, where each subarray represents an interval with its start and end values. For example, if the range is from 0 ...
Read MoreFinding the largest and smallest number in an unsorted array of integers in JavaScript
In JavaScript, finding the largest and smallest numbers in an unsorted array is a common programming task. We can efficiently solve this using a linear scan approach without sorting the entire array. Understanding the Problem Given an unsorted array of integers, we need to find both the minimum and maximum values. For example, in the array [11, 21, 14, 32, 20, 12], the smallest number is 11 and the largest is 32. The challenge is to find these values efficiently without sorting the array first. Method 1: Linear Scan Approach The most straightforward approach uses a ...
Read More