code-rag-bench/online-tutorials huggingface dataset:
How to keep gap between columns using Bootstrap?

30 Nov, 2020
We can keep gap between columns by using normal CSS but here we will use the Bootstrap framework for that. In this article, we will keep a measured gap between columns by the following methods.
Using “div” tag: Simply adding a “div” with padding in between two “div” tags gives spacing between the “div”.
Example:
<!DOCTYPE html><html lang="en">    <head>        <!-- Required meta tags -->        <meta charset="utf-8" />        <meta            name="viewport"            content="width=device-width,                     initial-scale=1,                      shrink-to-fit=no"/>           <!-- Bootstrap CSS -->        <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"            integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh"            crossorigin="anonymous" />           <style media="screen">            .a {                padding: 50px;            }        </style>    </head>       <body>        <div class="row">            <div class="col-4 bg-success a">                One of two columns            </div>            <div class="col-4"><!--extra div--></div>            <div class="col-4 bg-danger a">                One of two columns            </div>        </div>    </body></html>
Output:
Image without the extra “div” tag:
Image without the extra “div” tag:
Image with the extra “div” tag:
Image with the extra “div” tag:
Method using columns offset: The offset class is used to increase the left margin of a column. The class col-md-offset-2 moves col-md-3 by 3 columns.
Example:
<!DOCTYPE html><html lang="en">    <head>        <!-- Required meta tags -->        <meta charset="utf-8" />        <meta name="viewport"               content="width=device-width,                        initial-scale=1,                       shrink-to-fit=no" />          <!-- Bootstrap CSS -->        <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"               integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh"               crossorigin="anonymous" />        <style media="screen">            .a {                padding: 50px;            }        </style>    </head>    <body>        <!--using offset-->        <div class="row">            <div class="col-md-5 bg-success a">geeksforgeeks</div>            <div class="col-md-5 bg-danger offset-2 a">                geeksforgeeks            </div>        </div>    </body></html>
Output: This output may not match with the given output image because the screen size of the output is smaller.
Image without offset:Image with offset:
Image without offset:
Image without offset:
Image with offset:
Image with offset:
Bootstrap-Misc
Bootstrap
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to remove a committed file from the Git repository?

Git allows you to delete a file from the repository using any of the following methods −
Using the Linux rm command
Using the Linux rm command
Using the git rm command
Using the git rm command
Scenario 1 − Use the Linux rm command
The syntax of the Linux rm command is −
$ git rm <file_name>
Let us assume that a file “file1.python” exists in the repository. Use the Linux rm command to delete the file − “file1.python”.
$ git rm file1.python
Let us first verify if the file has been removed from the working directory. This can be verified by using the Linux ls command.
$ ls
The output suggests that the file has been removed from the working directory.
dell@DESKTOP−N961NR5 MINGW64 /e/tut_repo (master)
$ Is
Let us now verify if the file has also been removed from the staging area.
Use the git command ls−files to verify this.
$ git ls−files
The output of the above code is −
file1.python
It is clear from the output that the file has not been removed from the staging area. This means changes like adding, renaming or deleting a file performed using Linux commands will not be automatically staged. Such changes should be explicitly staged using the git add command and then committed.
$ git add file1.python
Execute the ls−files command. The status of the operation can also be verified using the git status command.
$ git ls−files
$ git status
The output of the above commands is shown in the screenshot.
On branch master
Changes to be committed:
   (use “git restore --staged <file>...” to unstage)
      deleted:file1.python
The file is removed from the staging area. Let us now finally commit the change.
$ git commit -m ‘removed unused python file’
The file is permanently deleted from the repository. Refer the screenshot below for output.
[master 81e32c4] removed unused python file
1 file changed, 2 deletions (-)
delete mode 100644 file1.python
Scenario 2 − Use the git rm command
The syntax of the git rm command is
git rm <file_name>
Assuming that a file “file1.js” exists in the repository, let us use the git rm command to delete the file.
$ git rm file1.js
Let us use the git ls−files command to verify if the file has been removed from the staging area.
$ git ls−files
We can also use the git status command to verify if the file has been removed from the staging area.
$ git status
It is clear from the output that files removed using the git rm command are deleted from the working area and also from the staging area. Refer screenshot below for the output.
On branch master
Changes to be committed:
   (use “git restore −−staged <file>...” to unstage)
      deleted:file1.js
Let us now commit the change and verify the output.
$ git commit −m ‘remove unused js file’
The output suggests that the file has been permanently deleted from the repository.
[master dc7861e] removed unused js file
1 file changed, 1 deletion(−)
delete mode 100644 file1.js
C++ Program to Implement Shell Sort

The shell sorting technique is based on the insertion sort. In the insertion sort sometimes we need to shift large block to insert item in the correct location. Using shell sort, we can avoid large number of shifting. The sorting is done with specific interval. After each pass the interval is reduced to make smaller interval.
Time Complexity: O(n log n) for best case, and for other cases, it depends on the gap sequence.
Time Complexity: O(n log n) for best case, and for other cases, it depends on the gap sequence.
Space Complexity: O(1)
Space Complexity: O(1)
Input − The unsorted list: 23 56 97 21 35 689 854 12 47 66
Output − Array after Sorting: 12 21 23 35 47 56 66 97 689 854
Input: An array of data, and the total number in the array
Output: The sorted Array
Begin
   for gap := size / 2, when gap > 0 and gap is updated with gap / 2 do
      for j:= gap to size– 1 do
         for k := j-gap to 0, decrease by gap value do
            if array[k+gap] >= array[k]
               break
            else
               swap array[k + gap] with array[k]
         done
      done
   done
End
#include<iostream>
using namespace std;
void swapping(int &a, int &b) {        //swap the content of a and b
   int temp;
   temp = a;
   a = b;
   b = temp;
}
void display(int *array, int size) {
   for(int i = 0; i<size; i++)
      cout << array[i] << " ";
   cout << endl;
}
void shellSort(int *arr, int n) {
   int gap, j, k;
   for(gap = n/2; gap > 0; gap = gap / 2) {        //initially gap = n/2,
      decreasing by gap /2
      for(j = gap; j<n; j++) {
         for(k = j-gap; k>=0; k -= gap) {
            if(arr[k+gap] >= arr[k])
               break;
            else
               swapping(arr[k+gap], arr[k]);
         }
      }
   }
}
int main() {
   int n;
   cout << "Enter the number of elements: ";
   cin >> n;
   int arr[n];     //create an array with given number of elements
   cout << "Enter elements:" << endl;
   for(int i = 0; i<n; i++) {
      cin >> arr[i];
   }
   cout << "Array before Sorting: ";
   display(arr, n);
   shellSort(arr, n);
   cout << "Array after Sorting: ";
   display(arr, n);
}
Enter the number of elements: 10
Enter elements:
23 56 97 21 35 689 854 12 47 66
Array before Sorting: 23 56 97 21 35 689 854 12 47 66
Array after Sorting: 12 21 23 35 47 56 66 97 689 854
Spring MVC - Generate XML Example

The following example shows how to generate XML using the Spring Web MVC Framework. To begin with, let us have a working Eclipse IDE in place and stick to the following steps to develop a Dynamic Form based Web Application using the Spring Web Framework.
package com.tutorialspoint;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement(name = "user")
public class User {
   private String name;
   private int id;
   public String getName() {
      return name;
   }
   @XmlElement
   public void setName(String name) {
      this.name = name;
   }
   public int getId() {
      return id;
   }
   @XmlElement
   public void setId(int id) {
      this.id = id;
   }	
}
package com.tutorialspoint;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/user")
public class UserController {
	
   @RequestMapping(value="{name}", method = RequestMethod.GET)
   public @ResponseBody User getUser(@PathVariable String name) {

      User user = new User();

      user.setName(name);
      user.setId(1);
      return user;
   }
}
<beans xmlns = "http://www.springframework.org/schema/beans"
   xmlns:context = "http://www.springframework.org/schema/context"   
   xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
   xmlns:mvc = "http://www.springframework.org/schema/mvc"
   xsi:schemaLocation = "
   http://www.springframework.org/schema/beans     
   http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
   http://www.springframework.org/schema/context 
   http://www.springframework.org/schema/context/spring-context-3.0.xsd
   http://www.springframework.org/schema/mvc
   http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
   <context:component-scan base-package = "com.tutorialspoint" />
   <mvc:annotation-driven />
</beans>
Here, we have created an XML Mapped POJO User and in the UserController, we have returned the User. Spring automatically handles the XML conversion based on RequestMapping.
Once you are done with creating source and configuration files, export your application. Right click on your application, use Export → WAR File option and save your TestWeb.war file in Tomcat's webapps folder.
Now, start the Tomcat server and make sure you are able to access other webpages from the webapps folder using a standard browser. Try a URL – http://localhost:8080/TestWeb/mahesh and we will see the following screen.
 Print
 Add Notes
 Bookmark this page
How to convert a DataFrame row into character vector in R? - GeeksforGeeks

21 Apr, 2021
If we want to turn a dataframe row into a character vector then we can use as.character() method In R, we can construct a character vector by enclosing the vector values in double quotation marks, but if we want to create a character vector from data frame row values, we can use the as character function.For example, if we have a data frame df then the values in the first row of the df can be turned into character vector using as.character(df[1,]).
Syntax: as.character(df[rownum, ])
Example 1: Here we are going to turn dataframe row into a character vector.
Here we will create a dataframe and then convert it to a vector.
R
# creating dataframedata <- data.frame(x1 = 1:5,                                x2 = letters[1:5],                  x3 = 6:10)  # converting first row into character vectorfirst_row_vector = as.character(data[1, ]);  print(first_row_vector)
Output:
[1] "1" "1" "6"
Example 2: Converting row-wise dataframe into the vector.
R
data <- data.frame(x1 = c("rahul", "vikas") ,                              x2 = letters[1:2],                  x3 = c(1,2))  first_row_vector = as.character(data[2, ]);  print("dataFrame")print(data)  print("character vector of first row is" )print(first_row_vector)
Output:
Picked
R Vector-Programs
R-Vectors
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
Group by function in R using Dplyr
How to Split Column Into Multiple Columns in R DataFrame?
How to Change Axis Scales in R Plots?
Replace Specific Characters in String in R
How to Split Column Into Multiple Columns in R DataFrame?
Replace Specific Characters in String in R
How to filter R DataFrame by values in a column?
How to filter R dataframe by multiple conditions?
Convert Matrix to Dataframe in R
Javascript Program To Check Whether The Length Of Given Linked List Is Even Or Odd - GeeksforGeeks

10 Jan, 2022
Given a linked list, the task is to make a function which checks whether the length of the linked list is even or odd.Examples:
Input : 1->2->3->4->NULL
Output : Even

Input : 1->2->3->4->5->NULL
Output : Odd
Method 1: Count the codes linearly Traverse the entire Linked List and keep counting the number of nodes. As soon as the loop is finished, we can check if the count is even or odd. You may try it yourself.Method 2: Stepping 2 nodes at a time Approach:
1. Take a pointer and move that pointer two nodes at a time
2. At the end, if the pointer is NULL then length is Even, else Odd.
Javascript
<script>// JavaScript program to check length // of a given linklist // Defining structureclass Node {    constructor()     {        this.data = 0;        this.next = null;    }}  // Function to check the length of // linklistfunction LinkedListLength(head) {    while (head != null &&            head.next != null)     {        head = head.next.next;    }    if (head == null)        return 0;    return 1;}  // Push functionfunction push(head, info) {    // Allocating node    node = new Node();      // Info into node    node.data = info;      // Next of new node to head    node.next = (head);      // head points to new node    (head) = node;}  // Driver codehead = null;  // Adding elements to Linked Listpush(head, 4);push(head, 5);push(head, 7);push(head, 2);push(head, 9);push(head, 6);push(head, 1);push(head, 2);push(head, 0);push(head, 5);push(head, 5);var check = LinkedListLength(head);  // Checking for length of linklistif (check == 0) {    document.write("Odd");} else{    document.write("Even");}// This code is contributed by umadevi9616</script>
Output:  
Odd
Time Complexity: O(n) Space Complexity: O(1)
Please refer complete article on Check whether the length of given linked list is Even or Odd for more details!
Linked List
Linked List
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Circular Singly Linked List | Insertion
Given a linked list which is sorted, how will you insert in sorted way
Swap nodes in a linked list without swapping data
Delete a node in a Doubly Linked List
Circular Linked List | Set 2 (Traversal)
Insert a node at a specific position in a linked list
Program to implement Singly Linked List in C++ using class
Priority Queue using Linked List
Insertion Sort for Singly Linked List
Real-time application of Data Structures
Koa.js - Hello World

Once we have set up the development, it is time to start developing our first app using Koa. Create a new file called app.js and type the following in it.
var koa = require('koa');
var app = new koa();

app.use(function* (){
   this.body = 'Hello world!';
});

app.listen(3000, function(){
   console.log('Server running on https://localhost:3000')
});
Save the file, go to your terminal and type.
$ nodemon app.js

This will start the server. To test this app, open your browser and go to https://localhost:3000 and you should receive the following message.
The first line imports Koa in our file. We have access to its API through the variable Koa. We use it to create an application and assign it to var app.
app.use(function) − This function is a middleware, which gets called whenever our server gets a request. We'll learn more about middleware in the subsequent chapters. The callback function is a generator, which we'll see in the next chapter. The context of this generator is called context in Koa. This context is used to access and modify the request and response objects. We are setting the body of this response to be Hello world!.
app.listen(port, function) − This function binds and listens for connections on the specified port. Port is the only required parameter here. The callback function is executed, if the app runs successfully.
 Print
 Add Notes
 Bookmark this page
How To enable GZIP Compression in  PHP?

GZIP Compression is a simple, effective way to save bandwidth and speed up PHP application. The mechanism runs behind the GZIP compression is described below −
The browser/client request for a file to the server.
The server sends a .zip file to the browser (index.html.zip) rather than plain old index.html in response, due to which the download time and bandwidth decreases.
After the execution of the above step, the browser downloads the zipped file, extracts it, and then shows it to the user. This loads the webpage very quickly.
In the Apache server, we have to Add the following to .htaccess file to enable GZIP compression.
# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xmlin
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
# Or, compress certain file types by extension:
<files *.html>
SetOutputFilter DEFLATE
</files>
In PHP files we can enable GZIP compression.
<?php
   if (substr_count($_SERVER[‘HTTP_ACCEPT_ENCODING’], ‘gzip’))
   ob_start(“ob_gzhandler”);
   else ob_start();
?>
Date toLocaleDateString() Method

Javascript date toLocaleDateString() method converts a date to a string, returning the "date" portion using the operating system's locale's conventions.
Its syntax is as follows −
Date.toLocaleString()

Returns the "date" portion using the operating system's locale's conventions.
Try the following example.
<html>   
   <head>
      <title>JavaScript toLocaleDateString Method</title>
   </head>
   
   <body>      
      <script type = "text/javascript">
         var dt = new Date(1993, 6, 28, 14, 39, 7);
         document.write( "Formated Date : " + dt.toLocaleDateString() ); 
      </script>      
   </body>
</html>
Formated Date : 7/28/1993 


    25 Lectures 
     2.5 hours 

 Anadi Sharma

    74 Lectures 
     10 hours 

 Lets Kode It

    72 Lectures 
     4.5 hours 

 Frahaan Hussain

    70 Lectures 
     4.5 hours 

 Frahaan Hussain

    46 Lectures 
     6 hours 

 Eduonix Learning Solutions

    88 Lectures 
     14 hours 

 Eduonix Learning Solutions
 Print
 Add Notes
 Bookmark this page
How to convert a comma separated String into an ArrayList in Java?

To convert a comma separated String into an ArrayList
Split the String into an array of Strings using the split() method.Now, convert the obtained String array to list using the asList() method of the Arrays class.
Split the String into an array of Strings using the split() method.
Now, convert the obtained String array to list using the asList() method of the Arrays class.
 Live Demo
import java.util.Arrays;
import java.util.List;

public class Sample {
   public static void main(String[] args) {
      String myString = "JavaFx,Java,WebGL,OpenCV";
      String[] myArray = myString.split(",");
      System.out.println("Contents of the array ::"+Arrays.toString(myArray));
      List <String> myList = Arrays.asList(myArray);
   }
}
Contents of the array ::[JavaFx, Java, WebGL, OpenCV]
Scala Collections - Reduce Method

reduce() method is a member of  TraversableOnce trait, it is used to collapse elements of collections. It is similar to fold method but it does not take initial value.
The following is the syntax of reduce method.
def reduce[A1 >: A](op: (A1, A1) ? A1): A1

Here, reduce method takes associative binary operator function as a parameter. This method returns the resultant value.
Below is an example program of showing how to use fold method −
object Demo {
   def main(args: Array[String]) = {
      val list = List(1, 2, 3 ,4)
      //apply operation to get sum of all elements of the list
      val result = list.reduce(_ + _)
      //print result
      println(result)      
   }
}
Save the above program in Demo.scala. The following commands are used to compile and execute this program.
\>scalac Demo.scala
\>scala Demo

10


    82 Lectures 
     7 hours 

 Arnab Chakraborty

    23 Lectures 
     1.5 hours 

 Mukund Kumar Mishra

    52 Lectures 
     1.5 hours 

 Bigdata Engineer

    76 Lectures 
     5.5 hours 

 Bigdata Engineer

    69 Lectures 
     7.5 hours 

 Bigdata Engineer

    46 Lectures 
     4.5 hours 

 Stone River ELearning
 Print
 Add Notes
 Bookmark this page
BigDecimal precision() Method in Java - GeeksforGeeks

04 Dec, 2018
The java.math.BigDecimal.precision() method returns the precision of this BigDecimal. The precision refers to the number of digits in the unscaled value.
Syntax:
public int precision()
Parameters: This method does not accept any parameters.
Return Value: This method returns an integer which denotes the precision of this BigDecimal object.
Examples:
Input : 198.176
Output : 6

Input : 721111.111
Output : 9

Below programs illustrate the java.math.BigDecimal.precision() function in Java:Program 1:
import java.math.*;import java.io.*;  class GFG {    public static void main(String[] args)    {        // create 2 BigDecimal Objects        BigDecimal b1, b2;          // Assigning values to b1, b2        b1 = new BigDecimal("198.176");        b2 = new BigDecimal("721111.111");          // Display their respective precision        System.out.println("The precision of " + b1 + " is " + b1.precision());        System.out.println("The precision of " + b2 + " is " + b2.precision());    }}
The precision of 198.176 is 6
The precision of 721111.111 is 9

Program 2:
// Java program to illustrate// precision() Functionimport java.math.*;import java.io.*;  class GFG {    public static void main(String[] args)    {        // Creating a BigDecimal Object        BigDecimal num;          // Assigning value 0.1 + 0.1 + 0.1 to num        num = new BigDecimal("0.1")                  .add(new BigDecimal("0.1"))                  .add(new BigDecimal("0.1"));          // Display the BigDecimal value and its precision        System.out.println("The precision of " + num + " is "        + num.precision());    }}
The precision of 0.3 is 1

Reference: https://docs.oracle.com/javase/7/docs/api/java/math/BigDecimal.html#precision()
Java-BigDecimal
Java-Functions
java-math
Java-math-package
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
HashMap in Java with Examples
Initialize an ArrayList in Java
Object Oriented Programming (OOPs) Concept in Java
Interfaces in Java
ArrayList in Java
How to iterate any Map in Java
Multidimensional Arrays in Java
LinkedList in Java
Stack Class in Java
Multithreading in Java
Controlling the Position of Table Caption using CSS

The CSS caption-side property is used to vertically position the table caption box. It can take top and bottom as values. By default, table caption is placed at the top.
The syntax of CSS list-style property is as follows−
Selector {
   caption-side: /*value*/
}
The following examples illustrate the CSS caption-side property.
 Live Demo
<!DOCTYPE html>
<html>
<head>
<style>
table * {
   border: ridge skyblue;
   padding: 0.5rem;
}
table {
   margin: 20px;
   box-shadow: 0 0 6px 3px indianred;
   empty-cells: show;
}
caption {
   border-top-style: none;
   caption-side: bottom;
   border-color: darkkhaki;
   border-radius: 50%;
}
</style>
</head>
<body>
<table id="demo">
<caption>Demo</caption>
<tr>
<th colspan="3">Table</th>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</table>
</body>
</html>
This gives the following output −
 Live Demo
<!DOCTYPE html>
<html>
<head>
<style>
table {
   margin: auto;
   border: double black 13px;
   border-radius: 6px;
}
td, th {
   border-left: 1px solid black;
   border-top: 1px solid black;
}
th {
   background-color: lightblue;
   border-top: none;
}
td:first-child, th:first-child {
   border-left: none;
}
caption {
   margin-top: 3px;
   background-color: purple;
   caption-side: bottom;
   color: white;
   border-radius: 20%;
}
</style>
</head>
<body>
<h2>Demo Table</h2>
<table>
<caption>Demo</caption>
<tr>
<th colspan="4">Table</th>
</tr>
<tr>
<td>One...</td>
<td>Two...</td>
<td>Three</td>
<td>Four</td>
</tr>
<tr>
<td>Five</td>
<td>Six</td>
<td>Seven</td>
<td>Eight</td>
</tr>
</table>
</body>
</html>
This gives the following output −
\arcsin - Tex Command

\arcsin - Used to draw arcsin.
{ \arcsin(x) }
\arcsin command is used to draw arcsin.

\arcsin(x) 

arcsin⁡(x)



\arcsin(x) 

arcsin⁡(x)


\arcsin(x) 

    14 Lectures 
     52 mins

 Ashraf Said

    11 Lectures 
     1 hours 

 Ashraf Said

    9 Lectures 
     1 hours 

 Emenwa Global, Ejike IfeanyiChukwu

    29 Lectures 
     2.5 hours 

 Mohammad Nauman

    14 Lectures 
     1 hours 

 Daniel Stern

    15 Lectures 
     47 mins

 Nishant Kumar
 Print
 Add Notes
 Bookmark this page
Matplotlib.pyplot.disconnect() in Python - GeeksforGeeks

21 Apr, 2020
Matplotlib is a library in Python and it is numerical – mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface.
The disconnect() function in pyplot module of matplotlib library is used to disconnect the callback with id cid.
Syntax: matplotlib.pyplot.disconnect(cid)
Parameters: This method accept the following parameters that are described below:
cid: This parameter is used to disconnect the callback.
Below examples illustrate the matplotlib.pyplot.disconnect() function in matplotlib.pyplot:
Example #1:
# Implementation of matplotlib functionimport numpy as npimport matplotlib.pyplot as plt  fig, ax = plt.subplots()ax.plot(np.random.rand(10))  def onclick(event):    print('% s click: button =% d, x =% d, y =% d,\    xdata =% f, ydata =% f' %          ('double' if event.dblclick else 'single',           event.button,           event.x,           event.y,            event.xdata,            event.ydata))  cid = fig.canvas.mpl_connect('button_press_event',                             onclick)fig.canvas.mpl_disconnect(cid)  plt.suptitle('matplotlib.pyplot.disconnect()\function Example', fontweight ="bold")  plt.show()
Output:
Example #2:
# Implementation of matplotlib functionfrom matplotlib.backend_bases import MouseButtonimport matplotlib.pyplot as pltimport numpy as np  t = np.arange(0.0, 1.0, 0.01)s = np.sin(2 * np.pi * t)fig, ax = plt.subplots()ax.plot(t, s)    def gfg1(event):          # get the x and y pixel coords    x, y = event.x, event.y    if event.inaxes:                  # the axes instance        ax = event.inaxes        print('Coordinates : % f  and\        % f' % (event.xdata, event.ydata))    def gfg2(event):          if event.button is MouseButton.LEFT:        print('Successfully disconnected')        plt.disconnect(binding_id)    binding_id = plt.connect('motion_notify_event',                         gfg1)  plt.connect('button_press_event', gfg2)  plt.suptitle('matplotlib.pyplot.disconnect()\function Example', fontweight ="bold")plt.show()
Output:Figure shown
Background result after click on figure
Python-matplotlib
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to Install PIP on Windows ?
How to drop one or multiple columns in Pandas Dataframe
Python OOPs Concepts
Python | Get unique values from a list
Check if element exists in list in Python
Python Classes and Objects
Python | os.path.join() method
How To Convert Python Dictionary To JSON?
Python | Pandas dataframe.groupby()
Create a directory in Python
Counting Sort

Counting sort is a stable sorting technique, which is used to sort objects according to the keys that are small numbers. It counts the number of keys whose key values are same. This sorting technique is effective when the difference between different keys are not so big, otherwise, it can increase the space complexity.
Time Complexity: O(n+r)
Space Complexity: O(n+r)
Input:
A list of unsorted data: 2 5 6 2 3 10 3 6 7 8
Output:
Array before Sorting: 2 5 6 2 3 10 3 6 7 8
Array after Sorting: 2 2 3 3 5 6 6 7 8 10
counting sort(array, size)
Input: An array of data, and the total number in the array
Output: The sorted Array
Begin
   max = get maximum element from array.
   define count array of size [max+1]

   for i := 0 to max do
      count[i] = 0 //set all elements in the count array to 0
   done

   for i := 1 to size do
      increase count of each number which have found in the array
   done

   for i := 1 to max do
      count[i] = count[i] + count[i+1] //find cumulative frequency
   done

   for i := size to 1 decrease by 1 do
      store the number in the output array
      decrease count[i]
   done

   return the output array
End
#include<iostream>
#include<algorithm>
using namespace std;

void display(int *array, int size) {
   for(int i = 1; i<=size; i++)
      cout << array[i] << " ";
   cout << endl;
}

int getMax(int array[], int size) {
   int max = array[1];
   for(int i = 2; i<=size; i++) {
      if(array[i] > max)
         max = array[i];
   }

   return max; //the max element from the array
}

void countSort(int *array, int size) {
   int output[size+1];
   int max = getMax(array, size);
   int count[max+1]; //create count array (max+1 number of elements)

   for(int i = 0; i<=max; i++)
      count[i] = 0; //initialize count array to all zero
   for(int i = 1; i <=size; i++)
      count[array[i]]++; //increase number count in count array.
   for(int i = 1; i<=max; i++)
      count[i] += count[i-1]; //find cumulative frequency

   for(int i = size; i>=1; i--) {
      output[count[array[i]]] = array[i];
      count[array[i]] -= 1; //decrease count for same numbers
   }

   for(int i = 1; i<=size; i++) {
      array[i] = output[i]; //store output array to main array
   }
}

int main() {
   int n;
   cout << "Enter the number of elements: ";
   cin >> n;
   int arr[n+1]; //create an array with given number of elements
   cout << "Enter elements:" << endl;

   for(int i = 1; i<=n; i++) {
      cin >> arr[i];
   }

   cout << "Array before Sorting: ";
   display(arr, n);
   countSort(arr, n);
   cout << "Array after Sorting: ";
   display(arr, n);
}
Enter the number of elements: 10
Enter elements:
2 5 6 2 3 10 3 6 7 8
Array before Sorting: 2 5 6 2 3 10 3 6 7 8
Array after Sorting: 2 2 3 3 5 6 6 7 8 10
Change the outline color for histogram bars using ggplot2 in R.

To change the outlines color of histogram bars using ggplot2, we can use col argument inside geom_histogram function of ggplot2 package.
For Example, if we have a data frame called df that contains a column say X then we can create the histogram of X with different outline color of bars using the below command −
ggplot(df,aes(X))+geom_histogram(bins=30,col=I("red"))
Following snippet creates a sample data frame −
x<-rnorm(20000)
df<-data.frame(x)
head(df,20)
The following dataframe is created −
          x
 1 -1.31426410
 2 -2.62316895
 3 -0.19231545
 4  0.89701476
 5 -0.10409584
 6  0.23481007
 7  1.53117888
 8 -0.63855632
 9  0.85309492
10  0.04791316
11  0.37854603
12  1.24928336
13 -0.65170883
14  2.58938742
15 -0.82602063
16  0.97524621
17  0.36930032
18  0.07720108
19 -0.66050878
20  0.66199644
To load the ggplot2 package and to create a histogram of x, on the above created data frame, add the following code to the above snippet −
x<-rnorm(20000)

library(ggplot2)
ggplot(df,aes(x))+geom_histogram(bins=30)
If you execute all the above given snippets as a single program, it generates the following Output −
To create a histogram of x with red colored outline of bars, on the above created data frame, add the following code to the above snippet −
x<-rnorm(20000)

library(ggplot2)
ggplot(df,aes(x))+geom_histogram(bins=30,col=I("red"))
If you execute all the above given snippets as a single program, it generates the following Output −
How can we extract the numbers from an input string in Java?

The java.lang.String class gives a considerable measure of methods to deal with a string. By the assistance of these methods, one can perform operations on the string like trimming, concatenating, converting and comparing. We can extract the numbers from a given string by using the replaceAll() method of a String class.
import java.util.Scanner;
public class StringExtractTest {
   public static void main(String[] args) {
      String input;
      String numbers;
      Scanner scanner = new Scanner(System.in);
      System.out.print(" Please enter a string from the keyboard that contains numbers: ");
      input = scanner.nextLine();
      numbers = input.replaceAll("[^0-9]", ""); 
      System.out.println("The Numbers are: " + numbers);
   }
}
Please enter a string from the keyboard that contains numbers: Welcome to Tutorials Point 1234567890
The Numbers are: 1234567890
Difference between Schema and Instance in DBMS

22 Sep, 2021
1. Instances : Instances are the collection of information stored at a particular moment. The instances can be changed by certain CRUD operations as like addition, deletion of data. It may be noted that any search query will not make any kind of changes in the instances. 
Example – Let’s say a table teacher in our database whose name is School, suppose the table has 50 records so the instance of the database has 50 records for now and tomorrow we are going to add another fifty records so tomorrow the instance have total 100 records. This is called an instance. 
2. Schema : Schema is the overall description of the database. The basic structure of how the data will be stored in the database is called schema. 
 
Schema is of three types: Logical Schema, Physical Schema and view Schema. 
Logical Schema – It describes the database designed at logical level.Physical Schema – It describes the database designed at physical level.View Schema – It defines the design of the database at the view level. 
Logical Schema – It describes the database designed at logical level.
Physical Schema – It describes the database designed at physical level.
View Schema – It defines the design of the database at the view level. 
Example – Let’s say a table teacher in our database name school, the teacher table require the name, dob, doj in their table so we design a structure as :  
Teacher table
name: String
doj: date
dob: date 
Above given is the schema of the table teacher. 
Difference between Schema and Instance : 
ak9319770552
Picked
DBMS
Difference Between
GATE CS
DBMS
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Difference between DELETE, DROP and TRUNCATE
Difference between Clustered and Non-clustered index
CTE in SQL
Indexing in Databases | Set 1
SQL Interview Questions
Class method vs Static method in Python
Difference between BFS and DFS
Differences between Black Box Testing vs White Box Testing
Difference Between Method Overloading and Method Overriding in Java
Differences between TCP and UDP
DateFormat getDateInstance() Method in Java with Examples

24 Jan, 2022
DateFormat class of java.text package is an abstract class that is used to format and parse dates for any locale. It allows us to format date to text and parse text to date. DateFormat class provides many functionalities to obtain, format, parse default date/time.
Note: DateFormat class extends Format class that means it is a subclass of Format class. Since DateFormat class is an abstract class, therefore, it can be used for date/time formatting subclasses, which format and parses dates or times in a language-independent manner.  
Package-view:
java.text Package
    DateFormat Class
        getDateInstance() Method
getDateInstance() Method of DateFormat class in Java is used to get the date formatter. This date formatter comes with the default formatting style for a default locale.
Syntax: 
public static final DateFormat getDateInstance()
Return Type: Returns a date formatted in a particular format.
Example 1:
Java
// Java Program to Illustrate getDateInstance() Method//  of DateFormat Class // Importing required classesimport java.text.*;import java.util.*; // Main classpublic class GFG {     // Main driver method    public static void main(String[] argv)    {        // Initializing the first formatter        // using getDateInstance() method        DateFormat DFormat = DateFormat.getDateInstance();         System.out.println("Object: " + DFormat);         // Formatting the string        String str = DFormat.format(new Date());         // Printing the string date on console        System.out.println(str);    }}
Object: java.text.SimpleDateFormat@ce9bf0a5
Mar 27, 2019
 
Example 2:
Java
// Java Program to Illustrate getDateInstance() Method// of DateFormat Class // Importing required classesimport java.text.*;import java.util.*; // Main classpublic class GFG {     // Main driver method    public static void main(String[] args)        throws InterruptedException    {         // Initializing SimpleDateFormat by        // creating object of SimpleDateFormat class        SimpleDateFormat SDFormat            = new SimpleDateFormat("MM/dd/yyyy");         // Printing the formats        Date date = new Date();        String str_Date1 = SDFormat.format(date);         // Displaying  the original date        System.out.println("The Original: " + (str_Date1));         // Initializing the Date formatter        DateFormat DFormat = DateFormat.getDateInstance();        System.out.println("Object: " + DFormat);         // Formatting the string        String str = DFormat.format(new Date());         // Printing the string date on console        System.out.println(str);    }}
The Original: 01/11/2022
Object: java.text.SimpleDateFormat@ad508834
Jan 11, 2022
solankimayank
Java-DateFormat
Java-Functions
Java-text package
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to iterate any Map in Java
Interfaces in Java
HashMap in Java with Examples
ArrayList in Java
Stream In Java
Collections in Java
Multidimensional Arrays in Java
Singleton Class in Java
Stack Class in Java
Set in Java
How to input multiple values from user in one line in Java?

To input multiple values from user in one line, the code is as follows −
 Live Demo
import java.util.Scanner;
public class Demo {
   public static void main(String[] args) {
      System.out.print("Enter two floating point values : ");
      Scanner my_scan = new Scanner(System.in);
      double double_val = my_scan.nextFloat();
      int int_val = my_scan.nextInt();
      System.out.println("The floating point value is : " + double_val + " and the integer value is : "
      + int_val);
   }
}
56.789 99
Enter two floating point values : The floating point value is : 56.78900146484375 and the integer
value is : 99
A class named Demo contains the main function, inside which a Scanner class object is created, and
two values, one double and one integer values are parsed. The values are taken from the standard
input and then displayed on the console.
The Scanner object parses the input directly, without splitting it into multiple strings. In addition to
this, the user can input the data on a single line or on multiple lines.
How to Find Duplicate Values in Excel Using VLOOKUP?

06 Jun, 2021
In this article, we will look into how we can use the VLOOKUP to find duplicate values in Excel.
 To do so follow the below steps:
Let’s make two columns of different section to check VLOOKUP formula on columns:
Created Two Columns 
Here is the formula we are going to use:
=VLOOKUP(List1,List2,TRUE,FALSE)
In this formula, the List-1 names will be searched in List-2. If there exists any duplicate name, the formula will return the name from List-1. Let`s look closely at our example for better clarification.
In C2 we will write this formula =VLOOKUP(A2:A10,B2:B10,TRUE,FALSE) and then press enter.
Now, we will see this result:
Here Himesh is duplicate value
Here the Himesh is found because the VLOOKUP function searches this name from Section A to Section B. When the same name is found it will output the result from Section A.
Now drag the list and see all values.
Here we drag the formulated Cells
The #N/A results are found because, in those particular cells, the names from column A are not found in column B.
In the Result column, you’re seeing a total of 2 duplicate values ( Himesh, Pragya). #N/A values are representing the unique values of column Section A.
We can also use the VLOOKUP to find duplicate values between two Excel worksheets. To do so follow the below steps:
Make two excel workbooks Section A and Section B.
Two Workbooks
In the B2 of Section B type the below code and press enter:-
=IF(ISERROR(VLOOKUP(A2,'Section A'!A1:A10,1,0)),"Unique","Duplicate")
Section A and Section B on different workbooks
We can also use the VLOOKUP to find duplicate values between two Excel workbooks. To do so follow the below steps:
Now we create a new Section A in a new Workbook with different values.
New Workbook
And In our main workbook which we were working (in our last example), create another worksheet titled Sheet 1 and again create a list of products.
Another workbook named Sheet1
Now in cell C2 of Sheet1, write down the following formula and press enter.
=IF(ISERROR(VLOOKUP(B2,[VL]Section A!$A$2:$A$10,1,0)),"Unique", "Duplicate")
You will get the result as Unique because value does not exist in Section A.
Result
Now Drag Down the formulated cell to see out the result of the whole column.
Picked
Excel
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Hello World in Dart Programming

A Hello World program is the first program that you learn whenever you are learning a new programming language. It might be a simple program but it is a great entry point as you get to know how a program works in Dart, how to run a dart file. It provides a way to test the systems and environment that you are using.
An important prerequisite before running a Hello World in Dart is to have the Dart SDK installed on your local machine. You can install the Dart SDK from this link.
The first thing that you need to do is open the terminal or cmd (if you are on Windows) and then run the following command −
touch hello_world.dart
The above command will work on macOS and Linux operating systems. For windows, you can use any text editor of your choice and then save the file with the .dart extension.
The program will look something like this −
 Live Demo
void main(){
   print("Hello World");
}
Hello World
It looks very simple, in fact, it is. Though we need to understand some of the keywords that we used in the above program to understand it better.
main - the entry point of our program.
main - the entry point of our program.
void - the keyword that tells the compiler that we are not returning anything from the function.
void - the keyword that tells the compiler that we are not returning anything from the function.
print - the print function is used to print (output) whatever we put inside the parentheses.
print - the print function is used to print (output) whatever we put inside the parentheses.
Python iter() method

11 Apr, 2022
python iter() method returns the iterator object, it is used to convert an iterable to the iterator.
Syntax : iter(obj, sentinel)
Parameters : 
obj : Object which has to be converted to iterable ( usually an iterator ).
sentinel : value used to represent end of sequence.
Returns : Iterator object
Iteration object remembers iteration count via internal count variable.
Once the iteration is complete, it raises a StopIteration exception and the iteration count cannot be reassigned to 0.
Therefore, it can be used to traverse the container just once.
Python3
# Python3 code to demonstrate# working of iter() # initializing listlis1 = [1, 2, 3, 4, 5] # printing typeprint("The list is of type : " + str(type(lis1))) # converting list using iter()lis1 = iter(lis1) # printing typeprint("The iterator is of type : " + str(type(lis1))) # using next() to print iterator valuesprint(next(lis1))print(next(lis1))print(next(lis1))print(next(lis1))print(next(lis1))
The list is of type : <class 'list'>
The iterator is of type : <class 'list_iterator'>
1
2
3
4
5

Python3
# Python 3 code to demonstrate# property of iter() # initializing listlis1 = [1, 2, 3, 4, 5] # converting list using iter()lis1 = iter(lis1) # prints thisprint("Values at 1st iteration : ")for i in range(0, 5):    print(next(lis1)) # doesn't print thisprint("Values at 2nd iteration : ")for i in range(0, 5):    print(next(lis1))
Expected Output: 
Values at 1st iteration : 
1
2
3
4
5
Values at 2nd iteration : 
Actual Exception (Error): 
Traceback (most recent call last):
  File "/home/0d0e86c6115170d7cd9083bcef1f22ef.py", line 18, in 
    print (next(lis1))
StopIteration
kumar_satyam
arshadali02177
Python-Built-in-functions
python-list
python-list-functions
Python
python-list
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Different ways to create Pandas Dataframe
Read a file line by line in Python
Python String | replace()
How to Install PIP on Windows ?
*args and **kwargs in Python
Python Classes and Objects
Python OOPs Concepts
Convert integer to string in Python
Introduction To PYTHON