HTML DOM Local Storage clear() method

AmitDiwan
Updated on 30-Jul-2019 22:30:26

192 Views

The HTML DOM Local Storage clear() method is used for clearing the whole local storage entries.SyntaxFollowing is the syntax −localStorage.clear()OrsessionStorage.clear()ExampleLet us see an example for LocalStorage() method property − Live Demo LocalStorage clear()    form {       width:70%;       margin: 0 auto;       text-align: center;    }    * {       padding: 2px;       margin:5px;    }    input[type="button"] {       border-radius: 10px;    }    table, th, td {       border:1px solid black;       border-collapse: collapse;       margin: 0 ... Read More

What is the difference between size_t and int in C++?

karthikeya Boyini
Updated on 30-Jul-2019 22:30:26

4K+ Views

Here we will see what are the differences between size_t and int in C++. If we consider the standard, both are integers of size 16 bits.On a typical 64-bit system, the size_t will be 64-bit, but unsigned int will be 32 bit. So we cannot use them interchangeably.One standard recommendation is that the size_t be at most as big as an unsigned long. So you may think that we can use unsigned long in the place of size_t, but unsigned long on 64-bit system, if the OS ins Windows, will be of 32-bits, but size_t will be of 64-bits.Read More

C++ Program to Implement Trie

Nishtha Thakur
Updated on 30-Jul-2019 22:30:26

1K+ Views

Here we shall discuss a C++ Program to implement Trie. It is a tree based data structure, used for efficient retrieval of a key in a large data-set of strings.Functions and pseudocodesBegin function insert() :    If key not present, inserts key into trie. If the key is prefix of trie node, just mark leaf node. End Begin function deleteNode()    If tree is empty then return null.    If last character of the key is being processed,       then that node will be no more end of string after deleting it.       If given key ... Read More

Binary Countdown Protocol

Moumita
Updated on 30-Jul-2019 22:30:26

5K+ Views

Binary Countdown Protocol is a collision-free protocol that operates in the Medium Access Control (MAC) layer of the OSI model. In computer networks, when more than one station tries to transmit simultaneously via a shared channel, the transmitted data is garbled, an event called collision. Collision-free protocols resolves channel access while the stations are contending for the shared channel, thus eliminating any possibilities of collisions.Working Principle of Binary CountdownIn a binary countdown protocol, each station is assigned a binary address. The binary addresses are bit strings of equal lengths. When a station wants to transmit, it broadcasts its address to ... Read More

How to do alphanumeric sort in MongoDB?

Smita Kapse
Updated on 30-Jul-2019 22:30:26

382 Views

You need to set numericOrdering: true for alphanumeric sort. Let us first create a collection with documents −> db.alphanumericSortDemo.insertOne({"StudentId":"STU1010"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5ccf149adceb9a92e6aa194c") } > db.alphanumericSortDemo.insertOne({"StudentId":"STU1101"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5ccf14a2dceb9a92e6aa194d") } > db.alphanumericSortDemo.insertOne({"StudentId":"STU1901"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5ccf14a9dceb9a92e6aa194e") } > db.alphanumericSortDemo.insertOne({"StudentId":"STU908"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5ccf14aedceb9a92e6aa194f") } > db.alphanumericSortDemo.insertOne({"StudentId":"STU101"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5ccf14b2dceb9a92e6aa1950") }Following is the query to display all documents from a collection with the help of find() method −> db.alphanumericSortDemo.find().pretty();This will produce the following output ... Read More

How to set the maximized bounds for a Frame in Java?

Ankith Reddy
Updated on 30-Jul-2019 22:30:26

282 Views

To set maximized bounds, use the setMaximizedBounds() method. Here, we will create a frame, which when maximized will form a shape −JFrame frame = new JFrame("Login!");Above, we have created a frame and now we will use the Rectangle class to specify an area of coordinates −Rectangle bounds = new Rectangle(50, 10, 100, 200); Now, set maximized bounds − frame.setMaximizedBounds(bounds);The following is an example to set the maximized bounds for a frame −Examplepackage my; import java.awt.GridLayout; import java.awt.Rectangle; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPasswordField; import javax.swing.JTextField; import javax.swing.SwingConstants; public class SwingDemo {    public static void main(String[] args) throws Exception { ... Read More

How to search between columns in MySQL?

Arjun Thakur
Updated on 30-Jul-2019 22:30:26

92 Views

Use BETWEEN clause to search between columns. Let us first create a table −mysql> create table DemoTable    (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    Score1 int,    Score2 int    ); Query OK, 0 rows affected (0.78 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(Score1, Score2) values(45, 65); Query OK, 1 row affected (0.26 sec) mysql> insert into DemoTable(Score1, Score2) values(450, 680); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable(Score1, Score2) values(800, 900); Query OK, 1 row affected (0.17 sec)Display all records from the table using select statement ... Read More

RAII and smart pointers in C++

Anvi Jain
Updated on 30-Jul-2019 22:30:26

1K+ Views

RAII in C++RAII (Resource Acquisition Is Initialization) is C++ technique which control the life cycle of resource. It is a class variant and is tied to object life time.It encapsulates several resources into class where resource allocation is done by constructor during object creation and resource deallocation is done by destructor during object destruction.Resource is guaranteed to be held till the object is alive.Examplevoid file_write {    Static mutex m; //mutex to protect file access    lock_guard lock(m); //lock mutex before accessing file    ofstream file("a.txt");    if (!file.is_open()) //if file is not open    throw runtime_error("unable to open file"); ... Read More

Why is operator overloading not supported by java?

Venkata Sai
Updated on 30-Jul-2019 22:30:26

9K+ Views

When a class has two or more methods by the same name but different parameters, at the time of calling based on the parameters passed respective method is called (or respective method body will be bonded with the calling line dynamically). This mechanism is known as method overloading.Operator overloadingOperator overloading is the ability to redefine the functionality of the operators. Programming languages like c++ supports operator overloading.you can redefine or overload most of the built-in operators available in C++. Thus, a programmer can use operators with user-defined types as well.Overloaded operators are functions with special names: the keyword "operator" followed ... Read More

HTML DOM Input Number stepDown() Method

karthikeya Boyini
Updated on 30-Jul-2019 22:30:26

45 Views

The HTML DOM input number stepDown() method decrements the value of input number field by a specified value.SyntaxFollowing is the syntax −object.stepDown(number)Here, if number parameter is omitted then it decrements the value by 1.ExampleLet us see an example of input number stepDown() method − Live Demo HTML DOM stepUp()/stepDown() Demo body{ text-align:center; background: linear-gradient(62deg, #FBAB7E 0%, #F7CE68 100%) center/cover no-repeat; height:100vh; color:#fff; } p{ ... Read More

Advertisements