Karthikeya Boyini has Published 2383 Articles

IntBuffer array() method in Java

karthikeya Boyini

karthikeya Boyini

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

80 Views

An int array for the buffer can be obtained using the method array() in the class java.nio.IntBuffer. If the returned array is modified, then the contents of the buffer are also similarly modified and vice versa. If the buffer is read-only, then the ReadOnlyBufferException is thrown.A program that demonstrates this ... Read More

Sum if all rows are not null else return null in MySQL?

karthikeya Boyini

karthikeya Boyini

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

442 Views

You can achieve this with the help of GROUP BY HAVING clause. The syntax is as follows −SELECT yourColumnName1,    SUM(yourCoumnName2)    from yourTableName    GROUP BY yourColumnName1 HAVING COUNT(yourCoumnName2) = COUNT(*);To understand the above syntax, let us create a table. The query to create a table is as follows ... Read More

How to parse an XML in JSP?

karthikeya Boyini

karthikeya Boyini

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

713 Views

The tag is used to parse the XML data specified either via an attribute or in the tag body.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultvarA variable that contains the parsed XML dataNoNonexmlText of the document to parse (String or Reader)NoBodysystemIdThe system identifier URI for parsing the documentNoNonefilterThe filter ... Read More

What should we assign to a C++ pointer: A Null or 0?

karthikeya Boyini

karthikeya Boyini

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

1K+ Views

In C++, Null is defined as 0. Null or 0 is an integer.In case of a pointer, we can assign a pointer p as −Float* p = NULL; Float* p = 0; Float* p = nullptr;3 of them will produce the same result. null ptr is a keyword introduced in ... Read More

What is import attribute in JSP?

karthikeya Boyini

karthikeya Boyini

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

1K+ Views

The import attribute serves the same function as and behaves like, the Java import statement. The value for the import option is the name of the package you want to import.To import java.sql.*, use the following page directive −To import multiple packages, you can specify them separated by comma as ... Read More

SecureRandom setSeed() method in Java

karthikeya Boyini

karthikeya Boyini

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

364 Views

The random object can be reseeded using the setSeed() method in the class java.security.SecureRandom. This method requires a single parameter i.e. the required seed byte array and it returns the reseeded random object.A program that demonstrates this is given as follows −Example Live Demoimport java.security.*; import java.util.*; public class Demo { ... Read More

MySQL “order by” inside of “group by”? Is it possible?

karthikeya Boyini

karthikeya Boyini

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

603 Views

Instead of using ORDER BY inside GROUP BY, you can use the MAX() aggregate function.The syntax is as follows −SELECT yourNameColumnName, MAX(yourRankColumnName) FROM yourTableName GROUP BY yourNameColumnName;To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table MaxDemo   ... Read More

IntBuffer hasArray() method in Java

karthikeya Boyini

karthikeya Boyini

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

83 Views

It can be checked if a buffer has the backing of an accessible int array by using the method hasArray() in the class java.nio.IntBuffer. This method returns true if the buffer has the backing of an accessible int array and false otherwise.A program that demonstrates this is given as follows ... Read More

What is isThreadSafe attribute in JSP?

karthikeya Boyini

karthikeya Boyini

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

1K+ Views

The isThreadSafe option marks a page as being thread-safe. By default, all JSPs are considered thread-safe. If you set the isThreadSafe option to false, the JSP engine makes sure that only one thread at a time is executing your JSP.The following page directive sets the isThreadSafe option to false −Read More

MySQL select accumulated (running sum) column?

karthikeya Boyini

karthikeya Boyini

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

195 Views

To select accumulated column, let us first create a demo table. The query to create a table is as follows −mysql> create table accumulatedDemo    -> (    -> Value int    -> ); Query OK, 0 rows affected (0.58 sec)Insert some records in the table using insert command. The ... Read More

Advertisements