code-rag-bench/online-tutorials huggingface dataset:
How to write address in an HTML document ?

04 Jan, 2022
The <address> tag in HTML is used to write contact information of a person or an organization. If <address> tag is used inside the <body> tag then it represents the contact information of the document and if the <address> tag is used inside the <article> tag, then it represents the contact information of the article. The text inside the <address> tag will display in italic format. Some browser adding a line break before and after the address element.
Syntax:
<address> Contact Information... </address>
Example:
HTML
<!DOCTYPE html><html> <head>    <title>        What is the correct way to write        address in an HTML document?    </title></head> <body>    <h1 style="color:green;">GeeksforGeeks</h1>     <h3>        Correct way to write address        in HTML document    </h3>    <!-- address tag starts from here -->    <address>        Organization Name: GeeksforGeeks <br>        Web Site:        <a href="https://www.geeksforgeeks.org/about/contact-us/">            GeeksforGeeks</a><br>        visit us: GeeksforGeeks<br>        5th Floor, A-118,        Sector-136, Noida,        Uttar Pradesh - 201305    </address>    <!-- address tag ends here --> </body> </html>
Output:
Supported Browsers:
Google Chrome
Internet Explorer
Firefox
Opera
Safari
varshagumber28
HTML-Misc
HTML
Web Technologies
Web technologies Questions
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
REST API (Introduction)
Design a Tribute Page using HTML & CSS
Build a Survey Form using HTML and CSS
Design a web page using HTML and CSS
Angular File Upload
Installation of Node.js on Linux
Difference between var, let and const keywords in JavaScript
How to fetch data from an API in ReactJS ?
Differences between Functional Components and Class Components in React
Remove elements from a JavaScript Array
How to set a String as a key for an object - JavaScript?

Let’s say the following is our string −
const keyName = 'username';
To set a string as a key for an object, use the [] and pass the string name −
const stringToObject = {
  [keyName]: 'David Miller'
};
Following is the complete code −
const keyName = 'username';
const stringToObject = {
   [keyName]: 'David Miller'
}; 
console.log("Your String Value="+keyName);
console.log("Your Object Value=")
console.log(stringToObject);
To run the above program, use the following command −
node fileName.js.
Here, my file name is demo238.js.
The output is as follows −
PS C:\Users\Amit\javascript-code> node demo238.js
Your String Value=username
Your Object Value=
{ username: 'David Miller' }
Java - String subSequence() Method

This method returns a new character sequence that is a subsequence of this sequence.
Here is the syntax of this method −
public CharSequence subSequence(int beginIndex, int endIndex)

Here is the detail of parameters −
beginIndex − the begin index, inclusive.
beginIndex − the begin index, inclusive.
endIndex − the end index, exclusive.
endIndex − the end index, exclusive.
This method returns the specified subsequence.
import java.io.*;
public class Test {

   public static void main(String args[]) {
      String Str = new String("Welcome to Tutorialspoint.com");

      System.out.print("Return Value :" );
      System.out.println(Str.subSequence(0, 10) );

      System.out.print("Return Value :" );
      System.out.println(Str.subSequence(10, 15) );
   }
}
This will produce the following result −
Return Value :Welcome to
Return Value : Tuto


    16 Lectures 
     2 hours 

 Malhar Lathkar

    19 Lectures 
     5 hours 

 Malhar Lathkar

    25 Lectures 
     2.5 hours 

 Anadi Sharma

    126 Lectures 
     7 hours 

  Tushar Kale

    119 Lectures 
     17.5 hours 

 Monica Mittal

    76 Lectures 
     7 hours 

 Arnab Chakraborty
 Print
 Add Notes
 Bookmark this page
What is the difference between Write() and WriteLine() methods in C#?

The difference between Write() and WriteLine() method is based on new line character.
Write() method displays the output but do not provide a new line character.
WriteLine() method displays the output and also provides a new line character it the end of the string, This would set a new line for the next output.
Let us see an example to learn about the difference between Write() and WriteLine() method −
 Live Demo
using System;
class Program {
   static void Main() {
      Console.Write("One");
      Console.Write("Two");

      // this will set a new line for the next output
      Console.WriteLine("Three");
      Console.WriteLine("Four");
   }
}
OneTwoThree
Four
Java Tutorial

Java is a popular programming language.
Java is used to develop mobile apps, web apps, desktop apps, games and much 
more.
Our "Try it Yourself" editor makes it easy to learn Java. You can edit Java code and view the result 
in your browser.
public class Main {
  public static void main(String[] args) {
    System.out.println("Hello World");
  }
}


Try it Yourself »

Click on the "Run example" button to see how it works.
We recommend reading this tutorial, in the sequence listed in the left menu.
Java is an object oriented language and some concepts may be new. Take breaks when needed, and go
over the examples as many times as needed.
Insert the missing part of the code below to output "Hello World".
public class MyClass {
  public static void main(String[] args) {
    ..("Hello World");
  }
}

Start the Exercise
Test your Java skills with a quiz.
Start Java Quiz
Learn by examples! This tutorial supplements all explanations with clarifying examples.
See All Java Examples
Java Keywords
Java String Methods
Java Math Methods
Download Java from the official Java web site:
https://www.oracle.com
Get certified by completing the JAVA course
We just launchedW3Schools videos
Get certifiedby completinga course today!
If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:
help@w3schools.com
Your message has been sent to W3Schools.
Python | Delete rows/columns from DataFrame using Pandas.drop()

17 Sep, 2018
Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric Python packages. Pandas is one of those packages and makes importing and analyzing data much easier.
Pandas provide data analysts a way to delete and filter data frame using .drop() method. Rows or columns can be removed using index label or column name using this method.
Syntax:DataFrame.drop(labels=None, axis=0, index=None, columns=None, level=None, inplace=False, errors=’raise’)
Parameters:
labels: String or list of strings referring row or column name.axis: int or string value, 0 ‘index’ for Rows and 1 ‘columns’ for Columns.index or columns: Single label or list. index or columns are an alternative to axis and cannot be used together.level: Used to specify level in case data frame is having multiple level index.inplace: Makes changes in original Data Frame if True.errors: Ignores error if any value from the list doesn’t exists and drops rest of the values when errors = ‘ignore’
Return type: Dataframe with dropped values
To download the CSV used in code, click here.
Example #1: Dropping Rows by index labelIn his code, A list of index labels is passed and the rows corresponding to those labels are dropped using .drop() method.
# importing pandas moduleimport pandas as pd  # making data frame from csv filedata = pd.read_csv("nba.csv", index_col ="Name" )  # dropping passed valuesdata.drop(["Avery Bradley", "John Holland", "R.J. Hunter",                            "R.J. Hunter"], inplace = True)  # displaydata
Output:As shown in the output images, the new output doesn’t have the passed values. Those values were dropped and the changes were made in the original data frame since inplace was True.Data Frame before Dropping values-Data Frame after Dropping values- 
Example #2 : Dropping columns with column name
In his code, Passed columns are dropped using column names. axis parameter is kept 1 since 1 refers to columns.
# importing pandas moduleimport pandas as pd  # making data frame from csv filedata = pd.read_csv("nba.csv", index_col ="Name" )  # dropping passed columnsdata.drop(["Team", "Weight"], axis = 1, inplace = True)  # displaydata
Output:As shown in the output images, the new output doesn’t have the passed columns. Those values were dropped since axis was set equal to 1 and the changes were made in the original data frame since inplace was True.Data Frame before Dropping Columns-Data Frame after Dropping Columns-
Python pandas-dataFrame
Python pandas-dataFrame-methods
Python-pandas
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python – MenuBars in wxPython

10 May, 2020
One of the most important part in a GUI is a menubar, which are used to perform various operations on a Window. In this article we will learn how to create a menubar and add menu item to it. This can be achieved using MenuBar() constructor and Append() function in wx.MenuBar class.
Syntax for MenuBar() constructor:
wx.MenuBar(style=0)

Syntax for Append() function:
wx.MenuBar.Append(self, menu, title)

Parameters:
Code Example:
# import wxPython import wx    class Example(wx.Frame):      def __init__(self, *args, **kwargs):        super(Example, self).__init__(*args, **kwargs)          self.InitUI()      def InitUI(self):        # create MenuBar using MenuBar() function        menubar = wx.MenuBar()        fileMenu = wx.Menu()        # add menu to MenuBar        menubar.Append(fileMenu, '&Menu# 1')        self.SetMenuBar(menubar)          self.SetSize((300, 200))        self.SetTitle('Menu Bar')def main():      app = wx.App()    ex = Example(None)    ex.Show()    app.MainLoop()    if __name__ == '__main__':    main()
Output :
Python-gui
Python-wxPython
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
How to Install PIP on Windows ?
Python String | replace()
*args and **kwargs in Python
Python Classes and Objects
Python OOPs Concepts
Introduction To PYTHON
Python | os.path.join() method
Read latest news using newsapi | Python

17 Sep, 2019
In this article, we will learn how to create a Python script to read the latest news. We will fetch news from news API and after that, we will read news using pyttsx3.
Modules required :
pyttsx3 - pip install pyttsx3
requests - pip install requests
Step #1: Import modules needed
import pyttsx3import requestsimport jsonimport time
Step #2: Setting up URL with API key, place your API key here.
url = ('https://newsapi.org/v2/top-headlines?'       'country = in&'       'apiKey =')  url += 'your_api_key_here'
Step #3: Setting an engine for pyttsx3 for reading news.
engine = pyttsx3.init()
Step #4: Setting up properties of our engine, means reading rate, volume, and sound of a voice.
rate = engine.getProperty('rate')engine.setProperty('rate', rate + 10)   volume = engine.getProperty('volume')engine.setProperty('volume', volume-0.60)   sound = engine.getProperty ('voices');engine.setProperty('voice', 'sound[1].id')
Step #5: Trying to send request to get news. Here, engine.say() function is used to read news.
try:    response = requests.get(url)except:    engine.say("can, t access link, plz check you internet ")   news = json.loads(response.text)
for new in news['articles']:    print("##############################################################\n")    print(str(new['title']), "\n\n")    engine.say(str(new['title']))    print('______________________________________________________\n')      engine.runAndWait()      print(str(new['description']), "\n\n")    engine.say(str(new['description']))    engine.runAndWait()    print("..............................................................")    time.sleep(2)
Now, everything is ready build a loop to read new articles.
 Below is the complete Python implementation :
import pyttsx3import requestsimport jsonimport time  url = ('https://newsapi.org/v2/top-headlines?'       'country = in&'       'apiKey =')  url +='your_api_key_here'     engine = pyttsx3.init()rate = engine.getProperty('rate')engine.setProperty('rate', rate + 10)  volume = engine.getProperty('volume')engine.setProperty('volume', volume-0.60)  sound = engine.getProperty ('voices');engine.setProperty('voice', 'sound[1].id')    try:    response = requests.get(url)except:    engine.say("can, t access link, plz check you internet ")  news = json.loads(response.text)    for new in news['articles']:    print("##############################################################\n")    print(str(new['title']), "\n\n")    engine.say(str(new['title']))    print('______________________________________________________\n')      engine.runAndWait()      print(str(new['description']), "\n\n")    engine.say(str(new['description']))    engine.runAndWait()    print("..............................................................")    time.sleep(2)
Output:
python-utility
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
turtle.ondrag() function in Python

17 Aug, 2020
The turtle module provides turtle graphics primitives, in both object-oriented and procedure-oriented ways. Because it uses tkinter for the underlying graphics, it needs a version of Python installed with Tk support.
This function is used to bind fun to mouse-move event on this turtle on canvas.
Syntax : turtle.ondrag(fun, btn, add)Parameters :
fun : a function with two arguments, to which will be assigned the coordinates of the clicked point on the canvas
btn : number of the mouse-button defaults to 1 (left mouse button)
add : True or False. If True, new binding will be added, otherwise it will replace a former binding
Below is the implementation of the above method with an example :
Example  :
# importing packageimport turtle  # method to call on dragdef fxn(x, y):      # stop backtracking    turtle.ondrag(None)       # move the turtle's angle and direction     # towards x and y    turtle.setheading(turtle.towards(x, y))      # go to x, y    turtle.goto(x, y)      # call again    turtle.ondrag(fxn)  # set turtle speedturtle.speed(10)  # make turtle screen objectsc = turtle.Screen()  # set screen sizesc.setup(400, 300)  # call fxn on dragturtle.ondrag(fxn)  # take screen in mainloopsc.mainloop()
Output :
Python-turtle
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Copy NumPy array into another array?

05 Sep, 2020
Many times there is a need to copy one array to another. Numpy provides the facility to copy array using different methods. There are 3 methods to copy a Numpy array to another array.
Method 1: Using np.empty_like() function
This function returns a new array with the same shape and type as a given array.
Syntax:
numpy.empty_like(a, dtype = None, order = ‘K’, subok = True)

Python3
# importing Numpy packageimport numpy as np  # Creating a numpy array using np.array()ary = np.array([13, 99, 100, 34, 65, 11,                 66, 81, 632, 44])  print("Original array: ")  # printing the Numpy arrayprint(ary)  # Creating an empty Numpy array similar# to arycopy = np.empty_like(ary)  # Now assign ary to copycopy[:] = ary  print("\nCopy of the given array: ")  # printing the copied arrayprint(copy)
Output:
In the above example, the given Numpy array ‘ary‘ is copied to another array ‘copy‘ using np.empty_like () function
Method 2: Using np.copy() function
This function returns an array copy of the given object.
Syntax :
numpy.copy(a, order='K', subok=False)
Example 1:
Python3
# importing Numpy packageimport numpy as np  # Creating a numpy array using np.array()org_array = np.array([1.54, 2.99, 3.42, 4.87, 6.94,                      8.21, 7.65, 10.50, 77.5])  print("Original array: ")  # printing the Numpy arrayprint(org_array)  # Now copying the org_array to copy_array# using np.copy() functioncopy_array = np.copy(org_array)  print("\nCopied array: ")  # printing the copied Numpy arrayprint(copy_array)
Output:
In the above example, the given Numpy array ‘org_array‘ is copied to another array ‘copy_array‘ using np.copy () function
Example 2: Copy given 3-D array to another array using np.copy() function
Python3
# importing Numpy packageimport numpy as np  # Creating a 3-D numpy array using np.array()org_array = np.array([[23, 46, 85],                      [43, 56, 99],                      [11, 34, 55]])  print("Original array: ")  # printing the Numpy arrayprint(org_array)  # Now copying the org_array to copy_array# using np.copy() functioncopy_array = np.copy(org_array)  print("\nCopied array: ")  # printing the copied Numpy arrayprint(copy_array)
Output:
In the above example, the given 3-D Numpy array ‘org_array‘ is copied to another array ‘copy_array‘ using np.copy () function
Method 3: Using Assignment Operator
Python3
# importing Numpy packageimport numpy as np  # Create a 2-D Numpy array using np.array()org_array = np.array([[99, 22, 33],                      [44, 77, 66]])  # Copying org_array to copy_array# using Assignment operatorcopy_array = org_array  # modifying org_arrayorg_array[1, 2] = 13  # checking if copy_array has remained the same  # printing original arrayprint('Original Array: \n', org_array)  # printing copied arrayprint('\nCopied Array: \n', copy_array)
Output:
In the above example, the given Numpy array ‘org_array‘ is copied to another array ‘copy_array‘ using Assignment Operator.
Python numpy-arrayCreation
Python-numpy
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
DATEFROMPARTS() Function in SQL Server

18 Jan, 2021
DATEFROMPARTS() function :This function in SQL Server is used to return a date from the given values of year, month and day.
Features :
This function is used to find a date from the stated values of year, month and day.
This function comes under Date Functions.
This function accepts three parameters namely year, month and day.
This function cannot include any time with the stated date.
Syntax :
DATEFROMPARTS(year, month, day)

Parameter :This method accepts three parameters as given below :
year : It is the year specified which is of 4 digits.
month : It is the month specified which is from 1 to 12.
day : It is the day specified which is from 1st to 31st.
Returns :It returns a date from the given values of year, month and day.
Example-1 :Using DATEFROMPARTS() function and getting the date specified.
SELECT DATEFROMPARTS(2021, 01, 04);

Output :
2021-01-04
Example-2 :Using DATEFROMPARTS() function with a variable and getting the date specified.
DECLARE @year Int;
SET @year = 2012;
SELECT DATEFROMPARTS(@year, 09, 13);

Output :
2012-09-13
Example-3 :Using DATEFROMPARTS() function with three variables and getting the date specified.
DECLARE @year Int;
DECLARE @month Int;
DECLARE @day Int;
SET @year = 2016;
SET @month = 08;
SET @day = 29;
SELECT DATEFROMPARTS(@year, @month, @day);

Output :
2016-08-29
Example-4 :Using DATEFROMPARTS() as a default value in the below example and getting the output.
CREATE TABLE date_from_parts
(
    id_num        INT IDENTITY, 
    message        VARCHAR(150) NOT NULL, 
    generated_at DATETIME NOT NULL
    DEFAULT DATEFROMPARTS(2001, 4, 7), 
    PRIMARY KEY(id_num)
);
INSERT INTO date_from_parts(message)
VALUES('First Message');

INSERT INTO date_from_parts(message)
VALUES('date_from_parts');
SELECT 
    id_num, 
    message, 
    generated_at
FROM 
    date_from_parts;

Output :
Here, firstly you need to create a table then insert values into it then generate the required output using DATEFROMPARTS() function as a default value.
Note : For running above code use sql server compiler, you can also use a online compiler.
Application :This function is used to find the date from the specified values year, month and day.
DBMS-SQL
SQL-Server
SQL
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Modern Web Automation With Python and Selenium

We can have modern web automation with Python and Selenium. To configure with Selenium webdriver in Python the steps described below need to be followed −
Step1 −To install Python in our system, visit the link − https://www.python.org/downloads/
Step 2 − Click on the Download Python <version number> button. Once the download is completed, the Python executable file should be available in our system.
Step 3 − Double-click on this executable file and the Python installation landing page should be opened. Click on Install Now.
Step 4 − Python should be available in the below path −
C:\Users\<User>\AppData\Local\Programs\Python\Python<version>
Step 5 − We shall configure the path of the folders - Python and Scripts (introduced within the Python folder) in the Environment variables for the Windows users.
Step 6 − To verify, Python has been installed, run the command: python --version.
The Python version should get displayed.
Step 7 − Selenium bindings installation can be done by executing the command: pip install selenium.
Step 8 − A folder called Selenium should be found within the Python folder. To update the Selenium existing version, run the command: pip install –U selenium.
Step 9 − Finally, we should also have a Python editor - PyCharm to create the Selenium scripts((https://www.jetbrains.com/pycharm/).
Step 10 − To launch the Selenium script in a browser, we also need to download the browser drivers. For this, visit the below link − https://www.selenium.dev/downloads/
Step 11 − Scroll down to the Browser section and to download the browser drivers for different browsers.
Code Implementation
from selenium import webdriver
#configure chromedriver path
driver = webdriver.Chrome(executable_path='../drivers/chromedriver')
#implicit wait
driver.implicitly_wait(0.5)
#url launch
driver.get("https://www.tutorialspoint.com/questions/index.php")
print('Page title: ' + driver.title)
#browser close
driver.close()
How can I insert a value in a column at the place of NULL using MySQL COALESCE() function?

To understand it, we are using the data from the table ‘Employee’ having Salary=NULL for ID = 5 and 6, as follows −
mysql> Select * from Employee;
+----+--------+--------+
| ID | Name   | Salary |
+----+--------+--------+
| 1  | Gaurav | 50000  |
| 2  | Rahul  | 20000  |
| 3  | Advik  | 25000  |
| 4  | Aarav  | 65000  |
| 5  | Ram    | NULL   |
| 6  | Mohan  | NULL   |
+----+--------+--------+
6 rows in set (0.00 sec)
Now, the following queries will use COALESCE() function along with UPDATE and WHERE clause to put values at the place of NULL.
mysql> Update Employee set Salary = COALESCE(Salary,20000) where Id = 5;
Query OK, 1 row affected (0.09 sec)
Rows matched: 1 Changed: 1 Warnings: 0

mysql> Update Employee set Salary = COALESCE(Salary,30000) where Id = 6;
Query OK, 1 row affected (0.06 sec)
Rows matched: 1 Changed: 1 Warnings: 0

mysql> Select * from Employee;
+----+--------+--------+
| ID | Name   | Salary |
+----+--------+--------+
| 1  | Gaurav | 50000  |
| 2  | Rahul  | 20000  |
| 3  | Advik  | 25000  |
| 4  | Aarav  | 65000  |
| 5  | Ram    | 20000  |
| 6  | Mohan  | 30000  |
+----+--------+--------+
6 rows in set (0.00 sec)
How to submit a form using ajax in jQuery ? - GeeksforGeeks

10 Nov, 2021
jQuery is an open-source JavaScript library that simplifies the interactions between an HTML/CSS document, or more precisely the Document Object Model (DOM), and JavaScript. Elaborating the terms, jQuery simplifies HTML document traversing and manipulation, browser event handling, DOM animations, Ajax interactions, and cross-browser JavaScript development.
The $.ajax() function is used for ajax call using jQuery.
Syntax:
$.ajax({name:value, name:value, ... })
We can submit a form by ajax using submit button and by mentioning the values of the following parameters.
type: It is used to specify the type of request.
url: It is used to specify the URL to send the request to.
data: It is used to specify data to be sent to the server.
 
Example:
HTML
<!Doctype html><html>  <head>    <title>JQuery AJAX Call</title>          <!--Include JQuery Library -->    <script src="https://code.jquery.com/jquery-3.5.0.js">    </script>    <script>          // When DOM is loaded this     // function will get executed    $(() => {        // function will get executed         // on click of submit button        $("#submitButton").click(function(ev) {            var form = $("#formId");            var url = form.attr('action');            $.ajax({                type: "POST",                url: url,                data: form.serialize(),                success: function(data) {                                          // Ajax call completed successfully                    alert("Form Submited Successfully");                },                error: function(data) {                                          // Some error in ajax call                    alert("some Error");                }            });        });    });    </script></head>  <body>    <form id='formId' action=''> Name:        <input type='text'                id='nm'                name='nm'>         </input>        <br> Student ID:        <input type='text'                id='studentId'                name='studentId'>         </input>        <br> Contact No. :        <input type='text'                id='contactNumber'                name='contactNumber'>         </input>        <br>        <button type='submit'                id='submitButton'>            Submit        </button>    </form></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.
HTML-Questions
jQuery-AJAX
jQuery-Methods
jQuery-Questions
Picked
HTML
JQuery
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
JQuery | Set the value of an input text field
Form validation using jQuery
How to change selected value of a drop-down list using jQuery?
How to change the background color after clicking the button in JavaScript ?
How to fetch data from JSON file and display in HTML table using jQuery ?
Node.js MySQL NULL Values - GeeksforGeeks

07 Oct, 2021
In this article, will learn to handle NULL values and make Query on the basis of NULL values.
Syntax:
IS NULL;
IS NOT NULL;
Return Value:
‘IS NULL’ returns the row in the column which contains one or more NULL values.
‘IS NOT NULL’ returns the row in the column which does not contains any NULL values.
Module Installation: Install the MySQL module using the following command.
npm install mysql
Database: Our SQL publishers table preview with sample data is shown below.
Example 1:
index.js
const mysql = require("mysql");  let db_con  = mysql.createConnection({    host: "localhost",    user: "root",    password: '',    database: 'gfg_db'});  db_con.connect((err) => {    if (err) {      console.log("Database Connection Failed !!!", err);      return;    }      console.log("We are connected to gfg_db database");      // Here is the query    let query = "SELECT * FROM users WHERE address IS NULL";      db_con.query(query, (err, rows) => {        if(err) throw err;          console.log(rows);    });});
Output:
Example 2:
index.js
const mysql = require("mysql");  let db_con  = mysql.createConnection({    host: "localhost",    user: "root",    password: '',    database: 'gfg_db'});  db_con.connect((err) => {    if (err) {      console.log("Database Connection Failed !!!", err);      return;    }      console.log("We are connected to gfg_db database");      // Here is the query    let query = "SELECT * FROM users WHERE address IS NOT NULL";      db_con.query(query, (err, rows) => {        if(err) throw err;          console.log(rows);    });});
Output:
NodeJS-MySQL
Technical Scripter 2020
Node.js
Technical Scripter
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Node.js Export Module
How to connect Node.js with React.js ?
Difference between dependencies, devDependencies and peerDependencies
Mongoose find() Function
Mongoose Populate() Method
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?
LinkedHashSet size() method in Java - GeeksforGeeks

30 Sep, 2019
The Java.util.LinkedHashSet.size() method is used to get the size of the LinkedHashSet or the number of elements present in the LinkedHashSet.
Syntax:
Linked_Hash_Set.size()

Parameters: This method does not takes any parameter.
Return Value: The method returns the size or the number of elements present in the LinkedHashSet.
Below program illustrate the Java.util.LinkedHashSet.size() method:
// Java code to illustrate LinkedHashSet.size() methodimport java.util.*;import java.util.LinkedHashSet;  public class LinkedHashSetDemo {    public static void main(String args[])    {        // Creating an empty LinkedHashSet        LinkedHashSet<String> set = new LinkedHashSet<String>();          // Use add() method to add elements into the Set        set.add("Welcome");        set.add("To");        set.add("Geeks");        set.add("4");        set.add("Geeks");          // Displaying the LinkedHashSet        System.out.println("LinkedHashSet: " + set);          // Displaying the size of the LinkedHashSet        System.out.println("The size of the set is: "                           + set.size());    }}
LinkedHashSet: [Welcome, To, Geeks, 4]
The size of the set is: 4

Java-Functions
java-LinkedHashSet
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Object Oriented Programming (OOPs) Concept in Java
Stream In Java
Interfaces in Java
How to iterate any Map in Java
ArrayList in Java
Initialize an ArrayList in Java
Stack Class in Java
Singleton Class in Java
Multidimensional Arrays in Java
Multithreading in Java
Java Program to Find sum of Series with n-th term as n^2 - (n-1)^2 - GeeksforGeeks

05 Dec, 2018
We are given an integer n and n-th term in a series as expressed below:
Tn = n2 - (n-1)2
We need to find Sn mod (109 + 7), where Sn is the sum of all of the terms of the given series and,
Sn = T1 + T2 + T3 + T4 + ...... + Tn
Examples:
Input : 229137999
Output : 218194447

Input : 344936985
Output : 788019571

Let us do some calculations, before writing the program. Tn can be reduced to give 2n-1 . Let’s see how:
Given, Tn = n2 - (n-1)2
Or, Tn =  n2 - (1 + n2 - 2n)
Or, Tn =  n2 - 1 - n2 + 2n
Or, Tn =  2n - 1. 

Now, we need to find ∑Tn.
∑Tn = ∑(2n – 1)
We can simplify the above formula as,∑(2n – 1) = 2*∑n – ∑1Or, ∑(2n – 1) = 2*∑n – n.Where, ∑n is the sum of first n natural numbers.
We know the sum of n natural number = n(n+1)/2.
Therefore, putting this value in the above equation we will get,
∑Tn = (2*(n)*(n+1)/2)-n = n2
Now the value of n2 can be very large. So instead of direct squaring n and taking mod of the result. We will use the property of modular multiplication for calculating squares:
(a*b)%k = ((a%k)*(b%k))%k
// Java program to find sum of given// series.  public class FINDSUM {      static long mod = 1000000007;      public static long findSum(long n)    {        return ((n % mod) * (n % mod)) % mod;    }      public static void main(String[] args)    {        long n = 229137999;        System.out.print(findSum(n));    }}  // Contributed by _omg
218194447

Please refer complete article on Find sum of Series with n-th term as n^2 – (n-1)^2 for more details!
Java Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Iterate HashMap in Java?
Iterate through List in Java
Java Program to Remove Duplicate Elements From the Array
Factory method design pattern in Java
Java program to count the occurrence of each character in a string using Hashmap
Iterate Over the Characters of a String in Java
How to Get Elements By Index from HashSet in Java?
Remove first and last character of a string in Java
Java Program to Convert Char to Int
Sorting in Java
setcolor function in C - GeeksforGeeks

23 Jan, 2018
The header file graphics.h contains setcolor() function which is used to set the current drawing color to the new color.Syntax :
void setcolor(int color);

Explanation : In Graphics, each color is assigned a number. Total number of colors available are 16. Number of available colors depends on current graphics mode and driver. For example, setcolor(RED) or setcolor(4) changes the current drawing color to RED. Remember that default drawing color is WHITE. The Colors table is given below.
COLOR               INT VALUES
-------------------------------
BLACK                   0
BLUE                    1
GREEN                   2
CYAN                    3   
RED                     4
MAGENTA                 5
BROWN                   6 
LIGHTGRAY               7 
DARKGRAY                8
LIGHTBLUE               9
LIGHTGREEN             10
LIGHTCYAN              11
LIGHTRED               12
LIGHTMAGENTA           13
YELLOW                 14
WHITE                  15

Below is the implementation of setcolor() function.
// C Implementation for setcolor()#include <graphics.h>#include <stdio.h>  // driver codeint main(){    // gm is Graphics mode which is    // a computer display mode that    // generates image using pixels.    // DETECT is a macro defined in    // "graphics.h" header file    int gd = DETECT, gm, color;      // initgraph initializes the    // graphics system by loading a    // graphics driver from disk    initgraph(&gd, &gm, "");      // Draws circle in white color    // center at (100, 100) and radius    // as 50    circle(100, 100, 50);      // setcolor function    setcolor(GREEN);      // Draws circle in green color    // center at (200, 200) and radius    // as 50    circle(200, 200, 50);      getch();      // closegraph function closes the    // graphics mode and deallocates    // all memory allocated by    // graphics system .    closegraph();      return 0;}
Output :


c-graphics
computer-graphics
C Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Multidimensional Arrays in C / C++
Left Shift and Right Shift Operators in C/C++
Function Pointer in C
Substring in C++
Core Dump (Segmentation fault) in C/C++
rand() and srand() in C/C++
fork() in C
Converting Strings to Numbers in C/C++
std::string class in C++
Enumeration (or enum) in C
Normal Distribution Plot using Numpy and Matplotlib - GeeksforGeeks

05 May, 2021
In this article, we will see how we can create a normal distribution plot in python with numpy and matplotlib module. 
Normal Distribution is a probability function used in statistics that tells about how the data values are distributed. It is the most important probability distribution function used in statistics because of its advantages in real case scenarios. For example, the height of the population, shoe size, IQ level, rolling a die, and many more.
It is generally observed that data distribution is normal when there is a random collection of data from independent sources. The graph produced after plotting the value of the variable on x-axis and count of the value on y-axis is bell-shaped curve graph. The graph signifies that the peak point is the mean of the data set and half of the values of data set lie on the left side of the mean and other half lies on the right part of the mean telling about the distribution of the values. The graph is symmetric distribution. 
Numpy is a general-purpose array-processing package. It provides a high-performance multidimensional array object, and tools for working with these arrays. It is the fundamental package for scientific computing with Python.Besides its obvious scientific uses, Numpy can also be used as an efficient multi-dimensional container of generic data.
Matplotlib is a plotting library for creating static, animated, and interactive visualizations in Python. Matplotlib can be used in Python scripts, the Python and IPython shell, web application servers, and various graphical user interface toolkits like Tkinter, awxPython, etc.
Below are some program which create a Normal Distribution plot using Numpy and Matplotlib module:
Example 1:
Python3
# importing numpy as npimport numpy as np # importing pyplot as pltimport matplotlib.pyplot as plt # positionpos = 100# scalescale = 5 # sizesize = 100000 # creating a normal distribution datavalues = np.random.normal(pos, scale, size) # plotting histographplt.hist(values, 100) # showing the graphplt.show()
Output :  
Example 2:
Python3
# importing numpy as npimport numpy as np # importing pyplot as pltimport matplotlib.pyplot as plt # positionpos = 0 # scalescale = 10 # sizesize = 10000  # random seednp.random.seed(10) # creating a normal distribution datavalues = np.random.normal(pos, scale, size) # plotting histographplt.hist(values, 100) # plotting mean lineplt.axvline(values.mean(), color='k', linestyle='dashed', linewidth=2) # showing the plotplt.show()
Output :  
sweetyty
Python-matplotlib
Python-numpy
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
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 a byte to hexadecimal equivalent in Java

To convert a byte to hexadecimal equivalent, use the toHexString() method in Java.
Firstly, let us take a byte value.
byte val1 = (byte)90;
Before using the method, let us do some more manipulations. Mask the byte value now:
int res = val1 & 0xFF;
Let us now see the complete example and use the toHexString() method to convert a byte to hexadecimal equivalent.
 Live Demo
public class Demo {
   public static void main(String[] args) {
      byte val1 = (byte)90;
      System.out.println("Byte = "+val1);
      int res = val1 & 0xFF;
      System.out.println("Hexadecimal = "+Integer.toHexString(res));
   }
}
Byte = 90
Hexadecimal = 5a
B+ tree Query in Data Structure

Here we will see, how to perform the searching in B+ Tree. The B+ Tree searching is also known as B+ Tree Querying. This algorithm is very much similar to the querying of B-Tree. Moreover, this supports range query. Suppose we have a B+ tree like below −
Example of B+ Tree −
The searching technique is very similar to the binary search tree. Suppose we want to search 63 from the above tree. So we will start from root, now 63 is larger than root element 60 but smaller than 75. So we will move to the right child of the element 60. The right child is 63. But if we use B Tree, then that will be the result. In this case as the current node is internal node, then that is not an actual data. We have to move to the right child first. And at the leaf level, we can find the 63 as record. That will be the actual result.
if we want to search all elements from 63 to 78, then we do not need to backtrack each element, one by one. We find the leaf node of the initial value, then by using the linked leaf nodes, simply find all nodes before 78. So this supports range query.
Let us see the algorithm to search element inside the B-Tree.
BPlusTreeSearch(root, key) −
Input − The root of the tree, and key to find 
Output − The value of the node with key, if it is not present, return null
Apply binary search on records
if record with the ‘key’ is found, then
   return required record
else if current node is leaf node, and key is not found, then
   return null
PyQt5 QSpinBox – Making it enabled - GeeksforGeeks

17 May, 2020
In this article we will see how we can make spin box enabled according to the user, disabled spin box is basically spin box which can’t be edited i.e which get disabled and enabled spin box is normal spin box, by default spin box is enabled. In order to make spin box disabled we use setDisabled method.
In order to do so we use setEnabled method.
Syntax : spin_box.setEnabled(bool)
Argument : It takes bool as argument
Return : It returns None
Implementation steps :1. Create a spin box2. Create a push button and add action to the push button3. Inside the action make the spin box disabled4. Create another push button and add action to it5. Inside the action make the spin box enabled
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 spin box        self.spin = QSpinBox(self)          # setting geometry to spin box        self.spin.setGeometry(100, 100, 250, 40)          # setting prefix to spin        self.spin.setPrefix("Prefix ")          # setting suffix to spin        self.spin.setSuffix(" Suffix")          # setting range to spin        self.spin.setRange(0, 99999)          # creating push button        button = QPushButton("Disable", self)          # setting button geometry        button.setGeometry(100, 160, 100, 40)          # adding action to the push button        button.clicked.connect(self.push_method)          # creating push button        e_button = QPushButton("Enable", self)          # setting button geometry        e_button.setGeometry(220, 160, 100, 40)          # adding action to the push button        e_button.clicked.connect(self.another_method)      # method called by push button    def push_method(self):          # making spin box disabled        self.spin.setDisabled(True)      # method called by e_button    def another_method(self):          # making spin box enabled        self.spin.setEnabled(True)  # create pyqt5 appApp = QApplication(sys.argv)  # create the instance of our Windowwindow = Window()  # start the appsys.exit(App.exec())
Output :
Python PyQt-SpinBox
Python-gui
Python-PyQt
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()
Python program to convert a list to string
Create a Pandas DataFrame from Lists
Reading and Writing to text files in Python
CSS | :active Selector - GeeksforGeeks

07 May, 2021
The :active selector is used in styling an active link of web page. Style display when user clicks on the link. This selector is different from :link, :visited and :hover selectors. The main use of :active selector is on the links but it can be used on all elements.Syntax:  
:active{
        //CSS property
}
Below HTML/CSS code shows the functionality of :active selector :  
HTML
<!DOCTYPE html><html> <head>    <title>Active selector</title>    <style>        a:active {            background-color: green;        }                 p:active {            background-color: blue;        }    </style></head> <body>    <h3>Active for link.</h3>    <a href="https://www.geeksforgeeks.org/">Geeks for Geeks</a>    <h3>Active for text.</h3>     <p>Click Me!!</p> </body> </html>
Output:  
 
Supported Browsers  
Google Chrome 4.0
 
Edge 7.0
 
Firefox 2.0
 
Safari 3.1
 
Opera 9.6
 
arorakashish0911
CSS-Selectors
CSS
Web Technologies
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 create footer to stay at the bottom of a Web page?
How to update Node.js and NPM to next version ?
CSS to put icon inside an input element in a form
Roadmap to Become a Web Developer in 2022
Installation of Node.js on Linux
How to fetch data from an API in ReactJS ?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to insert spaces/tabs in text using HTML/CSS?
MySQL Tryit Editor v1.0

SELECT INSERT("W3Schools.com", 1, 9, "Example");
​
        
Edit the SQL Statement, and click "Run SQL" to see the result.
This SQL-Statement is not supported in the WebSQL Database.
The example still works, because it uses a modified version of SQL.
Your browser does not support WebSQL.
Your are now using a light-version of the Try-SQL Editor, with a read-only Database.
If you switch to a browser with WebSQL support, you can try any SQL statement, and play with the Database as much as you like. The Database can also be restored at any time.
Our Try-SQL Editor uses WebSQL to demonstrate SQL.
A Database-object is created in your browser, for testing purposes.
You can try any SQL statement, and play with the Database as much as you like. The Database can be restored at any time, simply by clicking the "Restore Database" button.
WebSQL stores a Database locally, on the user's computer. Each user gets their own Database object.
WebSQL is supported in Chrome, Safari, and Opera.
If you use another browser you will still be able to use our Try SQL Editor, but a different version, using a server-based ASP application, with a read-only Access Database, where users are not allowed to make any changes to the data.
MySQL Order by beginning letter?

To order by the first letter, use ORDER BY CASE statement. Let us first create a table −
mysql> create table DemoTable1535
   -> (
   -> Value varchar(100)
   -> );
Query OK, 0 rows affected (2.26 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable1535 values('MySQL is good relational database.');
Query OK, 1 row affected (0.16 sec)
mysql> insert into DemoTable1535 values('is MySQL easy to lean');
Query OK, 1 row affected (0.35 sec)
mysql> insert into DemoTable1535 values('You need to start basic SQL');
Query OK, 1 row affected (0.35 sec)
Display all records from the table using select statement −
mysql> select * from DemoTable1535;
This will produce the following output −
+------------------------------------+
| Value                              |
+------------------------------------+
| MySQL is good relational database. |
| is MySQL easy to lean              |
| You need to start basic SQL        |
+------------------------------------+
3 rows in set (0.00 sec)
Following is the query to order by the first letter −
mysql> select * from DemoTable1535
    -> order by case when left(Value, 1) = 'i' then 1 else 2 end,Value;
This will produce the following output −
+------------------------------------+
| Value                              |
+------------------------------------+
| is MySQL easy to lean              |
| MySQL is good relational database. |
| You need to start basic SQL        |
+------------------------------------+
3 rows in set (0.00 sec)