What is the difference between include action and include directive in JSP?

Chandu yadav
Updated on 30-Jul-2019 22:30:25
include action lets you insert files into the page being generated. The syntax looks like this −Unlike the include directive, which inserts the file at the time the JSP page is translated into a servlet, this action inserts the file at the time the page is requested.

How to parse number in JSP?

karthikeya Boyini
Updated on 30-Jul-2019 22:30:25
The tag is used to parse numbers, percentages, and currencies.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultValueNumeric value to read (parse)NoBodytypeNUMBER, CURRENCY, or PERCENTNonumberparseLocaleLocale to use when parsing the numberNoDefault localeintegerOnlyWhether to parse to an integer (true) or floating-point number (false)NofalsepatternCustom parsing patternNoNonetimeZoneTime zone of the displayed dateNoDefault time zonevarName of the variable to store the parsed numberNoPrint to pagescopeScope of the variable to store the formatted numberNopageA pattern attribute is provided that works just like the pattern attribute for the tag. However, in the case of parsing, the pattern attribute tells the parser what format to expect.Example ... Read More

LocalDateTime format() method in Java

karthikeya Boyini
Updated on 30-Jul-2019 22:30:25
The LocalDateTime can be formatted with the specified formatter using the format() method in the LocalDateTime class in Java. This method requires a single parameter i.e. the LocalDateTime object to be formatted and it returns the formatted LocalDateTime with the specified formatter.A program that demonstrates this is given as follows −Example Live Demoimport java.util.*; import java.time.*; import java.time.format.DateTimeFormatter; public class Main {    public static void main(String[] args) {       LocalDateTime ldt = LocalDateTime.parse("2019-02-18T14:30:47");       System.out.println("The LocalDateTime is: " + ldt);       DateTimeFormatter dtf = DateTimeFormatter.ISO_TIME;       System.out.println("The formatted LocalDateTime is: " + ... Read More

LongStream asDoubleStream() method in Java

Chandu yadav
Updated on 30-Jul-2019 22:30:25
The asDoubleStream() method of the LongStream class in Java returns a DoubleStream consisting of the elements of this stream, converted to double.The syntax is as follows.DoubleStream asDoubleStream()Here, DoubleStream is a sequence of primitive double-valued elements. To use the LongStream class in Java, import the following package.import java.util.stream.LongStream;Create LongStream and add elements.LongStream longStream = LongStream.of(2000L, 35000L, 45000L);Now, convert it to double and return using asDoubleStream() method.DoubleStream s = longStream.asDoubleStream();The following is an example to implement LongStream asDoubleStream() method.Example Live Demoimport java.util.stream.LongStream; import java.util.stream.DoubleStream; public class Demo {    public static void main(String[] args) {       LongStream longStream = LongStream.of(2000L, 35000L, ... Read More

C++ Program to Implement Stack

Nitya Raut
Updated on 30-Jul-2019 22:30:25
In this program we will see how to implement stack using C++. A stack is an abstract data structure that contains a collection of elements. Stack implements the LIFO mechanism i.e. the element that is pushed at the end is popped out first. Some of the principle operations in the stack are −Push - This adds a data value to the top of the stack.Pop - This removes the data value on top of the stackPeek - This returns the top data value of the stackA program that implements a stack using array is given as follows.Input: Push elements 11, ... Read More

How to fasten MySQL inserts?

George John
Updated on 30-Jul-2019 22:30:25
You can speed the MySQL insert when you are inserting multiple records at the same time with the help of the following syntaxSTART TRANSACTION insert into insertDemo(yourColumnName1, yourColumnName2, ...N) values(yourValue1, yourValue2, ....N), (yourValue1, yourValue2, ....N), .......N commitLet us first create a demo tablemysql> create table insertDemo    -> (    -> StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> StudentName varchar(20),    -> StudentAge int    -> ); Query OK, 0 rows affected (0.72 sec)Insert multiple records at the same time. The query is as follows −mysql> START TRANSACTION; Query OK, 0 rows affected (0.00 sec) mysql> insert into ... Read More

How to convert std::string to LPCWSTR in C++?

Krantik Chavan
Updated on 30-Jul-2019 22:30:25
In this section we will see how to convert C++ wide string (std::wstring) to LPCWSTR. The LPCWSTR is the (Long Pointer to Constant Wide STRing). It is basically the string with wide characters. So by converting wide string to wide character array we can get LPCWSTR. This LPCWSTR is Microsoft defined. So to use them we have to include Windows.h header file into our program.To convert std::wstring to wide character array type string, we can use the function called c_str() to make it C like string and point to wide character string.Example Code#include #include using namespace std; main(){    wstring ... Read More

How to dismiss the dialog with click on outside of the dialog?

Nitya Raut
Updated on 30-Jul-2019 22:30:25
This example demonstrate about how to dismiss the dialog with click on outside of the dialogStep 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 text view.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.annotation.TargetApi; import android.content.DialogInterface; import android.os.Build; import android.os.Bundle; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends AppCompatActivity {    TextView text;    @TargetApi(Build.VERSION_CODES.LOLLIPOP) ... Read More

Java Program to get maximum value with Comparator

Samual Sam
Updated on 30-Jul-2019 22:30:25
First, declare an integer array and add some elements −Integer arr[] = { 40, 20, 30, 10, 90, 60, 700 };Now, convert the above array to List −List list = Arrays.asList(arr);Now, use Comparator and the reverseOrder() method. Using min() will eventually give you the minimum value, but with reverseOrder(), it reverses the result −Comparator comp = Collections.reverseOrder(); System.out.println("Maximum element = "+Collections.min(list, comp));Example Live Demoimport java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.List; public class Demo {    @SuppressWarnings("unchecked")    public static void main(String args[]) {       Integer arr[] = { 40, 20, 30, 10, 90, 60, 70 };     ... Read More

wcspbrk() function in C/C++

Smita Kapse
Updated on 30-Jul-2019 22:30:25
The wcspbrk() function is a built in function of C or C++. It searches for a set of wide characters present in a wide string in another wide string. This function is present into cwhar header file.This function takes two arguments. The first argument is destination, and the second argument is the source. As destination we have to pass null terminated wide strings to be searched. As source, we have to pass null terminated wide string, that is containing the characters that will be searched.This function returns two values. If one or more than one wide character is present, this ... Read More
Advertisements