code-rag-bench/online-tutorials huggingface dataset:
Dorks Eye - Google Hacking Dork Scraping and Searching Script - GeeksforGeeks

28 Nov, 2021
The Dorks Eye tool is developed in the Python3 language which h can easily find Vulnerable links using Google Dorks. Dorks Eye tool gathers links to web pages and applications from the Internet which reveals some information. Now this information can be sensitive data like SQL queries of web pages, usernames and passwords, bank details, and many more. Dorks Eye also supports saving the results onto a text formatted file. This tool is also available on the GitHub platform for free and is open source to use.
Google Dorking is the advanced search technique that shows the accurate results of our query rather than showing irrelevant stuff or some ad-containing sites. Google Dorking is so powerful that we can also get the username and passwords containing files, robot.txt files, sensitive files conf files, and many more. One of the sample dorking queries look like: /modules/vwar/admin/admin.php?vwar_root= 
Note: Make Sure You have Python Installed on your System, as this is a python-based tool. Click to check the Installation process: Python Installation Steps on Linux
Step 1: Use the following command to install the tool in your Kali Linux operating system.
git clone https://github.com/BullsEye0/dorks-eye.git
Step 2: Now use the following command to move into the directory of the tool. You have to move in the directory in order to run the tool.
cd dorks-eye
Step 3: You are in the directory of the dorks-eye. Now you have to install a dependency of the dorks-eye using the following command.
sudo pip3 install -r requirements.txt
Step 4: All the dependencies have been installed in your Kali Linux operating system. Now run the tool.
python3 dorks-eye.py
Example/Usage: Finding config files by using dork query
Query used -> indexof:backup/web.config
We have specified the dork query through which we will get vulnerable site links.
We will be displaying the 10 vulnerable sites on the terminal. You can display more than 10 websites.
We have got the links of vulnerable sites which match the dork query.
We have visited the link and we have got the conf directory contents which include various .xml files.
Kali-Linux
Linux-Tools
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
scp command in Linux with Examples
mv command in Linux with examples
chown command in Linux with Examples
Docker - COPY Instruction
nohup Command in Linux with Examples
SED command in Linux | Set 2
Named Pipe or FIFO with example C program
uniq Command in LINUX with examples
Thread functions in C/C++
Array Basics in Shell Scripting | Set 1
VBA - If-Else Statement

An If statement consists of a Boolean expression followed by one or more statements. If the condition is said to be True, the statements under If condition(s) are executed. If the condition is said to be False, the statements under Else Part is executed.
Following is the syntax of an If Else statement in VBScript.
If(boolean_expression) Then
   Statement 1
   .....
   .....
   Statement n
Else
   Statement 1
   .....
   ....
   Statement n
End If

For demo purpose, let us find the biggest between the two numbers of an Excel with the help of a function.
Private Sub if_demo_Click()
   Dim x As Integer
   Dim y As Integer
    
   x = 234
   y = 324
    
   If x > y Then
      MsgBox "X is Greater than Y"
   Else
      Msgbox "Y is Greater than X"
   End If
End Sub
When the above code is executed, it produces the following result.
Y is Greater than X


    101 Lectures 
     6 hours 

 Pavan Lalwani

    41 Lectures 
     3 hours 

 Arnold Higuit

    80 Lectures 
     5.5 hours 

 Prashant Panchal

    25 Lectures 
     2 hours 

 Prashant Panchal

    26 Lectures 
     2 hours 

 Arnold Higuit

    92 Lectures 
     10.5 hours 

 Vijay Kumar Parvatha Reddy
 Print
 Add Notes
 Bookmark this page
Get the size of all the documents in a MongoDB query?

To get the size of all the documents in a query, you need to loop through documents. Let us first create a collection with documents −
> db.sizeOfAllDocumentsDemo.insertOne({"StudentFirstName":"John","StudentSubject":["MongoDB","Java"]});
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5cd3c0c1edc6604c74817cd7")
}
> db.sizeOfAllDocumentsDemo.insertOne({"StudentFirstName":"Larry","StudentSubject":["MySQL","PHP"],"StudentAge":21});
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5cd3c0d9edc6604c74817cd8")
}
> db.sizeOfAllDocumentsDemo.insertOne({"StudentFirstName":"Chris","StudentSubject":["SQL Server","C#"],"StudentAge":23,"StudentCountryName":"US"});
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5cd3c0fbedc6604c74817cd9")
}
Following is the query to display all documents from a collection with the help of find() method −
> db.sizeOfAllDocumentsDemo.find().pretty();
This will produce the following output −
{
   "_id" : ObjectId("5cd3c0c1edc6604c74817cd7"),
   "StudentFirstName" : "John",
   "StudentSubject" : [
      "MongoDB",
      "Java"
   ]
}
{
   "_id" : ObjectId("5cd3c0d9edc6604c74817cd8"),
   "StudentFirstName" : "Larry",
   "StudentSubject" : [
      "MySQL",
      "PHP"
   ],
   "StudentAge" : 21
}
{
   "_id" : ObjectId("5cd3c0fbedc6604c74817cd9"),
   "StudentFirstName" : "Chris",
   "StudentSubject" : [
      "SQL Server",
      "C#"
   ],
   "StudentAge" : 23,
   "StudentCountryName" : "US"
}
Following is the query to get the size of all the documents in a query −
> var allDocument = db.sizeOfAllDocumentsDemo.find();
> var counter = 0;
> allDocument.forEach(
...   function(myDocument) {
...      counter = counter+Object.bsonsize(myDocument)
...   }
... );

> print(counter);
This will produce the following output −
358
What is binding in Java?

Association of method call with the method body is known as binding in Java. There are two kinds of binding.
In static binding the method call is bonded with the method body at compile time. This is also known as early binding. This is done using static, private and, final methods.
class Super{
   public static void sample(){
      System.out.println("This is the method of super class");
   }
}
Public class Sub extends Super{
   Public static void sample(){
      System.out.println("This is the method of sub class");
   }
   Public static void main(String args[]){
      Sub.sample()
   }
}
This is the method of sub class

In dynamic binding the method call is bonded with the method body at run time. This is also known as late binding. This is done using instance methods.
class Super{
   public void sample(){
      System.out.println("This is the method of super class");
   }
}
Public class extends Super{
   Public static void sample(){
      System.out.println("This is the method of sub class");
   }
   Public static void main(String args[]){
      new Sub().sample()
   }
}
This is the method of sub class
PyQt5 – Set maximum size for width or height of window

26 Mar, 2020
When we create a window, by default the window size is resizable, although we can use setMaximumSize() method to set the maximum size of the window. But what if we want to set maximum length only for width or height only. In order to do so we use setMaximumWidth() and setMaximumHeight() method to set maximum width / height. When we use these method other length will be variable i.e there will be no maximum length to it, it can be stretched to the size of screen.
Syntax :
self.setMaximumWidth(width)
self.setMaximumHeight(height)

Argument : Both takes integer as argument.
Action performed :setMaximumWidth() sets the maximum width.setMaximumHeight() sets the maximum height.
Code for maximum width –
# importing the required libraries  from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * import sys    class Window(QMainWindow):    def __init__(self):        super().__init__()          # set the title        self.setWindowTitle("Python")          width = 200          # setting the maximum width        self.setMaximumWidth(width)          # creating a label widget        self.label_1 = QLabel("Maximum width", self)          # moving position        self.label_1.move(0, 0)          # setting up the border        self.label_1.setStyleSheet("border :3px solid black;")          # resizing label        self.label_1.resize(120, 80)          # show all the widgets        self.show()    # create pyqt5 appApp = QApplication(sys.argv)  # create the instance of our Windowwindow = Window()  # start the appsys.exit(App.exec())
Output : Code for maximum height –
# importing the required libraries  from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * import sys    class Window(QMainWindow):    def __init__(self):        super().__init__()            # set the title        self.setWindowTitle("Python")          height = 200          # setting the maximum height        self.setMaximumHeight(height)            # creating a label widget        self.label_1 = QLabel("Maximum height", self)          # moving position        self.label_1.move(0, 0)          # setting up the border        self.label_1.setStyleSheet("border :3px solid black;")          # resizing label        self.label_1.resize(120, 80)          # show all the widgets        self.show()    # create pyqt5 appApp = QApplication(sys.argv)  # create the instance of our Windowwindow = Window()  # start the appsys.exit(App.exec())
Output :
Python-gui
Python-PyQt
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
MongoDB insertOne() Method – db.Collection.insertOne()

28 Jan, 2021
In MongoDB, insertOne() method inserts a document into the collection. This method inserts only one document at a time. 
Using this method you can also create a collection by inserting documents.
You can insert documents with or without _id field. If you insert a document in the collection without _id field, then MongoDB will automatically add an _id field and assign it with a unique ObjectId. And if you insert a document with _id field, then the value of the _id field must be unique to avoid the duplicate key error.
This method can also throw either writeError or writeConcernError exception.
This method can also be used inside multi-document transactions.
 Syntax: 
db.Collection_name.insertOne(
<document>,
{
    writeConcern: <document>
})
Parameters:
The first parameter is the document. Documents are a structure created of file and value pairs, similar to JSON objects.
The second parameter is optional.
Optional Parameter:
writeConcern: It is only used when you do not want to use the default write concern. The type of this parameter is a document.
Return:
This method returns :
Boolean acknowledged as true if write concern was enabled or false if write concern was disabled.
The insertedId field with the _id value of the inserted document.
Examples:
In the following examples, we are working with:
Database: gfg
Collection: student
Document: No document but, we want to insert in the form of the student name and student marks.
Insert a single document without specifying the _id field
 Here, we are inserting the document whose name is Akshay and marks is 500 in the student collection.
db.student.insertOne({Name: "Akshay", Marks: 500})
Insert a single document with _id field
Here, we are inserting a document whose unique id is Stu102, name is Vishal, and marks is 230 in the student collection
db.student.insertOne({_id: "Stu102", Name: "Vishal", Marks: 230})
MongoDB-method
Picked
MongoDB
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
strings.SplitN() Function in Golang with Examples

19 Apr, 2020
strings.SplitN() Function() is a string manipulation function in Go language. It is used to split a given string into substrings separated by a separator. This function returns the slices of all substrings between those separators.
Syntax:
func SplitN(s, sep string, n int) []string
Here, s is the string and sep is the separator. If s does not contain the given sep and sep is non-empty, then it will return a slice of length 1 which contains only s. Or if the sep is empty, then it will split after each UTF-8 sequence. Or if both s and sep are empty, then it will return an empty slice.
Here, the last parameter determines the number of strings to be returned by the function. It can be any of the following:
n is equal to zero (n == 0) : The result is nil, i.e, zero sub strings. An empty list is returned.
n is greater than zero (n > 0) : At most n sub strings will be returned and the last string will be the unsplit remainder.
n is less than zero (n < 0) : All possible substring will be returned.
Example 1:
// Golang program to illustrate the// strings.SplitN() Functionpackage main   import (    "fmt"    "strings")   func main() {       // String s a is comma serparated string    // The separater used is ","    // This will split the string into 6 parts    s := strings.SplitN("a,b,c,d,e,f", ",",6)    fmt.Println(s)}
Output:
[a b c d e f]

Example 2:
// Golang program to illustrate the// strings.SplitN() Functionpackage main  import (    "fmt"    "strings")  func main() {      // String s will be separated by spaces    // -1 implies all the possible sub strings    // that can be generated    s := strings.SplitN("I love GeeksforGeeks portal!", " ", -1)      // This will print all the sub strings    // of string s in a new line    for _, v := range s {        fmt.Println(v)    }}
Output:
I
love
GeeksforGeeks
portal!

Example 3:
// Golang program to illustrate the// strings.SplitN() Functionpackage main  import (    "fmt"    "strings")  func main() {      // This will give empty sub string    // as 0 is provided as the last parameter    s := strings.SplitN("a,b,c", ",", 0)    fmt.Println(s)      // This will give only 3 sub strings    // a and b will be the first 2 sub strings    s = strings.SplitN("a:b:c:d:e:f", ":", 3)    fmt.Println(s)      // Delimiter can be anything    // a -ve number specifies all sub strings    s = strings.SplitN("1234x5678x1234x5678", "x", -1)    fmt.Println(s)      // When the separator is not present in    // given list, original string is returned    s = strings.SplitN("qwerty", ",", 6)    fmt.Println(s)}
Output:
[]
[a b c:d:e:f]
[1234 5678 1234 5678]
[qwerty]

Golang-String
Picked
Go Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to uncompress a “.tar.gz” file using Python ?

17 Dec, 2020
.tar.gz files are made by the combination of TAR packaging followed by a GNU zip (gzip) compression. These files are commonly used in Unix/Linux based system as packages or installers. In order to read or extract these files, we have to first decompress these files and after that expand them with the TAR utilities as these files contain both .tar and .gz files.
In order to extract or un-compress “.tar.gz” files using python, we have to use the tarfile module in python. This module can read and write .tar files including .gz, .bz compression methods.
Import module
Open .tar.gz file
Extract file in a specific folder
Close file
Name: gfg.tar.gz 
Link to download this file: Click here
Contents:
“gfg.tar.gz” file
Example:
Python3
# importing the "tarfile" moduleimport tarfile  # open filefile = tarfile.open('gfg.tar.gz')  # extracting filefile.extractall('./Destination_FolderName')  file.close()
Output:
A folder named “Destination_Folder” is created.
Files are uncompressed inside the “Destination_Folder”
Example: Printing file names before extracting
Python3
# importing the "tarfile" moduleimport tarfile  # open filefile = tarfile.open('gfg.tar.gz')  # print file namesprint(file.getnames())  # extract filesfile.extractall('./Destination_FolderName')  # close filefile.close()
Output:
Example : Extract a specific file
Python3
# importing the "tarfile" moduleimport tarfile  # open filefile = tarfile.open('gfg.tar.gz')  # extracting a specific filefile.extract('sample.txt', './Destination_FolderName')  file.close()
Output:
A new folder named “Destination_FolderName” is created
‘sample.txt’ is uncompressed inside the “Destination_FolderName”
Picked
python-utility
Technical Scripter 2020
Python
Technical Scripter
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Intersection of Two Arrays II in Python

Suppose we have two arrays A and B, there are few elements in these array. We have to find the intersection of them. So if A = [1, 4, 5, 3, 6], and B = [2, 3, 5, 7, 9], then intersection will be [3, 5]
To solve this, we will follow these steps −
Take two arrays A and B
if length of A is smaller than length of B, then swap them
calculate the frequency of elements in the array and store them into m
for each element e in B, if e is present in m, and frequency is non-zero,decrease frequency m[e] by 1insert e into the resultant array
decrease frequency m[e] by 1
insert e into the resultant array
return the resultant array
Let us see the following implementation to get better understanding −
 Live Demo
class Solution(object):
   def intersect(self, nums1, nums2):
      """
      :type nums1: List[int]
      :type nums2: List[int]
      :rtype: List[int]
      """
      m = {}
      if len(nums1)<len(nums2):
         nums1,nums2 = nums2,nums1
      for i in nums1:
         if i not in m:
            m[i] = 1
         else:
            m[i]+=1
      result = []
      for i in nums2:
         if i in m and m[i]:
            m[i]-=1
            result.append(i)
      return result
ob1 = Solution()
print(ob1.intersect([1,4,5,3,6], [2,3,5,7,9]))
[1,4,5,3,6]
[2,3,5,7,9]
[3,5]
How to change ttk.Treeview column width and weight in Python 3.3?

To display a large set of data in a Tkinter application, we can use the Treeview widget. Generally, we represent data through tables that contain a set of rows and columns. We can add the data in the form of a table with the help of the Treeview widget.
To configure the column width of the Treeview widget, we can use the width and stretch property. It sets the width of the Treeview widget column with the given value.
In this example, we have created a table that contains a list of programming languages. The width of columns ‘ID’ and ‘Programming Language’ is set to their content. Further, we can give a value to set the width of the columns.
# Import the required libraries
from tkinter import *
from tkinter import ttk

# Create an instance of tkinter frame
win=Tk()

# Set the size of the tkinter window
win.geometry("700x350")

# Create an instance of Style widget
style=ttk.Style()
style.theme_use('clam')

# Add a Treeview widget
tree=ttk.Treeview(win, column=("c1", "c2"), show='headings', height=8)
tree.column("# 1",anchor=CENTER, stretch=NO, width=100)
tree.heading("# 1", text="ID")
tree.column("# 2", anchor=CENTER, stretch=NO)
tree.heading("# 2", text="Programming Language")

# Insert the data in Treeview widget
tree.insert('', 'end',text="1",values=('1','C++'))
tree.insert('', 'end',text="2",values=('2', 'Java'))
tree.insert('', 'end',text="3",values=('3', 'Python'))
tree.insert('', 'end',text="4",values=('4', 'Golang'))
tree.insert('', 'end',text="5",values=('5', 'JavaScript'))
tree.insert('', 'end',text="6",values=('6', 'C# '))
tree.insert('', 'end',text="7",values=('6', 'Rust'))
tree.insert('', 'end',text="8",values=('6', 'SQL'))

tree.pack()
win.mainloop()
Run the above code to display a Table that contains a list of programming languages and Index.
HTML | <input> required Attribute - GeeksforGeeks

07 Oct, 2021
The HTML required Attribute is a Boolean attribute which is used to specify that the input element must be filled out before submitting the Form. This attribute works with other types of input like radio, checkbox, number, text, etc.Syntax: 
<input required> 
Example-1: This Example that illustrates the use of required attribute in input Element. 
html
<!DOCTYPE html><html> <head>    <title>      required Attribute  </title>    <style>        h1,        h2 {            color: green;            font-style: italic;        }                 body {            text-align: center;        }    </style></head> <body>    <h1>GeeksForGeeks</h1>    <h2>      HTML input required attribute  </h2>    <form action="">        Username:        <input type="text"               name="username"               required>        <br> Password:        <input type="password"               name="password">        <br>        <input type="submit">    </form></body> </html>
Output : 
Example-2: This Example that illustrates the use of required attribute in input Element. 
html
<!DOCTYPE html><html> <head>    <title>      required Attribute  </title>    <style>        h1,        h2 {            color: green;            font-style: italic;        }                 body {            text-align: center;        }    </style></head> <body>    <h1>GeeksForGeeks</h1>    <h2>      HTML input required attribute  </h2>    <form action="">        Required:        <input type="radio"               name="radiocheck"               required>        <br>        <input type="submit">    </form></body> </html>
Output : 
Supported Browsers: The browser supported by HTML input required Attribute are listed below: 
Google Chrome
Internet Explorer
Firefox
Opera
Safari
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.
prachisoda1234
HTML-Attributes
HTML
Web Technologies
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 ?
How to Insert Form Data into Database using PHP ?
REST API (Introduction)
CSS to put icon inside an input element in a form
Types of CSS (Cascading Style Sheet)
Roadmap to Become a Web Developer in 2022
Installation of Node.js on Linux
How to fetch data from an API in ReactJS ?
Convert a string to an integer in JavaScript
Difference between var, let and const keywords in JavaScript
Ruby | Array assoc() function - GeeksforGeeks

09 Jan, 2020
The assoc() function in Ruby is used to search through an array of arrays whose first element is compared with the index of the function and return the contained array if match found otherwise return either nil or vacant.
Syntax: Array.assoc(Object)Here Array is the array of arrays.
Parameters:Object : It is an element which gets compared with the first element of the contained array.
Returns: the contained array if match found otherwise returns either nil or vacant.
Example 1:
# Initializing a array of elementsArray1 = ["Alphabets", "a", "b", "c", "d", "e"]Array2 = ["Names", "gfg", "Geeks", "Geek", "GeeksforGeeks"]Array3 = ["City", "Kolkata", "Mumbai", "Delhi", "Patna"]  # Creating an array of above arraysArray = [Array1, Array2, Array3]  # Calling assoc() functionA = Array.assoc("Alphabets")B = Array.assoc("City")C = Array.assoc("Names")  # Printing the matched contained arrayputs "#{A}"puts "#{B}"puts "#{C}"
Output:
["Alphabets", "a", "b", "c", "d", "e"]
["City", "Kolkata", "Mumbai", "Delhi", "Patna"]
["Names", "gfg", "Geeks", "Geek", "GeeksforGeeks"]

Example 2:
# Initializing a array of elementsArray1 = ["Alphabets", "a", "b", "c", "d", "e"]Array2 = ["Names"]Array3 = "City"  # Creating an array of above arraysArray = [Array1, Array2, Array3]  # Calling assoc() functionA = Array.assoc("Alphabets")B = Array.assoc("City")C = Array.assoc("Names")  # Printing the matched contained arrayputs "#{A}"puts "#{B}"puts "#{C}"
Output:
["Alphabets", "a", "b", "c", "d", "e"]

["Names"]

Reference: https://devdocs.io/ruby~2.5/array#method-i-assoc
Ruby Array-class
Ruby-Methods
Ruby
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Ruby | Enumerator each_with_index function
Ruby For Beginners
Ruby | Decision Making (if, if-else, if-else-if, ternary) | Set - 1
Ruby | Array collect() operation
Ruby | Array shift() function
Ruby Mixins
Ruby | Module
Instance Variables in Ruby
Ruby | Array reject() function
Ruby | String concat Method
p5.js createGraphics() Function - GeeksforGeeks

15 Mar, 2021
The createGraphics() function in p5.js is used for creating an off-screen graphics buffer. It creates and returns a new p5.Renderer object.
Syntax:
createGraphics(w, h, [renderer])
Parameter: This function accepts three parameters as mentioned above and described below:
w: It is a number that sets the width of the off-screen graphics buffer.
h: It is a number that sets the height of the off-screen graphics buffer.
renderer: It is a constant that sets the mode to either P2D or WEBGL. It is an optional parameter. It defaults to P2D if undefined.
Return Value: It returns a p5.Graphics object that contains the off-screen graphics buffer.
The below example illustrates the createGraphics() function in p5.js:
Example 1:
Javascript
// Define the variable to store the graphicslet gfg;  function setup() {  // Set the canvas  createCanvas(600, 600, WEBGL);    // Create a new graphics renderer  gfg = createGraphics(300, 300);    // Change the properties of the  // graphics buffer  gfg.background(255, 100);  gfg.textSize(64);  gfg.fill("green");  gfg.textAlign(CENTER);  gfg.text("GFG", 150, 50);}  function draw() {  background(0);    // Add a point light to the scene  pointLight(255, 255, 255, 0, -200, 200);    noStroke();  rotateZ(frameCount * 0.02);  rotateX(frameCount * 0.02);  noStroke();    // Apply the graphics created  // as a texture  texture(gfg);    // Use a box for the texture  box(150);}
Output:
Example 2:
Javascript
// Define the variable to store the graphicslet graphics;  function setup() {  // Set the canvas  createCanvas(600, 600, WEBGL);    // Create a new graphics renderer  graphics = createGraphics(200, 200);  graphics.background(255);}  function draw() {  background(0);    // Add the required objcets to the  // graphics buffer  graphics.line(0, 0, 200, 200);  graphics.line(100, 0, 200, 200);  graphics.line(100, 200, 200, 100);      graphics.fill("green");  graphics.triangle(30, 75, 50, 20, 85, 70);    ambientLight(150);    // Add a point light to the scene  pointLight(255, 255, 255, 0, -200, 200);    rotateZ(frameCount * 0.02);  rotateX(frameCount * 0.02);    // Apply the graphics created  // as a texture  texture(graphics);    // Use a box for the texture  box(150);}
Output:
Reference:https://p5js.org/reference/#/p5/createGraphics
JavaScript-p5.js
JavaScript
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Difference between var, let and const keywords in JavaScript
Difference Between PUT and PATCH Request
How to get character array from string in JavaScript?
How to filter object array based on attributes?
Remove elements from a JavaScript Array
Roadmap to Become a Web Developer in 2022
Installation of Node.js on Linux
How to fetch data from an API in ReactJS ?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to insert spaces/tabs in text using HTML/CSS?
How do we set the input type for an Android EditText programatically?

This example demonstrates how do I set the input type for an Android EditText programmatically.
Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.
Step 2 − Add the following code to res/layout/activity_main.xml.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   android:orientation="vertical"
   android:gravity="center_horizontal"
   android:layout_marginTop="30dp"
   android:padding="4dp"
   tools:context=".MainActivity">
   <EditText
      android:id="@+id/editText"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"/>
      <Button
         android:onClick="SetInputTypeNumber"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:text="Click Here to set EditText input type to number" />
</LinearLayout>
Step 3 − Add the following code to src/MainActivity.java
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.text.InputType;
import android.view.View;
import android.widget.EditText;
public class MainActivity extends AppCompatActivity {
   EditText editText;
   @Override
   protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      editText = findViewById(R.id.editText);
   }
   public void SetInputTypeNumber(View view) {
      editText.setInputType(InputType.TYPE_CLASS_NUMBER);
   }
}
Step 4 − Add the following code to androidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="app.com.sample">
   <application
      android:allowBackup="true"
      android:icon="@mipmap/ic_launcher"
      android:label="@string/app_name"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:supportsRtl="true"
      android:theme="@style/AppTheme">
      <activity android:name=".MainActivity">
         <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
         </intent-filter>
      </activity>
</application>
</manifest>
Let's try to run your application. I assume you have connected your actual Android Mobile device with your computer. To run the app from android studio, open one of your project's activity files and click Run   icon from the toolbar. Select your mobile device as an option and then check your mobile device which will display your default screen −
Click here to download the project code
SQL Tutorial

SQL is a standard language for storing, manipulating and retrieving data 
in databases.
Our SQL tutorial will teach you how to use SQL in:
MySQL, SQL Server, MS Access, Oracle, Sybase, Informix, Postgres, and other database systems.
With our online SQL editor, you can edit the SQL statements, and click on a button to view the result.
Click on the "Try it Yourself" button to see how it works.
Insert the missing statement to get all the columns from the Customers table.
 * FROM Customers;

Start the Exercise
Learn by examples! This tutorial supplements all explanations with clarifying examples.
See All SQL Examples
Test your SQL skills at W3Schools!
Start SQL Quiz!
At W3Schools you will find a complete reference for keywords and function:
SQL Keyword Reference
MYSQL Functions
SQLServer Functions
MS Access Functions
SQL Quick Reference
Data types and ranges for Microsoft Access, MySQL and SQL Server.
SQL Data Types
Get certified by completing the SQL course
We just launchedW3Schools videos
Get certifiedby completinga course today!
If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:
help@w3schools.com
Your message has been sent to W3Schools.
Functions in Java - GeeksQuiz

03 Dec, 2021
ab cd
ef gh
ij kl
ab
cd;ef
gh;ij
kl
hashCode of object1 is equal to object2
value of object1 is equal to object2
hashCode of object1 is equal to object2
memory address of object1 is same as object2
value of object1 is equal to object2
memory address of object1 is same as object2
value of object1 is equal to object2
obj1.a = 10
obj2.a = 20
obj1.a = 20
obj2.a = 20
obj1.a = 10
obj2.a = 10
Writing code in comment? Please use ide.geeksforgeeks.org, generate link and share the link here.
Comments
Old Comments
Must Do Coding Questions for Product Based Companies
Microsoft Interview Experience for Internship (Via Engage)
Difference between var, let and const keywords in JavaScript
Find number of rectangles that can be formed from a given set of coordinates
Array of Objects in C++ with Examples
How to Replace Values in Column Based on Condition in Pandas?
C Program to read contents of Whole File
How to Replace Values in a List in Python?
How to Read Text Files with Pandas?
Infosys DSE Interview Experience | On-Campus 2021
How to create a clickable dropdown menu with CSS and JavaScript?

Following is the code to create a clickable dropdown menu using CSS and JavaScript −
 Live Demo
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
.menu-btn {
   background-color: #7e32d4;
   color: white;
   padding: 16px;
   font-size: 20px;
   font-weight: bolder;
   font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
   border: none;
}
.dropdown-menu {
   position: relative;
   display: inline-block;
}
.menu-content {
   display: none;
   position: absolute;
   background-color: #017575;
   min-width: 160px;
   z-index: 1;
}
.links {
   color: rgb(255, 255, 255);
   padding: 12px 16px;
   text-decoration: none;
   display: block;
   font-size: 18px;
   font-weight: bold;
   border-bottom: 1px solid black;
}
.links:hover {
   background-color: rgb(8, 107, 46);
}
.dropdown-menu:hover .menu-btn {
   background-color: #3e8e41;
}
</style>
</head>
<body>
<h2>Click on the below dropdown button to open/close dropdown menu</h2>
<div class="dropdown-menu">
<button class="menu-btn">Open <</button>
<div class="menu-content">
<a class="links" href="#">Contact Us</a>
<a class="links" href="#">Visit Us</a>
<a class="links" href="#">About Us</a>
</div>
</div>
<script>
let dropdownBtn = document.querySelector('.menu-btn');
let menuContent = document.querySelector('.menu-content');
dropdownBtn.addEventListener('click',()=>{
   if(menuContent.style.display===""){
      menuContent.style.display="block";
   } else {
      menuContent.style.display="";
   }
})
</script>
</body>
</html>
The above code will produce the following output −
On clicking the open button −
Python dictionary get() Method

Python dictionary  method get() returns a value for the given key. If key is not available then returns default value None.
Following is the syntax for get() method −
dict.get(key, default = None)

key − This is the Key to be searched in the dictionary.
key − This is the Key to be searched in the dictionary.
default − This is the Value to be returned in case key does not exist.
default − This is the Value to be returned in case key does not exist.
This method return a value for the given key. If key is not available, then returns default value None.
The following example shows the usage of get() method.
#!/usr/bin/python

dict = {'Name': 'Zabra', 'Age': 7}
print "Value : %s" %  dict.get('Age')
print "Value : %s" %  dict.get('Education', "Never")
When we run above program, it produces following result −
Value : 7
Value : Never


    187 Lectures 
     17.5 hours 

 Malhar Lathkar

    55 Lectures 
     8 hours 

 Arnab Chakraborty

    136 Lectures 
     11 hours 

 In28Minutes Official

    75 Lectures 
     13 hours 

 Eduonix Learning Solutions

    70 Lectures 
     8.5 hours 

 Lets Kode It

    63 Lectures 
     6 hours 

 Abhilash Nelson
 Print
 Add Notes
 Bookmark this page
How to create a table row using HTML5 ? - GeeksforGeeks

02 Jun, 2020
In this article, we define a row in a table by using a <tr> tag in a document. This tag is used to define a row in an HTML table. The tr element contains multiple th or td elements.
Syntax:
<tr> ... </tr>
Example:
<!DOCTYPE html><html>  <head>    <title>        How to define row of a table    </title>      <style>        body {            text-align: center;        }          h1 {            color: green;        }          th {            color: blue;        }          table,        tbody,        td {            border: 1px solid black;            border-collapse: collapse;        }    </style></head>  <body>    <center>        <h1>GeeksforGeeks</h1>          <h2>            HTML5: How to define             a row in a table?        </h2>        <table>            <thead>                <!-- tr tag starts here -->                <tr>                    <th>Name</th>                    <th>User Id</th>                </tr>                <!-- tr tag end here -->            </thead>            <tbody>                <tr>                    <td>Shashank</td>                    <td>@shashankla</td>                </tr>                <tr>                    <td>GeeksforGeeks</td>                    <td>@geeks</td>                </tr>            </tbody>        </table>    </center></body>  </html>
Output:
Supported Browsers:
Google Chrome
Internet Explorer
Firefox
Opera
Safari
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.
HTML-Misc
HTML5
HTML
Web Technologies
Web technologies Questions
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Types of CSS (Cascading Style Sheet)
How to Insert Form Data into Database using PHP ?
REST API (Introduction)
Design a web page using HTML and CSS
How to position a div at the bottom of its container using CSS?
Top 10 Front End Developer Skills That You Need in 2022
Installation of Node.js on Linux
How to fetch data from an API in ReactJS ?
Difference between var, let and const keywords in JavaScript
Convert a string to an integer in JavaScript
Program to find last two digits of 2^n in C++

In this problem, we are given a number N. Our task is to create a Program to
find last two digits of 2^n in C++.
To find the last two digits. We will use only the
product of the last two digits. And leave other things to make the calculation
small.
Let’s take an example to understand the problem,
Input: N = 12 
Output: 96
2^12 = 4096
To solve the problem, a direct approach could be finding the value of 2^N
and then finding the remainder when it is divided by 100.
 Live Demo
#include <iostream>
using namespace std;
int findLastDigit(int N){
   int powerVal = 1;
      for(int i = 0; i < N; i++){
         powerVal *= 2;
      }
   return powerVal%100;
}
int main() {
   int N = 14;
   cout<<"The last two digits of 2^"<<N<<" is "<<findLastDigit(N);
   return 0;
}
The last two digits of 2^14 is 84
This approach is not effective, as for large values of N the program will
overflow.
A better approach is by only considering 2 digits from the values. And multiply it by two for every power.
For each in the case of 2^14, the last two digits are 84. We will multiply 84
by two instead of the whole number which will save calculations. So,
(84*2)%100 = 68.
 Live Demo
#include <iostream>
using namespace std;
int findLastDigit(int N){
   int powerVal = 1;
   for(int i = 0; i < N; i++){
      powerVal = (powerVal * 2)%100;
   }
   return powerVal;
}
int main() {
   int N = 15;
   cout<<"The last two digits of 2^"<<N<<" is "<<findLastDigit(N);
   return 0;
}
The last two digits of 2^15 is 68
How to call OnDestroy Activity in Android app?

This example demonstrates about How do I call OnDestroy Activity in Android app.
Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.
Step 2 − Add the following code to res/layout/activity_main.xml.
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
   xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:app="http://schemas.android.com/apk/res-auto"
   xmlns:tools="http://schemas.android.com/tools"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   tools:context=".MainActivity">
   <TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginLeft="8dp"
      android:layout_marginTop="16dp"
      android:layout_marginRight="8dp"
      android:layout_marginBottom="32dp"
      android:text="Destroy"
      android:textColor="@color/colorPrimary"
      android:textSize="32dp"
      android:textStyle="bold"
      app:layout_constraintBottom_toBottomOf="parent"
      app:layout_constraintLeft_toLeftOf="parent"
      app:layout_constraintRight_toRightOf="parent"
      app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
Step 3 − Add the following code to src/MainActivity.java
package com.sample.q2;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
public class MainActivity extends AppCompatActivity {
   public static final String MY_TAG = "Destroy";
   @Override
   protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      Log.i(MY_TAG, "onCreate");
   }
   protected void onDestroy() {
      super.onDestroy();
      Log.i(MY_TAG, "onDestroy");
   }
}
Step 4 − Add the following code to androidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="app.com.sample">
   <application
      android:allowBackup="true"
      android:icon="@mipmap/ic_launcher"
      android:label="@string/app_name"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:supportsRtl="true"
      android:theme="@style/AppTheme">
      <activity android:name=".MainActivity">
         <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
         </intent-filter>
      </activity>
   </application>
</manifest>
Let's try to run your application. I assume you have connected your actual Android Mobile device with your computer. To run the app from android studio, open one of your project's activity files and click Run  icon from the toolbar. Select your mobile device as an option and then check your mobile device which will display your default screen −
Click  here  to download the project code.
MongoDB aggregate to get the count of field values of corresponding duplicate names?

Let us see an example and create a collection with documents −
> db.demo558.insertOne(
... {
...    _id : 100,
...    CountryCode:101,
...    details: [
...       {
...          Name:"Chris",
...          Subject:"MySQL"
...       },
...       {
...          Name:"Chris",
...          Subject:"MongoDB"
...       },
...       {
...          Name:"Chris",
...          Subject:"Java"
...       },
...       {
...          Name:"Bob",
...          Subject:"Python"
...       },
...       {
...          Name:"Bob",
...          Subject:"Java"
...       }
...    ]
... }
... )
{ "acknowledged" : true, "insertedId" : 100 }
Display all documents from a collection with the help of find() method −
> db.demo558.find();
This will produce the following output −
{ "_id" : 100, "CountryCode" : 101, "details" : [
   { "Name" : "Chris", "Subject" : "MySQL" },
   { "Name" : "Chris", "Subject" : "MongoDB" },
   { "Name" : "Chris", "Subject" : "Java" },
   { "Name" : "Bob", "Subject" : "Python" },
   { "Name" : "Bob", "Subject" : "Java" }
] }
Following is the query to get the count −
> db.demo558.aggregate([
...    {$unwind: "$details" },
...    {$group: { _id: "$details.Name", NameCount:{$sum : 1}, Subject : {$push: "$details.Subject"}}},
...    {$project: { NameCount: 1, SubjectCount : {$size: "$Subject"}}}
... ]).pretty()
This will produce the following output −
{ "_id" : "Bob", "NameCount" : 2, "SubjectCount" : 2 }
{ "_id" : "Chris", "NameCount" : 3, "SubjectCount" : 3 }
2 Keys Keyboard in C++

Suppose we have only one character 'A' in a text editor. We can perform two operations on this letter for each step −
Copy All − We can copy all the characters present on the notepad
Paste − We can paste the characters which are copied last time.
Now suppose we have a number n. We have to get exactly n 'A' on the notepad by performing the minimum number of steps permitted. We have to find the result in the minimum number of steps to get n 'A'. So if the given n is 3, then answer will be 3, so initially there is only one “A”, Now copy this and paste this, so there will be “AA” now. Now we can paste again, so one ‘A’ will be placed. Thus we will get “AAA”.
To solve this, we will follow these steps −
ret := 0
for k in range 2 to nwhile n mod k is not 0ret := ret + k and n := n / k
while n mod k is not 0ret := ret + k and n := n / k
ret := ret + k and n := n / k
return ret
Let us see the following implementation to get better understanding −
 Live Demo
#include <bits/stdc++.h>
using namespace std;
class Solution {
   public:
   int minSteps(int n) {
      int ret = 0;
      for(int k = 2; k <= n; k++){
         for(; n % k == 0; ret += k, n /= k);
      }
      return ret;
   }
};
main(){
   Solution ob;
   cout << (ob.minSteps(10));
}
10
7
Hypergeometric Distribution in R Programming - GeeksforGeeks

10 Jul, 2020
Hypergeometric Distribution in R Language is defined as a method that is used to calculate probabilities when sampling without replacement is to be done in order to get the density value.
In R, there are 4 built-in functions to generate Hypergeometric Distribution:
dhyper()dhyper(x, m, n, k)
dhyper(x, m, n, k)
phyper()phyper(x, m, n, k)
phyper(x, m, n, k)
qhyper()qhyper(x, m, n, k)
qhyper(x, m, n, k)
rhyper()rhyper(N, m, n, k)
rhyper(N, m, n, k)
where,
x: represents the data set of valuesm: size of the populationn: number of samples drawnk: number of items in the populationN: hypergeometrically distributed values
It is defined as Hypergeometric Density Distribution used in order to get the density value.
Syntax:
dhyper(x_dhyper, m, n, k)

Example 1:
   # Specify x-values for dhyper functionx_dhyper <- seq(0, 22, by = 1.2)  # Apply dhyper functiony_dhyper <- dhyper(x_dhyper, m = 45, n = 30, k = 20)      # Plot dhyper valuesplot(y_dhyper) 
Output:
Hypergeometric Cumulative Distribution Function used estimating the number of faults initially resident in a program at the beginning of the test or debugging process based on the hypergeometric distribution and calculate each value in x using the corresponding values.
Syntax:
phyper(x, m, n, k)
Example 1:
# Specify x-values for phyper functionx_phyper <- seq(0, 22, by = 1)        # Apply phyper functiony_phyper <- phyper(x_phyper, m = 40, n = 20, k = 31)    # Plot phyper valuesplot(y_phyper)  
Output:
It is basically Hypergeometric Quantile Function used to specify a sequence of probabilities between 0 and 1.
Syntax:
qhyper(x, m, n, k)
Example 1:
# Specify x-values for qhyper functionx_qhyper <- seq(0, 1, by = 0.02)          # Apply qhyper functiony_qhyper <- qhyper(x_qhyper, m = 49, n = 18, k = 30)      # Plot qhyper valuesplot(y_qhyper)
Output:
It generally refers to generating random numbers function by specifying a seed and sample size.
Syntax:
rhyper(x, m, n, k)
Example 1:
# Set seed for reproducibility# Specify sample sizeset.seed(400)                                 N <- 10000                                        # Draw N hypergeometrically distributed valuesy_rhyper <- rhyper(N, m = 50, n = 20, k = 30) y_rhyper           # Plot of randomly drawn hyper densityhist(y_rhyper,                                               breaks = 50,     main = "")
Output :
R Statistics-Function
R Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Change Color of Bars in Barchart using ggplot2 in R
How to Change Axis Scales in R Plots?
Group by function in R using Dplyr
How to Split Column Into Multiple Columns in R DataFrame?
Replace Specific Characters in String in R
How to filter R DataFrame by values in a column?
How to filter R dataframe by multiple conditions?
R - if statement
How to import an Excel File into R ?
Time Series Analysis in R