code-rag-bench/online-tutorials huggingface dataset:
numpy.log10() in Python - GeeksforGeeks

29 Nov, 2018
About :numpy.log10(arr, out = None, *, where = True, casting = ‘same_kind’, order = ‘K’, dtype = None, ufunc ‘log10’) : This mathematical function helps user to calculate Base-10 logarithm of x where x belongs to all the input array elements.
Parameters :
array    : [array_like]Input array or object.
out      : [ndarray, optional]Output array with same dimensions as Input array, 
         placed with result.
**kwargs : allows you to pass keyword variable length of argument to a function. 
         It is used when we want to handle named argument in a function.
where    : [array_like, optional]True value means to calculate the universal 
         functions(ufunc) at that position, False value means to leave the value in the 
         output alone.

Return :
An array with Base-10 logarithmic value of x; 
where x belongs to all elements of input array. 

Code 1 : Working
# Python program explaining# log10() function  import numpy as np  in_array = [1, 3, 5, 10**8]print ("Input array : ", in_array)  out_array = np.log10(in_array)print ("Output array : ", out_array)    print("\nnp.log10(4**4) : ", np.log10(100**4))print("np.log10(2**8) : ", np.log10(10**8))
Output :
Input array :  [1, 3, 5, 100000000]
Output array :  [ 0.          0.47712125  0.69897     8.        ]

np.log10(4**4) :  8.0
np.log10(2**8) :  8.0

Code 2 : Graphical representation
# Python program showing# Graphical representation of # log10() function  import numpy as npimport matplotlib.pyplot as plt  in_array = [1, 2, 3, 4, 5]out_array = np.log10(in_array)  print ("out_array : ", out_array)  plt.plot(in_array, in_array, color = 'blue', marker = "*")  # red for numpy.log10()plt.plot(out_array, in_array, color = 'red', marker = "o")plt.title("numpy.log10()")plt.xlabel("out_array")plt.ylabel("in_array")plt.show()  
Output :
out_array :  [ 0.          0.30103     0.47712125  0.60205999  0.69897   ]
References :https://docs.scipy.org/doc/numpy-1.13.0/reference/generated/numpy.log10.html#numpy.log10.
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
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
CSS - azimuth

The azimuth property describes the position of a sound source along the horizontal axis of the listener's environment.
angle
left-side
far-left
left
center-left
center
center-right
right
far-right
right-side
far-right
behind center
Azimuth values should be shown as follows
All the HTML elements.
object.style.azimuth = "Any value defined above";

<html>
   <head>
      <style type = "text/css">
         h1 { azimuth: 70deg; }
         h3 { azimuth: behind left; }
         p { azimuth: left; }
      </style>
   </head>

   <body>
   
      <h1>This is header1 content</h1>
      <h3>This is header3 content</h3>
      <p>This is my paragraph content.</p>
      
   </body>
</html> 
It will produce the following result −
This is my paragraph content.

    33 Lectures 
     2.5 hours 

 Anadi Sharma

    26 Lectures 
     2.5 hours 

 Frahaan Hussain

    44 Lectures 
     4.5 hours 

 DigiFisk (Programming Is Fun)

    21 Lectures 
     2.5 hours 

 DigiFisk (Programming Is Fun)

    51 Lectures 
     7.5 hours 

 DigiFisk (Programming Is Fun)

    52 Lectures 
     4 hours 

 DigiFisk (Programming Is Fun)
 Print
 Add Notes
 Bookmark this page
How to plot an animated image matrix in matplotlib?

To plot an animated image matrix in matplotlib, we can take the following steps
Set the figure size and adjust the padding between and around the subplots.
Set the figure size and adjust the padding between and around the subplots.
Create a figure and a set of subplots.
Create a figure and a set of subplots.
Make an animation by repeatedly calling a function *update*.
Make an animation by repeatedly calling a function *update*.
Inside the update method, create a 6×6 dimension of matrix and display the data as an image, i.e., on a 2D regular raster.
Inside the update method, create a 6×6 dimension of matrix and display the data as an image, i.e., on a 2D regular raster.
Turn off the axes using set_axis_off().
Turn off the axes using set_axis_off().
To display the figure, use Show() method.
To display the figure, use Show() method.
from matplotlib.animation import FuncAnimation
import matplotlib.pyplot as plt
import numpy as np

plt.rcParams["figure.figsize"] = [7.00, 3.50]
plt.rcParams["figure.autolayout"] = True

fig, ax = plt.subplots()

def update(i):
    im_normed = np.random.rand(6, 6)
    ax.imshow(im_normed)
    ax.set_axis_off()

anim = FuncAnimation(fig, update, frames=20, interval=50)

plt.show()

It will produce the following output −
How to initialize variables in C#?

A variable is a name given to a storage area that our programs can manipulate.
Each variable in C# has a specific type, which determines the size and layout of the variable's memory the range of values that can be stored within that memory and the set of operations that can be applied to the variable.
To initialize a variable, first you need to define it.
int a;
Now to initialize, use an equal sign followed by a constant expression.
int a = 10;
We used the following syntax above.
variable_name = value;
Let us see a simple example to work with variable in C#.
 Live Demo
using System;
namespace VariableDefinition {
   class Program {
      static void Main(string[] args) {
         short a;
         int b ;
         double c;
         a = 10;
         b = 20;
         c = a + b;
         Console.WriteLine("a = {0}, b = {1}, c = {2}", a, b, c);
         Console.ReadLine();
      }
   }
}
a = 10, b = 20, c = 30
Arrays Data Structure in Javascript

The array is a container which can hold a fixed number of items and these items should be of the same type. It stores a fixed-size sequential collection of elements of the same type. An array is used to store a collection of data, but it is often more useful to think of an array as a collection of variables of the same type.
Let's say you want to record the average temperatures of all days of the week. You can record them as follows −
let avgTempMon = 35;
let avgTempTue = 33;
let avgTempWed = 31;
let avgTempThur = 24;
let avgTempFri = 25;
let avgTempSat = 22;
let avgTempSun = 30;
But if you look at this it gets difficult to keep track of these variables. What if you had to do this for all months? It would get very difficult to keep track. So we use arrays to keep track of these − 
let avgTemps = [];
avgTemps[0] = 35;
avgTemps[1] = 33;
avgTemps[2] = 31;
avgTemps[3] = 24;
avgTemps[4] = 25;
avgTemps[5] = 22;
avgTemps[6] = 30;
Now you only need to keep track of one variable to get all the values.
Arrays are represented as contiguous blocks of memory holding data in them. For example,
The above image shows an array of 10 elements. The indices are the places where each of these elements are stored. Note that index starts with 0 and each element can be accessed via its index. For example, we can fetch an element at index 6 as arr[6] which will give the result 27.
Let's look at some of the operations that can be applied to arrays in Javascript.
Creating an array
Adding an element
Removing an element
Joining 2 arrays
Sorting arrays
Searching in an array
Creating a multidimensional array
Looping through an array
How to match any non-digit character in Python using Regular Expression?



The following code matches and prints all non-digit characters in the given string using python regex as follows.
import re
foo = 'Mo4zam5Bi6QuE7'
match = re.findall(r'\D', foo)
print match
This gives the output
['M', 'o', 'z', 'a', 'm', 'B', 'i', 'Q', 'u', 'E']
How to create a PySpark dataframe from multiple lists ? - GeeksforGeeks

30 May, 2021
In this article, we will discuss how to create Pyspark dataframe from multiple lists. 
Create data from multiple lists and give column names in another list. So, to do our task we will use the zip method.
zip(list1,list2,., list n)
Pass this zipped data to spark.createDataFrame() method
dataframe = spark.createDataFrame(data, columns)
Example 1: Python program to create two lists and create the dataframe using these two lists
Python3
# importing moduleimport pyspark  # importing sparksession from # pyspark.sql modulefrom pyspark.sql import SparkSession  # creating sparksession and giving # an app namespark = SparkSession.builder.appName('sparkdf').getOrCreate()  # list  of college data with dictionary# with two lists in three elements eachdata = [1, 2, 3]data1 = ["sravan", "bobby", "ojaswi"]  # specify column namescolumns = ['ID', 'NAME']  # creating a dataframe by zipping the two listsdataframe = spark.createDataFrame(zip(data, data1), columns)  # show data framedataframe.show()
Output:
Example 2: Python program to create 4 lists and create the dataframe
Python3
# importing moduleimport pyspark  # importing sparksession from # pyspark.sql modulefrom pyspark.sql import SparkSession  # creating sparksession and giving # an app namespark = SparkSession.builder.appName('sparkdf').getOrCreate()  # list  of college data with dictionary# with four lists in three elements eachdata = [1, 2, 3]data1 = ["sravan", "bobby", "ojaswi"]data2 = ["iit-k", "iit-mumbai", "vignan university"]data3 = ["AP", "TS", "UP"]  # specify column namescolumns = ['ID', 'NAME', 'COLLEGE', 'ADDRESS']  # creating a dataframe by zipping # the two listsdataframe = spark.createDataFrame(  zip(data, data1, data2, data3), columns)  # show data framedataframe.show()
Output:
Picked
Python-Pyspark
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to Install PIP on Windows ?
How to drop one or multiple columns in Pandas Dataframe
How To Convert Python Dictionary To JSON?
Check if element exists in list in Python
Python | Pandas dataframe.groupby()
Defaultdict in Python
Python | Get unique values from a list
Python Classes and Objects
Python | os.path.join() method
Create a directory in Python
Linear Regression

From a given set of data points, the linear regression finds an equation of straight line. The given points will follow the straight line. Using this formula, we can predict what will be the value for some other specific point, which is not present in the set currently.
For solving linear regression problems using some data points, we have to follow these formulae:
Here the m and c are the slope and the y-intercept respectively. Using these expressions, we can get the equation of straight line in this form: y = mx + c.
Input:
The (x, y) coordinates of some points. {(1,3), (2,4), (3,5), (4,6), (5,8)}
Output:
The slope: 1.2 The Intercept: 1.6
The equation: y = 1.2x + 1.6
linReg(coord)
Input: The given set of coordinate points.
Output: The slope m and y-intercept c.
Begin
   for i := 1 to n, do
      sumX := sumX + coord[i,0]
      sumY := sumY + coord[i,1]
      sumXsq := sumXsq + (coord[i,0]*coord[i,0])
      sumXY := sumXY + (coord[i,0] * coord[i,1])
   done

   m := (n * sumXY – (sumX*sumY)) / (n * sumXsq – (sumX * sumX))
   c := (sumY / n) – (m * sumX)/n
End
#include<iostream>
#include<cmath>
#define N 5
using namespace std;

void linReg(int coord[N][2], float &m, float &c) {
   float sx2 = 0, sx = 0, sxy = 0, sy = 0;
   for(int i = 0; i<N; i++) {
      sx += coord[i][0];    //sum of x
      sy += coord[i][1];   //sum of y

      sx2 += coord[i][0]*coord[i][0];      //sum of x^2
      sxy += coord[i][0]*coord[i][1];     //sum of x*y
   }

   // finding slope and intercept
   m = (N*sxy-(sx*sy))/(N*sx2-(sx*sx));
   c = (sy/N)-(m*sx)/N;
}

main() {
   // this 2d array holds coordinate points
   int point[N][2] = {{1,3},{2,4},{3,5},{4,6},{5,8}};
   float m, c;
   linReg(point, m, c);
   cout << "The slope: " << m << " The Intercept: " << c << endl;
   cout << "The equation: " << "y = "<< m <<"x + "<< c;
}
The slope: 1.2 The Intercept: 1.6
The equation: y = 1.2x + 1.6
The kill() Function in Perl

Perl kill('KILL', (Process List)) function can be used to terminate a pseudo-process by passing it the ID returned by fork().
Note that using kill('KILL', (Process List)) on a pseudo-process() may typically cause memory leaks, because the thread that implements the pseudo-process does not get a chance to clean up its resources.
You can use kill() function to send any other signal to target processes, for example following will send SIGINT to a process IDs 104 and 102 −
#!/usr/bin/perl
kill('INT', 104, 102);
1;
Stack remove(Object) method in Java with Example - GeeksforGeeks

24 Dec, 2018
The Java.util.Stack.remove(Object o) method is used to remove any particular element from the Stack.
Syntax:
Stack.remove(Object o)
Parameters: This method accepts a mandatory parameter o is of the object type of Stack and specifies the element to be removed from the Stack.
Return Value: Returns True if the specified element is found and removed from the Stack, else False.
Below program illustrate the Java.util.Stack.remove(Object o) method:
Example 1:
// Java code to illustrate remove() when position of// element is passed as parameter  import java.util.*;  public class StackDemo {    public static void main(String args[])    {          // Creating an empty Stack        Stack<String> stack = new Stack<String>();          // Use add() method to add elements in the Stack        stack.add("Geeks");        stack.add("for");        stack.add("Geeks");        stack.add("10");        stack.add("20");          // Output the Stack        System.out.println("Stack: " + stack);          // Remove the element using remove()        boolean res = stack.remove("20");          // Print the removed element        System.out.println("Was 20 removed: "                           + res);          // Print the final Stack        System.out.println("Final Stack: "                           + stack);    }}
Stack: [Geeks, for, Geeks, 10, 20]
Was 20 removed: true
Final Stack: [Geeks, for, Geeks, 10]

Example 2:
// Java code to illustrate remove() when position of// element is passed as parameter  import java.util.*;  public class StackDemo {    public static void main(String args[])    {          // Creating an empty Stack        Stack<Integer> stack = new Stack<Integer>();          // Use add() method to add elements in the Stack        stack.add(10);        stack.add(20);        stack.add(30);        stack.add(40);        stack.add(50);          // Output the Stack        System.out.println("Stack: " + stack);          // Remove the element using remove()        boolean res = stack.remove("100");          // Print the removed element        System.out.println("Was 100 removed: "                           + res);          // Print the final Stack        System.out.println("Final Stack: "                           + stack);    }}
Stack: [10, 20, 30, 40, 50]
Was 100 removed: false
Final Stack: [10, 20, 30, 40, 50]

Java - util package
Java-Collections
Java-Functions
Java-Stack
Java
Java
Java-Collections
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Arrays in Java
Split() String method in Java with examples
For-each loop in Java
Object Oriented Programming (OOPs) Concept in Java
Arrays.sort() in Java with examples
Reverse a string in Java
HashMap in Java with Examples
Interfaces in Java
Stream In Java
How to iterate any Map in Java
How to make a leaderboard using PHP ? - GeeksforGeeks

28 Dec, 2020
The purpose of this article is to make a simple program to create a leaderboard using PHP. Below is the implementation for the same using PHP.  The prerequisites of this topic are PHP/MySQL and the installment of Apache Server on your computer.
Approach:
Step 1: First we will create a HTML table using <table> tag defined by the <tr> tag for creating rows. It’s just a simple HTML/CSS file. The only thing worth noting is that we are using the Bootstrap 4 CSS framework to give style to our page. You can use any other styling framework of your choice or write your own CSS if you want.
HTML
<!DOCTYPE html><html>    <head>        <title>LeaderBoard Using PHP</title>    </head>      <body>        <h2>Welcome To GFG</h2>        <table>            <tr>                <td>Ranking</td>                <td>UserName</td>                <td>Marks</td>            </tr>
Step 2: Fetch data from SQL and display it using PHP.
Step 3: Create a MySQL database by following commands.
CREATE DATABASE leaderboard;
CREATE TABLE leaderboard(userName VARCHAR(30), marks INT(10));
Step 4: Insert some values into the database.
INSERT INTO leaderboard(userName,marks) VALUES('Devesh Pratap Singh',100);
PHP
<?php  /* Connection Variable ("Servername","username","password","database") */$con = mysqli_connect("localhost",         "root", "", "leaderboard");  /* Mysqli query to fetch rows in descending order of marks */$result = mysqli_query($con, "SELECT userName, marks FROM leaderboard ORDER BY marks DESC");  /* First rank will be 1 and     second be 2 and so on */$ranking = 1;  /* Fetch Rows from the SQL query */if (mysqli_num_rows($result)) {    while ($row = mysqli_fetch_array($result)) {        echo "<td>{$ranking}</td>        <td>{$row['userName']}</td>        <td>{$row['marks']}</td>";        $ranking++;    }}?>
Step 5: Close the table tag, body tag, and html tag. 
HTML
</table></body></html>
Step 6: Save this file as “index.php“.
Step 7: Copy this file inside your xampp server in htdocs directory.
Step 8: Open phpMyAdmin or MySQL server on your computer.
Step 9: Open https://localhost/index.php into your web browser.
Output produced after running
HTML-Misc
mysql
PHP-array
PHP-Misc
Picked
HTML
PHP
SQL
Web Technologies
SQL
HTML
PHP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
REST API (Introduction)
HTML Cheat Sheet - A Basic Guide to HTML
Design a web page using HTML and CSS
Form validation using jQuery
Angular File Upload
How to execute PHP code using command line ?
How to convert array to string in PHP ?
How to pop an alert message box using PHP ?
PHP in_array() Function
How to delete an array element based on key in PHP?
C# | Getting the list of keys of a SortedList object - GeeksforGeeks

01 Feb, 2019
SortedList.GetKeyList Method is used to get the list of keys in a SortedList object.
Syntax:
public virtual System.Collections.IList GetKeyList ();
Return Value: It returns an IList object containing the keys in the SortedList object.
Below programs illustrate the use of above-discussed method:
Example 1:
// C# code for getting the keys// in a SortedList objectusing System;using System.Collections;  class Geeks {      // Main Method    public static void Main(String[] args)    {          // Creating a SortedList of integers        SortedList mylist = new SortedList();          // Adding elements to SortedList        mylist.Add("1", "C++");        mylist.Add("2", "Java");        mylist.Add("3", "DSA");        mylist.Add("4", "Python");        mylist.Add("5", "C#");          // taking an IList and        // using GetKeyList method        IList klist = mylist.GetKeyList();          // Prints the list of keys        Console.WriteLine("Key List");          for (int i = 0; i < mylist.Count; i++)            Console.WriteLine(klist[i]);    }}
Output:
Key List
1
2
3
4
5

Example 2:
// C# code for getting the keys// in a SortedList objectusing System;using System.Collections;  class Geeks {      // Main Method    public static void Main(String[] args)    {          // Creating a SortedList of integers        SortedList mylist = new SortedList();          // Adding elements to SortedList        mylist.Add("First", "Ram");        mylist.Add("Second", "Shyam");        mylist.Add("Third", "Mohit");        mylist.Add("Fourth", "Rohit");        mylist.Add("Fifth", "Manish");          // taking an IList and        // using GetKeyList method        IList klist = mylist.GetKeyList();          // Prints the list of keys        Console.WriteLine("Key List");          // will print the keys in sorted order        for (int i = 0; i < mylist.Count; i++)            Console.WriteLine(klist[i]);    }}
Output:
Key List
Fifth
First
Fourth
Second
Third

Note:
The returned IList object is a read-only view of the keys of the SortedList object. Modifications made to the underlying SortedList are immediately reflected in the IList.
The elements of the returned IList are sorted in the same order as the keys of the SortedList.
This method is similar to the Keys property but returns an IList object instead of an ICollection object.
This method is an O(1) operation.
Reference:
https://docs.microsoft.com/en-us/dotnet/api/system.collections.sortedlist.getkeylist?view=netframework-4.7.2
CSharp-Collections-Namespace
CSharp-Collections-SortedList
CSharp-method
C#
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Extension Method in C#
HashSet in C# with Examples
C# | Inheritance
Partial Classes in C#
C# | Generics - Introduction
Top 50 C# Interview Questions & Answers
C# | How to insert an element in an Array?
Switch Statement in C#
Convert String to Character Array in C#
Linked List Implementation in C#
PyQt5 – How to add image in Label background ? - GeeksforGeeks

26 Mar, 2020
In this article, we will see how to add background image to a label, By default, when we create a label there is no background image although we can set background color to it.
Sometimes background image is necessary. In order to set a background image we will use setStyleSheet() method.
Syntax : label.setStyleSheet(“background-image : url(image.png)”;)
Argument : It takes string as argument.
Action performed Add background image to a label.
Code :
# importing the required libraries  from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * import sys    class Window(QMainWindow):    def __init__(self):        super().__init__()            # set the title        self.setWindowTitle("Python")          # setting  the geometry of window        self.setGeometry(60, 60, 600, 400)            # creating a label widget        self.label_1 = QLabel(self)          # moving position        self.label_1.move(100, 100)          # setting up the border        self.label_1.setStyleSheet("border :3px solid blue;")          # setting label text        self.label_1.setText("no background image")          # creating a label widget        self.label_2 = QLabel(self)          # moving position        self.label_2.move(160, 170)          # setting up the border and adding image to background        self.label_2.setStyleSheet("background-image : url(image.png);                                              border : 2px solid blue")            # setting label text        self.label_2.setText("with background image")        self.label_2.resize(100, 50)          # show all the widgets        self.show()    # create pyqt5 appApp = QApplication(sys.argv)  # create the instance of our Windowwindow = Window()# start the appsys.exit(App.exec())
Output :
Python-gui
Python-PyQt
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
HTML | muted Attribute - GeeksforGeeks

08 Dec, 2021
The HTML muted Attribute is used to specify the audio output of the video is muted, it is a Boolean attribute.Applicable:  
<video muted Attribute>
Syntax  
<video muted>
Example:  
html
<!DOCTYPE html><html> <head>    <title>        HTML muted Attribute    </title></head> <body style="text-align: center">     <h1 style="color:green">    GeeksforGeeks</h1>    <h2 style="font-family:Impact">    HTML muted Attribute</h2>    <br>     <video id="Test_Video"        width="360"        height="240"        controls muted>         <source src="samplevideo.mp4"                type="video/mp4">         <source src="samplevideo.ogg"                type="video/ogg">    </video></body> </html>
Output:  
Supported Browsers: The browsers supported by HTML muted Attribute are listed below:  
Google Chrome 4.0
Internet Explorer 10.0
Firefox 11.0
Apple Safari 7.1
Opera 10.5
 
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.
hritikbhatnagar2182
HTML-Attributes
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to update Node.js and NPM to next version ?
How to Insert Form Data into Database using PHP ?
REST API (Introduction)
CSS to put icon inside an input element in a form
Types of CSS (Cascading Style Sheet)
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 ?
Difference between var, let and const keywords in JavaScript
How to add days to $Date in PHP? - GeeksforGeeks

03 Jun, 2021
Adding days to $Date can be done in many ways. It is very easy to do by using built-in functions like strtotime(), date_add() in PHP.Method 1: Using strtotime() Function: The strtotime() Function is used to convert an English textual date-time description to a UNIX timestamp. Syntax:  
strtotime( $EnglishDateTime, $time_now )
Parameters: This function accepts two optional parameters as mentioned above and described below.  
$EnglishDateTime: This parameter specifies the English textual date-time description, which represents the date or time to be returned.
$time_now: This parameter specifies the timestamp used to calculate the returned value. It is an optional parameter.
Program: PHP program to add days to $Date in PHP using strtotime() function.  
php
<?php// PHP program to add days to $Date // Declare a date$Date = "2019-05-10"; // Add days to date and display itecho date('Y-m-d', strtotime($Date. ' + 10 days')); ?>
2019-05-20
 
Method 2: Using date_add() Function: The date_add() function is used to add days, months, years, hours, minutes and seconds.Syntax:  
date_add(object, interval);
Parameters: This function accepts two parameters as mentioned above and described below:  
Object: It specifies the DateTime object returned by date_create() function.
Interval: It specifies the DateInterval object.
Program: PHP program to add days to $Date in PHP using date_add() function.  
php
<?php// PHP program to add 10 days in date // Declare a date$date = date_create("2019-05-10"); // Use date_add() function to add date objectdate_add($date, date_interval_create_from_date_string("10 days")); // Display the added dateecho date_format($date, "Y-m-d"); ?>
2019-05-20
 
varshagumber28
Picked
PHP
PHP Programs
Web Technologies
Web technologies Questions
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?
HTML | <audio> controls Attribute - GeeksforGeeks

08 Jul, 2019
The HTML <audio> controls attribute is used to specify the control to play audio. It is the Boolean value. This attribute is new in HTML5.
The audio control attribute contains the following property:
Play
Pause
Seeking
Volume
Syntax:
<audio controls>
Example:
<!DOCTYPE html><html>  <head>    <title>        HTML Audio controls Attribute    </title></head>  <body style="text-align: center">      <h1 style="color: green">         GeeksforGeeks     </h1>          <h2 style="font-family: Impact">         HTML Audio controls Attribute     </h2>    <br>      <audio id="Test_Audio" controls>          <source src="https://media.geeksforgeeks.org/wp-content/uploads/20190531165842/Recording1514.ogg"                type="audio/ogg">          <source src="https://media.geeksforgeeks.org/wp-content/uploads/20190531165842/Recording1514.mp3"                type="audio/mpeg">    </audio></body>  </html>                    
Output:
Supported Browsers: The browser supported by HTML <audio> controls attribute are listed below:
Google Chrome 4.0
Internet Explorer 9.0
Firefox 3.5
Safari 4.0
Opera 10.5
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.
HTML-Attributes
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to update Node.js and NPM to next version ?
How to Insert Form Data into Database using PHP ?
REST API (Introduction)
CSS to put icon inside an input element in a form
Types of CSS (Cascading Style Sheet)
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 ?
Difference between var, let and const keywords in JavaScript
strlen() function in c - GeeksforGeeks

28 Sep, 2018
The strlen() function calculates the length of a given string.The strlen() function is defined in string.h header file. It doesn’t count null character ‘\0’.
Syntax:
int strlen(const char *str);

Parameter:
str: It represents the string variable whose length we have to find.
Return: This function returns the length of string passed.
Below programs illustrate the strlen() function in C:
Example 1:-
// c program to demonstrate// example of strlen() function.  #include<stdio.h>#include <string.h>  int main(){   char ch[]={'g', 'e', 'e', 'k', 's', '\0'};     printf("Length of string is: %d", strlen(ch));   return 0;}
Output :
Length of string is: 5
Example 2:-
// c program to demonstrate// example of strlen() function.  #include<stdio.h>#include <string.h>  int main(){   char str[]= "geeks";     printf("Length of string is: %d", strlen(str));   return 0;}
Output:
Length of string is: 5
Example 3:-
// c program to demonstrate// example of strlen() function.#include<stdio.h>#include <string.h>  int main(){   char *str = "geeks";     printf("Length of string is: %d", strlen(str));   return 0;}
Output :
Length of string is: 5
C-Library
C-String
C Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Substring in C++
Multidimensional Arrays in C / C++
Left Shift and Right Shift Operators in C/C++
Converting Strings to Numbers in C/C++
Function Pointer in C
rand() and srand() in C/C++
std::string class in C++
fork() in C
Different methods to reverse a string in C/C++
Enumeration (or enum) in C
Convert CSV to HTML Table using Python Pandas and Flask Framework

26 May, 2022
In this article, we are going to convert a CSV file into an HTML table using Python Pandas and Flask Framework.
Sample CSV file :
USERNAME,IDENTIFIER,FIRST_NAME,LAST_NAME
booker12,9012,Rachel,Booker
grey07,2070,Laura,Grey
johnson81,4081,Craig,Johnson
jenkins46,9346,Mary,Jenkins
smith79,5079,Jamie,Smith
Step 1: Create an environment. Create a project folder and a venv folder within.
py -3 -m venv venv
Step 2: Activate the environment.
venv\Scripts\activate
Step 3: Install Flask and Pandas.
pip install Flask
pip install pandas
Step 1: Create ‘app.py’ folder and write the code given below.
Python3
# importing flaskfrom flask import Flask, render_template  # importing pandas moduleimport pandas as pd    app = Flask(__name__)    # reading the data in the csv filedf = pd.read_csv('sample_data.csv')df.to_csv('sample_data.csv', index=None)    # route to html page - "table"@app.route('/')@app.route('/table')def table():        # converting csv to html    data = pd.read_csv('sample_data.csv')    return render_template('table.html', tables=[data.to_html()], titles=[''])    if __name__ == "__main__":    app.run(host="localhost", port=int("5000"))
Step 2: Create the folder ‘templates’. create the file ‘table.html’ inside the ‘templates’ folder.
HTML
<!DOCTYPE html><html lang="en">    <head>        <title> Table </title>                  </head>    <body>        <div align="center">            <table>                <h1>                <!--Displaying the converted table-->                     {% for table in tables %}                    <h2>{{titles[loop.index]}}</h2>                                                {{ table|safe }}                    {% endfor %}                     </h1>             </table>        </div>    </body></html>
Step 3: Add the ‘sample_data.csv’ file.
Step 4: The project structure will look like this.
Structure of  the project
Step 1: Run the server.
Step 2: Browse the URL ‘localhost:5000’.
Step 3: The output web page will be displayed.
Output:
Output : CSV to HTML Table
Flask Projects
Python Flask
Python-pandas
Python-projects
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
HTTP headers | If-None-Match

18 Nov, 2019
The HTTP Header If-None-Match is a request-type header. Generally, it is used to update the entity tags on the server. Firstly, the Client provides the Server with a set of entity tags (E-tags). The Server compares the given tags with those it already has for the resource. Then, the Server will provide the requested page with a 200 status code only when none of the entity tags given to it matches. Or else, a 304 Not Modified status is returned by the Server.
There are two types of algorithms used to compare the entity tags. They are:
Weak Comparison Algorithm
Strong Comparison Algorithm
Weak comparison algorithm: It neglects minor differences which are considered to be unimportant between the entity tags. For example, two tags having the same contents but with different dates are considered to be identical.
Strong comparison algorithm: It checks the tags byte-to-byte.
Syntax:
If-None-Match: "entity_tag"
If-None-Match: *
Note : “*” is used to represent any resource.
Directives: This header accepts two directives as mentioned above and described below:
entity_tag: It represents the resource which is requested. It is a string which contains alphabets, numbers and other special characters enclosed within double quotes (” “).
“*”: It represents any resource and is used to avoid race conditions between PUT operations. When this directive is used, the server should not perform the requested method if the entity is given to it already exists for that resource.
Examples:
If-None-Match:"2780-5524acffbda80-gzip"
If-None-Match:"2780-5524acffbda80-gzip"
If-None-Match:*
If-None-Match:*
To check this If-None-Match in action go to Inspect Element -> Network check the request header for If-None-Match like below. The If-None-Match header is highlighted.
Supported Browsers: The browsers are compatible with HTTP If-None-Match header are listefd below:
Google Chrome
Internet Explorer
Mozilla Firefox
Microsoft Edge
Opera
Safari
HTTP-headers
Picked
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Cropping an Image in a circular way using Python

24 Feb, 2021
In this article, we will learn to crop an image circularly using a pillow library. Cropping an image circularly means selecting a circular region inside an image and removing everything outside the circle. 
Approach:
If you have an L mode image, the image becomes grayscale. So we create a new image with mode “L”.
An image is created with a white circle in the middle with dimensions same as the input image.
Convert a new image to an array.
Convert original image from an array.
Stack these two arrays together to crop out only the circular middle part.
Let’s take this initial image :
Step 1: Import the module and read the image.
Python3
import numpy as npfrom PIL import Image, ImageDraw    img = Image.open("/content/gfg.jpeg")display(img)
Output:
Step 2: Create an image.
We will use pieslice() function to get the circular part of the image in white, then we will superimpose the original image and the luminous image.
ImageDraw.Draw.pieslice() Same as arc, but also draws straight lines between the endpoints and the center of the bounding box.
Syntax: PIL.ImageDraw.Draw.pieslice(xy, start, end, fill=None, outline=None)
Parameters:xy – Four points to define the bounding box. Sequence of [(x0, y0), (x1, y1)] or [x0, y0, x1, y1].start – Starting angle, in degrees. Angles are measured from 3 o’clock, increasing clockwise.end – Ending angle, in degrees.fill – Color to use for the fill.outline – Color to use for the outline.
Returns: An Image object in pieslice shape.
Code:
Python3
h,w = img.size  # creating luminous imagelum_img = Image.new('L',[h,w] ,0) draw = ImageDraw.Draw(lum_img)draw.pieslice([(0,0),(h,w)],0,360,fill=255)img_arr = np.array(img)lum_img_arr = np.array(lum_img)display(Image.fromarray(lum_img_arr))
Output:
Step 3: Stack these two arrays together to crop out only the circular middle part.
Python3
final_img_arr = np.dstack((img_arr, lum_img_arr))display(Image.fromarray(final_img_arr))
Output:
Below is the full implementation:
Python3
import numpy as npfrom PIL import Image, ImageDraw  img=Image.open("img.jpg")display(img)  height,width = img.sizelum_img = Image.new('L', [height,width] , 0)  draw = ImageDraw.Draw(lum_img)draw.pieslice([(0,0), (height,width)], 0, 360,               fill = 255, outline = "white")img_arr =np.array(img)lum_img_arr =np.array(lum_img)display(Image.fromarray(lum_img_arr))final_img_arr = np.dstack((img_arr,lum_img_arr))display(Image.fromarray(final_img_arr))
Output:
Image-Processing
Picked
Python-pil
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Different ways to create Pandas Dataframe
Enumerate() in Python
Python String | replace()
How to Install PIP on Windows ?
*args and **kwargs in Python
Python Classes and Objects
Python OOPs Concepts
Introduction To PYTHON
Convert integer to string in Python
How to drop one or multiple columns in Pandas Dataframe
How to validate mobile number length in ReactJS ?

12 Feb, 2021
Validating mobile number length is an important step to check whether the number entered by the user is genuine or not. Material UI for React has this component available for us and it is very easy to integrate. We can use the error Property for TextField Component in ReactJS using the following approach.
Creating React Application And Installing Module:
Step 1: Create a React application using the following command:
npx create-react-app foldername
Step 2: After creating your project folder i.e. foldername, move to it using the following command:
cd foldername
Step 3: After creating the ReactJS application, Install the material-ui modules using the following command:
npm install @material-ui/core
Project Structure: It will look like the following.
Project Structure
App.js: Now write down the following code in the App.js file. Here, App is our default component where we have written our code.
Javascript
import React, { useState } from "react";import TextField from "@material-ui/core/TextField";import InputAdornment from "@material-ui/core/InputAdornment";  const App = () => {  const [mobile, setmobile] = useState("");  const [isError, setIsError] = useState(false);    return (    <div      style={{        marginLeft: "40%",      }}    >      <h2>Validate Mobile number length in ReactJS?</h2>      <TextField        type="tel"        error={isError}        value={mobile}        label="Enter Phone Number"        onChange={(e) => {          setmobile(e.target.value);          if (e.target.value.length > 10) {            setIsError(true);          }        }}        InputProps={{          startAdornment: <InputAdornment position="start">             +91             </InputAdornment>,        }}      />      <h3>Your Mobile Number is: +91 {mobile} </h3>    </div>  );};  export default App;
Step to Run Application: Run the application using the following command from the root directory of the project.
npm start
Output: Now open your browser and go to http://localhost:3000/, you will see the following output. In the above example, we can see when the user exceeds the 10 digits, the TextField color turns to red to indicate the error, this is how we can validate mobile number length in ReactJS.
React-Questions
JavaScript
ReactJS
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
Differences between Functional Components and Class Components in React
Node.js | fs.writeFileSync() Method
Remove elements from a JavaScript Array
Form validation using HTML and JavaScript
How to create a multi-page website using React.js ?
ReactJS setState()
Create a Responsive Navbar using ReactJS
How to do crud operations in ReactJS ?
Re-rendering Components in ReactJS
Python IF Statement

It is similar to that of other languages. The if statement contains a logical expression using which data is compared and a decision is made based on the result of the comparison.
if expression:
   statement(s)

If the boolean expression evaluates to TRUE, then the block of statement(s) inside the if statement is executed. If boolean expression evaluates to FALSE, then the first set of code after the end of the if statement(s) is executed.
#!/usr/bin/python

var1 = 100
if var1:
   print "1 - Got a true expression value"
   print var1

var2 = 0
if var2:
   print "2 - Got a true expression value"
   print var2
print "Good bye!"
When the above code is executed, it produces the following result −
1 - Got a true expression value
Python | Pandas Series.dt.second

20 Mar, 2019
Series.dt can be used to access the values of the series as datetimelike and return several properties. Pandas Series.dt.second attribute return a numpy array containing the second of the datetime in the underlying data of the given series object.
Syntax: Series.dt.second
Parameter : None
Returns : numpy array
Example #1: Use Series.dt.second attribute to return the seconds of the datetime in the underlying data of the given Series object.
# importing pandas as pdimport pandas as pd  # Creating the Seriessr = pd.Series(['2012-10-21 09:30:45', '2019-7-18 12:30:21', '2008-02-2 10:30:38',               '2010-4-22 09:25:19', '2019-11-8 02:22:44'])  # Creating the indexidx = ['Day 1', 'Day 2', 'Day 3', 'Day 4', 'Day 5']  # set the indexsr.index = idx  # Convert the underlying data to datetime sr = pd.to_datetime(sr)  # Print the seriesprint(sr)
Output :
Now we will use Series.dt.second attribute to return the seconds of the datetime in the underlying data of the given Series object.
# return the secondresult = sr.dt.second  # print the resultprint(result)
Output :As we can see in the output, the Series.dt.second attribute has successfully accessed and returned the second of the datetime in the underlying data of the given series object. Example #2 : Use Series.dt.second attribute to return the seconds of the datetime in the underlying data of the given Series object.
# importing pandas as pdimport pandas as pd  # Creating the Seriessr = pd.Series(pd.date_range('2012-12-12 12:12', periods = 5, freq = 'H'))  # Creating the indexidx = ['Day 1', 'Day 2', 'Day 3', 'Day 4', 'Day 5']  # set the indexsr.index = idx  # Print the seriesprint(sr)
Output :
Now we will use Series.dt.second attribute to return the seconds of the datetime in the underlying data of the given Series object.
# return the secondresult = sr.dt.second  # print the resultprint(result)
Output :As we can see in the output, the Series.dt.second attribute has successfully accessed and returned the second of the datetime in the underlying data of the given series object.
Python pandas-series-datetime
Python-pandas
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Python Classes and Objects
Python OOPs Concepts
Introduction To PYTHON
How to drop one or multiple columns in Pandas Dataframe
Python | os.path.join() method
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
Python | Get unique values from a list
Python | datetime.timedelta() function
elinks - Unix, Linux Command

elinks [OPTION]... [URL]...






ELinks is a text mode WWW browser, supporting colors, table rendering, background downloading, menu driven configuration interface, tabbed browsing and slim code.




Frames are supported. You can have different file formats associated with external viewers. mailto: and telnet: are supported via external clients.




ELinks can handle both local files and remote URLs. The main supported remote URL protocols are HTTP, HTTPS (with SSL support compiled in) and FTP. Additional protocol support exists for BitTorrent finger, Gopher, SMB and NNTP.




The homepage of ELinks can be found at <http://elinks.cz/>, where the ELinks manual is also hosted.






Most options can be set in the user interface or config file, so usually you do not need to care about them. Note that this list is roughly equivalent to the output of running ELinks with the option --long-help.





























-eval ’set protocol.file.allow_special_files = 1’






































Generated using output from ELinks version 0.11.0.GIT.




















































Other files that ELinks uses from ~/.elinks/ includes the user defined CSS stylesheet. The name of the file can set in the document.css.stylesheet option.






ELinks is known to work on Linux, FreeBSD, OpenBSD, Solaris, IRIX, HPUX, Digital Unix, AIX, OS/2, BeOS and RISC OS. Port for Win32 is in state of beta testing.






Please report any other bugs you find to the either the ELinks mailing list at <elinks-users@linuxfromscratch.org> or if you prefer enter them into the bug tracking system <http://bugzilla.elinks.or.cz/>. More information about how to get in contact with developers and getting help can be found on the community page <http://elinks.or.cz/community.html>.






ELinks is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License <http://www.gnu.org/copyleft/gpl.html> as published by the Free Software Foundation; version 2 of the License.






The Links browser - on which ELinks is based - was written by Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz>. ELinks was written by Petr Baudis <pasky@ucw.cz>. See file AUTHORS in the source tree for a list of people contributing to this project.




This manual page was written by Peter Gervai <grin@tolna.net>, using excerpts from a (yet?) unknown Links fan for the Debian GNU/Linux system (but may be used by others). Contributions from Francis A. Holop. Extended, clarified and made more up-to-date by Petr Baudis <pasky@ucw.cz>. Updated by Zas <zas@norz.org>. The conversion to Asciidoc and trimming was done by Jonas Fonseca <fonseca@diku.dk>.




elinkskeys(5), elinks.conf(5), links(1), lynx(1), w3m(1), wget(1)