code-rag-bench/online-tutorials huggingface dataset:
Table operations in MS SQL Server - GeeksforGeeks

17 Sep, 2020
In a relational database, the data is stored in the form of tables and each table is referred to as a relation. A table can store a maximum of 1000 rows. Tables are a preferred choice as:
Tables are arranged in an organized manner. 
We can segregate the data according to our preferences in the form of rows and columns.
Data retrieval and manipulation become easier.
You can identify if there are any repetitive data. 
You can also add new columns without interrupting the previous data in the table.
A table has a combination of rows and columns. Rows are called records and columns are called fields. In MS SQL Server, the tables are being designated within the database and schema names. 
The syntax for naming the table –
create table[db_name] [schema_name] table_name col1 datatype,......); 
Example –
create table student 
(
name varchar2(30),
rollnumber int primary key, 
course varchar2(10)
);
A table with the name student will be created in the database. A few values can be inserted as follows.
insert into student values('Aisha', 111, 'CSE');
insert into student values('Naina', 112, 'ECE');
Output –
The values are now inserted using the insert keyword. There are other operations that can be performed on the table:
Alter table add column :
A student table has so many attributes in it. In case a user wants to add a new column, it can be done as follows.
alter table table_name add column_name datatype column_constraint;
Suppose a user wants to add age of student in the student table, it can be done as follows.
alter table student add age int; 
The age column will be created. The user can insert age in the table as follows:
insert into student values('Aisha', 111, 'CSE', 18);
insert into student values('Naina', 112, 'ECE', 19);
Output –
Alter table drop column :
There are some columns that remain unused or rarely during the life cycle of a database. In order to delete them from the table, It has to be done as follows.
alter table table_name drop column column_name;
In the student table, age is one attribute that is unused. To delete the column, the query must be given as follows:
alter table student drop column age;
Output –
It removes the data from database records. It means the data is permanently removed and cannot be retrieved again.
DBMS-SQL
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?
How to Create a Table With Multiple Foreign Keys in SQL?
What is Temporary Table in SQL?
SQL | Subquery
SQL Query to Convert VARCHAR to INT
SQL Query to Find the Name of a Person Whose Name Starts with Specific Letter
SQL using Python
How to Select Data Between Two Dates and Times in SQL Server?
How to Write a SQL Query For a Specific Date Range and Date Time?
SQL Query to Compare Two Dates
Batch Script - Arithmetic operators

Batch Script language supports the normal Arithmetic operators as any language. Following are the Arithmetic operators available.
The following code snippet shows how the various operators can be used.
@echo off
SET /A a = 5
SET /A b = 10
SET /A c = %a%+%b%
echo %c%
SET /A c = %a%-%b%
echo %c%
SET /A c = %b%*%a%
echo %c%
SET /A c = %b%/%a%
echo %c%
SET /A c =%b% %% %a%
echo %c%
The above command produces the following output.
15
-5
50
2
0

 Print
 Add Notes
 Bookmark this page
set clear() in python - GeeksforGeeks

31 Dec, 2017
The clear() method removes all elements from the set.
Syntax:
set.clear()
parameters:
The clear() method doesn't take any parameters.
Return:
The clear() method doesn't return any value.

# set of lettersGEEK = {'g', 'e', 'e', 'k', 's'}print('GEEK before clear:', GEEK)  # clearing vowelsGEEK.clear()print('GEEK after clear:', GEEK)
Output:
GEEK before clear: set(['s', 'e', 'k', 'g'])
GEEK after clear: set([])

Application:
It is used to clear set.

# set of lettersGEEK = {6, 0, 4, 1}print('GEEK before clear:', GEEK)  # clearing vowelsGEEK.clear()print('GEEK after clear:', GEEK) 
Output:
GEEK before clear: set([0, 1, 4, 6])
GEEK after clear: set([])

python-set
Python
python-set
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Read JSON file using Python
Adding new column to existing DataFrame in Pandas
Python map() function
How to get column names in Pandas dataframe
Python Dictionary
Taking input in Python
Read a file line by line in Python
Enumerate() in Python
How to Install PIP on Windows ?
Iterate over a list in Python
Templates and Static variables in C++ - GeeksforGeeks

29 May, 2017
Function templates and static variables:Each instantiation of function template has its own copy of local static variables. For example, in the following program there are two instances: void fun(int ) and void fun(double ). So two copies of static variable i exist.
#include <iostream>  using namespace std;  template <typename T>void fun(const T& x){  static int i = 10;  cout << ++i;  return;}  int main(){      fun<int>(1);  // prints 11  cout << endl;  fun<int>(2);  // prints 12  cout << endl;  fun<double>(1.1); // prints 11  cout << endl;  getchar();  return 0;}
Output of the above program is:
  11
  12
  11

Class templates and static variables:The rule for class templates is same as function templatesEach instantiation of class template has its own copy of member static variables. For example, in the following program there are two instances Test and Test. So two copies of static variable count exist.
#include <iostream>  using namespace std;  template <class T> class Test{  private:  T val; public:  static int count;  Test()  {    count++;  }  // some other stuff in class};  template<class T>int Test<T>::count = 0;  int main(){  Test<int> a;  // value of count for Test<int> is 1 now  Test<int> b;  // value of count for Test<int> is 2 now  Test<double> c;  // value of count for Test<double> is 1 now  cout << Test<int>::count   << endl;  // prints 2    cout << Test<double>::count << endl; //prints 1       getchar();  return 0;}
Output of the above program is:
  2
  1

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
C++
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Inheritance in C++
C++ Classes and Objects
Constructors in C++
Socket Programming in C/C++
Operator Overloading in C++
Copy Constructor in C++
vector erase() and clear() in C++
rand() and srand() in C/C++
Virtual Function in C++
unordered_map in C++ STL
What are executable statements in C language?

A ‘C’ program contains executable statements. A compiler helps to translate the executable statements into machine language.
When a user runs the program, he/she machines the language statements which are executed by the compiler.
The types of executable statements in C language are as follows −
Input – output statements
Assignment statements
Storing a value into memory is called ‘input operation’.
Storing a value into memory is called ‘input operation’.
After executing the computations, the results are stored in memory and the results can be displayed to the user by ‘output operation’.
After executing the computations, the results are stored in memory and the results can be displayed to the user by ‘output operation’.
All i/o operations are performed using input / output functions.
All i/o operations are performed using input / output functions.
The most common I/O functions are supplied through the preprocessor directive # include<stdio.h>.
The most common I/O functions are supplied through the preprocessor directive # include<stdio.h>.
The most commonly used I/O functions are printf ( ) and scanf ( ).
The most commonly used I/O functions are printf ( ) and scanf ( ).
printf ( ) function
The syntax is as follows −
printf("format string", print list);
For example,
printf ("average of 3 numbers = %f",avg);
The printf ( ) displays the value of its format string
The printf ( ) displays the value of its format string
scanf ( ) function
The syntax is as follows −
scanf ("format string", input list);
For example, scanf ("%d %f", &a, &b);
The scanf ( ) copies data typed at the keyboard into memory during program execution.
The scanf ( ) copies data typed at the keyboard into memory during program execution.
The input list is preceded by ampersand ( &).
The input list is preceded by ampersand ( &).
The assignment statements store a value in a variable and is used to perform arithmetic operations in a program.
Syntax
The syntax is as follows −
variable=expression
For example,
c = a+b;
avg = sum/3;
r1 = (b*b – 4 * a*c);
Following is the C program for computing an average of three numbers −
 Live Demo
#include<stdio.h>
#include<stdio.h>
main(){
   int a,b,c,d;
   float avg;
   printf("Enter values for a,b,c:\n");
   scanf("%d%d%d",&a,&b,&c);// The scanf ( ) copies data typed at the keyboard into
   //memory during program execution.
   d=a+b+c; //assignment stmt
   avg=d/3;
   printf("Average avg=%f",avg);
}
You will see the following output −
Enter values for a,b,c:2 3 4
Average avg=3.000000
How to Assign Colors to Categorical Variable in ggplot2 Plot in R ? - GeeksforGeeks

24 Jun, 2021
In this article, we will see how to assign colors to categorical Variables in the ggplot2 plot in R Programming language. 
Note: Here we are using a scatter plot, the same can be applied to any other graph.
Dataset in use:
To Create an R plot, we use ggplot() function and to make it scatter plot we add geom_point() function to ggplot() function. By Default, the plot has following colors.
Example:
R
# Load Librarylibrary(ggplot2)  # Create DataFrame for Plotting.data <- data.frame(Year = c(2011, 2012, 2013, 2014, 2015),                   Points = c(30, 20, 15, 35, 50),                   Users = c("user1", "user2", "user3",                             "user4", "user5"))  # Create ggplot2 ScatterPlot.ggplot(data, aes(Year, Points, color = Users)) +     geom_point(size = 10)
Output:
ScatterPlot using ggplot2 with default colors
In R Programming, we have many in built function for creating our own discrete scales such as scale_fill_manual, scale_size_manual, scale_shape_manual, scale_linetype_manual, etc. To assign desired colors to categorical data, we use one of them scale_color_manual() function, which is used to scale (map) the manual colors.
 Syntax : scale_color_manual(values)
Parameter :
values : A set of aesthetic values to map the data. Here we take desired set of colors.
Return : Scale the manual values of colors on data.
Example:
R
# Load Librarylibrary(ggplot2)  # Create DataFrame for Plottingdata <- data.frame(Year = c(2011, 2012, 2013, 2014, 2015),                   Points = c(30, 20, 15, 35, 50),                   Users = c("user1", "user2", "user3",                             "user4", "user5"))  # Create a ScatterPlot with fixed colors of # points(data).ggplot(data, aes(Year, Points, color = Users)) +     geom_point(size = 10)+  scale_color_manual(values = c("green", "orange", "red",                                "yellow", "blue"))
Output :
Plot with fixed colors
Picked
R-ggplot
R Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Control Statements in R Programming
How to Replace specific values in column in R DataFrame ?
Change Color of Bars in Barchart using ggplot2 in R
Group by function in R using Dplyr
Data Visualization in R
How to change Row Names of DataFrame in R ?
How to Change Axis Scales in R Plots?
Logistic Regression in R Programming
Remove rows with NA in one column of R DataFrame
K-Means Clustering in R Programming
How to create a table in Oracle using JDBC?

You can create a table in a database using the CREATE TABLE query.
CREATE TABLE table_name(
   column1 datatype,
   column2 datatype,
   column3 datatype,
   .....
   columnN datatype,
   PRIMARY KEY( one or more columns )
);
To create a table in a database using JDBC API you need to −
Register the Driver: Register the driver class using the registerDriver() method of the DriverManager class. Pass the driver class name to it, as parameter.
Establish a connection: Connect ot the database using the getConnection() method of the DriverManager class. Passing URL (String), username (String), password (String) as parameters to it.
Create Statement: Create a Statement object using the createStatement() method of the Connection interface.
Execute the Query: Execute the query using the execute() method of the Statement interface.
Following JDBC program establishes connection with Oracle database and creates a table named DISPATCHES −
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
public class CreateTable_Oracle {
   public static void main(String args[]) throws SQLException {
      //Registering the Driver
      DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
      //Getting the connection
      String oracleUrl = "jdbc:oracle:thin:@localhost:1521/xe";
      Connection con = DriverManager.getConnection(oracleUrl, "system", "password");
      System.out.println("Connection established......");
      //Creating the Statement
      Statement stmt = con.createStatement();
      //Query to create a table
      String query = "CREATE TABLE DISPATCHES("
      + "ProductName VARCHAR (20) NOT NULL, "
      + "CustomerName VARCHAR (20) NOT NULL, "
      + "DispatchDate date, "
      + "DeliveryTime timestamp, "
      + "Price INT, "
      + "Location varchar(20))";
      stmt.execute(query);
      System.out.println("Table Created......");
   }
}
Connection established......
Table Created......
In oracle you can get the list of tables using the query/command −
Select * from tab;
If you verify the list of tables in the database using this, you can observe the newly created table in it as −
Python dictionary | values() - GeeksforGeeks

22 Nov, 2021
values() is an inbuilt method in Python programming language that returns a view object. The view object contains the values of the dictionary, as a list. If you use the type() method on the return value, you get “dict_values object”. It must be cast to obtain the actual list.
Syntax:
dictionary_name.values()
Parameters:There are no parameters
Returns:
returns a list of all the values available in a given dictionary.
the values have been stored in a reversed manner.
Error:
As we are not passing any parameters there
is no scope for any error.
Code#1:
# Python3 program for illustration # of values() method of dictionary     # numerical valuesdictionary = {"raj": 2, "striver": 3, "vikram": 4}print(dictionary.values())      # string valuesdictionary = {"geeks": "5", "for": "3", "Geeks": "5"}print(dictionary.values())  
Output:
dict_values([2, 3, 4])
dict_values(['5', '3', '5'])

Practical Application:Given name and salary, return the total salary of all employees.
Code#2:
# Python3 program for illustration # of values() method in finding total salary    # stores name and corresponding salariessalary = {"raj" : 50000, "striver" : 60000, "vikram" : 5000}   # stores the salaries onlylist1 = salary.values() print(sum(list1))  # prints the sum of all salaries
Output:
115000

python-dict
Python
python-dict
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Read JSON file using Python
Adding new column to existing DataFrame in Pandas
Python map() function
How to get column names in Pandas dataframe
Python Dictionary
Taking input in Python
Read a file line by line in Python
How to Install PIP on Windows ?
Enumerate() in Python
Different ways to create Pandas Dataframe
C# | How to get a subset in a SortedSet - GeeksforGeeks

01 Feb, 2019
SortedSet class represents the collection of objects in sorted order. This class comes under the System.Collections.Generic namespace. SortedSet<T>.GetViewBetween(T, T) method is used to return a view of a subset in a SortedSet<T>.
Properties:
In C#, SortedSet class can be used to store, remove or view elements.
It maintains ascending order and does not store duplicate elements.
It is suggested to use SortedSet class if you have to store unique elements and maintain ascending order.
Syntax: public virtual System.Collections.Generic.SortedSet<T> GetViewBetween (T lowerValue, T upperValue);
Parameters:lowerValue: The lowest desired value in the view.upperValue: The highest desired value in the view.
Return Value: A subset view that contains only the values in the specified range.
Exceptions :
ArgumentException: If lowerValue is more than upperValue according to the comparer.
ArgumentOutOfRangeException: A tried operation on the view was outside the range specified by lowerValue and upperValue.
Example 1:
// C# code to get the subset of a SortedSetusing System;using System.Collections.Generic;  class GFG {      // Driver code    public static void Main()    {          // Creating a SortedSet of strings        SortedSet<string> mySet1 = new SortedSet<string>();          // Inserting elements in SortedSet        mySet1.Add("A");        mySet1.Add("B");        mySet1.Add("C");        mySet1.Add("D");        mySet1.Add("E");        mySet1.Add("F");        mySet1.Add("G");        mySet1.Add("H");        mySet1.Add("I");          // Get the subset between "C" and "G"        SortedSet<string> mySet2 = mySet1.GetViewBetween("C", "G");          // Displaying the elements in the subset        foreach(string str in mySet2)        {            Console.WriteLine(str);        }    }}
C
D
E
F
G

Example 2:
// C# code to get the subset of a SortedSetusing System;using System.Collections.Generic;  class GFG {      // Driver code    public static void Main()    {          // Creating a SortedSet of integers        SortedSet<int> mySet1 = new SortedSet<int>();          // Inserting elements in SortedSet        for (int i = 0; i < 10; i++) {            mySet1.Add(i);        }          // Get the subset between "3" and "7"        SortedSet<int> mySet2 = mySet1.GetViewBetween(3, 7);          // Displaying the elements in the subset        foreach(int i in mySet2)        {            Console.WriteLine(i);        }    }}
3
4
5
6
7

Reference:
https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.sortedset-1.getviewbetween?view=netcore-2.1
CSharp-Generic-Namespace
CSharp-Generic-SortedSet
CSharp-method
C#
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Extension Method in C#
Top 50 C# Interview Questions & Answers
HashSet in C# with Examples
C# | How to insert an element in an Array?
Partial Classes in C#
C# | Inheritance
C# | List Class
Lambda Expressions in C#
Difference between Hashtable and Dictionary in C#
Convert String to Character Array in C#
How to define a caption for a fieldset element in HTML5 ? - GeeksforGeeks

02 Jun, 2020
In this article, we define a caption for a fieldset element by using the legend element. It is used to define the title for the child contents. The legend elements are the parent element.
Syntax:
<legend> Content... </legend>
Example:
<!DOCTYPE html><html>  <head>    <title>Legend Tag</title>    <style>        form {            width: 50%;        }          label {            display: inline-block;            float: left;            clear: left;            width: 90px;            margin: 5px;            text-align: left;        }          input[type="text"] {            width: 250px;            margin: 5px 0px;        }          .gfg {            font-size: 40px;            color: green;            font-weight: bold;        }    </style></head>  <body>    <div class="gfg">        GeeksforGeeks    </div>          <h2>Legend tag</h2>          <form>        <fieldset>            <legend>STUDENT::</legend>            <label>Name:</label>            <input type="text">            <br>                          <label>Email:</label>            <input type="text">            <br>                          <label>Date of birth:</label>            <input type="text">            <br>                          <label>Address:</label>            <input type="text">            <br>                          <label>Enroll No:</label>            <input type="text">        </fieldset>    </form></body>  </html>
Output:
Supported Browsers:
Google Chrome
Internet Explorer
Firefox
Opera
Safari
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.
HTML-Misc
HTML
Web Technologies
Web technologies Questions
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to update Node.js and NPM to next version ?
How to Insert Form Data into Database using PHP ?
Types of CSS (Cascading Style Sheet)
REST API (Introduction)
Form validation using HTML and JavaScript
Roadmap to Become a Web Developer in 2022
Installation of Node.js on Linux
How to fetch data from an API in ReactJS ?
Top 10 Angular Libraries For Web Developers
Convert a string to an integer in JavaScript
Difference between Object level lock and Class level lock in Java

In multithreading environment, two or more threads can access the shared resources simultaneously which can lead the inconsistent behavior of the system. Java uses concept of locks to restrict concurrent access of shared resources or objects. Locks can be applied at two levels −
Object Level Locks − It can be used when you want non-static method or non-static block of the code should be accessed by only one thread.
Class Level locks − It can be used when we want to prevent multiple threads to enter the synchronized block in any of all available instances on runtime. It should always be used to make static data thread safe. 
1
Basic 
It can be used when you want non-static method or non-static block of the code should be accessed by only one thread
It can be used when we want to prevent multiple threads to enter the synchronized block in any of all available instances on runtime
2
Static/Non Static 
It should always be used to make non-static data thread safe. 
It should always be used to make static data thread safe. 
3
Number of Locks 
Every object the class may have their own lock
Multiple objects of class may exist but there is always one class’s class object lock available
public class ClassLevelLockExample {
   public void classLevelLockMethod() {
      synchronized (ClassLevelLockExample.class) {
         //DO your stuff here
      }
   }
}
public class ObjectLevelLockExample {
   public void objectLevelLockMethod() {
      synchronized (this) {
         //DO your stuff here
      }
   }
}
Python program to find all the Combinations in the list with the given condition - GeeksforGeeks

05 Sep, 2020
Given a list with some elements being a list of optional elements. The task is to find all the possible combinations from all options.
Examples:
Input : test_list = [“geekforgeeks”, [5, 4, 3], “is”, [“best”, “good”, “better”]], K = 3 Output : [[‘geekforgeeks’, 5, ‘is’, ‘best’], [‘geekforgeeks’, 4, ‘is’, ‘good’], [‘geekforgeeks’, 3, ‘is’, ‘better’]] Explanation : Inner elements picked and paired with similar indices. 5 -> “best”.
Input : test_list = [“geekforgeeks”, [5, 4], “is”, [“best”, “good”]], K = 2 Output : [[‘geekforgeeks’, 5, ‘is’, ‘best’], [‘geekforgeeks’, 4, ‘is’, ‘good’]] Explanation : Inner elements picked and paired with similar indices. 5 -> “best”.  
Method: Using a loop
In this, we use a nested loop to get index wise combinations from each nested option list, and then the outer loop is used to get default values in all combinations.
Python3
# Python3 code to demonstrate working of # Optional Elements Combinations# Using loop  # initializing listtest_list = ["geekforgeeks", [5, 4, 3, 4], "is",              ["best", "good", "better", "average"]]  # printing original listprint("The original list is : " + str(test_list))  # initializing size of inner Optional list K = 4  res = []cnt = 0while cnt <= K - 1:    temp = []          # inner elements selections    for idx in test_list:                  # checks for type of Elements        if not isinstance(idx, list):            temp.append(idx)        else:            temp.append(idx[cnt])    cnt += 1    res.append(temp)  # printing result print("All index Combinations : " + str(res))
Output:
The original list is : [‘geekforgeeks’, [5, 4, 3, 4], ‘is’, [‘best’, ‘good’, ‘better’, ‘average’]]
All index Combinations : [[‘geekforgeeks’, 5, ‘is’, ‘best’], [‘geekforgeeks’, 4, ‘is’, ‘good’], [‘geekforgeeks’, 3, ‘is’, ‘better’], [‘geekforgeeks’, 4, ‘is’, ‘average’]]
Python list-programs
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Python Dictionary
How to Install PIP on Windows ?
Enumerate() in Python
Read a file line by line in Python
Iterate over a list in Python
Defaultdict in Python
Python | Get dictionary keys as a list
Python | Split string into list of characters
Python | Convert a list to dictionary
Python program to check whether a number is Prime or not
Accolite Interview Experience | Off-Campus Internship 2020 - GeeksforGeeks

30 Sep, 2020
I sent my resume to the HR team for an off-campus internship at Accolite, and after 1 week I got a call from HR that my resume has been shortlisted, and they are skipping the online coding round in my case because of good coding profile to direct Technical round.
Round 1 (Technical Interview 1Hr): Firstly she asked me to introduce myself and tell a few things which are not mentioned in my CV.
Then asked me a coding question:
Given a binary tree and I have to print the left view of the given binary tree using O(1) space. I was first asked to discuss the approach and then to write code. Then she extended the question to print all views (left, right, top, bottom) of the binary tree and write the code for the same.Then she asked to print the zig-zag order of the given tree. 
Given a binary tree and I have to print the left view of the given binary tree using O(1) space. I was first asked to discuss the approach and then to write code. 
Then she extended the question to print all views (left, right, top, bottom) of the binary tree and write the code for the same.
Then she asked to print the zig-zag order of the given tree. 
Round 2 (Technical Interview 1Hr 30 min): Without spending much time he came straight to the coding ques. Given an undirected graph, with the cost of traveling on every path, we have to reach the destination at minimum cost. I told him that we can solve this using the Dijkstra algorithm and wrote the complete code. He was happy with my quick approach to the solution.
Given an undirected graph, with the cost of traveling on every path, we have to reach the destination at minimum cost. I told him that we can solve this using the Dijkstra algorithm and wrote the complete code. He was happy with my quick approach to the solution.
Then he gave me another coding question, given an array, I have to find any the longest sinusoidal subsequence in the array and print it.For example:
Input: arr[] = {10, 22, 9, 33, 49, 50, 31, 60}
Output: 6
One such longest subsequence = {10, 22, 9, 33, 31, 60}
After 10-15 mins of thinking I gave him a proper solution. https://www.geeksforgeeks.org/longest-zig-zag-subsequence/
Round 3:  HR Interview (30 min)
Where do you see yourself in 2 years?Why Accolite?Some discussions on my previous project.
Where do you see yourself in 2 years?
Why Accolite?
Some discussions on my previous project.
Verdict: selected
Accolite
Marketing
Off-Campus
Internship
Interview Experiences
Accolite
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Microsoft Interview Experience for Internship (Via Engage)
OLX Interview Experience (On-Campus)
Zoho Interview Experience (Off-Campus ) 2022
Zoho Corporation (Internship cum Offer Experience )
Persistent Systems Interview Experience (Martian Program)
Amazon Interview Questions
Commonly Asked Java Programming Interview Questions | Set 2
Amazon Interview Experience for SDE-1 (On-Campus)
Difference between ANN, CNN and RNN
Amazon Interview Experience for SDE-1
Bootstrap navbar-default class

The navbar-default class in Bootstrap is used to create a navigation bar.
You can try to run the following code to implement a navbar-default class
Live Demo
<!DOCTYPE html>
<html>
   <head>
      <title>Bootstrap Example</title>
      <link href = "/bootstrap/css/bootstrap.min.css" rel = "stylesheet">
      <script src = "/scripts/jquery.min.js"></script>
      <script src = "/bootstrap/js/bootstrap.min.js"></script>
   </head>
   <body style = "background: #F5CBA7;">
      <nav class = "navbar navbar-default" role = "navigation">
         <div class = "navbar-header">
            <a class = "navbar-brand" href = "#">Cars</a>
         </div>
         <div>
            <ul class = "nav navbar-nav">
               <li class = "active"><a href = "#">BMW</a></li>
               <li><a href = "#">Audi</a></li>
            </ul>
         </div>
      </nav>
   </body>
</html>
LocalDate minusDays() method in Java with Examples

31 Oct, 2020
The minusDays() method of LocalDate class in Java is used to subtract the number of specified day from this LocalDate and return a copy of LocalDate.For example, 2019-01-01 minus one day would result in 2018-12-31. This instance is immutable and unaffected by this method call.
Syntax:
public LocalDate minusDays(long daysToSubtract)

Parameters: This method accepts a single parameter daysToSubtract which represents the days to subtract, may be negative.
Return value: This method returns a LocalDate based on this date with the days subtracted, not null.
Exception: This method throws DateTimeException if the result exceeds the supported date range.
Below programs illustrate the minusDays() method:Program 1:
// Java program to demonstrate// LocalDate.minusDays() method  import java.time.*;  public class GFG {    public static void main(String[] args)    {          // create a LocalDate object        LocalDate date            = LocalDate.parse("2018-11-13");          // print instance        System.out.println("LocalDate before"                           + " subtracting days: " + date);          // subtract 17 days        LocalDate returnvalue            = date.minusDays(17);          // print result        System.out.println("LocalDate after "                           + " subtracting days: " + returnvalue);    }}
LocalDate before subtracting days: 2018-11-13
LocalDate after  subtracting days: 2018-10-27

Program 2:
// Java program to demonstrate// LocalDate.minusDays() method  import java.time.*;  public class GFG {    public static void main(String[] args)    {          // create a LocalDate object        LocalDate date            = LocalDate.parse("2018-12-24");          // print instance        System.out.println("LocalDate before"                           + " subtracting days: " + date);          // subtract -15 days        LocalDate returnvalue            = date.minusDays(-15);          // print result        System.out.println("LocalDate after "                           + " subtracting days: " + returnvalue);    }}
LocalDate before subtracting days: 2018-12-24
LocalDate after  subtracting days: 2019-01-08

Reference:https://docs.oracle.com/javase/10/docs/api/java/time/LocalDate.html#minusDays(long)
nidhi_biet
w977741432
Java-Functions
Java-LocalDate
Java-time package
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
PrintWriter setError() method in Java with Examples

31 Jan, 2019
The setError() method of PrintWriter Class in Java is used to set the error state of this PrintWriter instance. This method is used as an indicator to indicate that an error has occurred in the stream. It is protected and hence needs to be implemented by deriving the PrintWriter class to use it.
Syntax:
protected void setError()
Parameters: This method do not accepts any parameter.
Return Value: This method do not return anything.
Below methods illustrates the working of setError() method:
Program 1:
// Java program to demonstrate// PrintWriter setError() method  import java.io.*;  // extending the PrintWriter Classclass GFG extends PrintWriter {      // Defining the protected constructor    public GFG(OutputStream out)    {        super(System.out);    }      // Driver Code    public static void main(String[] args)    {          // The string to be written in the Writer        String str = "GeeksForGeeks";          try {              // Create a GFG instance            GFG writer                = new GFG(System.out);              // Write the above string to this writer            // This will put the string in the stream            // till it is printed on the console            writer.write(str);              writer.flush();              // Use the protected setError() method            writer.setError();        }        catch (Exception e) {            System.out.println(e);        }    }}
GeeksForGeeks

Program 2:
// Java program to demonstrate// PrintWriter setError() method  import java.io.*;  // extending the PrintWriter Classclass GFG extends PrintWriter {      // Defining the protected constructor    public GFG(OutputStream out)    {        super(System.out);    }      // Driver Code    public static void main(String[] args)    {          try {              // Create a GFG instance            GFG writer                = new GFG(System.out);              // Write the char to this writer            // This will put the char in the stream            // till it is printed on the console            writer.write(65);              writer.flush();              // Use the protected setError() method            writer.setError();        }        catch (Exception e) {            System.out.println(e);        }    }}
A

Java-Functions
Java-IO package
Java-PrintWriter
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Join an array of strings into a single string in Julia – join() Method

23 Feb, 2021
The join() is an inbuilt function in julia that is used to join an array of strings into a single string. The specified delimiter is used to insert in between the returned strings. 
Syntax: 
join([io::IO, ] strings, delim, last) 
Parameters: 
[io::IO, ] strings: Specified string.
delim: Specified delimiter.
last: If last is given then this last parameter is inserted in between the last two strings.
Returns: It returns a new single string.  Example 1: 
Python
# Julia program to illustrate# the use of String join() method # Joining an array of strings into a single string.println(join(["Geeks", "for", "Geeks"]))println(join(["Geeks", "for", "Geeks"], "-"))println(join(["Geeks", "for", "Geeks"], "+"))println(join(["Geeks", "for", "Geeks"], "-", "+"))println(join(["Geeks", "for", "Geeks", "is", "CSE", "portal"], "-", "+"))
Output:  
GeeksforGeeks
Geeks-for-Geeks
Geeks+for+Geeks
Geeks-for+Geeks
Geeks-for-Geeks-is-CSE+portal
Example 2: 
Python
# Julia program to illustrate# the use of String join() method # Joining an array of strings into a single string.println(join(["1", "2", "3"]))println(join(["1", "2", "3"], "-"))println(join(["1", "2", "3"], "+"))println(join(["1", "2", "3"], "-", "+"))println(join(["1", "2", "3", "4", "5", "6"], "-", "+"))
Output:  
123
1-2-3
1+2+3
1-2+3
1-2-3-4-5+6
 
arorakashish0911
Julia
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python – Convert Matrix to dictionary

30 Dec, 2020
Given a Matrix, convert it into dictionary with keys as row number and value as nested list.
Input : test_list = [[5, 6, 7], [8, 3, 2]]Output : {1: [5, 6, 7], 2: [8, 3, 2]}Explanation : Matrix rows are paired with row number in order.
Input : test_list = [[5, 6, 7]]Output : {1: [5, 6, 7]}Explanation : Matrix rows are paired with row number in order.
Method #1 : Using dictionary comprehension + range()
The combination of above functions can be used to solve this problem. In this, we perform the task of iteration using dictionary comprehension and range() can be used to perform numbering of rows. 
Python3
# Python3 code to demonstrate working of # Convert Matrix to dictionary # Using dictionary comprehension + range()  # initializing listtest_list = [[5, 6, 7], [8, 3, 2], [8, 2, 1]]   # printing original listprint("The original list is : " + str(test_list))  # using dictionary comprehension for iterationres = {idx + 1 : test_list[idx] for idx in range(len(test_list))}  # printing result print("The constructed dictionary : " + str(res))
The original list is : [[5, 6, 7], [8, 3, 2], [8, 2, 1]]
The constructed dictionary : {1: [5, 6, 7], 2: [8, 3, 2], 3: [8, 2, 1]}

Method #2 : Using dictionary comprehension + enumerate()
The combination of above functions can be used to solve this problem. In this, dictionary comprehension help in construction of dictionary and enumerate() helps in iteration like range() in above method.
Python3
# Python3 code to demonstrate working of # Convert Matrix to dictionary # Using dictionary comprehension + enumerate()  # initializing listtest_list = [[5, 6, 7], [8, 3, 2], [8, 2, 1]]   # printing original listprint("The original list is : " + str(test_list))  # enumerate used to perform assigning row numberres = {idx: val for idx, val in enumerate(test_list, start = 1)}  # printing result print("The constructed dictionary : " + str(res))
The original list is : [[5, 6, 7], [8, 3, 2], [8, 2, 1]]
The constructed dictionary : {1: [5, 6, 7], 2: [8, 3, 2], 3: [8, 2, 1]}

Python dictionary-programs
Python list-programs
Python matrix-program
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Different ways to create Pandas Dataframe
Enumerate() in Python
Read a file line by line in Python
Python String | replace()
Python program to convert a list to string
Defaultdict in Python
Python | Get dictionary keys as a list
Python | Convert a list to dictionary
Python | Convert string dictionary to dictionary
Python | Flatten a 2d numpy array into 1d array

15 Mar, 2019
Given a 2d numpy array, the task is to flatten a 2d numpy array into a 1d array. Below are a few methods to solve the task.
Method #1 : Using np.flatten()
# Python code to demonstrate# flattening a 2d numpy array# into 1d array  import numpy as np  ini_array1 = np.array([[1, 2, 3], [2, 4, 5], [1, 2, 3]])  # printing initial arraysprint("initial array", str(ini_array1))  # Multiplying arraysresult = ini_array1.flatten()  # printing resultprint("New resulting array: ", result)
initial array [[1 2 3]
 [2 4 5]
 [1 2 3]]
New resulting array:  [1 2 3 2 4 5 1 2 3]

 Method #2: Using np.ravel()
# Python code to demonstrate# flattening a 2d numpy array# into 1d array  import numpy as np  ini_array1 = np.array([[1, 2, 3], [2, 4, 5], [1, 2, 3]])  # printing initial arraysprint("initial array", str(ini_array1))  # Multiplying arraysresult = ini_array1.ravel()  # printing resultprint("New resulting array: ", result)
initial array [[1 2 3]
 [2 4 5]
 [1 2 3]]
New resulting array:  [1 2 3 2 4 5 1 2 3]

 Method #3: Using np.reshape()
# Python code to demonstrate# flattening a 2d numpy array# into 1d array  import numpy as np  ini_array1 = np.array([[1, 2, 3], [2, 4, 5], [1, 2, 3]])  # printing initial arraysprint("initial array", str(ini_array1))  # Multiplying arraysresult = ini_array1.reshape([1, 9])  # printing resultprint("New resulting array: ", result)
initial array [[1 2 3]
 [2 4 5]
 [1 2 3]]
New resulting array:  [[1 2 3 2 4 5 1 2 3]]

Python numpy-program
Python-numpy
Python
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
Read a file line by line in Python
How to Install PIP on Windows ?
Python String | replace()
*args and **kwargs in Python
Python Classes and Objects
Python OOPs Concepts
Iterate over a list in Python
Introduction To PYTHON
HTTP headers | If-Modified-Since

15 May, 2020
The If-Modified-Since header is a request-header that is sent to a server as a conditional request. If the contents have changed, the server responds with a 200 status code and the entire requested document is updated. The If-Modified-Since HTTP header indicates the time for which a browser first downloaded a resource from the server. This helps to determine whether the resource has changed or not, since the last time it was accessed. If the status of a particular resource is 304 Not Modified, this means that the file has not changed and there is no need to download it again.
Let us take an example of this website i.e. GeeksforGeeks, it has different pages about computer science subjects. Whenever a search engine visits this website, it will check each page of the website and if none of the pages have changed, it will not load any of those pages. But if there is a change in any one of its pages, a flag will raise. So when the search engine visits, it will see the flag for the changed page, and then it will access that page.
Note: When used in combination with the If-None-Match, it is ignored, unless the server does not support If-None-Match.
Syntax:
If-Modified-Since: <day-name>, <day> <month> <year> <hour>:<minute>:<second> GMT
Directives: This header accept eight directive as mentioned above and described below:
<day name>: It contains the day’s name like “Mon”, “Tue” etc.(case-sensitive).
<day>: It contains the date in 2 digit numbers, like “04” or “23” for days.
<month>: It contains the name of the month, in 3 letter month names like “Jan”, “Feb” etc.(case-sensitive).
<year>: It contains the 4 digit year like “2020”
<hour>: It contains the hour in 2 digit hour like “07” or “12”.
<minute>: Same as hour minutes 2 digit minute like “09” or “55”
<second>: Containing the seconds in 2 digits second like “08” or “50”.
GMT: All the dates in HTTP will show in Greenwich Mean Time format, not in local time format.
Example:
If-Modified-Since: Sun, 10 May 2020 02:01:00 GMT 
Supported Browsers: The browsers supported by HTTP header If-Modified-Since header are listed below:
Google Chrome
Firefox
Internet Explorer
Opera
Safari
HTTP-headers
Picked
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Difference between var, let and const keywords in JavaScript
How to fetch data from an API in ReactJS ?
Differences between Functional Components and Class Components in React
Remove elements from a JavaScript Array
REST API (Introduction)
Node.js fs.readFileSync() Method
How to create footer to stay at the bottom of a Web page?
Roadmap to Learn JavaScript For Beginners
Difference Between PUT and PATCH Request
How to float three div side by side using CSS?
location element method – Selenium Python

07 Jul, 2021
Selenium’s Python Module is built to perform automated testing with Python. Selenium Python bindings provides a simple API to write functional/acceptance tests using Selenium WebDriver. To open a webpage using Selenium Python, checkout – Navigating links using get method – Selenium Python. Just being able to go to places isn’t terribly useful. What we’d really like to do is to interact with the pages, or, more specifically, the HTML elements within a page. There are multiple strategies to find an element using Selenium, checkout – Locating StrategiesThis article revolves around how to use location method in Selenium. location method is used to get location of element in renderable canvas.Syntax –  
element.location
Example –  
html
<input type="text" name="passwd" id="passwd-id" />
To find an element one needs to use one of the locating strategies, For example, 
element = driver.find_element_by_id("passwd-id")
element = driver.find_element_by_name("passwd")
element = driver.find_element_by_xpath("//input[@id='passwd-id']")
Also, to find multiple elements, we can use –  
elements = driver.find_elements_by_name("passwd")
Now one can get location of this field with  
element.location
 
Let’s try to get location of search field in geeksforgeeks. Program –  
Python3
# import webdriverfrom selenium import webdriver # create webdriver objectdriver = webdriver.Firefox() # get geeksforgeeks.orgdriver.get("https://www.geeksforgeeks.org/") # get elementelement = driver.find_element_by_id("gsc-i-id2") # get locationelement.location
Output-  
Terminal Output-  
{'x': 397, 'y': 21}
 
anikakapoor
Python-selenium
selenium
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
The extends Keyword in Java

An object can acquire the properties and behaviour of another object using Inheritance. In Java, the extends keyword is used to indicate that a new class is derived from the base class using inheritance. So basically, extends keyword is used to extend the functionality of the class.
A program that demonstrates the extends keyword in Java is given as follows:
 Live Demo
class A {
   int a = 9;
}
class B extends A {
   int b = 4;
}
public class Demo {
   public static void main(String args[]) {
      B obj = new B();
      System.out.println("Value of a is: " + obj.a);
      System.out.println("Value of b is: " + obj.b);
   }
}
Value of a is: 9
Value of b is: 4
Now let us understand the above program.
The class A contains a data member a.
The class B uses the extends keyword to derive from class A. It also contains a data member b. A code snippet which demonstrates this is as follows:
class A {
   int a = 9;
}
class B extends A {
   int b = 4;
}
In the main() method in class Demo, an object obj of class B is created. Then the values of a and b are printed. A code snippet which demonstrates this is as follows:
public class Demo {
   public static void main(String args[]) {
      B obj = new B();
      System.out.println("Value of a is: " + obj.a);
      System.out.println("Value of b is: " + obj.b);
   }
}
PostgreSQL – ADD COLUMN

28 Aug, 2020
PostgreSQL has an ADD COLUMN statement to add one or more columns to an existing database table. To add a new column to an existing table, you use the ALTER TABLE ADD COLUMN statement.
Syntax:
ALTER TABLE table_name
ADD COLUMN new_column_name data_type;
Let’s analyze the above syntax:
First, specify the table that you want to add a new column in the ALTER TABLE clause.
Second, indicate the column name with its attribute such as data type, default value, etc., in the ADD COLUMN clause.
While adding a new column to the table, PostgreSQL appends it at the end of the table. PostgreSQL has no option to set the position of the new column in the table.
Example 1:First, we create a table (say, village), with village_id and village_name columns using the below statement:
CREATE TABLE village(
    village_id SERIAL PRIMARY KEY,
    village_name VARCHAR NOT NULL
);
Now we add a district column to the table as below:
ALTER TABLE village
ADD COLUMN district VARCHAR;
Now we can verify if the column has been added using the below statement:
SELECT * FROM village;
Output:
Example 2:First, we create a table (say, cars), with car_id and car_name columns using the below statement:
CREATE TABLE cars(
    car_id SERIAL PRIMARY KEY,
    car_name VARCHAR NOT NULL
);
Now we add a modelcolumn to the table as below:
ALTER TABLE cars
ADD COLUMN model VARCHAR;
Now we can verify if the column has been added using the below statement:
SELECT * FROM cars;
Output:
postgreSQL-managing-table
PostgreSQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.