code-rag-bench/online-tutorials huggingface dataset:
HTTP headers | Trailer - GeeksforGeeks

07 Nov, 2019
The HTTP Trailer header is a response header that indicates the given set of header fields is present in the trailer of a message encoded with chunked transfer-coding and allows the sender to include additional fields at the end of chunked messages in order to supply metadata.
Syntax:
Trailer: header-names
Directives:
header-names: It is a set of header fields that are present in the trailer of a message encoded with chunked transfer-coding.
Examples:
In this example, the header that is being used is Max-Forwards which is a request modifier.Trailer: Max-Forwards
Trailer: Max-Forwards
In this example the header that is being used is the Host header which is a routing header.Trailer: Host
Trailer: Host
In this example Trailer header with a large amount of data from a database query, which is a chunked response. The Expires header is used in this example.HTTP/1.0 200 OK 
Content-Type: text/plain 
Transfer-Encoding: chunked
Trailer: Expires

0\r\n
Mozilla\r\n 
7\r\n
Developer\r\n
9\r\n
Network\r\n
0\r\n 
\r\n
HTTP/1.0 200 OK 
Content-Type: text/plain 
Transfer-Encoding: chunked
Trailer: Expires

0\r\n
Mozilla\r\n 
7\r\n
Developer\r\n
9\r\n
Network\r\n
0\r\n 
\r\n
Supported Browsers: The browsers compatible with HTTP Trailer header are listed below:
Google Chrome
Internet Explorer
Firefox
Opera
Safari
HTTP-headers
Picked
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Remove elements from a JavaScript Array
Convert a string to an integer in JavaScript
How to fetch data from an API in ReactJS ?
Difference between var, let and const keywords in JavaScript
Differences between Functional Components and Class Components in React
How to create footer to stay at the bottom of a Web page?
Node.js fs.readFileSync() Method
Difference Between PUT and PATCH Request
How to execute PHP code using command line ?
REST API (Introduction)
Return From Void Functions in C++

23 Dec, 2021
Void functions are known as Non-Value Returning functions. They are “void” due to the fact that they are not supposed to return values. True, but not completely. We cannot return values but there is something we can surely return from void functions. Void functions do not have a return type, but they can do return values. Some of the cases are listed below: 1) A Void Function Can Return: We can simply write a return statement in a void fun(). In fact, it is considered a good practice (for readability of code) to write a return; statement to indicate the end of the function. 
CPP
// CPP Program to demonstrate void functions#include <iostream>using namespace std;  void fun(){    cout << "Hello";      // We can write return in void    return;}  // Driver Codeint main(){    fun();    return 0;}
Hello
2) A void fun() can return another void function: A void function can also call another void function while it is terminating. For example, 
CPP
// C++ code to demonstrate void()// returning void()#include <iostream>using namespace std;  // A sample void functionvoid work(){    cout << "The void function has returned "            " a void() !!! \n";}  // Driver void() returning void work()void test(){    // Returning void function    return work();}  // Driver Codeint main(){    // Calling void function    test();    return 0;}
The void function has returned  a void() !!! 
The above code explains how void() can actually be useful to return void functions without giving errors. 3) A void() can return a void value: A void() cannot return a value that can be used. But it can return a value that is void without giving an error. For example,
CPP
// C++ code to demonstrate void()// returning a void value#include <iostream>using namespace std;  // Driver void() returning a void valuevoid test(){    cout << "Hello";      // Returning a void value    return (void)"Doesn't Print";}  // Driver Codeint main(){    test();    return 0;}
Hello
This article is contributed by Manjeet Singh. If you like GeeksforGeeks and would like to contribute, you can also write an article using write.geeksforgeeks.org or mail your article to review-team@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
anshikajain26
CPP-Functions
C Language
C++
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Program to Check Armstrong Number

In this article, we will learn about the solution and approach to solve the given problem statement.
Given an integer n , we need to check that the given integer is an armstrong number.
A positive integer is called an Armstrong number of order n if
abcd... = a^n + b^n + c^n + d^n + ...
Here we will be discussing the brute-force approach for an armstrong number of 3 digits and hence of order three.
To check the armstrong number of order n we need to replace 3 by the corresponding order value in line number 7.
Now let’s see the implementation −
 Live Demo
num = 221
sum_ = 0
#
temp = num
while temp > 0:
   digit = temp % 10
   sum_ += digit ** 3
   temp //= 10
#
if num == sum_:
   print(num,"is an Armstrong number")
else:
   print(num,"is not an Armstrong number")
221 is not an Armstrong number
All variables and functions are declared in the global scope as shown in the figure below.
In this article, we learned about the approach to check whether a given number is an armstrong number or not.
Flying Bird using Computer graphics in C/C++

12 Oct, 2021
In computer graphic, C++ provide graphic.h through which objects can be created and by using this objects flying bird can be created in C++ program.
Functions used in this program are as follows:
line(): The line function is used to draw a line. Syntax:
line(x1, y1, x2, y2); where, (x1, y1) (x2, y2) are end points of the line.  
arc(): The arc function is used to draw an arc. Syntax:
arc(x, y, start_angle, end_angle, r); where, (x, y) are centre of the arc, start_angle is the starting angle, end_angle is the ending angle and r is the radius of angle.
circle(): The circle function is used to draw a circle. Syntax:
circle(x, y, r); where, (x, y) is the centre points and r is the radius of the circle.
delay(): The delay function is used to stop the screen for a certain time as the execution of program is very fast. Syntax:
delay(n); where, n is number of seconds you want to stop the screen.
cleardevice(): The cleardevice function is used to clear the screen.
closegraph(): The closegraph function is used to close the graph.
Below is the C++ program implementing flying bird using graphics.h:
C++
// C++ program implementing flying bird using graphics.h #include <conio.h>#include <dos.h>#include <graphics.h>#include <iostream.h> // Wingsvoid handDown(int i){    line(85 + i, 155, 45 + i, 185);    line(85 + i, 155, 115 + i, 195);    arc(90 + i, 130, 228, 292, 70);} void handUp(int i){    line(85 + i, 155, 125 + i, 115);    line(85 + i, 155, 55 + i, 118);    arc(90 + i, 177, 60, 122, 70);} // Driver codevoid main(){    int gd = DETECT, gm;     // Path of the BGI folder    initgraph(&gd, &gm, "C:\\TURBOC3\\BGI");    int i = 0;     for (i = 0; i < 400; i++) {        // Body        circle(150 + i, 150, 20);        arc(90 + i, 190, 50, 145, 60);        arc(87 + i, 117, 220, 320, 60);         // Beak        line(170 + i, 147, 180 + i, 153);        line(180 + i, 153, 170 + i, 156);         // Eye        circle(162 + i, 150, 2);         // Tail        line(10 + i, 155, 40 + i, 155);        line(10 + i, 145, 40 + i, 155);        line(10 + i, 165, 40 + i, 155);         // Move hands        if (i % 2 == 0)            handUp(i);        else            handDown(i);         // Stop the screen for 10 secs        delay(10);         // Clear the screen    }    cleardevice();     getch();     // Close the graph    closegraph();}
Output:
sweetyty
prachisoda1234
computer-graphics
C++ Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Passing a function as a parameter in C++
Program to implement Singly Linked List in C++ using class
Const keyword in C++
How to convert a Vector to Set in C++
cout in C++
Different ways to print elements of vector
Dynamic _Cast in C++
string::npos in C++ with Examples
Multi Source Shortest Path in Unweighted Graph
Why it is important to write "using namespace std" in C++ program?
Python Pillow - Merging Images

Pillow package allows you to paste an image onto another one. The merge() function accepts a mode and a tuple of images as parameters, and combines them into a single image.
Image.merge(mode, bands)

Where,
mode − The mode to use for the output image.
mode − The mode to use for the output image.
bands  − A sequence containing one single-band image for each band in the output image. All bands must have the same size.
bands  − A sequence containing one single-band image for each band in the output image. All bands must have the same size.
Return value − An Image objects.
Return value − An Image objects.
Using the merge() function, you can merge the RGB bands of an image as −
from PIL import Image
image = Image.open("beach1.jpg")
r, g, b = image.split()
image.show()
image = Image.merge("RGB", (b, g, r))
image.show()
On executing the above piece of code, you can see the original image and the image with merge the RGB bands as shown below −
Input image


Output image


In the same way, to merge two different images, you need to −
Create image object for the required images using the open() function.
Create image object for the required images using the open() function.
While merging two images, you need to make sure that both images are of same size. Therefore, get each sizes of both images and if required, resize them accordingly.
While merging two images, you need to make sure that both images are of same size. Therefore, get each sizes of both images and if required, resize them accordingly.
Create an empty image using the Image.new() function.
Create an empty image using the Image.new() function.
Paste the images using the paste() function.
Paste the images using the paste() function.
Save and display the resultant image using the save() and show() functions.
Save and display the resultant image using the save() and show() functions.
Following example demonstrates the merging of two images using python pillow −
from PIL import Image
#Read the two images
image1 = Image.open('images/elephant.jpg')
image1.show()
image2 = Image.open('images/ladakh.jpg')
image2.show()
#resize, first image
image1 = image1.resize((426, 240))
image1_size = image1.size
image2_size = image2.size
new_image = Image.new('RGB',(2*image1_size[0], image1_size[1]), (250,250,250))
new_image.paste(image1,(0,0))
new_image.paste(image2,(image1_size[0],0))
new_image.save("images/merged_image.jpg","JPEG")
new_image.show()
If you save the above program as Example.py and execute, it displays the two input images and the merged image using standard PNG display utility, as follows −
Python List insert()

03 Aug, 2021
The Python List insert() method is an inbuilt function in Python that inserts a given element at a given index in a list. 
Syntax:
list_name.insert(index, element)
Parameters: 
index: the index at which the element has to be inserted.
element: the element to be inserted in the list.
Returns: 
This method does not return any value but it inserts the given element at the given index.
Error:
If anything other than a list is used with insert(), then it returns an AttributeError.
Note: 
If given index >= length(list) is given, then it inserts at the end of the list.
Python3
# Python3 program for use  # of insert() method   list1 = [ 1, 2, 3, 4, 5, 6, 7 ]   # insert 10 at 4th index list1.insert(4, 10) print(list1)   list2 = ['a', 'b', 'c', 'd', 'e']   # insert z at the front of the listlist2.insert(0, 'z')print(list2)
Output: 
[1, 2, 3, 4, 10, 5, 6, 7]
['z', 'a', 'b', 'c', 'd', 'e']
Python3
# Python3 program for error  # of insert() method   # attribute error string = "1234567"  string.insert(10, 1)print(string)
Output: 
Traceback (most recent call last):
  File "/home/2fe54bd8723cd0ae89a17325da8b2eb5.py", line 7, in 
    string.insert(10, 1)
AttributeError: 'str' object has no attribute 'insert'
Python3
# Python3 program for Insertion in a list  # before any element using insert() method   list1 = [ 1, 2, 3, 4, 5, 6 ]  # Element to be inserted element = 13   # Element to be inserted before 3beforeElement = 3   # Find indexindex = list1.index(beforeElement)   # Insert element at beforeElement list1.insert(index, element) print(list1)
Output: 
[1, 2, 13, 3, 4, 5, 6]
Python3
list1 = [ 1, 2, 3, 4, 5, 6 ]  # tuple of numbersnum_tuple = (4, 5, 6)  # inserting a tuple to the listlist1.insert(2, num_tuple)  print(list1)
Output: 
[1, 2, (4, 5, 6), 3, 4, 5, 6]
AmiyaRanjanRout
Python-Built-in-functions
python-list
python-list-functions
Python
python-list
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
C# Booleans

Very often, in programming, you will need a data type that can only have one of two values, like:
YES / NO
ON / OFF
TRUE / FALSE
For this, C# has a bool data type, which can take the values true or false.
A boolean type is declared with the bool keyword and can only take the values true or false:
bool isCSharpFun = true;
bool isFishTasty = false;
Console.WriteLine(isCSharpFun);   // Outputs True
Console.WriteLine(isFishTasty);   // Outputs False


Try it Yourself »

However, it is more common to return boolean values from boolean expressions, for conditional testing
(see below).
A Boolean expression is a C# expression that returns a Boolean value: True or False.
You can use a comparison operator, such as the greater than (>) operator to find out if an expression (or a variable) is true:
int x = 10;
int y = 9;
Console.WriteLine(x > y); // returns True, because 10 is higher than 9


Try it Yourself »

Or even easier:
Console.WriteLine(10 > 9); // returns True, because 10 is higher than 9


Try it Yourself »

In the examples below, we use the equal to (==) operator to evaluate an expression:
int x = 10;
Console.WriteLine(x == 10); // returns True, because the value of x is equal to 10


Try it Yourself »

Console.WriteLine(10 == 15); // returns False, because 10 is not equal to 15


Try it Yourself »

The boolean value of an expression is the basis for all C# comparisons and conditions.
You will learn more about conditions in the next chapter.
Fill in the missing parts to print the values True and False:
 isCodingFun = true;
 isFishTasty = false;
Console.WriteLine();
Console.WriteLine();

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

24 Jan, 2021
In this article, we will learn How to allow resizing a PyGame Window. 
Game programming is very rewarding nowadays and it can also be used in advertising and as a teaching tool too. Game development includes mathematics, logic, physics, AI, and much more and it can be amazingly fun. In python, game programming is done in pygame and it is one of the best modules for doing so.
Installation:
This library can be installed using the below command:
pip install pygame 
Steps-by-step Approach:
Import pygame.Set the title and add content.Run pygame.Quit pygame.
Import pygame.
Set the title and add content.
Run pygame.
Quit pygame.
Below is the program based on the above approach:
Python3
# import package pygameimport pygame  # Form screen with 400x400 size# with not resizablescreen = pygame.display.set_mode((400, 400))  # set titlepygame.display.set_caption('Not resizable')  # run windowrunning = Truewhile running:    for event in pygame.event.get():        if event.type == pygame.QUIT:            running = False  # quit pygame after closing windowpygame.quit()
Output :
Step-by-step Approach:
Import pygame.Form a screen by using pygame.display.set_mode() method and allow resizing using pygame.RESIZABLE .Set the title and add content.Run pygame.Quit pygame.
Import pygame.
Form a screen by using pygame.display.set_mode() method and allow resizing using pygame.RESIZABLE .
Set the title and add content.
Run pygame.
Quit pygame.
Below is the program based on the above approach:
Python3
# import package pygameimport pygame  # Form screen with 400x400 size# and with resizablescreen = pygame.display.set_mode((400, 400),                                  pygame.RESIZABLE)  # set titlepygame.display.set_caption('Resizable')  # run windowrunning = Truewhile running:    for event in pygame.event.get():        if event.type == pygame.QUIT:            running = False  # quit pygame after closing windowpygame.quit()
Output :
Picked
Python-PyGame
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
How to drop one or multiple columns in Pandas Dataframe
Python Classes and Objects
Python | os.path.join() method
Python | Get unique values from a list
Create a directory in Python
Defaultdict in Python
Python | Pandas dataframe.groupby()
MapStruct - Mapping Stream

Using Mapstruct we can create mapping of streams in the same way as we did for collections.
@Mapper
public interface UtilityMapper {
   Stream<String> getStream(Stream<Integer> source);
}

Following example demonstrates the same.
Open project mapping as updated in Mapping Map chapter in Eclipse.
Update UtilityMapper.java with following code −
UtilityMapper.java
package com.tutorialspoint.mapper;

import java.util.GregorianCalendar;
import java.util.Map;
import java.util.stream.Stream;
import org.mapstruct.MapMapping;
import org.mapstruct.Mapper;

@Mapper
public interface UtilityMapper {
   @MapMapping(valueDateFormat = "dd.MM.yyyy")
   Map<String, String> getMap(Map<Long, GregorianCalendar> source);
   Stream<String> getStream(Stream<Integer> source);
}
Update UtilityMapperTest.java with following code −
UtilityMapperTest.java
package com.tutorialspoint.mapping;

import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.Arrays;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Stream;
import org.junit.jupiter.api.Test;
import org.mapstruct.factory.Mappers;
import com.tutorialspoint.mapper.UtilityMapper;

public class UtilityMapperTest {
   private UtilityMapper utilityMapper=Mappers.getMapper(UtilityMapper.class);
   
   @Test
   public void testMapMapping() {
      Map<Long, GregorianCalendar> source = new HashMap<>();
      source.put(1L, new GregorianCalendar(2015, 3, 5));

      Map<String, String> target = utilityMapper.getMap(source);
      assertEquals("05.04.2015", target.get("1"));		
   }
   @Test
   public void testGetStream() {
      Stream<Integer> numbers = Arrays.asList(1, 2, 3, 4).stream();

      Stream<String> strings = utilityMapper.getStream(numbers);
      assertEquals(4, strings.count());			
   }
}
Run the following command to test the mappings.
mvn clean test

Once command is successful. Verify the output.
mvn clean test
[INFO] Scanning for projects...
...
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ mapping ---
[INFO] Surefire report directory: \mvn\mapping\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.tutorialspoint.mapping.CarMapperTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.327 sec
Running com.tutorialspoint.mapping.DeliveryAddressMapperTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 sec
Running com.tutorialspoint.mapping.StudentMapperTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 sec
Running com.tutorialspoint.mapping.UtilityMapperTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 sec

Results :

Tests run: 5, Failures: 0, Errors: 0, Skipped: 0
...

 Print
 Add Notes
 Bookmark this page
HTML | <table> cellspacing Attribute

29 Jul, 2021
The HTML <table> cellspacing Attribute is used to specify the space between the cells. The cellspacing attribute is set in terms of pixels.
Syntax:
<table cellspacing="pixels">
Attribute Values:
pixels: It sets the space between the cells in terms of pixels.
Note: The <table> cellspacing Attribute is not supported by HTML 5.
Example:
<!DOCTYPE html><html>  <head>    <title>        HTML table cellspacing Attribute    </title></head>  <body>    <h1>GeeksforGeeks</h1>      <h2>HTML table cellspacing Attribute</h2>      <table border="1"            cellspacing="15">        <caption>Author Details</caption>          <tr>            <th>NAME</th>            <th>AGE</th>            <th>BRANCH</th>        </tr>        <tr>            <td>BITTU</td>            <td>22</td>            <td>CSE</td>        </tr>        <tr>            <td>RAM</td>            <td>21</td>            <td>ECE</td>        </tr>    </table></body>  </html>
Output:
Supported Browsers: The browser supported by HTML <table> cellspacing Attribute are listed below:
Google Chrome
Internet Explorer
Firefox
Safari
Opera
HTML is the foundation of webpages, is used for webpage development by structuring websites and web apps.You can learn HTML from the ground up by following this HTML Tutorial and HTML Examples.
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 ?
REST API (Introduction)
CSS to put icon inside an input element in a form
Types of CSS (Cascading Style Sheet)
HTTP headers | Content-Type
Installation of Node.js on Linux
Difference between var, let and const keywords in JavaScript
How to fetch data from an API in ReactJS ?
Roadmap to Learn JavaScript For Beginners
Remove elements from a JavaScript Array
numpy.random.rayleigh() in python

18 Aug, 2020
With the help of numpy.random.rayleigh() method, we can get the random samples from Rayleigh distribution and return the random samples.
Rayleigh distribution function
Syntax : numpy.random.rayleigh(scale=1.0, size=None)
Return : Return the random samples as numpy array.
Example #1 :
In this example we can see that by using numpy.random.rayleigh() method, we are able to get the rayleigh distribution and return the random samples.
Python3
# import numpyimport numpy as npimport matplotlib.pyplot as plt  # Using rayleigh() methodgfg = np.random.rayleigh(3.4, 50000)  plt.figure()plt.hist(gfg, bins = 50, density = True)plt.show()
Output :
Example #2 :
Python3
# import numpyimport numpy as npimport matplotlib.pyplot as plt  # Using rayleigh() methodgfg = np.random.rayleigh(2 * np.sqrt(np.pi), 100000)  plt.figure()plt.hist(gfg, bins = 50, density = True)plt.show()
Output :
Python numpy-Random
Python-numpy
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Lodash _.get() Method

10 Sep, 2020
The _.get() method is used to get the value at path of object. If the resolved value is undefined, the defaultValue is returned in its place.
Syntax:
_.get(object, path, [defaultValue])

Parameters: This method accepts three parameters as mentioned above and described below:
object: This parameter holds the object to query.
path: This parameter holds the path of the property to get. The path will be array or string.
defaultValue: This parameter holds the value returned for undefined resolved values.
Return Value: This method returns the resolved value.
Example 1:
Javascript
// Requiring the lodash library  const _ = require("lodash");    // Given objectvar object = { 'c': [{ 'python': { 'java': 3 } }] };  // Use of _.get method console.log(_.get(object, 'c[0].python.java')); 
Output:
3

Example 2:  
Javascript
// Requiring the lodash library  const _ = require("lodash");    // Given objectvar object = { 'c': [{ 'python': { 'java': 3 } }] };  // Use of _.get method console.log(_.get(object, ['c', '0', 'python', 'java'])); 
Output:
3

Example 3:  
Javascript
// Requiring the lodash library  const _ = require("lodash");    // Given objectvar object = { 'c': [{ 'python': { 'java': 3 } }] };  // Use of _.get method console.log(_.get(object, 'c.python.java', 'default')); 
Output:
'default'

JavaScript-Lodash
JavaScript
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
Differences between Functional Components and Class Components in React
Roadmap to Learn JavaScript For Beginners
Difference Between PUT and PATCH Request
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 ?
isdisjoint() function in Python

05 Oct, 2021
Python set isdisjoint() function check whether the two sets are disjoint or not, if it is disjoint then it returns True otherwise it will return False. Two sets are said to be disjoint when their intersection is null. In simple words, they do not have any common element in between them. 
Examples: 
Let set A = {2, 4, 5, 6}
and set B = {7, 8, 9, 10} 
Set A and set B are said to be disjoint sets as their intersection is null. They do not have any common elements in between them. 
set1.isdisjoint(set2)
The isdisjoint() Python method takes only a single argument. It can also take an iterable (list, tuple, dictionary, and string) to disjoint(). The isdisjoint() method will automatically convert iterables to set and checks whether the sets are disjoint or not.
returns Trueif the two sets are disjoint. returns Falseif the twos sets are not disjoint.
Python3
# Python3 program for isdisjoint() functionset1 = {2, 4, 5, 6}set2 = {7, 8, 9, 10}set3 = {1, 2} # checking of disjoint of two setsprint("set1 and set2 are disjoint?",      set1.isdisjoint(set2)) print("set1 and set3 are disjoint?",      set1.isdisjoint(set3))
Output: 
set1 and set2 are disjoint? True
set1 and set3 are disjoint? False
Python3
# SetA = {2, 4, 5, 6} # Listlis = [1, 2, 3, 4, 5] # Dictionary dict, Set is formed on Keysdict = {1: 'Apple', 2: 'Orage'} # Dictionary dict2dict2 = {'Apple': 1, 'Orage': 2} print("Set A and List lis disjoint?", A.isdisjoint(lis))print("Set A and dict are disjoint?", A.isdisjoint(dict))print("Set A and dict2 are disjoint?", A.isdisjoint(dict2))
Output:
Set A and List lis disjoint? False
Set A and dict are disjoint? False
Set A and dict2 are disjoint? True
kumar_satyam
python-set
Python
python-set
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Read JSON file using Python
Adding new column to existing DataFrame in Pandas
Python map() function
Python Dictionary
How to get column names in Pandas dataframe
Taking input in Python
Different ways to create Pandas Dataframe
Enumerate() in Python
Read a file line by line in Python
How to Install PIP on Windows ?
Add a hover effect inside the Bootstrap 4 card

To add a hover effect, use the card-link class in Bootstrap.
The following are the links using the card-link class −
<a href="#" class="card-link">XAMPP (MySQL + PHP + Apache)</a>
<a href="#" class="card-link">WordPress</a>
All of the above code is used inside the card-body class −
<div class="card-body">
  <h4 class="card-title">WordPress Installation</h4>
  <p class="card-text">To work with WordPress, you need the following</p>
  <a href="#" class="card-link">XAMPP (MySQL + PHP + Apache)</a>
  <a href="#" class="card-link">WordPress</a>
</div>
You can try to run the following code to add a hover effect inside Bootstrap 4 card −
Live Demo
<!DOCTYPE html>
<html lang="en">
  <head>
   <title>Bootstrap Example</title>
   <meta charset="utf-8">
   <meta name="viewport" content="width=device-width, initial-scale=1">
   <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
   <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
   <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
  </head>

<body>

  <div class="container">
  <h2>Requirement - WordPress</h2>
  <div class="card">
    <div class="card-body">
      <h4 class="card-title">WordPress Installation</h4>
      <p class="card-text">To work with WordPress, you need the following</p>
      <a href="#" class="card-link">XAMPP (MySQL + PHP + Apache)</a>
      <a href="#" class="card-link">WordPress</a>
    </div>
  </div>
  </div>

</body>
</html>
How to establish connection with JDBC?

To connect with a database, you need to follow the steps given below:
Step1: Register the driver: To develop a basic JDBC application, first of all, you need to register the driver with the DriverManager.
You can register a driver in two ways, one is using registerDriver() method of the DriverManager class and, using forName() method of the class named Class.
The registerDriver() method accepts an object of the Driver class, it registers the specified Driver with the DriverManager.
Driver myDriver = new com.mysql.jdbc.Driver();
DriverManager.registerDriver(myDriver);
The forName() method loads the specified class into the memory and thus it automatically gets registered.
Class.forName("com.mysql.jdbc.Driver");
Step2: Get Connection: Get the Connection object using the getConnection() method. This method accepts the database URL (an address that points to your database), Username and, password as parameters and, returns a connection object.
Invoke this method by passing, the URL of the desired database, user name and, password as parameters to it.
String url = "jdbc:mysql://localhost/";
String user = "root";
String passwd = "password";
Connection conn = DriverManager.getConnection(url, root, passwd);
Following is an example JDBC program which establishes a connection with a database.
import java.sql.*;
public class JDBCExample {
   //JDBC driver name and database URL
   static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
   static final String DB_URL = "jdbc:mysql://localhost/";
   //Database credentials
   static final String USER = "root";
   static final String PASS = "password";

   public static void main(String[] args) {
      Connection conn = null;
      try{
         //STEP 2: Register JDBC driver
         Class.forName("com.mysql.jdbc.Driver");
         //STEP 3: Open a connection
         System.out.println("Connecting to database...");
         conn = DriverManager.getConnection(DB_URL, USER, PASS);
         System.out.println("Connection established");
         } catch(Exception e) {
      }
      System.out.println("Goodbye!");
   }
}
Connecting to database...
Connection established
Goodbye!
How to Find the Largest Among Three Numbers using Python?

You can create a list of the three numbers and call the max method to find the largest among them.
my_list = [10, 12, 3]
print(max(my_list))
This will give the output −
12
If you want to calculate it yourself, you can create a simple function like
def max_of_three(a, b, c):
   if a > b and a > c:
      return a
   elif b > c:
      return b
   else:
      return c
print(max_of_three(10, 12, 3))
This will give the output −
12
Redis - List Lrange Command

Redis LRANGE command returns the specified elements of the list stored at the key. The offsets start and stop are zero-based indexes, with 0 being the first element of the list (the head of the list), 1 being the next element, and so on. These offsets can also be negative numbers indicating offsets starting at the end of the list. For example, -1 is the last element of the list, -2 the penultimate, and so on.
Array reply, list of elements in the specified range.
Following is the basic syntax of Redis LRANGE command.
redis 127.0.0.1:6379> LRANGE KEY_NAME START END

redis 127.0.0.1:6379> LPUSH list1 "foo" 
(integer) 1 
redis 127.0.0.1:6379> LPUSH list1 "bar" 
(integer) 2 
redis 127.0.0.1:6379> LPUSHX list1 "bar" 
(integer) 0 
redis 127.0.0.1:6379> LRANGE list1 0 -1 
1) "foo" 
2) "bar" 
3) "bar"


    22 Lectures 
     40 mins

 Skillbakerystudios
 Print
 Add Notes
 Bookmark this page
Difference between Relational Algebra and Relational Calculus - GeeksforGeeks

12 Jan, 2022
Both Relational Algebra and Relational Calculus are formal query languages. 
Relational Algebra is a procedural language. In Relational Algebra, The order is specified in which the operations have to be performed. In Relational Algebra, frameworks are created to implement the queries. The basic operation included in relational algebra are: 
1. Select (σ)
2. Project (Π)
3. Union (U)
4. Set Difference (-)
5. Cartesian product (X)
6. Rename (ρ) 
Relational Calculus is the formal query language. It is also known as Declarative language. In Relational Calculus, the order is not specified in which the operation has to be performed. Relational Calculus means what result we have to obtain. Relational Calculus has two variations: 
Tuple Relational Calculus (TRC)Domain Relational Calculus (DRC)
Tuple Relational Calculus (TRC)
Domain Relational Calculus (DRC)
Relational Calculus is denoted as:  
{ t | P(t) }

Where,
t: the set of tuples
p: is the condition which is true for the given set of tuples.
itskawal2000
DBMS-Relational Algebra
DBMS-Relational Model
DBMS
Difference Between
GATE CS
DBMS
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Types of Functional dependencies in DBMS
Introduction of Relational Algebra in DBMS
What is Temporary Table in SQL?
Two Phase Locking Protocol
KDD Process in Data Mining
Difference between BFS and DFS
Class method vs Static method in Python
Differences between TCP and UDP
Difference between var, let and const keywords in JavaScript
Difference Between == and .equals() Method in Java
How to set width and height of an element using jQuery?

To set the width and height of an element using jQuery, use the width() and height() in jQuery.
Width of an element
You can try to run the following code to learn how to set the width of an element in jQuery:
Live Demo
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $("#button1").click(function(){
        $("div").width(300);
    });
    $("#button2").click(function(){
        $("div").width(400);
    });
});
</script>
</head>
<body>
<div style="height:150px;width:200px;border:2px solid gray;background-color:lightblue;"></div><br>
<button id="button1">Width of div: 300</button>
<button id="button2">Width of div: 400</button><br>

</body>
</html>
Height of an element
You can try to run the following code to learn how to set the height of an element in jQuery:
Live Demo
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $("#button1").click(function(){
        $("div").height(250);
    });
    $("#button2").click(function(){
        $("div").height(350);
    });

});
</script>
</head>
<body>
<div style="height:150px;width:400px;border:2px solid gray;background-color:lightblue;"></div><br>
<button id="button1">Height of div: 250</button>
<button id="button2">Height of div: 350</button><br>

</body>
</html>
Tryit Editor v3.7

Tryit: HTML external stylesheet
How to call a non-static method of an abstract class from a static method in java?

A method which does not have body is known as abstract method. It contains only method signature with a semi colon and, an abstract keyword before it.
public abstract myMethod();
To use an abstract method, you need to inherit it by extending its class and provide implementation to it.
A class which contains 0 or more abstract methods is known as abstract class. If it contains at least one abstract method, it must be declared abstract.
Hence, if you want to prevent instantiation of a class directly, you can declare it abstract.
Since you cannot instantiate an abstract class you cannot access its instance methods too. You can call only static methods of an abstract class (since an instance is not required).
abstract class Example{
   static void sample() {
      System.out.println("static method of the abstract class");
   }
   public void demo() {
      System.out.println("Method of the abstract class");
   }
}
public class NonStaticExample{
   public static void main(String args[]) {
      Example.sample();
   }
}
static method of the abstract class
The only way to access the non-static method of an abstract class is to extend it, implement the abstract methods in it (if any) and then using the subclass object you need to invoke the required methods.
abstract class Example{
   public void demo() {
      System.out.println("Method of the abstract class");
   }
}
public class NonStaticExample extends Example{
   public static void main(String args[]) {
      new NonStaticExample().demo();
   }
}
Method of the abstract class
How to find the minimum number of steps needed by knight to reach the destination using C#?

We have to make the knight cover all the cells of the board and it can move to a cell only once.
There can be two ways of finishing the knight move - the first in which the knight is one knight's move away from the cell from where it began, so it can go to the position from where it started and form a loop, this is called closed tour, the second in which the knight finishes anywhere else, this is called
open tour. A move is valid if it is inside the chessboard and if the cell is not already occupied. We will make the value of all the unoccupied cells equal to -1.
 Live Demo
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
namespace ConsoleApplication{
   public class KnightWalkProblem{
      public class cell{
         public int x, y;
         public int dis;
         public cell(int x, int y, int dis){
            this.x = x;
            this.y = y;
            this.dis = dis;
         }
      }
      static bool isInside(int x, int y, int N){
         if (x >= 1 && x <= N && y >= 1 && y <= N)
            return true;
            return false;
      }
      public int minStepToReachTarget(int[] knightPos, int[] targetPos, int N){
         int[] dx = { -2, -1, 1, 2, -2, -1, 1, 2 };
         int[] dy = { -1, -2, -2, -1, 1, 2, 2, 1 };
         Queue<cell> q = new Queue<cell>();
         q.Enqueue(new cell(knightPos[0], knightPos[1], 0));
         cell t;
         int x, y;
         bool[,] visit = new bool[N + 1, N + 1];
         for (int i = 1; i <= N; i++)
         for (int j = 1; j <= N; j++)
            visit[i, j] = false;
         visit[knightPos[0], knightPos[1]] = true;
         while (q.Count != 0){
            t = q.Peek();
            q.Dequeue();
            if (t.x == targetPos[0] && t.y == targetPos[1])
               return t.dis;
            for (int i = 0; i < 8; i++){
               x = t.x + dx[i];
               y = t.y + dy[i];
               if (isInside(x, y, N) && !visit[x, y]){
                  visit[x, y] = true;
                  q.Enqueue(new cell(x, y, t.dis + 1));
               }
            }
         }
         return int.MaxValue;
      }
   }
   class Program{
      static void Main(string[] args){
         KnightWalkProblem kn = new KnightWalkProblem();
         int N = 30;
         int[] knightPos = { 1, 1 };
         int[] targetPos = { 30, 30 };
         Console.WriteLine(
            kn.minStepToReachTarget(
               knightPos,
               targetPos, N));
      }
   }
}

20
Hive - Create Database

Hive is a database technology that can define databases and tables to analyze structured data. The theme for structured data analysis is to store the data in a tabular manner, and pass queries to analyze it. This chapter explains how to create Hive database. Hive contains a default database named default.
Create Database is a statement used to create a database in Hive. A database in Hive is a namespace or a collection of tables. The syntax for this statement is as follows:
CREATE DATABASE|SCHEMA [IF NOT EXISTS] <database name>
Here, IF NOT EXISTS is an optional clause, which notifies the user that a database with the same name already exists. We can use SCHEMA in place of DATABASE in this command. The following query is executed to create a database named userdb:
hive> CREATE DATABASE [IF NOT EXISTS] userdb;
or
hive> CREATE SCHEMA userdb;
The following query is used to verify a databases list:
hive> SHOW DATABASES;
default
userdb
The JDBC program to create a database is given below.
import java.sql.SQLException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.sql.DriverManager;

public class HiveCreateDb {
   private static String driverName = "org.apache.hadoop.hive.jdbc.HiveDriver";
   
   public static void main(String[] args) throws SQLException {
      // Register driver and create driver instance
   
      Class.forName(driverName);
      // get connection
      
      Connection con = DriverManager.getConnection("jdbc:hive://localhost:10000/default", "", "");
      Statement stmt = con.createStatement();
      
      stmt.executeQuery("CREATE DATABASE userdb");
      System.out.println(“Database userdb created successfully.”);
      
      con.close();
   }
}
Save the program in a file named HiveCreateDb.java. The following commands are used to compile and execute this program.
$ javac HiveCreateDb.java
$ java HiveCreateDb
Database userdb created successfully.


    50 Lectures 
     4 hours 

 Navdeep Kaur

    67 Lectures 
     4 hours 

 Bigdata Engineer

    109 Lectures 
     2 hours 

 Bigdata Engineer
 Print
 Add Notes
 Bookmark this page
Check if a string contains numbers in MySQL?

To check a string contains numbers, you can use regexp i.e. Regular Expressions. The syntax is as follows −
SELECT *FROM yourTableName where yourColumnName REGEXP ‘[0-9]’;
To understand the above syntax, let us create a table. The query to create a table is as follows −
mysql> create table StringContainsNumber
   -> (
   -> Id int not null auto_increment,
   -> Words text,
   -> primary key(Id)
   -> );
Query OK, 0 rows affected (0.53 sec)
Insert some records in the table using insert command. The query is as follows −
mysql> insert into StringContainsNumber(Words) values('He12345llo');
Query OK, 1 row affected (0.19 sec)

mysql> insert into StringContainsNumber(Words) values('MySQL is not a programming
4language');
Query OK, 1 row affected (0.17 sec)

mysql> insert into StringContainsNumber(Words) values('Java is an object oriented');
Query OK, 1 row affected (0.18 sec)

mysql> insert into StringContainsNumber(Words) values('Java does not support 456 multiple
inheritance');
Query OK, 1 row affected (0.20 sec)

mysql> insert into StringContainsNumber(Words) values('MySQL is a RDBMS 456');
Query OK, 1 row affected (0.19 sec)
Display all records from the table using select statement. The query is as follows −
mysql> select *from StringContainsNumber;
The following is the output.
+----+------------------------------------------------+
| Id | Words                                          |
+----+------------------------------------------------+
|  1 | He12345llo                                     |
|  2 | MySQL is not a programming 4language           |
|  3 | Java is an object oriented                     |
|  4 | Java does not support 456 multiple inheritance |
|  5 | MySQL is a RDBMS 456                           |
+----+------------------------------------------------+
5 rows in set (0.00 sec)
Here is the query to find the string that has numbers using REGEXP −
mysql> select *from StringContainsNumber where Words regexp '[0-9]';
The following is the output −
+----+------------------------------------------------+
| Id | Words                                          |
+----+------------------------------------------------+
|  1 | He12345llo                                     |
|  2 | MySQL is not a programming 4language           |
|  4 | Java does not support 456 multiple inheritance |
|  5 | MySQL is a RDBMS 456                           |
+----+------------------------------------------------+
4 rows in set (0.11 sec)
write command in Linux with Examples

15 Apr, 2019
write command in Linux is used to send a message to another user. The write utility allows a user to communicate with other users, by copying lines from one user’s terminal to others. When you run the write command, the user you are writing to gets a message of the form:
Message from yourname@yourhost on yourtty at hh:mm ...
Any further lines the user enter will be copied to the specified user’s terminal. If the other user wants to reply, they must run write as well. When you are done, type an end-of-file or interrupt character. The other user will see the message ‘EOF’ indicating that the conversation is over.
Syntax:
write user [tty]

write command without any option: It will print the general syntax of the write. With the help of this, the user will get a generalized idea about how to use this command since there nothing like help option for the write command.
Example:
write metal: In this command metal is the name of another user that I’m logged in with and when I execute this command with a message I get a notification on my terminal showing that I received a message from another user.write metalExplanation: So the basic use case of the write command is to send messages to the users on the other terminal as a way to interact. Once you enter write command and type your message then every user that is logged in will get a pop-up message. You will also receive a message from this particular user so if any other user wants to broadcast his message he can do the same.
write metal
Explanation: So the basic use case of the write command is to send messages to the users on the other terminal as a way to interact. Once you enter write command and type your message then every user that is logged in will get a pop-up message. You will also receive a message from this particular user so if any other user wants to broadcast his message he can do the same.
linux-command
Linux-networking-commands
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.