code-rag-bench/online-tutorials huggingface dataset:
Python | Plotting Google Map using folium package - GeeksforGeeks

08 Jun, 2021
Folium is built on the data wrangling strengths of the Python ecosystem and the mapping strengths of the Leaflet.js (JavaScript) library. Simply, manipulate your data in Python, then visualize it on a leaflet map via Folium. Folium makes it easy to visualize data that’s been manipulated in Python, on an interactive Leaflet map. This library has a number of built-in tilesets from OpenStreetMap, Mapbox etc.Command to install folium module :  
pip install folium
Code #1 : To create a Base Map.  
Python3
# import folium packageimport folium # Map method of folium return Map object # Here we pass coordinates of Gfg# and starting Zoom level = 12my_map1 = folium.Map(location = [28.5011226, 77.4099794],                                        zoom_start = 12 ) # save method of Map object will create a mapmy_map1.save(" my_map1.html " )
Output :  
  Code #2 : Add a circular marker with popup text.  
Python3
# import folium packageimport folium my_map2 = folium.Map(location = [28.5011226, 77.4099794],                                         zoom_start = 12) # CircleMarker with radiusfolium.CircleMarker(location = [28.5011226, 77.4099794],                    radius = 50, popup = ' FRI ').add_to(my_map2) # save as htmlmy_map2.save(" my_map2.html ")
Output :  
  Code #3 : Add a simple_marker for parachute style marker with pop-up text.  
Python3
# import folium packageimport folium my_map3 = folium.Map(location = [28.5011226, 77.4099794],                                        zoom_start = 15) # Pass a string in popup parameterfolium.Marker([28.5011226, 77.4099794],               popup = ' Geeksforgeeks.org ').add_to(my_map3)  my_map3.save(" my_map3.html ")
Output :  
  Code #4 : Add a line to the map  
Python3
# import folium packageimport folium my_map4 = folium.Map(location = [28.5011226, 77.4099794],                                        zoom_start = 12) folium.Marker([28.704059, 77.102490],              popup = 'Delhi').add_to(my_map4) folium.Marker([28.5011226, 77.4099794],              popup = 'GeeksforGeeks').add_to(my_map4) # Add a line to the map by using line method .# it connect both coordinates by the line# line_opacity implies intensity of the line folium.PolyLine(locations = [(28.704059, 77.102490), (28.5011226, 77.4099794)],                line_opacity = 0.5).add_to(my_map4) my_map4.save("my_map4.html")
Output :  
 
surinderdawra388
python-modules
python-utility
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
at Command in Linux with Examples - GeeksforGeeks

03 Jul, 2020
at command is a command-line utility that is used to schedule a command to be executed at a particular time in the future. Jobs created with at command are executed only once. The at command can be used to execute any program or mail at any time in the future. It executes commands at a particular time and accepts times of the form HH:MM to run a job at a specific time of day. The following expression like noon, midnight, teatime, tomorrow, next week, next Monday, etc. could be used with at command to schedule a job.
Syntax:
at [OPTION...] runtime
For Ubuntu/Debian :
sudo apt-get update
sudo apt-get install at
For CentOS/Fedora :
sudo yum install at
1. Command to list the user’s pending jobs:
at -l
or
atq
2. Schedule a job for the coming Monday at a time twenty minutes later than the current time:
at Monday +20 minutes
3. Schedule a job to run at 1:45 Aug 12 2020:
at 1:45 081220
4. Schedule a job to run at 3pm four days from now:
at 3pm + 4 days
5. Schedule a job to shutdown the system at 4:30 today:
# echo "shutdown -h now" | at -m 4:30
6. Schedule a job to run five hour from now:
at now +5 hours
7. at -r or atrm command is used to deletes job , here used to deletes job 11 .
 at -r 11
or
atrm 11
linux-command
Linux-system-commands
Picked
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
scp command in Linux with Examples
mv command in Linux with examples
Docker - COPY Instruction
SED command in Linux | Set 2
chown command in Linux with Examples
nohup Command in Linux with Examples
Named Pipe or FIFO with example C program
Thread functions in C/C++
uniq Command in LINUX with examples
Start/Stop/Restart Services Using Systemctl in Linux
How to Install PIL on Linux? - GeeksforGeeks

30 Sep, 2021
PIL is an acronym for Python Image Library. It is also called Pillow. It is one of the most famous libraries for manipulating images using the python programming language. It is a free and open-source Python library.
Step 1: Open up the Linux terminal and type the following command and hit enter.
pip install pillow
Output:
installing PIL
Step 2: To check if PIL is successfully installed, open up the python terminal by typing python3 in the terminal. This will open up the python3 interactive console now type the following command to check the current version of the PIL.
import PIL
PIL.__version__
This will output the currently installed version of the PIL.
Output:
PIL version
Aptitude is just a frontend version of the apt command that we used to install packages. Aptitude is an interactive package manager, it provides a list of all the matching packages that we want to install. It also finds and installs all the required dependencies for the package.
Step 1: Run the following command to install the PIL using Aptitude.
sudo aptitude install python3-pil
Output:
installing pil using aptitude
how-to-install
Picked
How To
Installation Guide
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Align Text in HTML?
How to filter object array based on attributes?
Java Tutorial
How to Install FFmpeg on Windows?
How to integrate Git Bash with Visual Studio Code?
Installation of Node.js on Linux
How to Install FFmpeg on Windows?
How to Install Anaconda on Windows?
How to Install Pygame on Windows ?
How to Install and Run Apache Kafka on Windows?
PyQt5 QSpinBox - Finding children using child type - GeeksforGeeks

19 May, 2020
In this article we will see how we can find all the children of spin box using the child type, child type is the quality of child for example push button type is QPushButton. Spin box is made of two child one is line edit whose type is QLineEdit and other is those up and down button whose type are QValidator.
In order to do this we use findChildren method
Syntax : spin_box.findChildren(child_type)
Argument : It takes child type as argument
Return : It returns the list of child objects, if no child is found it return empty list
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 spin box        self.spin = QSpinBox(self)          # setting geometry to spin box        self.spin.setGeometry(100, 100, 250, 40)          # setting range to the spin box        self.spin.setRange(0, 999999)          # setting prefix to spin        self.spin.setPrefix("Prefix ")          # setting suffix to spin        self.spin.setSuffix(" Suffix")            # getting children using child type        children = self.spin.findChildren(QValidator)          # creating a label        label = QLabel(self)          # making it multi line        label.setWordWrap(True)          # setting its geometry        label.setGeometry(100, 200, 200, 60)          # setting text to the label        label.setText(str(children))      # create pyqt5 appApp = QApplication(sys.argv)  # create the instance of our Windowwindow = Window()  # start the appsys.exit(App.exec())
Output :
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
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
GATE | GATE-CS-2014-(Set-1) | Question 40 - GeeksforGeeks

28 Jun, 2021
Given the following two statements:
  S1: Every table with two single-valued 
      attributes is in 1NF, 2NF, 3NF and BCNF.

  S2: AB->C, D->E, E->C is a minimal cover for 
      the set of functional dependencies 
      AB->C, D->E, AB->E, E->C. 
Which one of the following is CORRECT?
(A) S1 is TRUE and S2 is FALSE.(B) Both S1 and S2 are TRUE.(C) S1 is FALSE and S2 is TRUE.(D) Both S1 and S2 are FALSE.Answer: (A)Explanation:
 
S1: Every table with two single-valued 
      attributes is in 1NF, 2NF, 3NF and BCNF.

A relational schema R is in BCNF iff in Every non-trivial Functional Dependency X->Y, X is Super Key. If we can prove the relation is in BCNF then by default it would be in 1NF, 2NF, 3NF also.
Let R(AB) be a two attribute relation, then
If {A->B} exists then BCNF since {A}+ = AB = RIf {B->A} exists then BCNF since {B}+ = AB = RIf {A->B,B->A} exists then BCNF since A and B both are Super Key now.If {No non trivial Functional Dependency} then default BCNF.
If {A->B} exists then BCNF since {A}+ = AB = R
If {B->A} exists then BCNF since {B}+ = AB = R
If {A->B,B->A} exists then BCNF since A and B both are Super Key now.
If {No non trivial Functional Dependency} then default BCNF.
Hence it’s proved that a Relation with two single – valued attributes is in BCNF hence its also in 1NF, 2NF, 3NF.
Hence S1 is true.
S2: AB->C, D->E, E->C is a minimal cover for 
      the set of functional dependencies 
      AB->C, D->E, AB->E, E->C.

As we know Minimal Cover is the process of eliminating redundant Functional Dependencies and Extraneous attributes in Functional Dependency Set.
So each dependency of F = {AB->C, D->E, AB->E, E->C} should be implied in minimal cover.
As we can see AB->E is not covered in minimal cover since {AB}+ = ABC in the given cover {AB->C, D->E, E->C}
Hence, S2 is false.
This explanation has been contributed by Manish Rai.
Learn more about Normal forms here:
Database Normalization | IntroductionDatabase Normalization | Normal FormsQuiz of this Question
GATE-CS-2014-(Set-1)
GATE-GATE-CS-2014-(Set-1)
GATE
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
GATE | Gate IT 2007 | Question 25
GATE | GATE-CS-2001 | Question 39
GATE | GATE-CS-2000 | Question 41
GATE | GATE-CS-2005 | Question 6
GATE | GATE MOCK 2017 | Question 21
GATE | GATE MOCK 2017 | Question 24
GATE | GATE-CS-2006 | Question 47
GATE | Gate IT 2008 | Question 43
GATE | GATE-CS-2009 | Question 38
GATE | GATE-CS-2003 | Question 90
SELECT INTO statement in SQL - GeeksforGeeks

13 Aug, 2019
SELECT INTO statement in SQL is generally used for bulk copy purposes. We could copy the whole data from one table into another table using a single command.
Note:The queries are executed in SQL SERVER and they may not work in many online SQL editors so better use an offline editor.
Syntax:
SELECT column1, column2..... INTO TARGET_TABLE from SOURCE_TABLE 
TARGET_TABLE should have the same schema and data types as that of SOURCE_TABLE.
Let’s first create a table GFG_Employees:
create table GFG_Employees 
 (
  id int,
  name varchar(20),
  email varchar(max),
  department varchar(20)
 ) ;

insert into GFG_EMPLOyees values(1, 'Jessie', 'jessie23@gmail.com', 'Development'); 
insert into GFG_EMPLOyees values(2, 'Praveen', 'praveen_dagger@yahoo.com', 'HR');
insert into GFG_EMPLOyees values(3, 'Bisa', 'dragonBall@gmail.com', 'Sales'); 
insert into GFG_EMPLOyees values(4, 'Rithvik', 'msvv@hotmail.com', 'IT'); 
insert into GFG_EMPLOyees values(5, 'Suraj', 'srjsunny@gmail.com', 'Quality Assurance');
insert into GFG_EMPLOyees values(6, 'Om', 'OmShukla@yahoo.com', 'IT');
insert into GFG_EMPLOyees values(7, 'Naruto', 'uzumaki@konoha.com', 'Development'); 
Query-1: To copy all the data from GFG_Employees into backUpEmployee table.
SELECT * INTO backUpEmployee from GFG_Employees; 
Output:
Select * from backUpEmployee;
Query-2: Use ‘where’ clause to copy only some rows from GFG_Employees into backUp2 table.
SELECT * INTO backUp2 from GFG_Employees where department in ('Development', 'IT'); 
Output:
Select * from backUp2; 
Query-3: To copy only some columns from GFG_Employees into backUp3 table specify them in the query.
SELECT id, name INTO backUp3 from GFG_Employees; 
Output:
Select * from backUp3; 
INSERT INTO SELECT vs SELECT INTO:Both the statements could be used to copy data from one table to another. But INSERT INTO SELECT could be used only if the target table exists whereas SELECT INTO statement could be used even if the target table doesn’t exist as it creates the target table if it doesn’t exist.
INSERT INTO tempTable select * from GFG_Employees; 
HERE table tempTable should be present or created beforehand else throw an error.
SELECT * INTO backUpTable from GFG_Employees;
Here it’s not necessary to exist before as SELECT INTO creates table if the table doesn’t exist and then copies the data.
DBMS
SQL
DBMS
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
SQL Interview Questions
Introduction of B-Tree
CTE in SQL
Difference between Clustered and Non-clustered index
Data Preprocessing in Data Mining
How to find Nth highest salary from a table
SQL Interview Questions
SQL | ALTER (RENAME)
CTE in SQL
How to Update Multiple Columns in Single Update Statement in SQL?
How to hide elements defined as variables in jQuery ? - GeeksforGeeks

07 Apr, 2021
In this article, we will learn how to hide elements defined as variables in jQuery. These can be done using two approaches.
Approach 1: In this approach, we will first select the element that has to be hidden and then assign it to a variable. We will then call the hide() method on the variable. This method will hide the element from the page.
Example:
HTML
<html><head>  <script src="https://code.jquery.com/jquery-3.6.0.js">  </script>  <script>    $(document).ready(function () {      $("button").click(function () {          // Getting the element with the id        // of "dsa" in a variable        let dsaGFG = $("#dsa");          // Hiding the element using the        // hide() method        dsaGFG.hide();      })    });  </script></head>  <body>  <h1 style="color: green;">    GeeksforGeeks  </h1>      <p id="faang">FAANG</p>    <p id="dsa">DSA</p>    <p id="cp">CP</p>    <p id="algo">ALGO</p>    <button>Hide Element</button></body></html>
Output:
Approach 2: In this approach, we will first select the element that has to be hidden and then assign it to a variable. We will then call the addClass() method on the variable. This will add a CSS class that we will create next. This CSS class will contain the display property that is set to none, effectively hiding the element.
Example:
HTML
<html><head>  <style>    /* Define the class to       be added */    .hiddenClass {        /* Setting the display         to none hides the element */      display: none;    }  </style>  <script src="https://code.jquery.com/jquery-3.6.0.js">  </script>  <script>    $(document).ready(function () {      $("button").click(function () {          // Getting the element with the id        // of "cp" in a variable        let cpGFG = $("#cp");          // Hiding the element by adding a        // class using the addClass() method        cpGFG.addClass("hiddenClass");      })    });  </script></head><body>  <h1 style="color: green;">    GeeksforGeeks  </h1>      <p id="faang">FAANG</p>    <p id="dsa">DSA</p>    <p id="cp">CP</p>    <p id="algo">ALGO</p>    <button>Hide Element</button></body></html>
Output:
CSS-Properties
HTML-Tags
jQuery-Methods
jQuery-Questions
Picked
JQuery
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Show and Hide div elements using radio buttons?
How to prevent Body from scrolling when a modal is opened using jQuery ?
jQuery | ajax() Method
jQuery | removeAttr() with Examples
How to get the value in an input text box using jQuery ?
Remove elements from a JavaScript Array
Installation of Node.js on Linux
Convert a string to an integer in JavaScript
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?
Recursively apply a Function to a List in R Programming - rapply() function - GeeksforGeeks

16 Jun, 2020
rapply() function in R Language is used to recursively apply a function to a list.
Syntax:rapply(object, f, classes = “ANY”, deflt = NULL, how = c(“unlist”, “replace”, “list”))
Parameters:
object: represents list or an expressionf: represents function to be applied recursivelyclasses: represents class name of the vector or “ANY” to match any of the classdeflt: represents default result when how is not “replace”how: represents modes
The modes in rapply() function are of 2 basic types. If how = “replace”, each element of the list object which is not itself is a list and has a class included in classes then each element of the list is replaced by the resulting value of the function f applied to the element.
If how = “list” or how = “unlist”, list object is copied and all non-list elements which are included in classes are replaced by the resulting value of the function f applied to the element and all other are replaced by deflt.
Example 1: Using replace mode
# Defining a listls <- list(a = 1:5, b = 100:110, c = c('a', 'b', 'c'))  # Print whole listcat("Whole List: \n")print(ls)  # Using replace modecat("Using replace mode:\n")rapply(ls, mean, how = "replace", classes = "integer")
Output:
Whole List:
$a
[1] 1 2 3 4 5

$b
 [1] 100 101 102 103 104 105 106 107 108 109 110

$c
[1] "a" "b" "c"

Using replace mode:
$a
[1] 3

$b
[1] 105

$c
[1] "a" "b" "c"

Example 2: Using list mode
# Defining a listls <- list(a = 1:5, b = 100:110, c = c('a', 'b', 'c'))  # Print whole listcat("Whole List: \n")print(ls)  # Using list modecat("Using list mode:\n")rapply(ls, mean, how = "list", classes = "integer")
Output:
Whole List: 
$a
[1] 1 2 3 4 5

$b
 [1] 100 101 102 103 104 105 106 107 108 109 110

$c
[1] "a" "b" "c"

Using list mode:
$a
[1] 3

$b
[1] 105

$c
NULL

Example 3: Using unlist mode
# Defining a listls <- list(a = 1:5, b = 100:110, c = c('a', 'b', 'c'))  # Print whole listcat("Whole List: \n")print(ls)  # Using unlist modecat("Using unlist mode:\n")rapply(ls, mean, how = "unlist", classes = "integer")
Output:
Whole List:
$a
[1] 1 2 3 4 5

$b
 [1] 100 101 102 103 104 105 106 107 108 109 110

$c
[1] "a" "b" "c"

Using unlist mode:
  a   b 
  3 105

R List-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?
How to import an Excel File into R ?
Time Series Analysis in R
R - if statement
How to filter R dataframe by multiple conditions?
Increment ++ and decrement -- Operators in C++

The increment operator ++ adds 1 to its operand, and the decrement operator -- subtracts 1 from its operand. So,
x = x+1; is the same as x++;
And similarly,
x = x-1; is the same as x--;
Both the increment and decrement operators can either precede (prefix) or follow (postfix) the operand.
x = x+1; can be written as ++x;
Note that, When an increment or decrement is used as part of an expression, there is an important difference in prefix and postfix forms. If you are using prefix form then increment or decrement will be done before resting of the expression, and if you are using postfix form, then increment or decrement will be done after the complete expression is evaluated.
 In the prefix version (i.e., ++i), the value of i is incremented, and the value of the expression is the new value of i. So basically it first increments then assigns a value to the expression.
In the postfix version (i.e., i++), the value of i is incremented, but the value of the expression is the original value of i. So basically it first assigns a value to expression and then increments the variable.
Let's look at some code to get a better understanding −
#include<iostream>
using namespace std;

int main() {
   int x = 3, y, z;
   y = x++;
   z = ++x;
   cout << x << ", " << y << ", " << z;
   return 0;
}
This would give us the output −
5, 3, 5
Why is this? Let's look at it in detail −
Initialize x to 3
Assign y the value we get by evaluating the expression x++, ie, the value of x before increment then increment x.
Increment x then assign z the value we get by evaluating the expression ++x, ie, value of x after the increment.
Print these values
Python | os.getenv() method - GeeksforGeeks

20 May, 2019
OS module in Python provides functions for interacting with the operating system. OS comes under Python’s standard utility modules. This module provides a portable way of using operating system dependent functionality.
os.getenv() method in Python returns the value of the environment variable key if it exists otherwise returns the default value.
Syntax: os.getenv(key, default = None)
Parameters:key: string denoting the name of environment variabledefault (optional) : string denoting the default value in case key does not exists. If omitted default is set to ‘None’.
Return Type: This method returns a string that denotes the value of the environment variable key. In case key does not exists it returns the value of default parameter.
Code #1: use of os.getenv() method
# Python program to explain os.getenv() method     # importing os module import os  # Get the value of 'HOME'# environment variablekey = 'HOME'value = os.getenv(key)  # Print the value of 'HOME'# environment variableprint("Value of 'HOME' environment variable :", value)   # Get the value of 'JAVA_HOME'# environment variablekey = 'JAVA_HOME'value = os.getenv(key)  # Print the value of 'JAVA_HOME'# environment variableprint("Value of 'JAVA_HOME' environment variable :", value) 
Value of 'HOME' environment variable : /home/ihritik
Value of 'JAVA_HOME' environment variable : /opt/jdk-10.0.1

 
Code #2: if key does not exist
# Python program to explain os.getenv() method     # importing os module import os  # Get the value of 'home'# environment variablekey = 'home'value = os.getenv(key)  # Print the value of 'home'# environment variableprint("Value of 'home' environment variable :", value)
Value of 'home' environment variable : None

 
Code #3: Explicitly specifying default parameter
# Python program to explain os.getenv() method     # importing os module import os  # Get the value of 'home'# environment variablekey = 'home'value = os.getenv(key, "value does not exist")  # Print the value of 'home'# environment variableprint("Value of 'home' environment variable :", value) 
Value of 'home' environment variable : value does not exist

python-os-module
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Python Dictionary
Read a file line by line in Python
Enumerate() in Python
Iterate over a list in Python
How to Install PIP on Windows ?
Different ways to create Pandas Dataframe
Python String | replace()
Create a Pandas DataFrame from Lists
Python program to convert a list to string
Reading and Writing to text files in Python
Difference between an Iterator and ListIterator in Java

Java provided these two interfaces to traverse the data one by one stored in a collection. The internal implementation of iterator and list iterator makes them differ apart but the main agenda of both the iterators is the same.
The following are the important differences between Iterator and ListIterator.
JavaTester.java
 Live Demo
import java.io.*;
import java.util.*;
public class JavaTester {
   public static void main(String[] args){
      ArrayList<Integer> list = new ArrayList<Integer>();
      list.add(1);
      list.add(2);
      list.add(3);
      list.add(4);
      list.add(5);
      //Iterator
      Iterator itr = list.iterator();
      System.out.println("Iterator traversal:");
      while (itr.hasNext())
      System.out.print(itr.next() + " ");
      System.out.println();
      // ListIterator
      ListIterator i = list.listIterator();
      System.out.println("ListIterator Forward traversal:");
      while (i.hasNext()){
         System.out.print(i.next() + " ");
         System.out.println();
         System.out.println("ListIterator Backward traversal : ");
      }
      while (i.hasPrevious()){
         System.out.print(i.previous() + " ");
         System.out.println();
      }
   }
}
Iterator traversal:
1 2 3 4 5
ListIterator Forward traversal:
1
ListIterator Backward traversal :
2
ListIterator Backward traversal :
3
ListIterator Backward traversal :
4
ListIterator Backward traversal :
5
ListIterator Backward traversal :
5
4
3
2
1
Left join and Right join in MS SQL Server - GeeksforGeeks

15 Jul, 2020
Prerequisite – Introduction of MS SQL Server
1. Left Join :A join combines the set of two tables only. A left join is used when a user wants to extract the left table’s data only. Left join not only combines the left table’s rows but also the rows that match alongside the right table.
Syntax –
select select_list 
from table1 left join table2 on join_predicate
                 (OR)
select * 
from table1 right join table2

2. Right Join :Right join combines the data of the right table and the rows that match both the tables.
Syntax –
select select_list 
from table1 right join table2 on join_predicate
                 (OR)
select * 
from table1 right join table2

Example –The first table is the Course table which is considered the left table and the second table is the Student table which is considered the right table.
1. Left Join :Left join is applied to the tables Course and Student and the table below is the result set.
select name, course 
from c.course left join s.student on c.age = s.age 
The left table and its corresponding matching rows on the right table are displayed. If a user wants to display the rows only in the left table, where clause can be used in the query. Left join is usually used for a maximum of two tables but in case of SQL Server, it can be used for multiple tables too.2. Right Join :Right join is applied to the tables Course and Student and the table below is the result set.
select name, rollno 
from c.course right join s.student on c.age = s.age 
If the tables do not have common rows, it displays the rows as NULL. The right join can also be used for multiple tables.
DBMS-SQL
SQL-Server
DBMS
SQL
DBMS
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Deadlock in DBMS
Types of Functional dependencies in DBMS
KDD Process in Data Mining
Conflict Serializability in DBMS
Introduction of Relational Algebra in DBMS
SQL | DDL, DQL, DML, DCL and TCL Commands
How to find Nth highest salary from a table
SQL | ALTER (RENAME)
How to Update Multiple Columns in Single Update Statement in SQL?
MySQL | Group_CONCAT() Function
Python program to find the sum of sine series - GeeksforGeeks

10 May, 2021
Prerequisite: math
Given n and x, where n is the number of terms in the series and x is the value of the angle in degree. The Task here is, write a program to calculate the sum of sine series of x.
Formula Used:
Example:
Input: n = 10
        x = 30
Output: sum of sine series is 0.5 

Input: n = 10
        x = 60
Output: sum of sine series is 0.87
Below is the program to calculate the sum of sine series:
Python3
# Import Moduleimport math # Create sine functiondef sin( x, n):    sine = 0    for i in range(n):        sign = (-1)**i        pi = 22/7        y = x*(pi/180)        sine += ((y**(2.0*i+1))/math.factorial(2*i+1))*sign    return sine # driver nodes# Enter value in degree in xx = 10 # Enter number of termsn = 90 # call sine functionprint(round(sin(x,n),2))
 
 
Output:
 
0.17
 
Code_Mech
Mathematical
Python
Python Programs
Mathematical
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Program to print prime numbers from 1 to N.
Segment Tree | Set 1 (Sum of given range)
Modular multiplicative inverse
Count all possible paths from top left to bottom right of a mXn matrix
Fizz Buzz Implementation
Read JSON file using Python
Adding new column to existing DataFrame in Pandas
Python map() function
How to get column names in Pandas dataframe
PostgreSQL – ROLLBACK

30 Jun, 2022
PostgreSQL ROLLBACK command is used to undo the changes done in transactions. As we know transactions in database languages are used for purpose of large computations, for example in banks. For suppose, the employee of the bank incremented the balance record of the wrong person mistakenly then he can simply rollback and can go to the previous state.
ROLLBACK TRANSACTION;

(or)

ROLLBACK;

(or)

ROLLBACK WORK;
To understand the importance of the ROLLBACK command first let’s build a table for examples.
CREATE TABLE BankStatements (
    customer_id serial PRIMARY KEY,
    full_name VARCHAR NOT NULL,
    balance INT
);
Now we will insert data of some customers
INSERT INTO BankStatements (
    customer_id ,
    full_name,
    balance
)
VALUES
    (1, 'Sekhar rao', 1000),
    (2, 'Abishek Yadav', 500),
    (3, 'Srinivas Goud', 1000);
Now as  the table is ready we will understand about commit
Example 1:  
We will add the data to the table in the transaction using the commit
BEGIN;

 INSERT INTO BankStatements (
     customer_id,
    full_name,
        balance
)
    VALUES (
       4, 'Priya chetri', 500
       
)
;

SELECT * FROM BankStatements;
        
ROLLBACK;

SELECT * FROM BankStatements;
Output:
Example 2:
BEGIN;


    UPDATE BankStatements
      SET balance = balance - 500
      WHERE 
      customer_id = 1;
      
      // displaying data before
      // committing the transaction
      SELECT customer_id, full_name, balance
      FROM BankStatements;
      
      UPDATE BankStatements
      SET balance = balance + 500
      WHERE 
      customer_id = 2;
 
       
ROLLBACK;

// displaying data after
// committing the transaction
SELECT customer_id, full_name, balance
FROM BankStatements;
Output:
vinayedula
Picked
Technical Scripter 2020
PostgreSQL
Technical Scripter
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
PostgreSQL - LIMIT with OFFSET clause
PostgreSQL - REPLACE Function
PostgreSQL - INSERT
PostgreSQL - DROP INDEX
PostgreSQL - TIME Data Type
PostgreSQL - ROW_NUMBER Function
PostgreSQL - CREATE SCHEMA
PostgreSQL - EXISTS Operator
PostgreSQL - LEFT JOIN
PostgreSQL - SELECT
Inserting JSON data into a table in Cassandra - GeeksforGeeks

17 Mar, 2021
In this article, you will be able to understand how you can insert JSON data into a table in Cassandra and will discuss with the help of an example and then finally conclude the importance of JSON insertion. Let’s discuss it one by one.
Overview :It is a practical way than cqlsh to insert column and column values. In JSON values inserted in the form of string if they are not a number for example id with datatype uuid inserted as a string but will be stored as uuid. For better understanding now, first, we will see insertion data using cqlsh commands and then will discuss how you can insert data by using JSON format. 
Example :Let’s consider you have existing keyspace namely cluster1 and then first we will create a user_data table by using the CQL command as follows.
use cluster1;
create table user_record
           (
           user_id uuid,
           first_name varchar,
           last_name varchar,
           company varchar,
           primary key(user_id)
           );
Method-1 : Insertion by using cqlsh commands –
insert into user_record(user_id, first_name, last_name, company) 
values(101aa90a-4bba-211f-a4fb-00001a101cda,'Ashish','Rana','abc');

insert into user_record(user_id, first_name, last_name, company) 
values(102aa90a-4bba-211f-a4fb-00002a102cda,'Ayush','NA','abc');
After insertion, you can use the following cql command to verify the inserted data.
select * from user_record;
Output –
Method-2 :Insertion by using JSON format –To insert data in JSON format, JSON keyword will be added to the INSERT command as follows. 
 INSERT INTO cluster1.user_record JSON '{
 "user_id" : "103aa90a-4bba-211f-a4fb-00001a101cda",  
 "first_name" : "Ashish",  
 "last_name" : "Rana",
 "company" : "abc" }';
 Using JSON format if you do not insert any value for any column then a null value will be entered automatically as you can see in the below given example.
 INSERT INTO cluster1.user_record JSON '{
 "user_id" : "104aa90a-4bba-211f-a4fb-00001a101cda",  
 "first_name" : "Ashish",  
 "last_name" : "Rana" 
 }';
After insertion, you can use the following cql command to verify the inserted data.
select * from user_record;
Output –
Apache
NoSQL
Articles
DBMS
DBMS
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Time Complexity and Space Complexity
Docker - COPY Instruction
Time complexities of different data structures
Difference between Class and Object
SQL | Date functions
SQL | WITH clause
ACID Properties in DBMS
SQL query to find second highest salary?
Normal Forms in DBMS
Introduction of B-Tree
Linux - Renaming File While Downloading with Wget - GeeksforGeeks

11 Feb, 2021
Wget utility is the most popular and powerful tool to download files on operating systems like Linux and Windows OS.Wget supports the HTTP, HTTPS, and FTP protocols, as well as retrieval through HTTP proxies.
Wget is non-interactive, which means it can work in the background while the user is not logged on. In case while downloading any file if the downloading disturbs then the wget save the half downloaded file and allow us to download the remaining part of the file to download. Wget also provides the feature of downloading websites to use offline.
By default, the wget downloads the file and saves it with the original name in the URL. Let’s see what options provide the wget. To see all options of wget use the following command
wget --help
Then wget shows the all options to how to use it.
Now let’s see how to download the file using wget. 
To download the file using wget use the following command:
wget -c FILE_URL
Here we have used -c option because it allows users to complete the partially downloaded files. Here is example 
In the above image, we can see that the file is downloaded with the name of the file in the URL. Now let’s see how to rename file while downloading
Wget provide the -O option to save the file with a different name instate of the name in the URL. Use the following command to save the downloaded file with a different name.
 wget  -cO   - FILE_URL > NEW_FILE_NAME.extension
In the above command instead of FILE_URL use the URL of the file to be downloaded and in the place of NEW_FILE_NAME.extension use the new name to file with the extension. Here is example
The file is written to standard output and then redirected by the shell to the specified file as shown in the screenshot above.
Picked
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
scp command in Linux with Examples
Docker - COPY Instruction
mv command in Linux with examples
SED command in Linux | Set 2
chown command in Linux with Examples
nohup Command in Linux with Examples
Named Pipe or FIFO with example C program
Thread functions in C/C++
uniq Command in LINUX with examples
Start/Stop/Restart Services Using Systemctl in Linux
TRANSLATE() Function in SQL Server - GeeksforGeeks

05 Jan, 2021
TRANSLATE() function :This function in SQL Server is used to return the translated string of the string stated in the first argument of this function, when the characters stated in the characters argument of the above function are converted into the characters stated in the last argument i.e, translations.
Features :
This function is used to find a modified string of the string stated in the first argument, when the characters given in the characters argument are converted into the characters given in the last argument i.e, translations.
This function accepts string, characters, and translations as parameter.
This function can translate the string fully as well as partially.
This function can return an error if specified characters and translations are not of same length.
Syntax :
TRANSLATE(string, characters, translations)
Parameter :This method accepts three parameters as given below :
string : Specified input string which is to be translated.
characters : Specified characters which must be substituted.
translations : Specified new characters.
Returns :It returns the modified string of the string stated in the first argument of this function, when the characters given in the characters argument are interpreted into the characters stated in the last argument i.e, translations.
Example-1 :Getting a string from the specified string, characters and translations.
SELECT TRANSLATE('Geek', 'Geek', 'geek');
Output :
geek
Example-2 :Using TRANSLATE() function with a variable and getting the translated string as output.
DECLARE @str VARCHAR(2);
SET @str = 'gf';
SELECT TRANSLATE(@str, 'gf', 'cs');
Output :
cs
Example-3 :Using TRANSLATE() function with three variables and getting the translated string as output.
DECLARE @str VARCHAR(3);
DECLARE @chars VARCHAR(3);
DECLARE @newchar VARCHAR(3);
SET @str = 'abc';
SET @chars = 'ab';
SET @newchar = 'ed';
SELECT TRANSLATE(@str, @chars, @newchar);
Output :
edc
Example-4 :Getting a translated string of the string stated in the first argument, when the characters given in the characters argument of this function are interpreted into the characters given in the last argument i.e, translations.
SELECT TRANSLATE('x*[y+z]/[x-y]', '[][]', '()()');
Output :
x*(y+z)/(x-y)
Application :This function is used to return the translated string of the string stated in the first argument, when the characters given in the characters argument are interpreted into the characters given in the last argument i.e, translations.
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?
SQL | Subquery
How to Create a Table With Multiple Foreign Keys in SQL?
What is Temporary Table in SQL?
SQL Query to Find the Name of a Person Whose Name Starts with Specific Letter
SQL using Python
SQL Query to Convert VARCHAR to INT
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
PyQt5 - Indicator border of Check Box - GeeksforGeeks

22 Apr, 2020
In this article we will see how to set the border to indicator of check box, although by default indicator has its own border but we can edit it also, we can change the size and color of the border.
In order to do so we have to change the style sheet code with the help of setStyleSheet method, below is the style sheet code.
QCheckBox::indicator
{
border : 3px solid red;
}

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 the check-box        checkbox = QCheckBox('Geek ?', self)          # setting geometry of check box        checkbox.setGeometry(200, 150, 100, 30)          # changing border of indicator in checkbox        checkbox.setStyleSheet("QCheckBox::indicator"                               "{"                               "border : 3px solid red;"                               "}")      # create pyqt5 appApp = QApplication(sys.argv)  # create the instance of our Windowwindow = Window()  # start the appsys.exit(App.exec())
Output :
Python-gui
Python-PyQt
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
How to drop one or multiple columns in Pandas Dataframe
Python Classes and Objects
Python | Get unique values from a list
Python | os.path.join() method
Defaultdict in Python
Create a directory in Python
Python | Pandas dataframe.groupby()
iotop Command in Linux with Examples - GeeksforGeeks

26 May, 2020
iotop or Input/Output top is a command in Linux which is used to display and monitor the disk IO usage details and even gets a table of existing IO utilization by the process. It is designed in python and needs kernel modules for its execution. It is used by system administrators to trace the specific process that may be causing a high disk I/O read/writes.It requires a python interpreter for its execution. It produces output similar to that of top command. It generally requires root privileges for its execution.
CentOS/RHEL
sudo yum install iotop
ubuntu
sudo apt install iotop
1. To get the list of processes and their current disk IO usage.
sudo iotop
This command will now display the list of processes and their current disk usage and will keep on updating the same.
2. To show processes that are actually doing IO
sudo iotop -o
This will display all the processes which are currently and actually doing IO.
3. To get the version of the iotop
sudo iotop --version
This will display the currently installed version of iotop tool.
4. To display help section
sudo iotop -h
This command will display the help section of the iotop tool.
5. To display output in non interactive mode
sudo iotop -b
This will display the output in non-interactive and batch mode.
6. To change the number of iterations or updations
sudo iotop -n 3
This command will not update the output 3 times in spite of the default time which is infinity.
7 To display a specific process
sudo iotop -p 10989
This will display the IO usage of the process with the mentioned PID in spite of all the processes.
8. To show accumulated output
sudo iotop -a
This will not display the accumulated IO instead of bandwidth.
9. To add a time stamp to each line
sudo iotop -t
This will add a time stamp to each line of the output.
10. To suppress some lines of header
sudo iotop -q
This will now suppress some line of header in the output.
linux-command
Linux-system-commands
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
ZIP command in Linux with examples
TCP Server-Client implementation in C
SORT command in Linux/Unix with examples
tar command in Linux with examples
curl command in Linux with Examples
Conditional Statements | Shell Script
diff command in Linux with examples
UDP Server-Client implementation in C
Tail command in Linux with examples
echo command in Linux with Examples
Python | Splitting string to list of characters - GeeksforGeeks

11 May, 2020
Sometimes we need to work with just the lists and hence strings might need to be converted into lists. It has to be converted in list of characters for certain tasks to be performed. This is generally required in Machine Learning to preprocess data and text classifications.
Let’s discuss certain ways in which this task is performed.
Method #1 : Using list slicingList slicing can be used for this particular purpose, in which we assign to each index element of list the next occurring character of string using the slice operation.
# Python3 code to demonstrate # splitting string to list of characters.# using list slicing  # initializing stringtest_string = "GeeksforGeeks"  # printing original string print ("The original string is : " + str(test_string))  # using list slicing# for splitting string to list of charactersres = []res[:] = test_string  # printing resultprint ("The resultant list of characters : " +  str(res))
The original string is : GeeksforGeeksThe resultant list of characters : [‘G’, ‘e’, ‘e’, ‘k’, ‘s’, ‘f’, ‘o’, ‘r’, ‘G’, ‘e’, ‘e’, ‘k’, ‘s’]
Method #2 : Using list()The most concise and readable way to perform splitting is to type case string into list and the splitting of list is automatically handled internally. This is recommended method to perform this particular task.
# Python3 code to demonstrate # splitting string to list of characters.# using list()  # initializing stringtest_string = "GeeksforGeeks"  # printing original string print ("The original string is : " + str(test_string))  # using list()# for splitting string to list of charactersres = list(test_string)  # printing resultprint ("The resultant list of characters : " +  str(res))
The original string is : GeeksforGeeksThe resultant list of characters : [‘G’, ‘e’, ‘e’, ‘k’, ‘s’, ‘f’, ‘o’, ‘r’, ‘G’, ‘e’, ‘e’, ‘k’, ‘s’]
 Method #3 : Using map() + lambdaThis is yet another way to perform this particular task. Though not recommended but can be used in certain situations. But drawback is readability of code gets sacrificed.
# Python3 code to demonstrate # splitting string to list of characters.# using map() + lambda  # initializing stringtest_string = "GeeksforGeeks"  # printing original string print ("The original string is : " + str(test_string))  # using map() + lambda# for splitting string to list of charactersres = list(map(lambda i:i, test_string))  # printing resultprint ("The resultant list of characters : " +  str(res))
The original string is : GeeksforGeeksThe resultant list of characters : [‘G’, ‘e’, ‘e’, ‘k’, ‘s’, ‘f’, ‘o’, ‘r’, ‘G’, ‘e’, ‘e’, ‘k’, ‘s’]
mailtojyoti2005
Python list-programs
Python string-programs
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Enumerate() in Python
Different ways to create Pandas Dataframe
Python String | replace()
*args and **kwargs in Python
Defaultdict in Python
Python | Get dictionary keys as a list
Python | Convert a list to dictionary
How to print without newline in Python?
Python | Convert string dictionary to dictionary