code-rag-bench/online-tutorials huggingface dataset:
rm - Unix, Linux Command

rm - remove files or directories
rm [OPTION]... FILE...
rm removes each specified file. By default, it does not remove directories.
If the -I or --interactive=once option is given, and there are more than three files or the -r, -R, or --recursive are given, then rm prompts the user for whether to proceed with the entire operation. If the response is not affirmative, the entire command is aborted.
Otherwise, if a file is unwritable, standard input is a terminal, and the -f or --force option is not given, or the -i or --interactive=always option is given, rm prompts the user for whether to remove the file. If the response is not affirmative, the file is skipped.
Example-1:
Remove the file myfile.txt. If the file is write-protected, you will be prompted to confirm that you really want to delete it:
$ rm myfile.txt
Example-2:
Remove the file myfile.txt. You will not be prompted, even if the file is write-protected; if rm can delete the file, it will:
$ rm -f myfile.txt
Example-3:
Remove all files in the working directory. If it is write-protected, you will be prompted before rm removes it:
$ rm *
Example-4:
Remove all files in the working directory. rm will not prompt you for any reason before deleting them:
$ rm -f *
Example-5:
Attempt to remove every file in the working directory, but prompt before each file to confirm:
$ rm -i *
Example-6:
Remove every file in the working directory; prompt for confirmation if more than three files are being deleted:
$ rm -I *
Example-7:
Remove the directory mydirectory, and any files and directories it contains. If a file or directory that rm tries to delete 
is write-protected, you will be prompted to make sure that you really want to delete it:
$ rm -r mydirectory 
Example-8:
Same as the above command, but you will never be prompted; if rm can delete the files, it will:
$ rm -rf mydirectory
numpy.sin() in Python

04 Jul, 2021
numpy.sin(x[, out]) = ufunc ‘sin’) : This mathematical function helps user to calculate trigonometric sine for all x(being the array elements). Parameters :  
array    : [array_like]elements are in radians. 
 
2pi Radians = 36o degrees
Return :  
An array with trigonometric sine of
x for all x i.e. array elements 
  Code #1 : Working  
Python
# Python program explaining# sin() function import numpy as npimport math in_array = [0, math.pi / 2, np.pi / 3, np.pi]print ("Input array : \n", in_array) Sin_Values = np.sin(in_array)print ("\nSine values : \n", Sin_Values)
Output :  
Input array : 
 [0, 1.5707963267948966, 1.0471975511965976, 3.141592653589793]

Sine values : 
 [  0.00000000e+00   1.00000000e+00   8.66025404e-01   1.22464680e-16]
  Code #2 : Graphical representation  
Python
# Python program showing# Graphical representation of# sin() function import numpy as npimport matplotlib.pyplot as plt in_array = np.linspace(-np.pi, np.pi, 12)out_array = np.sin(in_array) print("in_array : ", in_array)print("\nout_array : ", out_array) # red for numpy.sin()plt.plot(in_array, out_array, color = 'red', marker = "o")plt.title("numpy.sin()")plt.xlabel("X")plt.ylabel("Y")plt.show()
Output :  
in_array :  [-3.14159265 -2.57039399 -1.99919533 -1.42799666 -0.856798   -0.28559933
  0.28559933  0.856798    1.42799666  1.99919533  2.57039399  3.14159265]

out_array :  [ -1.22464680e-16  -5.40640817e-01  -9.09631995e-01  -9.89821442e-01
  -7.55749574e-01  -2.81732557e-01   2.81732557e-01   7.55749574e-01
   9.89821442e-01   9.09631995e-01   5.40640817e-01   1.22464680e-16]
 
References : https://docs.scipy.org/doc/numpy-dev/reference/generated/numpy.sin.html#numpy.sin . 
akshaysingh98088
Python numpy-Mathematical Function
Python-numpy
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Different ways to create Pandas Dataframe
Enumerate() in Python
Read a file line by line in Python
Python String | replace()
How to Install PIP on Windows ?
*args and **kwargs in Python
Python Classes and Objects
Iterate over a list in Python
Python OOPs Concepts
Print * in place of characters for reading passwords in C

20 Sep, 2018
While writing a C program, if you want to type password and it should not be visible on screen or an * symbol is to be printed.
Examples:
Input : abcdefg
Output : *******

Note : Below solution uses getch() which may not work on all compilers as this is a non-standard function.
// C program to print * // in place of characters#include<stdio.h>#include<conio.h>int main(void){    char password[55];      printf("password:\n");    int p=0;    do{        password[p]=getch();        if(password[p]!='\r'){            printf("*");        }        p++;    }while(password[p-1]!='\r');    password[p-1]='\0';    printf("\nYou have entered %s as password.",password);    getch();}
Explanation: Basically it is taking the characters we enter through getch() function and print * instead of it for every letter we type.
Remark: It doesn’t run in this IDE, download this file and run in your terminal.
This article is contributed by Pavan Gopal Rayapati. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
imdpkmr
C Language
School Programming
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Unordered Sets in C++ Standard Template Library
Operators in C / C++
Exception Handling in C++
What is the purpose of a function prototype?
TCP Server-Client implementation in C
Python Dictionary
Reverse a string in Java
Introduction To PYTHON
Interfaces in Java
Inheritance in C++
Python Program for BogoSort or Permutation Sort

In this article, we will learn about the solution to the problem statement given below.
Problem statement − We are given an array, we need to sort it using the concept of permutation sort.
BogoSort also is known as permutation sort, is based on generating and testing paradigms.
Now let’s observe the solution in the implementation below−
 Live Demo
# random module
import random
# Sort
def bogoSort(a):
   n = len(a)
   while (is_sorted(a)== False):
      shuffle(a)
# check
def is_sorted(a):
   n = len(a)
   for i in range(0, n-1):
      if (a[i] > a[i+1] ):
         return False
   return True
# permutation
def shuffle(a):
   n = len(a)
   for i in range (0,n):
      r = random.randint(0,n-1)
      a[i], a[r] = a[r], a[i]
# main
a = [1,5,3,4,8,6,3,4,5]
bogoSort(a)
print("Sorted array :")
for i in range(len(a)):
   print (a[i],end=" ")
Sorted array is :
1 3 3 4 4 5 5 6 8
All the variables are declared in the local scope and their references are seen in the figure above.
In this article, we have learned about how we can make a Python Program for BogoSort or Permutation Sort
HTML <del> Tag - GeeksforGeeks

17 Mar, 2022
The <del> tag in HTML stands for delete and is used to mark a portion of text which has been deleted from the document. The deleted text is rendered as strike-through text by the web browsers although this property can be changed using CSS text-decoration property. The <del> tag requires a starting and ending tag.
Attributes: The <del> tag contains two attributes which are listed below: 
cite: It is used to specify the URL of the document or message which denotes the reason for deleting the text.
datetime: It is used to specify the date and time of the deleted text.
Syntax:
<del> Contents... </del>
Example 1: Below example illustrate the <del> element in HTML:
HTML
<!DOCTYPE html><html>    <body>        <h1>GeeksforGeeks</h1>        <h2>HTML del Tag</h2>        <!-- HTML del tag is used in paragraph Tag -->          <p>GeeksforGeeks is a <del>mathematical</del>           science portal</p>        </body></html>                   
Output:  
Example 2: This example use the <del> tag with the datetime attribute.  
HTML
<!DOCTYPE html><html>    <body>        <h1>GeeksforGeeks</h1>        <h2>HTML del Tag</h2>        <!-- HTML del tag is used in paragraph Tag -->          <p>GeeksforGeeks is a <del>mathematical</del>           science portal</p>        </body></html>                   
Output:  
Supported Browsers: 
Google Chrome 
Internet Explorer
Firefox 1 and above
Opera 
Safari 
Edge 
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.
shubhamyadav4
ManasChhabra2
HTML-Tags
HTML
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to insert spaces/tabs in text using HTML/CSS?
How to set the default value for an HTML <select> element ?
How to update Node.js and NPM to next version ?
How to set input type date in dd-mm-yyyy format using HTML ?
Hide or show elements in HTML using display property
Types of CSS (Cascading Style Sheet)
How to Insert Form Data into Database using PHP ?
CSS to put icon inside an input element in a form
REST API (Introduction)
RxJS - Latest Updates

We are using RxJS version 6 in this tutorial. RxJS is commonly used to deal with reactive programming and used more often with Angular, ReactJS. Angular 6 loads rxjs6 by default.
RxJS version 5 was handled differently in comparison to version 6. The code will break in case you update your RxJS 5 to 6. In this chapter, we are going to see the difference in ways of handling the version update.
In case you are updating RxJS to 6 and don't want to make the code changes, you can do that too, and will have to install the following package.
npm install --save-dev rxjs-compact

This package will take care of providing backward compatibility and old code will work fine with RxJS version 6. If you want to make the code changes that works fine with RxJS 6, here are the changes that needs to be done.
The packages for operators, observables, subject were restructured and hence, the major changes go in for imports and they are explained below.
As per version 5, for operators the following import statements should be included −
import 'rxjs/add/operator/mapTo'
import 'rxjs/add/operator/take'
import 'rxjs/add/operator/tap'
import 'rxjs/add/operator/map'

In RxJS version 6 the imports will be as follows −
import {mapTo, take, tap, map} from "rxjs/operators"

As per version 5, while working with Observables, the following import methods should be included −
import "rxjs/add/observable/from";
import "rxjs/add/observable/of";
import "rxjs/add/observable/fromEvent";
import "rxjs/add/observable/interval";

In RxJS version 6 the imports will be as follows −
import {from, of, fromEvent, interval} from 'rxjs';

In RxJS version 5, while working with Observables, the following import statements should be included −
import { Observable } from 'rxjs/Observable'

In RxJS version 6, the imports will be as follows −
import { Observable } from 'rxjs'

In RxJS version 5, subject should be included as follows −
import { Subject} from 'rxjs/Subject'

In RxJS version 6, the imports will be as follows −
import { Subject } from 'rxjs'

pipe() method is available on the observable created. It is added to RxJS from version 5.5. Using pipe() now you can work on multiple operators together in sequential order. This is how the operators were used in RxJS version 5.
import "rxjs/add/observable/from";
import 'rxjs/add/operator/max'

let list1 = [1, 6, 15, 10, 58, 2, 40];
from(list1).max((a,b)=>a-b).subscribe(x => console.log("The Max value is "+x));
From RxJS version 5.5 onwards, we have to use pipe() to execute the operator −
import { from } from 'rxjs';
import { max } from 'rxjs/operators';

from(list1).pipe(max((a,b)=>a-b)).subscribe(x => console.log(
   "The Max value is "+x)
);
During restructuring of the packages some of the operators were renamed as they were conflicting or matching with javascript keywords. The list is as shown below −

    51 Lectures 
     4 hours 

 Daniel Stern
 Print
 Add Notes
 Bookmark this page
Roll a six-sided die 6000 times in Java

In order to roll a six sided die 6000 times in Java, we need to the nextInt() statement with decision making statements.
The nextInt() method returns the next random integer value from this random number generator sequence.
Declaration − The java.util.Random.nextInt() method is declared as follows −
public int nextInt()
Let us see a program to roll a six sided die 6000 times −
 Live Demo
import java.util.Random;
public class Example {
   public static void main(String args[]) {
      Random rd = new Random(); // random number generator
      int freq[] = new int[6]; // creating an array to compute frequency of each face
      int val;
      int chance = 1;
      // rolling the dice 6000 times
      while(chance <= 6000){
         val = 1 + rd.nextInt(6); // generates integers from 1 to 6
         switch (val) {
            case 1:
               ++freq[0];
               break;
            case 2:
               ++freq[1];
               break;
            case 3:
               ++freq[2];
               break;
            case 4:
               ++freq[3];
               break;
            case 5:
               ++freq[4];
               break;
            case 6:
               ++freq[5];
               break;
         }
         chance++;
      }
      for(int i = 1; i <= 6; i++){
         System.out.println("Side: " + i + "-> Frequency : " + freq[i - 1]);
      }
   }
}
Side: 1-> Frequency: 987
Side: 2-> Frequency : 971
Side: 3-> Frequency : 1057
Side: 4-> Frequency : 979
Side: 5-> Frequency : 982
Side: 6-> Frequency : 1024
Python | Check if two lists have at-least one element common

21 Nov, 2018
Given two lists a, b. Check if two lists have at least one element common in them.
Examples:
Input : a = [1, 2, 3, 4, 5]
        b = [5, 6, 7, 8, 9]
Output : True

Input : a=[1, 2, 3, 4, 5]
        b=[6, 7, 8, 9]
Output : False

Method 1 : Traversal of List
Using traversal in two lists, we can check if there exists one common element at least in them. While traversing two lists if we find one element to be common in them, then we return true. After complete traversal and checking, if no elements are same, then we return false.
# Python program to check # if two lists have at-least # one element common# using traversal of list  def common_data(list1, list2):    result = False      # traverse in the 1st list    for x in list1:          # traverse in the 2nd list        for y in list2:                # if one common            if x == y:                result = True                return result                       return result      # driver codea = [1, 2, 3, 4, 5]b = [5, 6, 7, 8, 9]print(common_data(a, b))  a = [1, 2, 3, 4, 5]b = [6, 7, 8, 9]print(common_data(a, b))
Output:
True 
False

Method 2 : Using Set and Property
Using set’s and property, if there exists at least one common element then set(a)&set(b) returns a positive integer, if it does not contains any positive integer, then it returns 0. So we insert a in set_a and b in set_b and then check if set_a & set_b for a positive integer or not.
# Python program to check # if two lists have at-least # one element common# using set and property  def common_member(a, b):    a_set = set(a)    b_set = set(b)    if (a_set & b_set):        return True     else:        return False            a = [1, 2, 3, 4, 5]b = [5, 6, 7, 8, 9]print(common_member(a, b))  a =[1, 2, 3, 4, 5]b =[6, 7, 8, 9]print(common_member(a, b))
Output:
True 
False

Method 3 : Using Set Intersection
Using set’s intersection inbuilt function. a_set.intersection(b_set) returns a positive integer if there is at least one element in common, else it returns 0. So we insert a in set_a and b in set_b and then check a_set.intersection(b_set), and returns depending on the value.
# Python program to check # if two lists have at-least # one element common# using set intersection  def common_member(a, b):    a_set = set(a)    b_set = set(b)    if len(a_set.intersection(b_set)) > 0:        return(True)     return(False)     a = [1, 2, 3, 4, 5]b = [5, 6, 7, 8, 9]print(common_member(a, b))  a =[1, 2, 3, 4, 5]b =[6, 7, 8, 9]print(common_member(a, b))
Output:
True 
False

Python list-programs
Python set-programs
python-list
python-set
Python
python-list
python-set
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary clear()

13 Jan, 2018
The clear() method removes all items from the dictionary.
Syntax:
dict.clear()

Parameters:
The clear() method doesn't take any parameters.

Returns:
The clear() method doesn't return any value.

Examples:
Input : d = {1: "geeks", 2: "for"}
        d.clear()
Output : d = {}

Error:
As we are not passing any parameters there
is no chance for any error.

# Python program to demonstrate working of# dictionary clear()text = {1: "geeks", 2: "for"}  text.clear()print('text =', text)
Output:
text = {}

How is it different from assigning {} to a dictionary?Please refer the below code to see the difference. When we assign {} to a dictionary, a new empty dictionary is created and assigned to the reference. But when we do clear on a dictionary reference, the actual dictionary content is removed, so all references referring to the dictionary become empty.
# Python code to demonstrate difference# clear and {}.  text1 = {1: "geeks", 2: "for"}text2 = text1  # Using clear makes both text1 and text2# empty.text1.clear()  print('After removing items using clear()')print('text1 =', text1)print('text2 =', text2)  text1 = {1: "one", 2: "two"}text2 = text1  # This makes only text1 empty.text1 = {}  print('After removing items by assigning {}')print('text1 =', text1)print('text2 =', text2)
Output:
After removing items using clear()
text1 = {}
text2 = {}
After removing items by assigning {}
text1 = {}
text2 = {1: 'one', 2: 'two'}

python-dict
Python
python-dict
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
random.seed( ) in Python

16 May, 2020
random() function is used to generate random numbers in Python. Not actually random, rather this is used to generate pseudo-random numbers. That implies that these randomly generated numbers can be determined.
random() function generates numbers for some values. This value is also called seed value.
How Seed Function Works ?Seed function is used to save the state of a random function, so that it can generate same random numbers on multiple executions of the code on the same machine or on different machines (for a specific seed value). The seed value is the previous value number generated by the generator. For the first time when there is no previous value, it uses current system time.
Using random.seed() function
Here we will see how we can generate the same random number every time with the same seed value.
Example 1:
# random module is importedimport random for i in range(5):      # Any number can be used in place of '0'.    random.seed(0)      # Generated random number will be between 1 to 1000.    print(random.randint(1, 1000))       
865
865
865
865
865

 Example 2:
# importing random moduleimport random  random.seed(3)  # print a random number between 1 and 1000.print(random.randint(1, 1000))  # if you want to get the same random number again then,random.seed(3) print(random.randint(1, 1000))  # If seed function is not used  # Gives totally unpredictable responses.print(random.randint(1, 1000))
244
244
607

On executing the above code, the above two print statements will generate a response 244 but the third print statement gives an unpredictable response.
Uses of random.seed()
This is used in the generation of a pseudo-random encryption key. Encryption keys are an important part of computer security. These are the kind of secret keys which used to protect data from unauthorized access over the internet.It makes optimization of codes easy where random numbers are used for testing. The output of the code sometime depends on input. So the use of random numbers for testing algorithms can be complex. Also seed function is used to generate same random numbers again and again and simplifies algorithm testing process.
This is used in the generation of a pseudo-random encryption key. Encryption keys are an important part of computer security. These are the kind of secret keys which used to protect data from unauthorized access over the internet.
It makes optimization of codes easy where random numbers are used for testing. The output of the code sometime depends on input. So the use of random numbers for testing algorithms can be complex. Also seed function is used to generate same random numbers again and again and simplifies algorithm testing process.
itsayushisaxena
Python-Functions
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Subtract String Lists in Python

04 Oct, 2021
Sometimes, while working with lists, we can have a problem in which we need to remove one list elements from other, i.e perform subtraction. This has application across many domains. Let’s discuss certain ways in which this task can be performed.
Method #1 : Using loop + remove() The combination of above functionalities can be used to perform this task. In this, we perform the removal of elements using remove() and check for similar elements using loop. 
Python3
# Python3 code to demonstrate working of# Subtract String Lists# using loop + remove() # initialize liststest_list1 = ["gfg", "is", "best", "for", "CS"]test_list2 = ["preferred", "is", "gfg"] # printing original listsprint("The original list 1 : " + str(test_list1))print("The original list 2 : " + str(test_list2)) # Subtract String Lists# using loop + remove()res = [ ele for ele in test_list1 ]for a in test_list2:  if a in test_list1:    res.remove(a) # printing resultprint("The Subtracted list is : " + str(res))
The original list 1 : ['gfg', 'is', 'best', 'for', 'CS']
The original list 2 : ['preferred', 'is', 'gfg']
The Subtracted list is : ['best', 'for', 'CS']
 Method #2 : Using Counter() + elements() The combination of the above functions provides a shorthand to solve this problem. In this, we extract the count of elements in both list and then perform separation by their extraction using element().
Python3
# Python3 code to demonstrate working of# Subtract String Lists# using Counter() + elements()from collections import Counter # initialize liststest_list1 = ["gfg", "is", "best", "for", "CS"]test_list2 = ["preferred", "is", "gfg"] # printing original listsprint("The original list 1 : " + str(test_list1))print("The original list 2 : " + str(test_list2)) # Subtract String Lists# using Counter() + elements()res = list((Counter(test_list1)-Counter(test_list2)).elements()) # printing resultprint("The Subtracted list is : " + str(res))
The original list 1 : ['gfg', 'is', 'best', 'for', 'CS']
The original list 2 : ['preferred', 'is', 'gfg']
The Subtracted list is : ['best', 'for', 'CS']
nidhi_biet
akshaysingh98088
Python list-programs
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install Statsmodels in Python?

16 Dec, 2021
Statsmodels is a popular library in Python that enables us to estimate and analyze various statistical models. It is built on numeric and scientific libraries like NumPy and SciPy. It is a python module that provides classes & functions for the estimation of many different statistical models.
In this article, we will look into the process of Installing Satsmodels in Python.
Follow the below steps to install statsmodels in Python on Linux using pip:
Step 1: Open the terminal & execute the following commands:
$ python -m venv StatsM
$ source ./StatsM/bin/activate
$ pip install statsmodels
Hence installation is successful.
Follow the below steps to install statsmodels in Python on Linux using conda:
Step 1: Open terminal & execute the below commands:
$ conda create --name SM ,then press y to continue
Step 2: Again execute the two commands given below:
$ conda activate SM
$ conda install statsmodels
Step 3: Press y to continue.
Open terminal & write following commands
$ python
import statsmodels as sm
sm.__version__
It will give the version as shown below:
Hence, your installation is successful.
how-to-install
Picked
How To
Installation Guide
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Set Git Username and Password in GitBash?
How to Permanently Disable Swap in Linux?
How to Import JSON Data into SQL Server?
How to Install Jupyter Notebook on MacOS?
How to Install and Use NVM on Windows?
Installation of Node.js on Linux
Installation of Node.js on Windows
How to Install and Use NVM on Windows?
How to Install Jupyter Notebook on MacOS?
How to Add External JAR File to an IntelliJ IDEA Project?
Matplotlib.figure.Figure() in Python

30 Apr, 2020
Matplotlib is a library in Python and it is numerical – mathematical extension for NumPy library. The figure module provides the top-level Artist, the Figure, which contains all the plot elements. This module is used to control the default spacing of the subplots and top level container for all plot elements.
This class is the top level container for all the plot elements.The Figure instance supports callbacks through a callbacks attribute which is a CallbackRegistry instance.Note: In the Figure, the Base is the matplotlib.artist.Artist.
Syntax: class matplotlib.figure.Figure(figsize=None, dpi=None, facecolor=None, edgecolor=None, linewidth=0.0, frameon=None, subplotpars=None, tight_layout=None, constrained_layout=None)
Parameters: This accept the following parameters that are described below:
figsize : This parameter is the Figure dimension (width, height) in inches.
dpi : This parameter is the dots per inch.
facecolor : This parameter is the figure patch facecolor.
edgecolor : This parameter is the figure patch edge color.
linewidth : This parameter is the linewidth of the frame.
frameon : This parameter is the suppress drawing the figure background patch.
subplotpars : This parameter is the Subplot parameters.
tight_layout : This parameter is used to adjust subplot parameters.
constrained_layout : This parameter is used to adjust positioning of plot elements.
Returns: This method return the figure instances.
Below examples illustrate the matplotlib.figure.Figure() function in matplotlib.figure:
Example 1:
# Implementation of matplotlib function import matplotlib.pyplot as plt from matplotlib.figure import Figureimport numpy as np       fig = plt.figure(figsize =(5, 4))     ax = fig.add_axes([0.1, 0.1, 0.8, 0.8])  xx = np.arange(0, 2 * np.pi, 0.01) ax.plot(xx, np.sin(xx))     fig.suptitle('matplotlib.figure.Figure() class Example\n\n',               fontweight ="bold")     plt.show() 
Output:
Example-2:
# Implementation of matplotlib function import matplotlib.pyplot as plt from matplotlib.figure import Figurefrom mpl_toolkits.axisartist.axislines import Subplot import numpy as np      fig = plt.figure(facecolor ="green")     ax = Subplot(fig, 111) fig.add_subplot(ax)     ax.axis["left"].set_visible(False) ax.axis["top"].set_visible(False)  fig.suptitle('matplotlib.figure.Figure() class Example\n\n',               fontweight ="bold")     plt.show() 
Output:
Python-matplotlib
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Linux Error Redirection

02 Dec, 2020
Redirection is a feature in Linux which can be used to change the standard input device (keyboard) or standard output device (screen) during the execution of a command. The basic process of any Linux command is that it takes an input and gives output but the standard/input and output can be changed using the redirection technique.
Error Redirection
There are mainly two types of output streams in Linux- standard output and standard error. The redirection operator (command > file) only redirects standard output and hence, the standard error is still displayed on the terminal. The default standard error is the screen. The standard error can also be redirected so that error messages do not clutter up the output of the program. ‘2’ denotes the stderr of a program.
2> stderr
‘2>’ redirects the error of an output to a file. The error messages are redirected and clean output is displayed. The Syntax of this operator is as follows:
command 2> file
Consider an example:
eccho "gfg" 2>file.txt
echo "gfg" 2>file.txt
There is no command as echo and hence error message will be displayed. But if 2>file.txt is used, then the error will be redirected to file.txt and no error is displayed on the screen. The cat command can be used to display the content of the file named file.txt which is the error message for the previous command. While executing the second command, gfg is displayed as the echo is a command in Linux to display. Hence, 2> does not redirect standard output.
When 2>& is used both standard error and standard output get redirected to the same file.
Syntax:
command > file 2>&
Consider an example:
eccho "gfg" >error.txt 2>&1
echo "gfg" >error.txt 2>&1
There is no command as echo and hence the error message is redirected to the file error.txt and no error is displayed. The second command echo “gfg” is correct but still, no output is displayed, as the standard output is also redirected to the file error.txt. The content of the file can be displayed after each step using the cat command.
Note: >& can be used to redirect both standard output and standard error, but it is not supported in all shells. sh and ksh do not support >& while bash and zsh support it.
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Difference between Actual and Formal Parameters in PL/SQL

23 Nov, 2020
A parameter is an optional list of parameters that you define both pass information into the procedure and send information out of procedure back to the calling program. Parameter is also known as argument. When you define a parameter, you also specify the way in which it can be used. There are three different modes of parameter or argument.
1. Actual Parameters :The arguments that are passed in a function call are called actual arguments. These arguments are defined in the calling function. These are the variables or expressions referenced in the parameter list of a subprogram call. There is no need to specify datatype in actual parameter.
Example :
// X and Y NUMBER ARE ACTUAL PARAMETERS
SQL> CREATE OR REPLACE FUNCTION FUNC1(X NUMBER, 
                                         Y NUMBER) 
2    RETURN NUMBER IS
3    R NUMBER;
4    BEGIN
5    R:=X+Y;
6    RETURN(R);
7    END;
8    /
FUNCTION CREATED.

SQL>|

2. Formal Parameters :These are the variables or expressions referenced in the parameter list of a subprogram specification. The datatype of the receiving value must be defined. The scope of formal arguments is local to the function definition in which they are used.
Example :
SQL> DECLARE
2    N1 NUMBER:=10;
3    N2 NUMBER:=20;
4    S NUMBER;
5    BEGIN
6    S:=FUNC1(N1, N2);
7    DBMS_OUTOUT.PUT_LINE('RESULT IS: '||S);
8    END;
9    /

OUTPUT: RESULT IS: 30
PL/SQL PROCEDURE SUCCESSFULLY COMPLETED.
SQL>|

Difference between Actual and Formal Parameters :
DBMS-SQL
Difference Between
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
Difference Between Method Overloading and Method Overriding in Java
Similarities and Difference between Java and C++
Difference between Internal and External fragmentation
Difference between Compile-time and Run-time Polymorphism in Java
Difference between DELETE and TRUNCATE
Differences and Applications of List, Tuple, Set and Dictionary in Python
Difference between Abstraction and Encapsulation in Java with Examples
Difference between FDMA, TDMA and CDMA
Differences Between .NET Core and .NET Framework
SQL Query to Display the Length and First 3 Characters of Ename Column in Emp Table

10 Oct, 2021
To display the length and first three characters of a string, string functions come in handy to do these in SQL. In this article let us see how to display the length and first 3 characters of the Ename column in the Emp table using MSSQL as the server.
To find the length of a string we use the LEN( ) function.
Syntax:
LEN(Ename)
To find the first n characters of string we use the LEFT() function:
Syntax:
LEFT(Ename , N)
Step 1: Creating a Database
We use the below command to create a database named GeeksforGeeks.
Query:
CREATE DATABASE GeeksforGeeks
Step 2: Using the Database
To use the GeeksforGeeks database use the below command:
Query:
USE GeeksforGeeks;
Step 3: Creating a table
Creating a table Emp with 5 columns using the following SQL query as follows.
CREATE TABLE Emp
(
E_id varchar(20),
Ename varchar(20),
Edept varchar(20),
E_age INT,
E_sex varchar(8)
);
Output:
Step 4: Verifying the database
To view the description of the database using the following SQL query as follows.
Query:
EXEC sp_columns Emp
Output:
Step 5: Inserting data into the table 
Inserting rows into the Emp table using the following SQL query as follows.
Query:
 INSERT INTO Emp VALUES('E00001','JHONNY','BACKEND DEVELOPER',26,'male'),
 ('E00002','DARSHI','MARKETING',27,'male'),
('E00003','JASMINE','FRONTEND DEVELOPER',37,'female'),
('E00004','LILLY','FULL STACK DEVELOPER',47,'female'),
('E00005','RONALD','UI DEVELOPER',26,'male')
Output:
Step 6: Verifying inserted data 
Check the inserted data in the table using the select query as follows.
Query:
SELECT* FROM Emp
Output:
Query to Display the Length and First 3 Characters of Ename Column.
Query:
SELECT LEN(Ename) AS LengthofEname,
LEFT(Ename,3) AS FirstThree FROM Emp
Output:
Query to Display the Length and Last 3 Characters of Ename Column.
Query:
SELECT LEN(Ename) AS LengthofEname,
RIGHT(Ename,3) AS LastThree FROM Emp
Output:
Picked
SQL-Query
SQL-Server
SQL
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Getting the name of the Enumeration Constant having Specified value in C# - GeeksforGeeks

23 Jul, 2019
Enum.GetName(Type, Object) Method is used to get the name of the constant in the specified enumeration that has the specified value.
Syntax:
public static string GetName (Type enumType, object value);
Parameters:
enumType: It is an enumeration type.
value: It is the value of a particular enumerated constant in terms of its underlying type.
Returns: It is a string containing the name of the enumerated constant in enumType whose value is the value or null if no such constant is found.
Exceptions:
ArgumentNullException: If the enumType or value is null.
ArgumentException: If the enumType is not an Enum or value is neither of type enumType nor does it have the same underlying type as enumType.
Example:
// C# program to illustrate the// Enum.GetName(Type, Object) Methodusing System;  enum Animals { Dog,               Cat,               Cow,               Monkey };  class GFG {      // Main Method    public static void Main(String[] args)    {          // using the method        Console.WriteLine("2nd value is {0}", Enum.GetName(typeof(Animals), 1));        Console.WriteLine("4th value is {0}", Enum.GetName(typeof(Animals), 3));    }}
2nd value is Cat
4th value is Monkey

Reference:
https://docs.microsoft.com/en-us/dotnet/api/system.enum.getname?view=netframework-4.8
CSharp-Enum-Class
CSharp-method
C#
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Extension Method in C#
Top 50 C# Interview Questions & Answers
Partial Classes in C#
HashSet in C# with Examples
C# | Inheritance
C# | How to insert an element in an Array?
C# | List Class
Lambda Expressions in C#
C# | Generics - Introduction
What is Regular Expression in C#?
Python Program to Read a Number n And Print the Series "1+2+.....+n= "

When it is required to display the sum all the natural numbers within a given range, a method can be defined that uses a loop to iterate over the elements, and returns the sum of these numbers as output.
Below is a demonstration of the same −
 Live Demo
def sum_natural_nums(val):
   my_sum = 0
   for i in range(1, val + 1):
      my_sum += i * (i + 1) / 2
   return my_sum

val = 9
print("The value is ")
print(val)
print("The sum of natural numbers upto 9 is : ")
print(sum_natural_nums(val))
The value is
9
The sum of natural numbers upto 9 is :
165.0
A method named ‘sum_natural_nums’ is defined that takes a number as parameter.
A method named ‘sum_natural_nums’ is defined that takes a number as parameter.
A sum value is defined as 0.
A sum value is defined as 0.
A loop is iterated over the number passed as a parameter.
A loop is iterated over the number passed as a parameter.
The sum is incremented every time a number is encountered.
The sum is incremented every time a number is encountered.
This is returned as output.
This is returned as output.
The value for number of natural numbers whose sum needs to be found is defined.
The value for number of natural numbers whose sum needs to be found is defined.
The method is called by passing this number as a parameter.
The method is called by passing this number as a parameter.
The relevant output is displayed on the console.
The relevant output is displayed on the console.
How does $('iframe').ready() method work in jQuery?

Here’s an example wherein the iframe size is larger than the page. We will scroll to the top of the page whenever the iframe loads using jQuery −
Live Demo
<!DOCTYPE html>
<html>
  <head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
    <script>
    $(document).ready(function(){
      $("button").click(function(){
        $('iframe').ready(function(){
          $(window).scrollTop(0);
        });
      });
   });
   </script>
  </head>
<body>
  <iframe frameborder="2" height="900" id="iframe" align="top" src="https://www.qries.com" width="900" ></iframe><br>
  <button>Loop through each image</button>
</body>
</html>
Real-Time Object detection API using Tensorflow and OpenCV | by Daniel Ajisafe | Towards Data Science

The amount of visual data in the world today has grown exponentially in the last couple of years and this is largely due to lots of sensors everywhere. Building machine learning models that are capable of localizing and identifying obejcts in a single image remains a core challenge in computer vision. Working to solve this problem has ignited my interest into the field.
As a path to my quest, I discovered Google just released an object detection API. The API has been trained on Microsoft COCO dataset { A dataset of about 300,000 images of 90 commonly found objects} with different trainable detection models .
The higher the mAp (minimum average precision), the better the model
I started by cloning the Tensorflow object detection repository on github. The API is an open source framework built on tensorflow making it easy to construct, train and deploy object detection models.
For this project [am on windows 10, Anaconda 3, Python 3.6], I was concerned with only the installation part and following the example which included
Installing required libraries e.g pillow, lxml etc that comes with installing the latest version of tensorflow using pip(latest version)
Downloading the latest version of protobuf compatible with my system for compilation on google protobuf releases
Cloning the tensorflow/models folder as a zip file
On my Anaconda prompt, ran this command for protobuf compilation without which the example wont work.
# From tensorflow/models/research/protoc object_detection/protos/*.proto --python_out=.
I preferred using Spyder as my editor so i made a copy of the notebook in the example and converted it to a python file
Using the pre-trained ssd_mobilenet_v1_coco model (which was fast, though had the least accuracy), I decided to test it out on my own images and the results were amazing !
Trick: test images were taken with my mobile phone and a digital camera. Resizing their dimensions helped the model’s detection.
Now i wanted real-time detection, so i connected OpenCV with my webcam. OpenCV is an open source computer vision library for image processing, machine learning and real-time detection.
And this was the result :
Please dont mind the quality of my webcam 😊, its an old one. I wish i could just pip install upgrade
Using the pre-trained model was really cool but I would love to train the API on my own dataset for super applications. That might not be easy but as it stands, I AM BATTLE READY !!!
You can get the full code on my repository so you can run the files directly and test it out. If you find my post interesting 😍, hit the clap button as much as you can.
Follow me on Twitter: @danielajisafe, @lautechdatasci
How to find Gradient of a Function using Python? - GeeksforGeeks

28 Jul, 2020
The gradient of a function simply means the rate of change of a function. We will use numdifftools to find Gradient of a function.
Examples:
Input : x^4+x+1
Output :Gradient of x^4+x+1 at x=1 is  4.99

Input :(1-x)^2+(y-x^2)^2
Output :Gradient of (1-x^2)+(y-x^2)^2 at (1, 2) is  [-4.  2.] 

Approach:
For Single variable function: For single variable function we can define directly using “lambda” as stated below:-g=lambda x:(x**4)+x+1
g=lambda x:(x**4)+x+1
For Multi-Variable Function: We will define a function using “def” and pass an array “x” and it will return multivariate function as described below:-def rosen(x): 
    return (1-x[0])**2 +(x[1]-x[0]**2)**2where ‘rosen’ is name of function and ‘x’ is passed as array. x[0] and x[1] are array elements in the same order as defined in array.i.e Function defined above is (1-x^2)+(y-x^2)^2.
def rosen(x): 
    return (1-x[0])**2 +(x[1]-x[0]**2)**2
where ‘rosen’ is name of function and ‘x’ is passed as array. x[0] and x[1] are array elements in the same order as defined in array.i.e Function defined above is (1-x^2)+(y-x^2)^2.
Similarly, We can define function of more than 2-variables also in same manner as stated above.
Method used: Gradient()Syntax:
nd.Gradient(func_name)
Example:
import numdifftools as nd    g = lambda x:(x**4)+x + 1grad1 = nd.Gradient(g)([1])print("Gradient of x ^ 4 + x+1 at x = 1 is ", grad1)  def rosen(x):     return (1-x[0])**2 +(x[1]-x[0]**2)**2  grad2 = nd.Gradient(rosen)([1, 2])print("Gradient of (1-x ^ 2)+(y-x ^ 2)^2 at (1, 2) is ", grad2)
Output:
Gradient of x^4+x+1 at x=1 is  4.999999999999998
Gradient of (1-x^2)+(y-x^2)^2 at (1, 2) is  [-4.  2.]
python-utility
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
How to play videos in Android from assets folder or raw folder?

This example demonstrates how do I play videos in Android from the assets folder or raw folder in android.
Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.
Step 2 − Add the following code to res/layout/activity_main.xml.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:tools="http://schemas.android.com/tools"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   android:gravity="center"
   android:orientation="vertical"
   android:padding="8dp"
   tools:context=".MainActivity">
<VideoView
   android:id="@+id/videoView"
   android:layout_width="match_parent"
   android:layout_height="match_parent">
</VideoView>
</LinearLayout>
Step 3 − Create a new android resource folder(raw) and copy-paste your video file in that folder.
Step 4 − Add the following code to src/MainActivity.java
import androidx.appcompat.app.AppCompatActivity;
import android.net.Uri;
import android.os.Bundle;
import android.widget.MediaController;
import android.widget.VideoView;
public class MainActivity extends AppCompatActivity {
   @Override
   protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      VideoView videoView = findViewById(R.id.videoView);
      MediaController mediaController = new MediaController(this);
      mediaController.setAnchorView(videoView);
      videoView.setMediaController(mediaController);
      videoView.setVideoURI(Uri.parse("android.resource://" + getPackageName() + "/" +
      R.raw.videoplayback));
      videoView.start();
   }
}
Step 5 − Add the following code to androidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
   package="app.com.sample">
   <application
      android:allowBackup="true"
      android:icon="@mipmap/ic_launcher"
      android:label="@string/app_name"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:supportsRtl="true"
      android:theme="@style/AppTheme">
      <activity android:name=".MainActivity">
         <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
         </intent-filter>
      </activity>
   </application>
</manifest>
Let's try to run your application. I assume you have connected your actual Android Mobile device with your computer. To run the app from the android studio, open one of your project's activity files and click the Run  icon from the toolbar. Select your mobile device as an option and then check your mobile device which will display your default screen −
Integer Promotions in C - GeeksforGeeks

28 May, 2017
Some data types like char , short int take less number of bytes than int, these data types are automatically promoted to int or unsigned int when an operation is performed on them. This is called integer promotion. For example no arithmetic calculation happens on smaller types like char, short and enum. They are first converted to int or unsigned int, and then arithmetic is done on them. If an int can represent all values of the original type, the value is converted to an int . Otherwise, it is converted to an unsigned int.
For example see the following program.
#include <stdio.h> int main(){    char a = 30, b = 40, c = 10;    char d = (a * b) / c;    printf ("%d ", d);     return 0;}
Output:
120
At first look, the expression (a*b)/c seems to cause arithmetic overflow because signed characters can have values only from -128 to 127 (in most of the C compilers), and the value of subexpression ‘(a*b)’ is 1200 which is greater than 128. But integer promotion happens here in arithmetic done on char types and we get the appropriate result without any overflow.
Consider the following program as another example.
#include <stdio.h>  int main(){    char a = 0xfb;    unsigned char b = 0xfb;      printf("a = %c", a);    printf("\nb = %c", b);      if (a == b)      printf("\nSame");    else      printf("\nNot Same");    return 0;}
Output:
a = ?
b = ?
Not Same 
When we print ‘a’ and ‘b’, same character is printed, but when we compare them, we get the output as “Not Same”.‘a’ and ‘b’ have same binary representation as char. But when comparison operation is performed on ‘a’ and ‘b’, they are first converted to int. ‘a’ is a signed char, when it is converted to int, its value becomes -5 (signed value of 0xfb). ‘b’ is unsigned char, when it is converted to int, its value becomes 251. The values -5 and 251 have different representations as int, so we get the output as “Not Same”.
We will soon be discussing integer conversion rules between signed and unsigned, int and long int, etc.
References:http://www.tru64unix.compaq.com/docs/base_doc/DOCUMENTATION/V40F_HTML/AQTLTBTE/DOCU_067.HTM
This article is contributed by Abhay Rathi. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above
C-Data Types
cpp-data-types
C Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
rand() and srand() in C/C++
Left Shift and Right Shift Operators in C/C++
fork() in C
Core Dump (Segmentation fault) in C/C++
Command line arguments in C/C++
Substring in C++
Function Pointer in C
Different methods to reverse a string in C/C++
TCP Server-Client implementation in C
Structures in C