code-rag-bench/online-tutorials huggingface dataset:
Python Pandas - How to select rows from a DataFrame by integer location

To select rows by integer location, use the iloc() function. Mention the index number of the row you want to select.
Create a DataFrame −
dataFrame = pd.DataFrame([[10, 15], [20, 25], [30, 35]],index=['x', 'y', 'z'],columns=['a', 'b'])
Select rows with integer location using iloc() −
dataFrame.iloc[1]

Following is the code −
import pandas as pd

# Create DataFrame
dataFrame = pd.DataFrame([[10, 15], [20, 25], [30, 35]],index=['x', 'y', 'z'],columns=['a', 'b'])

# DataFrame
print"DataFrame...\n",dataFrame

# select rows with loc
print"\nSelect rows by passing label..."
print(dataFrame.loc['z'])

# select rows with integer location using iloc
print"\nSelect rows by passing integer location..."
print(dataFrame.iloc[1])


This will produce the following output −
DataFrame...
     a    b
x   10   15
y   20   25
z   30   35

Select rows by passing label...
a   30
b   35
Name: z, dtype: int64

Select rows by passing integer location...
a   20
b   25
Name: y, dtype: int64
Retrieving Cookies in Python - GeeksforGeeks

16 Jul, 2020
Retrieving cookies in Python can be done by the use of the Requests library. Requests library is one of the integral part of Python for making HTTP requests to a specified URL. The below codes show different approaches to do show:
1. By requesting a session:
# import the requests libraryimport requests  # initialize a sessionsession = requests.Session()  # send a get request to the serverresponse = session.get('http://google.com')  # print the response dictionaryprint(session.cookies.get_dict())
Output:
{‘1P_JAR’: ‘2020-04-30-07’, ‘NID’: ‘203=GIlzlNytcSGjMtV-ML49xgKQax4NACMgFZi56sbQ3tSd9uDqL7EWZ6KC_gUqPsKkk-XsDIlca8ElKqhjsHGgWrPRwbbPBFXxcGL_G5Jd0gzdQYhCo-QALsZm4zItqIeImlBBTp_TDOgRQIW0d2hSNerxmQkljluhIA3QGLgNLnM’}
2.By requesting cookies list from the server:
import requests  r = requests.get('http://google.com')  for c in r.cookies:    print(c.name +"==>>", c.value)
Output:
1P_JAR==>> 2020-04-30-07
NID==>> 203=YvFCKkIeHS4SvpTVv8jw6MIGEU54IlN8V_1aQZrXmOU7Zdj74qZdW69E3A38KSP-GrE5xLmR40ozrHTFxkXm4-iaTm4DbhU4cwmvOWHEs1OZELI8H8KQLmBLCxccxCuHT07QQ2mqc-ppBYXhcHtOC7idVc9RWD2kmNPDMR-YMl4
Python-projects
python-utility
Python
Write From Home
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
How To Convert Python Dictionary To JSON?
Check if element exists in list in Python
Python | Pandas dataframe.groupby()
Convert string to integer in Python
Python infinity
How to set input type date in dd-mm-yyyy format using HTML ?
Matplotlib.pyplot.title() in Python
Factory method design pattern in Java
Tryit Editor v3.7

HTML file paths
Tryit: absolute url
Java Program to concatenate a String and Integers

To concatenate a String and some integer values, you need to use the + operator.
Let’s say the following is the string.
String str = "Demo Text";

Now, we will concatenate integer values.
String res = str + 1 + 2 + 3 + 4 + 5;

The following is the final example.
 Live Demo
public class Demo {
   public static void main(String[] args) {
      String str = "Demo Text";
      System.out.println("String = "+str);
      String res = str + 1 + 2 + 3 + 4 + 5;
      System.out.println(res);
   }
}
String = Demo Text
Demo Text12345
AIML - Introduction

AIML stands for Artificial Intelligence Markup Language. AIML was developed by the Alicebot free software community and Dr. Richard S. Wallace during 1995-2000. AIML is used to create or customize Alicebot which is a chat-box application based on A.L.I.C.E. (Artificial Linguistic Internet Computer Entity) free software.
Following are the important tags which are commonly used in AIML documents.
<aiml>
Defines the beginning  and end of a AIML document.
<category>
Defines the unit of knowledge in Alicebot's knowledge base.
<pattern>
Defines the pattern to match what a user may input to an Alicebot.
<template>
Defines the response of an Alicebot to user's input.
We'll discuss each of these tags in AIML Basic tags chapter.
Following are some of the other widely used aiml tags. We'll be discussing each tag in details in coming chapters.
<star>
Used to match wild card * character(s) in the <pattern> Tag.
<srai>
Multipurpose tag, used to call/match the other categories.
<random>
Used <random> to get random responses.
<li>
Used to represent multiple responses.
<set>
Used to set value in an AIML variable.
<get>
Used to get value stored in an AIML variable.
<that>
Used in AIML to respond based on the context.
<topic>
Used in AIML to store a context so that later conversation can be done based on that context.
<think>
Used in AIML to store a variable without notifying the user.
<condition>
Similar to switch statements in programming language. It helps ALICE to respond to matching input.
AIML vocabulary uses words, space and two special characters * and _ as wild cards. AIML interpreter gives preference to pattern having _ than pattern having *. AIML tags are XML compliant and patterns are case-insensitive.
<aiml version = "1.0.1" encoding = "UTF-8"?>
   <category>
      <pattern> HELLO ALICE </pattern>
      
      <template>
         Hello User!
      </template>
      
   </category>
</aiml>
Following are the important points to be considered −
<aiml> tag signifies start of the AIML document.
<aiml> tag signifies start of the AIML document.
<category> tag defines the knowledge unit.
<category> tag defines the knowledge unit.
<pattern> tag defines the pattern user is going to type.
<pattern> tag defines the pattern user is going to type.
<template> tag defines the response to the user if user types Hello Alice.
<template> tag defines the response to the user if user types Hello Alice.
User: Hello Alice
Bot: Hello User

 Print
 Add Notes
 Bookmark this page
F# - while..do Loops

The while...do expression is used to perform iterative execution while a specified test condition is true.
while test-expression do
   body-expression

The test-expression is evaluated first; if it is true, the body-expression is executed and the test expression is evaluated again. The body-expression must have type unit, i.e., it should not return any value. If the test expression is false, the iteration ends.
let mutable a = 10
while (a < 20) do
   printfn "value of a: %d" a
   a <- a + 1
When you compile and execute the program, it yields the following output −
value of a: 10
value of a: 11
value of a: 12
value of a: 13
value of a: 14
value of a: 15
value of a: 16
value of a: 17
value of a: 18
value of a: 19

 Print
 Add Notes
 Bookmark this page
Compute Cumulative Logistic Density in R Programming - plogis() Function - GeeksforGeeks

25 Jun, 2020
plogis() function in R Language is used to compute logistic cumulative density of the distribution. It also creates a plot of the density of the logistic cumulative distribution.
Syntax: plogis(vec)
Parameters:vec: Vector of x-values for density
Example 1:
# R program to calculate # cumulative logistic density  # Create a vector of x-valuesx <- seq(-1, 1, by = 0.1)  # Calling the plogis() functiony <- plogis(x)y
Output:
 [1] 0.2689414 0.2890505 0.3100255 0.3318122 0.3543437 0.3775407 0.4013123
 [8] 0.4255575 0.4501660 0.4750208 0.5000000 0.5249792 0.5498340 0.5744425
[15] 0.5986877 0.6224593 0.6456563 0.6681878 0.6899745 0.7109495 0.7310586

Example 2:
# R program to calculate # cumulative logistic density  # Create a vector of x-valuesx <- seq(-20, 20, by = 0.1)  # Calling the plogis() functiony <- plogis(x)  # Plot the graphplot(y)
Output:
R-Statistics
R Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to Replace specific values in column in R DataFrame ?
How to change Row Names of DataFrame in R ?
Filter data by multiple conditions in R using Dplyr
Loops in R (for, while, repeat)
Change Color of Bars in Barchart using ggplot2 in R
Printing Output of an R Program
How to Change Axis Scales in R Plots?
Group by function in R using Dplyr
How to Split Column Into Multiple Columns in R DataFrame?
K-Means Clustering in R Programming
Laravel - Facades

Facades provide a static interface to classes that are available in the application's service container. Laravel facades serve as static proxies to underlying classes in the service container, providing the benefit of a terse, expressive syntax while maintaining more testability and flexibility than traditional static methods.
The following are the steps to create Facade in Laravel −
Step 1 − Create PHP Class File.
Step 1 − Create PHP Class File.
Step 2 − Bind that class to Service Provider.
Step 2 − Bind that class to Service Provider.
Step 3 − Register that ServiceProvider to
Config\app.php as providers.
Step 3 − Register that ServiceProvider to
Config\app.php as providers.
Step 4 − Create Class which is this class extends to
lluminate\Support\Facades\Facade.
Step 4 − Create Class which is this class extends to
lluminate\Support\Facades\Facade.
Step 5 − Register point 4 to Config\app.php as aliases.
Step 5 − Register point 4 to Config\app.php as aliases.
Laravel ships with many Facades. The following table show the in-built Facade class references −
Step 1 − Create a service provider called TestFacadesServiceProvider by executing the following command.
php artisan make:provider TestFacadesServiceProvider

Step 2 − After successful execution, you will receive the following output −
Step 3 − Create a class called TestFacades.php at App/Test.
App/Test/TestFacades.php
<?php
   namespace App\Test;
   class TestFacades{
      public function testingFacades() {
         echo "Testing the Facades in Laravel.";
      }
   }
?>
Step 4 − Create a Facade class called “TestFacades.php” at “App/Test/Facades”.
App/Test/Facades/TestFacades.php
<?php

namespace app\Test\Facades;

use Illuminate\Support\Facades\Facade;

class TestFacades extends Facade {
   protected static function getFacadeAccessor() { return 'test'; }
}
Step 5 − Create a Facade class called TestFacadesServiceProviders.php at App/Test/Facades.
App/Providers/TestFacadesServiceProviders.php
<?php

namespace App\Providers;

use App;
use Illuminate\Support\ServiceProvider;

class TestFacadesServiceProvider extends ServiceProvider {
   public function boot() {
      //
   }
   public function register() {
      App::bind('test',function() {
         return new \App\Test\TestFacades;
      });
   }
}
Step 6 − Add a service provider in a file config/app.php as shown in the below figure.
config/app.php
Step 7 − Add an alias in a file config/app.php as shown in the below figure.
config/app.php
Step 8 − Add the following lines in app/Http/routes.php.
app/Http/routes.php
Route::get('/facadeex', function() {
   return TestFacades::testingFacades();
});

Step 9 − Visit the following URL to test the Facade.
http://localhost:8000/facadeex

Step 10 − After visiting the URL, you will receive the following output −

    13 Lectures 
     3 hours 

 Sebastian Sulinski

    35 Lectures 
     3.5 hours 

 Antonio Papa

    7 Lectures 
     1.5 hours 

 Sebastian Sulinski

    42 Lectures 
     1 hours 

 Skillbakerystudios

    165 Lectures 
     13 hours 

 Paul Carlo Tordecilla

    116 Lectures 
     13 hours 

 Hafizullah Masoudi
 Print
 Add Notes
 Bookmark this page
BigInteger toByteArray() Method in Java - GeeksforGeeks

12 Apr, 2022
The java.math.BigInteger.toByteArray() method returns a array of byte containing the two’s-complement representation of this BigInteger. The most significant byte of byte array is present in the zeroth element. The returning array from this method contain sing bit and contain the minimum number of bytes required to represent this BigInteger. The sign bit position is (ceil((this.bitLength() + 1)/8)). Syntax:
public byte[] toByteArray()
Parameters: This method does not accepts any parameters. Return Value: This method returns a byte array containing the two’s-complement representation of this BigInteger. Below programs illustrate toByteArray() method of BigInteger class: Example 1: 
Java
// Java program to demonstrate toByteArray() method of BigInteger import java.math.BigInteger; public class GFG {     public static void main(String[] args)    {         // Creating BigInteger object        BigInteger bigInt = BigInteger.valueOf(10);         // create a byte array        byte b1[];        b1 = bigInt.toByteArray();         // print result        System.out.print("ByteArray of BigInteger "                         + bigInt + " is");         for (int i = 0; i < b1.length; i++) {            System.out.format(" "                                  + "0x%02X",                              b1[i]);        }    }}
ByteArray of BigInteger 10 is 0x0A
Example 2: 
Java
// Java program to demonstrate toByteArray() method of BigInteger import java.math.BigInteger; public class GFG {     public static void main(String[] args)    {         // create byte array        byte b[] = { 0x1, 0x2, 0x1 };         // Creating BigInteger object using byte Array        BigInteger bigInt = new BigInteger(b);         // apply toByteArray() on BigInteger        byte b1[] = bigInt.toByteArray();         // print result        System.out.print("ByteArray of BigInteger "                         + bigInt + " is");         for (int i = 0; i < b1.length; i++) {            System.out.format(" "                                  + "0x%02X",                              b1[i]);        }    }}
ByteArray of BigInteger 66049 is 0x01 0x02 0x01
Reference: https://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html#toByteArray()
sumitgumber28
Java-BigInteger
Java-Functions
java-math
Java-math-package
Java
Java-BigInteger
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Different ways of Reading a text file in Java
Constructors in Java
Stream In Java
Exceptions in Java
Generics in Java
Functional Interfaces in Java
Comparator Interface in Java with Examples
Strings in Java
HashMap get() Method in Java
StringBuilder Class in Java with Examples
Java Program to Compare Strings

You can compare two Strings in Java using the compareTo() method, equals() method or == operator.
The compareTo() method compares two strings. The comparison is based on the Unicode value of each character in the strings. The character sequence represented by this String object is compared lexicographically to the character sequence represented by the argument string.
The result is a negative integer if this String object lexicographically precedes the argument string.
The result is a positive integer if this String object lexicographically follows the argument string.
The result is zero if the strings are equal, compareTo returns 0 exactly when the equals(Object) method would return true.
Live Demo
public class StringCompareEmp{
   public static void main(String args[]){
      String str = "Hello World";
      String anotherString = "hello world";
      Object objStr = str;
      System.out.println( str.compareTo(anotherString) );
      System.out.println( str.compareToIgnoreCase(anotherString) );
      System.out.println( str.compareTo(objStr.toString()));
   }
}
-32
0
0
The equals() method of the String class compares this string to the specified object. The result is true if and only if the argument is not null and is a String object that represents the same sequence of characters as this object.
Live Demo
public class StringCompareEqual{
   public static void main(String []args){
      String s1 = "tutorialspoint";
      String s2 = "tutorialspoint";
      String s3 = new String ("Tutorials Point");
      System.out.println(s1.equals(s2));
      System.out.println(s2.equals(s3));
   }
}
true
false
You can also compare two strings using == operator. But, it compares references to the given variables, not values.
public class StringCompareequl{
   public static void main(String []args){
      String s1 = "tutorialspoint";
      String s2 = "tutorialspoint";
      String s3 = new String ("Tutorials Point");
      System.out.println(s1 == s2);
      System.out.println(s2 == s3);
   }
}
true
false
How do I plot two countplot graphs side by side in Seaborn using Matplotlib?

To plot two countplot graphs side by side in Seaborn, we can take the following steps −
To create two graphs, we can use nrows=1, ncols=2 with figure size (7, 7).
To create two graphs, we can use nrows=1, ncols=2 with figure size (7, 7).
Create a dataframe with keys, col1 and col2, using Pandas.
Create a dataframe with keys, col1 and col2, using Pandas.
Use countplot() to show the counts of observations in each categorical bin using bars.
Use countplot() to show the counts of observations in each categorical bin using bars.
Adjust the padding between and around the subplots.
Adjust the padding between and around the subplots.
To display the figure, use show() method.
To display the figure, use show() method.
import pandas as pd
import numpy as np
import seaborn as sns
from matplotlib import pyplot as plt

plt.rcParams["figure.figsize"] = [7.00, 3.50]
plt.rcParams["figure.autolayout"] = True
f, axes = plt.subplots(1, 2)
df = pd.DataFrame(dict(col1=np.linspace(1, 10, 5), col2=np.linspace(1, 10, 5)))
sns.countplot(df.col1, x='col1', color="red", ax=axes[0])
sns.countplot(df.col2, x="col2", color="green", ax=axes[1])
plt.show()
Explain Squeeze Function C language

Squeeze(s1,s2) or squeeze(char[],char[]) is a user defined function which is used to delete the common characters or equal characters in two strings.
How to delete the common characters in two strings using squeeze function in C programming language?
In this program, the user enters two strings in the console and write a code to display first string excluding the common characters present in second string.
The C program which demonstrates the functioning of squeeze function is as follows −
 Live Demo
#include<stdio.h>
void squeeze(char string1[],char string2[]);//prototype declaration
int main(){
   char string1[50];
   char string2[30];
   printf("enter the string1:");
   scanf("%s",string1);// read string1 from keyboard
   printf("enter the string2:");
   scanf("%s",string2);// read string2 from keyboard
   squeeze(string1,string2);//call squeeze function
   printf("Final string is:%s\n",string1);
   return 0;
}
void squeeze(char string1[],char string2[]){
   int i,j,k;
   for(i=k=0;string1[i]!='\0';i++){
      for(j=0;string2[j]!='\0' && string2[j]!=string1[i];j++)
         if(string2[j]=='\0')
         string1[k++]=string1[i];
   }
   string1[k]='\0';
}
The output is stated below −
Enter the string1 : Tutorial
Enter the string2 : ut
Final string : Torial
How to Remove % Sign From Data Table | by Benjamin Obi Tayo Ph.D. | Towards Data Science

Data wrangling is the process of transforming raw unstructured to a form that is ready for further analysis such as data visualization or for model building. Sometimes after wrangling your data, you may notice that some columns may contain symbols such as the dollar sign ($), plus sign (+), minus sign (-) or the percentage sign (%). Any data column containing one of these signs is treated as string type and hence cannot be used for numerical calculations.
In this article, I will show how the percentage sign (%) can be removed from a data column. Then once the % sign is removed, we shall convert the column from string to numeric type, to render it suitable for numerical manipulations and calculations. A similar approach could be used for removing unwanted signs such as plus sign (+), minus sign (-), and so on.
I will illustrate this example with a dataset extracted from a pdf file as shown below:
a) Copy and past table to Excel and save the file as table_1_raw.csv
Data is stored in one-dimensional format and has to be reshaped, cleaned, and transformed.
b) Import necessary libraries
import pandas as pdimport numpy as np
c) Import raw data and reshape the data
df = pd.read_csv("table_1_raw.csv", header=None)df2 = pd.DataFrame(df.values.reshape(25,10))column_names = df2[0:1].values[0]df3 = df2[1:]df3.columns = df2[0:1].values[0]df3.head()
d) Perform data wrangling using string processing tools
We notice from the table above that columns x5, x6, and x7 are expressed in percentages, so we need to get rid of the percent (%) symbol:
df4['x5'] = list(map(lambda x: x[:-1], df4['x5'].values))df4['x6'] = list(map(lambda x: x[:-1], df4['x6'].values))df4['x7'] = list(map(lambda x: x[:-1], df4['x7'].values))
e) Convert data to numeric form
We note that column values for columns x5, x6, and x7 have data types of string (even after the % symbol has been removed), so we need to convert these to numeric data as follows:
df4['x5'] = [float(x) for x in df4['x5'].values]df4['x6'] = [float(x) for x in df4['x6'].values]df4['x7'] = [float(x) for x in df4['x7'].values]
f) View final form of the transformed data
df4.head(n = 5)
g) Export final data to a csv file
df4.to_csv('table_1_final.csv',index = False)
In summary, we’ve shown how the percent sign (%) can be removed from a data column, and how the column can be converted into numerical type to render it suitable for numerical calculations. A similar approach could be used for removing unwanted signs such as plus sign (+), minus sign (-), and so on.
Character.charValue() in Java with examples - GeeksforGeeks

06 Dec, 2018
Java.lang.Character.charValue() is a built-in method in Java that returns the value of this character object. This method converts the Character object into its primitive data type char.
Syntax:
public char charValue() 

The function does not accepts any parameter. 

Return Type: This method returns the primitive char value represented by this object.
Below programs illustrate the Java.lang.Character.charValue() method:
Program 1:
// Java program to demonstrate the// Java.lang.Character.charValue() method// when the assigned char is a character  import java.lang.*;  public class Gfg1 {      public static void main(String[] args)    {        // Create a character object        Character x = new Character('z');          // assign the primitive value to a character        char ch = x.charValue();          System.out.println("Primitive char value is " + ch);    }}
Primitive char value is z

Program 2: When we assign the value of x by any digit:
// Java program to demonstrate the// function when the assigned value is// a numberimport java.lang.*;  public class Gfg {      public static void main(String[] args)    {        // create a Character object x        Character x = new Character('9');          // assign value is a number        // assign the primitive value to a character        char ch = x.charValue();            // print the primitive char value        System.out.println("Primitive char value is " + ch);    }}
Primitive char value is 9

Java-Character
Java-Functions
Java-lang package
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Object Oriented Programming (OOPs) Concept in Java
HashMap in Java with Examples
How to iterate any Map in Java
Interfaces in Java
Initialize an ArrayList in Java
ArrayList in Java
Stack Class in Java
Multidimensional Arrays in Java
Singleton Class in Java
LinkedList in Java
Calculating Wind Chill Factor(WCF) or Wind Chill Index(WCI) in Python

Wind Chill Factor is an indication of how cold we feel not just because of the atmospheric temperature but also taking into account the speed of the wind. It combines both these factors in form of an equation and gives us a measurement of how cold it actually feels when the wind blows at a higher speed even without any change in temperature.
Below is the equation for calculating the Wind Chill Factor.
Twc=13.12 + 0.6215Ta-11.37v+0.16 + 0.3965Tav+0.16
where Twc is the wind chill index, based on the Celsius temperature scale;
Ta is the air temperature in degrees Celsius; and v is the wind speed at 10 m
(33 ft) standard anemometer height, in kilometres per hour.[9]
 To apply this formula for calculating the value of the wind chill factor we will use the python math library as the power function in available in it. The below program achieves this. 
import math
wind = float(input("Enter wind speed in kilometers/hour: "))
temperature = float(input("Enter air temperature in degrees Celsius: "))
wind_chill_factor_index = 13.12 + 0.6215*temperature \
   - 11.37*math.pow(wind , 0.16) \
   + 0.3965*temperature*math.pow(wind , 0.16)
print("The wind chill index is", int(round( wind_chill_factor_index, 0)))
Running the above code gives us the following result −
Enter wind speed in kilometers/hour: 16
Enter air temperature in degrees Celsius: 27
The wind chill index is 29
How to create an ordered list using HTML5 ? - GeeksforGeeks

03 Jun, 2020
In this article, we define an ordered list by using the <ol> tag in the document, This tag is used for ordered list, an ordered list can be numerical or alphabetical. Inside the <ol> tag you have to make a list li of items that will follow the order.
Syntax:
<ol>
   <li>Item1</li>
   <li>Item2</li>
   <li>Item3</li>
</ol>

Example:
<!DOCTYPE html><html>  <head>    <title>        Define an ordered list?    </title></head>  <body>    <h1 style="color:green;">        GeeksforGeeks    </h1>      <h3>        HTML5: How to define         an ordered list?    </h3>      <p>reversed attribute</p>    <ol reversed>        <li>HTML</li>        <li>CSS</li>        <li>JS</li>    </ol>      <p>start attribute</p>    <ol start=5>        <li>HTML</li>        <li>CSS</li>        <li>JS</li>    </ol>      <p>type attribute</p>    <ol type="i">        <li>HTML</li>        <li>CSS</li>        <li>JS</li>    </ol></body>  </html> 
Output:
Supported Browsers:
Google Chrome
Internet Explorer
Firefox
Opera
Safari
 
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.
HTML-Basics
HTML-Misc
HTML
Web Technologies
Web technologies Questions
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
REST API (Introduction)
Design a web page using HTML and CSS
Form validation using jQuery
How to place text on image using HTML and CSS?
How to auto-resize an image to fit a div container using CSS?
Top 10 Front End Developer Skills That You Need in 2022
Installation of Node.js on Linux
How to fetch data from an API in ReactJS ?
Difference between var, let and const keywords in JavaScript
Convert a string to an integer in JavaScript
How do we upload external file on a website using HTML forms?

If you want to allow a user to upload an external file to your website, you need to use a file upload box, also known as a file select box. This is also created using the <input> element but type attribute is set to file.
Live Demo
You can try to run the following code to upload an external file to your website −
<!DOCTYPE html>
<html>
   <head>
      <title>File Upload</title>
   </head>
   <body>
      <form>
         <input type = "file" name = "upload" accept = "image/*" />
      </form>
   </body>
</html>
Here are the attributes of the file upload box −
How can I restore multiple databases or all databases dumped by mysqldump?

Suppose if we have dumped multiple databases or all the databases and now want to restore it then we can do it with the following example −
C:\mysql\bin>mysql -u root < tutorials_query1.sql
With the help of above query, we are restoring the dumped multiple databases named ‘tutorials’ and ‘query1’, which are dumped in the file named ‘tutorials_query1.sql’. In this case, we do not need to write the name of the database.
Similarly, with the help of the following query, we can restore all the databases dumped by mysqldump −
C:\mysql\bin>mysql -u root < alldatabases.sql
With the help of above query, we are restoring all the dumped databases, which are dumped in the file named ‘alldatabases.sql’. In this case, we do not need to write the name of the database.
Python program to print the hexadecimal value of the numbers from 1 to N

03 Jan, 2021
Given a number N, the task is to write a Python program to print the hexadecimal value of the numbers from 1 to N.
Examples:
Input: 3
Output: 1
        2
        3

Input: 11
Output: 1
        2
        3
        4
        5
        6
        7
        8
        9
        a
        b
Approach:
We will take the value of N as input.
Then, we will run the for loop from 1 to N+1 and traverse each “i” through hex() function.
Print each hexadecimal value.
Note: The hex() function is one of the built-in functions in Python3, which is used to convert an integer number into its corresponding hexadecimal form.
Below are the implementations based on the above approach:
Python3
# Python program to print the hexadecimal value of the # numbers from 1 to N  # Function to find the hexadecimal value of the numbers# in the range 1 to Ndef hex_in_range(n):          # For loop traversing from 1 to N (Both Inclusive)    for i in range(1, n+1):                  # Printing hexadecimal value of i        print(hex(i)[2:])  # Calling the function with input 3print("Input: 3")hex_in_range(3)  # Calling the function with input 11print("Input: 11")hex_in_range(11)
Output:
Input: 3
1
2
3
Input: 11
1
2
3
4
5
6
7
8
9
a
b
Python-Built-in-functions
Technical Scripter 2020
Python
Python Programs
Technical Scripter
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Python Classes and Objects
Python OOPs Concepts
Introduction To PYTHON
How to drop one or multiple columns in Pandas Dataframe
Defaultdict in Python
Python | Get dictionary keys as a list
Python | Convert a list to dictionary
Python | Convert string dictionary to dictionary
Python Program for Fibonacci numbers
Containers in Bootstrap with examples

27 Apr, 2022
In bootstrap, the container is used to set the content’s margin. It contains row elements and the row elements are containers of columns. This is known as the grid system. There are two container classes in bootstrap:  
.container.container-fluid
.container
.container-fluid
Let’s look at each of the above two classes in detail with examples:
.container: The .container class provides a responsive fixed width container.In the below example, the div with class “container” will have a fixed left and right margin and will not take the complete width of its parent or the viewport.
HTML
<!-- Bootstrap container class --><!DOCTYPE html><html><head>    <title>Bootstrap Container Example</title>    <!-- Add Bootstrap Links -->    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/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/3.3.7/js/bootstrap.min.js">    </script></head><body>    <!-- Since we are using the class container, the below        div will not take complete width of its parent. -->    <div class="container" style="background: green;">        <h1>GeeksforGeeks</h1>         <p>A computer science portal for geeks.</p>     </div></body></html>
Output:
.container-fluid: The .container-fluid class provides a full-width container which spans the entire width of the viewport.In the below example, the div with class “container-fluid” will take up the complete width of the viewport and will expand or shrink whenever the viewport is resized. 
HTML
<!-- Bootstrap container-fluid class --><!DOCTYPE html><html><head>    <title>Bootstrap Container Example</title>    <!-- Add Bootstrap Links -->    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/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/3.3.7/js/bootstrap.min.js">    </script></head><body>    <!-- Since we are using the class container-fluid, the        below div will expand whenever the viewport is resized. -->    <div class="container-fluid" style="background: green;">        <h1>GeeksforGeeks</h1>         <p>A computer science portal for geeks.</p>     </div></body></html>
Output:
Supported Browser:
Google Chrome
Internet Explorer
Firefox
Opera
Safari
ysachin2314
sahilintern
Picked
Bootstrap
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to change navigation bar color in Bootstrap ?
Form validation using jQuery
How to pass data into a bootstrap modal?
How to align navbar items to the right in Bootstrap 4 ?
How to set Bootstrap Timepicker using datetimepicker library ?
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
How to insert spaces/tabs in text using HTML/CSS?
How to fetch data from an API in ReactJS ?
How to specify no border in CSS ?

26 Mar, 2021
We can specify the no border property using CSS border: none, border-width : 0, border : 0 properties.
Approach 1:
We will give border-color, border-style properties to both headings, for showing text with border and no-border.
For no border heading, we will use the border-width : 0 which will result in no border.
Example:
HTML
<!DOCTYPE html><html><head>   <title>No Border CSS</title></head><body> <h1 style="border-color : red ;            border-style : solid ;            border-width : 0">GFG Best For Interview Preparation And Much more</h1> <h1 style="border-color : red ;            border-style : solid ;">GFG Best For Interview Preparation And Much more</h1></body></html>
Output :
no border 
Approach 2 :
 We will give border-color, border-style properties to both headings, for showing text with border and no-border.
For no border heading, we will use the border : 0 which will result in no border.
Example:
HTML
<!DOCTYPE html><html><head>  <title>No Border CSS</title></head><body> <h1 style="border-color : green ;            border-style : solid ;            border : 0">GFG Best For Interview Preparation And Much more</h1> <h1 style="border-color : green ;            border-style : solid ;">GFG Best For Interview Preparation And Much more</h1></body></html>
Output :
no border 
Approach 3:
 We will give border-color, border-style properties to both headings, for showing text with border and no-border.
For no border heading, we will use the border: none which will result in no border.
Example:
HTML
<!DOCTYPE html><html><head> <title>No Border CSS</title></head><body> <h1 style="border-color : green ;            border-style : solid ;            border : none">GFG Best For Interview Preparation And Much more</h1> <h1 style="border-color : green ;            border-style : solid ;">GFG Best For Interview Preparation And Much more</h1></body></html>
Output :
no border
CSS-Properties
CSS-Questions
Picked
CSS
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Design a Tribute Page using HTML & CSS
How to set space between the flexbox ?
Build a Survey Form using HTML and CSS
Form validation using jQuery
Design a web page using HTML and CSS
Installation of Node.js on Linux
Difference between var, let and const keywords in JavaScript
How to fetch data from an API in ReactJS ?
Differences between Functional Components and Class Components in React
Remove elements from a JavaScript Array
MongoDB – countDocuments() Method

05 Feb, 2021
In MongoDB, the countDocuments() method counts the number of documents that matches to the selection criteria. It returns a numeric value that represents the total number of documents that match the selection criteria. It takes two arguments first one is the selection criteria and other is optional. 
This method does not use metadata to return the count. It performs aggregation of the documents and returns a precise count.
You are allowed to use this method in multi-document transactions.
This method returns 0 for empty collection or if the given collection is not present in the database.
In this method, you are not allowed to use $where, $near, and $nearSphere operators as a part of the query expressions. 
Syntax:
db.Collection_name.countDocuments(
<Selection_criteria>,
{
    limit: <integer>,
    skip: <integer>,
    hint: <string or document>,
    maxTimeMS: <integer>,  
})
Parameters:
The first parameter is a selection criteria. The type of this parameter is a document. If you want to count the total number of documents present in the collection pass an empty document({}).
The second parameter is optional.
Optional Parameters:
limit: It is the maximum number of documents to count.
skip: It is the number of documents to skip before counting.
hint: It is a document or field that specifies the index to use to support the filter. It can take an index specification document or the index name string and if you specify an index that does not exist, then it will give an error.
maxTimeMs: It is the maximum amount of time to allow the query to run.
Return:  
This method returns the number of documents that match to selection criteria.
Examples:
In the following examples, we are working with:
Database: gfg
Collections: student
Document: Four documents contains name and age of the students
Count the number of documents in the given collection:
db.student.countDocuments({})
Here, we are counting the total number of documents present in the student collection.
Count the number of documents that match the given selection criteria:
db.student.countDocuments({age:{$gt:18}})
Here, we are counting the total number of documents in the student collection that matches the given condition, i.e., age is greater than 18.
Note: Here, $gt mean greater than
MongoDB-method
Picked
MongoDB
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
MongoDB Cursor
MongoDB - Index Types
Capped Collections in MongoDB
MongoDB - Map Reduce
How to connect MongoDB with ReactJS ?
MongoDB - Replication and Sharding
MongoDB Tutorial
MongoDB - sort() Method
Spring Boot - CRUD Operations using MongoDB
MongoDB updateOne() Method - db.Collection.updateOne()
SUBSTRING_INDEX() function in MySQL

23 Sep, 2020
SUBSTRING_INDEX() function in MySQL is used to return a substring from a string before a specified number of occurrences of the delimiter.
Syntax :
SUBSTRING_INDEX( str, delim, count )

Parameter : This method accepts three-parameter as mentioned above and described below :
str : The original string from which we want to create a substring.
delim : Is a string that acts as a delimiter. The function performs a case-sensitive match when searching for the delimiter.
count : It identifies the number of times to search for the delimiter. It can be both a positive or negative number. If it is a positive number, this function returns all to the left of the delimiter. If it is a negative number, this function returns all to the right of the delimiter.
Returns : It returns substring from a given string.
Example-1 : SUBSTRING_INDEX() function with a positive number of occurrences of a delimiter
SELECT SUBSTRING_INDEX("www.geeksforgeeks.org", ".", 2) as Sub_Str;

Output :
Example-2 : SUBSTRING_INDEX() function with a negative number of occurrences of a delimiter.
SELECT SUBSTRING_INDEX("www.geeksforgeeks.org", ".", -2) as Sub_Str;

Output :
Example-3 : SUBSTRING_INDEX() function with the table data.
Table : Employee :
Now, we will find the pin number address of every employee by using SUBSTRING_INDEX function.
SELECT  SUBSTRING_INDEX(Address, '  ', 1 )  AS Pin_Num FROM Employee 

Output :
DBMS-SQL
mysql
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?
Window functions in SQL
What is Temporary Table in SQL?
SQL using Python
SQL | Sub queries in From Clause
SQL Query to Find the Name of a Person Whose Name Starts with Specific Letter
RANK() Function in SQL Server
SQL Query to Convert VARCHAR to INT
SQL Query to Compare Two Dates
SQL | DROP, TRUNCATE
numpy.degrees() and rad2deg() in Python

04 Dec, 2020
The numpy.degrees() is a mathematical function that helps user to convert angles from radians to degrees.
Syntax : numpy.degrees(x[, out]) = ufunc ‘degrees’)Parameters :
array : [array_like] elements are in radians.out : [ndaaray, optional] Output array of same shape as x.        2pi Radians = 360 degrees
Return : An array with degree values in place of radian values.
 Code #1 : Working
# Python3 program explaining# degrees() functionimport numpy as npimport math  in_array = [0, math.pi / 2, np.pi / 3, np.pi]print ("Radian values : \n", in_array)  degree_Values = np.degrees(in_array)print ("\nDegree values : \n", degree_Values)
Output :
Radian values : 
 [0, 1.5707963267948966, 1.0471975511965976, 3.141592653589793]

Degree values : 
 [   0.   90.   60.  180.]

 
numpy.rad2deg(x[, out]) = ufunc ‘rad2deg’) : This mathematical function helps user to convert angles from radians to degrees.
Parameters :
array : [array_like] elements are in radians.out : [ndaaray, optional]Output array of same shape as x.        2pi Radians = 36o degrees
Return : Corresponding angles in degree.
 Code #2 : rad2deg() Equivalent to degree()
# Python3 program explaining# rad2deg() function  import numpy as npimport math  in_array = [0, math.pi / 2, np.pi / 3, np.pi]print ("Radian values : \n", in_array)  out_Values = np.rad2deg(in_array)print ("\nDegree values : \n", out_Values)
Output :
Radian values : 
 [0, 1.5707963267948966, 1.0471975511965976, 3.141592653589793]

Degree values : 
 [   0.   90.   60.  180.]

 References : https://docs.scipy.org/doc/numpy-dev/reference/generated/numpy.degrees.html#numpy.degrees.
Python numpy-Mathematical Function
Python-numpy
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Different ways to create Pandas Dataframe
Enumerate() in Python
Read a file line by line in Python
Python String | replace()
How to Install PIP on Windows ?
*args and **kwargs in Python
Python Classes and Objects
Iterate over a list in Python
Python OOPs Concepts
What is the use of ini_set() in PHP?

PHP allows the user to modify some of its settings mentioned in php.ini using ini_set(). This function requires two string arguments. The first one is the name of the setting to be modified and the second one is the new value to be assigned to it.
Not all the available options can be changed using ini_set(). There is a list of all available options in the appendix.
The new value for the option.
<?php
   ini_set('display_errors', '1');
?>
Given the line of code will enable the display_error setting for the script if it’s disabled. We need to put the above statement, at the top of the script so that, the setting remains enabled till the end. Also, the values set via ini_set() are applicable, only to the current script. Thereafter, PHP will start using the original values from php.ini.
Python VLC Instance - Creating MediaPlayer Instance - GeeksforGeeks

29 Aug, 2020
In this article we will see how we can create a MediaPlayer instance from the Instance class in the python vlc module. VLC media player is a free and open-source portable cross-platform media player software and streaming media server developed by the VideoLAN project. Instance act as a main object of the VLC library with the Instance object we can create media player, list player or any other player available in VLC. Instance class the base classed used in VLC to create various objects. Media player object is used play a single or multiple media.
In order to do this we will use media_player_new method with the Instance object
Syntax : instance.media_player_new()
Argument : It takes no argument but it can take uri as optional argument
Return : It returns MediaPlayer object
Below is the implementation
# importing vlc moduleimport vlc  # importing time moduleimport time  # creating Instance class objectplayer = vlc.Instance()  # creating a new mediamedia = player.media_new("death_note.mkv")  # creating a media player objectmedia_player = player.media_player_new()  media_player.set_media(media)  # setting video scalemedia_player.video_set_scale(0.6)  # start playing videomedia_player.play()    # wait so the video can be played for 5 seconds# irrespective for length of videotime.sleep(5)
Output :
Another exampleBelow is the implementation
# importing vlc moduleimport vlc  # importing time moduleimport time  # creating Instance class objectplayer = vlc.Instance()  # creating a new mediamedia = player.media_new("1.mp4")  # creating a media player objectmedia_player = player.media_player_new()  media_player.set_media(media)  # setting video scalemedia_player.video_set_scale(0.6)  # start playing videomedia_player.play()    # wait so the video can be played for 5 seconds# irrespective for length of videotime.sleep(5)
Output :
Python vlc-library
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Read a file line by line in Python
How to Install PIP on Windows ?
Enumerate() in Python
Different ways to create Pandas Dataframe
Iterate over a list in Python
Python String | replace()
*args and **kwargs in Python
Reading and Writing to text files in Python
Create a Pandas DataFrame from Lists
Comparing two dates in PHP - GeeksforGeeks

31 Jul, 2021
Given two dates (date1 and date2) and the task is to compare the given dates. Comparing two dates in PHP is simple when both the dates are in the same format but the problem arises when both dates are in a different format.
Method 1: If the given dates are in the same format then use a simple comparison operator to compare the dates.
Example:
<?php// PHP program to compare dates  // Declare two dates and // initialize it$date1 = "1998-11-24";$date2 = "1997-03-26";  // Use comparison operator to // compare datesif ($date1 > $date2)    echo "$date1 is latest than $date2";else    echo "$date1 is older than $date2";  ?>
1998-11-24 is latest than 1997-03-26

Method 2: If both of the given dates are in different formats then use strtotime() function to convert the given dates into the corresponding timestamp format and lastly compare these numerical timestamps to get the desired result.
Example:
<?php// PHP program to compare dates  // Declare two dates in different// format$date1 = "12-03-26";$date2 = "2011-10-24";  // Use strtotime() function to convert// date into dateTimestamp$dateTimestamp1 = strtotime($date1);$dateTimestamp2 = strtotime($date2);  // Compare the timestamp date if ($dateTimestamp1 > $dateTimestamp2)    echo "$date1 is latest than $date2";else    echo "$date1 is older than $date2";  ?>
12-03-26 is latest than 2011-10-24

Method 3: Using DateTime class to compare two dates.
Example:
<?php// PHP program to compare dates  // Declare two dates in different// format and use DateTime() function// to convert date into DateTime$date1 = new DateTime("12-11-24");$date2 = new DateTime("2011-03-26");  // Compare the datesif ($date1 > $date2)    echo $date1->format("Y-m-d") . " is latest than "            . $date2->format("Y-m-d");else    echo $date1->format("Y-m-d") . " is older than "             . $date2->format("Y-m-d");  ?>
2012-11-24 is latest than 2011-03-26

PHP is a server-side scripting language designed specifically for web development. You can learn PHP from the ground up by following this PHP Tutorial and PHP Examples.
Picked
PHP
PHP Programs
Web Technologies
PHP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to convert array to string in PHP ?
PHP | Converting string to Date and DateTime
How to pass JavaScript variables to PHP ?
Split a comma delimited string into an array in PHP
Download file from URL using PHP
How to convert array to string in PHP ?
How to call PHP function on the click of a Button ?
How to pass JavaScript variables to PHP ?
Split a comma delimited string into an array in PHP
How to get parameters from a URL string in PHP?