Ankith Reddy has Published 1070 Articles

Line detection in python with OpenCV?

Ankith Reddy

Ankith Reddy

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

3K+ Views

In this post, we are going to learn, how to detect lines in an image, with the help of a technique called Hough transform.Hough transform?Hough transform is a feature extraction method to detect any simple shape, if you can represent that shape in mathematical form. It somehow manage to detect ... Read More

Limit number of values in a field using MongoDB?

Ankith Reddy

Ankith Reddy

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

238 Views

To limit number of values in a field, use $slice operator.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" ... Read More

HTML rel Attribute

Ankith Reddy

Ankith Reddy

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

126 Views

The rel attribute of the element is used to set the relationship between the current document and the linked document. This attribute introduced in HTML5 for the element. Following is the syntax −Above, value can be any of the following options that links to −alternate: An alternate version of ... Read More

MongoDB query to select one field if the other is null and the first field if both are not null?

Ankith Reddy

Ankith Reddy

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

379 Views

For this, use $ifNull operatorLet us first create a collection with documents −> dbquerySelectDemoinsertOne({"Value1":10, "Value2":null}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cefc0ceef71edecf6a1f6b6") } > dbquerySelectDemoinsertOne({"Value1":null, "Value2":30}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cefc0d7ef71edecf6a1f6b7") } > dbquerySelectDemoinsertOne({"Value1":60, "Value2":40}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cefc0e2ef71edecf6a1f6b8") ... Read More

Check whether a node is a root node or not in JTree

Ankith Reddy

Ankith Reddy

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

209 Views

To check whether a node is a root node or not, use the isRoot() method. This returns a boolean value. TRUE if the node is a root node, else FALSE is returned. For example, TRUE is returned since the following node is a root node −node.isRoot()Another example, FALSE is returned ... Read More

How to add Internal Frame to a JDesktopPane in Java?

Ankith Reddy

Ankith Reddy

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

522 Views

At first, create a JDesktoPane −JDesktopPane desktopPane = new JDesktopPane();Now, create an Internal frame and add it to the JDesktopPane −JInternalFrame intFrame = new JInternalFrame("Our Frame", true, true, true, true); desktopPane.add(intFrame); The following is an example to add Internal Frame to a JDesktopPane − package my; import java.awt.BorderLayout; import javax.swing.JButton; ... Read More

HTML

Ankith Reddy

Ankith Reddy

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

334 Views

The name attribute of the element is used to set the name for a button. More than one button can have the same name, but we can submit different values from these buttons using the name attribute.Following is the syntax −Above, btn_name is the name of the button. Let ... Read More

Specify return format in MongoDB to return the values as an array?

Ankith Reddy

Ankith Reddy

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

162 Views

Use aggregation for this and add the values to an array using the $group and $addToSet operatorLet us first create a collection with documents −> dbspecifyReturnFormatDemoinsertOne({"Subject":"MongoDB"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cefd364ef71edecf6a1f6c0") } > dbspecifyReturnFormatDemoinsertOne({"Subject":"MySQL"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cefd369ef71edecf6a1f6c1") } > dbspecifyReturnFormatDemoinsertOne({"Subject":"SQL ... Read More

Get the number of siblings of a node in JTree with Java

Ankith Reddy

Ankith Reddy

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

138 Views

Use the getSiblingCount() method to get the number of siblings of a node in JTree. For example, let’s say we have a node, which isn’t a root node. For that, we will find the sibling count −node1.getSiblingCount()The following is an example to get the number of siblings of a node ... Read More

How to print results of script in MongoDB?

Ankith Reddy

Ankith Reddy

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

959 Views

We will use printjson() for this. Let us first create a collection with documents −> dbprintResultScriptDemoinsertOne({"StudentName":"John", "StudentAge":21}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cf22c02b64a577be5a2bc0b") } > dbprintResultScriptDemoinsertOne({"StudentName":"Carol", "StudentAge":20}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cf22c09b64a577be5a2bc0c") } > dbprintResultScriptDemoinsertOne({"StudentName":"David", "StudentAge":19}); {    "acknowledged" : true,    "insertedId" ... Read More

Advertisements