Anvi Jain has Published 629 Articles

How to display tree structured data in Java?

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:26

678 Views

To display tree structured data, use the JTree control in Java Swing.At first, create a node in the tree −DefaultMutableTreeNode node = new DefaultMutableTreeNode("Project");Now, add nodes to the node created above −DefaultMutableTreeNode node1 = new DefaultMutableTreeNode("App"); DefaultMutableTreeNode node2 = new DefaultMutableTreeNode("Website"); DefaultMutableTreeNode node3 = new DefaultMutableTreeNode("WebApp"); node.add(node1); node.add(node2); node.add(node3);Now, create ... Read More

Difference between fork() and exec() in C

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:26

3K+ Views

Here we will see the effect of fork() and exec() system call in C. The fork is used to create a new process by duplicating the calling process. The new process is the child process. See the following property.The child process has its own unique process id.The parent process id ... Read More

Implement MongoDB toLowerCase() in a forEach loop to update the name of students?

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:26

139 Views

Let us first create a collection with documents wherein one of the fields is StudentName −> db.lowerCaseDemo.insertOne({"StudentName":"JOHN SMith"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd9a86fb50a6c6dd317ad9f") } > db.lowerCaseDemo.insertOne({"StudentName":"CAROL TAYLor"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd9a88fb50a6c6dd317ada0") } > db.lowerCaseDemo.insertOne({"StudentName":"DAVID Miller"}); {    "acknowledged" : true,   ... Read More

How to show an android notification exactly 3 actions?

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:26

142 Views

This example demonstrate about How to determine if an activity has been called by a Notification in AndroidStep 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 ... Read More

MongoDB Query to combine AND & OR?

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:26

1K+ Views

To combine AND & OR in MongoDB, let us first create a collection with documents −>db.combinedAndOrDemo.insertOne({"StudentFirstName":"John", "StudentAge":23, "StudentSkill":"MongoDB"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd306dcb64f4b851c3a13e2") } >db.combinedAndOrDemo.insertOne({"StudentFirstName":"Larry", "StudentAge":21, "StudentSkill":"MySQL"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd306f3b64f4b851c3a13e3") } >db.combinedAndOrDemo.insertOne({"StudentFirstName":"Sam", "StudentAge":24, "StudentSkill":"SQL Server"}); {    "acknowledged" : true, ... Read More

Linear search using Multi-threading in C

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:26

732 Views

Here we will see how to apply the multi-threading concept to search one element in an array. Here the approach is very simple. We will create some threads, then divide the array into different parts. Different thread will search in different parts. After that, when the element is found, enable ... Read More

wcstoll() function in C/C++

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:26

94 Views

The wcstoll() function is used to convert the wide character string to long long integers. It sets the pointer to point to the first character after the last one. The syntax is like below.long long wcstoll(const wchar_t* str, wchar_t** str_end, int base)This function takes three arguments. These arguments are like ... Read More

How do you update a MongoDB document while replacing the entire document?

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:26

98 Views

Let us first create a collection with a document −>db.replacingEntireDocumentDemo.insertOne({"StudentFirstName":"John", "StudentLastName":"Smith", "StudentCountryName":"US"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd3119bb64f4b851c3a13e8") }Following is the query to display document from a collection with the help of find() method −> db.replacingEntireDocumentDemo.find().pretty();This will produce the following output −{    "_id" : ObjectId("5cd3119bb64f4b851c3a13e8"),   ... Read More

How do I remove a string from an array in a MongoDB document?

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:26

332 Views

You can use $pull operator to remove a string from an array. Let us first create a collection with documents −> db.removeAStringDemo.insertOne({"Score":[45, 67, 89, "John", 98, 99, 67]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cda5224b50a6c6dd317adbd") }Following is the query to display all documents from a collection with the ... Read More

wprintf() and wscanf in C Library

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:26

1K+ Views

Here we will see the wprintf() and wscanf() functions in C. These are the printf() and scanf() functions for wide characters. These functions are present in the wchar.hThe wprintf() function is used to print the wide character to the standard output. The wide string format may contain the format specifiers ... Read More

Advertisements