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 Mayank Agarwal
Page 4 of 31
agent.maxFreeSockets Property in Node.js
The agent.maxFreeSockets property defines the maximum number of sockets that can be kept open in the free state for connection reuse. This is part of Node.js HTTP agent configuration and helps optimize HTTP connection pooling. Syntax agent.maxFreeSockets = number Parameters number – Specifies the maximum number of sockets that can remain open in the free state. Default value is 256. Understanding Free Sockets Free sockets are HTTP connections that have completed their current request but remain open for potential reuse. This improves performance by avoiding the overhead of establishing new ...
Read MoreCreating a Dynamic Report Card using HTML, CSS, and JavaScript
In this article, we are going to build a dynamic report card using the inputs entered by the user. The user will enter student names and marks for different subjects, and our application will automatically calculate the total marks, average percentage, and pass/fail status. We will be using HTML, CSS, and JavaScript for the implementation. This interactive report card system allows teachers or administrators to quickly generate student performance reports by simply entering marks and clicking a calculate button. Project Overview We will create an HTML form with input fields for student name ...
Read MoreJavaScript: How to allow users to change the font-size of a webpage?
In this article, we will explore how to create a dynamic font size control feature that allows users to adjust the font size of webpage content. This accessibility feature is commonly found on government websites and helps users customize text size for better readability. We'll implement this functionality using both vanilla JavaScript and jQuery approaches to give you flexibility in your implementation. Method 1: Using jQuery This example demonstrates a simple implementation with increase and decrease buttons that modify the font size of specific content areas. Change Font ...
Read Moreasync.queue() Method in Node.js
The async module provides different functionalities to work with asynchronous JavaScript in a Node.js application. The async.queue() method creates a queue object for concurrent processing of tasks, allowing multiple items to be processed simultaneously based on a specified concurrency limit. Installation First, initialize your Node.js project and install the async module: npm init npm install --save async Then import the async module in your program: const async = require('async'); Syntax async.queue(worker, concurrency) Parameters worker – A function that processes each ...
Read Morecipher.final() Method in Node.js
The cipher.final() method in Node.js returns the remaining encrypted data after all input has been processed through cipher.update(). This method completes the encryption process and can only be called once per cipher instance. Syntax cipher.final([outputEncoding]) Parameters outputEncoding – Optional string parameter specifying the output format. Common values include 'hex', 'base64', 'latin1'. If not provided, returns a Buffer. Return Value Returns a Buffer containing the final encrypted data, or a string if outputEncoding is specified. Example 1: Basic Usage with Different Encodings // Importing ...
Read Morecipher.update() Method in Node.js
The cipher.update() method is used to update the cipher with data according to the specified encoding format. It is one of the built-in methods provided by the Cipher class within the crypto module. If an input encoding is specified, the data argument is a string; otherwise, the data argument is a buffer. Syntax cipher.update(data, [inputEncoding], [outputEncoding]) Parameters The parameters are described as follows: data – The data to be encrypted. Can be a string or buffer. ...
Read Morecrypto.createCipheriv() Method in Node.js
The crypto.createCipheriv() method creates and returns a cipher object using the specified algorithm, key, and initialization vector (IV). This method is essential for encrypting data in Node.js applications. Syntax crypto.createCipheriv(algorithm, key, iv, options) Parameters The parameters are described below: algorithm – The encryption algorithm to use (e.g., 'aes-256-cbc', 'aes-192-cbc') key – The raw key used by the algorithm. Can be string, ...
Read MoreJavaScript: How to Create an Object from Key-Value Pairs
In JavaScript, there are several ways to create objects from key-value pairs. Whether you have individual keys and values or arrays of data, you can build objects dynamically using different approaches. Using Object Literal Syntax The simplest way is to create an empty object and assign properties directly: Object Using Key-value Pair Welcome to Tutorials Point let object = {}; let firstKey ...
Read Morecrypto.createDiffieHellmanGroup() Method in Node.js
The crypto.createDiffieHellmanGroup() method creates a predefined Diffie-Hellman group using well-known parameters. This is an alias for crypto.getDiffieHellman() and provides a secure way to establish shared secrets between parties. Syntax crypto.createDiffieHellmanGroup(name) Parameters name − A string specifying the predefined group name (e.g., 'modp1', 'modp2', 'modp5', 'modp14', 'modp15', 'modp16', 'modp17', 'modp18'). Return Value Returns a DiffieHellman object that can generate keys and compute shared secrets. Example 1: Basic Usage with modp1 Create a file with name − diffieHellmanGroup.js and copy the below code snippet. After creating ...
Read Morecrypto.createECDH() Method in Node.js
The crypto.createECDH() method creates an Elliptic Curve Diffie-Hellman (ECDH) key exchange object using a predefined curve. ECDH is a cryptographic protocol that allows two parties to establish a shared secret over an insecure channel. Syntax crypto.createECDH(curveName) Parameters curveName - A string specifying the predefined elliptic curve to use. You can get available curves using crypto.getCurves(). Return Value Returns an ECDH object that can generate key pairs and compute shared secrets. Example 1: Basic ECDH Key Generation // Import the crypto module const crypto = require('crypto'); // ...
Read More