Anvi Jain has Published 569 Articles

Custom Notification Sounds for Android Oreo and Beyond?

Anvi Jain

Anvi Jain

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

2K+ Views

This example demonstrate about Custom Notification Sounds for Android Oreo and BeyondStep 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

C++ Program to Generate a Random UnDirected Graph for a Given Number of Edges

Anvi Jain

Anvi Jain

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

443 Views

This is a C++ program in which we generate a undirected random graph for the given edges ‘e’. This algorithm basically implements on a big network and time complexity of this algorithm is O(log(n)).AlgorithmBegin    Function GenerateRandomGraphs(), has ‘e’ as the number edges in the argument list.    Initialize i ... Read More

How to implement a copy constructors in C++?

Anvi Jain

Anvi Jain

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

523 Views

Here we will see how the copy constructors are implemented in C++. Before discussing that we should know what is the copy constructor.The copy constructor is a constructor which creates an object by initializing it with an object of the same class, which has been created previously. The copy constructor ... Read More

What is the syntax for boolean values in MongoDB?

Anvi Jain

Anvi Jain

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

6K+ Views

You can use $eq as well as $ne operator for boolean values. Let us first create a collection with documents −> db.booleanQueryDemo.insertOne({"UserName":"John", "UserAge":23, "isMarried":true}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cc815c08f9e6ff3eb0ce44a") } > db.booleanQueryDemo.insertOne({"UserName":"Chris", "UserAge":21, "isMarried":false}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cc815d08f9e6ff3eb0ce44b") } > db.booleanQueryDemo.insertOne({"UserName":"Robert", ... Read More

How to create Vertical progress bar occupying the entire frame in Java

Anvi Jain

Anvi Jain

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

256 Views

For this, create a vertical progress bar −JProgressBar progressBar = new JProgressBar(JProgressBar.VERTICAL); progressBar.setEnabled(true);Also, set the bounds −progressBar.setBounds(70, 50, 120, 30);The following is an example to create vertical progress bar occupying the entire frame −Examplepackage my; import java.awt.BorderLayout; import java.awt.Color; import javax.swing.JFrame; import javax.swing.JProgressBar; public class SwingDemo {    public static ... Read More

Merge two array fields in MongoDB?

Anvi Jain

Anvi Jain

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

693 Views

To merge, use $setUnion operator. Let us first create a collection with documents −> db.mergeTwoArrayFieldDemo.insertOne({"NaturalNumbers":[1, 2, 3, 8, 10, 20, 30], "WholeNumbers":[0, 1, 2, 63, 78, 20, 45]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd68e4057806ebf1256f11d") }Following is the query to display all documents from a collection with the ... Read More

Start an Activity from a Notification in Android?

Anvi Jain

Anvi Jain

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

1K+ Views

This example demonstrate about Start an Activity from 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 res/layout/activity_main.xml.     Step 3 ... Read More

Difference between files written in binary and text mode in C++

Anvi Jain

Anvi Jain

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

635 Views

Text modeBinary modeIn text mode various character translations are performed i.e;“\r+\f” is converted into “”In binary mode, such translations are not performed.To write in the files:ofstream ofs (“file.txt”);Orofstream ofs;ofs.open(“file.txt”);to write in the files: ofstream ofs(“file.txt”, ios::binary);orofstream ofs;ofs.open(“file.txt”, ios::binary);To add text at the end of the file:Ofstream ofs(“file.txt”, ios::app);orofstream ofs;ofs.open(“file.txt”, ios::app);To add text ... Read More

How to pull all elements from an array in MongoDB without any condition?

Anvi Jain

Anvi Jain

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

327 Views

You can use $set operator for this. Let us first create a collection with documents −> db.pullAllElementDemo.insertOne( ...    { ...       "StudentId":101, ...       "StudentDetails" : [ ...          { ... ...             "StudentName": "Carol", ...   ... Read More

Add multiple number input fields with JOptionPane and display the sum in Console with Java

Anvi Jain

Anvi Jain

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

2K+ Views

At first, set multiple number input fields −JTextField text1 = new JTextField(10); JTextField text2 = new JTextField(10); JTextField text3 = new JTextField(10); JTextField text4 = new JTextField(10); JTextField text5 = new JTextField(10); JTextField text6 = new JTextField(10); JTextField text7 = new JTextField(10); JTextField text8 = new JTextField(10); panel.add(text1); panel.add(text2); panel.add(text3); ... Read More

Advertisements