Anvi Jain has Published 500 Articles

How to show an android notification exactly 3 actions?

Anvi Jain

Anvi Jain

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

270 Views

This example demonstrate about How to determine if an activity has been called by a Notification in AndroidStep 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 ... Read More

MongoDB Query to combine AND & OR?

Anvi Jain

Anvi Jain

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

2K+ Views

To combine AND & OR in MongoDB, let us first create a collection with documents −>db.combinedAndOrDemo.insertOne({"StudentFirstName":"John", "StudentAge":23, "StudentSkill":"MongoDB"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd306dcb64f4b851c3a13e2") } >db.combinedAndOrDemo.insertOne({"StudentFirstName":"Larry", "StudentAge":21, "StudentSkill":"MySQL"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd306f3b64f4b851c3a13e3") } >db.combinedAndOrDemo.insertOne({"StudentFirstName":"Sam", "StudentAge":24, "StudentSkill":"SQL Server"}); {    "acknowledged" : true, ... Read More

Linear search using Multi-threading in C

Anvi Jain

Anvi Jain

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

955 Views

Here we will see how to apply the multi-threading concept to search one element in an array. Here the approach is very simple. We will create some threads, then divide the array into different parts. Different thread will search in different parts. After that, when the element is found, enable ... Read More

How do you update a MongoDB document while replacing the entire document?

Anvi Jain

Anvi Jain

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

174 Views

Let us first create a collection with a document −>db.replacingEntireDocumentDemo.insertOne({"StudentFirstName":"John", "StudentLastName":"Smith", "StudentCountryName":"US"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd3119bb64f4b851c3a13e8") }Following is the query to display document from a collection with the help of find() method −> db.replacingEntireDocumentDemo.find().pretty();This will produce the following output −{    "_id" : ObjectId("5cd3119bb64f4b851c3a13e8"),   ... Read More

How do I remove a string from an array in a MongoDB document?

Anvi Jain

Anvi Jain

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

452 Views

You can use $pull operator to remove a string from an array. Let us first create a collection with documents −> db.removeAStringDemo.insertOne({"Score":[45, 67, 89, "John", 98, 99, 67]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cda5224b50a6c6dd317adbd") }Following is the query to display all documents from a collection with the ... Read More

wprintf() and wscanf in C Library

Anvi Jain

Anvi Jain

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

2K+ Views

Here we will see the wprintf() and wscanf() functions in C. These are the printf() and scanf() functions for wide characters. These functions are present in the wchar.hThe wprintf() function is used to print the wide character to the standard output. The wide string format may contain the format specifiers ... Read More

MongoDB query for fields in embedded document?

Anvi Jain

Anvi Jain

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

274 Views

Let us first create a collection with documents −> db.embeddedDocumentDemo.insertOne( ...    { ...       "CustomerDetails":[ ...          {"CustomerName":"Chris", "CustomerPurchasePrice":3000}, ...          {"CustomerName":"Robert", "CustomerPurchasePrice":4500}, ...          {"CustomerName":"David", "CustomerPurchasePrice":1000}, ...       ] ...    } ... ); { ... Read More

How to push new items to an array inside of an object in MongoDB?

Anvi Jain

Anvi Jain

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

988 Views

You can use $elemMatch operator for this. Let us first create a collection with documents −> db.pushNewItemsDemo.insertOne(    {       "_id" :1,       "StudentScore" : 56,       "StudentOtherDetails" : [          {             "StudentName" : "John", ... Read More

sqrt, sqrtl and sqrtf in C++

Anvi Jain

Anvi Jain

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

977 Views

In the cmath library of C++, there are different functions for getting the square root except from sqrt. The sqrt is used basically for double type input. The others are used for float, long type data etc. Let us see the usage of these functions.The sqrt() FunctionThis function is used ... Read More

How to prevent resizing columns in a JTable

Anvi Jain

Anvi Jain

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

1K+ Views

To prevent resizing columns, use the method setResizingAllowed(). Here, we will set setResizingAllowed() to false for table header to disallow resizing of columns from header −table.getTableHeader().setResizingAllowed(false);Let us first see an example wherein we can easily resize columns in a table by resizing the table column header −Examplepackage my; import java.awt.Color; ... Read More

Advertisements