Karthikeya Boyini has Published 2193 Articles

MonthDay withDayOfMonth() Method in Java

karthikeya Boyini

karthikeya Boyini

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

105 Views

An immutable copy of a MonthDay with the day of month altered as required is done using the method withDayOfMonth() in the MonthDay class in Java. This method requires a single parameter i.e. the day of month that is to be set in the MonthDay and it returns the MonthDay ... Read More

Fetch records in MongoDB on querying its subset

karthikeya Boyini

karthikeya Boyini

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

148 Views

You can use $all operator. Let us first create a collection with documents −> db.subsetOfAnArrayDemo.insertOne({"StudentProgrammingSkills":    ["Java", "MongoDB", "MySQL", "C++", "Data Structure", "Algorithm", "Python", "Oracle", "SQL Server"]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cb9d1e1895c4fd159f80804") }Following is the query to display all documents from the collection with the help ... Read More

Working with dates before 1970 in MySQL?

karthikeya Boyini

karthikeya Boyini

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

1K+ Views

You need to use date type to work with date before 1970 because date stores value from 1000 to 9999. A date type can be used when you need to work with date part only not for time purpose.MySQL gives the data in the following format. The format is as ... Read More

Duration negated() method in Java

karthikeya Boyini

karthikeya Boyini

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

160 Views

An immutable copy of a duration where the duration is negated can be obtained using the negated() method in the Duration class in Java. This method requires no parameters and it returns the negated duration. Also, if a numeric overflow occurs the ArithmeticException is thrown.A program that demonstrates this is ... Read More

Create Quartet Tuple from Array in Java

karthikeya Boyini

karthikeya Boyini

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

127 Views

Let us first see what we need to work with JavaTuples. To work with Quartet class in JavaTuples, you need to import the following package −import org.javatuples.Quartet;Note − Steps to download and run JavaTuples program If you are using Eclipse IDE to run Quartet Class in JavaTuples, then Right Click ... Read More

How can you implement hit counter to avoid loss of count data with each restart of the application in JSP?

karthikeya Boyini

karthikeya Boyini

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

299 Views

When you restart your application, i.e., web server, this will reset your application variable and your hit counter will reset to zero. To avoid this loss, consider the following points −Define a database table with a single count, let us say hitcount. Assign a zero value to it.With every hit, ... Read More

MonthDay query() method in Java

karthikeya Boyini

karthikeya Boyini

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

93 Views

The MonthDay object can be queried as required using the query method in the MonthDay class in Java. This method requires a single parameter i.e. the query to be invoked and it returns the result of the query.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; import ... Read More

Delete a field and value in MongoDB?

karthikeya Boyini

karthikeya Boyini

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

446 Views

To delete a MongoDB field and value, you can use $unset operator. Let us first create a collection with documents −> db.deleteFieldDemo.insertOne({"FirstName":"John", "LastName":"Smith"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cb9fb767219729fde21ddad") } > db.deleteFieldDemo.insertOne({"FirstName":"David", "LastName":"Miller"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cb9fb837219729fde21ddae") } > db.deleteFieldDemo.insertOne({"FirstName":"Carol", "LastName":"Taylor"}); { ... Read More

Iterate through Java Pair Tuple

karthikeya Boyini

karthikeya Boyini

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

2K+ Views

The iteration through Pair in JavaTuples is the same as you may have seen in Java Arrays collection.Let us first see what we need to work with JavaTuples. To work with Pair class in JavaTuples, you need to import the following package −import org.javatuples.Pair;Note − Steps to download and run ... Read More

How do you implement the auto refresh in JSP?

karthikeya Boyini

karthikeya Boyini

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

446 Views

JSP makes this job easy by providing you a mechanism where you can make a webpage in such a way that it would refresh automatically after a given interval.The simplest way of refreshing a Webpage is by using the setIntHeader() method of the response object. Following is the signature of ... Read More

Advertisements