code-rag-bench/online-tutorials huggingface dataset:
How to create a pandas DataFrame using a list of tuples?

The pandas DataFrame constructor will create a pandas DataFrame object using a python list of tuples. We need to send this list of tuples as a parameter to the pandas.DataFrame() function.
The Pandas DataFrame object will store the data in a tabular format, Here the tuple element of the list object will become the row of the resultant DataFrame.
# importing the pandas package
import pandas as pd

# creating a list of tuples
list_of_tuples = [(11,22,33),(10,20,30),(101,202,303)]

# creating DataFrame
df = pd.DataFrame(list_of_tuples, columns= ['A','B','C'])

# displaying resultant DataFrame
print(df)
In the above example, we have a list with 3 tuple elements and each tuple is having again 3 integer elements, we pass this list object as data to the DataFrame constructor. Then it will create a DataFrame object with 3 rows and 3 columns.
A list of characters is given to the columns parameter, it will assign those characters as column labels of the resultant DataFrame.
      A     B    C
0    11    22    33
1    10    20    30
2   101   202   303
The resultant DataFrame object can be seen in the above output block with 3 rows and 3 columns, and the column label representation is A, B, C.
# importing the pandas package
import pandas as pd

# creating a list of tuples
list_of_tuples = [('A',65),('B',66),('C',67)]

# creating DataFrame
df = pd.DataFrame(list_of_tuples, columns=['Char', 'Ord'])

# displaying resultant DataFrame
print(df)
In this following example, we have created a simple pandas DataFrame object using the list of tuples and each tuple has a character and an integer value.
 Char  Ord
0   A   65
1   B   66
2   C   67
The output DataFrame is created by using the list of tuples in the above block, the column labels are ‘Char, Ord’, and the data is taken from tuple elements.
Camera Access in Flutter

30 Aug, 2020
To add images from the camera in flutter, we’ll use the image_picker package. For this, you’ll need to use your real device.
Follow the below steps to display the images from the camera:
Step 1: Create a new flutter application.
flutter create <APP_NAME>


Step 2: Delete the default code from the main.dart file.
Step 3: Add the dependency to your pubspec.yaml file:
Step 4: Use the below code in the main.dart file :
main.dart:
Dart
import 'dart:io';import 'package:flutter/material.dart';import 'package:image_picker/image_picker.dart';  void main() {  runApp(new MyApp());}  class MyApp extends StatelessWidget {  @override  Widget build(BuildContext context) {    return new MaterialApp(      home: new CameraAccess(),      debugShowCheckedModeBanner: false,    );  }}  class CameraAccess extends StatefulWidget {  @override  State<StatefulWidget> createState() {    return new CameraAccessState();  }}  class CameraAccessState extends State<CameraAccess> {  File cameraFile;    @override  Widget build(BuildContext context) {    //display image selected from gallery    selectFromCamera() async {      cameraFile=await ImagePicker.pickImage(        source: ImageSource.camera,        // maxHeight: 50.0,        // maxWidth: 50.0,      );      setState(() {});    }      return new Scaffold(      appBar: new AppBar(        title: new Text("Camera Access"),        backgroundColor: Colors.green,        actions: <Widget>[          Text("GFG",textScaleFactor: 3,)        ],      ),      body: new Builder(        builder: (BuildContext context) {          return Center(            child: new Column(              mainAxisAlignment: MainAxisAlignment.center,              children: <Widget>[                new RaisedButton(                  child: new Text('Select Image from Camera'),                  onPressed: selectFromCamera                ),                SizedBox(                  height: 200.0,                  width: 300.0,                  child: cameraFile == null                      ? Center(child: new Text('Sorry nothing selected!!'))                      : Center(child: new Image.file(cameraFile)),                )              ],            ),          );        },      ),    );  }}
Output:
When no image is selected, it will result:
When the button is tapped, the mobile’s camera will be opened to capture the image as shown below:
When the image is captured, it will be displayed on the screen as shown below:
Import image_picker package.
Create async selectFromCamera() function and await for camera image.
After loading the image from the camera, the image will be displayed on the screen.
android
Flutter
Dart
Flutter
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to download Google Images using Python

22 Jul, 2021
Python is a multi-purpose language and widely used for scripting. We can write Python scripts to automate day-to-day things. Let’s say we want to download google images with multiple search queries. Instead of doing it manually we can automate the process.
How to install needed Module :
pip install google_images_download
Let’s see how to write a Python script to download the Google images in Python using google_images_download module.
Below is the Python code :
# importing google_images_download modulefrom google_images_download import google_images_download   # creating objectresponse = google_images_download.googleimagesdownload()   search_queries = [      'The smartphone also features an in display fingerprint sensor.','The pop up selfie camera is placed aligning with the rear cameras.','''In terms of storage Vivo V15 Pro could offer   up to 6GB of RAM and 128GB of onboard storage.''','The smartphone could be fuelled by a 3 700mAh battery.',]    def downloadimages(query):    # keywords is the search query    # format is the image file format    # limit is the number of images to be downloaded    # print urs is to print the image file url    # size is the image size which can    # be specified manually ("large, medium, icon")    # aspect ratio denotes the height width ratio    # of images to download. ("tall, square, wide, panoramic")    arguments = {"keywords": query,                 "format": "jpg",                 "limit":4,                 "print_urls":True,                 "size": "medium",                 "aspect_ratio":"panoramic"}    try:        response.download(arguments)          # Handling File NotFound Error        except FileNotFoundError:         arguments = {"keywords": query,                     "format": "jpg",                     "limit":4,                     "print_urls":True,                      "size": "medium"}                               # Providing arguments for the searched query        try:            # Downloading the photos based            # on the given arguments            response.download(arguments)         except:            pass  # Driver Codefor query in search_queries:    downloadimages(query)     print() 
Output:
Note: Some images could not be open because of the downloading error. A separate “downloads” folder will be created with all the images.
TuhinMitra
Marketing
python-utility
Python
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Use rbind in Python? - GeeksforGeeks

28 Nov, 2021
In this article, we will discuss rbind() in python.
Here we have to take 2 dataframes with equal columns and apply concat() function. This will combine the rows based on columns.
Syntax:
pandas.concat([dataframe1, dataframe2])
where
dataframe1 is the first dataframe
dataframe2 is the second dataframe
Example:
Python3
# import pandas moduleimport pandas as pd  # create first dataframedata1 = pd.DataFrame({'fruits': ['apple', 'guava', 'mango', 'banana'],                      'cost': [34, 56, 65, 45]})  # create second dataframedata2 = pd.DataFrame({'fruits': ['cuatard apple', 'guava', 'mango', 'papaya'],                      'cost': [314, 86, 65, 51]})  # concat two columnspd.concat([data1, data2])
Output:
Here the two dataframes columns are not equal, In this scenario, the unmatched column will get NAN replaced rows in its column.
Syntax:
pandas.concat([dataframe1, dataframe2])
where,
dataframe1 is the first dataframe
dataframe2 is the second dataframe
Example:
Python3
# import pandas moduleimport pandas as pd  # create first dataframe with 2 columnsdata1 = pd.DataFrame({'fruits': ['apple', 'guava', 'mango', 'banana'],                      'cost': [34, 56, 65, 45]})  # create second dataframe with 3 columnsdata2 = pd.DataFrame({'fruits': ['cuatard apple', 'guava', 'mango', 'papaya'],                      'cost': [314, 86, 65, 51],                      'city': ['guntur', 'tenali', 'ponnur', 'hyd']})  # concat two columnspd.concat([data1, data2])
Output:
Here we observed that the index of the rows again starts from 0, in order to avoid this, we have to use the .reset_index() method. This will reset the index of the new dataframe.
Syntax:
pandas.concat([dataframe1, dataframe2]).reset_index(drop=True)
Example:
Python3
# import pandas moduleimport pandas as pd  # create first dataframe with 2 columnsdata1 = pd.DataFrame({'fruits': ['apple', 'guava', 'mango', 'banana'],                      'cost': [34, 56, 65, 45]})  # create second dataframe with 3 columnsdata2 = pd.DataFrame({'fruits': ['cuatard apple', 'guava', 'mango', 'papaya'],                      'cost': [314, 86, 65, 51],                      'city': ['guntur', 'tenali', 'ponnur', 'hyd']})  # concat two columnspd.concat([data1, data2]).reset_index(drop=True)
Output:
Picked
Python pandas-database
Python pandas-dataFrame-methods
Python-pandas
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
Python Classes and Objects
How to drop one or multiple columns in Pandas Dataframe
Defaultdict in Python
Python | Get unique values from a list
Python | os.path.join() method
Create a directory in Python
Python | Pandas dataframe.groupby()
NCHAR() Function in SQL Server - GeeksforGeeks

30 Dec, 2020
NCHAR() function :This function in SQL Server is used to return the Unicode character that is based on the number code.For example, if the specified number is 65 then this function will return A.
Features :
This function is used to find the Unicode character of a given number.
This function accepts only positive numbers.
This function also accepts decimal numbers but returns the output of the number code before decimal sign.
This function always returns a character.
Here, the number code starts from 65.
Syntax :
NCHAR(number_code)
Parameter :This method accepts a single parameter as given below :
number_code : Specified number code in the Unicode standard form in order to return the character for.
Returns :It returns the Unicode character that is based on the number code.
Example-1 :Getting the Unicode character of the number code 65.
SELECT NCHAR(65) AS NumberCodeToUnicode;
Output :
A
Here, the output is the first character as number code starts from 65.
Example-2 :Getting the Unicode character of the specified decimal number 70.76.
SELECT NCHAR(70.76) AS NumberCodeToUnicode;
Output :
F
Here, only the number code 70 is considered and the numbers after decimal is ignored.
Example-3 :Using NCHAR() function with a variable and getting the Unicode character of the specified number code 99.
DECLARE @number_code INT;  
SET @number_code = 99;  
SELECT NCHAR(@number_code);
Output :
c
Example-4 :Getting the Unicode character of 125 which is the result of “250/2”.
SELECT NCHAR(250/2);
Output :
}
Example-5 :Using NCHAR() function with a variable and getting the Unicode character of the specified float value “100.56”.
DECLARE @number_code Float;  
SET @number_code = 100.56;  
SELECT NCHAR(@number_code);
Output :
d
Application :This function is used to return the Unicode character of a specified number code which is a positive number.
DBMS-SQL
SQL-Server
SQL
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Update Multiple Columns in Single Update Statement in SQL?
SQL | Subquery
How to Create a Table With Multiple Foreign Keys in SQL?
What is Temporary Table in SQL?
SQL Query to Find the Name of a Person Whose Name Starts with Specific Letter
SQL Query to Convert VARCHAR to INT
SQL using Python
How to Write a SQL Query For a Specific Date Range and Date Time?
How to Select Data Between Two Dates and Times in SQL Server?
SQL Query to Compare Two Dates
turtle.filling() function in Python - GeeksforGeeks

28 Jul, 2020
The turtle module provides turtle graphics primitives, in both object-oriented and procedure-oriented ways. Because it uses Tkinter for the underlying graphics, it needs a version of Python installed with Tk support.
This function is used to return fillstate (True if filling, False else). It doesn’t require any argument.
Syntax :
turtle.filling()

Below is the implementation of the above method with some examples :
Example 1: Default value
Python3
# import packageimport turtle  # check the default # filling stateprint(turtle.filling())
Output :
False

Example 2: Inside fill
Python3
# import packageimport turtle  # begin the fill and check# the filling stateturtle.begin_fill()print(turtle.filling())
Output :
True

Example 3: After fill
Python3
# import packageimport turtle  # begin fill, do something and# end fill then check filling stateturtle.begin_fill()turtle.end_fill()print(turtle.filling())
Output :
False

Here we get that we can check the filling state anywhere in the program and get True only inside the fill statements ie; either after the begin_fill() method or in between the begin_fill() and end_fill() methods.
Python-turtle
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
How to drop one or multiple columns in Pandas Dataframe
Python Classes and Objects
Python | Get unique values from a list
Python | os.path.join() method
Defaultdict in Python
Create a directory in Python
Python | Pandas dataframe.groupby()
JavaScript window.close() Method - GeeksforGeeks

15 Dec, 2021
In this article, we will learn about the JavaScript window.close() method, which is used for closing a certain window or tab of the browser which was previously opened by the window.open() method. The window.close() method does not require any parameter. We will have some examples to completely understand its working process.
Syntax:
window.close();
Parameters: This method does not accept any parameters.
Example: In this example, at first we will use the window.open() method to open a new window, assign its value to a temporary variable, and use that variable with the window.close() method to close that page.
HTML
<!DOCTYPE html>  <head>    <title>Window open method</title>    <style>        body {            background-color: #272727;            display: flex;            justify-content: center;            align-items: center;            margin-top: 20%;        }          .main {            width: 30%;            height: 100%;            display: flex;            justify-content: center;            align-items: center;            flex-direction: column;            background-color: rgb(82, 82, 82);            margin: 10px;            font-family: 'Roboto', sans-serif;            color: rgb(214, 213, 213);            border-radius: 5px;            padding: 20px;        }          .btn {            width: 100%;            height: 50px;            background-color: rgb(29, 29, 29);            color: white;            font-size: 20px;            border: 2px solid rgb(82, 82, 82);            cursor: pointer;        }    </style></head>  <body>    <div class="main">        <h2>            Click the open and close button for            opening and closing the new window.        </h2>        <button class="btn open">Open</button>        <button class="btn close">Close</button>    </div>    <script>        var newPage = document.querySelector('.open')            .addEventListener('click', function () {                  newWindow =                    window.open('https://www.geeksforgeeks.org/',                     '_blank',                    'width=400,height=400 top=200,left=300');        });          document.querySelector('.close')        .addEventListener('click', function () {            newWindow.close();        });    </script></body>  </html>
Output:
JavaScript-Methods
Picked
JavaScript
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Remove elements from a JavaScript Array
Difference between var, let and const keywords in JavaScript
Difference Between PUT and PATCH Request
JavaScript | Promises
How to get character array from string in JavaScript?
Remove elements from a JavaScript Array
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?
PHP | ltrim() Function - GeeksforGeeks

10 Apr, 2018
The ltrim() function is a built-in function in PHP which removes whitespaces or other characters (if specified) from the left side of a string.
Syntax:
ltrim( $string, $charlist )
Parameters: The function ltrim() accepts two parameters as shown in the above syntax. Out of these two parameters, one is mandatory while the other one is optional. They are discussed in details below:
$string : This mandatory parameter specifies the string to be checked.
$charlist : This optional parameter specifies which characters are to be removed from the string.In case, this parameter is not provided, the following characters are removed :“\0” – NULL“\t” – tab“\n” – new line“\x0B” – vertical tab“\r” – carriage return” “ – ordinary white space
“\0” – NULL
“\t” – tab
“\n” – new line
“\x0B” – vertical tab
“\r” – carriage return
” “ – ordinary white space
Return Value: Returns the modified string.
Examples:
Input : $string = "            Geeks for Geeks"
Output : Geeks for Geeks

Input : $string = "!!! (( !!)) Geeks for Geeks", $charlist = "! ()"
Output : Geeks for Geeks

Below programs illustrate the ltrim() function :
Program 1 : This program shows the use of ltrim() function without any specified list of characters to be removed.
<?php  $string = "            Geeks for Geeks";  echo "Contribute to ".ltrim($string);  ?>
Output:
Contribute to Geeks for Geeks
Program 2: This program shows the use of ltrim() function with a specified list of characters to be removed.
<?php  $string = "!!! (( !!)) Geeks for Geeks";  // The characters '!', '(', ')', ' ' have // been specified to remove from the// beginning of the stringecho ltrim($string, "! ()");  ?>
Output:
Geeks for Geeks
Reference:http://php.net/manual/en/function.ltrim.php
PHP-string
PHP
Web Technologies
PHP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Insert Form Data into Database using PHP ?
How to convert array to string in PHP ?
How to check whether an array is empty using PHP?
PHP | Converting string to Date and DateTime
Comparing two dates in PHP
Remove elements from a JavaScript Array
Installation of Node.js on Linux
Convert a string to an integer in JavaScript
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?
JavaScript to push value in empty index in array

We have an array that contains some empty values inside it like this −
const arr = [43,534534,645,64,,645,64,,645,,645,,65,,645,,64];
We are required to write an Array function pushAtEmpty() which takes in an element and
pushes it at the first empty index it finds in the array it is used in context of. If there are no empty
spaces, the element should be pushed at the last of the array.
Let’s write the code for this function. We will first search for the index of empty position and then
replace the value there with the value we are provided with.
const arr = [43,534534,645,64,,645,64,,645,,645,,65,,645,,64];
Array.prototype.pushAtEmpty = function(element){
   let index;
   for(index = 0; index < this.length; index++){
      if(arr[index] === undefined){
         this.splice(index, 1, element);
         break;
      };
   };
   if(index === this.length){
      this.push(element);
   }
};
arr.pushAtEmpty(23);
arr.pushAtEmpty(33);
arr.pushAtEmpty(43);
arr.pushAtEmpty(53);
arr.pushAtEmpty(63);
arr.pushAtEmpty(73);
arr.pushAtEmpty(83);
arr.pushAtEmpty(93);
console.log(arr);
The output in the console will be −
[
   43, 534534, 645, 64,
   23, 645, 64, 33,
   645, 43, 645, 53,
   65, 63, 645, 73,
   64, 83, 93
]
Python program for sum of consecutive numbers with overlapping in lists

When it is required to sum the consecutive numbers with overlapping elements in lists, a list comprehension, list slicing, concatenation operator and ‘zip’ methods are used.
Below is a demonstration of the same −
my_list = [41, 27, 53, 12, 29, 32, 16]

print("The list is :")
print(my_list)

my_result = [a + b for a, b in zip(my_list, my_list[1:] + [my_list[0]])]

print("The result is :")
print(my_result)
The list is :
[41, 27, 53, 12, 29, 32, 16]
The result is :
[68, 80, 65, 41, 61, 48, 57]
A list of integers is defined and is displayed on the console.
A list of integers is defined and is displayed on the console.
A list comprehension is used to iterate over the elements.
A list comprehension is used to iterate over the elements.
The ‘zip’ method is used to obtain specific indices of the list and concatenate them using the ‘+’ operator.
The ‘zip’ method is used to obtain specific indices of the list and concatenate them using the ‘+’ operator.
This result is converted to a list and is assigned to a variable.
This result is converted to a list and is assigned to a variable.
This variable is displayed as output on the console.
This variable is displayed as output on the console.
How to remove consonants from a string using regular expressions in Java?

The simple character class “[ ]” matches all the specified characters in it. The meta character ^ acts as negation within the above character class i.e. the following expression matches all the characters except b (including spaces and special characters)
"[^b]"
Similarly, the following expression matches all the consonants in the given input string.
"([^aeiouyAEIOUY0-9\\W]+)";
Then you can remove the matched characters by replacing them with the empty string “”, using the replaceAll() method.
public class RemovingConstants {
   public static void main( String args[] ) {
      String input = "Hi welc#ome to t$utori$alspoint";
      String regex = "([^aeiouAEIOU0-9\\W]+)";
      String result = input.replaceAll(regex, "");
      System.out.println("Result: "+result);
   }
}
Result: i e#oe o $uoi$aoi
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class RemovingConsonants {
   public static void main( String args[] ) {
      Scanner sc = new Scanner(System.in);
      System.out.println("Enter input string: ");
      String input = sc.nextLine();
      String regex = "([^aeiouyAEIOUY0-9\\W])";
      String constants = "";
      //Creating a pattern object
      Pattern pattern = Pattern.compile(regex);
      //Matching the compiled pattern in the String
      Matcher matcher = pattern.matcher(input);
      //Creating an empty string buffer
      StringBuffer sb = new StringBuffer();
      while (matcher.find()) {
         matcher.appendReplacement(sb, "");
      }
      matcher.appendTail(sb);
      System.out.println("Result: \n"+ sb.toString() );
   }
}
Enter input string:
# Hello how are you welcome to Tutorialspoint #
Result:
# eo o ae you eoe o uoiaoi #
bitset size() in C++ STL - GeeksforGeeks

16 Jun, 2021
bitset::size() is a built-in STL in C++ which returns the total number of bits. 
Syntax:  
bitset_name.size()
Parameter: The function accepts no parameter. 
Return Value: The function returns an integral value which signifies the number of bits. It eventually returns the size that has been given while initializing the bitset.
Below programs illustrate the bitset::size() function. 
Program 1:  
C++
// C++ program to illustrate the// bitset::size() function// when input is a string #include <bits/stdc++.h>using namespace std; int main(){    // initialization of the bitset string    bitset<4> b1(string("1100"));    bitset<6> b2(string("010010"));     // prints the size i.e.,    // the number of bits in "1100"    cout << "The number of bits in " << b1         << " is " << b1.size() << endl;     // prints the size i.e.,    // the number of bits in  "010010"    cout << "The number of bits in " << b2         << " is " << b2.size() << endl;     return 0;}
The number of bits in 1100 is 4
The number of bits in 010010 is 6
 
Program 2: 
C++
// C++ program to illustrate the// bitset::size() function// when input is a number #include <bits/stdc++.h>using namespace std; int main(){    // initialization of the bitset string    bitset<3> b1(5);    bitset<5> b2(17);     // prints the size i.e.,    // the number of bits in 5    cout << "The number of bits in " << b1         << " is " << b1.size() << endl;     // prints the size i.e.,    // the number of bits in 17    cout << "The number of bits in "         << b2 << " is " << b2.size() << endl;     return 0;}
The number of bits in 101 is 3
The number of bits in 10001 is 5
 
ManasChhabra2
arorakashish0911
anikakapoor
CPP-bitset
CPP-Functions
STL
C++
STL
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Operator Overloading in C++
Iterators in C++ STL
Polymorphism in C++
Friend class and function in C++
Sorting a vector in C++
Convert string to char array in C++
Inline Functions in C++
List in C++ Standard Template Library (STL)
new and delete operators in C++ for dynamic memory
std::string class in C++
C++ nested if statements

It is always legal to nest if-else statements, which means you can use one if or else if statement inside another if or else if statement(s).
The syntax for a nested if  statement is as follows −
if( boolean_expression 1) {
   // Executes when the boolean expression 1 is true
   if(boolean_expression 2) {
      // Executes when the boolean expression 2 is true
   }
}

You can nest else if...else in the similar way as you have nested if statement.
#include <iostream>
using namespace std;
 
int main () {
   // local variable declaration:
   int a = 100;
   int b = 200;
 
   // check the boolean condition
   if( a == 100 ) {
      // if condition is true then check the following
      if( b == 200 ) {
         // if condition is true then print the following
         cout << "Value of a is 100 and b is 200" << endl;
      }
   }
   cout << "Exact value of a is : " << a << endl;
   cout << "Exact value of b is : " << b << endl;
 
   return 0;
}
When the above code is compiled and executed, it produces the following result −
Value of a is 100 and b is 200
Exact value of a is : 100
Exact value of b is : 200


    154 Lectures 
     11.5 hours 

 Arnab Chakraborty

    14 Lectures 
     57 mins

 Kaushik Roy Chowdhury

    30 Lectures 
     12.5 hours 

 Frahaan Hussain

    54 Lectures 
     3.5 hours 

 Frahaan Hussain

    77 Lectures 
     5.5 hours 

 Frahaan Hussain

    12 Lectures 
     3.5 hours 

 Frahaan Hussain
 Print
 Add Notes
 Bookmark this page
How to disable a link using only CSS? - GeeksforGeeks

06 Jan, 2020
To disable a link using CSS, pointer-events property can be used, which sets whether the element in the page has to respond or not while clicking on elements. The pointer-events property is used to specify whether element show to pointer events and whether not show on the pointer.
Below example illustrate the approach:
Example 1: Below code shows the use of property-events where ‘a’ tag is disabled, with no cursor (disabled cursor pointer on ‘a’ tag)
<!DOCTYPE html><html>  <head>    <title>Disable Link using CSS</title>    <style type="text/css">        .not-active {            pointer-events: none;            cursor: default;        }    </style></head>  <body>    <center>        <h1 style="color: green;">GeeksforGeeks</h1>        <h3>A Computer Science Portal for Geeks</h3>        <b>Disabled link:</b> To visit us           <a href="www.geeksforgeeks.org"             class="not-active">Click Here</a>        <br>        <br>        <b>Enabled link:</b> To use our ide           <a href=             "https://ide.geeksforgeeks.org/tryit.php">            Click Here</a>    </center></body>  </html>
Output: We can notice that although it looks like a link, nothing happens when we take pointer on it or click on it.
Example 2: This code shows CSS which applies to an ‘a’ tag so that it looks like, that the link is disabled, to do so, color and text-decoration property can be used.
<!DOCTYPE html><html>  <head>    <title>Disable Link using CSS</title>    <style type="text/css">        .not-active {            pointer-events: none;            cursor: default;            text-decoration: none;            color: black;        }    </style></head>  <body>    <center>        <h1 style="color: green;">GeeksforGeeks</h1>        <h3>A Computer Science Portal for Geeks</h3>        <b>Disabled link:</b> To visit us        <a href="www.geeksforgeeks.org" class="not-active">          Click Here        </a>        <br>        <br>        <b>Enabled link:</b> To use our ide        <a href="https://ide.geeksforgeeks.org/tryit.php">            Click Here        </a>    </center></body>  </html>
Output: Here it can be seen that it does not even look like a link.
CSS-Misc
Picked
Technical Scripter 2018
CSS
Technical Scripter
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to insert spaces/tabs in text using HTML/CSS?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to update Node.js and NPM to next version ?
How to create footer to stay at the bottom of a Web page?
How to apply style to parent if it has child with CSS?
Remove elements from a JavaScript Array
Installation of Node.js on Linux
Convert a string to an integer in JavaScript
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?
Bootstrap 4 .justify-content-*-center class

Use the justify-content-*-center class in Bootstrap 4 to center content on different screen sizes.
For different screen sizes −
justify-content-sm-center: Small Screen Size
justify-content-md-center: Medium Screen Size
justify-content-lg-center: Large Screen Size
justify-content-xl-center: Extra Large Screen Size
Let us see how to implement the justify-content-*-center class −
Live Demo
<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Bootstrap Example</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
  </head>
<body>
  <div class="container mt-3">
    <h3>Vehicle</h3>
    <div class="d-flex justify-content-sm-center bg-warning mb-5">
      <div class="p-2 bg-danger">Car</div>
      <div class="p-2 bg-info">Bike</div>
      <div class="p-2 bg-secondary">Truck</div>
    </div>
    <div class="d-flex justify-content-md-center bg-warning mb-5">
      <div class="p-2 bg-danger">Car</div>
      <div class="p-2 bg-info">Bike</div>
      <div class="p-2 bg-secondary">Truck</div>
    </div>
    <div class="d-flex justify-content-lg-center bg-warning mb-5">
      <div class="p-2 bg-danger">Car</div>
      <div class="p-2 bg-info">Bike</div>
      <div class="p-2 bg-secondary">Truck</div>
    </div>
    <div class="d-flex justify-content-xl-center bg-warning mb-5">
      <div class="p-2 bg-danger">Car</div>
      <div class="p-2 bg-info">Bike</div>
      <div class="p-2 bg-secondary">Truck</div>
    </div>
  </div>
</body>
</html>
Fabric.js Textbox textAlign Property - GeeksforGeeks

01 Feb, 2021
In this article, we are going to see how to set the text alignment of the canvas textbox using FabricJS. The canvas means textbox written is movable, rotatable, resizable, and can be stretched. In this article, we will set the text alignment.
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 textbox. After this, we will initialize instances of canvas and textbox provided by FabricJS and use the textAlign property to change the text alignment and render the canvas on the textbox as given in the example below.
Syntax:
fabric.Textbox('text', {
   textAlign: string
});
Parameters: This function accepts one parameter as mentioned above and described below.
textAlign: It specifies the value of text alignment.
Example: This example uses FabricJS to set the text alignment of canvas textbox as given below.
HTML
<!DOCTYPE html><html>  <head>     <!-- Adding the FabricJS library -->    <script src="https://cdnjs.cloudflare.com/ajax/libs/fabric.js/3.6.2/fabric.min.js">    </script></head>  <body>    <h1 style="color: green;">        GeeksforGeeks    </h1>      <h3>        Fabric.js | Textbox textAlign Property    </h3>      <canvas id="canvas" width="600" height="300"         style="border:1px solid #000000">    </canvas>      <script>          // Initiate a Canvas instance         var canvas = new fabric.Canvas("canvas");          // Create a new Textbox instance         var text = new fabric.Textbox(            'A Computer Science Portal', {            width: 500,            textAlign: "center"        });          // Render the Textbox in canvas         canvas.add(text);    </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
Difference between var, let and const keywords in JavaScript
Difference Between PUT and PATCH Request
How to get character array from string in JavaScript?
Remove elements from a JavaScript Array
How to get selected value in dropdown list using JavaScript ?
Top 10 Front End Developer Skills That You Need in 2022
Installation of Node.js on Linux
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?
Quine – A self-reproducing program

09 Aug, 2018
A quine is a program which prints a copy of its own as the only output. A quine takes no input. Quines are named after the American mathematician and logician Willard Van Orman Quine (1908–2000). The interesting thing is you are not allowed to use open and then print file of the program.
To the best of our knowledge, below is the shortest quine in C.
main() { char *s="main() { char *s=%c%s%c; printf(s,34,s,34); }"; printf(s,34,s,34); } 
This program uses the printf function without including its corresponding header (#include ), which can result in undefined behavior. Also, the return type declaration for main has been left off to reduce the length of the program. Two 34s are used to print double quotes around the string s.
Following is a shorter version of the above program suggested by Narendra.
main(a){printf(a="main(a){printf(a=%c%s%c,34,a,34);}",34,a,34);}
If you find a shorter C quine or you want to share quine in other programming languages, then please do write in the comment section.
Quine in Python
Source:http://en.wikipedia.org/wiki/Quine_%28computing%29
C Language
C++
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
C# | Tuple<T1,T2> Class

23 Nov, 2021
The Tuple<T1, T2> class is used to create a 2-tuple or pair. It represents a tuple which contains the two elements in it. You can instantiate a Tuple<T1, T2> object by calling either the Tuple<T1, T2>(T1, T2) constructor or by the static Tuple.Create method. You can retrieve the value of the tuple’s elements by using the read-only Item1 and Item2 instance property. Important Points:
It implements IStructuralComparable, IStructuralEquatable, and IComparable interface.
It defined under System namespace.
It represent multiple data into a single data set.
It allows us to create, manipulate, and access data set.
It returns multiple values from a method without using out parameter.
It allows passing multiple values to a method with the help of single parameters.
It can also store duplicate elements.
.tuple-class-table { border-collapse: collapse; width: 100%; } .tuple-class-table td { border: 1px solid #5fb962; text-align: left !important; padding: 8px; } .tuple-class-table th { border: 1px solid #5fb962; padding: 8px; } .tuple-class-table tr>th{ background-color: #c6ebd9; vertical-align: middle; } .tuple-class-table tr:nth-child(odd) { background-color: #ffffff; }  
Example:
CSharp
// C# program to illustrate the constructor// and property of Tuple<T1,T2> Classusing System; class GFG {     // Main Method    static public void Main()    {        // Creating 2-Tuple        // Using Tuple<T1, T2>(T1, T2) constructor        Tuple<int, int> mytuple = new Tuple<int, int>(79, 80);         // Accessing the values        Console.WriteLine("Value of the First Component: " + mytuple.Item1);        Console.WriteLine("Value of the Second Component: " + mytuple.Item2);    }}
Value of the First Component: 79
Value of the Second Component: 80
 
Example:
CSharp
// C# program to determine whether// the given tuples are equal or notusing System; public class GFG {     // Main method    static public void Main()    {         // Creating 2-Tuple        // Using Tuple<T1, T2>(T1, T2) constructor        Tuple<int, int> mytuple1 = new Tuple<int, int>(20, 40);        Tuple<int, int> mytuple2 = new Tuple<int, int>(20, 49);         // Using Equals method        if (mytuple1.Equals(mytuple2))        {            Console.WriteLine("Tuple Matched..");        }         else        {            Console.WriteLine("Tuple not matched..");        }    }}
Tuple not matched..
 
Reference: 
https://docs.microsoft.com/en-us/dotnet/api/system.tuple-2.item1?view=netframework-4
surindertarika1234
CSharp-Tuple
C#
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Collect.js | zip() Function

10 Jun, 2020
The zip() function is used to combine the values of given array with the values of original collection at a given index. In JavaScript, the array is first converted to a collection and then the function is applied to the collection.
Syntax: 
data.zip(value)

Parameters: This function accept a single parameter as mentioned above and described below:
values :  This parameter holds the values in the new array. 
Return value :  Return a new collection by margin the value with the main collection one by one. 
Below examples illustrate the zip() function in collect.js:Example 1: Here in this example, we take a collection and then using the zip() function we matched them with a array of corresponding items of a new collection using the zip() method
Javascript
// It is used to import collect.js library const collect = require('collect.js');  const fruits = collect(['Apple', 'Banana']);const quantity = fruits.zip([10, 15]);  console.log(quantity.all());
Output: 
[ Collection { items: [ 'Apple', 10 ] },
  Collection { items: [ 'Banana', 15 ] } ]

Example 2: 
Javascript
// It is used to import collect.js library  const collect = require('collect.js');  const people = collect(['Ram', 'Sham']);const age = people.zip([20, 25]);  console.log(age.all());
Output: 
[ Collection { items: [ 'Ram', 20 ] },
  Collection { items: [ 'Sham', 25 ] } ]

Reference: https://collect.js.org/api/zip.html
Collect.js
JavaScript
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Difference between var, let and const keywords in JavaScript
Remove elements from a JavaScript Array
JavaScript String includes() Method
Implementation of LinkedList in Javascript
DOM (Document Object Model)
Installation of Node.js on Linux
Top 10 Projects For Beginners To Practice HTML and CSS Skills
Difference between var, let and const keywords in JavaScript
REST API (Introduction)
How to fetch data from an API in ReactJS ?
fromtimestamp() Function Of Datetime.date Class In Python

28 Jul, 2021
The fromtimestamp() function is used to return the date corresponding to a specified timestamp.
Note: Here the timestamp is ranging from the year 1970 to the year 2038, and this function does not consider leap seconds if any present in the timestamp. This function is a class method.
Syntax: @classmethod fromtimestamp(timestamp)
Parameters: This function accepts a parameter which is illustrated below:
timestamp: This is the specified timestamp for which the date is going to be returned.
Return values: This function returns the date corresponding to a specified timestamp.
Example 1: Getting a date corresponding to an Epoch & Unix Timestamp. 
Python3
# Python3 code to demonstrate# Getting a date corresponding# to a specified timestamp  # Importing datetime and time module import datetimeimport time  # Calling the time() function# to return current timeTodays_time = time.time()  # Printing today's timeprint(Todays_time)    # Calling the fromtimestamp() function# to get date from the current timedate_From_CurrentTime = datetime.date.fromtimestamp(Todays_time);  # Printing the current dateprint("Date for the Timestamp is: %s"%date_From_CurrentTime);
Output:
1627279008.95
Date for the Timestamp is: 2021-07-26
Example 2: Getting a date corresponding to a specified timestamp.
Python3
# Python3 code to demonstrate# Getting a date corresponding# to a specified timestamp  # Importing datetime and time module import datetimeimport time  # Initializing a timestamp valueTimestamp = 1323456464;  # Calling the fromtimestamp() function# over the above specified Timestampdate_From_Timestamp = datetime.date.fromtimestamp(Timestamp);  # Printing the dateprint("Date for the Timestamp is: %s"%date_From_Timestamp);
Output:
Date for the Timestamp is: 2011-12-09
Picked
Python-datetime
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 | os.path.join() method
Introduction To PYTHON
Python OOPs Concepts
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
Create a directory in Python
Python – Constant Multiplication over List

14 Aug, 2021
While working with the python lists, we can come over a situation in which we require to multiply constant to each element in the list. We possibly need to iterate and multiply constant to each element but that would increase the line of code. Let’s discuss certain shorthands to perform this task.
Method #1 : Using List Comprehension List comprehension is just the short way to perform the task we perform using the naive method. This is mainly useful to save time and also is best among others when it comes to the readability of the code.
Python3
# Python3 code to demonstrate# Constant Multiplication over List# using list comprehension # initializing listtest_list = [4, 5, 6, 3, 9] # printing original listprint ("The original list is : " + str(test_list)) # initializing KK = 4 # using list comprehension# Constant Multiplication over Listres = [x * K for x in test_list] # printing resultprint ("The list after constant multiplication : " + str(res))
The original list is : [4, 5, 6, 3, 9]
The list after constant multiplication : [16, 20, 24, 12, 36]
 Method #2 : Using map() + operator.mul This is similar to the above function but uses the operator.mul to multiply each element to other element from the other list of K formed before applying the map function. It multiplies the similar index elements of list.
Python3
# Python3 code to demonstrate# Constant Multiplication over List# using map() + operator.mulimport operator # initializing listtest_list = [4, 5, 6, 3, 9] # printing original listprint ("The original list is : " + str(test_list)) # initializing K listK_list = [4] * len(test_list) # using map() + operator.mul# Constant Multiplication over Listres = list(map(operator.mul, test_list, K_list)) # printing resultprint ("The list after constant multiplication : " + str(res))
The original list is : [4, 5, 6, 3, 9]
The list after constant multiplication : [16, 20, 24, 12, 36]

varshagumber28
kk9826225
Python list-programs
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Different ways to create Pandas Dataframe
Enumerate() in Python
Python String | replace()
How to Install PIP on Windows ?
Python program to convert a list to string
Defaultdict in Python
Python | Get dictionary keys as a list
Python | Convert a list to dictionary
Python | Convert string dictionary to dictionary
Planar Graphs and their Properties

A graph 'G' is said to be planar if it can be drawn on a plane or a sphere so that no two edges cross each other at a non-vertex point.
Every planar graph divides the plane into connected areas called regions.
Degree of a bounded region r = deg(r) = Number of edges enclosing the regions r.
deg(1) = 3
deg(2) = 4
deg(3) = 4
deg(4) = 3
deg(5) = 8
Degree of an unbounded region r = deg(r) = Number of edges enclosing the regions r.
deg(R1) = 4
deg(R2) = 6
In planar graphs, the following properties hold good −
1. In a planar graph with 'n' vertices, sum of degrees of all the vertices isn ∑ i=1 deg(Vi) = 2|E|
1. In a planar graph with 'n' vertices, sum of degrees of all the vertices is
2. According to Sum of Degrees of Regions Theorem, in a planar graph with 'n' regions, Sum of degrees of regions is −n ∑ i=1 deg(ri) = 2|E|
2. According to Sum of Degrees of Regions Theorem, in a planar graph with 'n' regions, Sum of degrees of regions is −
Based on the above theorem, you can draw the following conclusions −
In a planar graph,
If degree of each region is K, then the sum of degrees of regions isK|R| = 2|E|
If degree of each region is K, then the sum of degrees of regions is
K|R| = 2|E|
If the degree of each region is at least K(≥ K), thenK|R| ≤ 2|E|
If the degree of each region is at least K(≥ K), then
K|R| ≤ 2|E|
If the degree of each region is at most K(≤ K), thenK|R| ≥ 2|E|
If the degree of each region is at most K(≤ K), then
K|R| ≥ 2|E|
Note − Assume that all the regions have same degree.
3. According to Euler's Formulae on planar graphs,
If a graph 'G' is a connected planar, then|V| + |R| = |E| + 2
If a graph 'G' is a connected planar, then
|V| + |R| = |E| + 2
If a planar graph with 'K' components then|V| + |R|=|E| + (K+1)
If a planar graph with 'K' components then
|V| + |R|=|E| + (K+1)
Where, |V| is the number of vertices, |E| is the number of edges, and |R| is the number of regions.
4. Edge Vertex Inequality
If 'G' is a connected planar graph with degree of each region at least 'K' then,
|E| ≤ k/k - 2{|v|-2}
You know, |V| + |R| = |E| + 2
       K.|R| ≤ 2|E|
      K(|E| - |V| + 2) ≤ 2|E|
      (K - 2)|E| ≤ K(|V| - 2)
      |E| ≤ k/k - 2{|v| - 2}
5. If 'G' is a simple connected planar graph, then
|E| ≤ 3|V| − 6
|R| ≤ 2|V| − 4
There exists at least one vertex V ∈ G, such that deg(V) ≤ 5
6. If 'G' is a simple connected planar graph (with at least 2 edges) and no triangles, then
|E| ≤ {2|V| – 4}
7. Kuratowski's Theorem
A graph 'G' is non-planar if and only if 'G' has a subgraph which is homeomorphic to K5 or K3,3.