Samual Sam has Published 2492 Articles

Instant until() Method in Java

Samual Sam

Samual Sam

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

536 Views

The time between two instant objects can be calculated using the until() method in the Instant class in Java. This method requires two parameters i.e. the end instant and the chronological unit to measure the time. It returns the time between two instant objects.A program that demonstrates this is given ... Read More

How to create a record in MySQL database subject to TTL (Time to live) option?

Samual Sam

Samual Sam

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

3K+ Views

You need to use MySQL event scheduler. It manages the execution of events as well as scheduling.First, you need to create a table. After that you can create a event that will schedule every single day.Let us create a table. The query to create a table is as follows −mysql> ... Read More

ByteBuffer compact() method in Java

Samual Sam

Samual Sam

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

180 Views

The buffer can be compacted using the compact() method in the class java.nio.ByteBuffer. This method does not require a parameter and it returns the new compacted ByteBuffer with the same content as the original buffer. If the buffer is read-only, then the ReadOnlyBufferException is thrown.A program that demonstrates this is ... Read More

Count top 10 most occurring values in a column in MySQL?

Samual Sam

Samual Sam

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

1K+ Views

To count the top 10 most occurring values in a column in MySQL, The syntax is as follows −SELECT yourColumnName, count(*)    FROM yourTableName    GROUP BY yourColumnName    ORDER BY count(*) DESC    LIMIT 10;To understand the above syntax, let us create a table. The query to create a ... Read More

Get index of given element in array field in MongoDB?

Samual Sam

Samual Sam

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

905 Views

You can use $indexOfArray operator for this. Let us create a collection with documents −>db.getIndexDemo.insertOne({"InstructorName":"Chris", "InstructorSubject":["MongoDB", "MySQL", "Java", "C++"]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cbd5251de8cc557214c0df8") }Display all documents from a collection with the help of find() method −> db.getIndexDemo.find().pretty();This will produce the following output −{    "_id" ... Read More

Duration ofMillis() method in Java

Samual Sam

Samual Sam

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

242 Views

The duration can be obtained in a one millisecond format using the ofMillis() method in the Duration class in Java. This method requires a single parameter i.e. the number of milliseconds and it returns the duration in a one millisecond format. If the capacity of the duration is exceeded, then ... Read More

What the different types of JSTL tags are ?

Samual Sam

Samual Sam

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

515 Views

The JSTL tags can be classified, according to their functions, into the following JSTL tag library groups that can be used when creating a JSP page −Core TagsFormatting tagsSQL tagsXML tagsJSTL Functions

Instant minus() method in Java

Samual Sam

Samual Sam

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

2K+ Views

An immutable copy of a instant where a time unit is subtracted from it can be obtained using the minus() method in the Instant class in Java. This method requires two parameters i.e. time to be subtracted from the instant and the unit in which it is to be subtracted. ... Read More

MySQL new user access denied even after giving privileges?

Samual Sam

Samual Sam

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

325 Views

After creating a user and giving all privileges to the user, you need to FLUSH PRIVILEGES to set up and want the new settings to work correctly.The syntax is as follows −FLUSH PRIVILEGES;Here is the query to create a new user which has the name ‘Bob’ in my case. The ... Read More

ByteBuffer get() method in Java

Samual Sam

Samual Sam

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

362 Views

The value at the current position of the buffer is read and then incremented using the method get() in the class java.nio.ByteBuffer. This method returns the value that is at the current buffer position. Also, the BufferUnderflowException is thrown if underflow situation occurs.A program that demonstrates this is given as ... Read More

Advertisements