Run Linux Natively on Windows 10

Ajay yadav
Updated on 13-Apr-2020 08:11:16

443 Views

Microsoft has introduced the WSL Subsystem for Linux, which lets users run their favorite Linux distributions directly from Windows 10 without dual-booting or using a virtual machine.Limitations of Windows Subsystem for LinuxWhile this is a step in the right direction for Microsoft, it's not quite there yet in terms of full functionality. Specifically, WSL does not support AF_PACKET for security restrictions. This means that you won't be able to put a Wi-Fi adapter in promiscuous mode (or monitor mode), and tools that require raw sockets to function properly won't work, such as Nmap.Installation the Windows Subsystem for LinuxStep-1:To do so, ... Read More

Modify Existing Module in Java 9

raja
Updated on 10-Apr-2020 17:24:53

561 Views

The module is a named, self-describing collection of code and data. The code has been organized as a set of packages containing types like Java classes and interfaces. The data includes resources and other kinds of static information. We need to declare a module then add module-info.java at the root of the source code.Below is the template of the "module-info.java" file.module {    requires ;    requires ;    exports ;    exports ;    exports to }We can use certain command-line options that help us to modify existing modules and add dependencies to them, export ... Read More

Different VARS Commands in JShell in Java 9

raja
Updated on 10-Apr-2020 13:48:38

477 Views

JShell is an interactive command-line tool introduced in Java 9. It is also called a REPL tool that takes input, evaluates it, and prints output to the user.In the JShell tool, it's possible to list all variables created by using the internal command "/vars". We have different "/vars" commands available in the JShell tool as listed below./vars /vars [ID] /vars [Variable_Name] /vars -start /vars -all/vars: This command allows to us display the list of all active variables of the current session./vars [ID]: This command displays the variable and its value, corresponding to the entered ID. This ID corresponds to the name of ... Read More

Create a Service Provider Interface in Java 9

raja
Updated on 10-Apr-2020 12:19:26

287 Views

A module that provides the implementation for the Service interface contains a "provides" statement in the module descriptor file. If the module doesn’t have the "provides" statement in the module descriptor file, the service loader can't load that module.We can create the Service Provider Interface by using below steps:We create a new Module com.tutorialspoint.serviceproviderinterface.In the src/main/java directory, we create "module-info.java" file.Inside our source directory, we create the package com.tutorialspoint.serviceproviderinterface.spi.Finally, we create the interface ServiceProviderInterface that contains a method: printServiceName() to be implemented.In the below, we can define Service Provider Interface.package com.tutorialspoint.serviceproviderinterface.spi; public interface ServiceProviderInterface {    void printServiceName(); }Read More

C# Program to Read All Lines of a File at Once

karthikeya Boyini
Updated on 10-Apr-2020 09:42:53

193 Views

Use ReadAllText() method to read all the lines of a file at once.Let’s say we have a file “hello.txt” with the following lines −One Two ThreeTo read the above file, add the path of the file as parameter.File.ReadAllText(myPath);Above, myPath had the file path.String myPath = "hello.txt";Let us see the complete code −Exampleusing System; using System.IO; public class Demo {    public static void Main() {       String myPath = "hello.txt";       String allLines;       allLines = File.ReadAllText(myPath);       Console.WriteLine(allLines);    } }OutputThe following is the output −One Two Three

Draw Image Contours Using Java OpenCV Library

Maruthi Krishna
Updated on 10-Apr-2020 09:15:05

2K+ Views

Contours is nothing but the line joining all the points along the boundary of a particular shape. Using this you can −Find the shape of an object.Calculate the area of an object.Detect an object.Recognize an object.You can find the contours of various shapes, objects in an image using the findContours() method. In the same way you can drawYou can draw the found contours of an image using the drawContours() method this method accepts the following parameters −An empty Mat object to store the result image.A list object containing the contours found.An integer value specifying the contour to draw (-ve value ... Read More

Convert OpenCV Mat to BufferedImage in Java

Maruthi Krishna
Updated on 10-Apr-2020 09:13:16

3K+ Views

If you try to read an image using the OpenCV imread() method it returns a Mat object. If you want to display the contents of the resultant Mat object using an AWT/Swings window You need to convert the Mat object to an object of the class java.awt.image.BufferedImage. To do so, you need to follow the steps given below −Encode the Mat to MatOfByte − First of all, you need to convert the matrix to the matrix of a byte. You can do it using the method imencode() of the class Imgcodecs.This method accepts a String parameter(specifying the image format), a ... Read More

Chash Value Tuple

Chandu yadav
Updated on 10-Apr-2020 09:12:04

106 Views

A value type representation of the C# Tuple is Value Type Tuple. It was introduced in C# 7.0.Note − Add System.ValueTuple package to run ValueTuple program.Let’s see how to add it −Go to your projectRight click on the project in the Solution ExplorerSelect “Manage NuGet Packages”You will reach the NuGet Package Manager.Now, click the Browse tab and find “ValueTuple”Finally, add System.ValueTuple packageExampleusing System; class Program {    static void Main() {       var val = (5, 50, 500, 5000);       Console.WriteLine("Add System.ValueTuple package to run this program!");       if (val.Item2 == 50) {          Console.WriteLine(val);       }    } }OutputThe following is the output.(5, 50, 500, 5000);

Perform Bitwise NOT Operation on Images using Java OpenCV

Maruthi Krishna
Updated on 10-Apr-2020 09:08:58

407 Views

You can compute the bitwise conjunction between two images using the bitwise_not() method of the org.opencv.core.Core class.This method accepts two Mat objects representing the source and destination matrices, calculates the inverse of each element in the source matrix and stores the result in the destination matrix.Exampleimport org.opencv.core.Core; import org.opencv.core.Mat; import org.opencv.highgui.HighGui; import org.opencv.imgcodecs.Imgcodecs; public class BitwiseNOTExample {    public static void main(String args[]) throws Exception {       //Loading the OpenCV core library       System.loadLibrary( Core.NATIVE_LIBRARY_NAME );       //Reading the Image       String file ="D://images//elephant.jpg";       Mat src = Imgcodecs.imread(file);   ... Read More

Get RGB Values of an Image Using Java OpenCV Library

Maruthi Krishna
Updated on 10-Apr-2020 09:07:06

9K+ Views

A digital image is stored as a 2D array of pixels and a pixel is the smallest element of a digital image.Each pixel contains the values of alpha, red, green, blue values and the value of each color lies between 0 to 255 which consumes 8 bits (2^8).The ARGB values are stored in 4 bytes of memory in the same order (right to left) with blue value at 0-7 bits, Green value at 8-15 bits, Red value at 16-23 bits and, alpha at 24-31 bits.Retrieving the pixel contents (ARGB values) of an image −To get the pixel values from an ... Read More

Advertisements