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
Determining beautiful number string in JavaScript
A numeric string is called a beautiful string if it can be split into a sequence of two or more positive integers, satisfying the following conditions: arr[i] - arr[i - 1] = 1, for any i in the sequence, i.e., each element is exactly one more than the previous element. No element should contain a leading zero. For example, '50607' can be split into [5, 06, 07], but it's not beautiful because 06 and 07 have leading zeros. The sequence order cannot be rearranged. Example For ...
Read MoreLargest sum of subarrays in JavaScript
Finding the maximum sum subarray is a classic algorithmic problem in JavaScript. Given an array of numbers, we need to find the contiguous subarray with the largest sum. This problem is commonly known as the Maximum Subarray Problem and has practical applications in data analysis and optimization. Problem Statement Given an array of integers, find the contiguous subarray with the maximum sum. For example, given the array: [-3, 4, 2, -1, 6, -5, 3, -2, 7, 1] The maximum subarray sum would be: 15 This comes from the subarray [4, ...
Read MoreFinding Fibonacci sequence in an array using JavaScript
In JavaScript, finding the longest Fibonacci subsequence in an array involves identifying a sequence where each element is the sum of the two preceding ones. This is a dynamic programming problem that requires careful tracking of potential Fibonacci sequences. Fibonacci Sequence Definition A sequence X₁, X₂, ..., Xₙ is Fibonacci if: n ≥ 3 (at least 3 elements) Xᵢ + Xᵢ₊₁ = Xᵢ₊₂ for all valid i (each element equals sum of previous two) Problem Statement Given an array of numbers, find the length of ...
Read MoreHow to lock the horizontal movement of a Circle using FabricJS?
In this tutorial, we are going to learn how to lock the horizontal movement of a Circle using FabricJS. Just as we can specify the position, colour, opacity and dimension of a circle object in the canvas, we can also specify whether we want it to move only in the Y-axis. This can be done by using the lockMovementX property. Syntax new fabric.Circle({ lockMovementX: Boolean }: Object) Parameters options (optional) − This parameter is an Object which provides additional customizations ...
Read MoreHow to set the fill colour of text in Textbox using FabricJS?
In this tutorial, we are going to learn how we can change the appearance of a Textbox object by changing the fill colour of its text using FabricJS. We can customize, stretch or move around the text written in a textbox. In order to create a textbox, we will have to create an instance of fabric.Textbox class and add it to the canvas. We can change the fill colour by using the fill property which allows us to specify the colour of the text in the Textbox. Syntax new fabric.Textbox(text: String, { fill: String }: Object) ...
Read MoreHow to identify the type of an Image instance using FabricJS?
In this tutorial, we are going to learn how to identify the type of an Image instance in FabricJS. We can create an Image object by creating an instance of fabric.Image. Since it is one of the basic elements of FabricJS, we can also easily customize it by applying properties like angle, opacity etc. In order to identify the type of an Image instance, we use the isType method. Syntax isType(type: String): Boolean Parameters type − This parameter accepts a String which specifies the type we want to check. ...
Read MoreExplain Popup Message using Event?
We can show popup messages to app users using JavaScript popup boxes. There are three different types of popup boxes available in JavaScript that trigger through events like button clicks. The three types of popup boxes are: Alert box - Shows a simple message Confirm box - Asks for user confirmation Prompt box - Collects user input Let's explore each popup type with event-driven examples. Alert Box The alert box displays a simple message to users. It's commonly used for notifications like "Login successful" ...
Read MoreHow to add a tooltip to a div using JavaScript?
To add a tooltip to a div using JavaScript, first create a function that will generate the tooltip content. Next, add an event listener to the div that will call the function and display the tooltip when the div is hovered over. Finally, use CSS to style the tooltip and position it appropriately. A tooltip is a small text box that appears when a user hovers over a specific element on a webpage, such as a button, link, or image. The tooltip typically contains additional information or context about the element that the user is hovering over. Tooltips are ...
Read MoreHow to auto like all the comments on a Facebook post using JavaScript?
Important Legal and Ethical Notice: This article is for educational purposes only. Auto-liking comments may violate Facebook's Terms of Service and could result in account suspension. Always respect platform policies and user consent. To auto-like all comments on a Facebook post using JavaScript, you need to use the Facebook Graph API. This requires proper authentication, API permissions, and careful handling of rate limits. Requirements Before implementing this functionality, you must have: A Facebook App registered at Facebook for Developers Valid Access Token with required permissions (user_posts, user_likes) Permission to access the specific post and its ...
Read MoreHow to convert Map keys to an array in JavaScript?
In JavaScript, you can convert a Map's keys to an array using several methods. The most common approaches are using Array.from(), the spread operator, or a for...of loop with Map.keys(). Given a JavaScript Map, the task is to extract all keys and create an array from them. Here's an example: Given Map: Map { 1 => "India", 2 => "Russia", 3 => "USA", 4 => "Japan", 5 => "UK" } Resulting Array: [1, 2, 3, 4, 5] There are multiple ways to achieve this conversion: Using Array.from() and Map.keys() method ...
Read More