
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
Found 26504 Articles for Server Side Programming

3K+ Views
This process.traceDeprecation() method states whether the --trace-deprecation flag is set or not on the current Node.js project. This Boolean flag controls whether the trace of deprecation warning messages are printed or not.Syntaxprocess.traceDeprecation( )Example 1Create a file with the name "traceDeprecation.js" and copy the following code snippet. After creating the file, use the command "node traceDeprecation.js" to run this code as shown in the example below −// process.traceDeprecation() Demo Example // Importing the process module const process = require('process'); // Printing traceDeprecation default value console.log(process.traceDeprecation);Output 1C:\homeode>> node traceDeprecation.js undefinedOutput 2C:\homeode>> node --trace-deprecation traceDeprecation.js trueExample 2// process.traceDeprecation() Demo Example ... Read More

185 Views
The dnsPromises.resolveNs() method uses the DNS protocol to resolve the name server records (NS) for the hostname. On success, the promise is resolved with an array of name server records available for the hostname.SyntaxdnsPromises.resolveNs( hostname )where hostname is the parameter that takes the input for the hostname to be resolved.Example 1Create a file with the name "resolveNs.js" and copy the following code snippet. After creating the file, use the command "node resolveNs.js" to run this code as shown in the example below −// dns.resolveNs() Demo Example // Importing the dns module const dns = require('dns'); const dnsPromises = ... Read More

2K+ Views
The dns.reverse() method is somewhat opposite of the method dns.lookup().This method performs a reverse DNS query that resolves an IPv4 or IPv6 to an array of host names.Syntaxdns.reverse(ip, callback)Parametersip – This takes an input for ip as a string, for which the DNS needs to be found.callback – It will catch errors, if any.Example 1Create a file with the name "reverse.js" and copy the following code snippet. After creating the file, use the command "node reverse.js" to run this code as shown in the example below −// dns.reverse() method Demo Example // Importing the dns module const dns = ... Read More

3K+ Views
Redis commands mostly take the input as a single string or an array of strings as arguments and the replies are sent back as a single string or an array of strings. But, while dealing with the hash values, there are a couple of exceptions.The client.hgetall() function in Node.js – Redis returns an Object keyed by the Hash keys. The strings will be returned either as a string or as a buffer depending upon the setting.The client.hmset() function supplies the Hash arguments to Redis.Syntaxclient.hmset()client.hmset(hash, key1, val1, ...keyN, valN, [callback])client.hgetall()client.hgetall(hash, callback)Example 1Create a file with the name "hmset.js" and copy the ... Read More

11K+ Views
There are some cases where we need to exit a certain process in Node.js based upon a condition. For this condition, we have the following methods where we can escape or exit any Node.js Process.Method 1: Using the Ctrl+C keyI hope everyone knows this shortcut to exit any Node.js process from outside. This shortcut can be used to stop any running process by hitting this command on terminal.Method 2: Using the process.exit() functionThis function instructs Node.js to end the process that is running at an instant with an exit code. Node.js will force the current running process to stop execution ... Read More

193 Views
The dnsPromises.reverse() method performs a reverse DNS search to resolve the IPv4 or Ipv6 address to an array of hostnames. The promise is rejected with an Error object if a Success status is not encountered.SyntaxdnsPromises.reverse( ip )where, ip is the parameter that takes the input for the IP address to be resolved.Example 1Create a file with the name "reverse.js" and copy the following code snippet. After creating the file, use the command "node reverse.js" to run this code as shown in the example below −// dns.reverse() Demo Example // Importing the dns module const dns = require('dns'); const ... Read More

99 Views
The dns.resolveSoa() method uses the DNS protocol to resolve the start of authority records for the hostname. The address argument passed to the callback function will be an object that will contain the following properties −nsnamehostmasterserialrefreshentryexpireSyntaxdns.resolveSoa(hostname, callback)ParametersIt accepts the following parameters −hostname – This parameter takes the input for the hostname to be resolved.callback – This function will catch errors, if any.records – Returns the start of authority records for the hostname.ExampleCreate a file with the name "resolveSoa.js" and copy the following code snippet. After creating the file, use the command node "resolveSoa.js" to run this code as shown in ... Read More

11K+ Views
We can download file using Node.js by either using third-party libraries or using some inbuilt packages.Method 1: Using 'https' and 'fs' moduleWe can use the http GET method to fetch the files that are to be downloaded.The createWriteStream() method from fs module creates a writable stream and receives the argument with the location of the file where it needs to be saved.pipe() is another method from fs that reads the data from the readable stream and writes it onto the writable stream and file.Example 1Create a file with the name downloadFile.js and copy the following code snippet. After creating the ... Read More

242 Views
The diffieHellman.computeSecret() is used for computing the shared secret using the public key of other's party and returning the computed shared secret. The suppliedKey is interpreted using the specified inputEncoding and the secret is encoded using the specified outputEncoding. If the inputEncoding is not specified the other publicKey is expected to be a buffer, DataView.SyntaxdiffieHellman.computeSecret(otherPublicKey, [inputEncoding], [outputEncoding])ParametersotherPublicKey – This is the public key that is used to compute the secret.inputEncoding – This encoding is used to interpret the supplied key.outputEncoding – This encoding is used for encoding the computed secret value.Example 1Create a file with the name "computeSecret.js" and copy ... Read More

310 Views
To compute the condition number of a matrix with respect to a matrix norm, we could apply torch.linalg.cond() method. It returns a new tensor with computed condition number. It accepts a matrix, a batch of matrices and also batches of matrices. A matrix is a 2D torch Tensor. It supports input of float, double, cfloat, and cdouble data typesSyntaxtorch.linalg.cond(M, p=None)ParametersM – A matrix or batch of matrices.p – A type of matrix norm to be used in computation of condition number. Default matrix norm is 2-norm.It returns a real-valued tensor of condition number.StepsWe could use the following steps to compute the ... Read More