Smita Kapse has Published 498 Articles

How to display multiple notifications in android?

Smita Kapse

Smita Kapse

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

983 Views

This example demonstrate about How to display multiple notifications 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 res/layout/activity_main.xml.     Step 3 − ... Read More

How to increment a field in MongoDB?

Smita Kapse

Smita Kapse

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

373 Views

To increment a field in MongoDB, you can use $inc operator. Let us first create a collection with documents −> db.incrementDemo.insertOne({"PlayerScore":100}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cc81cdd8f9e6ff3eb0ce44e") } > db.incrementDemo.insertOne({"PlayerScore":290}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cc81ce28f9e6ff3eb0ce44f") } > db.incrementDemo.insertOne({"PlayerScore":560}); {    "acknowledged" : true, ... Read More

How to add components with a relative Y position in Java?

Smita Kapse

Smita Kapse

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

150 Views

To add components with a relative Y position, use the GridBagConstraints.RELATIVE constant. Set this to gridy field −GridBagConstraints constraints = new GridBagConstraints(); constraints.gridy = GridBagConstraints.RELATIVE;The following is an example to add components with a relative Y position in Java −Examplepackage my; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import javax.swing.JButton; import javax.swing.JFrame; import ... Read More

What should be used to implement MySQL LIKE statement in MongoDB?

Smita Kapse

Smita Kapse

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

116 Views

To get MySQL LIKE statement, use the REGEX in MongoDB. Let us first create a collection with documents −> db.likeInMongoDBDemo.insertOne({"Name" : "Sam"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd6922857806ebf1256f123") } > db.likeInMongoDBDemo.insertOne({"Name" : "John" }); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd6923157806ebf1256f124") } > db.likeInMongoDBDemo.insertOne({"Name" : ... Read More

How to make notification intent resume rather than making a new intent?

Smita Kapse

Smita Kapse

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

526 Views

This example demonstrate about How to make notification intent resume rather than making a new intentStep 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

Reverse array field in MongoDB?

Smita Kapse

Smita Kapse

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

294 Views

To reverse array field in MongoDB, you can use forEach(). Let us first create a collection with documents −> db.reverseArrayDemo.insertOne({"Skills":["C", "Java"]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5ccddf99dceb9a92e6aa1946") }Following is the query to display all documents from a collection with the help of find() method −> db.reverseArrayDemo.find().pretty();This will ... Read More

How to set the alignment of the JLabel content along the X axis on the left in Java

Smita Kapse

Smita Kapse

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

150 Views

To set the alignment of the label content along the X axis on the left, use the setHorizontalAlignment() method and set the location. Let us first set a label component. We have set the label background color as well so that we can check the alignment of the label’s content ... Read More

How to find documents with exactly the same array entries as in a MongoDB query?

Smita Kapse

Smita Kapse

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

127 Views

For this, use the $all operator. Let us first create a collection with documents −>db.findDocumentExactlySameInArrayDemo.insertOne({"TechnicalSubjects":["C++", "Java", "MongoDB"]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd69a5f57806ebf1256f12e") } >db.findDocumentExactlySameInArrayDemo.insertOne({"TechnicalSubjects":["MySQL", "Java", "MongoDB"]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd69ac057806ebf1256f12f") } >db.findDocumentExactlySameInArrayDemo.insertOne({"TechnicalSubjects":["C#", "Python", "MongoDB"]}); {    "acknowledged" : true,    "insertedId" ... Read More

How to use Reference Parameters in C++?

Smita Kapse

Smita Kapse

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

241 Views

Here we will see how to pass reference of some variable in C++. Sometimes we call it as “Call by Reference”.The call by reference method of passing arguments to a function copies the reference of an argument into the formal parameter. Inside the function, the reference is used to access ... Read More

How to set the alignment of the JLabel content along the Y axis on the top in Java

Smita Kapse

Smita Kapse

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

194 Views

To set the alignment of the label’s content along the Y axis on the top, use the setVerticalAlignment() method and set the location. Let us first set a label component. We have set the label background color as well so that we can check the alignment of the label’s content ... Read More

Advertisements