The HTML DOM Input DatetimeLocal stepdown() method defines the number of minutes the datetimeLocal field should decrease.SyntaxFollowing is the syntax −Calling stepDown method with a number, which by default is equal to 1inputDatetimeLocalObject.stepDown(number)ExampleLet us see an example of Input DatetimeLocal stepDown method − Live Demo Input DatetimeLocal stepDown() form { width:70%; margin: 0 auto; text-align: center; } * { padding: 2px; margin:5px; } input[type="button"] { border-radius: 10px; } Datetime-Local-stepDown( ... Read More
The HTML DOM KeyboardEvent shiftKey property returns the Boolean value (true/false) corresponding to if shift key was pressed using an event or not.SyntaxFollowing is the syntax −Returning booleanValue −event.shiftKeyExampleLet us see an example for KeyboardEvent shiftKey property − Live Demo KeyboardEvent shiftKey form { width:70%; margin: 0 auto; text-align: center; } * { padding: 2px; margin:5px; } input[type="button"] { border-radius: 10px; } KeyboardEvent-shiftKey Editor: I Dare you ... Read More
This is a C++ program to generate Random Partition out of a given set of numbers or characters.AlgorithmBegin Take the integers or characters as input. For choice 1: Take the input of the n integer array. Assign l = 0 to traverse the array. Using rand(), generate random integer partition of n. For each partition i, print next i integer from index value l. For choice is 2: Take the input of a string in ch[]. Calculate the length ... 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 afterLast() method of the ResultSet interface moves the pointer/cursor of the current ResultSet object to next position of the last row.rs.afterLast();Let us create a table with name MyPlayers in MySQL ... Read More
You can use INFORMATION_SCHEMA.COLUMNS for this. Let us first create a table −mysql> create table DemoTable ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, Name varchar(20) ); Query OK, 0 rows affected (0.73 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(Name) values('Chris'); Query OK, 1 row affected (0.25 sec) mysql> insert into DemoTable(Name) values('Robert'); Query OK, 1 row affected (0.26 sec) mysql> insert into DemoTable(Name) values('Sam'); Query OK, 1 row affected (0.12 sec)Display all records from the table using select statement −mysql> select *from DemoTable;This will produce the following ... Read More
Yes, we can do it. An interface can extend multiple interfaces in Java.Example:interface A { public void test(); public void test1(); } interface B { public void test(); public void test2(); } interface C extends A,B { public void test3(); } class D implements C { public void test() { System.out.println("Testing"); } public void test1() { System.out.println("Testing1"); } public void test2() { System.out.println("Testing2"); } public void test3() { System.out.println("Testing3"); } } public class Main { public static void main(String[] args) { D d=new D(); d.test(); d.test1(); d.test2(); d.test3(); } }Output:Testing Testing1 Testing2 Testing3
To combine both the layouts, here we have created two panels −Frame f = new JFrame("Combining Layouts"); JPanel panel1 = new JPanel(); JPanel panel2 = new JPanel();Now, set the layouts accordingly −panel1.setLayout(new BoxLayout(panel1, BoxLayout.Y_AXIS)); panel2.setLayout(new FlowLayout());Then after adding components to both the panels, add them to the frame −f.add(panel1, BorderLayout.WEST); f.add(panel2, BorderLayout.CENTER);Examplepackage my; import java.awt.BorderLayout; import java.awt.Color; import java.awt.FlowLayout; import javax.swing.BoxLayout; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextArea; public class SwingDemo { public static void main(String[] args) { JFrame f = new JFrame("Combining Layouts"); JPanel panel1 = new JPanel(); ... Read More
Here we will see the Johnson’s Algorithm to find shortest path between two vertices. The graph is given here. The shortest path between the edges is like below. This program will take the number of vertices, number of edges, and the edges with their costs.Input − Vertices: 3Edges: 5Edge with costs −1 2 82 1 121 3 223 1 62 3 4Output − The distance matrix of the graph.081210046140AlgorithmjohnsonAlgorithm(cost)Input − The cost matrix of given Graph.Output − Matrix to for shortest path between any vertex to any vertex.Begin Create another matrix ‘A’ same as cost matrix, if there is no ... Read More
Doc strings is the documentation string which is string literal, and it occurs in the class, module, function or method definition, and it is written as a first statement.There are two types of a Doc strings:one-line Doc stringsmulti-line Doc stringsThese are mainly used in DataScience /Machine Learning Programming.one-line Doc stringsThis type of Doc strings fit in one line. You can write them either using single quotes( ' ... ') or triple quotes ('''....''') . Example 1in the following program we are declaring a doc string with in a function, and printing its contents.def square(x): '''Returns argument x is squared.''' return x**x print (square.__doc__) ... Read More
Let us first create a table −mysql> create table DemoTable -> ( -> Name varchar(100), -> Code varchar(100) -> ); Query OK, 0 rows affected (0.54 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('Chris', '0001'); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable values('Robert', '0002'); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable values('Robert', '0003'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values('Chris', '0001'); Query OK, 1 row affected (0.12 sec)Display all records from the table using ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP