The HTML DOM Input Color type property returns/sets type of Input Color.SyntaxFollowing is the syntax −Returning string valueinputColorObject.typeSetting type to string valueinputColorObject.type = stringValueString ValuesHere, “stringValue” can be the following −stringValueDetailsColorIt defines that input type is colorRadioIt defines that input type is radioTextIt defines that input type is textExampleLet us see an example of Input Color type property − Live Demo Input Color Type Color Picker: Get type & change to text var inputColor = document.getElementById("Color"); var divDisplay = document.getElementById("divDisplay"); divDisplay.textContent = 'Type of Input: '+inputColor.type; function changeNameValue() { ... Read More
The HTML DOM Input Time min property returns/sets min attribute of Input Time.SyntaxFollowing is the syntax −Returning string valueinputTimeObject.minSetting max to string valueinputTimeObject.min = hh:mm:ss.msString ValuesHere, “hh:mm:ss.ms” can be the following −stringValueDetailshhIt defines hour (eg:18)mmIt defines minutes (eg:59)ssIt defines seconds (eg:00)msIt defines milli-seconds (eg:700)ExampleLet us see an example of Input Time min property − Input Time min form { width:70%; margin: 0 auto; text-align: center; } * { padding: 2px; margin:5px; } input[type="button"] { ... Read More
The pthread_equal() function is used to check whether two threads are equal or not. This returns 0 or non-zero value. For equal threads, it will return non-zero, otherwise it returns 0. The syntax of this function is like below −int pthread_equal (pthread_t th1, pthread_t th2);Now let us see the pthread_equal() in action. In the first case, we will check the self-thread to check the result.Example#include #include #include #include #include pthread_t sample_thread; void* my_thread_function(void* p) { if (pthread_equal(sample_thread, pthread_self())) { //pthread_self will return current thread id printf("Threads are equal"); } else ... Read More
ResultSet objectCertain SQL queries (especially SELECT) returns tabular data, In JDBC the object of the java.sql.ResultSet interface holds the tabular data returned by the methods that execute the statements which quires the database (executeQuery() method of the Statement interface in general).ResultSet Cursor/pointerThe ResultSet object has a cursor/pointer which points to the current row. Initially this cursor is positioned before first row.There are two types of result sets namely, forward only and, bidirectional. By default the ResultSet we get by the executeQuery() method is of the type forward only. Using this you can traverse/move the cursor only forward direction.Bidirectional ResultSetA bi-directional ResultSet ... Read More
You can use $group operator along with aggregate framework to perform distinct on multiple fields. Let us first create a collection with documents −> db.distinctOnMultipleFieldsDemo.insertOne( ... { ... "StudentFirstName" : "Chris", ... "StudentAge" : 21, ... "StudentCountryName": "US" ... } ... ); { "acknowledged" : true, "insertedId" : ObjectId("5cd2e518b64f4b851c3a13d7") } > db.distinctOnMultipleFieldsDemo.insertOne( ... { ... "StudentFirstName" : "Robert", ... "StudentAge" : 21, ... "StudentCountryName": "AUS" ... } ... ); { "acknowledged" : true, "insertedId" ... Read More
Yes, we can enable drag and drop between two text fields in Java. Let us first create two JTextFields and set content in it as shown below −JTextField one = new JTextField(20); one.setText("You can drag!"); JTextField two = new JTextField(20); two.setText("Drag here or there");Now, we will enable and drag and drop for both the components created above −one.setDragEnabled(true); two.setDragEnabled(true);The following is an example to enable drag and drop between two text fields −Examplepackage my; import java.awt.Container; import java.awt.FlowLayout; import javax.swing.BoxLayout; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextField; import javax.swing.SwingConstants; public class SwingDemo { public static void main(String[] args) throws Exception ... Read More
To store MongoDB result in an array, use the toArray() method −var anyVariableName=db.yourCollectionName.find().toArray();Let us first create a collection with documents −> db.mongoDbResultInArrayDemo.insertOne({"CustomerName":"David Miller", "CustomerAge":24, "isMarried":false}); { "acknowledged" : true, "insertedId" : ObjectId("5cd99bd5b50a6c6dd317ad92") } > db.mongoDbResultInArrayDemo.insertOne({"CustomerName":"Sam Williams", "CustomerAge":46, "isMarried":true}); { "acknowledged" : true, "insertedId" : ObjectId("5cd99beab50a6c6dd317ad93") } > db.mongoDbResultInArrayDemo.insertOne({"CustomerName":"Carol Taylor", "CustomerAge":23, "isMarried":false}); { "acknowledged" : true, "insertedId" : ObjectId("5cd99bf9b50a6c6dd317ad94") }Following is the query to display all documents from a collection with the help of find() method −> db.mongoDbResultInArrayDemo.find().pretty();This will produce the following output −{ "_id" : ObjectId("5cd99bd5b50a6c6dd317ad92"), "CustomerName" : "David Miller", "CustomerAge" ... Read More
The HTML DOM Input Color value property returns a string, which represents the value of the input color value attribute. User can also set it to a new string.SyntaxFollowing is the syntax −Returning string valueinputColorObject.valueSetting value attribute to a string valueinputColorObject.value = ‘String’ExampleLet us see an example of Input Color value property − Live Demo Input Color Value Primary-Color: Get type & change to text var inputColor = document.getElementById("Color"); var divDisplay = document.getElementById("divDisplay"); divDisplay.textContent = 'value: '+inputColor.value; function changeValue() { if(inputColor.value == '#00ff00'){ ... Read More
The HTML DOM Input Time name property returns a string, which displays the value of the name attribute of input Time. User can also set it to a new string.SyntaxFollowing is the syntax −Returning string valueinputTimeObject.nameSetting name attribute to a string valueinputTimeObject.name = ‘String’ExampleLet us see an example of Input Time name property − Live Demo Input Time name form { width:70%; margin: 0 auto; text-align: center; } * { padding: 2px; margin:5px; } input[type="button"] { ... Read More
Here we will see what will be the effect of pthread_self() in C. The pthread_self() function is used to get the ID of the current thread. This function can uniquely identify the existing threads. But if there are multiple threads, and one thread is completed, then that id can be reused. So for all running threads, the ids are unique.Example#include #include #include void* func(void* p) { printf("From the function, the thread id = %d", pthread_self()); //get current thread id pthread_exit(NULL); return NULL; } main() { pthread_t thread; // declare thread ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP