HTML DOM Input Checkbox required Property

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

293 Views

The Input Checkbox required property determines whether Input Checkbox is compulsory to check or not.SyntaxFollowing is the syntax −Returning boolean value - true/falseinputCheckboxObject.requiredSetting required to booleanValueinputCheckboxObject.required = booleanValueBoolean ValuesHere, “booleanValue” can be the following −booleanValueDetailstrueIt defines that it is compulsory to check the checkbox to submit form.falseIt is the default value and checking is not compulsory.ExampleLet us see an example of Input Checkbox required property − Live Demo Required Attribute of Checkbox Check me ! I am required: Check if form is submittable    function getRequiredStatus(){       var requiredBool ... Read More

C Program for Basic Euclidean algorithms?

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

167 Views

Here we will see the Euclidean algorithm to find the GCD of two numbers. The GCD (Greatest Common Divisor) can easily be found using Euclidean algorithm. There are two different approach. One is iterative, another one is recursive. Here we are going to use the recursive Euclidean algorithm.AlgorithmEuclideanAlgorithm(a, b)begin    if a is 0, then       return b    end if    return gcd(b mod a, a) endExample Live Demo#include using namespace std; int euclideanAlgorithm(int a, int b) {    if (a == 0)       return b;    return euclideanAlgorithm(b%a, a); } main() {    int a, b;    cout > a >> b;    cout

How to sort array of strings by their lengths following shortest to longest pattern in Java

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

558 Views

At first, let us create and array of strings:String[] strArr = { "ABCD", "AB", "ABCDEFG", "ABC", "A", "ABCDE", "ABCDEF", "ABCDEFGHIJ" };Now, for shortest to longest pattern, for example A, AB, ABC, ABCD, etc.; get the length of both the string arrays and work them like this:Arrays.sort(strArr, (str1, str2) -> str1.length() - str2.length());The following is an example to sort array of strings by their lengths with shortest to longest pattern:Exampleimport java.util.Arrays; public class Demo {    public static void main(String[] args) {       String[] strArr = { "ABCD", "AB", "ABCDEFG", "ABC", "A", "ABCDE", "ABCDEF", "ABCDEFGHIJ" };       ... Read More

What is a Nonce in Block Chain?

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

4K+ Views

Cryptocurrency like Bitcoin uses the Block chain as a decentralized, distributed, public digital ledger that records all the transactions of the Bitcoin. Block Chain has a unique feature of storing the value of previous block as a hash value in the current block, which makes it impossible to alter any block without changing all the subsequent blocks.The miners create a block and verify it and will be rewarded for using their CPU power to do so. The block which gets more than 50% consensus will be added to the block chain. During the verification of Block, the miners will complete ... Read More

The DatabaseMetaData getResultSetHoldability() method with example

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

66 Views

ResultSet holdability determines whether the ResultSet objects (cursors) should be closed or held open when a transaction (that contains the said cursor/ResultSet object) is committed using the commit() method of the Connection interface.The getResultSetHoldability() method of the DatabaseMetaData interface retrieves the default holdability for the ResultSet objects of the underlying database.This method returns an integer value representing the default ResultSet holdability, which will be either 1 or 2 where, 1 indicates the value HOLD_CURSORS_OVER_COMMIT. If the holdability of the ResultSet object is set to this value. Whenever you commit/save a transaction using the commit() method of the Connection interface, the ResultSet ... Read More

Find objects created in last week in MongoDB?

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

336 Views

You can use Date() along with $gte operator to find objects created last week. Here the curdate is as follows in my system −> new Date(); ISODate("2019-05-14T08:32:42.773Z")Let us first create a collection with documents −> db.findObectInLastWeekDemo.insertOne({"ShippingDate":new ISODate("2019-05-01")}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cda7dc4bf3115999ed511e0") } > db.findObectInLastWeekDemo.insertOne({"ShippingDate":new ISODate("2019-05-02")}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cda7dc4bf3115999ed511e1") } > db.findObectInLastWeekDemo.insertOne({"ShippingDate":new ISODate("2019-05-08")}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cda7dc4bf3115999ed511e2") } > db.findObectInLastWeekDemo.insertOne({"ShippingDate":new ISODate("2019-05-07")}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cda7dc4bf3115999ed511e3") } > db.findObectInLastWeekDemo.insertOne({"ShippingDate":new ISODate("2019-05-09")}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cda7dc4bf3115999ed511e4") } > ... Read More

Java Program to append a row to a JTable in Java Swing

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

575 Views

To append a row, you can use the addRow() method. Ley us first create a table wherein we need to append a row −DefaultTableModel tableModel = new DefaultTableModel(); JTable table = new JTable(tableModel);Add some columns to the table −tableModel.addColumn("Language/ Technology"); tableModel.addColumn("Difficulty Level");Add some rows −tableModel.insertRow(0, new Object[] { "CSS", "Easy" }); tableModel.insertRow(0, new Object[] { "HTML5", "Easy"}); tableModel.insertRow(0, new Object[] { "JavaScript", "Intermediate" }); tableModel.insertRow(0, new Object[] { "jQuery", "Intermediate" }); tableModel.insertRow(0, new Object[] { "AngularJS", "Difficult"});Now, if you need to append a row to the table we created above, use the addrow() method −tableModel.addRow(new Object[] { "WordPress", "Easy" });The ... Read More

Display multiple lines of text in a component’s tooltip with Java

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

483 Views

Let’s first see how we set text in a components tooltip −JLabel label3 = new JLabel("Password", SwingConstants.CENTER); label3.setToolTipText("Enter Password");To display multiple lines of text in a tooltip, use . Here, we have used the HTML tag for new line and that would create multiple lines of text in the tooltip −label3.setToolTipText("" + "This will create multiple lines for the" + "" + "component! Yay!" + "");The following is an example to display multiple lines of text in a component’s tooltip −Examplepackage my; import java.awt.GraphicsEnvironment; import java.awt.GridLayout; import java.awt.Point; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPasswordField; import javax.swing.JTextField; import javax.swing.SwingConstants; import ... Read More

MySQL query to fetch date with year and month?

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

254 Views

For year and month date fetching, you can use YEAR() and MONTH() function in MySQL. Let us first create a table −mysql> create table DemoTable    (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    ShippingDate datetime    ); Query OK, 0 rows affected (0.48 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(ShippingDate) values('2019-01-31'); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable(ShippingDate) values('2018-12-01'); Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable(ShippingDate) values('2019-06-02'); Query OK, 1 row affected (0.22 sec) mysql> insert into DemoTable(ShippingDate) values('2019-11-18'); Query OK, 1 row ... Read More

C++ Program to Create the Prufer Code for a Tree

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

658 Views

Prufer code uniquely identifies a tree which is given by user as a graph representation with labels from 1 to p. This tree consist p(value is given by user) labels of node. It has sequence of p – 2 values.AlgorithmBegin    Declare i, j, ver, edg, minimum, p to the integer datatype.    Print “Enter the number of vertexes: ”.    Enter the value of ver.    Initialize edg = ver-1.    Declare EDG[edg][2], DG[ver+1] to the integer datatype.       Initialize DG[ver+1] = {0}.    Print “This tree has (value of edg) edges for (value of ver) vertexes”. ... Read More

Advertisements