HTML DOM selectRemove Method

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

131 Views

The HTML DOM select remove() method removes a new option from a drop-down list in an HTML document.SyntaxFollowing is the syntax −object.remove(index)Here, index represents the index of the option which is to be removed from the drop-down list.ExampleLet us see an example of HTML DOM select remove() method − Live Demo    html{       height:100%;    }    body{       text-align:center;       color:#fff;       background: radial-gradient( circle farthest-corner at 23.1% 64.6%, rgba(129, 125, 254, 1) 0%, rgba(111, 167, 254, 1) 90% ) no-repeat;       height:100%;    }   ... Read More

Generic Keyword in C

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

353 Views

As we know that the Macros are used in C or C++, but there is no facility for type checking. The macros can take any type of argument in it. The following example will show this case clearly.Example Live Demo#include #define INCREMENT(X) ++X main() {    int x = 5; float y = 2.56; char z = 'A';    printf("Integer Increment: %d", INCREMENT(x));    printf("Float Increment: %f", INCREMENT(y));    printf("Character Increment: %c", INCREMENT(z)); }OutputInteger Increment: 6 Float Increment: 3.560000 Character Increment: BThat is the problem of macro. In the later version of C, we can use macro by using ‘_Generic’ keyword. ... Read More

Count Objects Using Static Member Function in C++

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

7K+ Views

Here we will see how to count number of objects are created from a specific class using some static member functions. The static members are class properties, not the object properties. For a single class there will be only one instance for static members. No new members are created for each objects.In this problem we are using one static counter variable to keep track the number of objects, then static member will be there to display the count value.When a new object is created, so the constructor will be called. Inside the constructor, the count value is increased. Thus we ... Read More

Compiling Multiple C++ Files in C++ Program

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

2K+ Views

Here we will see how to compile multiple cpp file in C++ program. The task is very simple. We can provide the names as a list to the g++ compiler to compile them into one executable fileTo compile multiple files like abc.cpp, and xyz.cpp at once, the syntax will be like this −g++ abc.cpp xyz.cppTo run the program, we can use this −./a.outExamplefloat area(float r){    return (3.1415*r*r); //area of a circle } float area(float l, float w) {    return (l * w); //area of a rectangle }Example#include #include "area.cpp" using namespace std; main() {    cout Read More

Get Table Name from Current ResultSet Using JDBC

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

3K+ Views

You can get the name of the table in the current ResultSet object using the getTableName() method of the ResultSetMetaData interface. This method accepts an integer value representing the index of a column and, returns a String value representing the name of the table that contains the given column.Let us create a table with name MyPlayers in MySQL database using CREATE statement as shown below −CREATE TABLE MyPlayers(    ID INT,    First_Name VARCHAR(255),    Last_Name VARCHAR(255),    Date_Of_Birth date,    Place_Of_Birth VARCHAR(255),    Country VARCHAR(255),    PRIMARY KEY (ID) );Now, we will insert 7 records in MyPlayers table using INSERT statements −insert into ... Read More

Get Number of Rows and Columns of JTable in Java Swing

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

2K+ Views

To count the number of rows of a table, use the getRowCount() method −table.getRowCount()To count the number of columns of a table, use the getColumnCount() method −table.getColumnCount()The following is an example to get the number of rows and columns of a JTable −Examplepackage my; import java.awt.Font; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.table.DefaultTableModel; public class SwingDemo {    public static void main(String[] argv) throws Exception {       DefaultTableModel tableModel = new DefaultTableModel();       JTable table = new JTable(tableModel);       tableModel.addColumn("Language/ Technology");       tableModel.addColumn("Text Tutorial");       tableModel.addColumn("Video Tutorial");     ... Read More

Expand JTree Row to Display All Nodes in Java

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

978 Views

To expand JTree row to display all the nodes and child nodes, use the expandRow() method in Java. At first, create a node −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 more nodes and set them as child nodes for the nodes we creted above −DefaultMutableTreeNode one = new DefaultMutableTreeNode("Learning website"); DefaultMutableTreeNode two = new DefaultMutableTreeNode("Business website"); DefaultMutableTreeNode three = new DefaultMutableTreeNode("News publishing website"); DefaultMutableTreeNode four = new DefaultMutableTreeNode("Android app"); DefaultMutableTreeNode five = new DefaultMutableTreeNode("iOS app"); DefaultMutableTreeNode ... Read More

MongoDB Query to Find a Value from JSON-like Data

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

5K+ Views

To fund a value from JSON data, use the find() along with dot(.) notation. Let us first create a collection with documents −> db.findValueFromJsonDemo.insertOne(    {       "UserDetails": [{          "_id": new ObjectId(),          "UserName": "Carol",          "UserMessage": "Hi"       }],       "UserFriendsName": ["John", "Sam"]    } ); {    "acknowledged" : true,    "insertedId" : ObjectId("5cdf8a4cbf3115999ed511fd") }Following is the query to display all documents from a collection with the help of find() method −> db.findValueFromJsonDemo.find().pretty();This will produce the following output −{    "_id" : ... Read More

Select Column Names Containing a String in MySQL

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

1K+ Views

For this, you can use SHOW COLUMNS command. Following is the syntax. Here, we have set the string using LIKE −SHOW COLUMNS FROM yourTableName LIKE ‘yourStringValue’;Let us first create a table −mysql> create table DemoTable    -> (    -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> FirstName varchar(20),    -> LastName varchar(20)    -> ); Query OK, 0 rows affected (0.69 sec)Here is the query to select column names containing a specific string −mysql> SHOW COLUMNS FROM DemoTable LIKE 'FirstName';Output+-----------+-------------+------+-----+----------+-------+ | Field   | Type | Null | ... Read More

HTML DOM Option Object

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

233 Views

The HTML DOM option Object represent the element of an HTML document.Let us now see how to create option object −SyntaxFollowing is the syntax −document.createElement(“OPTION”);PropertiesFollowing are the properties of option Object −PropertyExplanationdisabledIt returns and modify whether the option element is disabled or not.defaultSelectedIt returns the default value of option element in an HTML document.formIt returns the reference of the form that contain the option element in HTML document.indexIt returns and modify the index position of an option in the HTML document.labelIt returns and alter the value of the label attribute of an option in an HTML document.selectedIt returns and ... Read More

Advertisements