Import Attribute in JSP

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

2K+ 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 follows −By default, a container automatically imports java.lang.*, javax.servlet.*, javax.servlet.jsp.*, and javax.servlet.http.*.

Print XPath Expression Result in JSP

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

400 Views

The tag displays the result of an XPath expression. It functions the same as JSP syntax.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultselectXPath expression to evaluate as a string, often using XPath variablesYesNoneescapeXmlTrue if the tag should escape special XML charactersNotrueExampleLet us take an example which will cover the tags (a) , (b) .           JSTL x:out Tags               Books Info:                                                 ... Read More

IntStream sorted Method in Java

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

390 Views

The sorted() method in Java IntStream class is used to return a stream consisting of the elements of this stream in sorted order.The syntax is as followsIntStream sorted()The sorted() method returns the new stream. To work with the IntStream class, you need to import the following packageimport java.util.stream.IntStream;Create an IntStream and add some elementsIntStream intStream = IntStream.of(30, 50, 70, 120, 150, 200, 250, 300);Now, to sort the above stream elements, use the sorted() methodintStream.sorted() The following is an example to implement IntStream sorted() method in JavaExample Live Demoimport java.util.stream.IntStream; public class Demo {    public static void main(String[] args) { ... Read More

Sublist Method of AbstractSequentialList in Java

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

141 Views

The subList() method returns a part of this list between the specified fromIndex, inclusive, and toIndex, exclusive. Get a sublist using the method by setting the range as the two parameters.The syntax is as follows −public List subList(int fromIndex, int toIndex)Here, the parameter fromIndex is the low endpoint (inclusive) of the subList, whereas toIndex is the high endpoint (exclusive) of the subListTo work with the AbstractSequentialList class in Java, you need to import the following package −import java.util.AbstractSequentialList;The following is an example to implement AbstractSequentialList subList() method in Java −Example Live Demoimport java.util.LinkedList; import java.util.AbstractSequentialList; public class Demo {   ... Read More

Return Local Array from C/C++ Function

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

250 Views

This is a C++ program return a local array from a function.AlgorithmBegin We can use dynamically allocated array to return a local array from function Array(). Print the elements of the array. EndExample Code Live Demo#include using namespace std; int* Array() { int* a = new int[100]; a[0] = 7; a[1] = 6; a[2] = 4; a[3] = 5; return a; } int main() { int* p = Array(); cout

MySQL SELECT INTO Equivalent

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

433 Views

The SELECT INTO equivalent is CREATE TABLE AS SELECT statement. The syntax is as follows −CREATE TABLE yourNewTableName AS SELECT *FROM yourTableName;To understand the above concept, let us create a table. The query to create a table is as follows −mysql> create table selectIntoEquivalentDemo    -> (    -> ClientId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> ClientName varchar(20),    -> ClientAge int    -> ); Query OK, 0 rows affected (0.71 sec)Insert some records in the table using insert command. The query is as follows −mysql> insert into selectIntoEquivalentDemo(ClientName, ClientAge) values('Larry', 34); Query OK, 1 row affected (0.13 ... Read More

Detect Specific Color Blue Using OpenCV with Python

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

2K+ Views

For many people, image processing may seem like a scary and daunting task but it is not as hard as many people thought it is. In this tutorial we’ll be doing basic color detection in openCv with python.How does color work on a computer?We represent colors on a computers by color-space or color models which basically describes range of colors as tuples of numbers.Instead of going for each color, we’ll discuss most common color-space we use .i.e. RGB(Red, Green, Blue) and HSV (Hue, Saturation, Value).RGB basically describes color as a tuple of three components. Each component can take a value ... Read More

Use GridLayoutManager in RecyclerView

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

377 Views

This example demonstrate about How to use GridLayoutManager in RecyclerViewStep 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.                   In the above code, we have taken recycerview.Step 3 − Add the following code to src/MainActivity.java import android.annotation.TargetApi; import android.os.Build; import android.os.Bundle; import android.support.v4.content.ContextCompat; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.DividerItemDecoration; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.widget.TextView; import android.widget.Toast; import java.util.ArrayList; public ... Read More

Convert Duration to Total Length in Nanoseconds in Java

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

192 Views

With this, get the nanoseconds in days, hours and minutes. At first, set the Duration:Duration d1 = Duration.ofDays(5); Duration d2 = Duration.ofHours(20); Duration d3 = Duration.ofMinutes(15);Convert the above Duration to nanoseconds:System.out.println("Nanoseconds in 5 days = "+d1.toNanos()); System.out.println("Nanoseconds in 20 hours = "+d2.toNanos()); System.out.println("Nanoseconds in 15 minutes = "+d3.toNanos());Exampleimport java.time.Duration; public class Demo {    public static void main(String[] args) {       Duration d1 = Duration.ofDays(5);       Duration d2 = Duration.ofHours(20);       Duration d3 = Duration.ofMinutes(15);       System.out.println("Nanoseconds in 5 days = "+d1.toNanos());       System.out.println("Nanoseconds in 20 hours = "+d2.toNanos());   ... Read More

Which Datatype to Use for Flag in MySQL

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

2K+ Views

To set a flag, you can set the type as tinyint(1) type. Following is the syntax −yourColumnName tinyint(1) DEFAULT 1;Let us first create a table −mysql> create table DemoTable (    ClientId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    ClientName varchar(20),    isMarried tinyint(1) DEFAULT 1 ); Query OK, 0 rows affected (0.64 sec)Insert some records in the table using insert command −mysql> INSERT INTO DemoTable(ClientName, isMarried) values('Larry', 0); Query OK, 1 row affected (0.16 sec) mysql> INSERT INTO DemoTable(ClientName) values('David'); Query OK, 1 row affected (0.12 sec) mysql> INSERT INTO DemoTable(ClientName, isMarried) values('Mike', 1); Query OK, 1 row affected (0.19 ... Read More

Advertisements