Karthikeya Boyini has Published 2383 Articles

LocalTime toNanoOfDay() method in Java

karthikeya Boyini

karthikeya Boyini

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

36 Views

The time in the form of nanoseconds of the day can be obtained using the toNanoOfDay() method in the LocalTime class in Java. This method requires no parameters and it returns the time in the form of nanoseconds of the day.A program that demonstrates this is given as follows −Example Live ... Read More

C++ Program to Implement Hash Tables chaining with Singly Linked Lists

karthikeya Boyini

karthikeya Boyini

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

3K+ Views

A hash table is a data structure which is used to store key-value pairs. Hash function is used by hash table to compute an index into an array in which an element will be inserted or searched.This is a C++ program to Implement Hash Tables chaining with singly linked lists.AlgorithmFor ... Read More

Java Program to display a prime number less than the given number

karthikeya Boyini

karthikeya Boyini

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

332 Views

Let’s say the value you have set is 20 and you have to display a prime number less than this value i.e. 19 in this case.The following is an example that displays a prime number less than the given number −Example Live Demopublic class Demo {    public static void main(String[] ... Read More

Select first word in a MySQL query?

karthikeya Boyini

karthikeya Boyini

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

4K+ Views

To select first word in MySQL query, you can use SUBSTRING_INDEX(). Following is the syntax −select substring_index(yourColumnName, ' ', 1) as anyAliasName from yourTableName;Let us first create a table −mysql> create table DemoTable (    StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    StudentFullName varchar(40) ); Query OK, 0 rows affected ... Read More

How to upgrade MySQL server from command line?

karthikeya Boyini

karthikeya Boyini

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

2K+ Views

First, you need to open the CMD with the help of shortcut key Windows+R key.After typing cmd, press the OK button. On pressing, you will get a command prompt. The screenshot is as follows −After that, you need to reach the /bin directory. Follow the below instructions. If you are ... Read More

LocalTime plusSeconds() method in Java

karthikeya Boyini

karthikeya Boyini

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

43 Views

An immutable copy of a LocalTime object where some seconds are added to it can be obtained using the plusSeconds() method in the LocalTime class in Java. This method requires a single parameter i.e. the number of seconds to be added and it returns the LocalTime object with the added ... Read More

C++ Program to Implement Rolling Hash

karthikeya Boyini

karthikeya Boyini

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

1K+ Views

Rolling hash is a hash function in which the input is hashed in a window that moves through the input.Rabin-Karp is popular application of rolling hash. The rolling hash function proposed by Rabin and Karp calculates an integer value. For a string the integer value is numeric value of a ... Read More

How to flush output stream after writing bytes

karthikeya Boyini

karthikeya Boyini

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

381 Views

Let us first crate OutputStream with file input.txt −FileOutputStream fileStream = new FileOutputStream("E:/input.txt"); DataOutputStream dataStream = new DataOutputStream(fileStream);Now, the writeBytes() method writes out the string to the underlying output stream as a sequence of bytes.dataStream.writeBytes("Demo text!");Flush the output stream −dataStream.flush();The following is an example. Here, our file is “E:/input.txt” and ... Read More

How to display message from a stored procedure?

karthikeya Boyini

karthikeya Boyini

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

5K+ Views

To display message from stored procedure on the basis of conditions, let us use IF-ELSE condition −mysql> DELIMITER // mysql> CREATE PROCEDURE showMessage(value int, Name varchar(20))    BEGIN       IF(value > 100) then          SELECT CONCAT("HELLO", " ", Name);       ELSE     ... Read More

Java Program to write int array to a file

karthikeya Boyini

karthikeya Boyini

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

3K+ Views

Here’s our file −FileWriter writer = new FileWriter("E:/demo.txt");Now, consider an Integer array −Integer arr[] = { 10, 20, 30, 40, 50 };Write the above array to the file “demo.txt” −int len = arr.length; for (int i = 0; i < len; i++) {    writer.write(arr[i] + "\t" + ""); }The ... Read More

Advertisements