Samual Sam has Published 2492 Articles

Create Unit Tuple from another collection in Java

Samual Sam

Samual Sam

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

82 Views

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

How to extract part of a URL in MySQL?

Samual Sam

Samual Sam

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

2K+ Views

You need to use SUBSTRING_INDEX() function from MySQL to extract part of a URL. Let us first create a table −mysql> create table DemoTable (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    URL text ); Query OK, 0 rows affected (0.53 sec)Insert some records in the table using insert ... Read More

How to set time zone in a JSP?

Samual Sam

Samual Sam

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

536 Views

The tag is used to copy a time zone object into the specified scoped variable.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultValueTime zone to expose as a scoped or configuration variableYesNonevarName of the variable to store the new time zoneNoReplace defaultscopeScope of the variable to store the new time ... Read More

How to order last 5 records by ID in MySQL

Samual Sam

Samual Sam

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

285 Views

You can use subquery for this. Let us first create a table −mysql> create table DemoTable (    Id int ); Query OK, 0 rows affected (0.68 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(100); Query OK, 1 row affected (0.16 sec) mysql> insert ... Read More

Create Septet Tuple from Array in Java

Samual Sam

Samual Sam

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

84 Views

Let us first see what we need to work with JavaTuples. To work with Septet class in JavaTuples, you need to import the following package −import org.javatuples.Septet;Note − Steps to download and run JavaTuples program. If you are using Eclipse IDE to run Septet Class in JavaTuples, then Right Click ... Read More

What is the use of jsp plugin action element?

Samual Sam

Samual Sam

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

141 Views

The plugin action is used to insert Java components into a JSP page. It determines the type of browser and inserts the or tags as needed.If the needed plugin is not present, it downloads the plugin and then executes the Java component. The Java component can be either ... Read More

Java Program to get Milliseconds between two time instants

Samual Sam

Samual Sam

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

2K+ Views

At first, create two time instants −Instant time1 = Instant.now(); Instant time2 = time1.plus(5, ChronoUnit.HOURS).plus(50, ChronoUnit.SECONDS);Use between() to get the milliseconds between two time instants −Duration duration = Duration.ofSeconds(13); Instant i = time1.plus(duration); System.out.println("Milliseconds between two time instants = "+ChronoUnit.MILLIS.between(time1, time2));Example Live Demoimport java.time.Duration; import java.time.Instant; import java.time.temporal.ChronoUnit; public class Demo ... Read More

Perform complex MySQL insert by using CONCAT()?

Samual Sam

Samual Sam

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

1K+ Views

To perform complex MySQL insert, you can use CONCAT() function. Let us see an example and create a table with StudentId and StudentFirstName.After that, complex MySQL insert will be performed and 'Web Student’ text will get inserted for every value and unique StudentId will get concatenated.The query to create first ... Read More

How to declare a pointer to a function in C?

Samual Sam

Samual Sam

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

5K+ Views

A pointer is a variable whose value is the address of another variable or memory block, i.e., direct address of the memory location. Like any variable or constant, you must declare a pointer before using it to store any variable or block address.SyntaxDatatype *variable_nameAlgorithmBegin.    Define a function show.   ... Read More

ByteBuffer asReadOnlyBuffer() method in Java

Samual Sam

Samual Sam

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

342 Views

A read-only byte buffer can be created using the contents of a buffer with the method asReadOnlyBuffer() in the class java.nio.ByteBuffer. The new buffer cannot have any modifications as it is a read-only buffer. However, the capacity, positions, limits etc. of the new buffer are the same as the previous ... Read More

Advertisements