code-rag-bench/online-tutorials huggingface dataset:
Difference between Method Overloading and Method Overriding in Python

29 Apr, 2021
Method Overloading: Method Overloading is an example of Compile time polymorphism. In this, more than one method of the same class shares the same method name having different signatures. Method overloading is used to add more to the behavior of methods and there is no need of more than one class for method overloading.Note: Python does not support method overloading. We may overload the methods but can only use the latest defined method.Example:  
Python3
# Function to take multiple argumentsdef add(datatype, *args):       # if datatype is int    # initialize answer as 0    if datatype =='int':        answer = 0               # if datatype is str    # initialize answer as ''    if datatype =='str':        answer =''       # Traverse through the arguments    for x in args:           # This will do addition if the         # arguments are int. Or concatenation         # if the arguments are str        answer = answer + x       print(answer)   # Integeradd('int', 5, 6)   # Stringadd('str', 'Hi ', 'Geeks')
Output:  
11
Hi Geeks
Method Overriding: Method overriding is an example of run time polymorphism. In this, the specific implementation of the method that is already provided by the parent class is provided by the child class. It is used to change the behavior of existing methods and there is a need for at least two classes for method overriding. In method overriding, inheritance always required as it is done between parent class(superclass) and child class(child class) methods.Example of Method Overriding in python:  
Python3
class A:     def fun1(self):        print('feature_1 of class A')             def fun2(self):        print('feature_2 of class A')      class B(A):         # Modified function that is    # already exist in class A    def fun1(self):        print('Modified feature_1 of class A by class B')                def fun3(self):        print('feature_3 of class B')          # Create instanceobj = B()     # Call the override functionobj.fun1()
Output:  
Modified feature_1 of class A by class B
  Difference between Method Overloading and Method Overriding in Python:    
 
anks005
rajavslk
python-basics
python-oop-concepts
Difference Between
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Difference Between Method Overloading and Method Overriding in Java
Difference between Compile-time and Run-time Polymorphism in Java
Difference between Synchronous and Asynchronous Transmission
Difference between Structure and Union in C
Differences between Procedural and Object Oriented Programming
Iterate over a list in Python
Python map() function
Read JSON file using Python
How to iterate through Excel rows in Python?
Enumerate() in Python
Python – math.dist() method

23 Jan, 2020
Math module in Python contains a number of mathematical operations, which can be performed with ease using the module. math.dist() method in Python is used to the Euclidean distance between two points p and q, each given as a sequence (or iterable) of coordinates. The two points must have the same dimension.This method is new in Python version 3.8.
Syntax: math.dist(p, q)
Parameters:p: A sequence or iterable of coordinates representing first pointq: A sequence or iterable of coordinates representing second point
Returns: the calculated Euclidean distance between the given points.
Code #1: Use of math.dist() method
# Python Program to explain math.dist() method  # Importing math moduleimport math  # One dimensional Point  # Coordinate of Point PP = 3  # Coordinates of point QQ = -8  # Calculate the Euclidean distance # between points P and QeDistance = math.dist([P], [Q])print(eDistance)
11.0

Code #2:
# Python Program to explain math.dist() method  # Importing math moduleimport math  # Two dimensional Point  # Coordinates of Point PPx = 3 Py = 7  # Coordinates of point QQx = -5Qy = -9  # Calculate the Euclidean distance # between points P and QeDistance = math.dist([Px, Py], [Qx, Qy])print(eDistance)    # Three-dimensional point  # Coordinates of Point PP = [3, 6, 9]  # Coordinates of point QQ = [1, 0, -2]   # Calculate the Euclidean distance # between points P and QeDistance = math.dist(P, Q)print(eDistance)
17.88854381999832
12.688577540449518

Code #3:
# Python Program to explain math.dist() method  # Importing math moduleimport math  # n-dimensional Point  # Coordinates of Point PP = [3, 9, 7, 2, 4, 5]   # Coordinates of point QQ = [-5, -3, -9, 0, 6, 2]  # Calculate the Euclidean distance # between points P and QeDistance = math.dist(P, Q)print(eDistance)  # Dimension of both points # should be the same 
21.93171219946131

Reference: Python math library
Python math-library
Python math-library-functions
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Python Classes and Objects
Python OOPs Concepts
Introduction To PYTHON
How to drop one or multiple columns in Pandas Dataframe
Python | os.path.join() method
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
Python | Get unique values from a list
Python | datetime.timedelta() function
MathF.Acos() Method in C# with Examples

The MathF.Acos() method in C# is used to return the angle whose cosine is given as a float value argument.
Following is the syntax −
public static float Acos (float val);
Above, Val is the floating-point number.
Let us now see an example to implement the MathF.Acos() method −
using System;
public class Demo {
   public static void Main(){
      float val1 = 0.1f;
      float val2 = 0.9f;
      Console.WriteLine("Angle (val1) = "+(MathF.Acos(val1)));
      Console.WriteLine("Angle (val2) = "+(MathF.Acos(val2)));
   }
}
This will produce the following output −
Angle (val1) = 1.470629
Angle (val2) = 0.4510269
Let us now see another example to implement the MathF.Acos() method −
using System;
public class Demo {
   public static void Main(){
      float val1 = 2.5f;
      float val2 = 5.0f;
      Console.WriteLine("Angle (val1) = "+(MathF.Acos(val1)));
      Console.WriteLine("Angle (val2) = "+(MathF.Acos(val2)));
   }
}
This will produce the following output −
Angle (val1) = NaN
Angle (val2) = NaN
Spring Boot – Difference Between CrudRepository and JpaRepository

22 Dec, 2021
Spring Boot is built on the top of the spring and contains all the features of spring. And is becoming a favorite of developers these days because of its rapid production-ready environment which enables the developers to directly focus on the logic instead of struggling with the configuration and setup. Spring Boot is a microservice-based framework and making a production-ready application in it takes very little time.
There is an interface available in Spring Boot named as CrudRepository that contains methods for CRUD operations. It provides generic Crud operation on a repository. It is defined in the package org.springframework.data.repository and It extends the Spring Data Repository interface. If someone wants to use CrudRepository in the spring boot application he/she has to create an interface and extend the CrudRepository interface. 
Syntax:
public interface CrudRepository<T, ID> extends Repository<T, ID>
Where:
T: Domain type that repository manages (Generally the Entity/Model class name)
ID: Type of the id of the entity that repository manages (Generally the wrapper class of your @Id that is created inside the Entity/Model class)
Example:
public interface DepartmentRepository extends CrudRepository<Department, Long> {}
JpaRepository is a JPA (Java Persistence API) specific extension of Repository. It contains the full API of CrudRepository and PagingAndSortingRepository. So it contains API for basic CRUD operations and also API for pagination and sorting. 
Syntax:
public interface JpaRepository<T,ID> extends PagingAndSortingRepository<T,ID>, QueryByExampleExecutor<T>
Where:
T: Domain type that repository manages (Generally the Entity/Model class name)
ID: Type of the id of the entity that repository manages (Generally the wrapper class of your @Id that is created inside the Entity/Model class)
Example:
public interface DepartmentRepository extends JpaRepository<Department, Long> {}
Here in the following image Repository, CrudRepository and PagingAndSortingRepository belong to Spring Data Commons whereas JpaRepository belongs to Spring Data JPA. 
Difference Table
CrudRepository 
JpaRepository 
Syntax: 
public interface CrudRepository<T, ID> extends Repository<T, ID>
Syntax:
public interface JpaRepository<T,ID> extends PagingAndSortingRepository<T,ID>, QueryByExampleExecutor<T>
Java-Spring-Boot
Picked
Difference Between
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Difference between var, let and const keywords in JavaScript
Difference Between Method Overloading and Method Overriding in Java
Similarities and Difference between Java and C++
Difference between Compile-time and Run-time Polymorphism in Java
Difference between Internal and External fragmentation
Arrays in Java
Split() String method in Java with examples
Arrays.sort() in Java with examples
Reverse a string in Java
Object Oriented Programming (OOPs) Concept in Java
Scala List indexOf() method with example

29 Jul, 2019
The indexOf() method is utilized to check the index of the element from the stated list present in the method as argument.
Method Definition: def indexOf(elem: A, from: Int): Int
Return Type: It returns the index of the element present in the argument.
Example #1:
// Scala program of indexOf()// method  // Creating objectobject GfG{       // Main method    def main(args:Array[String])    {        // Creating a list        val m1 = List(3, 6, 2, 9, 21)                  // Applying indexOf method        val result = m1.indexOf(9)                  // Displays output        println(result)          }} 
3

Example #2:
// Scala program of indexOf()// method  // Creating objectobject GfG{       // Main method    def main(args:Array[String])    {        // Creating a list        val m1 = List(3, 6, 2, 9, 21)                  // Applying indexOf method        val result = m1.indexOf(3)                  // Displays output        println(result)          }} 
0

Scala
Scala-list
Scala-Method
Scala
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to create a constant array in JavaScript? Can we change its values? Explain.

To create a const array in JavaScript we need to write const before the array name. The individual array elements can be reassigned but not the whole array.
Following is the code to create a constant array in JavaScript.
 Live Demo
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<style>
   body {
      font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
   }
   .result,.sample {
      font-size: 20px;
      font-weight: 500;
   }
</style>
</head>
<body>
<h1>Const array in JavaScript</h1>
<div class="sample"></div>
<div style="color: green;" class="result"></div>
<button class="Btn">CLICK HERE</button>
<h3>
Click on the above button to change array values and reassign the array later
</h3>
<script>
   let sampleEle = document.querySelector(".sample");
   let resEle = document.querySelector(".result");
   const arr = [22, 33, 44, 55];
   sampleEle.innerHTML = "Original Array = " + arr;
   document.querySelector(".Btn").addEventListener("click", () => {
      (arr[0] = 44), (arr[1] = 99), (arr[2] = 0);
      resEle.innerHTML += "Changing array elements value" + arr + '<br>';
      try {
         arr = [11, 11, 11, 11];
      }
      catch (err) {
         resEle.innerHTML += "Trying to reassign const array = " + err;
      }
   });
</script>
</body>
</html>
The above code will produce the following output −
On clicking the ‘CLICK HERE’ button −
SQL Full Outer Join Using Left and Right Outer Join and Union Clause

21 Apr, 2021
An SQL join statement is used to combine rows or information from two or more than two tables on the basis of a common attribute or field. There are basically four types of JOINS in SQL.
In this article, we will discuss FULL OUTER JOIN using LEFT OUTER Join, RIGHT OUTER JOIN, and UNION clause.
Consider the two tables below:
Sample Input Table 1:
Sample Input Table 2:
Full Join provides results with the concatenation of LEFT JOIN and RIGHT JOIN. The result will contain all the rows from both Table 1 and Table 2. The rows having no matching in the result table will have NULL values.
SELECT * FROM Table1
FULL OUTER JOIN Table2
ON Table1.column_match=Table2.column_match;

Table1: First Table in Database.
Table2: Second Table in Database.
column_match: The column common to both the tables.
The above query can also be written using a combination of LEFT OUTER JOIN, RIGHT OUTER JOIN, and UNION. The meaning of UNION is to join two or more data sets into a single set. The above query and the below query will provide the same output.
SELECT * FROM Table1
LEFT OUTER JOIN Table2
ON Table1.column_match=Table2.column_match
UNION
SELECT * FROM Table1
RIGHT OUTER JOIN Table2
ON Table1.column_match=Table2.column_match;

Table1: First Table in Database.
Table2: Second Table in Database.
column_match: The column common to both the tables.
Sample Output:
We have considered the Customer and Purchase Information of mobile phones from an E-Commerce site during Big Billion Days. The Database E-Commerce has two tables one has information about the Product and the other one has information about the Customer. Now, we will perform a FULL OUTER JOIN between these two tables to concatenate them into a single table and get complete data about the customers and the products they purchased from the site.
Now let’s consider the purchase_information table. To view the table use the below query:
SELECT * FROM purchase_information; 
Output:
Purchase Table
To view the customer_information table use the below query:
SELECT * FROM customer_information;
Output:
Customer Table
Now we can simply call the FULL OUTER JOIN clause to achieve a combined result from both the above-created tables using the below query:
SELECT * FROM purchase_information
FULL OUTER JOIN customer_information
ON purchase_information.cust_name=customer_information.customer_name
Output:
RESULT TABLE USING FULL OUTER JOIN
But we can achieve the same results without using the FULL OUTER JOIN clause. For this we make use of the LEFT JOIN, RIGHT JOIN, and the UNION clause as shown below:
SELECT FROM purchase_information
LEFT OUTER JOIN customer information
ON purchase_information.cust_name=customer_information.customer_name
UNION
SELECT * FROM purchase_information

RIGHT OUTER JOIN customer_information
ON purchase_information.cust_name=customer_information.customer_name
Output:
RESULTANT TABLE OF FULL OUTER JOIN USING LEFT AND RIGHT AND UNION
Picked
SQL-Query
SQL
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python | Pandas dataframe.min()

24 Nov, 2018
Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric python packages. Pandas is one of those packages and makes importing and analyzing data much easier.
Pandas dataframe.min() function returns the minimum of the values in the given object. If the input is a series, the method will return a scalar which will be the minimum of the values in the series. If the input is a dataframe, then the method will return a series with minimum of values over the specified axis in the dataframe. By default the axis is the index axis.
Syntax:DataFrame.min(axis=None, skipna=None, level=None, numeric_only=None, **kwargs)Parameters :axis : Align object with threshold along the given axis.skipna : Exclude NA/null values when computing the resultlevel : If the axis is a MultiIndex (hierarchical), count along a particular level, collapsing into a Seriesnumeric_only : Include only float, int, boolean columns. If None, will attempt to use everything, then use only numeric data. Not implemented forSeries.
Returns : min : Series or DataFrame (if level specified)
Example #1: Use min() function to find the minimum value over the index axis.
# importing pandas as pdimport pandas as pd  # Creating the dataframe df = pd.DataFrame({"A":[12, 4, 5, 44, 1],                   "B":[5, 2, 54, 3, 2],                    "C":[20, 16, 7, 3, 8],                    "D":[14, 3, 17, 2, 6]})  # Print the dataframedf
Lets use the dataframe.min() function to find the minimum value over the index axis
# find min Even if we do not specify axis = 0, the method # will return the min over the index axis by defaultdf.min(axis = 0)
Output : Example #2: Use min() function on a dataframe which has Na values. Also find the minimum over the column axis.
# importing pandas as pdimport pandas as pd  # Creating the dataframe df = pd.DataFrame({"A":[12, 4, 5, None, 1],                   "B":[7, 2, 54, 3, None],                   "C":[20, 16, 11, 3, 8],                    "D":[14, 3, None, 2, 6]})  # Print the dataframedf
Lets implement the min function.
# skip the Na values while finding the minimumdf.min(axis = 1, skipna = True)
Output :
Python pandas-dataFrame
Python pandas-dataFrame-methods
Python-pandas
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Write on an image using openCV in C++

04 Feb, 2021
In this article, we will discuss how to write over an image using OpenCV C++. Function putText() from OpenCV C++ library will be used to write text on an image.
Program 1:
Below program shows how to write text over a blank background image:
C++
// C++ program to demonstrate the// above approach#include <iostream>#include <opencv2/core/core.hpp>  // Library to include for// drawing shapes#include <opencv2/highgui/highgui.hpp>#include <opencv2/imgproc.hpp>using namespace cv;using namespace std;  // Driver Codeint main(int argc, char** argv){    // Create a blank image of size    // (500 x 500) with white background    // (B, G, R) : (255, 255, 255)    Mat image(500, 500, CV_8UC3,              Scalar(255, 255, 255));      // Check if the image is created    // successfully.    if (!image.data) {        cout << "Could not open or"             << " find the image"             << endl;        return 0;    }      // Writing over the Image    Point org(30, 100);    putText(image, "Text On Image", org,            FONT_HERSHEY_SCRIPT_COMPLEX, 2.1,            Scalar(0, 0, 255), 2, LINE_AA);      // Show our image inside a window.    imshow("Output", image);    waitKey(0);      return 0;}
Output:
Program 2:
Below program shows how to write text over a loaded image:
C++
// C++ program to demonstrate the// above approach#include <iostream>#include <opencv2/core/core.hpp>  // Library to include for// drawing shapes#include <opencv2/highgui/highgui.hpp>#include <opencv2/imgproc.hpp>using namespace cv;using namespace std;  // Driver Codeint main(int argc, char** argv){    // Create a blank image of size    // (500 x 500) with white background    // (B, G, R) : (255, 255, 255)    Mat image = imread("C:/Users/harsh/Downloads/geeks.png",                       IMREAD_COLOR);      // Check if the image is    // created successfully.    if (!image.data) {        cout << "Could not open or"             << " find the image" << std::endl;        return 0;    }      // Writing over the Image    Point org(1, 30);    putText(image, "Geeks For Geeks", org,            FONT_HERSHEY_SCRIPT_COMPLEX, 1.0,            Scalar(0, 255, 0), 2, LINE_AA);      // Show our image inside a window.    imshow("Output", image);    waitKey(0);      return 0;}
Output:
OpenCV
C++
C++ Programs
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Sorting a vector in C++
Polymorphism in C++
Pair in C++ Standard Template Library (STL)
Friend class and function in C++
std::string class in C++
Header files in C/C++ and its uses
Sorting a Map by value in C++ STL
Program to print ASCII Value of a character
How to return multiple values from a function in C or C++?
Shallow Copy and Deep Copy in C++
Substitute characters of a String in R Programming - chartr() Function - GeeksforGeeks

23 Dec, 2021
chartr() function in R Programming Language is used to do string substitutions. It replaces all the matches of the existing characters of a string with the new characters specified as arguments.
Syntax: chartr(old, new, x)
Parameters: 
old: old string to be substituted
new: new string
x: target string
Example 1: 
R
# R program to illustrate# chartr function # Initializing a stringx <- "Geeks GFG" # Calling the chartr() function# which will substitute G with Z# to the above specified stringchartr("G", "Z", x)
Output : 
[1] "Zeeks ZFZ"
Example 2: 
R
# R program to illustrate# chartr function # Initializing a stringx <- "GeeksforGeeks Geeks" # Calling the chartr() function# which will substitute G with 1,# k with 2 and s with 3# to the above specified stringchartr("Gks", "123", x)
Output: 
[1] "1ee23for1ee23 1ee23"
kumar_satyam
R String-Functions
R-strings
R Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Change Color of Bars in Barchart using ggplot2 in R
Group by function in R using Dplyr
How to Change Axis Scales in R Plots?
How to Split Column Into Multiple Columns in R DataFrame?
Replace Specific Characters in String in R
How to filter R DataFrame by values in a column?
R - if statement
How to import an Excel File into R ?
Plot mean and standard deviation using ggplot2 in R
How to filter R dataframe by multiple conditions?
C# | Random.NextBytes() Method - GeeksforGeeks

01 May, 2019
The NextBytes(Byte[]) method of the System.Random class in C# is used to fill the elements of a specified array of bytes with random numbers. This method takes a byte array as a parameter and fills it with random numbers.
Syntax:
public virtual void NextBytes (byte[] buffer);
Here, buffer is the array of bytes to contain random numbers.
Exception: This method will give ArgumentNullException if the buffer is null.
Below programs illustrates the use of NextBytes() method:
Example 1:
// C# program to illustrate the// use of Random.NextBytes Methodusing System;  class GFG {      // Driver code    public static void Main()    {        // Instantiate random number generator        Random rand = new Random();          // Instantiate an array of byte        Byte[] b = new Byte[10];          rand.NextBytes(b);          // Print random numbers in the byte array        Console.WriteLine("Printing random numbers"+                              " in the byte array");          for (int i = 0; i < 10; i++)            Console.WriteLine("{0} -> {1}", i, b[i]);    }}
Printing random numbers in the byte array
0 -> 63
1 -> 166
2 -> 5
3 -> 212
4 -> 114
5 -> 94
6 -> 161
7 -> 4
8 -> 226
9 -> 46

Example 2:
// C# program to illustrate the// use of Random.NextBytes Methodusing System;  class GFG {      // Driver code    public static void Main()    {        // Instantiate random number generator        Random rand = new Random();          // Instantiate an array of byte        Byte[] b = new Byte[10];          rand.NextBytes(b);          // Print random numbers in the byte array        Console.WriteLine("Printing random numbers"+                              " in the byte array");          foreach(byte byteValue in b)            Console.WriteLine("{0}", byteValue);    }}
Printing random numbers in the byte array
98
68
221
160
179
78
172
129
121
179

Reference:
https://docs.microsoft.com/en-us/dotnet/api/system.random.nextbytes?view=netframework-4.7.2
CSharp-method
CSharp-Random-Class
C#
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Destructors in C#
Extension Method in C#
HashSet in C# with Examples
Top 50 C# Interview Questions & Answers
C# | How to insert an element in an Array?
Partial Classes in C#
C# | Inheritance
C# | List Class
Difference between Hashtable and Dictionary in C#
Lambda Expressions in C#
AngularJS | ng-bind Directive - GeeksforGeeks

30 Mar, 2021
The ng-bind Directive in AngularJS is used to bind/replace the text content of any particular HTML element with the value that is entered in the given expression. The value of specified HTML content updates whenever the value of the expression changes in ng-bind directive.Syntax:  
<element ng-bind="expression"> Contents... </element>
Where expression is used to specify the expression to be evaluated or the variable.Example 1: This example uses ng-bind Directive to bind the product of two number to the <span> element.  
html
<!DOCTYPE html><html>     <head>    <title>ng-bind Directive</title>     <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js">    </script></head> <body ng-app="gfg" style="text-align:center">         <h1 style="color:green">GeeksforGeeks</h1>    <h2>ng-bind Directive</h2>                <div ng-controller="app">        num1: <input type="number" ng-model="num1"                ng-change="product()" />        <br><br>                 num2: <input type="number" ng-model="num2"                ng-change="product()" />        <br><br>                 <b>Product:</b> <span ng-bind="result"></span>    </div>         <script>        var app = angular.module("gfg", []);        app.controller('app', ['$scope', function ($app) {            $app.num1 = 1;            $app.num2 = 1;            $app.product = function () {                $app.result = ($app.num1 * $app.num2);            }        }]);    </script></body> </html>
Output:  
Example 2: This example uses ng-bind Directive to bind the innerHTML of the <span> element to the variable text.  
html
<!DOCTYPE html><html>     <head>    <title>ng-bind Directive</title>     <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js">    </script></head> <body  style = "text-align:center">         <h1 style = "color:green">GeeksforGeeks    <h2 style = "">ng-bind directive</h2>         <div ng-app="" ng-init="txt='GeeksforGeeks';col='green'">        <div>            <span ng-bind="txt"></span> is the            computer science portal for geeks.        </div>    </div></body> </html>
Output:  
 
simranarora5sos
AngularJS-Directives
AngularJS
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Angular File Upload
Angular | keyup event
Auth Guards in Angular 9/10/11
What is AOT and JIT Compiler in Angular ?
Angular PrimeNG Dropdown Component
Top 10 Front End Developer Skills That You Need in 2022
Installation of Node.js on Linux
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?
Get the time difference and convert it to hours in MySQL?

You can achieve with the help of timestampdiff() method from MySQL. The syntax is as follows −
SELECT ABS(TIMESTAMPDIFF(HOUR,yourColumnName1,yourColumnName2)) as
anyVariableName from yourTableName;
To understand the above syntax, let us create a table. The query to create a table is as follows −
mysql> create table DifferenceInHours
   -> (
   -> StartDateTime datetime,
   -> EndDateTime datetime
   -> );
Query OK, 0 rows affected (0.59 sec)
Insert some records in the table using insert command. The query is as follows −
mysql> insert into DifferenceInHours values('2018-12-20 10:00:00', '2018-12-19 12:00:00');
Query OK, 1 row affected (0.11 sec)

mysql> insert into DifferenceInHours values('2018-12-20 11:00:00', '2018-12-19 11:00:00');
Query OK, 1 row affected (0.16 sec)

mysql> insert into DifferenceInHours values('2018-12-20 10:30:00', '2018-12-19 11:00:00');
Query OK, 1 row affected (0.13 sec)
Display all records from the table using select statement. The query is as follows −
mysql> select *from DifferenceInHours;
+---------------------+---------------------+
| StartDateTime       | EndDateTime         |
+---------------------+---------------------+
| 2018-12-20 10:00:00 | 2018-12-19 12:00:00 |
| 2018-12-20 11:00:00 | 2018-12-19 11:00:00 |
| 2018-12-20 10:30:00 | 2018-12-19 11:00:00 |
+---------------------+---------------------+
3 rows in set (0.00 sec)
Here is the query that gets time difference in hours. The query is as follows −
mysql> SELECT ABS(TIMESTAMPDIFF(HOUR,StartDateTime,EndDateTime)) as Hour from
DifferenceInHours;
The following is the output displaying the time difference in hours −
+------+
| Hour |
+------+
|   22 |
|   24 |
|   23 |
+------+
3 rows in set (0.00 sec)
sorting in fork() - GeeksforGeeks

17 May, 2018
Prerequisite – Introduction of fork(), sorting algorithmsProblem statement – Write a program to sort the numbers in parent process and print the unsorted numbers in child process. For example :
Input : 5, 2, 3, 1, 4

Output :
Parent process 
sorted numbers are
1, 2, 3, 4, 5


Child process 
numbers to sort are
 5, 2, 3, 1, 4

Explanation – Here, we had used fork() function to create two processes one child and one parent process.
fork() returns value greater than 0 for parent process so we can perform the sorting operation.
for child process fork() returns 0 so we can perform the printing operation.
Here we are using a simple sorting algorithm to sort the numbers in the desired order.
We are using the returned values of fork() to know which process is a child or which is a parent process.
Note – At some instance of time, it is not necessary that child process will execute first or parent process will be first allotted CPU, any process may get CPU assigned, at some quantum time. Moreover process id may differ during different executions.
Code –
// C++ program to demonstrate sorting in parent and// printing result in child processes using fork()#include <iostream>#include <unistd.h>#include <algorithm>using namespace std;  // Driver codeint main(){    int a[] = { 1, 6, 3, 4, 9, 2, 7, 5, 8, 10 };    int n = sizeof(a)/sizeof(a[0]);    int id = fork();      // Checking value of process id returned by fork    if (id > 0) {        cout << "Parent process \n";          sort(a, a+n);            // Displaying Array        cout << " sorted numbers are ";        for (int i = 0; i < n; i++)             cout << "\t" << a[i];          cout << "\n";      }      // If n is 0 i.e. we are in child process    else {        cout << "Child process \n";        cout << "\n  numbers to be sorted are ";        for (int i = 0; i < n; i++)             cout << "\t" << a[i];           }      return 0;}
Output –
Output :
Parent process 
sorted numbers are 1 2 3 4 5 6 7 8 9 10

Child process 
numbers to be sorted are 1 6 3 4 9 2 7 5 8 10

This article is contributed by Pushpanjali Chauhan. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
AyushSaxena
system-programming
C++
C++ Programs
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Operator Overloading in C++
Polymorphism in C++
Sorting a vector in C++
Friend class and function in C++
std::string class in C++
Header files in C/C++ and its uses
Program to print ASCII Value of a character
How to return multiple values from a function in C or C++?
C++ Program for QuickSort
Sorting a Map by value in C++ STL
How to create multiple background image parallax in CSS ? - GeeksforGeeks

08 Sep, 2021
In this article, we will learn How to create multiple background image parallax in CSS.  
Approach: First, we will add background images using the background-image property in CSS. We can add multiple images using background-image.
Syntax:
background-image: url(image_url1),url(image_url2),...;
Then we apply animation property in CSS that animate the images.
Syntax:
animation: duration timing-function iteration-count direction;
Below is the full implementation of the above approach:
Example 1:
HTML
<!DOCTYPE html><html lang="en">  <head>    <style>      html {        /* Add background image */        background-image: url("gfg_stiker.png");        /* Repeat image in x-axis  */        background-repeat: repeat-x;        /* Animate Using animation: duration           timing-function iteration-count direction; */        animation: 30s parallel infinite linear;      }      /* timing-function */      @keyframes parallel {        100% {          /* set background-position */          background-position: -5000px 20%;        }      }    </style>  </head>  <body>    <div id="rocket">    <img src="gfg_stiker.png" alt="rocket"         style="margin: 200px 0px 50px 35%;">  </div>  </body></html>
Output:
Example 2:
HTML
<!DOCTYPE html><html lang="en">  <head>    <style>      html {        /* Add background image */        background-image: url("gfg_complete_logo_2x-min.png");        /* Repeat image in y-axis  */        background-repeat: repeat-y;        /* Animate Using animation: duration           timing-function iteration-count direction; */        animation: 30s parallel infinite linear;      }      /* timing-function */      @keyframes parallel {        100% {          /* set background-position */          background-position: 5000px 20%;        }      }    </style>  </head>  <body>    <div id="rocket">    <img src="gfg_complete_logo_2x-min.png"         alt="rocket" style="margin: 200px 0px 50px 35%;">  </div>  </body></html>
Output:
surinderdawra388
CSS-Properties
CSS-Questions
HTML-Tags
Picked
CSS
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Design a web page using HTML and CSS
How to set space between the flexbox ?
Form validation using jQuery
Search Bar using HTML, CSS and JavaScript
How to style a checkbox using CSS?
Remove elements from a JavaScript Array
Installation of Node.js on Linux
Convert a string to an integer in JavaScript
How to fetch data from an API in ReactJS ?
Difference between var, let and const keywords in JavaScript
Python | Delete elements in range - GeeksforGeeks

26 Feb, 2019
The deletion of a single element comparatively easier, but when we wish to delete element in range, the task becomes a tedious once due to the rearrangements and shifting of list elements automatically in python. Let’s discuss certain ways in which elements can be deleted in range.
Method #1 : Using del + sorted()In this method, we reverse the list of indices we wish to delete and delete them in the original list in backward manner so that the rearrangement of list doesn’t destroy the integrity of the solution.
# Python3 code to demonstrate# range deletion of elements # using del + sorted()  # initializing list test_list = [3, 5, 6, 7, 2, 10]  # initializing indicesindices_list = [1, 4, 2]  # printing the original listprint ("The original list is : " + str(test_list))  # printing the indices listprint ("The indices list is : " + str(indices_list))  # using del + sorted()# range deletion of elementsfor i in sorted(indices_list, reverse = True):    del test_list[i]  # printing resultprint ("The modified deleted list is : " + str(test_list))
The original list is : [3, 5, 6, 7, 2, 10]
The indices list is : [1, 4, 2]
The modified deleted list is : [3, 7, 10]

 Method #2 : Using enumerate() + list comprehensionThis task can also be performed if we make a list that would not have the elements in the delete list, i.e rather than actually deleting the elements, we can remake it without them.
# Python3 code to demonstrate# range deletion of elements # using enumerate() + list comprehension  # initializing list test_list = [3, 5, 6, 7, 2, 10]  # initializing indicesindices_list = [1, 4, 2]  # printing the original listprint ("The original list is : " + str(test_list))  # printing the indices listprint ("The indices list is : " + str(indices_list))  # using enumerate() + list comprehension# range deletion of elementstest_list[:] = [ j for i, j in enumerate(test_list)                         if i not in indices_list ]  # printing resultprint ("The modified deleted list is : " + str(test_list))
The original list is : [3, 5, 6, 7, 2, 10]
The indices list is : [1, 4, 2]
The modified deleted list is : [3, 7, 10]

Python list-programs
python-list
Python
Python Programs
python-list
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
Python Classes and Objects
How to drop one or multiple columns in Pandas Dataframe
Defaultdict in Python
Python | Get dictionary keys as a list
Python | Split string into list of characters
Python | Convert a list to dictionary
How to print without newline in Python?
How to implement BarChart in ReactJS ? - GeeksforGeeks

04 Mar, 2021
In our React app sometimes we want to display a BarChart representation of a particular data. We can use react-chartjs-2 and chart.js module in ReactJS to display information in BarCharts format. Following are some simple steps to do so:
Step 1: Create a React application using the following command.
npx create-react-app BARCHART_REACT
Step 2: After creating your project folder i.e. BARCHART_REACT, move to it using the following command.
cd BARCHART_REACT
Step 3: After creating the ReactJS application, Install react-chartjs-2 and chart.js modules using the following command.
npm install --save react-chartjs-2 chart.js
Project structure:
Example: Now write down the following code in the App.js file. Here, App is our default component where we have written our code.
App.js
import { Bar } from "react-chartjs-2";  function App() {  return (    <div className="App">      <h1>GEEKSFORGEEKS BAR CHART REACTJS</h1>      <div style={{ maxWidth: "650px" }}>        <Bar          data={{            // Name of the variables on x-axies for each bar            labels: ["1st bar", "2nd bar", "3rd bar", "4th bar"],            datasets: [              {                // Label for bars                label: "total count/value",                // Data or value of your each variable                data: [1552, 1319, 613, 1400],                // Color of each bar                backgroundColor: ["aqua", "green", "red", "yellow"],                // Border color of each bar                borderColor: ["aqua", "green", "red", "yellow"],                borderWidth: 0.5,              },            ],          }}          // Height of graph          height={400}          options={{            maintainAspectRatio: false,            scales: {              yAxes: [                {                  ticks: {                    // The y-axis value will start from zero                    beginAtZero: true,                  },                },              ],            },            legend: {              labels: {                fontSize: 15,              },            },          }}        />      </div>    </div>  );}  export default App;
Step to Run Application: Run the application using the following command from the root directory of the project:
npm start
Output: Now open your browser and go to http://localhost:3000/, you will see the following output:
React-Questions
Technical Scripter 2020
ReactJS
Technical Scripter
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
ReactJS useNavigate() Hook
How to set background images in ReactJS ?
Axios in React: A Guide for Beginners
How to create a table in ReactJS ?
How to navigate on path by button click in react router ?
Remove elements from a JavaScript Array
Installation of Node.js on Linux
Convert a string to an integer in JavaScript
How to insert spaces/tabs in text using HTML/CSS?
Difference between var, let and const keywords in JavaScript
How to Convert string to float type in Golang? - GeeksforGeeks

19 May, 2020
ParseFloat function is an in-build function in the strconv library which converts the string type into a floating-point number with the precision specified by bit size.
Example: In this example the same string -2.514 is being converted into float data type and then their sum is being printed. Once it is converted to 8 bit-size and other times it is 32 bit-size. Both yield different results because ParseFloat accepts decimal and hexadecimal floating-point number syntax. If a1 or a2 is well-formed and near a valid floating-point number, ParseFloat returns the nearest floating-point number rounded using IEEE754 unbiased rounding which is parsing a hexadecimal floating-point value only rounds when there are more bits in the hexadecimal representation than will fit in the mantissa.
// Golang program to Convert// string to float typepackage main  import (    "fmt"    "strconv")  func main() {      // defining a string a1    a1 := "-2.514"      // converting the string a1     // into float and storing it    // in b1 using ParseFloat    b1, _ := strconv.ParseFloat(a1, 8)      // printing the float b1    fmt.Println(b1)      a2 := "-2.514"    b2, _ := strconv.ParseFloat(a2, 32)    fmt.Println(b2)      fmt.Println(b1 + b2)}
Output:
-2.514
-2.5139999389648438
-5.027999938964843

Golang-Program
Golang-strconv
Picked
Go Language
Write From Home
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
6 Best Books to Learn Go Programming Language
How to Parse JSON in Golang?
Strings in Golang
Time Durations in Golang
Structures in Golang
Convert integer to string in Python
Convert string to integer in Python
How to set input type date in dd-mm-yyyy format using HTML ?
Python infinity
Matplotlib.pyplot.title() in Python
How to set font for Text in Tkinter? - GeeksforGeeks

02 Dec, 2020
Prerequisite:  Python GUI – tkinter
Python provides a Tkinter module for GUI (Graphical User Interface). In this article, we are going to see how to set text font in Tkinter.
Text Widget is used where a user wants to insert multi-line text fields. In this article, we are going to learn the approaches to set the font inserted in the text fields of the text widget. It can be done with different methods.
Method 1: Using a tuple and .configure( ) method.
Approach :
Import the tkinter module.
Create a GUI window.
Create our text widget.
Create a tuple containing the specifications of the font. But while creating this tuple, the order should be maintained like this, (font_family, font_size_in_pixel, font_weight). Font_family and font_weight should be passed as a string and the font size as an integer.
Parse the specifications to the Text widget using .configure( ) method.
Below is the implementation of the above approach
Python3
# Import the tkinter moduleimport tkinter  # Creating the GUI window.root = tkinter.Tk()root.title("Welcome to GeekForGeeks") root.geometry("400x240")  # Creating our text widget.sample_text = tkinter.Text( root, height = 10)sample_text.pack()  # Creating a tuple containing # the specifications of the font.Font_tuple = ("Comic Sans MS", 20, "bold")  # Parsed the specifications to the# Text widget using .configure( ) method.sample_text.configure(font = Font_tuple)root.mainloop()
Output :
Method 2: Setting the font using the Font object of tkinter.font
Approach: 
Import the Tkinter module.
Import Tkinter font.
Create the GUI window
Create our text widget.
Create an object of type Font from tkinter.font module. It takes in the desired font specifications(font_family, font_size_in_pixel , font_weight) as a constructor of this object. This is that specified object that the text widget requires while determining its font.
Parse the Font object to the Text widget using .configure( ) method.
Below is the implementation of the above approach:
Python3
# Import moduleimport tkinterimport tkinter.font  # Creating the GUI window.root = tkinter.Tk()root.title("Welcome to GeekForGeeks") root.geometry("918x450")  # Creating our text widget.sample_text=tkinter.Text( root, height = 10)sample_text.pack()  # Create an object of type Font from tkinter.Desired_font = tkinter.font.Font( family = "Comic Sans MS",                                  size = 20,                                  weight = "bold")  # Parsed the Font object # to the Text widget using .configure( ) method.sample_text.configure(font = Desired_font)root.mainloop()
Output:
Python-tkinter
Technical Scripter 2020
Python
Technical Scripter
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
Python Classes and Objects
How to drop one or multiple columns in Pandas Dataframe
Defaultdict in Python
Python | Get unique values from a list
Python | os.path.join() method
Create a directory in Python
Python | Pandas dataframe.groupby()
How to override functions of module in Node.js ? - GeeksforGeeks

10 Oct, 2021
Overriding means not change the original definition of any object or module but changing its behavior in the current scenario (where it has been imported or inherited). In order to implement overriding, we are going to override the function of ‘url‘, the in-built module of nodeJS. Let us look at the steps involved in overriding a module:
First of all, require the module which we want to override.
const url = require('url')
Then delete the function of the module which we want to override. Here we would override the format() function of ‘url‘ module
delete url['format']
Now add the function with the same name ‘format‘ to provide a new definition to the format() function of the module
url.format = function(params...) {
    // statement(s)
}

Now re-export the ‘url‘ module for changes to take effect
module.exports = url
Let us walk through step by step to implement the full working code:
Step 1: Create an “app.js” file and initialize your project with npm.
npm init
The project structure would look like this:
Project/File structure
Step 2: Now let us code the “app.js” file. In it, we follow all the steps mentioned above for overriding a module. After those steps, you would have successfully overridden the format() function of ‘url’ module. Find the full working code below in which the behaviour of format() function before overriding and after it has been shown.
app.js
// Requiring the in-built url module// to overrideconst url = require("url");  // The default behaviour of format()// function of urlconsole.log(url.format("http://localhost:3000/"));  // Deleting the format function of urldelete url["format"];  // Adding new function to url with same// name so that it would overrideurl.format = function (str) {  return "Sorry!! I don't know how to format the url";};  // Re-exporting the module for changes// to take effectmodule.exports = url;  // The new behaviour of export() function// of url moduleconsole.log(url.format("http://localhost:3000/"));
Step 3: Run your node app using the following command. 
node app.js
Output:
output in console
NodeJS-Questions
Picked
Node.js
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Difference between dependencies, devDependencies and peerDependencies
Node.js Export Module
How to connect Node.js with React.js ?
Mongoose find() Function
Mongoose Populate() Method
Remove elements from a JavaScript Array
Convert a string to an integer in JavaScript
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?
Difference between var, let and const keywords in JavaScript