code-rag-bench/online-tutorials huggingface dataset:
Adjacent JSX elements must be wrapped in an enclosing tag - GeeksforGeeks

12 Oct, 2020
If anyone uses multiple HTML elements inside a render method in the React library, it shows an error specifying that Adjacent JSX elements must be wrapped in an enclosing tag. The reason for the error is that when we use the render method it can only take a single HTML element. That means if you have two or more HTML elements back to back in the render method, then it’s not going to work and show an error. So to fix this error one can embed this all HTML element inside a single div element. Anything that goes inside a div will count as a single HTML element.
Syntax : 
ReactDOM.render(
<div>
  // now one can use more than one html 
  // element inside div element.
</div>,
  document.getElementById("root)
 ); 

Example 1: When I use multiple HTML elements inside a render method :
Javascript
import React from 'react';import ReactDOM from 'react-dom';  ReactDOM.render(  <h1>Geeks For Geeks</h1>    <p>Learn Programming </p>    document.getElementById('root'));
Output: I get an error specifying that  Adjacent JSX elements must be wrapped in an enclosing tag . To fix this error <h1> and <p> tag must be wrapped in a single HTML element like <div> tag . 
Example 2: When I use a single HTML element inside a render method :
Javascript
import React from 'react';import ReactDOM from 'react-dom';  ReactDOM.render(  <div>  <h1>Geeks For Geeks</h1>    <p>Learn Programming </p>    </div>,  document.getElementById('root'));
Output: I get the expected output with no error, as in render method <h1> and <p> tag is wrapped inside a single div HTML element and anything that goes inside a div will count as a single HTML element.
Picked
react-js
JavaScript
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Remove elements from a JavaScript Array
Difference between var, let and const keywords in JavaScript
Difference Between PUT and PATCH Request
JavaScript | Promises
How to get character array from string in JavaScript?
How to filter object array based on attributes?
How to remove duplicate elements from JavaScript Array ?
Lodash _.debounce() Method
Angular File Upload
How to get selected value in dropdown list using JavaScript ?
Java Program to Print Summation of Numbers - GeeksforGeeks

21 Oct, 2020
Given an array of integers, print the sum of all the elements in an array.
Input: arr[] = {1,2,3,4,5}
Output: 15
Input: arr[] = {2, 9, -10, -1, 5, -12}
Output: -7
Create a variable named sum and initialize it to 0.Traverse the array through a loop and add the value of each element into sum.Print sum as the answer.
Create a variable named sum and initialize it to 0.
Traverse the array through a loop and add the value of each element into sum.
Print sum as the answer.
Below is the implementation of the above approach.
Java
// Java Program to print the sum // of all the elements in an arrayclass GFG {      static int sumOfArray(int arr[])    {        // initialise sum to 0        int sum = 0;                // iterate through the array using loop        for (int i = 0; i < arr.length; i++) {            sum = sum + arr[i];        }          // return sum as the answer        return sum;    }      // Driver code    public static void main(String[] args)    {        // print the sum        int arr[] = { 1, 2, 3, 4, -2, 5 };        System.out.println(            "The sum of elements of given array is: "            + sumOfArray(arr));    }}
The sum of elements of given array is: 13
Time Complexity: O(N), where N is the size of array
Inbuilt function IntStream.of(arrayName).sum() is used to sum all the elements in an integer array.
Syntax:
IntStream.of(arrayName).sum();
Below is the implementation of the above approach.
Java
// Java Program to print the sum // of all the elements in an array  // import IntStreamimport java.util.stream.IntStream;  class GFG {      // Driver code    public static void main(String[] args)    {        // print the sum        int arr[] = { 1, 2, 3, 4, -2, 5 };        System.out.println(            "The sum of elements of given array is: "            + IntStream.of(arr).sum());    }}
The sum of elements of given array is: 13
Java
Java Programs
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Stream In Java
Constructors in Java
Exceptions in Java
Functional Interfaces in Java
Different ways of Reading a text file in Java
Java Programming Examples
Convert Double to Integer in Java
Implementing a Linked List in Java using Class
How to Iterate HashMap in Java?
Program to print ASCII Value of a character
How do I create child windows with Python tkinter?

The child window can be referred to as the independent window which is separated from the root or main window. In order to create a child window, we have to define a toplevel window which can be created manually using the Toplevel(win) method. In the method toplevel(root), we have to pass the main window as the parameter and further define the widgets if needed.
Let us create a child window which contains some widgets in it.
#Import tkinter library
from tkinter import *
from tkinter import ttk
#Create an instance of tkinter frame
win = Tk()
#Set the geometry and title of tkinter Main window
win.geometry("750x250")
win.title("Main Window")
#Create a child window using Toplevel method
child_w= Toplevel(win)
child_w.geometry("750x250")
child_w.title("New Child Window")
#Create Label in Mainwindow and Childwindow
label_main= Label(win, text="Hi, this is Main window", font=('Helvetica 15'))
label_main.pack(pady=20)
label_child= Label(child_w, text= "Hi, this is Child Window", font=('Helvetica 15'))
label_child.pack()
win.mainloop()
When we run the above code, it will display two windows: a Main window and a Child Window
Q Programming Language

Kdb+ comes with its built-in programming language that is known as q. It incorporates a superset of standard SQL which is extended for time-series analysis and offers many advantages over the standard version. Anyone familiar with SQL can learn q in a matter of days and be able to quickly write her own ad-hoc queries.
To start using kdb+, you need to start the q session. There are three ways to start a q session −
Simply type “c:/q/w32/q.exe” on your run terminal.
Simply type “c:/q/w32/q.exe” on your run terminal.
Start the MS-DOS command terminal and type q.
Start the MS-DOS command terminal and type q.
Copy the q.exe file onto “C:\Windows\System32” and on the run terminal, just type “q”.
Copy the q.exe file onto “C:\Windows\System32” and on the run terminal, just type “q”.
Here we are assuming that you are working on a Windows platform.
The following table provides a list of supported data types −
Atoms are single entities, e.g., a single number, a character or a symbol. In the above table (of different data types), all supported data types are atoms. A list is a sequence of atoms or other types including lists.
Passing an atom of any type to the monadic (i.e. single argument function) type function will return a negative value, i.e., –n, whereas passing a simple list of those atoms to the type function will return a positive value n.
/ Note that the comments begin with a slash “ / ” and cause the parser
/ to ignore everything up to the end of the line.

x: `mohan              / `mohan is a symbol, assigned to a variable x
type x                 / let’s check the type of x
-11h                   / -ve sign, because it’s single element.

y: (`abc;`bca;`cab)    / list of three symbols, y is the variable name.

type y
11h                    / +ve sign, as it contain list of atoms (symbol).

y1: (`abc`bca`cab)     / another way of writing y, please note NO semicolon

y2: (`$”symbols may have interior blanks”)   / string to symbol conversion
y[0]                   / return `abc
y 0                    / same as y[0], also returns `abc
y 0 2                  / returns `abc`cab, same as does y[0 2]

z: (`abc; 10 20 30; (`a`b); 9.9 8.8 7.7)      / List of different types,
z 2 0                  / returns (`a`b; `abc),
z[2;0]                 / return `a. first element of z[2]

x: “Hello World!”      / list of character, a string
x 4 0                  / returns “oH” i.e. 4th and 0th(first)
element

 Print
 Add Notes
 Bookmark this page
C++ Program to Find LCM

The Least Common Multiple (LCM) of two numbers is the smallest number that is a multiple of both.
For example: Let’s say we have the following two numbers: 15 and 9.
15 = 5 * 3
9 = 3 * 3
So, the LCM of 15 and 9 is 45.
A program to find the LCM of two numbers is given as follows −
 Live Demo
#include <iostream>
using namespace std;
int main() {
   int a=7, b=5, lcm;
   if(a>b)
   lcm = a;
   else
   lcm = b;
   while(1) {
      if( lcm%a==0 && lcm%b==0 ) {
         cout<<"The LCM of "<<a<<" and "<<b<<" is "<<lcm;
         break;
      }
      lcm++;
   }
   return 0;
}
The LCM of 7 and 5 is 35
In the above program, the variable lcm is set as the larger of the two numbers. This is demonstrated using the following code snippet.
if(a>b)
lcm = a;
else
lcm = b;
After this, a while loop runs. In this loop, if LCM is divisible by a as well as b, it is the LCM of the two numbers and is displayed. If not, LCM is incremented until this condition is fulfilled.
The code snippet that explains this is as follows −
while(1) {
   if( lcm%a==0 && lcm%b==0 ) {
      cout<<"The LCM of "<<a<<" and "<<b<<" is "<<lcm;
      break;
   }
   lcm++;
}
Another method of finding the LCM of two numbers is to use the LCM and GCD formula. This formula specifies that the product of two numbers is equal to the product of their LCM and GCD.
a * b = GCD * LCM
A program to find the LCM of two numbers using the formula is given as follows −
 Live Demo
#include<iostream>
using namespace std;
int gcd(int a, int b) {
   if (b == 0)
   return a;
   return gcd(b, a % b);
}
int main() {
   int a = 7, b = 5;
   cout<<"LCM of "<< a <<" and "<< b <<" is "<< (a*b)/gcd(a, b);
   return 0;
}
LCM of 7 and 5 is 35
In the above program, the LCM is found using the formula. First, the GCD of a and b is obtained using gcd(). Itis a recursive function. It has two parameters i.e. a and b. If b is greater than 0, then a is returned to the main() function. Otherwise the gcd() function recursively calls itself with the values b and a%b.
This is demonstrated using the following code snippet.
int gcd(int a, int b) {
   if (b == 0)
   return a;
   return gcd(b, a % b);
}
After the GCD is obtained, the LCM is calculated using the formula. Then it is displayed. This is shown in the following code snippet.
cout<<"LCM of "<< a <<" and "<< b <<" is "<< (a*b)/gcd(a, b);
How can we return null from a generic method in C#?

Generics allows us to define a class with placeholders for the type of its fields, methods, parameters, etc. Generics replace these placeholders with some specific type at compile time. A generic can be defined using angle brackets <>. A primary limitation of collections is the absence of effective type checking. This means that you can put any object in a collection because all classes in the C# programming language extend from the object base class.
Also, we cannot simply return null from a generic method like in normal method. Below is the error that a generic method will throw if we are trying to return null.
using System;
namespace DemoApplication {
   class Program {
      public static void Main() {
         Add(5, 5);
      }
      public static T Add<T>(T parameter1, T parameter2) {
         return null;
      }
   }
}
So, to return a null or default value from a generic method we can make use default(). default(T) will return the default object of the type which is provided.
 Live Demo
using System;
namespace DemoApplication {
   class Program {
      public static void Main() {
         Add(5, 5);
         Console.ReadLine();
      }
      public static T Add<T>(T parameter1, T parameter2) {
         var defaultVal = default(T);
         Console.WriteLine(defaultVal);
         return defaultVal;
      }
   }
}
The output of the code is
0
Here we could see that the default value of integer 0 is returned.
How to make a 3D scatter plot in Python?

To get a 3D plot, we can use fig.add_subplot(111, projection='3d') method to instantiate the axis. After that, we can use the scatter method to draw different data points on the x, y, and z axes.
Create a new figure, or activate an existing figure.
Create a new figure, or activate an existing figure.
Add an `~.axes.Axes` to the figure as part of a subplot arrangement, where nrows = 1, ncols = 1, index = 1 and projection is ‘3d’.
Add an `~.axes.Axes` to the figure as part of a subplot arrangement, where nrows = 1, ncols = 1, index = 1 and projection is ‘3d’.
Iterate a list of marks, xs, ys and zs, to make scatter points.
Iterate a list of marks, xs, ys and zs, to make scatter points.
Set x, y, and z labels using set_xlabel, y_label, and z_label methods.
Set x, y, and z labels using set_xlabel, y_label, and z_label methods.
Use plt.show() method to plot the figure.
Use plt.show() method to plot the figure.
import matplotlib.pyplot as plt
import numpy as np

np.random.seed(1000)

fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')

n = 100

for m, zl, zh in [('o', -50, -25), ('^', -30, -5)]:
   xs = (32 - 23) * np.random.rand(n) + 23
   ys = (100 - 0) * np.random.rand(n)
   zs = (zh - zl) * np.random.rand(n) + zl
   ax.scatter(xs, ys, zs, marker=m)

ax.set_xlabel('X Label')
ax.set_ylabel('Y Label')
ax.set_zlabel('Z Label')

plt.show()
How to Fix: No module named plotly - GeeksforGeeks

22 Nov, 2021
In this article, we are going to see how to fix the no module error of plotly. This type of error is seen when we don’t have a particular module installed in our Python environment. In this tutorial, we will try to reproduce the error and solve it using screenshots.
Example:
It can be done with pip commands, pip is used to install an external package in Python.
Command:
pip install plotly
It might take some time to install depending on your internet speed. 
Now we can successfully import Plotly. 
check if the installation is done or not
Picked
Python How-to-fix
Python-Plotly
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
How To Convert Python Dictionary To JSON?
How to drop one or multiple columns in Pandas Dataframe
Check if element exists in list in Python
Selecting rows in pandas DataFrame based on conditions
Python | os.path.join() method
Defaultdict in Python
Python | Get unique values from a list
Create a directory in Python
Python | Pandas dataframe.groupby()
HTML <fieldset> disabled Attribute - GeeksforGeeks

04 Jan, 2019
The disabled attribute for <fieldset> element in HTML is used to specify that the group of related form elements is disabled. A disabled fieldset is un-clickable and unusable. It is a boolean attribute.
Syntax:
<fieldset disabled>fieldset content...</fieldset>

Example:
<!DOCTYPE html> <html>     <head>         <title>HTML fieldset disabled Attribute</title>     </head>     <body style = "text-align:center">              <h1 style = "color: green;">GeeksforGeeks</h1>        <h2>HTML fieldset disabled Attribute</h2>          <p>This field set is disabled.</p>          <!--A disabled fieldset-->        <fieldset disabled>          Name: <input type="text"><br>        </fieldset>      </body> </html>      
Output:
Supported Browsers: The browser supported by <fieldset> disabled attribute are listed below:
Apple Safari 8.0
Google Chrome
Firefox
Opera
Internet Explorer Not supported
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.
HTML-Attributes
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to insert spaces/tabs in text using HTML/CSS?
How to Insert Form Data into Database using PHP ?
REST API (Introduction)
Form validation using HTML and JavaScript
Installation of Node.js on Linux
How to fetch data from an API in ReactJS ?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to insert spaces/tabs in text using HTML/CSS?
Express.js express.Router() Function
How to count the number of checkboxes in a page in Selenium with python?

We can count the total number of checkboxes in a page in Selenium with the help of find_elements method. While working on any checkboxes, we will always find an attribute type in the html code and its value should be checkbox.
This characteristic is only applicable to checkboxes on that particular page and to no other types of UI elements like edit box, link and so on.
To retrieve all the elements with attribute type = 'checkbox', we will use find_elements_by_xpath() method. This method returns a list of web elements with the type of xpath specified in the method argument. In case there are no matching elements, an empty list will be returned.
After the list of checkboxes are fetched, in order to count its total numbers, we need to get the size of that list. The size of the list can be obtained from the len() method of the list data structure.
Finally this length is printed on the console.
driver.find_elements_by_xpath("//input[@type='checkbox']")
Code Implementation for counting checkbox.
from selenium import webdriver
#browser exposes an executable file
#Through Selenium test we will invoke the executable file which will then #invoke actual browser
driver = webdriver.Chrome(executable_path="C:\\chromedriver.exe")
# to maximize the browser window
driver.maximize_window()
#get method to launch the URL
driver.get("https://www.tutorialspoint.com/selenium/selenium_automation_practice.htm")
#to refresh the browser
driver.refresh()
# identifying the checkboxes with type attribute in a list
chk =driver.find_elements_by_xpath("//input[@type='checkbox']")
# len method is used to get the size of that list
print(len(chk))
#to close the browser
driver.close()
How to add a variable description in R?

To add a variable description in R, we can use comment function and if we want to have a look at the description then structure call of the data frame will be used. For example, if we have a data frame say df that contains a column x then we can describe x by using the command comment(df$x)<-c("The name of this variable is x"). Now to have a look at it, we can use str(df).
Consider the below data frame −
 Live Demo
x1<-rnorm(20,21,3.24)
x2<-rnorm(20,5,2.1)
df1<-data.frame(x1,x2)
df1
     x1        x2
1  23.12252  5.085650
2  19.81415  5.180194
3  14.41423  2.756885
4  21.34914  5.714200
5  18.34662  3.814034
6  21.37762  9.538720
7  21.48240  4.838389
8  22.58701  2.185943
9  15.68257  5.084348
10 20.86272  5.732107
11 19.84529  3.430304
12 26.23832  3.684373
13 25.35179  5.001748
14 19.83831  3.393473
15 23.57819  5.057545
16 15.69374  7.442210
17 15.69028  6.722865
18 18.94718  8.046787
19 25.26722  2.776823
20 23.32905  3.561213
str(df1)
'data.frame': 20 obs. of 2 variables:
$ x1: num 23.1 19.8 14.4 21.3 18.3 ...
$ x2: num 5.09 5.18 2.76 5.71 3.81 ...
Adding description of variables in df1 −
comment(df1$x1)<-c("This variable follows normal distribution")
comment(df1$x2)<-c("This variable follows normal distribution")
str(df1)
'data.frame': 20 obs. of 2 variables −
$ x1: num 23.1 19.8 14.4 21.3 18.3 ...
..- attr(*, "comment")= chr "This variable follows normal distribution"
$ x2: num 5.09 5.18 2.76 5.71 3.81 ...
..- attr(*, "comment")= chr "This variable follows normal distribution"
 Live Demo
y1<-sample(0:1,20,replace=TRUE)
y2<-sample(LETTERS[1:5],20,replace=TRUE)
df2<-data.frame(y1,y2)
df2
   y1 y2
1  0  B
2  1  E
3  0  B
4  1  A
5  1  D
6  0  A
7  0  E
8  1  D
9  0  D
10 0  D
11 0  E
12 0  C
13 1  A
14 1  D
15 0  B
16 0  E
17 1  C
18 0  C
19 1  D
20 1  C
str(df2)
'data.frame': 20 obs. of 2 variables:
$ y1: int 0 1 0 1 1 0 0 1 0 0 ...
$ y2: chr "B" "E" "B" "A" ...
Adding description of variables in df2 −
comment(df2$y1)<-c("This is a binary variable")
comment(df2$y2)<-c("This is a categorical variable")
str(df2)
'data.frame': 20 obs. of 2 variables −
$ y1: int 0 1 0 1 1 0 0 1 0 0 ...
..- attr(*, "comment")= chr "This is a binary variable"
$ y2: chr "B" "E" "B" "A" ...
..- attr(*, "comment")= chr "This is a categorical variable"
numpy.hstack

Variants of numpy.stack function to stack so as to make a single array horizontally.
import numpy as np 
a = np.array([[1,2],[3,4]]) 

print 'First array:' 
print a 
print '\n'  
b = np.array([[5,6],[7,8]]) 

print 'Second array:' 
print b 
print '\n'  

print 'Horizontal stacking:' 
c = np.hstack((a,b)) 
print c 
print '\n'
It would produce the following output −
First array:
[[1 2]
 [3 4]]

Second array:
[[5 6]
 [7 8]]

Horizontal stacking:
[[1 2 5 6]
 [3 4 7 8]]


    63 Lectures 
     6 hours 

 Abhilash Nelson

    19 Lectures 
     8 hours 

 DATAhill Solutions Srinivas Reddy

    12 Lectures 
     3 hours 

 DATAhill Solutions Srinivas Reddy

    10 Lectures 
     2.5 hours 

 Akbar Khan

    20 Lectures 
     2 hours 

 Pruthviraja L

    63 Lectures 
     6 hours 

 Anmol
 Print
 Add Notes
 Bookmark this page
Write a C program that displays contents of a given file like 'more' utility in Linux - GeeksforGeeks

08 May, 2017
Write a C program that displays contents of given line page by page. Given number of lines to show as ‘n’ at a time and a file name, the program should first show n lines, then wait for user to hit a key before showing next n lines and so on.
We strongly recommend to minimize the browser and try this yourself first.
We can open the given file and print contents of files. While printing, we can keep track of number of newline characters. If the number of newline characters become n, we wait for the user to press a key before showing next n lines.
Following is the requires C program.
// C program to show contents of a file with breaks#include <stdio.h>  // This function displays a given file with breaks of// given line numbers.void show(char *fname, int n){    // Open given file    FILE *fp = fopen(fname, "r");    int curr_lines = 0, ch;      // If not able to open file    if (fp == NULL)    {        printf("File doesn't exist\n");        return;    }      // Read contents of file    while ((ch = fgetc(fp)) != EOF)    {        // print current character        putchar(ch);          // If current character is a new line character,        // then increment count of current lines        if (ch == '\n')        {            curr_lines++;              // If count of current lines reaches limit, then            // wait for user to enter a key            if (curr_lines == n)            {                curr_lines = 0;                getchar();            }        }    }      fclose(fp);}  // Driver program to test above functionint main(){    char fname[] = "A.CPP";    int n = 25;    show(fname, n);    return 0;}
This article is contributed by Ajay Jain. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
C-File Handling
cpp-file-handling
C Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
TCP Server-Client implementation in C
Exception Handling in C++
Multithreading in C
Arrow operator -> in C/C++ with Examples
'this' pointer in C++
How to split a string in C/C++, Python and Java?
Smart Pointers in C++ and How to Use Them
UDP Server-Client implementation in C
How to dynamically allocate a 2D array in C?
Unordered Sets in C++ Standard Template Library
Python | sympy.integrate() method - GeeksforGeeks

12 Jun, 2019
With the help of sympy.integrate() method, we can find the integration of mathematical expressions in the form of variables by using sympy.integrate() method.
Syntax : sympy.integrate(expression, reference variable)Return : Return integration of mathematical expression.
Example #1 :In this example we can see that by using sympy.integrate() method, we can find the integration of mathematical expression with variables. Here we use symbols() method also to declare a variable as symbol.
# import sympyfrom sympy import * x, y = symbols('x y')gfg_exp = sin(x)*exp(x)  print("Before Integration : {}".format(gfg_exp))  # Use sympy.integrate() methodintr = integrate(gfg_exp, x)  print("After Integration : {}".format(intr))
Output :
Before Integration : exp(x)*sin(x)
After Integration : exp(x)*sin(x)/2 – exp(x)*cos(x)/2
Example #2 :
# import sympyfrom sympy import * x, y = symbols('x y')gfg_exp = sin(x)*tan(x)  print("Before Integration : {}".format(gfg_exp))  # Use sympy.integrate() methodintr = integrate(gfg_exp, x)  print("After Integration : {}".format(intr))
Output :
Before Integration : sin(x)*tan(x)
After Integration : -log(sin(x) – 1)/2 + log(sin(x) + 1)/2 – sin(x)
SymPy
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to Install PIP on Windows ?
How to drop one or multiple columns in Pandas Dataframe
How To Convert Python Dictionary To JSON?
Check if element exists in list in Python
Python | Pandas dataframe.groupby()
Python | Get unique values from a list
Defaultdict in Python
Python | os.path.join() method
Python Classes and Objects
Create a directory in Python
How to create a big font text using JavaScript?

To create a big font text, use the JavaScript big() method. This method causes a string to be displayed in a big font as if it were in a BIG tag.
You can try to run the following code to create a big font text −
Live Demo
<html>
   <head>
      <title>JavaScript String big() Method</title>
   </head>

   <body>
      <script>
         var str = new String("Demo Text");
         document.write("Following is bigger text: "+str.big());
      </script>
   </body>
</html>
\atop - Tex Command

\atop - Command to create fractions without horizontal fraction bar
{ sub-formula1 \atop sub-formula2 }
\atop command creates a fraction like structure.

a+1 \atop b  

a+1b


 a \atop b+2  

ab+2


 {a+1 \atop b+2}+c  

a+1b+2+c



a+1 \atop b  

a+1b


a+1 \atop b  
 a \atop b+2  

ab+2


 a \atop b+2  
 {a+1 \atop b+2}+c  

a+1b+2+c


 {a+1 \atop b+2}+c  

    14 Lectures 
     52 mins

 Ashraf Said

    11 Lectures 
     1 hours 

 Ashraf Said

    9 Lectures 
     1 hours 

 Emenwa Global, Ejike IfeanyiChukwu

    29 Lectures 
     2.5 hours 

 Mohammad Nauman

    14 Lectures 
     1 hours 

 Daniel Stern

    15 Lectures 
     47 mins

 Nishant Kumar
 Print
 Add Notes
 Bookmark this page
TimeZone getTimeZone() Method in Java with Examples - GeeksforGeeks

02 Jan, 2019
The getTimeZone() method of TimeZone class in Java is used to know the actual TimeZone for any passed TimeZone ID.
Syntax:
public static TimeZone getTimeZone(String the_ID)
Parameters: The method takes one parameter the_ID of string datatype which refers to the ID of which the TimeZone is needed to be known.
Return Value: The method either returns the specified TimeZone for the passed ID or the GMT zone if the specified ID cannot be understood by the program.
Below programs illustrate the working of getTimeZone() Method of TimeZone:Example 1:
// Java code to illustrate getTimeZone() method  import java.util.*;  public class TimeZoneDemo {    public static void main(String args[])    {          // Creating a TimeZone        TimeZone the_time_zone            = TimeZone.getDefault();          // Knowing the TimeZone        System.out.println("The TimeZone is: "                           + the_time_zone                                 .getTimeZone("GMT+5:30"));    }}
The TimeZone is: sun.util.calendar.ZoneInfo[id="GMT+05:30",
offset=19800000, dstSavings=0, useDaylight=false, transitions=0, lastRule=null]

Example 2:
// Java code to illustrate getTimeZone() method  import java.util.*;  public class TimeZoneDemo {    public static void main(String args[])    {          // Creating a TimeZone        TimeZone the_time_zone            = TimeZone.getDefault();          // Knowing the TimeZone        System.out.println("The TimeZone is: "                           + the_time_zone                                 .getTimeZone("GMT-3:30"));    }}
The TimeZone is: sun.util.calendar.ZoneInfo[id="GMT-03:30",
offset=-12600000, dstSavings=0, useDaylight=false, transitions=0, lastRule=null]

Reference: https://docs.oracle.com/javase/7/docs/api/java/util/TimeZone.html#getTimeZone()
Java - util package
Java-Functions
Java-TimeZone
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Object Oriented Programming (OOPs) Concept in Java
HashMap in Java with Examples
How to iterate any Map in Java
Initialize an ArrayList in Java
Interfaces in Java
ArrayList in Java
Multidimensional Arrays in Java
Stack Class in Java
Singleton Class in Java
Collections in Java
Making Menu options with Checkbutton in Tkinter?

The Menu Bar in Tkinter can be created by initializing Menu (parent) instances in the application. We can add checkbuttons in place of add_command to extend the feature of Menu Bar in any application.
To add the menu items using the add_checkbutton(label, options) method, we first initialize a Menu Bar. Once the MenuBar is defined, we can give the value of menu items by using Checkbuttons. The CheckButtons can be used to add the list of Menu Items or options. Checkbuttons are nothing but the Boolean widget, which validates a particular value by making it True or False. To mark the status of checkbuttons in the menu items, we can use onvalue and offvalue.
#Import the required Libraries
from tkinter import *
#Create an instance of Tkinter frame
win = Tk()
#Set the geometry of Tkinter Frame
win.geometry("750x250")

#Initialize a Menu Bar
menubar = Menu(win)

#Add Menu Items in the MenuBar
menu_items = Menu(menubar)
menu_items.add_checkbutton(label="C++", onvalue=1, offvalue=0)
menu_items.add_checkbutton(label="Java", onvalue=1, offvalue=0)
menu_items.add_checkbutton(label="Python", onvalue=1, offvalue=0)

# Add the Viwable Menu to the MenuBar
menubar.add_cascade(label='File', menu=menu_items)
win.config(menu=menubar)

win.mainloop()
Run the above code to display a Menu Bar which is having the Menu Items of CheckButtons.
When we select an item in the Menu, it will mark the item on/off.
MySQL procedure to call multiple procedures?

Let us first see the syntax, wherein we are calling multiple procedures from a stored procedure −
DELIMITER //
CREATE PROCEDURE yourProcedureName()
BEGIN
   CALL yourStoredProcedureName1();
   CALL yourStoredProcedureName2();
   .
   .
   N
END
//
DELIMITER //
Let us implement the above syntax to call multiple stored procedures.
Following is the query to create first stored procedure −
mysql> DELIMITER //
mysql> CREATE PROCEDURE hello_message()
   -> BEGIN
   -> SELECT 'HELLO WORLD !!';
   -> END
   -> //
Query OK, 0 rows affected (0.19 sec)
The query to create second stored procedure is as follows −
mysql> CREATE PROCEDURE hi_message()
   -> BEGIN
   -> SELECT 'HI !!!!';
   -> END
   -> //
Query OK, 0 rows affected (0.11 sec)

mysql> DELIMITER ;
Here is the query to create a new procedure to call multiple stored procedures −
mysql> DELIMITER //
mysql> CREATE PROCEDURE call_all_stored_procedure()
   -> BEGIN
   -> CALL hello_message();
   -> CALL hi_message();
   -> END
   -> //
Query OK, 0 rows affected (0.26 sec)

mysql> DELIMITER ;
Now you can call the main stored procedure −
mysql> call call_all_stored_procedure();
This will produce the following output −
+----------------+
| HELLO WORLD !! |
+----------------+
| HELLO WORLD !! |
+----------------+
1 row in set (0.06 sec)

+---------+
| HI !!!! |
+---------+
| HI !!!! |
+---------+
1 row in set (0.06 sec)
Query OK, 0 rows affected (0.08 sec)
Properties of Dictionary Keys in Python

Dictionary values have no restrictions. They can be any arbitrary Python object, either standard objects or user-defined objects. However, same is not true for the keys.
There are two important points to remember about dictionary keys −
More than one entry per key not allowed. Which means no duplicate key is allowed. When duplicate keys encountered during assignment, the last assignment wins.
Following is a simple example −
 Live Demo
#!/usr/bin/python
dict = {'Name': 'Zara', 'Age': 7, 'Name': 'Manni'}
print "dict['Name']: ", dict['Name']
When the above code is executed, it produces the following result −
dict['Name']: Manni

Keys must be immutable. Which means you can use strings, numbers or tuples as dictionary keys but something like ['key'] is not allowed.
Following is a simple example −
 Live Demo
#!/usr/bin/python
dict = {['Name']: 'Zara', 'Age': 7}
print "dict['Name']: ", dict['Name']
When the above code is executed, it produces the following result −
Traceback (most recent call last):
File "test.py", line 3, in <module>
dict = {['Name']: 'Zara', 'Age': 7};
TypeError: unhashable type: 'list'
max() and min() in Python

Finding maximum and minimum values from a given list of values is a very common need in data processing programs. Python has these two functions which handle both numbers and strings. We will see both the scenarios in the below examples.
We take a list of numeric values which has integers and floats. The functions work appropriately to give both the max and the min values.
 Live Demo
x=[10,15,25.5,3,2,9/5,40,70]
print("Maximum number is :",max(x))
print("\nMinimum number is :",min(x))
Running the above code gives us the following result:
Maximum number is : 70
Minimum number is : 1.8
The string values are compared lexicographically to get the correct result. Internally the ascii values of the characters are compared.
 Live Demo
x=['Mon','Tue','Wed','Thu','Fri','Sat','Sun']
print("Maximum number is :",max(x))
print("\nMinimum number is :",min(x))
Running the above code gives us the following result:
Maximum number is : Wed
Minimum number is : Fri
C program to design a hot air balloon using graphics - GeeksforGeeks

23 Apr, 2021
In this article, we will discuss how to design a Hot Air Balloon in the C using Graphics.
Approach:
Draw a circle using the circle() function.
Draw a total of four lines using the line() function which will act as the rope that holds the container.
Implement the container using the rectangle() function.
Color the circle which will act as a balloon with red using the setfillstyle() & floodfill() functions.
Color the container yellow & brown using the setfillstyle() & floodfill() functions.
Color all the ropes white using the setfillstyle() & floodfill() functions.
Set the background color blue using setfillstyle() & floodfill() functions.
Below is the implementation of the above approach:
C
// C program to design a Hot Air Balloon// using graphics#include <conio.h>#include <graphics.h>#include <stdio.h>  // Driver Codevoid main(){    int gd = DETECT, gm;      // Initialize of gdriver with    // DETECT macros    initgraph(&gd, &gm, "C:\\"                        "turboc3\\bgi");      // Set the Background Color to blue    setfillstyle(SOLID_FILL, BLUE);    floodfill(100, 100, 15);      // Set Circle Balloon Color    // With Red    setfillstyle(SOLID_FILL, RED);      // Creating Balloon    circle(550, 200, 100);    floodfill(552, 202, 15);      // Set The Rope Color    // With White    setfillstyle(SOLID_FILL, WHITE);      // Right Side Right Rope    line(650, 200, 630, 400);      // Right Side Left Rope    line(650, 200, 620, 400);      // Connect the two right side ropes    // for coloring purpose    line(620, 400, 630, 400);    floodfill(625, 398, 15);      // Left side left rope    line(450, 200, 470, 400);      // Left side right rope      line(450, 200, 480, 400);      // Connect the two left side ropes    // for coloring purpose    line(470, 400, 480, 400);    floodfill(475, 398, 15);      // Set Container One Part    // With Brown    setfillstyle(SOLID_FILL, BROWN);    rectangle(450, 400, 650, 500);    floodfill(452, 402, 15);      // Set Container Another    // Part With Yellow    setfillstyle(XHATCH_FILL, YELLOW);      // Dividing Container For    // Decorating Purpose    line(450, 430, 650, 430);    floodfill(452, 498, 15);      // Hold the screen    getch();      // Close the initialized gdriver    closegraph();}
Output:
c-graphics
computer-graphics
C Language
C Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
TCP Server-Client implementation in C
Exception Handling in C++
Multithreading in C
'this' pointer in C++
Arrow operator -> in C/C++ with Examples
Strings in C
Arrow operator -> in C/C++ with Examples
C Program to read contents of Whole File
UDP Server-Client implementation in C
Header files in C/C++ and its uses
How can I make one Python file run another?

There are multiple ways to make one Python file run another.
1. Use it like a module. import the file you want to run and run its functions. For example, say you want to import fileB.py into fileA.py, assuming the files are in the same directory, inside fileA you'd write
import fileB
Now in fileA, you can call any function inside fileB like:
fileB.my_func()
2. You can use the exec command. 
execfile('file.py')
 executes the file.py file in the interpreter.
3. You can spawn a new process using the os.system command.
os.system('python my_file.py')
MySQL Stored Procedure calling with INT and VARCHAR values

To call a stored procedure, you can use CALL command. Following is the syntax −
CALL yourStoredProcedureName(parameter if any);
Let us first create a sample procedure. Following is the query to create a stored procedure. Here, we have set two values, one is an INT and another VARCHAR −
mysql> DELIMITER //
mysql> CREATE PROCEDURE CALL_PROC(Id int,Name varchar(40))
   BEGIN
   SELECT CONCAT('You have entered the Id which is=',Id);
   SELECT CONCAT('You have entered the Name which is=',Name);
   END
//
Query OK, 0 rows affected (0.21 sec)
mysql> DELIMITER ;
Following is the query to call a stored procedure in MySQL −
mysql> CALL CALL_PROC(1001,'Chris');
This will produce the following output −
+------------------------------------------------+
| CONCAT('You have entered the Id which is=',Id) |
+------------------------------------------------+
| You have entered the Id which is=1001          |
+------------------------------------------------+
1 row in set (0.00 sec)
+----------------------------------------------------+
| CONCAT('You have entered the Name which is=',Name) |
+----------------------------------------------------+
| You have entered the Name which is=Chris           |
+----------------------------------------------------+
1 row in set (0.02 sec)
Query OK, 0 rows affected, 1 warning (0.04 sec)
How to select element with specific class and title attribute using jQuery?

If your element is having a class and title attribute, still you can select it with jQuery. You can try to run the following code to learn how to select element with specific class and 'title' attribute using jQuery.
Live Demo
<html>

   <head>
      <title>The Selector Example</title>
      <script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
   
      <script>
         $(document).ready(function() {

            $(".big[title='one']").css("background-color", "yellow");
         });
      </script>
       
   </head>
   
   <body>

      <div class = "big" title="one">
         <p>This is first division of the DOM.</p>
      </div>
       <div class = "medium">
         <p>This is second division of the DOM.</p>
      </div>

   </body>
   
</html>
Lua - Data Types

Lua is a dynamically typed language, so the variables don't have types, only the values have types. Values can be stored in variables, passed as parameters and returned as results.
In Lua, though we don't have variable data types, but we have types for the values. The list of data types for values are given below.
nil
Used to differentiate the value from having some data or no(nil) data.
boolean
Includes true and false as values. Generally used for condition checking.
number
Represents real(double precision floating point) numbers.
string
Represents array of characters.
function
Represents a method that is written in C or Lua.
userdata
Represents arbitrary C data.
thread
Represents independent threads of execution and it is used to implement coroutines.
table
Represent ordinary arrays, symbol tables, sets, records, graphs, trees, etc., and implements associative arrays. It can hold any value (except nil).
In Lua, there is a function called ‘type’ that enables us to know the type of the variable. Some examples are given in the following code.
print(type("What is my type"))   --> string
t = 10

print(type(5.8*t))               --> number
print(type(true))                --> boolean
print(type(print))               --> function
print(type(nil))                 --> nil
print(type(type(ABC)))           --> string
When you build and execute the above program, it produces the following result on Linux −
string
number
boolean
function
nil
string

By default, all the variables will point to nil until they are assigned a value or initialized. In Lua, zero and empty strings are considered to be true in case of condition checks. Hence, you have to be careful when using Boolean operations. We will know more using these types in the next chapters.

    12 Lectures 
     2 hours 

 Manish Gupta

    80 Lectures 
     3 hours 

 Sanjeev Mittal

    54 Lectures 
     3.5 hours 

 Mehmet GOKTEPE
 Print
 Add Notes
 Bookmark this page
How To Place Legend Outside the Plot with Seaborn in Python? - GeeksforGeeks

16 Nov, 2020
Seaborn is a Python data visualization library based on matplotlib. It provides a high-level interface for drawing attractive and informative statistical graphics. Basically, it helps us stylize our basic plot made using matplotlib. Moreover, it also provides us different plotting techniques to ease our Exploratory Data Analysis(EDA). With these plots, it also becomes important to provide legends for a particular plot.
In this following article, we are going to see how can we place our Legend on our plot, and later in this article, we will also see how can we place the legend outside the plot using Seaborn. 
We will start by importing our necessary libraries. 
Python3
import seaborn as sns import matplotlib.pyplot as plt
We will be using Seaborn for not only plotting the data but also importing our dataset. Here we will be using the Gamma dataset by seaborn. 
Python3
# set our graph style to whitegridsns.set(style="whitegrid")  # load the gammas datasetds = sns.load_dataset("gammas")    # use seaborn's lineplot to plot our timeplot# and BOLD signal columnssns.lineplot(data=ds, x="timepoint", y="BOLD signal", hue = "ROI")   plt.show()
Output:
We can see that this plots a beautiful line plot graph with the legends. We can see that the legend box is on the plot. This might be an issue in many plots, so we need to keep our legend box outside the plot. 
We can do this by using matplotlib’s legend function and providing its necessary parameters.
Python3
plt.legend(bbox_to_anchor=(1, 1), loc=2)
Output:
We can also tune our parameters according to our necessities. 
Python3
plt.legend(bbox_to_anchor=(1.02, 1), loc=2)
Output:
Hence, this technique can be used in many scenarios where the legend box comes on the graph which may be otherwise useful for our EDA. 
Python-Seaborn
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()
How to Detect Keypress using JavaScript ? - GeeksforGeeks

31 Aug, 2020
In this article, keyboard detection is performed using HTML and CSS.HTML stands for “Hypertext Markup Language”. HTML language helps the developer to create and design the web page elements like links, sections, paragraphs, headings, and blockquotes for web applications.
CSS stands for “Cascading Style Sheet”. Cascading style sheets are used to design web page layouts. The styles are defined to give styles to tables, sizes, and texts.
JavaScript is a scripting programming language used on the client and server-side which makes the web pages talk and communicate with each other.All of the above technologies are used to implement keypress detection.Program editor applications like Atom or Sublime Text can be used to compile the programs.
Example:Create an index.html file for the following code.
<html><head>        <link rel="stylesheet" type="text/css"     href="main.css">    <script type="text/javascript" src="main.js">    </script></head><body>    <div id="demo"></div></body></html>
For the HTML above code, we need to include main.css and main.js
CSS code: The following code is written in the main.css file.
body{    font-family: monospace, arial;    font-size: 38px;    text-align: center;}
JavaScript code: The following code is written in the main.js file.
window.onload = function(){    var demo = document.getElementById('demo');    var value = 0;    var space_bar = 32;    var right_arrow = 39;      window.onkeydown= function(gfg){        if(gfg.keyCode === space_bar){            value++;            demo.innerHTML = value;        };        if(gfg.keyCode === right_arrow)       {           alert("Welcome to GeeksForGeeks!");       };    };};    
Here,
var space_bar = 32 
and
var right_arrow = 39 
are actually the key codes that corresponds to the specific key. Whenever the space bar or the right arrow is clicked, the HTML will detect the type of click and respond by the number of times clicked or by a message.
Output:
A number gets displayed when the space bar is once clicked.
A number gets displayed when the space bar is once clicked.
When the right arrow is clicked, the page responds with a message.
When the right arrow is clicked, the page responds with a message.
My Personal Notes
arrow_drop_upSave
CSS-Misc
HTML-Misc
JavaScript-Misc
CSS
HTML
JavaScript
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 ?
How to apply style to parent if it has child with CSS?
Types of CSS (Cascading Style Sheet)
How to position a div at the bottom of its container using CSS?
How to set space between the flexbox ?
How to update Node.js and NPM to next version ?
How to set the default value for an HTML <select> element ?
Hide or show elements in HTML using display property
How to set input type date in dd-mm-yyyy format using HTML ?
REST API (Introduction)
ES6 - Proxy API

ES6 implements intercession form of meta programming using Proxies. Similar to ReflectAPI, the Proxy API is another way of implementing meta programming in ES6. The Proxy object is used to define custom behavior for fundamental operations. A proxy object performs some operations on behalf of the real object.
The various terminologies related to ES6 proxies are given below
handler
Placeholder object which contains traps
traps
The methods that provide property access. This is analogous to the concept of traps in operating systems
target
Object which the proxy virtualizes. It is often used as storage backend for the proxy.
The syntax stated below is for the Proxy API, where, target can be any sort of object like array, function or another proxy and handler is an object whose properties are functions. This defines the behavior of the proxy.
const proxy = new Proxy(target,handler)

The handler object contains traps for Proxy. All traps are optional. If a trap has not been defined, the default behavior is to forward the operation to the target. Some common handler methods are as follows −
A trap for a function call.
A trap for the new operator.
A trap for getting property values.
A trap for setting property values.
TA trap for the in operator.

    32 Lectures 
     3.5 hours 

 Sharad Kumar

    40 Lectures 
     5 hours 

 Richa Maheshwari

    16 Lectures 
     1 hours 

 Anadi Sharma

    50 Lectures 
     6.5 hours 

 Gowthami Swarna

    14 Lectures 
     1 hours 

 Deepti Trivedi

    31 Lectures 
     1.5 hours 

 Shweta
 Print
 Add Notes
 Bookmark this page