code-rag-bench/online-tutorials huggingface dataset:
What are the different types of pointers in C language?

The pointer is a variable that stores the address of another variable.
The syntax for the pointer is as follows −
pointer = &variable;
There are eight different types of pointers which are as follows −
Null pointer
Null pointer
Void pointer
Void pointer
Wild pointer
Wild pointer
Dangling pointer
Dangling pointer
Complex pointer
Complex pointer
Near pointer
Near pointer
Far pointer
Far pointer
Huge pointer
Huge pointer
You create a null pointer by assigning the null value at the time of pointer declaration.
This method is useful when you do not assign any address to the pointer. A null pointer always contains value 0.
Following is the C program for the null pointer −
 Live Demo
#include <stdio.h>
int main(){
   int *ptr = NULL; //null pointer
   printf("The value inside variable ptr is:\n%d",ptr);
   return 0;
}
When the above program is executed, it produces the following result −
The value inside variable ptr is:
0
It is a pointer that has no associated data type with it. A void pointer can hold addresses of any type and can be typecast to any type.
It is also called a generic pointer and does not have any standard data type.
It is created by using the keyword void.
Following is the C program for the void pointer −
 Live Demo
#include <stdio.h>
int main(){
   void *p = NULL; //void pointer
   printf("The size of pointer is:%d\n",sizeof(p)); //size of p depends on compiler
   return 0;
}
When the above program is executed, it produces the following result −
The size of pointer is:8
Wild pointers are also called uninitialized pointers. Because they point to some arbitrary memory location and may cause a program to crash or behave badly.
This type of C pointer is not efficient. Because they may point to some unknown memory location which may cause problems in our program. This may lead to the crashing of the program.
It is advised to be cautious while working with wild pointers.
Following is the C program for the wild pointer −
#include <stdio.h>
int main(){
   int *p; //wild pointer
   printf("\n%d",*p);
   return 0;
}
Process returned -1073741819 (0xC0000005) execution time : 1.206 s
Press any key to continue
i.e. you won’t get output, some compilers show error message at output
What is the difference between list and dictionary in C#?

Dictionary is a collection of keys and values in C#. Dictionary<TKey, TValue> is included in the System.Collection.Generics namespace. Dictionary is a generic type and returns an error if you try to find a key which is not there.
List collection is a generic class and can store any data types to create a list.
A list is a group of items −
List<string> myList = new List<string>() {
   "Maths",
   "English",
"   Science"
};
Dictionary is a set of key-value pairs.
Dictionary<string, int> d = new Dictionary<string, int>();

d.Add("squash", 1);
d.Add("football", 2);
d.Add("rugby", 3);
Looping is easier and faster in a list and access element using index easily with a List.
How to Write Author Response/Rebuttal Letter | by Xu LIANG | Towards Data Science

In this post, I will give a brief summary of what I have learned to write a good author response/rebuttal letter. If you want more detailed, I highly recommend reading the articles listed in the reference section.
No matter the comment is long or short, first we have to do is to find the main issue where the reviewer thinks the paper should not be accepted. The main issue may not be only one, we need to identify all of them and give responses one by one.
As for other minor issues, like format and typo, we should be honest to admit and make the commitment to change them.
No matter the main issue or the minor issues, we can use the below format to give the response.
comment: paste the comment from the reviewer.
response: Thanks for the reviewer first, show your respect. Then write your response for the comment.
commitment: tell the reviewer which part you will modify how you will modify as detailed as possible.
Below is an example
-(comment) The main issue with this paper is that the analysis is not particularily informative or well carried out. It is not surprising that xxxx are important for xxxx, .....-(response) Thanks for the comment. We agree that the conclusion xxxx may be unsurprising. But we think xxxxxx. The figure xxx shows that xxxx, and table xxx also points out xxxx.-(commitment) We will modify the xx section (page xx, line xx) to make the statement more clear.
Check out my other posts on Medium with a categorized view!GitHub: BrambleXuLinkedIn: Xu LiangBlog: BrambleXu.com
Add buttons in Bootstrap Navbar

Add buttons using class .navbar-btn to <button> elements. You can try to run the following code to add a button to the navbar
Live Demo
<!DOCTYPE html>
<html>
   <head>
      <title>Bootstrap Example</title>
      <link href = "/bootstrap/css/bootstrap.min.css" rel = "stylesheet">
      <script src = "/scripts/jquery.min.js"></script>
      <script src = "/bootstrap/js/bootstrap.min.js"></script>
   </head>
   <body>
      <nav class = "navbar navbar-default" role = "navigation" style="background: red;color:white;">
         <div class = "navbar-header">
            <a class = "navbar-brand" href = "#">Example</a>
         </div>
         <div>
            <form class = "navbar-form navbar-left" role = "search">
               <div class = "form-group">
                  <input type = "text" class = "form-control" placeholder = "Search here...">
               </div>
               <button type = "submit" class = "btn btn-default">Submit Button</button>
            </form>
            <button type = "button" class = "btn btn-default navbar-btn">Navbar Button</button>
         </div>
      </nav>
   </body>
</html>
How to format a date to String in Java?

The java.text package provides a class named SimpleDateFormat which is used to format and parse dates in required manner (local).
Using the methods of this class you can parse String to Date or, format Date to String.
You can format a given String to Date object using the parse() method of the SimpleDateFormat class. To this method you need to pass the Date in String format. To format a String to Date object −
Instantiate the SimpleDateFormat class by passing the required pattern of the date in String format to its constructor.
Instantiate the SimpleDateFormat class by passing the required pattern of the date in String format to its constructor.
//Instantiating the SimpleDateFormat class
SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy");
Format/convert the required Date object to String using the format() method, by passing it as a parameter.
Format/convert the required Date object to String using the format() method, by passing it as a parameter.
//Formatting the obtained date
String formattedDate = formatter.format(date);
Following Java program formats the current date to a String and prints it.
 Live Demo
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.Date;
public class DateToString {
   public static void main(String args[]) throws ParseException {
      //Retrieving the current date
      LocalDate localDate = LocalDate.now();
      //Converting LocalDate object to Date
      Date date = java.sql.Date.valueOf(localDate);
      //Instantiating the SimpleDateFormat class
      SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy");
      //Formatting the obtained date
      String formattedDate = formatter.format(date);
      System.out.println("Formatted date: "+formattedDate);
   }
}
Formatted date: 31-05-2019
CompareTo() method in C#

To compare two values, use the CompareTo() method.
The following are the return values −
0 = both the numbers are equal
1 = second number is smaller
-1 = first number is smaller
Here is the code to implement CompareTo() method in C# −
 Live Demo
using System;

public class Demo {
   public static void Main() {
      int val1 = 100;
      int val2 = 100;
      int res = val1.CompareTo(val2);
      Console.WriteLine(res);
   }
}
0
Next.js - Environment Setup

As Next.js is a react based framework, we are using Node environment. Now make sure you have Node.js and npm installed on your system. You can use the following command to install Next.js −
npm install next react react-dom
You can observe the following output once Next.js is successfully installed −
+ react@16.13.1
+ react-dom@16.13.1
+ next@9.4.4
added 831 packages from 323 contributors and audited 834 packages in 172.989s

Now, let's create a node package.json −
npm init

Select default values while creating a package.json −
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.

See `npm help json` for definitive documentation on these fields
and exactly what they do.

Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.

Press ^C at any time to quit.
package name: (nextjs)
version: (1.0.0)
description:
entry point: (index.js)
test command:
git repository:
keywords:
author:
license: (ISC)
About to write to \Node\nextjs\package.json:
{
   "name": "nextjs",
   "version": "1.0.0",
   "description": "",
   "main": "index.js",
   "dependencies": {
      "next": "^9.4.4",
      "react": "^16.13.1",
      "react-dom": "^16.13.1"
   },
   "devDependencies": {},
   "scripts": {
      "test": "echo \"Error: no test specified\" && exit 1"
   },
   "author": "",
   "license": "ISC"
}
Is this OK? (yes)

Now update the scripts section of package.json to include Next.js commands.
{
   "name": "nextjs",
   "version": "1.0.0",
   "description": "",
   "main": "index.js",
   "dependencies": {
      "next": "^9.4.4",
      "react": "^16.13.1",
      "react-dom": "^16.13.1"
   },
   "devDependencies": {},
   "scripts": {
      "test": "echo \"Error: no test specified\" && exit 1",
      "dev": "next",
      "build": "next build",
      "start": "next start"
   },
   "author": "",
   "license": "ISC"
}
Create a pages folder within nextjs folder and create an index.js file with following contents.
function HomePage() {
   return <div>Welcome to Next.js!</div>
}

export default HomePage
Run the following command to start the server −.
npm run dev
> nextjs@1.0.0 dev \Node\nextjs
> next

ready - started server on http://localhost:3000
event - compiled successfully
event - build page: /
wait  - compiling...
event - compiled successfully
event - build page: /next/dist/pages/_error
wait  - compiling...
event - compiled successfully

Open localhost:3000 in a browser and you will see the following output.
 Print
 Add Notes
 Bookmark this page
Extract hyperlinks from PDF in Python - GeeksforGeeks

16 Oct, 2021
Prerequisite: PyPDF2, Regex
In this article, We are going to extract hyperlinks from PDF in Python. It can be done in different ways:
Using PyPDF2
Using pdfx
Method 1: Using PyPDF2.
PyPDF2 is a python library built as a PDF toolkit. It is capable of Extracting document information and many more.
Approach:
Read the PDF file and convert it into text
Get URL from text Using Regular Expression
Let’s Implement this module step-wise:
Step 1: Open and Read the PDF file.
Python3
import PyPDF2  file = "Enter PDF File Name" pdfFileObject = open(file, 'rb')  pdfReader = PyPDF2.PdfFileReader(pdfFileObject)  for page_number in range(pdfReader.numPages):         pageObject = pdfReader.getPage(page_number)    pdf_text = pageObject.extractText()    print(pdf_text)     pdfFileObject.close()
Output:
 
Step 2: Use Regular Expression to find URL from String
Python3
# Import Moduleimport PyPDF2import re # Enter File Namefile = "Enter PDF File Name" # Open File filepdfFileObject = open(file, 'rb')  pdfReader = PyPDF2.PdfFileReader(pdfFileObject) # Regular Expression (Get URL from String)def Find(string):       # findall() has been used    # with valid conditions for urls in string    regex = r"(https?://\S+)"    url = re.findall(regex,string)    return [x for x in url]   # Iterate through all pagesfor page_number in range(pdfReader.numPages):         pageObject = pdfReader.getPage(page_number)         # Extract text from page    pdf_text = pageObject.extractText()         # Print all URL    print(Find(pdf_text))     # CLose the PDFpdfFileObject.close()
Output:
['https://docs.python.org/', 'https://pythonhosted.org/PyPDF2/', 'https://www.geeksforgeeks.org/']
Method 2: Using pdfx. 
In this method, we will use pdfx module. pdfx module is used to extract URL, MetaData, and Plain text from a given PDF or PDF URL. Features: Extract references and metadata from a given PDF.
pip install pdfx
Below is the implementation:
Python3
# Import Moduleimport pdfx # Read PDF Filepdf = pdfx.PDFx("File Name") # Get list of URLprint(pdf.get_references_as_dict())
Output:-
{'url': ['https://www.geeksforgeeks.org/',
  'https://docs.python.org/',
  'https://pythonhosted.org/PyPDF2/',
  'GeeksforGeeks.org']}
sooda367
Picked
python-utility
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
How To Convert Python Dictionary To JSON?
Check if element exists in list in Python
How to drop one or multiple columns in Pandas Dataframe
Python Classes and Objects
Python | os.path.join() method
Create a directory in Python
Python | Get unique values from a list
Python | Pandas dataframe.groupby()
Defaultdict in Python
How To Make Density Plots with ggplot2 in R?

05 Oct, 2021
In this article, we are going to see how to make Density plots with ggtplot2 in R Programming language.
To create a density plot in R using ggplot2, we use the geom_density() function of the ggplot2 package.
Syntax: ggplot( aes(x)) + geom_density( fill, color, alpha)
Parameters:
fill: background color below the plot
color: the color of the plotline
alpha: transparency of graph
Here we are going to create a density plot.
R
# create dataframeset.seed(1234)df <- data.frame(value =round(c(rnorm(200,                                      mean=100,                                      sd=7))))  # import libraries ggplot2library(ggplot2)    # create density plot ggplot(df, aes(x=value)) + geom_density()
Output:
To change color, we use the color property of the geom_density() function.
R
# create dataframeset.seed(1234)df <- data.frame(value =round(c(rnorm(900,                                      mean=60,                                       sd=21))))  # import libraries ggplot2library(ggplot2)       # create density plot with desired colours ggplot(df, aes(x=value)) + geom_density(color="green")
Output:
To change background color, we use the fill property of geom_density() function.
R
# create dataframeset.seed(1234)df <- data.frame(value =round(c(rnorm(900,                                      mean=60,                                       sd=21))))  # import libraries ggplot2 library(ggplot2)         # create density plot with desired colours ggplot(df, aes(x=value)) + geom_density(fill="#77bd89",                                         color="#1f6e34",                                         alpha=0.8)
Output:
When x or y-axis data is very large, we can draw plots with log scale using the following.
Syntax: plot+ scale_x_log10()
R
# create dataframeset.seed(1234)df <- data.frame(value =round(c(rnorm(9000,                                      mean=600000,                                       sd=210000))))  # import libraries ggplot2library(ggplot2)        # create density plot with log scale ggplot(df, aes(x=value)) + geom_density() + scale_x_log10()
Output:
Picked
R-ggplot
R Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python | sympy.subs() method

18 Jun, 2019
With the help of sympy.subs() method, we can substitute all instances of a variable or expression in a mathematical expression with some other variable or expression or value.
Syntax: math_expression.subs(variable, substitute)
Parameters:variable – It is the variable or expression which will be substituted.substitute – It is the variable or expression or value which comes as substitute.
Returns: Returns the expression after the substitution.
Example #1:
In this example we can see that by using sympy.subs() method, we can find the resulting expression after substituting a variable or expression with some other variable or expression or value. Here we use symbols() method also to declare a variable as symbol.
# import sympyfrom sympy import *  x, y = symbols('x y')exp = x**2 + 1print("Before Substitution : {}".format(exp))     # Use sympy.subs() methodres_exp = exp.subs(x, y)     print("After Substitution : {}".format(res_exp)) 
Output:
 
Before Substitution : x**2 + 1
After Substitution : y**2 + 1

 Example #2:
In this example we see that if the substituted value is numerical then sympy.subs() returns the solution of the resulting expression.
# import sympyfrom sympy import *   x = symbols('x')exp = cos(x) + 7print("Before Substitution : {}".format(exp))     # Use sympy.subs() methodres_exp = exp.subs(x, 0)     print("After Substitution : {}".format(res_exp)) 
Output:
 
Before Substitution : cos(x) + 7
After Substitution : 8

Example #3:
In this example we see that we can do multiple substitutions if we pass a list of (old, new) pairs to subs.
# import sympyfrom sympy import *   x, y, z = symbols('x y z')exp = x**2 + 7 * y + zprint("Before Substitution : {}".format(exp))     # Use sympy.subs() methodres_exp = exp.subs([(x, 2), (y, 4), (z, 1)])     print("After Substitution : {}".format(res_exp)) 
Output:
 
Before Substitution : x**2 + 7*y + z
After Substitution : 33

SymPy
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python PIL | Image.transform() method

02 Aug, 2019
PIL is the Python Imaging Library which provides the python interpreter with image editing capabilities. The Image module provides a class with the same name which is used to represent a PIL image. The module also provides a number of factory functions, including functions to load images from files, and to create new images.
Image.transform() Transforms this image. This method creates a new image with the given size, and the same mode as the original, and copies data to the new image using the given transform.
Syntax: Image.transform(size, method, data=None, resample=0, fill=1)
Parameters:size – The output size.method – The transformation method.data – Extra data to the transformation method.resample – Optional resampling filter.
Returns: An Image object.
Image Used:
   # importing Image module from PIL package from PIL import Image  # creating image objectimg = Image.open(r"C:\Users\System-Pc\Desktop\tree.jpg")  # using image transform methodimg1 = img.transform((300, 300), Image.EXTENT,        data =[10, 0, 10 + img.width // 4, img.height // 3 ])  img1.show()
Output:
Python-pil
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Play Video on Mouse Hover and Pause on Mouseout using JavaScript ?

22 Nov, 2021
In this article, we learn how to play a video when the mouse hovers on it and how to stop it when the mouse is removed from the video element. Sometimes there is a need where we want that video on websites to automatically starts playing when the user keeps the mouse over it because it reduces the number of clicks by the user on the website and gives a great experience to the user. So to achieve that purpose we use javascript to make it playable when the mouse hovers over it and when the mouse comes out then it automatically stops playing.
Approach: First, we will attach a video file to our HTML DOM and then apply mouseover and mouseout event listener on it using javascript. Below is the complete code implementation:
Example: In this example, we will use pure javascript to play the video.
 
HTML
<!DOCTYPE html><html lang="en">  <head>    <meta charset="UTF-8">    <meta http-equiv="X-UA-Compatible"        content="IE=edge">    <meta name="viewport" content=        "width=device-width, initial-scale=1.0"></head>  <body>      <!-- Video element -->    <video src="https://media.geeksforgeeks.org/wp-content/uploads/20210810214359/2.mp4"        type="video/mp4" muted class="vid"         loop style="border: solid; width: 800px;">    </video>      <script>          // Targeting video element         let clip = document.querySelector(".vid")          /* Applying mouseover event on video clip         and then we call play() function to play         the video when the mouse is over the video */        clip.addEventListener("mouseover", function (e) {            clip.play();        })          /* Applying mouseout event on video clip         and then we call pause() function to stop         the video when the mouse is out the video */        clip.addEventListener("mouseout", function (e) {            clip.pause();        })    </script></body>  </html>
browser output
HTML-Questions
JavaScript-Questions
Picked
HTML
JavaScript
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Plotting a Sawtooth Wave using Matplotlib

03 Jan, 2021
Prerequisites:
Matplotlib
Scipy
A sawtooth waveform is a non-sinusoidal waveform because its teeth look like a saw. In an inverse (or reverse) sawtooth waveform the wave suddenly ramps downwards and then rises sharply. With Matplotlib we can draw different types of Graphical data. In this article, we will try to understand, How can we plot sawtooth waves using the Scipy python module.
Import required module.
Create a sample rate. The NumPy linspace function is a tool in Python for creating numeric sequences that return evenly spaced numbers over a specified interval.
Syntax:
numpy.linspace(start, stop, num = 50,endpoint = True, retstep = False, dtype = None)
Plot a sawtooth wave.
Label the graph.
Display Graph.
Syntax:
scipy.signal.sawtooth(t)
Parameter:
t: The input time array.
Return:
Output array containing the sawtooth waveform.
Program:
Python3
from scipy import signalimport matplotlib.pyplot as plotimport numpy as np  t = np.linspace(0, 1, 1000, endpoint=True)  # Plot the sawtooth waveplot.plot(t, signal.sawtooth(2 * np.pi * 5 * t))  # Give x, y, title axis labelplot.xlabel('Time')plot.ylabel('Amplitude')plot.title('Sawtooth Signal - Geeksforgeeks')  plot.axhline(y=0, color='k')  # Displayplot.show()
Output:
Python-matplotlib
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
p5.js | imageMode() Function

27 Feb, 2020
The imageMode() function is used to set the image mode of an image. The image mode defines the position of the image in the canvas, by changing the way that the parameters given to the image() function are interpreted.
Syntax:
imageMode( mode )
Parameters: This function accepts a single parameter mode that defines the mode to be used. It can have the following values:
CORNER: This mode interprets the second and third parameters given to image() as the upper-left corner of the image.
CORNERS: This mode interprets the second and third parameters given to image() as the upper-left corner and the fourth and fifth parameters as the bottom-right corner of the image.
CENTER: This mode interprets the second and third parameters given to image() as the center point of the image. Additonally, if the fourth and fifth parameters are specified, they are used as the width and height of the image.
Below example illustrate the imageMode() function in p5.js:
Example:
function preload() {  img = loadImage('sample-image.png');}  function setup() {  imageModes = [    CORNER,    CORNERS,    CENTER  ];  i = 0;  currMode = imageModes[i];    createCanvas(600, 400);  textSize(22);    // Create a button for the switching  // the imageMode  switchBtn = createButton("Change imageMode");  switchBtn.position(30, 400)  switchBtn.mousePressed(switchMode);}  function draw() {  clear();  text("Click on the button change the current"+                           " imageMode", 20, 20);  text("Current imageMode: " + currMode, 20, 40);    // Creating a rectangle to demonstrate  // the location of the image  rect(150, 150, 200, 200);    // Setting the imageMode  imageMode(currMode);    // Drawing the image  image(img, 150, 150, 200, 200);}  function switchMode() {  // Change the current imageMode  if (i < imageModes.length - 1)    i++;  else    i = 0;  currMode = imageModes[i];}
Output:
Online editor: https://editor.p5js.org/
Environment Setup: https://www.geeksforgeeks.org/p5-js-soundfile-object-installation-and-methods/
Reference: https://p5js.org/reference/#/p5/imagemode
JavaScript-p5.js
JavaScript
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python & MySQL - Select Database Example

Python MySQLdb provides MySQLdb.connect() function to select a database. This function takes multiple parameters and returns a connection object to do database operations.
db = MySQLdb.connect(host, username, passwd, dbName, port, socket);

host
Optional − The host name running the database server. If not specified, then the default value will be localhost:3306.
username
Optional − The username accessing the database. If not specified, then the default will be the name of the user that owns the server process.
passwd
Optional − The password of the user accessing the database. If not specified, then the default will be an empty password.
dbName
Optional − database name on which query is to be performed.
port
Optional − the port number to attempt to connect to the MySQL server..
socket
Optional − socket or named pipe that should be used.
You can disconnect from the MySQL database anytime using another connection object function close().
db.close()

Try the following example to connect to a MySQL database −
Copy and paste the following example as mysql_example.py −
#!/usr/bin/python

import MySQLdb

# Open database connection
db = MySQLdb.connect("localhost","root","root@123", "TUTORIALS")

# prepare a cursor object using cursor() method
cursor = db.cursor()

# execute SQL query using execute() method.
cursor.execute("SELECT VERSION()")

# Fetch a single row using fetchone() method.
data = cursor.fetchone()
if data:
   print('Version available: ', data)
else:
   print('Version not retrieved.')

# disconnect from server
db.close()
Execute the mysql_example.py script using python and verify the output.
py mysql_example.py
Version available:  ('8.0.23',)


    187 Lectures 
     17.5 hours 

 Malhar Lathkar

    55 Lectures 
     8 hours 

 Arnab Chakraborty

    136 Lectures 
     11 hours 

 In28Minutes Official

    75 Lectures 
     13 hours 

 Eduonix Learning Solutions

    70 Lectures 
     8.5 hours 

 Lets Kode It

    63 Lectures 
     6 hours 

 Abhilash Nelson
 Print
 Add Notes
 Bookmark this page
Video to Audio convert using Python - GeeksforGeeks

16 Jul, 2020
Prerequisites: Python Programming Language
There are several libraries and techniques available in Python for the conversion of Video to Audio. One such library is Movie Editor.
MoviePy can read and write all the most common audio and video formats, including GIF, and runs on Windows/Mac/Linux, with Python 2.7+ and 3 (or only Python 3.4+ from v.1.0)
To install the Movie Editor Library, open terminal and write :
pip install moviepy

Note: This module automatically installs FFmpeg. However, you might prompt to install in some cases.
Windows:
Download the build from here.
Unzip the build in any folder.
Open the CMD with adminstrative rights.
Run the below command for setting the environment variable.setx /M PATH "path\to\ffmpeg\bin;%PATH%"
setx /M PATH "path\to\ffmpeg\bin;%PATH%"
Linux:
Write the below commands in the terminal.
sudo add-apt-repository ppa:mc3man/trusty-media  
sudo apt-get update  
sudo apt-get install ffmpeg  
sudo apt-get install frei0r-plugins
Implementation
# Python code to convert video to audioimport moviepy.editor as mp  # Insert Local Video File Path clip = mp.VideoFileClip(r"Video File")  # Insert Local Audio File Pathclip.audio.write_audiofile(r"Audio File")
Output:
Python-projects
python-utility
Technical Scripter 2019
Python
Technical Scripter
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
Python - Horizontal Concatenation of Multiline Strings - GeeksforGeeks

05 Sep, 2020
Given pair of strings, which is multiline, perform concatenation horizontally.
Examples:
Input : test_str1 = ”’ geeks for geeks”’, test_str2 = ”’ is best”’ Output : geeks foris geeksbest Explanation : 1st line joined with 1st line of 2nd string, “geeks for” -> “is”.
Input : test_str1 = ”’ geeks for ”’ test_str2 = ”’ geeks ”’ Output : geeks for geeks Explanation : 1st line joined with 1st line of 2nd string, “geeks for ” -> “geeks”.  
Method #1 : Using zip() + split() + join() + list comprehension
In this, we perform the task of splitting by “\n” using split(), and they are paired together using zip(). The next step is joining both the zipped strings for horizontal orientation using “\n” and join().
Python3
# Python3 code to demonstrate working of# Horizontal Concatenation of Multiline Strings# Using zip() + split() + join() + list comprehension  # initializing stringstest_str1 = '''geeks 4geeks'''  test_str2 = '''isbest'''  # printing original stringsprint("The original string 1 is : " + str(test_str1))print("The original string 2 is : " + str(test_str2))  # split linessplt_lines = zip(test_str1.split('\n'), test_str2.split('\n'))  # horizontal joinres = '\n'.join([x + y for x, y in splt_lines])  # printing resultprint("After String Horizontal Concatenation : " + str(res))
The original string 1 is : 
geeks 4
geeks
The original string 2 is : 
is
best
After String Horizontal Concatenation : 
geeks 4is
geeksbest

Method #2 : Using map() + operator.add + join()
In this, we use map() to with help of add() to perform concatenation, split() is used to perform initial split by “\n”.
Python3
# Python3 code to demonstrate working of# Horizontal Concatenation of Multiline Strings# Using map() + operator.add + join()from operator import add  # initializing stringstest_str1 = '''geeks 4geeks'''test_str2 = '''isbest'''  # printing original stringsprint("The original string 1 is : " + str(test_str1))print("The original string 2 is : " + str(test_str2))  # using add to concat, map() to concat each lines zippedres = '\n'.join(map(add, test_str1.split('\n'), test_str2.split('\n')))  # printing resultprint("After String Horizontal Concatenation : " + str(res))
The original string 1 is : 
geeks 4
geeks
The original string 2 is : 
is
best
After String Horizontal Concatenation : 
geeks 4is
geeksbest

Python string-programs
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
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 program to convert a list to string
Defaultdict in Python
Python | Get dictionary keys as a list
Python | Split string into list of characters
Python | Convert a list to dictionary
Duration ofMillis(long) method in Java with Examples - GeeksforGeeks

26 Nov, 2018
The ofMillis(long) method of Duration Class in java.time package is used to get a duration in a 1 milliSecond format.
Syntax:
public static Duration ofMillis(long milliSeconds)

Parameters: This method accepts a parameter milliSeconds which is the number of milliSeconds. It can be positive or negative.
Return Value: This method returns a Duration representing the time in 1 milliSecond format.
Exception: This method throws ArithmeticException if the input milliSeconds exceeds the capacity of Duration.
Below examples illustrate the Duration.ofMillis() method:
Example 1:
// Java code to illustrate ofMillis() method  import java.time.Duration;  public class GFG {    public static void main(String[] args)    {          // input number of Millis        long noOfMillis = 50000;          // Duration using ofMillis() method        Duration duration            = Duration.ofMillis(noOfMillis);          System.out.println(duration.getSeconds());    }}
50

Example 2:
// Java code to illustrate ofMillis() method  import java.time.Duration;  public class GFG {    public static void main(String[] args)    {          // input number of Millis        long noOfMillis = -445000;          // Duration using ofMillis() method        Duration duration            = Duration.ofMillis(noOfMillis);          System.out.println(duration.getSeconds());    }}
-445

Reference: https://docs.oracle.com/javase/9/docs/api/java/time/Duration.html#ofMillis-long-
Java-Duration
Java-Functions
Java-time package
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Stream In Java
Constructors in Java
Exceptions in Java
Functional Interfaces in Java
Different ways of Reading a text file in Java
Generics in Java
Introduction to Java
Comparator Interface in Java with Examples
Internal Working of HashMap in Java
Strings in Java
Collections singletonList() method in Java with Examples - GeeksforGeeks

19 Feb, 2021
The singletonList() method of java.util.Collections class is used to return an immutable list containing only the specified object. The returned list is serializable. This list will always contain only one element thus the name singleton list. When we try to add/remove an element on the returned singleton list, it would give UnsupportedOperationException.
Syntax:  
public static  List singletonList(T o)
Parameters: 
This method takes the object o as a parameter to be stored in the returned list.
Return Value: 
This method returns an immutable list containing only the specified object.
Below are the examples to illustrate the singletonList() method
Example 1:  
Java
// Java program to demonstrate// singletonList() method// for <String> Value import java.util.*; public class GFG1 {    public static void main(String[] argv)        throws Exception    {         try {             // create singleton list            // using method singletonList() method            List<String> list = Collections.singletonList("E");             // print the list            System.out.println("singletonList : " + list);        }         catch (IllegalArgumentException e) {            System.out.println("Exception thrown : " + e);        }    }}
singletonList : [E]

Example 2: 
Java
// Java program to demonstrate// singletonList() method// for <Integer> Value import java.util.*; public class GFG1 {    public static void main(String[] argv)        throws Exception    {         try {             // create singleton list            // using method singletonList() method            List<Integer> list = Collections.singletonList(20);             // print the list            System.out.println("singletonList : " + list);        }         catch (IllegalArgumentException e) {            System.out.println("Exception thrown : " + e);        }    }}
singletonList : [20]

hajamohamedm
Java - util package
Java-Collections
Java-Functions
Java
Java
Java-Collections
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Object Oriented Programming (OOPs) Concept in Java
HashMap in Java with Examples
Stream In Java
Interfaces in Java
How to iterate any Map in Java
ArrayList in Java
Stack Class in Java
Singleton Class in Java
Multidimensional Arrays in Java
Set in Java
How to automatically start a download in PHP ? - GeeksforGeeks

14 Sep, 2020
This post deals with creating a start downloading file using PHP. The idea is to make a download button which will redirect you to another page with the PHP script that will automatically start the download.
Creating a download button:
<!DOCTYPE html><html>  <head>    <meta name="viewport" content=        "width=device-width, initial-scale=1">    <style>        .btn {            background-color: limeGreen;            border: none;            color: white;            padding: 12px 30px;            cursor: pointer;            font-size: 20px;        }          .btn:hover {            background-color: green;        }    </style></head>  <body>    <center>        <p>Auto width:</p>        <button class="btn">            <i class="fa fa-download">Download</i>        </button>        <p>Full width:</p>        <button class="btn" style="width:100%">            <i class="fa fa-download">Download</i>        </button>    </center></body>  </html>
Output:
To redirect to some file which has the file to be downloaded, create an HTML form as shown below.
<form action="downloadFile.php" method="post"> <input type="submit" name="submit" value="Download" /></form>
Output:
PHP code to download: When the user clicks the above button, the code will be redirected to the “downloadFile.php” file. Now, use the URL of the file and PHP file_get_contents() function to download the file.
<?php     // Initialize a file URL to // the variable $url = 'https://contribute.geeksforgeeks.org/wp-content/uploads/gfg-40.png';     // Use basename() function to // return the file  $file_name = basename($url);      // Use file_get_contents() function // to get the file from url and use // file_put_contents() function to // save the file by using base name if(file_put_contents( $file_name,       file_get_contents($url))) {     echo "File downloaded successfully"; } else {     echo "File downloading failed."; }?> 
Output:
Before running the program:
After running the program:
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.
CSS-Misc
HTML-Misc
PHP-Misc
CSS
HTML
PHP
PHP Programs
Web Technologies
HTML
PHP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to apply style to parent if it has child with CSS?
How to position a div at the bottom of its container using CSS?
Types of CSS (Cascading Style Sheet)
How to set space between the flexbox ?
Design a web page using HTML and CSS
How to set the default value for an HTML <select> element ?
Hide or show elements in HTML using display property
How to set input type date in dd-mm-yyyy format using HTML ?
REST API (Introduction)
How to Insert Form Data into Database using PHP ?
MathML - Repeating Decimals

Decimal numbers having digit(s) that repeat(s) infinitely such as 1/3 (.3333...) are represented by putting a horizontal line over or below the digits that repeat. <mstack> , <msrow>, and <msline> elements can be used to create decimal numbers with repeated digits as shown below.
<math xmlns = "http://www.w3.org/1998/Math/MathML">
   <mstack stackalign = "right">
      <msline length = "1"/>
      <mn> 0.3333 </mn>
   </mstack>
</math>
<math xmlns = "http://www.w3.org/1998/Math/MathML">
   <mstack stackalign="right">
      <msline length="6"/>
      <mn> 0.142857 </mn>
   </mstack>
</math> 
<math xmlns = "http://www.w3.org/1998/Math/MathML">
   <mstack stackalign="right">   
      <mn> 0.142857 </mn>
      <msline length="6"/>
   </mstack>
</math> 
 Print
 Add Notes
 Bookmark this page
AngularJS | angular.isArray() Function - GeeksforGeeks

16 Apr, 2019
The angular.isArray() Function in AngularJS is used to return TRUE if the reference is an array and FALSE if it is not an array.Syntax:
angular.isArray(value)
Return value: Returns TRUE if the value is an array else it will return FALSE.
Example 1:
<html>    <head>        <title>angular.isArray()</title>    <script src=    "https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js">     </script>    </head>    <body ng-app="app" style="text-align:Center">        <h1 style="color:green">GeeksforGeeks</h1>          <h2>angular.isArray()</h2>          <div ng-controller="geek">            <b>Sorting Algos:</b>            <div ng-repeat="i in sort">{{i.name}}</div>            <br><br>            isArray: {{isArray}}        </div>          <script>        var app = angular.module("app", []);        app.controller('geek', ['$scope', function ($scope) {            $scope.sort = [];            var values = [            { name: 'Merge sort' },             { name: 'Quick sort' },             { name: 'Bubble sort' }            ];            if (angular.isArray(values)) {                $scope.isArray = true;                angular.forEach(values, function (value, key) {                    $scope.sort.push(value)                })            }        }]);        </script>    </body></html>
Output:
Example 2:
<!DOCTYPE html><html>    <head>        <title>angular.isArray()</title>    <script src=    "https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js">     </script>    </head>    <body ng-app="app" style="text-align:Center">        <h1 style="color:green">GeeksforGeeks</h1>        <h2>angular.isArray()</h2>        <div ng-controller="geek">        <b>Input: </b>{{name}}        <br><br>            <b>isArray:</b> {{isArray}}        </div>        <script>            var app = angular.module("app", []);            app.controller('geek', ['$scope', function ($scope) {                var values = 'GeeksforGeeks';                $scope.name = values;                $scope.isArray = angular.isArray(values)            }]);        </script>    </body></html>
Output:
AngularJS
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Top 10 Angular Libraries For Web Developers
Angular File Upload
How to use <mat-chip-list> and <mat-chip> in Angular Material ?
Auth Guards in Angular 9/10/11
Angular | keyup event
Roadmap to Become a Web Developer in 2022
Installation of Node.js on Linux
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?
Functional Programming - Tuple

A tuple is a compound data type having a fixed number of terms. Each term in a tuple is known as an element. The number of elements is the size of the tuple.
The following program shows how to define a tuple of four terms and print them using C#, which is an object-oriented programming language.
using System; 
public class Test { 
   public static void Main() { 
      var t1 = Tuple.Create(1, 2, 3, new Tuple<int, int>(4, 5));   
      Console.WriteLine("Tuple:" + t1);    
   } 
} 
It will produce the following output −
Tuple :(1, 2, 3, (4, 5)) 

The following program shows how to define a tuple of four terms and print them using Erlang, which is a functional programming language.
-module(helloworld).  
-export([start/0]).   

start() -> 
   P = {1,2,3,{4,5}} ,  
   io:fwrite("~w",[P]). 
It will produce the following output −
{1, 2, 3, {4, 5}} 

Tuples offer the following advantages −
Tuples are fined size in nature i.e. we can’t add/delete elements to/from a tuple.
Tuples are fined size in nature i.e. we can’t add/delete elements to/from a tuple.
We can search any element in a tuple.
We can search any element in a tuple.
Tuples are faster than lists, because they have a constant set of values.
Tuples are faster than lists, because they have a constant set of values.
Tuples can be used as dictionary keys, because they contain immutable values like strings, numbers, etc.
Tuples can be used as dictionary keys, because they contain immutable values like strings, numbers, etc.
In this section, we will discuss a few operations that can be performed on a tuple.
The method is_tuple(tuplevalues) is used to determine whether an inserted value is a tuple or not. It returns true when an inserted value is a tuple, else it returns false. For example,
-module(helloworld).  
-export([start/0]).  

start() ->  
   K = {abc,50,pqr,60,{xyz,75}} , io:fwrite("~w",[is_tuple(K)]). 
It will produce the following output −
True

The method list_to_tuple(listvalues) converts a list to a tuple. For example,
-module(helloworld).  
-export([start/0]).  

start() ->  
   io:fwrite("~w",[list_to_tuple([1,2,3,4,5])]). 
It will produce the following output −
{1, 2, 3, 4, 5} 

The method tuple_to_list(tuplevalues) converts a specified tuple to list format. For example,
-module(helloworld).  
-export([start/0]).  

start() ->  
   io:fwrite("~w",[tuple_to_list({1,2,3,4,5})]). 
It will produce the following output −
[1, 2, 3, 4, 5] 

The method tuple_size(tuplename) returns the size of a tuple. For example,
-module(helloworld).  
-export([start/0]).  

start() ->  
   K = {abc,50,pqr,60,{xyz,75}} ,  
   io:fwrite("~w",[tuple_size(K)]). 
It will produce the following output −
5


    32 Lectures 
     3.5 hours 

 Pavan Lalwani

    11 Lectures 
     1 hours 

 Prof. Paul Cline, Ed.D

    72 Lectures 
     10.5 hours 

 Arun Ammasai

    51 Lectures 
     2 hours 

 Skillbakerystudios

    43 Lectures 
     4 hours 

 Mohammad Nauman

    8 Lectures 
     1 hours 

 Santharam Sivalenka
 Print
 Add Notes
 Bookmark this page
How to change the name of data frames stored in an R list?

To change the name of data frames stored in an R list, we can follow the below steps −
First of all, create a list of data frames.
First of all, create a list of data frames.
Then, use names function to change the name of data frames.
Then, use names function to change the name of data frames.
Using data.frame function to create data frames and list function to create the list of those data frames −
df1<-data.frame(x1=rpois(25,5),x2=rpois(25,3),x3=rpois(25,1))
df2<-data.frame(y1=rpois(25,5),y2=rpois(25,3),y3=rpois(25,1))
List<-list(df1,df2)
List
On executing, the above script generates the below output(this output will vary on your system due to randomization) −
[[1]]
  x1 x2 x3
1  5  2 0
2  1  4 3
3  1  2 2
4  3  2 0
5  6  4 2
6  5  3 0
7  4  1 2
8  3  1 1
9  4  1 0
10 4  3 0
11 5  2 1
12 7  3 3
13 2  3 0
14 5  5 0
15 9  5 0
16 4  1 1
17 2  3 1
18 6  4 1
19 4  4 0
20 9  9 1
21 9  1 1
22 4  1 2
23 5  5 0
24 5  4 1
25 4  2 0

[[2]]
   y1 y2 y3
1  3  6  1
2  9  6  1
3  8  5  0
4  8  5  2
5  7  3  0
6  6  1  0
7  6  5  0
8  4  2  0
9  2  3  0
10 2  3  1
11 5  1  1
12 6  8  0
13 2  3  2
14 9  2  0
15 5  4  2
16 5  2  0
17 7  3  0
18 5  3  1
19 10 2  0
20 3  4  1
21 5  6  1
22 10 2  4
23 6  5  0
24 3  0  1
25 1  0  1
Change the name of data frames in list
Using names function to change the name of data frames stored in list called List as shown below −
df1<-data.frame(x1=rpois(25,5),x2=rpois(25,3),x3=rpois(25,1))
df2<-data.frame(y1=rpois(25,5),y2=rpois(25,3),y3=rpois(25,1))
List<-list(df1,df2)
names(List)<-c("X","Y")
List
$X
   x1 x2 x3
1  9  3  0
2  2  5  1
3  4  2  0
4  7  5  1
5  3  5  2
6  2  2  3
7  7  2  0
8  2  1  1
9  1  2  1
10 9  4  1
11 5  3  1
12 8  6  0
13 7  3  2
14 6  2  2
15 4  5  0
16 5  1  0
17 5  3  0
18 7  1  1
19 3  5  0
20 4  3  0
21 8  1  1
22 4  0  1
23 10 0  0
24 8  4  4
25 3  6  0

$Y
   y1 y2 y3
1  5  3  1
2  5  5  2
3  5  2  1
4  2  3  1
5  3  5  3
6  3  3  0
7  3  1  0
8  6  4  2
9  8  3  0
10 3  0  1
11 6  1  0
12 4  4  0
13 5  2  0
14 4  2  1
15 9  3  2
16 7  4  1
17 5  2  2
18 6  2  2
19 3  1  0
20 4  4  1
21 3  1  0
22 3  4  3
23 7  2  1
24 1  5  4
25 8  3  0