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 by Chandu yadav
Page 18 of 81
How to convert a binary NodeJS Buffer to JavaScript ArrayBuffer?
Converting a binary NodeJS Buffer to JavaScript ArrayBuffer is a common requirement when working with binary data across different JavaScript environments. There are multiple approaches to achieve this conversion. Method 1: Using buf.buffer Property (Direct Access) The simplest approach is to access the buf.buffer property directly. However, this creates a view of the underlying ArrayBuffer, not a copy. const buffer = Buffer.from([1, 2, 3, 4, 5]); console.log("Original Buffer:", buffer); // Direct access to underlying ArrayBuffer const arrayBuffer = buffer.buffer; console.log("ArrayBuffer byteLength:", arrayBuffer.byteLength); // Create Uint8Array view to inspect data const uint8View = new Uint8Array(arrayBuffer); ...
Read MoreHow to perform Automated Unit Testing with JavaScript?
To perform automated unit testing in JavaScript, Unit.js is a cross-platform open-source unit testing framework that provides a simple and intuitive API for testing JavaScript applications. What is Unit.js? Unit.js is a JavaScript testing framework that works in both Node.js and browsers. It offers a fluent interface for writing readable test assertions and supports various testing patterns. Basic Syntax Unit.js uses a chainable syntax where you specify the data type and then chain assertion methods: test.dataType(value).assertionMethod(expectedValue); Simple String Testing Example Here's a basic example of testing a string value: ...
Read MoreUsage of -moz-opacity property with CSS
The -moz-opacity property was a Mozilla-specific CSS property used to set the opacity of HTML elements, including images. This property created transparent effects in older Firefox browsers before the standard opacity property was widely supported. Browser-Specific Opacity Properties Different browsers historically required different approaches for opacity: Mozilla Firefox: -moz-opacity Internet Explorer: filter: alpha(opacity=x) Modern browsers: opacity (standard) Syntax /* Legacy Mozilla syntax */ -moz-opacity: value; /* IE filter syntax */ filter: alpha(opacity=value); /* Modern standard syntax */ opacity: value; The value ranges from 0 (completely transparent) to 1 ...
Read MoreUsage of CSS border-collapse property
The border-collapse CSS property controls how adjacent table cell borders are displayed. It determines whether borders should merge together or remain separate. Syntax border-collapse: collapse | separate | initial | inherit; Values Value Description collapse Adjacent borders are merged into a single border separate Each cell maintains its own borders (default) initial Sets to default value (separate) inherit Inherits from parent element Example Here's a comparison showing both collapse and separate values: ...
Read MoreChange the style of left border with CSS
The border-left-style property in CSS allows you to change the style of an element's left border. This property accepts various values like solid, dashed, dotted, double, and more to create different visual effects. Syntax border-left-style: value; Available Border Styles The border-left-style property accepts several values: solid - A single solid line dashed - A series of dashes dotted - A series of dots double - Two parallel lines groove - A 3D grooved border ridge - A 3D ridged border inset - A 3D inset border outset - A 3D outset border ...
Read MoreRaise the Mobile Safari HTML5 application cache limit?
Mobile Safari imposes specific limits on HTML5 application cache storage, unlike desktop Safari which has no strict limits. Understanding these constraints is crucial for mobile web development. Mobile Safari Cache Limits The default application cache limit on mobile Safari is 5MB. This applies to the overall cache storage allocated to your web application. Desktop Safari No Limit Unlimited Cache Mobile Safari 5MB Limit ...
Read MoreUsage of border-bottom-color property in CSS
The border-bottom-color CSS property sets the color of an element's bottom border. It only affects the color when a border style is already defined. Syntax border-bottom-color: color | transparent | inherit; Parameters The property accepts these values: color - Any valid CSS color value (hex, RGB, named colors) transparent - Makes the border invisible inherit - Inherits the color from parent element Example: Basic Usage ...
Read MoreUsage of border-left-style property in CSS
The border-left-style property defines the style of an element's left border. It accepts various values like solid, dashed, dotted, double, and more to create different visual effects. Syntax border-left-style: value; Available Values Value Description none No border (default) solid Solid line dashed Series of dashes dotted Series of dots double Two parallel lines groove 3D grooved effect ridge 3D ridged effect Example: Different Border Styles ...
Read MoreMake HTML5 Canvas fill the whole page
To make an HTML5 canvas fill the entire browser viewport, you need to remove default margins/padding and set the canvas dimensions to 100% of the page. CSS Setup First, reset the default browser styles and set up the HTML structure: * { margin: 0; padding: 0; } body, html { height: 100%; overflow: hidden; /* Prevents scrollbars */ } #canvas { position: absolute; top: 0; left: 0; ...
Read MoreUsage of border-bottom-width property in CSS
The border-bottom-width property sets the thickness of an element's bottom border. It only takes effect when border-style is defined, as borders need a style to be visible. Syntax border-bottom-width: value; Values The property accepts the following values: thin - A thin border (typically 1px) medium - A medium border (typically 3px) thick - A thick border (typically 5px) length - Custom width in px, em, rem, etc. inherit - Inherits from parent element Example with Different Widths ...
Read More