Anvi Jain has Published 629 Articles

How to use lastIndexOf () in Android textview?

Anvi Jain

Anvi Jain

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

254 Views

This example demonstrate about How to use lastIndexOf () in Android textview.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

Array class in C++

Anvi Jain

Anvi Jain

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

3K+ Views

Array class in C++ are efficient enough and also it knows its own size.Functions used to perform operations on array aresize() = To return the size of array i.e. returns the no of elements of the array.max_size() = To return maximum number of elements of the array.get(), at(), operator[] = ... Read More

How to use replace () in Android textview?

Anvi Jain

Anvi Jain

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

1K+ Views

This example demonstrate about How to use replace () in Android textview.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

Standard Size of character ('a') in C/C++ on Linux

Anvi Jain

Anvi Jain

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

4K+ Views

In C++ the size of the character literal is char. In C the type of character literal is integer (int). So in C the sizeof(‘a’) is 4 for 32bit architecture, and CHAR_BIT is 8. But the sizeof(char) is one byte for both C and C++.Example Code Live Demo#include main() {   ... Read More

Get a count of total documents with MongoDB while using limit?

Anvi Jain

Anvi Jain

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

632 Views

You can use $facet operator for this. To understand the concept, let us create a collection with document. The query to create a collection with document is as follows −> db.totalDocumentDemo.insertOne({"InstructorId":100, "InstructorName":"Larry", "InstructorFav ouriteSubject":["Java", "MongoDB", "Python"]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c76e6701e9c5dd6f1f78274") } > db.totalDocumentDemo.insertOne({"InstructorId":200, "InstructorName":"Sam", "InstructorFav ... Read More

Find largest document size in MongoDB?

Anvi Jain

Anvi Jain

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

622 Views

To find the largest document size in MongoDB, you need to write a script in the shell.To understand the concept, let us create a collection with the document. The query to create a collection with a document is as follows −> db.largestDocumentDemo.insertOne({"StudentName":"John"}); {    "acknowledged" : true,    "insertedId" : ... Read More

C++ Program to Generate N Number of Passwords of Length M Each

Anvi Jain

Anvi Jain

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

207 Views

This is a C++ Program to Generate N Number of Passwords of Length M Each.AlgorithmBegin    Take the length of password as input.    function permutation() generate random passwords:    /* Arguments       A pointer array a.       Total Number of random numbers m.     ... Read More

How to use startsWith () in Android textview?

Anvi Jain

Anvi Jain

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

227 Views

This example demonstrate about How to use startsWith () in Android textview.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

Get MongoDB documents with max attribute per group in a collection?

Anvi Jain

Anvi Jain

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

319 Views

You can get documents with max attribute per group in a collection using $sort operator along with $group statement.To understand the concept further, let us create a collection with document. The query to create a collection with document is as follows −> db.maxAttributePerGroup.insertOne({"StudentFirstName":"John", "StudentLastName":"Smith    ", "StudentAge":29, "StudentId":10}); {   ... Read More

Opposite of $addToSet to '$removeFromSet' in MongoDB?

Anvi Jain

Anvi Jain

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

1K+ Views

To get the opposite of $addToSet to '$removeFromSet', use the $pull operator.Let us create a collection with a document. The query to create a collection with a document is as follows −> db.oppositeAddToSetDemo.insertOne({"StudentName":"John", "StudentHobby":["Cricket", "Cooking", "Drawing"]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c8eddcc2f684a30fbdfd588") } > db.oppositeAddToSetDemo.insertOne({"StudentName":"Carol", "StudentHobby":["Cricket", "Dance", ... Read More

Advertisements