code-rag-bench/online-tutorials huggingface dataset:
How to rotate X-axis tick labels in Pandas bar plot?

Using plt.xticks(x, labels, rotation='vertical'), we can rotate our tick’s label.
Create two lists, x, and y.
Create two lists, x, and y.
Create labels with a list of different cities.
Create labels with a list of different cities.
Adjust the subplot layout parameters, where bottom = 0.15.
Adjust the subplot layout parameters, where bottom = 0.15.
Add a subplot to the current figure, where nrow = 1, ncols = 2 and index = 1.
Add a subplot to the current figure, where nrow = 1, ncols = 2 and index = 1.
Plot the line using plt.plot(), using x and y (Step 1).
Plot the line using plt.plot(), using x and y (Step 1).
Get or set the current tick locations and labels of the X-axis. Pass no arguments to return the current values without modifying them, with x and label data.
Get or set the current tick locations and labels of the X-axis. Pass no arguments to return the current values without modifying them, with x and label data.
Set or retrieve auto-scaling margins, value is 0.2.
Set or retrieve auto-scaling margins, value is 0.2.
Set the title of the figure at index 1, the title is "Horizontal tick label".
Set the title of the figure at index 1, the title is "Horizontal tick label".
Add a subplot to the current figure, where nrow = 1, ncols = 2 and index = 2.
Add a subplot to the current figure, where nrow = 1, ncols = 2 and index = 2.
Plot line using plt.plot() method, using x and y (Step 1).
Plot line using plt.plot() method, using x and y (Step 1).
Get or set the current tick locations and labels of the X-axis. Pass no arguments to return the current values without modifying them, with x, label data, and rotation = ’vertical’.
Get or set the current tick locations and labels of the X-axis. Pass no arguments to return the current values without modifying them, with x, label data, and rotation = ’vertical’.
Set or retrieve auto-scaling margins, value is 0.2.
Set or retrieve auto-scaling margins, value is 0.2.
Set the title of the figure at index 2, the title is "Vertical tick label".
Set the title of the figure at index 2, the title is "Vertical tick label".
Use plt.show() to show the figure.
Use plt.show() to show the figure.
import matplotlib.pyplot as plt

x = [1, 2, 3, 4]
y = [1, 4, 9, 6]
labels = ['Delhi', 'Mumbai', 'Hyderabad', 'Chennai']
plt.subplots_adjust(bottom=0.15)

plt.subplot(121)
plt.plot(x, y)
plt.xticks(x, labels)
plt.margins(0.2)
plt.title("Horizontal tick label")

plt.subplot(122)
plt.plot(x, y)
plt.xticks(x, labels, rotation='vertical')
plt.margins(0.2)
plt.title("Vertical tick label")

plt.show()
Python String | min()

07 Jan, 2018
min() is an inbuilt function in Python programming language that returns the minimum alphabetical character in a string.
Syntax:
min(string)
Parameter:min() method takes a string as a parameter
Return value:
Returns a character which is alphabetically the lowest character in the string.
Below is the Python implementation of the method min()
# python program to demonstrate the use of # min() function   # minimum alphabetical character in # "geeks" string = "geeks" print(min(string))  # minimum alphabetical character in # "raj"string = "raj" print(min(string))
Output:
e
a

python-string
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
list pop_front() function in C++ STL

13 Jun, 2022
The list::pop_front() is a built-in function in C++ STL which is used to remove an element from the front of a list container. This function thus decreases the size of the container by 1 as it deletes the element from the front of a list. Syntax:
list_name.pop_front();
Parameters: The function does not accept any parameter. Return Value: This function does not returns anything. Below program illustrate the list::pop_front() function in C++ STL: 
CPP
// CPP program to illustrate the// list::pop_front() function#include <bits/stdc++.h>using namespace std; int main(){ // Creating a list list<int> demoList;  // Adding elements to the list // using push_back() demoList.push_back(10); demoList.push_back(20); demoList.push_back(30); demoList.push_back(40);  // Initial List: cout << "Initial List: "; for (auto itr = demoList.begin(); itr != demoList.end(); itr++)  cout << *itr << " ";  // removing an element from the front of List // using pop_front demoList.pop_front();  // List after removing element from front cout << "\n\nList after removing an element from front: "; for (auto itr = demoList.begin(); itr != demoList.end(); itr++)  cout << *itr << " ";  return 0;}
Initial List: 10 20 30 40 

List after removing an element from front: 20 30 40
Time Complexity: O(n)
Auxiliary Space: O(1)
utkarshgupta110092
CPP-Functions
cpp-list
STL
C++
STL
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Bitwise Operators in C/C++
Set in C++ Standard Template Library (STL)
vector erase() and clear() in C++
unordered_map in C++ STL
Inheritance in C++
Priority Queue in C++ Standard Template Library (STL)
Substring in C++
Object Oriented Programming in C++
C++ Classes and Objects
Sorting a vector in C++
How to Install Face Recognition in Python on Linux?

16 Oct, 2021
In this article, we will learn how to install Face Recognition in Python on Linux. This package is used to recognize and manipulate faces from Python or from the command line with the world’s simplest face recognition library.
Follow the below steps to install the Face Recognition package on Linux using pip:
Step 1: Install the latest Python3 in Linux
Step 2: Check if pip3 and python3 are correctly installed.
python3 --version
pip3 --version
Step 3: Upgrade your pip to avoid errors during installation.
pip3 install --upgrade pip
Step 4: Enter the following command to install Face Recognition using pip3.
pip3 install face-recognition
Follow the below steps to install the Face Recognition package on Linux using the setup.py file:
Step 1: Download the latest source package of Face Recognition for python3 from here.
curl https://files.pythonhosted.org/packages/92/aa/fd00864e0bab93d084879bf149cb25d87850887199f0f1bebd16f926f3dc/face_recognition-0.1.11.tar.gz > face_recognition.tar.gz
Step 2: Extract the downloaded package using the following command.
tar -xvzf face_recognition.tar.gz
Step 3: Go inside the folder and Enter the following command to install the package.
cd face_recognition-0.1.11
python3 setup.py install
Make the following import in your python terminal to verify if the installation has been done properly:
import face_recognition
If there is any error while importing the module then is not installed properly.
how-to-install
Picked
How To
Installation Guide
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Set Git Username and Password in GitBash?
How to Install and Use NVM on Windows?
How to Install Jupyter Notebook on MacOS?
How to Install Python Packages for AWS Lambda Layers?
How to Add External JAR File to an IntelliJ IDEA Project?
Installation of Node.js on Linux
Installation of Node.js on Windows
How to Install and Use NVM on Windows?
How to Install Jupyter Notebook on MacOS?
How to Add External JAR File to an IntelliJ IDEA Project?
Tryit Editor v3.7

Tryit: Unordered HTML list
Fabric.js | Circle fill Property - GeeksforGeeks

12 May, 2020
In this article, we are going to see how to change the fill color of a canvas circle using FabricJS. The canvas means the circle is movable and can be stretched according to requirement. Further, the circle can be customized when it comes to initial stroke color, fill color, stroke width, or radius.
Approach: To make it possible we are going to use a JavaScript library called FabricJS. After importing the library using CDN, we will create a canvas block in the body tag which will contain our circle. After this, we will initialize instances of Canvas and Circle provided by FabricJS and change the fill color of the circle using fill property and render the Circle on the Canvas as given in the example below.
Syntax:
fabric.Circle({
    radius: number,
    fill: string
}); 
Parameters: This function accepts two parameters as mentioned above and described below:
radius: It specifies the radius of circle.
fill: It specifies the color to be filled into the circle.
Example: This example uses FabricJS to change the fill color of a canvas circle.
<!DOCTYPE html><html>  <head>    <title>        Fabric.js | Circle fill Property    </title>      <!-- FabricJS CDN -->    <script src="https://cdnjs.cloudflare.com/ajax/libs/fabric.js/3.6.2/fabric.min.js">    </script></head>  <body>    <canvas id="canvas" width="600" height="200"        style="border:1px solid #000000">    </canvas>      <script>          // Initiate a Canvas instance        var canvas = new fabric.Canvas("canvas");          // Initiate a Circle instance        var circle = new fabric.Circle({            radius: 50,            fill: 'green'        });          // Render the circle in canvas        canvas.add(circle);    </script></body>  </html>
Output:
Fabric.js
JavaScript
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Convert a string to an integer in JavaScript
Difference between var, let and const keywords in JavaScript
Differences between Functional Components and Class Components in React
How to append HTML code to a div using JavaScript ?
How to Open URL in New Tab using JavaScript ?
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?
GitLab CI - Install Runner

GitLab runner is a build instance which is used to run the jobs over multiple machines and send the results to GitLab. In this chapter, we will discuss about how to install runner in the GitLab CI.
Step 1 − First, login to your GitLab server using SSH (Secure Shell).
Step 2 − Update the repository by using the below command −
$ sudo apt-get update -y
Step 3 − Next, install the required dependencies −
sudo apt-get install wget curl gcc checkinstall libxml2-dev
sudo apt-get install libxslt-dev libcurl4-openssl-dev
sudo apt-get install libreadline6-dev libc6-dev libssl-dev
sudo apt-get install libmysql++-dev make build-essential
zlib1g-dev
sudo apt-get install openssh-server git-core libyaml-dev
sudo apt-get install redis-server postfix libpq-dev libicudev
Step 4 − Now, install the Ruby by creating a directory under /tmp folder −
mkdir /tmp/ruby && cd /tmp/ruby
Step 5 − Install the Ruby package with the below command −
curl --progress http://cache.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p353.tar.bz2 | tar xj
cd ruby-2.0.0-p353
./configure –disable-install-rdoc && make && sudo make install
Step 6 − After installing the Ruby, install the package manager for Ruby −
sudo gem install bundler 
Step 7 − Now create a new user to run the runner instead of running as root user. (For security reasons, we are creating new user) −
sudo adduser –disabled-login –gecos 'GitLab CI Runner' gitlab_ci_runner
Step 8 − Login with new user −
sudo su gitlab_ci_runner
cd ~/
Step 9 − Now clone the actual code after installing all dependencies −
git clone https://gitlab.com/gitlab-org/gitlab-ci-runner.git && cd gitlab-ci-runner
Step 10 − Next, install the gems for the runner −
bundle install –-deployment
Step 10 − Your need to start runner automatically whenever the server restarts by creating the init.d file −
cd /gitlab-ci-runner
sudo cp ./lib/support/init.d/gitlab_ci_runner /etc/init.d/gitlab-ci-runner
sudo chmod +x /etc/init.d/gitlab-ci-runner
sudo update-rc.d gitlab-ci-runner defaults 21
Step 11 − Now you can start the runner by using the below command −
sudo service gitlab-ci-runner start
 Print
 Add Notes
 Bookmark this page
getchar_unlocked() in C

The function getchar_unlocked() is deprecated in Windows because it is a thread unsafe version of getchar(). It is suggested not to use getchar_unlocked(). There is no stream lock check that’s why getchar_unlocked is unsafe. The function getchar_unlocked() is faster than getchar().
Here is the syntax of getchar_unlocked() in C language,
int getchar_unlocked(void);
A program of getchar_unlocked() in C is as follows −
 Live Demo
#include <stdio.h>

int main() {
   char val;
   val = getchar_unlocked();
   printf("Enter the character : \n");
   printf("Entered character : %c", val);
   return 0;
}
Here is the output
Enter the character : a
Entered character : a
HTML - <comment> and <!--....--> Tag

The HTML <comment> tag allows authors to comment their HTML code. This tag is supported by IE only.
It is recommended to use <!--....--> to comment your tags. This tag is compatible to all browsers.
Note − The <comment> tag deprecated in HTML5. Do not use this element.
<!DOCTYPE html>
<html>

   <head>
      <title>HTML <!--....--> Tag</title>
   </head>

   <body>
      <comment>This is a commented line in IE</comment>
      
      <!-- This is a commented line supported by almost every browser.
         It will not appear in output as its a comment. 
      -->
   </body>

</html>
This will produce the following result −
Browser Support for <comment> tag
Browser Support for <!--...--> tag

    19 Lectures 
     2 hours 

 Anadi Sharma

    16 Lectures 
     1.5 hours 

 Anadi Sharma

    18 Lectures 
     1.5 hours 

 Frahaan Hussain

    57 Lectures 
     5.5 hours 

 DigiFisk (Programming Is Fun)

    54 Lectures 
     6 hours 

 DigiFisk (Programming Is Fun)

    45 Lectures 
     5.5 hours 

 DigiFisk (Programming Is Fun)
 Print
 Add Notes
 Bookmark this page
Tryit Editor v3.6 - Show Sass

/* Define standard variables and values for website */
$bgcolor: lightblue;
$textcolor: darkblue;
$fontsize: 18px;

/* Use the variables */
body {
  background-color: $bgcolor;
  color: $textcolor;
  font-size: $fontsize;
}

body {
  background-color: lightblue;
  color: darkblue;
  font-size: 18px;
}

<!DOCTYPE html>
<html>
<link rel="stylesheet" href="mystyle.css">
<body>

<h1>Hello World</h1>

<p>This is a paragraph.</p>

</body>
</html>
This is a paragraph.
matplotlib.pyplot.arrow() in Python

20 Jul, 2021
Matplotlib is a very powerful plotting library useful for those working with Python and NumPy. And for making statistical interference, it becomes very necessary to visualize our data and Matplotlib is the tool that can be very helpful for this purpose. It provides MATLAB like interface only difference is that it uses Python and is open source.
This function adds the arrow to the graph based on the coordinates passed to it. 
Syntax: matplotlib.pyplot.arrow(x, y, dx, dy, **kwargs)Parameters: x, y: The x and y coordinates of the arrow base. dx, dy: The length of the arrow along x and y direction. **kwargs: Optional arguments that helps in adding properties to arrow, like adding color to arrow, changing width of arrow  
Example #1  
Python3
import matplotlib.pyplot as plt  # Initializing values# of x and yx =[1, 2, 3, 4, 5]y =[2, 4, 6, 8, 10] # Plotting the graphplt.plot(x, y) # Adding an arrow to graph starting# from the base (2, 4) and with the# length of 2 units from both x and y# And setting the width of arrow for# better visualizationplt.arrow(2, 4, 2, 2, width = 0.05) # Showing the graphplt.show()
Output: 
Example 2#  
Python3
import matplotlib.pyplot as plt  x =[1, 2, 3, 4, 5]y =[2, 4, 6, 8, 10] plt.plot(x, y) # Increasing head_width of# the arrow by setting# head_width parameterplt.arrow(2, 4, 2, 2,          head_width = 0.2,          width = 0.05) plt.show()
Output: 
Example #3  
Python3
import matplotlib.pyplot as plt  x =[1, 2, 3, 4, 5]y =[2, 4, 6, 8, 10]plt.plot(x, y) # changing the edge color# to greenplt.arrow(2, 4, 2, 2,          head_width = 0.2,          width = 0.05,          ec ='green') plt.show()
Output: 
 
arorakashish0911
Python-matplotlib
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Iterate over a list in Python
How to iterate through Excel rows in Python?
Enumerate() in Python
Python Dictionary
Python OOPs Concepts
Different ways to create Pandas Dataframe
*args and **kwargs in Python
Python Classes and Objects
Introduction To PYTHON
Stack in Python
How to store a NULL value in a particular column of a DB2 table using COBOL-DB2 program?

We will make use of NULL indicator in order to store a NULL value in any column of a DB2 table. Firstly, we should move a value -1 in the NULL indicator in our COBOL-DB2 program. After that we execute UPDATE or INSERT query to store the NULL value.
For example, if we have to update a NULL value in the ORDER_DESCRIPTION column of
the ORDER table where ORDER_ID is 3345612.
A020-UPDATE-ORDERS.
   MOVE -1 TO ORDER-DESCRIPTION-N
   MOVE SPACES TO ORDER-DESCRIPTION-DATA
   EXEC SQL
      UPDATE ORDERS
         SET ORDER_DESCRIPTION =
            :ORDER-DESCRIPTION-DATA
   :ORDER-DESCRIPTION-N
   WHERE ORDER_ID = ‘3345612’
END-SQL.
ORDER-DESCRIPTION-N is the NULL indicator here. The important point to note here is that the second line in the paragraph i.e the line highlighted with orange is optional. Once we have moved -1 in the null indicator then no matter what value we give in the data field,
only NULL value will be stored in DB2 table.
list empty() function in C++ STL

20 Jun, 2018
The list::empty() is a built-in function in C++ STL is used to check whether a particular list container is empty or not. This function does not modifies the list, it simply checks whether a list is empty or not, i.e. the size of list is zero or not.
Syntax:
list_name.empty() 

Parameters: This function does not accept any parameter, it simply checks whether a list container is empty or not.
Return Value: The return type of this function is boolean. It returns True is the size of the list container is zero otherwise it returns False.
Below program illustrates the list::empty() function.
// CPP program to illustrate the// list::empty() function#include <bits/stdc++.h>using namespace std;  int main(){    // Creating a list    list<int> demoList;      // check if list is empty    if (demoList.empty())        cout << "Empty List\n";    else        cout << "Not Empty\n";      // Add elements to the List    demoList.push_back(10);    demoList.push_back(20);    demoList.push_back(30);    demoList.push_back(40);      // check again if list is empty    if (demoList.empty())        cout << "Empty List\n";    else        cout << "Not Empty\n";      return 0;}
Empty List
Not Empty

Note: This function works in constant time complexity.
CPP-Functions
cpp-list
STL
C++
STL
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Bitwise Operators in C/C++
Set in C++ Standard Template Library (STL)
vector erase() and clear() in C++
unordered_map in C++ STL
Inheritance in C++
Substring in C++
C++ Classes and Objects
Sorting a vector in C++
Object Oriented Programming in C++
Priority Queue in C++ Standard Template Library (STL)
Moment.js moment().daysInMonth() Function

29 Jul, 2020
The moment().daysInMonth() function is used to get the number of days in month of a particular month in Node.js. It returns an integer denoting the number of days.
Syntax:
moment().daysInMonth();
Parameters: This function has no parameter.
Return Value: This function returns integer.
Installation of moment module:
You can visit the link to Install moment module. You can install this package by using this command.npm install momentAfter installing the moment module, you can check your moment version in command prompt using the command.npm version momentAfter that, you can just create a folder and add a file for example, index.js as shown below.
You can visit the link to Install moment module. You can install this package by using this command.npm install moment
npm install moment
After installing the moment module, you can check your moment version in command prompt using the command.npm version moment
npm version moment
After that, you can just create a folder and add a file for example, index.js as shown below.
Example 1: Filename: index.js
// Requiring the moduleconst moment = require('moment');  // Function callvar result = moment("2020-02", "YYYY-MM").daysInMonth()   console.log("No of days in 2020-02 is:", result)
Steps to run the program:
The project structure will look like this:Run index.js file using below command:node index.jsOutput:No of days in 2020-02 is: 29

The project structure will look like this:
Run index.js file using below command:node index.jsOutput:No of days in 2020-02 is: 29

node index.js
Output:
No of days in 2020-02 is: 29

Example 2: Filename: index.js
// Requiring the moduleconst moment = require('moment');   function getNoOfDays(date) {   return moment(date, "YYYY-MM").daysInMonth() }   // Function callvar result = getNoOfDays("2019-03");console.log("No of days in given date is:", result)
Steps to run the program:
The project structure will look like this:Run index.js file using below command:node index.jsOutput:No of days in given date is: 31

The project structure will look like this:
Run index.js file using below command:node index.jsOutput:No of days in given date is: 31

node index.js
Output:
No of days in given date is: 31

Reference: https://momentjs.com/docs/#/displaying/days-in-month/
Moment.js
Node.js
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Installation of Node.js on Windows
JWT Authentication with Node.js
Difference between dependencies, devDependencies and peerDependencies
Mongoose Populate() Method
Mongoose find() 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
How can I return multiple values from a function?

21 Sep, 2018
We all know that a function in C can return only one value. So how do we achieve the purpose of returning multiple values.Well, first take a look at the declaration of a function.
int foo(int arg1, int arg2);
So we can notice here that our interface to the function is through arguments and return value only. (Unless we talk about modifying the globals inside the function)
Let us take a deeper look...Even though a function can return only one value but that value can be of pointer type. That’s correct, now you’re speculating right!We can declare the function such that, it returns a structure type user defined variable or a pointer to it . And by the property of a structure, we know that a structure in C can hold multiple values of asymmetrical types (i.e. one int variable, four char variables, two float variables and so on...)
If we want the function to return multiple values of same data types, we could return the pointer to array of that data types.
We can also make the function return multiple values by using the arguments of the function. How? By providing the pointers as arguments.
Usually, when a function needs to return several values, we use one pointer in return instead of several pointers as arguments.
Please see How to return multiple values from a function in C or C++? for more details.
C-Functions
c-puzzle
C Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Substring in C++
Function Pointer in C
Left Shift and Right Shift Operators in C/C++
Different Methods to Reverse a String in C++
std::string class in C++
Unordered Sets in C++ Standard Template Library
rand() and srand() in C/C++
Enumeration (or enum) in C
C Language Introduction
Power Function in C/C++
HTML <picture> Tag

20 May, 2021
The <picture> tag in HTML is used to give flexibility to the web-developers to specify image resources. The <picture> tag contains <source> and <img> tags. The attribute value is set to load more appropriate image. The <img> element is used for the last child element of the picture declaration block. The <img> element is used to provide backward compatibility for browsers that do not support the element, or if none of the source tags matched. 
The <picture> tag is similar to <video> and <audio>. We add different sources, and the first source that fits the preferences is the one that will be used.
Syntax: 
<picture>
    Image and source tag
<picture>
Below example illustrates the <picture> tag in HTML:
Example: 
html
<!DOCTYPE html><html>  <head>    <style>        body {            text-align: center;        }                  h1 {            color: green;        }    </style></head>  <body>    <h1>GeeksforGeeks</h1>      <h2>HTML <picture> Tag</h2>      <picture>        <source media="(min-width: 700px)"                 srcset="https://media.geeksforgeeks.org/wp-content/uploads/20190825000042/geeks-221.png">          <source media="(min-width: 450px)"                 srcset="https://media.geeksforgeeks.org/wp-content/uploads/20190802021607/geeks14.png">          <img src="https://media.geeksforgeeks.org/wp-content/uploads/20190808102629/geeks15.png"              alt="GFG" style="width:auto;">    </picture></body>  </html>
Output:  
Supported Browsers: 
Google Chrome 38.0
Internet Explorer 13.0
Firefox 38.0
Safari 9.1
Opera 25.0
ghoshsuman0129
HTML-Tags
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to update Node.js and NPM to next version ?
REST API (Introduction)
CSS to put icon inside an input element in a form
Types of CSS (Cascading Style Sheet)
Design a Tribute Page using HTML & CSS
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
Random nextGaussian() method in Java with Examples

07 Jan, 2019
The nextGaussian() method of Random class returns the next pseudorandom, Gaussian(normally) distributed double value with mean 0.0 and standard deviation 1.0 from the random number generator’s sequence.
Syntax:
public double nextGaussian()

Parameters: The function does not accepts any parameter.
Return Value: This method returns the next pseudorandom Gaussian distributed double number with mean 0.0 and standard deviation 1.0.
Exception: The function does not throws any exception.
Program below demonstrates the above mentioned function:
Program 1:
// program to demonstrate the// function java.util.Random.nextGaussian()  import java.util.*;public class GFG {    public static void main(String[] args)    {          // create random object        Random r = new Random();          // check next Gaussian value and print it        System.out.println("Next Gaussian value is = "                           + r.nextGaussian());    }}
Next Gaussian value is = 0.3350871100964153

Program 2:
// program to demonstrate the// function java.util.Random.nextGaussian()  import java.util.*;public class GFG {    public static void main(String[] args)    {          // create random object        Random r = new Random();          // check next Gaussian value and print it        System.out.println("Next Gaussian value is = "                           + r.nextGaussian());    }}
Next Gaussian value is = 1.5685150659018154

Java-Functions
Java-Random
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Object Oriented Programming (OOPs) Concept in Java
How to iterate any Map in Java
Interfaces in Java
HashMap in Java with Examples
ArrayList in Java
Collections in Java
Stream In Java
Multidimensional Arrays in Java
Singleton Class in Java
Set in Java
Convert DataFrame with Date Column to Time Series Object in R

23 May, 2021
In this article, we will discuss how to convert dataframe with date column to time series object in the R programming language.
Time series object are a series of data points in which each data point is associated with a timestamp. For example, is a price of a stock in the stock market at different points of time. The data for the time series is stored in an R object called time-series object. These are also called as xts / zoo Object.
To convert the given dataframe with the date column to the time series object, the user first needs to import and load the xts package.
Syntax:
install.packages(“xts”)                   
library(“xts”)
The user then needs to call the xts() function with the required parameters the main need to call this function is to create the time-series object in R language and at the end use is.xts() function we will be conforming to the time-series object created by xts() function in R language.
 xts() function is basically used as the constructor for creating an extensible time-series object.
Syntax:
xts(x = NULL, order.by = index(x), frequency = NULL,  unique = TRUE, tzone = Sys.getenv(“TZ”),  ...)
Parameters:
x:-an object containing the time series data
order.by:-a corresponding vector of unique times/dates – must be of a known time-based class.
frequency:-numeric indicating the frequency of order.
unique:-should index be checked for unique time-stamps?
tzone:-time zone of series. This is ignored for Date indices
...:-additional attributes to be added.
Example:
R
library("xts")  gfg_date <- data.frame(date = c("2004-05-07","2005-10-12",                                "2011-11-11","2020-11-11",                                "2021-12-11"),val=c(1,2,3,4,5))  gfg_date$date<-as.Date(gfg_date$date)    gfg_ts <- xts(gfg_date$val, gfg_date$date)gfg_ts      is.xts(gfg_ts)
Output:
Picked
R DataFrame-Programs
R-DataFrame
R Language
R Programs
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
How to Split Column Into Multiple Columns in R DataFrame?
Group by function in R using Dplyr
How to Change Axis Scales in R Plots?
How to filter R DataFrame by values in a column?
How to Split Column Into Multiple Columns in R DataFrame?
How to filter R DataFrame by values in a column?
Replace Specific Characters in String in R
Merge DataFrames by Column Names in R
How to Sort a DataFrame in R ?
Scala | map() method

14 Mar, 2019
A collection in Scala is a data structure which holds a group of objects. Examples of collections include Arrays, Lists, etc. We can apply some transformations to these collections using several methods. One such widely used method offered by Scala is map().Important points about map() method:
map() is a higher order function.
Every collection object has the map() method.
map() takes some function as a parameter.
map() applies the function to every element of the source collection.
map() returns a new collection of the same type as the source collection.
Syntax:
collection = (e1, e2, e3, ...)

//func is some function
collection.map(func)

//returns collection(func(e1), func(e2), func(e3), ...)

Example 1: Using user-defined function
// Scala program to// transform a collection// using map()  //Creating objectobject GfG{      // square of an integer    def square(a:Int):Int    =    {        a*a    }      // Main method    def main(args:Array[String])    {        // source collection        val collection = List(1, 3, 2, 5, 4, 7, 6)              // transformed collection        val new_collection = collection.map(square)          println(new_collection)      }  }
List(1, 9, 4, 25, 16, 49, 36)

In the above example, we are passing a user-defined function square as a parameter to the map() method. A new collection is created which contains squares of elements of the original collection. The source collection remains unaffected.
Example 2: Using anonymous function
// Scala program to// transform a collection// using map()  //Creating objectobject GfG{          // Main method    def main(args:Array[String])    {        // source collection        val collection = List(1, 3, 2, 5, 4, 7, 6)          // transformed collection        val new_collection = collection.map(x => x * x )          println(new_collection)    }}
List(1, 9, 4, 25, 16, 49, 36)

In the above example, an anonymous function is passed as a parameter to the map() method instead of defining a whole function for square operation. This approach reduces the code size.
Scala
Scala-Method
Scala
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Class and Object in Scala
Scala Singleton and Companion Objects
Introduction to Scala
Method Overloading in Scala
Scala | yield Keyword
Throw Keyword in Scala
Scala | Functions - Basics
Scala | Option
Tail Recursion in Scala
Scala | Traits
Spring Data JPA – @Id Annotation

29 Dec, 2021
Spring Boot is built on the top of the spring and contains all the features of spring. Spring also provides JPA and hibernate to increase the data manipulation efficiency between the spring application and the database. In very simple terms we can say JPA (Java persistence API) is like an interface and the hibernate is the implementation of the methods of the interface Like how insertion will be down is already defined with the help of hibernate. In this article, we will discuss how to make a specific variable of the class primary key in the Spring  Application. @Id annotation is the JPA is used for making specific variable primary key.
The @Id annotation is inherited from javax.persistence.Id, indicating the member field below is the primary key of the current entity. Hence your Hibernate and spring framework as well as you can do some reflect works based on this annotation. 
Spring Initializr is a web-based tool using which we can easily generate the structure of the Spring Boot project. It also provides various different features for the projects expressed in a metadata model. This model allows us to configure the list of dependencies that are supported by JVM. Here, we will create the structure of an application using a spring initializer.
Step 1: Go to this link. Fill in the details as per the requirements. For this application:
Project: Maven
Language: Java
Spring Boot: 2.5.6
Packaging: JAR
Java: 11
Dependencies: Spring Web,Spring Data JPA, MySql Driver
Click on Generate which will download the starter project.
Step 2: Extract the zip file. Now open a suitable IDE and then go to File > New > Project from existing sources > Mapping and select pom.xml. Click on import changes on prompt and wait for the project to sync as pictorially depicted below as follows:
Step 3: Adding the necessary properties in the application.properties file. (mapping is the database name)
spring.datasource.username=root
spring.datasource.password=Aayush
spring.datasource.url=jdbc:mysql://localhost:3306/mapping
spring.jpa.hibernate.ddl-auto=update
Step 4: Go to src->main->java->com->example->Mapping and create a file StudentInformation.java
Project Structure:
StudentInformation:
Java
@Entity@Table(name = "Student")public class StudentInformation {    // Making roll number primary key    @Id    @GeneratedValue(strategy = GenerationType.IDENTITY)    private int rollno;    private String name;      public int getRollno() { return rollno; }      public StudentInformation() {}      public StudentInformation(int rollno, String name)    {        this.rollno = rollno;        this.name = name;    }      public void setRollno(int rollno)    {          this.rollno = rollno;    }      public String getName() { return name; }      public void setName(String name) { this.name = name; }}
Run the main application:
Terminal Output:
Database Output:
Java-Spring-Data-JPA
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to use Greek symbols in ggplot2? - GeeksforGeeks

06 Jun, 2021
In this article, we will be looking at the approach to use Greeks symbols in ggplot2 using some in-built functions in the R programming language.
Greeks Symbols are used in mathematics, science, engineering, and other areas where the mathematical notation is used as symbols for constants, special functions, and also conventionally for variables representing certain quantities. In these contexts, the capital letters and the small letters represent distinct and unrelated entities.
In this method to use Greeks symbols in ggplot2 user need to call the expression function which is a base function of the R programming language, and pass the name of the Greek symbols to be used as the parameters to this function to get a Greek symbol to the ggplot2.
expression() function in R Language is used to create an expression from the values passed as an argument. It creates an object of the expression class.
Syntax:
expression(character)
Parameter:
character: Expression, like calls, symbols, constants
Example:
R
library("ggplot2")     gfg_data<-data.frame(x=c(1,2,3,4,5),y=c(5,4,3,2,1))  gfg_plot<-ggplot(data=gfg_data, aes(x, y)) +  geom_bar(stat="identity")    gfg_plot + ggtitle(expression(~ alpha * beta*gamma*delta*zeta*tau*phi*xi))
Output:
The approach is the same as above, here also expression() method is used but to add symbols to the main plot annotate() function is used.
Syntax: annotate() 
Parameters:
geom : specify text
x : x axis location
y : y axis location
label : custom textual content
color : color of textual content
size : size of text
fontface : fontface of text
angle : angle of text
Example:
R
library("ggplot2")   gfg_data<-data.frame(x=c(1,2,3,4,5),y=c(5,4,3,2,1))  gfg_plot<-ggplot(data=gfg_data, aes(x, y)) +  geom_bar(stat="identity")    gfg_plot +   annotate("text", x = 4, y = 4,                      label = expression(                        ~ alpha * beta*delta*zeta*tau*phi))
Output:
Picked
R-ggplot
R Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Change Color of Bars in Barchart using ggplot2 in R
How to Change Axis Scales in R Plots?
Group by function in R using Dplyr
How to Split Column Into Multiple Columns in R DataFrame?
How to filter R DataFrame by values in a column?
Logistic Regression in R Programming
How to change the order of bars in bar chart in R ?
How to filter R dataframe by multiple conditions?
Replace Specific Characters in String in R
Data Visualization in R
How to iterate through images in a folder Python?

03 Dec, 2021
In this article, we will learn how to iterate through images in a folder in Python. 
At first we imported the os module to interact with the operating system.
Then we import listdir() function from os to get access to the folders given in quotes.
Then with the help of os.listdir() function, we iterate through the images and printed the names in order.
Here we have mentioned only  .png files to be loaded using the endswith() function.
Python3
# import the modulesimport osfrom os import listdir # get the path/directoryfolder_dir = "C:/Users/RIJUSHREE/Desktop/Gfg images"for images in os.listdir(folder_dir):     # check if the image ends with png    if (images.endswith(".png")):        print(images)
Output:
Here we have mentioned .png, .jpg, .jpeg files to be loaded using the endswith() function.
Python3
# import the modulesimport osfrom os import listdir # get the path or directoryfolder_dir = "C:/Users/RIJUSHREE/Desktop/Gfg images"for images in os.listdir(folder_dir):     # check if the image end swith png or jpg or jpeg    if (images.endswith(".png") or images.endswith(".jpg")\        or images.endswith(".jpeg")):        # display        print(images)
Output:
At first, we imported the pathlib module from Path.
Then we pass the directory/folder inside Path() function and used it .glob(‘*.png’) function to iterate through all the images present in this folder.
Python3
# import required modulefrom pathlib import Path # get the path/directoryfolder_dir = 'Gfg images' # iterate over files in# that directoryimages = Path(folder_dir).glob('*.png')for image in images:    print(image)
Output:
At first we imported the glob module.
Then with the help of glob.iglob() function we iterate through the images and print the names in order.
Here we have mentioned .png files to be loaded using the endswith() function.
Python3
# import required moduleimport glob # get the path/directoryfolder_dir = 'Gfg images' # iterate over files in# that directoryfor images in glob.iglob(f'{folder_dir}/*'):       # check if the image ends with png    if (images.endswith(".png")):        print(images)
Output:
anikakapoor
Picked
Python directory-program
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Program for Check if all digits of a number divide it

12 Jun, 2022
Given a number n, find whether all digits of n divide it or not. 
Examples: 
Input : 128
Output : Yes
128 % 1 == 0, 128 % 2 == 0, and 128 % 8 == 0.

Input : 130
Output : No
We want to test whether each digit is non-zero and divides the number. For example, with 128, we want to test d != 0 && 128 % d == 0 for d = 1, 2, 8. To do that, we need to iterate over each digit of the number.  
python3
# Python 3 program to# check the number is# divisible by all# digits are not. # Function to check# the divisibility# of the number by# its digit.def checkDivisibility(n, digit) :         # If the digit divides the    # number then return true    # else return false.    return (digit != 0 and n % digit == 0)     # Function to check if# all digits of n divide# it or notdef allDigitsDivide( n) :         temp = n    while (temp > 0) :                 # Taking the digit of        # the number into digit        # var.        digit = temp % 10        if ((checkDivisibility(n, digit)) == False) :            return False         temp = temp // 10         return True # Driver functionn = 128 if (allDigitsDivide(n)) :    print("Yes")else :    print("No" )     # This code is contributed by Nikita Tiwari.
Output:  
Yes
Time Complexity: O(log10n), where n represents the given integer.Auxiliary Space: O(1), no extra space is required, so it is a constant.
Please refer complete article on Check if all digits of a number divide it for more details!
himanshujakhmola143
tamanna17122007
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python program to interchange first and last elements in a list
Appending to list in Python dictionary
Differences and Applications of List, Tuple, Set and Dictionary in Python
Python Program to check Armstrong Number
Python | Difference between two dates (in minutes) using datetime.timedelta() method
Appending a dictionary to a list in Python
Python | Remove spaces from a string
Python Program for Merge Sort
Python Program for simple interest
Python | Get the first key in dictionary
Python | re.search() vs re.match()

09 Aug, 2021
Prerequisite: Regex in Python
The re.search() and re.match() both are functions of re module in python. These functions are very efficient and fast for searching in strings. The function searches for some substring in a string and returns a match object if found, else it returns none.
There is a difference between the use of both functions. Both return the first match of a substring found in the string, but re.match() searches only from the beginning of the string and return match object if found. But if a match of substring is found somewhere in the middle of the string, it returns none. While re.search() searches for the whole string even if the string contains multi-lines and tries to find a match of the substring in all the lines of string. 
Example : 
Python3
# import re moduleimport re Substring ='string'  String1 ='''We are learning regex with geeksforgeeks         regex is very useful for string matching.          It is fast too.'''String2 ='''string We are learning regex with geeksforgeeks         regex is very useful for string matching.          It is fast too.''' # Use of re.search() Methodprint(re.search(Substring, String1, re.IGNORECASE))# Use of re.match() Methodprint(re.match(Substring, String1, re.IGNORECASE)) # Use of re.search() Methodprint(re.search(Substring, String2, re.IGNORECASE))# Use of re.match() Methodprint(re.match(Substring, String2, re.IGNORECASE))
Output : 
<re.Match object; span=(75, 81), match='string'>
None
<re.Match object; span=(0, 6), match='string'>
<re.Match object; span=(0, 6), match='string'>
Conclusion : 
re.search() is returning match object and implies that first match found at index 69.re.match() is returning none because match exists in the second line of the string and re.match() only works if the match is found at the beginning of the string. re.IGNORECASE is used to ignore the case sensitivity in the strings. Both re.search() and re.match() returns only the first occurrence of a substring in the string and ignore others. 
re.search() is returning match object and implies that first match found at index 69.
re.match() is returning none because match exists in the second line of the string and re.match() only works if the match is found at the beginning of the string. 
re.IGNORECASE is used to ignore the case sensitivity in the strings. 
Both re.search() and re.match() returns only the first occurrence of a substring in the string and ignore others. 
narendradodwaria
ajwan92
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
YAML - Introduction

YAML Ain't Markup Language is a data serialization language that matches user’s expectations about data. It designed to be human friendly and works perfectly with other programming languages. It is useful to manage data and includes Unicode printable characters. This chapter will give you an introduction to YAML and gives you an idea about its features.
Consider the text shown below −
Quick brown fox jumped over the lazy dog.

The YAML text for this will be represented as shown below −
yaml.load(Quick brown fox jumped over the lazy dog.)
>>'Quick brown fox jumped over the lazy dog.'
Note that YAML takes the value in string format and represents the output as mentioned above.
Let us understand the formats in YAML with the help of the following examples −
Consider the following point number of “pi”, which has a value of 3.1415926. In YAML, it is represented as a floating number as shown below −
>>> yaml.load('3.1415926536')
3.1415926536
Suppose, multiple values are to be loaded in specific data structure as mentioned below −
eggs
ham
spam
French basil salmon terrine

When you load this into YAML, the values are taken in an array data structure which is a form of list. The output is as shown below −
>>> yaml.load('''
   - eggs
   - ham
   - spam
   - French basil salmon terrine
   ''')
['eggs', 'ham', 'spam', 'French basil salmon terrine']

YAML includes a markup language with important construct, to distinguish data-oriented language with the document markup. The design goals and features of YAML are given below −
Matches native data structures of agile methodology and its languages such as Perl, Python, PHP, Ruby and JavaScript
Matches native data structures of agile methodology and its languages such as Perl, Python, PHP, Ruby and JavaScript
YAML data is portable between programming languages
YAML data is portable between programming languages
Includes data consistent data model
Includes data consistent data model
Easily readable by humans
Easily readable by humans
Supports one-direction processing
Supports one-direction processing
Ease of implementation and usage
Ease of implementation and usage