This is a C++ program to generate all possible combinations out of a, b, c, d, e.AlgorithmsBegin Take the number of elements and the elements as input. function Combi(char a[], int reqLen, int s, int currLen, bool check[], int l) to print the all possible combination of given array set: // Here, char a[] = character array reqLen = required length s = start variable currLen = current length check[] = a boolean variable l = length of array // Body of the Function: ... Read More
When we execute certain SQL queries (SELECT query in general) they return tabular data.The java.sql.ResultSet interface represents such tabular data returned by the SQL statements.i.e. the ResultSet object holds the tabular data returned by the methods that execute the statements which quires the database (executeQuery() method of the Statement interface in general).The ResultSet object has a cursor/pointer which points to the current row. Initially this cursor is positioned before first row.The wasNull() method of the ResultSet interface determines whether the last column read had a Null value. i.e. whenever you read the contents of a column of the ResultSet using the ... Read More
You can use $type operator to check whether a filed contains null value. Let us first create a collection with documents. We have also inserted a null in a field −> db.nullDemo.insertOne({"FirstName":"Chris"}); { "acknowledged" : true, "insertedId" : ObjectId("5cc68a1eac184d684e3fa270") } > db.nullDemo.insertOne({"FirstName":null}); { "acknowledged" : true, "insertedId" : ObjectId("5cc68a25ac184d684e3fa271") } > db.nullDemo.insertOne({"FirstName":"Robert"}); { "acknowledged" : true, "insertedId" : ObjectId("5cc68a2cac184d684e3fa272") }Following is the query to display all documents from a collection with the help of find() method −> db.nullDemo.find().pretty();This will produce the following output. One of the field is null −{ "_id" : ObjectId("5cc68a1eac184d684e3fa270"), "FirstName" ... Read More
Request to Send (RTS) is a control frame employed in the medium access control (MAC) layer protocol IEEE 802.11 RTS/CTS. The protocol uses the concept of Multiple Access with Collision Avoidance (MACA) in wireless networks. The RTS/CTS (Request to Send / Clear to Send) mechanism aims to reduce frame collisions introduced by the hidden terminal problem. RTS frame is sent by the transmitter prior to transmission of the actual data frame.Working Principle of MACA implementing RTSThe MACA protocol works with the condition that the communicating stations are synchronized and frame sizes and data speed are the same.Let us consider that ... Read More
Create a panel and set the layout −JPanel panel = new JPanel(); GridBagLayout layout = new GridBagLayout(); panel.setLayout(layout);Now, set the constrainst and with that the columnWeights and rowWeights −GridBagConstraints gbc = new GridBagConstraints(); JLabel label = new JLabel("Rank: "); JTextArea text = new JTextArea(); text.setText("Add rank here..."); layout.columnWeights = new double[]{0.0f, 0.0f, 2.0f}; layout.rowWeights = new double[]{0.0f, 1.0f};Now, set the constraints for the label and add it to the panel −gbc.gridx = 0; gbc.gridy = 0; layout.setConstraints(label, gbc); panel.add(label);The following is an example to set columnWeights and rowWeights in a GridBagLayout −Examplepackage my; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import javax.swing.JFrame; import ... Read More
The cite attribute of the element is used to set a URL that specified the reason to insert the text. Following is the syntax −Above, we have set url, which is the address to the document explaining the reason to insert the text. Let us now see an example to implement the cite attribute of the element −Example Live Demo Demo Heading Text is inserted. OutputIn the above example, we have inserted a text using the element − Text is inserted. Above, we have set the reason of insertion using the cite attribute −cite="new.htm
The HTML DOM iframe Object represents the element of an HTML document.Let us now create iframe object −SyntaxFollowing is the syntax −document.createElement(“IFRAME”);PropertiesFollowing are the properties of iframe Object −PropertyExplanationcontentDocumentIt returns the document object generated by an iframe HTML element.contentWindowIt returns the window object generated by an iframe HTML element.heightIt returns and modify the value of height attribute of an iframe HTML element.nameIt returns and modify the value of the name attribute of an iframe HTML element.sandboxIt returns and alter the value of sandbox attribute of an iframe HTML element.seamlessIt returns and modify whether the iframe should look seamless like ... Read More
The HTML DOM Input DatetimeLocal type property returns/sets type of Input DatetimeLocal.SyntaxFollowing is the syntax −Returning string valueinputDatetimeLocalObject.typeSetting type to string valueinputDatetimeLocalObject.type = stringValueString ValuesHere, “stringValue” can be the following −stringValueDetailsdateIt defines that input type is datedatetime-localIt defines that input type is datetime-localcheckboxIt defines that input type is checkboxtextIt defines that input type is textExampleLet us see an example of Input DatetimeLocal type property − Live Demo Input DatetimeLocal type form { width:70%; margin: 0 auto; text-align: center; } * { padding: 2px; ... Read More
This is a C++ Program to solve a matching problem for a Given Specific Case. Here, N men and N women are given, each person has ranked all members of the opposite gender in order of preference, marry the men and women together such that there are no two people of opposite gender who would both rather have each other than their current partners. All the marriages are “stable”, if there are no such people exists.AlgorithmsBegin function WomenPrefersMenOverMen1(): A) Check if women prefer men over her current engagement men1 B) If men1 comes before men in list ... Read More
The getColumnCount() method of the ResultSetMetaData (interface) retrieves the number of the columns of the current ResultSet object.This method returns an integer value representing the number of columns.To get the ResultSetMetaData object, you need to:Register the Driver: Select the required database register the Driver class of the particular database using the registerDriver() method of the DriverManager class or, the forName() method of the class named Class.DriverManager.registerDriver(new com.mysql.jdbc.Driver());Get connection: Create a connection object by passing the URL of the database, username and password of a user in the database (in string format) as parameters to the getConnection() method of the DriverManager class.Connection mysqlCon = ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP