code-rag-bench/online-tutorials huggingface dataset:
PyQt5 QSpinBox – Editing Finished Signal

03 Jan, 2022
In this article we will see how we can use the editing finished signal of the spin box, editing finished is the signal generated by the spin box when enter is pressed. We know we can ad action to the spin box when its value get changed but calling a method every time the value get changed is no required sometimes method should get called only when value is set and enter is pressed i.e editing is finished of spin box.
In order to do this we use editingFinished.connec method.
Syntax : spin_box.editingFinished.connect(method_name)
Argument : It takes method name as argument as argument
Action Performed : It calls the passed method every time editing is finished
Below is the implementation
Python3
# importing librariesfrom PyQt5.QtWidgets import * from PyQt5 import QtCore, QtGuifrom PyQt5.QtGui import * from PyQt5.QtCore import * import sys    class Window(QMainWindow):      def __init__(self):        super().__init__()          # setting title        self.setWindowTitle("Python ")          # setting geometry        self.setGeometry(100, 100, 600, 400)          # calling method        self.UiComponents()          # showing all the widgets        self.show()          # method for widgets    def UiComponents(self):        # creating spin box        self.spin = QSpinBox(self)          # setting geometry to spin box        self.spin.setGeometry(100, 100, 250, 40)          # setting prefix to spin        self.spin.setPrefix("Prefix ")          # setting suffix to spin        self.spin.setSuffix(" Suffix")          # creating a label        self.label = QLabel("Label ", self)          # setting geometry to the label        self.label.setGeometry(100, 150, 300, 70)          # adding action when editing get finished        self.spin.editingFinished.connect(self.do_action)      # method called after editing finished    def do_action(self):          # getting current value of spin box        current = self.spin.value()          self.label.setText("Editing finished, final value : " + str(current))    # create pyqt5 appApp = QApplication(sys.argv)  # create the instance of our Windowwindow = Window()  # start the appsys.exit(App.exec())
Output :
anikakapoor
Python PyQt-SpinBox
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
Python OOPs Concepts
How to get text of a tag in selenium – Python?

24 Jan, 2021
Selenium is a powerful tool for controlling web browsers through programs and performing browser automation. It is functional for all browsers, works on all major OS and its scripts are written in various languages i.e Python, Java, C#, etc, we will be working with Python.
In this article, we will write a Python Script for getting the text from the tag name using selenium module. We will be getting the tag text from this URL.
Step #1: Import required libraries
Python3
# Import Libraryfrom selenium import webdriver
Step #2: Create a Chrome object or specify web driver path if it is not present in the default path and assign URL.
Python3
# Chrome Pathdriver = webdriver.Chrome('Enter Chrome Path')  # Web URLdriver.get('Enter Web URL')
Step #3: Specify the tag name, which you want to extract the text. 
Syntax:
Object Name.find_element_by_tag_name(Tag Name)
Python3
# Get Textprint (element.text)  # Close the windowdriver.close()
Below is the implementation.
Python3
# Import Libraryfrom selenium import webdriver  # Chrome Pathdriver = webdriver.Chrome()  # Web URLdriver.get('https://phptravels.com/demo/')  element = driver.find_element_by_tag_name('a')  # Get Textprint(element.text)  # Close the windowdriver.close()
Output:
Picked
Python-selenium
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
Introduction To PYTHON
How to drop one or multiple columns in Pandas Dataframe
Python | os.path.join() method
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
Python | Get unique values from a list
Create a directory in Python
std::divides in C++

06 Aug, 2017
Function object for performing division. Effectively calls operator / on two instances of type T.
Syntax :

template  struct divides : binary_function  
{
    T operator() (const T& x, const T& y) const {return x/y;}
};

Template Parameters :
T - Type of the arguments and return type of the functional call.
    The type shall support the operation (operator /).

Member types :
x : Type of the first argument in member operator()
y : Type of the second argument in member operator()
result_type : Type returned by member operator()

Example :
// C++ program to illustrate std::divides// by dividing the respective elements of 2 arrays#include <iostream> // std::cout#include <functional> // std::divides#include <algorithm> // std::transform  int main(){    // First array    int first[] = { 10, 20, 30, 40, 50 };      // Second array    int second[] = { 1, 2, 3, 4, 5 };      // Result array    int results[5];      // std::transform applies std::divides to the whole array    std::transform(first, first + 5, second, results, std::divides<int>());      // Printing the result array    for (int i = 0; i < 5; i++)        std::cout << results[i] << " ";      return 0;}
Output:
10 10 10 10 10
Another Example :
// C++ program to illustrate std::divides// by dividing all array elements with a number#include <bits/stdc++.h>  int main(){    // Array with elements to be divided    int arr[] = { 10, 10 };      // size of array    int size = sizeof(arr) / sizeof(arr[0]);      // Variable with which array is to be divided    int num = 100;      // Variable to store result    int result;      // using std::accumulate to perform division on array with num    // using std::divides    result = std::accumulate(arr, arr + size, num, std::divides<int>());      // Printing the result    std::cout << "The result of (100 / 10) / 10 is " << result;      return 0;}
Output:
The result of (100 / 10) / 10 is 1

This article is contributed by Rohit Thapliyal. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
STL
C++
STL
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Sorting a vector in C++
Polymorphism in C++
Pair in C++ Standard Template Library (STL)
Friend class and function in C++
std::string class in C++
Queue in C++ Standard Template Library (STL)
std::find in C++
Unordered Sets in C++ Standard Template Library
List in C++ Standard Template Library (STL)
vector insert() function in C++ STL
Python | Calculate Distance between two places using Geopy

19 Jul, 2019
GeoPy is a Python library that makes geographical calculations easier for the users. In this article, we will see how to calculate the distance between 2 points on the earth in two ways.
How to Install GeoPy ?
pip install geopy
 Geodesic Distance:It is the length of the shortest path between 2 points on any surface. In our case, the surface is the earth. Below program illustrates how to calculate geodesic distance from latitude-longitude data.
# Importing the geodesic module from the libraryfrom geopy.distance import geodesic  # Loading the lat-long data for Kolkata & Delhikolkata = (22.5726, 88.3639)delhi = (28.7041, 77.1025)  # Print the distance calculated in kmprint(geodesic(kolkata, delhi).km)
Output:
1318.13891581683
 Great Circle Distance:It is the length of the shortest path between 2 points on a sphere. In this case, the earth is assumed to be a perfect sphere. Below program illustrates how to calculate great-circle distance from latitude-longitude data.
# Importing the great_circle module from the libraryfrom geopy.distance import great_circle  # Loading the lat-long data for Kolkata & Delhikolkata = (22.5726, 88.3639)delhi = (28.7041, 77.1025)  # Print the distance calculated in kmprint(great_circle(kolkata, delhi).km)
Output:
1317.7554645657162
Reference: https://geopy.readthedocs.io/en/stable/
python-modules
python-utility
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Class getSimpleName() method in Java with Examples - GeeksforGeeks

25 Jan, 2022
The getSimpleName() method of java.lang.Class class is used to get the simple name of this class, as given in the sourcecode. The method returns the simple name of this class in the form of String. If this class is anonymous, then this method returns empty string.Syntax:  
public String getSimpleName()
Parameter: This method does not accept any parameter.Return Value: This method returns the simple name of this class in the form of String. If this class is anonymous, then this method returns empty string.Below programs demonstrate the getSimpleName() method.Example 1: 
Java
// Java program to demonstrate getSimpleName() method import java.util.*; public class Test {    public static void main(String[] args)        throws ClassNotFoundException    {         // returns the Class object for this class        Class myClass = Class.forName("Test");         System.out.println("Class represented by myClass: "                           + myClass.toString());         // Get the simple name of myClass        // using getSimpleName() method        System.out.println("SimpleName of myClass: "                           + myClass.getSimpleName());    }}
Class represented by myClass: class Test
SimpleName of myClass: Test
 
Example 2: 
Java
// Java program to demonstrate getSimpleName() method import java.util.*; class Main {     public Object obj;     Main()    {         class Arr {        };         obj = new Arr();    }     public static void main(String[] args)        throws ClassNotFoundException    {        Main t = new Main();         // returns the Class object        Class myClass = t.obj.getClass();         // Get the simple name of myClass        // using getSimpleName() method        System.out.println("SimpleName of myClass: "                           + myClass.getSimpleName());    }}
SimpleName of myClass: Arr
 
Reference: https://docs.oracle.com/javase/9/docs/api/java/lang/Class.html#getSimpleName– 
adnanirshad158
Java-Functions
Java-lang package
Java.lang.Class
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Functional Interfaces in Java
Stream In Java
Constructors in Java
Different ways of Reading a text file in Java
Exceptions in Java
Generics in Java
Comparator Interface in Java with Examples
Strings in Java
How to remove an element from ArrayList in Java?
Difference between Abstract Class and Interface in Java
Tryit Editor v3.7

Tryit: HTML src attribute
How to Disable / Enable a Button in TKinter?

There are various attributes and properties in each tkinter widget to help us extend the functionality of the application. Tkinter Button widgets can be enabled and disabled by defining its state in the Button Object. The state attribute generally accepts two values Normal and Disabled which are used for enabling and disabling the button, respectively.
#Import necessary Library
from tkinter import *
from tkinter import ttk
from tkinter.filedialog import asksaveasfile
#Create an instance of tkinter window
win= Tk()
#Set the geometry of tkinter window
win.geometry("750x250")
#Define the function to change the value in label widget
def change_text(label):
   label.configure(text= "Hey, I am Label-2", background="gray91")
#Create a Label
label = Label(win, text= "Hey, I am Label-1", font= ('Helvetica
15 underline'), background="gray76")
label.pack(pady=20)
#Create a button
btn= ttk.Button(win,text= "Change", command=
lambda:change_text(label), state= DISABLED)
btn.pack(pady=10)
win.mainloop()
Running the above code will display a window that has a disabled button. We can change the state of the button to Normal.
Now, change the value of the state attribute to NORMAL to make the button active on the window.
Prime number program in Java.

Following is the required program.
Live Demo
public class Tester {
   public static void main(String args[]) {
      int i, m = 0, flag = 0;
      int n = 41;// it is the number to be checked
      m = n / 2;
      if (n == 0 || n == 1) {
         System.out.println(n + " not a prime number");
      } else {
         for (i = 2; i <= m; i++) {
            if (n % i == 0) {
               System.out.println(n + " not a prime number");
               flag = 1;
               break;
            }
         }
         if (flag == 0) {
            System.out.println(n + " is a prime number");
         }
      }
   }
}
41 is a prime number.
What are reference data types in Java?

Reference datatypes in java are those which contains reference/address of dynamically created objects. These are not predefined like primitive data types.
Following are the reference types in Java.
class types − This reference type points to an object of a class.
class types − This reference type points to an object of a class.
array types − This reference type points to an array.
array types − This reference type points to an array.
interface types − This reference type points to an object of a class which implements an interface.
interface types − This reference type points to an object of a class which implements an interface.
Once we create a variable of these types (i.e. when we create an array or object, class or interface).
These variables only store the address of these values.
These variables only store the address of these values.
Default value of any reference variable is null.
Default value of any reference variable is null.
A reference variable can be used to refer any object of the declared type or any compatible type.
A reference variable can be used to refer any object of the declared type or any compatible type.
Animal animal = new Animal("giraffe");
Python IF...ELIF...ELSE Statements

An else statement can be combined with an if statement. An else statement contains the block of code that executes if the conditional expression in the if statement resolves to 0 or a FALSE value.
The else statement is an optional statement and there could be at most only one else statement following if.
The syntax of the if...else statement is −
if expression:
   statement(s)
else:
   statement(s)

#!/usr/bin/python

var1 = 100
if var1:
   print "1 - Got a true expression value"
   print var1
else:
   print "1 - Got a false expression value"
   print var1

var2 = 0
if var2:
   print "2 - Got a true expression value"
   print var2
else:
   print "2 - Got a false expression value"
   print var2

print "Good bye!"
When the above code is executed, it produces the following result −
1 - Got a true expression value
100
2 - Got a false expression value
0
Good bye!

The elif statement allows you to check multiple expressions for TRUE and execute a block of code as soon as one of the conditions evaluates to TRUE.
Similar to the else, the elif statement is optional. However, unlike else, for which there can be at most one statement, there can be an arbitrary number of elif statements following an if.
if expression1:
   statement(s)
elif expression2:
   statement(s)
elif expression3:
   statement(s)
else:
   statement(s)

Core Python does not provide switch or case statements as in other languages, but we can use if..elif...statements to simulate switch case as follows −
#!/usr/bin/python

var = 100
if var == 200:
   print "1 - Got a true expression value"
   print var
elif var == 150:
   print "2 - Got a true expression value"
   print var
elif var == 100:
   print "3 - Got a true expression value"
   print var
else:
   print "4 - Got a false expression value"
   print var

print "Good bye!"
When the above code is executed, it produces the following result −
3 - Got a true expression value
100
Good bye!


    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 remove object from array in MongoDB?

You can use $pull operator to remove the object from an array in MongoDB. To understand the concept, let us create a collection with the document. The query to create a collection with a document is as follows −
> db.removeObjectFromArrayDemo.insertOne(
... {
   ...
   ... "StudentName": "John",
   ... "StudentAcademicProjectDetails":
   ... [{
         ... "StudentProjectId": 101,
         ... "StudentProjectName": "Pig Dice Game"
      ... },
      ... {
         ... "StudentProjectId": 110,
         ... "StudentProjectName": "Library Management System"
      ... },
      ...
      ... {
         ... "StudentProjectId": 120,
         ... "StudentProjectName": "Phonebook Management System"
      ... }
   ... ]
   ... }
... );
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5c8ad13d6cea1f28b7aa0817")
}
Display all documents from a collection with the help of find() method. The query is as follows −
> db.removeObjectFromArrayDemo.find().pretty();
The following is the output −
{
   "_id" : ObjectId("5c8ad13d6cea1f28b7aa0817"),
   "StudentName" : "John",
   "StudentAcademicProjectDetails" : [
      {
         "StudentProjectId" : 101,
         "StudentProjectName" : "Pig Dice Game"
      },
      {
         "StudentProjectId" : 110,
         "StudentProjectName" : "Library Management System"
      },
      {
         "StudentProjectId" : 120,
         "StudentProjectName" : "Phonebook Management System"
      }
   ]
}
Here is the query to remove the object from an array in MongoDB −
> db.removeObjectFromArrayDemo.update(
   ... {'_id': ObjectId("5c8ad13d6cea1f28b7aa0817")},
   ... { $pull: { "StudentAcademicProjectDetails" : { StudentProjectId: 101 } } },
   ... false,
   ... true
... );
WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })
Let us check the documents from collection to check the object has been removed from an array or not. The query is as follows −
> db.removeObjectFromArrayDemo.find().pretty();
The following is the output −
{
   "_id" : ObjectId("5c8ad13d6cea1f28b7aa0817"),
   "StudentName" : "John",
   "StudentAcademicProjectDetails" : [
      {
         "StudentProjectId" : 110,
         "StudentProjectName" : "Library Management System"
      },
      {
         "StudentProjectId" : 120,
         "StudentProjectName" : "Phonebook Management System"
      }
   ]
}
Look at the above sample output, the field “StudentProjectId” with 101 has been removed.
Dictionary elements() Method in Java with Examples - GeeksforGeeks

27 Dec, 2018
The keys() method of Dictionary class in Java is used to get the enumeration of the values present in the dictionary.
Syntax:
Enumeration enu = DICTIONARY.elements()
Parameters: The method does not take any parameters.
Return value: The method returns an enumeration of the values of the Dictionary.
Below programs are used to illustrate the working of the java.util.Dictionary.elements() method:Program 1:
// Java code to illustrate the elements() methodimport java.util.*;  public class Dictionary_Demo {    public static void main(String[] args)    {          // Creating an empty Dictionary        Dictionary<Integer, String> dict            = new Hashtable<Integer, String>();          // Inserting elements into the Dictionary        dict.put(10, "Geeks");        dict.put(15, "4");        dict.put(20, "Geeks");        dict.put(25, "Welcomes");        dict.put(30, "You");          // Displaying the Dictionary        System.out.println("The Dictionary is: " + dict);          // Creating an empty enumeration to store        Enumeration enu = dict.elements();          System.out.println("The enumeration of values are:");          // Displaying the Enumeration        while (enu.hasMoreElements()) {            System.out.println(enu.nextElement());        }    }}
The Dictionary is: {10=Geeks, 20=Geeks, 30=You, 15=4, 25=Welcomes}
The enumeration of values are:
Geeks
Geeks
You
4
Welcomes

Program 2:
// Java code to illustrate the elements() methodimport java.util.*;  public class Dictionary_Demo {    public static void main(String[] args)    {          // Creating an empty Dictionary        Dictionary<String, Integer> dict            = new Hashtable<String, Integer>();          // Inserting elements into the table        dict.put("Geeks", 10);        dict.put("4", 15);        dict.put("Geeks", 20);        dict.put("Welcomes", 25);        dict.put("You", 30);          // Displaying the Dictionary        System.out.println("The Dictionary is: " + dict);          // Creating an empty enumeration to store        Enumeration enu = dict.elements();          System.out.println("The enumeration of values are:");          // Displaying the Enumeration        while (enu.hasMoreElements()) {            System.out.println(enu.nextElement());        }    }}
The Dictionary is: {You=30, Welcomes=25, 4=15, Geeks=20}
The enumeration of values are:
30
25
15
20

Java - util package
Java-Collections
Java-Functions
Java
Java
Java-Collections
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Different ways of Reading a text file in Java
Stream In Java
Constructors in Java
Exceptions in Java
Generics in Java
Functional Interfaces in Java
HashMap get() Method in Java
Comparator Interface in Java with Examples
Strings in Java
StringBuilder Class in Java with Examples
Java Program for Radix Sort - GeeksforGeeks

24 May, 2019
The Radix Sort Algorithm1) Do following for each digit i where i varies from least significant digit to the most significant digit..............a) Sort input array using counting sort (or any stable sort) according to the i\’th digit.
// Radix sort Java implementationimport java.io.*;import java.util.*;  class Radix {      // A utility function to get maximum value in arr[]    static int getMax(int arr[], int n)    {        int mx = arr[0];        for (int i = 1; i < n; i++)            if (arr[i] > mx)                mx = arr[i];        return mx;    }      // A function to do counting sort of arr[] according to    // the digit represented by exp.    static void countSort(int arr[], int n, int exp)    {        int output[] = new int[n]; // output array        int i;        int count[] = new int[10];        Arrays.fill(count,0);          // Store count of occurrences in count[]        for (i = 0; i < n; i++)            count[ (arr[i]/exp)%10 ]++;          // Change count[i] so that count[i] now contains        // actual position of this digit in output[]        for (i = 1; i < 10; i++)            count[i] += count[i - 1];          // Build the output array        for (i = n - 1; i >= 0; i--)        {            output[count[ (arr[i]/exp)%10 ] - 1] = arr[i];            count[ (arr[i]/exp)%10 ]--;        }          // Copy the output array to arr[], so that arr[] now        // contains sorted numbers according to current digit        for (i = 0; i < n; i++)            arr[i] = output[i];    }      // The main function to that sorts arr[] of size n using    // Radix Sort    static void radixsort(int arr[], int n)    {        // Find the maximum number to know number of digits        int m = getMax(arr, n);          // Do counting sort for every digit. Note that instead        // of passing digit number, exp is passed. exp is 10^i        // where i is current digit number        for (int exp = 1; m/exp > 0; exp *= 10)            countSort(arr, n, exp);    }      // A utility function to print an array    static void print(int arr[], int n)    {        for (int i=0; i<n; i++)            System.out.print(arr[i]+" ");    }        /*Driver function to check for above function*/    public static void main (String[] args)    {        int arr[] = {170, 45, 75, 90, 802, 24, 2, 66};        int n = arr.length;        radixsort(arr, n);        print(arr, n);    }}/* This code is contributed by Devesh Agrawal */
Please refer complete article on Radix Sort for more details!
nidhi_biet
Java Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to Iterate HashMap in Java?
Iterate Over the Characters of a String in Java
How to Get Elements By Index from HashSet in Java?
Java Program to Write into a File
Modulo or Remainder Operator in Java
Java Program to Convert String to String Array
Java Program to Find Sum of Array Elements
How to Replace a Element in Java ArrayList?
How to Iterate LinkedList in Java?
How to convert Date to String in Java
umask() - Unix, Linux System Call

Unix - Home
Unix - Getting Started
Unix - File Management
Unix - Directories
Unix - File Permission
Unix - Environment
Unix - Basic Utilities
Unix - Pipes & Filters
Unix - Processes
Unix - Communication
Unix - The vi Editor
Unix - What is Shell?
Unix - Using Variables
Unix - Special Variables
Unix - Using Arrays
Unix - Basic Operators
Unix - Decision Making
Unix - Shell Loops
Unix - Loop Control
Unix - Shell Substitutions
Unix - Quoting Mechanisms
Unix - IO Redirections
Unix - Shell Functions
Unix - Manpage Help
Unix - Regular Expressions
Unix - File System Basics
Unix - User Administration
Unix - System Performance
Unix - System Logging
Unix - Signals and Traps
Unix - Useful Commands
Unix - Quick Guide
Unix - Builtin Functions
Unix - System Calls
Unix - Commands List
Unix Useful Resources
Computer Glossary
Who is Who
Copyright © 2014 by tutorialspoint
umask - set file mode creation mask
#include <sys/types.h>
#include <sys/stat.h> 
mode_t umask(mode_t mask); 


mode_t umask(mode_t mask); 

umask() sets the calling process’s file mode creation mask (umask) to mask & 0777.
The umask is used by open(2),
mkdir(2),
and other system calls that create files
to modify the permissions placed on newly created files or directories.
Specifically, permissions in the umask are turned off from
the mode argument to
open(2)
and
mkdir(2).
The constants that should be used to specify
mask are described under
stat(2).
The typical default value for the process umask is
S_IWGRP | S_IWOTH
(octal 022).
In the usual case where the
mode argument to
open(2)
is specified as:
S_IRUSR | S_IWUSR | S_IRGRP | S_IWRGRP | S_IROTH | S_IWOTH

(octal 0666) when creating a new file, the permissions on the
resulting file will be:
S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH

(because 0666 & ~022 = 0644; i.e., rw-r--r--).
This system call always succeeds and the previous value of the mask
is returned.
A child process created via
fork(2)
inherits its parent’s umask.
The umask is left unchanged by
execve(2).
SVr4, 4.3BSD, POSIX.1-2001.
chmod (2)
chmod (2)
mkdir (2)
mkdir (2)
open (2)
open (2)
stat (2)
stat (2)

Advertisements


    129 Lectures 
     23 hours 

 Eduonix Learning Solutions

    5 Lectures 
     4.5 hours 

 Frahaan Hussain

    35 Lectures 
     2 hours 

 Pradeep D

    41 Lectures 
     2.5 hours 

 Musab Zayadneh

    46 Lectures 
     4 hours 

 GUHARAJANM

    6 Lectures 
     4 hours 

 Uplatz
 Print
 Add Notes
 Bookmark this page
How to add icons in the button in HTML ?

13 Jan, 2022
We can add icons on buttons in so many ways but we will try that in pure HTML. 
We have to use external fonts links for the icons. Applying icons on the button makes the user easy to understand the functionality of that button.
Font Awesome icon in your form is an innovative idea, that will bring attention to your website. It is as simple as applying Font Awesome icon on any button. The <i> tag and <span> tag are used widely to add icons on the webpages. To add any icons on the web pages, it needs the font-awesome link inside the head section. The font-awesome icon can be placed by using the fa prefix before the icon’s name.CDN Link:
https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css
Example: In this example, we will take a form where the button is necessary. After that, we will place the font-awesome icon inside the button. We will use the CDN link to use the font-awesome icons. After the button, we will place our icon.
HTML
<!DOCTYPE html><html>  <head>    <!-- Add icon library -->    <link rel="stylesheet"          href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">    <style>      h1 {          color: green;      }      .btn {          background-color: light-green;          padding: 12px 16px;          font-size: 16px;      }      .btn:hover {          background-color: green;      }    </style></head>  <body>    <center>        <h1>GeeksforGeeks</h1>        <h2>How to add icons in the button in HTML?</h2>        <button class="btn">            <i class="fa fa-bolt"></i>        </button>        <button class="btn">            <i class="fa fa-fire"></i>        </button>        <button class="btn">            <i class="fa fa-tree"></i>        </button>        <button class="btn">            <i class="fa fa-trash"></i>        </button>    </center></body>  </html>
Output:
HTML-Questions
Picked
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
REST API (Introduction)
Design a Tribute Page using HTML & CSS
Build a Survey Form using HTML and CSS
Angular File Upload
Form validation using jQuery
Installation of Node.js on Linux
Difference between var, let and const keywords in JavaScript
How to fetch data from an API in ReactJS ?
Differences between Functional Components and Class Components in React
Remove elements from a JavaScript Array
HTML <option> Tag

17 Mar, 2022
The <option> tag in HTML is used to choose an option from a Drop-Down menu. This tag can be used with or without any attributes and needed value can be sent to the server. The group of options can be created using <optgroup> Tag. It creates a group of related menu items.
Syntax: 
<option> Contents... </option>
Attributes: The <option> tag contains four attributes which are listed below: 
disabled: This attribute contains the value disabled which represents the option is disabled.
label: This attribute contains the text value which represents the shorted label for the option.
selected: This attribute contains the value selected which represents the item that is pre-selected when the browser loaded.
value: This attribute contains the value text sent to the server.
Example 1: 
HTML
<!DOCTYPE html><html>  <body>    <h1>GeeksforGeeks</h1>    <h2>HTML option Tag</h2>    <select>        <!-- option tag starts -->            <option>Choose an option</option>            <option value="html">HTML</option>            <option value="java">JAVA</option>            <option value="C++">C++</option>            <option value="php">PHP</option>            <option value="perl">PERL</option>        <!-- option tag ends -->        </select></body>  </html>
Output:  
Example 2: 
HTML
<!DOCTYPE html><html>  <body>    <h1>GeeksforGeeks</h1>    <h2>HTML option Tag</h2>    <strong>Select City<br></strong>    <select>        <!-- option tag starts -->            <option>Allahabad</option>            <option>Pryagraj</option>            <option>Jaipur</option>            <option>Noida</option>        <!-- option tag ends     -->        </select></body>  </html>
Output:  
Supported Browsers: 
Google Chrome
Internet Explorer
Firefox
Safari
Opera
ghoshsuman0129
HTML-Tags
HTML
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to update Node.js and NPM to next version ?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to insert spaces/tabs in text using HTML/CSS?
REST API (Introduction)
Hide or show elements in HTML using display property
How to set the default value for an HTML <select> element ?
How to set input type date in dd-mm-yyyy format using HTML ?
CSS to put icon inside an input element in a form
Design a Tribute Page using HTML & CSS
Types of CSS (Cascading Style Sheet)
HTTP headers | Access-Control-Allow-Methods

08 Jun, 2020
The Access-Control-Allow-Methods header is a  Cross-Origin Resource Sharing(CORS) response-type header. It is used to indicate which HTTP methods are permitted while accessing the resources in response to the cross-origin requests. 
Syntax: 
Access-Control-Allow-Methods: <method>, <method>, ...

OR
Access-Control-Allow-Methods: *

Directives:  This header accepts two directive as mentioned above and described below:
<method>: This directive consists of a list of HTTP request methods separated by a comma.
*: This directive is a wildcard value to indicate all the requests lacking credentials like HTTP cookies or HTTP authentication information.  
Examples: 
Access-Control-Allow-Methods: POST, GET, OPTIONS 

Access-Control-Allow-Methods: *

Supported Browsers:  The browsers  are compatible with HTTP Access-Control-Allow-Methods header are listed below: 
Google Chrome 
Edge 
Opera 
Firefox 
HTTP-headers
Picked
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
SQL Joins

A JOIN clause is used to combine rows from two or more tables, based on 
a related column between them.
Let's look at a selection from the "Orders" table:
Then, look at a selection from the "Customers" table:
Notice that the "CustomerID" column in the "Orders" table refers to the 
"CustomerID" in the "Customers" table. The relationship between the two tables above 
is the "CustomerID" column.
Then, we can create the following SQL statement (that contains an 
INNER JOIN), 
that selects records that have matching values in both tables:
and it will produce something like this:
Here are the different types of the JOINs in SQL:
(INNER) JOIN: Returns records that have matching values in both tables
LEFT (OUTER) JOIN: Returns all records from the left table, and the matched records from the right table
RIGHT (OUTER) JOIN: Returns all records from the right table, and the matched 
  records from the left table
FULL (OUTER) JOIN: Returns all records when there is a match in either left 
  or right table

 
 
 


Insert the missing parts in the JOIN clause to join the two tables Orders and Customers,
using the CustomerID field in both tables as the relationship between the two tables.
SELECT *
FROM Orders
LEFT JOIN Customers
=;

Start the Exercise
We just launchedW3Schools videos
Get certifiedby completinga course today!
If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:
help@w3schools.com
Your message has been sent to W3Schools.
Matplotlib.axis.Axis.get_major_ticks() function in Python - GeeksforGeeks

03 Jun, 2020
Matplotlib is a library in Python and it is numerical – mathematical extension for NumPy library. It is an amazing visualization library in Python for 2D plots of arrays and used for working with the broader SciPy stack.
The Axis.get_major_ticks() function in axis module of matplotlib library is used to get the tick instances. 
Syntax: Axis.get_major_ticks(self, numticks=None)  
Parameters: This method accepts the following parameter. 
numticks : This parameter is the number of ticks.
Return value: This method returns the tick instances. 
Below examples illustrate the matplotlib.axis.Axis.get_major_ticks() function in matplotlib.axis:
Example 1:
Python3
# Implementation of matplotlib function import numpy as npfrom matplotlib.axis import Axis  import matplotlib.pyplot as pltimport matplotlib.ticker as ticker     np.random.seed(19680801)  fig, ax = plt.subplots()ax.plot(100*np.random.rand(20))  formatter = ticker.FormatStrFormatter('%1.2f')Axis.set_major_formatter(ax.yaxis, formatter)  print("Value of get_major_ticks() :")for tick in ax.yaxis.get_major_ticks(2):    tick.label1.set_color('green')    print(tick)  plt.title("Matplotlib.axis.Axis.get_major_ticks()\n\Function Example", fontsize = 12, fontweight ='bold')   plt.show()
Output:  
 
Value of get_major_ticks() :
<matplotlib.axis.XTick object at 0x08A46250>
<matplotlib.axis.XTick object at 0x08A46230>

Example 2:
Python3
# Implementation of matplotlib function import numpy as npfrom matplotlib.axis import Axis  import matplotlib.pyplot as pltimport matplotlib.ticker as ticker     np.random.seed(19680801)  fig, ax = plt.subplots()ax.plot(100*np.random.rand(20))  formatter = ticker.FormatStrFormatter('%1.2f')Axis.set_major_formatter(ax.yaxis, formatter)  print("Value of get_major_ticks() :")for tick in ax.xaxis.get_major_ticks():    tick.label1.set_color('red')    print(tick)  plt.title("Matplotlib.axis.Axis.get_major_ticks()\n\Function Example", fontsize = 12, fontweight ='bold')   plt.show()
Output:  
 
Value of get_major_ticks() :
<matplotlib.axis.YTick object at 0x07EB79F0>
<matplotlib.axis.YTick object at 0x07EB7670>
<matplotlib.axis.YTick object at 0x07EA8EB0>
<matplotlib.axis.YTick object at 0x090A30B0>
<matplotlib.axis.YTick object at 0x090A32D0>
<matplotlib.axis.YTick object at 0x090A3570>
<matplotlib.axis.YTick object at 0x090A3830>

 
Matplotlib-Axis Class
Python-matplotlib
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Create a Pandas DataFrame from Lists
Python | Get dictionary keys as a list
Enumerate() in Python
Python Dictionary
Bar Plot in Matplotlib
Multithreading in Python | Set 2 (Synchronization)
Python Dictionary keys() method
loops in python
Python - Call function from another file
Ways to filter Pandas DataFrame by column values
Sorting arrays using bubble sort in JavaScript

We are required to write a JavaScript function that takes in an array of literals and sorts it using bubble sort.
The code for this will be −
const arr = [4, 56, 4, 23, 8, 4, 23, 2, 7, 8, 8, 45];
const swap = (items, firstIndex, secondIndex) => {
   var temp = items[firstIndex];
   items[firstIndex] = items[secondIndex];
   items[secondIndex] = temp;
};
const bubbleSort = items => {
   var len = items.length,
   i, j;
   for (i=len-1; i >= 0; i--){
      for (j=len-i; j >= 0; j--){
         if (items[j] < items[j-1]){
            swap(items, j, j-1);
         }
      }
   }
   return items;
};
console.log(bubbleSort(arr));
The output in the console −
[
   2, 4, 4, 4, 7,
   8, 8, 8, 23, 23,
   45, 56
]
How to put string in array, split by new line in PHP ? - GeeksforGeeks

24 Jan, 2022
Given a string concatenated with several new line character. The task is to split that string and store them into array such that strings are splitted by the newline.Example:  
 Input : string is 'Ankit \n Ram \n Shyam'
 Output : Array
(
    [0] => Ankit
    [1] => Ram
    [2] => Shyam
)
Using explode() Function: The explode() function splits a string based on a string delimiter, i.e. it splits the string wherever the delimiter character occurs. This functions returns an array containing the strings formed by splitting the original string. This function accepts separator and string to be separated and optional argument length of string to be separated.Example:  
php
<?php // PHP program to separate string// using explode function // String which to be converted$str = "Ankit Mishra\nRam Singh\nShyam Pandey"; // Function to convert string to array$arr = explode("\n", $str); // Print the information of arrayprint_r($arr);?>
Array
(
    [0] => Ankit Mishra
    [1] => Ram Singh
    [2] => Shyam Pandey
)
 
Using preg_split() Function: The function splits the string into smaller strings or sub-strings of length which is specified by the user. If the limit is specified then small string or sub-strings up to limit return through an array. The preg_split() function is similar to explode() function but the difference is used to the regular expression to specify the delimiter but explode is not used it. This function takes first argument as regular expression which is used for splitting second argument is as string which is to be splitted.Example:  
php
<?php // A php program to separate string// using preg_split() function // String which to be converted$str = "Ankit Mishra\nRam Singh\nShyam Pandey"; // This function converts the string$arr= preg_split ('/\n/', $str); // print the information of arrayprint_r($arr);?>
Array
(
    [0] => Ankit Mishra
    [1] => Ram Singh
    [2] => Shyam Pandey
)
 
saurabh1990aror
Picked
Web-Programs
PHP
PHP Programs
Web Technologies
PHP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Insert Form Data into Database using PHP ?
How to convert array to string in PHP ?
How to Upload Image into Database and Display it using PHP ?
How to check whether an array is empty using PHP?
PHP | Converting string to Date and DateTime
How to Insert Form Data into Database using PHP ?
How to convert array to string in PHP ?
How to call PHP function on the click of a Button ?
How to Upload Image into Database and Display it using PHP ?
How to check whether an array is empty using PHP?
C# | How to get First Element of the Tuple? - GeeksforGeeks

30 Apr, 2019
Tuple is a data structure which gives you the easiest way to represent a data set which has multiple values that may/may not be related to each other. Item1 Property is used to get the first element of the given tuple. It is applicable on every tuple like 1-Tuple, 2-Tuple, and so on.
Syntax:
public T1 Item1 { get; }
Here, T1 is the value of the current Tuple<> object’s first component. This Tuple<> can be 1-tuple, or 2-tuple, or 3-tuple, or 4-tuple, or 5-tuple, or 6-tuple, or 7-tuple, or 8-tuple.
Example: In the below code, you can see that we are accessing the first element of each tuple.
// C# program to illustrate how to get // the first element of the tupleusing System;  class GFG {      // Main method    static public void Main()    {          // Taking 1-tuple        var st1 = Tuple.Create("Mohan");        Console.WriteLine("Student-1 Name: " + st1.Item1);          // Taking 2-tuple        var st2 = Tuple.Create("Sohan", 20);        Console.WriteLine("Student-2 Name: " + st2.Item1);          // Taking 3-tuple        var st3 = Tuple.Create("Soniya", 30, "CSE");        Console.WriteLine("Student-3 Name: " + st3.Item1);          // Taking 4-tuple        var st4 = Tuple.Create("Rohan", 29, "CSE", 2015);        Console.WriteLine("Student-4 Name: " + st4.Item1);          // Taking 5-tuple        var st5 = Tuple.Create("Siya", 22, "CSE", 2017,                                           "20-Mar-1993");          Console.WriteLine("Student-5 Name: " + st5.Item1);          // Taking 6-tuple        var st6 = Tuple.Create("Riya", 24, "CSE", 2015,                               "30-May-2015", 230134832);          Console.WriteLine("Student-6 Name: " + st6.Item1);          // Taking 7-tuple        var st7 = Tuple.Create("Rohit", 21, "CSE", 2017,                         "21-Apr-1998", 384749829, 20000);          Console.WriteLine("Student-7 Name: " + st7.Item1);          // Taking 8-tuple        var st8 = Tuple.Create("Manita", 24, "CSE", 2016,                    "03-Aug-1991", 235678909, 34000, "C#");          Console.WriteLine("Student-8 Name: " + st8.Item1);    }}
Student-1 Name: Mohan
Student-2 Name: Sohan
Student-3 Name: Soniya
Student-4 Name: Rohan
Student-5 Name: Siya
Student-6 Name: Riya
Student-7 Name: Rohit
Student-8 Name: Manita

CSharp-Tuple
C#
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
C# | Delegates
C# | Method Overriding
C# | Abstract Classes
Difference between Ref and Out keywords in C#
Extension Method in C#
C# | Class and Object
C# | Constructors
C# | String.IndexOf( ) Method | Set - 1
C# | Replace() Method
Introduction to .NET Framework
LocalTime toEpochSecond() method in Java with Examples - GeeksforGeeks

04 Dec, 2018
The toEpochSecond() method of LocalTime class is used to convert this LocalTime to the number of seconds since the epoch of 1970-01-01T00:00:00Z. The method combines this local time with the specified date and offset passed as parameters to calculate the epoch-second value, which is the number of elapsed seconds from 1970-01-01T00:00:00Z. Instants on the timeline after the epoch are positive, earlier are negative.
Syntax:
public long 
         toEpochSecond(LocalDate date,
                          ZoneOffset offset)

Parameters: This method accepts two parameters:
date: It is the date which is to be used for epoch second calculation as the target date.
offset: It is the zone offset.
Return value: This method returns number of seconds since the epoch of 1970-01-01T00:00:00Z. It may be negative.
Below programs illustrate the toEpochSecond() method:
Program 1:
// Java program to demonstrate// LocalTime.toEpochSecond() method  import java.time.*;  public class GFG {    public static void main(String[] args)    {          // create a LocalDate object        LocalDate date            = LocalDate.parse("2018-12-29");          // create a LocalTime object        LocalTime time            = LocalTime.parse("20:12:32");          // print Instant        System.out.println("LocalDate: " + date);          // create ZoneId        ZoneOffset zone = ZoneOffset.of("Z");          // print ZoneId        System.out.println("ZoneOffset: " + zone);          // apply ofInstant()        long value = time.toEpochSecond(date, zone);          // print result        System.out.println("Epoch Second: "                           + value);    }}
LocalDate: 2018-12-29
ZoneOffset: Z
Epoch Second: 1546114352

Program 2:
// Java program to demonstrate// LocalTime.toEpochSecond() method  import java.time.*;  public class GFG {    public static void main(String[] args)    {          // create a LocalDate object        LocalDate date            = LocalDate.parse("1909-04-18");          // create a LocalTime object        LocalTime time            = LocalTime.parse("00:10:09");          // print Instant        System.out.println("LocalDate: " + date);          // create ZoneId        ZoneOffset zone = ZoneOffset.of("Z");          // print ZoneId        System.out.println("ZoneOffset: " + zone);          // apply ofInstant()        long value = time.toEpochSecond(date, zone);          // print result        System.out.println("Epoch Second: "                           + value);    }}
LocalDate: 1909-04-18
ZoneOffset: Z
Epoch Second: -1915746591

References: https://docs.oracle.com/javase/10/docs/api/java/time/LocalTime.html#toEpochSecond(java.time.LocalDate, java.time.ZoneOffset)
Java-Functions
Java-LocalTime
Java-time package
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Object Oriented Programming (OOPs) Concept in Java
HashMap in Java with Examples
Stream In Java
How to iterate any Map in Java
ArrayList in Java
Initialize an ArrayList in Java
Stack Class in Java
Multidimensional Arrays in Java
Singleton Class in Java
Set in Java