CookiesA webserver can assign a unique session ID as a cookie to each web client and for subsequent requests from the client they can be recognized using the received cookie.This may not be an effective way as the browser at times does not support a cookie. It is not recommended to use this procedure to maintain the sessions.Hidden Form FieldsA web server can send a hidden HTML form field along with a unique session ID as follows −This entry means that, when the form is submitted, the specified name and value are automatically included in the GET or the POST ... Read More
To fetch the value from Decade Tuple in Java, use the getAtX() method. Here, X represents the index value like getAt1() at index 1. This will return the element at index 1 in the Tuple.Let us first see what we need to work with JavaTuples. To work with Decade class in JavaTuples, you need to import the following packageimport org.javatuples.Decade;Note Download JavaTuples Jar library to run JavaTuples program. If you are using Eclipse IDE, then Right Click Project -> Properties -> Java Build Path -> Add External Jars and upload the downloaded JavaTuples jar file. Refer the below guide for ... Read More
The isEmpty() method of the AbstractSequentialList class is used to check whether the list is empty or not. If it is empty, then TRUE is returned, else FALSE.The syntax is as follows.public boolean isEmpty()To work with the AbstractSequentialList class in Java, you need to import the following package.import java.util.AbstractSequentialList;The following is an example to implement AbstractSequentialList isEmpty() method in Java.Example Live Demoimport java.util.LinkedList; import java.util.AbstractSequentialList; public class Demo { public static void main(String[] args) { AbstractSequentialList absSequential = new LinkedList(); absSequential.add(110); absSequential.add(320); absSequential.add(400); absSequential.add(550); absSequential.add(600); absSequential.add(700); absSequential.add(900); System.out.println("Elements ... Read More
An immutable copy of a LocalTime object where some seconds are subtracted from it can be obtained using the minusSeconds() method in the LocalTime class in Java. This method requires a single parameter i.e. the number of seconds to be subtracted and it returns the LocalTime object with the subtracted seconds.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; public class Demo { public static void main(String[] args) { LocalTime lt = LocalTime.now(); System.out.println("The current LocalTime is: " + lt); System.out.println("The LocalTime with 5 seconds subtracted is: ... Read More
Yes, we can. In order to store CSS color value, you can use CHAR(6) without # symbol for hexadecimal. Let us see an example and create a tablemysql> create table storeCSSColorDemo -> ( -> CSSValue char(6) -> ); Query OK, 0 rows affected (0.53 sec)Insert some records in the table using insert command. The records here are individual color values in hexadecimal, for which we have used char(6)mysql> insert into storeCSSColorDemo values('FF0000'); Query OK, 1 row affected (0.13 sec) mysql> insert into storeCSSColorDemo values('FFA500'); Query OK, 1 row affected (0.86 sec) ... Read More
The get() method of CopyOnWriteArrayList class returns the element at the specified position in this list.The syntax is as follows:E get(int index)Here, the parameter index is the position from where you want the element.To work with CopyOnWriteArrayList class, you need to import the following package:import java.util.concurrent.CopyOnWriteArrayList;The following is an example to implement CopyOnWriteArrayList class get() method in Java:Example Live Demoimport java.util.concurrent.CopyOnWriteArrayList; public class Demo { public static void main(String[] args) { CopyOnWriteArrayList arrList = new CopyOnWriteArrayList(); arrList.add(100); arrList.add(250); arrList.add(400); arrList.add(500); arrList.add(650); ... Read More
You can use $slice operator to limit an array. Let us create a collection with documents. Following is the query> db.limitAnArrayDemo.insertOne( ... { ... _id: 101, ... "PlayerName": "Bob", ... "PlayerDetails": {Age:23, isStudent:true}, ... "PlayerGameScores": [234, 5767, 58, 67, 78, 90, 1002, 576, 68, 45, 23, 45, 678, 89, 78 ] ... } ... ); { "acknowledged" : true, "insertedId" : 101 }Following is the query to display all documents from a collection with the help of find() method> db.limitAnArrayDemo.find().pretty();This will produce the following output{ ... Read More
Two lists are equal if they consist of same number of elements in the same order.Let’s say we have the following two lists −ListarrList1 = Arrays.asList(new Integer[] { 10, 20, 30, 45, 55, 70, 90, 100 }); ListarrList2 = Arrays.asList(new Integer[] {15, 25, 35, 50, 55, 75, 95, 120});Now, let’s find out whether both the lists are equal or not −arrList1.equals(arrList2);If both the above lists have equal elements, then TRUE is returned, else FALSE is the return value.Example Live Demoimport java.util.Arrays; import java.util.List; public class Demo { public static void main(String[] a) { ListarrList1 = Arrays.asList(new Integer[] ... Read More
You can use SUBSTRING() along with UPDATE command to delete last 4 letters. Let us first create a table −mysql> create table DemoTable ( StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY, StudentSubject varchar(100) ); Query OK, 0 rows affected (0.57 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(StudentSubject) values('Introduction to Java'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable(StudentSubject) values('Introduction to C'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable(StudentSubject) values('Introduction to C++'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable(StudentSubject) values('Spring And Hibernate'); ... Read More
In this program we will see how to add two 16-bit BCD numbers with carry.Problem StatementWrite 8086 Assembly language program to add two 16-bit BCD numbers stored in memory offset 500H – 501H and 502H – 503H.DiscussionHere we are adding the 16-bit data byte by byte. At first we are adding lower byte and perform the DAA instruction, then Add higher bytes with carry, and again DAA to adjust. The final result is stored at location offset 600H, and if carry is present, it will be stored at 601H.We are taking two numbers 8523 + 7496 = 16019InputAddressData……50023501855029650374…… Flow Diagram Program OutputAddressData……600196016060201……