Smita Kapse has Published 558 Articles

MongoDB Query for boolean field as “not true”

Smita Kapse

Smita Kapse

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

777 Views

You can use $ne(not equal) operator for this. The syntax is as follows −db.yourCollectionName.find({yourFieldName: {$ne: true}}).pretty();To understand the above syntax, let us create a collection with the document. The query to create a collection with a document is as follows −> db.queryForBooleanFieldsDemo.insertOne({"EmployeeName":"Larry", "EmployeeAge":24, "isOldEmployee":true}); {    "acknowledged" : true,   ... Read More

Padding the beginning of a MySQL INT field with zeroes?

Smita Kapse

Smita Kapse

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

272 Views

You can use LPAD() from MySQL to pad the beginning of a MySQL INT field with zeroes. Let us first create a table.mysql> create table paddingDemo    -> (    -> Number int    -> ); Query OK, 0 rows affected (0.49 sec)Following is the query to insert some records ... Read More

C++ program to perform unique factorization of a Given Number

Smita Kapse

Smita Kapse

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

114 Views

Here is a C++ Program to get all the unique factorization of a given integer such that addition of a partition results an integer. In this program, a positive integer n is given, and we shall generate all possible unique ways to represent n as sum of positive integers.AlgorithmBegin function ... Read More

How to quickly reverse a string in C++?

Smita Kapse

Smita Kapse

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

185 Views

In this section, we will see how to reverse a string very quickly using C++. For reversing there is a built-in function in the algorithm library, called reverse(). This function takes the beginning and the ending pointer of a container, then reverse the elements.Input: A number string “Hello World” Output: ... Read More

Inline virtual function in C++

Smita Kapse

Smita Kapse

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

2K+ Views

Virtual functions in C++ use to create a list of base class pointers and call methods of any of the derived classes without even knowing kind of derived class object. Virtual functions are resolved late, at the runtime.The main use of the virtual function is to achieve Runtime Polymorphism. The ... Read More

How do I insert a NULL value in MySQL?

Smita Kapse

Smita Kapse

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

3K+ Views

To insert a NULL value, you can use UPDATE command. Following is the syntax −UPDATE yourTableName SET yourColumnName=NULL;Let us first create a table −mysql> create table insertNullValue    -> (    -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> ClientName varchar(100),    -> ClientCountryName varchar(20)    -> ); ... Read More

C++ Program to Find Transitive Closure of a Graph

Smita Kapse

Smita Kapse

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

358 Views

If a directed graph is given, determine if a vertex j is reachable from another vertex i for all vertex pairs (i, j) in the given graph. Reachable mean that there is a path from vertex i to j. This reachability matrix is called transitive closure of a graph. Warshall ... Read More

How to get current time from Network provider in android?

Smita Kapse

Smita Kapse

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

834 Views

This example demonstrate about How to get current time from Network provider in android.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

How can I rename a collection in MongoDB?

Smita Kapse

Smita Kapse

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

640 Views

To rename a collection in MongoDB, you can use renameCollection() method. The syntax is as follows −db.yourOldCollectionName.renameCollection('yourNewCollectionName');To understand the above syntax, let us list all the collections from database sample. The query is as follows −> use sample; switched to db sample > show collections;The following is the output −copyThisCollectionToSampleDatabaseDemo ... Read More

String tokenisation function in C

Smita Kapse

Smita Kapse

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

5K+ Views

In this section, we will see how to tokenize strings in C. The C has library function for this. The C library function char *strtok(char *str, const char *delim) breaks string str into a series of tokens using the delimiter delim.Following is the declaration for strtok() function.char *strtok(char *str, const ... Read More

Advertisements