Nishtha Thakur has Published 498 Articles

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

Can MongoDB return result of increment?

Nishtha Thakur

Nishtha Thakur

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

134 Views

Yes, you can achieve this with findAndModify(). Let us first create a collection with documents −> db.returnResultOfIncementDemo.insertOne({"PlayerScore":98}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd3c292edc6604c74817cda") }Following is the query to display all documents from a collection with the help of find() method −> db.returnResultOfIncementDemo.find();This will produce the following output ... Read More

override Keyword in C++

Nishtha Thakur

Nishtha Thakur

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

4K+ Views

The function overriding is the most common feature of C++. Basically function overriding means redefine a function which is present in the base class, also be defined in the derived class. So the function signatures are the same but the behavior will be different.But there may be a situation when ... Read More

How to set values to list of parameters of IN clause on PreparedStatement using JDBC?

Nishtha Thakur

Nishtha Thakur

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

4K+ Views

The IN clause in MYSQL database is used to specify the list of parameters in a query.For example, you need to retrieve contents of a table using specific IDs you can do so using the SELECT statement along with the IN clause as −mysql> SELECT * from sales where ID ... Read More

How to check if a field in MongoDB is [] or {}?

Nishtha Thakur

Nishtha Thakur

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

175 Views

To check if a field in MongoDB is [] or {}, you can use the following syntax −db.yourCollectionName.find({    "yourOuterFieldName": { "$gt": {} },    "yourOuterFieldName.0": { "$exists": false } });Let us first create a collection with documents -> db.checkFieldDemo.insert([ ...   { _id: 1010, StudentDetails: {} }, ...   ... Read More

How to pass a value in where clause on PreparedStatement using JDBC?

Nishtha Thakur

Nishtha Thakur

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

4K+ Views

To execute a statement with Where clause using PreparedStatement. Prepare the query by replacing the value in the clause with place holder “?” and, pass this query as a parameter to the prepareStatement() method.String query = "SELECT * FROM mobile_sales WHERE unit_sale >= ?"; //Creating the PreparedStatement object PreparedStatement pstmt ... Read More

Extending namespace and Unnamed namespace

Nishtha Thakur

Nishtha Thakur

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

285 Views

Here we will see how we can extend some namespace, and how the unnamed or anonymous name space can be used.Sometimes we can define one namespace. Then we can write the namespace again with the same definition. If the first one has some member, and second one has some other ... Read More

How to change notification background colour in Android?

Nishtha Thakur

Nishtha Thakur

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

2K+ Views

This example demonstrate about How can I marquee the text content in Android Notification.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     ... Read More

MongoDB pull with positional operator?

Nishtha Thakur

Nishtha Thakur

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

172 Views

Use $pull operator along with positional operator($) in MongoDB. Let us first create a collection with documents −> db.pullWithPositionalOperatorDemo.insertOne( ...   { ...      _id: 100, ...      "StudentDetails": [ ...         { ...            "StudentId": "STU-1", ...       ... Read More

How to store decimal values in a table using PreparedStatement in JDBC?

Nishtha Thakur

Nishtha Thakur

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

1K+ Views

To insert records into a table that contains a decimal value using PreparedStatement you need to −Register the driver − Register the driver class using the registerDriver() method of the DriverManager class. Pass the driver class name to it, as parameter.Establish a connection − Connect ot the database using the ... Read More

Advertisements