code-rag-bench/online-tutorials huggingface dataset:
TypeScript | String Prototype Property - GeeksforGeeks

18 Jun, 2020
The Prototype Property() in TypeScript which is used to add properties and methods to an object. Syntax:
string.prototype 
Return Value: This method does not returns any value. Below examples illustrate the String Prototype property in TypeScriptExample 1: 
JavaScript
function Person(name:string, job:string, yearOfBirth:number)    {            this.name= name;         this.job= job;         this.yearOfBirth= yearOfBirth;     }                   // Driver code    var emp = new Person("Smith", "ABC",12214)           // This will show Person's prototype property.      console.log(emp.prototype);
Output: 
Example #2:  
JavaScript
function Person(name:string, job:string, yearOfBirth:number)    {            this.name= name;         this.job= job;         this.yearOfBirth= yearOfBirth;     }           // Driver code    var emp = new Person("Smith", "ABC",12214)       // This will show Person's prototype property.     Person.prototype.email = "abc@123.com";            console.log("Person's name: " + emp.name);     console.log("Person's Email ID: " + emp.email);
Output: 
TypeScript
JavaScript
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Remove elements from a JavaScript Array
Convert a string to an integer in JavaScript
Difference between var, let and const keywords in JavaScript
Differences between Functional Components and Class Components in React
How to append HTML code to a div using JavaScript ?
Remove elements from a JavaScript Array
Installation of Node.js on Linux
Convert a string to an integer in JavaScript
How to fetch data from an API in ReactJS ?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to sort by value in PySpark? - GeeksforGeeks

18 Jul, 2021
In this article, we are going to sort by value in PySpark.
Creating RDD for demonstration:
Python3
# importing modulefrom pyspark.sql import SparkSession, Row  # creating sparksession and giving an app namespark = SparkSession.builder.appName('sparkdf').getOrCreate()  # create 2 Rows with 3 columnsdata = Row(First_name="Sravan", Last_name="Kumar", age=23),Row(First_name="Ojaswi", Last_name="Pinkey", age=16),Row(First_name="Rohith", Last_name="Devi", age=7)  # create row on rddrdd = spark.sparkContext.parallelize(data)  # display datardd.collect()
Output:
[Row(First_name='Sravan', Last_name='Kumar', age=23),
Row(First_name='Ojaswi', Last_name='Pinkey', age=16),
Row(First_name='Rohith', Last_name='Devi', age=7)]
sortBy() is used to sort the data by value efficiently in pyspark. It is a method available in rdd.
Syntax: rdd.sortBy(lambda expression)
It uses a lambda expression to sort the data based on columns.
lambda expression: lambda x: x[column_index]
Example 1: Sort the data by values based on column 1
Python3
# sort the data by values based on column 1rdd.sortBy(lambda x: x[0]).collect()
Output:
[Row(First_name='Ojaswi', Last_name='Pinkey', age=16),
Row(First_name='Rohith', Last_name='Devi', age=7),
Row(First_name='Sravan', Last_name='Kumar', age=23)]
Example 2: Sort data based on column 2 values
Python3
# sort the data by values based on column 2rdd.sortBy(lambda x: x[2]).collect()
Output:
[Row(First_name='Rohith', Last_name='Devi', age=7),
Row(First_name='Ojaswi', Last_name='Pinkey', age=16),
Row(First_name='Sravan', Last_name='Kumar', age=23)]
It is the method available in RDD, this is used to sort values based on values in a particular column.
Syntax: rdd.takeOrdered(n,lambda expression)
where, n is the total rows to be displayed after sorting
Sort values based on a particular column using takeOrdered function
Python3
# sort values based on# column 1 using takeOrdered functionprint(rdd.takeOrdered(3,lambda x: x[0]))  # sort values based on# column 3 using takeOrdered functionprint(rdd.takeOrdered(3,lambda x: x[2]))
Output:
[Row(First_name=’Ojaswi’, Last_name=’Pinkey’, age=16), Row(First_name=’Rohith’, Last_name=’Devi’, age=7), Row(First_name=’Sravan’, Last_name=’Kumar’, age=23)]
[Row(First_name=’Rohith’, Last_name=’Devi’, age=7), Row(First_name=’Ojaswi’, Last_name=’Pinkey’, age=16), Row(First_name=’Sravan’, Last_name=’Kumar’, age=23)]
Picked
Python-Pyspark
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
How to drop one or multiple columns in Pandas Dataframe
Python Classes and Objects
Python | Get unique values from a list
Python | os.path.join() method
Create a directory in Python
Defaultdict in Python
Python | Pandas dataframe.groupby()
How can we write main as a class in C++? - GeeksforGeeks

07 Feb, 2020
As it is already known that main() method is the entry point in any program in C++, hence creating a class named “main” is a challenge and is generally not possible. But this article explains how to write a class named “main” in C++.
What happens when we try to write a class named main?Writing a class named main is not allowed generally in C++, as the compiler gets confused it with main() method. Hence when we write the main class, creating its object will lead to error as it won’t consider the ‘main’ as a class name.Example:
// C++ program to declare// a class with name main  #include <bits/stdc++.h>using namespace std;  // Class named mainclass main {  public:    void print()    {        cout << "GFG";    }};  // Driver codeint main(){      // Creating an object of class main    main obj;      // Calling the print() method    // of class main    obj.print();}
Output:
Compilation Error in CPP code :- prog.cpp: In function 'int main()':
prog.cpp:17:10: error: expected ';' before 'obj'
     main obj;
          ^
prog.cpp:18:5: error: 'obj' was not declared in this scope
     obj.print();
     ^

How to successfully create a class named main?When the class name is main, it is compulsory to use keyword class or struct to declare objects.
Example:
// C++ program to declare// a class with name main  #include <bits/stdc++.h>using namespace std;  // Class named mainclass main {  public:    void print()    {        cout << "GFG";    }};  // Driver codeint main(){      // Creating an object of class main    // Add keyword class ahead of main    class main obj;      // Calling the print() method    // of class main    obj.print();}
GFG

How to write a constructor or destructor named main?Writing a constructor or destructor named main is not a problem, as it means the class name must be main. We have already discussed how to make a class named main above.
Example:
// C++ program to declare// a class with name main  #include <bits/stdc++.h>using namespace std;  // Class named mainclass main {  public:      // Constructor    main()    {        cout << "In constructor main()\n";    }      // Destructor    ~main()    {        cout << "In destructor main()";    }      void print()    {        cout << "GFG\n";    }};  // Driver codeint main(){      // Creating an object of class main    // Add keyword class ahead of main    class main obj;      // Calling the print() method    // of class main    obj.print();}
In constructor main()
GFG
In destructor main()

cpp-main
C++ Programs
School Programming
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Passing a function as a parameter in C++
Program to implement Singly Linked List in C++ using class
Const keyword in C++
cout in C++
Dynamic _Cast in C++
Python Dictionary
Arrays in C/C++
Inheritance in C++
Reverse a string in Java
C++ Classes and Objects
<mat-label> in Angular Material - GeeksforGeeks

05 Feb, 2021
Angular Material is a UI component library that is developed by the Angular team to build design components for desktop and mobile web applications. In order to install it, we need to have angular installed in our project, once you have it you can enter the below command and can download it. mat-label is similar to labels which we use in normal HTML forms. But the advantage with mat-label is that it has pre-defined CSS style classes and animations defined in it.
Installation syntax:
ng add @angular/material
Approach:
First, install the angular material using the above-mentioned command.
After completing the installation, Import ‘MatFormFieldModule’ from ‘@angular/material/form-field’ in the app.module.ts file.
Now we need to use <mat-label> tag with respective label name inside the <mat-form-field> tag.
Below is an example on how to use <mat-label> tag inside <mat-form-field>
Once done with the above steps then serve or start the project.
Project Structure: It will look like the following.
Code Implementation:
app.module.ts:
Javascript
import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { FormsModule } from '@angular/forms'; import { MatFormFieldModule } from '@angular/material/form-field';         import { AppComponent } from './app.component'; import { BrowserAnimationsModule } from     '@angular/platform-browser/animations';    @NgModule({   imports:   [ BrowserModule,     FormsModule,     MatFormFieldModule,    BrowserAnimationsModule],   declarations: [ AppComponent ],   bootstrap: [ AppComponent ] }) export class AppModule { }
app.component.html:
HTML
<mat-form-field appearance="legacy">    <mat-label>Mat Label Example</mat-label>    <input matInput placeholder="Placeholder"></mat-form-field>
Output: 
Angular-material
Picked
AngularJS
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Angular PrimeNG Dropdown Component
Angular PrimeNG Calendar Component
Angular 10 (blur) Event
Angular PrimeNG Messages Component
How to make a Bootstrap Modal Popup in Angular 9/8 ?
Remove elements from a JavaScript Array
Installation of Node.js on Linux
Convert a string to an integer in JavaScript
How to fetch data from an API in ReactJS ?
Difference between var, let and const keywords in JavaScript
GATE | GATE-CS-2006 | Question 64 - GeeksforGeeks

14 Feb, 2018
Consider three processes (process id 0, 1, 2 respectively) with compute time bursts 2, 4 and 8 time units. All processes arrive at time zero. Consider the longest remaining time first (LRTF) scheduling algorithm. In LRTF ties are broken by giving priority to the process with the lowest process id. The average turn around time is:(A) 13 units(B) 14 units(C) 15 units(D) 16 unitsAnswer: (A)Explanation: Background Explanation:Turn around time of a process is total time between submission of the process and its completion.LRTF(Longest Remaining Time First), means the process which has remaining time largest, will run first and in case of same remaining time, lowest process with will be given priority to run.
Solution:
Let the processes be p0, p1 and p2. These processes will be executed in following order.
Gantt chart is as follows:
  p2  p1  p2  p1  p2  p0  p1   p2   p0   p1   p2
0   4   5   6   7   8   9   10    11   12   13   14 


First 4 sec, p2 will run, then remaining time p2=4, p1=4, p0=2. Now P1 will get chance to run for 1 sec, then remaining time. p2=4,p1=3,p0=2. Now p2 will get chance to run for 1 sec, then remaining time. p2=3,p1=3,p0=2.By doing this way, you will get above gantt chart.
Scheduling table:
AT=Arrival Time, BT=Burst Time, CT=Completion Time, TAT=Turn Around Time As we know, turn around time is total time between submission of the process and its completion. i.e turn around time=completion time-arrival time. i.e. TAT=CT-AT Turn around time of p0 = 12 (12-0) Turn around time of p1 = 13 (13-0) Turn around time of p2 = 14 (14-0)
Average turn around time is (12+13+14)/3 = 13. Option (A) is the correct answer.
See question 1 of https://www.geeksforgeeks.org/operating-systems-set-15/
This solution is contributed by Nitika BansalQuiz of this Question
GATE-CS-2006
GATE-GATE-CS-2006
GATE
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
GATE | Gate IT 2007 | Question 25
GATE | GATE-CS-2001 | Question 39
GATE | GATE-CS-2000 | Question 41
GATE | GATE-CS-2005 | Question 6
GATE | GATE MOCK 2017 | Question 21
GATE | GATE MOCK 2017 | Question 24
GATE | GATE-CS-2006 | Question 47
GATE | Gate IT 2008 | Question 43
GATE | GATE-CS-2009 | Question 38
GATE | GATE-CS-2003 | Question 90
How to search for items in a dropdown menu with CSS and JavaScript?

To search for items in a dropdown menu with CSS and JavaScript, the code is as follows −
 Live Demo
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
   .dropbtn {
      background-color: rgb(76, 78, 175);
      color: white;
      padding: 16px;
      font-size: 16px;
      border: none;
      cursor: pointer;
   }
   .dropbtn:hover, .dropbtn:focus {
      background-color: #4f3e8e;
   }
   .searchField {
      box-sizing: border-box;
      font-size: 16px;
      padding: 14px 20px 12px 45px;
      border: none;
      border-bottom: 1px solid #ddd;
   }
   .searchField:focus {outline: 3px solid #ddd;}
   .dropdown {
      position: relative;
      display: inline-block;
   }
   .dropdownList {
      display: none;
      position: absolute;
      background-color: #f6f6f6;
      min-width: 230px;
      overflow: auto;
      border: 1px solid #ddd;
      z-index: 1;
   }
   .dropdownList a {
      color: black;
      padding: 12px 16px;
      text-decoration: none;
      display: block;
   }
   .dropdown a:hover {background-color: #ddd;}
   .show {display: block;}
</style>
</head>
<body>
<h1>Search/filterText Dropdown Example</h1>
<div class="dropdown">
<button class="dropbtn" onclick="showDropList()">Dropdown</button>
<div id="myDropdown" class="dropdownList">
<input type="text" placeholder="Search.." class="searchField">
<a href="#">Cow</a>
<a href="#">Cat</a>
<a href="#">Dog</a>
<a href="#">Giraffe</a>
<a href="#">Lion</a>
<a href="#">Leopard</a>
<a href="#">Cheetah</a>
</div>
</div>
<script>
   function showDropList(){
      let dropDiv = document.querySelector('.dropdownList');
      if(dropDiv.style.display==="block"){
         dropDiv.style.display = "";
      } else {
         dropDiv.style.display = "block";
      }
   }
   document.querySelector('.searchField').addEventListener('keyup',filterDropdown);
   function filterDropdown() {
      var inputSearch, filterText, ul, li, links, i,div;
      inputSearch = document.querySelector(".searchField");
      filterText = inputSearch.value.toUpperCase();
      div = document.getElementById("myDropdown");
      links = div.getElementsByTagName("a");
      for (i = 0; i < links.length; i++) {
         txtValue = links[i].textContent || links[i].innerText;
         if (txtValue.toUpperCase().indexOf(filterText) > -1) {
            links[i].style.display = "";
         } else {
         links[i].style.display = "none";
         }
      }
   }
</script>
</body>
</html>
The above code will produce the following output −
On clicking the Dropdown button and entering text in search field −
How can I put a Java arrays inside an array?

Live Demo
import java.util.Arrays;

public class ArrayWithinAnArray{
   public static void main(String args[]) {
      int[] myArray1 = {23, 56, 78, 91};
      int[] myArray2 = {123, 156, 178, 191};
      int[] myArray3 = {223, 256, 278, 291};
      int[] myArray4 = {323, 356, 378, 391};
      int [][] arrayOfArrays = {myArray1, myArray2, myArray3, myArray4};
      System.out.println(Arrays.deepToString(arrayOfArrays));
   }
}
[[23, 56, 78, 91], [123, 156, 178, 191], [223, 256, 278, 291], [323, 356, 378, 391]]
Node.js sort() function - GeeksforGeeks

14 Oct, 2021
sort() is an array function from Node.js that is used to sort a given array.
Syntax:
array_name.sort()
Parameter: This function does not takes any parameter.
Return type: The function returns the sorted array.
The program below demonstrates the working of the function:
Program 1:
function sortDemo(){  arr.sort()  console.log(arr);}var arr=[ 3, 1, 8, 5, 2, 1];sortDemo();
Output:
[ 1, 1, 2, 3, 5, 8 ]
Program 2:
function sortDemo(){  arr.sort()  console.log(arr);}var arr=[ -3, 1, 10, 12, 1];sortDemo();
Output:
[ -3, 1, 1, 10, 12 ]
NodeJS-function
Node.js
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to install the previous version of node.js and npm ?
Difference between promise and async await in Node.js
How to use an ES6 import in Node.js?
Express.js res.sendFile() Function
Express.js res.redirect() Function
Top 10 Front End Developer Skills That You Need in 2022
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?
Difference between var, let and const keywords in JavaScript
JSF - h:outputText

The h:outputText tag renders an HTML text.
<h:outputText value = "Hello World!" />
Hello World! 

Identifier for a component
Reference to the component that can be used in a backing bean
A boolean; false suppresses rendering
Cascading stylesheet (CSS) class name
A component’s value, typically a value binding
Converter class name
Inline style information
A title, used for accessibility, that describes an element. Visual browsers typically create tooltips for the title’s value
Let us create a test JSF application to test the above tag.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns = "http://www.w3.org/1999/xhtml">
   <head>
      <title>JSF Tutorial!</title>
   </head>
   
   <body>
      <h2>h:outputText example</h2>
      <hr />
      
      <h:form>
         <h3>Text</h3>
         <h:outputText value = "Hello World"/>
      </h:form>
   </body>
</html>
Once you are ready with all the changes done, let us compile and run the application as we did in JSF - Create Application chapter. If everything is fine with your application, this will produce the following result.

    37 Lectures 
     3.5 hours 

 Chaand Sheikh
 Print
 Add Notes
 Bookmark this page
JavaScript Regex to remove leading zeroes from numbers?

To remove leading zeros, use Regex in replace() method as in the below syntax −
yourStringValue.replace(/\D|^0+/g, ""))
Let’s say the following are our variables with number values −
var theValue1="5001000";
var theValue2="100000005";
var theValue3="05000001";
var theValue4="00000000006456";
var theValue1="5001000";
var theValue2="100000005";
var theValue3="05000001";
var theValue4="00000000006456";
console.log(theValue1.replace(/\D|^0+/g, ""));
console.log(theValue2.replace(/\D|^0+/g, ""));
console.log(theValue3.replace(/\D|^0+/g, ""));
console.log(theValue4.replace(/\D|^0+/g, ""));
To run the above program, you need to use the following command −
node fileName.js.
Here, my file name is demo101.js. This will produce the following output −
PS C:\Users\Amit\JavaScript-code> node demo101.js
5001000
100000005
5000001
6456
8085 program to subtract two 16-bit numbers with or without borrow - GeeksforGeeks

14 Aug, 2018
Problem – Write an assembly language program in 8085 microprocessor to subtract two 16 bit numbers.
Assumption –
Starting address of program: 2000
Input memory location: 2050, 2051, 2052, 2053
Output memory location: 2054, 2055
Example –
INPUT:
       (2050H) = 19H
       (2051H) = 6AH 
       (2052H) = 15H 
       (2053H) = 5CH

OUTPUT:
        (2054H) = 04H
        (2055H) = OEH
RESULT:Hence we have subtracted two 16 bit numbers.
Algorithm –
Get the LSB in L register and MSB in H register of 16 Bit number.Exchange the content of HL register with DE register.Again Get the LSB in L register and MSB in H register of 16 Bit number.Subtract the content of L register from the content of E register.Subtract the content of H register from the content of D register and borrow from previous step.Store the result in memory location.
Get the LSB in L register and MSB in H register of 16 Bit number.
Exchange the content of HL register with DE register.
Again Get the LSB in L register and MSB in H register of 16 Bit number.
Subtract the content of L register from the content of E register.
Subtract the content of H register from the content of D register and borrow from previous step.
Store the result in memory location.
Program –
Explanation –
LHLD 2050: load HL pair with address 2050.XCHG: exchange the content of HL pair with DE.LHLD 2052: load HL pair with address 2050.MOV A, E: move the content of register E to A.SUB L: subtract the content of A with the content of register L.STA 2054: store the result from accumulator to memory address 2054.MOV A, D: move the content of register D to A.SBB H: subtract the content of A with the content of register H with borrow.STA 2055: store the result from accumulator to memory address 2055.HLT: stops executing the program and halts any further execution.
LHLD 2050: load HL pair with address 2050.
XCHG: exchange the content of HL pair with DE.
LHLD 2052: load HL pair with address 2050.
MOV A, E: move the content of register E to A.
SUB L: subtract the content of A with the content of register L.
STA 2054: store the result from accumulator to memory address 2054.
MOV A, D: move the content of register D to A.
SBB H: subtract the content of A with the content of register H with borrow.
STA 2055: store the result from accumulator to memory address 2055.
HLT: stops executing the program and halts any further execution.
microprocessor
system-programming
Computer Organization & Architecture
microprocessor
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Architecture of 8085 microprocessor
Direct Access Media (DMA) Controller in Computer Architecture
Computer Organization and Architecture | Pipelining | Set 2 (Dependencies and Data Hazard)
Pin diagram of 8086 microprocessor
I2C Communication Protocol
8085 program to add two 16 bit numbers
General purpose registers in 8086 microprocessor
8255 microprocessor operating modes
Difference between RISC and CISC processor | Set 2
Computer Organization | Different Instruction Cycles
Annotating points from a Pandas Dataframe in Matplotlib plot

To annotate points from a Pandas dataframe in Matplotlib, we can take the following steps −
Set the figure size and adjust the padding between and around the subplots.
Set the figure size and adjust the padding between and around the subplots.
Make a two-dimensional, size-mutable, potentially heterogeneous tabular data, with x, y and textc columns.
Make a two-dimensional, size-mutable, potentially heterogeneous tabular data, with x, y and textc columns.
Plot the columns x and y data points, using plot() method.
Plot the columns x and y data points, using plot() method.
Concatenate Pandas objects along a particular axis with optional set logic along the other axes.
Concatenate Pandas objects along a particular axis with optional set logic along the other axes.
Iterate the Pandas object.
Iterate the Pandas object.
Place text for each plotted points using text() method.
Place text for each plotted points using text() method.
To display the figure, use show() method.
To display the figure, use show() method.
import pandas as pd
import matplotlib.pyplot as plt

plt.rcParams["figure.figsize"] = [7.50, 3.50]
plt.rcParams["figure.autolayout"] = True

df = pd.DataFrame(dict(x=[2, 4, 1, 5, 2], y=[2, 1, 3, 5, 7], text=['First', 'Second', 'Third', 'Fourth', 'Fifth']))

ax = df.set_index('x')['y'].plot(style='*', color='red', ms=20)

a = pd.concat({'x': df.x, 'y': df.y, 'text': df.text}, axis=1)

for i, point in a.iterrows():
   ax.text(point['x']+0.125, point['y'], str(point['text']))

plt.show()
Pandas – Get the elements of series that are not present in other series

11 Oct, 2020
Sometimes we have two or more series and we have to find all those elements that are present in one series but not in other. We can do this easily, using the Bitwise NOT operator along with the pandas.isin() function.
Example 1: Taking two Integer Series
Python3
# Importing pandas libraryimport pandas as pd  # Creating 2 pandas Seriesps1 = pd.Series([2, 4, 8, 20, 10, 47, 99])ps2 = pd.Series([1, 3, 6, 4, 10, 99, 50])  print("Series1:")print(ps1)print("\nSeries2:")print(ps2)  # Using Bitwise NOT operator along# with pandas.isin()print("\nItems of ps1 not present in ps2:")res = ps1[~ps1.isin(ps2)]print(res)
Output:
In the above example, we take 2 pandas series of int type ‘ps1‘ and ‘ps2‘ and find all those elements of ps1 that are not present in ps2.
Example 2: Taking two Floating point Series
Python3
# Importing pandas libraryimport pandas as pd  # Creating 2 pandas Series ps1 = pd.Series([2.8, 4.5, 8.0, 2.2, 10.1, 4.7, 9.9])ps2 = pd.Series([1.4, 2.8, 4.7, 4.8, 10.1, 9.9, 50.12])  print("Series1:")print(ps1)print("\nSeries2:")print(ps2)  # Using Bitwise NOT operator along # with pandas.isin()print("\nItems of ps1 not present in ps2:")res = ps1[~ps1.isin(ps2)]print(res)
Output:
In the above example, we take 2 pandas series of float type ‘ps1‘ and ‘ps2‘ and find all those elements of ps1 that are not present in ps2.
Example 3: Taking two String Series
Python3
# Importing pandas libraryimport pandas as pd  # Creating 2 pandas Seriesps1 = pd.Series(['Monu', 'Sonu', 'Tonu', 'Nonu',                 'Ronu', 'Bonu'])  ps2 = pd.Series(['Sweetu', 'Tweetu', 'Nonu',                 'Micku', 'Bonu', 'Kicku'])  print("Series1:")print(ps1)print("\nSeries2:")print(ps2)  # Using Bitwise NOT operator along with# pandas.isin()print("\nItems of ps1 not present in ps2:")res = ps1[~ps1.isin(ps2)]print(res)
Output:
In the above example, we take 2 pandas series of string type ‘ps1‘ and ‘ps2‘ and find all those elements of ps1 that are not present in ps2.
Python pandas-series
Python-pandas
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Python Classes and Objects
Python OOPs Concepts
Python | os.path.join() method
How to drop one or multiple columns in Pandas Dataframe
Introduction To PYTHON
How To Convert Python Dictionary To JSON?
Check if element exists in list in Python
Python | datetime.timedelta() function
Python | Get unique values from a list
How to set checkbox size in HTML/CSS?

30 Jul, 2021
The checkbox is an HTML element which is used to take input from the user.Method 1: The checkbox size can be set by using height and width property. The height property sets the height of checkbox and width property sets the width of the checkbox.
Syntax:
input./*checkbox class name*/ {
    width : /*desired width*/;
    height : /*desired height*/;
}

Example:
<!DOCTYPE html> <html>  <head>    <title>        Set checkbox size    </title>          <!-- Style to set the size of checkbox -->    <style>        input.largerCheckbox {            width: 40px;            height: 40px;        }    </style></head>  <body>     <input type="checkbox" class="defaultCheckbox"            name="checkBox1" checked>              <input type="checkbox" class="largerCheckbox"            name="checkBox2" checked></body>  </html>                    
Output:
Note: This works well for Google Chrome, Microsoft Edge and Internet Explorer. In Mozilla Firefox the clickable checkbox area is as specified but it displays a checkbox of the default size.
Method 2: An alternate solution that works for Mozilla Firefox as well is by using transform property.
Syntax:
input./*checkbox class name*/ {
    transform : scale(/*desired magnification*/);
}

Example:
<!DOCTYPE html> <html>  <head>    <title>        Set the size of checkbox    </title>          <!-- Use transform scale property to         set size of checkbox -->    <style>        input.largerCheckbox {            transform : scale(10);        }        body {            text-align:center;            margin-top:100px;        }    </style></head>  <body>    <input type="checkbox" class="largerCheckbox"            name="checkBox2" checked></body>  </html>
Output:This method has a few drawbacks. The checkbox has to be positioned carefully to keep it within the browser window or prevent it from overlapping with other elements. Also, in some browsers, the checkbox may appear pixelated for larger sizes.
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.
CSS is the foundation of webpages, is used for webpage development by styling websites and web apps.You can learn CSS from the ground up by following this CSS Tutorial and CSS Examples.
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.
close() method in PyQt5

26 Mar, 2020
In this article, we will see how to use close() method which belongs to the QWidget class, this method is used to close the window in PyQt5 application. In other words by close() method the window get closed without manually closing it.
Syntax : self.close()
Argument : It takes no argument.
Code :
# importing the required libraries  from PyQt5.QtWidgets import * from PyQt5 import QtCorefrom PyQt5 import QtGuiimport sysimport time    class Window(QMainWindow):    def __init__(self):        super().__init__()          # set the title        self.setWindowTitle("Close")          # setting  the geometry of window        self.setGeometry(0, 0, 400, 300)          # creating a label widget        self.label = QLabel("Icon is set", self)          # moving position        self.label.move(100, 100)          # setting up border        self.label.setStyleSheet("border: 1px solid black;")          # show all the widgets        self.show()          # waiting for 2 second        time.sleep(2)          # closing the window        self.close()  # create pyqt5 appApp = QApplication(sys.argv)  # create the instance of our Windowwindow = Window()  # start the appsys.exit(App.exec())
This will open the window and after 2 seconds it will automatically closes the window.
Python-gui
Python-PyQt
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
Convert integer to string in Python
Python | Pair the consecutive character strings in a list

26 Nov, 2019
Sometimes while programming, we can face a problem in which we need to perform consecutive element concatenation. This problem can occur at times of school programming or competitive programming. Let’s discuss certain ways in which this problem can be solved.
Method #1 : Using list comprehension + zip()Combination of above functionalities can be used to solve this problem. In this, we iterate the list using list comprehension and formation of pairs using zip().
# Python3 code to demonstrate working of# Consecutive element pairing in list# using list comprehension + zip()  # initialize list test_list = ["G", "F", "G", "I", "S", "B", "E", "S", "T"]  # printing original list print("The original list : " + str(test_list))  # Consecutive element pairing in list# using list comprehension + zip()res = [i + j for i, j in zip(test_list, test_list[1:])]  # printing resultprint("List after Consecutive concatenation is : " + str(res))
The original list : [‘G’, ‘F’, ‘G’, ‘I’, ‘S’, ‘B’, ‘E’, ‘S’, ‘T’]List after Consecutive concatenation is : [‘GF’, ‘FG’, ‘GI’, ‘IS’, ‘SB’, ‘BE’, ‘ES’, ‘ST’]
 
Method #2 : Using map() + concat()The combination of these functions can also perform this task. In this traversal logic is done by map() and concat performs the task of pairing. It’s more efficient than above method.
# Python3 code to demonstrate working of# Consecutive element pairing in list# using map() + concatimport operator  # initialize list test_list = ["G", "F", "G", "I", "S", "B", "E", "S", "T"]  # printing original list print("The original list : " + str(test_list))  # Consecutive element pairing in list# using map() + concatres = list(map(operator.concat, test_list[:-1], test_list[1:]))  # printing resultprint("List after Consecutive concatenation is : " + str(res))
The original list : [‘G’, ‘F’, ‘G’, ‘I’, ‘S’, ‘B’, ‘E’, ‘S’, ‘T’]List after Consecutive concatenation is : [‘GF’, ‘FG’, ‘GI’, ‘IS’, ‘SB’, ‘BE’, ‘ES’, ‘ST’]
Python list-programs
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Python Classes and Objects
Python OOPs Concepts
Introduction To PYTHON
Python | os.path.join() method
Defaultdict in Python
Python | Get dictionary keys as a list
Python | Convert a list to dictionary
Python | Convert string dictionary to dictionary
Python Program for Fibonacci numbers
PHP | filter_input() Function

14 Feb, 2019
The filter_input() is an inbuilt function in PHP which is used to get the specific external variable by name and filter it. This function is used to validate variables from insecure sources, such as user input from form. This function is very much useful to prevent some potential security threat like SQL Injection.
Syntax:
filter_input( $type, $variable_name, $filter, $options)
Parameters: This function accepts four parameters as mentioned above and described below:
$type: It is mandatory parameter and used to check the type of input. The list of filters are:INPUT_GETINPUT_POSTINPUT_COOKIEINPUT_SERVERINPUT_ENV
INPUT_GET
INPUT_POST
INPUT_COOKIE
INPUT_SERVER
INPUT_ENV
$variable_name: It is required parameter. It is used to hols the name of variable which is to be checked.
$filter: It is an optional parameter. It holds the name or ID of the filter. If this parameter is not set then FILTER_DEFAULT is used.
$options: It is an optional parameter and used to specify one or more flags/options to use. It check for possible options and flags in each filter. If filter options are accepted then flags can be provided in “flags” field of array.
Return Value: It returns the value of the variable on success or False on failure. If parameter is not set then return NULL. If the flag FILTER_NULL_ON_FAILURE is used, it returns FALSE if the variable is not set and NULL if the filter fails.
Example 1:
<?php// PHP program to validate email using filter  if (isset($_GET["email"])) {    if (!filter_input(INPUT_GET, "email",             FILTER_VALIDATE_EMAIL) === false) {        echo("Valid Email");    } else {        echo("Invalid Email");    }}  ?>
Output:
Valid Email
Example 2:
<?php  // Input type:INPUT_GET input name:search // filter name:FILTER_SANITIZE_SPECIAL_CHARS$search_variable_data = filter_input(INPUT_GET,             'search', FILTER_SANITIZE_SPECIAL_CHARS);              // Input type:INPUT_GET input name:search// filter name:FILTER_SANITIZE_ENCODED$search_url_data = filter_input(INPUT_GET,            'search', FILTER_SANITIZE_ENCODED);              echo "Search for $search_variable_data.\n";  echo "<a href='?search=$search_url_data'>Search again.</a>";  ?>
Output:
Search for tic tac & toc. Search again.
References: http://php.net/manual/en/function.filter-input.php
PHP-function
PHP
PHP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to convert array to string in PHP ?
PHP | Converting string to Date and DateTime
Split a comma delimited string into an array in PHP
How to get parameters from a URL string in PHP?
Download file from URL using PHP
How to fetch data from localserver database and display on HTML table using PHP ?
How to pass JavaScript variables to PHP ?
Difference between HTTP GET and POST Methods
How to Encrypt and Decrypt a PHP String ?
How to declare a global variable in PHP?
Matplotlib.axes.Axes.axvspan() in Python

13 Apr, 2020
Matplotlib is a library in Python and it is numerical – mathematical extension for NumPy library. The Axes Class contains most of the figure elements: Axis, Tick, Line2D, Text, Polygon, etc., and sets the coordinate system. And the instances of Axes supports callbacks through a callbacks attribute.
The Axes.axvspan() function in axes module of matplotlib library is used to add a vertical span (rectangle) across the axis.
Syntax:
Axes.axvspan(self, xmin, xmax, ymin=0, ymax=1, **kwargs)
Parameters: This method accept the following parameters that are described below:
xmin: This parameter indicates the first X-axis coordinate of the vertical span rectangle in data units.
xmax: This parameter indicates the second X-axis coordinate of the vertical span rectangle in data units.
ymin: This parameter indicates the first Y-axis coordinate of the vertical span rectangle in relative Y-axis units .
ymax: This parameter indicates the second Y-axis coordinate of the vertical span rectangle in relative Y-axis units.
Returns: This returns the vertical span (rectangle) from (xmin, ymin) to (xmax, ymax).
Below examples illustrate the matplotlib.axes.Axes.axhspan() function in matplotlib.axes:
Example-1:
# Implementation of matplotlib functionimport matplotlib.pyplot as pltimport numpy as np  fig, ax = plt.subplots()  ax.axvspan(1.5, 2.5, facecolor ='g', alpha = 0.7)  ax.set_title('matplotlib.axes.Axes.axvspan() Example')  plt.show()
Output:
Example-2:
# Implementation of matplotlib functionimport numpy as npimport matplotlib.pyplot as plt  t = np.arange(-3, 4, .1)s = np.sin(np.pi * t)  fig, ax = plt.subplots()ax.plot(t, s, color ='black')ax.axhline(y = 1, color ='black')ax.axvline(x = 1, color ='black')ax.axvline(x = 0, ymin = 0.75, linewidth = 8,           color ='green')ax.axhline(y =.5, xmin = 0.25, xmax = 0.75,           color ='black')  ax.axhspan(0.25, 0.75, facecolor ='green', alpha = 0.7)ax.axvspan(1.25, 1.55, facecolor ='0.5', alpha = 0.5)  ax.set_title('matplotlib.axes.Axes.axvspan() Example')  plt.show()
Output:
Python-matplotlib
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
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
Python OOPs Concepts
Introduction To PYTHON
Convert integer to string in Python
Finding Similar Type of Names | Fuzzy Search in SQL

10 May, 2021
Fuzzy Search :A technique of finding the strings that match a pattern approximately (rather than exactly). Users / Reviewers often capture names inaccurately. Typing mistake is a very common mistake that reviewer does while capturing the names which leads to inconsistency in Data. But sometimes, we need to search or match this inaccurate data anyway. For example, users should match existing customer records rather than creating unwanted duplicates.
Problem Statement :Finding all kind of error types that described in the below table e.g. Spelling Mistake, Incomplete Name, Formatting Issue, Suffix Missing.
Approach to solve :SOUNDEX() Function can find the inconsistency in names. SOUNDEX() can evaluate the similarity of two names. SOUNDEX() only works well when we do have 1 or 2 tokens. Names generally contain 1-2 tokens, so it works fine with Name. But if we want to find similar names for the company then it’s not that useful as it contains multiple tokens.
Data :Benjamin Sheriff and Benjamin Sherrif where FirstName is same but any of the LastName has a spelling error. Likewise, there are many errors in this data like formatting issues, incomplete names.
Code :Case-1: FirstName is exact the same but LastName is a similar type.Case-2: LastName is exact the same but FirstName is a similar type.
Let’s discuss it one by one as follows.
Case-1 : FirstName is exact the same but LastName is similar type :
select distinct ss.firstname,ss.lastname,sd.firstname,sd.lastname
from load as ss, load as sd
where ss.firstName=sd.firstName and SOUNDEX(ss.lastName)=SOUNDEX(sd.lastname)
      and
      left(ss.lastname,2)=left(sd.lastname,2)
      and
      ss.lastName<>sd.lastName
Output : 
Case-2 :LastName is exact same but FirstName is similar type :
select distinct ss.lastname,ss.firstname,sd.lastname,sd.firstname
from load as ss, load as sd
where ss.lastname=sd.lastname and SOUNDEX(ss.firstname)=SOUNDEX(sd.firstname)
      and
      left(ss.firstname,2)=left(sd.firstname,2)
      and
      ss.firstname<>sd.firstname
Output : 
Reference :Github Link – https://github.com/SuryaSD/Finding-Similar-Types-of-Names-Fuzzy-Search
DBMS-SQL
SQL
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Update Multiple Columns in Single Update Statement in SQL?
Window functions in SQL
SQL | Sub queries in From Clause
What is Temporary Table in SQL?
SQL using Python
SQL Query to Find the Name of a Person Whose Name Starts with Specific Letter
SQL Query to Convert VARCHAR to INT
RANK() Function in SQL Server
SQL Query to Compare Two Dates
SQL Query to Convert Rows to Columns in SQL Server
How to find the intersection of two arrays in java?

To find the intersection of two arrays in java use two loops. The outer loop is to iterate the elements of the first array whereas, the second loop is to iterate the elements of the second array. Within the second loop compare the elements of the two arrays:
Live Demo
public class IntersectionOfTwoArrays {
   public static void main(String args[]) {
      int myArray1[] = {23, 36, 96, 78, 55};
      int myArray2[] = {78, 45, 19, 73, 55};
      System.out.println("Intersection of the two arrays ::");
     
      for(int i = 0; i<myArray1.length; i++ ) {
         for(int j = 0; j<myArray2.length; j++) {
            if(myArray1[i]==myArray2[j]) {
               System.out.println(myArray2[j]);
            }
         }
      }
   }
}
Intersection of the two arrays ::
78
55
How to draw a line following mouse coordinates with tkinter?

To draw a line following mouse coordinates, we need to create a function to capture the coordinates of each mouse-click and then draw a line between two consecutive points. Let's take an example and see how it can be done.
Import the tkinter library and create an instance of tkinter frame.
Import the tkinter library and create an instance of tkinter frame.
Set the size of the frame using geometry method.
Set the size of the frame using geometry method.
Create a user-defined method "draw_line" to capture the x and y coordinates of each mouse click. Then, use the create_line() method of Canvas to draw a line between two consecutive points.
Create a user-defined method "draw_line" to capture the x and y coordinates of each mouse click. Then, use the create_line() method of Canvas to draw a line between two consecutive points.
Bind the left-click of the mouse with the draw_line method.
Bind the left-click of the mouse with the draw_line method.
Finally, run the mainloop of the application window.
Finally, run the mainloop of the application window.
# Import the library
import tkinter as tk

# Create an instance of tkinter
win = tk.Tk()

# Window size
win.geometry("700x300")

# Method to draw line between two consecutive points
def draw_line(e):
   x, y = e.x, e.y
   if canvas.old_coords:
      x1, y1 = canvas.old_coords
      canvas.create_line(x, y, x1, y1, width=5)
   canvas.old_coords = x, y

canvas = tk.Canvas(win, width=700, height=300)
canvas.pack()
canvas.old_coords = None

# Bind the left button the mouse.
win.bind('<ButtonPress-1>', draw_line)

win.mainloop()
It will track the left-clicks of the mouse and draw a line between each two consecutive points.
What are the differences between implicit and explicit waits in Selenium with python?

The differences between implicit and explicit wait are listed below −
title_contains
visibility_of_element_located
presence_of_element_located
title_is
visibility_of
element_selection_state_to_be
presence_of_all_elements_located
element_located_to_be_selected
alert_is_present
element_located_selection_state_to_b
e
staleness_of
element_to_be_clickable
invisibility_of_element_located
frame_to_be_available_and_switch_to
_it
text_to_be_present_in_element_value
text_to_be_present_in_element
element_to_be_selected
driver.implicitly_wait(2)
w = WebDriverWait(driver, 7)
w.until(expected_conditions.presence_of_ele
ment_located((By.ID, "Tutorialspoint")))
JavaScript | Object.defineProperty() Method - GeeksforGeeks

16 Apr, 2020
The Object.defineProperty() method in JavaScript is a Standard built-in objects which defines a new property directly on an object and returns the object.
Syntax:
Object.defineProperty(obj, prop, descriptor)
Parameter: This method accept three parameters as mentioned above and described below:
Obj: This parameter holds the Object on which user is going to be define the property.
Prop: This parameter holds the name of a property which is going to be defined or modified.
Descriptor: This parameter holds the descriptor for the property being defined or modified.
Return Value: This method returns the object which is passed as the argument to the function.
Below examples illustrate the Object.defineProperty() method in JavaScript:
Example 1:
<script>const geek1 = {};Object.defineProperty(geek1, 'prop1', {  value: 65,  writable: false});geek1.prop1 = 7;console.log(geek1.prop1);  const geek2 = {};  Object.defineProperty(geek2, 'prop2', {          value: 54,    value: 23,    value: 12*9,    });  geek2.prop2 ;  console.log(geek2.prop2); </script> 
Output:
65
108
Example 2:
<script>function gfg() {}  var result;Object.defineProperty(gfg.prototype, "valx", {  get() {    return result;  },  set(valx) {    result = valx;  }});  var vala = new gfg();var valb = new gfg();vala.valx = 6;console.log(valb.valx);  function gfg1() {}  gfg1.prototype.valx = 4;Object.defineProperty(gfg1.prototype, "valy", {  writable: false,  value: 8});  var vala = new gfg1();vala.valx = 4;console.log(vala.valx); console.log(gfg1.prototype.valx); vala.valy = 2;console.log(vala.valy);console.log(gfg1.prototype.valy);</script> 
Output:
6
4
4
8
8
Supported Browsers: The browsers supported by Object.defineProperty() method are listed below:
Google Chrome
Firefox
Opera
Safari
Edge
javascript-functions
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
Difference Between PUT and PATCH Request
How to get character array from string in JavaScript?
How to remove duplicate elements from JavaScript Array ?
How to get selected value in dropdown list using JavaScript ?
Roadmap to Become a Web Developer in 2022
Installation of Node.js on Linux
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?
Lolcode - Input/Output

This chapter will explain you how to input a value through LOLCODE terminal and how to output it onto the terminal.
You can use the keyword VISIBLE to print something in LOLCODE. VISIBLE is a function which can take an infinite number of characters as input, and prints them all at once by internally concatenating them, and converting them to strings or YARN.
The VISIBLE function ends or terminates by a delimiter, which is either a line end or a comma.
The output is automatically terminated by the compiler with a carriage return. If the final token is terminated with an exclamation symbol (!), then the carriage returned is over-ridden by this symbol.
VISIBLE <any_expression> [<any_expression> ...][!]

Please note that in LOLCODE, currently there is no defined standard for printing some data to a file.
To take some input from the user, the keyword used is GIMMEH. It is a function which can take any number of variables as input. It takes YARN as the input and stores the value in any given variable.
GIMMEH <any_variable>

HAI 1.2
   I HAS A VAR ITZ A YARN BTW DECLARE A VARIABLE FOR LATER USE
   VISIBLE "TYPE SOMETHING AND ENTER"
   GIMMEH VAR BTW GET INPUT (STRING) INTO VARIABLE
   VISIBLE VAR
KTHXBYE
When this code is run, it will ask you to enter a number and then prints the number back in the next line automatically. When you run this code, it will print the following output −
sh-
4.3$ lci main.lo

TYPE SOMETHING AND ENTER
67

67
 Print
 Add Notes
 Bookmark this page