Smita Kapse has Published 558 Articles

What's the difference between __PRETTY_FUNCTION__, __FUNCTION__, __func__ in C/C++?

Smita Kapse

Smita Kapse

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

1K+ Views

Here we will see what are the differences between __FUNCTION__, __func__ and the __PRETTY_FUNCTION__ in C++.Basically the __FUNCTION__ and __func__ are same. Some old versions of C and C++ supports __func__. This macro is used to get the name of the current function. The _PRETTY_FUNCTION__ is used to return the ... Read More

How to create MongoDB stored procedure?

Smita Kapse

Smita Kapse

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

1K+ Views

The following is the syntax to create MongoDB stored procedure −db.system.js.save (    {       _id:"yourStoredProcedueName",       value:function(argument1, ....N)       {          statement1,          .          .          N       ... Read More

Modulus of Negative Numbers in C

Smita Kapse

Smita Kapse

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

1K+ Views

Here we will see what will be the result if we use negative numbers to get the modulus. Let us see the following programs and their outputs to get the idea.Example#include int main() {    int a = 7, b = -10, c = 2;    printf("Result: %d", a % ... Read More

How to use AND Conjunctive Operators in Android sqlite?

Smita Kapse

Smita Kapse

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

83 Views

Before getting into example, we should know what sqlite data base in android is. SQLite is an open source SQL database that stores data to a text file on a device. Android comes in with built in SQLite database implementation. SQLite supports all the relational database features. In order to ... Read More

What is difference between int and const int& in C/C++?

Smita Kapse

Smita Kapse

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

3K+ Views

Here we will see what are the differences between int and const_int& in C or C++.The int is basically the type of integer type data. And const is used to make something constant. If there is int& constant, then it indicates that this will hold the reference of some int ... Read More

Structure Sorting in C++

Smita Kapse

Smita Kapse

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

1K+ Views

Here we will see how to sort using some condition on some member variables of the structure in C++. In this example we will take a structure called book. The book will hold name, number of pages, and price. We will sort them based in the price.For comparing two structures, ... Read More

The toArray() method of CopyOnWriteArrayListin Java

Smita Kapse

Smita Kapse

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

66 Views

The toArray() method is used to return an array containing all the elements in this list in proper sequence.The syntax is as follows −Object[] toArray()To work with CopyOnWriteArrayList class, you need to import the following package −import java.util.concurrent.CopyOnWriteArrayList;The following is an example to implement CopyOnWriteArrayList class toArray() method in Java−Example Live ... Read More

Compound Literals in C

Smita Kapse

Smita Kapse

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

458 Views

In this section we will see what is the compound literals in C. The compound literals are introduced in C99 standard in C. Using this feature, it can create unnamed objects. In the following example we will see how to use compound literal to generate object without any name.Example#include struct ... Read More

MongoDB print JSON without whitespace i.e. unpretty JSON?

Smita Kapse

Smita Kapse

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

568 Views

To print unpretty json, use the following syntax −var yourVariableName= db.yourCollectionName.find().sort({_id:-1}).limit(10000); while( yourVariableName.hasNext() ) {    printjsononeline(yourVariableName.next() ); };To understand the syntax, let us create a collection with the document. The query to create a collection with a document is as follows −> db.unprettyJsonDemo.insertOne({"StudentName":"John", "StudentAge":21, "StudentTechnicalSkills":["C", "C++"]}); {   ... Read More

LongStream summaryStatistics() method in Java

Smita Kapse

Smita Kapse

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

83 Views

The summaryStatistics() method in the LongStream class in Java returns a LongSummaryStatistics describing various summary data about the elements of this stream.The syntax is as follows −LongSummaryStatistics summaryStatistics()Here, LongSummaryStatistics is a state object for collecting statistics such as count, min, max, etc.To use the LongStream class in Java, import the ... Read More

Advertisements