- 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
Anvi Jain has Published 629 Articles
Anvi Jain
360 Views
To select two fields and return a sorted array with distinct values, use aggregate framework along with $setUnion operator. Let us first create a collection with documents −> db.sortedArrayWithDistinctDemo.insertOne( ... { value1: 4, value2: 5} ... ); { "acknowledged" : true, "insertedId" : ObjectId("5cc690b99cb58ca2b005e666") } > db.sortedArrayWithDistinctDemo.insertOne( ... Read More
Anvi Jain
652 Views
To disallow resizing component with GridBagLayout, use the GridBagConstraints NONE constant −GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.NONE;The following is an example to disallow resizing component with GridBagLayout −Examplepackage my; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextArea; import javax.swing.WindowConstants; public class SwingDemo { ... Read More
Anvi Jain
1K+ Views
Here we will see what are the differences between iostream and iostream.h in C++. The iostream.h was a header file used by the early 1990's I/O streams library. This was developed at AT&T for use with early C++. In that time C++ was not standardized.iostream header file used by the ... Read More
Anvi Jain
12K+ Views
Here we will see how to calculate the time taken by the process. For this problem, we will use the clock() function. The clock() is present in the time.h header file.To get the elapsed time, we can get the time using clock() at the beginning, and at the end of ... Read More
Anvi Jain
276 Views
This is a C++ program to solve the Dominating Set problem.AlgorithmBegin Take the number of vertices and edges as input. Also take the edge point of the edges. function dominant(): Declare vector Set. Take any edge e graph connecting the vertices i.e.; ... Read More
Anvi Jain
524 Views
For MongoDB multidimensional array projection, you need to use aggregate framework. Let us first create a collection with documents. Here, we have multidimensional array for Student marks −> db.multiDimensionalArrayProjection.insertOne( ... { ... "StudentFirstName" : "Chris", ... "StudentMarks" : [ [98, 99], [56, 79] ... Read More
Anvi Jain
446 Views
To create a borderless window in Java, do not decorate the window. The following is an example to create a BorderLess Window −Examplepackage my; import java.awt.GraphicsEnvironment; import java.awt.GridLayout; import java.awt.Point; import javax.swing.JLabel; import javax.swing.JPasswordField; import javax.swing.JTextField; import javax.swing.JWindow; import javax.swing.SwingConstants; public class SwingDemo { public static void main(String[] args) ... Read More
Anvi Jain
55 Views
Here we will see some program that will return different results if they are compiled in C or C++ compilers. We can find many such programs, but here we are discussing about some of them.In C and C++, the character literals are treated as different manner. In C, they are ... Read More
Anvi Jain
1K+ Views
This is a C++ program to implement Treap. Treap data structure is basically a randomized binary search tree. Here, we shall consider insert, delete and search operations on this.Functions and descriptionsfunction rotLeft() for left rotationFirst rotate the tree then set new root.function rotRight() for right rotationFirst rotate the tree then ... Read More
Anvi Jain
92 Views
To remove only a single document, use the remove() in MongoDB. Let us first create a collection with documents −> db.removeOnlyOneDocumentDemo.insertOne({"FirstName":"John", "LastName":"Smith"}); { "acknowledged" : true, "insertedId" : ObjectId("5cc6ca2f9cb58ca2b005e674") } > db.removeOnlyOneDocumentDemo.insertOne({"FirstName":"Carol", "LastName":"Taylor"}); { "acknowledged" : true, "insertedId" : ObjectId("5cc6ca399cb58ca2b005e675") } > db.removeOnlyOneDocumentDemo.insertOne({"FirstName":"David", "LastName":"Miller"}); { ... Read More