
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 569 Articles

Anvi Jain
1K+ Views
To get the path of the selected file, at first get the selected file −java.io.File f = file.getSelectedFile();Now, get the path of the selected file which we will get using the above method −System.err.println(f.getPath());The following is an example to get the path of the file selected in the JFileChooser component ... Read More

Anvi Jain
823 Views
If we need to modify a pointer rather than the object that the pointer is pointing to, we pass a pointer by reference.Here is an example of how to pass a pointer by reference −Example Live Demo#include using namespace std; void Decrement( int*& d ) { --d; } int ... Read More

Anvi Jain
328 Views
You can use $where operator for this. Let us first create a collection with documents −>db.searchDocumentArrayIntegerDemo.insertOne({"StudentFirstName":"John", "StudentScores":[45, 78, 89, 90]}); { "acknowledged" : true, "insertedId" : ObjectId("5cd2a219345990cee87fd88c") } >db.searchDocumentArrayIntegerDemo.insertOne({"StudentFirstName":"Larry", "StudentScores":[45, 43, 34, 33]}); { "acknowledged" : true, "insertedId" : ObjectId("5cd2a22a345990cee87fd88d") } >db.searchDocumentArrayIntegerDemo.insertOne({"StudentFirstName":"Chris", "StudentScores":[]}); { "acknowledged" ... Read More

Anvi Jain
71 Views
We can set or disallow selection of column in the table using setColumnSelectionAllowed().Let’s say the following is our table −DefaultTableModel tableModel = new DefaultTableModel(); JTable table = new JTable(tableModel);If you want to allow selection of column, then set the method to TRUE −table.setColumnSelectionAllowed(true);If you want to disallow selection of column, ... Read More

Anvi Jain
4K+ Views
Travelling Salesman Problem use to calculate the shortest route to cover all the cities and return back to the origin city. This method is use to find the shortest path to cover all the nodes of a graph.This is the program to find shortest route of a unweighted graph.AlgorithmBegin ... Read More

Anvi Jain
5K+ Views
To compile multiple files like file_name.h, or file_name.cpp at once, we can use the files like a list one after another. The syntax will be like this −g++ abc.h xyz.cppTo run the program, we can use this −./a.outExamplefloat area(float r){ return (3.1415*r*r); //area of a circle } float area(float ... Read More

Anvi Jain
588 Views
We will use the Null type here. Following are the null types with the alias −TypeNumberAliasDouble1“double”String2“string”Object3“object”Array4“array”Binary data5“binData”Undefined6“undefined”ObjectId7“objectId”Boolean8“bool”Date9“date”Null10“null”Regular Expression11“regex”Following is the syntax for type 10 i.e. null −db.yourCollectionName.find({"yourFieldName":{ $type: 10 } });The above syntax will find only those documents which have null value. Let us first create a collection with documents ... Read More

Anvi Jain
300 Views
You can use $inc operator to increment. Let us first create a collection with documents −> db.addInUpdateFunctionDemo.insertOne({"PlayerName":"Chris", "PlayerScore":78}); { "acknowledged" : true, "insertedId" : ObjectId("5cd2b3f4345990cee87fd893") } > db.addInUpdateFunctionDemo.insertOne({"PlayerName":"Robert", "PlayerScore":88}); { "acknowledged" : true, "insertedId" : ObjectId("5cd2b3fc345990cee87fd894") } > db.addInUpdateFunctionDemo.insertOne({"PlayerName":"David", "PlayerScore":99}); { "acknowledged" : true, ... Read More

Anvi Jain
148 Views
Let’s say we have a menu and within that we need to set the JCheckBoxMenuItem. Here’s the Menu −JMenu editMenu = new JMenu("Edit"); editMenu.setMnemonic(KeyEvent.VK_E); menuBar.add(editMenu);Now, set the JCheckBoxMenuItem and add it to the editMenu created above −JCheckBoxMenuItem checkMenuItem = new JCheckBoxMenuItem("SelectAll"); checkMenuItem.setMnemonic(KeyEvent.VK_B); editMenu.add(checkMenuItem);The following is an example to set JCheckBoxMenuItem ... Read More

Anvi Jain
829 Views
This is the program to find closest pair of points in an array.AlgorithmsFor Distance between Closest pointBegin Declare function Closest_dist_Spoint(poi stp[], int s, double dist, poi &pnt1, poi &pnt2) to the double datatype. Declare Minimum to the double datatype. Initialize Minimum = dist. for ... Read More