Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Server Side Programming Articles - Page 717 of 2650
106 Views
The dnsPromises.resolveSoa() method uses the DNS protocol to resolve the Start of Authority records (SOA Records) for the hostname. On success, the promise is resolved with the following propertiesnsnamehostmasterserialrefreshretryexpireminttlSyntaxdnsPromises.resolveSoa( hostname )Parametershostname - This parameter takes the input for the hostname to be resolved.Example 1Create a file with the name "resolveSoa.js" and copy the following code. After creating the file, use the command "node resolveSoa.js" to run this code as shown in the example below// dns.resolveSoa() Demo Example // Importing the dns module const dns = require('dns'); const dnsPromises = dns.promises; // Passing IP to find the hostname TXT ... Read More
2K+ Views
The client.end(flush) method forcibly closes all the connection to the Redis server without waiting until all the replies have been parsed. This method just closes all the connection and ongoing streaming between the Node and Redis server. If you want to exit cleanly, you should use client.quit() method.Syntaxclient.end(flush)Parametersflush - This input parameter will hold a Boolean value that will indicate whether to close a connection or not.Example 1Create a file with the name "clientEnd.js" and copy the following code. After creating the file, use the command "node clientEnd.js" to run this code as shown in the example below −// client.end() ... Read More
675 Views
Node.js Redis offers certain properties which can be used as per your usecase. One such property is detect_buffers.If this property is set to True, then the replies that are sent to the callbacks are sent as buffers.This option lets you switch between the buffer and strings based upon this single command basis.This property does not work with pub-sub mode.SyntaxdetectBuffers: trueExample 1Create a file with the name "detectBuffers.js" and copy the following code. After creating the file, use the command "node detectBuffers.js" to run this code, as shown in the example below:// detect_buffers Property Demo Example // Importing the redis ... Read More
3K+ Views
The chalk module is a third-party library that can be used for styling of texts. It allows the users to create their own themes in a Node.js project.This module helps the users to customize the response messages with different colors as per the preferences.It also improves the readability by providing colors and makes it easier to detect warnings and errors.Installationnpm install chalkExample 1Create a file with the name "chalk.js" and copy the following code. After creating the file, use the command "node chalk.js" to run this code as shown in the example below −// Importing the chalk module const chalk=require("chalk"); ... Read More
764 Views
The 'beforeExit' event is called when Node.js empties its event loop and has no other work to schedule. The Node.js process exits normally when there is no work scheduled but a listener registered on the 'before exit' event can make async calls and thereby cause the Node.js process to continue.Example 1Create a file with the name "beforeExit.js" and copy the following code. After creating the file, use the command "node beforeExit.js" to run this code as shown in the example below −// process 'beforeExit' Demo Example // Importing the process module const process = require('process'); // Calling the ... Read More
108 Views
The diffieHellman.getGenerator() method returns the Diffie-Hellman generator in the specified encoding. A string is returned in case an encoding is passed, else a buffer is returned.SyntaxdiffieHellman.getGenerator([encoding])Parametersencoding - This parameter specifies the encoding of the return value.Example 1Create a file with the name "generator.js" and copy the following code. After creating the file, use the command "node generator.js" to run this code as shown in the example below:// diffieHellman.getPrime() Demo Example // Importing cryptoDiffieHellman from the crypto module const { createDiffieHellman } = require('crypto'); // Initializing the diffieHellman object const dh = createDiffieHellman(512); // Generate DiffieHellman's Generator ... Read More
201 Views
The dnsPromises.resolveAny() method uses the DNS protocol to resolve all records (this is also known as ANY or * query). The promise is resolved with an array containing various types of records.TypeProperties'A'IPv4 address'AAAA'IPv6 address'Any'Any RecordsMXMail Exchange RecordsNAPTRName authority pointer recordsNSName server recordsPTRPointer RecordsSOAStart of Authority RecordsSRVService RecordsTXTText RecordsCNAMECanonical Name RecordsSyntaxdnsPromises.resolveAny(hostname)Parametershostname - This parameter takes input for the hostname to be resolved.Example 1Create a file with the name "resolveAny.js" and copy the following code. After creating the file, use the command "node resolveAny.js" to run this code, as shown in the example below −// Node.js program to demonstrate the // dnsPromises.resolveAny() method ... Read More
79 Views
This method indicates about the flag value of --throw-deprecation which is set to True or False on the current Node.js project.The process.throwDeprecation() method is mutable, so the deprecation warning results in errors may be altered at runtime.Syntaxprocess.throwDeprecation( )Example 1Create a file with the name "throwDeprecation.js" and copy the following code. After creating the file, use the command "node throwDeprecation.js" to run this code as shown in the example below// process.throwDeprecation() Demo Example // Importing the process module const process = require('process'); // Printing the --throw-Deprecation default value console.log(process.throwDeprecation);Output 1undefinedOutput 2trueExample 2Let's take another example// process.throwDeprecation() Demo Example ... Read More
223 Views
The dns.resolve4() method uses the DNS protocol to resolve a IPv4 address for the hostname. The arguments passed to the callback function can contain an array of multiple addresses.Syntaxdns.resolve4(hostname, [options], callback)Parametershostname - This parameter takes input for the hostname to be resolved.options - It can have the following optionsttl - It defines the Time-To-Live (TTL) for each record. Callback receives an array of addresses like this{ address: '1.2.3.4', ttl:60 }callback - It will catch errors, if any.Example 1Create a file with the name "resolve4.js" and copy the following code snippet. After creating the file, use the command "node resolve4.js" to ... Read More
567 Views
C++ has a huge list of functions to solve mathematical issues. One of the mathematical functions is to find Nth odd digits using codes. This article will describe the complete approach of finding the odd Nth number and understand what odd numbers are and what numbers are made up of odd digits.Finding the Nth Number Made up of Odd Digits OnlyOdd numbers give remainder on dividing by two, so the first few odd numbers are 1, 3, 5, 7, 9, 11, 13, 15, 17, 19...To find the required number, we have two approaches here −Approach 1 − Check every natural ... Read More