The DOM PageTransitionEvent is an event which occurs when a user navigates between the webpages.Property of PageTransitionEvent objectPropertyExplanationpersistedIt returns true or false value depending upon whether the webpage was cached or not.Types of events belong to PageTransitionEvent objectEventsExplanationpageHideIt happens when the user navigates away from a webpage.pageShowIt happens when the user navigates to a webpage.ExampleLet us see an example of PageTransitionEvent object − Live Demo body{ text-align:center; color:#fff; background: #ff7f5094; height:100%; } .btn{ background:#0197F6; border:none; ... Read More
The HTML DOM Input URL Object represents an input HTML element with type url.SyntaxFollowing is the syntax −Creating an with type url.var urlObject = document.createElement(“input”); urlObject.type = “url”;AttributesHere, “urlObject” can have the following attributes −AttributesDescriptionautocompleteIt provides suggestions based on previously typed text, if set to ‘ON’autofocusIf set to true the url field is focused upon initial page load.defaultValueIt sets/returns the default value of an url fielddisabledIt defines if an url field is disabled/enabledformIt returns a reference of enclosing form that contains the url fieldmaxLengthIt returns/sets the value of maxLength attribute of an url fieldnameIt defines the value of name ... Read More
We have seen sometimes the strings are made using char s[], or sometimes char *s. So here we will see is there any difference or they are same?There are some differences. The s[] is an array, but *s is a pointer. For an example, if two declarations are like char s[20], and char *s respectively, then by using sizeof() we will get 20, and 4. The first one will be 20 as it is showing that there are 20 bytes of data. But second one is showing only 4 as this is the size of one pointer variable. For the ... Read More
Let’s say the following is String array, which we have converted to List −Arrays.asList("DE", "GH", "JK", "MN", "PQ", "RS", "TU", "VW", "XY", "BC")Now filter String stream and map to lower case −.stream() .filter(a-> a.startsWith("V")) .map(String::toLowerCase)To sort now, use the sorted() and display using forEach().The following is an example to filter string stream and map to lowercase −Exampleimport java.util.Arrays; public class Demo { public static void main(String[] args) throws Exception { Arrays.asList("DE", "GH", "JK", "MN", "PQ", "RS", "TU", "VW", "XY", "BC") .stream() .filter(a-> a.startsWith("V")) .map(String::toLowerCase) ... Read More
Let us first create a Stored Procedure. Following is the query to create a stored procedure using MySQL Workbench.use business; DELIMITER // DROP PROCEDURE IF EXISTS SP_GETMESSAGE; CREATE PROCEDURE SP_GETMESSAGE() BEGIN DECLARE MESSAGE VARCHAR(100); SET MESSAGE="HELLO"; SELECT CONCAT(MESSAGE, ' ', 'MYSQL!!!!'); END // DELIMITER ;Here is the screenshot of stored procedure in MySQL workbench −You need to execute the above stored procedure with the help of below symbol shown in the screenshot −Now you can call the stored procedure with the help of CALL command.call SP_GETMESSAGE();The screenshot is as follows −Now again you can execute the above statement with the ... Read More
This example demonstrate about How to limit text length of EditText in Android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml. Step 3 − Add the following code to src/MainActivity.javapackage app.tutorialspoint.com.sample ; import android.support.v7.app.AppCompatActivity ; import android.os.Bundle ; public class MainActivity extends AppCompatActivity { @Override protected void onCreate (Bundle savedInstanceState) { super .onCreate(savedInstanceState) ; setContentView(R.layout. activity_main ) ; } }Step 4 − Add ... Read More
You can use update(). Let us first create a collection with documents −> db.addExtraFieldDemo.insertOne( { "_id": 1, "UserName": "Larry" , "UserOtherDetails":[ { "UserCountryName": "US", "UserAge":23 }, { "UserCountryName": "UK", "UserAge":24 } ] } ); { "acknowledged" : true, "insertedId" : 1 }Following is the query to ... Read More
CLOB stands for Character Large Object. in general, an SQL Clob is a built-in datatype which is used to store large amount of textual data. Using this datatype, you can store data up to 2, 147, 483, 647 characters. MYSQL database provides support Clob datatype TINYTEXT, TEXT, MEDIUMTEXT, LONGTEXT.The java.sql.Clob interface of the JDBC API represents the CLOB datatype. Since the Clob object in JDBC is implemented using an SQL locator, it holds a logical pointer to the SQL CLOB (not the data).Inserting Data into a column of Clob typeYou can insert a CLOB type value using the setCharacterStream() or, ... Read More
In this problem we will see how we can get the sum of cubes of first n natural numbers. Here we are using one for loop, that runs from 1 to n. In each step we are calculating cube of the term and then add it to the sum. This program takes O(n) time to complete. But if we want to solve this in O(1) or constant time, we can use this series formula −AlgorithmcubeNNatural(n)begin sum := 0 for i in range 1 to n, do sum := sum + i^3 done return ... Read More
In C or C++, we have used the switch-case statement. In the switch statement we pass some value, and using different cases, we can check the value. Here we will see that we can use ranges in the case statement.The syntax of using range in Case is like below −case low … highAfter writing case, we have to put lower value, then one space, then three dots, then another space, and the higher value.In the following program, we will see what will be the output for the range based case statement.Example#include main() { int data[10] = { 5, ... Read More