Karthikeya Boyini has Published 2383 Articles

Java Program to get day of week as string

karthikeya Boyini

karthikeya Boyini

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

1K+ Views

To get day of week as string, first let us display the current date −LocalDate currentDate = LocalDate.now();Now, use DayOfWeek to get the day of week from the current date −DayOfWeek day = currentDate.getDayOfWeek();Get the day of week as string −String weekName = day.name();Exampleimport java.time.DayOfWeek; import java.time.LocalDate; public class Demo ... Read More

Clock tickSeconds() method in Java

karthikeya Boyini

karthikeya Boyini

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

95 Views

The current ticking with the system clock in seconds can be obtained using the method tickSeconds() in the Clock Class in Java. This method requires a single parameter i.e. the time zone and it returns the current ticking value in seconds.A program that demonstrates this is given as follows −Example Live ... Read More

Iterate through Quintet class in Java Tuples

karthikeya Boyini

karthikeya Boyini

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

84 Views

You can iterate through Quintet class using a loop, like arrays in Java.Let us first see what we need to work with JavaTuples. To work with Quintet class in JavaTuples, you need to import the following package −import org.javatuples.Quintet;Note − Steps to download and run JavaTuples program If you are ... Read More

Java Program to get Temporal Queries precision

karthikeya Boyini

karthikeya Boyini

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

97 Views

To get Temporal Queries precision, use the TemporalQuery interface with the precision() method of the TemporalQueries −TemporalQueryprecision = TemporalQueries.precision(); Get the precision for LocalDate: LocalDate.now().query(precision) Get the precision for LocalTime: LocalTime.now().query(precision) Get the precision for YearMonth: YearMonth.now().query(precision) Get the precision for Year: Year.now().query(precision)Exampleimport java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; import java.time.Year; ... Read More

Why SHOW DBS does not show my databases in MongoDB?

karthikeya Boyini

karthikeya Boyini

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

3K+ Views

This SHOW DBS command won’t show the databases because you may have not created a document for a collection. If you will create document for a collection then the created database will be visible.Let us implement the above concept and create a database −> use web; switched to db webFollowing ... Read More

Change max_heap_table_size value in MySQL?

karthikeya Boyini

karthikeya Boyini

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

2K+ Views

The max_heap_table_size is a system variable that has both read/write property.Initially, max_heap_table_size has size 16 MB. First, check the value of max_heap_table_size, which is in bytes.The query is as follows −mysql> select @@max_heap_table_size;The following is the output −+-----------------------+ | @@max_heap_table_size | +-----------------------+ | 16777216 ... Read More

How to get number of quarters between two dates in Java

karthikeya Boyini

karthikeya Boyini

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

462 Views

Let’s say we have the following two dates −LocalDate.of(2019, 3, 20); LocalDate.of(2019, 10, 25);To get the number of quarters between the above two dates, use the QUARTER_YEARS −IsoFields.QUARTER_YEARS.between(LocalDate.of(2019, 3, 20), LocalDate.of(2019, 10, 25));Exampleimport java.time.LocalDate; import java.time.temporal.IsoFields; public class Demo {    public static void main(String[] args) {       ... Read More

How to apply a condition only if field exists in MongoDB?

karthikeya Boyini

karthikeya Boyini

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

2K+ Views

You can use $or operator for this. Let us first create a collection with documents −> db.applyConditionDemo.insertOne({"StudentName":"Larry", "StudentAge":21, "StudentMarks":45}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cb80b78623186894665ae36") } > db.applyConditionDemo.insertOne({"StudentName":"Sam", "StudentAge":23, "StudentMarks":55}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cb80b87623186894665ae37") } > db.applyConditionDemo.insertOne({"StudentName":"David", "StudentAge":21, "StudentMarks":65}); {    "acknowledged" ... Read More

How cookies work in JSP?

karthikeya Boyini

karthikeya Boyini

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

180 Views

Cookies are usually set in an HTTP header (although JavaScript can also set a cookie directly on a browser). A JSP that sets a cookie might send headers that look something like this −HTTP/1.1 200 OK Date: Fri, 04 Feb 2000 21:03:38 GMT Server: Apache/1.3.9 (UNIX) PHP/4.0b3 Set-Cookie: name = ... Read More

Rename all tables and columns to lower case in MySQL?

karthikeya Boyini

karthikeya Boyini

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

816 Views

You can achieve this with the help of INFORMATION_SCHEMA.COLUMNS. The syntax is as follows −SELECT CONCAT('ALTER TABLE ', TABLE_NAME, ' CHANGE `', COLUMN_NAME, '` `', LOWER(COLUMN_NAME), '` ', COLUMN_TYPE, ';') AS anyAliasName FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = ‘yourDatabaseName’;Now use the database which has two tables. The database name is as ... Read More

Advertisements