code-rag-bench/online-tutorials huggingface dataset:
Compute the mean, standard deviation, and variance of a given NumPy array

29 Aug, 2020
 In NumPy, we can compute the mean, standard deviation, and variance of a given array along the second axis by two approaches first is by using inbuilt functions and second is by the formulas of the mean, standard deviation, and variance.
Method 1: Using numpy.mean(), numpy.std(), numpy.var()
Python
import numpy as np    # Original arrayarray = np.arange(10)print(array)  r1 = np.mean(array)print("\nMean: ", r1)  r2 = np.std(array)print("\nstd: ", r2)  r3 = np.var(array)print("\nvariance: ", r3)
Output:
[0 1 2 3 4 5 6 7 8 9]

Mean:  4.5

std:  2.8722813232690143

variance:  8.25

Method 2: Using the formulas 
Python3
import numpy as np  # Original arrayarray = np.arange(10)print(array)  r1 = np.average(array)print("\nMean: ", r1)  r2 = np.sqrt(np.mean((array - np.mean(array)) ** 2))print("\nstd: ", r2)  r3 = np.mean((array - np.mean(array)) ** 2)print("\nvariance: ", r3)
Output:
[0 1 2 3 4 5 6 7 8 9]

Mean:  4.5

std:  2.8722813232690143

variance:  8.25

Example: Comparing both inbuilt methods and formulas
Python
import numpy as np  # Original arrayx = np.arange(5)print(x)  r11 = np.mean(x)r12 = np.average(x)print("\nMean: ", r11, r12)  r21 = np.std(x)r22 = np.sqrt(np.mean((x - np.mean(x)) ** 2))print("\nstd: ", r21, r22)  r31 = np.var(x)r32 = np.mean((x - np.mean(x)) ** 2)print("\nvariance: ", r31, r32)
Output:
[0 1 2 3 4]

Mean:  2.0 2.0

std:  1.4142135623730951 1.4142135623730951

variance:  2.0 2.0

Python numpy-Statistics Functions
Python-numpy
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Python Classes and Objects
Python | os.path.join() method
Introduction To PYTHON
Python OOPs Concepts
How to drop one or multiple columns in Pandas Dataframe
How To Convert Python Dictionary To JSON?
Check if element exists in list in Python
Python | Get unique values from a list
Python | datetime.timedelta() function
Dassault Systemes Interview Experience for Software Developer

31 Mar, 2021
Round 1 (Online Assessment – 60 minutes): This test made up to 23 questions. The estimated test time is 30 minutes. However, you have up to 60 minutes to finish the test (after which the test will end automatically). The below are some questions, which were asked while I was giving the test. 
  Expectations:
 Basic Knowledge of C#
Exception Handling
Inheritance
Local Function
HashCode
2 system(binary)
TCP/IP
SQL Commands
What SQL command should be used to remove a row from the table in the database?Which SQL command would you use to add a row in a table of a database?A C# class can have more than one parent classWhich property returns the number of characters in a stringTo Communicate with a host via TCP/IP, we can use the class(es).Public interface A: B, C, D{} – This interface is correct if B, C, and D are also interfacesWhat is the best interface to implement on a class that does input and/or output so that it can be disposed of using one of the users or async using   constructs in the c#In a base 2 system(binary), what is the value of 0001 & 0001?class A{
string str;
}
class B : A
{
}str is visible from B?Type the operator used in lambda expression (2 characters)Give the one example of a local function in C#The general contract of GetHashCode says that two objects having the same hashcode must be equals.
What SQL command should be used to remove a row from the table in the database?
Which SQL command would you use to add a row in a table of a database?
A C# class can have more than one parent class
Which property returns the number of characters in a string
To Communicate with a host via TCP/IP, we can use the class(es).
Public interface A: B, C, D{} – This interface is correct if B, C, and D are also interfaces
What is the best interface to implement on a class that does input and/or output so that it can be disposed of using one of the users or async using   constructs in the c#
In a base 2 system(binary), what is the value of 0001 & 0001?class A{
string str;
}
class B : A
{
}str is visible from B?
class A{
string str;
}
class B : A
{
}
str is visible from B?
Type the operator used in lambda expression (2 characters)
Give the one example of a local function in C#
The general contract of GetHashCode says that two objects having the same hashcode must be equals.
Dassault Systemes
Marketing
Interview Experiences
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Clojure - Sets

Sets in Clojure are a set of unique values. Sets are created in Clojure with the help of the set command.
Following is an example of the creation of sets in Clojure.
(ns clojure.examples.example
   (:gen-class))
(defn example []
   (println (set '(1 1 2 2))))
(example)
The above code produces the following output.
#{1,2}

Following are the methods available in Clojure for sets.
Returns a sorted set of elements.
Returns the element at the index position.
Finds out whether the set contains a certain element or not.
Appends an element to the set and returns the new set of elements.
Disjoins an element from the set.
Return a set that is the union of the input sets
Return a set that is the first set without elements of the remaining sets.
Return a set that is the intersection of the input sets.
Is set1 a subset of set2?
Is set1 a superset of set2?
 Print
 Add Notes
 Bookmark this page
How do you find the number of dimensions of an array in C#?

To find the number of dimensions of an array, use the Rank property.
arr.Rank
Here, arr is our array −
int[,] arr = new int[3,4];
If you also want to get the rows and columns it has, then use the GetLength property −
arr.GetLength(0);
arr.GetLength(1);
The following is the complete code −
 Live Demo
using System;

class Program {
   static void Main() {
      int[,] arr = new int[3,4];

      Console.WriteLine(arr.GetLength(0));
      Console.WriteLine(arr.GetLength(1));

      // Length
      Console.WriteLine(arr.Length);
      Console.WriteLine("Upper Bound: {0}",arr.GetUpperBound(0).ToString());
      Console.WriteLine("Lower Bound: {0}",arr.GetLowerBound(0).ToString());
      Console.WriteLine("Dimensions of Array : " + arr.Rank);
   }
}
3
4
12
Upper Bound: 2
Lower Bound: 0
Dimensions of Array : 2
Cryptography with Python - Caesar Cipher

In the last chapter, we have dealt with reverse cipher. This chapter talks about Caesar cipher in detail.
The algorithm of Caesar cipher holds the following features −
Caesar Cipher Technique is the simple and easy method of encryption technique.
Caesar Cipher Technique is the simple and easy method of encryption technique.
It is simple type of substitution cipher.
It is simple type of substitution cipher.
Each letter of plain text is replaced by a letter with some fixed number of positions down with alphabet.
Each letter of plain text is replaced by a letter with some fixed number of positions down with alphabet.
The following diagram depicts the working of Caesar cipher algorithm implementation −
The program implementation of Caesar cipher algorithm is as follows −
def encrypt(text,s):
result = ""
   # transverse the plain text
   for i in range(len(text)):
      char = text[i]
      # Encrypt uppercase characters in plain text
      
      if (char.isupper()):
         result += chr((ord(char) + s-65) % 26 + 65)
      # Encrypt lowercase characters in plain text
      else:
         result += chr((ord(char) + s - 97) % 26 + 97)
      return result
#check the above function
text = "CEASER CIPHER DEMO"
s = 4

print "Plain Text : " + text
print "Shift pattern : " + str(s)
print "Cipher: " + encrypt(text,s)
You can see the Caesar cipher, that is the output as shown in the following image −
The plain text character is traversed one at a time.
For each character in the given plain text, transform the given character as per the rule depending on the procedure of encryption and decryption of text.
For each character in the given plain text, transform the given character as per the rule depending on the procedure of encryption and decryption of text.
After the steps is followed, a new string is generated which is referred as cipher text.
After the steps is followed, a new string is generated which is referred as cipher text.
The cipher text can be hacked with various possibilities. One of such possibility is Brute Force Technique, which involves trying every possible decryption key. This technique does not demand much effort and is relatively simple for a hacker.
The program implementation for hacking Caesar cipher algorithm is as follows −
message = 'GIEWIVrGMTLIVrHIQS' #encrypted message
LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

for key in range(len(LETTERS)):
   translated = ''
   for symbol in message:
      if symbol in LETTERS:
         num = LETTERS.find(symbol)
         num = num - key
         if num < 0:
            num = num + len(LETTERS)
         translated = translated + LETTERS[num]
      else:
         translated = translated + symbol
print('Hacking key #%s: %s' % (key, translated))
Consider the cipher text encrypted in the previous example. Then, the output with possible hacking methods with the key and using brute force attack technique is as follows −

    10 Lectures 
     2 hours 

 Total Seminars

    10 Lectures 
     2 hours 

 Stone River ELearning
 Print
 Add Notes
 Bookmark this page
HTML align Attribute - GeeksforGeeks

25 Feb, 2022
The align Attribute in HTML is used to is used to specify the alignment of text content of The Element. this attribute is is used in all elements.
Supported Tags: 
<applet>
<caption>
<col>
<colgroup>
<hr>
<iframe>
<img>
<legend>
<table>
<tbody>
<td>
<tfoot>
<th>
<thead>
<tr>
Syntax:
<element_name align="left | right | center | justify">
Attribute Values:
left: It sets the text left-align.
right: It sets the text right-align.
center: It sets the text center-align.
justify: It stretch the text of paragraph to set the width of all lines equal.
Example 1:
html
<!DOCTYPE html><html> <head>    <title>        HTML p align Attribute    </title></head> <body>    <h1>GeeksforGeeks</h1>     <h2>HTML p align Attribute</h2>     <p align="left">    Left align content</p>       <p align="center">    center align content</p>       <p align="right">    Right align content</p>   </body> </html>
Output:
Example 2:  
html
<!DOCTYPE html><html> <head>    <title>gfg</title>    <style type=text/css>        p {            background-color: gray;            margin: 10px;        }                 div {            color: white;            background-color: 009900;            margin: 2px;            font-size: 25px;        }                 body {            text-align: center;        }    </style> </head> <body>    <h1>GeeksForGeeks</h1>    <h2><div>align Attribute</h2>    <div align="center">    div align="center"</div>    <div align="left">    div align="left"</div>    <div align="right">    div align="right"</div>    <div align="justify">    div align="justify"</div> </body> </html>
Output:  
Supported Browsers:  
Google Chrome
Internet Explorer
Firefox
Apple Safari
Opera
 
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.
hritikbhatnagar2182
HTML-Attributes
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
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 Insert Form Data into Database using PHP ?
Roadmap to Become a Web Developer in 2022
Installation of Node.js on Linux
How to fetch data from an API in ReactJS ?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to insert spaces/tabs in text using HTML/CSS?
How can I profile C++ code running in Linux?

There are many great profiling tools for profiling C++ programs on Linux. The most widely used tool is Valgrind. It is a programming tool for memory debugging, memory leak detection, and profiling. You can use valgrind by passing the binary to it and setting the tool to callgrind. First generate the binary by compiling the program −
$ g++ -o hello.cpp hello
Now use valgrind to profile it:
$ valgrind --tool=callgrind ./hello
This will generate a file called callgrind.out.x. You can read this file using a tool called kcachegrind.
If you're using gcc, you can use the inbuilt profiling tool, gprof. You can use it while compiling the file as follows −
$ g++ -o hello hello.cpp -g -pg
Set border width with CSS

The border-width property allows you to set the width of element borders. The value of this property could be either a length in px, pt or cm or it should be set to thin, medium or thick.
You can try to run the following code to set the border width with CSS:
<html>
   <head>
   </head>
   <body>
      <p style = "border-width:4px; border-style:solid;">
         David Beckham is a legend.
      </p>
      <p style = "border-width:4pt; border-style:dashed;">
         Sachin Tendulkar is a legend.
      </p>
   </body>
</html>
Calculate Factorial in Python

Suppose we have a number n less than or equal to 10, we have to find its factorial. We know
that the factorial of a number n is n! = n * (n - 1) * (n - 2) * ... * 1.
So, if the input is like 6, then the output will be 720
To solve this, we will follow these steps −
Define a function solve(). This will take nif n <= 1, thenreturn 1
if n <= 1, thenreturn 1
return 1
return n * solve(n - 1)
Let us see the following implementation to get better understanding −
 Live Demo
class Solution:
   def solve(self, n):
      if(n <= 1): return 1
         return n * self.solve(n - 1)
ob = Solution()
print(ob.solve(6))
6
720
GitLab - Git Commands

Git commands are used for sharing and combining the code easily with other developers. 
Following are the some basic Git commands can be used to work with Git −
The version of the Git can be checked by using the below command −
$ git --version

Add Git username and email address to identify the author while committing the information. Set the username by using the command as −
$ git config --global user.name "USERNAME"

After entering user name, verify the entered user name with the below command −
$ git config --global user.name

Next, set the email address with the below command −
$ git config --global user.email "email_address@example.com"

You can verify the entered email address as −
$ git config --global user.email

Use the below command to check the entered information −
$ git config --global --list

You can pull the latest changes made to the master branch by using the below command −
$ git checkout master

You can fetch the latest changes to the working directory with the below command −
$ git pull origin NAME-OF-BRANCH -u

Here, NAME-OF-BRANCH could be 'master' or any other existing branch.
Create a new branch with the below command −
$ git checkout -b branch-name

You can switch from one branch to other branch by using the command as −
$ git checkout branch-name

Check the changes made to your files with the below command −
$ git status

You will see the changes in red color and add the files to staging as −
$ git add file-name

Or you can add all the files to staging as −
$ git add *

Now send your changes to master branch with the below command −
$ git push origin branch-name

Delete the all changes, except unstaged things by using the below command −
$ git checkout .

You can delete the all changes along with untracked files by using the command as −
$ git clean -f

To merge the different branch with the master branch, use the below command −
$git checkout branch-name
$ git merge master 

You can also merge the master branch with the created branch, by using the below command −
$git checkout master
$ git merge branch-name 

 Print
 Add Notes
 Bookmark this page
How to write asynchronous function for Node.js ? - GeeksforGeeks

22 Jan, 2021
The asynchronous function can be written in Node.js using ‘async’ preceding the function name. The asynchronous function returns implicit Promise as a result. The async function helps to write promise-based code asynchronously via the event-loop. Async functions will always return a value. Await function can be used inside the asynchronous function to wait for the promise. This forces the code to wait until the promise returns a result.
Install async from npm in Node.js using the following command:
npm i async
Use async inside your Node.js project using require() method.
Example 1: Create asynchronous function to calculate square of a number inside Node.js.
Create a project folder.
Use the following command to initialize the package.json file inside the project folder.npm init -y
npm init -y
Install async using the following command:npm i async
npm i async
Create a server.js file & write the following code inside it.
Run the code using npm start
var async = require("async");  function square(x) {    return new Promise((resolve) => {        setTimeout(() => {            resolve(Math.pow(x, 2));        }, 2000);    });}  async function output(x) {    const ans = square(x);    console.log(ans);}  output(10);var async = require("async");  function square(x) {    return new Promise((resolve) => {        setTimeout(() => {            resolve(Math.pow(x, 2));        }, 2000);    });}  async function output(x) {    const ans = await square(x);    console.log(ans);}  output(10);
Output:
Example 2: Create an asynchronous function to calculate the sum of two numbers inside Node.js using await. Perform the above procedure to create a Node.js project.
var async = require("async");  function square(a, b) {    return new Promise(resolve => {        setTimeout(() => {            resolve(a + b);        }, 2000);    });}  async function output(a, b) {    const ans = await square(a, b);    console.log(ans);}  output(10, 20);
Output:
mridulmanochagfg
NodeJS-Questions
Picked
Node.js
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Node.js fs.writeFile() Method
How to install the previous version of node.js and npm ?
Difference between promise and async await in Node.js
How to use an ES6 import in Node.js?
Express.js res.render() Function
Remove elements from a JavaScript Array
Convert a string to an integer in JavaScript
How to fetch data from an API in ReactJS ?
Difference between var, let and const keywords in JavaScript
How to insert spaces/tabs in text using HTML/CSS?
bitset reset() function in C++ STL - GeeksforGeeks

18 Jun, 2018
bitset::reset() is a built-in function in C++ STL which resets the bits at the given index in the parameter. If no parameter is passed then all the bits are reset to zero.
Syntax:
reset(int index) 

Parameter: The function accepts a parameter index which signifies the position at which the bit has to be reset to zero. If no parameter is passed, all the bits in the bitset are reset to zero.
Return Value: The function does not return anything.
Below programs illustrates the bitset::reset() function.
Program 1:
// CPP program to illustrate the// bitset::reset() function#include <bits/stdc++.h>using namespace std;  int main(){    // Initialization of bitset    bitset<4> b1(string("1100"));    bitset<6> b2(string("111111"));      // Function that resets all bits    cout << "Before applying reset() function: "         << b1 << endl;      b1.reset();    cout << "After applying reset() function: "         << b1 << endl;      // Function that resets all bits    cout << "Before applying reset() function: "         << b2 << endl;      b2.reset();    cout << "After applying reset() function: "         << b2 << endl;      return 0;}
Before applying reset() function: 1100
After applying reset() function: 0000
Before applying reset() function: 111111
After applying reset() function: 000000

Program 2:
// CPP program to illustrate the// bitset::reset() function#include <bits/stdc++.h>using namespace std;  int main(){    // Initialization of bitset    bitset<4> b1(string("1101"));    bitset<6> b2(string("111111"));      // Function that resets all bits    cout << "Before applying reset() function: "         << b1 << endl;    b1.reset(2);    cout << "After applying reset(2) function: "         << b1 << endl;      // Function that resets all bits    cout << "Before applying reset() function: "         << b2 << endl;      b2.reset(3);    b2.reset(5);    cout << "After applying reset(3) and reset(5) function: "         << b2 << endl;      return 0;}
Before applying reset() function: 1101
After applying reset(2) function: 1001
Before applying reset() function: 111111
After applying reset(3) and reset(5) function: 010111

CPP-bitset
CPP-Functions
STL
C++
STL
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Operator Overloading in C++
Polymorphism in C++
Sorting a vector in C++
Friend class and function in C++
std::string class in C++
Pair in C++ Standard Template Library (STL)
Queue in C++ Standard Template Library (STL)
Inline Functions in C++
Array of Strings in C++ (5 Different Ways to Create)
Convert string to char array in C++
GRE Arithmetic | Fraction - GeeksforGeeks

17 Aug, 2021
Fraction is the number in the form of numerator/denominator, where numerator and denominator are the integers and denominator ≠ 0. Numerator and denominator are a subset of integers. If the denominator is equal to 0 then the fraction is not defined or denominators are integers except 0. A fraction can be rational or irrational. Rational fractions are either terminating or repeating but irrational fraction neither terminate nor repeat. 
When a number contains an integer part and a fraction part then it is called a mixed number. 
For example: 
1. 5 / 2
2. 3 / 5
3. 22 /7 
4. 0 / 4
5. 1 / 0 
6. -1 / 4
7. 1 / -4
8. -2 / -7
9. 43⁄13
10. -1112⁄13
All are fraction except 1 / 0 it is not defined. 
Different arithmetic operation are possible on fraction: 
Addition 
Subtraction 
Multiplication 
Division
Basic rules for arithmetic operation:  
If denominator of two or more than two fraction are same, simply add their numerator. If denominator of two or more than two fractions are not equal then make it equal by multiplying by different numbers so that it becomes equal but keep in mind that to balance the fraction multiply the numerator by same number too. For multiplication just multiply numerator by numerator and denominator by denominator. For division of two fraction multiply the dividend into reciprocal of divisor. 
If denominator of two or more than two fraction are same, simply add their numerator. 
If denominator of two or more than two fractions are not equal then make it equal by multiplying by different numbers so that it becomes equal but keep in mind that to balance the fraction multiply the numerator by same number too. 
For multiplication just multiply numerator by numerator and denominator by denominator. 
For division of two fraction multiply the dividend into reciprocal of divisor. 
Example:  
1. (1 / 2) + (1 / 2) 
=(1 + 1) / 2 = 2 / 2 = 1
2. (3 / 4) + (5 / 7) 
= (3 * 7 / 4 * 7) + (5 * 4 / 7 * 4) 
= (21 / 28) + (20 / 28) 
= (21 + 20) / 28 = 41 / 28 
3. (-5 / 6) + (-3 / 6) 
= (-5 - 3) / 6
= -8 / 6
4. (2 / -3) + (1 / 4) = -(2 / 3) + (1 / 4) 
= -(2 * 4 / 3 * 4) + (1 * 3 / 4 * 3) 
= -(8 / 12) + (3 / 12) 
= (-8 + 3) / 12
= -5 / 12
5. 2 / 5 - 1 / 7 = 14 / 35 - 5 / 35
= 9 / 35
6. (4 / 7) * (2 / 3) = (4 * 2) / (7 * 3)
= 8 / 21
7. (-4 / 7) * (2 / -3) = -(4 * 2) / -(7 * 3)
= 8 / 21
8. (5 / 13) ÷ (3 / 25)
= (5 / 13) * (25 / 3) = 125 / 139
9. 43⁄13 + 43⁄13
= 55 / 13 + 55 / 13 = 110 / 13
10. 58⁄15 - 37⁄15
= (83 / 15) - (52 / 15)
= 29 / 15  
 
sooda367
Aptitude
placement preparation
GRE
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Vocabulary for CAT and Aptitude Related Exams
GRE Data Analysis | Distribution of Data, Random Variables, and Probability Distributions
GRE Data Analysis | Counting Methods
GRE Algebra | Rules of Exponent
GRE Data Analysis | Numerical Methods for Describing Data
GRE Algebra | Coordinate Geometry
GRE Data Analysis | Methods for Presenting Data
Vocabulary for CAT and Aptitude Related Exams | Set 2
Important Tips on How To Prepare for the GRE
GRE Algebra | Operations with Algebraic Expressions
Ruby | Array class first() function - GeeksforGeeks

08 Jan, 2020
first() is a Array class method which returns the first element of the array or the first ‘n’ elements from the array.
Syntax: Array.first()
Parameter: Arrayn – no. of elements
Return: first element of the array or the first ‘n’ elements from the array
Example #1 :
# Ruby code for first() method  # declaring arraya = [18, 22, 33, nil, 5, 6]  # declaring arrayb = [1, 4, 1, 1, 88, 9]  # declaring arrayc = [18, 22, nil, nil, 50, 6]  # firstputs "first : #{a.first(5)}\n\n"  # firstputs "first : #{b.first(4)}\n\n"  # firstputs "first : #{c.first()}\n\n"
Output :
first : [18, 22, 33, nil, 5]

first : [1, 4, 1, 1]

first : 18


Example #2 :
# Ruby code for first() method  # declaring arraya = ["abc", "nil", "dog"]  # declaring arrayb = ["cow", nil, "dog"]  # declaring arrayc = ["cat", nil, nil]  # firstputs "first : #{a.first(5)}\n\n"  # firstputs "first : #{b.first(4)}\n\n"  # firstputs "first : #{c.first()}\n\n"
Output :
first : ["abc", "nil", "dog"]

first : ["cow", nil, "dog"]

first : cat


Ruby Array-class
Ruby-Methods
Ruby
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Include v/s Extend in Ruby
Global Variable in Ruby
Ruby | Hash delete() function
Ruby | Enumerator each_with_index function
Ruby | Types of Variables
Ruby | Case Statement
Ruby | Array select() function
Ruby | Data Types
Ruby | Numeric round() function
Ruby | String capitalize() Method
Tukey's Five-number Summary in R Programming - fivenum() function - GeeksforGeeks

01 Jul, 2020
fivenum() function in R Language is used to return Tukey’s five-number summary of input data i.e., minimum value, lower-hinge value, median value, upper-hinge value and maximum value of the input data.
Syntax: fivenum(x, na.rm = TRUE)
Parameters:x: indicates numeric objectna.rm: indicates logical value. If TRUE, NAs and NANs are dropped.
Example 1:
# Create numeric data objectx <- seq(1, 13, by = 2)  # Show Tukey's five-number summaryfivenum(x)
Output:
[1]  1  4  7 10 13

Example 2:
# Create numeric data objectx <- rnorm(1000)  # Show Tukey's five-number summaryfivenum(x)
Output:
[1] -2.97770299 -0.65995003 -0.04482463  0.70722486  2.99627903

R Statistics-Function
R Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Change Color of Bars in Barchart using ggplot2 in R
Group by function in R using Dplyr
How to Change Axis Scales in R Plots?
How to Split Column Into Multiple Columns in R DataFrame?
Replace Specific Characters in String in R
How to filter R DataFrame by values in a column?
R - if statement
How to import an Excel File into R ?
Plot mean and standard deviation using ggplot2 in R
How to filter R dataframe by multiple conditions?
How to select direct parent element of an element in jQuery ? - GeeksforGeeks

31 Mar, 2021
In this article, we will select the direct parent element of an element using jQuery. To select the direct parent element, the parent() method is used. This method finds the parent element related to the selected element. This parent() method traverse a single level up the selected element and return that element.
Syntax:
$(selector).parent()
Example: 
HTML
<!DOCTYpe html><html>  <head>    <title>        How to select direct parent element        of an element in jQuery?    </title>      <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">    </script>      <script>        $(document).ready(function () {            $("li").parent().css({                color: "white",                background: "green"            });        });    </script></head>  <body>    <h1 style="color: green;">        GeeksforGeeks    </h1>      <h3>        How to select direct parent element        of an element in jQuery?    </h3>      <p>GeeksforGeeks Subjects List-</p>      <ul>        <li>HTML</li>        <li>CSS</li>        <li>JavaScript</li>        <li>PHP</li>    </ul></body>  </html>
Output:
CSS-Questions
HTML-Questions
jQuery-Methods
jQuery-Questions
jQuery-Selectors
JQuery
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Show and Hide div elements using radio buttons?
How to prevent Body from scrolling when a modal is opened using jQuery ?
jQuery | ajax() Method
jQuery | removeAttr() with Examples
How to get the value in an input text box using jQuery ?
Remove elements from a JavaScript Array
Installation of Node.js on Linux
Convert a string to an integer in JavaScript
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?
CSS Rounded Borders

The border-radius property is used to add rounded borders to an element:
Normal border
Round border
Rounder border
Roundest border
All the top border properties in one declaration
This example demonstrates a shorthand property for setting all of the properties for the top border in one declaration.
Set the style of the bottom border
This example demonstrates how to set the style of the bottom border.
Set the width of the left border
This example demonstrates how to set the width of the left border.
Set the color of the four borders
This example demonstrates how to set the color of the four borders. It can have from one to four colors.
Set the color of the right border
This example demonstrates how to set the color of the right border.
Use the border shorthand property to set a "4px", "dotted", "red" border for the <p> elements.
<style>
p {
  : ;
}
</style>

<body>
  <h1>This is a heading</h1>
  <p>This is a paragraph</p>
  <p>This is a paragraph</p>
</body>

Start the Exercise
We just launchedW3Schools videos
Get certifiedby completinga course today!
If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:
help@w3schools.com
Your message has been sent to W3Schools.
Absolute Difference of all pairwise consecutive elements in an array (C++)?

In this problem we will see how we can get the absolute differences between the elements of each pair of elements in an array. If there are n elements, the resultant array will contain n-1 elements. Suppose the elements are {8, 5, 4, 3}. The result will be |8-5| = 3, then |5-4| = 1, |4-3|=1.
begin
   res := an array to hold results
   for i in range 0 to n-2, do
      res[i] := |res[i] – res[i+1]|
   done
end
 Live Demo
#include<iostream>
#include<cmath>
using namespace std;
void pairDiff(int arr[], int res[], int n) {
   for (int i = 0; i < n-1; i++) {
      res[i] = abs(arr[i] - arr[i+1]);
   }
}
main() {
   int arr[] = {14, 20, 25, 15, 16};
   int n = sizeof(arr) / sizeof(arr[0]);
   int res[n-1];
   pairDiff(arr, res, n);
   cout << "The differences array: ";
   for(int i = 0; i<n-1; i++) {
      cout << res[i] << " ";
   }
}
The differences array: 6 5 10 1
How to create NVARCHAR column in MySQL?

The MySQL converts NVARCHAR() to VARCHAR(). NVARCHAR stands for National Varchar in MySQL. Let us first create a table with one of the columns “StudentName” as NVARCHAR −
mysql> create table DemoTable
(
   StudentName NVARCHAR(40),
   StudentCountryName VARCHAR(50)
);
Query OK, 0 rows affected, 1 warning (0.49 sec)
Let us check the description of the table −
mysql> desc DemoTable;
This will produce the following output. As you can see below, the StudentName column with NVARCHAR type is automatically converted to VARCHAR in MySQL −
+--------------------+-------------+------+-----+---------+-------+
| Field              | Type        | Null | Key | Default | Extra |
+--------------------+-------------+------+-----+---------+-------+
| StudentName        | varchar(40) | YES  |     | NULL    |       |
| StudentCountryName | varchar(50) | YES  |     | NULL    |       |
+--------------------+-------------+------+-----+---------+-------+
2 rows in set (0.00 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable values('Chris','US');
Query OK, 1 row affected (0.10 sec)
mysql> insert into DemoTable values('Tom','UK');
Query OK, 1 row affected (0.16 sec)
mysql> insert into DemoTable values('David','AUS');
Query OK, 1 row affected (0.11 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable;
This will produce the following output −
+-------------+--------------------+
| StudentName | StudentCountryName |
+-------------+--------------------+
| Chris       | US                 |
| Tom         | UK                 |
| David       | AUS                |
+-------------+--------------------+
3 rows in set (0.00 sec)
How to integrate React-PDF in ReactJS ? - GeeksforGeeks

23 Apr, 2021
React-PDF is a package that helps users to display PDF files in their React app. By using react-pdf package we can add PDF files in our React app as if they were images. To use the latest version of react-pdf package, our project should use React 16.3 or later. We can integrate react-pdf using the following approach.
Creating React Application And Installing Module:
Step 1: Create a React application using the following command.npx create-react-app my-app
Step 1: Create a React application using the following command.
npx create-react-app my-app
Step 2: After creating your project folder(i.e. my-app), move to it by using the following command.cd my-app
Step 2: After creating your project folder(i.e. my-app), move to it by using the following command.
cd my-app
Step 3: After creating the React application, Install the react-pdf package using the following command.npm install react-pdf
npm install react-pdf
Step 4: Add sample.pdf file to my-app/src folder which you want to display.
Step 4: Add sample.pdf file to my-app/src folder which you want to display.
Project Structure : 
Project Structure
Example: Add the following code in the App.js file. Here, App is our default component where we have written our code.
Javascript
import React from 'react';import { Document,Page } from 'react-pdf/dist/esm/entry.webpack';import pdfFile from './sample.pdf'  function App() {    return (    <div>      <Document file={pdfFile}>        <Page pageNumber={1} />      </Document>    </div>  );}  export default App;
Note: Instead of importing/requiring react-pdf directly, we had used entry points which are being provided by react-pdf because entry points enable PDF.js worker which is crucial for performance.  This makes sure that PDF files will be rendered in a different thread without affecting the performance of the page.
Step to Run Application: Run the application using the following command from the root directory of the project.
npm start
Output: Now open your browser and go to http://localhost:3000/, you will see the following output.
Reference: https://www.npmjs.com/package/react-pdf
Picked
React-Questions
ReactJS
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to set background images in ReactJS ?
How to create a table in ReactJS ?
How to navigate on path by button click in react router ?
How to create a multi-page website using React.js ?
How to build a basic CRUD app with Node.js and ReactJS ?
Top 10 Front End Developer Skills That You Need in 2022
Installation of Node.js on Linux
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to insert spaces/tabs in text using HTML/CSS?
Difference between var, let and const keywords in JavaScript
What is the C# equivalent for the Java System.exit(0)?

The C# equivalent for Java System.exit(0) is −
Environment.Exit(exitCode);

The Environment.Exit() method terminates this process and returns an exit code to the operating
system.
Above, use exitCode as 0 (zero) to show that the process completed successfully.
Use exitCode as a non-zero number to show an error, for example −
Return a value 1 to show that the file you want is not present
Return a value 2 to indicate that the file is in an incorrect format.
How to sum varchar column and display the count in MySQL?

For this, use GROUP BY along with COUNT(*). Let us first create a table −
mysql> create table DemoTable
(
   EmployeeId int NOT NULL AUTO_INCREMENT PRIMARY KEY,
   EmployeeGender varchar(40)
);
Query OK, 0 rows affected (0.48 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable(EmployeeGender) values('MALE');
Query OK, 1 row affected (0.15 sec)
mysql> insert into DemoTable(EmployeeGender) values('FEMALE');
Query OK, 1 row affected (0.09 sec)
mysql> insert into DemoTable(EmployeeGender) values('FEMALE');
Query OK, 1 row affected (0.07 sec)
mysql> insert into DemoTable(EmployeeGender) values('FEMALE');
Query OK, 1 row affected (0.09 sec)
mysql> insert into DemoTable(EmployeeGender) values('MALE');
Query OK, 1 row affected (0.25 sec)
mysql> insert into DemoTable(EmployeeGender) values('MALE');
Query OK, 1 row affected (0.23 sec)
mysql> insert into DemoTable(EmployeeGender) values('MALE');
Query OK, 1 row affected (0.07 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable;
This will produce the following output −
+------------+----------------+
| EmployeeId | EmployeeGender |
+------------+----------------+
|          1 | MALE           |
|          2 | FEMALE         |
|          3 | FEMALE         |
|          4 | FEMALE         |  
|          5 | MALE           |
|          6 | MALE           |
|          7 | MALE           |
+------------+----------------+
7 rows in set (0.00 sec)
Following is the query to sum the varchar column. This will sum the MALE and FEMALE column values and count would be displayed −
mysql> select EmployeeGender,count(*) from DemoTable
   group by EmployeeGender;
This will produce the following output −
+----------------+----------+
| EmployeeGender | count(*) |
+----------------+----------+
| MALE           |        4 |
| FEMALE         |        3 |
+----------------+----------+
2 rows in set (0.00 sec)
How to click on a hyper link using linkText in Selenium?

A hyperlink on a page is identified with the anchor tag. To click a link, we can use the link text locator which matches the text enclosed within the anchor tag.
We can also use the partial link text locator which matches the text enclosed within the anchor tag partially. NoSuchElementException is thrown if there is no matching element found by both these locators.
WebElement t =driver.findElement(By.partialLinkText("Refund"));
WebElement m =driver.findElement(By.linkText("Refund Policy"));
Let us make an attempt to click a link Refund Policy on the below page −
Code Implementation with linkText
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import java.util.concurrent.TimeUnit;
public class LnkClick{
   public static void main(String[] args) {
      System.setProperty("webdriver.gecko.driver",
"C:\\Users\\ghs6kor\\Desktop\\Java\\geckodriver.exe");
      WebDriver driver = new FirefoxDriver();
      //implicit wait
      driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
      //URL launch
      driver.get("https://www.tutorialspoint.com/about/about_careers.htm");
      // identify element with link text
      WebElement m =driver.findElement(By.linkText("Refund Policy"));
      m.click();
      System.out.println("Page navigated: " + driver.getTitle());
      driver.quit();
   }
}
Code Implementation with partialLinkText
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import java.util.concurrent.TimeUnit;
public class PartialLnkClick{
   public static void main(String[] args) {
      System.setProperty("webdriver.gecko.driver",
"C:\\Users\\ghs6kor\\Desktop\\Java\\geckodriver.exe");
      WebDriver driver = new FirefoxDriver();
      //implicit wait
      driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
      //URL launch
      driver.get("https://www.tutorialspoint.com/about/about_careers.htm");
      // identify element with partial link text
      WebElement p =driver.findElement(By.partialLinkText("Refund"));
      p.click();
      System.out.println("Page navigated: " + driver.getTitle());
      driver.quit();
   }
}
How to enter a letter in uppercase in the edit box using Actions in Selenium?

We can enter a letter in upper case in the edit box in Selenium with the help of Actions. In order to achieve this, we need to first move to the edit box, then click() on that field. Then press SHIFT and enter the letters using sendKeys() method. Finally use build().perform() to execute all the steps.
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.interactions.Action;
import org.openqa.selenium.interactions.Actions;
import java.util.concurrent.TimeUnit;
public class UpperCase{
   public static void main(String[] args) {
      System.setProperty("webdriver.chrome.driver", "C:\\Users\\ghs6kor\\Desktop\\Java\\chromedriver.exe");
      WebDriver driver = new ChromeDriver();
      String url = "https://www.tutorialspoint.com/questions/index.php";
      driver.get(url);
      driver.manage().timeouts().implicitlyWait(12, TimeUnit.SECONDS);
      // move to the element, press shift and then enter the letters then //perform() to execute the       action
      Actions a = new Actions(driver);
      a.moveToElement(driver.findElement(By.xpath(“input[@type=’text’]))).
      click().keyDown(Keys.SHIFT).sendKeys(“tutorialspoint”).
      build().perform();
      driver.quit();
   }
}
How to use PowerShell break statement with the For loop?

To use the Break statement with the For loop, consider the below example.
for($i=1; $i -le 10; $i++){
   Write-Host "i = $i"
   if($i -eq 5){break}
}
i = 1
i = 2
i = 3
i = 4
i = 5
Here, when the value of $i reaches to 5, For loop gets terminated.
Inner For loop Break statement.
for($i=1; $i -le 3; $i++){
   for($j=1; $j -le 5; $j++){
      Write-Host "i = $i"
      Write-Host "j = $j`n"
      if($j -eq 3){break}
   }
}
i = 1
j = 1
i = 1
j = 2
i = 1
j = 3
i = 2
j = 1
i = 2
j = 2
i = 2
j = 3
i = 3
j = 1
i = 3
j = 2
i = 3
j = 3
Here, when the value of $j reaches 3, the only inner loop gets terminated but the outer loop execution still continues.
Outer For loop Break Statement.
for($i=1; $i -le 3; $i++){
   for($j=1; $j -le 2; $j++){
      Write-Host "i = $i"
      Write-Host "j = $j`n"
   }
   if($i -eq 2){break}
}
i = 1
j = 1
i = 1
j = 2
i = 2
j = 1
i = 2
j = 2
In the above example, when the value of $i reaches to 2 it breaks outer and inner loop both.
AVG() Function in SQL Server - GeeksforGeeks

21 Jan, 2021
AVG() :
This function in SQL Server is used to return the average value of the specified expression.
Features :
This function is used to find the average value of the specified expression.
This function comes under Numeric Functions.
This function accepts only one parameter, namely expression.
This function ignores NULL values.
Syntax :
AVG(expression)
Parameter :
This method accepts one parameter.
expression – A specified numeric value may be either a stated field or a stated formula.
Returns :
It returns the average value of the specified expression.
Example-1 :
Using AVG() function and getting the output.
CREATE TABLE product
(  
user_id int IDENTITY(100, 2) NOT NULL,    
product_1 VARCHAR(10),
product_2 VARCHAR(10),
price int  
);
INSERT product(product_1, price)  
VALUES ('rice', 400);

INSERT product(product_2, price)  
VALUES ('grains', 600);

SELECT AVG(price) FROM product;
Output :
500
Here, the average of the first product’s price and second product’s price is returned.
Example-2 :
Using AVG() function and getting the average of float values.
CREATE TABLE floats
(  
user_id int IDENTITY(100, 2) NOT NULL,
float_val float
);
INSERT floats(float_val)  
VALUES (3.5);

INSERT floats(float_val)  
VALUES (2.5);

SELECT AVG(float_val) FROM floats;
Output :
3
Example-3 :
Using AVG() function and getting the output where MRP is greater than the average MRP of the products.
CREATE TABLE package
(  
user_id int IDENTITY(100, 4) NOT NULL,  
item VARCHAR(10),
mrp int  
);
INSERT package(item, mrp)  
VALUES ('book1', 250);

INSERT package(item, mrp)  
VALUES ('book2', 350);

INSERT package(item, mrp)  
VALUES ('book3', 400);

SELECT * FROM package
WHERE mrp > (SELECT AVG(mrp) FROM package);
Output :
  | user_id  | item     | mrp
--------------------------------
1 | 104      | book2    | 350
--------------------------------
2 | 108      | book3    | 400
Example-4 :
Using AVG() function and getting the average of the (MRP-sales price).
CREATE TABLE package
(  
user_id int IDENTITY(100, 4) NOT NULL,  
item VARCHAR(10),
mrp int,
sp int
);
INSERT package(item, mrp, sp)  
VALUES ('book1', 250, 240);

INSERT package(item, mrp, sp)  
VALUES ('book2', 350, 320);

INSERT package(item, mrp, sp)  
VALUES ('book3', 400, 350);

SELECT AVG(mrp-sp) FROM package;
Output :
30
Application :
This function is used to find the average of the expression specified.
DBMS-SQL
SQL-Server
SQL
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Update Multiple Columns in Single Update Statement in SQL?
What is Temporary Table in SQL?
SQL Query to Find the Name of a Person Whose Name Starts with Specific Letter
SQL using Python
SQL | Subquery
How to Write a SQL Query For a Specific Date Range and Date Time?
SQL Query to Convert VARCHAR to INT
How to Select Data Between Two Dates and Times in SQL Server?
SQL - SELECT from Multiple Tables with MS SQL Server
SQL Query to Delete Duplicate Rows
SQL Query to Delete a Data From a Table Based on Date - GeeksforGeeks

09 Nov, 2021
Many of the time we have to delete data based on the date. These dates can be some older dates. For this purpose, we can use delete query along with where clause. This approach helps us to delete some old data in our database. In this article, we are going to delete the data of employees based on their birth dates.
Step 1: Creating the database
Query:
CREATE DATABASE Gfg;
Step 2: Using the database
Query:
USE DATABASE Gfg;
After executing this query we can create tables in our database.
Step 3: Table definition
Query:
CREATE TABLE EMPLOYEE (name VARCHAR(20), age VARCHAR(20),
 GENDER(20), birth DATE, Department VARCHAR(50) );
Output:
After executing this query, a table with the name Employee will get created with the specified column. 
Step 4: Adding data to the table
Output:
After executing this query, records will get inserted as shown above.
Step 5: Deleting from the table based on a date
Query:
DELETE FROM Employee where birth < '2001-01-04'
In this query, we are deleting the records which have birthdate older than 2001-01-04 (year-month-date).
Output:
As we have deleted the employees whos birthdate was older than ‘2001-01-04’, we can see the employees with the date greater than and equal to 2001-01-04.
Picked
SQL-Query
SQL-Server
SQL
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to Update Multiple Columns in Single Update Statement in SQL?
What is Temporary Table in SQL?
SQL Query to Find the Name of a Person Whose Name Starts with Specific Letter
SQL using Python
SQL | Subquery
How to Write a SQL Query For a Specific Date Range and Date Time?
SQL Query to Convert VARCHAR to INT
SQL indexes
SQL Query to Delete Duplicate Rows
SQL Query to Compare Two Dates