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
Can split array into consecutive subsequences in JavaScript
We are required to write a JavaScript function that takes in an array of sorted integers and determines if we can split it into consecutive subsequences of at least 3 elements each. Problem Statement Our function should return true if we can split the array into 1 or more subsequences where each subsequence consists of consecutive integers and has length at least 3, false otherwise. Input: const arr = [1, 2, 3, 3, 4, 5]; Expected Output: true Explanation: We can split the array into two consecutive subsequences: 1, 2, ...
Read MoreHow to create a canvas with help cursor on hover over objects using FabricJS?
In this article, we are going to create a canvas with a help cursor on hover using FabricJS. The help cursor is one of the native cursor styles available which can be used in FabricJS canvas applications. FabricJS provides various types of cursors such as default, all-scroll, crosshair, col-resize, row-resize, etc. that reuse the native cursor under the hood. The hoverCursor property sets the style of the cursor when hovered over a canvas object. Syntax new fabric.Canvas(element: HTMLElement|String, { hoverCursor: String }: Object) Parameters ...
Read MoreHow to Add Google Maps to a Website?
In this article, we will be exploring Google Maps and how to add or embed google maps into our HTML template/website. Once the Google Maps are embedded into the website we can pin a location in it to display the user the current position of the store or a company. Steps to Embed Google Maps Below are the steps that need to be followed to embed Google Maps into your HTML pages: We need to generate an API key to be able to use Google maps privately. Creating the HTML ...
Read MoreHow to set the padding of a Circle using FabricJS?
In this tutorial, we are going to learn how to set the padding of a Circle using FabricJS. Circle is one of the various shapes provided by FabricJS. In order to create a circle, we will have to create an instance of fabric.Circle class and add it to the canvas. Just as we can specify the position, colour, opacity and dimension of a circle object in the canvas, we can also set the padding of a circle object. This can be done by using the padding property. Syntax new fabric.Circle({ padding : Number }: Object) ...
Read MoreHow to set the style of controlling corners of a Triangle using FabricJS?
In this tutorial, we are going to learn how to set the style of controlling corners of Triangle using FabricJS. Triangle is one of the various shapes provided by FabricJS. In order to create a triangle, we will have to create an instance of fabric.Triangle class and add it to the canvas. The controlling corners of an object allow us to scale, stretch or change its position. We can customize our controlling corners in many ways such as adding a specific colour to it, changing its size, etc. We can change the style by using the cornerStyle property. ...
Read MoreWhat are the attributes that work differently between React and HTML?
React and HTML handle attributes differently, which can cause confusion for developers. While HTML attributes are always strings, React treats some attributes as JavaScript expressions and has specific naming conventions that differ from standard HTML. Key Differences in Attribute Handling The main differences between React and HTML attributes include: Naming Convention: React uses camelCase (onClick) vs HTML's lowercase (onclick) JavaScript Expressions: React attributes can accept JavaScript functions and expressions Special Attributes: Some HTML attributes have different names in React Boolean Handling: React handles boolean attributes differently than HTML Event Handler Attributes React event ...
Read MoreHow to create a Text with dash pattern border using FabricJS?
In this tutorial, we are going to create a Text with a dash pattern border using FabricJS. We can display text on canvas by adding an instance of fabric.Text. Not only does it allow us to move, scale and change the dimensions of the text but it also provides additional functionality like text alignment, text decoration, line height which can be obtained by the properties textAlign, underline and lineHeight respectively. We can change the appearance of the dashes of border, by using the borderDashArray property. However, our text object must have borders in order for this property to work. If ...
Read MoreHow to disable a specific control point of Line object using FabricJS?
In this tutorial, we are going to learn about how to disable a specific control point of Line object using FabricJS. A Line element is one of the basic elements provided in FabricJS. It is used for creating straight lines. Because line elements are geometrically one-dimensional and do not contain an interior, they are never filled. We can create a line object by creating an instance of fabric.Line, specifying the x and y coordinates of the line and adding it to the canvas. In order to disable a specific control point of Line object, we use the setControlVisible method. ...
Read MoreHow to add float numbers using JavaScript?
In JavaScript, floating-point numbers can be added directly using the addition operator (+). The parseFloat() function converts strings to floating-point numbers, but is not required when working with numeric literals. Example 1: Direct Addition The simplest way to add float numbers is using the addition operator directly: let inputFloat1 = 2.3; let inputFloat2 = 3.5; console.log("The two float values are:", inputFloat1, "and", inputFloat2); let result = inputFloat1 + inputFloat2; console.log("The sum of the float values is:", result); The two float values are: 2.3 and 3.5 The sum of the float values ...
Read MoreUse jQuery to get values of selected checkboxes?
jQuery provides an efficient way to get values of selected checkboxes using the :checked selector combined with checkbox input elements. This is useful for forms where users can select multiple options. Syntax $('input[type="checkbox"]:checked') // or $('input[name="checkboxName"]:checked') Basic Example Here's a complete example that demonstrates getting values of selected checkboxes: jQuery Checkbox Values Select your hobbies: ...
Read More