The HTML DOM Input Checkbox autofocus property returns and modify the value of autofocus attribute of an input HTML element with type=”checkbox”.SyntaxFollowing is the syntax −1. Returning autofocusobject.autofocus2. Modifying autofocusobject.autofocus = true|falseExampleLet us see an example of autofocus property − Live Demo
The HTML DOM Input DatetimeLocal stepUp() method defines the number of minutes the datetimeLocal field should increase.SyntaxFollowing is the syntax −Calling stepUp method with a number, which by default is equal to 1inputDatetimeLocalObject.stepUp(number)ExampleLet us see an example of Input DatetimeLocal stepUp method − Live Demo Input DatetimeLocal stepUp() form { width:70%; margin: 0 auto; text-align: center; } * { padding: 2px; margin:5px; } input[type="button"] { border-radius: 10px; } Datetime-Local-stepUp( ... Read More
The HTML DOM KeyboardEvent Object represents an event when user presses a key on keyboard.PropertiesHere, “KeyboardEvent” can have the following properties and methods −Property/MethodDescriptionaltKeyIt returns whether the "ALT" key was pressed or notcharCodeIt returns the Unicode character code of the keycodeIt returns the code of the keyctrlKeyIt returns whether the "CTRL" key was pressed or notgetModifierState()It returns true if the specified key is activated and false if inactiveisComposingIt returns whether the state of the event is composing or notkeyIt returns the key value of the key represented by the eventkeyCodeIt returns the Unicode character code of the key that triggered ... Read More
This is a C++ program to generate all possible subsets with exactly k elements in each subset.AlgorithmsBegin function PossibleSubSet(char a[], int reqLen, int s, int currLen, bool check[], int l): If currLen > reqLen Return Else if currLen = reqLen Then print the new generated sequence. If s = l Then return no further element is left. For every index there are two options: either proceed with a start as ‘true’ and recursively call PossibleSubSet() with incremented value ... 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 relative() method of the ResultSet interface moves the ResultSet pointer/cursor n number of rows from the current position.This method returns an integer value representing the current row number to which the ResultSet pointer ... Read More
Let us first create a collection with a document −>db.useResultDemo.insertOne({"StudentFirstName":"Robert"}); { "acknowledged" : true, "insertedId" : ObjectId("5cda70f5b50a6c6dd317adcd") }Display all documents from a collection with the help of find() method −> db.useResultDemo.find();Following is the output −{ "_id" : ObjectId("5cda70f5b50a6c6dd317adcd"), "StudentFirstName" : "Robert" }Here is the query to use result from MongoDB in shell script with var keyword −> var studentName=db.useResultDemo.findOne({},{_id:0}); > studentNameFollowing is the output −{ "StudentFirstName" : "Robert" }
Enum type can have a private constructor that can be used to initialize instance fields. The EnumDemo class demonstrates this. It features a Food enum type with four constants: HAMBURGER, FRIES, HOTDOG, and ARTICHOKE. Notice that after each constant value is present in parentheses. This calls the constructor for that member to initialize the price field for that member. We iterate over the Food values in the for loop in the main() method. In this method, we first display the name of the food constant. Next, we examine the price for that food item and display whether the price is expensive or ... Read More
The hreflang attribute of the element is used to set the language of the url in the area. Following is the syntax −Above, code is the ISO language code set for the language, for example, en for English, fr for French, js for Japanese, etc. Let us now see an example to implement the hreflang attribute for the element −Example Live Demo Learning Learn these technologies with ease.... OutputIn the above example, we have set the map on the following image −Now, we have set the map and ... Read More
Sometimes we have noticed that the console is being closed immediately after displaying the result. So we cannot see the result properly. Here we will see how we can stop the console from closing.The idea is very simple. We can use the getchar() function at the end. This will wait for one character. If one character is pressed, the console will exit.Example Live Demo#include using namespace std; int main() { cout
Object.is()Object.is() is used to check whether two values are same or not. Two values are same when they have the following criteria. Either both the values are undefined or null .Either both are true or false.Both strings should be of same length, same characters and in same order.The polarities of both the values should be equal.Both the values can be NaN and should be equal.syntaxObject.is(val1, val2);It accepts two parameters and scrutinize whether they are equal or not. If equal gives out true as output else false as output.There is a small difference between Object.is() and "==" that is when comparing +0 and -0, the former results false whereas the latter results true. ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP