Karthikeya Boyini has Published 2383 Articles

LinkedBlockingDeque in Java

karthikeya Boyini

karthikeya Boyini

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

248 Views

The LinkedBlockingDeque Class in Java has a blockingdeque that is optionally bounded and based on linked nodes. This class implements the Collection interface as well as the AbstractQueue class. It is a part of the Java Collection Framework.A program that demonstrates this is given as follows −Example Live Demoimport java.util.concurrent.LinkedBlockingDeque; public ... Read More

Java Signature getAlgorithm() method

karthikeya Boyini

karthikeya Boyini

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

150 Views

The name of the algorithm for the signature object can be obtained using the method getAlgorithm() in the class java.security.Signature. This method requires no parameters and it returns the name of the algorithm for the signature object.A program that demonstrates this is given as follows −Example Live Demoimport java.security.*; import java.util.*; ... Read More

How to executes an SQL SELECT statement in a JSP?

karthikeya Boyini

karthikeya Boyini

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

3K+ Views

The tag executes an SQL SELECT statement and saves the result in a scoped variable.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultsqlSQL command to execute (should return a ResultSet)NoBodydataSourceDatabase connection to use (overrides the default)NoDefault databasemaxRowsMaximum number of results to store in the variableNoUnlimitedstartRowNumber of the row in the ... Read More

Return null for date_format when input is null in MySQL?

karthikeya Boyini

karthikeya Boyini

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

529 Views

Use IF() function to return null for date_format when input is null in MySQL. The syntax is as follows −SELECT IF(yourDateColumnName, date_format(yourDateColumnName, '%d/%m/%Y'), NULL) FROM yourTableName;To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table returnNullWhenInputIsNullDemo    -> ... Read More

How to convert Float array list to float array in Java?

karthikeya Boyini

karthikeya Boyini

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

2K+ Views

Let us first create a float array list −ArrayList < Float > arrList = new ArrayList < Float > (); arrList.add(5.2 f); arrList.add(10.3 f); arrList.add(15.3 f); arrList.add(20.4 f);Now, convert the float array list to float array. At first, we have set the same size to float array i.e. the same ... Read More

What are various attributes Of page directive in JSP?

karthikeya Boyini

karthikeya Boyini

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

486 Views

Following table lists out the attributes associated with the page directive −S.No.Attribute & Purpose1bufferSpecifies a buffering model for the output stream.2autoFlushControls the behavior of the servlet output buffer.3contentTypeDefines the character encoding scheme.4errorPageDefines the URL of another JSP that reports on Java unchecked runtime exceptions.5isErrorPageIndicates if this JSP page is a ... Read More

Java Program to get random letters

karthikeya Boyini

karthikeya Boyini

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

787 Views

To generate random letters, set letters as a strong and use the toCharArray() to convert it into character array −"abcdefghijklmnopqrstuvwxyz".toCharArray()Now, use the nextInt() to generate random letters from it −System.out.println("" + "abcdefghijklmnopqrstuvwxyz".toCharArray()[randNum.nextInt("abcdefghijklmnopqrstuvwxyz".toCharArray().length)]);Above, initially we have created a Random object −static Random randNum = new Random();Example Live Demoimport java.util.Random; public class Demo ... Read More

CopyOnWriteArraySet in Java

karthikeya Boyini

karthikeya Boyini

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

53 Views

A thread safe version of the set is the CopyOnWriteArraySet in Java. This set uses an CopyOnWriteArrayList internally for the set operations. The CopyOnWriteArraySet was introduced by the JDK 1.5.A program that demonstrates this is given as follows −Example Live Demoimport java.util.concurrent.*; public class Demo extends Thread {    public static ... Read More

How to execute UPDATE SQL in a JSP?

karthikeya Boyini

karthikeya Boyini

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

1K+ Views

The tag executes an SQL statement that does not return data; for example, SQL INSERT, UPDATE, or DELETE statements.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultsqlSQL command to execute (should not return a ResultSet)NoBodydataSourceDatabase connection to use (overrides the default)NoDefault databasevarName of the variable to store the count of ... Read More

Verify that MySQL SET FOREIGN KEY CHECKS is set to = 1?

karthikeya Boyini

karthikeya Boyini

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

652 Views

You can verify SET FOREIGN KEY CHECKS is set to = 1 or not with the help of variable@@foreign_key_checks;The syntax is as follows −select @@foreign_key_checks;You can use SHOW VARIABLES command. The syntax is as follows −show variables like 'foreign%';Now you can implement both the syntaxes.Case 1 − Using variable @@foreign_key_checks.The ... Read More

Advertisements