Network Control Protocol (NCP)

Krantik Chavan
Updated on 30-Jul-2019 22:30:25

4K+ Views

Network Control Protocol (NCP) is a set of protocols forming a part of Point − to − Point Protocol (PPP). PPP is a data link layer protocol that is used to transmit multiprotocol data between two directly connected (point-to-point) computers. PPP is composed of link control protocol (LCP), authentication protocol (AP) and network control protocol (NCP). NCPs are used for negotiating the parameters and facilities for the network layer. For every higher-layer protocol supported by PPP, one NCP is there.The following diagram illustrates the layer in which NCPs operate:List of NCPsSome of the NCPs are −Internet Protocol Control Protocol (IPCP) ... Read More

Merits of I/O Mapped I/O and Demerits of Memory Mapped I/O

George John
Updated on 30-Jul-2019 22:30:25

2K+ Views

Before having a discussion regarding the merits of I/O mapped I/O and demerits of memorymapped I/O, let us have a generic discussion regarding the difference between I/O mapped I/O and memory mapped I/O.In Memory Mapped Input Output −We allocate a memory address to an Input Output device.Any instructions related to memory can be accessed by this Input Output device.The Input Output device data are also given to the Arithmetic Logical Unit.Input Output Mapped Input Output −We give an Input Output address to an Input Output device.Only IN and OUT instructions are accessed by such devices.The ALU operations are not directly ... Read More

Prevent Negative Numbers in MySQL

Arjun Thakur
Updated on 30-Jul-2019 22:30:25

2K+ Views

To prevent negative numbers in MySQL, you need to use INT UNSIGNED. Let’s say you created a table with a column as int i.e. UserGameScores heremysql> create table preventNegativeNumberDemo    - > (    - > UserId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    - > UserName varchar(20),    - > UserGameScores int    - > ); Query OK, 0 rows affected (1.74 sec)Now if you need to prevent negative numbers in it, modify the same column with INT UNSIGNEDmysql> alter table preventNegativeNumberDemo modify column UserGameScores INT UNSIGNED NOT NULL; Query OK, 0 rows affected (3.32 sec) Records: 0 ... Read More

Difference Between Type Scroll Insensitive and Type Scroll Sensitive ResultSets in JDBC

Krantik Chavan
Updated on 30-Jul-2019 22:30:25

2K+ Views

In the TYPE_SCROLL_INSENSITIVE ResultSet, the cursor moves in forward or backward directions. This type of ResultSet is insensitive to the changes that are made in the database i.e. the modifications done in the database are not reflected in the ResultSet.Which means if we have established a connection with a database using a JDBC program and retrieved a ResultSet holding all the records in a table named SampleTable. Meanwhile, if we have added some more records to the table (after retrieving getting the ResultSet), these recent changes will not be reflected in the ResultSet object we previously obtained.In the TYPE_SCROLL_SENSITIVE ResultSet, ... Read More

LocalDateTime Query Method in Java

karthikeya Boyini
Updated on 30-Jul-2019 22:30:25

138 Views

The LocalDateTime object can be queried as required using the query method in the LocalDateTime class in Java. This method requires a single parameter i.e. the query to be invoked and it returns the result of the query.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; import java.time.temporal.*; public class Demo {    public static void main(String[] args) {       LocalDateTime ldt = LocalDateTime.parse("2019-02-18T23:15:30");       System.out.println("The LocalDateTime is: " + ldt);       String precision = ldt.query(TemporalQueries.precision()).toString();       System.out.println("The Precision for the LocalDateTime is: "+ precision);    } }OutputThe LocalDateTime ... Read More

The clear Method of AbstractList Class in Java

Arjun Thakur
Updated on 30-Jul-2019 22:30:25

127 Views

Remove all the elements from the list using the clear() method of the AbstractList class. After using the method, the list won’t be having any elements.The syntax is as followspublic void clear()To work with the AbstractList class, import the following packageimport java.util.AbstractList;The following is an example to implement clear() method of the AbstractlList class in JavaExample Live Demoimport java.util.ArrayList; import java.util.AbstractList; public class Demo {    public static void main(String[] args) {       AbstractList       myList = new ArrayList();       myList.add(75);       myList.add(100);       myList.add(150);       myList.add(200);     ... Read More

Clone a Collection in MongoDB

Nishtha Thakur
Updated on 30-Jul-2019 22:30:25

656 Views

To clone a collection in MongoDB, you can use the forEach() method. Let us first create a collection with a document.The query to create a collection with a document is as follows −> db.studentInformation.insertOne({"StudentName":"Chris"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c8bc15780f10143d8431e21") } > db.studentInformation.insertOne({"StudentName":"Robert"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c8bc15e80f10143d8431e22") } > db.studentInformation.insertOne({"StudentName":"James"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c8bc17380f10143d8431e23") }Display all documents from a collection with the help of find() method. The query is as follows −> db.studentInformation.find().pretty();The following is the output −{ "_id" : ObjectId("5c8bc15780f10143d8431e21"), "StudentName" : "Chris" } { "_id" ... Read More

Easiest Way to Convert int to String in C++

Smita Kapse
Updated on 30-Jul-2019 22:30:25

436 Views

In this section, we will see how to convert an integer to a string.The logic is very simple. Here we will use the sprintf() function. This function is used to print some value or line into a string, but not in the console. This is the only difference between printf() and sprintf(). Here the first argument is the string buffer. where we want to save our data.Input: User will put some numeric value say 42 Output: This program will return the string equivalent result of that number like “42”AlgorithmStep 1: Take a number from the user Step 2: Create an ... Read More

Execute Zombie and Orphan Process in a Single C Program

Vrundesha Joshi
Updated on 30-Jul-2019 22:30:25

2K+ Views

In this section we will see how to execute zombie process and orphan process in a single program in C/C++. Before going to the main discussion, let us see what are the zombie process and orphan process.Zombie ProcessesA zombie process is a process whose execution is completed but it still has an entry in the process table. Zombie processes usually occur for child processes, as the parent process still needs to read its child’s exit status. Once this is done using the wait system call, the zombie process is eliminated from the process table. This is known as reaping the ... Read More

Prevent Android from Taking Screenshots When App Goes to Background

Arjun Thakur
Updated on 30-Jul-2019 22:30:25

1K+ Views

In some situations, we should not allow to take screen shots of our application. This example demonstrate about how do I prevent Android taking a screenshot when my app goes to the background.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     In the above code, we have taken text view for some sample view.Step 3 − Add the following code to src/MainActivity.javapackage com.example.andy.myapplication; import android.os.Build; import android.os.Bundle; import android.support.annotation.RequiresApi; import android.support.v7.app.AppCompatActivity; import ... Read More

Advertisements