code-rag-bench/online-tutorials huggingface dataset:
HTML | title Attribute

17 Mar, 2022
The title attribute is used to specify extra information about the element. When the mouse moves over the element then it shows the information. Supported Tags: It supports all HTML elements. 
Syntax:  
<element title = "text">
Attribute Value: This attribute contains single value text which is used as the tooltip text for an element. This title is associated with all HTML elements. Example:  
html
<!DOCTYPE html><html> <head>    <title>title attribute</title>    <style>        body {            text-align: center;        }                 h1 {            color: green;        }    </style></head> <body>    <h1>GeeksforGeeks</h1>    <h2>title attribute</h2>     <p title="GeeksforGeeks: A computer science        portal for geeks">      GeeksforGeeks.org    </p> </body> </html>
Output: Before hovering the mouse:  
After hovering the mouse:  
Supported Browsers: The browser supported by title attribute are listed below:  
Chrome
Internet Explorer
Firefox
Opera
Safari
 
hritikbhatnagar2182
HTML-Attributes
HTML-Tags
HTML
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to update Node.js and NPM to next version ?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to insert spaces/tabs in text using HTML/CSS?
REST API (Introduction)
Hide or show elements in HTML using display property
How to set the default value for an HTML <select> element ?
How to set input type date in dd-mm-yyyy format using HTML ?
CSS to put icon inside an input element in a form
Types of CSS (Cascading Style Sheet)
HTTP headers | Content-Type
How to print the Fibonacci Sequence using Python?

Fibonacci series contains numbers where each number is sum of previous two numbers. This type of series is generated using looping statement.
x=0
y=1
fibo=0
while fibo<10:
    fibo=fibo+1
    z=x+y
    print (z)
    x,y=y,z
Above program print 10 numbers in Fibonacci series
1
2
3
5
8
13
21
34
55
89
HTML | DOM Input Email pattern Property

16 Oct, 2019
The Input Email pattern property in HTML DOM is used to set or return the pattern attribute of an email field. It is used to specify the regular expression on which the input elements value is checked against. Use the Global title attribute to describe the pattern for helping the user.
Syntax:
It returns the Input Email pattern property.emailObject.pattern
emailObject.pattern
It is used to set Input Email pattern property.emailObject.pattern = regexp
emailObject.pattern = regexp
Property Values: It contains single value regexp which is used to specify the regular expression that an email field value is checked against.
Return Value: It returns a string value which represents the regular expression that an email field value is checked against.
Example: This example illustrates the use of Input Email pattern property.
<!DOCTYPE html> <html>       <head>     <title>         HTML DOM Input Email pattern Property     </title> </head>       <body style="text-align:center;">       <h1> GeeksforGeeks</h1>       <h2>DOM Input Email pattern Property</h2>       E-mail: <input type="email" id="email" name="myGeeks"        pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2, 4}$">          <br><br>      <button onclick="myGeeks()">         Click Here!     </button>           <p id="GFG" style="font-size:20px;color:green;"></p>           <!-- Script to use Input Email pattern Property -->    <script>         function myGeeks() {             var em = document.getElementById("email").pattern;            document.getElementById("GFG").innerHTML = em;         }     </script> </body>   </html>                    
Output:Before clicking on the Button:After clicking on the Button:
Supported Browsers: The browsers supported by DOM input Email pattern Property are listed below:
Google Chrome
Internet Explorer 10.0
Firefox
Opera
Safari
Tobiaswalter3
HTML-DOM
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Align flex items in the end on different screen sizes in Bootstrap

Use the .justify-content-*-end class to align flex items in the end on different screen sizes like this −
For small screen size, use −
justify-content-sm-end
For medium screen size, use −
justify-content-md-end
For large screen size, use −
justify-content-lg-end
Let us see how to align flex items horizontally on small, medium and large screen sizes −
Live Demo
<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Bootstrap Example</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
  </head>
<body>
  <div class="container mt-3">
    <h3>Form of Tea</h3>
    <div class="d-flex justify-content-sm-end bg-secondary mb-5">
      <div class="p-2 bg-warning">Black Tea</div>
      <div class="p-2 bg-info">Green Tea</div>
      <div class="p-2 bg-secondary">Indian Tea</div>
    </div>
    <div class="d-flex justify-content-md-end bg-secondary mb-5">
      <div class="p-2 bg-info">Black Tea</div>
      <div class="p-2 bg-danger">Green Tea</div>
      <div class="p-2 bg-secondary">Indian Tea</div>
    </div>
    <div class="d-flex justify-content-lg-end bg-secondary mb-5">
      <div class="p-2 bg-primary">Black Tea</div>
      <div class="p-2 bg-warning">Green Tea</div>
      <div class="p-2 bg-danger">Indian Tea</div>
    </div>
 </div>
</body>
</html>
Scala List splitAt() method with example

13 Aug, 2019
The splitAt() method belongs to the value member of the class List. It is utilized to split the given list into a prefix/suffix pair at a stated position.
Method Definition: def splitAt(n: Int): (List[A], List[A])
Where, n is the position at which we need to split.
Return Type: It returns a pair of lists consisting of the first n elements of this list, and the other elements.
Example #1:
// Scala program of splitAt()// method  // Creating objectobject GfG{       // Main method    def main(args:Array[String])    {              // Creating a List         val list = List("a", "b", "c", "d", "e", "f")                  // Applying splitAt method         val result = list.splitAt(3)                  // Displays output        println(result)          }}
(List(a, b, c), List(d, e, f))

Example #2:
// Scala program of splitAt()// method  // Creating objectobject GfG{       // Main method    def main(args:Array[String])    {              // Creating a List         val list = List(1, 2, 3, 4, 5, 6, 7)                  // Applying splitAt method         val result = list.splitAt(4)                  // Displays output        println(result)          }}
(List(1, 2, 3, 4), List(5, 6, 7))

Scala
Scala-list
Scala-Method
Scala
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Package Management in Julia

25 Aug, 2020
Package in Julia is a project which provides reusable functionality that can be used by other Julia projects via import X or using X. Julia uses Git as a repository for itself and for its package and that the installation has a built-in package manager called pkg.jl. It allows multiple registries managed by different parties to interact smoothly. It handles operations such as installing, removing, and updating packages. But it works only if the package is in Julia’s REPL.
If you want to Install a Package in Julia open the Julia Command-Line
Press ], to open the Julia package management environment.
julia> ]


Note:
If you want to know which packages we can install on julia go to this link:
https://juliaobserver.com/packages 
If you want to add a package in Julia then use the add command along with the name of the package to be added. Go through the following command:
(@v1.4) pkg> add DecisionTree


Here we have added DecisionTree package in Julia by using the add command. 
Note: It takes about a minute for the installation to complete.
To remove a package from Julia’s environment, use the rm command which is pre-defined in Julia’s library. Go through the following command:
(@v1.4) pkg> rm DecisionTree


Here we have removed the DecisionTree package in Julia by using rm command. By this command, it will remove the package completely form Julia.
To update all installed packages, use update without any arguments:
(@v1.4) pkg> update


now update DecisionTree with the following command:
(@v1.4) pkg> up DecisionTree


To test a package in Julia, the test command can be used in the following format:
(@v1.4) pkg> test DecisionTree


Pre-defined build command can be used to build a package in Julia.
For example, to build flux package, use the following command:
(@v1.4) pkg> build  Flux


Julia-packages
Picked
Julia
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Vectors in Julia
Getting rounded value of a number in Julia - round() Method
Reshaping array dimensions in Julia | Array reshape() Method
Manipulating matrices in Julia
Storing Output on a File in Julia
Exception handling in Julia
Formatting of Strings in Julia
Tuples in Julia
Creating array with repeated elements in Julia - repeat() Method
Get array dimensions and size of a dimension in Julia - size() Method
MongoDB – Current Date Operator ($currentDate)

10 May, 2020
MongoDB provides different types of field update operators to update the values of the fields of the documents and $currentDate operator is one of them. This operator is used to set the value of a field to the current date (either as a timestamp or as a Date).
The default type of $currentDate operator is a Date.
This operator can also work with embedded/nested documents or arrays.
You can use this operator in methods like update(), updateOne(), etc., according to your requirements.
If the specified field is not found then this operator will add that field in the document.
Syntax:
{ $currentDate: { <field1>: <typeSpecification1>, ... } }
Here, in this method, typeSpecification1 is either a boolean true to set the value of a field to the current date as a Date or a document { $type: "timestamp" } or { $type: "date" } which explicitly specifies the type, here the operator is case-sensitive only accept lowercase “timestamp” or “date”. To specify field in embedded/nested documents with the help of dot notation.
In the following examples, we are working with:
Database: GeeksforGeeksCollection: EmployeeDocument: three documents that contain the details of the employees in the form of field-value pairs.
In the example, we are updating the value of joiningDate field of an employee’s document whose first name is Om.
db.Employee.updateOne({"name.first": "Om"},                       {$currentDate: {joiningDate: true}})
In the example, we are updating the value of joiningDate field of an employee’s document whose first name is .
db.Employee.updateOne({"name.first": "Sumit"},                       {$currentDate: {"personalDetails.joiningDate": true}})
In the example, we are adding a new date field whose value is assigned by the $cuurentDate operator in the employee’s document whose first name is Amu.
db.Employee.updateOne({"name.first": "Amu"},                      {$currentDate: {joiningDate: {$type: "date"}}})
MongoDB
MongoDB-operators
MongoDB
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python | Pandas DataFrame.abs()

09 Mar, 2022
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.dataframe.abs() is one of the simplest pandas dataframe function. It returns an object with absolute value taken and it is only applicable to objects that are all numeric. It does not work with any Nan value either. abs() function can also be used with complex numbers to find their absolute value. For complex numbers, the absolute value is defined as:  
 
Syntax:  DataFrame.abs()
Returns: type of caller
For link to CSV file Used in Code, click hereExample #1: Replace team “Boston Celtics” with “Omega Warrior” in the nba.csv file  
Python3
# importing pandas as pdimport pandas as pd # Making data frame from the csv filedf = pd.read_csv("nba.csv") # Printing the first 10 rows of the# data frame for visualizationdf[:10]
In order to find the absolute value, we also need to have negative values in the dataframe. So, let’s change some values to be negative for the demonstration purpose. 
Python3
# This will set the Number column# to be all negative.df.Number = df.Number*(-1)
Output:  
Now let’s use abs() function to find only the absolute value of the Number column. 
Python3
# Applying abs() value on one column onlydf.Number.abs()
Output:  
  Example #2: Applying abs() on a series with complex numbers. 
Python3
# Importing pandas as pdimport pandas as pd # Creating a seriesser = pd.Series([1.2 + 1j, 2 + 5j, 1 + 8j, 3.2 + 2j]) # let's print the values in seriesser
Python3
# Using abs() function to find the# absolute value of the complex numbersabsolute_values = s.abs() # Print the absolute values of all complex numbersabsolute_values
sagartomar9927
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.
PHP | print_r() Function

26 Apr, 2018
The print_r() function is a built-in function in PHP and is used to print or display information stored in a variable.
Syntax:
print_r( $variable, $isStore )
Parameters: This function accepts two parameters as shown in above syntax and described below.
$variable: This parameter specifies the variable to be printed and is a mandatory parameter.$isStore: This an option parameter. This parameter is of boolean type whose default value is FALSE and is used to store the output of the print_r() function in a variable rather than printing it. If this parameter is set to TRUE then the print_r() function will return the output which it is supposed to print.
$variable: This parameter specifies the variable to be printed and is a mandatory parameter.
$isStore: This an option parameter. This parameter is of boolean type whose default value is FALSE and is used to store the output of the print_r() function in a variable rather than printing it. If this parameter is set to TRUE then the print_r() function will return the output which it is supposed to print.
Return Value: If the $variable is an integer or a float or a string the function prints the value of the variable. If the variable is an array the function prints the array in a format which displays the keys as well as values, a similar notation is used for objects. If the parameter $isStore is set to TRUE then the print_r() function will return a string containing the information which it is supposed to print.
Below programs illustrate the print_r() function:
Program 1:
<?php  // PHP program to illustrate// the print_r() function  // string variable$var1 = "Welcome to GeeksforGeeks";  // integer variable$var2 = 101;  // array variable$arr = array('0' => "Welcome", '1' => "to", '2' => "GeeksforGeeks");  // printing the variablesprint_r($var1);echo"\n";print_r($var2);echo"\n";print_r($arr);  ?>
Output:
Welcome to GeeksforGeeks
101
Array
(
    [0] => Welcome
    [1] => to
    [2] => GeeksforGeeks
)

Program 2:
<?php  // PHP program to illustrate the print_r()// function when $isStore is set to true  // array variable$arr = array('0' => "Welcome", '1' => "to",                     '2' => "GeeksforGeeks");                       // storing output of print_r() function// in another variable$results = print_r($arr, true);   echo $results;  ?>
Output:
Array
(
    [0] => Welcome
    [1] => to
    [2] => GeeksforGeeks
)

Reference:http://php.net/manual/en/function.print-r.php
PHP-input-output
PHP
Web Technologies
PHP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
GATE | GATE-CS-2014-(Set-1) | Question 65

28 Jun, 2021
Consider a hash table with 9 slots. The hash function is h(k) = k mod 9. The collisions are resolved by chaining. The following 9 keys are inserted in the order: 5, 28, 19, 15, 20, 33, 12, 17, 10. The maximum, minimum, and average chain lengths in the hash table, respectively, are
(A) 3, 0, and 1(B) 3, 3, and 3(C) 4, 0, and 1(D) 3, 0, and 2Answer: (A)Explanation: Following are values of hash function for all keys
 5 --> 5
28 --> 1
19 --> 1  [Chained with 28]
15 --> 6
20 --> 2
33 --> 6  [Chained with 15]
12 --> 3
17 --> 8
10 --> 1 [Chained with 28 and 19]
The maximum chain length is 3. The keys 28, 19 and 10 go to same slot 1, and form a chain of length 3.The minimum chain length 0, there are empty slots (0, 4 and 7).Average chain length is (0 + 3 + 1 + 1 + 0 + 1 + 2 + 0 + 1)/9 = 1Quiz of this Question
GATE-CS-2014-(Set-1)
GATE-GATE-CS-2014-(Set-1)
GATE
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to check the given element has the specified class in JavaScript ?

06 Apr, 2021
Sometimes we need to check the element has the class name ‘X’ ( Any specific name ). To check if the element contains a specific class name, we can use the contains method of the classList object.
element.classList.contains("class-name")
It returns a Boolean value. If the element contains the class name it returns true otherwise it returns false.
Implementation: Now let’s implement the given method. Here we will create a simple HTML page and add an h1 element having the class name main and id name main. Our task is to find the h1 contains the class name main.
HTML
<!DOCTYPE html><html>  <body>    <h1 id="main" class="main">Welcome To GFG</h1></body>  </html>
Now create a script tag and write the javascript code. Create a variable named elem and store the h1 element by using document.getElementById( )
Now check if the element has the class name main and also checking if the class name myClass present or not.
Javascript
let elem = document.getElementById("main");  let isMainPresent = elem.classList.contains("main");  if(isMainPresent){    console.log("Found the class name");}else{    console.log("Not found the class name");}      let isMyclassPresent = elem.classList.contains("myClass")  if(isMyClassPresent){    console.log("Found the class name");}else{    console.log("Not found the class name");}
HTML
<!DOCTYPE html><html>  <body>    <h1 id="main" class="main">Welcome To GFG</h1>      <script>        let elem = document.getElementById("main");          let isMainPresent = elem.classList.contains("main");          if (isMainPresent) {            console.log("Found the class name");        } else {            console.log("Not found the class name");        }          let isMyclassPresent =             elem.classList.contains("myClass")          if (isMyclassPresent) {            console.log("Found the class name");        } else {            console.log("Not found the class name");        }    </script></body>  </html>
Output:
HTML-DOM
HTML-Questions
HTML-Tags
JavaScript-Methods
JavaScript-Questions
HTML
JavaScript
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python program to print all Prime numbers in an Interval

22 Mar, 2022
Given two positive integers start and end. The task is to write a Python program to print all Prime numbers in an Interval.
Definition: A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. The first few prime numbers are {2, 3, 5, 7, 11, ....}.
The idea to solve this problem is to iterate the val from start to end using a for loop and for every number, if it is greater than 1, check if it divides n. If we find any other number which divides, print that value.
Below is the Python implementation: 
Python3
# Python program to print all# prime number in an interval def prime(x, y):    prime_list = []    for i in range(x, y):        if i == 0 or i == 1:            continue        else:            for j in range(2, int(i/2)+1):                if i % j == 0:                    break            else:                prime_list.append(i)    return prime_list # Driver programstarting_range = 2ending_range = 7lst = prime(starting_range, ending_range)if len(lst) == 0:    print("There are no prime numbers in this range")else:    print("The prime numbers in this range are: ", lst)
Output: 
The prime numbers in this range are: [2,3,5]
Time Complexity: O(N2), where N is the size of the range.
Auxiliary Space: O(N).
The above solution can be optimized using the Sieve of Eratosthenes. Please see print prime numbers in a range for details. 
JayantaBanik
niharmishra11
ksunderam2000
rakeshvelle
monishap5559
rohitkumarsinghcna
Prime Number
Python
Python Programs
Prime Number
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Setting up a simple HTTP server using Python

02 Sep, 2020
In this article, we are going to learn how to set up a simple and local HTTP server using Python. An HTTP server can be very useful for testing Android, PC or Web apps locally during development. It can also be used to share files between two devices connected over the same LAN or WLAN network.
On the terminal run the following statement:
python3 -m http.server

or
python -m http.server

Python3 server command
For accessing the server locally you need to visit http://localhost:8000/. Here you can see all the directories of your local storage along with all the data. You can also access an HTML page, It will be rendered by your web browser as you access it.
The localhost page
Before going into application make a note that the device on which you have run the above commands is called a Server or a Host and the second device that you will be using to access the Server over the network is called Client. For accessing the server over a Network make sure that both the device(Server and the Client) are connected over the same LAN or WLAN network. To access the Server you need the IP address of the server.
For obtaining the IP address the following steps are to be followed on your Server device:
On the Windows command prompt, execute the following statement:
ipconfig

On the Linux, Unix or macOS terminal, execute the following statement:
ifconfig

Note the IP address returned by the above command. We will use this IP address further.
The result of ‘ifconfig’ command in Linux.
Once you know the IP address open any web browser on the Client device and type in the IP address of the first machine(Server device), along with port 8000: http://[ip address]:8000
Congratulations!! Now you know how to host a simple HTTP server using Python.
Note: This HTTP server has limited security only so use it only for development purposes or sharing files locally it’s not recommended for use over a production environment.
python-utility
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How do I change the range of the X-axis with datetimes in Matplotlib?

To change the range of the X-axis with datetimes in matplotlib, we can take the following steps −
Create a list of x and y, where x stores the datetime and y stores the number.
Create a list of x and y, where x stores the datetime and y stores the number.
Using subplots method, create a figure and add a set of subplots.
Using subplots method, create a figure and add a set of subplots.
Plot x and y data points using plots() method, wehere markerface color is green, marker edge color is red, and marker size is 7.
Plot x and y data points using plots() method, wehere markerface color is green, marker edge color is red, and marker size is 7.
Since date ticklabels often overlap, so it is useful to rorate them and right-align them using autofmt_xdate() method.
Since date ticklabels often overlap, so it is useful to rorate them and right-align them using autofmt_xdate() method.
To change the range of X-axis with datetimes, use set_xlim() with range of datetimes.
To change the range of X-axis with datetimes, use set_xlim() with range of datetimes.
To change the range of Y-axis, use set_ylim() method.
To change the range of Y-axis, use set_ylim() method.
To display the figure, use show() method.
To display the figure, use show() method.
import datetime
import matplotlib.pyplot as plt
plt.rcParams["figure.figsize"] = [7.00, 3.50]
plt.rcParams["figure.autolayout"] = True
x = [datetime.date(2021, 1, 1), datetime.date(2021, 1, 3), datetime.date(2021, 1,
5), datetime.date(2021, 1, 7)]
y = [1, 3, 5, 7]
fig, ax = plt.subplots()
ax.plot_date(x, y, markerfacecolor='green', markeredgecolor='red', ms=7)
fig.autofmt_xdate()
ax.set_xlim([datetime.date(2020, 12, 31), datetime.date(2021, 1, 8)])
ax.set_ylim([0, 8])
plt.show()
MySQL query to set my auto increment column ( id ) to zero or reset the value of auto increment field?

Use ALTER table to set the auto_increment column to 0 or reset with another value
ALTER TABLE yourTableName AUTO_INCREMENT=0;
The above syntax will begin from 1.
Let us first create a table −
mysql> create table DemoTable698 (
   ClientId int NOT NULL AUTO_INCREMENT PRIMARY KEY
) auto_increment=109;
Query OK, 0 rows affected (0.88 sec)
Here is the query to reset the auto_increment value to 0 −
mysql> alter table DemoTable698 AUTO_INCREMENT=0;
Query OK, 0 rows affected (0.21 sec)
Records: 0 Duplicates: 0 Warnings: 0
Insert some records in the table using insert command. Here, we haven’t inserted anything since we want to display auto increment value after setting it from beginning again −
mysql> insert into DemoTable698 values();
Query OK, 1 row affected (0.18 sec)
mysql> insert into DemoTable698 values();
Query OK, 1 row affected (0.12 sec)
mysql> insert into DemoTable698 values();
Query OK, 1 row affected (0.12 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable698;
This will produce the following output -
+----------+
| ClientId |
+----------+
| 1        |
| 2        |
| 3        |
+----------+
3 rows in set (0.00 sec)
Google Charts - Organization Chart

Organization chart helps in rendering a hierarchy of nodes, used to portray superior/subordinate relationships in an organization. For example, A family tree is a type of org chart.. We've already seen the configuration used to draw this chart in Google Charts Configuration Syntax chapter. So, let's see the complete example.
We've used OrgChart class to show organization based chart.
//organization chart
var chart = new google.visualization.OrgChart(document.getElementById('container'));

googlecharts_organization_chart.htm
<html>
   <head>
      <title>Google Charts Tutorial</title>
      <script type = "text/javascript" src = "https://www.gstatic.com/charts/loader.js">
      </script>
      <script type = "text/javascript">
         google.charts.load('current', {packages: ['orgchart']});     
      </script>
   </head>
   
   <body>
      <div id = "container" style = "width: 550px; height: 400px; margin: 0 auto">
      </div>
      <script language = "JavaScript">
         function drawChart() {
            // Define the chart to be drawn.
            var data = new google.visualization.DataTable();   
            data.addColumn('string', 'Name');
            data.addColumn('string', 'Manager');
            data.addColumn('string', 'ToolTip');

            // For each orgchart box, provide the name, manager, and tooltip to show.
            data.addRows([
               [{v:'Robert', f:'Robert<div style="color:red; font-style:italic">President</div>'},'', 'President'],
               [{v:'Jim', f:'Jim<div style="color:red; font-style:italic">Vice President</div>'},'Robert', 'Vice President'],
               ['Alice', 'Robert', ''],
               ['Bob', 'Jim', 'Bob Sponge'],
               ['Carol', 'Bob', '']
            ]);			

            // Set chart options
            var options = {allowHtml:true};
                  
            // Instantiate and draw the chart.
            var chart = new google.visualization.OrgChart(document.getElementById('container'));
            chart.draw(data, options);
         }
         google.charts.setOnLoadCallback(drawChart);
      </script>
   </body>
</html>
Verify the result.
 Print
 Add Notes
 Bookmark this page
HTML5 check if audio is playing

Use the following to check if audio is playing −
functionisPlaying(audelem) {
   return!audelem.paused;
}
The above code can be used to check ifaudio is playing or not. The audio tag has a paused property.The paused property returns whether the audio/video is paused.
You can also toggle −
functiontogglePause() {
   if(newAudio.paused && newAudio.currentTime > 0 && !newAudio.ended) {
      newAudio.play();
   } else {
      newAudio.pause();
   }
}
Angular7 - Environment Setup

In this chapter, we will discuss the Environment Setup required for Angular 7. To install Angular 7, we require the following −
Nodejs
Npm
Angular CLI
IDE for writing your code
To check if nodejs is installed on your system, type node -v in the terminal. This will help you see the version of nodejs currently installed on your system.
Nodejs has to be greater than 8.x or 10.x, and npm has to be greater than 5.6 or 6.4.
C:\>node 
–v v10.15.1

If it does not print anything, install nodejs on your system. To install nodejs, go to the homepage, https://nodejs.org/en/download/of nodejs and install the package based on your OS.
The homepage of nodejs is as follows −
Based on your OS, install the required package. Once nodejs is installed, npm will also get installed along with it. To check if npm is installed or not, type npm –v in the terminal as given below. It will display the version of the npm.
C:\>npm 
–v 6.4.1

Angular 7 installations are very simple with the help of angular CLI. Visit the homepage https://cli.angular.io/ of angular to get the reference of the command.
Type npm install –g @angular/cli in your command prompt, to install angular cli on your system. It will take a while to install and once done you can check the version using below command −
ng version

It will display version details of angular - cli as well version of others packages as shown below −
We are done with the installation of Angular 7. You can use any IDE of your choice, i.e., WebStorm, Atom, Visual Studio Code to start working with Angular 7.
The details of the project setup are explained in the next chapter.

    16 Lectures 
     1.5 hours 

 Anadi Sharma

    28 Lectures 
     2.5 hours 

 Anadi Sharma

    11 Lectures 
     7.5 hours 

 SHIVPRASAD KOIRALA

    16 Lectures 
     2.5 hours 

 Frahaan Hussain

    69 Lectures 
     5 hours 

 Senol Atac

    53 Lectures 
     3.5 hours 

 Senol Atac
 Print
 Add Notes
 Bookmark this page
Get page title with Selenium WebDriver using Java.

We can get the page title with Selenium webdriver. The method getTitle() is used to obtain the present page title and then we can get the result in the console.
t = driver.getTitle();
Let us find the title of the current page. We shall get About Careers at Tutorials Point – Tutorialspoint as output.
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import java.util.concurrent.TimeUnit;

public class PageTitle{
   public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver","C:\\Users\\ghs6kor\\Desktop\\Java\\chromedriver.exe");
      WebDriver driver = new ChromeDriver();
      driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
      driver.get("https://www.tutorialspoint.com/about/about_careers.htm");
      // getTitle() to obtain page title
      System.out.println("Page title is : " + driver.getTitle());
      driver.close();
   }
}
Display form values after clicking Submit button using event.preventdefault() - jQuery?

For this, use document.getElementById(“”) along with addEventListener().
Following is the code −
 Live Demo
<!DOCTYPE html>
<html lang="en">
<head>
   <meta charset="UTF-8">
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <title>Document</title>
</head>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<body>
   <form id="details">
      FirstName:
         <label><input type="text" id="firstName" /> </label>
         <br>
      LastName:
         <label><input type="text" id="lastName" /> </label>
         <br>
      <input type="submit">
   </form>
</body>
<script>
   const formDetails = document.getElementById("details");
   formDetails.addEventListener("submit", async (ev) => {
      ev.preventDefault();
      var fName = document.getElementById("firstName").value;
      var lName = document.getElementById("lastName").value;
      console.log("First Name=" + fName);
      console.log("Last Name=" + lName);
   })
</script> 
</html>
To run the above program, save the file name “anyName.html(index.html)”. Right click on the file and select the option “Open with Live Server” in VS Code editor.
This will produce the following output −
Now, enter value into the text box and click the Submit button.
After clicking the submit button, you will get the following output on console −
How to change format of dates in a table column with a MySQL query?

To change format of dates, use the DATE_FORMAT() function. Let us first create a table −
mysql> create table DemoTable1906
   (
   DueTime datetime
   );
Query OK, 0 rows affected (0.00 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable1906 values(now());
Query OK, 1 row affected (0.00 sec)
mysql> insert into DemoTable1906 values(curdate());
Query OK, 1 row affected (0.00 sec)
mysql> insert into DemoTable1906 values('2017-10-11');
Query OK, 1 row affected (0.00 sec)
mysql> insert into DemoTable1906 values('2015-01-12');
Query OK, 1 row affected (0.00 sec)
mysql> insert into DemoTable1906 values('2018-04-25');
Query OK, 1 row affected (0.00 sec)
Display all records from the table using select statement −
mysql> select * from DemoTable1906;
This will produce the following output −
+---------------------+
| DueTime             |
+---------------------+
| 2019-12-11 13:54:22 |
| 2019-12-11 00:00:00 |
| 2017-10-11 00:00:00 |
| 2015-01-12 00:00:00 |
| 2018-04-25 00:00:00 |
+---------------------+
5 rows in set (0.00 sec)
Here is the query to change the format of dates −
mysql> select date_format(DueTime,'%d-%m-%Y') from DemoTable1906;
This will produce the following output −
+---------------------------------+
| date_format(DueTime,'%d-%m-%Y') |
+---------------------------------+
| 11-12-2019                      |
| 11-12-2019                      |
| 11-10-2017                      |
| 12-01-2015                      |
| 25-04-2018                      |
+---------------------------------+
5 rows in set (0.00 sec)
PyQt5 – Change the text font and size in Push button - GeeksforGeeks

23 Jul, 2021
In this article we will see how to change the text style or size of Push Button.QPushButton is a simple button in PyQt, when clicked by a user some associated action gets performed. For adding this button into the application, QPushButton class is used.In order to set font we will use setFont method which takes QFont object as argument. 
Syntax : button.setFont(QFont(‘Arial’, 15))Argument : It takes two argument first is font name and other is integer which refer to size of text.Action performed It changes the size and font of text.
Code :  
Python3
# importing librariesfrom PyQt5.QtWidgets import *from PyQt5.QtGui import *from PyQt5.QtCore import *import sys  class Window(QMainWindow):    def __init__(self):        super().__init__()         # setting title        self.setWindowTitle("Python ")         # setting geometry        self.setGeometry(100, 100, 600, 400)         # calling method        self.UiComponents()         # showing all the widgets        self.show()     # method for widgets    def UiComponents(self):         # creating a push button        button = QPushButton("CLICK", self)         # setting geometry of button        button.setGeometry(200, 150, 100, 40)         # changing font and size of text        button.setFont(QFont('Times', 15))         # adding action to a button        button.clicked.connect(self.clickme)      # action method    def clickme(self):         # printing pressed        print("pressed") # create pyqt5 appApp = QApplication(sys.argv) # create the instance of our Windowwindow = Window() # start the appsys.exit(App.exec())
Output :  
 
manikarora059
Python-gui
Python-PyQt
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Enumerate() in Python
How to Install PIP on Windows ?
Different ways to create Pandas Dataframe
Python String | replace()
Create a Pandas DataFrame from Lists
*args and **kwargs in Python
How To Convert Python Dictionary To JSON?
sum() function in Python
How to drop one or multiple columns in Pandas Dataframe
Swing Examples - Adding horizontal scrollbar

Following example showcase how to show a Scroll Pane with a horizontal bar always on a Panel in a Java Swing application.
We are using the following APIs.
JScrollPane(Component view) − To create a scrollPane on a component.
JScrollPane(Component view) − To create a scrollPane on a component.
JScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS) − To show a horizontal bar always.
JScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS) − To show a horizontal bar always.
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
 
public class SwingTester {
   private JFrame mainFrame;
   private JLabel headerLabel;
   private JLabel statusLabel;
   private JPanel controlPanel;
   
   public SwingTester(){
      prepareGUI();
   }
   public static void main(String[] args){
      SwingTester  swingControlDemo = new SwingTester();      
      swingControlDemo.showScrollPaneDemo();
   }
   private void prepareGUI(){
      mainFrame = new JFrame("Java Swing Examples");
      mainFrame.setSize(400,400);
      mainFrame.setLayout(new GridLayout(3, 1));
      
      mainFrame.addWindowListener(new WindowAdapter() {
         public void windowClosing(WindowEvent windowEvent){
            System.exit(0);
         }        
      });    
      headerLabel = new JLabel("", JLabel.CENTER);        
      statusLabel = new JLabel("",JLabel.CENTER);    
      statusLabel.setSize(350,100);

      controlPanel = new JPanel();
      controlPanel.setLayout(new FlowLayout());

      mainFrame.add(headerLabel);
      mainFrame.add(controlPanel);
      mainFrame.add(statusLabel);
      mainFrame.setVisible(true);  
   }
   
   private JTextArea outputTextArea;
   
   private void showScrollPaneDemo(){
      headerLabel.setText("Control in action: ScrollPane");
      outputTextArea = new JTextArea("",5,20);
      JScrollPane scrollPane = new JScrollPane(outputTextArea);    
      scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
      controlPanel.add(scrollPane);
      mainFrame.setVisible(true);  
   }   
}
 Print
 Add Notes
 Bookmark this page
Adding YouTube videos on an HTML web page

Videos can be easily from YouTuvbe to your web page. You need to just embed the videos.
At first, get the Video id −
Step1: Go to the Video and right click on it. Select “Stats for nerds” −
On clicking, you will get the following dialog box displaying the stats −
Above you can see the video id is F6m0ghjadlw. Now, we will embed the same video using its id −
 Live Demo
<!DOCTYPE html>
<html>
<head>
   <title>Learn WordPress</title>
</head>
<body>
   <h1>WordPress Installation</h1>
   <p>Following is the video demonstrating how to install WordPress on localhost using
   XAMPP Server:</p>
   <iframe height="350" width="600"
      src="https://www.youtube.com/embed/F6m0ghjadlw">
   </iframe>
</body>
</html>
Following is the output displaying we have successfully embedded a YouTube video on a web page −
You can also achieve the same using the <embed> tag. Following is the HTML code −
 Live Demo
<!DOCTYPE html>
<html>
<head>
   <title>Learn WordPress</title>
</head>
<body>
   <h1>WordPress Installation</h1>
   <p>Following is the video demonstrating how to install WordPress on localhost using
   XAMPP Server (video uploaded using embed element):</p>
   <embed height="350" width="600" src="https://www.youtube.com/embed/F6m0ghjadlw">
</body>
</html>
The output displays the video successfully embedded −
C# | Random.NextDouble() Method - GeeksforGeeks

01 May, 2019
The NextDouble() Method of System.Random class in C# is used to return a random floating-point number which is greater than or equal to 0.0, and less than 1.0.
Syntax:
public virtual double NextDouble();
Return Value: This method returns a double-precision floating point number which is greater than or equal to 0.0, and less than 1.0.
Below program illustrates the use of NextDouble() Method:
Example 1:
// C# program to illustrate the // Random.NextDouble() Methodusing System;  class GFG {      // Driver code    public static void Main()    {        // Instantiate random number generator        Random rand = new Random();          // Print 10 random floating point numbers        Console.WriteLine("Printing 10 random floating point numbers");        for (int i = 0; i < 10; i++)            Console.WriteLine("{0} -> {1}", i, rand.NextDouble());    }}
Printing 10 random floating point numbers
0 -> 0.0227202852362396
1 -> 0.624568469647583
2 -> 0.0145442797870116
3 -> 0.646489209330869
4 -> 0.967497945748036
5 -> 0.839329582098559
6 -> 0.873648912121378
7 -> 0.16200648022909
8 -> 0.66018275761054
9 -> 0.0837694853934317

Example 2:
// C# program to illustrate the // Random.NextDouble() Methodusing System;  class GFG {      // Driver code    public static void Main()    {        // Instantiate random number generator        Random rand = new Random();          // Instantiate an array of double        double[] a = new double[10];          // Store random floating point         // numbers in the array        for (int i = 0; i < 10; i++)            a[i] = rand.NextDouble();          // Print 10 random floating point numbers        Console.WriteLine("Printing 10 random "+                      "floating point numbers");          for (int i = 0; i < 10; i++)            Console.WriteLine("{0} -> {1}", i, a[i]);    }}
Printing 10 random floating point numbers
0 -> 0.853536825558886
1 -> 0.741455778359182
2 -> 0.496043408986201
3 -> 0.0975164361752181
4 -> 0.120282317567748
5 -> 0.57163705703413
6 -> 0.749181974562435
7 -> 0.684014179596684
8 -> 0.691246760865323
9 -> 0.888019556127498

Reference:
https://docs.microsoft.com/en-us/dotnet/api/system.random.nextdouble?view=netframework-4.7.2
CSharp-method
CSharp-Random-Class
C#
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
C# | Method Overriding
C# Dictionary with examples
Difference between Ref and Out keywords in C#
C# | Delegates
Top 50 C# Interview Questions & Answers
C# | Constructors
Introduction to .NET Framework
Extension Method in C#
C# | Class and Object
C# | Abstract Classes
GATE | GATE-CS-2004 | Question 35 - GeeksforGeeks

28 Jun, 2021
Consider the label sequences obtained by the following pairs of traversals on a labeled binary tree. Which of these pairs identify a tree uniquely ?
(i)     preorder and postorder
(ii)    inorder and postorder
(iii)   preorder and inorder
(iv)   level order and postorder
(A) (i) only(B) (ii), (iii)(C) (iii) only(D) (iv) onlyAnswer: (B)Explanation: Here, we consider each and every option to check whether it is true or false.
1) Preorder and postorder
For the above trees,
Preorder is AB
Postorder is BA
It shows that preorder and postorder can’t identify a tree uniquely.
2) Inorder and postorder define a tree uniquely
3) Preorder and Inorder also define a tree uniquely
4) Levelorder and postorder can’t define a tree uniquely. For the above example,
Level order is AB
Postorder is BA
See https://www.geeksforgeeks.org/if-you-are-given-two-traversal-sequences-can-you-construct-the-binary-tree/ for details
This solution is contributed by Anil Saikrishna DevarasettyQuiz of this Question
GATE-CS-2004
GATE-GATE-CS-2004
GATE
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
GATE | GATE CS 2019 | Question 27
GATE | GATE-IT-2004 | Question 66
GATE | GATE-CS-2014-(Set-3) | Question 65
GATE | GATE-CS-2006 | Question 49
GATE | GATE-CS-2016 (Set 2) | Question 48
GATE | GATE-CS-2004 | Question 3
GATE | GATE-CS-2000 | Question 43
GATE | GATE-CS-2017 (Set 2) | Question 42
GATE | GATE CS 2010 | Question 24
GATE | Gate IT 2007 | Question 30
Check if a field contains a string in MongoDB?

You can use $regex operator to check if a field contains a string in MongoDB. The syntax is as follows −
db.yourCollectionName.findOne({"yourFieldName":{$regex:".*yourValue.*"}});
To understand the above concept, let us create a collection with the document. The query to create a collection with a document is as follows −
> db.checkFieldContainsStringDemo.insertOne({"Id":1,"Name":"John"});
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5c77d762fc4e719b197a12ed")
}
> db.checkFieldContainsStringDemo.insertOne({"Id":2,"Name":"Johnson"});
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5c77d76bfc4e719b197a12ee")
}
> db.checkFieldContainsStringDemo.insertOne({"Id":3,"Name":"Carol"});
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5c77d774fc4e719b197a12ef")
}
> db.checkFieldContainsStringDemo.insertOne({"Id":4,"Name":"Mike"});
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5c77d77cfc4e719b197a12f0")
}
> db.checkFieldContainsStringDemo.insertOne({"Id":5,"Name":"Sam"});
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5c77d784fc4e719b197a12f1")
}
> db.checkFieldContainsStringDemo.insertOne({"Id":6,"Name":"Larry"});
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5c77d78cfc4e719b197a12f2")
}
Display all documents from a collection with the help of find() method. The query is as follows −
> db.checkFieldContainsStringDemo.find();
The following is the output −
{ "_id" : ObjectId("5c77d762fc4e719b197a12ed"), "Id" : 1, "Name" : "John" }
{ "_id" : ObjectId("5c77d76bfc4e719b197a12ee"), "Id" : 2, "Name" : "Johnson" }
{ "_id" : ObjectId("5c77d774fc4e719b197a12ef"), "Id" : 3, "Name" : "Carol" }
{ "_id" : ObjectId("5c77d77cfc4e719b197a12f0"), "Id" : 4, "Name" : "Mike" }
{ "_id" : ObjectId("5c77d784fc4e719b197a12f1"), "Id" : 5, "Name" : "Sam" }
{ "_id" : ObjectId("5c77d78cfc4e719b197a12f2"), "Id" : 6, "Name" : "Larry" }
Here is the query to check the field contains a particular string in MongoDB. Here the string we are searching in a field is “Johnson” −
> db.checkFieldContainsStringDemo.findOne({"Name":{$regex:".*Johnson.*"}});
The following is the output −
{
   "_id" : ObjectId("5c77d76bfc4e719b197a12ee"),
   "Id" : 2,
   "Name" : "Johnson"
}