Karthikeya Boyini has Published 2383 Articles

Ways to copy a vector in C++

karthikeya Boyini

karthikeya Boyini

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

10K+ Views

There are different ways to copy a vector in C++.1) std::copystd:: copy is inbuilt to copy the elements from one vector to another.Syntaxstd::copy(first_iterator_o, last_iterator_o, back_inserter()): first_iteratot_0 = First iterator of first vector. last_iteratot_0 = Last iterator of first vector. back_inserter() = To insert values from back.AlgorithmBegin    Declare v1 of ... Read More

Java Signature toString() method

karthikeya Boyini

karthikeya Boyini

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

272 Views

The string representation for the signature object can be obtained using the method getString() in the class java.security.Signature. This includes information such as the object state, algorithm name etc. The method getString() requires no parameters and it returns the provider for the signature object.A program that demonstrates this is given ... Read More

What happens when buffer is set to a value "none" in JSP?

karthikeya Boyini

karthikeya Boyini

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

147 Views

The buffer attribute specifies the buffering characteristics for the server output response object.You may code value of "none" to specify no buffering so that the servlet output is immediately directed to the response object or you may code a maximum buffer size in kilobytes, which directs the servlet to write ... Read More

Java Program to find keys from both the Linked HashMap and store it in a list alternatively

karthikeya Boyini

karthikeya Boyini

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

61 Views

Let us first create a LinkedHashMap with key-value pair −Mapmap1 = new LinkedHashMap(); map1.put("1", "Jim"); map1.put("2", "David"); map1.put("3", "Tom"); map1.put("4", "Sam"); map1.put("5", "Steve");Let us now create another LinkedHashMap with key-value pair −Mapmap2 = new LinkedHashMap(); map2.put("6", "Katie"); map2.put("7", "John"); map2.put("8", "Kane"); map2.put("9", "Chris");Now, create a new List and store the ... Read More

Get the date/time of the last change to a MySQL database?

karthikeya Boyini

karthikeya Boyini

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

965 Views

You can get the date/time of the last change to a MySQL database with the help of INFORMATION_SCHEMA.TABLES. The syntax is as follows −SELECT update_time FROM information_schema.tables WHERE table_schema = 'yourDatabaseName’' AND table_name = 'yourTableName’;To understand the above syntax, let us create a table. The query to create a table ... Read More

What is contentType attribute in JSP?

karthikeya Boyini

karthikeya Boyini

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

4K+ Views

The contentType attribute sets the character encoding for the JSP page and for the generated response page. The default content type is text/html, which is the standard content type for HTML pages.If you want to write out XML from your JSP, use the following page directive −The following statement directs ... Read More

Java Program to convert LocalDate to java.util.Date by timezone offset

karthikeya Boyini

karthikeya Boyini

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

122 Views

Set the LocalDate to now −LocalDate date = LocalDate.now();Now, set the TimeZone offset −ZoneOffset timeZone = ZoneOffset.UTC;Convert the LocalDate to java.util.Date −Date.from(date.atStartOfDay().toInstant(timeZone))Example Live Demoimport java.time.LocalDate; import java.time.ZoneOffset; import java.util.Date; public class Demo {    public static void main(String[] args) {       LocalDate date = LocalDate.now();       System.out.println("Date ... Read More

Hashmap vs WeakHashMap in Java

karthikeya Boyini

karthikeya Boyini

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

1K+ Views

Details about HashMap and WeakHashMap that help to differentiate them are given as follows −HashMap in JavaA HashMap has key-value pairs i.e. keys that are associated with the values and the keys are in arbitrary order. A HashMap object that is specified as a key is not eligible for garbage ... Read More

SecureRandom getInstance() method in Java

karthikeya Boyini

karthikeya Boyini

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

232 Views

A SecureRandom object can be obtained using the getInstance() method in class java.security.SecureRandom. This SecureRandom object is useful in implementing the Random Number Generator (RNG) algorithm that is specified.The getInstance() method requires a single parameter i.e. the Random Number Generator (RNG) algorithm and it returns the SecureRandom object.A program that ... Read More

How to use parameterized SQL query in a JSP?

karthikeya Boyini

karthikeya Boyini

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

933 Views

The tag used as a nested action for the tag and the tag to supply a value for a value placeholder. If a null value is provided, the value is set to SQL NULL for the placeholder.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultValueValue of the parameter ... Read More

Advertisements