code-rag-bench/online-tutorials huggingface dataset:
Create a form that uses the horizontal layout with Bootstrap

To create a horizontal layout in Bootstrap, use the form-horizontal class.
You can try to run the following code −
Live Demo
<!DOCTYPE html>
<html>
   <head>
      <title>Bootstrap Example</title>
      <meta name = "viewport" content = "width=device-width, initial-scale = 1">
      <link rel = "stylesheet" href = "https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css">
      <script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
      <script src = "https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
   </head>
   <body>
      <form class = "form-horizontal" role = "form">
         <div class = "form-group">
            <label for = "name" class = "col-sm-2 control-label">Name</label>
            <div class = "col-sm-10">
               <input type = "text" class = "form-control" id = "name" placeholder = "Enter Name">
            </div>
         </div>
         <div class = "form-group">
            <label for = "country" class = "col-sm-2 control-label">Country</label>
            <div class = "col-sm-10">
               <input type = "text" class = "form-control" id = "country" placeholder = "Enter Country">
            </div>
         </div>
         <div class = "form-group">
            <div class = "col-sm-offset-2 col-sm-10">
               <button type = "submit" class = "btn btn-default">Sign in</button>
            </div>
         </div>
      </form>
   </body>
</html>
Combination Sum in Python

Suppose we have a set of candidate numbers (all elements are unique) and a target number. We have to find all unique combinations in candidates where the candidate numbers sum to the given target. The same repeated number may be chosen from candidates unlimited number of times. So if the elements are [2,3,6,7] and the target value is 7, then the possible output will be [[7], [2,2,3]]
Let us see the steps −
We will solve this in recursive manner. The recursive function is named as solve(). This takes an array to store results, one map to keep records, the target value and a list of distinct elements. Initially res array and map is empty. The solve method will work like below −
We will solve this in recursive manner. The recursive function is named as solve(). This takes an array to store results, one map to keep records, the target value and a list of distinct elements. Initially res array and map is empty. The solve method will work like below −
if target is 0, thentemp := a list of elements present in the listtemp1 := temp, then sort tempif temp is not in the map, then insert temp into map and set value as 1, insert temp into resreturnif temp < 0, then returnfor x in range i to length of element list,insert elements[x] into the currentsolve(elements, target – elements[x], res, map, i, current)delete element from current list from index (length of current – 1)
temp := a list of elements present in the list
temp1 := temp, then sort temp
if temp is not in the map, then insert temp into map and set value as 1, insert temp into res
return
if temp < 0, then return
for x in range i to length of element list,insert elements[x] into the currentsolve(elements, target – elements[x], res, map, i, current)delete element from current list from index (length of current – 1)
insert elements[x] into the current
solve(elements, target – elements[x], res, map, i, current)
delete element from current list from index (length of current – 1)
Let us see the following implementation to get better understanding −
 Live Demo
class Solution(object):
   def combinationSum(self, candidates, target):
      result = []
      unique={}
      candidates = list(set(candidates))
      self.solve(candidates,target,result,unique)
      return result
   def solve(self,candidates,target,result,unique,i = 0,current=[]):
      if target == 0:
         temp = [i for i in current]
         temp1 = temp
         temp.sort()
         temp = tuple(temp)
         if temp not in unique:
            unique[temp] = 1
            result.append(temp1)
         return
      if target <0:
         return
      for x in range(i,len(candidates)):
         current.append(candidates[x])
         self.solve(candidates,target-candidates[x],result,unique,i,current)
         current.pop(len(current)-1)
ob1 = Solution()
print(ob1.combinationSum([2,3,6,7,8],10))
[2,3,6,7,8]
10
[[2, 8], [2, 2, 2, 2, 2], [2, 2, 3, 3], [2, 2, 6], [3, 7]]
JSF - Basic Tags

In this chapter, you will learn about various types of basic JSF tags.
JSF provides a standard HTML tag library. These tags get rendered into corresponding html output.
For these tags you need to use the following namespaces of URI in html node.
<html 
   xmlns = "http://www.w3.org/1999/xhtml" 
   xmlns:h = "http://java.sun.com/jsf/html">

Following are the important Basic Tags in JSF 2.0.
Renders a HTML input of type="text", text box.
Renders a HTML input of type="password", text box.
Renders a HTML textarea field.
Renders a HTML input of type="hidden".
Renders a single HTML check box.
Renders a group of HTML check boxes.
Renders a single HTML radio button.
Renders a HTML single list box.
Renders a HTML multiple list box.
Renders a HTML combo box.
Renders a HTML text.
Renders a HTML text. It accepts parameters.
Renders an image.
Includes a CSS style sheet in HTML output.
Includes a script in HTML output.
Renders a HTML input of type="submit" button.
Renders a HTML anchor.
Renders a HTML anchor.
Renders a HTML anchor.
Renders an HTML Table in form of grid.
Renders message for a JSF UI Component.
Renders all message for JSF UI Components.
Pass parameters to JSF UI Component.
Pass attribute to a JSF UI Component.
Sets value of a managed bean's property.

    37 Lectures 
     3.5 hours 

 Chaand Sheikh
 Print
 Add Notes
 Bookmark this page
Pandas - Data Correlations

A great aspect of the Pandas module is the corr() method.
The corr() method calculates the relationship between each column in your data set.
The examples in this page uses a CSV file called: 'data.csv'.
Download data.csv. or Open 
data.csv
Show the relationship between the columns:

            Duration     Pulse  Maxpulse  Calories
  Duration  1.000000 -0.155408  0.009403  0.922721
  Pulse    -0.155408  1.000000  0.786535  0.025120
  Maxpulse  0.009403  0.786535  1.000000  0.203814
  Calories  0.922721  0.025120  0.203814  1.000000



Note:
    The corr() method ignores "not numeric" 
    columns.
  
The Result of the corr() method is a table with a lot of numbers that represents
how well the relationship is between two columns.
The number varies from -1 to 1.
1 means that there is a 1 to 1 relationship (a perfect correlation),
and for this data set, each time a value went up in the first column, the other one went up as well.
0.9 is also a good relationship, and if you increase one value, the other will probably increase as well.
-0.9 would be just as good relationship as 0.9, but if you increase one value, the other will probably go down.
0.2 means NOT a good relationship, meaning that if one value goes up does not mean that the other will.

What is a good correlation?
    It depends on the use, but I think it is safe to say you have to have at least 0.6 (or -0.6) to call it a good correlation.
  
We can see that "Duration" and "Duration" got the number 1.000000, which makes sense,
each column always has a perfect relationship with itself.
"Duration" and "Calories" got a 0.922721 correlation, 
which is a very good correlation, and we can predict that the longer you work 
out, the more calories you burn, and the other way around: if you burned a lot 
of calories, you probably had a long work out.
"Duration" and "Maxpulse" got a 0.009403 correlation, 
which is a very bad correlation, meaning that we can not predict the max pulse 
by just looking at the duration of the work out, and vice versa.
Insert a correct syntax for finding relationships between columns in a DataFrame.
df.()

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.
Difference between TypeScript and JavaScript

As we know that both Typescript and JavaScript are the programming language usually used at client end for processing the server request and rendering data on UI. However, both are scripting language but Typescript supports some additional features than Javascript due to which we can state it as the superset of Javascript.
The following are the important differences between TypeScript and JavaScript.
JavaTester.js
<script type="text/javascript">
   document.write("Hello World");
</script>
Hello World
JavaTester.ts
var hello: string = "Hello";
var world: string = "World";
console.log(hello + " from " + world);
Hello from World
\underline - Tex Command

\underline - Used to create underline symbol under the argument.
{ \underline #1}
\underline command creates underline symbol under the argument.

\underline{AB}

AB_


\underline a

a_


\underline{\text{a long argument}}

a long argument_



\underline{AB}

AB_


\underline{AB}
\underline a

a_


\underline a
\underline{\text{a long argument}}

a long argument_


\underline{\text{a long argument}}

    14 Lectures 
     52 mins

 Ashraf Said

    11 Lectures 
     1 hours 

 Ashraf Said

    9 Lectures 
     1 hours 

 Emenwa Global, Ejike IfeanyiChukwu

    29 Lectures 
     2.5 hours 

 Mohammad Nauman

    14 Lectures 
     1 hours 

 Daniel Stern

    15 Lectures 
     47 mins

 Nishant Kumar
 Print
 Add Notes
 Bookmark this page
How to access the pointer to structure in C language?

Pointer to structure holds the address of an entire structure.
Mainly, these are used to create the complex data structures such as linked lists, trees, graphs and so on.
The members of the structure can be accessed by using a special operator called arrow operator ( -> ).
Following is the declaration for pointer to structure −
struct tagname *ptr;
For example, struct student *s;
You can access pointer to structure by using the following −
Ptr-> membername;
For example, s->sno, s->sname, s->marks;
Following is the C program to access the pointer to structure −
#include<stdio.h>
struct classroom{
   int students[7];
};
int main(){
   struct classroom clr = {2, 3, 5, 7, 11, 13};
   int *ptr;
   ptr = (int *)&clr;
   printf("%d",*(ptr + 4));
   return 0;
}
When the above program is executed, it produces the following result −
11
Here, a pointer variable ptr holds the address of a first value 2 of an object clr. Then, the address of the pointer variable is incremented by 4 and finally, the value is displayed.
For example,
*(ptr + 0) = 2
*(ptr + 1) = 3
*(ptr + 2) = 5
*(ptr + 3) = 7
*(ptr + 4) = 11
*(ptr + 5) = 13
Consider another simple example to know about pointer to structures −
struct student{
   int sno;
   char sname[30];
   float marks;
};
main ( ){
   struct student s;
   struct student *st;
   printf("enter sno, sname, marks :");
   scanf ("%d%s%f", & s.sno, s.sname, &s. marks);
   st = &s;
   printf ("details of the student are\n");
   printf ("Number = %d\n", st ->sno);
   printf ("name = %s\n", st->sname);
   printf ("marks =%f", st->marks);
   getch ( );
}
When the above program is executed, it produces the following result −
enter sno, sname, marks :1 bhanu 69
details of the student are
Number = 1
name = bhanu
marks =69.000000
TreeSet remove() Method in Java - GeeksforGeeks

26 Nov, 2018
The Java.util.TreeSet.remove(Object O) method is to remove a particular element from a Tree set.
Syntax:
TreeSet.remove(Object O)
Parameters: The parameter O is of the type of Tree set and specifies the element to be removed from the set.
Return Value: This method returns True if the element specified in the parameter is initially present in the Set and is successfully removed otherwise it returns False.
Below program illustrate the Java.util.TreeSet.remove() method:
// Java code to illustrate remove()import java.util.*;import java.util.TreeSet;  public class TreeSetDemo {    public static void main(String args[])    {        // Creating an empty TreeSet        TreeSet<String> tree = new TreeSet<String>();          // Use add() method to add elements into the Set        tree.add("Welcome");        tree.add("To");        tree.add("Geeks");        tree.add("4");        tree.add("Geeks");        tree.add("TreeSet");          // Displaying the TreeSet        System.out.println("TreeSet: " + tree);          // Removing elements using remove() method        tree.remove("Geeks");        tree.remove("4");        tree.remove("TreeSet");          // Displaying the TreeSet after removal        System.out.println("New TreeSet: " + tree);    }}
TreeSet: [4, Geeks, To, TreeSet, Welcome]
New TreeSet: [To, Welcome]

Java - util package
Java-Collections
Java-Functions
java-treeset
Java
Java
Java-Collections
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Initialize an ArrayList in Java
Object Oriented Programming (OOPs) Concept in Java
Interfaces in Java
How to iterate any Map in Java
ArrayList in Java
Multidimensional Arrays in Java
Stack Class in Java
Stream In Java
Singleton Class in Java
Overriding in Java
C# program to count the occurrences of each character

Firstly, set the string −
string str = "Website";
Console.WriteLine("String: "+str);
Check for every character in the string and increment a variable that would count the number of occurrences of that character −
for (int j = 0; j < str.Length; j++) {
   if (str[0] == str[j]) {
      cal++;
   }
}
You can try to run the following code to count the occurrences of each character.
Live Demo
using System;
public class Demo {
   public static void Main() {
      string str = "Website";
      Console.WriteLine("String: "+str);
      while (str.Length > 0) {
         Console.Write(str[0] + " = ");
         int cal = 0;
         for (int j = 0; j < str.Length; j++) {
            if (str[0] == str[j]) {
               cal++;
            }
         }
         Console.WriteLine(cal);
         str = str.Replace(str[0].ToString(), string.Empty);
      }
      Console.ReadLine();
   }
}
String: Website
W = 1
e = 2
b = 1
s = 1
i = 1
t = 1
DATE_SUB() Function in MySQL - GeeksforGeeks

03 Dec, 2020
DATE_SUB() function in MySQL is used to subtract a specified time or date interval to a specified date and then returns the date.
Syntax :
DATE_SUB(date, INTERVAL value addunit)

Parameter: This function accepts two parameters which are illustrated below :
date – Specified date to be modified
value addunit – Here the value is date or time interval to subtract. This value can be both positive and negative. And here the addunit is the type of interval to subtract such as SECOND, MINUTE, HOUR, DAY, YEAR, MONTH etc.
Returns :It returns the new date after subtraction of specified time or date.
Example-1 :Getting a new date of “2017-11-22” after the subtraction of 3 year to the specified date “2020-11-22”.
SELECT DATE_SUB("2020-11-22", INTERVAL 3 YEAR);

Output :
2017-11-22
Example-2 :Getting a new date of “2020-9-22” after the subtraction of 2 month to the specified date “2020-11-22”.
SELECT DATE_SUB("2020-11-22", INTERVAL 2 MONTH);

Output :
2020-09-22
Example-3 :Getting a new date of “2020-11-12” after the subtraction of 10 days to the specified date “2020-11-22”.
SELECT DATE_SUB("2020-11-22", INTERVAL 10 DAY);

Output :
2020-11-12
Example-4 :Getting a new date of “2020-11-22 06:12:10” after the subtraction of 3 hours to the specified date “2020-11-22 09:12:10”.
SELECT DATE_SUB("2020-11-22 09:12:10", INTERVAL 3 HOUR);

Output :
2020-11-22 06:12:10
Example-5 :Getting a new date of “2020-11-22 09:06:10” after the subtraction of 3 minutes to the specified date “2020-11-22 09:09:10”.
SELECT DATE_SUB("2020-11-22 09:09:10", INTERVAL 3 MINUTE);

Output :
2020-11-22 09:06:10
Example-6 :Getting a new date of “2020-11-22 09:09:05” after the subtraction of 5 seconds to the specified date “2020-11-22 09:09:10”.
SELECT DATE_SUB("2020-11-22 09:09:10", INTERVAL 5 SECOND);

Output :
2020-11-22 09:09:05
Application :This function is used to subtract a specified time or date interval to a specified date and then returns the date.
DBMS-SQL
mysql
SQL
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Update Multiple Columns in Single Update Statement in SQL?
What is Temporary Table in SQL?
SQL Query to Find the Name of a Person Whose Name Starts with Specific Letter
SQL using Python
SQL | Subquery
How to Write a SQL Query For a Specific Date Range and Date Time?
SQL Query to Convert VARCHAR to INT
How to Select Data Between Two Dates and Times in SQL Server?
SQL - SELECT from Multiple Tables with MS SQL Server
SQL Query to Delete Duplicate Rows
jQuery - find( selector ) Method

The find( selector ) method searches for descendant elements that match the specified selector.
Here is the simple syntax to use this method −
selector.find( selector )

Here is the description of all the parameters used by this method −
selector − The selector can be written using CSS 1-3 selector syntax.
selector − The selector can be written using CSS 1-3 selector syntax.
Following is a simple example a simple showing the usage of this method.
<html>
   <head>
      <title>The jQuery Example</title>
      <script type = "text/javascript" 
         src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js">
      </script>
		
      <script type = "text/javascript" language = "javascript">
         $(document).ready(function() {
            $("p").find("span").addClass("selected");
         });
      </script>
		
      <style>
         .selected { color:red; }
      </style>
   </head>
	
   <body>
      <div>
         <p><span>Hello</span>, how are you?</p>
         <p>Me? I'm <span>good</span>.</p>
      </div>
   </body>
</html>
This will produce following result −
Hello, how are you?
Me? I'm good.
Following is a simple example a simple showing the usage of this method.
<html>
   <head>
      <title>The jQuery Example</title>
      <script type = "text/javascript" 
         src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js">
      </script>
		
      <script type = "text/javascript" language = "javascript">
         $(document).ready(function() {
            $("p").find("span").addClass("selected");
         });
      </script>
		
      <style>
         .selected { color:red; }
      </style>
   </head>
	
   <body>
      <div>
         <p><span class = "selected">Hello</span>, how are you?</p>
         <p>Me? I'm <span class = "selected">good</span>.</p>
      </div>
   </body>
</html>
This will produce following result −
Hello, how are you?
Me? I'm good.

    27 Lectures 
     1 hours 

 Mahesh Kumar

    27 Lectures 
     1.5 hours 

 Pratik Singh

    72 Lectures 
     4.5 hours 

 Frahaan Hussain

    60 Lectures 
     9 hours 

 Eduonix Learning Solutions

    17 Lectures 
     2 hours 

 Sandip Bhattacharya

    12 Lectures 
     53 mins

 Laurence Svekis
 Print
 Add Notes
 Bookmark this page
alarm() - Unix, Linux System Call

Unix - Home
Unix - Getting Started
Unix - File Management
Unix - Directories
Unix - File Permission
Unix - Environment
Unix - Basic Utilities
Unix - Pipes & Filters
Unix - Processes
Unix - Communication
Unix - The vi Editor
Unix - What is Shell?
Unix - Using Variables
Unix - Special Variables
Unix - Using Arrays
Unix - Basic Operators
Unix - Decision Making
Unix - Shell Loops
Unix - Loop Control
Unix - Shell Substitutions
Unix - Quoting Mechanisms
Unix - IO Redirections
Unix - Shell Functions
Unix - Manpage Help
Unix - Regular Expressions
Unix - File System Basics
Unix - User Administration
Unix - System Performance
Unix - System Logging
Unix - Signals and Traps
Unix - Useful Commands
Unix - Quick Guide
Unix - Builtin Functions
Unix - System Calls
Unix - Commands List
Unix Useful Resources
Computer Glossary
Who is Who
Copyright © 2014 by tutorialspoint
#include <unistd.h> 

unsigned int alarm(unsigned int seconds); 

unsigned int alarm(unsigned int seconds); 
alarm() arranges for a SIGALRM signal to be delivered to the process in seconds seconds.
If seconds is zero, no new alarm() is scheduled.
In any event any previously set alarm() is cancelled.
alarm() returns the number of seconds remaining until any previously scheduled alarm was due to be delivered, or zero if there was no previously scheduled alarm.
alarm() and setitimer() share the same timer; calls to one will interfere with use of the other.
sleep() may be implemented using SIGALRM; mixing calls to alarm() and sleep() is a bad idea.
Scheduling delays can, as ever, cause the execution of the process to be delayed by an arbitrary amount of time.
SVr4, POSIX.1-2001, 4.3BSD
gettimeofday (2)
gettimeofday (2)
pause (2)
pause (2)
select (2)
select (2)
setitimer (2)
setitimer (2)
sigaction (2)
sigaction (2)
signal (2)
signal (2)

Advertisements


    129 Lectures 
     23 hours 

 Eduonix Learning Solutions

    5 Lectures 
     4.5 hours 

 Frahaan Hussain

    35 Lectures 
     2 hours 

 Pradeep D

    41 Lectures 
     2.5 hours 

 Musab Zayadneh

    46 Lectures 
     4 hours 

 GUHARAJANM

    6 Lectures 
     4 hours 

 Uplatz
 Print
 Add Notes
 Bookmark this page
How to copy a file's content from Linux terminal? - GeeksforGeeks

11 Jul, 2019
This article shows the alternative method to copy the content of the file onto the clipboard, via the Linux terminal. In OSX, the commands pbcopy and pbpaste are available by default. Thus, to copy a file onto the clipboard via OSX terminal, type:
pbcopy < 'path of the file'
Since, in Ubuntu, pbcopy and pbpaste commands are not available by default, installing xclip will serve our purpose.
The next step is to open the bash_aliases file.
Next, type in the following inside bash_aliases file and save it.
#using pbcopy and pbpaste for copy-paste a file's contents

alias pbcopy='xclip -selection clipboard'
alias pbpaste='xclip -selection clipboard -o'

This will set pbcopy and pbpaste as the aliases for xclip’s copy and paste commands respectively. Now we are ready to test the commands in the terminal. Let’s create a file named ‘file.txt’ and add some content into it.
Save the file and exit from the text editor. Let’s try copying and pasting its content from the terminal with our pbcopy and pbpaste commands.
Thus, now we are able to copy and paste the contents of our file using the terminal.
Note: One can use pbcopy command in the terminal to copy the c++/python template file used for competitive programming. Instead of the opening and copying the template file every time you attempt a question, just run the command in the terminal to get the work done and save time.
linux-command
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
nohup Command in Linux with Examples
scp command in Linux with Examples
Thread functions in C/C++
mv command in Linux with examples
chown command in Linux with Examples
SED command in Linux | Set 2
Docker - COPY Instruction
Array Basics in Shell Scripting | Set 1
Basic Operators in Shell Scripting
nslookup command in Linux with Examples
difftime() function in C++

In this article we are going to discuss the difftime() function in C++, its syntax, working and its return values.
difftime() function is an inbuilt function in C++ which is defined in header file. The function accepts two parameters of time_t type, function calculate the difference between the two times
double difftime(time_t end, time_t beginning);
Returns the difference of the time in seconds, stored as double data type.
 Live Demo
#include <stdio.h>
#include <time.h>
int main () {
   time_t now;
   struct tm newyear;
   double seconds;
   time(&now); /* get current time; */
   newyear = *localtime(&now);
   newyear.tm_hour = 0; newyear.tm_min = 0; newyear.tm_sec = 0;
   newyear.tm_mon = 0; newyear.tm_mday = 1;
   seconds = difftime(now,mktime(&newyear));
   printf ("%.f seconds since new year in the current timezone.\n", seconds);
   return 0;
}
If we run the above code it will generate the following output −
3351041 seconds since new year in the current timezone.
#include <iostream>
#include <ctime>
using namespace std;
int main() {
   time_t start, ending;
   long addition;
   time(&start);
   for (int i = 0;
   i < 50000; i++) {
      for (int j = 0; j < 50000; j++);
   }
   for (int i = 0; i < 50000; i++) {
      for (int j = 0; j < 50000; j++);
   } for (int i = 0; i < 50000; i++) {
      for (int j = 0; j < 50000; j++);
   } time(&ending);
   cout << "Total time required = " << difftime(ending, start) << " seconds " << endl;
   return 0;
}
If we run the above code it will generate the following output −
Total time required = 37 seconds
HTML - <body> Tag

The HTML <body> tag is used for indicating the main content section of the HTML document.
<!DOCTYPE html>
<html>

   <head>
      <title>HTML body Tag</title>
   </head>
	
   <body>
      Body of the document...
   </body>

</html>
This will produce the following result −
This tag supports all the global attributes described in HTML Attribute Reference
The HTML <body> tag also supports the following  additional attributes −
This tag supports all the event attributes described in HTML Events Reference

    19 Lectures 
     2 hours 

 Anadi Sharma

    16 Lectures 
     1.5 hours 

 Anadi Sharma

    18 Lectures 
     1.5 hours 

 Frahaan Hussain

    57 Lectures 
     5.5 hours 

 DigiFisk (Programming Is Fun)

    54 Lectures 
     6 hours 

 DigiFisk (Programming Is Fun)

    45 Lectures 
     5.5 hours 

 DigiFisk (Programming Is Fun)
 Print
 Add Notes
 Bookmark this page
Plot two horizontal bar charts sharing the same Y-axis in Python Matplotlib

To plot two horizontal bar charts sharing the same Y-axis, we can use sharey=ax1 in subplot() method and for horizontal bar, we can use barh() method.
Create lists for data points.
Create a new figure or activate an existing figure using figure() method
Add a subplot to the current figure using subplot() method, at index=1.
Plot horizontal bar on axis 1 using barh() method.
Add a subplot to the current figure using subplot() method, at index=2. Share the Yaxis of axis 1.
Plot the horizontal bar on axis 2.
To display the figure, use show() method.
import matplotlib.pyplot as plt
import numpy as np

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

y = [3, 1, 5]
x1 = [10, 7, 3]
x2 = [9, 5, 1]

fig = plt.figure()

axe1 = plt.subplot(121)
axe1.barh(y, x1, align='center', color='red', edgecolor='black')

axe2 = plt.subplot(122, sharey=axe1)
axe2.barh(y, x2, align='center', color='green', edgecolor='black')

plt.show()
VBScript - Constants

Constant is a named memory location used to hold a value that CANNOT be changed during the script execution. If a user tries to change a Constant Value, the Script execution ends up with an error. Constants are declared the same way the variables are declared.
[Public | Private] Const Constant_Name = Value

The Constant can be of type Public or Private. The Use of Public or Private is Optional. The Public constants are available for all the scripts and procedures while the Private Constants are available within the procedure or Class. One can assign any value such as number, String or Date to the declared Constant.
In this example, the value of pi is 3.4 and it displays the area of the circle in a message box.
<!DOCTYPE html>
<html>
   <body>
      <script language = "vbscript" type = "text/vbscript">
         Dim intRadius
         intRadius = 20
         const pi = 3.14
         Area = pi*intRadius*intRadius
         Msgbox Area

      </script>
   </body>
</html>
The below example illustrates how to assign a String and Date Value to a Constant.
<!DOCTYPE html>
<html>
   <body>
      <script language = "vbscript" type = "text/vbscript">
         Const myString = "VBScript"
         Const myDate = #01/01/2050#
         Msgbox myString
         Msgbox myDate

      </script>
   </body>
</html>
In the below example, the user tries to change the Constant Value; hence, it will end up with an Execution Error.
<!DOCTYPE html>
<html>
   <body>
      <script language = "vbscript" type = "text/vbscript">
         Dim intRadius
         intRadius = 20
         const pi = 3.14
         pi = pi*pi	'pi VALUE CANNOT BE CHANGED.THROWS ERROR'
         Area = pi*intRadius*intRadius
         Msgbox Area
         
      </script>
   </body>
</html>

    63 Lectures 
     4 hours 

 Frahaan Hussain
 Print
 Add Notes
 Bookmark this page
Use of 'ClickAt ' selenium command.

We can use the ClickAt command in Selenium IDE. The ClickAt command
has two arguments − the element locator and the coordinates which mentions the x and y coordinates of the mouse with respect to the element identified by the locator.
This method is used when we want to click on a position having a specific mouse coordinate. It can click on a checkbox, radio button or link.
clickAt(locator, coordinates)
In the Selenium IDE, Choose a row inside the test script edit box. Enter click at the Command field. To identify the dropdown with the id locator, enter the Target field. The x and y coordinates are to be entered inside the Value field.
Tryit Editor v3.7

CSS Web Fonts
Tryit: The font-face rule
Stringstream in C++ programming

This sample draft calculates the total number of words in a given string as well as counts the total occurrence of a particular word using stringstream in the C++ programming code. The stringstream class partners a string object with a stream enabling you to peruse from the string as though it were a stream. This code shall achieve two feats, first, it will count the total number of words then calculates the frequencies of individual words subsequently in a string using the map
iterator essential methods as follows;
 Live Demo
#include <bits/stdc++.h>
using namespace std;
int totalWords(string str){
   stringstream s(str);
   string word;
   int count = 0;
   while (s >> word)
      count++;
   return count;
}
void countFrequency(string st){
   map<string, int> FW;
   stringstream ss(st);
   string Word;
   while (ss >> Word)
      FW[Word]++;
   map<string, int>::iterator m;
   for (m = FW.begin(); m != FW.end(); m++)
      cout << m->first << " = " << m->second << "\n";
}
int main(){
   string s = "Ajay Tutorial Plus, Ajay author";
   cout << "Total Number of Words=" << totalWords(s)<<endl;
   countFrequency(s);
   return 0;
}
When the string “Ajay Tutorial Plus, Ajay author” supplied to this program, the total counts and frequencies of words in output as follows;
Enter a Total Number of Words=5
Ajay=2
Tutorial=1
Plus,=1
Author=1
Difference Between Pseudo-Class and Pseudo-Element in CSS

A pseudo-class represents a state of a selector like :hover, :active, :last-child,etc. These start with a single colon(:).
The syntax of CSS pseudo-class is as follows −
:pseudo-class{
   attribute: /*value*/
}
Similarly, a pseudo-element is used to select virtual elements like ::after, ::before, ::first-line, etc.
These start with a double colon(::).
The syntax of CSS pseudo-element is as follows −
::pseudo-element{
   attribute: /*value*/
}
The following examples illustrate CSS pseudo-class and pseudo-element property.
 Live Demo
<!DOCTYPE html>
<html>
<head>
<style>
a:hover{
   padding: 3%;
   font-size:1.4em;
   color: tomato;
   background: bisque;
}
</style>
</head>
<body>
<p>You're somebody else</p>
<a href=#>Dummy link 1</a>
<a href=#>Dummy link 2</a>
</body>
</html>
This will produce the following result −
 Live Demo
<!DOCTYPE html>
<html>
<head>
<style>
p::after {
   content: " BOOM!";
   background: hotpink;
}
p:last-child {
   font-size: 1.4em;
   color: red;
}
</style>
</head>
<body>
<p>Anymore Snare?</p>
<p>Donec in semper diam. Morbi sollicitudin sed eros nec elementum. Praesent eget nisl vitaeneque consectetur tincidunt. Ut molestie vulputate sem, nec convallis odio molestie nec.</p>
<p>Hit</p>
<p>Pop</p>
</body>
</html>
This will produce the following result −
Inserting data into a new column of an already existing table in MySQL using Python

24 Feb, 2021
Prerequisite: Python: MySQL Create Table
In this article, we are going to see how to Inserting data into a new column of an already existing table in MySQL using Python. Python allows the integration of a wide range of database servers with applications. A database interface is required to access a database from Python. MySQL Connector Python module is an API in python for communicating with a MySQL database. 
Database table in use:
We are going to use geeks(Database name) database and table describing the salary.
Approach:
Import module.
Make a connection request with the database.
Create an object for the database cursor.
Execute the following MySQL query:
ALTER TABLE person
ADD salary int(20);
UPDATE persons SET salary = '145000' where Emp_Id=12;
And print the result.
Before starting let do the same in SQL:
Step 1: Create a new column with alter command.
ALTER TABLE table_name ADD column_name datatype;
Step 2: Insert data in a new column.
Below is the full implementation in python:
Python3
# Establish connection to MySQL databaseimport mysql.connector  db = mysql.connector.connect(    host="localhost",    user="root",    password="root123",    database="geeks")  # getting the cursor by cursor() methodmycursor = db.cursor()query_1 = "ALTER TABLE person ADD salary int(20);"query_2 = "UPDATE persons SET salary = '145000' where Emp_Id=12;"  # execute the queriesmycursor.execute(query_1)mycursor.execute(query_2)  mycursor.execute("select * from persons;")myresult = mycursor.fetchall()for row in myresult:    print(row)  db.commit()  # close the Connectiondb.close()
Output:
Picked
Python-mySQL
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Elasticsearch - Mapping

Mapping is the outline of the documents stored in an index. It defines the data type like geo_point or string and format of the fields present in the documents and rules to control the mapping of dynamically added fields.
PUT bankaccountdetails
{
   "mappings":{
      "properties":{
         "name": { "type":"text"}, "date":{ "type":"date"},
         "balance":{ "type":"double"}, "liability":{ "type":"double"}
      }
   }
 }
When we run the above code, we get the response as shown below −
{
   "acknowledged" : true,
   "shards_acknowledged" : true,
   "index" : "bankaccountdetails"
}

Elasticsearch supports a number of different datatypes for the fields in a document. The
data types used to store fields in Elasticsearch are discussed in detail here.
These are the basic data types such as text, keyword, date, long, double, boolean or ip,
which are supported by almost all the systems.
These data types are a combination of core data types. These include array, JSON object
and nested data type. An example of nested data type is shown below &minus
POST /tabletennis/_doc/1
{
   "group" : "players",
   "user" : [
      {
         "first" : "dave", "last" : "jones"
      },
      {
         "first" : "kevin", "last" : "morris"
      }
   ]
}
When we run the above code, we get the response as shown below −
{
   "_index" : "tabletennis",
   "_type" : "_doc",
   "_id" : "1",
   _version" : 2,
   "result" : "updated",
   "_shards" : {
      "total" : 2,
      "successful" : 1,
      "failed" : 0
   },
   "_seq_no" : 1,
   "_primary_term" : 1
}

Another sample code is shown below −
POST /accountdetails/_doc/1
{
   "from_acc":"7056443341", "to_acc":"7032460534",
   "date":"11/1/2016", "amount":10000
}
When we run the above code, we get the response as shown below −
{  "_index" : "accountdetails",
   "_type" : "_doc",
   "_id" : "1",
   "_version" : 1,
   "result" : "created",
   "_shards" : {
      "total" : 2,
      "successful" : 1,
      "failed" : 0
   },
   "_seq_no" : 1,
   "_primary_term" : 1
}

We can check the above document by using the following command −
GET /accountdetails/_mappings?include_type_name=false

Indices created in Elasticsearch 7.0.0 or later no longer accept a _default_ mapping. Indices created in 6.x will continue to function as before in Elasticsearch 6.x. Types are
deprecated in APIs in 7.0.
Remove the Chrome’s “No file chosen option” from a file input using JavaScript

11 Jul, 2022
The task is to remove the “no file chosen” value from the empty input element in chrome. We are going to achieve that task with the help of JavaScript.
Approach 1:
Remove the tooltip value(‘No file chosen’).
Use .attr() method to set the value of title attribute to empty.
Example 1: This example removes the tooltip value.
<!DOCTYPE HTML><html>  <head>    <title>        Remove the “No file chosen” from a file input in Chrome?    </title>    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js">    </script></head>  <body style="text-align:center;"       id="body">    <h1 style="color:green;">              GeeksForGeeks          </h1>    <p id="GFG_UP"        style="font-size: 15px;              font-weight: bold;">    </p>    <div>        <input type='file' />    </div>    <br>    <button onclick="gfg_Run()">        Remove tooltip    </button>    <p id="GFG_DOWN"        style="color:green;              font-size: 20px;               font-weight: bold;">    </p>    <script>        var el_up = document.getElementById("GFG_UP");        var el_down = document.getElementById("GFG_DOWN");        el_up.innerHTML = "Click on the button to remove the tooltip value '" +           "No file is chosen.'";          function gfg_Run() {            $('input').attr('title', '');            el_down.innerHTML =               "Tooltip value has been removed.";        }    </script></body>  </html>
Output:
Before clicking on the button:
After clicking on the button:
Approach 2:
Remove the value(‘No file chosen’).
Use .addClass() method to add the class which removes the value “No file chosen”.
Example 2: This example remove the value “No file chosen” from input element.
<!DOCTYPE HTML><html>  <head>    <title>        Remove the “No file chosen” from a file input in Chrome?    </title>    <style>        .removeValue {            color: transparent;        }    </style>    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js">    </script></head>  <body style="text-align:center;"       id="body">    <h1 style="color:green;">              GeeksForGeeks          </h1>    <p id="GFG_UP"        style="font-size: 15px;               font-weight: bold;">    </p>    <div>        <input type="file" />    </div>    <br>    <button onclick="gfg_Run()">        Remove value    </button>    <p id="GFG_DOWN"        style="color:green;              font-size: 20px;              font-weight: bold;">    </p>    <script>        var el_up = document.getElementById("GFG_UP");        var el_down = document.getElementById("GFG_DOWN");        el_up.innerHTML =           "Click on the button to remove the value '" +           "No file is chosen.'";          function gfg_Run() {            $('input').addClass('removeValue');            el_down.innerHTML = "Value has been removed.";        }    </script></body>  </html>
Output:
Before clicking on the button:
After clicking on the button:
JavaScript-Misc
JavaScript
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python program to print negative numbers in a list

26 Oct, 2018
Given a list of numbers, write a Python program to print all negative numbers in given list.
Example:
Input: list1 = [12, -7, 5, 64, -14]
Output: -7, -14

Input: list2 = [12, 14, -95, 3]
Output: -95
Example #1: Print all negative numbers from given list using for loop
Iterate each element in the list using for loop and check if number is less than 0. If the condition satisfies, then only print the number.
# Python program to print negative Numbers in a List  # list of numberslist1 = [11, -21, 0, 45, 66, -93]  # iterating each number in listfor num in list1:          # checking condition    if num < 0:       print(num, end = " ")
Output:
-21 -93 
 Example #2: Using while loop
# Python program to print negative Numbers in a List  # list of numberslist1 = [-10, 21, -4, -45, -66, 93]num = 0  # using while loop     while(num < len(list1)):          # checking condition    if list1[num] < 0:        print(list1[num], end = " ")          # increment num     num += 1     
Output:
-10 -4 -45 -66 
 Example #3: Using list comprehension
# Python program to print negative Numbers in a List  # list of numberslist1 = [-10, -21, -4, 45, -66, 93]  # using list comprehensionneg_nos = [num for num in list1 if num < 0]  print("Negative numbers in the list: ", *neg_nos)
Output:
Negative numbers in the list:  -10 -21 -4 -66
 Example #4: Using lambda expressions
# Python program to print negative Numbers in a List  # list of numbers list1 = [-10, 21, 4, -45, -66, 93, -11]     # we can also print negative no's using lambda exp. neg_nos = list(filter(lambda x: (x < 0), list1))  print("Negative numbers in the list: ", *neg_nos) 
Output:
Negative numbers in the list:  -10 -45 -66 -11
Python list-programs
python-list
Python
Python Programs
School Programming
python-list
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Different ways to create Pandas Dataframe
Enumerate() in Python
Python String | replace()
How to Install PIP on Windows ?
*args and **kwargs in Python
Defaultdict in Python
Python | Get dictionary keys as a list
Python | Convert a list to dictionary
Python | Convert string dictionary to dictionary
Python Program for Fibonacci numbers
Date from() method in Java with Examples

26 Mar, 2019
The from(Instant inst) method of Java Date class returns an instance of date which is obtained from an Instant object.
Syntax:
public static Date from(Instant inst)
Parameters: The method takes one parameter inst of Instant type which is required to be converted.
Return Value: The method returns a date representing the same point on the timeline as the passing instant.
Exceptions:
NullPointerException: This is thrown when the instant is left null.
IllegalArgumentException: This is thrown when the instant is too large to be represented as a Date.
Below programs illustrate the use of from() Method in Java:Example 1:
// Java code to demonstrate// from() method of Date class  import java.time.Instant;import java.util.Date;  public class JavaDateDemo {    public static void main(String args[])    {        // Creating Date Object        Date dateOne = new Date();          // Creating Instant object        Instant inst = Instant.now();          // Displaying the instant        System.out.println(            "Present: "            + dateOne.from(inst));    }}
Present: Tue Mar 26 06:45:40 UTC 2019

Example 2:
import java.util.Date;import java.util.Calendar;import java.time.Instant;  public class GfG {    public static void main(String args[])    {        // Creating a Calendar object        Calendar c1 = Calendar.getInstance();          // Set Month        // MONTH starts with 0 i.e. ( 0 - Jan)        c1.set(Calendar.MONTH, 00);          // Set Date        c1.set(Calendar.DATE, 30);          // Set Year        c1.set(Calendar.YEAR, 2019);          // Creating a date object        // with specified time.        Date dateOne = c1.getTime();          Instant inst = dateOne.toInstant();          System.out.println(            "Date: " + dateOne.from(inst));    }}
Date: Wed Jan 30 06:45:43 UTC 2019

Reference: https://docs.oracle.com/javase/8/docs/api/java/util/Date.html#from-java.time.Instant-
Java - util package
Java-Functions
Java-util-Date
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
SQL Query to Convert Datetime to Date

14 Sep, 2021
In MS SQL Server, dates are complicated for newbies, since while working with the database, the format of the date in the table must be matched with the input date in order to insert. In various scenarios instead of date, DateTime (time is also involved with date) is used. In this article, we will learn how to convert a DateTime to a DATE by using the three different functions.
CAST( ) 
CONVERT( )
TRY_CONVERT( )
Using Substring
 The aim of this article data is to convert DateTime to Date in SQL Server like YYYY-MM-DD HH:MM: SS to YYYY-MM-DD. 
This is a function for casting one type to another type, So here we will use for cast DateTime to date.
Syntax:
CAST( dateToConvert AS DATE)
Example 1:
Query:
SELECT CAST(GETDATE() AS DATE) AS CURRENT_DATE
Output:
GETDATE(): This function return current date time like(2021-08-27 17:26:36.710)
Example 2;
Query:
SELECT CAST('2021-08-27 17:26:36.710' AS DATE) AS CURRENT_DATE_GFG
Output:
This is a function for convert one type to another type, So here we will use it to convert DateTime to date.
Syntax:
CONVERT(DATE, dateToConvert)
Example 1:
Query:
SELECT CONVERT(DATE, GETDATE()) AS CURRENT_DATE_GFG
Output:
Example 2:
Query:
SELECT CONVERT(DATE, '2021-08-27 17:26:36.710' ) AS CURRENT_DATE_GFG
Output:
This is a function for casting one type to another type, So here we will use for Convert DateTime to date. if the date is invalid then it will be null while Convert generates an error. 
Syntax:
TRY_CONVERT(DATE, dateToConvert)
SELECT TRY_CONVERT(DATE,’2021-08-27 17:26:36.710′) AS CURRENT_DATE_GFG
Example 1:
Query:
SELECT TRY_CONVERT(DATE,GETDATE()) AS CURRENT_DATE_GFG
Output:
Example 2:
Query:
SELECT TRY_CONVERT(DATE,'2021-08-27 17:26:36.710') AS CURRENT_DATE_GFG
Output:
This is a function to use get a short string or substring, so here use we get substring 0 to 11 index.
Syntax:
SUBSTRING( dateToConvert ,0,11)
Example 1:
Query:
SELECT SUBSTRING( '2021-08-27 17:26:36.710' ,0,11) AS CURRENT_DATE_GFG
Output:
Example 2;
Query:
SELECT SUBSTRING( CONVERT(varchar(17), GETDATE(), 23) ,0,11) AS CURRENT_DATE_GFG
Output:
Blogathon-2021
Picked
SQL-Query
Blogathon
SQL
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
ReactJS - Forms

In this chapter, we will learn how to use forms in React.
In the following example, we will set an input form with value = {this.state.data}. This allows to update the state whenever the input value changes. We are using onChange event that will watch the input changes and update the state accordingly.
import React from 'react';

class App extends React.Component {
   constructor(props) {
      super(props);
      
      this.state = {
         data: 'Initial data...'
      }
      this.updateState = this.updateState.bind(this);
   };
   updateState(e) {
      this.setState({data: e.target.value});
   }
   render() {
      return (
         <div>
            <input type = "text" value = {this.state.data} 
               onChange = {this.updateState} />
            <h4>{this.state.data}</h4>
         </div>
      );
   }
}
export default App;
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App.jsx';

ReactDOM.render(<App/>, document.getElementById('app'));
When the input text value changes, the state will be updated.
In the following example, we will see how to use forms from child component. onChange method will trigger state update that will be passed to the child input value and rendered on the screen. A similar example is used in the Events chapter. Whenever we need to update state from child component, we need to pass the function that will handle updating (updateState) as a prop (updateStateProp).
import React from 'react';

class App extends React.Component {
   constructor(props) {
      super(props);
      
      this.state = {
         data: 'Initial data...'
      }
      this.updateState = this.updateState.bind(this);
   };
   updateState(e) {
      this.setState({data: e.target.value});
   }
   render() {
      return (
         <div>
            <Content myDataProp = {this.state.data} 
               updateStateProp = {this.updateState}></Content>
         </div>
      );
   }
}
class Content extends React.Component {
   render() {
      return (
         <div>
            <input type = "text" value = {this.props.myDataProp} 
               onChange = {this.props.updateStateProp} />
            <h3>{this.props.myDataProp}</h3>
         </div>
      );
   }
}
export default App;
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App.jsx';

ReactDOM.render(<App/>, document.getElementById('app'));
This will produce the following result.