Abhinaya

Abhinaya

39 Articles Published

Articles by Abhinaya

39 articles

How to check whether a string contains a substring in JavaScript?

Abhinaya
Abhinaya
Updated on 20-Apr-2022 995 Views

JavaScript provides us with different methods to check whether a string contains a substring or not. In this article, we use the following three methods for this purpose-String search() methodString indexOf() methodString includes() methodLet’s explore in detail each method.1. String search() methodThe string search method can be used to search a text (using regular expression) in a string.It matches the string against a regular expression and returns the index (position) of the first match.It returns -1 if no match is found. It’s case-sensitive.The string search() method is an ES1 feature. It is fully supported in all browsers.Syntaxstring.search(searchValue)searchValue is a regular ...

Read More

How to add a unique id for an element in HTML?

Abhinaya
Abhinaya
Updated on 24-Jun-2020 973 Views

Use the id attribute in HTML to add the unique id of an element.ExampleYou can try to run the following code to implement id attribute −           Tutorialspoint       We provide Tutorials!       More...                function display() {             document.getElementById("myid").innerHTML = "We provide learning videos as well";          }          

Read More

Why aren't variable-length arrays part of the C++ standard?

Abhinaya
Abhinaya
Updated on 24-Jun-2020 523 Views

Having to create a potential large array on the stack, which usually has only little space available, isn't good. If you know the size beforehand, you can use a static array. And if you don't know the size beforehand, you will write unsafe code. Variable-length arrays can not be included natively in C++ because they'll require huge changes in the type system.An alternative to Variable-length arrays in C++ is provided in the C++ STL, the vector. You can use it like −Example#include #include using namespace std; int main() {    vector vec;    vec.push_back(1);    vec.push_back(2);    vec.push_back(3);   ...

Read More

How to set the length of the item relative to the rest with JavaScript?

Abhinaya
Abhinaya
Updated on 23-Jun-2020 158 Views

Use the flex property in JavaScript to set the length of the item relative to the rest. You can try to run the following code to implement flex property with JavaScript −Example                    #box {             border: 1px solid #000000;             width: 300px;             height: 400px;             display: flex;          }                              DIV1          DIV2          DIV3             Set                function display() {             var a = document.getElementById("box");             var b = a.getElementsByTagName("DIV");             var j ;             for (j = 0; j < b.length; j++) {                b[j].style.flex = "1";             }          }          

Read More

How to create JavaScript regexes using string variables?

Abhinaya
Abhinaya
Updated on 23-Jun-2020 184 Views

Yes, use new RegExp(pattern, flags) to achieve this in JavaScript.You can try to run the following code to implement JavaScript regex using string variables −                    var str = 'HelloWorld'.replace( new RegExp('hello', 'i'), '' );          document.write(str);          

Read More

How to set the bottom padding of an element with JavaScript?

Abhinaya
Abhinaya
Updated on 23-Jun-2020 731 Views

To set the bottom padding, use the paddingBottom property in JavaScript.ExampleYou can try to run the following code to return the bottom padding of an element with JavaScript −                    #box {             border: 2px solid #FF0000;             width: 150px;             height: 70px;          }                     This is demo text.                   Bottom padding                      function display() {             document.getElementById("box").style.paddingBottom = "100px";          }          

Read More

With JavaScript how can I find the name of the web browser, with version?

Abhinaya
Abhinaya
Updated on 23-Jun-2020 372 Views

To find the name of the web browser, with version, you need to try the following code −Example           Browser Detection Example                                  

Read More

How do you launch the JavaScript debugger in Google Chrome?

Abhinaya
Abhinaya
Updated on 23-Jun-2020 329 Views

To launch JavaScript debugger in Google Chrome, try any of the following ways,Press Ctrl + Shift + JGo to Settings and click More Tools. After that, click Developer Tools.For more, refer the official website of  Chrome Dev Tool,

Read More

How can I display MySQL query result vertically?

Abhinaya
Abhinaya
Updated on 22-Jun-2020 893 Views

With the use of ego, \G option at end of a statement, we can get the result set in vertical format. Consider the following example −mysql> Select * from Student where name = 'Aarav'\G *************************** 1. row ***************************   Name: Aarav RollNo: 150  Grade: M.SC 1 row in set (0.00 sec)

Read More

How MySQL prevents unauthorized clients from accessing the database system?

Abhinaya
Abhinaya
Updated on 20-Jun-2020 271 Views

MySQL implements a sophisticated access control and privilege system that allows us to create comprehensive access rules for handling client operations and effectively preventing unauthorized clients from accessing the database system.The MySQL access control has two stages when a client connects to the server −Connection verification A client, which connects to the MySQL database server, needs to have a valid username and password. In addition, the host from that the client connects needs to match with the host within the MySQL grant table.Request verificationonce a connection is established successfully, for each statement issued by the client, MySQL checks whether the client ...

Read More
Showing 1–10 of 39 articles
« Prev 1 2 3 4 Next »
Advertisements