code-rag-bench/online-tutorials huggingface dataset:
Java super Keyword

❮ Java Keywords

Using super to call the superclass of Dog 
(subclass):
class Animal { // Superclass (parent)
  public void animalSound() {
    System.out.println("The animal makes a sound");
  }
}

class Dog extends Animal { // Subclass (child)
  public void animalSound() {
    super.animalSound(); // Call the superclass method
    System.out.println("The dog says: bow wow");
  }
}

public class Main {
  public static void main(String args[]) {
    Animal myDog = new Dog(); // Create a Dog object
    myDog.animalSound(); // Call the method on the Dog object
  }
}


Try it Yourself »

The super keyword refers to superclass 
(parent) objects.
It is used to call superclass methods, and to access the superclass 
constructor.
The most common use of the super keyword is to eliminate 
the confusion between superclasses and subclasses that have methods with the 
same name.
To understand the super keyword, you should have a basic understanding of Inheritance and Polymorphism.
Read more about inheritance (subclasses and superclasses) in our Java Inheritance Tutorial.
Read more about polymorphism in our Java Polymorphism Tutorial.

❮ Java Keywords

We just launchedW3Schools videos
Get certifiedby completinga course today!
If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:
help@w3schools.com
Your message has been sent to W3Schools.
How to convert text to speech in Node.js ?

19 May, 2020
To convert text to speech in Node.js, there are various modules but the most popular among them is gtts(Google Text to Speech) module.
Feature of gtts module:
It is easy to get started and easy to use.It is widely used and popular for converting text to speech.
It is easy to get started and easy to use.
It is widely used and popular for converting text to speech.
Installation of gtts module:
You can visit the link to Install gtts module. You can install this package by using this command.npm install gttsAfter installing gtts module, you can check your gtts version in command prompt using the command.npm version gttsAfter that, you can create a folder and add a file, for example index.js. To run this file you need to run the following command.node index.js
You can visit the link to Install gtts module. You can install this package by using this command.npm install gtts
npm install gtts
After installing gtts module, you can check your gtts version in command prompt using the command.npm version gtts
npm version gtts
After that, you can create a folder and add a file, for example index.js. To run this file you need to run the following command.node index.js
node index.js
Filename: index.js
const gTTS = require('gtts');      var speech = 'Welcome to GeeksforGeeks';var gtts = new gTTS(speech, 'en');  gtts.save('Voice.mp3', function (err, result){    if(err) { throw new Error(err); }    console.log("Text to speech converted!");});
Steps to run the program:
The project structure will look like this:Make sure you have installed gtts module using the following commands:npm install gttsRun index.js file using below command:node index.jsAfter running above command, your text is converted to speech and save in your Voice.mp3 file as shown below:
The project structure will look like this:
Make sure you have installed gtts module using the following commands:npm install gtts
npm install gtts
Run index.js file using below command:node index.js
node index.js
After running above command, your text is converted to speech and save in your Voice.mp3 file as shown below:
So this is how you can use the gtts (Google Text to Speech) module for converting text to speech in Node.js.
Node.js-Misc
Node.js
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Difference between promise and async await in Node.js
Mongoose | findByIdAndUpdate() Function
Installation of Node.js on Windows
JWT Authentication with Node.js
Node.js forEach() function
Top 10 Projects For Beginners To Practice HTML and CSS Skills
Difference between var, let and const keywords in JavaScript
How to insert spaces/tabs in text using HTML/CSS?
How to fetch data from an API in ReactJS ?
Differences between Functional Components and Class Components in React
What is an extern storage class in C language?

There are four storage classes in C programming language, which are as follows −
auto
extern
static
register
The keyword is extern. These variables are declared outside the block.
Scope − Scope of a global variable is available throughout the program.
Scope − Scope of a global variable is available throughout the program.
Default value is zero.
Default value is zero.
The algorithm is given below −
START
Step 1: Declare and initialized extern variable
Step 2: Declare and initialized int variable a=3
Step 3: Print a
Step 4: Call function step 5
Step 5: Called function
Print a (takes the value of extern variable)
Following is the C program for extern storage class −
extern int a =5; /* this ‘a’ is available entire program */
main ( ){
   int a = 3; /* this ‘a' is valid only in main */
   printf ("%d",a);
   fun ( );
}
fun ( ){
   printf ("%d", a);
}
The output is stated below −
3 1
Consider another program for extern storage class −
External.h
extern int a=14;
extern int b=8;
externstorage.c file
#include<stdio.h>
#include "External.h"
int main(){
   int sub = a-b;
   printf("%d -%d = %d ", a, b, sub);
   return 0;
}
The output is stated below −
a-b=6
Python | Pandas Series.values

28 Jan, 2019
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 series is a One-dimensional ndarray with axis labels. The labels need not be unique but must be a hashable type. The object supports both integer- and label-based indexing and provides a host of methods for performing operations involving the index.
Pandas Series.values attribute return Series as ndarray or ndarray-like depending on the dtype.
Syntax:Series.values
Parameter : None
Returns : ndarray
Example #1: Use Series.values attribute to return the values in the given series object as an ndarray.
# importing pandas as pdimport pandas as pd  # Creating the Seriessr = pd.Series(['New York', 'Chicago', 'Toronto', 'Lisbon', 'Rio'])  # Creating the row axis labelssr.index = ['City 1', 'City 2', 'City 3', 'City 4', 'City 5']   # Print the seriesprint(sr)
Output :
Now we will use Series.values attribute to return the values of the given Series object as an ndarray.
# return an ndarraysr.values
Output :
As we can see in the output, the Series.values attribute has returned an ndarray object containing the values of the given Series object. Example #2 : Use Series.values attribute to return the values in the given series object as an ndarray.
# importing pandas as pdimport pandas as pd  # Creating the Seriessr = pd.Series(['1/1/2018', '2/1/2018', '3/1/2018', '4/1/2018'])  # Creating the row axis labelssr.index = ['Day 1', 'Day 2', 'Day 3', 'Day 4']  # Print the seriesprint(sr)
Output :
Now we will use Series.values attribute to return the values of the given Series object as an ndarray.
# return an ndarraysr.values
Output :As we can see in the output, the Series.values attribute has returned an ndarray object containing the values of the given Series object.
Python pandas-series
Python pandas-series-methods
Python-pandas
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
Python | os.path.join() method
How to drop one or multiple columns in Pandas Dataframe
How To Convert Python Dictionary To JSON?
Check if element exists in list in Python
Python | Get unique values from a list
Python | datetime.timedelta() function
GATE | GATE CS 2020 | Question 32

11 Aug, 2021
Consider the following C program.
#include <stdio.h> int main ()  {     int  a[4][5] = {{1, 2, 3, 4, 5},                     {6, 7, 8, 9, 10},                     {11, 12, 13, 14, 15},                     {16, 17, 18, 19, 20}};     printf("%d\n", *(*(a+**a+2)+3));     return(0); }  
The output of the program is _______ .
Note – This question was Numerical Type.(A) 18(B) 19(C) 20(D) 14Answer: (B)Explanation: Given a[4][5] is 2D array. Let starting address (or base address) of given array is 1000.
Therefore,
= *(*(a+**a+2)+3))
= *(*(1000+**1000+2)+3))
= *(*(1000+3)+3))   {given element **1002 = 3}
= *(*(1003)+3))
= *((1003)+3)    {4th row selected in given matrix}
= *((1003)+3)     {address of 4th element in 4th row}
= a[3][3]
= 19            {element selected a[3][3] = 19} 
#include <stdio.h> int main ()  {     int  a[4][5] = {{1, 2, 3, 4, 5},                     {6, 7, 8, 9, 10},                     {11, 12, 13, 14, 15},                     {16, 17, 18, 19, 20}};     printf("%d\n", *(*(a+**a+2)+3));     return(0); }  
Option (B) is correct.
GATE PYQs 2019 and 2020 | Programming and Data Structures | Shubham Agrawal | GeeksforGeeks GATE CSE - YouTubeGeeksforGeeks GATE Computer Science17.5K subscribersGATE PYQs 2019 and 2020 | Programming and Data Structures | Shubham Agrawal | GeeksforGeeks GATE CSEWatch laterShareCopy linkInfoShoppingTap to unmuteIf playback doesn't begin shortly, try restarting your device.More videosMore videosYou're signed outVideos you watch may be added to the TV's watch history and influence TV recommendations. To avoid this, cancel and sign in to YouTube on your computer.CancelConfirmSwitch cameraShareInclude playlistAn error occurred while retrieving sharing information. Please try again later.Watch on0:000:0054:27 / 1:16:33•Live•<div class="player-unavailable"><h1 class="message">An error occurred.</h1><div class="submessage"><a href="https://www.youtube.com/watch?v=fP8QED8d6ws" target="_blank">Try watching this video on www.youtube.com</a>, or enable JavaScript if it is disabled in your browser.</div></div>Quiz of this Question
GATE
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to add a datepicker in form using HTML ?

22 Jul, 2021
We know that a datepicker is used to select a particular date from a calendar. A datepicker is an interactive dropdown that makes it easy to choose the date from a calendar instead of typing it manually. It is generally used to save a birthdate of a user or also used in many cases. 
In this article, we will learn how to add a datepicker in form using HTML5. 
Approach: 
Create an HTML document that contains a form with an input field.
Using a type attribute in input element which is set to “datetime-local“.
Syntax:
<input type="datetime-local">
HTML Code:
HTML
<!DOCTYPE html><html>  <head>              <style>                        body {            text-align: center;        }    </style></head>  <body>      <h2 style="color:green">GeeksforGeeks</h1>          <b> How to add a datepicker in form using HTML    </b>          <br>          <h4>Date Of Birth:      <input type="datetime-local" id="Test_DatetimeLocal">    </h4></body>  </html>                    
Output:
Datepicker modal 
HTML-Attributes
HTML-Questions
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
REST API (Introduction)
Design a Tribute Page using HTML & CSS
Build a Survey Form using HTML and CSS
Angular File Upload
Form validation using jQuery
Installation of Node.js on Linux
Difference between var, let and const keywords in JavaScript
How to fetch data from an API in ReactJS ?
Differences between Functional Components and Class Components in React
Remove elements from a JavaScript Array
Scala String startsWith(String prefix) method with example

29 Oct, 2019
The startsWith(String prefix) method is utilized to check if the stated string starts with the prefix or not that is being specified by us.
Method Definition: Boolean startsWith(String prefix)
Return Type: It returns true if the string starts with the specified prefix else it returns false.
Example: 1#
// Scala program of startsWith()// method  // Creating objectobject GfG{       // Main method    def main(args:Array[String])    {              // Applying startsWith method        val result = "GeeksforGeeks".startsWith("Geeks")                  // Displays output        println(result)          }} 
true

Example: 2#
// Scala program of startsWith()// method  // Creating objectobject GfG{       // Main method    def main(args:Array[String])    {              // Applying startsWith method        val result = "GeeksforGeeks".startsWith("geeks")                  // Displays output        println(result)          }} 
false

Scala
Scala-Method
Scala-Strings
Scala
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Type Casting in Scala
Class and Object in Scala
Scala List filter() method with example
Scala Map
Scala Tutorial – Learn Scala with Step By Step Guide
Scala Lists
Operators in Scala
Scala | Arrays
Scala Constructors
Enumeration in Scala
Executing SQL query with Psycopg2 in Python

17 Oct, 2021
In this article, we are going to see how to execute SQL queries in PostgreSQL using Psycopg2 in Python.
Psycopg2 is a PostgreSQL database driver, it is used to perform operations on PostgreSQL using python, it is designed for multi-threaded applications. SQL queries are executed with psycopg2 with the help of the execute() method.  It is used to Execute a database operation query or command.
Parameters can be provided in the form of a sequence or a mapping, and they’ll be tied to variables in the operation. Positional ( % s) or named ( % (name)s) placeholders are used to specify variables. execute() method returns “none” if the query is properly executed (without errors).
Python3
import psycopg2  conn = psycopg2.connect(    database="geeks", user='postgres',   password='root', host='localhost', port='5432')  conn.autocommit = Truecursor = conn.cursor()  sql = '''CREATE TABLE employees(emp_id int,emp_name varchar, \salary decimal); '''  cursor.execute(sql)  conn.commit()conn.close()
Output:
Python3
import psycopg2  conn = psycopg2.connect(    database="geeks", user='postgres',    password='root', host='localhost', port='5432')  conn.autocommit = Truecursor = conn.cursor()  sql = '''insert into employee values('191351','divit','100000.0'),                                     ('191352','rhea','70000.0'); '''  cursor.execute(sql)  conn.commit()conn.close()
Output:
Python3
import psycopg2  conn = psycopg2.connect(    database="geeks", user='postgres',    password='root', host='localhost', port='5432')  conn.autocommit = Truecursor = conn.cursor()  sql = '''SELECT * FROM employee;'''  cursor.execute(sql)results = cursor.fetchall()print(results)  conn.commit()conn.close()
Output:
[(1216755, ‘raj’, ‘data analyst’, 1000000, 2), (1216756, ‘sarah’, ‘App developer’, 60000, 3), (1216757, ‘rishi’, ‘web developer’, 60000, 1), (1216758, ‘radha’, ‘project analyst’, 70000, 4), (1216759, ‘gowtam’, ‘ml engineer’, 90000, 5), (1216754, ‘rahul’, ‘web developer’, 70000, 5), (191351, ‘divit’, ‘100000.0’, None, None), (191352, ‘rhea’, ‘70000.0’, None, None)]
Picked
Python PostgreSQL
Python Pyscopg2
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
Python | os.path.join() method
How to drop one or multiple columns in Pandas Dataframe
Introduction To PYTHON
How To Convert Python Dictionary To JSON?
Check if element exists in list in Python
Python | datetime.timedelta() function
Python | Get unique values from a list
Java program to count the occurrence of each character in a string using Hashmap

07 Aug, 2021
Given a string, the task is to write a program in Java which prints the number of occurrences of each character in a string.
Examples: 
Input: str = "GeeksForGeeks"
Output:
r 1
s 2
e 4
F 1
G 2
k 2
o 1

Input: str = "Ajit" 
Output: 
A 1
t 1
i 1
j 1 
 
An approach using frequency[] array has already been discussed in the previous post. In this program an approach using Hashmap in Java has been discussed.  
Declare a Hashmap in Java of {char, int}.
Traverse in the string, check if the Hashmap already contains the traversed character or not.
If it is present, then increase its count using get() and put() function in Hashmap.
Once the traversal is completed, traverse in the Hashmap and print the character and its frequency.
Below is the implementation of the above approach.  
Java
// Java program to count frequencies of// characters in string using Hashmapimport java.io.*;import java.util.*;class OccurenceOfCharInString {    static void characterCount(String inputString)    {        // Creating a HashMap containing char        // as a key and occurrences as  a value        HashMap<Character, Integer> charCountMap            = new HashMap<Character, Integer>();         // Converting given string to char array         char[] strArray = inputString.toCharArray();         // checking each char of strArray        for (char c : strArray) {            if (charCountMap.containsKey(c)) {                 // If char is present in charCountMap,                // incrementing it's count by 1                charCountMap.put(c, charCountMap.get(c) + 1);            }            else {                 // If char is not present in charCountMap,                // putting this char to charCountMap with 1 as it's value                charCountMap.put(c, 1);            }        }         // Printing the charCountMap        for (Map.Entry entry : charCountMap.entrySet()) {            System.out.println(entry.getKey() + " " + entry.getValue());        }    }     // Driver Code    public static void main(String[] args)    {        String str = "Ajit";        characterCount(str);    }}
A 1
t 1
i 1
j 1
 
kk9826225
Java-HashMap
Java-Strings
Java Programs
Java-Strings
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Factory method design pattern in Java
Java Program to Remove Duplicate Elements From the Array
Iterate through List in Java
How to Iterate HashMap in Java?
Remove first and last character of a string in Java
Iterate Over the Characters of a String in Java
How to Convert Char to String in Java?
Java Program to find largest element in an array
How to Get Elements By Index from HashSet in Java?
Find the duration of difference between two dates in Java
MySQL SELECT to add a new column to a query and give it a value?

To add column to MySQL query and give it a value, use the below syntax −
select yourColumnName1,yourColumnName2,.....N ,yourValue AS anyAliasName from yourTableName;
Let us first create a table −
mysql> create table DemoTable
(
   Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,
   FirstName varchar(20)
);
Query OK, 0 rows affected (0.84 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable(FirstName) values('John');
Query OK, 1 row affected (0.13 sec)
mysql> insert into DemoTable(FirstName) values('Larry');
Query OK, 1 row affected (0.17 sec)
mysql> insert into DemoTable(FirstName) values('Chris');
Query OK, 1 row affected (0.14 sec)
mysql> insert into DemoTable(FirstName) values('Robert');
Query OK, 1 row affected (0.15 sec)
Following is the query to display all records from the table using select statement −
mysql> select *from DemoTable;
This will produce the following output −
+----+-----------+
| Id | FirstName |
+----+-----------+
| 1  | John      |
| 2  | Larry     |
| 3  | Chris     |
| 4  | Robert    |
+----+-----------+
4 rows in set (0.00 sec)
Following is the query to add column to MySQL and give it a value. Here we have set the value 23 after creating a new column AGE −
mysql> select Id,FirstName,23 AS AGE from DemoTable;
This will produce the following output −
+----+-----------+-----+
| Id | FirstName | AGE |
+----+-----------+-----+
| 1  | John      | 23  |
| 2  | Larry     | 23  |
| 3  | Chris     | 23  |
| 4  | Robert    | 23  |
+----+-----------+-----+
4 rows in set (0.00 sec)
How to call a jQuery library function?

Calling a JavaScript library function is quite easy. You need to use the script tag. As almost everything we do when using jQuery reads or manipulates the document object model (DOM), we need to make sure that we start adding events etc. as soon as the DOM is ready.
If you want an event to work on your page, you should call it inside the $(document).ready() function. Everything inside it will load as soon as the DOM is loaded and before the page contents are loaded.
To do this, we register a ready event for the document as follows:
$(document).ready(function() {
   // do stuff when DOM is ready
});
To call upon any jQuery library function, use HTML script tags:
Live Demo
<html>
   <head>
      <title>jQuery Function</title>
      <script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
      <script>
         $(document).ready(function() {
            $("div").click(function() {alert("Hello, world!");});
         });
      </script>
   </head>
   <body>
      <div id = "mydiv">
         Click on this to see a dialogue box.
      </div>
   </body>
</html>
System tray applications using PyQt5

22 May, 2020
In this article, we will learn how to create a System Tray application using PyQt.
System Tray(or menu bar) is an area on the taskbar in an operating system. You can find this system on the bottom right side of the desktop if you’re using windows, and top right if using macOS. The icons which are visible in this notification area are the ones that run in the foreground. Some of the famous applications which use system tray to function, and they are Windscribe(VPN application) and Adobe Creative Cloud.
Menu bar applications are also useful to minimally control the desktop application using the shortcuts provided in the menu bar icon. One can choose to not open the whole application and still work by just using the options provided on the System Tray. In this article, you will learn how to create these applications.
Below is an example of an application named Windscribe.
Code:
from PyQt5.QtGui import * from PyQt5.QtWidgets import *     app = QApplication([])app.setQuitOnLastWindowClosed(False)  # Adding an iconicon = QIcon("icon.png")  # Adding item on the menu bartray = QSystemTrayIcon()tray.setIcon(icon)tray.setVisible(True)  # Creating the optionsmenu = QMenu()option1 = QAction("Geeks for Geeks")option2 = QAction("GFG")menu.addAction(option1)menu.addAction(option2)  # To quit the appquit = QAction("Quit")quit.triggered.connect(app.quit)menu.addAction(quit)  # Adding options to the System Traytray.setContextMenu(menu)  app.exec_()
Output:
As you can see there is a marker icon on my mac menu bar, and there are three options visible namely Geeks for Geeks, GFG, and quit. By clicking on the last option(quit) you will exit the application.
PyQt-exercise
Python-PyQt
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Different ways to create Pandas Dataframe
Enumerate() in Python
Read a file line by line in Python
Python String | replace()
How to Install PIP on Windows ?
*args and **kwargs in Python
Iterate over a list in Python
Python Classes and Objects
Convert integer to string in Python
4-ZERO-3: Tool to bypass 403/401 - GeeksforGeeks

04 Jan, 2022
4-ZERO-3 is a free and open-source tool available on GitHub. It’s a bash script.4-ZERO-3 is used to bypass 403 and 401 technical obstacles on any domain. Content length matters when performing bypass using the  4-ZERO-3 tool. If you see multiple 200 while bypassing then you must check the content length.  4-ZERO-3 can curl Payload automatically if any bypass is found.
Step 1: Use the following command to install the tool from Github.
git clone https://github.com/Dheerajmadhukar/4-ZERO-3
Step 2: Use the following command to run the tool.
bash 403-bypass.sh 
The tool has been installed and running successfully. Now we will see examples to use the tool.
Example 1: Use the  4-ZERO-3  tool to perform 403/402 bypass using content headers of the domain.
bash 403-bypass.sh -u https://target.com/secret –header
Example 2: Use the  4-ZERO-3  tool to perform 403/402 bypass using content protocols of the domain.
 bash 403-bypass.sh -u https://target.com/secret –protocol
Example 3:Use the  4-ZERO-3  tool to perform  PORT based bypasses/payloads.
bash 403-bypass.sh -u https://target.com/secret –port
Example 4: Use the  4-ZERO-3  tool to perform HTTP Method based bypasses/payloads
bash 403-bypass.sh -u https://target.com/secret –HTTPmethod
Example 4: Use the  4-ZERO-3  tool to perform URL Encoded bypasses/payloads
bash 403-bypass.sh -u https://target.com/secret –encode
Example 5: Use the  4-ZERO-3  tool to perform  MySQL mod_Security & libinjection bypasses/payloads [** New **]
bash 403-bypass.sh -u https://target.com/secret –SQLi
Example 6: Use the  4-ZERO-3  tool to perform complete Scan {includes all exploits/payloads} for an endpoint [ –exploit ]
bash 403-bypass.sh -u https://target.com/secret –exploit
Kali-Linux
Linux-Tools
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Thread functions in C/C++
Basic Operators in Shell Scripting
nohup Command in Linux with Examples
Array Basics in Shell Scripting | Set 1
Named Pipe or FIFO with example C program
chown command in Linux with Examples
mv command in Linux with examples
Docker - COPY Instruction
Start/Stop/Restart Services Using Systemctl in Linux
SED command in Linux | Set 2
Difference between function expression vs declaration in JavaScript - GeeksforGeeks

23 May, 2019
Function Declaration:A Function Declaration( or a Function Statement) defines a function with the specified parameters without requiring a variable assignment. They exist on their own, i.e, they are standalone constructs and cannot be nested within a non-function block. A function is declared using the function keyword.
Syntax:function gfg(parameter1, parameter2) {
 //A set of statements
 }

function gfg(parameter1, parameter2) {
 //A set of statements
 }

Function Expression:A Function Expression works just like a function declaration or a function statement, the only difference is that a function name is NOT started in a function expression, that is, anonymous functions are created in function expressions. The function expressions run as soon as they are defined.
Syntax:var gfg = function(parameter1, parameter2) {
 //A set of statements
 }

var gfg = function(parameter1, parameter2) {
 //A set of statements
 }

Example 1: Using a Function Declaration
<!DOCTYPE html><html>  <head>    <title>Function Declaration</title></head>  <body>    <center>        <h1 style="color:green">GeeksforGeeks</h1>        <h3>Function Declaration</h3>        <script>            function gfg(a, b) {                return a * b;            }            var result = gfg(5, 5);            document.write(result);        </script>    </center></body>  </html>
Output:
25

Example 2: Using a Function Expression
<!DOCTYPE html><html>  <head>    <title>Function Expression</title></head>  <body>    <center>        <h1 style="color:green">GeeksforGeeks</h1>        <h3>Function Expression</h3>        <script>            var gfg = function(a, b) {                return a * b;            }            document.write(gfg(5, 5));        </script>    </center></body>  </html>
Output:
25

Picked
Difference Between
JavaScript
Web Technologies
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 Process and Thread
Stack vs Heap Memory Allocation
Difference Between Method Overloading and Method Overriding in Java
Differences between JDK, JRE and JVM
Convert a string to an integer in JavaScript
Difference between var, let and const keywords in JavaScript
How to calculate the number of days between two dates in javascript?
Differences between Functional Components and Class Components in React
How to append HTML code to a div using JavaScript ?
Groovy - Maps size()

Returns the number of key-value mappings in this Map.
int size()

None.
The size of the map.
Following is an example of the usage of this method −
class Example { 
   static void main(String[] args) { 
      def mp = ["TopicName" : "Maps", "TopicDescription" : "Methods in Maps"] 
      println(mp.size()); 
		
      mp.put("TopicID","1"); 
      println(mp.size()); 
   } 
} 
When we run the above program, we will get the following result −
2 
3 


    52 Lectures 
     8 hours 

 Krishna Sakinala

    49 Lectures 
     2.5 hours 

 Packt Publishing
 Print
 Add Notes
 Bookmark this page
Python PIL | getbands() and getextrema() method - GeeksforGeeks

16 Aug, 2021
Python PIL library contains Image module in which variety of functions are defined. PIL.Image.Image.getbands() This method is used to get the mode (bands) present in an image. 
Syntax: PIL.Image.Image.getbands(image_object [valid image path])Parameters: It takes a parameter image_object i.e it the reference of the image which is opened using open() method or image path can also be mentioned.Return value: Returns a tuple containing the name of each band in this image. For example, getbands on an RGB image returns (“R”, “G”, “B”).
 
Python3
# Importing Image module from PIL packagefrom PIL import Image # Opening a multiband imageim = Image.open(r"C:\Users\Admin\Pictures\images.png") # This returns the bands used in im (image)im1 = Image.Image.getbands(im) print("Multiband image", im1) # Opening a single band imageim2 = Image.open(r"C:\Users\Admin\Pictures\singleband.png") # This returns the band used in im2im3 = Image.Image.getbands(im2) print("Single band image", im3)
Output:  
Multiband image ('R', 'G', 'B')
Single band image ('P', )
 
Gets the minimum and maximum pixel values for each band in the image. 
Syntax: PIL.Image.Image.getextrema(image_object [valid image path])Parameters: It takes a parameter image_object i.e it the reference of the image which is opened using open() method or image path can also be mentioned.Return Value: For a single-band image, a 2-tuple containing the minimum and maximum pixel value. For a multi-band image, a tuple containing one 2-tuple for each band.
 
Python3
# importing Image module from PIL packagefrom  PIL import Image # opening a multiband imageim = Image.open(r"C:\Users\Admin\Pictures\download.png") # getting maximum and minimum pixels of# multiband images (RBG)im1 = Image.Image.getextrema(im) print("Multi band image ", im1) # Opening a single band imageim2 = Image.open(r"C:\Users\Admin\Pictures\singleband.png") # getting maximum and minimum pixels of# single band imageim3 = Image.Image.getextrema(im2) print("Single band image ", im3)
Output:  
Multi band image  ((73, 255), (0, 255), (0, 255))
Single band image  (0, 123)
These images used in above article –Multiband Images 
 
Single band Image 
 
Akanksha_Rai
sumitgumber28
Image-Processing
python-utility
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Read a file line by line in Python
Enumerate() in Python
How to Install PIP on Windows ?
Iterate over a list in Python
Different ways to create Pandas Dataframe
Python String | replace()
Create a Pandas DataFrame from Lists
Python program to convert a list to string
Reading and Writing to text files in Python
Why Makefile?

Compiling the source code files can be tiring, especially when you have to include several source files and type the compiling command every time you need to compile. Makefiles are the solution to simplify this task.
Makefiles are special format files that help build and manage the projects automatically.
For example, let’s assume we have the following source files.
main.cpp
hello.cpp
factorial.cpp
functions.h
main.cpp
The following is the code for main.cpp source file −
#include <iostream>

using namespace std;

#include "functions.h"

int main(){
   print_hello();
   cout << endl;
   cout << "The factorial of 5 is " << factorial(5) << endl;
   return 0;
}
hello.cpp
The code given below is for hello.cpp source file −
#include <iostream>

using namespace std;

#include "functions.h"

void print_hello(){
   cout << "Hello World!";
}
factorial.cpp
The code for factorial.cpp is given below −
#include "functions.h"

int factorial(int n){
   
   if(n!=1){
      return(n * factorial(n-1));
   } else return 1;
}
functions.h
The following is the code for fnctions.h −
void print_hello();
int factorial(int n);
The trivial way to compile the files and obtain an executable, is by running the command −
gcc  main.cpp hello.cpp factorial.cpp -o hello

This command generates hello binary. In this example we have only four files and we know the sequence of the function calls. Hence, it is feasible to type the above command and prepare a final binary.
However, for a large project where we have thousands of source code files, it becomes difficult to maintain the binary builds.
The make command allows you to manage large programs or groups of programs. As you begin to write large programs, you notice that re-compiling large programs takes longer time than re-compiling short programs. Moreover, you notice that you usually only work on a small section of the program ( such as a single function ), and much of the remaining program is unchanged.
In the subsequent section, we see how to prepare a makefile for our project.
 Print
 Add Notes
 Bookmark this page
Prime Palindrome in C++

Suppose we have to find the smallest prime palindrome that is greater than or equal to N. So if the N is 13, then the smallest palindrome will be 101.
To solve this, we will follow these steps −
If N is in range 8 to 11, then return 11
If N is in range 8 to 11, then return 11
for i in range 1 to 99999s := i as a stringr := sreverse rnum := concatenate s and substring of r from index 1, then convert to numberif num >= N and num is prime, then return num
for i in range 1 to 99999
s := i as a string
s := i as a string
r := s
r := s
reverse r
reverse r
num := concatenate s and substring of r from index 1, then convert to number
num := concatenate s and substring of r from index 1, then convert to number
if num >= N and num is prime, then return num
if num >= N and num is prime, then return num
return 0
return 0
Let us see the following implementation to get better understanding −
 Live Demo
#include <bits/stdc++.h>
using namespace std;
class Solution {
   public:
   bool isPrime(int n){
      if(n % 2 == 0 && n > 2) return false;
      for(int i = 3; i * i <= n; i++){
         if(n % i == 0) return false;
      }
      return n != 1 && n != 0;
   }
   int primePalindrome(int N) {
      if(8 <= N && N <= 11) return 11;
      for(int i = 1; i < 100000; i++){
         string s = to_string(i);
         string r = s;
         reverse(r.begin(), r.end());
         int num = stoi(s + r.substr(1));
         if(num >= N && isPrime(num)) return num;
      }
      return 0;
   }
};
main(){
   Solution ob;
   cout << (ob.primePalindrome(105));
}
105
131
Find rows where column value ends with a specific substring in MySQL?

To find rows and update with new value where column value ends with specific substring you need to use LIKE operator.
The syntax is as follows:
UPDATE yourTableName
SET yourColumnName=’yourValue’
WHERE yourColumnName LIKE ‘%.yourString’;
To understand the above syntax, let us create a table. The query to create a table is as follows:
mysql> create table RowEndsWithSpecificString
   -> (
   -> Id int NOT NULL AUTO_INCREMENT,
   -> FileName varchar(30),
   -> PRIMARY KEY(Id)
   -> );
Query OK, 0 rows affected (1.50 sec)
Now you can insert some records in the table using insert command. The query is as follows:
mysql> insert into RowEndsWithSpecificString(FileName) values('MergeSort.c');
Query OK, 1 row affected (0.11 sec)
mysql> insert into RowEndsWithSpecificString(FileName) values('BubbleSortIntroduction.pdf');
Query OK, 1 row affected (0.25 sec)
mysql> insert into RowEndsWithSpecificString(FileName) values('AllMySQLQuery.docx');
Query OK, 1 row affected (0.18 sec)
mysql> insert into RowEndsWithSpecificString(FileName) values('JavaCollections.pdf');
Query OK, 1 row affected (0.16 sec)
mysql> insert into RowEndsWithSpecificString(FileName) values('JavaServlet.pdf');
Query OK, 1 row affected (0.18 sec)
Display all records from the table using select statement. The query is as follows:
mysql> select *from RowEndsWithSpecificString;
The following is the output:
+----+----------------------------+
| Id | FileName                   |
+----+----------------------------+
|  1 | MergeSort.c                |
|  2 | BubbleSortIntroduction.pdf |
|  3 | AllMySQLQuery.docx         |
|  4 | JavaCollections.pdf        |
|  5 | JavaServlet.pdf            |
+----+----------------------------+
5 rows in set (0.00 sec)
Here is the query to find and update where column value ends with specific substring. The following query finds a substring that ends with ‘.docx’ and updates with a new substring which is ‘.pdf’. The query is as follows:
mysql> update RowEndsWithSpecificString
   -> set FileName='IntroductionToCoreJava.pdf'
   -> where FileName LIKE '%.docx';
Query OK, 1 row affected (0.14 sec)
Rows matched: 1 Changed: 1 Warnings: 0
Now check the table records once again. The query is as follows:
mysql> select *from RowEndsWithSpecificString;
The following is the output:
+----+----------------------------+
| Id | FileName                   |
+----+----------------------------+
|  1 | IntroductionToCoreJava.pdf |
|  2 | BubbleSortIntroduction.pdf |
|  3 | IntroductionToCoreJava.pdf |
|  4 | JavaCollections.pdf        |
|  5 | JavaServlet.pdf            |
+----+----------------------------+
5 rows in set (0.00 sec)
D3.js brush() Function - GeeksforGeeks

31 Jul, 2020
The d3.brush() function in D3.js is used to new create a 2-D brush. The brush is generally created SVG element.
Syntax:
d3.brush();

Parameters: This function does not accept any parameters.
Return Value: This function returns a newly created brush.
Example: In this example, we will create a brush of size 600×600 pixels on an SVG element using this method.
HTML
<!DOCTYPE html> <html>       <head>     <title>         D3.js | d3.brush() Function     </title>           <script src =         "https://d3js.org/d3.v4.min.js">     </script> </head>   <body>     <svg width=600 height=600 id="brush"></svg>    <script>                   // Selecting SVG element        d3.select("#brush")        // Creating a brush using the         // d3.brush function        .call( d3.brush()                     // Initialise the brush area: start at         // 0,0 and finishes at given width,height        .extent( [ [0,0], [600,600] ] )             )    </script> </body>   </html> 
Output: The brush is created successfully, you can drag to create rectangles using this brush.
Reference: https://devdocs.io/d3~5/d3-brush#_brush
D3.js
JavaScript
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Difference between var, let and const keywords in JavaScript
Difference Between PUT and PATCH Request
How to get character array from string in JavaScript?
Remove elements from a JavaScript Array
How to filter object array based on attributes?
Roadmap to Become a Web Developer in 2022
Installation of Node.js on Linux
How to fetch data from an API in ReactJS ?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to insert spaces/tabs in text using HTML/CSS?
Python – Strip whitespace from a Pandas DataFrame

To strip whitespace, whether its leading or trailing, use the strip() method. At first, let us import thr required Pandas library with an alias −
import pandas as pd
Let’s create a DataFrame with 3 columns. The first column is having leading and trailing whitespaces −
dataFrame = pd.DataFrame({
   'Product Category': [' Computer', ' Mobile Phone', 'Electronics ', 'Appliances', ' Furniture', 'Stationery'],'Product Name': ['Keyboard', 'Charger', 'SmartTV', 'Refrigerators', 'Chairs', 'Diaries'],'Quantity': [10, 50, 10, 20, 25, 50]})


Removing whitespace from a single column “Product Category” −
dataFrame['Product Category'].str.strip()
Following is the complete code −
import pandas as pd

# create a dataframe with 3 columns
dataFrame = pd.DataFrame({
   'Product Category': [' Computer', ' Mobile Phone', 'Electronics ', 'Appliances', ' Furniture', 'Stationery'],'Product Name': ['Keyboard', 'Charger', 'SmartTV', 'Refrigerators', 'Chairs', 'Diaries'],'Quantity': [10, 50, 10, 20, 25, 50]})

# removing whitespace from a single column
dataFrame['Product Category'].str.strip()

# dataframe
print"Dataframe after removing whitespaces...\n",dataFrame


This will produce the following output −
Dataframe after removing whitespaces...
   Product Category   Product Name   Quantity
0         Computer      Keyboard           10
1     Mobile Phone       Charger           50
2      Electronics       SmartTV           10
3       Appliances Refrigerators           20
4        Furniture        Chairs           25
5       Stationery       Diaries           50
Debugging Dbt: When Your Table Name is a Reserved Keyword | by Madison Schott | Towards Data Science

Welcome to my newest series- debugging dbt. As an analytics engineer, I use dbt every day in my job to write robust data models. It is a great tool for simplifying and containerizing the way data models run. While it makes things easier, there are still things I am constantly learning about the tool. I wanted to use my struggles and learnings as a way to teach others within the community that may run into the same issues.
Today I will be addressing a problem I had using Snowflake tables with the same name as reserved keywords. If you are using Fivetran to ingest your data, then you may experience a similar issue.
Two data sources that we ingest using Fivetran are Zendesk and Shopify. Both of these sources contain tables with the names order and group. Because these words are considered reserved keywords in many databases, in my case Snowflake, then we are going to run into some issues running them with dbt.
This may show up in the form of an error that looks like this:
SQL compilation error: syntax error line 1 at position 26 unexpected 'group'. syntax error line 1 at position 31 unexpected '<EOF>'.
How to fix this:
Go to the src.yml file that contains the database/schema information for your corresponding source table.Under the name of you table add identifier and the name of the table.
Go to the src.yml file that contains the database/schema information for your corresponding source table.
Under the name of you table add identifier and the name of the table.
identifier: ORDER# or identifier: GROUP
3. Also add another line that says quoting and sets the nested identifier to be true.
quoting:  identifier: true
Adding these few things to your src.yml file for these sources changes the way the SQL is compiled in dbt. Instead of reading your source tables as
select * from raw.zendesk.group
it will now be read as
select * from raw.zendesk."GROUP"
The changes simply add quotes to the table name which lets SQL know that this is actually the table’s name rather than a reserved keyword.
Issues like these often manifest themselves in many different types of error messages. It can be hard to get to exactly what is causing a certain issue, but it often ends up being fairly simple. Be sure to follow to stay updated on the rest of my Debugging Dbt series. Next up is incremental models!
Add an autoincrement column with a custom start value in MySQL

To add a new column to an already created table, use ALTER TABLE and ADD COLUMN. Use AUTO_INCREMENT to set auto increment custom value.
Let us first create a table −
mysql> create table DemoTable
   -> (
   -> StudentName varchar(20)
   -> );
Query OK, 0 rows affected (0.63 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable values('Robert');
Query OK, 1 row affected (0.12 sec)
mysql> insert into DemoTable values('Adam');
Query OK, 1 row affected (0.13 sec)
mysql> insert into DemoTable values('Mike');
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 output −
+-------------+
| StudentName |
+-------------+
| Robert      |
| Adam        |
| Mike        |
+-------------+
3 rows in set (0.00 sec)
Following is the query to add an autoincrement column with start value −
mysql> alter table DemoTable add column StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY,AUTO_INCREMENT=1000;
Query OK, 0 rows affected (1.83 sec)
Records: 0 Duplicates: 0 Warnings: 0
Let us check the table records once again −
mysql> select *from DemoTable;
This will produce the following output −
+-------------+-----------+
| StudentName | StudentId |
+-------------+-----------+
| Robert      |      1000 |
| Adam        |      1001 |
| Mike        |      1002 |
+-------------+-----------+
3 rows in set (0.00 sec)
Auto-scrolling animation in React.js using react-spring

In this article, we will see how to create a scroll to top animation in React JS using the react-spring package.
First create a react project −
npx create-react-app tutorialpurpose
Now go to the project directory −
cd tutorialpurpose
Install the react-spring package −
npm install react-spring
react-spring is used to add Spring concept based animations to our website.
Next,Add the following lines of code in App.js −
import React,{useState} from 'react'
import { useSpring, animated } from 'react-spring'

export default function App(){
   const [flip, set] = useState(false)

   const words = ['We', 'came.', 'We', 'saw.', 'We', 'hold', 'it s', 'hands.']

   const { scroll } = useSpring({
      scroll: (words.length - 1) * 50,
      from: { scroll: 0 },
      reset: true,
      reverse: flip,
      delay: 200,
      onRest: () => set(!flip),
   })
   return (
      <animated.div
      style={{
         position: 'relative',
         width: '100%',
         height: 60,
         overflow: 'auto',
         fontSize: '1em',
         marginTop:200 ,
         border:"1px solid black"
      }}
      scrollTop={scroll}>
      {words.map((word, i) => (
         <div
            key={`${word}_${i}`}
            style={{ width: '100%', height: 50, textAlign: 'center' }}>
            {word}
         </div>
      ))}
      </animated.div>
   )
}
In the scroll attribute of spring object, we defined how much we have to scroll. If you change the value from 50 to 20, it will only scroll three words
The from attribute indicates from where to start scrolling; "0" means start scrolling from the beginning.
We also have some extra attributes like
reset which is meant for looping
reset which is meant for looping
reverse signifies when the counting should start or end,
reverse signifies when the counting should start or end,
delay to introduce time delay between animation, and
delay to introduce time delay between animation, and
onRest indicates what to do on when the counting stops.
onRest indicates what to do on when the counting stops.
On execution, it will produce the following output −
Your browser does not support HTML5 video.
Tryit Editor v3.7

HTML Input types
Tryit: default text on submit button
How can we provide an alias name for an action method in Asp .Net MVC C#?

ActionName attribute is an action selector which is used for a different name of the
action method. We use ActionName attribute when we want that action method to be
called with a different name instead of the actual name of the method.
[ActionName("AliasName")]
using System.Collections.Generic;
using System.Web.Mvc;
namespace DemoMvcApplication.Controllers{
   public class HomeController : Controller{
      [ActionName("ListCountries")]
      public ViewResult Index(){
         ViewData["Countries"] = new List<string>{
            "India",
            "Malaysia",
            "Dubai",
            "USA",
            "UK"
         };
         return View();
      }
   }
}
@{
   ViewBag.Title = "Countries List";
}
<h2>Countries List</h2>
<ul>
@foreach(string country in (List<string>)ViewData["Countries"])
{
   <li>@country</li>
}
In the above since we have provided a different action name for the Index method,
when we try to navigate with action name Index will get 404 error.
Now let us try to navigate using ListCountries action name.