The HTML DOM Input DatetimeLocal step property determines the legal intervals for seconds or milliseconds.SyntaxFollowing is the syntax −Returning number valueinputDatetimeLocalObject.stepSetting step attribute to a number valueinputDatetimeLocalObject.step = numberParametersParameter number values −ValueDescriptionsecondsvalid values constitute of those numbers that divide 60 perfectly (eg: 10, 15, 20)millisecondsvalid values start with “.” and divide 1000 perfectly (eg: .10, .20, .01)ExampleLet us see an example of Input DatetimeLocal step property − Live Demo Input DatetimeLocal step form { width:70%; margin: 0 auto; text-align: center; } * { ... Read More
The HTML DOM KeyboardEvent metaKey property returns the Boolean value (true/false) corresponding to if meta key was pressed using an event or not.SyntaxFollowing is the syntax −Returning booleanValue −event.metaKeyExampleLet us see an example for KeyboardEvent metaKey property − Live Demo KeyboardEvent metaKey form { width:70%; margin: 0 auto; text-align: center; } * { padding: 2px; margin:5px; } input[type="button"] { border-radius: 10px; } KeyboardEvent-metaKey Editor: I Dare you ... 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 beforeFirst() method of the ResultSet interface moves the pointer of the current (ResultSet) object to the default position (before first), from the current position.Statement stmt = con.createStatement(); ResultSet rs = ... Read More
Use YEAR() and MONTH() to display records from specific month and year respectively. Let us first create a table −mysql> create table DemoTable ( CustomerId int NOT NULL AUTO_INCREMENT PRIMARY KEY, CustomerName varchar(20), CustomerTotalBill int, PurchasingDate date ); Query OK, 0 rows affected (0.83 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(CustomerName, CustomerTotalBill, PurchasingDate) values('John', 2000, '2019-01-21'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable(CustomerName, CustomerTotalBill, PurchasingDate) values('Chris', 1000, '2019-01-31'); Query OK, 1 row affected (0.21 sec) mysql> insert into DemoTable(CustomerName, CustomerTotalBill, PurchasingDate) values('Robert', ... Read More
A regular expression is a special sequence of characters that helps you match or find other strings or sets of strings, using a specialized syntax held in a pattern. Regular expressions are widely used in UNIX world. The re module in python refers to the module Regular Expressions (RE). It specifies a set of strings or patterns that matches it. Metacharacters are used to understand the analogy of RE. subn()method is similar to sub() and also returns the new string along with the no. of replacements.Syntaxre.subn (pattern, repl, string, count=0, flags=0)Exampleimport re print(re.subn('ov', '~*' , 'movie tickets booking in online')) t ... Read More
To align components vertically, use the BoxLayout −JFrame frame = new JFrame(); frame.getContentPane().setLayout(new BoxLayout(frame.getContentPane(), BoxLayout.Y_AXIS));Now, create a Panel and add some buttons to it. After that set left alignment of components which are already arranged vertically using Component.LEFT_ALIGNMENT constant −JPanel panel = new JPanel(); JButton btn1 = new JButton("One"); JButton btn2 = new JButton("Two"); JButton btn3 = new JButton("Three"); JButton btn4 = new JButton("Four"); JButton btn5 = new JButton("Five"); panel.add(btn1); panel.add(btn2); panel.add(btn3); panel.add(btn4); panel.add(btn5); panel.setAlignmentX(Component.LEFT_ALIGNMENT);The following is an example to left align components vertically with BoxLayout −Examplepackage my; import java.awt.Component; import java.awt.Dimension; import javax.swing.BorderFactory; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JFrame; ... Read More
Here we will see how to create Random Linear Extension of a Directed Acyclic Graph (DAG). The Linear extension is basically the topological sorting of DAG. Let us consider the graph is like below −The topological sorting for a directed acyclic graph is the linear ordering of vertices. For every edge u-v of a directed graph, the vertex u will come before vertex v in the ordering.As we know that the source vertex will come after the destination vertex, so we need to use a stack to store previous elements. After completing all nodes, we can simply display them from ... Read More
Overloading is a one of the mechanisms to achieve polymorphism where, a class contains two methods with same name and different parameters.Whenever you call this method the method body will be bound with the method call based on the parameters.Example Live Demopublic class Calculator { public int addition(int a , int b){ int result = a+b; return result; } public int addition(int a , int b, int c){ int result = a+b+c; return result; } public static void main(String args[]){ Calculator ... Read More
Let us first create a table −mysql> create table DemoTable -> ( -> Amount int -> ); Query OK, 0 rows affected (0.50 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(10); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable values(20); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable values(30); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable values(40); Query OK, 1 row affected (0.15 sec)Display all records from the table using select statement −mysql> select *from DemoTable;Output+--------+ | Amount ... Read More
The HTML DOM input checkbox defaultChecked property returns the default value of checked attribute of a checkbox in HTML.SyntaxFollowing is the syntax −object.defaultCheckedExampleLet us see an example of defaultChecked property − Live Demo HTML DOM checked property body{ text-align:center; } p{ font-size:1.5rem; color:#ff8741; } input{ width:30px; height:30px; } button{ background-color:#db133a; color:#fff; padding:8px; border:none; width:180px; margin:0.5rem; ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP