code-rag-bench/online-tutorials huggingface dataset:
CSS Text Effects

In this chapter you will learn about the following properties:
text-overflow
word-wrap
word-break
writing-mode
The CSS text-overflow property specifies how overflowed content that is not 
displayed should be signaled to the user.
It can be clipped:
This is some long text that will not fit in the box
or it can be rendered as an ellipsis (...):
This is some long text that will not fit in the box
The CSS code is as follows:
The following example shows how you can display the overflowed content when hovering over the element:
The CSS word-wrap property allows long words to be able to be broken and wrap onto the next line. 
If a word is too long to fit within an area, it expands outside:
 This paragraph contains a very long word: thisisaveryveryveryveryveryverylongword. The long word will break and wrap to the next line.
The word-wrap property allows you to force the text to wrap - even if it means splitting it in the middle of a word:
 This paragraph contains a very long word: thisisaveryveryveryveryveryverylongword. The long word will break and wrap to the next line.
The CSS code is as follows:
Allow long words to be able to be broken and wrap onto the next line:
The CSS word-break property specifies line breaking rules.
This paragraph contains some text. This line will-break-at-hyphens.
This paragraph contains some text. The lines will break at any character.
The CSS code is as follows:
The CSS writing-mode property specifies 
whether lines of text are laid out horizontally or vertically.
Some text with a span element with a vertical-rl writing-mode.
The following example shows some different writing modes:
Specify that the overflowed content for the <p> element should be signaled with an ellipsis (...).
<style>
p {
  white-space: nowrap; 
  width: 200px; 
  border: 1px solid #000000;
  overflow: hidden;
  : ;
}
</style>

<body>
  <p>
    This paragraph contains a very long word: supercalifragilisticexpialidocious.
  </p>
</body>

Start the Exercise
The following table lists the CSS text effect properties:
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.
JavaScript - Array sort() Method

Javascript array sort() method sorts the elements of an array.
Its syntax is as follows −
array.sort( compareFunction );

compareFunction − Specifies a function that defines the sort order. If omitted, the array is sorted lexicographically. 
Returns a sorted array.
Try the following example.
<html>
   <head>
      <title>JavaScript Array sort Method</title>
   </head>
   
   <body>
      <script type = "text/javascript">
         var arr = new Array("orange", "mango", "banana", "sugar");         
         var sorted = arr.sort();
         document.write("Returned string is : " + sorted );
      </script>      
   </body>
</html>
Returned array is : banana,mango,orange,sugar 


    25 Lectures 
     2.5 hours 

 Anadi Sharma

    74 Lectures 
     10 hours 

 Lets Kode It

    72 Lectures 
     4.5 hours 

 Frahaan Hussain

    70 Lectures 
     4.5 hours 

 Frahaan Hussain

    46 Lectures 
     6 hours 

 Eduonix Learning Solutions

    88 Lectures 
     14 hours 

 Eduonix Learning Solutions
 Print
 Add Notes
 Bookmark this page
Find the area between two curves plotted in Matplotlib

To find the area between two curves plot in matplotlib, we can take the following steps
Set the figure size and adjust the padding between and around the subplots.
Create x, c1 and c2 data points using numpy.
Plot (x, c1) and (x, c2) using plot() methods.
Fill the area between the two curves, c1 and c2, with grey color and hatch "|", using fill_between() method.
To display the figure, use show() method.
import matplotlib.pyplot as plt
import numpy as np
plt.rcParams["figure.figsize"] = [7.50, 3.50]
plt.rcParams["figure.autolayout"] = True
x = np.linspace(0, 1, 100)
c1 = x ** 2
c2 = x
plt.plot(x, c1)
plt.plot(x, c2)
plt.fill_between(x, c1, c2, color="grey", alpha=0.3, hatch='|')
plt.show()
Count repeated values in R - GeeksforGeeks

30 May, 2021
In this article, we will learn how we can count the repeated values in R programming language. 
We will be using the table() function along with which() and length() functions to get the count of repeated values. The table() function in R Language is used to create a categorical representation of data with the variable name and the frequency in the form of a table.
Syntax: table(x)
Parameters:x: Object to be converted
Using condition table(v>1) will return the boolean values, it will return TRUE for the values which have a frequency of greater than 1 else it will return false. Here, we have used (v>1) as we want those elements whose frequency is greater than 1. On passing it as an argument in which() function it will return the elements(along with their indexes) which are repeated more than once. which(): This function returns the index of the element which satisfies the condition given in the parameters. 
Use the length() function to count the number of elements returned by the which() function, as which function returns the elements that are repeated more than once. The length() function in R Language is used to get or set the length of a vector (list) or other objects.
Syntax: 
length(which(table(v)>1))
Example 1:
R
# sample vectorv <- c(1,1,1,1,1,5,2,3,4,5,3,7,8,9,5)v  print("Count of repeated values")length(which(table(v)>1))
Output:
 [1] 1 1 1 1 1 5 2 3 4 5 3 7 8 9 5
[1] “Count of repeated values”
[1] 3
Example 2:
R
v <- c(c(5:15),c(10:12),5,5,6,7)v  print("Count of repeated values")length(which(table(v)>1))
Output:
 [1]  5  6  7  8  9 10 11 12 13 14 15 10 11 12  5  5  6  7
[1] “Count of repeated values”
[1] 6
Using condition table(v>1) will return the boolean values, it will return TRUE for the values which have a frequency of more than 1 else it will return false. On passing it as an argument in which() function it will return the elements(along with their indexes) which are repeated more than once. which(): This function returns the index of the element which satisfies the condition given in the parameters.
Syntax: 
which(table(v)>1)
Example 1:
R
v <- c(c(5:15),c(10:12),5,5,6,7)v  print("Elements which are repeated")which(table(v)>1)
Output: 
 [1]  5  6  7  8  9 10 11 12 13 14 15 10 11 12  5  5  6  7
[1] “Elements which are repeated”
5  6  7 10 11 12
1  2  3  6  7  8 
Picked
R-Functions
R Language
R Programs
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
How to Change Axis Scales in R Plots?
Group by function in R using Dplyr
How to Split Column Into Multiple Columns in R DataFrame?
How to filter R DataFrame by values in a column?
How to Split Column Into Multiple Columns in R DataFrame?
How to filter R DataFrame by values in a column?
How to filter R dataframe by multiple conditions?
Replace Specific Characters in String in R
Convert Matrix to Dataframe in R
numpy.gcd() in Python - GeeksforGeeks

29 Nov, 2018
numpy.gcd(arr1, arr2, out = None, where = True, casting = ‘same_kind’, order = ‘K’, dtype = None) : This mathematical function helps user to calculate GCD value of |arr1| and |arr2| elements.
Greatest Common Divisor (GCD) of two or more numbers, which are not all zero, is the largest positive number that divides each of the numbers.
Example: Finding GCD of 120 and 2250
120 = 2^3 * 3 * 5
2250 = 2 * 3^2 * 5^3

Now, GCD of 120 and 2250 = 2 * 3 * 5 = 30

Parameters :arr1 / arr2 : [array_like]Input array.
Return : Greatest Common Divisor (GCD) of two or more numbers.
Code :
# Python program illustrating # gcd() method import numpy as np   arr1 = [120, 24, 42, 10]arr2 = [2250, 12, 20, 50]  print ("arr1 : ", arr1)print ("arr2 : ", arr2)  print ("\nGCD of arr1 and arr2 : ", np.gcd(arr1, arr2))print ("\nGCD of arr1 and 10   : ", np.gcd(arr1, 10))           
Output :
arr1 : [120, 24, 42, 10]
arr2 : [2250, 12, 20, 50]

GCD of arr1 and arr2 : [30, 12,  2, 10]

GCD of arr1 and 10   : [10,  2,  2, 10]

Python numpy-Mathematical Function
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 ?
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
Defaultdict in Python
Python | os.path.join() method
Python | Get unique values from a list
Selecting rows in pandas DataFrame based on conditions
Create a directory in Python
Python | Pandas dataframe.groupby()
Tryit Editor v3.7

Tryit: HTML link target
SQL - NOT NULL Constraint

By default, a column can hold NULL values. If you do not want a column to have a NULL value, then you need to define such a constraint on this column specifying that NULL is now not allowed for that column.
A NULL is not the same as no data, rather, it represents unknown data.
For example, the following SQL query creates a new table called CUSTOMERS and adds five columns, three of which, are ID NAME and AGE, In this we specify not to accept NULLs −
CREATE TABLE CUSTOMERS(
   ID   INT              NOT NULL,
   NAME VARCHAR (20)     NOT NULL,
   AGE  INT              NOT NULL,
   ADDRESS  CHAR (25) ,
   SALARY   DECIMAL (18, 2),       
   PRIMARY KEY (ID)
);
If CUSTOMERS table has already been created, then to add a NOT NULL constraint to the SALARY column in Oracle and MySQL, you would write a query like the one that is shown in the following code block.
ALTER TABLE CUSTOMERS
   MODIFY SALARY  DECIMAL (18, 2) NOT NULL;

    42 Lectures 
     5 hours 

 Anadi Sharma

    14 Lectures 
     2 hours 

 Anadi Sharma

    44 Lectures 
     4.5 hours 

 Anadi Sharma

    94 Lectures 
     7 hours 

 Abhishek And Pukhraj

    80 Lectures 
     6.5 hours 

 Oracle Master Training | 150,000+ Students Worldwide

    31 Lectures 
     6 hours 

 Eduonix Learning Solutions
 Print
 Add Notes
 Bookmark this page
Python File next() Method

Python file method next() is used when a file is used as an iterator, typically in a loop, the next() method is called repeatedly. This method returns the next input line, or raises StopIteration when EOF is hit.
Combining next() method with other file methods like readline() does not work right. However, usingseek() to reposition the file to an absolute position will flush the read-ahead buffer.
Following is the syntax for next() method −
fileObject.next(); 

NA
NA
This method returns the next input line.
The following example shows the usage of next() method.
This is 1st line
This is 2nd line
This is 3rd line
This is 4th line
This is 5th line

#!/usr/bin/python

# Open a file
fo = open("foo.txt", "rw+")
print "Name of the file: ", fo.name

# Assuming file has following 5 lines
# This is 1st line
# This is 2nd line
# This is 3rd line
# This is 4th line
# This is 5th line

for index in range(5):
   line = fo.next()
   print "Line No %d - %s" % (index, line)

# Close opend file
fo.close()
When we run above program, it produces following result −
Name of the file:  foo.txt
Line No 0 - This is 1st line

Line No 1 - This is 2nd line

Line No 2 - This is 3rd line

Line No 3 - This is 4th line

Line No 4 - This is 5th line


    187 Lectures 
     17.5 hours 

 Malhar Lathkar

    55 Lectures 
     8 hours 

 Arnab Chakraborty

    136 Lectures 
     11 hours 

 In28Minutes Official

    75 Lectures 
     13 hours 

 Eduonix Learning Solutions

    70 Lectures 
     8.5 hours 

 Lets Kode It

    63 Lectures 
     6 hours 

 Abhilash Nelson
 Print
 Add Notes
 Bookmark this page
How to find the variance of row elements of a matrix in R?

Finding the variance of columns is a common task in data analysis but often data is provided in wide format instead of long format, therefore, the cases are represented vertically and the variables are aligned horizontally and this data could be available in matrix or any other form. Therefore, the variance can be easily found by using apply function.
 Live Demo
M1<-matrix(1:25,ncol=5)
M1
   [,1] [,2] [,3] [,4] [,5]
[1,] 1   6    11   16    21
[2,] 2   7    12   17    22
[3,] 3   8    13   18    23
[4,] 4   9    14   19    24
[5,] 5   10   15   20    25
apply(M1,1,var)
[1] 62.5 62.5 62.5 62.5 62.5
 Live Demo
M2<-matrix(1:100,nrow=10)
M2
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,] 1 11 21 31 41 51 61 71 81 91
[2,] 2 12 22 32 42 52 62 72 82 92
[3,] 3 13 23 33 43 53 63 73 83 93
[4,] 4 14 24 34 44 54 64 74 84 94
[5,] 5 15 25 35 45 55 65 75 85 95
[6,] 6 16 26 36 46 56 66 76 86 96
[7,] 7 17 27 37 47 57 67 77 87 97
[8,] 8 18 28 38 48 58 68 78 88 98
[9,] 9 19 29 39 49 59 69 79 89 99
[10,] 10 20 30 40 50 60 70 80 90 100
apply(M2,1,var)
[1] 916.6667 916.6667 916.6667 916.6667 916.6667 916.6667 916.6667 916.6667 [9] 916.6667 916.6667
 Live Demo
M3<-matrix(1:60,nrow=20)
M3
    [,1] [,2] [,3]
[1,]  1   21 41
[2,]  2   22 42
[3,]  3   23 43
[4,]  4   24 44
[5,]  5   25 45
[6,]  6   26 46
[7,]  7   27 47
[8,]  8   28 48
[9,]  9   29 49
[10,] 10  30 50
[11,] 11  31 51
[12,] 12  32 52
[13,] 13  33 53
[14,] 14  34 54
[15,] 15  35 55
[16,] 16  36 56
[17,] 17  37 57
[18,] 18  38 58
[19,] 19  39 59
[20,] 20  40 60
apply(M3,1,var)
[1] 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400
[20] 400
 Live Demo
M4<-matrix(rnorm(30,5,1),nrow=15)
M4
        [,1]    [,2]
[1,] 5.517894  6.105346
[2,] 4.008269  3.640526
[3,] 5.484878  6.779180
[4,] 4.534817  6.723722
[5,] 5.602067  4.032113
[6,] 5.884524  4.910336
[7,] 3.234350  5.824891
[8,] 4.188615  4.874050
[9,] 3.367234  5.062664
[10,] 6.430093  3.369706
[11,] 4.364802  5.902848
[12,] 5.536012  7.037217
[13,] 5.096840 4.269251
[14,] 6.154817 4.320163
[15,] 5.070610 5.150351
apply(M4,1,var)
[1] 0.021906088 0.711543659 0.632177226 0.822552459 0.273495182 1.132347512
[7] 0.058730197 1.369282431 1.130733174 0.625609262 2.226411932 0.081628957
[13] 0.237108400 0.001073659 0.011819879
 Live Demo
M5<-matrix(runif(40,1,2),nrow=20)
M5
[,1] [,2]
[1,] 1.797724 1.045920
[2,] 1.663738 1.404009
[3,] 1.751550 1.920017
[4,] 1.250277 1.445597
[5,] 1.344217 1.975511
[6,] 1.186875 1.877203
[7,] 1.232352 1.912921
[8,] 1.848107 1.016703
[9,] 1.997422 1.888561
[10,] 1.370770 1.548419
[11,] 1.564406 1.925559
[12,] 1.316188 1.024001
[13,] 1.373600 1.642644
[14,] 1.880770 1.861855
[15,] 1.230204 1.628706
[16,] 1.339799 1.782240
[17,] 1.128182 1.186216
[18,] 1.862291 1.140511
[19,] 1.541293 1.454260
[20,] 1.332327 1.398676
apply(M5,1,var)
[1] 3.995889e-05 2.476911e-01 9.689490e-02 3.826634e-02 6.342112e-06
[6] 2.507245e-02 2.410225e-01 7.566494e-02 2.419975e-02 2.205656e-02
[11] 3.307264e-03 1.020207e-01 2.852077e-01 1.436173e-01 4.729889e-03
[16] 4.647355e-02 1.425541e-01 4.943002e-03 4.128207e-02 7.227659e-03
Enum in C

Enumeration is a user defined datatype in C language. It is used to assign names to the integral constants which makes a program easy to read and maintain. The keyword “enum” is used to declare an enumeration.
Here is the syntax of enum in C language,
enum enum_name{const1, const2, ....... };
The enum keyword is also used to define the variables of enum type. There are two ways to define the variables of enum type as follows.
enum week{sunday, monday, tuesday, wednesday, thursday, friday, saturday};
enum week day;
Here is an example of enum in C language,
 Live Demo
#include<stdio.h>
enum week{Mon=10, Tue, Wed, Thur, Fri=10, Sat=16, Sun};
enum day{Mond, Tues, Wedn, Thurs, Frid=18, Satu=11, Sund};
int main() {
   printf("The value of enum week: %d\t%d\t%d\t%d\t%d\t%d\t%d\n\n",Mon , Tue, Wed, Thur, Fri, Sat, Sun);
   printf("The default value of enum day: %d\t%d\t%d\t%d\t%d\t%d\t%d",Mond , Tues, Wedn, Thurs, Frid, Satu, Sund);
   return 0;
}
The value of enum week: 10111213101617
The default value of enum day: 0123181112
In the above program, two enums are declared as week and day outside the main() function. In the main() function, the values of enum elements are printed.
enum week{Mon=10, Tue, Wed, Thur, Fri=10, Sat=16, Sun};
enum day{Mond, Tues, Wedn, Thurs, Frid=18, Satu=11, Sund};
int main() {
   printf("The value of enum week: %d\t%d\t%d\t%d\t%d\t%d\t%d\n\n",Mon , Tue, Wed, Thur, Fri, Sat, Sun);
   printf("The default value of enum day: %d\t%d\t%d\t%d\t%d\t%d\t%d",Mond , Tues, Wedn, Thurs, Frid, Satu,    Sund);
}
D3.js ticks() Function - GeeksforGeeks

19 Jul, 2020
The ticks()  function in D3.js is used to form an array of between a given range of start and stop both inclusive such that each element is uniformly and equally spaced.
Syntax:
d3.ticks(start,stop,count);

Parameters: This function accepts three parameters as mentioned above and described below:
start: It is the starting value from where we want the array element to be, it is inclusive.
stop: It is the starting value to which we want the array element to be, it is inclusive.
count: It is the number of elements we want in a given start and stops range.
Return value: It returns an array of nicely-rounded numbers.
Below given are a few examples of ticks() function.
Example 1:
HTML
<!DOCTYPE html><html lang="en"><head>  <meta charset="UTF-8">  <meta name="viewport"         content="width=device-width, initial-scale=1.0">  <title>Document</title></head><body>  <!--fetching from CDN of D3.js -->  <script type = "text/javascript"           src = "https://d3js.org/d3.v4.min.js">  </script>  <script>    // Choosing 10 elements in a range    // Note that each element is equally spaced    console.log(d3.ticks(10, 20, 20))  </script></body></html>
Output:
Example 2:
HTML
<!DOCTYPE html><html lang="en"><head>  <meta charset="UTF-8">  <meta name="viewport"         content="width=device-width, initial-scale=1.0">  <title>Document</title></head><body>  <!--fetching from CDN of D3.js -->  <script type = "text/javascript"           src = "https://d3js.org/d3.v4.min.js">  </script>  <script>    // Choosing 10 elements in a range    console.log(d3.ticks(10, 20))  </script></body></html>
Output:
D3.js
JavaScript
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Difference between var, let and const keywords in JavaScript
Differences between Functional Components and Class Components in React
Convert a string to an integer in JavaScript
Form validation using HTML and JavaScript
JavaScript | console.log() with Examples
Installation of Node.js on Linux
Express.js express.Router() Function
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to fetch data from an API in ReactJS ?
Difference between var, let and const keywords in JavaScript
C | Dynamic Memory Allocation | Question 3 - GeeksforGeeks

09 Feb, 2013
Output?
# include<stdio.h># include<stdlib.h>   void fun(int *a){    a = (int*)malloc(sizeof(int));}   int main(){    int *p;    fun(p);    *p = 6;    printf("%d\n",*p);    return(0);}
(A) May not work(B) Works and prints 6Answer: (A)Explanation: The program is not valid. Try replacing “int *p;” with “int *p = NULL;” and it will try to dereference a null pointer.This is because fun() makes a copy of the pointer, so when malloc() is called, it is setting the copied pointer to the memory location, not p. p is pointing to random memory before and after the call to fun(), and when you dereference it, it will crash.If you want to add memory to a pointer from a function, you need to pass the address of the pointer (ie. double pointer).
C-Dynamic Memory Allocation
Dynamic Memory Allocation
C Language
C Quiz
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
rand() and srand() in C/C++
Core Dump (Segmentation fault) in C/C++
Left Shift and Right Shift Operators in C/C++
fork() in C
Command line arguments in C/C++
Compiling a C program:- Behind the Scenes
Operator Precedence and Associativity in C
Output of C programs | Set 64 (Pointers)
C | Structure & Union | Question 10
C | File Handling | Question 1
How to attach a click and double-click event to an element in jQuery ? - GeeksforGeeks

25 Mar, 2021
In this article, we will see how to attach a click and double-click event to an element in jQuery. To attach click and double-click events, click and dbclick events used. These events are attached with bind() method. This method is used to attach one or more event handlers for selected elements and this method specifies a function to run when an event occurs. Also, we use appendTo() method to append the result to an element.
Syntax:
$(element).bind(click, function() { })
$(element).bind(dbclick, function() { })
Example:
HTML
<!DOCTYPE html><html>  <head>    <title>        How to attach a click and double-click        event to 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 () {            $(".clickable_ele").bind("click", function () {                $("<h4>Single click Event called</h4>")                .appendTo(".res");            });              $(".clickable_ele").bind("dblclick", function () {                $("<h4>Double click Event called</h4>")                .appendTo(".res");            });        });    </script>      <style>        body {            text-align: center;        }          h1 {            color: green;        }          .clickable_ele {            font-size: 20px;            font-weight: bold;        }    </style></head>  <body>    <h1>GeeksforGeeks</h1>      <h3>        How to attach a click and double-click        event to an element in jQuery?    </h3>      <div class="clickable_ele">        Clickable Element    </div>      <div class="res"></div></body>  </html>
Output:
CSS-Properties
HTML-Tags
jQuery-Questions
JQuery
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to prevent Body from scrolling when a modal is opened using jQuery ?
jQuery | ajax() Method
Difference Between JavaScript and jQuery
How to get the value in an input text box using jQuery ?
jQuery | parent() & parents() with Examples
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 fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?
Does deleting row from view delete row from base table in MySQL?

Yes, deleting row from view delete row from base table. Let us understand this by creating a new table. The query to create a table is as follows
mysql> create table deleteFromBaseTableDemo
   -> (
   -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,
   -> Name varchar(20)
   -> );
Query OK, 0 rows affected (0.83 sec)
Insert some records in the table using insert command. The query is as follows −
mysql> insert into deleteFromBaseTableDemo(Name) values('John');
Query OK, 1 row affected (0.18 sec)
mysql> insert into deleteFromBaseTableDemo(Name) values('Carol');
Query OK, 1 row affected (0.15 sec)
mysql> insert into deleteFromBaseTableDemo(Name) values('Bob');
Query OK, 1 row affected (0.14 sec)
mysql> insert into deleteFromBaseTableDemo(Name) values('Sam');
Query OK, 1 row affected (0.14 sec)
Display all records from the table using select statement. The query is as follows −
mysql> select *from deleteFromBaseTableDemo;
The following is the output
+----+-------+
| Id | Name  |
+----+-------+
|  1 | John  |
|  2 | Carol |
|  3 | Bob   |
|  4 | Sam   |
+----+-------+
4 rows in set (0.00 sec)
Let us create a view. The query to create a view is as follows
mysql> create view delete_view as select Id,Name from deleteFromBaseTableDemo;
Query OK, 0 rows affected (0.17 sec)
Let us check all the records of view. The query is as follows −
mysql> select *from delete_view;
The following is the output
+----+-------+
| Id | Name  |
+----+-------+
|  1 | John  | 
|  2 | Carol |
|  3 | Bob   |
|  4 | Sam   |
+----+-------+
4 rows in set (0.05 sec)
Now if you delete from view then it will automatically delete from base table as well.
The query to delete row from view is as follows
mysql> delete from delete_view where Id=4;
Query OK, 1 row affected (0.26 sec)
Let us check all the records from view and parent table. The query is as follows −
mysql> select *from delete_view;
The following is the output
+----+-------+
| Id | Name  |
+----+-------+
|  1 | John  |
|  2 | Carol |
|  3 | Bob   |
+----+-------+
3 rows in set (0.00 sec)
The query to show all records from base table is as follows
mysql> select *from deleteFromBaseTableDemo;
The following is the output
+----+-------+
| Id | Name  |
+----+-------+
|  1 | John  |
|  2 | Carol |
|  3 | Bob   |
+----+-------+
3 rows in set (0.00 sec)
Look at both the sample outputs, Id with value 4 has been deleted from the parent table as well as from view.
How to use quotation marks in HTML?

The <q> tag is used to add short quotation marks in HTML. Just keep in mind if the quotation goes for multiple lines, use <blockquote> tag. Browsers usually insert quotation marks around the q element.
You can also use the cite attribute to indicate the source of the quotation in URL form.
You can try the following code to add quotation marks in HTML
<!DOCTYPE html>
<html>
   <head>
      <title>HTM q tag</title>
   </head>

   <body>
      <h1>Drupal</h1>
      <p>Drupal Community says,</p>
      <q>Drupal is built on principles like collaboration, globalism, and
         innovation.</q>
   </body>
</html>
strings.EqualFold() Function in Golang With Examples - GeeksforGeeks

10 May, 2020
strings.EqualFold() Function in Golang reports whether s and t, interpreted as UTF-8 strings, are equal under Unicode case-folding, which is a more general form of case-insensitivity.
Syntax:
func EqualFold(s1, s2 string) bool

Here, s1 and s2 are string.
Return Value: It returns the boolean value.
Example 1:
// Golang program to illustrate the// strings.EqualFold() Functionpackage main  // importing fmt and stringsimport (    "fmt"    "strings")  // calling main methodfunc main() {    // case insensitive comparing and returns true.    fmt.Println(strings.EqualFold("Geeks", "Geeks"))      // case insensitive comparing and returns true.    fmt.Println(strings.EqualFold("computerscience", "computerscience"))}
Output:
true
true

Example 2:
// Golang program to illustrate the// strings.EqualFold() Functionpackage main  // importing fmt and stringsimport (    "fmt"    "strings")  // calling main methodfunc main() {      // case insensitive comparing and returns true.    fmt.Println(strings.EqualFold("Geeks", "geeks"))      // case insensitive comparing and returns true.    fmt.Println(strings.EqualFold("COMPUTERSCIENCE", "computerscience"))}
Output:
true

Golang-String
Picked
Go Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Time Durations in Golang
How to Parse JSON in Golang?
Structures in Golang
Strings in Golang
Defer Keyword in Golang
How to iterate over an Array using for loop in Golang?
Loops in Go Language
Class and Object in Golang
Rune in Golang
time.Parse() Function in Golang With Examples
Element-wise concatenation of string vector in R - GeeksforGeeks

07 Apr, 2021
Element wise concatenation of two vectors means concurrently taking values from two vectors and joining or concatenating them into one. For this paste() function is used in the R programming language.
Syntax:
paste(vector1,vector2,....,vectorn)
Where, vectors are the inputs to paste function
Example 1:
R
# create a vector named as first_namesfirst_names=c("sravan","bobby","mohan","sai")  # create a vector named as middle_namesmiddle_names=c("kumar","kumari","pavan","kumar")  # apply paste functionprint(paste(first_names,middle_names))
Output:
[1] “sravan kumar” “bobby kumari” “mohan pavan”  “sai kumar”
We can combine n vector elements at a time
Example: 2 
R
# create a vector named as first_namesfirst_names=c("sravan","bobby","mohan","sai")  # create a vector named as middle_namesmiddle_names=c("kumar","kumari","pavan","kumar")  # create a vector named as middle_nameslast_names=c("H","B","G","M")  # apply paste functionprint(paste(first_names,middle_names,last_names))
Output:
[1] “sravan kumar H” “bobby kumari B” “mohan pavan G”  “sai kumar M” 
If we do not need to give a gap between two concatenated strings use paste0() function.
Syntax:
paste0(vector1,vector2,...,vectorn)
Example:
R
# create a vector named as first_namesfirst_names=c("sravan","bobby","mohan","sai")  # create a vector named as middle_namesmiddle_names=c("kumar","kumari","pavan","kumar")  # create a vector named as middle_nameslast_names=c("H","B","G","M")  # apply paste0 function fro combining first and middlenameprint(paste0(first_names,middle_names))  # apply paste0 function fro combining first  middlename and last namesprint(paste0(first_names,middle_names,last_names))
Output:
[1] “sravankumar” “bobbykumari” “mohanpavan”  “saikumar”
[1] “sravankumarH” “bobbykumariB” “mohanpavanG”  “saikumarM” 
Picked
R Vector-Programs
R-Vectors
R Language
R Programs
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 Split Column Into Multiple Columns in R DataFrame?
How to Change Axis Scales in R Plots?
Replace Specific Characters in String in R
How to Split Column Into Multiple Columns in R DataFrame?
Replace Specific Characters in String in R
How to filter R dataframe by multiple conditions?
How to filter R DataFrame by values in a column?
Convert Matrix to Dataframe in R
Named capture groups JavaScript Regular Expressions

With JavaScript, you can group s part of regular expression. This can be done by
encapsulating characters in parentheses.
Following is an example −
 Live Demo
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<style>
   body {
      font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
   }
   .sample,.result {
      font-size: 20px;
      font-weight: 500;
   }
</style>
</head>
<body>
<h1>Named capture groups Regular Expressions</h1>
<div class="sample">The year in which i passed school was 2012.</div>
<div style="color: green;" class="result"></div>
<button class="btn">CLICK HERE</button>
<h3>
Click on the above button to extract the year using named groups
</h3>
<script>
   let sampleEle = document.querySelector(".sample").innerHTML;
   let btnEle = document.querySelector(".btn");
   let resEle = document.querySelector(".result");
   const yearRegex = /(?\d{4})/g;
   btnEle.addEventListener("click", () => {
      resEle.innerHTML = "The year = " + sampleEle.match(yearRegex);
   });
</script>
</body>
</html>
The above code will produce the following output −
On clicking the ‘CLICK HERE’ button −
MongoDB query to find data from an array inside an object?

Let us first create a collection with documents −
> db.findDataDemo.insertOne(
   {
      "_id": new ObjectId(),
      "CustomerName":"John",
      "CustomerDetails" : {
         "CountryName" : [
            "AUS"
         ],
         "isMarried" : [
            false
         ]
      }
   }
);
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5cefa5eeef71edecf6a1f6a5")
}
> db.findDataDemo.insertOne(
   {
      "_id": new ObjectId(),
      "CustomerName":"Carol",
      "CustomerDetails" : {
         "CountryName" : [
            "UK"
         ],
         "isMarried" : [
            true
         ]
      }
   }
);
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5cefa60aef71edecf6a1f6a6")
}
Display all documents from a collection with the help of find() method −
> db.findDataDemo.find().pretty();
{
   "_id" : ObjectId("5cefa5eeef71edecf6a1f6a5"),
   "CustomerName" : "John",
   "CustomerDetails" : {
      "CountryName" : [
         "AUS"
      ],
      "isMarried" : [
         false
      ]
   }
}
{
   "_id" : ObjectId("5cefa60aef71edecf6a1f6a6"),
   "CustomerName" : "Carol",
   "CustomerDetails" : {
      "CountryName" : [
         "UK"
      ],
      "isMarried" : [
         true
      ]
   }
}
Following is the query to find data from an array inside an object −
> db.findDataDemo.find({"CustomerDetails.CountryName":"UK"});
{ "_id" : ObjectId("5cefa60aef71edecf6a1f6a6"), "CustomerName" : "Carol", "CustomerDetails" : { "CountryName" : [ "UK" ], "isMarried" : [ true ] } }
C++ Passing Arrays to Functions

C++ does not allow to pass an entire array as an argument to a function. However, You can pass a pointer to an array by specifying the array's name without an index.
If you want to pass a single-dimension array as an argument in a function, you would have to declare function formal parameter in one of following three ways and all three declaration methods produce similar results because each tells the compiler that an integer pointer is going to be received.
Formal parameters as a pointer as follows −
void myFunction(int *param) {
   .
   .
   .
}

Formal parameters as a sized array as follows −
void myFunction(int param[10]) {
   .
   .
   .
}

Formal parameters as an unsized array as follows −
void myFunction(int param[]) {
   .
   .
   .
}

Now, consider the following function, which will take an array as an argument along with another argument and based on the passed arguments, it will return average of the numbers passed through the array as follows −
double getAverage(int arr[], int size) {
  int i, sum = 0;       
  double avg;          

   for (i = 0; i < size; ++i) {
      sum += arr[i];
   }
   avg = double(sum) / size;

   return avg;
}
Now, let us call the above function as follows −
#include <iostream>
using namespace std;
 
// function declaration:
double getAverage(int arr[], int size);

int main () {
   // an int array with 5 elements.
   int balance[5] = {1000, 2, 3, 17, 50};
   double avg;

   // pass pointer to the array as an argument.
   avg = getAverage( balance, 5 ) ;
 
   // output the returned value 
   cout << "Average value is: " << avg << endl; 
    
   return 0;
}
When the above code is compiled together and executed, it produces the following result −
Average value is: 214.4

As you can see, the length of the array doesn't matter as far as the function is concerned because C++ performs no bounds checking for the formal parameters.

    154 Lectures 
     11.5 hours 

 Arnab Chakraborty

    14 Lectures 
     57 mins

 Kaushik Roy Chowdhury

    30 Lectures 
     12.5 hours 

 Frahaan Hussain

    54 Lectures 
     3.5 hours 

 Frahaan Hussain

    77 Lectures 
     5.5 hours 

 Frahaan Hussain

    12 Lectures 
     3.5 hours 

 Frahaan Hussain
 Print
 Add Notes
 Bookmark this page
Check two numbers for equality in Java

To check two numbers for equality in Java, we can use the Equals() method as well as the == operator.
Firstly, let us set Integers.
Integer val1 = new Integer(5);
Integer val2 = new Integer(5);
Now, to check whether they are equal or not, let us use the == operator.
(val1 == val2)
Let us now see the complete example.
 Live Demo
public class Demo {
   public static void main( String args[] ) {
      Integer val1 = new Integer(5);
      Integer val2 = new Integer(5);
      Integer val3 = new Integer(10);
      System.out.println("Integer 1 = "+val1);
      System.out.println("Integer 2 = "+val2);
      System.out.println("Integer 3 = "+val3);
      System.out.println("val1 is equal to val2 = "+(val1 == val2));
      System.out.println("val2 is not equal to val3 = "+(val2 != val3));
   }
}
Integer 1 = 5
Integer 2 = 5
Integer 3 = 10
val1 is equal to val2 = false
val2 is not equal to val3 = true
Why do we need inner classes in Java?

Inner classes are a security mechanism in Java. We know a class cannot be associated with the access modifier private, but if we have the class as a member of other class, then the inner class can be made private. And this is also used to access the private members of a class.
Following is the program to create an inner class and access it. In the given example, we make the inner class private and access the class through a method.
 Live Demo
class Outer_Demo {
   int num;
   // inner class
   private class Inner_Demo {
      public void print() {
         System.out.println("This is an inner class");
      }
   }
   //Accessing he inner class from the method within
   void display_Inner() {
      Inner_Demo inner = new Inner_Demo();
      inner.print();
   }
}
public class My_class {
   public static void main(String args[]) {
      //Instantiating the outer class
      Outer_Demo outer = new Outer_Demo();
      
      //Accessing the display_Inner() method.
      outer.display_Inner();
   }
}
This is an inner class.
How to show multiple Canvases at the same time in Tkinter?

The Canvas widget is one of the versatile widgets in Tkinter which is used to create illustrations, draw shapes, arcs, images, and other complex layouts in an application. To create a Canvas widget, you'll need to create a constructor of canvas(root, **options).
You can use the factory functions to create text, images, arcs and define other shapes in the canvas. In some cases, if you want to create another canvas using the same canvas to keep the application workflow consistent, then you can create a button to call an event that creates another canvas.
To understand this, let us create a canvas and a button to open another canvas to update the primary canvas widget.
# Import required libraries
from tkinter import *
from tkinter import ttk

# Create an instance of tkinter window
win = Tk()
win.geometry("700x350")

# Create an instance of style class
style=ttk.Style(win)

def open_new_win():
   top=Toplevel(win)
   canvas1=Canvas(canvas, height=180, width=100, bg="#aaaffe")
   canvas1.pack()
   Label(canvas1, text="You can modify this text", font='Helvetica 18 bold').pack()

# Create a canvas widget
canvas=Canvas(win, height=400, width=300)
canvas.pack()

# Create a button widget
button=ttk.Button(canvas, text="Open Window", command=open_new_win)
button.pack(pady=30)

win.mainloop()
Running the above code will display a window with a button to open another canvas window.
When you click the button, it will display a message on the primary canvas window.
MATLAB - Set Operations

MATLAB provides various functions for set operations, like union, intersection and testing for set membership, etc.
The following table shows some commonly used set operations −
intersect(A,B)
Set intersection of two arrays; returns the values common to both A and B. The values returned are in sorted order.
intersect(A,B,'rows')
Treats each row of A and each row of B as single entities and returns the rows common to both A and B. The rows of the returned matrix are in sorted order.
ismember(A,B)
Returns an array the same size as A, containing 1 (true) where the elements of A are found in B. Elsewhere, it returns 0 (false).
ismember(A,B,'rows')
Treats each row of A and each row of B as single entities and returns a vector containing 1 (true) where the rows of matrix A are also rows of B. Elsewhere, it returns 0 (false).
issorted(A)
Returns logical 1 (true) if the elements of A are in sorted order and logical 0 (false) otherwise. Input A can be a vector or an N-by-1 or 1-by-N cell array of strings. A is considered to be sorted if A and the output of sort(A) are equal.
issorted(A, 'rows')
Returns logical 1 (true) if the rows of two-dimensional matrix A is in sorted order, and logical 0 (false) otherwise. Matrix A is considered to be sorted if A and the output of sortrows(A) are equal.
setdiff(A,B)
Sets difference of two arrays; returns the values in A that are not in B. The values in the returned array are in sorted order.
setdiff(A,B,'rows')
Treats each row of A and each row of B as single entities and returns the rows from A that are not in B. The rows of the returned matrix are in sorted order.
The 'rows' option does not support cell arrays.
setxor
Sets exclusive OR of two arrays
union
Sets union of two arrays
unique
Unique values in array
Create a script file and type the following code −
a = [7 23 14 15 9 12 8 24 35]
b = [ 2 5 7 8 14 16 25 35 27]
u = union(a, b)
i = intersect(a, b)
s = setdiff(a, b)
When you run the file, it produces the following result −
a =

    7   23   14   15    9   12    8   24   35

b =

    2    5    7    8   14   16   25   35   27

u =

    2    5    7    8    9   12   14   15   16   23   24   25   27   35

i =

    7    8   14   35

s =

    9   12   15   23   24


    30 Lectures 
     4 hours 

 Nouman Azam

    127 Lectures 
     12 hours 

 Nouman Azam

    17 Lectures 
     3 hours 

 Sanjeev

    37 Lectures 
     5 hours 

 TELCOMA Global

    22 Lectures 
     4 hours 

 TELCOMA Global

    18 Lectures 
     3 hours 

 Phinite Academy
 Print
 Add Notes
 Bookmark this page
HTML5 - Character Encodings

A character encoding is a method of converting bytes into characters. To validate or display an HTML document, a program must choose a character encoding. HTML 5 authors have three means of setting the character encoding −
If you are writing cgi or similar program then you would use HTTP Content-Type header to set any character encoding.
Following is the simple example −
print "Content-Type: text/html; charset=utf-8\r\n";

You can use a <meta> element with a charset attribute that specifies the encoding within the first 512 bytes of the HTML5 document.
Following is the simplified example −
<meta charset="UTF-8">

Above syntax replaces the need for <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> although that syntax is still allowed.
A byte order mark (BOM) consists of the character code U+FEFF at the beginning of a data stream, where it can be used as a signature defining the byte order and encoding form, primarily of unmarked plaintext files.
Many Windows programs (including Windows Notepad) add the bytes 0xEF, 0xBB, 0xBF at the start of any document saved as UTF-8. This is the UTF-8 encoding of the Unicode byte order mark (BOM), and is commonly referred to as a UTF-8 BOM even though it is not relevant to byte order.
For HTML5 document, you can use a Unicode Byte Order Mark (BOM) character at the start of the file. This character provides a signature for the encoding used.

    19 Lectures 
     2 hours 

 Anadi Sharma

    16 Lectures 
     1.5 hours 

 Anadi Sharma

    18 Lectures 
     1.5 hours 

 Frahaan Hussain

    57 Lectures 
     5.5 hours 

 DigiFisk (Programming Is Fun)

    54 Lectures 
     6 hours 

 DigiFisk (Programming Is Fun)

    45 Lectures 
     5.5 hours 

 DigiFisk (Programming Is Fun)
 Print
 Add Notes
 Bookmark this page
Math.max() function in JavaScript

The max() function of the Math object accepts multiple numbers and returns the largest numbers among them.
If you pass single number to this function it will return the same
And, if you do not pass any arguments to it will return infinity.
Its Syntax is as follows
Math.max(48, 148, 3654);
 Live Demo
<html>
<head>
   <title>JavaScript Example</title>
</head>
<body>
   <script type="text/javascript">
      var result = Math.max(48, 148, 3654);
      document.write("Maximum of the given numbers: "+result);
   </script>
</body>
</html>
Maximum of the given numbers: 3654
Structs in Rust Programming

Structs in Rust are user-defined data types. They contain fields that are used to define their particular instance.
We defined structs with the help of the struct keyword followed by the name we want for the struct. The name of the struct should describe the significance of the pieces of data that we are grouping together inside it.
struct Employee {
   id: i32,
   name: String,
   leaves: i8,
}
The above syntax contains the name of the struct and inside the curly braces, we have different fields, namely, id which is of type i32, name and leaves.
To create an instance of the Employee struct, we do something like this:
fn main() {
   let emp1 = Employee {
      id : 10602,
      name : String::from("Mukul"),
      leaves : 9
   };
   println!("{:?}",emp1);
}
Employee { id: 10602, name: "Mukul", leaves: 9 }
The above struct instance is not mutable; we can make it mutable by adding the mut keyword.
 Live Demo
#![allow(unused)]
#[derive(Debug)]
struct Employee {
   id: i32,
   name: String,
   leaves: i8,
}
fn main() {
   let mut emp1 = Employee {
      id : 10602,
      name : String::from("Mukul"),
      leaves : 9
   };
   println!("{:?}",emp1);
   emp1.id = 10603;
   println!("{:?}",emp1);
}
Employee { id: 10602, name: "Mukul", leaves: 9 }
Employee { id: 10603, name: "Mukul", leaves: 9 }
We can also have a struct in Rust that doesn’t contain any fields. They are rarely useful but can be used in combination with other features.
 Live Demo
#![allow(unused)]
#[derive(Debug)]
struct Person;
fn main() {
   let p = Person;
   println!("{:?}",p);
}
Person
The third type of structs are known as tuple structs; they contain one or more comma-separated values.
 Live Demo
#![allow(unused)]
#[derive(Debug)]
struct Color(u8, u8, u8);
fn main() {
   let white = Color(1, 1, 1);
   let Color(r, g, b) = white;
   println!("White = rgb({}, {}, {})", r, g, b);
}
White = rgb(1, 1, 1)
Python - Nested Dictionary Subset - GeeksforGeeks

11 Oct, 2020
Given a Nested Dictionary, test if another dictionary is subset.
Examples:
Input : test_dict = {“gfg”: 12, ‘best’ : {1 : 3, 4 : 3, ‘geeks’ : {8 : 7}}}, sub_dict = {8 : 7} Output : True Explanation : Required Nested dictionary present in Dictionary. 
Input : test_dict = {“gfg”: 12, ‘best’ : {1 : 3, 4 : 3, ‘geeks’ : {8 : 7}}}, sub_dict = {9 : 7} Output : False Explanation : Nested dictionary not present in Dictionary. 
Method : Using all() + any() + isinstance() + recursion
In this, We check for subset at each nesting using function, and check for all the keys matching using all(), any() is used for the utility to test for any nested possible subset matching the tested subset on the test dictionary. Each nesting is tested using recursion.
Python3
# Python3 code to demonstrate working of# Nested Dictionary Subset Python# Using all() + any() + isinstance() + recursion    def check_eq(mast_dict, subdict):    if not isinstance(mast_dict, (dict, list)):        return mast_dict == subdict    if isinstance(mast_dict, list):          # check for nesting dictionaries in list        return all(check_eq(x, y) for x, y in zip(mast_dict, subdict))      # check for all keys    return all(mast_dict.get(idx) == subdict[idx] or check_eq(mast_dict.get(idx), subdict[idx]) for idx in subdict)    def is_subset(mast_dict, subdict):    if isinstance(mast_dict, list):          # any matching dictionary in list        return any(is_subset(idx, subdict) for idx in mast_dict)      # any matching nested dictionary    return check_eq(mast_dict, subdict) or (isinstance(mast_dict, dict) and any(is_subset(y, subdict) for y in mast_dict.values()))    # initializing dictionarytest_dict = {"gfg": 12, 'best': {1: 3, 4: 3, 'geeks': {8: 7}}, 'cs': 7}  # printing original dictionaryprint("The original dictionary is : " + str(test_dict))  # initializing subset dictsub_dict = {8: 7}  # calling funcres = is_subset(test_dict, sub_dict)  # printing resultprint("Is dictionary subset : " + str(res))
Output:
The original dictionary is : {‘gfg’: 12, ‘best’: {1: 3, 4: 3, ‘geeks’: {8: 7}}, ‘cs’: 7}Is dictionary subset : True
Python dictionary-programs
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to Install PIP on Windows ?
How to drop one or multiple columns in Pandas Dataframe
How To Convert Python Dictionary To JSON?
Check if element exists in list in Python
Python | Pandas dataframe.groupby()
Defaultdict in Python
Python | Get dictionary keys as a list
Python | Split string into list of characters
Python | Convert a list to dictionary
Python program to check whether a number is Prime or not