code-rag-bench/online-tutorials huggingface dataset:
How to include a font .ttf using CSS ?

13 Aug, 2021
Adding .ttf fonts using CSS: In the late 1980s, after getting beaten by adobe’s type 1 fonts, Apple came up with a new font format type which is .ttf(True Type Font). These fonts were so awesome that, they become the most common font formats all over the world in a very short time. In fact, windows itself started using them in there operating system.
Then, if you wish to use these font formats in your web pages, here is a detailed step by step explanation, how to import and use .ttf(true type fonts) in Html using CSS.
1. Download .ttf format file: The .ttf format is quite famous nowadays, these font files are available for free on Google. You can visit font space, font squirrel, etc websites that provide these fonts for free. Keep all the files in the same folder.
2. Create a HTML file: Create a HTML file and add a h2 tag for demonstrating our font style. 
HTML
<!DOCTYPE html><html lang="en"><head>    <meta charset="UTF-8">    <meta name="viewport" content=          "width=device-width, initial-scale=1.0">    <link rel="stylesheet" href="style.css"></head><body>    <h2>This font is awesome</h2></body></html>
3. Create a CSS file: For adding external fonts through CSS, we use the @Font-face attribute property to manually define font name and giving source file. Afterward, we can access our defined font in any element required with Font-family property. 
@font-face {
    font-family: myFirstFont;
    src: url(ArianaVioleta-dz2K.ttf);
}
  
h2 {
    font-family: myFirstFont;
    color: darkgreen;
}
 Final result: This is how our font look on the browser
font in browser
If you didn’t catch the idea in the above example, let’s try with another font style.
HTML File: 
HTML
<!DOCTYPE html><html lang="en"><head>    <meta charset="UTF-8">    <meta name="viewport" content=          "width=device-width, initial-scale=1.0">    <link rel="stylesheet" href="style.css"></head><body>       <p>The font on this paragraph looks awesome</p>   </body></html>
  
CSS File: 
@font-face {
   font-family: myFirstFont;
   src: url(ChrustyRock-ORLA.ttf);
}
 
h2 {
   font-family: myFirstFont;
   color: darkgreen;
}
 
Output: 
2nd example with a new font
Supported Browser:
Google Chrome
Internet Explorer
Firefox
Opera
Safari
ysachin2314
akshaysingh98088
CSS-Misc
HTML-Misc
Picked
CSS
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Design a Tribute Page using HTML & CSS
How to set space between the flexbox ?
Build a Survey Form using HTML and CSS
Form validation using jQuery
Design a web page using HTML and CSS
REST API (Introduction)
Hide or show elements in HTML using display property
How to set the default value for an HTML <select> element ?
How to set input type date in dd-mm-yyyy format using HTML ?
HTTP headers | Content-Type
HTML <body> Tag

17 Mar, 2022
The <body> tag in HTML is used to define the main content present inside an HTML page. It is always enclosed within <html>tag. The <body> tag is the last child of <html> tag. A body tag contains starting as well as an ending tag. 
Syntax: 
<body> Body Contents... </body>
Attributes: There are many attributes in the <body> tag which are depreciated from HTML5 are listed below: 
background: It contains the URL of the background image. It is used to set the background image.
bgcolor: It is used to specify the background color of an image.
alink: It is used to specify the color of the active link.
link: It is used to specify the color of visited links.
text: It specifies the color of the text in a document.
vlink: It specifies the color of visited links.
Example : Using HTML body tag. All then content placed inside the body tag.
HTML
<!DOCTYPE html><html>  <!-- body tag starts here --><body>    <h1>GeeksforGeeks</h1>    <h2>body Tag</h2>      <p>This is paragraph text</p>    </body><!-- body tag ends here -->  </html>
Output:  
Example 2: Example to show the functioning of a Body tag along with its CSS implementation.
HTML
<!DOCTYPE html><html>  <!-- style on the body tag --><!-- body tag starts here --><body style="background-color:seagreen">    <h1>GeeksforGeeks</h1>    <h2>HTML body Tag</h2>      <p>This is paragraph Tag</p>  </body><!-- body tag ends here --></html>
Output:  
Supported Browsers: 
Google Chrome
Internet Explorer
Firefox
Opera
Safari
shubhamyadav4
HTML-Tags
Picked
HTML
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to update Node.js and NPM to next version ?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to insert spaces/tabs in text using HTML/CSS?
REST API (Introduction)
Hide or show elements in HTML using display property
How to set the default value for an HTML <select> element ?
How to set input type date in dd-mm-yyyy format using HTML ?
CSS to put icon inside an input element in a form
Design a Tribute Page using HTML & CSS
Types of CSS (Cascading Style Sheet)
MongoDB – Equality Operator $eq

27 Mar, 2020
MongoDB provides different types of comparison operators and an equality operator($eq) is one of them. The equality operator( $eq ) is used to match the documents where the value of the field is equal to the specified value. In other words, the $eq operator is used to specify the equality condition.
Important Points:
If the given value is a document, then the order of the fields in the document is important.
If the given value is an array, then MongoDB matches the documents where the field contains an element that exactly matches the specified array.
Syntax:
{field: {$eq: value}}
or
{field: value}


In the following examples, we are working with:
Database: GeeksforGeeksCollection: employeeDocument: five documents that contain the details of the employees in the form of field-value pairs.
 Example #1:In this example, we are selecting those documents where the value of the salary field is equal to 30000.
db.employee.find({salary: {$eq: 30000}}).pretty()
It is equivalent to –
db.employee.find({salary: 30000}).pretty()
 Example #2:In this example, we are selecting those documents where the first name of the employee is equal to Amu. or in other words, in this example, we are specifying conditions on the field in the embedded document using dot notation.
db.employee.find({"name.first": {$eq: "Amu"}}).pretty()
It is equivalent to:
db.employee.find({"name.first": "Amu"}).pretty()
 Example #3:In this example, we are selecting those documents where the language array contains an element with value “C++”.
db.employee.find({language: {$eq: "C++"}}).pretty()
It is equivalent to:
db.employee.find({language: "C++"}).pretty()
 Example #4:In this example, we are selecting those documents where the language array is equal to the specified array.
db.employee.find({language: {$eq: ["C#", "Java"]}}).pretty()
It is equivalent to:
db.employee.find({language:["C#", "Java"]}).pretty()
MongoDB
Advanced Computer Subject
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
ML | Monte Carlo Tree Search (MCTS)
Copying Files to and from Docker Containers
Basics of API Testing Using Postman
Markov Decision Process
Getting Started with System Design
Principal Component Analysis with Python
How to create a REST API using Java Spring Boot
Monolithic vs Microservices architecture
Mounting a Volume Inside Docker Container
Fuzzy Logic | Introduction
cksum command in Linux with examples

15 May, 2019
cksum command in Linux is used to display a CRC(Cyclic Redundancy Check) value, the byte size of the file and the name of the file to standard output. CRC is unique for each file and only changes if the file is edited. It is used to check whether the file had accidentally corrupted while transfer. If the CRC is same after the transfer, it means that the file had not accidentally corrupted.
Syntax:
cksum [FileName]
Note: An intruder can corrupt a file in such a way that it produces the same CRC value after the transfer. That is why it is only checked for accidental corruption.
Options:
–help : It displays help information.–version : It displays version information.
–help : It displays help information.
–version : It displays version information.
linux-command
Linux-file-commands
Picked
Technical Scripter 2018
Linux-Unix
Technical Scripter
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Docker - COPY Instruction
scp command in Linux with Examples
chown command in Linux with Examples
SED command in Linux | Set 2
mv command in Linux with examples
nohup Command in Linux with Examples
chmod command in Linux with examples
Introduction to Linux Operating System
Array Basics in Shell Scripting | Set 1
Basic Operators in Shell Scripting
GATE | Gate IT 2008 | Question 69

16 Nov, 2020
A Binary Search Tree (BST) stores values in the range 37 to 573. Consider the following sequence of keys.
I.  81, 537, 102, 439, 285, 376, 305
II. 52, 97, 121, 195, 242, 381, 472
III. 142, 248, 520, 386, 345, 270, 307
IV. 550, 149, 507, 395, 463, 402, 270 
Suppose the BST has been unsuccessfully searched for key 273. Which all of the above sequences list nodes in the order in which we could have encountered them in the search?(A) II and III only(B) I and III only(C) III and IV only(D) III onlyAnswer: (D)Explanation: Key to be searched 273:
I) 81, 537, 102, 439, 285, 376, 305 is not correctWe cannot go to 376 from 285 as 273 is smaller than 285.
II) 52, 97, 121, 195, 242, 381, 472 is not correct.We cannot go to 472 from 381 as 273 is smaller than 381.
III) 142, 248, 520, 386, 345, 270, 307 is correct
550, 149, 507, 395, 463, 402, 270 is not correct.We cannot go to 463 from 395 in search of 273
Following representation of the binary search trees is given below.
Quiz of this Question
vivekyemul786
Gate IT 2008
GATE-Gate IT 2008
GATE
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
GATE | GATE-CS-2014-(Set-2) | Question 65
GATE | Sudo GATE 2020 Mock I (27 December 2019) | Question 33
GATE | GATE-CS-2015 (Set 3) | Question 65
GATE | GATE-CS-2014-(Set-3) | Question 65
GATE | GATE CS 2008 | Question 40
GATE | GATE CS 1996 | Question 63
GATE | GATE-CS-2015 (Set 2) | Question 55
GATE | GATE-CS-2004 | Question 31
GATE | GATE-CS-2001 | Question 50
GATE | GATE CS 1996 | Question 38
How to remove a column from an R data frame?

This can be easily done by using subset function.
> df <- data.frame(x=1:5, y=6:10, z=11:15, a=16:20)
> df
x  y  z  a
1 1 6 11 16
2 2 7 12 17
3 3 8 13 18
4 4 9 14 19
5 5 10 15 20
To remove only one column
> df <- subset (df, select = -x)
> df
y z a
1 6 11 16
2 7 12 17
3 8 13 18
4 9 14 19
5 10 15 20
To remove two columns
> df <- data.frame(x=1:5, y=6:10, z=11:15, a=16:20)
> df <- subset (df, select = -c(x,y))
> df
z a
1 11 16
2 12 17
3 13 18
4 14 19
5 15 20
To remove a range of columns
> df <- data.frame(x=1:5, y=6:10, z=11:15, a=16:20)
> df <- subset (df, select = -c(x:z))
> df
a
1 16
2 17
3 18
4 19
5 20
To remove separate columns
> df <- data.frame(x=1:5, y=6:10, z=11:15, a=16:20)
> df <- subset (df, select = -c(x,z:a))
> df
y
1 6
2 7
3 8
4 9
5 10
OpenCV - Morphological Operations

In the earlier chapters, we discussed the process of erosion and dilation. In addition to these two, OpenCV has more morphological transformations. The morphologyEx() of the method of the class Imgproc is used to perform these operations on a given image.
Following is the syntax of this method −
morphologyEx(src, dst, op, kernel)

This method accepts the following parameters −
src − An object of the class Mat representing the source (input) image.
src − An object of the class Mat representing the source (input) image.
dst − object of the class Mat representing the destination (output) image.
dst − object of the class Mat representing the destination (output) image.
op − An integer representing the type of the Morphological operation.
op − An integer representing the type of the Morphological operation.
kernel − A kernel matrix.
kernel − A kernel matrix.
The following program demonstrates how to apply the morphological operation "top-hat" on an image using OpenCV library.
import org.opencv.core.Core;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.imgproc.Imgproc;

public class MorphologyExTest {
   public static void main(String args[]) {
      // Loading the OpenCV core library
      System.loadLibrary( Core.NATIVE_LIBRARY_NAME );

      // Reading the Image from the file and storing it in to a Matrix object
      String file ="E:/OpenCV/chap12/morph_input.jpg";
      Mat src = Imgcodecs.imread(file);

      // Creating an empty matrix to store the result
      Mat dst = new Mat();

      // Creating kernel matrix
      Mat kernel = Mat.ones(5,5, CvType.CV_32F);

      // Applying Blur effect on the Image 
      Imgproc.morphologyEx(src, dst, Imgproc.MORPH_TOPHAT, kernel);

      // Writing the image
      Imgcodecs.imwrite("E:/OpenCV/chap12/morph_tophat.jpg", dst);

      System.out.println("Image Processed");
   } 
}
Assume that following is the input image morph_input.jpg specified in the above program.
On executing the program, you will get the following output −
Image Processed

If you open the specified path, you can observe the output image as follows −
In addition to the morphological operation TOPHAT, demonstrated in the previous example, OpenCV caters various other types of morphologies. All these types are represented by predefined static fields (fixed values) of Imgproc class.
You can choose the type of the morphology you need by passing their respective predefined value to the parameter op of the morphologyEx() method.
// Applying Blur effect on the Image
Imgproc.morphologyEx(src, dst, Imgproc.MORPH_TOPHAT, kernel);

Following are the values representing the type of morphological operations and their respective outputs.

    70 Lectures 
     9 hours 

 Abhilash Nelson

    41 Lectures 
     4 hours 

 Abhilash Nelson

    20 Lectures 
     2 hours 

 Spotle Learn

    12 Lectures 
     46 mins

 Srikanth Guskra

    19 Lectures 
     2 hours 

 Haithem Gasmi

    67 Lectures 
     6.5 hours 

 Gianluca Mottola
 Print
 Add Notes
 Bookmark this page
How can we insert a new row into a MySQL table?

With the help of INSERT INTO command, a new row can be inserted into a table.
INSERT INTO table_name values(value1,value2,...)
Suppose we have a table named ‘Employee’ with three columns ‘Emp_id’, ‘Emp_name’ and ‘Emp_Sal’ then with the help of following query we can add new rows to the table −
mysql> INSERT INTO Employee values(110,'Aarav',50000);
Query OK, 1 row affected (0.07 sec)

mysql> INSERT INTO Employee values(200,'Raman',28000);
Query OK, 1 row affected (0.10 sec)

mysql> Select * from Employee;
+---------+-------------+-----------+
| Emp_id  | Emp_name    | Emp_sal   |
+---------+-------------+-----------+
| 110     |Aarav        | 50000     |
| 200     | Raman       | 28000     |
+---------+-------------+-----------+
2 rows in set (0.00 sec)
Salesforce - Variables & Formulas

The data from the Salesforce objects can be brought into the Visualforce page using variables and expressions. Like other normal programming language, the Visualforce language has expressions, operators and literals, etc. The basic building block of this language is expressions.
The syntax of a Visualforce expression is as below.
{! expression }

Let us use the global variable $user. We can write the following code to get the username, First name and login name.
On previewing the output, we get the following details.
Similarly, we can use many other variables and manipulate them using formula as shown in the code below.
On previewing the output, we get the following details.

    49 Lectures 
     3.5 hours 

 Manigandan Jagadeesan

    113 Lectures 
     13 hours 

 Eduonix Learning Solutions

    37 Lectures 
     3 hours 

 Manish Choudhari

    22 Lectures 
     4.5 hours 

 Pranjal Srivastava

    43 Lectures 
     7 hours 

 Debasis Jena

    54 Lectures 
     8 hours 

 SYED CHAND SHAH
 Print
 Add Notes
 Bookmark this page
How to wrap long lines in Python?

The preferred way of wrapping long lines is by using Python's implied line continuation inside parentheses, brackets and braces. If necessary, you can add an extra pair of parentheses around an expression, but sometimes using a backslash looks better. Make sure to indent the continued line appropriately. The preferred place to break around a binary operator is after the operator, not before it. 
 Example of paranthesized line break:
 list(
    "Hello"
    )
This will give the output:
['H', 'e','l', 'l', 'o']
 Example of back-slashed line break:
 print 'This s a really long line,', \
    'but we can make it across multiple lines.'
 This will give the output:
This is a really long line, but we can make it across multiple lines.
 Both of these can be used, you may choose to use either depending on which looks more readable to you.
Prolog - Towers of Hanoi Problem

Towers of Hanoi Problem is a famous puzzle to move N disks from the source peg/tower to the target peg/tower using the intermediate peg as an auxiliary holding peg. There are two conditions that are to be followed while solving this problem −
A larger disk cannot be placed on a smaller disk.
A larger disk cannot be placed on a smaller disk.
Only one disk can be moved at a time.
Only one disk can be moved at a time.
The following diagram depicts the starting setup for N=3 disks.
To solve this, we have to write one procedure move(N, Source, Target, auxiliary). Here N number of disks will have to be shifted from Source peg to Target peg keeping Auxiliary peg as intermediate.
For example – move(3, source, target, auxiliary).
Move top disk from source to target
Move top disk from source to target
Move top disk from source to auxiliary
Move top disk from source to auxiliary
Move top disk from target to auxiliary
Move top disk from target to auxiliary
Move top disk from source to target
Move top disk from source to target
Move top disk from auxiliary to source
Move top disk from auxiliary to source
Move top disk from auxiliary to target
Move top disk from auxiliary to target
Move top disk from source to target
Move top disk from source to target
move(1,X,Y,_) :-
   write('Move top disk from '), write(X), write(' to '), write(Y), nl.
move(N,X,Y,Z) :-
   N>1,
   M is N-1,
   move(M,X,Z,Y),
   move(1,X,Y,_),
   move(M,Z,Y,X).
| ?- [towersofhanoi].
compiling D:/TP Prolog/Sample_Codes/towersofhanoi.pl for byte code...
D:/TP Prolog/Sample_Codes/towersofhanoi.pl compiled, 8 lines read - 1409 bytes written, 15 ms

yes
| ?- move(4,source,target,auxiliary).
Move top disk from source to auxiliary
Move top disk from source to target
Move top disk from auxiliary to target
Move top disk from source to auxiliary
Move top disk from target to source
Move top disk from target to auxiliary
Move top disk from source to auxiliary
Move top disk from source to target
Move top disk from auxiliary to target
Move top disk from auxiliary to source
Move top disk from target to source
Move top disk from auxiliary to target
Move top disk from source to auxiliary
Move top disk from source to target
Move top disk from auxiliary to target

true ?

(31 ms) yes


    65 Lectures 
     5 hours 

 Arnab Chakraborty

    78 Lectures 
     7 hours 

 Arnab Chakraborty
 Print
 Add Notes
 Bookmark this page
How animate(), hide and show elements using jQuery?

Use the hide() and show() method with animate() to hide and show elements.
You can try to run the following code to learn how to work with animate() method to hide and show elements:
Live Demo
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $("#btn1").click(function(){
        $("#box").animate({height: "300px"}, 500, function() {
           $(this).hide();
        });
    });
   $("#btn2").click(function(){
        $("#box").animate({height: "300px"}, 500, function() {
           $(this).show();
        });
    });
});
</script>
</head>
<body>

<button id="btn1">Hide</button>
<button id="btn2">Show</button>

<div id="box" style="background:#000000;height:300px;width:100px;margin:10px;"></div>

</body>
</html>
Split the array into equal sum parts according to given conditions in C++

Here we will see one problem. Suppose one array arr is given. We have to check whether the array can be split into two parts, such that −
Sub of both sub-arrays will be the same
All elements, which are multiple of 5, will be in the same group
All elements which are multiple of 3, but not multiple of 5, will be in the same group
All other elements will be in other groups.
Suppose the array elements are {1, 4, 3}, then this can be split, because the sum of {1, 3} is the same as the sum of {4}, and the groups are also correct for the given condition.
isSplitArray(arr, n, start, left_sum, right_sum) −
Begin
   if start = n, then return true when left_sum = right_sum, otherwise false
   if arr[start] is divisible by 5, then add arr[start] with the left_sum
   else if arr[start] is divisible by 3, then add arr[start] with the right_sum
   else
      return isSplitArray(arr, n, start + 1, left_sum + arr[start], right_sum) OR isSplitArray(arr, n, start + 1, left_sum, right_sum + arr[start])
   isSplitArray(arr, n, start + 1, left_sum, right_sum)
End
 Live Demo
#include <iostream>
using namespace std;
bool isSplitArray(int* arr, int n, int start, int left_sum, int right_sum) {
   if (start == n) //when it reaches at the end
      return left_sum == right_sum;
   if (arr[start] % 5 == 0) //when the element is divisible by 5, add to left sum
      left_sum += arr[start];
   else if (arr[start] % 3 == 0) //when the element is divisible by 3 but not 5, add to right sum
         right_sum += arr[start];
   else // otherwise it can be added to any of the sub-arrays
         return isSplitArray(arr, n, start + 1, left_sum + arr[start], right_sum) || isSplitArray(arr, n, start + 1, left_sum, right_sum + arr[start]);
   // For cases when element is multiple of 3 or 5.
   return isSplitArray(arr, n, start + 1, left_sum, right_sum);
}
int main() {
   int arr[] = {1, 4, 3};
   int n = sizeof(arr)/sizeof(arr[0]);
   if(isSplitArray(arr, n, 0, 0, 0)){
      cout <<"Can be split";
   } else {
      cout <<"Can not be split";
   }
}
Can be split
Program to find maximum in generated array in Python

Suppose we have a number n. We have to generate an array A of length n + 1 in the following way −
A[0] = 0
A[0] = 0
A[1] = 1
A[1] = 1
A[2 * i] = A[i] if 2 <= 2 * i <= n
A[2 * i] = A[i] if 2 <= 2 * i <= n
A[2 * i + 1] = A[i] + A[i + 1] if 2 <= 2 * i + 1 <= n
A[2 * i + 1] = A[i] + A[i + 1] if 2 <= 2 * i + 1 <= n
Finally we have to find the maximum number in the array nums.
So, if the input is like n = 5, then the output will be 3 because
A[0] = 0
A[0] = 0
A[1] = 1
A[1] = 1
A[2] = A[1] = 1
A[2] = A[1] = 1
A[3] = A[1] + A[2] = 1 + 1 = 2
A[3] = A[1] + A[2] = 1 + 1 = 2
A[4] = A[2]= 1
A[4] = A[2]= 1
A[5] = A[2] + A[3] = 1 + 2 = 3
A[5] = A[2] + A[3] = 1 + 2 = 3
A[6] = A[3] = 2
A[6] = A[3] = 2
So the maximum is 3
To solve this, we will follow these steps −
A := a new list from 0 to n
A := a new list from 0 to n
for each element i in A, doif i is same as 0 or i is same as 1, thengo to next iterationotherwise when i is even, thenA[i] := A[integer of i/2]otherwise,A[i] := A[integer of i/2] + A[(integer of i/2) + 1]
for each element i in A, do
if i is same as 0 or i is same as 1, thengo to next iteration
if i is same as 0 or i is same as 1, then
go to next iteration
go to next iteration
otherwise when i is even, thenA[i] := A[integer of i/2]
otherwise when i is even, then
A[i] := A[integer of i/2]
A[i] := A[integer of i/2]
otherwise,A[i] := A[integer of i/2] + A[(integer of i/2) + 1]
otherwise,
A[i] := A[integer of i/2] + A[(integer of i/2) + 1]
A[i] := A[integer of i/2] + A[(integer of i/2) + 1]
return maximum element of A
return maximum element of A
Let us see the following implementation to get better understanding −
 Live Demo
def solve(n):
   A = list(range(0,n+1))
   for i in A:
      if i == 0 or i == 1:
         continue
      elif i%2 == 0:
         A[i] = A[i//2]
      else:
         A[i] = A[i//2] + A[(i//2) + 1]
   return max(A)

n = 5
print(solve(n))
5
3
SQL Query to Display Last 50% Records from Employee Table - GeeksforGeeks

13 Apr, 2021

Here, we are going to see how to display the last 50% of records from an Employee Table in MySQL and MS SQL server’s databases.
For the purpose of demonstration, we will be creating an Employee table in a database called “geeks“.
Use the below SQL statement to create a database called geeks:
CREATE DATABASE geeks;
USE geeks;
We have the following Employee table in our geeks database :
CREATE TABLE Employee(
ID INT IDENTITY(1,1) KEY,     --IDENTITY(1,1) tells start ID from 1 and increment
                            -- it by 1 with each row inserted.
NAME VARCHAR(30) NOT NULL,
PHONE INT NOT NULL UNIQUE,
EMAIL VARCHAR(30) NOT NULL UNIQUE,
DATE_OF_JOINING DATE);
NOTE: We should use VARCHAR or BIGINT as the data type for the PHONE column to avoid integer overflow.
You can use the below statement to query the description of the created table:
EXEC SP_COLUMNS Employee;
Use the below statement to add data to the Employee table:
INSERT INTO Employee (NAME, PHONE, EMAIL, DATE_OF_JOINING)
VALUES
('Yogesh Vaishnav', 0000000001, 'yogesh@mail.com', '2019-10-03'),
('Vishal Vishwakarma', 0000000002, 'chicha@mail.com', '2019-11-07'),
('Ajit Yadav', 0000000003, 'ppa@mail.com', '2019-12-12'),
('Ashish Yadav', 0000000004, 'baba@mail.com', '2019-12-25'),
('Tanvi Thakur', 0000000005, 'tanvi@mail.com', '2020-01-20'),
('Sam', 0000000006, 'sam@mail.com', '2020-03-03'),
('Ron', 0000000007, 'ron@mail.com', '2020-05-16'),
('Sara', 0000000008, 'sara@mail.com', '2020-07-01'),
('Zara', 0000000009, 'zara@mail.com', '2020-08-20'),
('Yoji', 0000000010, 'yoji@mail.com', '2020-03-10'),
('Rekha Vaishnav', 12, 'rekha@mail.com', '2021-03-25');
To verify the contents of the table use the below statement:
SELECT * FROM Employee;
Now let’s retrieve the last 50% of the records from the Employee Table.
In MS SQL we can directly retrieve the last 50% of the records with the help of top and percent and order by clauses. A simple syntax for the same is given below:
Syntax :
select * from 
  /*Gives the top N percent records from bottom of a database table*/
(select top N percent * from <table_name> order by <column_name> desc)<identifier>
order by <column_name>;
Example :
SELECT * FROM
(SELECT top 50 percent * FROM Employee ORDER BY ID DESC)
ORDER BY ID;
Output :

Picked


SQL-Query


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?
SQL Query to Find the Name of a Person Whose Name Starts with Specific Letter
Composite Key in SQL
SQL using Python
SQL | DROP, TRUNCATE
SQL indexes
SQL | Date functions
What is Temporary Table in SQL?
Window functions in SQL
How to Concat Two Columns Into One With the Existing Column Name in MySQL?
QTP - Data Table Object Methods

Consider the following DataTable −
'Accessing Datatable to get Row Count and Column Count
rowcount = DataTable.GetSheet("Global").GetRowCount
msgbox rowcount      ' Displays 4
  
colcount = DataTable.GetSheet("Global").GetParameterCount
msgbox colcount		 ' Displays 3
  
DataTable.SetCurrentRow(2) 
val_rate = DataTable.Value("Rate","Global")
print val_rate   ' Displays 7%
  
val_ppl = DataTable.Value("Principal","Global")
print val_ppl	 ' Displays 2556
  
val_Time = DataTable.Value("Time","Global")
print val_Time	 ' Displays 5

    108 Lectures 
     8 hours 

 Pavan Lalwani
 Print
 Add Notes
 Bookmark this page
How to implement reactive streams using Flow API in Java 9?

Flow API is official support for reactive streams specification since Java 9. It is a combination of both Iterator and Observer patterns. The Flow API is an interoperation specification and not an end-user API like RxJava.
Flow API consists of four basic interfaces:
Subscriber: The Subscriber subscribes to Publisher for callbacks.
Publisher: The Publisher publishes the stream of data items to the registered subscribers.
Subscription: The link between publisher and subscriber.
Processor: The processor sits between Publisher and Subscriber, and transforms one stream to another.
In the below example, we have created a basic subscriber that asks for one data object, prints it and asks for one more. We can use a publisher implementation provided by Java (SubmissionPublisher) to complete our session.
import java.util.concurrent.Flow;
import java.util.List;
import java.util.concurrent.SubmissionPublisher;

class MySubscriber<T>implements Flow.Subscriber<T> {
   private Flow.Subscription subscription;
   @Override
   public void onSubscribe(Flow.Subscription subscription) {
      this.subscription = subscription;
      this.subscription.request(1);
   }
   @Override
   public void onNext(T item) {
      System.out.println(item);
      subscription.request(1);
   }
   @Override
   public void onError(Throwable throwable) {
      throwable.printStackTrace();
   }
   @Override
   public void onComplete() {
      System.out.println("Done");
   }
}

// main class
public class FlowTest {
   public static void main(String args[]) {
      List<String> items = List.of("1", "2", "3", "4", "5", "6", "7", "8", "9", "10");
      SubmissionPublisher<String> publisher = new SubmissionPublisher<>();
      publisher.subscribe(new MySubscriber<>());
      items.forEach(s -> {
         try {
            Thread.sleep(1000);
         } catch (InterruptedException e) {
            e.printStackTrace();
         }
         publisher.submit(s);
      });
      publisher.close();
   }
}
1
2
3
4
5
6
7
8
9
10
Done
How to print the largest value from Python dictionary?

Python's built-in dictionary class has values() method which returns list of value component from each key-value pair. Using built-in function max() the largest value in the dictionary can be obtained
>>> dct={1:45,2:76,3:12,4:55,5:33}
>>> vlist=dct.values()
>>> vlist
dict_values([45, 76, 12, 55, 33])
>>> max(vlist)
76
Implementation of lower_bound() and upper_bound() in Vector of Pairs in C++

27 May, 2022
In this article we will discuss the implementation of the lower_bound() and upper_bound() in vector of pairs. 
lower_bound(): It returns an iterator pointing to the first element in the range [first, last) which has a value greater than or equals to the given value “val”. But in Vector of Pairs lower_bound() for pair(x, y) will return an iterator pointing to the position of pair whose the first value is greater than or equals x and second value is greater than equals to y. If the above-mentioned criteria are not met, then it returns an iterator to the index which out of the vectors of pairs.  
upper_bound(): It returns an iterator pointing to the first element in the range [first, last) which has a value greater than the given value “val”. But in Vector of Pairs upper_bound() for pair(x, y) will return an iterator pointing to the position of the pair whosefirst value is equal to x and second value is greater than y.orWhose first value is greater than x. 
first value is equal to x and second value is greater than y.or
Whose first value is greater than x. 
Below is the program to demonstrate lower_bound() and upper_bound() in vector of pairs:Program 1:  
CPP
// C++ program to demonstrate lower_bound()// and upper_bound() in Vectors of Pairs #include <bits/stdc++.h>using namespace std; // Function to implement lower_bound()void findLowerBound(vector<pair<int, int> >& arr,                    pair<int, int>& p){    // Given iterator points to the    // lower_bound() of given pair    auto low = lower_bound(arr.begin(), arr.end(), p);     cout << "lower_bound() for {2, 5}"         << " is at index: " << low - arr.begin() << endl;} // Function to implement upper_bound()void findUpperBound(vector<pair<int, int> >& arr,                    pair<int, int>& p){    // Given iterator points to the    // upper_bound() of given pair    auto up = upper_bound(arr.begin(), arr.end(), p);     cout << "upper_bound() for {2, 5}"         << " is at index: " << up - arr.begin() << endl;} // Driver Codeint main(){    // Given sorted vector of Pairs    vector<pair<int, int> > arr;    arr = { { 1, 3 }, { 1, 7 }, { 2, 4 },            { 2, 5 }, { 3, 8 }, { 8, 6 } };     // Given pair {2, 5}    pair<int, int> p = { 2, 5 };     // Function Call to find lower_bound    // of pair p in arr    findLowerBound(arr, p);     // Function Call to find upper_bound    // of pair p in arr    findUpperBound(arr, p);     return 0;}
lower_bound() for {2, 5} is at index: 3
upper_bound() for {2, 5} is at index: 4
ShubhamDamkondwar
bhuwanesh
cpp-pair
cpp-vector
C++
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Split large Pandas Dataframe into list of smaller Dataframes

05 Sep, 2020
In this article, we will learn about the splitting of large dataframe into list of smaller dataframes. This can be done mainly in two different ways :
By splitting each rowUsing the concept of groupby
By splitting each row
Using the concept of groupby
Here we use a small dataframe to understand the concept easily and this can also be implemented in an easy way. The Dataframe consists of student id, name, marks, and grades. Let’s create the dataframe.
Python3
# importing packagesimport pandas as pd  # dictionary of datadct = {'ID': {0: 23, 1: 43, 2: 12,              3: 13, 4: 67, 5: 89,              6: 90, 7: 56, 8: 34},                'Name': {0: 'Ram', 1: 'Deep',                2: 'Yash', 3: 'Aman',                4: 'Arjun', 5: 'Aditya',                6: 'Divya', 7: 'Chalsea',                8: 'Akash'},                'Marks': {0: 89, 1: 97, 2: 45, 3: 78,                 4: 56, 5: 76, 6: 100, 7: 87,                 8: 81},                'Grade': {0: 'B', 1: 'A', 2: 'F', 3: 'C',                 4: 'E', 5: 'C', 6: 'A', 7: 'B',                 8: 'B'}       }  # create dataframedf = pd.DataFrame(dct)  # view dataframedf
Output:
Below is the implementation of the above concepts with some examples :
Example 1: By splitting each row
Here, we use the loop of iteration for each row. Every row is accessed by using DataFrame.loc[] and stored in a list. This list is the required output which consists of small DataFrames. In this example, the dataset (consists of 9 rows data) is divided into smaller dataframes by splitting each row so the list is created of 9 smaller dataframes as shown below in output.
Python3
# split dataframe by rowsplits = [df.loc[[i]] for i in df.index]  # view splitted dataframeprint(splits)  # check datatype of smaller dataframeprint(type(splits[0]))  # view smaller dataframeprint(splits[0])
Output:
Example 2: Using Groupby
Here, we use the DataFrame.groupby() method for splitting the dataset by rows. The same grouped rows are taken as a single element and stored in a list. This list is the required output which consists of small DataFrames. In this example, the dataset (consists of 9 rows data) is divided into smaller dataframes using groupby method on column “Grade”. Here, the total number of distinct grades is 5 so the list is created of 5 smaller dataframes as shown below in output.
Python3
# split dataframe using gropubysplits = list(df.groupby("Grade"))  # view splitted dataframeprint(splits)  # check datatype of smaller dataframeprint(type(splits[0][1]))  # view smaller dataframeprint(splits[0][1])
Output:
Python pandas-dataFrame
Python Pandas-exercise
Python-pandas
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Different ways to create Pandas Dataframe
Enumerate() in Python
Read a file line by line in Python
Python String | replace()
How to Install PIP on Windows ?
*args and **kwargs in Python
Python Classes and Objects
Iterate over a list in Python
Python OOPs Concepts
How to use xPath in Selenium WebDriver to grab SVG elements?

We can use xpath to grab SVG elements with Selenium webdriver. A SVG element is identified with tagname svg. The svg image has the attributes like width and height attributes.
Let us investigate the html code of a svg element.
To create a xpath for a svg element, we have the syntax as //*[local-name()='svg'].
The local-name function is mandatory for creating a xpath of a svg element. So for the xpath expression for the image highlighted in the above image should be −
//*[local-name()='svg' and @data-icon='home']/*[local-name()='path']
Here, data-icon is an attribute of the svg tag element which is added accompanied with @ symbol. The [local-name()='path'] is included since it is the child of the svg tagname.
Let us validate the xpath we have created, within the Console tab.
The image which is a SVG element before the Home menu gets highlighted with our XPath.
Code Implementation.
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import java.util.concurrent.TimeUnit;
public class SVGElement{
   public static void main(String[] args) {
      System.setProperty("webdriver.chrome.driver", "C:\\Users\\ghs6kor\\Desktop\\Java\\chromedriver.exe");
      WebDriver driver = new ChromeDriver();
      // wait of 5 seconds
      driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
      driver.get("https://www.tutorialspoint.com/index.htm");
      // identify element
      WebElement m= driver.findElement(By.xpath("//*[local-name()='svg' and @dataicon='home']/*[local-name()='path']"));
      // Action class to move and click element
      Actions act = new Actions(driver);
      act.moveToElement(m).
      click().build().perform();
      driver.quit();
   }
}
Binning in Data Mining

15 Jun, 2022
Data binning, bucketing is a data pre-processing method used to minimize the effects of small observation errors. The original data values are divided into small intervals known as bins and then they are replaced by a general value calculated for that bin. This has a smoothing effect on the input data and may also reduce the chances of overfitting in the case of small datasetsThere are 2 methods of dividing data into bins:  
Equal Frequency Binning: bins have an equal frequency.Equal Width Binning : bins have equal width with a range of each bin are defined as [min + w], [min + 2w] .... [min + nw] where w = (max – min) / (no of bins).
Equal Frequency Binning: bins have an equal frequency.
Equal Width Binning : bins have equal width with a range of each bin are defined as [min + w], [min + 2w] .... [min + nw] where w = (max – min) / (no of bins).
Equal frequency: 
Input:[5, 10, 11, 13, 15, 35, 50, 55, 72, 92, 204, 215] 

Output:
[5, 10, 11, 13]
[15, 35, 50, 55]
[72, 92, 204, 215]
Equal Width:  
Input: [5, 10, 11, 13, 15, 35, 50, 55, 72, 92, 204, 215]

Output:
[5, 10, 11, 13, 15, 35, 50, 55, 72]
[92]
[204, 215]
Code : Implementation of Binning Technique: 
Python
# equal frequencydef equifreq(arr1, m):        a = len(arr1)    n = int(a / m)    for i in range(0, m):        arr = []        for j in range(i * n, (i + 1) * n):            if j >= a:                break            arr = arr + [arr1[j]]        print(arr)  # equal widthdef equiwidth(arr1, m):    a = len(arr1)    w = int((max(arr1) - min(arr1)) / m)    min1 = min(arr1)    arr = []    for i in range(0, m + 1):        arr = arr + [min1 + w * i]    arri=[]          for i in range(0, m):        temp = []        for j in arr1:            if j >= arr[i] and j <= arr[i+1]:                temp += [j]        arri += [temp]    print(arri)   # data to be binneddata = [5, 10, 11, 13, 15, 35, 50, 55, 72, 92, 204, 215]  # no of binsm = 3   print("equal frequency binning")equifreq(data, m)  print("\n\nequal width binning")equiwidth(data, 3)
Output : 
equal frequency binning
[5, 10, 11, 13]
[15, 35, 50, 55]
[72, 92, 204, 215]


equal width binning
[[5, 10, 11, 13, 15, 35, 50, 55, 72], [92], [204, 215]] 
vc17srimouli
Kumaramit2000
sumitgumber28
Machine Learning
Python
Machine Learning
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
ML | Linear Regression
Decision Tree Introduction with example
Search Algorithms in AI
Getting started with Machine Learning
Support Vector Machine Algorithm
Read JSON file using Python
Python map() function
Adding new column to existing DataFrame in Pandas
Python Dictionary
How to get column names in Pandas dataframe
SQL - Distinct Keyword

The SQL DISTINCT keyword is used in conjunction with the SELECT statement to eliminate all the duplicate records and fetching only unique records.
There may be a situation when you have multiple duplicate records in a table. While fetching such records, it makes more sense to fetch only those unique records instead of fetching duplicate records.
The basic syntax of DISTINCT keyword to eliminate the duplicate records is as follows −
SELECT DISTINCT column1, column2,.....columnN 
FROM table_name
WHERE [condition]

Consider the CUSTOMERS table having the following records −
+----+----------+-----+-----------+----------+
| ID | NAME     | AGE | ADDRESS   | SALARY   |
+----+----------+-----+-----------+----------+
|  1 | Ramesh   |  32 | Ahmedabad |  2000.00 |
|  2 | Khilan   |  25 | Delhi     |  1500.00 |
|  3 | kaushik  |  23 | Kota      |  2000.00 |
|  4 | Chaitali |  25 | Mumbai    |  6500.00 |
|  5 | Hardik   |  27 | Bhopal    |  8500.00 |
|  6 | Komal    |  22 | MP        |  4500.00 |
|  7 | Muffy    |  24 | Indore    | 10000.00 |
+----+----------+-----+-----------+----------+

First, let us see how the following SELECT query returns the duplicate salary records.
SQL> SELECT SALARY FROM CUSTOMERS
   ORDER BY SALARY;
This would produce the following result, where the salary (2000) is coming twice which is a duplicate record from the original table.
+----------+
| SALARY   |
+----------+
|  1500.00 |
|  2000.00 |
|  2000.00 |
|  4500.00 |
|  6500.00 |
|  8500.00 |
| 10000.00 |
+----------+

Now, let us use the DISTINCT keyword with the above SELECT query and then see the result.
SQL> SELECT DISTINCT SALARY FROM CUSTOMERS
   ORDER BY SALARY;
This would produce the following result where we do not have any duplicate entry.
+----------+
| SALARY   |
+----------+
|  1500.00 |
|  2000.00 |
|  4500.00 |
|  6500.00 |
|  8500.00 |
| 10000.00 |
Java Program for Coin Change

19 Jan, 2018
Given a value N, if we want to make change for N cents, and we have infinite supply of each of S = { S1, S2, .. , Sm} valued coins, how many ways can we make the change? The order of coins doesn\’t matter.
For example, for N = 4 and S = {1,2,3}, there are four solutions: {1,1,1,1},{1,1,2},{2,2},{1,3}. So output should be 4. For N = 10 and S = {2, 5, 3, 6}, there are five solutions: {2,2,2,2,2}, {2,2,3,3}, {2,2,6}, {2,3,5} and {5,5}. So the output should be 5.
/* Dynamic Programming Java implementation of Coin   Change problem */import java.util.Arrays;  class CoinChange{    static long countWays(int S[], int m, int n)    {        // Time complexity of this function: O(mn)          // table[i] will be storing the number of solutions        // for value i. We need n+1 rows as the table is        // constructed in bottom up manner using the base        // case (n = 0)        long[] table = new long[n+1];          // Initialize all table values as 0        Arrays.fill(table, 0);   //O(n)          // Base case (If given value is 0)        table[0] = 1;          // Pick all coins one by one and update the table[]        // values after the index greater than or equal to        // the value of the picked coin        for (int i=0; i<m; i++)            for (int j=S[i]; j<=n; j++)                table[j] += table[j-S[i]];          return table[n];    }      // Driver Function to test above function    public static void main(String args[])    {        int arr[] = {1, 2, 3};        int m = arr.length;        int n = 4;        System.out.println(countWays(arr, m, n));    }}// This code is contributed by Pankaj Kumar
Please refer complete article on Dynamic Programming | Set 7 (Coin Change) for more details!
dp-coin-change
Java Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Iterate Over the Characters of a String in Java
How to Convert Char to String in Java?
How to Get Elements By Index from HashSet in Java?
Java Program to Write into a File
How to Write Data into Excel Sheet using Java?
Java Program to Read a File to String
Comparing two ArrayList In Java
Java Program to Convert File to a Byte Array
SHA-1 Hash
Java Program to Find Sum of Array Elements
Difference between an id and class in HTML?

29 Jul, 2021
HTML id Attribute: The id attribute is a unique identifier which is used to specify the document. It is used by CSS and JavaScript to perform a certain task for a unique element. In CSS, the id attribute is written using # symbol followed by id.Syntax:  
<element id="id_name">

In CSS Stylesheet:
#id_name {
    // CSS Property
}
Example:  
html
<!DOCTYPE html><html>  <head>    <title>        HTML id attribute    </title>          <style>        #geeks{            color:green;            font-size:25px;        }    </style></head>  <body style="text-align:center">    <h1>Geeks for Geeks</h1>    <p id="geeks">Welcome to Geeks for Geeks</p>        <p>A Computer Science portal for geeks</p>  </body>  </html>                    
Output:  
HTML class Attribute: The class attribute is used to specify one or more class names for an HTML element. The class attribute can be used on any HTML element. The class name can be used by CSS and JavaScript to perform certain tasks for elements with the specified class name. The class name in CSS stylesheet using “.” symbol.Syntax:  
<element class="class_name">

In CSS Stylesheet:
.class {
    // CSS Property
}
Example:  
html
<!DOCTYPE html><html>  <head>    <style>        .geeks{            color:green;            font-size:25px;        }    </style></head>  <body style="text-align:center;">    <h1>Geeks for Geeks</h1>      <p> Welcome to Geeks for Geeks</p>      <p class="geeks">        A Computer Science portal for geeks    </p>  </body>  </html>                    
Output:  
Difference between id and class attribute: The only difference between them is that “id” is unique in a page and can only apply to at most one element, while “class” selector can apply to multiple elements.  
HTML is the foundation of webpages, is used for webpage development by structuring websites and web apps.You can learn HTML from the ground up by following this HTML Tutorial and HTML Examples.
trehanshanya23
Picked
HTML
Web Technologies
Web technologies Questions
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to update Node.js and NPM to next version ?
REST API (Introduction)
CSS to put icon inside an input element in a form
Types of CSS (Cascading Style Sheet)
Design a Tribute Page using HTML & CSS
Installation of Node.js on Linux
Difference between var, let and const keywords in JavaScript
How to fetch data from an API in ReactJS ?
Differences between Functional Components and Class Components in React
Remove elements from a JavaScript Array