code-rag-bench/online-tutorials huggingface dataset:
Creating an Alpine Docker Container

31 Oct, 2020
Alpine is a Linux Distribution. Docker provides you with the low sized (only 5 MB) Alpine Linux Image. The Alpine Linux Docker Image has advantages over the Ubuntu Image because of its relatively lower size and it provides almost all the functionalities that an Ubuntu Image can. In this article, we will see how to build an Alpine Linux Image. We will try to install MySQL client, Python 3, and Firefox inside the Alpine Linux Docker Container as well.
To create the Alpine Docker Container follow the below steps:
To run the Alpine Image Docker Container, you can use the Docker run command.
sudo docker run -it alpine:3


Running the Alpine Container
Once the Image is loaded, it opens up the shell for you automatically.
To install python 3 inside the Alpine Container, you can use the apk add command inside the shell.
apk add python3 


Installing Python 3
You can install the My-SQL client using the following command.
apk add mysql-client


My-SQL Client
To install Firefox inside the Container, you can use the following command.
apk add firefox


Installing Firefox
Step 5: Commit the changes in the Image
You need the Container Id to commit the changes in the Image.
To find the Container ID, use this command.
sudo docker ps -a


Copy the Container ID and paste it in this command.
sudo docker commit eacdf78d1bde my-alpine


“my-alpine” is the new image name.
You can verify by listing the images.
sudo docker images 


Docker commit
Docker Container
linux
Advanced Computer Subject
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python | Pandas Dataframe.rank()

17 Sep, 2018
Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric python packages. Pandas is one of those packages and makes importing and analyzing data much easier.
Pandas Dataframe.rank() method returns a rank of every respective index of a series passed. The rank is returned on the basis of position after sorting.
Syntax:DataFrame.rank(axis=0, method=’average’, numeric_only=None, na_option=’keep’, ascending=True, pct=False)
Parameters:axis: 0 or ‘index’ for rows and 1 or ‘columns’ for Column.method: Takes a string input(‘average’, ‘min’, ‘max’, ‘first’, ‘dense’) which tells pandas what to do with same values. Default is average which means assign average of ranks to the similar values.numeric_only: Takes a boolean value and the rank function works on non-numeric value only if it’s False.na_option: Takes 3 string input(‘keep’, ‘top’, ‘bottom’) to set position of Null values if any in the passed Series.ascending: Boolean value which ranks in ascending order if True.pct: Boolean value which ranks percentage wise if True.
Return type: Series with Rank of every index of caller series.
For link to CSV file Used in Code, click here.
Example #1: Ranking Column with Unique values
In the following example, a new rank column is created which ranks the Name of every Player. All the values in Name column are unique and hence there is no need to describe a method.
# importing pandas packageimport pandas as pd  # making data frame from csv filedata = pd.read_csv("nba.csv")  # creating a rank column and passing the returned rank seriesdata["Rank"] = data["Name"].rank()  # displaydata  # sorting w.r.t name columndata.sort_values("Name", inplace = True)  # display after sorting w.r.t Name columndata
Output:As shown in the image, a column rank was created with rank of every Name. After the sort_value function sorted the data frame with respect to name, it can be seen that the rank was also sorted since those were ranking of Names only.
Before Sorting – After Sorting – Example #2: Sorting Column with some similar values
In the following example, data frame is first sorted with respect to team name and first the method is default (i.e. average) and hence the rank of same Team players is average. After that min method is also used to see the output.
# importing pandas packageimport pandas as pd  # making data frame from csv filedata = pd.read_csv("nba.csv")  # sorting w.r.t team namedata.sort_values("Team", inplace = True)  # creating a rank column and passing the returned rank series# change method to 'min' to rank by minimumdata["Rank"] = data["Team"].rank(method ='average')  # displaydata
Output:
With method=’average’
 
With method=’min’
Python pandas-dataFrame
Python pandas-dataFrame-methods
Python-pandas
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
turtle.setundobuffer() function in Python

17 May, 2021
The turtle module provides turtle graphics primitives, in both object-oriented and procedure-oriented ways. Because it uses Tkinter for the underlying graphics, it needs a version of Python installed with Tk support.
This function is used to set or disable undobuffer. It takes the size parameter. If the size is an integer an empty undobuffer of a given size is installed. Size gives the maximum number of turtle-actions that can be undone by the undo() function. If the size is None, no undobuffer is present.
Syntax :
turtle.setundobuffer(size)
Below is the implementation of the above method with some examples :
Example 1 :
Python3
# importing packageimport turtle # check default value of undobufferprint(turtle.undobufferentries()) # set undo buffer by 10 as valueturtle.setundobuffer(10) # loop executes 50 times with# turtle.forward(1) statement# i.e; undobufferentries gives 50for i in range(50):      turtle.forward(1)     # but gives 10 as it is set alreadyprint(turtle.undobufferentries())
  
Output :
 
0
10
 
Example 2 :
 
Python3
# importing packageimport turtle # print default valueprint(turtle.undobufferentries()) # loop for motionfor i in range(50):       # one statement increase the    # undobuffer entries    turtle.fd(1)     # print undobuffer entries ie; 50# due to above loop with one statementprint(turtle.undobufferentries()) # set undobuffer to Noneturtle.setundobuffer(None) # print undobuffer entries# i.e; value set by set undobufferprint(turtle.undobufferentries())
  
Output :
 
0
50
0
 
akshaysingh98088
Python-turtle
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python | os.path.islink() method

12 Jun, 2019
OS module in Python provides functions for interacting with the operating system. OS comes under Python’s standard utility modules. This module provides a portable way of using operating system dependent functionality. os.path module is sub module of OS module in Python used for common path name manipulation.
os.path.islink() method in Python is used to check whether the given path represents an existing directory entry that is a symbolic link or not.
Note: If symbolic links are not supported by the Python runtime then os.path.islink() method always returns False.
Syntax: os.path.islink(path)
Parameter:path: A path-like object representing a file system path. A path-like object is either a string or bytes object representing a path.
Return Type: This method returns a Boolean value of class bool. This method returns True if the given path is a directory entry that is a symbolic link, otherwise returns False.
Create a soft link or symbolic linkIn Unix or Linux, soft link or symbolic link can be created using ln command. Below is the syntax to create a symbolic link at the shell prompt:
$ ln -s {source-filename} {symbolic-filename}

Example:
In above output, file(shortcut).txt is a symbolic link which also shows the file name to which it is linked.
Code: Use of os.path.islink() method to check if the given path is a symbolic link
# Python program to explain os.path.islink() method     # importing os.path module import os.path  # Path path = "/home/ihritik/Documents/file(original).txt"  # Check whether the # given path is a# symbolic linkisLink = os.path.islink(path)print(isLink)    # Pathpath = "/home/ihritik/Desktop/file(shortcut).txt"    # Check whether the # given path is a# symbolic linkisLink = os.path.islink(path)print(isFile)
False
True

Reference: https://docs.python.org/3/library/os.path.html
Python OS-path-module
python-os-module
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Setup Sublime Text 3 for Python in Windows?

01 Jun, 2020
Written by a Google engineer sublime text is a cross-platform IDE developed in C++ and Python. It has basic built-in support for Python. Sublime text is fast and you can customize this editor as per your need to create a full-fledged Python development environment. You can install packages such as debugging, auto-completion, code linting, etc. There are also various packages for scientific development, Django, Flask, and so on.
Sublime Text 3 can be downloaded from its official site sublimetext.com. To install sublime text 3 on Windows, go through How to install Sublime Text 3 in Windows?
Step 1: Click the Advanced system settings link.
Step 2: Click Environment Variables. In the section System Variables, find the PATH environment variable and select it. Click Edit. If the PATH environment variable does not exist, click New.
Step 3: In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable. Click OK. Close all remaining windows by clicking OK.
Step 1: Create a new file and save it with extension .py for example save it as checkversion.py. Now, Go to Tools -> Build System -> Python then type on your checkversion.pyThis is showing the version of python. This means python is successfully installed and added in Environment Variable.
Step 2: Add new build system on your Sublime Tools -> Build System -> New Build System and make sure that the new build system has this following command
{ "cmd":["C:/Users/<user>/AppData/Local/Programs/Python/Python37-32/python.exe", "-u", "$file"], "file_regex": "^[ ]File \"(...?)\", line ([0-9]*)", "selector": "source.python"}
Select your new system build newPython3 and re-run the checkversion.py and now it should be using Python 3
ALL Done...Now create any file and save it with .py extension
Now you can run your Python code by using CTRL+SHIFT+B and choose from the 2 options.
How To
Python
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Oracle DataBase – Grant Privileges to a User in SQL Command Line

12 Jan, 2022
As we create a new user in the Oracle database, we first need to grant it the required privileges. After that only we can use that user to perform any task, provided that task comes under the role of privileges provided to it. This is illustrated below. For this article, we will be using the SQL Command-Line.
Step 1: Open the SQL Command Line by typing run in the Search toolbar and selecting the option of Run as administrator. The SQL Command Line opens.
Step 2: The following screen appears after clicking “Yes” on the dialog box which appears after step 1.
Output:
Step 3: Connect to the oracle database using CONNECT command.
Query:
CONNECT
Hit ENTER after typing the command.
Output:
Step 4: Login using the default user i.e. the SYSTEM user. So type in the user-name as SYSTEM and then type in the correct password and hit Enter. 
Note: The password for the SYSTEM user is set during Oracle installation.
Output:
Step 5: Now, we create a new user named GFG.
Syntax:
CREATE USER NEW_USER_NAME INENTIFIED BY PASSWORD;
Query:
CREATE USER NEWUSERGFG INENTIFIED BY GFGQWERTY;
Note: Here, we set the password as GFGQWERTY.
Output:
Step 6: Now, we close this session and reopen the SQL Command Line using Steps 1 and 2. We try to CONNECT to the session using NEWUSERGFG user-name. An error is thrown as the user NEWUSERGFG doesn’t have the privilege to start a session.
Query:
CONNECT
Output:
Step 7: Again connect using SYSTEM user-name. Now we shall enable all the privileges to NEWUSERGFG users.
Syntax:
GRANT ALL PRIVILEGES TO NEW_USER_NAME;
Query:
GRANT ALL PRIVILEGES TO NEWUSERGFG;
Step 8: We test the last step by re-attempting to connect using NEWUSERGFG user-name.
Query:
CONNECT
Note: The connection is successfully established this time and Connected is displayed.
Step 9: Create a table named NEWSAMPLETABLE containing 2 columns i.e. ID and NAME. This further establishes a successful connection.
Query:
CREATE TABLE NEWSAMPLETABLE(
ID INT,
NAME VARCHAR2(10)
);
Oracle
Picked
SQL-Query
SQL-Server
SQL
Oracle
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Calculate IP Subnet Address with ipcalc Tool ?

30 May, 2021
Subnetting is something you’ll have to deal with if you’re doing any kind of moderate to advanced networking. While some people can do the binary math in their heads to figure out the correct subnet-mask, others may find it difficult to calculate. For those people, Ipcalc is a Linux utility that may assist them to compute the number of subnets, the subnetting mask, and other IP addressing-related information.
Ipcalc determines the broadcast, network, Cisco wildcard mask, and host range from an IP address and netmask. You can create subnets and supernets by specifying a second netmask. It’s also meant to be a teaching tool. Therefore, the subnetting results are presented as simple binary values.
Formats for multiple addresses and netmask output (dotted quad, hex, number of bits).
Broadcast address, network class, Cisco wildcard, hosts/range, and network range are all output.
Bitmaps of various types are output.
A user-defined number of extra networks are output.
Multiple networks can be accessed using the command line.
Hostname DNS resolutions.
To install Ipcalc in Ubuntu/Debian-based Linux, open terminal and run the following command:
$ sudo apt-get install ipcalc
Use ipcalc to find out everything you need to know about your IP address:
$ ipcalc 192.168.1.27
To calculate subnet for 192.168.1.0/24 use the following command: 
$ ipcalc 192.168.1.0/24
To calculate a single subnet, use the following command: 
$ ipcalc  192.168.1.0 -s 5
Assume you want to split 192.168.1.0 into three subnets, with a total of 50 hosts. In each segment, specify your network mask and the number of hosts.
$ ipcalc 192.168.1.0 -s 10 20 20
Linux-Tools
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
JavaTuples setValue() method

27 Aug, 2018
The setValue() method in org.javatuples is used to set the value in the LabelValueClassObject or KeyValueClassObject. This method can be used with only LabelValue class or KeyValue class of javatuples library. It returns another ClassObject with the value as the element passed as the parameter, and the key or label from the previous ClassObject.
Method Declaration:
public <X> LabelValue<A, X> setValue(X value)
Syntax:
LabelValue<A, B> LabelValueClassObject = LabelValue.setValue(X value)
Return Value: This method returns another LabelValueClassObject with the value as the element passed as the parameter, and the label from the previous LabelValueClassObject.
Below is the program that will illustrate the various ways to use setValue() method in LabelValue Class:
Example:
// Below is a Java program to set// Value in a LabelValue pair  import java.util.*;import org.javatuples.LabelValue;  class GfG {    public static void main(String[] args)    {        // Creating a LabelValue object        LabelValue<Integer, String> lv            = LabelValue.with(Integer.valueOf(1),                              "A computer science portal");          // Using setValue() method        LabelValue<Integer, Integer> lv1 = lv.setValue(Integer.valueOf(2));          // Printing the returned LabelValue        System.out.println(lv1);    }}
Output:
[1, 2]

Method Declaration:
public <X> KeyValue<A, X> setValue(X value)
Syntax:
KeyValue<A, B> KeyValueClassObject = KeyValue.setValue(X value)
Return Value: This method returns another KeyValueClassObject with the value as the element passed as the parameter, and the key from the previous KeyValueClassObject.
Below is the program that will illustrate the various ways to use setValue() method in KeyValue Class:
Example:
// Below is a Java program to set// Value in a KeyValue pair  import java.util.*;import org.javatuples.KeyValue;  class GfG {    public static void main(String[] args)    {        // Creating a KeyValue object        KeyValue<Integer, String> kv            = KeyValue.with(Integer.valueOf(1),                            "A computer science portal");          // Using setValue() method        KeyValue<Integer, String> kv1 = kv.setValue("GeeksforGeeks");          // Printing the returned KeyValue        System.out.println(kv1);    }}
Output:
[1, GeeksforGeeks]

Java-Functions
JavaTuples
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Program to Subtract two 8 Bit numbers in 8051 Microprocessor

Now, in this section we will see how to subtract two 8-bit numbers using 8051 microcontroller. The register A (Accumulator) is used as one operand in the operations. There are seven registers R0 – R7 in different register banks. We can use any of them as second operand.
We are taking two number 73H and BDH at location 20H and 21H, After subtracting the result will be stored at location 30H and 31H.
      MOV R0, #20H ; set source address 20H to R0
      MOV R1, #30H ; set destination address 30H to R1
      MOV A, @R0 ; take the value from source to register A
      MOV R5, A ; Move the value from A to R5
      MOV R4, #00H ; Clear register R4 to store borrow
      INC R0 ; Point to the next location
      MOV A, @R0 ; take the value from source to register A
      MOV R3, A ; store second byte
      MOV A, R5 ;get back the first operand
      SUBB A, R3 ; Subtract R3 from A
      JNC SAVE
      INC R4 ; Increment R4 to get borrow
      MOV B, R4 ; Get borrow to register B
      MOV @R1, B ; Store the borrow first
      INC R1 ; Increase R1 to point to the next address
SAVE: MOV @R1, A ; Store the result
HALT: SJMP HALT ; Stop the program
So by subtracting 73H – BDH, the result will be B6H. At location 30H, we will get 01H. This indicates that the result is negative. The get the actual value from result B6H, we have to perform 2’s complement operation. After performing 2’s Complement, the result will be -4AH.
Python program maximum of three.

Given three number a b and c, our task is that we have to find the maximum element in among in given number.
Input: a = 2, b = 4, c = 3
Output: 4 

Step 1: input three user input number.
Step2: Add three numbers to list.
Step 3: Using max() function to find the greatest number max(lst).
Step 4:  And finally we will print maximum number.

def maximum(a, b, c): 
   list = [a, b, c] 
   return max(list) 
# Driven code  
x = int(input("Enter First number"))
y = int(input("Enter Second number"))
z = int(input("Enter Third number"))
print("Maximum Number is ::>",maximum(x, y, z)) 
Enter First number 56
Enter Second number 90
Enter Third number 67
Maximum Number Is ::> 90
Randomly SELECT distinct rows in a MySQL table?

To randomly select rows, use ORDER BY RAND() with LIMIT. Use DISTINCT for distinct rows. Let us first see an example and create a table −
mysql> create table DemoTable
(
   Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,
   Name varchar(40)
);
Query OK, 0 rows affected (0.54 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable(Name) values('John Doe');
Query OK, 1 row affected (0.13 sec)
mysql> insert into DemoTable(Name) values('Chris Brown');
Query OK, 1 row affected (0.11 sec)
mysql> insert into DemoTable(Name) values('Adam Smith');
Query OK, 1 row affected (0.09 sec)
mysql> insert into DemoTable(Name) values('John Doe');
Query OK, 1 row affected (0.24 sec)
mysql> insert into DemoTable(Name) values('John Doe');
Query OK, 1 row affected (0.23 sec)
mysql> insert into DemoTable(Name) values('Chris Brown');
Query OK, 1 row affected (0.53 sec)
mysql> insert into DemoTable(Name) values('Adam Smith');
Query OK, 1 row affected (0.12 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable;
This will produce the following output −
+----+-------------+
| Id | Name        |
+----+-------------+
|  1 | John Doe    |
|  2 | Chris Brown |
|  3 | Adam Smith  |
|  4 | John Doe    |
|  5 | John Doe    |
|  6 | Chris Brown |
|  7 | Adam Smith  |
+----+-------------+
7 rows in set (0.00 sec)
Following is the query to randomly select two distinct rows in a table −
mysql> select distinct Name from DemoTable order by rand() limit 3;
This will produce the following output −
+-------------+
| Name        |
+-------------+
| Chris Brown |
| John Doe    |
| Adam Smith  |
+-------------+
3 rows in set (0.00 sec)
Data Structure & Algorithms - Tree Traversal

Traversal is a process to visit all the nodes of a tree and may print their values too. Because, all nodes are connected via edges (links) we always start from the root (head) node. That is, we cannot randomly access a node in a tree. There are three ways which we use to traverse a tree −
In-order Traversal
Pre-order Traversal
Post-order Traversal
Generally, we traverse a tree to search or locate a given item or key in the tree or to print all the values it contains.
In this traversal method, the left subtree is visited first, then the root and later the right sub-tree. We should always remember that every node may represent a subtree itself.
If a binary tree is traversed in-order, the output will produce sorted key values in an ascending order.
We start from A, and following in-order traversal, we move to its left subtree B. B is also traversed in-order. The process goes on until all the nodes are visited. The output of inorder traversal of this tree will be −
D → B → E → A → F → C → G
Until all nodes are traversed −
Step 1 − Recursively traverse left subtree.
Step 2 − Visit root node.
Step 3 − Recursively traverse right subtree.

In this traversal method, the root node is visited first, then the left subtree and finally the right subtree.
We start from A, and following pre-order traversal, we first visit A itself and then move to its left subtree B. B is also traversed pre-order. The process goes on until all the nodes are visited. The output of pre-order traversal of this tree will be −
A → B → D → E → C → F → G
Until all nodes are traversed −
Step 1 − Visit root node.
Step 2 − Recursively traverse left subtree.
Step 3 − Recursively traverse right subtree.

In this traversal method, the root node is visited last, hence the name. First we traverse the left subtree, then the right subtree and finally the root node.
We start from A, and following Post-order traversal, we first visit the left subtree B. B is also traversed post-order. The process goes on until all the nodes are visited. The output of post-order traversal of this tree will be −
D → E → B → F → G → C → A
Until all nodes are traversed −
Step 1 − Recursively traverse left subtree.
Step 2 − Recursively traverse right subtree.
Step 3 − Visit root node.

To check the C implementation of tree traversing, please click here.

    42 Lectures 
     1.5 hours 

 Ravi Kiran

    141 Lectures 
     13 hours 

 Arnab Chakraborty

    26 Lectures 
     8.5 hours 

 Parth Panjabi

    65 Lectures 
     6 hours 

 Arnab Chakraborty

    75 Lectures 
     13 hours 

 Eduonix Learning Solutions

    64 Lectures 
     10.5 hours 

 Eduonix Learning Solutions
 Print
 Add Notes
 Bookmark this page
\circ - Tex Command

\circ - Used to draw circle symbol.
{ \circ }
\circ command draws circle symbol.

(f\circ g)(x) = f(g(x)) 

(f∘g)(x)=f(g(x))


45^\circ 

45∘



(f\circ g)(x) = f(g(x)) 

(f∘g)(x)=f(g(x))


(f\circ g)(x) = f(g(x)) 
45^\circ 

45∘


45^\circ 

    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
MATLAB - continue Statement

The continue statement is used for passing control to next iteration of for or while loop.
The continue statement in MATLAB works somewhat like the break statement. Instead of forcing termination, however, 'continue' forces the next iteration of the loop to take place, skipping any code in between.
Create a script file and type the following code −
a = 9;
%while loop execution 
while a < 20
   a = a + 1; 
   if a == 15
      % skip the iteration 
      continue;
   end 
fprintf('value of a: %d\n', a);
end
When you run the file, it displays the following result −
value of a: 10
value of a: 11
value of a: 12
value of a: 13
value of a: 14
value of a: 16
value of a: 17
value of a: 18
value of a: 19
value of a: 20


    30 Lectures 
     4 hours 

 Nouman Azam

    127 Lectures 
     12 hours 

 Nouman Azam

    17 Lectures 
     3 hours 

 Sanjeev

    37 Lectures 
     5 hours 

 TELCOMA Global

    22 Lectures 
     4 hours 

 TELCOMA Global

    18 Lectures 
     3 hours 

 Phinite Academy
 Print
 Add Notes
 Bookmark this page
How to Create and Assign Lists in Python?

We can Create and Assign List by Insert, Append Length, Index, Remove and Extend, etc.. 
Lists are mutable and the changeble object is enclosed within the square brackets i.e [ ], Lists in python is easy.
list =["Tutorials ","Point", "Pvt","Ltd"]
list
['Tutorials ', 'Point', 'Pvt', 'Ltd']

Assign Values in Lists To assign values in lists, use square brackets
list1 = ['physics', 'chemistry', 1997, 2000];
list2 = [1, 2, 3, 4, 5, 6, 7 ];
print ("list1[0]: ", list1[0])
print ("list2[1:5]: ", list2[1:5])
When the above code is executed, Following is the preceding output
list1[0]: physics
list2[1:5]: [2, 3, 4, 5]
append() and extend() in python
append add its argument/parameter as a single element at the end of a list.
the list length will increase by one.
list=['Red','Green','Yellow','Purple','White','Black']
list.append('Orange')
print(list)
['Red', 'Green', 'Yellow', 'Purple', 'White', 'Black', 'Orange']

extend() iterates over its parameter adding each element to the list and extending the list
length of the list will increase through the iterable argument
list=['Car','Bike','Scooty','Bus','Metro']
list.extend('Car')
print(list)
When the above code is executed, Following is the preceding output
['Car', 'Bike', 'Scooty', 'Bus', 'Metro', 'C', 'a', 'r']

Index: Index method can search easily, that expects a value is to be searched
list=['Car','Bike','Scooty','Bus','Metro']
list.index('Scooty')
2
HTML - Footer Tag

The HTML <footer> tag specifies a footer for a document or section.
<!DOCTYPE html>
<html>

   <head>
      <title>HTML Footer Tag</title>
   </head>

   <body>
      <header>
         <h1>Simply Easy Learning</h1>
         <p>You're visiting tutorialspoint.com - tutorial hub for simply easy learning.</p>
      </header>
		
      <footer>
         © Copyright 2014, All Rights Reserved
      </footer>
      
   </body>

</html>
This will produce the following result −
You're visiting tutorialspoint.com - tutorial hub for simply easy learning.
Swing Examples - Using radiobuttons

Following example showcase how to use standard radio buttons in a Java Swing application.
We are using the following APIs.
JRadioButton − To create a standard Radio Button.
JRadioButton − To create a standard Radio Button.
JRadioButton.setEnabled(false); − To disable a Radio Button.
JRadioButton.setEnabled(false); − To disable a Radio Button.
JRadioButton.setMnemonic(KeyEvent.VK_C) − To set a keyboard shortcut a Radio Button.
JRadioButton.setMnemonic(KeyEvent.VK_C) − To set a keyboard shortcut a Radio Button.
JRadioButton.setSelected(true) − To set a Radio Button selected.
JRadioButton.setSelected(true) − To set a Radio Button selected.
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.LayoutManager;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;

import javax.swing.JRadioButton;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;

public class SwingTester {
   public static void main(String[] args) {
      createWindow();
   }

   private static void createWindow() {    
      JFrame frame = new JFrame("Swing Tester");
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

      createUI(frame);
      frame.setSize(560, 200);      
      frame.setLocationRelativeTo(null);  
      frame.setVisible(true);
   }

   private static void createUI(final JFrame frame){  
      JPanel panel = new JPanel();
      LayoutManager layout = new FlowLayout();  
      panel.setLayout(layout);       

      JRadioButton radioButton1 = new JRadioButton("Radio Button 1");
      JRadioButton radioButton2 = new JRadioButton("Radio Button 2");
      radioButton2.setEnabled(false);
      JRadioButton radioButton3 = new JRadioButton("Radio Button 3");
      radioButton3.setMnemonic(KeyEvent.VK_C);

      radioButton1.addActionListener(new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent e) {
            Object source = e.getSource();
            JOptionPane.showMessageDialog(frame, 
               ((JRadioButton)source).getText() + ": " + ((JRadioButton)source).isSelected());
         }
      });  

      panel.add(radioButton1);
      panel.add(radioButton2);
      panel.add(radioButton3);

      frame.getContentPane().add(panel, BorderLayout.CENTER);    
   }
}
 Print
 Add Notes
 Bookmark this page
Java program to print a Fibonacci series

Fibonacci Series generates subsequent number by adding two previous numbers. Fibonacci series starts from two numbers − F0 &amp; F1. The initial values of F0 &amp; F1 can be taken 0, 1 or 1, 1 respectively.
Fn = Fn-1 + Fn-2
1. Take integer variable A, B, C
2. Set A = 1, B = 1
3. DISPLAY A, B
4. C = A + B
5. DISPLAY C
6. Set A = B, B = C
7. REPEAT from 4 - 6, for n times
Live Demo
public class FibonacciSeries2{
   public static void main(String args[]) {
      int a, b, c, i, n;
      n = 10;
      a = b = 1;
      System.out.print(a+" "+b);
      for(i = 1; i <= n-2; i++) {
         c = a + b;
         System.out.print(" ");
         System.out.print(c);
         a = b;
         b = c;
      }
   }
}
1 1 2 3 5 8 13 21 34 55
Increment and Decrement Operators in C#

Increment operator increases integer value by one i.e.
int a = 10;
a++;
++a;
Decrement operator decreases integer value by one i.e.
int a = 20;
a--;
--a;
The following is an example demonstrating increment operator −
 Live Demo
using System;

class Program {
   static void Main() {
      int a, b;

      a = 10;
      Console.WriteLine(++a);
      Console.WriteLine(a++);

      b = a;
      Console.WriteLine(a);
      Console.WriteLine(b);
   }
}
11
11
12
12
The following is an example demonstrating decrement operator −
int a, b;
a = 10;

// displaying decrement operator result
Console.WriteLine(--a);
Console.WriteLine(a--);

b = a;
Console.WriteLine(a);
Console.WriteLine(b);
Create a Radar Chart using Recharts in ReactJS - GeeksforGeeks

28 Jul, 2021
Introduction: Rechart JS is a library that is used for creating charts for React JS. This library is used for building Line charts, Bar charts, Pie charts, etc, with the help of React and D3 (Data-Driven Documents).
Approach: To create Radar chart using Recharts, we create a dataset with label and polar coordinate details. Then we create a polar grid and both axes i.e. polarAngle axis and polarRadius axis using data coordinates. Finally using the Radar element draws the Radar plot.
Creating React Application And Installing Module:
Step 1: Create a React application using the following command.npx create-react-app foldername 
Step 1: Create a React application using the following command.
npx create-react-app foldername
 
Step 2: After creating your project folder i.e. foldername, move to it using the following command.cd foldername
Step 2: After creating your project folder i.e. foldername, move to it using the following command.
cd foldername
Step 3: After creating the ReactJS application, Install the required modules using the following command.npm install --save recharts
Step 3: After creating the ReactJS application, Install the required modules using the following command.
npm install --save recharts
Project Structure: It will look like the following.
Example: Now write down the following code in the App.js file. Here, App is our default component where we have written our code.
App.js
import React from 'react';import { Radar, RadarChart, PolarGrid,     PolarAngleAxis, PolarRadiusAxis } from 'recharts';  const App = () => {      // Sample data    const data = [        { name: 'A', x: 21 },        { name: 'B', x: 22 },        { name: 'C', x: -32 },        { name: 'D', x: -14 },        { name: 'E', x: -51 },        { name: 'F', x: 16 },        { name: 'G', x: 7 },        { name: 'H', x: -8 },        { name: 'I', x: 9 },    ];      return (        <RadarChart height={500} width={500}             outerRadius="80%" data={data}>            <PolarGrid />            <PolarAngleAxis dataKey="name" />            <PolarRadiusAxis />            <Radar dataKey="x" stroke="green"                 fill="green" fillOpacity={0.5} />        </RadarChart>    );}  export default App;
Step to Run the Application: Run the application using the following command from the root directory of the project:
npm start
Output: Now open your browser and go to http://localhost:3000/, you will see the following output:
Output
React-Questions
Recharts
JavaScript
ReactJS
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Difference between var, let and const keywords in JavaScript
Difference Between PUT and PATCH Request
Remove elements from a JavaScript Array
How to get character array from string in JavaScript?
How to filter object array based on attributes?
How to fetch data from an API in ReactJS ?
How to redirect to another page in ReactJS ?
How to pass data from child component to its parent in ReactJS ?
How to pass data from one component to other component in ReactJS ?
ReactJS Functional Components
How to create JFrame with no border and title bar in Java?

To create a JFrame with no border and title bar, use setUndecorated() −
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setPreferredSize(new Dimension(400, 300));
frame.setUndecorated(true);
The following is an example to create JFrame with no border and title bar −
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class SwingDemo {
   public static void main(String[] args) {
      JFrame frame = new JFrame();
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.setPreferredSize(new Dimension(400, 300)); frame.setUndecorated(true);
      JPanel panel = new JPanel();
      panel.add(new JLabel("Demo!"));
      panel.add(new JButton(new AbstractAction("Close") {
         @Override
         public void actionPerformed(ActionEvent e) {
            System.exit(0);
         }
      }));
      frame.add(panel);
      frame.pack();
      frame.setVisible(true);
   }
}
Introduction to Classes and Inheritance in Python

Object-oriented programming creates reusable patterns of code to prevent code redundancy in projects. One way that recyclable code is created is through inheritance, when one subclass leverages code from another base class.
Inheritance is when a class uses code written within another class.
Classes called child classes or subclasses inherit methods and variables from parent classes or base classes.
Because the Child subclass is inheriting from the Parent base class, the Child class can reuse the code of Parent, allowing the programmer to use fewer lines of code and decrease redundancy.
Derived classes are declared much like their parent class; however, a list of base classes to inherit from is given after the class name −
class SubClassName (ParentClass1[, ParentClass2, ...]):
   'Optional class documentation string'
   class_suite
class Parent:        # define parent class
   parentAttr = 100
   def __init__(self):
      print "Calling parent constructor"
   def parentMethod(self):
      print 'Calling parent method'
   def setAttr(self, attr):
      Parent.parentAttr = attr
   def getAttr(self):
      print "Parent attribute :", Parent.parentAttr
class Child(Parent): # define child class
   def __init__(self):
      print "Calling child constructor"
   def childMethod(self):
      print 'Calling child method'
c = Child()          # instance of child
c.childMethod()      # child calls its method
c.parentMethod()     # calls parent's method
c.setAttr(200)       # again call parent's method
c.getAttr()          # again call parent's method
When the above code is executed, it produces the following result 
Calling child constructor
Calling child method
Calling parent method
Parent attribute :200
How to create an infinite loop in C#?

An infinite loop is a loop that never terminates and repeats indefinitely.
Let us see an example to create an infinite loop in C#.
using System;
namespace Demo {
   class Program {
      static void Main(string[] args) {
         for (int a = 0; a < 50; a--) {
            Console.WriteLine("value : {0}", a);
         }
         Console.ReadLine();
      }
   }
}
Above, the loop executes until a < 50. The value of is set to 0 initially.
int a = 0;
The value of a decrements after each iteration since it is set to.
a--;
Therefore the value of a will never be above 50 and the condition a <50 will be true always. This will make the loop an infinite loop.
What is a static storage class in C language?

There are four storage classes in C programming language, which are as follows −
auto
extern
static
register
The keyword is static.
Scope of a static variable is that it retains its value throughout the program and in between function calls.
Scope of a static variable is that it retains its value throughout the program and in between function calls.
Static variables are initialised only once.
Static variables are initialised only once.
Default value is zero.
Following is the C program for static storage class −
 Live Demo
#include<stdio.h>
main ( ){
   inc ( );
   inc ( );
   inc ( );
}
inc ( ){
   static int i =1;
   printf ("%d", i);
   i++;
}
The output is stated below −
1 2 3
Following is another C program for static storage class −
 Live Demo
#include<stdio.h>
main ( ){
   inc ( );
   inc ( );
   inc ( );
}
inc ( ){
   auto int i=1;
   printf ("%d", i);
   i++;
}
The output is stated below −
1 1 1
Following is the third example of the C program for static storage class −
 Live Demo
#include <stdio.h>
//function declaration
void function();
int main(){
   function();
   function();
   return 0;
}
//function definition
void function(){
   static int value= 1; //static variable declaration
   printf("\nvalue = %d ", value);
   value++;
}
The output is stated below −
value = 1
value =2
Number to word conversion

This algorithm will convert a given number into English words. Like 564 will be Five Hundred and Sixty-Four. 
For this algorithm, some predefined strings are given, from that list, it will get the proper words to make into words.
The lists are like
 Units: it will hold all words for (0 to 9) like Zero, One...Nine
 twoDigits: it will hold all numbers from (10 - 19), like Ten, eleven...Nineteen
tenMul: For ten multiples, (20-90), like Twenty, Thirty, ... Ninety.
tenPower: It is for Hundred and Thousands as power 2 and 3 of 10
Input:
The number: 568
Output:
Five Hundred And Sixty Eight
numToWord(num)
there are some lists which hold the words for different integers
Input: The number.
Output: Represent number into words.
Begin
   if n >= 0 and n < 10, then
      display units(n) into words
   else if n >= 10 and n < 20, then
      display twoDigitNum(n) into words         //It is from ten to nineteen
   else if n >= 20 and n <100, then
      display tensMultiple(n/10), into words
      if n mod 10 ≠ 0, then
         numToWord(n mod 10)
   else if n >= 100 and n < 1000, then
      display units(n/100), into words
      display “Hundred”, into words      //Hundred
      if n mod 100 ≠ 0, then
         display “And”
         numToWord(n mod 100)
      else if n >= 1000 and n <= 32767, then
         numToWord(n/1000)
         display “Thousand”
         if n mod 1000 ≠ 0, then
            numToWord(n mod 1000)
      else
         display invalid number and exit
End

#include<iostream>
using namespace std;

string getUnit(int n) {
    //Return single digit to word
   string unit[10] = {"Zero", "One","Two", "Three","Four","Five", "Six","Seven","Eight","Nine"};
   return unit[n];
}

string getTwoDigits(int n) {
   //Here n is 2 digit number
   string td[10] = {"Ten", "Eleven","Twelve","Thirteen", "Fourteen","Fifteen","Sixteen","Seventeen","Eighteen","Nineteen"};
   return td[n%10];
}

string getTenMul(int n) {
   //Here n is multiple of 10
   string tm[8] = {"Twenty", "Thirty","Fourty", "Fifty","Sixty", "Seventy","Eighty","Ninty"};
   return tm[n-2];
}

string getTenPow(int pow) {
   //The power of ten in words
   string power[2] = {"Hundred", "Thousand"};
   return power[pow-2];
}

void printNumToWord(int n) {
   if(n >= 0 && n < 10)
      cout << getUnit(n) << " ";      //Unit values to word
   else if(n >= 10 && n < 20)
      cout << getTwoDigits(n) << " ";       //from eleven to nineteen
   else if(n >= 20 && n < 100) {
      cout << getTenMul(n/10)<<" ";
      if(n%10 != 0)
         printNumToWord(n%10); //Recursive call to convert num to word
   }else if(n >= 100 && n < 1000) {
      cout << getUnit(n/100)<<" ";
      cout <<getTenPow(2) << " ";

      if(n%100 != 0) {
         cout << "And ";
         printNumToWord(n%100);
      }

   }else if(n >= 1000 && n <= 32767) {
      printNumToWord(n/1000);
      cout <<getTenPow(3)<<" ";
      if(n%1000 != 0)
         printNumToWord(n%1000);
   }else
      printf("Invalid Input");
}

main() {
   int number;
   cout << "Enter a number between 0 to 32767: "; cin >> number;
   printNumToWord(number);
}
Enter a number between 0 to 32767: 568
Five Hundred And Sixty Eight
Why array index starts from zero in C/C++ ?

An array arr[i] is interpreted as *(arr+i). Here, arr denotes the address of the first array element or the 0 index element. So *(arr+i) means the element at i distance from the first element of the array. So array index starts from 0 as initially i is 0 which means the first element of the array.
A program that demonstrates this in C++ is as follows.
 Live Demo
#include <iostream>
using namespace std;
int main() {
   int arr[] = {5,8,9,3,5};
   int i;
   for(i = 0; i<5; i++)
   cout<< arr[i] <<" ";
   cout<<"\n";
   for(i = 0; i<5; i++)
   cout<< *(arr + i) <<" ";
   return 0;
}
The output of the above program is as follows.
5 8 9 3 5
5 8 9 3 5
Now let us understand the above program.
An array arr[] contains 5 elements. These elements are displayed using a for loop with array representations arr[i] and *(arr + i). The results obtained are identical in both cases. The code snippet that shows this is as follows.
int arr[] = {5,8,9,3,5};
int i;
for(i = 0; i<5; i++)
cout<< arr[i] <<" ";
cout<<"\n";
for(i = 0; i<5; i++)
cout<< *(arr + i) <<" ";
C# program to find common values from two or more Lists

Create more than one list −
// two lists
var list1 = new List<int>{3, 4};
var list2 = new List<int>{1, 2, 3};
Now, use the Intersect() method to get the common values −
var res = list1.Intersect(list2);
The following is the complete code −
 Live Demo
using System.Collections.Generic;
using System.Linq;
using System;

public class Demo {
   public static void Main() {

      // two lists
      var list1 = new List<int>{3, 4};
      var list2 = new List<int>{1, 2, 3};

      // common values
      var res = list1.Intersect(list2);

      foreach(int i in res) {
         Console.WriteLine(i);
      }
   }
}
3
How to make a basic dialog using jQuery UI ? - GeeksforGeeks

18 Jan, 2021
In this article, we will be creating a Basic dialog using jQuery UI.
Approach: First, add jQuery UI scripts needed for your project.
<link href = “https://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css” rel = “stylesheet”><script src = “https://code.jquery.com/jquery-1.10.2.js”></script><script src = “https://code.jquery.com/ui/1.10.4/jquery-ui.js”></script>
Example 1:
HTML
<!doctype html><html lang="en">  <head>    <meta charset="utf-8">    <link href="https://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css"        rel="stylesheet">    <script src="https://code.jquery.com/jquery-1.10.2.js"></script>    <script src="https://code.jquery.com/ui/1.10.4/jquery-ui.js">    </script>      <script>        $(function () {            $("#gfg").dialog({                autoOpen: true,            });            $("#geeks").click(function () {                $("#gfg").dialog("open");            });        });    </script></head>  <body>    <div id="gfg" title="GeeksforGeeks">        jquery UI| basic dialog option    </div>          <button id="geeks">Open Dialog</button></body>  </html>
Output:
Example 2:
HTML
<!doctype html><html lang="en">  <head>    <meta charset="utf-8">    <link href="https://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css"            rel="stylesheet">    <script src="https://code.jquery.com/jquery-1.10.2.js"></script>    <script src="https://code.jquery.com/ui/1.10.4/jquery-ui.js">    </script>      <script>        $(function () {            $("#gfg").dialog({                autoOpen: false,            });            $("#geeks").click(function () {                $("#gfg").dialog("open");            });        });    </script></head>  <body>    <div id="gfg" title="GeeksforGeeks">        Jquery UI| basic dialog option    </div>          <button id="geeks">Open Dialog</button></body>  </html>
Output:
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.
jQuery-UI
HTML
JQuery
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
REST API (Introduction)
Design a web page using HTML and CSS
Angular File Upload
Form validation using jQuery
How to auto-resize an image to fit a div container using CSS?
JQuery | Set the value of an input text field
How to change selected value of a drop-down list using jQuery?
Form validation using jQuery
How to change the background color after clicking the button in JavaScript ?
How to Dynamically Add/Remove Table Rows using jQuery ?
MySQL - Modulus Operator(%, MOD)

This operator returns the reminder of the operation (right operator divided by the left operator).
Following is an example of the "%" operator −
mysql> SELECT 62555 MOD 59;
+--------------+
| 62555 MOD 59 |
+--------------+
| 15           |
+--------------+
1 row in set (0.00 sec)
Let us see another example −
mysql> SELECT 6255.55855 MOD 987546.965;
+---------------------------+
| 6255.55855 MOD 987546.965 |
+---------------------------+
|                6255.55855 |
+---------------------------+
1 row in set (0.00 sec)
Assume we have created a table in MySQL using the following quires −
CREATE TABLE data (Name VARCHAR(100), Score INT);
INSERT INTO data values('Raman', 545);
INSERT INTO data values('Rahul' , 250);
INSERT INTO data values('Mohit', 695);
Following query calculates displays whether the score is even or odd −
mysql> SELECT name, IF(score%2, 'Odd', 'Even') as OddOrEven FROM data; MySQL Modulus Operator (%, MOD)
+-------+-----------+
| name | OddOrEven  |
+-------+-----------+
| Raman | Odd       |
| Rahul | Even      |
| Mohit | Odd       |
+-------+-----------+
3 rows in set (0.00 sec)

    31 Lectures 
     6 hours 

 Eduonix Learning Solutions

    84 Lectures 
     5.5 hours 

 Frahaan Hussain

    6 Lectures 
     3.5 hours 

 DATAhill Solutions Srinivas Reddy

    60 Lectures 
     10 hours 

 Vijay Kumar Parvatha Reddy

    10 Lectures 
     1 hours 

 Harshit Srivastava

    25 Lectures 
     4 hours 

 Trevoir Williams
 Print
 Add Notes
 Bookmark this page