code-rag-bench/online-tutorials huggingface dataset:
Google Charts - Combination Chart

Combination chart helps in rendering each series as a different marker type from the following list: line, area, bars, candlesticks, and stepped area. To assign a default marker type for series, use the seriesType property. Series property is to be useed to specify properties of each series individually. We've already seen the configuration used to draw this chart in Google Charts Configuration Syntax chapter. So, let's see the complete example.
We've used ComboChart class to show combination based chart.
//combination chart
var chart = new google.visualization.ComboChart(document.getElementById('container'));

googlecharts_combination_chart.htm
<html>
   <head>
      <title>Google Charts Tutorial</title>
      <script type = "text/javascript" src = "https://www.gstatic.com/charts/loader.js">
      </script>
      <script type = "text/javascript">
         google.charts.load('current', {packages: ['corechart']});     
      </script>
   </head>
   
   <body>
      <div id = "container" style = "width: 550px; height: 400px; margin: 0 auto">
      </div>
      <script language = "JavaScript">
         function drawChart() {
            // Define the chart to be drawn.
            var data = google.visualization.arrayToDataTable([
               ['Fruit', 'Jane', 'John', 'Average'],
               ['Apples', 3, 2, 2.5],
               ['Oranges', 2, 3, 2.5],
               ['Pears', 1, 5, 3],
               ['Bananas', 3, 9, 6],
               ['Plums', 4, 2, 3]      
            ]);
              
            // Set chart options
            var options = {
               title : 'Fruits distribution',
               vAxis: {title: 'Fruits'},
               hAxis: {title: 'Person'},
               seriesType: 'bars',
               series: {2: {type: 'line'}}
            };

            // Instantiate and draw the chart.
            var chart = new google.visualization.ComboChart(document.getElementById('container'));
            chart.draw(data, options);
         }
         google.charts.setOnLoadCallback(drawChart);
      </script>
   </body>
</html>
Verify the result.
 Print
 Add Notes
 Bookmark this page
SimpleDateFormat(“HH.mm.ss”) in Java

The format SimpleDateFormat(“HH.mm.ss”) displays time. To work with SimpleDateFormat class, we have imported the following package.
import java.text.SimpleDateFormat;
Here, we are using the SimpleDateFormat class to display date and time. Let us set it for the format we want i.e time - HH.mm.ss −
Format f = new SimpleDateFormat("HH.mm.ss");
String strResult = f.format(new Date());
System.out.println("Time = "+strResult);
The following is an example −
 Live Demo
import java.text.Format;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Calendar;
public class Demo {
   public static void main(String[] args) throws Exception {
      // displaying current date and time
      Calendar cal = Calendar.getInstance();
      SimpleDateFormat simpleformat = new SimpleDateFormat("dd/MMMM/yyyy hh:mm:s");
      System.out.println("Today's date = "+simpleformat.format(cal.getTime()));
      // current time
      Format f = new SimpleDateFormat("HH.mm.ss");
      String strResult = f.format(new Date());
      System.out.println("Time = "+strResult);
      // displaying hour
      f = new SimpleDateFormat("H");
      String strHour = f.format(new Date());
      System.out.println("Current Hour = "+strHour);
      // displaying minutes
      f = new SimpleDateFormat("mm");
      String strMinute = f.format(new Date());
      System.out.println("Current Minutes = "+strMinute);
      // displaying seconds
      f = new SimpleDateFormat("ss");
      String strSeconds = f.format(new Date());
      System.out.println("Current Seconds = "+strSeconds);
   }
}
Today's date = 26/November/2018 08:32:16
Time = 08.32.16
Current Hour = 8
Current Minutes = 32
Current Seconds = 16
Can I overload private methods in Java?

Overloading is a one of the mechanisms to achieve polymorphism where, a class contains two methods with same name and different parameters.
Whenever you call this method the method body will be bound with the method call based on the parameters.
Yes, we can overload private methods in Java but, you can access these from the same class.
 Live Demo
public class Calculator {
   private int addition(int a , int b){
      int result = a+b;
      return result;
   }
   private int addition(int a , int b, int c){
      int result = a+b+c;
      return result;
   }
   public static void main(String args[]){
      Calculator obj = new Calculator();
      System.out.println(obj.addition(12, 13));
      System.out.println(obj.addition(12, 13, 15));
   }
}
25
40
Explain recursive function in C language with program

Recursive Functions is the process of defining something in terms of itself. It is a function that calls itself again in the body of the function.
A function fact ( ), that computes the factorial of an integer ‘N’ ,which is the product of all whole numbers from 1 to N.
When fact ( ) is called with an argument of 1 (or) 0, the function returns 1. Otherwise, it returns the product of n*fact (n-1), this happens until ‘n’ equals 1.
Fact (5) =5* fact (4)
   =5*4*3* fact (3)
   =5*4*3*2* fact (2)
   =5*4*3*2*1 fact (1)
   =5*4*3*2*1
   = 120.
Following is the C program for recursive function −
 Live Demo
#include<stdio.h>
int main ( ){
   int n,f;
   int fact (int);
   printf ("enter a number");
   scanf ("%d", &n);
   f= fact (n);
   printf ("factorial value = %d",f);
}
int fact (int n){
   int f;
   if ( ( n==1) || (n==0))
      return 1;
   else f= n*fact (n-1);
      return f;
}
When the above program is executed, it produces the following result −
Enter a number 5
Factorial value = 120
How to select element by ID in jQuery ? - GeeksforGeeks

11 Sep, 2021
In this article, we are going to see how to select the element by its id using jQuery. To learn about this topic one should have prior knowledge about HTML, CSS, JavaScript and jQuery.
Using JavaScript: This question is also solved by a popular JavaScript method called document.getElementById() which is used to select the element by its id attribute. The getElementById() method returns the elements that has given ID which is passed to the function. This function is widely used in web designing to change the value of any particular element or get a particular element. If passed ID to the function does not exits then it returns null.
Syntax:
document.getElementById('idname') 
Example:
HTML
<!DOCTYPE html><html>  <head>    <title>        How do you select element by ID in javascript?    </title></head>  <body style="border: 2px solid green;     min-height: 240px; text-align: center;">          <h1 style="color:green;">        GeeksforGeeks    </h1>          <p id="element" style="margin-top:20px;"></p>      <script>        setTimeout(function() {            document.getElementById('element').innerText                 = 'Hello Geeks !! Welcome to GeeksforGeeks';        }, 2000);    </script></body>  </html>
Output:
Using jQuery: The above code is also done by using jQuery method which is very simple and done with less code. The #id selector specifies an id for an element to be selected. It should not begin with a number and the id attribute must be unique within a document which means it can be used only one time.
syntax:
$("#idname");
Example:
HTML
<!DOCTYPE html><html>  <head>    <title>        How do you select element         by ID in javascript?    </title>          <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js">    </script></head>  <body style="border: 2px solid green;     min-height: 240px; text-align: center;">          <h1 style="color:green;">        GeeksforGeeks    </h1>          <p id="element" style="margin-top:20px;"></p>      <script>        setTimeout(function () {            $('#element').text(                'Hello Geeks !! Welcome to GeeksforGeeks');        }, 2000);    </script></body>  </html>
Output:
Blogathon-2021
jQuery-Questions
jQuery-Selectors
Picked
Blogathon
JQuery
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Create a Table With Multiple Foreign Keys in SQL?
How to Import JSON Data into SQL Server?
Stratified Sampling in Pandas
SQL Query to Convert Datetime to Date
How to pass data into table from a form using React Components
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 ?
What’s difference between char s[] and char *s in C?

24 Sep, 2021
Consider below two statements in C. What is the difference between the two? 
   char s[] = "geeksquiz";
   char *s  = "geeksquiz";
Below are the key differences:
The statements ‘char s[] = “geeksquiz”‘ creates a character array which is like any other array and we can do all array operations. The only special thing about this array is, although we have initialized it with 9 elements, its size is 10 (Compiler automatically adds ‘\0’) 
C
#include <stdio.h>int main(){    char s[] = "geeksquiz";    printf("%lu", sizeof(s));    s[0] = 'j';    printf("\n%s", s);    return 0;}
Output: 
10
jeeksquiz
The statement ‘char *s = “geeksquiz”‘ creates a string literal. The string literal is stored in the read-only part of memory by most of the compilers. The C and C++ standards say that string literals have static storage duration, any attempt at modifying them gives undefined behavior. s is just a pointer and like any other pointer stores address of string literal. 
C
#include <stdio.h>int main(){    char *s = "geeksquiz";    printf("%lu", sizeof(s));     // Uncommenting below line would cause undefined behaviour    // (Caused segmentation fault on gcc)    //  s[0] = 'j';     return 0;}
Output: 
8
Running above program may generate a warning also “warning: deprecated conversion from string constant to ‘char*’”. This warning occurs because s is not a const pointer, but stores address of the read-only location. The warning can be avoided by the pointer to const.
C
#include <stdio.h>int main(){    const char *s = "geeksquiz";    printf("%lu", sizeof(s));    return 0;}
This article is contributed by Abhay Rathi. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above 
chhabradhanvi
C Array and String
cpp-string
C Language
Difference Between
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Difference between RAD Model and Incremental Model

22 Sep, 2020
1. RAD Model :RAD model refers to Rapid Application Development and it is type of Incremental Model. The components or functions are developed in parallel and it can handle small project as well as medium project. In this model any changes can be made in any stages. It has high productivity due to less number of people.
2. Incremental Model :Incremental Model is a model of software development where the product is, analyzed, designed, implemented and tested incrementally until the product is finished. Multiple development cycles take place and these cycles are divided into more smaller modules. Generally a working software in incremental model is produced during first module Each subsequent release of the module adds function to the previous release. In incremental model, process continues till the complete system is achieved.
Difference between RAD Model and Incremental Model :
Software Testing
Difference Between
Software Engineering
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
JavaScript | Check if element exists in the visible DOM

20 May, 2019
The task is to find whether an element exists in the visible DOM or not. For that purpose, there is a number of methods used but we’re going to look at few of them.
Example-1: In this example, the element is searched by document.getElementById(‘Id’) and !! is used before selector to get the boolean result.
<!DOCTYPE HTML><html>  <head>    <title>        JavaScript       | Check if element exists in the visible DOM.    </title></head>  <body style="text-align:center;"      id="body">    <h1 style="color:green;">              GeeksForGeeks          </h1>    <p id="GFG_UP"        style="font-size: 15px;              font-weight: bold;">       Check if an Element exists in visible DOM    </p>    <button onclick="gfg_Run()">        check    </button>    <p id="GFG_DOWN"        style="color:green;               font-size: 23px;              font-weight: bold;">    </p>    <script>        var el_down =             document.getElementById("GFG_DOWN");        var id = 'GFG_UP';          function gfg_Run() {            var element =                !!document.getElementById(id);            var ans = '';            if (element) {                ans = "Element of id = '" + id +                   "' exists in visible DOM.";            } else {                ans = "Element of id = '" + id +                   "' not exists in visible DOM.";            }            el_down.innerHTML = ans;        }    </script></body>  </html>
Output:
Before clicking on the button:
After clicking on the button:
Example-2: In this example, the element is searched by document.getElementsByClassName(‘className’) and length property is used to check whether variable contains results or not.
<!DOCTYPE HTML><html>  <head>    <title>        JavaScript       | Check if element exists in the visible DOM.    </title></head>  <body style="text-align:center;"       id="body">    <h1 style="color:green;">              GeeksForGeeks          </h1>    <p id="GFG_UP"        class="p"        style="font-size: 15px;               font-weight: bold;">       Check if an Element exists in visible DOM    </p>    <button onclick="gfg_Run()">        check    </button>    <p id="GFG_DOWN"       class="p"       style="color:green;               font-size: 23px;              font-weight: bold;">    </p>    <script>        var el_down =             document.getElementById("GFG_DOWN");        var className = 'p';          function gfg_Run() {            var element =                 document.getElementsByClassName(className);            var ans = '';            if (element.length > 0) {                ans = "Element of className = '" + className +                  "' exists in visible DOM.";            } else {                ans = "Element of className = '" + className +                  "' not exists in visible DOM.";            }            el_down.innerHTML = ans;        }    </script></body>  </html>
Output:
Before clicking on the button:
After clicking on the button:
HTML-DOM
JavaScript
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Bootstrap 4 .card-body class

To set the container for the Bootstrap card, you need to use the card-body class. It allows you to add content
The following is the card-body class −
<div class="card-body">
  Body of the card
</div>
And set the above inside the card class as shown in the following code snippet −
<div class="card">
  <div class="card-body">Body of the card.</div>
</div>
You can try to run the following code to implement the card-body class −
Live Demo
<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Bootstrap Example</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
  </head>

<body>

  <div class="container">
    <h3>Heading Three</h3>
    <div class="card">
      <div class="card-body">Body of the card.</div>
    </div>
  </div>

</body>
</html>
Make a Pandas DataFrame with two-dimensional list | Python

24 Oct, 2019
As we know 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 Dataframe can be achieved in multiple ways. In this article, we will learn how to create a dataframe using two-dimensional List.
Example #1:
# import pandas as pd import pandas as pd        # List1  lst = [['Geek', 25], ['is', 30],        ['for', 26], ['Geeksforgeeks', 22]]   # creating df object with columns specified    df = pd.DataFrame(lst, columns =['Tag', 'number']) print(df )
Output:
             Tag  number
0           Geek      25
1             is      30
2            for      26
3  Geeksforgeeks      22
 Example #2:
import pandas as pd        # List1  lst = [['tom', 'reacher', 25], ['krish', 'pete', 30],        ['nick', 'wilson', 26], ['juli', 'williams', 22]]       df = pd.DataFrame(lst, columns =['FName', 'LName', 'Age'],                                           dtype = float) print(df)
Output:
   FName     LName  Age
0    tom   reacher   25
1  krish      pete   30
2   nick    wilson   26
3   juli  williams   22

pandas-dataframe-program
Python-pandas
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Enumerate() in Python
Different ways to create Pandas Dataframe
Read a file line by line in Python
How to Install PIP on Windows ?
Python String | replace()
Python OOPs Concepts
Python Classes and Objects
*args and **kwargs in Python
Introduction To PYTHON
Use multiple columns in a Matplotlib legend

26 Dec, 2020
In this article, the task is to use multiple columns in a Matplotlib legend in Python. Before starting the discussion on “Use multiple columns in a Matplotlib legend”, firstly we should know briefly about matplotlib, pyplot and legend.
Matplotlib: The “matplotlib” library basically used to create so many graphical things such like high quality graphs, charts, figures and many things. The library is extensive and capable of changing very small to the smallest details of a figure. This library was introduced by John Hunter and his team in 2002.
Pyplot:  In Python, “pyplot” is a plotting library used for 2-dimensional graphics. It is used in python scripts, shell, web application servers and other GUI toolkits.
Legend: A legend is an area that describes the elements of a graph. In the matplotlib, there is a function called legend() which is used to place a legend on the mentioned axis. 
Note: Before declaring matplotlib and pyplot, it is better to declare numpy library also.
Basically, we can import pyplot with matplotlib as we generally import other libraries in python, such like
import matplotlib.pyplot as plt
or
from matplotlib import pyplot as plt
In many cases, the main thing we may have to encounter that as the legend number gets increased, it may consume a lot of vertical spaces which may create problem for visualization of the graph.  So, in this situation, we need to organize legend labels into multiple columns. For this, it will be easy to place non-disruptively all the legends. 
Using the ncol argument inside plt.legend() in below defined manner to specify the number of columns which the legend should have.
plt.legend(ncol=k)
Here, k is the number of columns the legend should have in the graph.         
Example:
Python3
# codeimport matplotlib.pyplot as plt  plt.plot([0, 3], [0, 2.0], label='Label 1')plt.plot([0, 3], [0, 2.1], label='Label 2')plt.plot([0, 3], [0, 2.2], label='Label 3')plt.plot([0, 3], [0, 2.3], label='Label 4')plt.plot([0, 3], [0, 2.4], label='Label 5')  # Change the number of columns hereplt.legend(ncol=3)  plt.show()
Output:
OUTPUT
Picked
Python-matplotlib
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Read JSON file using Python
Adding new column to existing DataFrame in Pandas
Python map() function
Python Dictionary
How to get column names in Pandas dataframe
Different ways to create Pandas Dataframe
Taking input in Python
Enumerate() in Python
Read a file line by line in Python
Python String | replace()
Sort a list according to the Length of the Elements in Python program

We have a list of strings and our goal is to sort the list based on the length of strings in the list. We have to arrange the strings in ascending order according to their lengths. We can do this using our algorithms or Python built-in method sort() or function sorted() along with a key.
Let's take an example to see the output.
Input:
strings = ["hafeez", "aslan", "honey", "appi"]
Output:
["appi", "aslan", "honey", "hafeez"]
Let's write our program using sort(key) and sorted(key). Follow the below steps to achieve the desired output using a sorted(key) function.
1. Initialize the list of strings.
2. Sort the list by passing list and key to the sorted(list, key = len) function. We have to pass len as key for the sorted() function as we are sorting the list based on the length of the string. Store the resultant list in a variable.
3. Print the sorted list.
 Live Demo
## initializing the list of strings
strings = ["hafeez", "aslan", "honey", "appi"]
## using sorted(key) function along with the key len
sorted_list = list(sorted(strings, key = len))
## printing the strings after sorting
print(sorted_list)
If you run the above program, you will get the following output.
['appi', 'aslan', 'honey', 'hafeez']

1. Initialize the list of strings.
2. Sort the list by passing key to the sort(key = len) method of the list. We have to pass len as key for the sort() method as we are sorting the list based on the length of the string. sort() method will sort the list in place. So, we don't need to store it in new variable.
3. Print the list.
 Live Demo
## initializing the list of strings
strings = ["hafeez", "aslan", "honey", "appi"]
## using sort(key) method to sort the list in place
strings.sort(key = len)
## printing the strings after sorting
print(strings)
If you run the above program, you will get the following output.
['appi', 'aslan', 'honey', 'hafeez']

If you have any doubts regarding the tutorial, mention them in the comment section.
What is the use of asterisk (*) selector in CSS ?

03 Jul, 2021
The asterisk (*) is known as the CSS universal selectors. It can be used to select any and all types of elements in an HTML page. The asterisk can also be followed by a selector while using to select a child object. This selector is useful when we want to select all the elements on the page. For example:  
* {
    property : value;
 }
While selecting elements, if we use just asterisk (*), then all the elements of the HTML page gets selected irrespective of the parent-child relation. If we use the asterisk (*) while selecting children of a particular parent, so we can select all the children of that parent by:  
parent * {
           property : value;
 }
We can use an asterisk (*) for intermediate level while selecting an element by:  
grand_parent * grand_child{
           property : value;
 }
Examples:
Input:  * { color : green; }
Output:  The text in all the elements become green

Input:  * p { color : green; }
Output:  The text inside those  which are direct children of any elements of HTML the page will become green.
 
html
<!DOCTYPE html><html> <head>    <style>        * {            background-color: gray;        }                 * p {            background-color: green;        }                 * p span {            background-color: yellow;        }                 div * h3 {            background-color: red;        }    </style></head> <body>    <center>        <h1 style="color:green">          GeeksforGeeks      </h1>         <div>             <p>                div->p                <span> div->p->span </span>            </p>             <span>    <h3> div->span->h3</h3></span>        </div>          <p>A computer science portal.</p>     </center></body> </html>
Output:  
Supported Browser:
Google Chrome 4.0
Internet Explorer 7.0
Firefox 2.0
Opera 9.6
Safari 3.1
ysachin2314
CSS-Misc
CSS-Selectors
Picked
CSS
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to update Node.js and NPM to next version ?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to insert spaces/tabs in text using HTML/CSS?
How to create footer to stay at the bottom of a Web page?
CSS to put icon inside an input element in a form
Top 10 Projects For Beginners To Practice HTML and CSS Skills
Installation of Node.js on Linux
Difference between var, let and const keywords in JavaScript
How to insert spaces/tabs in text using HTML/CSS?
How to fetch data from an API in ReactJS ?
MoviePy – Previewing a Video Clip

07 Mar, 2022
In this article we will see how we can preview the video file clip in MoviePy. MoviePy is a Python module for video editing, which can be used for basic operations on videos and GIF’s. The methods clip.show and clip.preview enable you to visualize the clip in a Pygame window. They are the fastest way to preview, as the clips are generated and displayed at the same time, and they can be useful to get the coordinates or colors of pixels. These methods require to have PyGame installed, and to use the moviepy.editor module.
In order to do this we will use preview method with the VideoFileClip object
Syntax : clip.preview(fps)
Argument : It takes fps as optional argument
Return : It returns None
If we click somewhere in the frames of a video clip being previewed, it will print the position and color of the pixel clicked. Press Escape abort the previewing.
Below is the implementation
# Import everything needed to edit video clipsfrom moviepy.editor import *     # loading video dsa gfg intro videoclip = VideoFileClip("dsa_geek.webm")   # getting only first 5 secondsclip = clip.subclip(0, 5)  # previewing the clip at fps = 20clip.preview(fps = 20)
Output :
Another example
# Import everything needed to edit video clipsfrom moviepy.editor import *  # loading video gfgclip = VideoFileClip("geeks.mp4")  # getting only first 5 secondsclip = clip.subclip(0, 5)    # previewing the clip at fps = 20clip.preview(fps = 20)
Output :
rkbhola5
Python-MoviePy
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
SQL – Multiple Column Ordering

14 Sep, 2021
SQL stands for Structured Query Language. It is used to communicate with the database. There are some standard SQl commands like ‘select’, ‘delete’, ‘alter’ etc. For column ordering in SQL, we use the ‘ORDER BY’ keyword.
It is used to sort the result-set in ascending or descending order. It sorts the records in ascending order by default. To sort the records in descending order, use the DESC keyword.
Syntax:
SELECT * FROM table_name ORDER BY column_name;
For Multiple column order, add the name of the column by which you’d like to sort records first. The column that is entered at first place will get sorted first and likewise.
Use the below SQL statement to create a database called geeks:
Query:
CREATE DATABASE geeks;
Use the below SQL statement to switch the database context to geeks:
Query:
USE geeks;
We have the following demo_table in our geeks database.
Query:
 CREATE TABLE geeksforgeeks(
 FIRSTNAME VARCHAR(20), LASTNAME VARCHAR(20), 
 CITY VARCHAR(20), AGE INT, GENDER VARCHAR(20));
INSERT INTO geeksforgeeks VALUES
('ROMY', 'Kumari', 'New Delhi', 22, 'female'),
('Pushkar', 'jha', 'New Delhi', 23, 'male'),
('Sujata', 'jha', 'Bihar', 30, 'female'),
('Roshini', 'Kumari', 'Bihar', 16, 'female'),
('Avinav', 'Pandey', 'New Delhi', 21, 'male'),
('Aman','Dhattarwal','Banglore', 30, 'male'),
('Aman','Agnihotri','Chennai', 23, 'male'),
('Aman','Malik','Agra', 35, 'male'),
('Bhawna','Dhattarwal','Banglore', 34, 'female'),
('Bhawna','Meena','Rajastha', 30, 'female')
Query:
SELECT * FROM geeksforgeeks;
Output:
Let’s take an example to order table content based on firstname and then on age.
Query:
 SELECT * FROM geeksforgeeks ORDER BY FIRSTNAME, AGE;
Output:
Now if we want to Order by firstname (ascending), lastname(descending), age(descending) then the query is: 
Query:
 SELECT * FROM geeksforgeeks ORDER BY FIRSTNAME, LASTNAME DESC, AGE DESC ;
Output:
Blogathon-2021
Picked
Blogathon
SQL
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Import JSON Data into SQL Server?
SQL Query to Convert Datetime to Date
Python program to convert XML to Dictionary
Scrape LinkedIn Using Selenium And Beautiful Soup in Python
How to toggle password visibility in forms using Bootstrap-icons ?
SQL | DDL, DQL, DML, DCL and TCL Commands
SQL | Join (Inner, Left, Right and Full Joins)
SQL | WITH clause
How to find Nth highest salary from a table
CTE in SQL
How to convert LinkedList to Array in Java?

The toArray() method of the LinkedList class converts the current Linked List object into an array of object type and returns it. This array contains all of the elements in this list in proper sequence (from first to last element). This acts as bridge between array-based and collection-based APIs.
Therefore, to convert a LinkedList to an array −
Instantiate the LinkedList class.
Instantiate the LinkedList class.
Populate it using the add() method.
Populate it using the add() method.
Invoke the toArray() method on the above created linked list and retrieve the object array.
Invoke the toArray() method on the above created linked list and retrieve the object array.
Convert each and every element of the object array to string.
Convert each and every element of the object array to string.
 Live Demo
import java.util.Arrays;
import java.util.LinkedList;
public class LinkedListToArray {
   public static void main(String[] args) {
      LinkedList <String> list = new LinkedList<String>();
      //Instantiating an ArrayList object
      list.add("JavaFX");
      list.add("Java");
      list.add("WebGL");
      list.add("OpenCV");
      list.add("OpenNLP");
      list.add("JOGL");
      list.add("Hadoop");
      list.add("HBase");
      list.add("Flume");
      list.add("Mahout");
      list.add("Impala");
      Object[] objectAarray = list.toArray();
      int length = objectAarray.length;;
      String [] stringArray = new String[length];
      for(int i =0; i < length; i++) {
         stringArray[i] = (String) objectAarray[i];
      }
      System.out.println("Contents of the array: \n"+Arrays.toString(stringArray));
   }
}
Contents of the array:
[JavaFX, Java, WebGL, OpenCV, OpenNLP, JOGL, Hadoop, HBase, Flume, Mahout, Impala]
You can also get the String array directly by passing new String[0] to the toArray() method.
 Live Demo
import java.util.Arrays;
import java.util.LinkedList;
public class LinkedListToArray {
   public static void main(String[] args) {
      LinkedList <String> list = new LinkedList<String>();
      //Instantiating an ArrayList object
      list.add("JavaFX");
      list.add("Java");
      list.add("WebGL");
      list.add("OpenCV");
      list.add("OpenNLP");
      list.add("JOGL");
      list.add("Hadoop");
      list.add("HBase");
      list.add("Flume");
      list.add("Mahout");
      list.add("Impala");
      String[] stringArray = list.toArray(new String[0]);
      System.out.println("Contents of the array: \n"+Arrays.toString(stringArray));
   }
}
Contents of the array:
[JavaFX, Java, WebGL, OpenCV, OpenNLP, JOGL, Hadoop, HBase, Flume, Mahout, Impala]
numpy.right_shift() in Python - GeeksforGeeks

28 Nov, 2018
numpy.right_shift() function is used to Shift the bits of an integer to the right.
Because the internal representation of numbers is in binary format, this operation is equivalent to dividing arr1 by 2**arr2. For example, if the number is 20 and we want to 2-bit right shift then after right shift 2-bit the result will be 20/(2^2) = 5.
Syntax : numpy.right_shift(arr1, arr2, /, out=None, *, where=True, casting=’same_kind’, order=’K’, dtype=None, ufunc ‘right_shift’)
Parameters :arr1 : array_like of integer typearr2 : array_like of integer typeNumber of bits we have to remove at the right of arr1.
out : [ndarray, optional] A location into which the result is stored.  -> If provided, it must have a shape that the inputs broadcast to.  -> If not provided or None, a freshly-allocated array is returned.
**kwargs : allows you to pass keyword variable length of argument to a function. It is used when we want to handle named argument in a function.
where : [array_like, optional] True value means to calculate the universal functions(ufunc) at that position, False value means to leave the value in the output alone.
Return : array of integer type.Return arr1 with bits shifted arr2 times to the right. This is a scalar if both arr1 and arr2 are scalars.
Code #1 : Working
# Python program explaining# right_shift() function  import numpy as geekin_num = 20bit_shift = 2  print ("Input  number : ", in_num)print ("Number of bit shift : ", bit_shift )     out_num = geek.right_shift(in_num, bit_shift) print ("After right shifting 2 bit  : ", out_num) 
Output :
Input  number :  20
Number of bit shift :  2
After right shifting 2 bit  :  5

 Code #2 :
# Python program explaining# right_shift() function  import numpy as geek  in_arr = [24, 48, 16]bit_shift =[3, 4, 2]   print ("Input array : ", in_arr) print ("Number of bit shift : ", bit_shift)    out_arr = geek.right_shift(in_arr, bit_shift) print ("Output array after right shifting: ", out_arr) 
Output :
Input array :  [24, 48, 16]
Number of bit shift :  [3, 4, 2]
Output array after right shifting:  [3 3 4]

 
Python numpy-Binary Operation
Python-numpy
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Python OOPs Concepts
How to Install PIP on Windows ?
Bar Plot in Matplotlib
Defaultdict in Python
Python Classes and Objects
Deque in Python
Check if element exists in list in Python
How to drop one or multiple columns in Pandas Dataframe
Python - Ways to remove duplicates from list
Class method vs Static method in Python
Can constructor throw exceptions in Java?

A constructor is used to initialize an object when it is created. It is syntactically similar to a method. The difference is that the constructors have same name as their class and, have no return type.
There is no need to invoke constructors explicitly these are automatically invoked at the time of instantiation.
public class Example {
   public Example(){
      System.out.println("This is the constructor of the class example");
   }
   public static void main(String args[]) {
      Example obj = new Example();
   }
}
This is the constructor of the class example
Yes, just like methods you can throw exceptions from constructors in. But, if you do so, you need to catch/throw (handle) the exception at the method where you invoke the constructor. If you don’t a compile time error is generated.
In the following example we have a class named Employee whose constructor throws an IOException, we are instantiating this class without handling the exception. Therefore, if you compile this program, it generates a compile time error.
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
class Employee{
   private String name;
   private int age;
   File empFile;
   Employee(String name, int age, String empFile) throws IOException{
      this.name = name;
      this.age = age;
      this.empFile = new File(empFile);
      new FileWriter(empFile).write("Employee name is "+name+"and age is "+age);
   }
   public void display(){
      System.out.println("Name: "+name);
      System.out.println("Age: "+age);
   }
}
public class ConstructorExample {
   public static void main(String args[]) {
      String filePath = "samplefile.txt";
      Employee emp = new Employee("Krishna", 25, filePath);
   }
}
ConstructorExample.java:23: error: unreported exception IOException; must be caught or declared to be thrown
   Employee emp = new Employee("Krishna", 25, filePath);
                  ^
1 error
To make this program work properly, wrap the instantiation line within try-catch or, throw the exception.
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
class Employee{
   private String name;
   private int age;
   File empFile;
   Employee(String name, int age, String empFile) throws IOException{
      this.name = name;
      this.age = age;
      this.empFile = new File(empFile);
      new FileWriter(empFile).write("Employee name is "+name+"and age is "+age);
   }
   public void display(){
      System.out.println("Name: "+name);
      System.out.println("Age: "+age);
   }
}
public class ConstructorExample {
   public static void main(String args[]) {
      String filePath = "samplefile.txt";
      Employee emp = null;
      try {
         emp = new Employee("Krishna", 25, filePath);
      }catch(IOException ex) {
         System.out.println("Specified file not found");
      }
      emp.display();
   }
}
Name: Krishna
Age: 25
Tryit Editor v3.7

Tryit: HTML text color
How to Get a slice of a primitive array in Java?

You can get a part of a Java array in between two specified indexes in various ways.
One way to do so is to create an empty array and copy the contents of the original array from the start index to the endIndex.
 Live Demo
import java.util.Arrays;
public class SlicingAnArray {
   public static int[] sliceArray(int array[], int startIndex, int endIndex ){
      int size = endIndex-startIndex;
      int part[] = new int[size];
      //Copying the contents of the array
      for(int i=0; i<part.length; i++){
         part[i] = array[startIndex+i];
      }
      return part;
   }
   public static void main(String args[]){
      int intArray[] = {12, 14, 58, 225, 56, 96 , 3, 45, 8 };
      intArray = sliceArray(intArray, 3, 7);
      System.out.println(Arrays.toString(intArray));
   }
}
[225, 56, 96, 3]
The copyOfRange() method of the java.util.Arrays class accepts an array, two integers representing start and end indexes and returns a slice of the given array which is in between the specified indexes.
import java.util.Arrays;
public class SlicingAnArray {
   public static void main(String args[]){
      int intArray[] = {12, 14, 58, 225, 56, 96 , 3, 45, 8 };
      intArray = Arrays.copyOfRange(intArray, 3, 7);
      System.out.println(Arrays.toString(intArray));
   }
}
[225, 56, 96, 3]
import java.util.Arrays;
import java.util.stream.IntStream;
public class SlicingAnArray {
   public static int[] sliceArray(int array[], int startIndex, int endIndex ){
      int size = endIndex-startIndex;
      int part[] = new int[size];
      IntStream stream = IntStream.range(startIndex, endIndex).map(i->array[i]);
      part = stream.toArray();
      //Copying the contents of the array
      for(int i=0; i<part.length; i++){
         part[i] = array[startIndex+i];
      }
      return part;
   }
   public static void main(String args[]){
      int intArray[] = {12, 14, 58, 225, 56, 96 , 3, 45, 8 };
      intArray = sliceArray(intArray, 3, 7);
      System.out.println(Arrays.toString(intArray));
      }
   }
[225, 56, 96, 3]
DirectX - 3D Transformation

In this chapter, we will focus more on transformations which help us change the 3D model coordinates to respective pixel coordinates.
There are three basic types of transforms −
World Transform
View Transform
Projection Transform
Direct3D uses these transformation models to include translations, rotations and scaling. The only condition here is that it does not apply to lights.
View transform mainly focuses on the transition of world coordinates to the respective camera space determining the position of camera.
Projection transform is usually designed to change the geometry perspective from camera space into “clip space” and applies the respective transform.
Clipping and transforming vertices usually take place in homogenous space but the final result for most applications needs to be three-dimensional (3D) non-homogenous coordinates defined in "screen space". This means that we should put both the input vertices and the clipping volume into the respective homogenous space to perform the clipping and then translate back into non-homogenous space to be displayed.
A Direct3D matrix is defined as a 4x4 homogenous matrix defined by a D3DMATRIX structure. Although Direct3D matrices are not considered as standard objects, they are represented by a COM interface.
Consider the vertex mentioned in the coordinate system given by the below equation −
Pm = (Xm, Ym, Zm, 1)
Then, the transformations created as shown in the following figure are applied to compute screen coordinates by the given equation −
Ps = (Xs, Ys, Zs, Ws)
Now let us focus on the description of each transformation stage which is needed.
World matrix Mworld transforms the required vertices from the model space to the world space. This matrix is set as mentioned below −
syntaxCopy
   d3dDevice->SetTransform (D3DTRANSFORMSTATE_WORLD, matrix address)

DirectX assumes that the last column of this matrix is taken as (0,0,0,1). No error is returned if the user specifically mentions the matrix with a different last column.
View matrix Mview transforms vertices from the world space to the camera space. The demonstration of setting up this matrix is set as follows −
syntaxCopy
   d3dDevice->SetTransform (D3DTRANSFORMSTATE_VIEW, matrix address)

Direct3D implementation assumes that the last column of this matrix is (0, 0, 0, 1).
Projection matrix which is also called Mproj transforms vertices from the mentioned camera space to the projection space. The basic syntax of creating the matrix is mentioned below −
syntaxCopy
   d3dDevice->SetTransform (D3DTRANSFORMSTATE_PROJECTION, matrix address)

 Print
 Add Notes
 Bookmark this page
Plotly - Format Axis and Ticks

You can configure appearance of each axis by specifying the line width and color. It is also possible to define grid width and grid color. Let us learn about the same in detail in this chapter.
In the Layout object’s properties, setting showticklabels to true will enable ticks. The tickfont property is a dict object specifying font name, size, color, etc. The tickmode property can have two possible values — linear and array. If it is linear, the position of starting tick is determined by tick0 and step between ticks by dtick properties.
If tickmode is set to array, you have to provide list of values and labels as tickval and ticktext properties.
The Layout object also has Exponentformat attribute set to ‘e’ will cause tick values to be displayed in scientific notation. You also need to set showexponent property to ‘all’.
We now format the Layout object in above example to configure x and y axis by specifying line, grid and title font properties and tick mode, values and font.
layout = go.Layout(
   title = "Sine and cos",
   xaxis = dict(
      title = 'angle',
      showgrid = True,
      zeroline = True,
      showline = True,
      showticklabels = True,
      gridwidth = 1
   ),
   yaxis = dict(
      showgrid = True,
      zeroline = True,
      showline = True,
      gridcolor = '#bdbdbd',
      gridwidth = 2,
      zerolinecolor = '#969696',
      zerolinewidth = 2,
      linecolor = '#636363',
      linewidth = 2,
      title = 'VALUE',
      titlefont = dict(
         family = 'Arial, sans-serif',
         size = 18,
         color = 'lightgrey'
      ),
      showticklabels = True,
      tickangle = 45,
      tickfont = dict(
      family = 'Old Standard TT, serif',
      size = 14,
      color = 'black'
      ),
      tickmode = 'linear',
      tick0 = 0.0,
      dtick = 0.25
   )
)

Sometimes it is useful to have dual x or y axes in a figure; for example, when plotting curves with different units together. Matplotlib supports this with the twinx and twiny functions. In the following example, the plot has dual y axes, one showing exp(x) and other showing log(x)
x = np.arange(1,11)
y1 = np.exp(x)
y2 = np.log(x)
trace1 = go.Scatter(
   x = x,
   y = y1,
   name = 'exp'
)
trace2 = go.Scatter(
   x = x,
   y = y2,
   name = 'log',
   yaxis = 'y2'
)
data = [trace1, trace2]
layout = go.Layout(
   title = 'Double Y Axis Example',
   yaxis = dict(
      title = 'exp',zeroline=True,
      showline = True
   ),
   yaxis2 = dict(
      title = 'log',
      zeroline = True,
      showline = True,
      overlaying = 'y',
      side = 'right'
   )
)
fig = go.Figure(data=data, layout=layout)
iplot(fig)
Here, additional y axis is configured as yaxis2 and appears on right side, having ‘log’ as title. Resultant plot is as follows −

    12 Lectures 
     53 mins

 Pranjal Srivastava
 Print
 Add Notes
 Bookmark this page
How to call parent constructor in child class in PHP?

We will face two cases while calling the parent constructor method in child class.
We can't run directly the parent class constructor in child class if the child class defines a constructor. In order to run a parent constructor, a call to parent::__construct() within the child constructor is required.
 Live Demo
<?php
   class grandpa{
      public function __construct(){
         echo "I am in Tutorials Point"."\n";
      }
   }
   class papa extends grandpa{
      public function __construct(){
         parent::__construct();
         echo "I am not in Tutorials Point";
      }
   }
$obj = new papa();
?>
Output:
I am in Tutorials Point
I am not in Tutorials Point
In the above example, we have used parent::__construct() to call the parent class constructor.
If the child does not define a constructor then it may be inherited from the parent class just like a normal class method(if it was not declared as private).
 Live Demo
<?php
   class grandpa{
      public function __construct(){
         echo "I am in Tutorials point";
      }
   }
   class papa extends grandpa{
   }
   $obj = new papa();
?>
I am in Tutorials point
Here the parent class is called implicitly because in child class we have not declared any constructor function in child class.
HTML Window sessionStorage Property

The HTML Window sessionStorage property allow us to store key/value pairs data in a web browser only for one session that means the data is deleted when the browser tab is closed.
Following is the syntax −
window.sessionStorage
Let us see an example of HTML Window sessionStorage Property −
 Live Demo
<!DOCTYPE html>
<html>
<style>
   body {
      color: #000;
      height: 100vh;
      background-color: #8BC6EC;
      background-image: linear-gradient(135deg, #8BC6EC 0%, #9599E2 100%) no-repeat;
      text-align: center;
   }
   .btn {
      background: #db133a;
      border: none;
      height: 2rem;
      border-radius: 2px;
      width: 30%;
      display: block;
      color: #fff;
      outline: none;
      cursor: pointer;
      margin: 1rem auto;
   }
   .show{
      font-size:1.2rem;
   }
</style>
<body>
<h1>HTML Window sessionStorage Property Demo</h1>
<button onclick="store()" class="btn">Store 'John Smith' Name to sessionStorage</button>
<button onclick="display()" class="btn">Display sessionStorage stored value</button>
<div class="show"></div>
<script>
   function store(){
      sessionStorage.setItem('firstName','John');
      sessionStorage.setItem('lastName','Smith');
      document.querySelector('.show').innerHTML='Name store successfully';
   }
   function display(){
      var firstName=sessionStorage.getItem('firstName');
      var lastName=sessionStorage.getItem('lastName');
      document.querySelector('.show').innerHTML='Name stored in sessionStorage is: '+ firstName +' '+lastName;
   }
</script>
</body>
</html>
Click on “Store ‘John Smith’ Name to sessionStorage” button to store name to sessionStorage:
Now click on “Display sessionStorage stored value” button to display the stored value −
Now you can also open session storage in your dev tools to understand how it works −