The process.emitWarning() method can be used to emit custom or user-defined process warnings. This can be listened by adding a handler to the warning event.Syntaxprocess.emitWarning(warning, [options])Parameterswarning – This is the warning that will be emitted.options –type – This is the type of warning being emitted. Default ‘Warning’code – This is a unique identifier for the warning that will be emitted.ctor – This is an optional function used to limit the generated stack trace.detail – This is the additional text to be included with the error.Example 1Create a file with the name "warning.js" and copy the following code snippet. After creating ... Read More
The dns.resolveTxt() method uses the DNS protocol to resolve the text queries (TXT Records) for the hostname. The addresses argument passed to the callback function is a two-dimensional array that contains the array of text records available for the hostname.Syntaxdns.resolveTxt(hostname, callback)Parametershostname – This parameter takes input for hostname to be resolvedcallback – This function will catch errors, if any.records – Returns TXT records for the hostname.Example 1Create a file with the name "resolveTxt.js" and copy the below code snippet. After creating file use the command "node resolveTxt.js" to run this code.// dns.resolveTxt() Demo Example // Importing the dns module ... Read More
process.report is an object whose methods generate the diagnostic reports for the current process. It is found under the process module.Syntaxprocess.reportExample 1Create a file with the name "report.js" and copy the following code snippet. After creating the file, use the command "node report.js" to run this code.// process.report Demo Example // Importing the process module const process = require('process'); // Getting reports for the below processes const reports = process.report; // Printing out the result console.log(reports)OutputuC:\homeode>> node report.js { writeReport: [Function: writeReport], getReport: [Function: getReport], directory: [Getter/Setter], filename: [Getter/Setter], compact: [Getter/Setter], ... Read More
Deterministic means that on each input there is one and only one state to which the automata can have the transition from its current state. In deterministic finite automata, the head can move only in one direction to scan the input tape symbols. But in the case of two-way, finite automata on scanning an input symbol the head of the tape may move in right or left from its current position.A deterministic finite automata is a set of 5 tuples and defined asM = (Q, Σ, δ, q0, F)Q: A non-empty finite set of states present in the finite control ... Read More
The dns.lookup() method resolves the host name (e.g., tutorialspoint.com) into the first found A IPv4) or AAAA (IPv6) record. The properties available under the options are optional. dns.lookup() does not have anything to do with the DNS protocol. The implementation uses an OS facility that can associate names with addresses and vice versa.Syntaxdns.lookup(hostname, [options], callback)ParametersThe above parameters are defined as below −hostname – This is the website hostname for which you want to look up the DNS values.options – It can have the following optionsfamily – It can have the values 4, 6, or 0 only. The value "0" indicates ... Read More
Shift reduce parser is a type of bottom-up parser. It uses a stack to hold grammar symbols. A parser goes on shifting the input symbols onto the stack until a handle comes on the top of the stack. When a handle occurs on the top of the stack, it implements reduction.There are the various steps of Shift Reduce Parsing which are as follows −It uses a stack and an input buffer.Insert $ at the bottom of the stack and the right end of the input string in Input Buffer.Shift: Parser shifts zero or more input symbols onto the stack until ... Read More
The dns.resolveNs() method uses the DNS protocol to resolve the nameserver records (NS Records) for the hostname. The addresses argument passed to the callback function will contain an array of nameserver records for the hostname.Syntaxdns.resolveNs(hostname, callback)ParametersThe above parameters are defined as below −hostname – This parameter takes input for the hostname to be resolved.callback – This function will catch errors, if any.records – Returns the nameserver (NS) records for the hostname.Example 1Create a file "resolveNs.js" and copy the following code snippet. After creating the file, use the command "node resolveNs.js" to run this code:// dns.resolveNs() Demo Example // Importing ... Read More
The process.connected property returns True if an IPC channel is connected and will return False after the process.disconnect() method is called. This happens only when the node process is spawned with an IPC channel (i.e., Child process and Cluster).Once the process.connected property is false, no messages can be sent over the IPC channel.Syntaxprocess.connectedExample 1Create two files "parent.js" and "child.js" as follows −parent.js// process.connected Property Demo Example // Importing the child_process modules const fork = require('child_process').fork; // Attaching the child process file const child_file = 'util.js'; // Spawning/calling child process const child = fork(child_file);child.jsconsole.log('In Child') // Check ... Read More
In top-down parsing, the parse tree is generated from top to bottom, i.e., from root to leaves & expand till all leaves are generated.It generates the parse tree containing root as the starting symbol of the Grammar. It starts derivation from the start symbol of Grammar & performs leftmost derivation at each step.Drawback of Top-Down ParsingTop-down parsing tries to identify the left-most derivation for an input string ω which is similar to generating a parse tree for the input string ω that starts from the root and produce the nodes in a pre-defined order.The reason that top-down parsing follow the ... Read More
Parsing is known as Syntax Analysis. It contains arranging the tokens as source code into grammatical phases that are used by the compiler to synthesis output generally grammatical phases of the source code are defined by parse tree. There are various types of parsing techniques which are as follows −Top-Down ParserIt generates the Parse Tree from root to leaves. In top-down parsing, the parsin begins from the start symbol and changes it into the input symbol.An example of a Top-Down Parser is Predictive Parsers, Recursive Descent Parser.Predictive Parser − Predictive Parser is also known as Non-Recursive Predictive Parsing. A predictive ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP