Nishtha Thakur has Published 495 Articles

How to insert/store JSON array into a database using JDBC?

Nishtha Thakur

Nishtha Thakur

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

10K+ Views

A Json array is an ordered collection of values that are enclosed in square brackets i.e. it begins with ‘[’ and ends with ‘]’. The values in the arrays are separated by ‘, ’ (comma).Sample JSON array{    "books": [ Java, JavaFX, Hbase, Cassandra, WebGL, JOGL] }The json-simple is a ... Read More

Middle of three using minimum comparisons in C++

Nishtha Thakur

Nishtha Thakur

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

700 Views

In this section, we will see how to find the middle of three given values by comparing them. So if three numbers are given like (10, 30, 20), then it will find 20 as this is the middle element. Let us see the algorithm first, then we will implement that ... Read More

How to add a sub-document to sub-document array in MongoDB?

Nishtha Thakur

Nishtha Thakur

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

2K+ Views

Use the $push operator to add a sub-document. Let us first create a collection with documents −> db.subDocumentToSubDocumentDemo.insertOne(    {       "_id" :101,       "StudentName" : "Larry",       "StudentAge" : 21,       "StudentDetails" : [          {     ... Read More

kbhit in C language

Nishtha Thakur

Nishtha Thakur

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

2K+ Views

Here we will see the kbhit functionality in C. The kbhit is basically the Keyboard Hit. This function is present at conio.h header file. So for using this, we have to include this header file into our code.The functionality of kbhit() is that, when a key is pressed it returns ... Read More

Name Mangling and extern “C” in C++

Nishtha Thakur

Nishtha Thakur

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

1K+ Views

In C++ we can use the function overloading feature. Using this feature, we can create functions with same name. The only difference is the type of the arguments, and the number of arguments. The return type is not considered here. Now the question comes how the C++ distinguishes overloaded functions ... Read More

How to apply adjustments to the last column of a JTable only, when the width of any column is changed in Java Swing?

Nishtha Thakur

Nishtha Thakur

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

448 Views

To apply adjustments to the last column only, use the setAutoResizeMode and set the mode. The mode here would be AUTO_RESIZE_LAST_COLUMN. This will allow you to adjust only the last columns even if any of the column header is dragged to resize.Let us first see an example to create a ... Read More

How to retrieve auto-incremented value generated by Statement using JDBC?

Nishtha Thakur

Nishtha Thakur

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

313 Views

While creating a table, in certain scenarios, we need values to column such as ID, to be generated/incremented automatically. Various databases support this feature in different ways.In MySQL database you can declare a column auto increment using the following syntax.CREATE TABLE table_name(    ID INT PRIMARY KEY AUTO_INCREMENT,    column_name1 ... Read More

How to access subdocument value when the key is a number in MongoDB?

Nishtha Thakur

Nishtha Thakur

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

170 Views

To access subdocument value, let us first create a collection with documents −> db.accessSubDocumentDemo.insertOne( ...    { ... ...       "Details" : { ...          "1" : { ...             "StudentLowerScore" : "33", ...             ... Read More

How to set the initial value of an auto-incremented column in MySQL using JDBC?

Nishtha Thakur

Nishtha Thakur

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

2K+ Views

While creating a table, in certain scenarios, we need values to column such as ID, to be generated/incremented automatically. Various databases support this feature in different ways.In MySQL database you can declare a column auto increment using the following syntax.CREATE TABLE table_name(    ID INT PRIMARY KEY AUTO_INCREMENT,    column_name1 ... Read More

Returning multiple values from a function using Tuple and Pair in C++

Nishtha Thakur

Nishtha Thakur

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

3K+ Views

In C or C++, we cannot return more than one value from a function. To return multiple values, we have to provide output parameter with the function. Here we will see another approach to return multiple value from a function using tuple and pair STL in C++.The Tuple is an ... Read More

Advertisements