
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 33676 Articles for Programming

7K+ Views
The torchvision.utils package provides the draw_bounding_boxes() function to draw bounding boxes on an image. It supports images of type torch Tensor with shape (C x H x W) where C is the number of channels, and W and H are the width and height of the image, respectively.If we read an image using Pillow or OpenCV, then we would have to first convert it to a torch tensor. We can draw one or more bounding boxes on the image. This function returns an image Tensor of dtype uint8 with bounding boxes drawn.The bounding boxes should be torch Tensors of size ... Read More

7K+ Views
Reading the images is a very important part in image processing or computer vision related tasks. The torchvision.io package provides functions to perform different IO operations. To read an image, torchvision.io package provides the image_read() function. This function reads JPEG and PNG images. It returns a 3D RGB or Grayscale Tensor.The three dimensions of the tensor correspond to [C, H, W]. C is the number of channels, W and H are the width and height of the image, respectively.For RGB, the number of channels is 3. So, the output of the read image is a tensor of [3, H, W]. The ... Read More

680 Views
When a Node.js process is spawned with an IPC channel, the process.disconnect() method will close that IPC channel to the parent process, allowing the child process to exit or finish gracefully. The process will exit once there are no other connections keeping it alive.Syntaxprocess.disconnect()Example 1Create two files with the names "parent.js" and "child.js" and copy the following code snippets. After creating the file, use the command "node parent.js" to run parent.js.parent.js// process.channel Property Demo Example // Importing the child_process modules const fork = require('child_process').fork; // Attaching the child process file const child_file = 'child.js'; // Spawning/calling child ... Read More

120 Views
The dnsPromises.resolve6() method uses the DNS protocol to resolve the IPv6 addresses (AAAA records) for the hostname. The promise is resolved with an array of IPv6 addresses.Syntaxdns.resolve6(hostname, [options])Parametershostname – This parameter takes input for hostname to be resolved.options – It can have the following options −ttl – It defines the Time-To-Live (TTL) for each record.Example 1Create a file with the name "resolve6.js" and copy the following code snippet. After creating the file, use the command "node resolve6.js" to run this code as shown in the example below −// dns.resolve6() Demo Example // Importing the dns module const dns = ... Read More

522 Views
The dns.resolveMx() method uses the DNS protocol to resolve mail exchange (MX) records for the hostname. The addresses argument passed to the callback function will contain an array of objects containing both the priority and exchange objects.Syntaxdns.resolveMx(hostname, callback)Parametershostname – This parameter takes input for hostname to be resolved.callback – This function will catch errors, if any.records – Returns Mx records for the hostname.Example 1Create a file with the name "resolveMx.js" and copy the following code snippet. After creating the file, use the command "node resolveMx.js" to run this code as shown in the example below −// dns.resolveMx() Demo Example ... Read More

157 Views
The process.report.directory property is used to get or set the directory where the report is written. The default value is the empty string that indicates the reports are written to the current working directory of the Node.js Process.Syntaxprocess.report.directoryExample 1Create a file with the name "directory.js" and copy the following code snippet. After creating the file, use the command "node directory.js" to run this code as shown in the example below −// process.report.directory Property Demo Example // Importing the process module const process = require('process'); // Assigning a directory to store process.report.directory = "/tutorialsPoint" // Printing the result ... Read More

266 Views
The dnsPromises.resolveMx() method uses the DNS protocol to resolve the mail exchange records (MX Records) for the hostname. The promise is resolved with an array of objects containing both a priority and exchange property on success.SyntaxdnsPromises.resolveMx( hostname )where, hostname is the parameter that takes the input for the hostname to be resolved.Example 1Create a file with the name "resolveMx.js" and copy the following code snippet. After creating the file, use the command "node resolveMx.js" to run this code as shown in the example below −// dns.resolveMx() Demo Example // Importing the dns module const dns = require('dns'); const ... Read More

495 Views
The dns.resolveCname() method uses the DNS protocol to resolve CNAME records for the hostname. The addresses argument passed to the callback function will contain an array of canonical records in an array.Syntaxdns.resolveCname(hostname, callback)Parametershostname – This parameter takes the input for the hostname to be resolved.callback – This function will catch errors, if any.addresses – Returns CNAME addresses for the hostname.Example 1Create a file with the name "resolveCname.js" and copy the following code snippet. After creating the file, use the command "node resolveCname.js" to run this code as shown in the example below −// dns.resolveCname() Demo Example // Importing the ... Read More

132 Views
The diffieHellman.setPublicKey() sets the Diffie-Hellman generated public key. The private key is a string if the encoding argument is provided. If no encoding is provided, the privateKey will be of type buffer, TypedArray or DataView.SyntaxdiffieHellman.setPublicKey( publicKey, [encoding] )where, encoding is the parameter that specifies the encoding of the public Key.Example 1Create a file with the name "publicKey.js" and copy the following code snippet. After creating the file, use the command "node publicKey.js" to run this code as shown in the example below −// diffieHellman.setPublicKey() Demo Example // Importing the crypto module const crypto = require('crypto') // Generating the ... Read More

190 Views
The dns.resolve6() method uses the DNS protocol to resolve the IPv6 addresses (AAAA records) for the hostname. The addresses argument that is passed to the callback will contain an array of IPv6 addresses.Syntaxdns.resolve6(hostname, [options], callback)Parametershostname – This parameter takes the input for the hostname to be resolved.options – It can have the following options −ttl – This defines the Time-To-Live (TTL) for each record.Example 1Create a file with the name "resolve6.js" and copy the following code snippet. After creating the file, use the command "node resolve6.js" to run this code as shown in the example below −// dns.resolve6() Demo Example ... Read More