HTML DOM Input Checkbox Disabled Property

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

1K+ Views

The HTML DOM Input Checkbox disabled property sets/returns whether Input Checkbox is to be enabled or disabled.SyntaxFollowing is the syntax −Returning boolean value − true/falseinputCheckboxObject.disabledSetting disabled to booleanValueinputCheckboxObject.disabled = booleanValueBoolean ValuesHere, “booleanValue” can be the following −booleanValueDetailstrueIt defines that the checkbox is disabled.falseIt defines that the checkbox is not disabled and it is also the default value.ExampleLet us see an example of Input Checkbox disabled property − Live Demo Student Details Biology: Mathematics: Physics: Psychology: Enable Subjects    function enableCheckboxes(){       var enableCheckboxes ... Read More

HTML DOM Input FileUpload Accept Property

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

120 Views

The HTML DOM Input FileUpload accept property returns a string, which is the value of the accept attribute of FileUpload. User can also set it to a new value.SyntaxFollowing is the syntax −Returning string valueinputFileUploadObject.acceptSetting value attribute to a string valueinputFileUploadObject.accept = valueExampleLet us see an example of Input FileUpload accept property − Live Demo Input FileUpload accept      form {       width:70%;       margin: 0 auto;       text-align: center;    }    * {       padding: 2px;       margin:5px;    }    input[type="button"]{       ... Read More

Sort a List with Lambda in Java

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

814 Views

Yes, we can sort a list with Lambda. Let us first create a String List:List list = Arrays.asList("LCD", "Laptop", "Mobile", "Device", "LED", "Tablet");Now, sort using Lambda, wherein we will be using compareTo():Collections.sort(list, (String str1, String str2) -> str2.compareTo(str1));The following is an example to sort a list with Lambda in Java:Exampleimport java.util.Arrays; import java.util.Collections; import java.util.List; public class Demo {    public static void main(String... args) {         List list = Arrays.asList("LCD", "Laptop", "Mobile", "Device", "LED", "Tablet");       System.out.println("List = "+list);       Collections.sort(list, (String str1, String str2) -> str2.compareTo(str1));       System.out.println("Sorted List ... Read More

Terminate a Thread in C++11

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

7K+ Views

Here we will see, how to terminate the threads in C++11. The C++11 does not have direct method to terminate the threads.The std::future can be used to the thread, and it should exit when value in future is available. If we want to send a signal to the thread, but does not send the actual value, we can pass void type object.To create one promise object, we have to follow this syntax −std::promise exitSignal;Now fetch the associated future object from this created promise object in main function −std::future futureObj = exitSignal.get_future();Now pass the main function while creating the thread, pass ... Read More

Java Connection getSystemFunctions Method with Example

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

151 Views

This method retrieves the list of System functions supported by the current database. The names returned by this method are the Open CLI System function names.This method returns a String value holding the list of functions separated by commas (", ").To get the list of the System functions supported by the underlying database −Make sure your database is up and running.Register the driver using the registerDriver() method of the DriverManager class. Pass an object of the driver class corresponding to the underlying database.Get the connection object using the getConnection() method of the DriverManager class. Pass the URL the database and, user ... Read More

Selecting Database Inside JS in MongoDB

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

135 Views

You can use getSiblingDB() from MongoDB for this using var keyword from JS −anyVariableName= db.getSiblingDB(‘yourDatabaseName’);Let us implement the above syntax in order to select database −> selectedDatabase = db.getSiblingDB('sample');This will produce the following output −SampleNow, insert some documents. Let’s say the collection is ‘selectDatabaseDemo’ −> db.selectDatabaseDemo.insertOne({"ClientName":"John Smith", "ClientAge":23}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cda794b5667f1cce01d55ad") } > db.selectDatabaseDemo.insertOne({"ClientName":"Carol Taylor", "ClientAge":24}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cda79565667f1cce01d55ae") }Display all documents from a collection with the help of find() method −db.selectDatabaseDemo.find().pretty();This will produce the following output −{    "_id" : ObjectId("5cda794b5667f1cce01d55ad"),    "ClientName" : "John Smith",   ... Read More

Create Default Cell Editor Using JCheckBox in Java

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

339 Views

Create a check box first and set valueJCheckBox checkBox = new JCheckBox("In-Stock");Set the JCheckBox for the editor so that the editor uses the check box −TreeCellEditor editor = new DefaultCellEditor(comboBox); tree.setEditable(true); tree.setCellEditor(editor);The following is an example to create a Default Cell Editor that uses a JCheckBox −Examplepackage my; import javax.swing.DefaultCellEditor; import javax.swing.JCheckBox; import javax.swing.JFrame; import javax.swing.JTree; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.TreeCellEditor; public class SwingDemo {    public static void main(String[] args) throws Exception {       JFrame frame = new JFrame("Demo");       DefaultMutableTreeNode node = new DefaultMutableTreeNode("Products");       DefaultMutableTreeNode node1 = new DefaultMutableTreeNode("Clothing");       ... Read More

Create Confirmation Dialog Box in Java

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

4K+ Views

To create a confirmation dialog box in Java, use the Java Swing JOptionPane.showConfirmDialog() method, which allows you to create a dialog box that asks for confirmation from the user. For example, Do you want to restart the system?, “This file contains a virus, Do you want to still download?”, etc. Kt comes with a type JOptionPane.YES_NO_CANCEL_OPTION for the same confirmation.The following is an example to create a Confirmation Dialog Box in Java −Examplepackage my; import java.awt.Dimension; import javax.swing.ImageIcon; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.SwingConstants; import javax.swing.UIManager; public class SwingDemo {    public static void main(String[] args) {   ... Read More

MySQL Query to Get Current Datetime and Only Current Date

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

420 Views

The query SELECT NOW() gives the current date as well as current time. If you want only current date, use only CURDATE(). Following is the syntax for datetime −SELECT NOW();The syntax for only date.SELECT CURDATE();Let us now implement the above syntax −Case 1 : If you want both current date and time −mysql> SELECT NOW();Output+-----------------------+ | NOW() | +-----------------------+ | 2019-06-02 15 :30 :39 | +-----------------------+ 1 row in set (0.00 sec)Case 2 : If you want the current date only −mysql> SELECT CURDATE();Output+------------+ | CURDATE() | +------------+ | 2019-06-02 | +------------+ 1 row in set (0.00 sec)

Find Maximum Subarray Sum Using Binary Search in C++

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

338 Views

Binary search is a fast search algorithm with run-time complexity of Ο(log n). This search algorithm works on the principle of divide and conquer. For this algorithm to work properly, the data collection should be in the sorted form.Binary search looks for a particular item by comparing the middle most item of the collection. If a match occurs, then the index of item is returned. If the middle item is greater than the item, then the item is searched in the sub-array to the left of the middle item. Otherwise, the item is searched for in the sub-array to the ... Read More

Advertisements