What is the use of tag in JSP?

Samual Sam
Updated on 30-Jul-2019 22:30:25
The tag allows proper URL request parameter to be specified with URL and also does the necessary URL encoding required.Within a tag, the name attribute indicates the parameter name, and the value attribute indicates the parameter value −AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultnameName of the request parameter to set in the URLYesNonevalueValue of the request parameter to set in the URLNoBodyExampleIf you need to pass parameters to a tag, use the tag to create the URL first as shown below − The above request will ... Read More

LocalDate toString() method in Java

karthikeya Boyini
Updated on 30-Jul-2019 22:30:25
The string value of the LocalDate object can be obtained using the method toString() in the LocalDate class in Java. This method requires no parameters and it returns the string value of the LocalDate object.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; public class Demo { public static void main(String[] args) { LocalDate ld = LocalDate.parse("2019-02-15"); System.out.println("The LocalDate is: " + ld.toString()); } }OutputThe LocalDate is: 2019-02-15Now let us understand the above program.The string value of the LocalDate ... Read More

The subList() method of AbstractList class in Java

George John
Updated on 30-Jul-2019 22:30:25
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 and toIndex is the high endpoint (exclusive) of the subList.To work with the AbstractList class, import the following package.import java.util.AbstractList;The following is an example to implement subList() method of the AbstractlList class in Java.Exampleimport java.util.ArrayList; import java.util.AbstractList; public class Demo {    public static void main(String[] args) {   ... Read More

How to create MongoDB stored procedure?

Smita Kapse
Updated on 30-Jul-2019 22:30:25
The following is the syntax to create MongoDB stored procedure −db.system.js.save (    {       _id:"yourStoredProcedueName",       value:function(argument1,....N)       {          statement1,          .          .          N       }    } );Now implement the above syntax. The query to create a stored procedure is as follows −> db.system.js.save (    {       _id:"addTwoValue",       value:function(a,b)       {          return a+b       }    } );The following is the output −WriteResult({ "nMatched" : 0, "nUpserted" : 1, "nModified" : 0, "_id" : "addTwoValue" })Now you can call the stored procedure using eval(). The query is as follows −> db.eval("return addTwoValue(100,25)"); 125

How can I enforce compound uniqueness in MySQL?

Chandu yadav
Updated on 30-Jul-2019 22:30:25
You can enforce compound uniqueness in MySQL with the help of UNIQUE keyword. Here is the syntax to add UNIQUE keyword to your table column.The syntax is as followsCREATE TABLE yourTableName (    yourColumnName1 datatype,    yourColumnName2 datatype,    yourColumnName3 datatype,    .    .    N    UNIQUE yourConstarintName(yourColumnName2, yourColumnName3) );To understand the above concept, let us create a table with some columns and add a unique constraint to a table. The query to create a table is as followsmysql> create table UniqueDemo    -> (    -> StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> StudentName varchar(100), ... Read More

log() function in C++

George John
Updated on 30-Jul-2019 22:30:25
The C/C++ library function double log(double x) returns the natural logarithm (basee logarithm) of x. Following is the declaration for log() function.double log(double x)The parameter is a floating point value. And this function returns natural logarithm of x.Example Live Demo#include #include using namespace std; int main () {    double x, ret;    x = 2.7;    /* finding log(2.7) */    ret = log(x);    cout

C++ Program to Implement Dijkstra’s Algorithm Using Set

Nancy Den
Updated on 30-Jul-2019 22:30:25
This is a C++ Program to Implement Dijkstra’s Algorithm using Set. Here we need to have two sets. We generate a shortest path tree with given source node as root. One set contains vertices included in shortest path tree and other set includes vertices not yet included in shortest path tree. At every step, we find a vertex which is in the other set (set of not yet included) and has minimum distance from source.Algorithm:Begin    function dijkstra() to find minimum distance:    1) Create a set Set that keeps track of vertices included in shortest    path tree, Initially, ... Read More

How to use MongoDB $pull to delete documents within an Array?

Chandu yadav
Updated on 30-Jul-2019 22:30:25
You need to use update command along with $pull operator to delete documents within an array. Let us create a collection with documents. Following is the query> db.deleteDocumentsDemo.insertOne( ... { ...    "_id":100, ...    "StudentsDetails" : [ ...       { ...          "StudentId" : 1, ...          "StudentName" : "John" ...       }, ...       { ...          "StudentId" : 2, ...          "StudentName" : "Carol" ...       }, ...       { ...         ... Read More

Generate a random string in Java

karthikeya Boyini
Updated on 30-Jul-2019 22:30:25
Let us first declare a string array and initialize −String[] strArr = { "P", "Q", "R", "S", "T", "U", "V", "W" };Now, create a Random object −Random rand = new Random();Generate random string −int res = rand.nextInt(strArr.length);Example Live Demoimport java.util.Random; public class Demo {    public static void main(String[] args) {       String[] strArr = { "P", "Q", "R", "S", "T", "U", "V", "W" };       Random rand = new Random();       int res = rand.nextInt(strArr.length);       System.out.println("Displaying a random string = " + strArr[res]);    } }OutputDisplaying a random string = RLet ... Read More

Modulus of Negative Numbers in C

Smita Kapse
Updated on 30-Jul-2019 22:30:25
Here we will see what will be the result if we use negative numbers to get the modulus. Let us see the following programs and their outputs to get the idea.Example#include int main() {    int a = 7, b = -10, c = 2;    printf("Result: %d", a % b / c); }OutputResult: 3Here the precedence of % and / are same. So % is working at first, so a % b is generating 7, now after dividing it by c, it is generating 3. Here for a % b, the sign of left operand is appended to the ... Read More
Advertisements