code-rag-bench/online-tutorials huggingface dataset:
Implicit Join vs Explicit Join in SQL - GeeksforGeeks

28 Oct, 2021
JOIN clause is used to combine rows from two or more tables, based on a relation between them. There are two different syntax forms to perform JOIN operation:
Explicit join
Implicit join
Step 1: Creating the Database
Use the below SQL statement to create a database called geeks:
CREATE DATABASE geeks;
Step 2: Using the Database
Use the below SQL statement to switch the database context to geeks:
USE geeks;
Step 3: Creating the Tables
Use the below SQL statement to create a table called student:
CREATE TABLE student(
  ROLL_NO INT PRIMARY KEY,
  NAME VARCHAR(25),
  AGE INT);
Use the below SQL statement to create a table called course:
CREATE TABLE course(
  COURSE_ID INT,
  ROLL_NO INT);
Step 4: Adding Data to the Tables
Use the below SQL statement to add the data to the student table:
INSERT INTO student 
VALUES 
(1, 'Anjali', 20), 
(2, 'Rachna', 18), 
(3, 'Shubham', 21), 
(4, 'Harsh', 25), 
(5, 'Shivam', 18), 
(6, 'Harshit', 20);
Use the below SQL statement to add the data to the course table:
INSERT INTO course 
VALUES 
(1, 1),
(2, 2),
(2, 3),
(5, 4),
(3, 5);
Step 5: Student Table
Use the below SQL statement to view the content of the student table:
SELECT * FROM student;
Course Table:
Use the below SQL statement to view the content of the course table:
SELECT * FROM course;
Step 6: Explicit Join 
This notation uses the ON keyword to specify the predicates for Join and the JOIN keyword to specify the tables to join. Join can be of any type i.e. INNER JOIN, LEFT JOIN, RIGHT JOIN, or FULL JOIN. It is easier to understand and less prone to errors.
Syntax:
SELECT column_names
FROM table1
JOIN table2
ON table1.column_name = table2.column_name
The following query will show the course id, names, and age of students enrolled in different courses by using explicit join notation.
Query:
SELECT COURSE_ID, NAME, AGE 
FROM student
JOIN course
ON student.ROLL_NO = course.ROLL_NO;
Output:
Step 7: Implicit Join 
This notation simply lists the tables for joining (in the FROM clause of the SELECT statement), using commas to separate them and WHERE clause to apply to join predicates. It performs a CROSS JOIN. It is difficult to understand and more prone to errors.
Syntax:
SELECT column_names
FROM table1, table2
WHERE table1.column_name = table2.column_name
The following query will show the course id, names, and age of students enrolled in different courses by using implicit join notation.
Query:
SELECT COURSE_ID, NAME, AGE 
FROM student, course
WHERE student.ROLL_NO = course.ROLL_NO;
Output:
Picked
SQL-Server
SQL
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to Update Multiple Columns in Single Update Statement 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 | Subquery
How to Write a SQL Query For a Specific Date Range and Date Time?
SQL Query to Convert VARCHAR to INT
SQL Query to Delete Duplicate Rows
SQL Query to Compare Two Dates
Window functions in SQL
What happens when we try to add a duplicate key into a HashMap object in java?

The HashMap is a class that implements the Map interface. It is based on the Hash table. It allows null values and null keys.
You can store key-value pairs in the HashMap object. Once you do so you can retrieve the values of the respective keys but, the values we use for keys should be unique
The put command associates the value with the specified key. i.e. if we add a key-value pair where the key exists already, this method replaces the existing value of the key with the new value,
 Live Demo
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
public class DuplicatesInHashMap {
   public static void main(String args[]) {
      HashMap<String, Long> map = new HashMap<String, Long>();
      map.put("Krishna", 9000123456L);
      map.put("Rama", 9000234567L);
      map.put("Sita", 9000345678L);
      map.put("Bhima", 9000456789L);
      map.put("Yousuf ", 9000456789L);
      System.out.println("Values Stored . . . . . .");
      //Retrieving the values of a Hash map
      Iterator it1 = map.entrySet().iterator();
      System.out.println("Contents of the hashMap are: ");
      while(it1.hasNext()){
         Map.Entry <String, Long> ele = (Map.Entry) it1.next();
         System.out.print(ele.getKey()+" : ");
         System.out.print(ele.getValue());
         System.out.println();
      }
      map.put("Bhima", 0000000000L);
      map.put("Rama", 0000000000L);
      //Retrieving the values of a Hash map
      Iterator it2 = map.entrySet().iterator();
      System.out.println("Contents of the hashMap after inserting new key-value pair: ");
      while(it2.hasNext()){
         Map.Entry <String, Long> ele = (Map.Entry) it2.next();
         System.out.print(ele.getKey()+" : ");
         System.out.print(ele.getValue());
         System.out.println();
      }
   }
}
Values Stored . . . . . .
Contents of the hashMap are:
Yousuf : 9000456789
Krishna : 9000123456
Sita : 9000345678
Rama : 9000234567
Bhima : 9000456789
Contents of the hashMap after inserting new key-value pair:
Yousuf : 9000456789
Krishna : 9000123456
Sita : 9000345678
Rama : 0
Bhima : 0
How to Copy NTFS permissions using PowerShell?

To change, add or remove security permissions on the files or folder using PowerShell you can use the Set-Acl command. The best way to set the permission is to copy the permissions from another file or folder if you need the same permissions on the destination path.
For example, I want the same folder permissions of the source C:\Shared\ to the destination folder path c:\shared1 path. You can use any destination path, it could be the remote shared UNC path.
See the difference in the above security permissions, the Shared named folder has one additional permission assigned (LABDOMAIN\Delta). We will copy the permission from one folder to another using Get-ACL of the source and Set-ACL to the destination path using the pipeline.
Get-ACL C:\Shared | Set-Acl C:\Shared1
Once the above operation is done, you can check the permission on the destination path.
You can see the delta user permission is added and other permissions are also copied. If the user already exists at the source and destination location then destination user permissions will be overwritten with the source user permission.
You can also store the Get-ACL output of the source object to the variable and assign it to the Set-ACL of the destination object. Set-ACL uses -AclObject parameter to take input of the permissions.
$perm = Get-Acl C:\Shared Set-Acl C:\Shared1 -AclObject $perm
If you need to apply permission on the multiple folders or the files or the subfolders then you can use Get-ChildItem to retrieve files and folders and use the Set-ACL command as shown above.
For example, we have reference folder C:\shared permission to apply on the destination objects. First, we will copy permissions using Get-Acl command.
$perm = Get-Acl C:\Shared
Second, we will retrieve the files/folders using Get-ChildItem, and then we will use the Set-ACL command after the pipeline.
Get-ChildItem C:\Temp -Recurse | Set-Acl -AclObject $perm
Before you set permissions on the multiple files and folders, it is always recommended that you use the -WhatIf parameter to know on which file or folder permissions are being applied.
PS C:\> Get-ChildItem C:\Temp -Recurse | Set-Acl -AclObject $perm -WhatIf
What if: Performing the operation "Set-Acl" on target "Microsoft.PowerShell.Core\FileSystem::C:\Temp\Scripts".
What if: Performing the operation "Set-Acl" on target "Microsoft.PowerShell.Core\FileSystem::C:\Temp\vcredist_x64.exe".
What if: Performing the operation "Set-Acl" on target "Microsoft.PowerShell.Core\FileSystem::C:\Temp\W2K12-KB3191565-x64.msu".
What if: Performing the operation "Set-Acl" on target "Microsoft.PowerShell.Core\FileSystem::C:\Temp\WindowsSensor.exe".
What if: Performing the operation "Set-Acl" on target "Microsoft.PowerShell.Core\FileSystem::C:\Temp\WindowsSensor_7E3A9735FA064249A7005E9BE8CDD
What if: Performing the operation "Set-Acl" on target "Microsoft.PowerShell.Core\FileSystem::C:\Temp\Scripts\MyModules".
What if: Performing the operation "Set-Acl" on target "Microsoft.PowerShell.Core\FileSystem::C:\Temp\Scripts\MyModules\MyModules.psm1".
Find the area of a circle in C programming.

A circle is a closed figure. All the points of the circle are equidistant from a point that lies inside in circle. The point at the center is known as the center of the circle. The distance of points from the center is known as the radius.
The area is the quantitative representation of the span of the dimensions of a closed figure.
The area of circle is the area enclosed inside the dimensions of a circle.
The formula for calculating the area of a circle,
Area = π*r*r
To calculate the area we are given the radius of the circle as input and we will use the formula to calculate the area,
STEP 1: Take radius as input from the user using std input.
STEP 2: Calculate the area of circle using,
   area = (3.14)*r*r
STEP 3: Print the area to the screen using the std output.
int r , the radius of the circle
float area, the area of circle calculated using the formula.
 Live Demo
#include <stdio.h>
int main(){
   int r = 8;
   float area = (3.14)*r*r;
   printf("The area of the circle is %f",area);
   return 0;
}
The area of the circle is 200.96
Can we create an enum with custom values in java?

Enumeration (enum) in Java is a datatype which stores a set of constant values (Strings in general). You can use enumerations to store fixed values such as days in a week, months in a year etc.
enum Days {
   SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY
}
Instead of declaring just string constants in an enum, you can also have values to these constants as −
enum Vehicles {
   ACTIVA125(80000), ACTIVA5G(70000), ACCESS125(75000), VESPA(90000), TVSJUPITER(75000);
}
Whenever, you need to assign custom values to the constants of an enum −
To hold the value of each constant you need to have an instance variable (generally, private).
You cannot create an object of an enum explicitly so, you need to add a parameterized constructor to initialize the value(s).
The initialization should be done only once. Therefore, the constructor must be declared private or default.
To returns the values of the constants using an instance method(getter).
In the following Java example, we are defining an enum with name Vehicles and declaring five constants representing the vehicle names with their prices as values.
 Live Demo
enum Vehicles {
   //Constants with values
   ACTIVA125(80000), ACTIVA5G(70000), ACCESS125(75000), VESPA(90000), TVSJUPITER(75000);
   //Instance variable
   private int price;
   //Constructor to initialize the instance variable
   Vehicles(int price) {
      this.price = price;
   }
   public int getPrice() {
      return this.price;
   }
}
public class EnumTest{
   public static void main(String args[]) {
      Vehicles vehicles[] = Vehicles.values();
      for(Vehicles veh: vehicles) {
         System.out.println("Price of "+veh+" is: "+veh.getPrice());
      }
   }
}
Price of ACTIVA125 is: 80000
Price of ACTIVA5G is: 70000
Price of ACCESS125 is: 75000
Price of VESPA is: 90000
Price of TVSJUPITER is: 75000
Get Bit Coin price in real time using Python - GeeksforGeeks

13 Jan, 2022
In this article we will see how we can get the current price of the bit coin.
Bitcoin is a cryptocurrency. It is a decentralized digital currency without a central bank or single administrator that can be sent from user to user on the peer-to-peer bitcoin network without the need for intermediaries.
Modules required and Installation:
Requests :Requests allows you to send HTTP/1.1 requests extremely easily. There’s no need to manually add query strings to your URLs.
pip install requests
Beautiful Soup:Beautiful Soup is a library that makes it easy to scrape information from web pages. It sits atop an HTML or XML parser, providing Pythonic idioms for iterating, searching, and modifying the parse tree.
pip install beautifulsoup4
Explanation –We have the google search URL of the bit coin price from that we have scrape the price of the bitcoin in Indian rupees and stored it in a variable, which we further print it.
Python3
# importing librariesfrom bs4 import BeautifulSoup as BSimport requests    # method to get the price of bit coindef get_price(url):          # getting the request from url     data = requests.get(url)      # converting the text     soup = BS(data.text, 'html.parser')      # finding metha info for the current price    ans = soup.find("div", class_ ="BNeawe iBp4i AP7Wnd").text          # returning the price    return ans   # url of the bit coin priceurl = "https://www.google.com / search?q = bitcoin + price"  # calling the get_price methodans = get_price(url)  # printing the ansprint(ans)
Output :
520, 106.95 Indian Rupee
varshagumber28
as5853535
Python web-scraping-exercises
Python-BS3
Web-scraping
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Python Dictionary
Enumerate() in Python
Read a file line by line in Python
Defaultdict in Python
Different ways to create Pandas Dataframe
sum() function in Python
Iterate over a list in Python
Deque in Python
How to Install PIP on Windows ?
Python String | replace()
MySQL Tryit Editor v1.0

SELECT TRUNCATE(345.156, 0);
​
        
Edit the SQL Statement, and click "Run SQL" to see the result.
This SQL-Statement is not supported in the WebSQL Database.
The example still works, because it uses a modified version of SQL.
Your browser does not support WebSQL.
Your are now using a light-version of the Try-SQL Editor, with a read-only Database.
If you switch to a browser with WebSQL support, you can try any SQL statement, and play with the Database as much as you like. The Database can also be restored at any time.
Our Try-SQL Editor uses WebSQL to demonstrate SQL.
A Database-object is created in your browser, for testing purposes.
You can try any SQL statement, and play with the Database as much as you like. The Database can be restored at any time, simply by clicking the "Restore Database" button.
WebSQL stores a Database locally, on the user's computer. Each user gets their own Database object.
WebSQL is supported in Chrome, Safari, and Opera.
If you use another browser you will still be able to use our Try SQL Editor, but a different version, using a server-based ASP application, with a read-only Access Database, where users are not allowed to make any changes to the data.
Impala - Select Statement

Impala SELECT statement is used to fetch the data from one or more tables in a database. This query returns data in the form of tables.
Following is the syntax of the Impala select statement.
SELECT column1, column2, columnN from table_name;

Here, column1, column2...are the fields of a table whose values you want to fetch. If you want to fetch all the fields available in the field, then you can use the following syntax −
SELECT * FROM table_name;

Assume we have a table named customers in Impala, with the following data −
ID    NAME       AGE    ADDRESS      SALARY
---   -------    ---    ----------   -------
1     Ramesh     32     Ahmedabad    20000
2     Khilan     25     Delhi        15000
3     Hardik     27     Bhopal       40000
4     Chaitali   25     Mumbai       35000
5     kaushik    23     Kota         30000
6     Komal      22     Mp           32000

You can fetch the id, name, and age of all the records of the customers table using select statement as shown below −
[quickstart.cloudera:21000] > select id, name, age from customers;

On executing the above query, Impala fetches id, name, age of all the records from the specified table and displays them as shown below.
Query: select id,name,age from customers

+----+----------+-----+
| id | name     | age |
| 1  | Ramesh   | 32  |
| 2  | Khilan   | 25  |
| 3  | Hardik   | 27  |
| 4  | Chaitali | 25  |
| 5  | kaushik  | 23  |
| 6  | Komal    | 22  |
+----+----------+-----+

Fetched 6 row(s) in 0.66s

You can also fetch all the records from the customers table using the select query as shown below.
[quickstart.cloudera:21000] > select name, age from customers; 
Query: select * from customers

On executing the above query, Impala fetches and displays all the records from the specified table as shown below.
+----+----------+-----+-----------+--------+
| id | name     | age | address   | salary |
+----+----------+-----+-----------+--------+
| 1  | Ramesh   | 32  | Ahmedabad | 20000  |
| 2  | Khilan   | 25  | Delhi     | 15000  |
| 3  | Hardik   | 27  | Bhopal    | 40000  |
| 4  | Chaitali | 25  | Mumbai    | 35000  |
| 5  | kaushik  | 23  | Kota      | 30000  |
| 6  | Komal    | 22  | MP        | 32000  |
+----+----------+-----+-----------+--------+

Fetched 6 row(s) in 0.66s

Open Impala Query editor and type the select Statement in it. And click on the execute button as shown in the following screenshot.
After executing the query, if you scroll down and select the Results tab, you can see the list of the records of the specified table as shown below.
 Print
 Add Notes
 Bookmark this page
Collectors toList() method in Java 8


The toList() method of the Collectors class returns a Collector that accumulates the input elements into a new List.
The syntax is as follows −
static <T> Collector<T,?,List<T>> toList()
Here, parameter T is the type of input elements.
To work with Collectors class in Java, import the following package −
import java.util.stream.Collectors;
The following is an example to implement Collectors toList() method in Java −
 Live Demo
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class Demo {
   public static void main(String[] args) {
      Stream<String> stream = Stream.of("25", "40", "90", "150", "180", "220", "350");
      List<String> list = stream.collect(Collectors.toList());
      System.out.println("List = "+list);
   }
}
List = [25, 40, 90, 150, 180, 220, 350]
C# Program to Convert a Binary String to an Integer - GeeksforGeeks

02 Jul, 2020
Given an binary string as input, we need to write a program to convert the binary string into equivalent integer. To convert an binary string to integer, we have to use Convert.ToInt32(String, Base/Int32) function to convert the values. The base of the binary is 2. 
Syntax: 
 Convert.ToInt32(String, Base/Int32);

Examples:
Input  : 1010101010101010
Output : 43690

Input : 1100011000
        111100001111
        11001100110011001100

Output : 792
         3855
         838860

Program 1:  
csharp
// C# program to convert array// of binary string to an integerusing System;using System.Text;  class GFG {      static void Main(string[] args)    {        // binary number as string        string bin_strng = "1010101010101010";        int number = 0;                // converting to integer        number = Convert.ToInt32(bin_strng, 2);                // to print  the value        Console.WriteLine("Number value of binary \"{0}\" is = {1}", bin_strng,                          number);    }}
Output:
Number value of binary "1010101010101010" is = 43690

Program 2:  
C#
// C# program to convert array// of binary string to an integerusing System;using System.Text;  namespace geeks {class GFG {        static void Main(string[] args)    {        // binary number as string        string bin_strng = "1100011000";        int number = 0;          // converting to integer        number = Convert.ToInt32(bin_strng, 2);                // to print  the value        Console.WriteLine("Number value of binary \"{0}\" is = {1}", bin_strng,                          number);          bin_strng = "111100001111";          // converting to integer        number = Convert.ToInt32(bin_strng, 2);                // to print  the value        Console.WriteLine("Number value of binary \"{0}\" is = {1}", bin_strng,                          number);          bin_strng = "11001100110011001100";          // converting to integer        number = Convert.ToInt32(bin_strng, 2);                // to print the value        Console.WriteLine("Number value of binary \"{0}\" is = {1}", bin_strng,                          number);          // hit ENTER to exit        Console.ReadLine();    }}}
Output: 
Number value of binary "1100011000" is = 792
Number value of binary "111100001111" is = 3855
Number value of binary "11001100110011001100" is = 838860

C#
C# Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
C# | Method Overriding
C# Dictionary with examples
Difference between Ref and Out keywords in C#
C# | Delegates
Top 50 C# Interview Questions & Answers
Convert String to Character Array in C#
Getting a Month Name Using Month Number in C#
Socket Programming in C#
Program to Print a New Line in C#
Program to find absolute value of a given number
C# - Operators Precedence

Operator precedence determines the grouping of terms in an expression. This affects evaluation of an expression. Certain operators have higher precedence than others; for example, the multiplication operator has higher precedence than the addition operator.
For example x = 7 + 3 * 2; here, x is assigned 13, not 20 because operator * has higher precedence than +, so the first evaluation takes place for 3*2 and then 7 is added into it.
Here, operators with the highest precedence appear at the top of the table, those with the lowest appear at the bottom. Within an expression, higher precedence operators are evaluated first.
using System;
namespace OperatorsAppl {
   class Program {
      static void Main(string[] args) {
         int a = 20;
         int b = 10;
         int c = 15;
         int d = 5;
         int e;
         e = (a + b) * c / d;     // ( 30 * 15 ) / 5
         Console.WriteLine("Value of (a + b) * c / d is : {0}", e);

         e = ((a + b) * c) / d;   // (30 * 15 ) / 5
         Console.WriteLine("Value of ((a + b) * c) / d is  : {0}", e);

         e = (a + b) * (c / d);   // (30) * (15/5) {0}", e);

         e = a + (b * c) / d;    //  20 + (150/5) {0}", e);
         Console.ReadLine();
      }
   }
}
When the above code is compiled and executed, it produces the following result −
Value of (a + b) * c / d is : 90
Value of ((a + b) * c) / d is  : 90


    119 Lectures 
     23.5 hours 

 Raja Biswas

    37 Lectures 
     13 hours 

 Trevoir Williams

    16 Lectures 
     1 hours 

 Peter Jepson

    159 Lectures 
     21.5 hours 

 Ebenezer Ogbu

    193 Lectures 
     17 hours 

 Arnold Higuit

    24 Lectures 
     2.5 hours 

 Eric Frick
 Print
 Add Notes
 Bookmark this page
Convert an image into grayscale image using HTML/CSS - GeeksforGeeks

07 Dec, 2018
Given a colored image and the task is to convert the image into grayscale image using CSS property. In CSS, filter property is used to convert an image into grayscale image. Filter property is mainly used to set the visual effect of an image.
Syntax:
filter: grayscale()
Example 1: In this example, use filter: grayscale(100%) to convert an image into grayscale.
<!DOCTYPE html><html>    <head>        <title>Convert into grayscale image</title>        <style>            img {                -webkit-filter: grayscale(100%);                filter: grayscale(100%);            }            h1 {                color:green;            }        </style>    </head>    <body>        <center>        <h1>GeeksforGeeks</h1>        <h2>Grayscale Image</h2>        <img src="https://media.geeksforgeeks.org/wp-content/uploads/interview-preparation-2.png"         width="500px" height="250px" alt="filter applied" />          </center>    </body></html>
Output:
Example 2:
<!DOCTYPE html><html>    <head>        <title>Convert into grayscale image</title>        <style>            img {                -webkit-filter: grayscale(1);                filter: grayscale(1);            }            img:hover {              -webkit-filter: grayscale(0);              filter: none;            }            h1 {                color:green;            }        </style>    </head>    <body>        <center>        <h1>GeeksforGeeks</h1>        <h2>Grayscale Image</h2>        <img src="https://media.geeksforgeeks.org/wp-content/uploads/interview-preparation-2.png"         width="500px" height="250px" alt="filter applied" />          </center>    </body></html>
Output:
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.
Picked
CSS
HTML
Web Technologies
Web technologies Questions
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to insert spaces/tabs in text using HTML/CSS?
How to update Node.js and NPM to next version ?
How to create footer to stay at the bottom of a Web page?
CSS to put icon inside an input element in a form
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to insert spaces/tabs in text using HTML/CSS?
How to update Node.js and NPM to next version ?
How to set the default value for an HTML <select> element ?
How to set input type date in dd-mm-yyyy format using HTML ?
Python - turtle.delay() method - GeeksforGeeks

01 Aug, 2020
Turtle graphics is a popular way for introducing programming to kids. It was part of the original Logo programming language developed by Wally Feurzeig, Seymour Papert and Cynthia Solomon in 1967.
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 method is used to return or set the drawing delay in milliseconds. It requires only one optional argument as a positive integer for delay.
Syntax : turtle.delay(delay)Parameter :
delay : a positive integer, denoted the delay time in milliseconds, is optional
Returns : The delayed value
Below is the implementation of above method with some examples :Example 1 :
# import packageimport turtle  # turtle movement with# normal speedturtle.forward(100)  # slow the speed by # turtle delayturtle.delay(50)  # turtle movementturtle.forward(80)
Output :
Example 2 :
# import packageimport turtle   # loop for patternfor i in range(10):      # set turtle delay    turtle.delay(10 * i)      # motion for pattern    turtle.forward(50 + 10 * i)    turtle.right(90)
Output :
Python-turtle
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to Install PIP on Windows ?
How to drop one or multiple columns in Pandas Dataframe
Selecting rows in pandas DataFrame based on conditions
How To Convert Python Dictionary To JSON?
Check if element exists in list in Python
Python | os.path.join() method
Python | Get unique values from a list
Defaultdict in Python
Create a directory in Python
Python | Pandas dataframe.groupby()
C++ Vector Library - emplace() Function

The C++ function std::vector::emplace() extends container by inserting new element at position. Reallocation happens if there is need of more space.
This method increases container size by one.
Following is the declaration for std::vector::emplace() function form std::vector header.
template <class... Args>
iterator emplace (const_iterator position, Args&&... args);

position − Index in the container where the new element is to be inserted.
position − Index in the container where the new element is to be inserted.
args − Arguments forwarded to construct the new element.
args − Arguments forwarded to construct the new element.
Returns a random access iterator which points to the newly emplaced element.
If reallocation fails bad_alloc exception is thrown.
Linear i.e. O(n)
The following example shows the usage of std::vector::emplace() function.
#include <iostream>
#include <vector>

using namespace std;

int main(void) {
   vector<int> v = {1, 2, 5};

   /* insert element at index 3 */
   auto it = v.emplace(v.begin() + 2, 4);

   /* insert element at index 2 */
   v.emplace(it, 3);

   for (auto it = v.begin(); it != v.end(); ++it)
      cout << *it << endl;

   return 0;
}
Let us compile and run the above program, this will produce the following result −
1
2
3
4
5

 Print
 Add Notes
 Bookmark this page
getpixel() function in C - GeeksforGeeks

23 Jan, 2018
The header file graphics.h contains getpixel() function which returns the color of pixel present at location (x, y).
Syntax :
int getpixel(int x, int y);

Note : By default the screen is BLACK, therefore color of pixel at (0,0) is BLACK.
Below is the implementation of getpixel() function.
// C Implementation for getpixel()#include <graphics.h>#include <stdio.h>  // driver codeint main(){    // gm is Graphics mode which is    // a computer display mode that    // generates image using pixels.    // DETECT is a macro defined in    // "graphics.h" header file    int gd = DETECT, gm, color;    char arr[50];      // initgraph initializes the    // graphics system by loading a    // graphics driver from disk    initgraph(&gd, &gm, "");      // getpixel function    color = getpixel(0, 0);      // sprintf stands for “String print”.    // Instead of printing on console,    // it store output on char buffer    // which are specified in sprintf    sprintf(arr, "color of pixel at (0,0) = %d",                                       color);      // outtext function displays text    // at current position.    outtext(arr);      getch();      // closegraph function closes the    // graphics mode and deallocates    // all memory allocated by    // graphics system .    closegraph();      return 0;}
Output :


Explanation : As nothing is drawn anything on screen and by default screen is BLACK, therefore color of pixel at (0, 0) is BLACK as 0 indicates BLACK color.
c-graphics
computer-graphics
C Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
TCP Server-Client implementation in C
Exception Handling in C++
'this' pointer in C++
Multithreading in C
Arrow operator -> in C/C++ with Examples
Smart Pointers in C++ and How to Use Them
Understanding "extern" keyword in C
Multiple Inheritance in C++
Ways to copy a vector in C++
Basics of File Handling in C
How to clear console in MongoDB?

To clear console in MongoDB, you can use any of the following two syntaxes.
The first syntax is as follows, which is the usage of keyboard shortcut −
Ctrl + L
After pressing the above key, you can clear console in MongoDB.
The second syntax is as follows −
cls
To understand the above syntaxes, let us implement them one by one. Here is the snapshot of my console.
The first query is as follows to clear console in MongoDB −
Ctrl+L;
The following is the output −
Look at the above sample output, the console has been cleared. Let us check the console once again.
The second query is as follows to clear console i.e. type “cls” −
After pressing enter key, the console will clear. The screenshot of the sample output is as follows −
How to perform right click on an element in Selenium with python?

We can perform right click on an element in Selenium with the help of
Action Chains class. These classes are generally used for automating interactions
like context menu click, mouse button actions, key press and mouse movements.
These types of actions are mainly common in complex scenarios like drag and drop
and hovering over an element on the page. The methods of the Action Chains class
are utilized by advanced scripts. We can manipulate DOM with the help of Action
Chains in Selenium.
The action chain object implements the ActionChains in the form of a queue and
then executes the perform() method. On calling the method perform(), all the
actions on action chains will be performed.
The method of creating an Action Chain object is listed below −
First we need to import the Action Chain class and then the driver will be
passed as an argument to it.
First we need to import the Action Chain class and then the driver will be
passed as an argument to it.
Now all the operations of action chains can be done with the help of this
object.
Now all the operations of action chains can be done with the help of this
object.
Syntax for creating an object of Action Chains −
from selenium import webdriver
# import Action chains
from selenium.webdriver import ActionChains
# create webdriver object
driver = webdriver.Firefox()
# create action chain object
action = ActionChains(driver)
After creating an object of Action Chains, we can perform numerous operations
one by one like a chain which is queued.
context_click() − This method performs right click operation on an element of the
page.
context_click(args)
Where args is the element which has to be right clicked. If omitted, the click on
the present mouse position is performed.
#element
source = driver.find_element_by_id("name")
#action chain object
action = ActionChains(driver)
# right click operation
action.context_click(source)
Code Implementation for right click operation.
from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.common.keys import Keys
#browser exposes an executable file
#Through Selenium test we will invoke the executable file which will then
#invoke actual browser
driver = webdriver.Chrome(executable_path="C:\\chromedriver.exe")
# to maximize the browser window
driver.maximize_window()
#get method to launch the URL
driver.get("https://www.tutorialspoint.com/about/about_careers.htm")
#to refresh the browser
driver.refresh()
# identifying the source element
source= driver.find_element_by_xpath("//*[text()='Company']");
# action chain object creation
action = ActionChains(driver)
# right click operation and then perform
action.context_click(source).perform()
#to close the browser
driver.close()
How to run Python Program?

After writing the code, we need to run the code to execute and obtain the output. On running the program, we can check whether the code is written is correct and produces the desired output.
Running a python program is quite an easy task.
To run a python program on IDLE, follow the given steps −
Write the python code and save it.
Write the python code and save it.
To run the program, go to Run > Run Module or simply click F5.
To run the program, go to Run > Run Module or simply click F5.
The python script file is saved with ‘.py’ extension. After saving the python script, we can run it from the Command Line. In the cmd, type keyword ‘python’ followed by the name of the file with which you saved the python script.
Example
Let us suppose, we have a python script saved with the name ‘hello.py’. To run it on command line, type the following −
python hello.py
To run a python program on an IDE like PyCharm, we need to follow the given steps −
Create a new python file and save it with some name, say “hello.py”.You don’t need to specify the extension as it will pick it automatically.
Create a new python file and save it with some name, say “hello.py”.You don’t need to specify the extension as it will pick it automatically.
After writing the required code in the python file, we need to run it.
After writing the required code in the python file, we need to run it.
To run, Click on the Green Play Button at the top right corner of the IDE. The second way to run is, Right click and select ‘Run File in Python Console’ option.This will open a console box at the bottom and output will be shown there.
To run, Click on the Green Play Button at the top right corner of the IDE. The second way to run is, Right click and select ‘Run File in Python Console’ option.
This will open a console box at the bottom and output will be shown there.
Interactive mode is the method to type and run python code in command line. In interactive mode, the python code is written and run line by line in a sequential manner.To enter into interactive mode, open Command Prompt and type ‘python’ and press Enter.
Write one line of code and press enter to execute it and enter the second line.
Example
To run the code in interactive mode, You must have python installed on your system. On typing ‘python’ , the version of the python installed on your system is displayed. This means that python is installed on your system and we can move forward in running python scripts. On entering one line of code i.e. print(“Hello World”) ,after pressing enter the “Hello World” is displayed.
We can run python script on a text editor. To do so,follow the following steps −
Create a file with a name ,let “hello.py”.
Create a file with a name ,let “hello.py”.
Write some python code in the file.
Write some python code in the file.
To run the code, Right Click > Select Run Code. Else, press ‘Ctrl+Alt+N’ to run the code.
To run the code, Right Click > Select Run Code. Else, press ‘Ctrl+Alt+N’ to run the code.
Concatenate two lists element-wise in Python

Pyhton has great data manipulation features. In this article we will see how to combine the elements from two lists in the same order as they are present in the lists.
The zip function can take in the two lists as parameters and concatenate them. We design a for loop to capture these combinations and put them into a new list.
 Live Demo
listA = ["Outer-", "Frost-", "Sun-"]
listB = ['Space', 'bite', 'rise']
# Given lists
print("Given list A: ", listA)
print("Given list B: ",listB)
# Use zip
res = [i + j for i, j in zip(listA, listB)]
# Result
print("The concatenated lists: ",res)
Running the above code gives us the following result −
Given list A: ['Outer-', 'Frost-', 'Sun-']
Given list B: ['Space', 'bite', 'rise']
The concatenated lists: ['Outer-Space', 'Frost-bite', 'Sun-rise']
The map function will apply the same function again and again to the parameters passed onto it. We will also use a lambda function to combine the individual elements one by one from the two lists through zip.
 Live Demo
listA = ["Outer-", "Frost-", "Sun-"]
listB = ['Space', 'bite', 'rise']
# Given lists
print("Given list A: ", listA)
print("Given list B: ",listB)
# Use map
res = list(map(lambda(i, j): i + j, zip(listA, listB)))
# Result
print("The concatenated lists: ",res)
Running the above code gives us the following result −
Given list A: ['Outer-', 'Frost-', 'Sun-']
Given list B: ['Space', 'bite', 'rise']
The concatenated lists: ['Outer-Space', 'Frost-bite', 'Sun-rise']
Initialization of a multidimensional array in C

Array is a collection of same type of elements at contiguous memory location. The lowest address corresponds to the first element while highest corresponds to last element. Array index starts with zero(0) and ends with the size of array minus one(array size - 1). Array size must be integer greater than zero.
Let us see an example,
If array size = 10
First index of array = 0
Last index of array = array size - 1 = 10-1 = 9
Multi-dimensional arrays are arrays of array. The data is stored in tabular form in row major order.
The following is the syntax of multi-dimensional arrays.
type array_name[array_size1][array_size2].......[array_sizeN];
Here,
array_name − Any name given to an array.
array_size − Size of array.
The following is how you can initialize a multi-dimensional array.
type array_name[array_size1][array_size2].......[array_sizeN]; = { {elements} , {elements} , ... , {elements} }
The following is an example of multi-dimensional array.
 Live Demo
#include <stdio.h>
int main () {
   int arr[2][3] = { {5,2,3}, {28,8,30}};
   int i, j;
   for ( i = 0; i < 2; i++ ) {
      for ( j = 0; j < 3; j++ )
      printf("arr[%d][%d] = %d\n", i, j, arr[i][j] );
   }
   return 0;
}
arr[0][0] = 5
arr[0][1] = 2
arr[0][2] = 3
arr[1][0] = 28
arr[1][1] = 8
arr[1][2] = 30
In the above program, a two-dimensional array is declared.
int arr[2][3] = { {5,2,3}, {28,8,30}};
The elements of array are printed using nested for loop.
for ( i = 0; i < 2; i++ ) {
   for ( j = 0; j < 3; j++ )
   printf("arr[%d][%d] = %d\n", i, j, arr[i][j] );
}
Display minutes with SimpleDateFormat('mm') in Java

To work with SimpleDateFormat class in Java, import the following package.
import java.text.SimpleDateFormat;
Now, set the format with SimpleDateFormat(“mm”) to display minutes in two-digits.
Format f = new SimpleDateFormat(‘”mm”);
Now, get the minutes in a string.
String strMinute = f.format(new Date());
The following is an example −
 Live Demo
import java.text.Format;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Calendar;
public class Demo {
   public static void main(String[] args) throws Exception {
      // displaying current date and time
      Calendar cal = Calendar.getInstance();
      SimpleDateFormat simpleformat = new SimpleDateFormat("dd/MMMM/yyyy hh:mm:s");
      System.out.println("Today's date = "+simpleformat.format(cal.getTime()));
      // displaying hour
      Format f = new SimpleDateFormat("H");
      String strHour = f.format(new Date());
      System.out.println("Current Hour = "+strHour);
      // displaying minutes in two-digits
      f = new SimpleDateFormat("mm");
      String strMinute = f.format(new Date());
      System.out.println("Current Minutes = "+strMinute);
   }
}
Today's date = 26/November/2018 08:03:40
Current Hour = 8
Current Minutes = 03
Find indices of all occurrence of one string in other in C++

Suppose we have string str, and another substring sub_str, we have to find the indices for all occurrences of the sub_str in str. Suppose the str is “aabbababaabbbabbaaabba”, and sub_str is “abb”, then the indices will be 1 9 13 18.
To solve this problem, we can use the substr() function in C++ STL. This function takes the initial position from where it will start checking, and the length of the substring, if that is the same as the sub_str, then returns the position.
 Live Demo
#include<iostream>
using namespace std;
void substrPosition(string str, string sub_str) {
   bool flag = false;
   for (int i = 0; i < str.length(); i++) {
      if (str.substr(i, sub_str.length()) == sub_str) {
         cout << i << " ";
         flag = true;
      }
   }
   if (flag == false)
      cout << "NONE";
}
int main() {
   string str = "aabbababaabbbabbaaabba";
   string sub_str = "abb";
   cout << "Substrings are present at: ";
   substrPosition(str, sub_str);
}
Substrings are present at: 1 9 13 18
How to Find Factors of Number using Python?

In order to find factors of a number, we have to run a loop over all numbers from 1 to itself and see if it is divisible.
num=int(input("enter a number"))
factors=[]
for i in range(1,num+1):
    if num%i==0:
       factors.append(i)

print ("Factors of {} = {}".format(num,factors))
If i is able to divide num completely, it is added in the list. Finally the list is diaplayed as the factors of given number
enter a number75
Factors of 75 = [3, 5, 15, 25, 75]
Batch Script - FIND

This batch command searches for a string in files or input, outputting matching lines.
FIND [text] [destination]

Where text is the string which needs to be searched for and destination is the source in which the search needs to take place.
@echo off 
FIND "Application" C:\tp\lists.txt
If the word “Application” resides in the file lists.txt, the line containing the string will be displayed in the command prompt.
 Print
 Add Notes
 Bookmark this page
Maximum Sum SubArray using Divide and Conquer in C++

Suppose we have one list of data with positive and negative values. We have to find the sum of contiguous subarray whose sum is largest. Suppose the list is containing {-2, -5, 6, -2, -3, 1, 5, -6}, then the sum of maximum subarray is 7. It is the sum of {6, -2, -3, 1, 5}
We will solve this problem using Divide and Conquer method. The steps will be look like below −
Steps −
Divide the array into two parts
Find the maximum of following threeMaximum subarray sum of left subarrayMaximum subarray sum of right subarrayMaximum subarray sum such that subarray crosses the midpoint
Maximum subarray sum of left subarray
Maximum subarray sum of right subarray
Maximum subarray sum such that subarray crosses the midpoint
#include <iostream>
using namespace std;
int max(int a, int b) {
   return (a > b)? a : b;
}
int max(int a, int b, int c) {
   return max(max(a, b), c);
}
int getMaxCrossingSum(int arr[], int l, int m, int h) {
   int sum = 0;
   int left = INT_MIN;
   for (int i = m; i >= l; i--) {
      sum = sum + arr[i];
      if (sum > left)
         left = sum;
   }
   sum = 0;
   int right = INT_MIN;
   for (int i = m+1; i <= h; i++) {
      sum = sum + arr[i];
      if (sum > right)
      right = sum;
   }
   return left + right;
}
int maxSubArraySum(int arr[], int low, int high) {
   if (low == high)
   return arr[low];
   int mid = (low + high)/2;
   return max(maxSubArraySum(arr, low, mid), maxSubArraySum(arr, mid+1, high), getMaxCrossingSum(arr, low, mid, high));
}
int main() {
   int arr[] = {-2, -5, 6, -2, -3, 1, 5, -6};
   int n = sizeof(arr)/sizeof(arr[0]);
   int max_sum = maxSubArraySum(arr, 0, n-1);
   printf("Maximum contiguous sum is %d", max_sum);
}
Valid String
LinkedList removeFirst() Method in Java

10 Dec, 2018
The Java.util.LinkedList.removeFirst() method is used to remove the first element from a linked list. This function also returns the first element after removing it.
Syntax:
LinkedList.removeFirst();

Parameters: This function does not take any parameters.
Return Value: The method returns the first element or the element present at the head of the list.
Below program illustrate the Java.util.LinkedList.removeFirst() method:
// Java code to illustrate removeFirst() methodimport java.io.*;import java.util.LinkedList;  public class LinkedListDemo {    public static void main(String args[])    {        // Creating an empty LinkedList        LinkedList<String> list = new LinkedList<String>();          // Using add() method to add elements in the list        list.add("Geeks");        list.add("for");        list.add("Geeks");        list.add("10");        list.add("20");          // Displaying the list        System.out.println("LinkedList:" + list);          // Remove the head using removeFirst() method        System.out.println("The first element is: " + list.removeFirst());          // Displaying the final list        System.out.println("Final LinkedList:" + list);    }}
LinkedList:[Geeks, for, Geeks, 10, 20]
The first element is: Geeks
Final LinkedList:[for, Geeks, 10, 20]

Java - util package
Java-Collections
Java-Functions
java-LinkedList
Java
Java
Java-Collections
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.