code-rag-bench/online-tutorials huggingface dataset:
Selecting data from a MySQL table based on a specific month?

Use the MONTH() method in MySQL to select date based on month. Let us first create a table −
mysql> create table DemoTable
-> (
-> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,
-> UserName varchar(10),
-> UserPostMessageDate datetime,
-> UserLikes int
-> );
Query OK, 0 rows affected (0.77 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable(UserName,UserPostMessageDate,UserLikes)
values('John','2019-01-31',4560);
Query OK, 1 row affected (0.17 sec)

mysql> insert into DemoTable(UserName,UserPostMessageDate,UserLikes)
values('Sam','2019-06-28',790);
Query OK, 1 row affected (0.27 sec)

mysql> insert into DemoTable(UserName,UserPostMessageDate,UserLikes)
values('Carol','2019-05-01',230);
Query OK, 1 row affected (0.18 sec)

mysql> insert into DemoTable(UserName,UserPostMessageDate,UserLikes)
values('David','2019-03-05',10000000);
Query OK, 1 row affected (0.33 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable;
This will produce the following output −
+----+----------+---------------------+-----------+
| Id | UserName | UserPostMessageDate | UserLikes |
+----+----------+---------------------+-----------+
| 1  | John     | 2019-01-31 00:00:00 | 4560      |
| 2  | Sam      | 2019-06-28 00:00:00 | 790       |
| 3  | Carol    | 2019-05-01 00:00:00 | 230       |
| 4  | David    | 2019-03-05 00:00:00 | 10000000  |
+----+----------+---------------------+-----------+
4 rows in set (0.00 sec)
Following is the query to select data from a table based on a specific month −
mysql> select Id,UserName,UserLikes from DemoTable where MONTH(UserPostMessageDate)=6;
This will produce the following output −
+----+----------+-----------+
| Id | UserName | UserLikes |
+----+----------+-----------+
| 2  | Sam      | 790       |
+----+----------+-----------+
1 row in set (0.00 sec)
Duration parse(CharSequence) method in Java with Examples - GeeksforGeeks

26 Nov, 2018
The parse(CharSequence) method of Duration Class in java.time package is used to get a Duration from a string passed as the parameter. The format for the String to be parsed is “PnDTnHnMn.nS” where “nDT” means ‘n’ number of Days, “nH” means ‘n’ number of Hours, “nM” means ‘n’ number of Minutes and “nS” means ‘n’ number of Seconds. The formats accepted are based on the ISO-8601 duration format.
Syntax:
public static Duration parse(CharSequence text)

Parameters: This method accepts a parameter text which is CharSequence to be parsed into Duration.
Return Value: This method returns a Duration representing the time passed in the form of CharSequence as parameter.
Exception: This method throws DateTimeParseException if the text cannot be parsed to a duration.
Below examples illustrate the Duration.parse() method:
Example 1:
// Java code to illustrate parse() method  import java.time.Duration;  public class GFG {    public static void main(String[] args)    {          // Get the text        String time = "P2DT3H4M";          // Duration using parse() method        Duration duration            = Duration.parse(time);          System.out.println(duration.getSeconds());    }}
183840

Example 2: To demonstrate DateTimeParseException
// Java code to illustrate parse() method  import java.time.Duration;  public class GFG {    public static void main(String[] args)    {          // Get the text        String time = "M";          try {            // Duration using parse() method            Duration duration                = Duration.parse(time);        }        catch (Exception e) {            System.out.println("Exception: " + e);        }    }}
Exception:
 java.time.format.DateTimeParseException:
 Text cannot be parsed to a Duration

Reference: https://docs.oracle.com/javase/9/docs/api/java/time/Duration.html#parse-java.lang.CharSequence-
Java-Duration
Java-Functions
Java-time package
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Initialize an ArrayList in Java
HashMap in Java with Examples
Interfaces in Java
Object Oriented Programming (OOPs) Concept in Java
How to iterate any Map in Java
ArrayList in Java
Multidimensional Arrays in Java
Stack Class in Java
Set in Java
LinkedList in Java
How to sum a variable by group in R? - GeeksforGeeks

01 Apr, 2021
In this article, let’s discusses how to find sum of a variable by the group in R Programming Language. 
Dataset in Use:
Table-1
Expected output:
Group by Category
Create dataframe
Set values to required parameters
Pass to the function in use
Display dataframe
In this method we will take help of aggregate function to sum by group. Aggregate function splits the data into subsets, computes summary statistics for each, and returns the result in a convenient form.
Syntax:
aggregate(x = dataset_Name , by = group_list, FUN = any_function)  # Basic R syntax of aggregate function
Example:
R
GFG <- data.frame(   Category  = c ("A","B","C","B","C","A","C","A","B"),    Frequency= c(9,5,0,2,7,8,1,3,7))  aggregate(x= GFG$Frequency,                       by = list(GFG$Category),                 FUN = sum)                      
Output:
dplyr is a package which provides a set of tools for efficiently manipulating datasets in R
    Methods in dplyr package
mutate() adds new variables that are functions of existing variables
select() picks variables based on their names.
filter() picks cases based on their values.
summarise() reduces multiple values down to a single summary.
arrange() changes the ordering of the rows.
Before using this package you have to install it
Program:
R
library("dplyr")                             GFG <- data.frame(   Category  = c ("A","B","C","B","C","A","C","A","B"),    Frequency= c(9,5,0,2,7,8,1,3,7))GFG%>%                                          group_by(Category) %>%                         summarise_at(vars(Frequency),                               list(name = sum))
Output: 
Picked
R DataFrame-Programs
R-DataFrame
R Language
R Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Change Color of Bars in Barchart using ggplot2 in R
How to Change Axis Scales in R Plots?
Group by function in R using Dplyr
How to Split Column Into Multiple Columns in R DataFrame?
How to filter R DataFrame by values in a column?
How to Split Column Into Multiple Columns in R DataFrame?
How to filter R DataFrame by values in a column?
Replace Specific Characters in String in R
How to filter R dataframe by multiple conditions?
Convert Matrix to Dataframe in R
C program to swap two strings

For swapping two strings from one location to another location, we use strcpy() function.
An array of characters (or) collection of characters is called a string.
Following is the declaration for an array −
char stringname [size];
For example, char string[50]; string of length 50 characters.
Using single character constant
char string[10] = { ‘H’, ‘e’, ‘l’, ‘l’, ‘o’ ,‘\0’}
Using string constants
char string[10] = "Hello":;
There is a control string "%s" used for accessing the string till it encounters ‘\0’
This function is used for copying source string into destination string.
The length of the destination string is greater than or equal to the source string.
The syntax for strcpy() function is as follows −
strcpy (Destination string, Source String);
For example,
char a[50];            char a[50];
strcpy ("Hello",a);    strcpy ( a,"hello");
output: error          output: a= "Hello"
Following is the C program to swap two strings by using strcpy() function −
 Live Demo
#include<stdio.h>
#include<string.h>
main(){
   char s1[10],s2[10],s3[10];
   printf("Enter String 1\n");
   gets(s1);
   printf("Enter String 2\n");
   gets(s2);
   printf("Before Swapping\n");
   printf("String 1 : %s\n",s1);
   printf("String 2 : %s\n",s2);
   strcpy(s3,s1);
   strcpy(s1,s2);
   strcpy(s2,s3);
   printf("After Swapping:\n");
   printf("String 1 : %s\n",s1);
   printf("String 2 : %s\n",s2);
}
When the above program is executed, it produces the following result −
Enter String 1
Tutorial
Enter String 2
Point
Before Swapping
String 1: Tutorial
String 2: Point
After Swapping:
String 1: Point
String 2: Tutorial
Change a MySQL Column datatype from text to timestamp?

To change a MySQL column datatype from text to timestamp, you need to use ALTER command.
The syntax is as follows
ALTER TABLE yourTableName MODIFY COLUMN yourColumnName TIMESTAMP;
To understand the above syntax, let us create a table.
The query to create a table is as follows
mysql> create table textTotimestampdemo
   - > (
   - > Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,
   - > Source text
   - > );
Query OK, 0 rows affected (0.44 sec)
Here is the description of table using DESC command.
The syntax is as follows
DESC yourTableName;
The query is as follows
mysql> desc textTotimestampdemo;
The following is the output
+--------+---------+------+-----+---------+----------------+
| Field  | Type    | Null | Key | Default | Extra          |
+--------+---------+------+-----+---------+----------------+
| Id     | int(11) | NO   | PRI | NULL    | auto_increment |
| Source | text    | YES  |     | NULL    |                |
+--------+---------+------+-----+---------+----------------+
2 rows in set (0.04 sec)
Now change the column text to timestamp with the help of the following query
mysql> alter table textTotimestampdemo modify column Source TIMESTAMP;
Query OK, 0 rows affected (1.25 sec)
Records: 0 Duplicates: 0 Warnings: 0
Now check the description of the table once again.
The query is as follows
mysql> desc textTotimestampdemo;
The following is the output
+--------+-----------+------+-----+---------+----------------+
| Field  | Type      | Null | Key | Default | Extra          |
+--------+-----------+------+-----+---------+----------------+
| Id     | int(11)   | NO   | PRI | NULL    | auto_increment |
| Source | timestamp | YES  |     | NULL    |                |
+--------+-----------+------+-----+---------+----------------+
2 rows in set (0.00 sec)
Look at the column Source above, the datatype has been changed from text to timestamp.
SQL Tryit Editor v1.6

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

The loss of type and dimensions of an array is known as array decay. It occurs when we pass the array into a function by pointer or value. First address is sent to the array which is a pointer. That is why, the size of array is not the original one.
Here is an example of array decay in C++ language,
 Live Demo
#include<iostream>
using namespace std;
void DisplayValue(int *p) {
   cout << "New size of array by passing the value : ";
   cout << sizeof(p) << endl;
}
void DisplayPointer(int (*p)[10]) {
   cout << "New size of array by passing the pointer : ";
   cout << sizeof(p) << endl;
}
int main() {
   int arr[10] = {1, 2, };
   cout << "Actual size of array is : ";
   cout << sizeof(arr) <endl;
   DisplayValue(arr);
   DisplayPointer(&arr);
   return 0;
}
Actual size of array is : 40
New size of array by passing the value : 8
New size of array by passing the pointer : 8
There are two following ways to prevent the array decay.
Array decay is prevented by passing the size of array as a parameter and do not use sizeof() on parameters of array.
Array decay is prevented by passing the size of array as a parameter and do not use sizeof() on parameters of array.
Pass the array into the function by reference. It prevents the conversion of array into pointer and it prevents array decay.
Pass the array into the function by reference. It prevents the conversion of array into pointer and it prevents array decay.
Here is an example of preventing array decay in C++ language,
 Live Demo
#include<iostream>
using namespace std;
void Display(int (&p)[10]) {
   cout << "New size of array by passing reference: ";
   cout << sizeof(p) << endl;
}
int main() {
   int arr[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
   cout << "Actual size of array is: ";
   cout << sizeof(arr) <<endl;
   Display(arr);
   return 0;
}
Actual size of array is: 40
New size of array by passing reference: 40
Scanless - Pentesting Tool to Perform Anonymous open Port Scan on Target Websites - GeeksforGeeks

23 Sep, 2021
The Information Gathering and Scanning phase is incomplete if the tester has not done Port Scanning or Port Detection on the target host. There can be some services that are running on a specific port. These services can be used to penetrate the host. To detect the active ports on the domain, there are various automated tools. Scanless is an automated tool developed in the Python language, which performs port scanning on the target host. Scanless tool uses some famous scanners to scan and fetch the results on the terminal itself. Scanless tool is available on the GitHub platform, it’s a free and open-source tool to use.
yougetsignal
viewdns
hackertarget
ipfingerprints
pingeu
spiderip
portcheckers
t1shopper
Note: Make Sure You have Python Installed on your System, as this is a python-based tool. Click to check the Installation process – Python Installation Steps on Linux
Step 1: Use the following command to install the tool in your Kali Linux operating system.
git clone https://github.com/vesche/scanless.git
Step 2: Now use the following command to move into the directory of the tool. You have to move in the directory in order to run the tool.
cd scanless
Step 3: You are in the directory of the Scanless. Now you have to install the tool by using the following command.
sudo python3 setup.py install
Step 4: All the dependencies have been installed in your Kali Linux operating system. Now use the following command to run the tool and check the help section.
scanless -h
Example 1: To Run Scan 
scanless -t geeksforgeeks.org -s spiderip
In this example, we are using the spiderip scanner to perform port scanning on the target domain geeksforgeeks.org 
We have got the list of active ports on the http://geeksforgeeks.org domain.
Example 2: To list all the supported scanners
scanless -l
In this example, we are listing all the supported scanners by using the ‘-l’ tag
We have listed the available scanners used by the scanless tool
Example 3: scanless -s pingeu -t domain.com
scanless -s pingeu -t geeksforgeeks.org
In this example, we are using the pingeu scanner for port scanning against the target domain geeksforgeeks.org.
We have got the results which show that port 80 and port 443 are open on the http://geeksforgeeks.org domain.
Kali-Linux
Linux-Tools
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
scp command in Linux with Examples
nohup Command in Linux with Examples
mv command in Linux with examples
Thread functions in C/C++
Docker - COPY Instruction
chown command in Linux with Examples
nslookup command in Linux with Examples
SED command in Linux | Set 2
Named Pipe or FIFO with example C program
uniq Command in LINUX with examples
arch command in Linux with examples - GeeksforGeeks

04 Apr, 2019
arch command is used to print the computer architecture. Arch command prints things such as “i386, i486, i586, alpha, arm, m68k, mips, sparc, x86_64, etc.
Syntax:
arch [OPTION]
Example:
Options:
arch –help : It displays help information.
arch –version : It displays version information.
linux-command
Linux-misc-commands
Picked
Technical Scripter 2018
Linux-Unix
Technical Scripter
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
TCP Server-Client implementation in C
ZIP command in Linux with examples
tar command in Linux with examples
SORT command in Linux/Unix with examples
curl command in Linux with Examples
UDP Server-Client implementation in C
'crontab' in Linux with Examples
diff command in Linux with examples
Conditional Statements | Shell Script
Cat command in Linux with examples
Database - Third Normal Form (3NF)

A table is in a third normal form when the following conditions are met −
It is in second normal form.
All nonprimary fields are dependent on the primary key.
The dependency of these non-primary fields is between the data. For example, in the following table – the street name, city and the state are unbreakably bound to their zip code.
CREATE TABLE CUSTOMERS(
   CUST_ID       INT              NOT NULL,
   CUST_NAME     VARCHAR (20)      NOT NULL,
   DOB           DATE,
   STREET        VARCHAR(200),
   CITY          VARCHAR(100),
   STATE         VARCHAR(100),
   ZIP           VARCHAR(12),
   EMAIL_ID      VARCHAR(256),
   PRIMARY KEY (CUST_ID)
);
The dependency between the zip code and the address is called as a transitive dependency. To comply with the third normal form, all you need to do is to move the Street, City and the State fields into their own table, which you can call as the Zip Code table. −
CREATE TABLE ADDRESS(
   ZIP           VARCHAR(12),
   STREET        VARCHAR(200),
   CITY          VARCHAR(100),
   STATE         VARCHAR(100),
   PRIMARY KEY (ZIP)
);
The next step is to alter the CUSTOMERS table as shown below −
CREATE TABLE CUSTOMERS(
   CUST_ID       INT              NOT NULL,
   CUST_NAME     VARCHAR (20)      NOT NULL,
   DOB           DATE,
   ZIP           VARCHAR(12),
   EMAIL_ID      VARCHAR(256),
   PRIMARY KEY (CUST_ID)
);
The advantages of removing transitive dependencies are mainly two-fold. First, the amount of data duplication is reduced and therefore your database becomes smaller.
The second advantage is data integrity. When duplicated data changes, there is a big risk of updating only some of the data, especially if it is spread out in many different places in the database.
For example, if the address and the zip code data were stored in three or four different tables, then any changes in the zip codes would need to ripple out to every record in those three or four tables.

    42 Lectures 
     5 hours 

 Anadi Sharma

    14 Lectures 
     2 hours 

 Anadi Sharma

    44 Lectures 
     4.5 hours 

 Anadi Sharma

    94 Lectures 
     7 hours 

 Abhishek And Pukhraj

    80 Lectures 
     6.5 hours 

 Oracle Master Training | 150,000+ Students Worldwide

    31 Lectures 
     6 hours 

 Eduonix Learning Solutions
 Print
 Add Notes
 Bookmark this page
C++ | Exception Handling | Question 10 - GeeksforGeeks

28 Jun, 2021
Which of the following is true about exception handling in C++?
1) There is a standard exception class like Exception class in Java.2) All exceptions are unchecked in C++, i.e., compiler doesn’t check if the exceptions are caught or not.3) In C++, a function can specify the list of exceptions that it can throw using comma separated list like following.
  void fun(int a, char b) throw (Exception1, Exception2, ..) 
(A) 1 and 3(B) 1, 2 and 3(C) 1 and 2(D) 2 and 3Answer: (B)Explanation: See Comparison of Exception Handling in C++ and JavaQuiz of this Question
C++-Exception Handling
Exception Handling
C Language
C++ Quiz
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Substring in C++
fork() in C
Command line arguments in C/C++
Function Pointer in C
Different methods to reverse a string in C/C++
C++ | new and delete | Question 4
C++ | Inheritance | Question 7
C++ | Operator Overloading | Question 10
C++ | Inheritance | Question 1
C++ | Inheritance | Question 3
Matplotlib histogram with multiple legend entries

To plot a histogram with multiple legend entries, we can take the following steps −
Set the figure size and adjust the padding between and around the subplots.
Create random data using numpy
Plot a histogram using hist() method.
Make a list of colors to color the face of each patch.
Iterate the patches and set face color of each patch.
Create a list of handles to place the legend.
Use legend() method for multiple legend entries.
To display the figure, use show() method.
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.patches import Rectangle

plt.rcParams["figure.figsize"] = [7.50, 3.50]
plt.rcParams["figure.autolayout"] = True

data = np.random.rayleigh(size=1000) * 35
N, bins, patches = plt.hist(data, 30, ec="k")
colors = ["red", "yellow", "green"]

for i in range(0, len(bins)-1):
patches[i].set_facecolor(colors[i % len(colors)])

handles = [Rectangle((0, 0), 1, 1, color=c, ec="k") for c in colors]
labels = ["Red", "Yellow", "Green"]
plt.legend(handles, labels)

plt.show()
Comments in Perl

Comments in any programming language are friends of developers. Comments can be used to make program user-friendly and they are simply skipped by the interpreter without impacting the core functionality. For example, in the above program, a line starting with hash # is a comment.
Simply saying comments in Perl start with a hash symbol and run to the end of the line −
# This is a comment in perl
Lines starting with = are interpreted as the start of a section of embedded documentation (pod), and all subsequent lines until the next =cut are ignored by the compiler. Following is the example −
 Live Demo
#!/usr/bin/perl
# This is a single line comment
print "Hello, world\n";
=begin comment
This is all part of multiline comment.
You can use as many lines as you like
These comments will be ignored by the
compiler until the next =cut is encountered.
=cut
This will produce the following result −
Hello, world
bar() function in C graphics - GeeksforGeeks

30 Jan, 2018
The header file graphics.h contains bar() function which is used to draw a 2-dimensional, rectangular filled in bar.Syntax :
void bar(int left, int top, int right, int bottom);

where,
left specifies the X-coordinate of top left corner,
top specifies the Y-coordinate of top left corner,
right specifies the X-coordinate of right bottom corner,
bottom specifies the Y-coordinate of right bottom corner.

Examples :
Input : left = 150, top = 150, 
        right = 190, bottom = 350

        left = 220, top = 250, 
        right = 260, bottom = 350

        left = 290, top = 200, 
        right = 330, bottom = 350
Output : 


Input : left = 150, top = 250,
        right = 190, bottom = 350

        left = 220, top = 150, 
        right = 260, bottom = 350

        left = 290, top = 200,
        right = 330, bottom = 350
Output : 


Below is the implementation of bar() function.
// C implementation of bar() function#include <graphics.h>  // driver codeint main(){    // gm is Graphics mode which is    // a computer display mode that    // generates image using pixels.    // DETECT is a macro defined in    // "graphics.h" header file    int gd = DETECT, gm;      // initgraph initializes the    // graphics system by loading a    // graphics driver from disk    initgraph(&gd, &gm, "");      // location of sides    int left, top, right, bottom;      // left, top, right, bottom denotes    // location of rectangular bar    bar(left = 150, top = 150,     right = 190, bottom = 350);      bar(left = 220, top = 250,    right = 260, bottom = 350);      bar(left = 290, top = 200,    right = 330, bottom = 350);      // y axis line    line(100, 50, 100, 350);      // x axis line    line(100, 350, 400, 350);      getch();          // closegraph function closes the    // graphics mode and deallocates    // all memory allocated by    // graphics system .    closegraph();          return 0;}
Output:


c-graphics
computer-graphics
C Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Multidimensional Arrays in C / C++
Left Shift and Right Shift Operators in C/C++
Core Dump (Segmentation fault) in C/C++
Function Pointer in C
rand() and srand() in C/C++
Substring in C++
fork() in C
Converting Strings to Numbers in C/C++
std::string class in C++
Enumeration (or enum) in C
HTML | <source> src Attribute - GeeksforGeeks

28 Jun, 2019
The HTML <source> src attribute is used to specify the URL of the media resource. The source element is used as a child element of the <audio> and <video> element.
Syntax:
<source src="URL">
Attribute Values: It contains single value URL which specifies the URL of the media resource. There are two types of URL link which are listed below:
Absolute URL: It points to another webpage.
Relative URL: It points to other files of the same web page.
Below example illustrates the <source> src attribute in HTML:
Example:
<!DOCTYPE html> <html>   <head>     <title>        HTML source src Attribute    </title></head>   <body style="text-align:center;">           <h1 style="color:green;">        GeeksforGeeks    </h1>           <h2>HTML Source src Attribute</h2>       <audio controls>         <source id="mySource" src="gameover.wav"                type="audio/mpeg">           <source src="gameover.ogg" type="audio/ogg">     </audio> </body>   </html>                    
Output:
Supported Browsers: The browser supported by HTML <source> src attribute are listed below:
Google Chrome 4.0
Internet Explorer 9.0
Firefox 3.5
Safari 4.0
Opera 10.5
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.
REST API (Introduction)
HTML Cheat Sheet - A Basic Guide to HTML
Design a web page using HTML and CSS
Form validation using jQuery
Angular File Upload
Remove elements from a JavaScript Array
Installation of Node.js on Linux
Convert a string to an integer in JavaScript
How to fetch data from an API in ReactJS ?
Difference between var, let and const keywords in JavaScript
What is onkeypress event in JavaScript?

The onkeypress event triggers when a key is pressed and released. You can try to run the following code to learn how to work with onkeypress event in JavaScript −
<html>
   <head>
      <script>
         <!--
            function sayHello() {
               alert("A key is pressed.")
            }
         //-->
      </script>
   </head>
   <body>
      <input type = "text" onkeypress = "sayHello()">
   </body>
</html>
CSS | 4 Digit Hex Color - GeeksforGeeks

22 Aug, 2019
The Four Digit Hex Color can be used as the shorthand of 8 Digit Hex Color. Four Digit Hex color can be used to define the color of your elements with the CSS like 8 Digit Hex Color. There are 8 character in 8 digit hex color that shrinks to 4 in 4 digit hex color but performance is the same as the color. In the 4 digits the 4 characters followed by the hash(#) like #RGBA. Here the R define the Red, G define the Green, B define the Blue and the A define the Alpha Channel that effects on how much transparent it will be.Syntax:
#RGBA
Note: Here the Red, Green, and Blue define the colors with less variant compare to 8 and 6 digit hex color and last character represent Alpha channel.Example 1:
<!DOCTYPE html><html>   <head>    <title>CSS 4 Digit Hex Color</title>    <style>        body {            background-color: #666600;        }                   h1 {            color: green;        }                   article {            background-color: #FFF4;            border: 5px solid green;            margin: 15px;            text-align: center;        }    </style></head>   <body>    <article>        <h1>GeeksforGeeks</h1>    </article></body>   </html>
Output:Example 2:
<!DOCTYPE html><html>   <head>    <title>CSS 4 Digit Hex Color</title>       <style>        body {            background-image: url('https://media.geeksforgeeks.org/wp-content/uploads/20190806202057/Screenshot-from-2019-08-02-10-51-372.png');            background-attachment: fixed;            background-size: cover;        }                   h2 {            color: white;        }                   article {            background-color: #FFF2;            border: 2px solid green;            background-position: center center;            text-align: center;        }    </style></head>   <body>    <article>        <h2>GeeksforGeeks</h2>    </article></body>   </html>
Output:
CSS-Properties
CSS
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to set space between the flexbox ?
Design a web page using HTML and CSS
Form validation using jQuery
How to style a checkbox using CSS?
Search Bar using HTML, CSS and JavaScript
Remove elements from a JavaScript Array
Installation of Node.js on Linux
Convert a string to an integer in JavaScript
How to fetch data from an API in ReactJS ?
Difference between var, let and const keywords in JavaScript
How many parameters can a lambda expression have in Java?

The lambda expressions are easy and contain three parts like parameters (method arguments), arrow operator (->) and expressions (method body). The lambda expressions can be categorized into three types: no parameter lambda expressions, single parameter lambda expressions and multiple parameters lambda expressions.
We need to create no parameter lambda expression then start the expression with empty parenthesis.
() -> {
   //Body of no parameter lambda
}
import java.util.function.*;
import java.util.Random;

public class LambdaExpression1 {
   public static void main(String args[]) {
      NumberUtil num = new NumberUtil();
      int randVal = num.getRandomValue(
               () -> {     // no parameter lambda
                   Random random = new Random();
                   return random.nextInt(500);
               });
      System.out.println("The value returned from Lambda is: "+ randVal);
   }
   private static class NumberUtil {
      public int getRandomValue(Supplier<Integer> supplier) {
         return supplier.get();
      }
   }
}
The value returned from Lambda is: 144

We need to create lambda expression with a single parameter then start the expression with a parenthesis of a single argument.
(p1) -> {
   //Body of single parameter lambda
}
import java.util.function.*;

public class LambdaExpression2 {
   public static void main(String args[]) {
      Validator validator = new Validator();
      String city = "Hyderabad";
      boolean isValid = validator.isDataValid(city,
                    (String info) -> {           // single parameter lambda
                       String regx = "^[a-zA-Z0-9]*$";
                       return info.matches(regx);
                    });
      System.out.println(" The value returned from lambda is: "+ isValid);
   }
   private static class Validator {
      public boolean isDataValid(String data, Predicate<String> predicate) {
         return predicate.test(data);
      }
   }
}
The value returned from lambda is: true

We need to create lambda expression with multiple parameters then start the expression with parenthesis of multiple arguments.
(p1,p2) -> {
   //Body of multiple parameter lambda
}
import java.util.function.*;

public class LambdaExpression3 {
   public static void main(String args[]) {
      Message m = new Message();
      m.printStringInteger("Java", 75,
                    (String str, Integer number) -> {     // multiple parameters lambda
                       System.out.println("The values are: "+ str + " "+ number);
                    });
      }
   private static class Message {
      public void printStringInteger(String str, Integer number, BiConsumer<String, Integer> biConsumber) {
         biConsumber.accept(str, number);
      }
   }
}
The values are: Java 75
TypeScript - Number toExponential()

This method returns a string representing the number object in exponential notation.
number.toExponential( [fractionDigits] )

fractionDigits − An integer specifying the number of digits after the decimal point. Defaults to as many digits as necessary to specify the number.
A string representing a Number object in exponential notation with one digit before the decimal point, rounded to fractionDigits digits after the decimal point. If the fractionDigits argument is omitted, the number of digits after the decimal point defaults to the number of digits necessary to represent the value uniquely.
//toExponential() 
var num1 = 1225.30 
var val = num1.toExponential(); 
console.log(val)

On compiling, it will generate the same code in JavaScript.
Its output is as follows −
1.2253e+3


    45 Lectures 
     4 hours 

 Antonio Papa

    41 Lectures 
     7 hours 

 Haider Malik

    60 Lectures 
     2.5 hours 

 Skillbakerystudios

    77 Lectures 
     8 hours 

 Sean Bradley

    77 Lectures 
     3.5 hours 

 TELCOMA Global

    19 Lectures 
     3 hours 

 Christopher Frewin
 Print
 Add Notes
 Bookmark this page
pandas.DataFrame.T() function in Python

11 Oct, 2020
pandas.DataFrame.T property is used to transpose index and columns of the data frame. The property T is somehow related to method transpose().  The main function of this property is to create a reflection of the data frame overs the main diagonal by making rows as columns and vice versa.
Syntax: DataFrame.T
Parameters:copy: If True, the underlying data is copied, otherwise (default).*args, **kwargs: Additional keywords
Returns: The Transposed data frame
Example 1:
Sometimes we need to transpose the data frame in order to study it more accurately. In this situation pandas.DataFrame.T property plays an important role. 
Python3
# Importing pandas moduleimport pandas as pd  # Creating a dictionarydit = {'August': [10, 25, 34, 4.85, 71.2, 1.1],       'September': [4.8, 54, 68, 9.25, 58, 0.9],       'October': [78, 5.8, 8.52, 12, 1.6, 11],       'November': [100, 5.8, 50, 8.9, 77, 10]}  # Converting it to data framedf = pd.DataFrame(data=dit)  # Original DataFramedf
Output:
Transposing the data frame.
Python3
# Transposing the data frame # using dataframe.T propertydf_trans = df.T  print("Transposed Data frame :")df_trans
Output:
In the above example, we transpose the data frame ‘df’ having numeric values/content.
Example 2:
Python3
# Import pandas libraryimport pandas as pd  # initialize list of listsdata = [['Harvey.', 10.5, 45.25, 95.2],        ['Carson', 15.2, 54.85, 50.8],        ['juli', 14.9, 87.21, 60.4],        ['Ricky', 20.3, 45.23, 99.5],        ['Gregory', 21.1, 77.25, 90.9],        ['Jessie', 16.4, 95.21, 10.85]]  # Create the pandas DataFramedf = pd.DataFrame(data, columns=['Name', 'Age', 'Percentage', 'Accuracy'],                  index=['a', 'b', 'c', 'd', 'e', 'f'])  # print dataframe.df
Output:
Transposing the dataframe.
Python3
# Transposing the data frame # using dataframe.T propertydf_trans = df.T  print("Transposed Data frame :")df_trans
Output:
In the above example, we transpose the data frame ‘df’ having mixed up data type. 
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.
List of all Java Keywords

09 Mar, 2022
Keywords or Reserved words are the words in a language that are used for some internal process or represent some predefined actions. These words are therefore not allowed to use as variable names or objects. If we do we will get a compile-time error as shown below as follows:
Illustration:
Java
// Java Program to Illustrate What If We use the keywords as the variable name// Code Contributed by @Shubham Jain class HelloWorld {    public static void main(String[] args)    {         int this = "Hello World!"; // Note "this" is a reserved word in java        System.out.println(this);    } }
Output:
Errors in Code : Compiler Error

prog.java:11: error: not a statement
        int this = "Hello World!"; // Note "this" is a reserved word in java
        ^
prog.java:11: error: ';' expected
        int this = "Hello World!"; // Note "this" is a reserved word in java
           ^
2 errors
Java contains a list of keywords or reserved words which are also highlighted with different colors be it an IDE or editor in order to segregate the differences between flexible words and reserved words. They are listed below in the table with the primary action associated with them. 
Note: 
The keywords const and goto are reserved, even they are not currently in use.
Currently they are no longer supported in Java.
true, false and null look like keywords, but in actual they are literals. However they still can’t be used as identifiers in a program.
These keywords cannot be used as a variable. Check out this article for more on the rules of variable declarations.
2. Keywords in Java (Core Java) | GeeksforGeeks - YouTubeGeeksforGeeks532K subscribers2. Keywords in Java (Core Java) | GeeksforGeeksWatch laterShareCopy linkInfoShoppingTap to unmuteIf playback doesn't begin shortly, try restarting your device.More videosMore videosYou're signed outVideos you watch may be added to the TV's watch history and influence TV recommendations. To avoid this, cancel and sign in to YouTube on your computer.CancelConfirmSwitch cameraShareInclude playlistAn error occurred while retrieving sharing information. Please try again later.Watch on0:000:000:00 / 8:23•Live•<div class="player-unavailable"><h1 class="message">An error occurred.</h1><div class="submessage"><a href="https://www.youtube.com/watch?v=yLhVhi4rxsA" target="_blank">Try watching this video on www.youtube.com</a>, or enable JavaScript if it is disabled in your browser.</div></div>
solankimayank
jainshubham766
varshagumber28
Java-keyword
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to draw text on Image in Android?

This example demonstrates how do I draw text on imagein android.
Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.
Step 2 − Add the following code to res/layout/activity_main.xml.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:tools="http://schemas.android.com/tools"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   android:padding="8dp"
   tools:context=".MainActivity">
   <ImageView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:background="@drawable/image"/>
   <TextView
      android:id="@+id/text"
      android:textStyle="bold|italic"
      android:textSize="24sp"
      android:padding="4dp"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_alignParentBottom="true"
      android:layout_marginBottom="16sp"/>
</RelativeLayout>
Step 3 − Add the following code to src/MainActivity.java
import android.graphics.Color;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
   TextView textView;
   @Override
   protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      textView = findViewById(R.id.text);
      textView.setText("This is the place where i want to live");
      textView.setTextColor(Color.WHITE);
   }
}
Step 4 - Add the following code to androidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
   package="app.com.sample">
   <application
      android:allowBackup="true"
      android:icon="@mipmap/ic_launcher"
      android:label="@string/app_name"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:supportsRtl="true"
      android:theme="@style/AppTheme">
      <activity android:name=".MainActivity">
         <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
         </intent-filter>
      </activity>
   </application>
</manifest>
Let's try to run your application. I assume you have connected your actual Android Mobile device with your computer. To run the app from android studio, open one of your project's activity files and click Run  icon from the toolbar. Select your mobile device as an option and then check your mobile device which will display your default screen –
Click here to download the project code.
How to Install Multiple R Packages? - GeeksforGeeks

25 Mar, 2022
In this article, we will see how to install multiple packages in R Programming Language. Installation can be done in two ways.
Step 1: Open R Studio
Step 2: Navigate to Tools and select the Install packages option 
Step 3: In the Text box packages, enter the package names.
                   
Step 4: Click on install button
Step 5: Find the console after clicking on the install button. If all packages installed successfully the below output will be generated. Otherwise, follow the steps again.
In this method simply specify the packages to be installed as a vector to install.packages() function.
Syntax:
install.packages(c(“package1′′,....,”package n”))
Example
R
install.packages(c("ggplot2","dpylr"))
To load multiple packages at once specify the names of the packages to be loaded to lapply() function.
Syntax:
lapply(c(“package 1′′,...”package n”), require, character.only = TRUE)
Example:
R
lapply(c("dpylr", "ggplot2"), require, character.only = TRUE)
surinderdawra388
how-to-install
Picked
R-Packages
How To
Installation Guide
R Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install FFmpeg on Windows?
How to Set Git Username and Password in GitBash?
How to Add External JAR File to an IntelliJ IDEA Project?
How to Install Jupyter Notebook on MacOS?
How to Check the OS Version in Linux?
Installation of Node.js on Linux
How to Install FFmpeg on Windows?
How to Install Pygame on Windows ?
How to Add External JAR File to an IntelliJ IDEA Project?
How to Install Jupyter Notebook on MacOS?
MySQL SELECT Statement

The SELECT statement is used to select data from a database.
The data returned is stored in a result table, called the result-set.
Here, column1, column2, ... are the field names of the table you want to 
select data from. If you 
want to select all the fields available in the table, use the following syntax:
In this tutorial we will use the well-known Northwind sample database.
Below is a selection from the "Customers" table in the Northwind sample database:
The following SQL statement selects the "CustomerName", "City", and "Country" columns from the "Customers" table:
The following SQL statement selects ALL the columns from the "Customers" table:
The SELECT DISTINCT statement is used to return only distinct (different) values.
Inside a table, a column often contains many duplicate values; and sometimes you only want to list the different (distinct) values.
The following SQL statement selects all (including the duplicates) values from the "Country" column in the "Customers" table:
Now, let us use the SELECT DISTINCT statement and see the result.
The following SQL statement selects only the DISTINCT values from the "Country" column in the "Customers" table:
The following SQL statement counts and returns the number of different (distinct) 
countries in the "Customers" table:
Insert the missing statement to get all the columns from the Customers table.
 * FROM Customers;

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

HTML Form attributes
Tryit: The formmethod attribute
tone() and noTone() in Arduino

The tone function can be used to generate a square wave (50% duty cycle) of a specific frequency on a pin.
The syntax is −
tone(pin, frequency)
pin is the pin number on which to generate the tone. The frequency is specified in Hz.
This function can also take in a third optional argument − the millisecond duration for which the tone should be generated on the pin.
tone(pin,frequency,duration)
If you don’t specify the duration, the tone will continue till the noTone() function is called on the same pin. The syntax of the noTone() function is −
noTone(pin)
where pin is the pin number on which you wish to stop the tone. noTone() will have no effect if there is no tone being generated on the specified pin.
Only one tone can be called at a time, across all pins. Thus, if there is a tone running on pin 6, then trying to generate another tone on pin 5 will have no effect
Only one tone can be called at a time, across all pins. Thus, if there is a tone running on pin 6, then trying to generate another tone on pin 5 will have no effect
The minimum frequency for generating tones is 31 Hz. You can’t generate tones of frequencies below that.
The minimum frequency for generating tones is 31 Hz. You can’t generate tones of frequencies below that.
The tone() function interferes with the PWM output on pins 3 and 11 (except on the Mega board). It is recommended to not use the two together.
The tone() function interferes with the PWM output on pins 3 and 11 (except on the Mega board). It is recommended to not use the two together.