- 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
137 Views
Create a panel and set the layout −JPanel panel = new JPanel(); GridBagLayout layout = new GridBagLayout(); panel.setLayout(layout);Now, set the constrainst and with that the columnWeights and rowWeights −GridBagConstraints gbc = new GridBagConstraints(); JLabel label = new JLabel("Rank: "); JTextArea text = new JTextArea(); text.setText("Add rank here..."); layout.columnWeights = new ... Read More
Smita Kapse
9K+ Views
In C++, we can derive some classes. Sometimes we need to call the super class (Base class) constructor when calling the constructor of the derived class. Unlike Java there is no reference variable for super class. If the constructor is non-parameterized, then it will be called automatically with the derived ... Read More
Smita Kapse
392 Views
This is a C++ Program to solve a matching problem for a Given Specific Case. Here, N men and N women are given, each person has ranked all members of the opposite gender in order of preference, marry the men and women together such that there are no two people ... Read More
Smita Kapse
653 Views
Here we will see how to write one-line C function, that can round floating point numbers. To solve this problem, we have to follow these steps.Take the numberif the number is positive, then add 0.5Otherwise, subtract 0.5Convert the floating point value to an integer using typecastingExample#include int my_round(float ... Read More
Smita Kapse
130 Views
To create a user in MongoDB v3, use the createUser() method. This allows you to create a user and while creating you need to add user, password, and roles as well. These roles assign permissions. The syntax is as follows −use admin db.createUser( { user: “yourUserName", ... Read More
Smita Kapse
446 Views
To add components with a relative X position, use the GridBagConstraints.RELATIVE constant. Set this to gridx field −GridBagConstraints constraints = new GridBagConstraints(); constraints.gridx = GridBagConstraints.RELATIVE;The following is an example to add components with a relative X position in Java −Examplepackage my; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import javax.swing.JButton; import javax.swing.JFrame; import ... Read More
Smita Kapse
492 Views
This is a C++ Program to Demonstrate the Implementation of 4-Color Problem.AlgorithmBegin Develop function issafe() to check if the current color assignment is safe for vertex v i.e. checks whether the edge exists or not. If it exists, then next check whether the color ... Read More
Smita Kapse
250 Views
You can use the concept of map reduce to get the position in an array. Let us first create a collection with documents −> db.retrievePositionDemo.find(); { "_id" : ObjectId("5cd569ec7924bb85b3f4893f"), "Subjects" : [ "MySQL", "MongoDB", "Java" ] }Following is the query to display all documents from a collection with the help ... Read More
Smita Kapse
3K+ Views
For vertical alignment, create a frame and set the layout using the BoxLayout manager −JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(new BoxLayout(frame.getContentPane(), BoxLayout.Y_AXIS));Above, we have set the BoxLayout to set the alignment since it is a layout manager that allows multiple components to be laid out either vertically or horizontally. ... Read More
Smita Kapse
2K+ Views
In this section, we will see what are the setjump and longjump in C. The setjump() and longjump() is located at setjmp.h library. The syntax of these two functions is like below.setjump(jmp_buf buf) : uses buf to store current position and returns 0. longjump(jmp_buf buf, i) : Go back to ... Read More