Nishtha Thakur has Published 564 Articles

How to perform $gt on a hash in a MongoDB document?

Nishtha Thakur

Nishtha Thakur

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

69 Views

The $gt is for greater than, wherein select those documents where the value of the field is greater than the specified value. Let us first create a collection with documents −> db.performQueryDemo.insertOne({"PlayerDetails":{"PlayerScore":1000, "PlayerLevel":2}, "PlayerName":"Chris"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd7eba41a844af18acdffa9") } > db.performQueryDemo.insertOne({"PlayerDetails":{"PlayerScore":0, "PlayerLevel":1}, "PlayerName":"Robert"}); {   ... Read More

How to get notified when a notification is notified?

Nishtha Thakur

Nishtha Thakur

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

45 Views

This example demonstrate about How to get notified when a notification is notifiedStep 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 res/layout/activity_main.xml.     Step ... Read More

Find the MongoDB document from sub array?

Nishtha Thakur

Nishtha Thakur

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

358 Views

You can use dot(.) notation to find the document from sub array. Let us first create a collection with documents −> db.findDocumentDemo.insertOne( ...    { ...       "EmployeeDetails" : ...       { ...          "EmployeeAppraisalTime": ... ...          [ ... ... Read More

How to add a title to JTable in Java Swing?

Nishtha Thakur

Nishtha Thakur

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

1K+ Views

To display a title to the JTable, you can set a title for the JPanel, which already consists of a JTable.Here, we are using createTitledBorder() for the JPanel to set the title for the panel border that would eventually work for table title.Let’s say the following is the JPanel −JPanel ... Read More

MongoDB regex to display records whose first five letters are uppercase?

Nishtha Thakur

Nishtha Thakur

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

805 Views

Let us first create a collection with documents −> db.upperCaseFiveLetterDemo.insertOne({"StudentFullName":"JOHN Smith"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd7edef1a844af18acdffb2") } > db.upperCaseFiveLetterDemo.insertOne({"StudentFullName":"SAM Williams"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd7ee011a844af18acdffb3") } > db.upperCaseFiveLetterDemo.insertOne({"StudentFullName":"CAROL Taylor"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd7ee101a844af18acdffb4") } > db.upperCaseFiveLetterDemo.insertOne({"StudentFullName":"Bob Taylor"}); ... Read More

Java Program to set the content of the JLabel to be right-justified and bottom-aligned

Nishtha Thakur

Nishtha Thakur

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

91 Views

To set the text of the label component to be right-justified and bottom-aligned, you need to set the alignment. Set the label to be on the right and bottom aligned −JLabel label = new JLabel("Total Runs", JLabel.RIGHT); label.setVerticalAlignment(JLabel.BOTTOM);Here, we have set the size of the label as well as the ... Read More

How to hide the track on the slider in Java?

Nishtha Thakur

Nishtha Thakur

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

180 Views

To hide the track on the slider, you need to use the setPaintTrack() method and set it to FALSE −JSlider slider = new JSlider(JSlider.HORIZONTAL, 0, 100, 55); slider.setInverted(true); slider.setMinorTickSpacing(10); slider.setMajorTickSpacing(25); slider.setPaintTicks(true); slider.setPaintLabels(true); slider.setPaintTrack(false);The above method setPaintTrack() is by default set to TRUE.The following is an example to hide the track ... Read More

Retrieve values from nested JSON array in MongoDB?

Nishtha Thakur

Nishtha Thakur

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

1K+ Views

To retrieve values from nested JSON array, you can use the below syntax −db.yourCollectionName.find({"yourOuterFieldName.yourInnerFieldName.yourNextInnerFieldName…...N": "yourValue"}).pretty();Let us first create a collection with documents −> db.nestedJSONArrayDemo.insertOne({ ...    "ClientDetails" : ...    { ...       "ClientPersonalDetails" : [ ...          { "CountryName" : "US" }, ...   ... Read More

How to arrange components in a Flow to be right-justified in Java?

Nishtha Thakur

Nishtha Thakur

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

89 Views

Use FlowLayout.RIGHT to arrange components in a FlowLayout to be right-justified. −JFrame frame = new JFrame("Language"); frame.setLayout(new FlowLayout(FlowLayout.RIGHT));The following is an example to arrange components in a flow to be right-justified −Examplepackage my; import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Font; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextArea; import javax.swing.WindowConstants; public ... Read More

How to style an Android notification using InboxStyle?

Nishtha Thakur

Nishtha Thakur

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

85 Views

This example demonstrate about How to style an Android notification using InboxStyleStep 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 res/layout/activity_main.xml.     Step 3 ... Read More

Advertisements