code-rag-bench/online-tutorials huggingface dataset:
SMTP Commands

13 Sep, 2021
Simple Mail Transfer Protocol (SMTP) is an ASCII protocol. It is based on client-server model. It uses TCP port number 25 for this service. Therefore e-mail; is delivered from source to destination by having the source machine established a TCP to port 25 of the destination machine. To send mail, a system must contain client MTA and to receive a mail, a system must have server MTA. SMTP transfers this message from client MTA to the server MTA. To send a mail, SMTP is used two times: one between sender and sender’s mail server and the other between the two mail servers. 
SMTP Commands : These commands are sent from the client to the server. Each command consists of a keyword followed by zero or more arguments. It means there are also some keywords that do not contain any argument. The format of the command is as follows : 
 Keywords : argument(s) 
There are 14 different SMTP commands which are given in the following table : 
 
avtarkumar719
Computer Networks
GATE CS
Computer Networks
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
GSM in Wireless Communication
Wireless Application Protocol
Secure Socket Layer (SSL)
Mobile Internet Protocol (or Mobile IP)
Advanced Encryption Standard (AES)
ACID Properties in DBMS
Types of Operating Systems
Normal Forms in DBMS
Page Replacement Algorithms in Operating Systems
Inter Process Communication (IPC)
How to create Donghnut chart in react using material UI and DevExpress ?

19 Jul, 2021
DevExpress: DevExpress is a package for controlling and building the user interface of the Window, Mobile, and other applications.
Doughnut Charts: Doughnut charts are the modified version of Pie Charts with the area of center cut out. A donut is more concerned about the use of an area of arcs to represent the information in the most effective manner instead of Pie chart which is more focused on comparing the proportion area between the slices. 
Steps for creating React Application And Installing Module:
Step 1: Create a React application using the following command.npx create-react-app foldername
Step 1: Create a React application using the following command.
npx create-react-app foldername
 
Step 2: After creating your project folder i.e. folder name, move to it using the following command.cd foldername
Step 2: After creating your project folder i.e. folder name, move to it using the following command.
cd foldername
Step 3: After creating the ReactJS application, install the required modules using the following command.npm i --save @devexpress/dx-react-core @devexpress/dx-react-chart
npm install @material-ui/core
npm i --save @devexpress/dx-react-chart-material-ui
Step 3: After creating the ReactJS application, install the required modules using the following command.
npm i --save @devexpress/dx-react-core @devexpress/dx-react-chart
npm install @material-ui/core
npm i --save @devexpress/dx-react-chart-material-ui
Project Structure: It will look like the following :
Project Structure
Example: Now write down the following code in the App.js file. Here, the App is our default component where we have written our code.
App.js
import React from "react";import Paper from '@material-ui/core/Paper';import {  Chart,  PieSeries,  Title} from '@devexpress/dx-react-chart-material-ui';    const App = () => {  // Sample dataconst data = [  { argument:'Monday', value:10 },  { argument:'Tuesday', value:40 },  { argument:'Wednesday', value:10 },  { argument:'Thursday', value:20 },  { argument:'Friday', value:20 },];return (    <Paper>    <Chart      data={data}    >      <PieSeries valueField="value"         argumentField="argument"         innerRadius={0.6} />      <Title text="Studies per day"/>    </Chart>  </Paper>);}  export default App;
Step to Run Application: Run the application using the following command from the root directory of the project:
npm start
Output: Now open your browser and go to http://localhost:3000/, you will see the following output:
Output
Material-UI
Picked
React-Questions
JavaScript
ReactJS
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Difference between var, let and const keywords in JavaScript
Remove elements from a JavaScript Array
Difference Between PUT and PATCH Request
Roadmap to Learn JavaScript For Beginners
JavaScript | Promises
How to fetch data from an API in ReactJS ?
How to redirect to another page in ReactJS ?
Axios in React: A Guide for Beginners
ReactJS Functional Components
SAP ABAP - Nested If Statement

It is always legal to nest IF....ELSE statements, which means you can use one IF or ELSEIF statement inside another IF or ELSEIF statement.
The syntax for a nested IF....ELSE statement is as follows −
IF<condition_1>. 
<statement block>.  
IF<condition_2>. 
<statement block>.  
ELSE. 
<statement block>.  
ENDIF. 
ELSE <statement block>.  
ENDIF.

Report YH_SEP_15. 
 
Data: Title_1(10) TYPE C,
      Title_2(15) TYPE C,
      Title_3(10) TYPE C. 
   
Title_1 = 'ABAP'. 
Title_2 = 'Programming'. 
Title_3 = 'Tutorial'.
  
IF Title_1 = 'ABAP'.
  
IF Title_2 = 'Programming'.  
   IF Title_3 = 'Tutorial'.  
      Write 'Yes, It’s Correct'.
ELSE.  
Write 'Sorry, It’s Wrong'. 
 
ENDIF.
    
ENDIF.  
ENDIF.
The above code produces the following output −
Yes, It’s Correct.
JavaScript to generate random hex codes of color

24 May, 2018
What is hex code?
A hex code is a six-digit, three-byte hexadecimal number used to represent colors in HTML, CSS, SVG. The bytes represent the red, green and blue components of the color. One byte represents a number in the range 00 to FF (in hexadecimal notation), or 0 to 255 in decimal notation. This represents the least (0) to the most (255) intensity of each of the color components.
Functions to be used for generating hex codes:Math.random() generates any no. between 0 and 1 including decimal.Math.random() * 16 generates no. between 0 to 16 including decimal.Math.floor() removes the decimal part.
<script>    // storing all letter and digit combinations    // for html color code    var letters = "0123456789ABCDEF";      // html color code starts with #    var color = '#';      // generating 6 times as HTML color code consist    // of 6 letter or digits    for (var i = 0; i < 6; i++)       color += letters[(Math.floor(Math.random() * 16))];   document.write(color);</script>
Output:
#E3B0DF 

Note: Output will be different for everytime the code will get executed.Reference: https://en.wikipedia.org/wiki/Web_colors#Hex_triplet
javascript-math
JavaScript
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Difference between var, let and const keywords in JavaScript
Differences between Functional Components and Class Components in React
Remove elements from a JavaScript Array
Hide or show elements in HTML using display property
Difference Between PUT and PATCH Request
How to append HTML code to a div using JavaScript ?
How to Open URL in New Tab using JavaScript ?
How to calculate the number of days between two dates in javascript?
File uploading in React.js
Roadmap to Learn JavaScript For Beginners
Python | Add leading K character

11 Mar, 2022
Sometimes, during the string manipulation, we are into a problem where we need to pad or add leading K to the string as per the requirements. This problem can occur in web development. Having shorthands to solve this problem turns to be handy in many situations. Let’s discuss certain ways in which this problem can be solved.Method #1 : Using rjust() rjust function offers a single line way to perform this particular task. Hence can easily be employed to any string whose padding we need to be done. We can specify the amount of padding required. 
Python3
# Python3 code to demonstrate# Add leading K character# using rjust() # initializing stringtest_string = 'GFG' # printing original stringprint("The original string : " + str(test_string)) # No. of zeros requiredN = 4 # initializing KK = 'M' # using rjust()# Add leading K characterres = test_string.rjust(N + len(test_string), K) # print resultprint("The string after adding leading K : " + str(res))
The original string : GFG
The string after adding leading K : MMMMGFG
 
 Method #2 : Using format() String formatting using the format function can be used to perform this task easily, we just mention the number of elements total, element needed to pad, and direction of padding, in this case left. 
Python3
# Python3 code to demonstrate# Add leading K character# using format() # initializing stringtest_string = 'GFG' # printing original stringprint("The original string : " + str(test_string)) # No. of zeros requiredN = 4 # initializing KK = '0' # using format()# Add leading K character# N for number of elements and '>' for leadingtemp = '{:>' + K + '7}'res = temp.format(test_string) # print resultprint("The string after adding leading K : " + str(res))
The original string : GFG
The string after adding leading K : 0000GFG
 
sumitgumber28
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 ?
Python Classes and Objects
Python OOPs Concepts
Introduction To PYTHON
Python | os.path.join() method
Defaultdict in Python
Python | Get dictionary keys as a list
Python | Convert a list to dictionary
Python Program for Fibonacci numbers
Python | Convert string dictionary to dictionary
HTML <select> disabled Attribute

04 Jan, 2019
The disabled attribute for <select> element in HTML is used to specify that the select element is disabled. A disabled drop-down list is un-clickable and unusable. It is a boolean attribute.
Syntax:
<select disabled>option values...</select>

Example:
<!DOCTYPE html> <html>     <head>         <title>HTML select disabled Attribute</title>     </head>       <body style = "text-align:center">            <h1 style = "color: green;">GeeksforGeeks</h1>        <h2>HTML select disabled Attribute</h2>          <p>This select field is disabled.</p>          <!--A disabled select-->        <select disabled>            <option value="binary">Binary Search</option>            <option value="linear">Linear Search</option>            <option value="interpolation">Interpolation Search</option>        </select>    </body> </html>    
Output:
Supported Browsers: The browser supported by <select> disabled attribute are listed below:
Apple Safari
Google Chrome
Firefox
Opera
Internet Explorer
HTML-Attributes
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to update Node.js and NPM to next version ?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to insert spaces/tabs in text using HTML/CSS?
REST API (Introduction)
Hide or show elements in HTML using display property
Top 10 Projects For Beginners To Practice HTML and CSS Skills
Installation of Node.js on Linux
Difference between var, let and const keywords in JavaScript
How to insert spaces/tabs in text using HTML/CSS?
How to fetch data from an API in ReactJS ?
How to set full-screen iframe with height 100% in JavaScript ?

31 Oct, 2019
Given an HTML document containing an <iframe> element and the task is to change the height of the <iframe> element to 100% with the help of JavaScript. There are two methods to change the height of the iframe which are discussed below:
Method 1: This method uses id attribute of iframe with height property to change the height of <iframe> element. JavaScript code is written within the <script> tag.
<html>   <head>    <title>        How to change the height of an        iframe to 100% with JavaScript?    </title></head>   <body style="text-align:center;">       <h1 style="color:green;">        GeeksforGeeks    </h1>       <h3>        How to change the height of a        <iframe id="iframe" width="100%" height="40%"        src="https://www.youtube.com/embed/hjGD08xfg9c"        frameborder="0" allowfullscreen>        </iframe> to 100% with JavaScript?    </h3>       <br><br>       <button onclick="changeHeight()">        Click to change    </button>      <script>              // JavaScript code to change the        // height to 100% of <iframe>        function changeHeight() {            var x = document.getElementById('iframe');            x.style.height = "100%";        }    </script></body>   </html>
Output:
Before clicking the button:
After clicking the button:
Method 2: This method uses the id attribute of the iframe with window.innerHeight property to change the height of <iframe> element. JavaScript code is written within the <script> tag.
<html>   <head>    <title>        How to change the height of an         iframe to 100% with JavaScript?    </title></head>   <body style="text-align:center;">       <h1 style="color:green;">        GeeksforGeeks    </h1>       <h3>        How to change the height of a        <iframe id="iframe" width="100%" src=        "https://www.youtube.com/embed/hjGD08xfg9c"        frameborder="0" ></iframe>         to 100% with JavaScript?    </h3>       <br><br>       <button onclick="changeHeight()">        Click to change    </button>       <script>              // JavaScript code to change the        // height to 100% of <iframe>        function changeHeight() {            var x = document.getElementById('iframe');            x.style.height = window.innerHeight;        }    </script></body>   </html>
Output:
Before clicking the button:
After clicking the button:
JavaScript-Misc
Picked
JavaScript
Web Technologies
Web technologies Questions
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Difference between var, let and const keywords in JavaScript
Differences between Functional Components and Class Components in React
Remove elements from a JavaScript Array
How to append HTML code to a div using JavaScript ?
Difference Between PUT and PATCH Request
Installation of Node.js on Linux
Difference between var, let and const keywords in JavaScript
How to insert spaces/tabs in text using HTML/CSS?
How to fetch data from an API in ReactJS ?
Differences between Functional Components and Class Components in React
Python String islower() method

12 Aug, 2021
Python String islower() method checks if all characters in the string are lowercase. This method returns True if all alphabets in a string are lowercase alphabets. If the string contains at least one uppercase alphabet, it returns False.
Syntax: 
string.islower()
Parameters: 
None
Returns: 
True: If all the letters in the string are in lower case and
False: If even one of them is in upper case.
Python3
# Python3 code to demonstrate# working of islower() # initializing stringislow_str = "geeksforgeeks"not_islow = "Geeksforgeeks" # checking which string is# completely lowerprint ("Is geeksforgeeks full lower ? : " + str(islow_str.islower()))print ("Is Geeksforgeeks full lower ? : " + str(not_islow.islower()))
Output: 
Is geeksforgeeks full lower ? : True
Is Geeksforgeeks full lower ? : False
This function can be used in many ways and has many practical applications. One such application is checking for lower cases, checking proper nouns, checking for correctness of sentences that requires all lower cases. Demonstrated below is a small example showing the application of islower() method.
Python3
# Python3 code to demonstrate# application of islower() method # checking for proper nouns.# nouns which start with capital letter test_str = "Geeksforgeeks is most rated Computer \            Science portal and is highly recommended" # splitting stringlist_str = test_str.split() count = 0 # counting lower casesfor i in list_str:    if (i.islower()):        count = count + 1 # printing proper nouns countprint ("Number of proper nouns in this sentence is : "                            + str(len(list_str)-count))
Output: 
Number of proper nouns in this sentence is : 3
shubham_singh
AmiyaRanjanRout
python-string
Python-string-functions
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Changing Column Width Based on Screen Size using CSS

To change column width based on screen size, the code is as follows −
 Live Demo
<!DOCTYPE html>
<html>
<head>
<style>
body {
   font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}
.sample {
   width: 50%;
   background-color: lightblue;
   height: 200px;
   font-size: 18px;
}
@media only screen and (max-width: 700px) {
   body {
      margin: 0;
      padding: 0;
   }
   .sample {
      width: 100%;
   }
}
</style>
</head>
<body>
<h1>Changing column width based on screen size</h1>
<div class="sample">Lorem ipsum dolor, sit amet consectetur adipisicing elit. Quod, maiores!</div>
<h3>Resize the browser window to 700px and below to see the above div width change to 100%</h3>
</body>
</html>
The above code will produce the following output −
On resizing the browser window to 700 px −
Tailwind CSS Grid Template Columns

23 Mar, 2022
This class accepts more than one value in tailwind CSS all the properties are covered as in class form. It is the alternative of CSS grid-template-columns property in CSS. It is used to set the number of columns and size of the columns of the grid, here we will do the same but for fast development of front-end. The number of columns is set by the number of values given to this class. 
Grid Template Columns:
grid-cols-1: Each row concedes only one column.
grid-cols-2:  Each row concedes only two columns.
grid-cols-3:  Each row concedes only three columns.
grid-cols-4:  Each row concedes only four columns.
grid-cols-5:  Each row concedes only five columns.
grid-cols-6:  Each row concedes six columns.
grid-cols-7: Each row concedes seven-columns.
grid-cols-8: Each row concedes eight columns.
grid-cols-9: Each row concedes nine columns.
grid-cols-10: Each row concedes ten columns.
grid-cols-11: Each row concedes eleven columns.
grid-cols-12: Each row concedes twelve columns.
grid-cols-none: Does not follow the grid-column property.
Syntax:
<element class="grid grid-cols-number"> Contents... </element>
Example:
HTML
<!DOCTYPE html> <html>  <head>     <title>Tailwind grid-cols Class</title>       <link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css"           rel="stylesheet"> </head>   <body class="text-center">     <h1 class="text-green-600 text-5xl font-bold">        GeeksforGeeks    </h1>       <b>Tailwind CSS grid-cols Class</b>       <div id="main" class="grid grid-cols-3 gap-1 justify-evenly">         <div class="bg-green-700 w-26 h-12">1</div>         <div class="bg-green-500 w-26 h-12">2</div>         <div class="bg-green-300 w-26 h-12">3</div>         <div class="bg-green-700 w-26 h-12">4</div>         <div class="bg-green-500 w-26 h-12">5</div>         <div class="bg-green-300 w-26 h-12">6</div>     </div> </body>   </html>
Output:
Tailwind CSS
Tailwind-Grid
CSS
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to update Node.js and NPM to next version ?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to insert spaces/tabs in text using HTML/CSS?
How to create footer to stay at the bottom of a Web page?
CSS to put icon inside an input element in a form
Installation of Node.js on Linux
Top 10 Projects For Beginners To Practice HTML and CSS Skills
Difference between var, let and const keywords in JavaScript
How to insert spaces/tabs in text using HTML/CSS?
How to fetch data from an API in ReactJS ?
C# | Dictionary.Count Property - GeeksforGeeks

01 Feb, 2019
This property is used to get the number of key/value pairs contained in the Dictionary.
Syntax:
public int Count { get; }

Return Value : The number of key/value pairs contained in the Dictionary.
Below are the programs to illustrate the use of above-discussed property:
Example 1:
// C# code to count the number of // key/value pairs in  Dictionaryusing System;using System.Collections.Generic;  class GFG {      // Driver code    public static void Main()    {          // Create a new dictionary of        // strings, with string keys.        Dictionary<string, string> myDict =            new Dictionary<string, string>();          // Adding key/value pairs in myDict        myDict.Add("Australia", "Canberra");        myDict.Add("Belgium", "Brussels");        myDict.Add("Netherlands", "Amsterdam");        myDict.Add("China", "Beijing");        myDict.Add("Russia", "Moscow");        myDict.Add("India", "New Delhi");          // To get count of key/value        // pairs in myDict        Console.WriteLine("Total key/value pairs"+              " in myDict are : " + myDict.Count);    }}
Total key/value pairs in myDict are : 6

Example 2:
// C# code to count the number of // key/value pairs in  Dictionaryusing System;using System.Collections.Generic;  class GFG {      // Driver code    public static void Main()    {          // Create a new dictionary of         // strings, with string keys.        Dictionary<int, string> myDict =           new Dictionary<int, string>();          // Adding key/value pairs in myDict        myDict.Add(1, "C");        myDict.Add(2, "C++");        myDict.Add(3, "Java");        myDict.Add(4, "Python");        myDict.Add(5, "C#");        myDict.Add(6, "HTML");          // To get count of key/value pairs in myDict        Console.WriteLine("Total key/value pairs"+              " in myDict are : " + myDict.Count);    }}
Total key/value pairs in myDict are : 6

Note: Retrieving the value of this property is an O(1) operation.
Reference:
https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.dictionary-2.count?view=netframework-4.7.2#System_Collections_Generic_Dictionary_2_Count
CSharp Dictionary Class
CSharp-Generic-Namespace
C#
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Extension Method in C#
HashSet in C# with Examples
C# | Inheritance
Partial Classes in C#
C# | Generics - Introduction
Top 50 C# Interview Questions & Answers
Switch Statement in C#
Convert String to Character Array in C#
C# | How to insert an element in an Array?
Linked List Implementation in C#
Node.js path.extname() Method - GeeksforGeeks

13 Oct, 2021
The path.extname() method is used to get the extension portion of a file path. The extension string returned from the last occurrence of a period (.) in the path to the end of the path string. If there are no periods in the file path, then an empty string is returned.
Syntax:
path.extname( path )
Parameters: This method accepts single parameter path which holds the file path that would be used to extract the extension.
Return Value: It returns a string with the extension portion of the path. It throws a TypeError if this parameter is not a string value.
Below examples illustrate the path.extname() method in node.js:
Example 1:
// Node.js program to demonstrate the   // path.extname() method  // Import the path moduleconst path = require('path');   path1 = path.extname("hello.txt");console.log(path1)   path2 = path.extname("readme.md");console.log(path2)   // File with no extension// Returns empty stringpath3 = path.extname("fileDump")console.log(path3)   // File with blank extension// Return only the periodpath4 = path.extname("example.")console.log(path4)   path5 = path.extname("readme.md.txt")console.log(path5)   // Extension name of the current scriptpath6 = path.extname(__filename)console.log(path6)
Output:
.txt
.md

.
.txt
.js
Example 2:
// Node.js program to demonstrate the   // path.extname() method  // Import the path moduleconst path = require('path');   // Comparing extensions from a// list of file pathspaths_array = [    "/home/user/website/index.html",    "/home/user/website/style.css",    "/home/user/website/bootstrap.css",    "/home/user/website/main.js",    "/home/user/website/contact_us.html",    "/home/user/website/services.html",]   paths_array.forEach(filePath => {    if (path.extname(filePath) == ".html")        console.log(filePath);});
Output:
/home/user/website/index.html
/home/user/website/contact_us.html
/home/user/website/services.html
Reference: https://nodejs.org/api/path.html#path_path_extname_path
Node.js-Methods
Node.js-path-module
Node.js
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to update Node.js and NPM to next version ?
Node.js fs.readFileSync() Method
Node.js fs.writeFile() Method
How to update NPM ?
Difference between promise and async await in Node.js
Remove elements from a JavaScript Array
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?
Difference between var, let and const keywords in JavaScript
C | Loops & Control Structure | Question 1 - GeeksforGeeks

09 Jan, 2013
#include <stdio.h>  int main(){    int i = 1024;    for (; i; i >>= 1)        printf("GeeksQuiz");    return 0;}
How many times will GeeksQuiz be printed in the above program?(A) 10(B) 11(C) Infinite(D) The program will show compile-time errorAnswer: (B)Explanation: In for loop, mentioning expression is optional. >>= is a composite operator. It shifts the binary representation of the value by 1 to the right and assigns the resulting value to the same variable. The for loop is executed until value of variable i doesn’t drop to 0.
C-Loops & Control Structure
Loops & Control Structure
C Language
C Quiz
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Substring in C++
Function Pointer in C
rand() and srand() in C/C++
std::string class in C++
fork() in C
Compiling a C program:- Behind the Scenes
Operator Precedence and Associativity in C
C | File Handling | Question 1
C | Misc | Question 7
C | Arrays | Question 7
DAX Time Intelligence - DATEADD function

Returns a table that contains a column of dates, shifted either forward or backward in time by the specified number of intervals from the dates in the current context.
DATEADD (<dates>, <number_of_intervals>, <interval>) 

dates
A column that contains dates.
number_of_intervals
A column that contains dates.
interval
The interval by which to shift the dates.
The value for interval can be one of the following −
Year
Quarter
Month
Day
A table containing a single column of date values.
The dates parameter can be any of the following −
A reference to a date/time column.
A reference to a date/time column.
A table expression that returns a single column of date/time values.
A table expression that returns a single column of date/time values.
A Boolean expression that defines a single-column table of date/time values.
A Boolean expression that defines a single-column table of date/time values.
Constraints on Boolean expressions −
The expression cannot reference a calculated field.
The expression cannot reference a calculated field.
The expression cannot use CALCULATE function.
The expression cannot use CALCULATE function.
The expression cannot use any function that scans a table or returns a table, including aggregation functions.
The expression cannot use any function that scans a table or returns a table, including aggregation functions.
However, a Boolean expression can use any function that looks up a single value, or that calculates a scalar value.
If the number specified for number_of_intervals parameter is positive, the dates are moved forward in time. If the number is negative, the dates are shifted back in time.
The interval parameter is an enumeration, not a set of strings. Hence, the values for interval should not be enclosed in quotation marks. Also, the values: year, quarter, month, day should be spelled in full when using them.
The result table includes only dates that are specified in the dates parameter.
= DATEADD (ProductInventory[InventoryDate],1, YEAR) 

    53 Lectures 
     5.5 hours 

 Abhay Gadiya

    24 Lectures 
     2 hours 

 Randy Minder

    26 Lectures 
     4.5 hours 

 Randy Minder
 Print
 Add Notes
 Bookmark this page
HTML DOM customElements define() Method - GeeksforGeeks

14 Jul, 2020
The customElements define() method is used to define a new custom element. There are two types of custom elements that can be created:
Autonomous custom element: These elements do not inherit from built-in HTML elements.
Customized built-in element: These elements inherit from built-in HTML elements.
Syntax:
customElements.define( name, constructor, options );
Parameters:
name: It specifies the name for the new custom element. The name of custom elements must contain hyphen.
constructor: It specifies the constructor for the new custom element.
options: It specifies the object that controls how the element is defined. It is an optional parameter.
Return value: This method returns void.
Example: In this example, a custom element is defined, named <gfg-custom-element> with a constructor named CustomEl using this method.
HTML
<!DOCTYPE HTML><html>  <body style="text-align:center;">    <h1 style="color:green;">        GeeksforGeeks    </h1>      <p>        HTML | customElements define() method    </p>      <button onclick="Geeks();">        click here    </button>      <p id="arr"></p>      <script>        var arr =            document.getElementById("arr");          // Function to define the element        function Geeks() {            class CustomEl extends HTMLElement {                constructor() {                    super();                    this.attachShadow({ mode: 'open' });                    this.shadowRoot.innerHTML = `            <h1 style="color:green;">              GeeksforGeeks Custom            Element Data                </h1>            `;                }            }              // Use the define() method to define            // a new element            window.customElements.define(                'gfg-custom-element', CustomEl);        }     </script>    <gfg-custom-element></gfg-custom-element></body>  </html>
Output:
Before Clicking the Button:
Before Clicking the Button:
After Clicking the Button:
After Clicking the Button:
Supported Browsers:
Google Chrome 66.0
Edge 79.0
Firefox 63.0
Safari 10.1
Opera 53.0
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.
HTML-DOM
HTML-Methods
HTML
JavaScript
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
REST API (Introduction)
HTML Cheat Sheet - A Basic Guide to HTML
Design a web page using HTML and CSS
Form validation using jQuery
Angular File Upload
Remove elements from a JavaScript Array
Convert a string to an integer in JavaScript
Difference between var, let and const keywords in JavaScript
Differences between Functional Components and Class Components in React
How to calculate the number of days between two dates in javascript?
Python | Convert string dictionary to dictionary - GeeksforGeeks

22 May, 2019
Interconversions of data types have been discussed many times and have been quite a popular problem to solve. This article discusses yet another problem of interconversion of dictionary, in string format to a dictionary. Let’s discuss certain ways in which this can be done.
Method #1 : Using json.loads()
This task can easily be performed using the inbuilt function of loads of json library of python which converts the string of valid dictionary into json form, dictionary in Python.
# Python3 code to demonstrate# convert dictionary string to dictionary# using json.loads()import json  # initializing string test_string = '{"Nikhil" : 1, "Akshat" : 2, "Akash" : 3}'   # printing original string print("The original string : " + str(test_string))  # using json.loads()# convert dictionary string to dictionaryres = json.loads(test_string)  # print resultprint("The converted dictionary : " + str(res))
The original string : {"Nikhil" : 1, "Akshat" : 2, "Akash" : 3}
The converted dictionary : {'Nikhil': 1, 'Akshat': 2, 'Akash': 3}

 
Method #2 : Using ast.literal_eval()
The above method can also be used to perform a similar conversion. Function safer than the eval function and can be used for interconversion of all data types other than dictionary as well.
# Python3 code to demonstrate# convert dictionary string to dictionary# using ast.literal_eval()import ast  # initializing string test_string = '{"Nikhil" : 1, "Akshat" : 2, "Akash" : 3}'   # printing original string print("The original string : " + str(test_string))  # using ast.literal_eval()# convert dictionary string to dictionaryres = ast.literal_eval(test_string)  # print resultprint("The converted dictionary : " + str(res))
The original string : {"Nikhil" : 1, "Akshat" : 2, "Akash" : 3}
The converted dictionary : {'Nikhil': 1, 'Akshat': 2, 'Akash': 3}

Python dictionary-programs
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Read a file line by line in Python
Enumerate() in Python
How to Install PIP on Windows ?
Iterate over a list in Python
Different ways to create Pandas Dataframe
Python program to convert a list to string
Defaultdict in Python
Python | Get dictionary keys as a list
Python | Split string into list of characters
Python | Convert a list to dictionary
Convert an image into jpg format using Pillow in Python - GeeksforGeeks

20 Aug, 2020
Let us see how to convert an image into jpg format in Python. The size of png is larger when compared to jpg format. We also know that some applications might ask for images of smaller sizes. Hence conversion from png(larger ) to jpg(smaller) is needed.For this task we will be using the Image.convert() method of the Pillow module.
Algorithm :
Import the Image module from PIL and import the os module.Import the image to be converted using the Image.open() method.Display the size of the image before the conversion using the os.path.getsize() method.Convert the image using the Image.convert() method. Pass "RGB" as the parameter.Export the image using the Image.save() method.Display the size of the image after the conversion using the os.path.getsize() method.
Import the Image module from PIL and import the os module.
Import the image to be converted using the Image.open() method.
Display the size of the image before the conversion using the os.path.getsize() method.
Convert the image using the Image.convert() method. Pass "RGB" as the parameter.
Export the image using the Image.save() method.
Display the size of the image after the conversion using the os.path.getsize() method.
We will be converting the following image :
# importing the modulefrom PIL import Imageimport os  # importing the image im = Image.open("geeksforgeeks.png")print("The size of the image before conversion : ", end = "")print(os.path.getsize("geeksforgeeks.png"))  # converting to jpgrgb_im = im.convert("RGB")  # exporting the imagergb_im.save("geeksforgeeks_jpg.jpg")print("The size of the image after conversion : ", end = "")print(os.path.getsize("geeksforgeeks_jpg.jpg"))
Output :
The size of the image before conversion : 26617
The size of the image after conversion : 18118

Python-pil
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Python Dictionary
How to Install PIP on Windows ?
Read a file line by line in Python
Enumerate() in Python
Iterate over a list in Python
Different ways to create Pandas Dataframe
Python program to convert a list to string
Create a Pandas DataFrame from Lists
Python String | replace()
Reading and Writing to text files in Python
How can BeautifulSoup be used to extract ‘href’ links from a website?

BeautifulSoup is a third party Python library that is used to parse data from web pages. It helps in web scraping, which is a process of extracting, using, and manipulating the data from different resources.
Web scraping can also be used to extract data for research purposes, understand/compare market trends, perform SEO monitoring, and so on.
The below line can be run to install BeautifulSoup on Windows −
pip install beautifulsoup4
Following is an example −
from bs4 import BeautifulSoup
import requests
url = "https://en.wikipedia.org/wiki/Algorithm"
req = requests.get(url)
soup = BeautifulSoup(req.text, "html.parser")
print("The href links are :")
for link in soup.find_all('a'):
   print(link.get('href'))
The href links are :
...
https://stats.wikimedia.org/#/en.wikipedia.org
https://foundation.wikimedia.org/wiki/Cookie_statement
https://wikimediafoundation.org/
https://www.mediawiki.org/
The required packages are imported, and aliased.
The required packages are imported, and aliased.
The website is defined.
The website is defined.
The url is opened, and data is read from it.
The url is opened, and data is read from it.
The ‘BeautifulSoup’ function is used to extract text from the webpage.
The ‘BeautifulSoup’ function is used to extract text from the webpage.
The ‘find_all’ function is used to extract text from the webpage data.
The ‘find_all’ function is used to extract text from the webpage data.
The href links are printed on the console.
The href links are printed on the console.
Python | Append String to list - GeeksforGeeks

29 Nov, 2019
Sometimes, while working with data, we can have a problem in which we need to add elements to a container. List can contain any type of data type. Let’s discuss certain ways in which we can perform string append operation in list of integers.
Method #1 : Using + operator + list conversionIn this method, we first convert the string into a list and then perform the task of append using + operator.
# Python3 code to demonstrate working of# Appending String to list# using + operator + list conversion  # initialize list test_list = [1, 3, 4, 5]  # initialize string test_str = 'gfg'  # printing original list print("The original list : " + str(test_list))  # printing original string print("The original string : " + str(test_str))  # Appending String to list# using + operator + list conversiontest_list += [test_str]  # printing resultprint("The list after appending is : " + str(test_list))
The original list : [1, 3, 4, 5]
The original string : gfg
The list after appending is : [1, 3, 4, 5, 'gfg']

 
Method #2 : Using append()This particular function can be used to perform the operation of appending string element to end of list without changing the state of string to list of characters.
# Python3 code to demonstrate working of# Appending String to list# using append()  # initialize list test_list = [1, 3, 4, 5]  # initialize string test_str = 'gfg'  # printing original list print("The original list : " + str(test_list))  # printing original string print("The original string : " + str(test_str))  # Appending String to list# using append()test_list.append(test_str)  # printing resultprint("The list after appending is : " + str(test_list))
The original list : [1, 3, 4, 5]
The original string : gfg
The list after appending is : [1, 3, 4, 5, 'gfg']

Python list-programs
Python
Python Programs
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
How to Install PIP on Windows ?
Different ways to create Pandas Dataframe
Python String | replace()
Python program to convert a list to string
Defaultdict in Python
Python | Get dictionary keys as a list
Python | Split string into list of characters
Python | Convert a list to dictionary
How to find the nth occurrence of substring in a string in Python?

You can find the nth occurrence of a substring in a string by splitting at the substring with max n+1 splits. If the resulting list has a size greater than n+1, it means that the substring occurs more than n times. Its index can be found by a simple formula, length of the original string - length of last splitted part - length of the substring.
def findnth(string, substring, n):
    parts = string.split(substring, n + 1)
    if len(parts) <= n + 1:
        return -1
    return len(string) - len(parts[-1]) - len(substring)
findnth('foobarfobar akfjfoobar afskjdf foobar', 'foobar', 2)
This would give the output:
31
The n in this starts from 0. It is quite trivial to change that.
HashSet in C#

HashSet in C# eliminates duplicate strings or elements in an array.In C#, it is an optimized set collection.
Let us see an example to remove duplicate strings using C# HashSet. Here, we have duplicate elements −
 Live Demo
using System;
using System.Collections.Generic;
using System.Linq;

class Program {
   static void Main() {

      string[] arr1 = {
         "bus",
         "truck",
         "bus",
         "car",
         "truck"
      };

      Console.WriteLine(string.Join(",", arr1));

      // HashSet
      var h = new HashSet(arr1);
      // eliminates duplicate words
      string[] arr2 = h.ToArray();
      Console.WriteLine(string.Join(",", arr2));
   }
}
bus,truck,bus,car,truck
bus,truck,car
To declare HashSet −
var h = new HashSet(arr1);
Now set it on the array to remove the duplicate words −
string[] arr2 = h.ToArray();
Python - Google Maps

Python provides modules which can be used to translate addresses available in google map directly to geographic coordinates. It is helpful in finding business addresses and locating the closeness of different addresses. 
We use a module named pygeocoder which provides the functionalities to receive addresses and geocodes. This module is installed through pip using the following command. 
pip install pygeocoder 
 We submit a business name as input and the program gives the complete address as the output. The module uses data from google maps in the background to retrieve the result. 
from pygeocoder import Geocoder

business_name = "Workafella Business Centre - Hitec city"
print "Searching %s" %business_name
results = Geocoder.geocode(business_name)
for result in results:
    print result
When we run the above program, we get the following output −
Searching Workafella Business Centre - Hitec city
Western pearl building 1st floor, Hitech City Rd, 
Opposite HDFC Bank, Kondapur, Hyderabad, Telangana 500084, India


    187 Lectures 
     17.5 hours 

 Malhar Lathkar

    55 Lectures 
     8 hours 

 Arnab Chakraborty

    136 Lectures 
     11 hours 

 In28Minutes Official

    75 Lectures 
     13 hours 

 Eduonix Learning Solutions

    70 Lectures 
     8.5 hours 

 Lets Kode It

    63 Lectures 
     6 hours 

 Abhilash Nelson
 Print
 Add Notes
 Bookmark this page
Batch Script - DIR

This batch command lists the contents of a directory.
dir

The following example shows the different variants of the dir command.
@echo off
Rem All the directory listings from C:\ will be routed to the file lists.txt
dir C:\>C:\lists.txt
Rem Lists all directories and subdirectories recursively
dir /s
Rem Lists the contents of the directory and all subdirectories recursively, one 
file per line, displaying complete path for each listed file or directory.
dir /s /b
Rem Lists all files with .txt extension.
dir *.txt
Rem Includes hidden files and system files in the listing.
dir /a
Rem Lists hidden files only.
dir /ah
All actions are performed as per the remarks in the batch file.
 Print
 Add Notes
 Bookmark this page
Extract Content from Java Class File

How to extract content from a java .class file using java.
Following is the program to extract content from a java .class file using java.
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

import org.apache.tika.exception.TikaException;
import org.apache.tika.metadata.Metadata;
import org.apache.tika.parser.ParseContext;
import org.apache.tika.parser.asm.ClassParser;
import org.apache.tika.sax.BodyContentHandler;
import org.xml.sax.SAXException;

public class ExtractContentFromJavaClass {
   public static void main(String[] args) throws IOException,SAXException, TikaException {
      
      //detecting the file type
      BodyContentHandler handler = new BodyContentHandler();
      
      Metadata metadata = new Metadata();
      FileInputStream inputstream = new FileInputStream(new File(
         "C:/tika/classFileExample.class"));
      ParseContext pcontext = new ParseContext();
      
      //Html parser
      ClassParser ClassParser = new ClassParser();
      
      ClassParser.parse(inputstream, handler, metadata,pcontext);
      System.out.println("Contents of the document:" + handler.toString());
      System.out.println("Metadata of the document:");
      String[] metadataNames = metadata.names();

      for(String name : metadataNames) {
         System.out.println(name + " :  " + metadata.get(name));   
      }
   }
}
Contents of the document:public synchronized class ClassFileExample { 
   public void ClassFileExample(); 
   public static void main(String[]); 
}   

Metadata of the document: 
dc:title :  ClassFileExample 
resourceName :  ClassFileExample.class 
title :  ClassFileExample

 Print
 Add Notes
 Bookmark this page
Classic for Loop Implementation

Following is the classic ‘for’ statement which is available in most programming languages.
for(variable declaration;expression;Increment) {
   statement #1
   statement #2
   ...
}

The Batch Script language does not have a direct ‘for’ statement which is similar to the above syntax, but one can still do an implementation of the classic ‘for’ loop statement using if statements and labels.
Following is the general flow of the classic ‘for’ loop statement.
Let’s look at the general syntax implementation of the classic for loop in batch scripting.
Set counter
:label

If (expression) exit loop
Do_something
Increment counter
Go back to :label

The entire code for the ‘for’ implementation is placed inside of a label.
The entire code for the ‘for’ implementation is placed inside of a label.
The counters variables must be set or initialized before the ‘for’ loop implementation starts.
The counters variables must be set or initialized before the ‘for’ loop implementation starts.
The expression for the ‘for’ loop is done using the ‘if’ statement. If the expression evaluates to be true then an exit is executed to come out of the loop.
The expression for the ‘for’ loop is done using the ‘if’ statement. If the expression evaluates to be true then an exit is executed to come out of the loop.
A counter needs to be properly incremented inside of the ‘if’ statement so that the ‘for’ implementation can continue if the expression evaluation is false.
A counter needs to be properly incremented inside of the ‘if’ statement so that the ‘for’ implementation can continue if the expression evaluation is false.
Finally, we will go back to our label so that we can evaluate our ‘if’ statement again.
Finally, we will go back to our label so that we can evaluate our ‘if’ statement again.
Following is an example of how to carry out the implementation of the classic ‘for’ loop statement.
@echo off 
SET /A i = 1 
:loop 

IF %i%==5 GOTO END 
echo The value of i is %i% 
SET /a i=%i%+1 
GOTO :LOOP 
:END
The above command produces the following output.
The value of i is 1 
The value of i is 2 
The value of i is 3 
The value of i is 4

 Print
 Add Notes
 Bookmark this page
Querying age from DOB in MySQL?

Let us first create a table −
mysql> create table DemoTable611 (DOB date);
Query OK, 0 rows affected (0.99 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable611 values('1996-04-21');
Query OK, 1 row affected (0.13 sec)
mysql> insert into DemoTable611 values('2001-01-31');
Query OK, 1 row affected (0.16 sec)
mysql> insert into DemoTable611 values('2004-12-21');
Query OK, 1 row affected (0.22 sec)
mysql> insert into DemoTable611 values('2000-02-03');
Query OK, 1 row affected (0.14 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable611;
This will produce the following output −
+------------+
| DOB        |
+------------+
| 1996-04-21 |
| 2001-01-31 |
| 2004-12-21 |
| 2000-02-03 |
+------------+
4 rows in set (0.00 sec)
Querying age from DOB −
mysql> select *from DemoTable611 where DOB >= (CURDATE() - INTERVAL 16 YEAR);
This will produce the following output −
+------------+
| DOB        |
+------------+
| 2004-12-21 |
+------------+
1 row in set (0.00 sec)