code-rag-bench/online-tutorials huggingface dataset:
How to detect and change the content/style of a div using jQuery ? - GeeksforGeeks

05 Nov, 2019
The changes to the html/text of a div can be detected using jQuery on() method. The on() is used to attach one or more event handlers for the selected elements and child elements in the DOM tree. The on() method is the replacement of the bind(), live() and delegate() method from the jQuery version 1.7.
Syntax:
$(selector).on(event, childSelector, data, function, map)
Example 1: This example uses jQuery on() method to change the text of the <div> element.
<!DOCTYPE html><html>      <head>    <title>        How to detect and change the        content of a div using JQuery ?    </title>          <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js">    </script>          <style>        #div1 {             font-size: 35px;             color:green;            text-align:center;        }     </style>          <script>        $(document).ready(function(){            $("div").on("click", function(){                document.getElementById("div1").innerHTML                    = "A computer science portal for geeks";             });        });    </script></head>  <body>    <div id="div1">GeeksforGeeks!</div></body>  </html>
Output:
Before clicking the div element:
After clicking the div element:
Example 2: This example uses jQuery on() method to change the style of a <div> element.
<!DOCTYPE html><html>      <head>    <title>        How to detect and change the        style of a div using JQuery?    </title>          <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js">    </script>          <style>        #div1 {             font-size: 35px;             color:green;            text-align:center;        }     </style>          <script>        $(document).ready(function(){            $("div").on("click", function(){                document.getElementById("div1").style.color                            = "white";                                               document.getElementById("div1").style.backgroundColor                            = "green";             });        });    </script></head>  <body>    <div id="div1">Welcome to GeeksforGeeks!!!</div> </body>  </html>
Output:
Before clicking the div element:
After clicking the div element:
jQuery-Misc
jQuery-Selectors
Picked
JQuery
Web Technologies
Web technologies Questions
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Form validation using jQuery
How to Dynamically Add/Remove Table Rows using jQuery ?
Scroll to the top of the page using JavaScript/jQuery
How to Show and Hide div elements using radio buttons?
How to prevent Body from scrolling when a modal is opened using jQuery ?
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 ?
How to insert spaces/tabs in text using HTML/CSS?
Underscore.js _.camelCase() Method - GeeksforGeeks

07 Aug, 2020
The _.camelCase() method is used to convert a dash-separated string into camel case strings
Syntax:
_.camelCase( dashedString );
Parameters: 
dashedString: This method takes a dash-separated String.
Return Value: This method returns the converted camelCase String.
Note: This will not work in normal JavaScript because it requires the underscore.js contrib library to be installed. Underscore.js contrib library can be installed using npm install underscore-contrib –save.
Example 1: 
Javascript
// Defining underscore contrib variablevar _ = require('underscore-contrib');   var cml  = _.camelCase( "a-ab-abc" );  console.log("The calmelCase String is : ", cml);
Output:
The calmelCase String is :  aAbAbc
Example 2:
Javascript
// Defining underscore contrib variablevar _ = require('underscore-contrib');   var cml  = _.camelCase( "geeks-for-geeks" );  console.log("The calmelCase String is : ", cml);
Output:
The calmelCase String is :  geeksForGeeks
JavaScript - Underscore.js
JavaScript
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Remove elements from a JavaScript Array
Convert a string to an integer in JavaScript
Difference between var, let and const keywords in JavaScript
Differences between Functional Components and Class Components in React
How to append HTML code to a div using JavaScript ?
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 ?
How to insert spaces/tabs in text using HTML/CSS?
C# | Dictionary.ContainsValue() Method - GeeksforGeeks

01 Feb, 2019
This method is used to check whether the Dictionary<TKey,TValue> contains a specific value or not.
Syntax:
public bool ContainsValue (TValue value);

Here, the value is the Value to locate in the Dictionary. The value can be null for reference types.
Return Value: This method returns true if the Dictionary contains an element with the specified value otherwise it returns false.
Below are the programs to illustrate the use of Dictionary<TKey,TValue>.ContainsValue() Method:
Example 1:
// C# code to check if a value // is present or not in a Dictionary.using System;using System.Collections.Generic;  class GFG {      // Driver code    public static void Main()    {          // Create a new dictionary of         // strings, with string keys.        Dictionary<string, string> myDict =           new Dictionary<string, string>();          // Adding key/value pairs in myDict        myDict.Add("Australia", "Canberra");        myDict.Add("Belgium", "Brussels");        myDict.Add("Netherlands", "Amsterdam");        myDict.Add("China", "Beijing");        myDict.Add("Russia", "Moscow");        myDict.Add("India", "New Delhi");          // Checking the value "India" but         // here "India" is the key        if (myDict.ContainsValue("India"))            Console.WriteLine("Value : India is present.");          else            Console.WriteLine("Value : India is not present.");    }}
Value : India is not present.

Example 2:
// C# code to check if a value is// present or not in a Dictionary.using System;using System.Collections.Generic;  class GFG {      // Driver code    public static void Main()    {          // Create a new dictionary of         // strings, with string keys.        Dictionary<string, string> myDict =            new Dictionary<string, string>();          // Adding key/value pairs in myDict        myDict.Add("Australia", "Canberra");        myDict.Add("Belgium", "Brussels");        myDict.Add("Netherlands", "Amsterdam");        myDict.Add("China", "Beijing");        myDict.Add("Russia", "Moscow");        myDict.Add("India", "New Delhi");          // Checking for value Moscow        if (myDict.ContainsValue("Moscow"))            Console.WriteLine("Value : Moscow is present");          else            Console.WriteLine("Value : Moscow is absent");    }}
Value : Moscow is present

Reference:
https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.dictionary-2.containsvalue?view=netframework-4.7.2
CSharp Dictionary Class
CSharp-Generic-Namespace
CSharp-method
C#
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
C# | Delegates
C# | Abstract Classes
Extension Method in C#
C# | Class and Object
C# | Constructors
C# | String.IndexOf( ) Method | Set - 1
C# | Replace() Method
Introduction to .NET Framework
C# | Data Types
C# | Arrays
How to disable the drop-down list in HTML5 ? - GeeksforGeeks

26 Mar, 2021
The drop-down is used to create a list of items that need to select an element. We use <select> and <option> elements to create a drop-down list and use disabled attribute in <select> element to disable the drop-down list element.  A disabled drop-down list is un-clickable and unusable. It is a boolean attribute.
Syntax:
<select disabled> Option values... </select>
Attribute Value:
disabled: The <select> disabled attribute is used to specify the select element is disabled. A disabled drop-down list is un-clickable and unusable. It is a boolean attribute.
Example:
HTML
<!DOCTYPE html><html>  <head>    <title>        How to disabled drop-down list in HTML5?    </title></head>  <body style="text-align: center;">    <h1 style="color: green;">        GeeksforGeeks    </h1>      <h3>        How to disabled drop-down list in HTML5?    </h3>      <select disabled>        <option value="c">C</option>        <option value="cpp">C++</option>        <option value="java">Java</option>        <option value="python">Python</option>    </select></body>  </html>
Output:
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.
CSS-Properties
HTML-Attributes
HTML-Questions
HTML-Tags
HTML5
Picked
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to insert spaces/tabs in text using HTML/CSS?
How to update Node.js and NPM to next version ?
How to set the default value for an HTML <select> element ?
Hide or show elements in HTML using display property
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 ?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
miscellaneous topics in data structures - GeeksQuiz

10 Jul, 2018
   o	Delection of the smallest element 
   o	Insertion of an element if it is not already present in the set

X: depth first search            1: heap
Y: breadth-first search          2: queue
Z: sorting                       3: stack
Writing code in comment? Please use ide.geeksforgeeks.org, generate link and share the link here.
Must Do Coding Questions for Product Based Companies
How to Replace Values in Column Based on Condition in Pandas?
C Program to read contents of Whole File
How to Replace Values in a List in Python?
Epam Interview Experience for Junior Software Engineer
EPAM Interview Experience | On-Campus 2022
How to Read Text Files with Pandas?
Python Data Structures and Algorithms
Data Science With Python Tutorial
Top 10 Programming Languages to Learn in 2022
Matplotlib.axes.Axes.contourf() in Python - GeeksforGeeks

13 Apr, 2020
Matplotlib is a library in Python and it is numerical – mathematical extension for NumPy library. The Axes Class contains most of the figure elements: Axis, Tick, Line2D, Text, Polygon, etc., and sets the coordinate system. And the instances of Axes supports callbacks through a callbacks attribute.
The Axes.contourf() function in axes module of matplotlib library is also used to plot contours. But contourfdraw filled contours, while contourf draws contour lines.
Syntax:
Axes.contourf(self, *args, data=None, **kwargs)
Parameters: This method accept the following parameters that are described below:
X, Y: These parameter are the coordinates of the values in Z.
Z : This parameter is the height values over which the contour is drawn.
levels : This parameter is used to determine the numbers and positions of the contour lines / regions.
Returns: This returns the following:
c :This returns the QuadContourSet.
Below examples illustrate the matplotlib.axes.Axes.contourf() function in matplotlib.axes:
Example-1:
# Implementation of matplotlib functionimport numpy as npimport matplotlib.pyplot as pltfrom numpy import mafrom matplotlib import ticker, cm  N = 1000x = np.linspace(-6.0, 6.0, N)y = np.linspace(-7.0, 7.0, N)X, Y = np.meshgrid(x, y)  Z1 = np.exp(-(X)**2 - (Y)**2)z = 50 * Z1z[:5, :5] = -1z = ma.masked_where(z <= 0, z)  fig, ax = plt.subplots()cs = ax.contourf(X, Y, z, locator = ticker.LogLocator(),                 cmap ="Greens")  cbar = fig.colorbar(cs)ax.set_title('matplotlib.axes.Axes.contourf() Example')  plt.show()
Output:
Example-2:
# Implementation of matplotlib functionimport matplotlib.pyplot as pltimport numpy as np  # invent some numbers, turning the# x and y arrays into simple 2d arrays,# which make combining them together easier.x = np.linspace(-3, 15, 450).reshape(1, -1)y = np.linspace(-3, 15, 720).reshape(-1, 1)z = np.cos(x)*2 - np.sin(y)**2  # we no longer need x and y to be# 2 dimensional, so flatten them.x, y = x.flatten(), y.flatten()  fig1, ax1 = plt.subplots()cs = ax1.contourf(x, y, z, hatches =['-', '/', '\\', '//'],                  cmap ='Greens', extend ='both', alpha = 1)fig1.colorbar(cs)ax1.set_title('matplotlib.axes.Axes.contourf() Example')plt.show()
Output:
Python-matplotlib
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
How To Convert Python Dictionary To JSON?
How to drop one or multiple columns in Pandas Dataframe
Check if element exists in list in Python
Python | os.path.join() method
Defaultdict in Python
Selecting rows in pandas DataFrame based on conditions
Python | Get unique values from a list
Create a directory in Python
Python | Pandas dataframe.groupby()
Python - cmath.inf Constant - GeeksforGeeks

28 May, 2020
cMath module contains a number of functions which is used for mathematical operations for complex numbers. The cmath.inf Constant is used to get the floating-point positive infinity.
Syntax: cmath.inf 
Returns: Return the value of positive infinity
Below examples illustrate the use of above function:
Example #1 : 
Python3
# Python code to implement# the cmath.inf constant        # importing "cmath"# for mathematical operations  import cmath     # Print the positive infinityval = cmath.inf print(val)
Output:
inf
Example 2:
Python3
# Python code to implement# the cmath.inf constant        # importing "cmath"# for mathematical operations  import cmath     # Print the negative infinityval = -cmath.infprint(val)
Output:
-inf
Python Cmath-library
Python math-library-functions
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Read a file line by line in Python
Enumerate() in Python
How to Install PIP on Windows ?
Iterate over a list in Python
Different ways to create Pandas Dataframe
Python String | replace()
Create a Pandas DataFrame from Lists
Python program to convert a list to string
Reading and Writing to text files in Python
How do I assign a dictionary value to a variable in Python?

You can assign a dictionary value to a variable in Python using the access operator []. 
my_dict = {
   'foo': 42,
   'bar': 12.5
}

new_var = my_dict['foo']
print(new_var)
This will give the output −
42
This syntax can also be used to reassign the value associated with this key. 
my_dict = {
   'foo': 42,
   'bar': 12.5
}

my_dict['foo'] = "Hello"
print(my_dict['foo'])
This will give the output −
Hello
How to create a WebView in an iOS App using Swift?

As an iOS developer, you will come across multiple scenarios where you have to display something in web, for that we use WebView.
As per Apple, − It is an object that displays interactive web content, such as for an in-app browser.
So in this post, we will be seeing how to create WebView and load the data in it.
So let’s start
Step 1 − Open Xcode and create a single view application and name it WebViewSample.
Step 2 − Open ViewController.swift file and import the WebKit module. import WebKit
Step 3 − Add a property of WebKit in ViewController.swift.
var webView: WKWebView!
Step 4 − Add WKUIDelegate delegate to ViewController.swift
Step 5 − In ViewController.swift add the below method, add override loadView function.
override func loadView() {
   let webConfiguration = WKWebViewConfiguration()
   webView = WKWebView(frame: .zero, configuration: webConfiguration)
   webView.uiDelegate = self
   view = webView
}
Step 6 − In viewDidLoad create the URL request which you want to load and load the URL
override func viewDidLoad() {
   super.viewDidLoad()
   let myURL = URL(string:"https://www.apple.com")
   let myRequest = URLRequest(url: myURL!)
   webView.load(myRequest)
}
Step 7 − Run the application,
import UIKit
import WebKit
class ViewController: UIViewController, WKUIDelegate {
   var webView: WKWebView!
   override func viewDidLoad() {
      super.viewDidLoad()
      let myURL = URL(string:"https://www.apple.com")
      let myRequest = URLRequest(url: myURL!)
      webView.load(myRequest)
   }
   override func loadView() {
      let webConfiguration = WKWebViewConfiguration()
      webView = WKWebView(frame: .zero, configuration: webConfiguration)
      webView.uiDelegate = self
      view = webView
   }
}
PostgreSQL – TEXT Data Type

28 Aug, 2020
PostgreSQL supports a character data type called TEXT. This data type is used to store character of unlimited length. It is represented as text in PostgreSQL. The performance of the varchar (without n) and text are the same.
Syntax: variable_name TEXT
Example 1:Let’s create a new table(say, text_test) for the demonstration using the below commands:
CREATE TABLE text_test (
    id serial PRIMARY KEY,
    x TEXT,
        y TEXT
);
Now let’s insert a new row into the char_test table using the below command:
INSERT INTO text_test (x, y)
VALUES
    (
        'Geeks',
        'This is a test for char'
        
    );
Now that we have managed to successfully assign the values to the character data type, check it by running the below command:
SELECT * FROM text_test;
Output:
Example 2:Let’s create a new table(say, text_test2) for the demonstration using the below commands:
CREATE TABLE text_test2 (
    id serial PRIMARY KEY,
    a TEXT,
        b TEXT
);
Now let’s insert a new row into the char_test table using the below command:
INSERT INTO text_test2 (a, b)
VALUES
    (
        'GeeksForGeeks',
        'GeeksForGeeks is the Best.'
        
    );
Now that we have managed to successfully assign the values to the character data type, check it by running the below command:
SELECT * FROM text_test2;
Output:
postgreSQL-dataTypes
PostgreSQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Get Zip Code with given location using GeoPy in Python

25 Oct, 2020
In this article, we are going to write a python script to get the Zip code by using location using the Geopy module.geopy makes it easy for Python developers to locate the coordinates of addresses, cities, countries, and landmarks across the world.
To install the Geopy module, run the following command in your terminal.
pip install geopy

Approach:
Import the Geopy module
Initialize Nominatim API to get location from the input string.
Get location with geolocator.geocode() function.
Now extract the Zip data from the location instance.
Step-by-step implementation:
Step #1: Import module.
Python3
# import modulefrom geopy.geocoders import Nominatim
Step #2: Make a Nominatim object and initialize Nominatim API  with the geoapiExercises parameter.
Python3
# initialize Nominatim API geolocator = Nominatim(user_agent="geoapiExercises")
Step #3:  Now get a complete address with geocode().
Python3
place = "Boring road patna"location = geolocator.geocode(place)print(location)
Output:
Boring Road, Digha, Patna, Patna Rural, Patna, Bihar, 800001, India
Step #4: Now get the information from the given list and parsed into a dictionary with raw function().
Python3
data = location.rawprint(data)
Output:
Step #5: Now traverse the ZIP Code from a given dictionary.
Python3
loc_data = data['display_name'].split()print("Full Location")print(loc_data)print("Zip code : ",loc_data[-2])
Output:
Full implementation:
Python3
# import modulefrom geopy.geocoders import Nominatim  # initialize Nominatim API geolocator = Nominatim(user_agent="geoapiExercises")  # place input by geekplace = "Boring road patna"location = geolocator.geocode(place)  # traverse the datadata = location.rawloc_data = data['display_name'].split()print("Full Location")print(loc_data)print("Zip code : ",loc_data[-2])
Output:
python-utility
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Data Structures | Tree Traversals | Question 3

28 Jun, 2021
The inorder and preorder traversal of a binary tree are d b e a f c g and a b d e c f g, respectively. The postorder traversal of the binary tree is:(A) d e b f g c a(B) e d b g f c a(C) e d b f g c a(D) d e f g b c aAnswer: (A)Explanation: Below is the given tree.
                              a
                           /    \
                        /          \
                      b             c
                   /   \          /   \
                 /       \      /       \
               d         e    f          g
Quiz of this Question
Data Structures
Data Structures-Tree Traversals
Tree Traversals
Data Structures
Data Structures
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Introduction to Data Structures
Data Structures | Array | Question 2
Advantages and Disadvantages of Linked List
Data Structures | Binary Search Trees | Question 8
Data Structures | Queue | Question 2
Data Structures | Hash | Question 5
Amazon Interview Experience for SDE-II
Data Structures | Linked List | Question 4
Data Structures | Linked List | Question 16
Difference between Singly linked list and Doubly linked list
How to set the width of an element in JavaScript?

Use the width property in JavaScript to set the width of an element.
You can try to run the following code to learn how to set the width of an element in JavaScript −
<!DOCTYPE html>
<html>
   <body>
      <button type="button" id="btn" onclick="display()">
      Change height and width
      </button>
      <script>
         function display() {
            document.getElementById("btn").style.width = "250px";
            document.getElementById("btn").style.height = "250px";
         }
      </script>
   </body>
</html>
Python – Join strings by multiple delimiters

02 Feb, 2021
Given two strings, the task is to write a python program to join them by every delimiter from delimiter list.
Input : test_str1 = ‘Geeksforgeeks’, test_str2 = “Best”, join_list = [“+”, “*”, “-“, “$”, “,”, “@”]
Output : [‘Geeksforgeeks+Best’, ‘Geeksforgeeks*Best’, ‘Geeksforgeeks-Best’, ‘Geeksforgeeks$Best’, ‘Geeksforgeeks,Best’, ‘Geeksforgeeks@Best’]
Explanation : Elements are concatenated with all desired delimiters.
Input : test_str1 = ‘Geeksforgeeks’, test_str2 = “Best”, join_list = [“+”, “*”, “-“, “$”]
Output : [‘Geeksforgeeks+Best’, ‘Geeksforgeeks*Best’, ‘Geeksforgeeks-Best’, ‘Geeksforgeeks$Best’]
Explanation : Elements are concatenated with all desired delimiters.
Method 1 : Using list comprehension
In this, we iterate through all the delimiters from list using loop inside list comprehension and + operator performs task of concatenation.
Example:
Python3
# initializing stringstest_str1 = 'Geeksforgeeks'test_str2 = "Best"  # printing original stringsprint("The original string 1 is : " + str(test_str1))print("The original string 2 is : " + str(test_str2))  # initializing join listjoin_list = ["+", "*", "-", "$", ",", "@"]  # + operator used for concatenationsres = [test_str1 + delim + test_str2 for delim in join_list]  # printing resultprint("All delimiters concatenations : " + str(res))
Output:
The original string 1 is : Geeksforgeeks
The original string 2 is : Best
All delimiters concatenations : [‘Geeksforgeeks+Best’, ‘Geeksforgeeks*Best’, ‘Geeksforgeeks-Best’, ‘Geeksforgeeks$Best’, ‘Geeksforgeeks,Best’, ‘Geeksforgeeks@Best’]
Method 2 : Using join() and list comprehension
Similar to above method, difference being task of joining is performed using join(), rather than + operator.
Example:
Python3
# initializing stringstest_str1 = 'Geeksforgeeks'test_str2 = "Best"  # printing original stringsprint("The original string 1 is : " + str(test_str1))print("The original string 2 is : " + str(test_str2))  # initializing join listjoin_list = ["+", "*", "-", "$", ",", "@"]  # join() operator used for concatenationsres = [delim.join([test_str1, test_str2]) for delim in join_list]  # printing resultprint("All delimiters concatenations : " + str(res))
Output:
The original string 1 is : Geeksforgeeks
The original string 2 is : Best
All delimiters concatenations : [‘Geeksforgeeks+Best’, ‘Geeksforgeeks*Best’, ‘Geeksforgeeks-Best’, ‘Geeksforgeeks$Best’, ‘Geeksforgeeks,Best’, ‘Geeksforgeeks@Best’]
Python string-programs
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Generate the row count (serial number) of records after returning the result in MySQL query?

To generate serial number i.e. row count in MySQL query, use the following syntax.
SELECT @yourVariableName − = @yourVariableName+1 anyAliasName,
   yourColumnName1,yourColumnName2,yourColumnName3,....N from yourTableName ,
   (select @yourVariableName − = 0) as yourVariableName;
To understand the above syntax, let us create a table. The query to create a table is as follows −
mysql> create table tblStudentInformation
   -> (
   -> StudentName varchar(20),
   -> StudentAge int,
   -> StudentMathMarks int
   -> );
Query OK, 0 rows affected (0.68 sec)
Insert some records in the table using insert command. The query is as follows −
mysql> insert into tblStudentInformation values('Carol',23,89);
Query OK, 1 row affected (0.18 sec)

mysql> insert into tblStudentInformation values('Bob',25,92);
Query OK, 1 row affected (0.22 sec)

mysql> insert into tblStudentInformation values('John',21,82);
Query OK, 1 row affected (0.15 sec)

mysql> insert into tblStudentInformation values('David',26,98);
Query OK, 1 row affected (0.21 sec)
Display all records from the table using select statement. The query is as follows −
mysql> select *from tblStudentInformation;
The following is the output.
+-------------+------------+------------------+
| StudentName | StudentAge | StudentMathMarks |
+-------------+------------+------------------+
| Carol       | 23         |               89 |
| Bob         | 25         |               92 |
| John        | 21         |               82 |
| David       | 26         |               98 |
+-------------+------------+------------------+
4 rows in set (0.00 sec)
The following is the query to generate the serial number in MySQL query −
mysql> SELECT @serialNumber − = @serialNumber+1 yourSerialNumber,
   -> StudentName,StudentAge,StudentMathMarks from tblStudentInformation,
   -> (select @serialNumber − = 0) as serialNumber;
Here is the output displaying the row number in the form of serial number.
+------------------+-------------+------------+------------------+
| yourSerialNumber | StudentName | StudentAge | StudentMathMarks |
+------------------+-------------+------------+------------------+
|                1 | Carol       |         23 |               89 |
|                2 | Bob         |         25 |               92 |
|                3 | John        |         21 |               82 |
|                4 | David       |         26 |               98 |
+------------------+-------------+------------+------------------+
4 rows in set (0.00 sec)
Python Program for Counting Sort

In this article, we will learn about the solution to the problem statement given below.
Problem statement− We are given an array, we need to sort the array using the concept of counting sort.
Counting sort is a technique in which we work on keys between a specific range. It involves counting the number of objects which have distinct key & values. Finally, we do arithmetic calculations to obtain the position of each object and display the output.
Now let’s observe the solution in the implementation below −
 Live Demo
def countSort(arr):
   # The output character array that will have sorted arr
   output = [0 for i in range(256)]
   # Create a count array initialized with 0
   count = [0 for i in range(256)]
   # as strings are immutable
   ans = ["" for _ in arr]
   # count
   for i in arr:
      count[ord(i)] += 1
   # position of character in the output array
   for i in range(256):
      count[i] += count[i-1]
   # output character array
   for i in range(len(arr)):
      output[count[ord(arr[i])]-1] = arr[i]
      count[ord(arr[i])] -= 1
   # array of sorted charcters
   for i in range(len(arr)):
      ans[i] = output[i]
   return ans
# main
arr = "Tutorialspoint"
ans = countSort(arr)
print ("Sorted character array is "+str("".join(ans)))
Sorted character array is Taiilnooprsttu
All the variables are declared in the local scope and their references are seen in the figure above.
In this article, we have learned about how we can make a Python Program for Counting Sort
How to stretch div to fit the container ?

06 Apr, 2021
A child div inside a container can be made to take the complete width and height of the parent div. There are two methods to stretch the div to fit the container using CSS tat are discussed below:
Method 1: First method is to simply assign 100% width and 100% height to the child div so that it will take all available space of the parent div.
Consider this HTML for demonstration:
HTML
<!DOCTYPE html><html lang="en">  <head>    <style>        .container {            height: 400px;            background-color: green;        }                  .num1 {            background-color: yellow;            height: 100%;            width: 100%;        }    </style>  </head>  <body>    <div class="container">        <div class="num1">            Welcome to GFG.        </div>    </div></body>  </html>
Output:
Method 2: We can make the display attribute of the child container to table-row and display attribute of parent container to table, that will take all the height available from the parent div element. To cover all the width, we can make the width of parent div to 100%.
HTML
<!DOCTYPE html><html lang="en">  <head>    <style>        .container {            height: 200px;            background-color: green;            display: table;            width: 100%;        }                  .num1 {            background-color: greenyellow;            display: table-row;        }    </style></head>  <body>    <div class="container">        <div class="num1">            Welcome to GFG.        </div>    </div></body>  </html>
  
Output:
CSS-Properties
CSS-Questions
HTML-Attributes
HTML-Questions
HTML-Tags
Picked
CSS
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to run node.js program as an Executable ?

15 Sep, 2021
Running Node.js program as an Executable means we do not have to go to the program directory, from anywhere in the terminal, we can execute our program with a specific self-registered word. 
There are four steps to follow to run a node.js program as Executable. 
Add bin section in package.jsonChange index.js file permission (not for windows operating system).Add comment to index.js file to allow it to be treated like an executable.Link the project.
Add bin section in package.json
Change index.js file permission (not for windows operating system).
Add comment to index.js file to allow it to be treated like an executable.
Link the project.
Adding bin section in package.json file:  
"bin" : {
    "execute" : "index.js"
} 
Note: Add any reasonable word in place of ‘execute’.
Change File permission  
chmod +x index.js
Add comment to index.js  
#!/usr/bin/env node
Command to link projects  
npm link
Example 1:  
Javascript
// Adding comment to to index.js#!/usr/bin / env node// Code to count length of word// passed as argument // Receive argument via command lineconst word = process.argv[2]; // Counting lengthconst length = word.length; // Printing it to consoleconsole.log(`Words Length : ${length}`);
Input 
execute Countlengthofmine!
Output:  
Example 2:  
Javascript
// Adding comment to to index.js#!/usr/bin / env node // Receiving name as command// line argumentconst name = process.argv[2] // Say greetingsconsole.log(`Hi there, ${name}`)
Input 
execute Aasia
Output:  
Note: 
One must have to do the above-mentioned 4 steps to run your node.js program as executable. 
For Windows users, run the Executable from Node.js command prompt.
 
sagartomar9927
Node.js-Misc
Node.js
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to use Sequelize in Node.js ? - GeeksforGeeks

20 May, 2020
Sequelize is a promise-based Node.js ORM for Postgres, MySQL, MariaDB, SQLite, and Microsoft SQL Server. Its features are solid transaction support, relations, eager and lazy loading, read replication and many more.
Features of Sequelize:
Sequelize is a third-party package to be precise its an Object-Relational Mapping Library(ORM)..
Standardization ORMs usually have a single schema definition in the code. This makes it very clear what the schema is, and very simple to change it.
No need to learn SQL – queries are written in plain JavaScript.
Setting up a Node.js app:
Start Node.js app using the following command:npm init -y
npm init -y
Installation of Sequelize:
Sequelize needs MySql module installed in your project. if you have not installed MySql module then make sure before installing Sequelize you need to install MySql2 module. You need to install this module by using the following command.npm install mysql2After installing the MySql2 module, we have to install Sequelize module to install this module by using the following command.npm install sequelize
Sequelize needs MySql module installed in your project. if you have not installed MySql module then make sure before installing Sequelize you need to install MySql2 module. You need to install this module by using the following command.npm install mysql2
npm install mysql2
After installing the MySql2 module, we have to install Sequelize module to install this module by using the following command.npm install sequelize
npm install sequelize
Requiring module:
You need to include Sequelize module in your project by using these lines.const Sequelize = require('sequelize');
const Sequelize = require('sequelize');
Configuring database.js file:
// Include Sequelize moduleconst Sequelize = require('sequelize')  // Creating new Object of Sequelizeconst sequelize = new Sequelize(    'DATABASE_NAME',    'DATABASE_USER_NAME',    'DATABASE_PASSWORD', {          // Explicitly specifying         // mysql database        dialect: 'mysql',          // By default host is 'localhost'                   host: 'localhost'    });  // Exporting the sequelize object. // We can use it in another file// for creating modelsmodule.exports = sequelize
Node.js-Misc
Node.js
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Node.js fs.writeFile() Method
Node.js fs.readFile() Method
How to install the previous version of node.js and npm ?
Difference between promise and async await in Node.js
How to use an ES6 import in Node.js?
Remove elements from a JavaScript Array
Convert a string to an integer in JavaScript
How to fetch data from an API in ReactJS ?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to insert spaces/tabs in text using HTML/CSS?
How to run Java code in Node.js ? - GeeksforGeeks

19 May, 2021
Node.js is a non-blocking, event-driven JavaScript runtime platform that is built using Chrome’s V8 JavaScript engine. It is mainly used to build scalable projects and applications as it is quite efficient as well as lightweight. It is mainly used for backend purposes while building an application.
Approach: In this particular article, we will be learning how to run a Java code using Node.js. Our main approach for achieving this functionality will be to use Bridge API to be able to connect to existing Java APIs.
Follow these steps to run java program in Node.js:
1. Install Node.js on your computer, See the steps here.
If it is already installed, skip this step.
2. Open the folder (or) project where your Java code is stored, and initialize npm.
Syntax:
npm init
3.Install java as npm package
Syntax:
npm install java
Note: Python and JDK need to be installed on your system for this to run error-free as the package to be installed uses gyp else you’ll end with a similar set of errors :
Learn how to download Python from here and JDK from here and set up the environment variable to both along with their respective paths.
Alternatively, you can add the java package directly to the package.json file in your project in the dependencies column.
Note: This should be the last resort i.e only if any other method doesn’t work.
4. Now test the java program by running in test.js file.
Example 1: 
Javascript
var java = require('java');var javaLangSystem = java.import('java.lang.System');  javaLangSystem.out.printlnSync('I love gfg!');
Then execute the following command on the terminal of your project:
node test.js
Output:
I love gfg!
Example 2:
Javascript
var java = require('java');var javaLangSystem = java.import('java.lang.System');var n=10  javaLangSystem.out.printlnSync(n);
node test.js
Output:
10
Reference: https://www.npmjs.com/package/java.
Node-npm
NodeJS-Questions
Picked
Java
Node.js
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Stream In Java
Constructors in Java
Exceptions in Java
Functional Interfaces in Java
Different ways of Reading a text file in Java
Installation of Node.js on Linux
How to update Node.js and NPM to next version ?
Node.js fs.readFileSync() Method
Node.js fs.writeFile() Method
Node.js fs.readFile() Method
Get element at the specific position from matrix in R - GeeksforGeeks

07 Apr, 2021
At any point in time, a matrix may be required to be traversed for an element at a specific position. In this article, we are going to access the elements from a matrix in R Programming Language using integer vector, logical vector as the index.
Integer vector is a vector, that includes all elements of integer type.
Syntax:
matrix_name[row_vector_with_values,column_vector_with_values,]
Example:
select rows 1 & 3 and columns 1 & 3 of matrix a.
print(a )
Program:
R
# create a vector named data with 9 elementsdata=c(1,2,3,4,5,6,7,8,9)  # pass this vector to matrix inputa=matrix(data, nrow = 3, ncol = 3)print(a)  # select rows 1 & 3 and columns 1 & 3print(a[c(1,3),c(1,3)] )     # select rows 1 & 2 and columns 1 & 2print(a[c(1,2),c(1,2)] )     # select rows 2 & 1 and columns 2 & 2print(a[c(2,1),c(2,2)] )   
Output:
Logical vector includes a vector comprising boolean values i.e. TRUE or FALSE.
Syntax :
matrix_name[logical_vector]
If TRUE at that position, matrix element is accessed 
If FALSE at that position, matrix element is not accessed.
Example:
data=c(TRUE,TRUE,FALSE)
Program 1:
R
# create a vector named data with 9 elementsdata=c(1,2,3,4,5,6,7,8,9)  # pass this vector to matrix inputa=matrix(data, nrow = 3, ncol = 3)print(a)  a[c(TRUE, FALSE,TRUE, FALSE,TRUE, FALSE,TRUE, FALSE,TRUE)]# accessing elements 
Output:
Program 2:
R
# create a vector named data with 9 elementsdata=c(1,2,3,4,5,6,7,8,9)  # pass this vector to matrix inputa=matrix(data, nrow = 3, ncol = 3)print(a)  print(a[c(TRUE)])# accessing elements by placing all TRUE  print(a[c(FALSE)])# accessing elements by placing all FALSE
Output:
Picked
R Matrix-Programs
R-Matrix
R Language
R Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Change Color of Bars in Barchart using ggplot2 in R
Group by function in R using Dplyr
How to Change Axis Scales in R Plots?
How to Split Column Into Multiple Columns in R DataFrame?
Replace Specific Characters in String in R
How to Split Column Into Multiple Columns in R DataFrame?
Replace Specific Characters in String in R
How to filter R DataFrame by values in a column?
How to filter R dataframe by multiple conditions?
Convert Matrix to Dataframe in R
Getting key value pairs of a dictionary in Julia - pairs() Method - GeeksforGeeks

01 Apr, 2020
The pairs() is an inbuilt function in julia which is used to return an iterator over key=>value pairs for the specified collection that maps a set of keys to a set of values. This includes arrays, where the keys are the array indices.
Syntax:pairs(collection)orpairs(IndexStyle(A), A)
Parameters:
collection: Specified collection.
IndexStyle(A): Specified iterator.
A: Specified array.
Returns: It returns an iterator over key=>value pairs for the specified collection that maps a set of keys to a set of values.
Example 1:
# Julia program to illustrate # the use of pairs() method   # Getting an iterator over key =>value # pairs for the specified collection # that maps a set of keys to a set of values.A = ["a" "c"; "b" "d"];println(pairs(A))
Output:
Example 2:
# Julia program to illustrate # the use of pairs() method   # Getting an iterator over key =>value # pairs for the specified arrayA = ["a" "c"; "b" "d"];for (index, value) in pairs(IndexStyle(A), A)    println("$index $value")    end
Output:
Julia
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Decision Making in Julia (if, if-else, Nested-if, if-elseif-else ladder)
Get array dimensions and size of a dimension in Julia - size() Method
Exception handling in Julia
Searching in Array for a given element in Julia
Find maximum element along with its index in Julia - findmax() Method
Get number of elements of array in Julia - length() Method
Join an array of strings into a single string in Julia - join() Method
Working with Excel Files in Julia
File Handling in Julia
Getting last element of an array in Julia - last() Method
GATE | GATE-CS-2014-(Set-3) | Question 65 - GeeksforGeeks

28 Jun, 2021
Classless Inter-domain Routing (CIDR) receives a packet with address 131.23.151.76. The router’s routing table has the following entries:
Prefix           Output Interface Identifier
131.16.0.0/12              3
131.28.0.0/14              5
131.19.0.0/16              2
131.22.0.0/15              1
The identifier of the output interface on which this packet will be forwarded is ______.(A) 1(B) 2(C) 3(D) 5Answer: (A)Explanation: In this question, we need to find out Netmask for each entry and BITWISE AND with given packet address, whichever equals the Netid, is the ans. Ex. 1st entry in table: 131.16.0.0/12. its MASK is first 12 bits of network(they are all 1) and remaining 20 bits of host(they are all 0). so MASK is 255.240.0.0 AND 131.23.151.76 = 131.16.0.0. Last entry is 131.22.0.0/15 MASK—>255.254.0.0 AND 131.23.151.76 = 131.22.0.0. Two ans coming interfaces 1,3.
Longest Prefix Matching is used to decide among two. When one destination address matches more than one forwarding table entry. The most specific of the matching table entries is used as the interface.
The interface 1 has the longest matching prefix with the input IP address. Therefore 1 is chosen.Quiz of this Question
GATE-CS-2014-(Set-3)
GATE-GATE-CS-2014-(Set-3)
GATE
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
GATE | Gate IT 2007 | Question 25
GATE | GATE-CS-2001 | Question 39
GATE | GATE-CS-2000 | Question 41
GATE | GATE-CS-2005 | Question 6
GATE | GATE MOCK 2017 | Question 21
GATE | GATE MOCK 2017 | Question 24
GATE | GATE-CS-2006 | Question 47
GATE | Gate IT 2008 | Question 43
GATE | GATE-CS-2009 | Question 38
GATE | GATE-CS-2003 | Question 90
How to pass a Slice to Function in Golang? - GeeksforGeeks

22 Jul, 2019
Slice is a variable-length sequence which stores elements of a similar type, you are not allowed to store different type of elements in the same slice. It is just like an array having an index value and length, but the size of the slice is resized they are not in fixed-size just like an array. In Go language, you are allowed to pass a slice to a function, means the function gets the copy of the slice.The slice is passed by value to a function along with the slice capacity, length, and the pointer of the slice is always pointing to the underlying array. So, if we made some change in the slice which is passed to the function by value will reflect in the slice present outside the function. Let us discuss this concept with the help of an example:
Example 1:
// Go program to illustrate how to// pass a slice to the functionpackage main  import "fmt"  // Function in which slice// is passed by valuefunc myfun(element []string) {      // Modifying the given slice    element[2] = "Java"    fmt.Println("Modified slice: ", element)}  // Main functionfunc main() {      // Creating slice    slc := []string{"C#", "Python", "C", "Perl"}          fmt.Println("Initial slice: ", slc)      // Passing the slice to the function    myfun(slc)          fmt.Println("Final slice:", slc)  }
Output:
Initial slice:  [C# Python C Perl]
Modified slice:  [C# Python Java Perl]
Final slice: [C# Python Java Perl]

Explanation: In the above example, we have a slice named as slc. This slice is passed in the myfun() function. As we know that the slice pointer always points to the same reference even if they passed in a function. So, when we change the value C to Java present at index value 2. This change reflects the slice present outside the function too, so the final slice after modification is [C# Python Java perl].
Example 2:
// Go program to illustrate how to// pass a slice to the functionpackage main  import "fmt"  // Function in which slice// is passed by valuefunc myfun(element []string) {      // Here we only modify the slice    // Using append function    // Here, this function only modifies    // the copy of the slice present in     // the function not the original slice    element = append(element, "Java")    fmt.Println("Modified slice: ", element)}  // Main functionfunc main() {      // Creating a slice    slc := []string{"C#", "Python", "C", "Perl"}          fmt.Println("Initial slice: ", slc)      // Passing the slice    // to the function          myfun(slc)    fmt.Println("Final slice: ", slc)  }
Output:
Initial slice:  [C# Python C Perl]
Modified slice:  [C# Python C Perl Java]
Final slice:  [C# Python C Perl]

Golang
Golang-Slices
Go Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
6 Best Books to Learn Go Programming Language
How to Parse JSON in Golang?
Time Durations in Golang
Strings in Golang
Structures in Golang
How to iterate over an Array using for loop in Golang?
Rune in Golang
Loops in Go Language
Defer Keyword in Golang
Class and Object in Golang
PyQt5 – How to make a button with image ? - GeeksforGeeks

22 Apr, 2020
In this article we will see how to create a button with image. Unlike icon which exist only at the left side, we will create a button which is covered with the image. In order to do so we will use setStyleSheet method to add image to background of the button.
Below is how normal button and a button with image looks like. 
Syntax : button.setStyleSheet(“background-image : url(image.png);”)
Argument : It takes string as argument.
Action performed : It sets background image to the button.
Code :
# importing librariesfrom PyQt5.QtWidgets import * from PyQt5.QtGui import * from PyQt5.QtCore import * import sys    class Window(QMainWindow):    def __init__(self):        super().__init__()          # setting title        self.setWindowTitle("Python ")          # setting geometry        self.setGeometry(100, 100, 600, 400)          # calling method        self.UiComponents()          # showing all the widgets        self.show()      # method for widgets    def UiComponents(self):          # creating a push button        button = QPushButton("CLICK", self)          # setting geometry of button        button.setGeometry(200, 150, 100, 30)          # adding action to a button        button.clicked.connect(self.clickme)          # setting image to the button        button.setStyleSheet("background-image : url(image.png);")          # action method    def clickme(self):          # printing pressed        print("pressed")  # create pyqt5 appApp = QApplication(sys.argv)  # create the instance of our Windowwindow = Window()  # start the appsys.exit(App.exec())
Output :
Python-gui
Python-PyQt
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Read a file line by line in Python
How to Install PIP on Windows ?
Enumerate() in Python
Different ways to create Pandas Dataframe
Iterate over a list in Python
Python String | replace()
*args and **kwargs in Python
Reading and Writing to text files in Python
Create a Pandas DataFrame from Lists
Convert integer to string in Python