Parsing an URLIt is very simple to parse an URL in javascript by using DOM method rather than Regular expressions. If regular expressions are used then code will be much more complicated. In DOM method just a function call will return the parsed URL. In the following example, initially a function is created and then an anchor tag "a" is created inside it using a DOM method. Later on the provided URL was assigned to the anchor tag using href. Now, when function returns the parts of the URL, it tries to return the parsed parts as shown in the output. ... Read More
You can search for a particular letter in a string using the indexOf() method of the String class. This method which returns a position index of a word within the string if found. Otherwise it returns -1.Example Live Demopublic class Test { public static void main(String args[]){ String str = new String("hi welcome to Tutorialspoint"); int index = str.indexOf('w'); System.out.println("Index of the letter w :: "+index); } }OutputIndex of the letter w :: 3
To get the highest value, use the GREATEST() method. Let us first create a table −mysql> create table DemoTable -> ( -> Value1 int, -> Value2 int, -> Value3 int -> ); Query OK, 0 rows affected (1.29 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(100, 600, 400); Query OK, 1 row affected (0.19 sec)Display all records from the table using select statement −mysql> select *from DemoTable;Output+--------+--------+--------+ | Value1 | Value2 | Value3 | +--------+--------+--------+ | 100 | 600 | 400 | ... Read More
The HTML DOM name property returns and alter the value of name attribute of an input button in HTML.SyntaxFollowing is the syntax −1. Returning nameobject.name2. Modifying nameobject.name=”text”Here, “text” represents the new name of the input button.ExampleLet us see an example of name property − Live Demo HTML DOM name Property body{ text-align:center; } .btn{ display:block; margin:1rem auto; background-color:#db133a; color:#fff; border:1px solid #db133a; padding:0.5rem; border-radius:50px; width:80%; } ... Read More
The HTML DOM Input DatetimeLocal name property returns a string, which is the value of the name attribute of input datetimeLocal. User can also set it to a new string.SyntaxFollowing is the syntax −Returning string valueinputDatetimeLocalObject.nameSetting name attribute to a string valueinputDatetimeLocalObject.name = ‘String’ExampleLet us see an example of Input DatetimeLocal name property − Live Demo Input DatetimeLocal name form { width:70%; margin: 0 auto; text-align: center; } * { padding: 2px; margin:5px; } input[type="button"] { ... Read More
The getModifierState() method returns true/false if the provided modifier key was pressed or not.SyntaxFollowing is the syntax −Calling getModifierState() with parameter as modifier keyevent.getModifierState(“modifierKey”)Modifier KeysHere, “modifierKey” can be the following −modifierKeyAltAltGraphCapsLockControlMetaNumLockScrollLockShiftExampleLet us see an example for getModifierState() method − Live Demo KeyboardEvent getModifierState() form { width:70%; margin: 0 auto; text-align: center; } * { padding: 2px; margin:5px; } input[type="button"] { border-radius: 10px; } KeyboardEvent getModifierState( ) Password: ... Read More
This is a C++ program to generate a sequence of N characters for a given specific case.AlgorithmsBegin function GenerateSequence() generate a Sequence of N Characters for a Given Specific Case: Use rand() for generating random indexes. Store the first character directly into the sequence. If that sequence is used earlier, then it discards that and generates random index again. EndExample#include #include #include using namespace std; void GenerateSequence(char string[], int n, int l, char *sequence) { int i, j=0, k, in; for(i = 0; i < n; i++) { ... Read More
For conditional MySQL query, you can use IF ELSE concept in stored procedure. Let us first create a table −mysql> create table DemoTable1 ( Id int ); Query OK, 0 rows affected (0.62 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1 values(10); Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable1 values(20); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable1 values(30); Query OK, 1 row affected (0.12 sec)Display all records from the table using select statement −mysql> select *from DemoTable1;This will produce the following output ... Read More
The cords attribute of the element is used to set the coordinates of area in image map. Use the attribute with shape attribute and set the size & shape of an area.Following is the syntaxUnder the value above, you can set the following coordinates with different parameters −x1, y1, x2, y2Coordinates of the top-left and bottom-right corner of the rectangle (shape="rect")x, y, radiusCoordinates of the circle center and the radius (shape="circle")x1, y1, x2, y2, .., xn, ynCoordinates of the edges of the polygon.Let us now see an example to implement the cords attribute of the element −Example Live Demo ... Read More
Yes, you can use json_extract(). Let us first create a table −mysql> create table DemoTable -> ( -> Data json -> ); Query OK, 0 rows affected (0.63 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('{"Name": "John", "CountryName": "US"}'); Query OK, 1 row affected (0.33 sec) mysql> insert into DemoTable values('{"Name": "Chris", "CountryName": "UK"}'); Query OK, 1 row affected (0.15 sec)Display all records from the table using select statement −mysql> select *from DemoTable;Output+----------------------------------------+ | Data ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP