George John has Published 1167 Articles

File and Directory Comparisons in Python

George John

George John

Updated on 25-Jun-2020 13:34:45

5K+ Views

Python’s standard library has filecmp module that defines functions for comparison of files and directories. This comparison takes into consideration the properties of files in addition to data in them.Example codes in this article use following file and directory structure.Two directories dir1 and dir2 are first created under current working ... Read More

Validate the first name and last name with Java Regular Expressions

George John

George John

Updated on 25-Jun-2020 13:25:18

5K+ Views

In order to match the first name and last name using regular expression, we use the matches method in Java. The java.lang.String.matches() method returns a boolean value which depends on the matching of the String with the regular expression.Declaration −The java.lang.String.matches() method is declared as follows −public boolean matches(String regex)Let ... Read More

Change the Auto Increment counter in MySQL?

George John

George John

Updated on 25-Jun-2020 13:20:13

9K+ Views

In MySQL, auto increment counter starts from 0 by default, but if you want the auto increment to start from another number, use the below syntax.ALTER TABLE yourTable auto_increment=yourIntegerNumber;To understand the above syntax, let us first create a table. The query to create a table is as follows.mysql> create table ... Read More

Is there any whoami function or command in MySQL like UNIX?

George John

George John

Updated on 25-Jun-2020 13:16:47

621 Views

There is no whoami function in MySQL. The whoami can be used to know the current user in UNIX. Use user() or current_user() function from MySQL for the same purpose.The following is the output.+-----------+ | version() | +-----------+ | 8.0.12    | +-----------+ 1 row in set (0.00 sec)Case 1  ... Read More

Change CSS filter property with Animation

George John

George John

Updated on 25-Jun-2020 13:13:26

224 Views

To implement animation on filter property with CSS, you can try to run the following codeExampleLive Demo                    div {             width: 600px;             height: 300px;           ... Read More

Usage of cubic-bezier() CSS function

George John

George John

Updated on 25-Jun-2020 13:09:09

160 Views

To define a Cubic Bezier curve, use the cubic-bezier() function. You can try to run the following code to implement the cubic-bezier() functionExampleLive Demo                    div {             width: 100px;             height: 100px;             background: yellow;             transition: width 3s;             transition-timing-function: cubic-bezier(0.3, 0.3, 2.0, 0.9);          }          div:hover {             width:200px;          }                     Hover over the below container:          

Change column-rule-width property with CSS Animations

George John

George John

Updated on 25-Jun-2020 13:01:46

112 Views

To implement animation on column-rule-width property with CSS, you can try to run the following codeExampleLive Demo                    div {             width: 600px;             height: 300px;         ... Read More

MySQL concatenation operator?

George John

George John

Updated on 25-Jun-2020 12:59:12

359 Views

You can use in-built function CONCAT() from MySQL. The syntax is as follows −SELECT CONCAT(('(', yourColumnName1, ', ', yourColumnName2, ', ', yourColumnName3, ...N')')as anyVariableName from yourTableName;To understand the above syntax, let us first create a table. The query to create a table is as follows −mysql> create table Concatenation_OperatorDemo -> ... Read More

Sieve of Eratosthenes in java

George John

George John

Updated on 25-Jun-2020 12:55:11

4K+ Views

Sieve of Eratosthenes is the ancient algorithm to find prime numbers up to a given number.Algorithm1. Generate integers from 2 to n (Given number).2. Counting from 2 mark every 2nd integer. (multiples of 2)3. Now, starting from 3 mark every third integer. (multiples of 3)4. Finally, marking from 5 mark ... Read More

Legendre’s Formula in java

George John

George John

Updated on 25-Jun-2020 12:46:49

182 Views

You can calculate the exponent of the largest power of a PrimeNumber that divides the factorial n! using Legendre's formula.Programimport java.util.Scanner; public class LegendresFormula {    static int Largestpower(int n, int p) {       int ans = 0;       while (n > 0) {   ... Read More

Advertisements