Sliding window protocols are data link layer protocols for reliable and sequential delivery of data frames. The sliding window is also used in Transmission Control Protocol. In these protocols, the sender has a buffer called the sending window and the receiver has buffer called the receiving window.In one – bit sliding window protocol, the size of the window is 1. So the sender transmits a frame, waits for its acknowledgment, then transmits the next frame. Thus it uses the concept of stop and waits for the protocol. This protocol provides for full – duplex communications. Hence, the acknowledgment is attached ... Read More
Calculate Age based on date of birth with the help of DATE_FORMAT() method in MySQL. Firstly, get the current date time with the help of now() method and you can place your date of birth in DATE_FORMAT().The syntax is as follows −SELECT DATE_FORMAT(FROM_DAYS(DATEDIFF(now(), 'yourDateofbirth')), '%Y')+0 AS anyVariableName;Apply the above syntax to calculate age from yourDateofbirth. In the above syntax, replace yourDateofbirth with your date of birth. The query is as follows −SELECT DATE_FORMAT(FROM_DAYS(DATEDIFF(now(), '2010-11-25')), '%Y')+0 AS Age;The following is the output −+------+ | Age | +------+ | 8 | +------+ 1 row in set (0.00 sec)Let ... Read More
In order to install MySQL command line client for Windows, you need to visit the following URL to get the download link https://dev.mysql.com/downloads/mysql/ −The snapshot is as follows −After that you need to select operating system. The snapshot is as follows −You need to choose Windows (x86, 32/64-bit) and download the installer.
Use the headMap() method in Java to get ahead map. It returns a view of the portion of this map whose keys are less than or equal to.Let’s say you need to get the portion of the map above the set map (and not inclusive of it). For that, use the headMap() method like this −m.headMap(4)If you want the value 4 to be included as well, then set it as true −m.headMap(4, true)The following is an example to get Head Map from Java TreeMap −Example Live Demoimport java.util.*; public class Demo { public static void main(String args[]) { ... Read More
This is a common issue that has been faced by us once or more in our college and school time. The appropriate resolution for this differs as to which university or organization one studies in. Still, the below solutions could help.1. If carrying a mobile phone is allowed in your library, click a picture of the important topics you wished to study from the book you want to get issued.2. You may also get these books issued on the card of any other student. We used to have the books issued through identity cards in our school and college. In ... Read More
The method java.io.File.isDirectory() checks whether a file with the specified abstract path name is a directory or not. This method returns true if the file specified by the abstract path name is a directory and false otherwise.A program that demonstrates this is given as follows −Example Live Demoimport java.io.File; public class Demo { public static void main(String[] args) { try { File file = new File("demo1.txt"); file.createNewFile(); System.out.println("Is directory? " + file.isDirectory()); } catch(Exception e) { e.printStackTrace(); ... Read More
To view stored procedure/function definition in MySQL, you can use show command. The syntax is as follows −SHOW CREATE PROCEDURE yourProcedureName;To understand the above syntax, you can create a procedure and check that definition. Let us create a stored procedure −mysql> delimiter // mysql> create procedure AllRecords() -> begin -> select *from student; -> end // Query OK, 0 rows affected (0.24 sec)You can call the stored procedure with the help of call command. The query is as follows −mysql> delimiter ; mysql> call AllRecords();The following is the output −+------+-------+ | id | Name | +------+-------+ ... Read More
Use the firstKey() method to get the lowest key stored in TreeMap.Let us first set the TreeMap and add some elements to it −TreeMap m = new TreeMap(); m.put(1, "PHP"); m.put(2, "jQuery"); m.put(3, "JavaScript"); m.put(4, "Ruby"); m.put(5, "Java"); m.put(6, "AngularJS"); m.put(7, "ExpressJS");Now get the lowest key −m.firstKey()The following is an example to get the lowest key in TreeMap −Example Live Demoimport java.util.*; public class Demo { public static void main(String args[]) { TreeMap m = new TreeMap(); m.put(1, "PHP"); m.put(2, "jQuery"); m.put(3, "JavaScript"); m.put(4, "Ruby"); ... Read More
The method java.io.File.isFile() is used to check whether the given file specified by the abstract path name is an existing file in Java. This method returns true if the file specified by the abstract path name is a file and false otherwise.A program that demonstrates this is given as follows −Example Live Demoimport java.io.File; public class Demo { public static void main(String[] args) { try { File file = new File("demo1.txt"); file.createNewFile(); System.out.println("Is file? " + file.isFile()); } catch(Exception e) { ... Read More
The method java.io.File.isHidden() is used to check whether the given file specified by the abstract path name is a hidden file in Java. This method returns true if the file specified by the abstract path name is hidden and false otherwise.A program that demonstrates this is given as follows −Example Live Demoimport java.io.File; public class Demo { public static void main(String[] args) { try { File file = new File("demo1.txt"); file.createNewFile(); System.out.println("Is file hidden? " + file.isHidden()); } catch(Exception e) { ... Read More