- 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
Nishtha Thakur has Published 564 Articles
Nishtha Thakur
91 Views
We have set a component first −GridBagConstraints constraints = new GridBagConstraints(); constraints.gridy = 0; panel.add(new JButton("First row"), constraints);Now, we will place it next to the previously added component −constraints.gridx = GridBagConstraints.RELATIVE; constraints.gridy = 1; panel.add(new JButton("2nd row 1st column"), constraints); panel.add(new JButton("2nd row 2nd column"), constraints);Examplepackage my; import java.awt.GridBagConstraints; import ... Read More
Nishtha Thakur
367 Views
The C++ language is designed by adding some additional features like Object Oriented concepts with C. Most of the C programs can be compiled using C++ compiler also. Though there are some programs that cannot be compiled using C++ compiler.Let us see some code, that will compile in C compiler, ... Read More
Nishtha Thakur
147 Views
Vizing’s theorem state that the chromatic index of simple graph can be either maxdegree or maxdegree+1. Here, chromatic index means maximum color needed for the edge coloring of the graph.This is a C++ program to implement the Vizing’s Theorem.AlgorithmBegin Take the number of vertices and edges as input. ... Read More
Nishtha Thakur
1K+ Views
To remove key fields in MongoFB, you can use $unset operator. Let us first create a collection with documents −>db.removeKeyFieldsDemo.insertOne({"StudentFirstName":"John", "StudentLastName":"Doe", "StudentAge":23}); { "acknowledged" : true, "insertedId" : ObjectId("5cc6c8289cb58ca2b005e672") } >db.removeKeyFieldsDemo.insertOne({"StudentFirstName":"John", "StudentLastName":"Smith", "StudentAge":21}); { "acknowledged" : true, "insertedId" : ObjectId("5cc6c8359cb58ca2b005e673") }Following is the query to display ... Read More
Nishtha Thakur
375 Views
To create titled border for a panel, use the createTitledBorder() method. Let us create a panel first −JPanel panel = new JPanel(); JButton btn1 = new JButton("One"); JButton btn2 = new JButton("Two"); panel.add(btn1); panel.add(btn2);Now, set titled border with BorderFactory class −panel.setBorder(BorderFactory.createTitledBorder("Title of the border"));The following is an example to create ... Read More
Nishtha Thakur
1K+ Views
Here we will see three functions. These functions are trunc(), truncf() and the truncl(). These functions are used to convert floating point values into truncated form.The trunc() FunctionThis function is used to truncate double type value. And return only the integer part. The syntax is like below.double trunc(double argument)Example#include ... Read More
Nishtha Thakur
5K+ Views
This is a C++ program to print Happy Birthday.AlgorithmBegin Take a str1 which takes the next character of our desired ouput like for H it will be G. Assign the string to a pointer p. Make a while loop till *p != NULL. Go ... Read More
Nishtha Thakur
135 Views
Yes, you can set a variable collection name in MongoDB shell using JavaScript. Let us first create a collection with documents −> db.employeeInformation.insertOne({"EmployeeName":"John Smith", "EmployeeAge":24, "EmployeeSalary":450000}); { "acknowledged" : true, "insertedId" : ObjectId("5cc6d06baf8e7a4ca6b2ad97") }Following is the query to display all documents from a collection with the help of ... Read More
Nishtha Thakur
125 Views
In C++ and Java, there are another type of loop called foreach loop. This is not present in C. This loop has introduced in C++11 and Java JDK 1.5.0. The advantage of this loop is that, it can access the elements very quickly without performing initialization, testing and increment/decrement. This ... Read More
Nishtha Thakur
298 Views
In a Directed Acyclic Graph, we can sort vertices in linear order using topological sort.Topological sort is only work on Directed Acyclic Graph. In a Directed Acyclic Graph (DAG), there can be more than one topological sort.We shall consider a C++ program, which will perform topological sort to check cycle ... Read More