George John has Published 1081 Articles

Get MAX() on column in two MySQL tables?

George John

George John

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

527 Views

Use GREATEST() to find the maximum. Let us first create a table −mysql> create table DemoTable1    (    Number int    ); Query OK, 0 rows affected (0.52 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1 values(80); Query OK, 1 row affected (0.26 sec) ... Read More

How to order by a custom rule like order like 4,2,1,3 in MySQL?

George John

George John

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

271 Views

To order with a custom rule, use the ORDER BY FIELD(). Let us first create a table −mysql> create table DemoTable    (    Number int    ); Query OK, 0 rows affected (0.55 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(1); Query OK, ... Read More

Mathematical Functions in Python?

George John

George John

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

3K+ Views

From doing simple to complex mathematical operations(like trigonometric, logarithmic operations etc) in python we may need to use the math() module.The python math module is used to access mathematical functions. All methods of math() function are used for integer or real type objects but not for complex numbers.To use this ... Read More

MySQL query to get current datetime and only current date

George John

George John

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

407 Views

The query SELECT NOW() gives the current date as well as current time. If you want only current date, use only CURDATE(). Following is the syntax for datetime −SELECT NOW();The syntax for only date.SELECT CURDATE();Let us now implement the above syntax −Case 1 : If you want both current date ... Read More

How to create input Pop-Ups (Dialog) and get input from user in Java?

George John

George John

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

879 Views

Use the JOptionPane.showInputDialog() to get input from user in a dialog box like “Which sports you play the most”, “What is your name”, etc. The following is an example to create input Pop-Ups (Dialog) and get input from user −Examplepackage my; import javax.swing.JOptionPane; public class SwingDemo {    public static ... Read More

How to set vertical gap between elements in a GridLayout with Java?

George John

George John

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

1K+ Views

Use the setVgap() method to set the vertical gap between elements in a GridLayout. Let’s say we have a GridLaypout −GridLayout layout = new GridLayout(3, 3);Set the horizontal gap −layout.setVgap(30);The following is an example −Examplepackage my; import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Font; import java.awt.GridLayout; import javax.swing.JButton; import javax.swing.JFrame; ... Read More

Partial Functions in Python?

George John

George John

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

1K+ Views

Everybody loves to write reusable code, right? Then partial function is a cool thing to learn. Partial functions allows us to derive a function with x parameters to a function with fewer parameters and constant values set for the more limited function.We can write partial functional application in python through ... Read More

HTML

George John

George John

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

250 Views

The form attribute of the element is used to specify the forms wherein the button belongs to.Following is the syntax −The id above is the if of the form wherein the button belongs to.Let us now see an example to implement the form attribute of the element−Example Live Demo ... Read More

How can I separate Menu Items in a Menu with Java?

George John

George John

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

351 Views

Let’s say we have following MenuBar and menu in it -JMenuBar menuBar = new JMenuBar(); UIManager.put("MenuBar.background", Color.ORANGE); JMenu fileMenu = new JMenu("File"); fileMenu.setMnemonic(KeyEvent.VK_F); menuBar.add(fileMenu);Now, we will create a MenuItem and separate it using the JSeparator():JMenuItem menuItem1 = new JMenuItem("New", KeyEvent.VK_N); fileMenu.add(menuItem1); // separating MenuItems fileMenu.add(new JSeparator());The following is an example ... Read More

Implementing Web Scraping in Python with BeautifulSoup?

George John

George John

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

293 Views

BeautifulSoup is a class in the bs4 module of python. Basic purpose of building beautifulsoup is to parse HTML or XML documents.Installing bs4 (in-short beautifulsoup)It is easy to install beautifulsoup on using pip module. Just run the below command on your command shell.pip install bs4Running above command on your terminal, ... Read More

Advertisements