George John has Published 1081 Articles

Display the last two values from field with MongoDB

George John

George John

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

96 Views

Let us first create a collection with documents −> db.numberOfValuesDemo.insertOne({"Values":[100, 200, 300, 900, 1000, 98]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cefb736ef71edecf6a1f6ab") }Display all documents from a collection with the help of find() method −> db.numberOfValuesDemo.find().pretty();Output{    "_id" : ObjectId("5cefb736ef71edecf6a1f6ab"),    "Values" : [       100, ... Read More

How to enable multiple selections in a JFileChooser Dialog with Java?

George John

George John

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

153 Views

To enable multiple selections in a JFileChooser dialog, use the setMultiSelectionEnabled() to be TRUE −JFileChooser file = new JFileChooser(); file.setMultiSelectionEnabled(true);The following is an example to enable multiple selections in a JFileChooser Dialog −Examplepackage my; import javax.swing.JFileChooser; public class SwingDemo {    public static void main(String[] args) {       ... Read More

MongoDB query to search for Month and Day only?

George John

George John

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

541 Views

To search for month and day only, use the aggregate framework.Let us first create a collection with documents −> db.monthAndDayDemo.insertOne({"LoginDate":new ISODate("2019-04-27")}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cefbcaeef71edecf6a1f6b2") } > db.monthAndDayDemo.insertOne({"LoginDate":new ISODate("2018-04-30")}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cefbcb7ef71edecf6a1f6b3") } > db.monthAndDayDemo.insertOne({"LoginDate":new ISODate("2018-04-27")}); {    "acknowledged" ... Read More

How to create a LineBorder with BorderFactory class in Java?

George John

George John

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

340 Views

To create line border, use the createLineBorder() method. Let us first create a label component −JLabel label; label = new JLabel("Demo label");Now, create line border with BorderFactory class. Here, we have also set the color for the line border −label.setBorder(BorderFactory.createLineBorder(Color.yellow));The following is an example to create a LineBorder with BorderFactory ... Read More

Working with Images in Python?

George John

George John

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

3K+ Views

One of the most popular and considered as default library of python for image processing is Pillow. Pillow is an updated version of the Python Image Library or PIL and supports a range of simple and advanced image manipulation functionality. It is also the basis for simple image support in ... Read More

Update key value where another key equals some value in MongoDB?

George John

George John

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

229 Views

Use $elemMatch fir this with $setLet us first create a collection with documents −> dbkeyValueDemoinsertOne(    {       "_id" : new ObjectId(),       "CustomerDetails" : [          {             "Name" : "Chris",             ... Read More

HTML