code-rag-bench/online-tutorials huggingface dataset:
turtle.Screen().turtles() function in Python

27 Aug, 2021
The turtle module provides turtle graphics primitives, in both object-oriented and procedure-oriented ways. Because it uses Tkinter for the underlying graphics, it needs a version of Python installed with Tk support.
This function is used to return the list of turtles on the screen. This doesn’t require any argument.
Syntax :
turtle.Screen().turtles()
Below is the implementation of the above method with some examples :
Example 1 :
Python3
# import packageimport turtle # make screen object# and set sizesc = turtle.Screen()sc.setup(400,300) # make turtle objectt1=turtle.Turtle(shape='square') # do some motion with propertiest1.color("red")t1.circle(50) # make another turtle objectt2=turtle.Turtle(shape='circle') # do some motion with propertiest2.color("green")t2.circle(40) # get all turtle objects on screenprint(sc.turtles())
Output :
[<turtle.Turtle object at 0x000001E90622DAC8>, <turtle.Turtle object at 0x000001E90625CC88>]  
 
Example 2 :
Python3
# import packageimport turtle # make screen object and set sizesc = turtle.Screen()sc.setup(400, 300) # make first turtle and do somethingt1 = turtle.Turtle(shape='square')t1.color("red")t1.circle(50) # make another turtle and do somethingt2 = turtle.Turtle(shape='circle')t2.color("green")t2.circle(40) # get all turtles objectturt = sc.turtles() # use first turtle objectturt[0].circle(-40) # use another turtle objectturt[1].circle(-50)
Output :
surindertarika1234
Python-turtle
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 | os.path.join() method
Introduction To PYTHON
Python OOPs Concepts
How to drop one or multiple columns in Pandas Dataframe
How To Convert Python Dictionary To JSON?
Check if element exists in list in Python
Python | Get unique values from a list
Create a directory in Python
Python | Extracting rows using Pandas .iloc[]

09 Jun, 2022
Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric Python packages. Pandas is one of those packages that makes importing and analyzing data much easier. 
The Pandas library provides a unique method to retrieve rows from a Data Frame. Dataframe.iloc[] method is used when the index label of a data frame is something other than numeric series of 0, 1, 2, 3....n or in case the user doesn’t know the index label. Rows can be extracted using an imaginary index position which isn’t visible in the data frame.
Syntax: pandas.DataFrame.iloc[] 
Parameters: 
Index Position: Index position of rows in integer or list of integer. 
Return type: Data frame or Series depending on parameters
To download the CSV used in code, click here. Example #1: Extracting single row and comparing with .loc[] In this example, same index number row is extracted by both .iloc[] and.loc[] method and compared. Since the index column by default is numeric, hence the index label will also be integers.  
Python3
# importing pandas packageimport pandas as pd # making data frame from csv filedata = pd.read_csv("nba.csv") # retrieving rows by loc methodrow1 = data.loc[3] # retrieving rows by iloc methodrow2 = data.iloc[3] # checking if values are equalrow1 == row2
Output: 
As shown in the output image, the results returned by both methods are the same.
    
Example #2: Extracting multiple rows with index In this example, multiple rows are extracted, first by passing a list and then by passing integers to extract rows between that range. After that, both the values are compared. 
Python3
# importing pandas packageimport pandas as pd # making data frame from csv filedata = pd.read_csv("nba.csv") # retrieving rows by loc methodrow1 = data.iloc[[4, 5, 6, 7]] # retrieving rows by loc methodrow2 = data.iloc[4:8] # comparing valuesrow1 == row2
Output: 
As shown in the output image, the results returned by both methods are the same. All values are True except values in the college column since those were NaN values. 
urvishmahajan
Python pandas-dataFrame
Python pandas-dataFrame-methods
Python-pandas
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Read JSON file using Python
Adding new column to existing DataFrame in Pandas
Python map() function
How to get column names in Pandas dataframe
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 ?
Iterate over a list in Python
Find number of months between two dates in R - GeeksforGeeks

07 Sep, 2021
In this article, we will discuss how to Find the number of months between two dates in the R programming language. 
Example:
Input: Date_1 = 2020/02/21
  Date_2 = 2020/03/21
Output: 1
Explanation: In Date_1 and Date_2 have only one difference in month.
Here we will use seq() function to get the result. This function is used to create a sequence of elements in a Vector. It takes the length and difference between values as optional argument.
Syntax: length(seq(from=date_1, to=date_2, by=’month’)) -1 
Where: seq is function generates a sequence of numbers, from is starting date, to is ending date.
 Example 1: In the below example, we are storing two dates in two different variables and by using length(seq(from=date_1, to=date_2, by=’month’)) we are finding a number of months between these two dates.
R
# creating date_1 variable and storing date in it.date_1<-as.Date("2020-08-10") # creating date_2 variable and storing date in it.date_2<-as.Date("2020-10-10") # Here first date will  start from 2020-08-10 and# end by 2020-10-10.Here increment is done by month.# This three dates  will be generated as we used# seq and this dates will be stored in a. a = seq(from = date_1, to = date_2, by = 'month')) # Here we are finding length of a and we are subtracting# 1 because we dont need to include current month.length(a)-1
Output:
2
Example 2: Checking with different dates.
R
# creating date_1 variable and storing date in it.date_1<-as.Date("2020-01-23") # creating date_2 variable and storing date in it.date_2<-as.Date("2020-9-25") # Here first date will  start from 2020-01-23# and end by 2020-9-25.Here increment is done# by month.This three dates  will be generated# as we used seq and this dates will be stored in a. a=seq(from = date_1, to = date_2, by = 'month')) # Here we are finding length of a and we are# subtracting 1 because we dont need to include# current month.length(a)-1
Output:
8
anikakapoor
Picked
R Vector-Function
R Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Change Color of Bars in Barchart using ggplot2 in R
Group by function in R using Dplyr
How to Change Axis Scales in R Plots?
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?
R - if statement
How to filter R dataframe by multiple conditions?
Plot mean and standard deviation using ggplot2 in R
How to import an Excel File into R ?
log2() function in C++ with Examples - GeeksforGeeks

04 May, 2020
The function log2() of cmath header file in C++ is used to find the logarithmic value with base 2 of the passed argument.
Syntax:
log2(x)
Parameters: This function takes a value x, in the range [0, ∞] whose log value is to be found.
Return Type: It returns the logarithmic value, as double, float or long double type, based on the following conditions:
If x > 1: It returns the positive logarithmic value of x.
If x is equals to 1: It returns 0.
If 0 < x < 1: It returns the negative logarithmic value of x.
If x is equals to 0: It returns the negative infinity(-∞).
If x < 0: It returns NaN(Not a Number).
Below examples demonstrate the use of log2() method:
Example 1:
// C++ program to illustrate log2() function  #include <bits/stdc++.h>using namespace std;  // Driver Codeint main(){    long b = 16;    float c = 2.5;    double d = 10.35;    long double e = 25.5;      // Logarithmic value of long datatype    cout << log2(b) << "\n";      // Logarithmic value of float datatype    cout << log2(c) << "\n";      // Logarithmic value of double datatype    cout << log2(d) << "\n";      // Logarithmic value of long double datatype    cout << log2(e) << "\n";      return 0;}
4
1.32193
3.37156
4.67243

Example 2:
// C++ program to illustrate log2() function  #include <bits/stdc++.h>using namespace std;  // Driver Codeint main(){    // To show extreme cases    int a = 0;    int b = -16;      // Logarithmic value of 0    cout << log2(a) << "\n";      // Logarithmic value of negative value    cout << log2(b) << "\n";      return 0;}
-inf
nan

Reference: http://www.cplusplus.com/reference/cmath/log2/
CPP-Functions
cpp-math
C++
Mathematical
Mathematical
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Operator Overloading in C++
Polymorphism in C++
Friend class and function in C++
Sorting a vector in C++
std::string class in C++
Program for Fibonacci numbers
Write a program to print all permutations of a given string
Coin Change | DP-7
Merge two sorted arrays
Modulo Operator (%) in C/C++ with Examples
Insertion sort using C++ STL - GeeksforGeeks

30 Aug, 2017
Implementation of Insertion Sort using STL functions.
Pre-requisites : Insertion Sort, std::rotate, std::upper_bound, C++ Iterators.
The idea is to use std::upper_bound to find an element making the array unsorted. Then we can rotate the unsorted part so that it ends up sorted. We can traverse the array doing these operations and the result will be a sorted array.
The code is offline on purpose to show hard-coded and easy to understand code.
// C++ program to implement insertion sort using STL.#include <bits/stdc++.h>  // Function to sort the arrayvoid insertionSort(std::vector<int> &vec){    for (auto it = vec.begin(); it != vec.end(); it++)    {                // Searching the upper bound, i.e., first         // element greater than *it from beginning        auto const insertion_point =                 std::upper_bound(vec.begin(), it, *it);                  // Shifting the unsorted part        std::rotate(insertion_point, it, it+1);            }}  // Function to print the arrayvoid print(std::vector<int> vec){    for( int x : vec)        std::cout << x << " ";    std::cout << '\n';}  // Driver codeint main(){    std::vector<int> arr = {2, 1, 5, 3, 7, 5, 4, 6};        insertionSort(arr);        print(arr);}
Output:
1 2 3 4 5 5 6 7

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.
Insertion Sort
STL
Sorting
Sorting
STL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Chocolate Distribution Problem
C++ Program for QuickSort
Stability in sorting algorithms
Quick Sort vs Merge Sort
Number of visible boxes after putting one inside another
Sorting in Java
Quickselect Algorithm
Find all triplets with zero sum
Recursive Bubble Sort
Segregate 0s and 1s in an array
How to Show Schema of a Table in MySQL Database? - GeeksforGeeks

26 Sep, 2021
The term “schema” refers to the organization of data as a blueprint of how the database is constructed (divided into database tables in the case of relational databases). The formal definition of a database schema is a set of formulas (sentences) called integrity constraints imposed on a database. In this article, we will learn how to display the Schema of a Table with the help of some SQL queries.
Step 1: Creating the Database
For the purpose of demonstration, we will be creating a Participant table in a database called “GeeksForGeeksDatabase“.
Query:
CREATE DATABASE GeeksForGeeksDatabase;
 
Step 2: Using the Database
Use the below SQL statement to switch the database context to GeeksForGeeksDatabase.
Query:
USE GeeksForGeeksDatabase;
Step 3: Table Definition
Query:
CREATE TABLE Geeks(
GeekID INTEGER PRIMARY KEY,
GeekName VARCHAR(255) NOT NULL,
GeekRank INTEGER NOT NULL,
GeekSchool VARCHAR(255) NOT NULL
);
Step 4:To display the table structure (Schema) in SQL
In Oracle, we use this query:
Query:
DESC tableName
In the MySQL database, we use this query:
Query:
DESCRIBE databasename.tableName;
In SQL Server we use Transact-SQL :
Query:
EXEC sp_help 'dbo.tableName';
Using the above query we got the whole description of the table, its properties like column names, data types used for each column, constraints.
Blogathon-2021
mysql
Picked
SQL-Server
Blogathon
DBMS
SQL
DBMS
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Create a Table With Multiple Foreign Keys in SQL?
How to Import JSON Data into SQL Server?
Stratified Sampling in Pandas
How to Install Tkinter in Windows?
Python program to convert XML to Dictionary
SQL | WITH clause
SQL | Join (Inner, Left, Right and Full Joins)
ACID Properties in DBMS
SQL query to find second highest salary?
Normal Forms in DBMS
PyQt5 QLabel - Adding blur effect - GeeksforGeeks

10 May, 2020
In this article we will see how we can add blur effect to the label, blur means smoothing of the label, by default there is no blur effect to the label although we can add blur effect any time. Below is the representation of label with blur effect.
In order to do this we have to do the following –
1. Create a label2. Create QGraphicsBlurEffect object3. Add this object to the label with the help of setGraphicsEffect method
Syntax :
# creating a blur effect
self.blur_effect = QGraphicsBlurEffect()

# adding blur effect to the label
label.setGraphicsEffect(self.blur_effect)

Below is the implementation
# 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 label        label = QLabel("Label", self)          # setting geometry to the label        label.setGeometry(200, 100, 150, 60)          # setting alignment to the label        label.setAlignment(Qt.AlignCenter)          # setting font        label.setFont(QFont('Arial', 15))          # creating a blur effect        self.blur_effect = QGraphicsBlurEffect()          # adding blur effect to the label        label.setGraphicsEffect(self.blur_effect)    # create pyqt5 appApp = QApplication(sys.argv)  # create the instance of our Windowwindow = Window()  # start the appsys.exit(App.exec())
Output :
Python PyQt5-Label
Python-gui
Python-PyQt
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Read a file line by line in Python
How to Install PIP on Windows ?
Enumerate() in Python
Different ways to create Pandas Dataframe
Iterate over a list in Python
Python String | replace()
*args and **kwargs in Python
Reading and Writing to text files in Python
Create a Pandas DataFrame from Lists
Censor bad words in Python using better-profanity - GeeksforGeeks

24 Jan, 2021
In this article, we will learn how to Censor bad words using Python. For this, we are using the better_profanity module from python.
Installation
pip install better_profanity
For censoring bad words, we are using profanity.censor() method from better_profanity. So, we discuss first its syntax and arguments.
Syntax: profanity.censor(text, censor_char=’*’)
Parameters:
text : text to be censor
censor_char : ‘*’ by default, character to censor bad words
Return value: censored text
Approach:
Import package (profanity)Declare or input the text to be censored.Use profanity.censor() method and get the censored text.Print censored text.
Import package (profanity)
Declare or input the text to be censored.
Use profanity.censor() method and get the censored text.
Print censored text.
Example 1:
# importing packagefrom better_profanity import profanity  # text to be censoredtext = "What the shit are you doing?"  # do censoringcensored = profanity.censor(text)  # view outputprint(censored)
Output:
What the **** are you doing?
Example 2:
# importing packagefrom better_profanity import profanity  # text to be censoredtext = "What the shit are you doing?"  # do censoringcensored = profanity.censor(text, '$')  # view outputprint(censored)
Output:
What the $$$$ are you doing?
python-modules
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
How to drop one or multiple columns in Pandas Dataframe
Python Classes and Objects
Python | os.path.join() method
Python | Get unique values from a list
Create a directory in Python
Defaultdict in Python
Python | Pandas dataframe.groupby()
PHP Database connection - GeeksforGeeks

02 Nov, 2020
The collection of related data is called a database. XAMPP stands for cross-platform, Apache, MySQL, PHP, and Perl. It is among the simple light-weight local servers for website development.
Requirements: XAMPP web server procedure:
Start XAMPP server by starting Apache and MySQL.
Write PHP script for connecting to XAMPP.
Run it in the local browser.
Database is successfully created which is based on the PHP code.
In PHP, we can connect to the database using XAMPP web server by using the following path.
"localhost/phpmyadmin"
Steps in Detail:
Open XAMPP and start running Apache, MySQL and FileZilla
Now open your PHP file and write your PHP code to create database and a table in your database.PHP code to create a database:PHPPHP<?php  // Server name must be localhost$servername = "localhost";  // In my case, user name will be root$username = "root";  // Password is empty$password = "";  // Creating a connection$conn = new mysqli($servername,             $username, $password);  // Check connectionif ($conn->connect_error) {    die("Connection failure: "         . $conn->connect_error);}   // Creating a database named geekdata$sql = "CREATE DATABASE geekdata";if ($conn->query($sql) === TRUE) {    echo "Database with name geekdata";} else {    echo "Error: " . $conn->error;}  // Closing connection$conn->close();?>
PHP code to create a database:
PHP
<?php  // Server name must be localhost$servername = "localhost";  // In my case, user name will be root$username = "root";  // Password is empty$password = "";  // Creating a connection$conn = new mysqli($servername,             $username, $password);  // Check connectionif ($conn->connect_error) {    die("Connection failure: "         . $conn->connect_error);}   // Creating a database named geekdata$sql = "CREATE DATABASE geekdata";if ($conn->query($sql) === TRUE) {    echo "Database with name geekdata";} else {    echo "Error: " . $conn->error;}  // Closing connection$conn->close();?>
Save the file as “data.php” in htdocs folder under XAMPP folder.
Then open your web browser and type localhost/data.php
Finally the database is created and connected to PHP.
If you want to see your database, just type localhost/phpmyadmin in the web browser and the database can be found.
PHP-Misc
Technical Scripter 2020
PHP
PHP Programs
Technical Scripter
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 check whether an array is empty using PHP?
PHP | Converting string to Date and DateTime
Comparing two dates in PHP
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 check whether an array is empty using PHP?
Comparing two dates in PHP
RAND() Function in SQL Server - GeeksforGeeks

30 Dec, 2020
RAND() function :This function in SQL Server is used to return a random decimal value and this value lies in the range greater than and equal to zero (>=0) and less than 1. If we want to obtain a random integer R in the range i <= R < j, we have to use the expression “FLOOR(i + RAND() * (j − i))”.
Features :
This function is used to give a random decimal value.
The returned value lies in between 0 (inclusive) and 1 (exclusive).
If this function does not accept any parameter, it will returns a completely random number.
If this function takes a parameter, it will returns a repeatable sequence of random numbers.
This function accepts optional parameter.
This function uses a formula“FLOOR(i + RAND() * (j − i))” to get a random integer R,where R lies in the range of “i <= R < j”.
Syntax :
RAND(N)
Parameter :This method accepts a parameter as given below :
N : If N is specified, it returns a repeatable sequence of random numbers. If no N is specified, it returns a completely random number. It is optional and it works as a seed value.
Returns :It returns a random number between 0 (inclusive) and 1 (exclusive).
Example-1 :Getting a random value between 0 and 1.
SELECT RAND();
Output :
0.37892290119984562
Example-2 :Getting a random decimal number with seed value of 5.
SELECT RAND(5);
Output :
0.71366652509795636
Example-3 :Using RAND() function with variables and getting a random number between in the range of [ 2, 8 ) using RAND Function. Here, we will use the expression : FLOOR(i + RAND() * (j − i)) for generating the random number. Here, i is 2 and j is 8.
DECLARE @i INT;
DECLARE @j INT;
SET @i = 2;
SET @j = 8;
SELECT FLOOR(@i + RAND()*(@j-@i));

Output :
7.0
Example-4 :Getting a random value between in the range [ 3, 9 ] using RAND Function. Here, we will use the expression : FLOOR(i + RAND() * (j − i + 1)) for generating the random number. Here i is 3 and j is 9.
SELECT FLOOR(3 + RAND()*(9 - 3 + 1));

Output :
9.0
Application :This function is used to return a random number between 0 (inclusive) and 1 (exclusive).
DBMS-SQL
SQL-Server
SQL
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Update Multiple Columns in Single Update Statement in SQL?
How to Create a Table With Multiple Foreign Keys in SQL?
What is Temporary Table in SQL?
SQL | Subquery
SQL Query to Find the Name of a Person Whose Name Starts with Specific Letter
SQL Query to Convert VARCHAR to INT
SQL using Python
How to Write a SQL Query For a Specific Date Range and Date Time?
How to Select Data Between Two Dates and Times in SQL Server?
SQL Query to Compare Two Dates
Python | set() method - GeeksforGeeks

19 Feb, 2022
Set, a term in mathematics for a sequence consisting of distinct language is also extended in its language by Python and can easily be made using set().
set() method is used to convert any of the iterable to sequence of iterable elements with distinct elements, commonly called Set. 
Syntax : set(iterable)Parameters : Any iterable sequence like list, tuple or dictionary.Returns : An empty set if no element is passed. Non-repeating element iterable modified as passed as argument.  
Don’t worry if you get an unordered list from the set. Sets are unordered. Use sorted(set(sampleList)) to get it sorted
Code #1 : Demonstrating set() with list and tuple 
Python3
# Python3 code to demonstrate the# working of set() on list and tuple # initializing listlis1 = [ 3, 4, 1, 4, 5 ] # initializing tupletup1 = (3, 4, 1, 4, 5) # Printing iterables before conversionprint("The list before conversion is : " + str(lis1))print("The tuple before conversion is : " + str(tup1)) # Iterables after conversion are# notice distinct and elementsprint("The list after conversion is : " + str(set(lis1)))print("The tuple after conversion is : " + str(set(tup1)))
Output:  
The list before conversion is : [3, 4, 1, 4, 5]
The tuple before conversion is : (3, 4, 1, 4, 5)
The list after conversion is : {1, 3, 4, 5}
The tuple after conversion is : {1, 3, 4, 5}
No parameters are passed to create the empty set
Dictionary can also be created using set, but only keys remain after conversion, values are lost.
Code #2: Demonstration of working of set on dictionary  
Python3
# Python3 code to demonstrate the# working of set() on dictionary # initializing listdic1 = { 4 : 'geeks', 1 : 'for', 3 : 'geeks' } # Printing dictionary before conversion# internally sortedprint("Dictionary before conversion is : " + str(dic1)) # Dictionary after conversion are# notice lost keysprint("Dictionary after conversion is : " + str(set(dic1)))
Dictionary before conversion is : {4: 'geeks', 1: 'for', 3: 'geeks'}
Dictionary after conversion is : {1, 3, 4}
Time Complexity: Set method is implemented as a hash table, so the time complexity is O(1). 
yashthakkar1173
praveendhakad798
ruhelaa48
rajeev0719singh
anantmulchandani
Python-Built-in-functions
python-set
Python-set-functions
Python
python-set
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Enumerate() in Python
Different ways to create Pandas Dataframe
Python String | replace()
*args and **kwargs in Python
Reading and Writing to text files in Python
Create a Pandas DataFrame from Lists
Convert integer to string in Python
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
Poisson Regression in R Programming - GeeksforGeeks

10 May, 2020
A Poisson Regression model is used to model count data and model response variables (Y-values) that are counts. It shows which X-values work on the Y-value and more categorically, it counts data: discrete data with non-negative integer values that count something.
In other words, it shows which explanatory variables have a notable effect on the response variable. Poisson Regression involves regression models in which the response variable is in the form of counts and not fractional numbers.
Mathematical Equation:
log(y) = a + b1x1 + b2x2 + bnxn.....
Parameters:
y: This parameter sets as a response variable.
a and b: The parameter a and b are the numeric coefficients.
x: This parameter is the predictor variable.
The function used to create the Poisson regression model is the glm() function.
Syntax: glm(formula, data, family)
Parameters:
formula: This parameter is the symbol presenting the relationship between the variables.
data: The parameter is the data set giving the values of these variables.
family: This parameter R object to specify the details of the model. It’s value is ‘Poisson’ for Logistic Regression.
Example:
We use the data set “warpbreaks”.
Considering “breaks” as the response variable.
The wool “type” and “tension” are taken as predictor variables.
Code:
input <- warpbreaksprint(head(input))
Output:
Approach: Creating the poisson regression model:
Take the parameters which are required to make model.
let’s use summary() function to find the summary of the model for data analysis.
Example:
output <-glm(formula = breaks ~ wool + tension,             data = warpbreaks, family = poisson)print(summary(output))     
Output:
Approach: Creating the regression model with the help of the glm() function as:
With the help of this function, easy to make model.
Now we draw a graph for the relation between “formula”, “data” and “family”.
Example:
output_result <-glm(formula = breaks ~ wool + tension,                    data = warpbreaks, family = poisson)  output_result 
Output:
R Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Change Color of Bars in Barchart using ggplot2 in R
Group by function in R using Dplyr
How to Change Axis Scales in R Plots?
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 import an Excel File into R ?
R - if statement
Time Series Analysis in R
How to filter R dataframe by multiple conditions?
Tryit Editor v3.7

Tryit: Audio autoplay and muted
How to count unique elements in the array using java?

The interface Set does not allow duplicate elements, therefore, create a set object and try to add each element to it using the add() method in case of repetition of elements this method returns false −
If you try to add all the elements of the array to a Set, it accepts only unique elements −
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class CountingUniqueElements {
   public static void main(String args[]) {
      Scanner sc = new Scanner(System.in);
      System.out.println("Enter the size of the array that is to be created ::");
      
      int size = sc.nextInt();
      int count = 0;
      int[] myArray = new int[size];
      
      System.out.println("Enter the elements of the array ::");

      for(int i = 0; i<size; i++) {
         myArray[i] = sc.nextInt();
      }
      System.out.println("The array created is :: "+Arrays.toString(myArray));
      System.out.println("indices of duplicate elements in the array are elements :: ");
      Set set = new HashSet();

      for(int i = 0; i<myArray.length; i++) {
         if(set.add(myArray[i])) {
            count++;
            System.out.println("Index :: "+i+" Element :: "+myArray[i]);
         }
      }
   }
}
Enter the size of the array that is to be created ::
6
Enter the elements of the array ::
45
45
45
69
32
69
The array created is :: [45, 45, 45, 69, 32, 69]
indices of duplicate elements in the array are elements ::
Index :: 0 Element :: 45
Index :: 3 Element :: 69
Index :: 4 Element :: 32
HTML - Entities

Some characters are reserved in HTML and they have special meaning when used in HTML document. For example, you cannot use the greater than and less than signs or angle brackets within your HTML text because the browser will treat them differently and will try to draw a meaning related to HTML tag.
HTML processors must support following five special characters listed in the table that follows.
If you want to write <div id = "character"> as a code then you will have to write as follows −
<!DOCTYPE html>
<html>

   <head>
      <title>HTML Entities</title>
   </head>

   <body>
      &lt;div id = "character"&gt;
   </body>

</html>
This will produce the following result −
There is also a long list of special characters in HTML 4.0. In order for these to appear in your document, you can use either the numerical codes or the entity names. For example, to insert a copyright symbol you can use either of the following −
&copy; 2007
or
&#169; 2007


    19 Lectures 
     2 hours 

 Anadi Sharma

    16 Lectures 
     1.5 hours 

 Anadi Sharma

    18 Lectures 
     1.5 hours 

 Frahaan Hussain

    57 Lectures 
     5.5 hours 

 DigiFisk (Programming Is Fun)

    54 Lectures 
     6 hours 

 DigiFisk (Programming Is Fun)

    45 Lectures 
     5.5 hours 

 DigiFisk (Programming Is Fun)
 Print
 Add Notes
 Bookmark this page
Cordova - Plugman

Cordova Plugman is a useful command line tool for installing and managing plugins. You should use plugman if your app needs to run on one specific platform. If you want to create a cross-platform app you should use cordova-cli which will modify plugins for different platforms.
Open the command prompt window and run the following code snippet to install plugman.
C:\Users\username\Desktop\CordovaProject>npm install -g plugman

To understand how to install the Cordova plugin using plugman, we will use the Camera plugin as an example.
C:\Users\username\Desktop\CordovaProject>plugman  
   install --platform android --project platforms\android  
   --plugin cordova-plugin-camera 
   plugman uninstall --platform android --project platforms\android  
   --plugin cordova-plugin-camera 

We need to consider three parameters as shown above.
--platform − platform that we are using (android, ios, amazon-fireos, wp8, blackberry10).
--platform − platform that we are using (android, ios, amazon-fireos, wp8, blackberry10).
--project −  path where the project is built. In our case, it is platforms\android directory.
--project −  path where the project is built. In our case, it is platforms\android directory.
--plugin − the plugin that we want to install.
--plugin − the plugin that we want to install.
If you set valid parameters, the command prompt window should display the following output.
You can use the uninstall method in similar way.
C:\Users\username\Desktop\CordovaProject>plugman uninstall  
   --platform android --project platforms\android --plugin cordova-plugin-camera 

The command prompt console will display the following output.
Plugman offers some additional methods that can be used. The methods are listed in the following table.
install
Used for installing Cordova plugins.
uninstall
Used for uninstalling Cordova plugins.
fetch
Used for copying Cordova plugin to specific location.
prepare
Used for updating configuration file to help JS module support.
adduser
Used for adding user account to the registry.
publish
Used for publishing plugin to the registry.
unpublish
Used for unpublishing plugin from the registry.
search
Used for searching the plugins in the registry.
config
Used for registry settings configuration.
create
Used for creating custom plugin.
platform
Used for adding or removing platform from the custom created plugin.
If you are stuck, you can always use the plugman -help command. The version can be checked by using plugman -v. To search for the plugin, you can use plugman search and finally you can change the plugin registry by using the plugman config set registry command.
Since Cordova is used for cross platform development, in our subsequent chapters we will use Cordova CLI instead of Plugman for installing plugins.

    45 Lectures 
     2 hours 

 Skillbakerystudios

    16 Lectures 
     1 hours 

 Nilay Mehta
 Print
 Add Notes
 Bookmark this page
How to check if a Python string contains only digits?

There is a method called isdigit() in String class that returns true if all characters in the string are digits and there is at least one character, false otherwise. You can call it as follows −
print("12345".isdigit())
print("12345a".isdigit())
True
False
You can also use regexes for the same result. For matching only digits, we can call the re.match(regex, string) using the regex: "^[0-9]+$". 
import re
print(bool(re.match('^[0-9]+$', '123abc')))
print (bool(re.match('^[0-9]+$', '123')))
False
True
re.match returns an object, to check if it exists or not, we need to convert it to a boolean using bool().
Display a message on console while focusing on input type in JavaScript?

For this, you can use the concept of focus(). Following is the code −
 Live Demo
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initialscale=1.0">
<title>Document</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fontawesome/
4.7.0/css/font-awesome.min.css">
</head>
<body>
<input id='txtInput' placeholder="Enter the value......."/>
<button id='submitBtn'>Submit</button>
<script>
   const submitButton = document.getElementById('submitBtn');
   submitButton.addEventListener('click', () => {
      console.log('Submitting information to the server.....');
   })
   const txtInput = document.getElementById('txtInput');
   txtInput.addEventListener('blur', () => {
      console.log('Enter the new value into the text box......');
      txtInput.focus();
   });
   txtInput.focus();
</script>
</body>
</html>
To run the above program, save the file name “anyName.html(index.html)” and right click on the
file. Select the option “Open with Live Server” in VS Code editor.
This will produce the following output −
After focusing at the input text box, you will get the following output.
Display result of a table into a temp table with MySQL?

Let us first create a table −
mysql> create table DemoTable1 (Id int,Name varchar(100));
Query OK, 0 rows affected (0.89 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable1 values(100,'John');
Query OK, 1 row affected (0.19 sec)
mysql> insert into DemoTable1 values(110,'Chris');
Query OK, 1 row affected (0.16 sec)
mysql> insert into DemoTable1 values(120,'Robert');
Query OK, 1 row affected (0.12 sec)
mysql> insert into DemoTable1 values(130,'David');
Query OK, 1 row affected (0.14 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable1;
This will produce the following output −
+------+--------+
| Id   | Name   |
+------+--------+
|  100 | John   |
|  110 | Chris  |
|  120 | Robert |
|  130 | David  |
+------+--------+
4 rows in set (0.00 sec)
Following is the query to display result of a table into a temporary table −
mysql> create temporary table DemoTable2
   select *from DemoTable1;
Query OK, 4 rows affected (0.01 sec)
Records: 4 Duplicates: 0 Warnings: 0
Let us check the table records of temporary table −
mysql> select *from DemoTable2;
This will produce the following output −
+------+--------+
| Id   | Name   |
+------+--------+
|  100 | John   |
|  110 | Chris  |
|  120 | Robert |
|  130 | David  |
+------+--------+
4 rows in set (0.00 sec)
Lodash _.mergeWith() Method - GeeksforGeeks

14 Sep, 2020
Lodash is a JavaScript library that works on the top of underscore.js. Lodash helps in working with arrays, strings, objects, numbers, etc.
The _.mergeWith() method uses a customizer function that is invoked to produce the merged values of the given destination and source properties. When the customizer function returns undefined, the merging is handled by the method instead. It is almost the same as _.merge() method.
Syntax:
_.mergeWith( object, sources, customizer )

Parameters: This method accepts three parameters as mentioned above and described below:
object: This parameter holds the destination object.
sources: This parameter holds the source object. It is an optional parameter.
customizer: This is the function to customize assigned values.
Return Value: This method returns the object.
Example 1:
Javascript
// Requiring the lodash library  const _ = require("lodash");    // The destination objectvar object = {  'amit': [{ 'susanta': 20 }, { 'durgam': 40 }]};   // The source objectvar other = {  'amit': [{ 'chinmoy': 30 }, { 'kripamoy': 50 }]};  // Using the _.mergeWith() method console.log(_.mergeWith(object, other));
Output:
{ ‘amit’: [{‘chinmoy’: 30, ‘susanta’: 20 }, { ‘durgam’: 40, ‘kripamoy’: 50 }] }
Example 2:  
Javascript
// Requiring the lodash library  const _ = require("lodash");    // Defining the customizer functionfunction customizer(obj, src) {  if (_.isArray(obj)) {    return obj.concat(src);  }}   // The destination objectvar object = {  'amit': [{ 'susanta': 20 }, { 'durgam': 40 }]};   // The source objectvar other = {  'amit': [{ 'chinmoy': 30 }, { 'kripamoy': 50 }]};  // Using the _.mergeWith() method console.log(_.mergeWith(object, other, customizer));
Output:
{ ‘amit’: [{‘susanta’: 20 }, { ‘durgam’: 40}, {‘chinmoy’: 30}, {‘kripamoy’: 50 } ]}
JavaScript-Lodash
JavaScript
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Difference between var, let and const keywords in JavaScript
Convert a string to an integer in JavaScript
Differences between Functional Components and Class Components in React
How to Open URL in New Tab using JavaScript ?
How to read a local text file using JavaScript?
Top 10 Front End Developer Skills That You Need in 2022
Installation of Node.js on Linux
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?
How to use <mat-divider> in Angular Material ? - GeeksforGeeks

05 Feb, 2021
Angular Material is a UI component library that is developed by the Angular team to build design components for desktop and mobile web applications. In order to install it, we need to have angular installed in our project, once you have it you can enter the below command and can download it. <mat-divider> tag is used to separate two sections or content with a horizontal line.
Installation syntax:
ng add @angular/material
Approach:
First, install the angular material using the above-mentioned command.
After completing the installation, Import ‘MatDividerModule’ from ‘@angular/material/divider’ in the app.module.ts file.
After importing the ‘MatDividerModule’ we need to use <mat-divider> tag.
When we use <mat-divider>, a horizontal grey line is rendered on the screen.
The main purpose of this tag is to separate any two-block, div, or any sections.
Once done with the above steps then serve or start the project.
Project Structure: It will look like the following.
Code Implementation:
app.module.ts: 
Javascript
import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { FormsModule } from '@angular/forms';   import { MatDividerModule } from '@angular/material/divider';import { AppComponent } from './app.component'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations';    @NgModule({   imports:   [     BrowserModule,     FormsModule,     MatDividerModule,    BrowserAnimationsModule  ],   declarations: [ AppComponent ],   bootstrap: [ AppComponent ] }) export class AppModule { }
app.component.html: 
HTML
<h1 style="color:green">    GeeksforGeeks</h1>  <mat-divider> </mat-divider>  <h5>One stop Solution for all CS subjects</h5>  <mat-divider> </mat-divider>    <p>    The above horizontal line is displayed     due to the presence of mat-divider tag.</p>
Output:
Angular-material
Picked
AngularJS
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Top 10 Angular Libraries For Web Developers
How to use <mat-chip-list> and <mat-chip> in Angular Material ?
How to make a Bootstrap Modal Popup in Angular 9/8 ?
How to create module with Routing in Angular 9 ?
Angular 10 (blur) Event
Roadmap to Become a Web Developer in 2022
Installation of Node.js on Linux
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?
C/C++ program to make a simple calculator?

A simple calculator is a calculator that performs some basic operations like ‘+’ , ‘-’ , ‘*’ , ‘/’. A calculator does basic operation in a fast way. We will use switch statement to make a calculator.
Operator − ‘+’ => 34 + 324 = 358
Operator − ‘-’ => 3874 - 324 = 3550
Operator − ‘*’ => 76 * 24 = 1824
Operator − ‘/’ => 645/5 = 129
#include <iostream<
using namespace std;
int main() {
   char op = '+';
   float a = 63, b= 7;
   // cout << "Enter operator either + or - or * or /: ";
   // cin >> op;
   cout<<"The operator is "<<op<<endl;
   // cout << "Enter two operands: ";
   // cin>> a >> b;
   cout<<"a = "<<a<<" b = "<<b<<endl;
   switch(op) {
      case '+':
         cout <<"Sum of"<<a<<"and"<<b<<"is"<< a+b;
      break;
      case '-':
         cout <<"Difference of"<<a<<"and"<<b<<"is"<<a-b;
      break;
      case '*':
         cout <<"Product of"<<a<<"and"<<b<<"is"<<a*b;
      break;
      case '/':
         cout <<"Division of"<<a<<"and"<<b<<"is"<<a/b;
      break;
      default:
         // If the operator is other than +, -, * or /, error message is shown
         cout << "Error! operator is not correct";
      break;
   }
   return 0;
}
The operator is +
a = 63 b = 7
Sum of63 and 7 is 70
How do we add a menu list in HTML?

Use the <menu> tag in HTML to add a menu list. The HTML <menu> tag is used for creating a menu list.
The HTML <menu> tag also supports the following additional attributes −
Note − This tag deprecated in HTML and redefined in HTML5
You can try to run the following code to add a menu list in HTML −
<!DOCTYPE html>
<html>
   <head>
      <title>HTML menu Tag</title>
   </head>
   <body>
      <menu>
         <li>ol - ordered list</li>
         <li>ul - unordered list</li>
         <li>dir - directory list</li>
         <li>menu - menu list</li>
      </menu>
   </body>
</html>
HTML DOM div object

The HTML DOM div object is associated with the HTML <div> element. Div is a general purpose block level element that allows us to group elements together to either apply style to them or to manipulate a group of HTML elements under a single tag name or id.
Following is the property for div object −
Following is the syntax for −
Creating a div object −
var p = document.createElement("DIV");
Let us look at an example for the HTML DOM div object −
Live Demo
<!DOCTYPE html>
<html>
<body>
<h2>Div object example</h2>
<p>click on the CREATE button to create a div element with some text in it.</p>
<button onclick="createDiv()">CREATE</button>
<script>
   function createDiv() {
      var d = document.createElement("DIV");
      var txt = document.createTextNode("Sample Div element");
      d.setAttribute("style", "margin:10px;width:200px;background-color: lightgreen;border:2px solid blue");
      d.appendChild(txt);
      document.body.appendChild(d);
   }
</script>
</body>
</html>
This will produce the following output −
On clicking the CREATE button −
In the above example −
We have first created a button CREATE that will execute the createDiv() method when clicked by the user −
<button onclick="createDiv()">CREATE</button>
The createDiv() function creates a <div> element and assigns it to the variable d. It then creates a text node and assigns it to the variable txt. We then set the <div> element attributes using the setAttribute() method. The text node is then appended to the <div> element using the appendChild() method. The <div> element along with the text node is then appended as the document body child −
function createDiv() {
   var d = document.createElement("DIV");
   var txt = document.createTextNode("Sample Div element");
   d.setAttribute("style", "margin:10px;width:200px;background-color: lightgreen;border:2px solid blue");
   d.appendChild(txt);
   document.body.appendChild(d);
}