Karthikeya Boyini has Published 2193 Articles

Create Pair Tuple using with() method in Java

karthikeya Boyini

karthikeya Boyini

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

131 Views

You can also create a Pair Tule in Java using the with() method.Let us first see what we need to work with JavaTuples. To work with Pair class in JavaTuples, you need to import the following package −import org.javatuples.Pair;Note − Steps to download and run JavaTuples program If you are ... Read More

As HTTP is a stateless then how to maintain the session between web browser and web server?

karthikeya Boyini

karthikeya Boyini

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

4K+ Views

HTTP is a "stateless" protocol which means each time a client retrieves a Webpage, the client opens a separate connection to the Web server and the server automatically does not keep any record of previous client request.Maintaining Session Between Web Client And ServerLet us now discuss a few options to ... Read More

Difference between find() and findOne() methods in MongoDB?

karthikeya Boyini

karthikeya Boyini

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

5K+ Views

The findOne() returns first document if query matches otherwise returns null. The find() method does not return null, it returns a cursor.Let us implement the concept of find() and findOne() and create a collection with documents −> db.createCollection('emptyCollection'); { "ok" : 1 }Let us count how many documents are in ... Read More

Insert default into not null column if value is null in MySQL?

karthikeya Boyini

karthikeya Boyini

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

1K+ Views

You can use IFNULL() property or simple IF() with IS NULL property. The syntax is as follows −INSERT INTO yourTableName(yourColumnName1, yourColumnName2) VALUES('yourValue’', IF(yourColumnName1 IS NULL, DEFAULT(yourColumnName2), 'yourMessage'));To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table Post ... Read More

Java 8 Clock millis() Method

karthikeya Boyini

karthikeya Boyini

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

367 Views

The current instance of the clock in milliseconds can be obtained using the method millis() in the Clock Class in Java. This method requires no parameters and it returns the current instant of the clock in milliseconds. If the instance cannot be obtained for some reason, then the DateTimeException is ... Read More

Create Pair Tuple from another collection in Java

karthikeya Boyini

karthikeya Boyini

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

198 Views

Use the fromCollection() method to create a Pair Tuple from another collection, for example, List.Let us first see what we need to work with JavaTuples. To work with Pair class in JavaTuples, you need to import the following package −import org.javatuples.Pair;Note − Steps to download and run JavaTuples program If ... Read More

How to track access time of a webpage using session in a JSP page?

karthikeya Boyini

karthikeya Boyini

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

581 Views

This example describes how to use the HttpSession object to find out the creation time and the last-accessed time for a session. We would associate a new session with the request if one does not already exist.Example Live Demo           Session Tracking       ... Read More

How to disable “Establishing SSL connection without server's identity verification is not recommended” warning when connecting to MySQL database in Java?

karthikeya Boyini

karthikeya Boyini

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

13K+ Views

To disable the warning while connecting to a database in Java, use the below concept −autoReconnect=true&useSSL=falseThe complete syntax is as follows −yourJdbcURL="jdbc:mysql://localhost:yourPortNumber/yourDatabaseName?autoReconnect=true&useSSL=false";Here is the warning message if you do not include “useSSL=false” −Wed Feb 06 18:53:39 IST 2019 WARN: Establishing SSL connection without server's identity verification is not recommended. According ... Read More

Java 8 Clock hashCode() method

karthikeya Boyini

karthikeya Boyini

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

267 Views

The hash code for a clock object can be obtained using the method hashCode() in the Clock Class in Java. This method requires no parameters and it returns the acceptable hash code for a clock object.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; public class Demo ... Read More

JavaTuples setAt0() method for Quintet class

karthikeya Boyini

karthikeya Boyini

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

102 Views

The setAt0() method is used to set the Quintet value in JavaTuples and a copy with a new value at the specified index i.e. index 0 here.Let us first see what we need to work with JavaTuples. To work with Quintet class in JavaTuples, you need to import the following ... Read More

Advertisements