code-rag-bench/online-tutorials huggingface dataset:
How to find all the foreign keys of a DB2 table TAB1?

The foreign key of a DB2 table can be found using SYSIBM.SYSFOREIGNKEYS table and SYSIBM.SYSRELS table. The SYSFOREIGNKEYS is a DB2 system table which contains one row for every column of every foreign key. The SYSRELS table contains details about the referential constraints. In order to find out the foreign key(s) of any table, we can use the below SQL query.
SELECT B.REFTBNAME AS PARENTTABLE,COLNAME
FROM SYSIBM.SYSFOREIGNKEYS A, SYSIBM.SYSRELS B
WHERE A.RELNAME = B.RELNAME
AND B.TBNAME = 'TAB1'
AND B.REFTBCREATOR = A.CREATOR
We will join SYSFOREIGNKEYS and SYSRELS table for the columns RELNAME which stores the details regarding constraint name for the constraint for which the column is part of the foreign key.
How can I create a dropdown menu from a List in Tkinter?

Let us suppose we want to create a dropdown menu of a list in an application using tkinter. In this case, we can use the Tkinter OptionMenu(win, menu_to_set, options) function.
First, we will instantiate an object of StringVar(), then we will set the initial value of the dropdown menu. We will create the dropdown menu by creating an object of OptionMenu and passing the value of window, menu object, and options which are to be displayed.
#Import the required libraries
from tkinter import *

#Create an instance of tkinter frame
win= Tk()

#Define the size of window or frame
win.geometry("715x250")

#Set the Menu initially
menu= StringVar()
menu.set("Select Any Language")

#Create a dropdown Menu
drop= OptionMenu(win, menu,"C++", "Java","Python","JavaScript","Rust","GoLang")
drop.pack()

win.mainloop()
In the output window, you can select an option by clicking over “Select Any Language” and it will show a list in the dropdown menu.
jQuery - jQuery.post() Method

The jQuery.post( url, [data], [callback], [type] ) method loads a page from the server using a POST HTTP request.
The method returns XMLHttpRequest object.
Here is the simple syntax to use this method −
$.post( url, [data], [callback], [type] )

Here is the description of all the parameters used by this method −
url − A string containing the URL to which the request is sent
url − A string containing the URL to which the request is sent
data − This optional parameter represents key/value pairs or the return value of the .serialize() function that will be sent to the server.
data − This optional parameter represents key/value pairs or the return value of the .serialize() function that will be sent to the server.
callback − This optional parameter represents a function to be executed whenever the data is loaded successfully.
callback − This optional parameter represents a function to be executed whenever the data is loaded successfully.
type − This optional parameter represents a type of data to be returned to callback function: "xml", "html", "script", "json", "jsonp", or "text".
type − This optional parameter represents a type of data to be returned to callback function: "xml", "html", "script", "json", "jsonp", or "text".
Assuming we have following PHP content in result.php file −
<?php
if( $_REQUEST["name"] ) {

   $name = $_REQUEST['name'];
   echo "Welcome ". $name;
}

?>
Following is a simple example a simple showing the usage of this method −
<html>
   <head>
      <title>The jQuery Example</title>
      <script type = "text/javascript" 
         src = "https://www.tutorialspoint.com/jquery/jquery-3.6.0.js">
      </script>
		
      <script type = "text/javascript" language = "javascript">
         $(document).ready(function() {
			
            $("#driver").click(function(event){
				
               $.post( 
                  "result.php",
                  { name: "Zara" },
                  function(data) {
                     $('#stage').html(data);
                  }
               );
					
            });
				
         });
      </script>
   </head>
	
   <body>
      <p>Click on the button to load result.html file −</p>
		
      <div id = "stage" style = "background-color:cc0;">
         STAGE
      </div>
		
      <input type = "button" id = "driver" value = "Load Data" />
   </body>
</html>
This should produce following result −
Click on the button to load result.html file −
PyQt5 - isChecked() method for Check Box - GeeksforGeeks

22 Apr, 2020
isChecked method is used to know if the check box is checked or not. This method will return true if the check box is checked else it will return false. If we use this method after creating the check box it will always return False as by default check box is not checked.
Syntax : checkbox.isChecked()
Argument : It takes no argument.
Return : It return bool, true is it checked else false
Below is the implementation.
# importing librariesfrom PyQt5.QtWidgets import * from PyQt5 import QtCore, QtGuifrom PyQt5.QtGui import * from PyQt5.QtCore import * import sys    class Window(QMainWindow):      def __init__(self):        super().__init__()          # setting title        self.setWindowTitle("Python ")          # setting geometry        self.setGeometry(100, 100, 600, 400)          # calling method        self.UiComponents()          # showing all the widgets        self.show()      # method for widgets    def UiComponents(self):          # creating the check-box        self.checkbox = QCheckBox('Check box', self)          # setting geometry of check box        self.checkbox.setGeometry(200, 150, 100, 30)            # connecting it to function        self.checkbox.stateChanged.connect(self.method)          # checking if it checked        check = self.checkbox.isChecked()          # printing the check        print(check)      def method(self):          # printing the checked status        print(self.checkbox.isChecked())      # create pyqt5 appApp = QApplication(sys.argv)  # create the instance of our Windowwindow = Window()  # start the appsys.exit(App.exec())
Output :
False
True

When we run the code False will be printed and after making check box checked it will print True.
Python-gui
Python-PyQt
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
How to drop one or multiple columns in Pandas Dataframe
Python Classes and Objects
Python | os.path.join() method
Python | Get unique values from a list
Create a directory in Python
Defaultdict in Python
Python | Pandas dataframe.groupby()
Python - Multiply Consecutive elements in list - GeeksforGeeks

29 Dec, 2019
While working with python, we usually come by many problems that we need to solve in day-day and in development. Specially in development, small tasks of python are desired to be performed in just one line. We discuss some ways to compute a list consisting of elements that are successive product in the list.
Method #1 : Using list comprehensionNaive method can be used to perform, but as this article discusses the one liner solutions to this particular problem, we start with the list comprehension as a method to perform this task.
# Python3 code to demonstrate # Consecutive Product list# using list comprehension  # initializing list test_list = [1, 4, 5, 3, 6]    # printing original list print ("The original list is : " + str(test_list))  # using list comprehension# Consecutive Product listres = [test_list[i] * test_list[i + 1] for i in range(len(test_list)-1)]  # printing resultprint ("The computed successive product list is : " + str(res))
The original list is : [1, 4, 5, 3, 6]
The computed successive product list is : [4, 20, 15, 18]

 
Method #2 : Using zip()zip() can also be used to perform the similar task and uses the power of negative indices to zip() the index element with its next element and hence compute the product.
# Python3 code to demonstrate # Consecutive Product list# using zip()  # initializing list test_list = [1, 4, 5, 3, 6]  # printing original list print ("The original list is : " + str(test_list))  # using zip()# Consecutive Product listres = [i * j for i, j in zip(test_list[: -1], test_list[1 :])]  # printing resultprint ("The computed successive product list is : " + str(res))
The original list is : [1, 4, 5, 3, 6]
The computed successive product list is : [4, 20, 15, 18]

Python list-programs
Python
Python Programs
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
Iterate over a list in Python
Python program to convert a list to string
Defaultdict in Python
Python | Get dictionary keys as a list
Python | Split string into list of characters
Python | Convert a list to dictionary
Properties of Fourier Transform - GeeksforGeeks

04 Dec, 2019
Fourier Transform: Fourier transform is the input tool that is used to decompose an image into its sine and cosine components.
Properties of Fourier Transform:
Linearity:Addition of two functions corresponding to the addition of the two frequency spectrum is called the linearity. If we multiply a function by a constant, the Fourier transform of the resultant function is multiplied by the same constant. The Fourier transform of sum of two or more functions is the sum of the Fourier transforms of the functions.Case I.
 If h(x) -> H(f) then ah(x) -> aH(f)
Case II.
 If h(x) -> H(f) and g(x) -> G(f) then h(x)+g(x) -> H(f)+G(f)
Case I.
 If h(x) -> H(f) then ah(x) -> aH(f)
Case II.
 If h(x) -> H(f) and g(x) -> G(f) then h(x)+g(x) -> H(f)+G(f)
Scaling:Scaling is the method that is used to the change the range of the independent variables or features of data. If we stretch a function by the factor in the time domain then squeeze the Fourier transform by the same factor in the frequency domain.If f(t) -> F(w) then f(at) -> (1/|a|)F(w/a)
If f(t) -> F(w) then f(at) -> (1/|a|)F(w/a)
Differentiation:Differentiating function with respect to time yields to the constant multiple of the initial function.If f(t) -> F(w) then f'(t) -> jwF(w)
If f(t) -> F(w) then f'(t) -> jwF(w)
Convolution:It includes the multiplication of two functions. The Fourier transform of a convolution of two functions is the point-wise product of their respective Fourier transforms.If f(t) -> F(w) and g(t) -> G(w)
then f(t)*g(t) -> F(w)*G(w)
If f(t) -> F(w) and g(t) -> G(w)
then f(t)*g(t) -> F(w)*G(w)
Frequency Shift:Frequency is shifted according to the co-ordinates. There is a duality between the time and frequency domains and frequency shift affects the time shift.If f(t) -> F(w) then f(t)exp[jw't] -> F(w-w')
If f(t) -> F(w) then f(t)exp[jw't] -> F(w-w')
Time Shift:The time variable shift also effects the frequency function. The time shifting property concludes that a linear displacement in time corresponds to a linear phase factor in the frequency domain.If f(t) -> F(w) then f(t-t') -> F(w)exp[-jwt']
If f(t) -> F(w) then f(t-t') -> F(w)exp[-jwt']
computer-graphics
Misc
Misc
Misc
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Activation Functions
Characteristics of Internet of Things
Advantages and Disadvantages of OOP
Sensors in Internet of Things(IoT)
Challenges in Internet of things (IoT)
Election algorithm and distributed processing
Introduction to Internet of Things (IoT) | Set 1
Introduction to Electronic Mail
Communication Models in IoT (Internet of Things )
Introduction to Parallel Computing
HTML | <input type="tel"> - GeeksforGeeks

31 May, 2019
The HTML <input type=”tel”> is used to define a field that entering a user telephone Number.
Syntax:
<input type="tel"> 
Example:
<!DOCTYPE html><html>  <head>    <title>        HTML Input Type Tel    </title></head><style>    #Geek_p {        font-size: 30px;        color: green;    }</style>  <body style="text-align:center;">      <h1 style="color:green;">             GeeksForGeeks         </h1>      <h2>HTML <Input Type="tel"> </h2>    <form>        Phone No.:        <input type="tel">        <br>        <br>      </form></body>  </html>
Output:
Supported Browsers:
Google Chrome
Firefox
Edge
Opera
Apple 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-Attributes
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
REST API (Introduction)
HTML Cheat Sheet - A Basic Guide to HTML
Design a web page using HTML and CSS
Form validation using jQuery
Angular File Upload
Remove elements from a JavaScript Array
Installation of Node.js on Linux
Convert a string to an integer in JavaScript
How to fetch data from an API in ReactJS ?
Difference between var, let and const keywords in JavaScript
scipy.fft() in Python - GeeksforGeeks

29 Aug, 2020
With the help of scipy.fft() method, we can compute the fast fourier transformation by passing simple 1-D numpy array and it will return the transformed array by using this method.
Fast Fourier Transformation
Syntax : scipy.fft(x)
Return : Return the transformed array.
Example #1 :
In this example we can see that by using scipy.fft() method, we are able to compute the fast fourier transformation by passing sequence of numbers and return the transformed array.
Python3
# import scipy and numpyimport scipyimport numpy as np  x = np.array(np.arange(10))# Using scipy.fft() methodgfg = scipy.fft(x)  print(gfg)
Output :
[45. +0.j         -5.+15.38841769j -5. +6.8819096j  -5. +3.63271264j
-5. +1.62459848j -5. +0.j         -5. -1.62459848j -5. -3.63271264j
-5. -6.8819096j  -5.-15.38841769j]
Example #2 :
Python3
# import scipy and numpyimport scipyimport numpy as np  x = np.array(np.arange(5))# Using scipy.fft() methodgfg = scipy.fft(x)  print(gfg)
Output :
[10. +0.j         -2.5+3.4409548j  -2.5+0.81229924j -2.5-0.81229924j
-2.5-3.4409548j ]
Python scipy-stats-functions
Python-scipy
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
Python Classes and Objects
How to drop one or multiple columns in Pandas Dataframe
Defaultdict in Python
Python | Get unique values from a list
Python | os.path.join() method
Create a directory in Python
Python | Pandas dataframe.groupby()
How to create a COVID19 Data Representation GUI? - GeeksforGeeks

15 Feb, 2021
Prerequisites: Python Requests, Python GUI – tkinterSometimes we just want a quick fast tool to really tell whats the current update, we just need a bare minimum of data. Web scrapping deals with taking some data from the web and then processing it and displaying the relevant content in a short and crisp manner. What the code is doing ?  
First we are using Tkinter Library to make GUI required for our script
We are using requests Library to get the data from the unofficial api
Then we are displaying the data we need in this case its Total active cases: and confirmed cases
below is the implementation.  
Python3
import requestsimport jsonfrom tkinter import * window = Tk() # creating the Boxwindow.title("Covid-19") # Determining the size of the Boxwindow.geometry('220x70') # Including labelslbl = Label(window,            text ="Total active cases:-......")lbl1 = Label(window,             text ="Total confirmed cases:-...") lbl.grid(column = 1, row = 0)lbl1.grid(column = 1, row = 1)lbl2 = Label(window, text ="")lbl2.grid(column = 1, row = 3)  def clicked():    # Opening the url and loading the    # json data using json Library    url = "https://api.covid19india.org / data.json"    page = requests.get(url)    data = json.loads(page.text)         lbl.configure(text ="Total active cases:-"                  + data["statewise"][0]["active"])         lbl1.configure(text ="Total Confirmed cases:-"                   + data["statewise"][0]["confirmed"])         lbl2.configure(text ="Data refreshed") btn = Button(window, text ="Refresh", command = clicked)btn.grid(column = 2, row = 0) window.mainloop()
Output:
 
 
abhigoya
Python web-scraping-exercises
Python-requests
Python-tkinter
Python
Write From Home
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Enumerate() in Python
How to Install PIP on Windows ?
Different ways to create Pandas Dataframe
Python String | replace()
Create a Pandas DataFrame from Lists
Convert integer to string in Python
Convert string to integer in Python
Python infinity
How to set input type date in dd-mm-yyyy format using HTML ?
Matplotlib.pyplot.title() in Python
How to initialize a boolean array in JavaScript?

To initialize a Boolean array in JavaScript, try to run the following code −
Live Demo
<html>
   <head>
      <title>JavaScript Boolean</title>
   </head>
 
   <body>
      <script>
         var myArr = [];
         var value = 2;
         for(var i = 0; i < value; i++) {
            myArr.push(false);
         }
         alert(myArr);
      </script>
   </body>
</html>
Variadic function templates in C++

Variadic function templates in C++ is a function which can take a multiple number of arguments.
template(typename arg, typename... args)
return_type function_name(arg var1, args... var2)
 Live Demo
#include <iostream>
using namespace std;
void show() //base case. {
   cout << "I am now empty";
}

template <typename T, typename... T2>// variadic function
void show(T v1, T2... v2) {
   cout << v1 << endl;
   show(v2...) ;
}

int main() {
   show(7, 6, 0.04, "hi ","I am variadic function","I will show\n");
   return 0;
}
7
6
0.04
hi I am variadic function
I will show

I am now empty
How to pretty print JSON using the Gson library in Java?

A Gson is a JSON library for java, which is created by Google. By using Gson, we can generate JSON and convert JSON to java objects. By default, Gson can print the JSON in compact format. To enable Gson pretty print, we must configure the Gson instance using the setPrettyPrinting() method of GsonBuilder class and this method configures Gson to output JSON that fits in a page for pretty printing.
public GsonBuilder setPrettyPrinting()
import java.util.*;
import com.google.gson.*;
public class PrettyJSONTest {
   public static void main( String[] args ) {
      Employee emp = new Employee("Raja", "115", "Content Engineer", "Java", "Hyderabad");
      Gson gson = new GsonBuilder().setPrettyPrinting().create(); // pretty print
      String prettyJson = gson.toJson(emp);
      System.out.println(prettyJson);
   }
}
// Employee class
class Employee {
   private String name, id, designation, technology, location;
   public Employee(String name, String id, String designation, String technology, String location) {
      super();
      this.name = name;
      this.id = id;
      this.designation = designation;
      this.technology = technology;
      this.location = location;
   }
   public String getName() {
      return name;
   }
   public String getId() {
      return id;
   }
   public String getDesignation() {
      return designation;
   }
   public String getTechnology() {
      return technology;
   }
   public String getLocation() {
      return location;
   }
}
{
 "name": "Raja",
 "id": "115",
 "designation": "Content Engineer",
 "technology": "Java",
 "location": "Hyderabad"
}
Style the Bootstrap modal

Use the .modal-body class in Bootstrap to style the modal.
You can try to run the following code to style modal −/p>
LIve Demo
<!DOCTYPE html>
<html>
   <head>
      <title>Bootstrap Example</title>
      <link rel = "stylesheet" href = "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
      <script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
      <script src = "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
   </head>
   <body>
      <div class = "container">
         <h2>Website Information</h2>
         <button type = "button" class = "btn btn-lg" data-toggle = "modal" data-target = "#new">Info</button>
         <div class = "modal fade" id="new" role="dialog">
            <div class = "modal-dialog">
               <div class = "modal-content">
                  <div class = "modal-header">
                     <button type="button" class="close" data-dismiss="modal">×</button>
                     <h4 class="modal-title">Warning</h4>
                  </div>
                  <div class = "modal-body">
                     <p>If JavaScript isn't enabled in your web browser, then you may not be able to see this information correcty.</p>
                  </div>
                  <div class = "modal-footer">
                     <button type = "button" class = "btn btn-default" data-dismiss = "modal">Close</button>
                  </div>
               </div>
            </div>
         </div>
      </div>
   </body>
</html>
Angular 2 - Templates

In the chapter on Components, we have already seen an example of the following template.
template: '
   <div>
      <h1>{{appTitle}}</h1>
      <div>To Tutorials Point</div>
   </div>
'
This is known as an inline template. There are other ways to define a template and that can be done via the templateURL command. The simplest way to use this in the component is as follows.
templateURL:
viewname.component.html

viewname − This is the name of the app component module.
viewname − This is the name of the app component module.
After the viewname, the component needs to be added to the file name.
Following are the steps to define an inline template.
Step 1 − Create a file called app.component.html. This will contain the html code for the view.
Step 2 − Add the following code in the above created file.
<div>{{appTitle}} Tutorialspoint </div>

This defines a simple div tag and references the appTitle property from the app.component class.
Step 3 − In the app.component.ts file, add the following code.
import { Component } from '@angular/core';

@Component ({
   selector: 'my-app',
   templateUrl: 'app/app.component.html'  
})

export class AppComponent {
   appTitle: string = 'Welcome';
}
From the above code, the only change that can be noted is from the templateURL, which gives the link to the app.component.html file which is located in the app folder.
Step 4 − Run the code in the browser, you will get the following output.
From the output, it can be seen that the template file (app.component.html) file is being called accordingly.

    16 Lectures 
     1.5 hours 

 Anadi Sharma

    28 Lectures 
     2.5 hours 

 Anadi Sharma

    11 Lectures 
     7.5 hours 

 SHIVPRASAD KOIRALA

    16 Lectures 
     2.5 hours 

 Frahaan Hussain

    69 Lectures 
     5 hours 

 Senol Atac

    53 Lectures 
     3.5 hours 

 Senol Atac
 Print
 Add Notes
 Bookmark this page
Difference between order by and group by clause in SQL - GeeksforGeeks

22 Apr, 2020
1. Order By :Order by keyword sort the result-set either in ascending or in descending order. This clause sorts the result-set in ascending order by default. In order to sort the result-set in descending order DESC keyword is used.
Order By Syntax –
SELECT column_1, column_2, column_3...........
FROM Table_Name
ORDER BY column_1, column_2, column_3....... ASC|DESC;


Table_Name: Name of the table.
ASC: keyword for ascending order
DESC: keyword for descending order 
2. Group By :Group by statement is used to group the rows that have the same value. It is often used with aggregate functions for example:AVG(), MAX(), COUNT(), MIN() etc. One thing to remember about the group by clause is that the tuples are grouped based on the similarity between the attribute values of tuples.
Group By Syntax –
SELECT function_Name(column_1), column_2
FROM Table_Name
WHERE condition
GROUP BY column_1, column_2
ORDER BY column_1, column_2; 
function_Name: Name of the aggregate function, for example:
SUM(), AVG(), COUNT() etc.

Table_Name: Name of the table. 
Let’s see the difference between Order by and group by clause:-
ashushrma378
DBMS
Difference Between
GATE CS
SQL
DBMS
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
SQL Interview Questions
CTE in SQL
SQL Trigger | Student Database
Introduction of B-Tree
Difference between Clustered and Non-clustered index
Difference between BFS and DFS
Class method vs Static method in Python
Differences between TCP and UDP
Difference between var, let and const keywords in JavaScript
Differences between IPv4 and IPv6
GitLab - Squashing Commits

Squashing is a way of combining all commits into one when you are obtaining a merge request.
Step 1 − Go to your project directory and check out a new branch with the name squash-chapter by using the git checkout command −
The flag -b indicates new branch name.
Step 2 − Now, create a new file with two commits, add that file to working directory and store the changes to the repository along with the commit messages as shown below −
Step 3 − Now, squash the above two commits into one commit by using the below command −
$ git rebase -i HEAD~2

Here, git rebase command is used to integrate changes from one branch to another and HEAD~2 specifies last two squashed commits and if you want to squash four commits, then you need to write as HEAD~4. One more important point is, you need atleast two commits to complete the squash operation.
Step 4 −  After entering the above command, it will open the below editor in which you have to change the pick word to squash word in the second line (you need to squash this commit).
Now press the Esc key, then colon(:) and type wq to save and exit from the screen.
Step 5 − Now push the branch to remote repository as shown below −
 Print
 Add Notes
 Bookmark this page
JavaScript | string.length - GeeksforGeeks

02 Jul, 2018
The string.length is a property in JavaScript which is used to find the length of a given string.Syntax:
string.length
Parameter: It does not accept any parameter.Return Values: It returns the length of the given string.
<script>      // Taking some strings    var x = 'geeksforgeeks';    var y = 'gfg';    var z = '';      // Returning the length of the string.    document.write(x.length + "<br>");    document.write(y.length + "<br>");    document.write(z.length);  </script>
Output:
13
3
0
Code #2:
<script>      // Taking some strings.    var x = '2341312134';    var y = '@#$%^&**((*&^';      // Variable z contains two spaces    var z = '  ';      // Returning the length of the string.    document.write(x.length + "<br>");    document.write(y.length + "<br>");    document.write(z.length);  </script>
Output:
10
13
2
javascript-string
JavaScript
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Difference between var, let and const keywords in JavaScript
Convert a string to an integer in JavaScript
Differences between Functional Components and Class Components in React
Difference Between PUT and PATCH Request
Set the value of an input field in JavaScript
How to Use the JavaScript Fetch API to Get Data?
Node.js | fs.writeFileSync() Method
Difference between TypeScript and JavaScript
Create a Responsive Navbar using ReactJS
Form validation using HTML and JavaScript
Dictionary.Item[] Property in C#

The Dictionary.Item[] property in C# is used to get or set the value associated with the specified key in the Dictionary.
Following is the syntax −
public TValue this[TKey key] { get; set; }
Let us now see an example to implement the Dictionary.Item[] property −
using System;
using System.Collections.Generic;
public class Demo {
   public static void Main(){
      Dictionary<string, string> dict =
      new Dictionary<string, string>();
      dict.Add("One", "Chris");
      dict.Add("Two", "Steve");
      dict.Add("Three", "Messi");
      dict.Add("Four", "Ryan");
      dict.Add("Five", "Nathan");
      Console.WriteLine("Count of elements = "+dict.Count);
      Console.WriteLine("\nKey/value pairs...");
      foreach(KeyValuePair<string, string> res in dict){
         Console.WriteLine("Key = {0}, Value = {1}", res.Key, res.Value);
      }
      Console.WriteLine("Value for key three = "+dict["Three"]);
      dict["Three"] = "Ronaldo";
      Console.Write("Updated value associated with key Three...");
      Console.WriteLine(dict["Three"]);
      if (dict.ContainsValue("Angelina"))
         Console.WriteLine("\n\nValue found!");
      else
         Console.WriteLine("\n\nValue isn't in the dictionary!");
      dict.Clear();
      Console.WriteLine("Cleared Key/value pairs...");
      foreach(KeyValuePair<string, string> res in dict){
         Console.WriteLine("Key = {0}, Value = {1}", res.Key, res.Value);
      }
      Console.WriteLine("Count of elements now = "+dict.Count);
   }
}
This will produce the following output −
Count of elements = 5
Key/value pairs...
Key = One, Value = Chris
Key = Two, Value = Steve
Key = Three, Value = Messi
Key = Four, Value = Ryan
Key = Five, Value = Nathan
Value for key three = Messi
Updated value associated with key Three...Ronaldo
Value isn't in the dictionary!
Cleared Key/value pairs...
Count of elements now = 0
Let us now see another example to implement the Dictionary.Item[] method −
using System;
using System.Collections.Generic;
public class Demo {
   public static void Main(){
      Dictionary<string, string> dict =
      new Dictionary<string, string>();
      dict.Add("One", "Chris");
      dict.Add("Two", "Steve");
      dict.Add("Three", "Messi");
      dict.Add("Four", "Ryan");
      dict.Add("Five", "Nathan");
      Console.WriteLine("Count of elements = "+dict.Count);
      Console.WriteLine("\nKey/value pairs...");
      foreach(KeyValuePair<string, string> res in dict){
         Console.WriteLine("Key = {0}, Value = {1}", res.Key, res.Value);
      }
      Console.WriteLine("Value for key three = "+dict["Three"]);
      dict["Three"] = "Katie";
      Console.Write("Updated value associated with key Three...");
      Console.WriteLine(dict["Three"]);
   }
}
This will produce the following output −
Count of elements = 5
Key/value pairs...
Key = One, Value = Chris
Key = Two, Value = Steve
Key = Three, Value = Messi
Key = Four, Value = Ryan
Key = Five, Value = Nathan
Value for key three = Messi
Updated value associated with key Three...Katie
SQL Query to Select all Records From Employee Table Where Name is Not Specified

14 May, 2021
Here, we are going to see how to find the names of the persons other than a person with a particular name  SQL. In this article, we will be making use of the MSSQL Server as our database.
For example, if the employee name is Pradeep you need to show the table of employees excluding that employee with the name Pradeep. So let us execute this query in detail step-by-step.
Creating a database employee by using the following SQL query as follows.
CREATE DATABASE employee;
Output :
Using the database employee using the following SQL query as follows.
USE employee;
Output :
Creating a table employee_details with  4 columns using the following SQL query as follows.
  CREATE TABLE employee_details(
     emp_id VARCHAR(8),
     emp_name VARCHAR(20),
     emp_designation VARCHAR(20),
     emp_age INT);
Output :
To view the description of the tables in the database using the following SQL query as follows.
EXEC sp_columns employee_details;
Output :
Inserting rows into employee_details table using the following SQL query as follows.
INSERT INTO employee_details VALUES('E40001','PRADEEP','H.R',36),
    ('E40002','ASHOK','MANAGER',28),
    ('E40003','PAVAN KUMAR','ASST MANAGER',28),
    ('E40004','SANTHOSH','STORE MANAGER',25),
    ('E40005','THAMAN','GENERAL MANAGER',26);
Output :
Viewing the table employee_details after inserting rows by using the following SQL query as follows.
SELECT * FROM employee_details;
Output :
Query to find an employee whose name is not Pradeep.
Since we need to display the names other than Pradeep we can use not equal to (<>) operator with the where clause to get the required query executed, In the WHERE clause we can use any other conditions also using other operators such as >,<, AND, OR, NOT etc..,
SYNTAX:
SELECT * 
FROM table_name
WHERE condition1 ,condition 2,....;
For the above we can do it in two ways:
1) USING <> operator
 SELECT* FROM employee_details
 WHERE emp_name <>'PRADEEP';
Output :
2) USING NOT operator
  SELECT* FROM employee_details
  WHERE NOT emp_name='PRADEEP';
Output :
Query to find the employee whose designation is not of General Manager and Store Manager.
Using AND operator we can merge different conditions here AND is used to execute the following query.
  SELECT* FROM employee_details
  WHERE  emp_designation<> 'GENERAL MANAGER' AND
  emp_designation <> 'STORE MANAGER';
Output :
Picked
SQL-Query
SQL
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Use of na_values parameter in read_csv() function of Pandas in Python

28 Jul, 2020
read_csv() is an important pandas function to read CSV files. But there are many other things one can do through this function only to change the returned object completely. In this post, we will see the use of the na_values parameter.
na_values: This is used to create a string that considers pandas as NaN (Not a Number). by-default pandas consider #N/A, -NaN, -n/a, N/A, NULL etc as NaN value. let’s see the example for better understanding.
so this is our dataframe it has three column names, class, and total marks. now import the dataframe in python pandas.
Refer the link to the data set used from here.
Example 1: see pandas consider #N/A as NaN.
Python3
# import pandas libraryimport pandas as pd  # read a csv filedf = pd.read_csv('Example.csv')  # show the dataframeprint(df)
 Output:
Example 2: Now the na_values parameter is used to tell pandas they consider “not available” as NaN value and print NaN at the place of “not available”.
Python3
# import pandas libraryimport pandas as pd  # read a csv filedf = pd.read_csv('Example.csv',                  na_values = "not available")  # show the dataframeprint(df)
Output:
Python-pandas
Python
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()
How to Install PIP on Windows ?
*args and **kwargs in Python
Python Classes and Objects
Iterate over a list in Python
Convert integer to string in Python
HTTP headers | Location

07 Nov, 2019
The HTTP Location header is a response header that is used under 2 circumstances to ask a browser to redirect a URL (status code 3xx) or provide information about the location of a newly created resource (status code of 201). Its usage is often confused with another HTTP Header which is HTTP Content-Location header. The main difference between them is that Location gives the URL of the resource where the redirection of the page happens while HTTP Content-Location is used to indicate the URL of a transmitted resource.
Syntax:
Location: <url>
Directives: This header accepts a single directive mentioned above and described below:
<url>: This directive holds the relative or absolute URL that gives access to a resource.
Examples:
These URLs include a scheme/host and conform to scheme-specific syntax and semantics, this is an Absolute URL:Location: https://www.geeksforgeeks.org/index.php
Location: https://www.geeksforgeeks.org/index.php
These URLs don’t include a scheme or a host. It must be combined with the URLs of the original request, Relative URL:Location: /blogs/
Location: /blogs/
To check this Location in action go to Inspect Element -> Network check the response header for Location like below, Location is highlighted you can see.Supported Browsers: The browsers are compatible with the HTTP Location header are listed below:
Google Chrome
Internet Explorer
Microsoft Edge
Firefox
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 set the default value for an HTML <select> element ?
How to create footer to stay at the bottom of a Web page?
How to set input type date in dd-mm-yyyy format using HTML ?
Roadmap to Learn JavaScript For Beginners
Stack clone() method in Java with Example

24 Dec, 2018
The clone() method of Stack class is used to return a shallow copy of this Stack. It just creates a copy of the Stack. The copy will have a reference to a clone of the internal data array but not a reference to the original internal data array.
Syntax:
Stack.clone()
Parameters: The method does not take any parameter.
Return Value: The method returns an Object which is just the copy of the Stack.
Exception: This method throws CloneNotSupportedException if the object’s class does not support the Cloneable interface.
Below programs illustrate the Java.util.Stack.clone() method:
Program 1:
// Java code to illustrate clone()  import java.util.*;  public class StackDemo {    public static void main(String args[])    {        // Creating an empty Stack        Stack<String> stack = new Stack<String>();          // Use add() method to add elements into the Stack        stack.add("Welcome");        stack.add("To");        stack.add("Geeks");        stack.add("4");        stack.add("Geeks");          // Displaying the Stack        System.out.println("Stack: " + stack);          // Creating another Stack to copy        Object copy_Stack = stack.clone();          // Displaying the copy of Stack        System.out.println("The cloned Stack is: "                           + copy_Stack);    }}
Stack: [Welcome, To, Geeks, 4, Geeks]
The cloned Stack is: [Welcome, To, Geeks, 4, Geeks]

Program 2:
// Java code to illustrate clone()  import java.util.*;  public class StackDemo {    public static void main(String args[])    {        // Creating an empty Stack        Stack<Integer> stack = new Stack<Integer>();          // Use add() method to add elements into the Queue        stack.add(10);        stack.add(15);        stack.add(30);        stack.add(20);        stack.add(5);          // Displaying the Stack        System.out.println("Stack: " + stack);          // Creating another Stack to copy        Object copy_Stack = (Stack)stack.clone();          // Displaying the copy of Stack        System.out.println("The cloned Stack is: "                           + copy_Stack);    }}
Stack: [10, 15, 30, 20, 5]
The cloned Stack is: [10, 15, 30, 20, 5]

Java - util package
Java-Collections
Java-Functions
Java-Stack
Java
Java
Java-Collections
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Arrays in Java
Split() String method in Java with examples
Arrays.sort() in Java with examples
Reverse a string in Java
Object Oriented Programming (OOPs) Concept in Java
For-each loop in Java
How to iterate any Map in Java
Interfaces in Java
HashMap in Java with Examples
Stream In Java
Python | Add tuple to front of list

18 Oct, 2019
Sometimes, while working with Python list, we can have a problem in which we need to add a new tuple to existing list. Append at rear is usually easier than addition at front. Let’s discuss certain ways in which this task can be performed.
Method #1 : Using insert()This is one of the way in which the element can be added to front in one-liner. It is used to add any element in front of list. The behaviour is the same for tuple as well.
# Python3 code to demonstrate working of# Adding tuple to front of list# using insert()  # Initializing list test_list = [('is', 2), ('best', 3)]  # printing original list print("The original list is : " + str(test_list))  # Initializing tuple to add add_tuple = ('gfg', 1)  # Adding tuple to front of list# using insert()test_list.insert(0, add_tuple)  # printing resultprint("The tuple after adding is : " + str(test_list))
The original list is : [('is', 2), ('best', 3)]
The tuple after adding is : [('gfg', 1), ('is', 2), ('best', 3)]

 
Method #2 : Using deque() + appendleft()The combination of above functions can be used to perform this particular task. In this, we just need to convert the list into a deque so that we can perform the append at front using appendleft()
# Python3 code to demonstrate working of# Adding tuple to front of list# using deque() + appendleft()from collections import deque  # Initializing list test_list = [('is', 2), ('best', 3)]  # printing original list print("The original list is : " + str(test_list))  # Initializing tuple to add add_tuple = ('gfg', 1)  # Adding tuple to front of list# using deque() + appendleft()res = deque(test_list)res.appendleft(add_tuple)  # printing resultprint("The tuple after adding is : " + str(list(res)))
The original list is : [('is', 2), ('best', 3)]
The tuple after adding is : [('gfg', 1), ('is', 2), ('best', 3)]

Python list-programs
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
Python String | replace()
How to Install PIP on Windows ?
Defaultdict in Python
Python | Get dictionary keys as a list
Python | Convert a list to dictionary
Python | Convert string dictionary to dictionary
Python Program for Fibonacci numbers
JavaScript Array splice() Method

27 May, 2022
Below is the example of Array splice() method. 
Example: 
Javascript
<script>    var webDvlop = ["HTML", "CSS", "JS", "Bootstrap"];     document.write(webDvlop + "<br>");     // Add 'React_Native' and 'Php' after removing 'JS'.    var removed = webDvlop.splice(2, 1, 'PHP', 'React_Native')     document.write(webDvlop + "<br>");    document.write(removed + "<br>");     // No Removing only Insertion from 2nd    // index from the ending    webDvlop.splice(-2, 0, 'React')    document.write(webDvlop)</script>               
Output: 
HTML,CSS,JS,Bootstrap
HTML,CSS,PHP,React_Native,Bootstrap
JS
HTML,CSS,PHP,React,React_Native,Bootstrap
The arr.splice() method is an inbuilt method in JavaScript which is used to modify the contents of an array by removing the existing elements and/or by adding new elements.
Syntax:  
Array.splice( index, remove_count, item_list )
Parameter: This method accepts many parameters some of them are described below: 
index: It is a required parameter. This parameter is the index which start modifying the array (with origin at 0). This can be negative also, which begins after that many elements counting from the end.
remove_count: The number of elements to be removed from the starting index.
items_list: The list of new items separated by comma operator that is to be inserted from the starting index.
Return Value: While it mutates the original array in-place, still it returns the list of removed items. In case there is no removed array it returns an empty array.
Below example illustrates the Array.splice() method in JavaScript:
Example:  
Javascript
<script>var languages = ['C++', 'Java', 'Html', 'Python', 'C']; document.write(languages + "<br>"); // Add 'Julia' and 'Php' after removing 'Html'.var removed = languages.splice(2, 1, 'Julia', 'Php') document.write(languages + "<br>");document.write(removed + "<br>"); // No Removing only Insertion from 2nd index from the endinglanguages.splice(-2, 0, 'Pascal')document.write(languages)</script>                   
Output: 
C++,Java,Html,Python,C
C++,Java,Julia,Php,Python,C
Html
C++,Java,Julia,Php,Pascal,Python,C 
 Supported Browser:
Google Chrome 1 and above
Internet Explorer 5.5 and above
Firefox 1 and above
Opera 4 and above
Safari 1 and above
bhattapoorv10
ysachin2314
tabishnadeem50
javascript-array
JavaScript-Methods
JavaScript
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
Differences between Functional Components and Class Components in React
Difference Between PUT and PATCH Request
How to append HTML code to a div using JavaScript ?
How to Open URL in New Tab using JavaScript ?
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 ?
How to subset a data frame by excluding the column names that are stored in a vector in R?

Subsetting of a data frame can be done in many ways and one such say is selecting the columns that are stored in a vector. Suppose we have a data frame df that has columns x, y, and z and the column names y and z are stored in a vector called V then we can subset df by excluding column names in V as select(df,-all_of(V)).
Consider the below data frame:
Live Demo
> x1<-rpois(20,5)
> x2<-rpois(20,2)
> x3<-rpois(20,3)
> x4<-rpois(20,5)
> df1<-data.frame(x1,x2,x3,x4)
> df1
x1 x2 x3 x4
1 3 4 0 5
2 4 1 2 6
3 4 1 2 3
4 8 1 7 6
5 4 2 3 8
6 4 4 1 0
7 4 1 1 2
8 7 2 4 4
9 4 3 6 5
10 4 3 5 7
11 3 2 3 5
12 4 2 3 5
13 3 1 2 5
14 4 2 5 7
15 4 3 7 2
16 2 1 3 6
17 5 1 8 3
18 4 0 4 6
19 5 2 4 9
20 9 0 4 7
Vector containing columns x1 and x4:
> v1<-c("x1","x4")
Subsetting df1 by excluding x1 and x4:
> select(df1,-all_of(v1))
 x2 x3
1 4 0
2 1 2
3 1 2
4 1 7
5 2 3
6 4 1
7 1 1
8 2 4
9 3 6
10 3 5
11 2 3
12 2 3
13 1 2
14 2 5
15 3 7
16 1 3
17 1 8
18 0 4
19 2 4
20 0 4
Let’s have a look at another example:
Live Demo
> y1<-rnorm(20,1,0.098)
> y2<-rnorm(20,100,10)
> y3<-rnorm(20,5,0.97)
> y4<-rnorm(20,5275,30.5)
> df2<-data.frame(y1,y2,y3,y4)
> df2
     y1        y2       y3       y4
1 1.0004066 95.44217 4.436526 5302.802
2 0.8704272 103.72030 4.459705 5279.560
3 1.0010894 96.78478 4.979246 5250.222
4 1.0856458 100.94359 5.480827 5261.604
5 0.9609981 98.62898 4.427267 5230.762
6 0.9497958 90.31327 4.332123 5204.725
7 0.9598390 95.87049 4.557982 5273.675
8 0.7686893 95.67384 5.747136 5232.587
9 0.8447364 97.65526 5.012912 5282.668
10 1.1740212 105.39359 4.088489 5300.367
11 0.9476001 115.77728 5.490385 5315.523
12 0.9824041 89.73841 4.703173 5256.286
13 0.9139366 112.73522 5.676117 5279.863
14 1.0712399 83.89056 4.510641 5275.326
15 1.1097967 91.60747 4.391030 5269.570
16 1.0449168 90.27042 3.793536 5210.164
17 0.8880382 74.78750 5.876453 5284.542
18 0.9304634 112.05254 5.410632 5330.084
19 1.1660059 108.03871 5.982188 5303.685
20 0.7662319 104.80364 5.518754 5283.069
> v2<-c("y2","y3")
Subsetting df2 by excluding y2 and y3:
> select(df2,-all_of(v2))
      y1       y4
1 1.0004066 5302.802
2 0.8704272 5279.560
3 1.0010894 5250.222
4 1.0856458 5261.604
5 0.9609981 5230.762
6 0.9497958 5204.725
7 0.9598390 5273.675
8 0.7686893 5232.587
9 0.8447364 5282.668
10 1.1740212 5300.367
11 0.9476001 5315.523
12 0.9824041 5256.286
13 0.9139366 5279.863
14 1.0712399 5275.326
15 1.1097967 5269.570
16 1.0449168 5210.164
17 0.8880382 5284.542
18 0.9304634 5330.084
19 1.1660059 5303.685
20 0.7662319 5283.069
KeyPairGenerator generateKeyPair() method in Java

A key pair can be generated using the generateKeyPair() method in the class java.security.KeyPairGenerator. This method requires no parameters and it returns the key pair that is generated. Every time the generateKeyPair() method is called, it generates a new key pair.
A program that demonstrates this is given as follows −
 Live Demo
import java.security.*;
import java.util.*;
public class Demo {
   public static void main(String[] argv) throws Exception {
      try {
         KeyPairGenerator kpGenerator = KeyPairGenerator.getInstance("RSA");
         KeyPair keyPair = kpGenerator.generateKeyPair();
         System.out.println(keyPair);
      } catch (NoSuchAlgorithmException e) {
         System.out.println("Error!!! NoSuchAlgorithmException");
      }
   }
}
java.security.KeyPair@12a3a380
Now let us understand the above program.
A key pair is generated using the generateKeyPair() method and then this key pair is displayed. If the algorithm is wrong, then the exception of NoSuchAlgorithmException is thrown. A code snippet that demonstrates is given as follows −
try {
   KeyPairGenerator kpGenerator = KeyPairGenerator.getInstance("RSA");
   KeyPair keyPair = kpGenerator.generateKeyPair();
   System.out.println(keyPair);
} catch (NoSuchAlgorithmException e) {
   System.out.println("Error!!! NoSuchAlgorithmException");
}