- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Smita Kapse has Published 558 Articles
Smita Kapse
3K+ Views
This example demonstrate about How to Send a notification when the Android app is closedStep 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
Smita Kapse
362 Views
Use $set operator along with update() for this. Let us first create a collection with documents. Here we have set one field as NumberLong −> db.findAndReplaceDemo.insertOne({"UserId":NumberLong(101)}); { "acknowledged" : true, "insertedId" : ObjectId("5cd2c960b64f4b851c3a13b6") } > db.findAndReplaceDemo.insertOne({"UserId":NumberLong(110)}); { "acknowledged" : true, "insertedId" : ObjectId("5cd2c966b64f4b851c3a13b7") } > db.findAndReplaceDemo.insertOne({"UserId":NumberLong(101)}); ... Read More
Smita Kapse
2K+ Views
Here, we are using the LayoutManager GridBagLayout to center the components. We have two components here including a label and we have set the layout as GridBagLayout −JLabel label = new JLabel("Name (Centered Label): "); JTextArea text = new JTextArea(); text.setText("Add name here..."); panel.setLayout(new GridBagLayout());The following is an example to ... Read More
Smita Kapse
181 Views
It is up to you how much space you want. You need to use the parameter size to set. Use below syntax −db.createCollection(‘yourCollectionName’, capped=true, size=yourValue);Let us implement the above syntax in order to allow size for a capped collection −> db.createCollection('cappedCollectionMaximumSize', capped=true, size=1948475757574646); { "ok" : 1 }Let us check ... Read More
Smita Kapse
98 Views
Yes, we can avoid the _id, using the following syntax in MongoDB −db.yourCollectionName.find({}, { _id:0});Let us first create a collection with documents:>> db.excludeIdDemo.insertOne({"CustomerName":"Larry"}); { "acknowledged" : true, "insertedId" : ObjectId("5cd7f62c1a844af18acdffb9") } > db.excludeIdDemo.insertOne({"CustomerName":"Chris"}); { "acknowledged" : true, "insertedId" : ObjectId("5cd7f6311a844af18acdffba") } > db.excludeIdDemo.insertOne({"CustomerName":"Mike"}); { "acknowledged" ... Read More
Smita Kapse
165 Views
To change the minimum value of a slider in Java, use the setMinimum() method wherein set the minimum value.Let’s say the following is our slider in Java −JSlider slider = new JSlider(JSlider.HORIZONTAL, 0, 100, 55); slider.setMinorTickSpacing(10); slider.setMajorTickSpacing(20); slider.setPaintTicks(true); slider.setPaintLabels(true);Now, set the minimum value −slider.setMinimum(10);The following is an example to change ... Read More
Smita Kapse
312 Views
Here we will see some interesting facts about C programming. These are like below.Sometimes the case labels of some switch statement can be placed inside if-else statement.Example#include main() { int x = 2, y = 2; switch(x) { case 1: ... Read More
Smita Kapse
383 Views
To update all elements in an array with a prefix string, use forEach(). Let us first create a collection with documents −> db.replaceAllElementsWithPrefixDemo.insertOne( { "StudentNames" : [ "John", "Carol" ] } ); { ... Read More
Smita Kapse
2K+ Views
The content in the JTextFile is by default left aligned, but you can change it using the setHorizontalAlignment() method. Let’s say the following is our JTextField −JTextField emailId = new JTextField(20);Now, we will set the horizontal alignment and set the alignment to the right for the JTextPane −emailId.setHorizontalAlignment(JTextField.RIGHT);The following is ... Read More
Smita Kapse
184 Views
The pthread_equal() function is used to check whether two threads are equal or not. This returns 0 or non-zero value. For equal threads, it will return non-zero, otherwise it returns 0. The syntax of this function is like below −int pthread_equal (pthread_t th1, pthread_t th2);Now let us see the pthread_equal() ... Read More