
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Krantik Chavan has Published 278 Articles

Krantik Chavan
21K+ Views
Let us first set two Instants with ofEpochSeconds() method using seconds from the epoch of 1970-01- 01T00:00:00Z.Now get the duration between the above two Instant:Duration res = Duration.between(one, two);Exampleimport java.time.Duration; import java.time.Instant; public class Demo { public static void main(String[] args) { Instant one = Instant.ofEpochSecond(1845836728); ... Read More

Krantik Chavan
3K+ Views
The following are the two Instant timestamps:Instant one = Instant.ofEpochSecond(1355836728); Instant two = Instant.ofEpochSecond(1355866935);Get the Duration between both the Instant:Duration res = Duration.between(one, two);Now, get the seconds between the two timestamps:long seconds = res.getSeconds();Now, get the minutes between the two timestamps:long minutes = res.abs().toMinutes();Exampleimport java.time.Duration; import java.time.Instant; public class Demo ... Read More

Krantik Chavan
221 Views
To SELECT records if the absolute value of the difference between two values is greater than a certain number, following is the syntax:select *from yourTableName where abs(yourColumnName1-yourColumnName2) >= yourCertainNumber;Let us first create a table:mysql> create table DemoTable ( Number1 int , Number2 int ); Query OK, 0 rows ... Read More

Krantik Chavan
397 Views
You can use LEFT() from MySQL to display some character from the entire value in MySQL. Following is the syntax:select left(yourColumnName ,200 ) AS anyAliasName from yourTableName;Let us first create a table:mysql> create table DemoTable (Paragraph longtext); Query OK, 0 rows affected (0.71 sec)Following is the query to insert records ... Read More

Krantik Chavan
4K+ Views
To skip blank and null in MySQL, use the following syntax:select *from yourTableName where yourColumnName IS NOT NULL AND yourColumnName '';Let us first create a table:mysql> create table DemoTable (Id int, FirstName varchar(20)); Query OK, 0 rows affected (0.66 sec)Following is the query to insert records in the table ... Read More

Krantik Chavan
4K+ Views
Firstly, declare a Long array list and add some elements to it:ArrayList < Long > arrList = new ArrayList < Long > (); arrList.add(100000 L); arrList.add(200000 L); arrList.add(300000 L); arrList.add(400000 L); arrList.add(500000 L);Now, set the same size for the newly created long array:final long[] arr = new long[arrList.size()]; int index ... Read More

Krantik Chavan
339 Views
To evaluate mathematical string to int, use Nashorn JavaScript in Java i.e. scripting. Nashorn invoke dynamics feature, introduced in Java 7 to improve performance.For scripting, use the ScriptEngineManager class for the engine:ScriptEngineManager scriptEngineManager = new ScriptEngineManager(); ScriptEngine scriptEngine = scriptEngineManager.getEngineByName("nashorn");Now, use put() to set a key/value pair in the state ... Read More

Krantik Chavan
130 Views
It can be checked if a particular MonthDay is before the other MonthDay in a timeline using the isBefore() method in the MonthDay class in Java. This method requires a single parameter i.e. the MonthDay object that is to be compared. It returns true if the MonthDay object is before ... Read More

Krantik Chavan
126 Views
It can be checked if a particular MonthDay is after the other MonthDay in a timeline using the isAfter() method in the MonthDay class in Java. This method requires a single parameter i.e. the MonthDay object that is to be compared. It returns true if the MonthDay object is after ... Read More

Krantik Chavan
276 Views
The most efficient want to check the presence of a row, use the count():select count(1) from yourTableName where yourCondition;Let us first create a table:mysql> create table DemoTable ( Id int, FirstName varchar(20) ); Query OK, 0 rows affected (0.73 sec)Following is the query to insert some records in ... Read More