code-rag-bench/online-tutorials huggingface dataset:
Multiple WHERE with LIMIT in MySQL?

For this, you can use UNION ALL operator. Let us first create a table −
mysql> create table DemoTable
   -> (
   -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,
   -> Subject varchar(100)
   -> );
Query OK, 0 rows affected (0.64 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable(Subject) values('MySQL');
Query OK, 1 row affected (0.13 sec)

mysql> insert into DemoTable(Subject) values('MySQL');
Query OK, 1 row affected (0.19 sec)

mysql> insert into DemoTable(Subject) values('MongoDB');
Query OK, 1 row affected (0.14 sec)

mysql> insert into DemoTable(Subject) values('MongoDB');
Query OK, 1 row affected (0.13 sec)

mysql> insert into DemoTable(Subject) values('MySQL');
Query OK, 1 row affected (0.27 sec)

mysql> insert into DemoTable(Subject) values('Java');
Query OK, 1 row affected (0.25 sec)

mysql> insert into DemoTable(Subject) values('MySQL');
Query OK, 1 row affected (0.11 sec)

mysql> insert into DemoTable(Subject) values('MongoDB');
Query OK, 1 row affected (0.14 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable;
+----+---------+
| Id | Subject |
+----+---------+
| 1  | MySQL   |
| 2  | MySQL   |
| 3  | MongoDB |
| 4  | MongoDB |
| 5  | MySQL   |
| 6  | Java    |
| 7  | MySQL   |
| 8  | MongoDB |
+----+---------+
8 rows in set (0.00 sec)
Following is the query to implement multiple WHERE with LIMIT in MySQL −
mysql> (select *from DemoTable where Subject='MySQL' limit 3)
   -> union all
   -> (select *from DemoTable where Subject='MongoDB' limit 5)
   -> ;
+----+---------+
| Id | Subject |
+----+---------+
| 1  | MySQL   |
| 2  | MySQL   |
| 5  | MySQL   |
| 3  | MongoDB |
| 4  | MongoDB |
| 8  | MongoDB |
+----+---------+
6 rows in set (0.00 sec)
Plot yscale class linear, log, logit and symlog by name in Matplotlib?

To plot yscale with class by name, we can take the following steps
Set the figure size and adjust the padding between and around the subplots.
Create y data points using numpy.
Create x data points using numpy.
Add a subplot to the current figure at index 1.
Plot x and y data points using plot() method.
For linear class by name, use yscale("linear") method.
Set the title of the current subplot.Repeat the steps from 4 to 5 with different indices, yscale() class by name, and title of the plot.
To display the figure, use show() method.
import numpy as np
import matplotlib.pyplot as plt
plt.rcParams["figure.figsize"] = [7.50, 3.50]
plt.rcParams["figure.autolayout"] = True
y = np.random.normal(loc=0.5, scale=0.4, size=1000)
y = y[(y > 0) & (y < 1)]
y.sort()
x = np.arange(len(y))

# linear
plt.subplot(221)
plt.plot(x, y)
plt.yscale('linear')
plt.title('linear')

# log
plt.subplot(222)
plt.plot(x, y)
plt.yscale('log')
plt.title('log')

# symmetric log
plt.subplot(223)
plt.plot(x, y - y.mean())
plt.yscale('symlog', linthreshy=0.01)
plt.title('symlog')

# logit
plt.subplot(224)
plt.plot(x, y)
plt.yscale('logit')
plt.title('logit')
plt.show()
How to compare field values in MongoDB?

You can use $where operator to compare field values in MongoDB. Let us first create a collection with documents
> db.comparingFieldDemo.insertOne({"Value1":30,"Value2":40});
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5c9c99ed2d6669774125246e")
}
> db.comparingFieldDemo.insertOne({"Value1":60,"Value2":70});
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5c9c99f62d6669774125246f")
}
> db.comparingFieldDemo.insertOne({"Value1":160,"Value2":190});
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5c9c99ff2d66697741252470")
}
> db.comparingFieldDemo.insertOne({"Value1":200,"Value2":160});
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5c9c9a0b2d66697741252471")
}
Following is the query to display all documents from a collection with the help of find() method
> db.comparingFieldDemo.find().pretty();
This will produce the following output
{
   "_id" : ObjectId("5c9c99ed2d6669774125246e"),
   "Value1" : 30,
   "Value2" : 40
}
{
   "_id" : ObjectId("5c9c99f62d6669774125246f"),
   "Value1" : 60,
   "Value2" : 70
}
{
   "_id" : ObjectId("5c9c99ff2d66697741252470"),
   "Value1" : 160,
   "Value2" : 190
}
{
   "_id" : ObjectId("5c9c9a0b2d66697741252471"),
   "Value1" : 200,
   "Value2" : 160
}
Following is the query to find by comparing field values.
> db.comparingFieldDemo.find({ $where: "this.Value1 > this.Value2" } );
This will produce the following output
{ "_id" : ObjectId("5c9c9a0b2d66697741252471"), "Value1" : 200, "Value2" : 160 }
Let us see another query
> db.comparingFieldDemo.find({ $where: "this.Value1 < this.Value2" } );
This will produce the following output
{ "_id" : ObjectId("5c9c99ed2d6669774125246e"), "Value1" : 30, "Value2" : 40 }
{ "_id" : ObjectId("5c9c99f62d6669774125246f"), "Value1" : 60, "Value2" : 70 }
{ "_id" : ObjectId("5c9c99ff2d66697741252470"), "Value1" : 160, "Value2" : 190 }
Multiples of 3 or 7 in C++

Given a number n, we need to find the count of multiples of 3 or 7 till n. Let's see an example.
Input
100
Output
43
There are total of 43 multiples of 3 or 7 till 100.
Initialise the number n.
Initialise the number n.
Initialise the count to 0.
Initialise the count to 0.
Write a loop that iterates from 3 to n.Increment the count if the current number is divisible by 3 or 7.
Write a loop that iterates from 3 to n.
Increment the count if the current number is divisible by 3 or 7.
Increment the count if the current number is divisible by 3 or 7.
Following is the implementation of the above algorithm in C++
#include <bits/stdc++.h>
using namespace std;
int getMultiplesCount(int n) {
   int count = 0;
   for (int i = 3; i <= n; i++) {
      if (i % 3 == 0 || i % 7 == 0) {
         count++;
      }
   }
   return count;
}
int main() {
   cout << getMultiplesCount(100) << endl;
}
If you run the above code, then you will get the following result.
43
Difference Between Friend Function and Friend Class

In this post, we will understand the difference between Friend function and Friend class.
It is usually used with operator overloading operation.
It is usually used with operator overloading operation.
It is used with the ‘friend’ keyword.
It is used with the ‘friend’ keyword.
It helps give a non-member function the access to the private members of the class.
It helps give a non-member function the access to the private members of the class.
It has to be declared before it is used.
It has to be declared before it is used.
It is used to access private and protected members of the class.
It is used to access private and protected members of the class.
It can be a global function or a function in another class.
It can be a global function or a function in another class.
class Node
{
   private:
   int val;
   Node* next;

   // Other members of Node Class //
   friend int LinkedList::search();
   // Only search method of linkedList
   // can be used to access the internal members
};
It is a class that is used with ‘friend’ keyword.
It is a class that is used with ‘friend’ keyword.
It is not necessary to declare it before using it.
It is not necessary to declare it before using it.
A friend class is used when a class is created as an inherited class from another base class.
A friend class is used when a class is created as an inherited class from another base class.
It is used to access private and protected members of the class.
It is used to access private and protected members of the class.
class Node
{
   private:
   int val;
   Node* next;
   /* Other members of Class */

   // The class can access private members of
   //Node friend class LinkedList;
};
Copy characters from string into char Array in Java

Let’s say we have the following string.
String str = "Demo Text!";
To copy some part of the above string, use the getChars() method.
// copy characters from string into chArray
=str.getChars( 0, 5, chArray, 0 );
The following is an example to copy characters from string into char Array in Java.
 Live Demo
public class Demo {
   public static void main(String[] args) {
      String str = "Demo Text!";
      char chArray[] = new char[ 5 ];
      System.out.println("String: "+str);
      // copy characters from string into chArray
      str.getChars( 0, 5, chArray, 0 );
      System.out.print("Resultant character array...\n");
      for (char ch : chArray)
         System.out.print( ch );
   }
}
String: Demo Text!
Resultant character array...
Demo
How to get the number of columns of a table using JDBC?

You can get the number of columns of a table using the getColumnCount() method of the ResultSetMetaData class.
//Retrieving the ResultSetMetaData object
ResultSetMetaData rsmd = rs.getMetaData();

//getting the column type
int column_count = rsmd.getColumnCount();
Assume we have a table named employee_data in the database with description as shown below:
+----------+--------------+------+-----+---------+-------+
| Field    | Type         | Null | Key | Default | Extra |
+----------+--------------+------+-----+---------+-------+
| id       | int(11)      | YES  |     | NULL    |       |
| Name     | varchar(255) | YES  |     | NULL    |       |
| Dob      | date         | YES  |     | NULL    |       |
| Location | varchar(255) | YES  |     | NULL    |       |
+----------+--------------+------+-----+---------+-------+
Following JDBC program establishes connection with the database, retrieves the ResultSetMetaData object of the employee_data table, and prints the number of columns in it.
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.Statement;
public class NumberOfColumns {
   public static void main(String args[])throws Exception {

      //Registering the Driver
      DriverManager.registerDriver(new com.mysql.jdbc.Driver());

     //Getting the connection
     String mysqlUrl = "jdbc:mysql://localhost/mydatabase";
     Connection con = DriverManager.getConnection(mysqlUrl, "root", "password");
     System.out.println("Connection established......");

     //Creating a Statement object
     Statement stmt = con.createStatement();
     ResultSet rs = stmt.executeQuery("select * from employee_data");

     //Retrieving the ResultSetMetaData object
     ResultSetMetaData rsmd = rs.getMetaData();

     //getting the column type
     int column_count = rsmd.getColumnCount();
     System.out.println("Number of columns in the table : "+column_count);
   }
}
Connection established......
Number of columns in the table : 4
CSS | Image Sprites - GeeksforGeeks

04 Dec, 2018
It is basically an image which is a collection of different images put together to form a single image. The use of image sprites is done for two main reasons:
For faster page loading since use only single image.
It reduce the bandwidth used to load multiple images. This way less data is consume.
Image sprites are generally used for designing a graphic social media bar or a navigation bar to make it more attractive and efficient at the same time. It is just a method in HTML and CSS to implement more efficient way of putting images and designing web pages.
Used Image:
Example:
<!DOCTYPE html><html>    <head>        <style>            #navlist {                position: relative;            }                        #navlist li {                margin: 0;                padding: 0;                list-style: none;                position: absolute;                top: 0;            }                        #navlist li, #navlist a {                height: 100px;                display: block;            }                       .gfg {                width: 100px;                left:0px;                background: url('https://media.geeksforgeeks.org/wp-content/uploads/icon.png') -0px -0px;            }            .gfg1 {                width: 100px;                 left:120px;                background: url('https://media.geeksforgeeks.org/wp-content/uploads/icon.png') -0px -140px;            }            .gfg2 {                width: 100px;                 left:240px;                background: url('https://media.geeksforgeeks.org/wp-content/uploads/icon.png') -300px -140px;            }         </style>    </head>    <body>        <ul id="navlist">            <li class = "gfg"><a href="#"></a></li>            <li class = "gfg1"><a href="#"></a></li>            <li class = "gfg2"><a href="#"></a></li>        </ul>    </body></html>                                    
Output:
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.
CSS-Advanced
Picked
CSS
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to insert spaces/tabs in text using HTML/CSS?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to create footer to stay at the bottom of a Web page?
How to update Node.js and NPM to next version ?
CSS to put icon inside an input element in a form
How to insert spaces/tabs in text using HTML/CSS?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to set the default value for an HTML <select> element ?
How to update Node.js and NPM to next version ?
How to set input type date in dd-mm-yyyy format using HTML ?
What are the differences between bitwise and logical AND operators in C/C++

As we know the bit-wise AND is represented as ‘&’ and the logical operator is represented as ‘&&’. There are some fundamental differences between them. These are as follows −
The logical AND operator works on Boolean expressions, and returns Boolean values only. The bitwise AND operator works on integer, short int, long, unsigned int type data, and also returns that type of data.
 Live Demo
#include<iostream>
using namespace std;
int main() {
   int x = 3; //...0011
   int y = 7; //...0111
   if (y > 1 && y > x)
      cout << "y is greater than 1 AND x" << endl;
   int z = x & y; // 0011
   cout << "z = "<< z;
}
y is greater than 1 AND x
z = 3
The && operator does not evaluate second operand if first operand becomes false. Similarly, || operator does not evaluate second operand when first one becomes true, but bitwise operators like & and | always evaluate their operands.
 Live Demo
#include<iostream>
using namespace std;
int main() {
   int x = 0;
   cout << (x && printf("Test using && ")) << endl;
   cout << (x & printf("Test using & "));
}
0
Test using & 0
C++ Program to Find the Minimum value of Binary Search Tree

It is a program to find the minimum value of a binary search tree.
Begin
   Declare nd as a structure.
   Declare d to the integer datatype.
   Declare pointer lt to the structure nd type.
   Declare pointer lt to the structure nd type.
   Declare function new_nd() to the structure nd type.
   Declare d to the integer datatype.
   Pass them as a parameter.
   Declare pointer nd to the structure nd type.
      Initialize nd = (struct nd*) malloc(sizeof(struct nd)).
   nd->d = d.
   nd->lt = NULL.
   nd->rt = NULL.
   return(nd).
End
Begin
   Declare function add_node() to the structure nd type.
   Declare pointer nd to the structure nd type.
   Declare d to the integer datatype.
   Pass them as a parameter.
   if (nd == NULL) then
      return(new_nd(d)).
   else
      if (d <= nd->d) then
         nd->lt = add_node(nd->lt, d).
   else
      nd->rt = add_node(nd->rt, d).
   return nd.
End
Begin
   Declare minimum_val() function to the integer datatype.
   Declare pointer nd to the structure nd type.
   Pass it as a parameter.
   Declare pointer cur to the structure nd type.
      Initialize cur = nd.
   while (cur->lt != NULL) do
   cur = cur->lt.
   return(cur->d).
   Declare pointer root to the structure nd type.
      Initialize root = NULL.
   root = add_node(root, 54).
   add_node(root, 32).
   add_node(root, 25).
   add_node(root, 45).
   add_node(root, 65).
   add_node(root, 75).
   Print "The Minimum value of the given binary search tree is: ".
   Print the minimum value of binary tree.
   getchar().
End.
 Live Demo
#include <bits/stdc++.h>
using namespace std;
struct nd {
   int d;
   struct nd* lt;
   struct nd* rt;
};
struct nd* new_nd(int d) {
   struct nd* nd = (struct nd*)
   malloc(sizeof(struct nd));
   nd->d = d;
   nd->lt = NULL;
   nd->rt = NULL;
   return(nd);
}
struct nd* add_node(struct nd* nd, int d) {
   if (nd == NULL)
   return(new_nd(d));
   else {
      if (d <= nd->d)
         nd->lt = add_node(nd->lt, d);
      else
         nd->rt = add_node(nd->rt, d);
      return nd;
   }
}
int minimum_val(struct nd* nd) {
   struct nd* cur = nd;
   while (cur->lt != NULL) {
      cur = cur->lt;
   }
   return(cur->d);
}
int main() {
   struct nd* root = NULL;
   root = add_node(root, 54);
   add_node(root, 32);
   add_node(root, 25);
   add_node(root, 45);
   add_node(root, 65);
   add_node(root, 75);
   cout << "The Minimum value of the given binary search tree is: " << minimum_val(root);
   getchar();
   return 0;
}
The Minimum value of the given binary search tree is: 25
PwC Acceleration Center Interview Experience for Associate Role | On-Campus 2021

21 Apr, 2021
PwC is a Consulting company that came to our college for the Role of Associate Bangalore Location
It Comprises 4 Rounds:
Online Test Group Discussion Technical HR
Online Test
 Group Discussion 
Technical 
HR
Round 1(Online Test): This test comprises three sections Aptitude, Java, and SQL
Aptitude: It was so basic level like a standard and simple mathematics asked, trust me it will be easiest because I am very weak at Aptitude even I have cleared it. (15 Ques)
Java: They covered the OOPS concepts and basic level of pseudocodes and output-based questions. All are MCQ’s
SQL: They asked some basic insert, delete, update and join operations type MCQ questions, mainly focussed on Joins
Round 2(Group Discussion):
They have given a topic like Internet Advantages and Dis-Advantages. (30 mins)
Round 3(Technical Interview):
Totally Resume-based and OOPS Concepts. (30 mins)
Round 4(HR) :
It was some basic questions general things.
Finally, Got Selected for PWC!
Marketing
On-Campus
Pwc
Interview Experiences
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Amazon Interview Experience for SDE 1
Amazon Interview Experience SDE-2 (3 Years Experienced)
Write It Up: Share Your Interview Experiences
Amazon Interview Experience for SDE-1
Samsung Interview Experience Research & Institute SRIB (Off-Campus) 2022
Google SWE Interview Experience (Google Online Coding Challenge) 2022
Nagarro Interview Experience | On-Campus 2021
Goldman Sachs Interview Experience for FTE ( On-Campus) Virtual 2021-22
Tiger Analytics Interview Experience for Data Analyst (On-Campus)
Nagarro Interview Experience
HTML | DOM Style visibility Property

12 May, 2021
The Style visibility property in HTML DOM used to set the visibility for an element. It is used to hide or show the element. It returns the visibility property that is given to an element.
Syntax: 
It returns the visibility property.
object.style.visibility
It is used to set the visibility property. 
object.style.visibility = "visible | hidden | collapse | initial | inherit"
Property Values:  
visible: It is used to specify the element to be visible. It is a default value.
hidden: Element is not visible, but it affects layout.
collapse: It hides the element when it is used on a table row or a cell.
initial: It sets the visibility property to its default value.
inherit: This property is inherited from its parent element.
Return Value: It returns a string representing the content to be displayed or not for an element.
Example-1: 
html
<!DOCTYPE html><html><body>     <center>        <h1 style="color:green;">                GeeksForGeeks            </h1>        <h2>DOM Style visibility Property </h2>        <p id="gfg"> A Computer science portal for geeks</p>          <button type="button" onclick="geeks()">            Change visibility        </button>         <script>            function geeks() {                document.getElementById(                  "gfg").style.visibility = "hidden";            }        </script>    </center></body> </html>
Output: 
Before clicking on the button:  
After clicking on the button:  
Example-2: 
html
<!DOCTYPE html><html><body>     <center>        <h1 style="color:green;;">                GeeksForGeeks            </h1>        <h2>DOM Style visibility Property </h2>        <p id="gfg" style="visibility:hidden;">          A Computer science portal for geeks</p>          <button type="button" onclick="geeks()">            Change visibility        </button>        <p id="y"></p>          <script>            function geeks() {                var x = document.getElementById(                  "gfg").style.visibility;                               document.getElementById('y').innerHTML = x;            }        </script>    </center></body> </html>
Output: 
Before clicking on the button:  
After clicking on the button:  
Supported Browsers: The browser supported by DOM Style visibility property are listed below: 
Google Chrome
Internet Explorer
Firefox
Opera
Apple Safari
simranarora5sos
HTML-DOM
Picked
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to update Node.js and NPM to next version ?
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
Installation of Node.js on Linux
Top 10 Projects For Beginners To Practice HTML and CSS Skills
Difference between var, let and const keywords in JavaScript
How to insert spaces/tabs in text using HTML/CSS?
How to fetch data from an API in ReactJS ?
What is the Maximum Value of smallint(6) unsigned in MySQL?

The maximum value of SMALLINT(6) unsigned in MySQL is 65535. The number 6 does not affect the actual range. It can only be used to display width on the command line.
The Minimum Value signed is
-32768
The Maximum Value unsigned is
65535
The Maximum value signed is
32767
Let us understand this with zerofill and create a table using the following query.
mysql> create table smallIntDemo
-> (
-> FirstNumber smallint(6) zerofill
-> );
Query OK, 0 rows affected (1.95 sec)
Now you can insert records in the table using insert command. Whenever you insert beyond the range 65535, it will not insert in the table, since this is the maximum value. The query is as follows inserting the values less than the maximum range.
mysql> insert into smallIntDemo values(2);
Query OK, 1 row affected (0.21 sec)

mysql> insert into smallIntDemo values(23);
Query OK, 1 row affected (0.21 sec)

mysql> insert into smallIntDemo values(234);
Query OK, 1 row affected (0.17 sec)

mysql> insert into smallIntDemo values(2345);
Query OK, 1 row affected (0.15 sec)

mysql> insert into smallIntDemo values(23456);
Query OK, 1 row affected (0.48 sec)
Now, let us see some records that will not insert in the table since it extends the maximum value.
mysql> insert into smallIntDemo values(234567);
ERROR 1264 (22003): Out of range value for column 'FirstNumber' at row 1

mysql> insert into smallIntDemo values(111111);
ERROR 1264 (22003): Out of range value for column 'FirstNumber' at row 1
Now you can display all records from the table using select statement. The query is as follows -
mysql> select *from smallIntDemo;
The following is the output displaying the usage of width i.e. number in SMALLINT(6). The width is 6.
+-------------+
| FirstNumber |
+-------------+
| 000002 |
| 000023 |
| 000234 |
| 002345 |
| 023456 |
+-------------+
5 rows in set (0.00 sec)
Merge DataFrames by Row Names in R

14 Sep, 2021
In this article, we are going to see how to merge Dataframe by Row Name using merge in R Programming Language. 
The merge() function in base R can be used to merge input dataframes by common columns or row names. The merge() function retains all the row names of the dataframes, behaving similarly to the inner join. The dataframes are combined in order of the appearance in the input function call. 
Syntax: merge(x, y, by, all)
Arguments : 
x, y – The input dataframes
by – specifications of the columns used for merging. In case of merging using row names, the by attribute uses ‘row.names’ value.
all – logical true or false.
The output displayed is in the order of row numbers of x dataframe followed by y dataframe row numbers.
R
# creating a dataframedata_frame1 <- data.frame(col1 = c(6:8),                         col2 = letters[1:3],                         col3 = c(1,4,NA))  print ("Original DataFrame1")print (data_frame1)data_frame2 <- data.frame(col1 = c(5:7),                          col2 = letters[7:9])  print ("Original DataFrame2")print (data_frame2)data_frame_merge <- merge(data_frame1, data_frame2,                          by = 'row.names', all = TRUE)  print ("Merged DataFrame")print (data_frame_merge)
Output:
In case of the unequal number of row numbers in the dataframes, the dataframe with the lesser number of rows is supplied with NA values, which appear in the merged dataframe. 
R
#creating a dataframedata_frame1 <- data.frame(col1 = c(6:8),                         col2 = letters[1:3],                         col3 = c(1,4,NA))  print ("Original DataFrame1")print (data_frame1)data_frame2 <- data.frame(col4 = c(5:6),                          col5 = letters[7:8])  print ("Original DataFrame2")print (data_frame2)data_frame_merge <- merge(data_frame1, data_frame2,                          by = 'row.names', all = TRUE)  print ("Merged DataFrame")print (data_frame_merge)
Output:
Picked
R DataFrame-Programs
R-DataFrame
R Language
R Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
PostgreSQL- LPAD Function

01 Feb, 2021
The PostgreSQL LPAD() function is used for padding a string to the left by a specified length with other specified characters.
Syntax: LPAD(string, length[, fill])

Let’s analyze the above syntax:
The string argument is a string that is to be padded on the left.
It is a positive integer that sets the length of the result string after padding.
The fill argument is used to pad the original string. It is an optional argument.By default, its value is a space.
Example 1:
The following statement uses the LPAD() function to pad the ‘*’ on the left of the string ‘GeeksforGeeks’:
SELECT LPAD('GeeksforGeeks', 15, '*');

Output:
Example 2:
The following statement illustrates how to use the LPAD() function to draw a chart based on the sum of payments per customer from the customer and payment table of the sample database:
SELECT first_name || ' ' || last_name fullname,
    SUM(amount) total,
    LPAD('*', CAST(TRUNC(SUM(amount) / 10) AS INT), '*') chart
FROM payment
INNER JOIN customer using (customer_id)
GROUP BY customer_id
ORDER BY SUM(amount) DESC;

Output:
PostgreSQL-function
PostgreSQL-String-function
PostgreSQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
PostgreSQL - LIMIT with OFFSET clause
PostgreSQL - REPLACE Function
PostgreSQL - DROP INDEX
PostgreSQL - INSERT
PostgreSQL - TIME Data Type
PostgreSQL - ROW_NUMBER Function
PostgreSQL - SELECT
PostgreSQL - CREATE SCHEMA
PostgreSQL - EXISTS Operator
PostgreSQL - LEFT JOIN
Stack.Pop() Method in C#

04 Feb, 2019
This method(comes under System.Collections namespace) is used to remove and returns the object at the top of the Stack. This method is similar to the Peek method, but Peek does not modify the Stack.
Syntax:
public virtual object Pop ();
Return Value: It returns the Object removed from the top of the Stack.
Exception : This method will give InvalidOperationException if the Stack is empty.
Below programs illustrate the use of the above-discussed method:
Example 1:
// C# Program to illustrate the // use of Stack.Pop() Methodusing System;using System.Collections;  class GFG {      // Main Method    public static void Main()    {          // Creating a Stack        Stack myStack = new Stack();          // Inserting the elements into the Stack        myStack.Push("Geeks");        myStack.Push("Geeks Classes");        myStack.Push("Noida");        myStack.Push("Data Structures");        myStack.Push("GeeksforGeeks");          Console.WriteLine("Number of elements in the Stack: {0}",                                                 myStack.Count);          // Retrieveing top element of Stack        Console.Write("Top element of Stack is: ");        Console.Write(myStack.Pop());          // printing the no of Stack element        // after Pop operation        Console.WriteLine("\nNumber of elements in the Stack: {0}",                                                    myStack.Count);    }}
Number of elements in the Stack: 5
Top element of Stack is: GeeksforGeeks
Number of elements in the Stack: 4

Example 2:
// C# Program to illustrate the // use of Stack.Pop() Methodusing System;using System.Collections;  class GFG {      // Main Method    public static void Main()    {          // Creating a Stack        Stack myStack = new Stack();          // Inserting the elements into the Stack        myStack.Push(7);        myStack.Push(9);          Console.WriteLine("Number of elements in the Stack: {0}",                                                 myStack.Count);          // Retrieveing top element of Stack        Console.Write("Top element of Stack is: ");        Console.Write(myStack.Pop());          // printing the no of Stack element        // after Pop operation        Console.WriteLine("\nNumber of elements in the Stack: {0}",                                                    myStack.Count);    }}
Number of elements in the Stack: 2
Top element of Stack is: 9
Number of elements in the Stack: 1

Reference:
https://docs.microsoft.com/en-us/dotnet/api/system.collections.stack.pop?view=netframework-4.7.2
CSharp-Collections-Namespace
CSharp-Collections-Stack
CSharp-method
C#
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
HTML | input maxlength Attribute

28 Feb, 2022
The <input> maxlength attribute is used to specify the maximum number of characters enters into the <input> element.Syntax:  
<input maxlength="number">
Attribute Value:  
number: It contains single value number which allows the maximum number of character in <input> element. Its default value is 524288.
Example:  
html
<!DOCTYPE html><html> <head>    <title>        HTML input maxlength Attribute    </title></head> <body>    <center>        <h1 style="color:green;">            GeeksforGeeks        </h1>         <h2>            HTML &lt;input&gt; maxlength Attribute        </h2>         <form action="#">            Username:            <input type="text"                   name="username"                   maxlength="12">             <br>            <br> Password:            <input type="text"                   name="password"                   maxlength="10">             <br>            <br>             <input type="submit"                   value="Submit">        </form>    </center></body> </html>
Output:  
Supported Browsers: The browsers supported by input maxlength Attribute are listed below:  
Google Chrome 1.0
Internet Explorer 2.0
Firefox 1.0
Safari 1.0
Opera 1.0
 
varshagumber28
HTML-Attributes
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to update Node.js and NPM to next version ?
REST API (Introduction)
CSS to put icon inside an input element in a form
Types of CSS (Cascading Style Sheet)
Design a Tribute Page using HTML & CSS
Installation of Node.js on Linux
Difference between var, let and const keywords in JavaScript
How to fetch data from an API in ReactJS ?
Differences between Functional Components and Class Components in React
Remove elements from a JavaScript Array
extends – Django Template Tags

02 Dec, 2021
A Django template is a text document or a Python string marked-up using the Django template language. Django being a powerful Batteries included framework provides convenience to rendering data in a template. Django templates not only allow passing data from view to template, but also provides some limited features of a programming such as variables, for loops, comments, extends etc. This article revolves about how to use extends tag in Templates. extends tag is used for inheritance of templates in django. One needs to repeat the same code again and again. Using extends we can inherit templates as well as variables. 
Syntax: 
{% extends 'template_name.html' %} 
Example:assume the following directory structure:
dir1/
    template.html
    base2.html
    my/
        base3.html
base1.html
In template.html, the following paths would be valid: 
html
{% extends "./base2.html" %}{% extends "../base1.html" %}{% extends "./my/base3.html" %}
Illustration of How to use extends tag in Django templates using an Example. Consider a project named geeksforgeeks having an app named geeks.  
Refer to the following articles to check how to create a project and an app in Django.  
How to Create a Basic Project using MVT in Django?
How to Create an App in Django ?
Now create a view through which we will access the template, In geeks/views.py, 
Python3
# import Http Response from djangofrom django.shortcuts import render # create a functiondef geeks_view(request):     # return response    return render(request, "extendedgeeks.html")
Create a url path to map to this view. In geeks/urls.py,
Python3
from django.urls import path # importing views from views.pyfrom .views import geeks_view urlpatterns = [    path('', geeks_view),]
extends is always used with block tags so that can be inherited and overriden. Create a template as base template in templates/geeks.html. 
html
<h1>Main Template</h1> {% block content %}{% endblock %}
Now create a template which will use geeks.html as base template. Create a new template extendedgeeks.html, 
html
{% extends "geeks.html" %} {% block content %}<h2> GeeksForGeeks is the Best{% endblock %}
Let’s check if data is displayed from both the templates in extendedgeeks.html  
 
{% extends variable %} uses the value of variable. If the variable evaluates to a string, Django will use that string as the name of the parent template. If the variable evaluates to a Template object, Django will use that object as the parent template. 
surindertarika1234
Django-templates
Python Django
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to write <dt> and <dd> element on the same line using CSS ?

02 Jun, 2020
The <dt> and <dd> tags are used together within the <dl> (defines a description list) tag in HTML to define terms or give their description. The <dt> tag is used to specify the description list. The <dd> tag stands for definition description and used to denote the description or definition of an item in a description list. The <dl> tag is used to represent the description list. This tag is used with <dt> and <dd> tags.
Example 1: This example uses <dt> and <dd> tags within <dl> tag and display the <dt> and <dd> content on different line. 
HTML
<!DOCTYPE html><html>  <head>    <title>        How to write dt and dd element        on the same line using CSS ?    </title>      <style>        dt {            font-weight: bold;            color: green;        }          dt::after {            content: ":";        }    </style></head>  <body>    <dl>        <dt>Name</dt>        <dd>Cristiano Ronaldo</dd>        <dt>Date of birth</dt>        <dd>5 February 1985 (age 35)</dd>        <dt>Nationality</dt>        <dd>Portugal</dd>        <dt>Profession</dt>        <dd>Footballer</dd>    </dl></body>  </html>
Output:  
Example 2:  This example uses <dt> and <dd> tags within <dl> tag and display the <dt> and <dd> content on the same line using CSS. 
HTML
<!DOCTYPE html><html>  <head>    <style>        dt {            float: left;            clear: left;            width: 110px;            font-weight: bold;            color: green;        }          dt::after {            content: ":";        }          dd {            margin: 0 0 0 80px;            padding: 0 0 0.5em 0;        }    </style></head>  <body>    <dl>        <dt>Name</dt>        <dd>Cristiano Ronaldo</dd>        <dt>Date of birth</dt>        <dd>5 February 1985 (age 35)</dd>        <dt>Nationality</dt>        <dd>Portugal</dd>        <dt>Profession</dt>        <dd>Footballer</dd>    </dl></body>  </html>
Output:  
CSS-Misc
HTML-Misc
Picked
CSS
HTML
Web Technologies
Web technologies Questions
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Design a Tribute Page using HTML & CSS
Types of CSS (Cascading Style Sheet)
How to set space between the flexbox ?
How to position a div at the bottom of its container using CSS?
How to Upload Image into Database and Display it using PHP ?
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 ?
Design a Tribute Page using HTML & CSS
How to convert/store a string of numbers in to an array in java?

You can convert a String to an integer using the parseInt() method of the Integer class. To convert a string array to an integer array, convert each element of it to integer and populate the integer array with them.
 Live Demo
import java.util.Arrays;

public class StringToIntegerArray {
   public static void main(String args[]) {
      String [] str = {"123", "345", "437", "894"};
      int size = str.length;
      int [] arr = new int [size];

      for(int i=0; i<size; i++) {
         arr[i] = Integer.parseInt(str[i]);
      }
      System.out.println(Arrays.toString(arr));
   }
}
[123, 345, 437, 894]
2 reasons to use MixUp Augmentation when training your Deep Learning models | by Art Kulakov | Towards Data Science

The MixUp idea was introduced back in 2018 in this paper and was immediately taken into pipelines by many ML researchers. The implementation of MixUp is really simple, but still it can bring a huge benefit to your model performance.
MixUp can be represented with this simple equation:
newImage = alpha * image1 + (1-alpha) * image2
This newImage is simply a blend of 2 images from your training set, it is that simple! So, what will be the target value for the newImage?
newTarget = alpha * target1 + (1-alpha) * target2
The important thing here, is that you don’t always need to One Hot Encode your target vector. In case you are not doing OneHotEncoding, custom loss function will be required. I will explain it deeper in the implementation part.
And here is how the output of the MixUp augmentation can look like. In this case, I took alpha=0.3 and blended together dog and cat images.
So, why should you try this MixUp idea, if you are still not using it in your augmentation methods?
1. Regularization
MixUp is extremely good at regularizing ML models for Computer Vision tasks. As the creators state here, you can train DNN on a single GPU for 6 minutes, and still get 94% on CIFAR 10 dataset! Moreover, you can even embed this type of augmentation into sound pipelines, in case you are using something like melspectrogram as model input.
2. Simplicity and speed
As I have stated above, MixUp concept is really simple to master, though, you should be careful at implementation steps, which will be described below. In terms of speed, creators of the method encountered some problems in their experiments, but resolved successfully, which made this augmentation type really fast.
In real world scenario, MixUp will be coded as follows:
Take one batch of training data.Sample MixUp alpha value from the beta distribution. (Very high probability of alpha being close to 0 or 1)
Take one batch of training data.
Sample MixUp alpha value from the beta distribution. (Very high probability of alpha being close to 0 or 1)
3. Shuffle your training data batch to get a pair image for the image in an original batch.
4. Apply MixUp formula for image pairs.
Creators of this method also provided a PyTorch compatible callback and loss, to be used on model training.
In case, you want to master your PyTorch coding skills (in terms of creating callbacks, custom losses and custom pipelines), especially for Computer Vision applications, I highly recommend this book to start your journey. It helped me a lot.
I personally used and continue using this augmentation concept whenever I can and I am constantly getting boosts in model performance when using it. Hope that you will find this concept helpful for yourself as well.
C++ String Library - operator=

It assigns a new value to the string, replacing its current contents.
Following is the declaration for std::string::operator=
tring& operator= (const string& str);
str − It is an another string object.
str − It is an another string object.
s − Pointer to an array of characters.
s − Pointer to an array of characters.
c − Character to fill the string.
c − Character to fill the string.
il − It is an initializer_list object.
il − It is an initializer_list object.
It returns *this.
Never throw any exceptions.
In below example for std::string::operator=.
#include <string>

int main () {
   std::string str1, str2, str3;
   str1 = "Test string: ";
   str2 = 'abc';
   str3 = str1 + str2;

   std::cout << str3  << '\n';
   return 0;
}
The sample output should be like this −
Test string: c  

 Print
 Add Notes
 Bookmark this page
Console.ReadLine() Method in C#

The Console.ReadLine() method in C# is used to read the next line of characters from the standard input stream.
The syntax is as follows −
public static string ReadLine ();
Let us now see an example to implement the Console.ReadLine() method in C# −
using System;
public class Demo{
   public static void Main(){
      string str;
      Console.WriteLine("Enter any subject...");
      str = Console.ReadLine();
      Console.WriteLine("Entered subject = "+str);
   }
}
This will produce the following output −
Enter any subject...
Entered subject = Maths
PHP Scope Resolution Operator (::)

In PHP, the double colon :: is defined as Scope Resolution Operator. It used when when we want to access constants, properties and methods defined at class level. When referring to these items outside class definition, name of class is used along with scope resolution operator. This operator is also called Paamayim Nekudotayim, which in Hebrew means double colon.
<?php
class A{
   const PI=3.142;
   static $x=10;
}
echo A::PI;
echo A::$x;
$var='A';
echo $var::PI;
echo $var::$x;
?>
To access class level items inside any method, keyword - self is used
<?php
class A{
   const PI=3.142;
   static $x=10;
   static function show(){
      echo self::PI . self::$x;
   }
}
A::show();
?>
If a parent class method overridden by a child class and you need to call the corresponding parent method, it must be prefixed with parent keyword and scope resolution operator
 Live Demo
<?php
class testclass{
   public function sayhello(){
      echo "Hello World\n";
   }
}
class myclass extends testclass{
   public function sayhello(){
      parent::sayhello();
      echo "Hello PHP";
   }
}
$obj=new myclass();
$obj->sayhello();
?>
This will produce following output −
Hello World
Hello PHP
numpy.cumsum() in Python - GeeksforGeeks

28 Nov, 2018
numpy.cumsum() function is used when we want to compute the cumulative sum of array elements over a given axis.
Syntax : numpy.cumsum(arr, axis=None, dtype=None, out=None)
Parameters :arr : [array_like] Array containing numbers whose cumulative sum is desired. If arr is not an array, a conversion is attempted.axis : Axis along which the cumulative sum is computed. The default is to compute the sum of the flattened array.dtype : Type of the returned array, as well as of the accumulator in which the elements are multiplied. If dtype is not specified, it defaults to the dtype of arr, unless arr has an integer dtype with a precision less than that of the default platform integer. In that case, the default platform integer is used instead.out : [ndarray, optional] A location into which the result is stored.  -> If provided, it must have a shape that the inputs broadcast to.  -> If not provided or None, a freshly-allocated array is returned.
Return : A new array holding the result is returned unless out is specified, in which case it is returned.
Code #1 : Working
# Python program explaining# numpy.cumsum() functionimport numpy as geek  in_num = 10  print ("Input  number : ", in_num)    out_sum = geek.cumsum(in_num) print ("cumulative sum of input number : ", out_sum) 
Output :
Input  number :  10
cumulative sum of input number :  [10]

 Code #2 :
# Python program explaining# numpy.cumsum() function  import numpy as geek  in_arr = geek.array([[2, 4, 6], [1, 3, 5]])   print ("Input array : ", in_arr)     out_sum = geek.cumsum(in_arr) print ("cumulative sum of array elements: ", out_sum) 
Output :
Input array :  [[2 4 6]
 [1 3 5]]
cumulative sum of array elements:  [ 2  6 12 13 16 21]

 Code #3 :
# Python program explaining# numpy.cumsum() function  import numpy as geek  in_arr = geek.array([[2, 4, 6], [1, 3, 5]])   print ("Input array : ", in_arr)     out_sum = geek.cumsum(in_arr, axis = 1) print ("cumulative sum of array elements taking axis 1: ", out_sum) 
Output :
Input array :  [[2 4 6]
 [1 3 5]]
cumulative sum of array elements taking axis 1:  [[ 2  6 12]
 [ 1  4  9]]

Python numpy-Mathematical Function
Python-numpy
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
How to Install PIP on Windows ?
Enumerate() in Python
Different ways to create Pandas Dataframe
Python String | replace()
*args and **kwargs in Python
Reading and Writing to text files in Python
Create a Pandas DataFrame from Lists
Convert integer to string in Python
Check if element exists in list in Python
Perl | qw Operator - GeeksforGeeks

07 May, 2019
The qw operator in Perl is used to extract each element of the given string as it is in an array of elements in single-quote ( ‘ ‘ ).This function stands for quote word because it considers each word of the given string as it is quoted like qw(Geeks for Geeks) is equivalent to (‘Geeks’, ‘for’, ‘Geeks’).This qw() uses parentheses so it seems like it is a function but it is not. It uses different types of delimiters which are shown below:
@String = qw/Ram is a boy/;
@String = qw{Geeks for Geeks};
@String = qw[Geeks for Geeks];
@String = qw'Geeks for Geeks';
@String = qw"Geeks for Geeks";
@String = qw!Geeks for Geeks!;
@String = qw@Geeks for Geeks@;
Syntax: qw(String)
Parameters:String : It is the input string whose each element is extracted.
Returns: each element of the given string as it is an array of elements in single-quote (”).
Example 1:
#!/usr/bin/perl  # Initialising a String as the parameter of qw# operator whose each element is extracted.@String = qw(GfG is a computer science portal);foreach $key (@String) {   print"Element is: $key\n";}
Output:
Element is: GfG
Element is: is
Element is: a
Element is: computer
Element is: science
Element is: portal

Example 2:
#!/usr/bin/perl  # Initialising a String as the parameter of qw# operator whose each element is extracted.@String = qw(Delhi Mumbai Kolkata Patna);foreach $key (@String) {   print"City name is: $key\n";}
Output :
City name is: Delhi
City name is: Mumbai
City name is: Kolkata
City name is: Patna

Note: The qw operator reads a white-space and extract elements before and after the white-space.
perl-operators
Perl-String-Operators
Perl
Perl
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Perl | Polymorphism in OOPs
Perl | Arrays (push, pop, shift, unshift)
Perl | Arrays
Perl Tutorial - Learn Perl With Examples
Use of print() and say() in Perl
Perl | length() Function
Perl | join() Function
Perl | Basic Syntax of a Perl Program
Perl | substitution Operator
Perl | Subroutines or Functions