code-rag-bench/online-tutorials huggingface dataset:
Hide the console of an .exe file created with PyInstaller in Tkinter

To convert a standard Tkinter application into a window executable file, we generally use thePyintsaller package. It converts the application file into an executable application. However, we notice that when we open the executable (or .exe) file, it displays a command shell before opening the application window. We can hide or avoid the console by specifying pyinstaller --oneline filename --windowed command.
In this example, we will create an .exe file of the following program using PyInstaller.
app.py
#Import the required libraries
from tkinter import *

#Create an instance of Tkinter Frame
win = Tk()

#Set the geometry
win.geometry("700x350")

#Set the default color of the window
win.config(bg= '#aad5df')

def display_text():
   Label(win, text= "Hello World!", background= 'white', foreground='purple1').pack()

Button(win, text= "Click Me", background= "white", foreground= "black", font= ('Helvetica 13 bold'), command= display_text).pack(pady= 50)
win.mainloop()
Now, open the terminal in the same location where you have saved app.py and run the following command −
> pyinstaller –onefile app.py –windowed
It will create an app.exe file in the Dist folder.
When we run the executable file located in the Dist folder, it will display a window with a button and a Label widget.
Notice that the .exe file didn't display the command shell before opening the application window.
C++ | Exception Handling | Question 3 - GeeksforGeeks

28 Jun, 2021
What should be put in a try block?

1. Statements that might cause exceptions
2. Statements that should be skipped in case of an exception 
(A) Only 1(B) Only 2(C) Both 1 and 2Answer: (C)Explanation: The statements which may cause problems are put in try block. Also, the statements which should not be executed after a problem accursed, are put in try block. Note that once an exception is caught, the control goes to the next line after the catch block.Quiz of this Question
C++-Exception Handling
Exception Handling
C Language
C++ Quiz
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Multidimensional Arrays in C / C++
rand() and srand() in C/C++
fork() in C
Core Dump (Segmentation fault) in C/C++
Left Shift and Right Shift Operators in C/C++
C++ | new and delete | Question 4
C++ | Inheritance | Question 7
C++ | Virtual Functions | Question 12
C++ | new and delete | Question 1
C++ | Inheritance | Question 1
How to erase everything from a Tkinter text widget?

Tkinter Text widget is more than just a multiline Entry widget. It supports the implementation of multicolored text, hyperlink text, and many more.
Let us suppose a text widget has been created in an application. Now, to clear the Text widget, we can use the delete("1.0", END) method. It can be invoked in a callback function or event which can be triggered through an object of the Button Class.
# Import the required libraries
from tkinter import *

# Create an instance of Tkinter Frame
win = Tk()

# Set the geometry
win.geometry("750x250")

# Define a function to clear the text widget
def clear():
   text.delete('1.0', END)

# Create a Text Widget
text = Text(win, width=50, height=10)
text.insert("1.0", "This is my Text Widget")
text.pack(padx=5, pady=5)

# Create a Button to delete all the text
Button(win, text="Clear All", command=clear, font="aerial 12 bold").pack(padx=5, pady=5)

win.mainloop()
Running the above code will display a text widget and a button to clear the Text Widget.
Now, click the "Clear All" button to clear the text inside the text widget.
Annotated Heatmaps using Plotly in Python - GeeksforGeeks

05 Sep, 2020
A Plotly is a Python library that is used to design graphs, especially interactive graphs. It can plot various graphs and charts like histogram, barplot, boxplot, spreadplot, and many more. It is mainly used in data analysis as well as financial analysis. plotly is an interactive visualization library.
Annotated Heatmaps is the most important component of the heatmap as they shows additional information that associates with rows or columns in the heatmap. Annotation heatmaps will be represented as rows of grids through which multiple metrics can be compared to others.
Syntax: create_annotated_heatmap(z, x=None, y=None, annotation_text=None, colorscale=’Plasma’, font_colors=None, showscale=False, reversescale=False)
Parameters:
x: x axis labels.
y: y axis labels.
z:  z matrix to create heatmap.
annotation_text: Text strings for annotations. Should have the same dimensions as the z matrix. If no text is added, the values of the z matrix are annotated. Default = z matrix values.
colorscale: heatmap colorscale.
Example:
Python3
import plotly.figure_factory as ffimport numpy as np  feature_x = np.arange(0, 10, 2)feature_y = np.arange(0, 10, 3)  # Creating 2-D grid of features[X, Y] = np.meshgrid(feature_x, feature_y)  Z = np.cos(X / 2) + np.sin(Y / 4)  fig = ff.create_annotated_heatmap(Z)fig.show()
Output:
In plotly, colorscale or color chart is a flat physical object which have different types of colors. It can be set in this graph using the colorscale parameter.
Example 1:
Python3
import plotly.figure_factory as ffimport numpy as np  feature_x = np.arange(0, 10, 2)feature_y = np.arange(0, 10, 3)  # Creating 2-D grid of features[X, Y] = np.meshgrid(feature_x, feature_y)  Z = np.cos(X / 2) + np.sin(Y / 4)  fig = ff.create_annotated_heatmap(Z, colorscale='rainbow')fig.show()
Output:
 Example 2: Adding Custom Colorscale
Python3
import plotly.figure_factory as ffimport numpy as np  feature_x = np.arange(0, 10, 2)feature_y = np.arange(0, 10, 3)  # Creating 2-D grid of features[X, Y] = np.meshgrid(feature_x, feature_y)  Z = np.cos(X / 2) + np.sin(Y / 4)  custom = [[0, 'green'], [0.5, 'red']]  fig = ff.create_annotated_heatmap(Z, colorscale=custom)fig.show()
Output:
Python-Plotly
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Read a file line by line in Python
Enumerate() in Python
How to Install PIP on Windows ?
Iterate over a list in Python
Different ways to create Pandas Dataframe
Python String | replace()
Create a Pandas DataFrame from Lists
Python program to convert a list to string
Reading and Writing to text files in Python
mysqldump - A MySQL Database Backup Program

The mysqldump client utility helps performs logical backups, thereby producing a set of SQL statements which can be executed to reproduce the original database object definitions and table data.
It dumps one or more MySQL databases for backup or transfer to another SQL server.
It dumps one or more MySQL databases for backup or transfer to another SQL server.
The mysqldump command also generates output in CSV, other delimited text, or XML
format.
The mysqldump command also generates output in CSV, other delimited text, or XML
format.
The utility mysqldump requires at least the SELECT privilege for dumped tables, SHOW VIEW for dumped views, TRIGGER for dumped triggers, LOCK TABLES if the --single-transaction option is not used, and PROCESS if --no-tablespaces option is not used.
The utility mysqldump requires at least the SELECT privilege for dumped tables, SHOW VIEW for dumped views, TRIGGER for dumped triggers, LOCK TABLES if the --single-transaction option is not used, and PROCESS if --no-tablespaces option is not used.
The databases can be cloned for the purpose of development and DBA work, or can be used to produce slight variations of an existing database that could be required for testing purposes.
The databases can be cloned for the purpose of development and DBA work, or can be used to produce slight variations of an existing database that could be required for testing purposes.
For large-scale backup and restore, a physical backup is suggested, and then copying the data files in their original format thereby restoring the data quickly:
For large-scale backup and restore, a physical backup is suggested, and then copying the data files in their original format thereby restoring the data quickly:
If the tables are primarily InnoDB tables, or if there is a mix of InnoDB and MyISAM tables, the mysqlbackup command is used for the MySQL Enterprise Backup product. It provides the best performance for InnoDB backups and has minimal disruption.
If the tables are primarily InnoDB tables, or if there is a mix of InnoDB and MyISAM tables, the mysqlbackup command is used for the MySQL Enterprise Backup product. It provides the best performance for InnoDB backups and has minimal disruption.
The mysqldump can also be used to retrieve and dump table contents row by row, or it can be used to retrieve the entire content from a table and buffer it in memory before dumping it.
The mysqldump can also be used to retrieve and dump table contents row by row, or it can be used to retrieve the entire content from a table and buffer it in memory before dumping it.
There are three ways to use mysqldump, to dump a set of one or more tables, a set of one or more complete databases, or an entire MySQL server. They have been shown below −
shell> mysqldump [options] db_name [tbl_name ...]
shell> mysqldump [options] --databases db_name ...
shell> mysqldump [options] --all-databases
If the user wishes to dump the entire database, the tables following db_name shouldn’t be named, or the --databases or --all-databases option has to be used.
PriorityQueue poll() Method in Java

10 Dec, 2018
The java.util.PriorityQueue.poll() method in Java is used to retrieve or fetch and remove the first element of the Queue or the element present at the head of the Queue. The peek() method only retrieved the element at the head but the poll() also removes the element along with the retrieval. It returns NULL if the queue is empty.
Syntax:
Priority_Queue.poll()
Parameters: The method does not take any parameters.
Return Value: The method returns the element at the head of the Queue else returns NULL if the Queue is empty.
Below programs illustrate the use of java.util.PriorityQueue.poll() method:Program 1:
// Java code to illustrate poll()import java.util.*;  public class PriorityQueueDemo {    public static void main(String args[])    {        // Creating an empty PriorityQueue        PriorityQueue<String> queue = new PriorityQueue<String>();          // Use add() method to add elements into the Queue        queue.add("Welcome");        queue.add("To");        queue.add("Geeks");        queue.add("For");        queue.add("Geeks");          // Displaying the PriorityQueue        System.out.println("Initial PriorityQueue: " + queue);          // Fetching and removing the element at the head of the queue        System.out.println("The element at the head of the"                           + " queue is: " + queue.poll());          // Displaying the Queue after the Operation        System.out.println("Final PriorityQueue: " + queue);    }}
Initial PriorityQueue: [For, Geeks, To, Welcome, Geeks]
The element at the head of the queue is: For
Final PriorityQueue: [Geeks, Geeks, To, Welcome]

Program 2:
// Java code to illustrate poll()import java.util.*;  public class PriorityQueueDemo {    public static void main(String args[])    {        // Creating an empty PriorityQueue        PriorityQueue<Integer> queue = new PriorityQueue<Integer>();          // Use add() method to add elements into the Queue        queue.add(10);        queue.add(15);        queue.add(30);        queue.add(20);        queue.add(5);          // Displaying the PriorityQueue        System.out.println("Initial PriorityQueue: " + queue);          // Fetching the element at the head of the queue        System.out.println("The element at the head of the"                           + " queue is: " + queue.poll());          // Displaying the Queue after the Operation        System.out.println("Final PriorityQueue: " + queue);    }}
Initial PriorityQueue: [5, 10, 30, 20, 15]
The element at the head of the queue is: 5
Final PriorityQueue: [10, 15, 30, 20]

Java - util package
Java-Collections
Java-Functions
java-priority-queue
Java
Java
Java-Collections
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python – Bigrams Frequency in String

08 May, 2020
Sometimes while working with Python Data, we can have problem in which we need to extract bigrams from string. This has application in NLP domains. But sometimes, we need to compute the frequency of unique bigram for data collection. The solution to this problem can be useful. Lets discuss certain ways in which this task can be performed.
Method #1 : Using Counter() + generator expressionThe combination of above functions can be used to solve this problem. In this, we compute the frequency using Counter() and bigram computation using generator expression and string slicing.
# Python3 code to demonstrate working of # Bigrams Frequency in String# Using Counter() + generator expressionfrom collections import Counter      # initializing stringtest_str = 'geeksforgeeks'  # printing original stringprint("The original string is : " + str(test_str))  # Bigrams Frequency in String# Using Counter() + generator expressionres = Counter(test_str[idx : idx + 2] for idx in range(len(test_str) - 1))  # printing result print("The Bigrams Frequency is : " + str(dict(res))) 
The original string is : geeksforgeeksThe Bigrams Frequency is : {‘ee’: 2, ‘ks’: 2, ‘ek’: 2, ‘sf’: 1, ‘fo’: 1, ‘ge’: 2, ‘rg’: 1, ‘or’: 1}
 
Method #2 : Using Counter() + zip() + map() + joinThe combination of above functions can also be used to solve this problem. In this, we perform the task of constructing bigrams using zip() + map() + join.
# Python3 code to demonstrate working of # Bigrams Frequency in String# Using Counter() + zip() + map() + joinfrom collections import Counter      # initializing stringtest_str = 'geeksforgeeks'  # printing original stringprint("The original string is : " + str(test_str))  # Bigrams Frequency in String# Using Counter() + zip() + map() + joinres = Counter(map(''.join, zip(test_str, test_str[1:])))  # printing result print("The Bigrams Frequency is : " + str(dict(res))) 
The original string is : geeksforgeeksThe Bigrams Frequency is : {‘ee’: 2, ‘ks’: 2, ‘ek’: 2, ‘sf’: 1, ‘fo’: 1, ‘ge’: 2, ‘rg’: 1, ‘or’: 1}
Python string-programs
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to find the length of the pointer in Golang?

05 Sep, 2019
Pointers in Go programming language or Golang is a variable which is used to store the memory address of another variable. Pointers in Golang are also termed as the special variables. The variables are used to store some data at a particular memory address in the system. The memory address is always found in hexadecimal format(starting with 0x like 0xFFAAF etc.).In pointers, you are allowed to find the length of the pointer with the help of len() function. This function is a built-in function returns the total number of elements present in the pointer to an array, even if the specified pointer is nil. This function is defined under builtin.
Syntax:
func len(l Type) int
Here, the type of l is a pointer. Let us discuss this concept with the help of given examples:
Example:
// Go program to illustrate how to find the// length of the pointer to an arraypackage main  import (    "fmt")  // Main functionfunc main() {      // Creating and initializing    // pointer to array    // Using var keyword    var ptr1 [6]*int    var ptr2 [3]*string    var ptr3 [4]*float64      // Finding the length of     // the pointer to array    // Using len function    fmt.Println("Length of ptr1: ", len(ptr1))    fmt.Println("Length of ptr2: ", len(ptr2))    fmt.Println("Length of ptr3: ", len(ptr3))  }
Output:
Length of ptr1:  6
Length of ptr2:  3
Length of ptr3:  4

Example 2:
// Go program to illustrate how to find// the length of the pointer to an arraypackage main  import (    "fmt")  // Main functionfunc main() {      // Creating an array    arr := [6]int{200, 300,        400, 500, 600, 700}          var x int      // Creating pointer    var p [4]*int      // Assigning the address    for x = 0; x < len(p); x++ {              p[x] = &arr[x]    }      // Displaying result    for x = 0; x < len(p); x++ {              fmt.Printf("Value of p[%d] = %d\n", x, *p[x])    }      // Finding length    // Using len() function    fmt.Println("Length of arr: ", len(arr))    fmt.Println("Length of p: ", len(p))}
Output:
Value of p[0] = 200
Value of p[1] = 300
Value of p[2] = 400
Value of p[3] = 500
Length of arr:  6
Length of p:  4

Golang
Golang-Pointers
Go Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Tailwind CSS Animation

16 Jun, 2021
This class accepts lots of value in tailwind CSS in which all the properties are covered in class form. This class is used for animating elements with CSS animation. In CSS, we can do that by using the CSS  animation property.
Animation classes :
animate-spin:  This class is used to add a linear spin animation to elements.
animate-ping: This class is used to make an element scale and fade like a radar ping or ripple of water.
animate-bounce: This class is used to make an element bounce up and down.
animate-pulse: This class is used to make an element gently fade in and out.
Syntax :
<element class="animate-{animation_name}">...</element>
Example 1: The following code implements classes animation-spin and animation-ping.
HTML
<!DOCTYPE html><html><head>     <link href= "https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css"        rel="stylesheet"> </head> <body class="text-center mx-4 space-y-2">    <h1 class="text-green-600 text-5xl font-bold">         GeeksforGeeks     </h1>     <b>Tailwind CSS Animation</b>       <div class="m-auto ml-10 h-20 w-20                 bg-green-300 animate-spin">        Spin    </div>    <div class="m-auto mt-0 h-20 w-20                 bg-green-500 animate-ping">         Ping    </div></body></html>
 
Output:
Example 2: The following code implements classes animation-bounce and animation-pulse.
HTML
<!DOCTYPE html><html><head>     <link href= "https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css"        rel="stylesheet"> </head> <body class="text-center mx-4 space-y-2"><h1 class="text-green-600 text-5xl font-bold">         GeeksforGeeks     </h1>     <b>Tailwind CSS Animation</b>       <div class=" m-auto ml-10 h-20 w-20                bg-green-600 animate-pulse">       Pulse    </div>    <div class="m-auto mt-0 h-20 w-20                 bg-green-700 animate-bounce">       Bounce    </div>    </body></html>
Output:
Tailwind CSS
CSS
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to dynamically change the title of web page using JavaScript ?

24 Oct, 2019
Given a web page containing the page title and the task is to change the title of a web page dynamically using JavaScript.
Method 1: Using document.title property: The document.title property is used to set or return the current title of the document. The title of the page can be changed by assigning the new title as a string to this property. This will change the title of the website to the preferred title.Syntax:
newPageTitle = 'The title has changed!';document.title = newPageTitle;
Example:
<!DOCTYPE html><html>  <head>    <title>        How to dynamically change a web        page’s title using JavaScript ?    </title></head>  <body>    <h1 style="color: green">        GeeksforGeeks    </h1>          <b>        How to dynamically change a web        page’s title using JavaScript ?    </b>          <p>        Click on the button to change the page        title to: "The title has changed!"    </p>          <button onclick="changePageTitle()">        Change Page Title    </button>          <script type="text/javascript">        function changePageTitle() {            newPageTitle = 'The title has changed!';            document.title = newPageTitle;        }    </script></body>  </html>
Output:
Before clicking the button:
After clicking the button:
Method 2: Using querySelector() Method: The document.querySelector() method is used to select elements in the document. The title element can be selected by specifying the title element in the selector as a parameter. This will return the current title element of the page.
The textContent property of an element returns the text content of a specific node. The title of the page can be changed by assigning the required new title as a string to the textContent property. This will change the title of the website to the preferred title.
Syntax:
newPageTitle = 'The title has changed!';document.querySelector('title').textContent = newPageTitle;
Example:
<!DOCTYPE html><html>  <head>    <title>        How to dynamically change a web        page’s title using JavaScript ?    </title></head>  <body>    <h1 style="color: green">        GeeksforGeeks    </h1>          <b>        How to dynamically change a web        page’s title using JavaScript ?    </b>          <p>        Click on the button to change the page        title to: "The title has changed!"    </p>          <button onclick="changePageTitle()">        Change Page Title    </button>          <script type="text/javascript">        function changePageTitle() {            newPageTitle = 'The title has changed!';            document.querySelector('title').textContent                    = newPageTitle;        }    </script></body>  </html>
Output:
Before clicking the button:
After clicking the button:
javascript-basics
Picked
JavaScript
Web Technologies
Web technologies Questions
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Puzzle | Falling bear

02 Aug, 2018
A bear falling from a height of 10m on the ground in the square root of 2 seconds. what is the color of bear?
We would advise you to think yourself before reading the answer below.
Solution:
Let h ==> Height
    t ==> Time
    g ==> Gravity
h = (1/2) g (t^2)
or g = (2S)/(t^2)

So g = 10m/s, this is the maximum value of gravity on earth and occurs at the POLES. So the colour of the bear is WHITE, since it is a POLAR BEAR.
This article is contributed by Harender Bhardwaj and ADITI SAINI. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Adobe
Puzzles
Adobe
Puzzles
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Knapsack Encryption Algorithm in Cryptography

28 Dec, 2021
Knapsack Encryption Algorithm is the first general public key cryptography algorithm. It is developed by Ralph Merkle and Mertin Hellman in 1978. As it is a Public key cryptography, it needs two different keys. One is Public key which is used for Encryption process and the other one is Private key which is used for Decryption process. In this algorithm we will two different knapsack problems in which one is easy and other one is hard. The easy knapsack is used as the private key and the hard knapsack is used as the public key. The easy knapsack is used to derived the hard knapsack. 
For the easy knapsack, we will choose a Super Increasing knapsack problem. Super increasing knapsack is a sequence in which every next term is greater than the sum of all preceding terms. 
Example – 
{1, 2, 4, 10, 20, 40} is a super increasing as
1<2, 1+2<4, 1+2+4<10, 1+2+4+10<20 and 1+2+4+10+20<40.
Derive the Public key 
Step-1: Choose a super increasing knapsack {1, 2, 4, 10, 20, 40} as the private key.  
Step-2: Choose two numbers n and m. Multiply all the values of private key by the number n and then find modulo m. The value of m must be greater than the sum of all values in private key, for example 110. And the number n should have no common factor with m, for example 31.  
Step-3: Calculate the values of Public key using m and n. 
1x31 mod(110) = 31
2x31 mod(110) = 62
4x31 mod(110) = 14
10x31 mod(110) = 90
20x31 mod(110) = 70
40x31 mod(110) = 30
Thus, our public key is {31, 62, 14, 90, 70, 30} And Private key is {1, 2, 4, 10, 20, 40}.  
Now take an example for understanding the process of encryption and decryption. 
Example – Lets our plain text is 100100111100101110. 
1. Encryption : As our knapsacks contain six values, so we will split our plain text in a groups of six:  
100100  111100  101110 
Multiply each values of public key with the corresponding values of each group and take their sum. 
100100  {31, 62, 14, 90, 70, 30}
1x31+0x62+0x14+1x90+0x70+0x30 = 121

111100  {31, 62, 14, 90, 70, 30}
1x31+1x62+1x14+1x90+0x70+0x30 = 197

101110  {31, 62, 14, 90, 70, 30}
1x31+0x62+1x14+1x90+1x70+0x30 = 205 
So, our cipher text is 121 197 205. 
2. Decryption : The receiver receive the cipher text which has to be decrypt. The receiver also knows the values of m and n. So, first we need to find the , which is multiplicative inverse of n mod m i.e.,  
n x  mod(m) = 1

31 x mod(110) = 1

 = 71
Now, we have to multiply 71 with each block of cipher text take modulo m. 
121 x 71 mod(110) = 11 
Then, we will have to make the sum of 11 from the values of private key {1, 2, 4, 10, 20, 40} i.e., 1+10=11 so make that corresponding bits 1 and others 0 which is 100100. Similarly, 
197 x 71 mod(110) = 17
1+2+4+10=17 = 111100

And, 205 x 71 mod(110) = 35
1+4+10+20=35 = 101110 
After combining them we get the decoded text. 100100111100101110 which is our plain text.
rkbhola5
cryptography
Computer Networks
cryptography
Computer Networks
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
SQL | SELECT Query

09 Jan, 2019
Select is the most commonly used statement in SQL. The SELECT Statement in SQL is used to retrieve or fetch data from a database. We can fetch either the entire table or according to some specified rules. The data returned is stored in a result table. This result table is also called result-set.
With the SELECT clause of a SELECT command statement, we specify the columns that we want to be displayed in the query result and, optionally, which column headings we prefer to see above the result table.
The select clause is the first clause and is one of the last clauses of the select statement that the database server evaluates. The reason for this is that before we can determine what to include in the final result set, we need to know all of the possible columns that could be included in the final result set.
Sample Table:Basic Syntax:
SELECT column1,column2 FROM table_name 
column1 , column2: names of the fields of the table
table_name: from where we want to fetch
This query will return all the rows in the table with fields column1 , column2.
To fetch the entire table or all the fields in the table: SELECT * FROM table_name;
 SELECT * FROM table_name;
Query to fetch the fields ROLL_NO, NAME, AGE from the table Student:SELECT ROLL_NO, NAME, AGE FROM Student;Output:ROLL_NONAMEAge1Ram182RAMESH183SUJIT204SURESH18
SELECT ROLL_NO, NAME, AGE FROM Student;
Output:
To fetch all the fields from the table Student: SELECT * FROM Student;Output:ROLL_NONAMEADDRESSPHONEAge1RamDelhiXXXXXXXXXX182RAMESHGURGAONXXXXXXXXXX183SUJITROHTAKXXXXXXXXXX204SURESHDelhiXXXXXXXXXX18
 SELECT * FROM Student;
Output:
This article is contributed by Harsh Agarwal. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
SQL-Clauses-Operators
Articles
DBMS
SQL
DBMS
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Matplotlib.axes.Axes.set_label() in Python

30 Apr, 2020
Matplotlib is a library in Python and it is numerical – mathematical extension for NumPy library. The Axes Class contains most of the figure elements: Axis, Tick, Line2D, Text, Polygon, etc., and sets the coordinate system. And the instances of Axes supports callbacks through a callbacks attribute.
The Axes.set_label() function in axes module of matplotlib library is used to set the label that will be displayed in the legend.
Syntax: Axes.set_label(self, s)
Parameters: This method accepts only one parameters.
s: This parameter is converted to a string by calling str.
Returns: This method does not return any value.
Below examples illustrate the matplotlib.axes.Axes.set_label() function in matplotlib.axes:
Example 1:
# Implementation of matplotlib function  import matplotlib.pyplot as pltimport numpy as npfrom matplotlib.collections import EllipseCollection     x = np.arange(10)y = np.arange(15)X, Y = np.meshgrid(x, y)   XY = np.column_stack((X.ravel(), Y.ravel()))   fig, ax = plt.subplots()   ec = EllipseCollection(10, 10, 5, units ='y',                       offsets = XY * 0.5,                       transOffset = ax.transData,                       cmap ="inferno")  ec.set_array((X * Y + X * X).ravel())  ax.add_collection(ec)ax.autoscale_view()  ax.set_xlabel('X')ax.set_ylabel('y')  cbar = plt.colorbar(ec)cbar.set_label('X + Y')   fig.suptitle('matplotlib.axes.Axes.set_label() function \Example\n', fontweight ="bold")  fig.canvas.draw()  plt.show()
Output:
Example 2:
# Implementation of matplotlib functionimport matplotlib.pyplot as pltimport numpy as np     np.random.seed(19680801)   n = 100000x = np.random.standard_normal(n)y = 2 * np.random.standard_normal(n)z =[1, 2, 3, 4]  xmin = x.min()xmax = x.max()ymin = y.min()ymax = y.max()   fig, ax = plt.subplots()hb = ax.hexbin(x, y, gridsize = 50, bins ='log', cmap ='BuGn')ax.set(xlim =(xmin, xmax), ylim =(ymin, ymax))  cb = fig.colorbar(hb, ax = ax)cb.set_label('log')   fig.suptitle('matplotlib.axes.Axes.set_label() function\ Example\n', fontweight ="bold")  fig.canvas.draw()  plt.show()
Output:
Matplotlib axes-class
Python-matplotlib
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Max and Min date in Pandas GroupBy

24 Jan, 2021
Prerequisites: Pandas
Pandas GroupBy is very powerful function. This function is capable of splitting a dataset into various groups for analysis. 
Syntax:
dataframe.groupby([column names])
Along with groupby function we can use agg() function of pandas library. Agg() function aggregates the data that is being used for finding minimum value, maximum value, mean, sum in dataset.
Syntax:
dataframe.agg(dictionary with keys as column name)
Import module
Create or Load data
Use GroupBy function on column that you want
Then use agg() function on Date column.
Display result
Data frame in Use:
Program:
Python3
import pandas as pdimport numpy as np  # Creating Dataframedataset = {'Group': ['G-2', 'G-3', 'G-3', 'G-2', 'G-2',                      'G-2', 'G-3', 'G-1', 'G-1', 'G-2'],                        'Date': ['2019-11-04', '2020-05-17', '2020-12-12',                     '2019-10-15', '2019-01-31', '2019-02-13',                    '2020-12-25', '2018-06-01', '2018-07-15',                    '2019-09-14']}  dataset = pd.DataFrame(dataset, columns=['Group', 'Date'])  # using groupby() function on Group columndf = dataset.groupby(['Group'])  # using agg() function on Date columndf2 = df.agg(Minimum_Date=('Date', np.min), Maximum_Date=('Date', np.max))  # Displaying resultdisplay(df2)
Output:
Picked
Python pandas-groupby
Python-pandas
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Python Classes and Objects
Python OOPs Concepts
Introduction To PYTHON
Python | os.path.join() method
How to drop one or multiple columns in Pandas Dataframe
How To Convert Python Dictionary To JSON?
Check if element exists in list in Python
Python | Get unique values from a list
Python | datetime.timedelta() function
Concatenation of strings in PL/SQL

03 Jul, 2018
Prerequisite – PL/SQL Introduction
In PL/SQL code groups of commands are arranged within a block. A block group related declarations or statements. In declare part, we declare variables and between begin and end part, we perform the operations.
Given two strings and the task is to concatenate them and store it in another string.
Examples:
Input: str1 = ' RAMESH', str2 = 'SURESH'
Output: RAMESH SURESH

Input: str1 = ' Ramesh is a good boy', str3 = 'and',
       str2 = 'Suresh is a brilliant student'.
Output: Ramesh is a good boy and Suresh is a brilliant student

Approach is to use the concatenation operator i.e. || .
Below is the required implementation:
DECLARE    --Here variables are str, str1, str2 and v    str  VARCHAR2(40) := 'Ramesh is a good boy';    str1 VARCHAR2(40) := 'Suresh is a brilliant student';    str2 VARCHAR2(40) := 'and';    v    VARCHAR2(100);BEGIN    v := str         ||' '         || str2         ||' '         ||str1;      dbms_output.Put_line(v);END;-- Program End  
Output:
Ramesh is a good boy and Suresh is a brilliant student

SQL-PL/SQL
SQL
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Pandas – Find the maximum value of a column and return its corresponding row values

To find the maximum value of a column and to return its corresponding row values in Pandas, we can use df.loc[df[col].idxmax()]. Let's take an example to understand it better.
Create a two-dimensional, size-mutable, potentially heterogeneous tabular data, df.
Print the input DataFrame, df.
Initialize a variable, col, to find the maximum value of that column.
Find the maximum value and its corresponding row, using df.loc[df[col].idxmax()]
Print the Step 4 output.
import pandas as pd

df = pd.DataFrame(
   {
      "x": [5, 2, 7, 0],
      "y": [4, 7, 5, 1],
      "z": [9, 3, 5, 1]
   }
)
print "Input DataFrame is:\n", df

col = "x"
max_x = df.loc[df[col].idxmax()]
print "Maximum value of column ", col, " and its corresponding row values:\n", max_x

col = "y"
max_x = df.loc[df[col].idxmax()]
print "Maximum value of column ", col, " and its corresponding row values:\n", max_x

col = "z"
max_x = df.loc[df[col].idxmax()]
print "Maximum value of column ", col, " and its corresponding row values:\n", max_x
Input DataFrame is:
  x y z
0 5 4 9
1 2 7 3
2 7 5 5
3 0 1 1

Maximum value of column x and its corresponding row values:
x  7
y  5
z  5
Name: 2, dtype: int64

Maximum value of column y and its corresponding row values:
x  2
y  7
z  3
Name: 1, dtype: int64

Maximum value of column z and its corresponding row values:
x  5
y  4
z  9
Name: 0, dtype: int64
How to get a part of string after a specified character in JavaScript?

To get a part of a string, string.substring() method is used in javascript. Using this method we can get any part of a string that is before or after a particular character.
This method slices a string from a given start index(including) to end index(excluding). If only one index is provided then the method slice the entire string from the start of the index. 
Using this line of code we can get a part of a string after a particular character.
string.substring(string.indexOf(character) + 1);
Using this line of code we can get a part of a string before a particular character.
string.substring(0, string.indexOf(character));
Live Demo
<html>
<body>
<script>
   function subStr(string, character, position) {
      if(position=='b')
      return string.substring(string.indexOf(character) + 1);
      else if(position=='a')
      return string.substring(0, string.indexOf(character));
      else
      return string;
   }
   document.write(subStr('Tutorix & Tutorialspoint','&','a'));
   document.write("</br>");
   document.write(subStr('Tutorix:a best e-learning platform', ':','b'));
</script>
</body>
</html>
Tutorix
a best e-learning platform
D3.js | d3.range() function - GeeksforGeeks

09 Feb, 2021
The d3.range() function in D3.js is used to return an array containing an arithmetic progression starting from the start parameter and iterated over a sequence of uniformly-spaced numeric value called a step and ends with a stop parameter.Syntax:  
d3.range(start, stop, step)
Parameters: This function accepts three parameter which are illustrated below:-  
start: It is the inclusive integer value which is the first element of the output array. Its default value is 0.
stop: It is the exclusive integer value which are not added into the output array.
step: It is the integer value which regularly gets added with the start value and prints the result till stop value arrives.
Return Value: It returns an array containing an arithmetic progression.Below programs illustrate the d3.range() function in D3.js.Example 1:  
javascript
<body>    <script src='https://d3js.org/d3.v4.min.js'></script>     <script>             // Calling to d3.range() function        // with parameters start, stop and steps.        A = d3.range(0, 4, 1);        B = d3.range(10, 100, 10);        C = d3.range(5, 50, 5);        D = d3.range(1, 10, 2);                 // Getting an array of arithmetic progression        document.write(A + "<br>");        document.write(B + "<br>");        document.write(C + "<br>");        document.write(D + "<br>");    </script></body>
Output:  
[0,1,2,3]
[10,20,30,40,50,60,70,80,90]
[5,10,15,20,25,30,35,40,45]
[1,3,5,7,9]
Example 2:  
javascript
<body>    <script src='https://d3js.org/d3.v4.min.js'></script>     <script>             // Calling to d3.range() function        // with parameters start, stop and steps.        A = d3.range(1, 2);        B = d3.range(10, 20);        C = d3.range(0, 10, 0.5);        D = d3.range(1, 10, 0.9);                 // Getting an array of arithmetic progression        document.write(A + "<br>");        document.write(B + "<br>");        document.write(C + "<br>");        document.write(D + "<br>");    </script></body>
Output:  
1
[10,11,12,13,14,15,16,17,18,19]
[0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7,7.5,8,8.5,9,9.5]
[1,1.9,2.8,3.7,4.6,5.5,6.4,7.3,8.2,9.1]
Note:In the above code, some range() functions did not take step value so its default value is considered as 1.Reference: https://devdocs.io/d3~5/d3-array#range 
arorakashish0911
D3.js
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Top 10 Front End Developer Skills That You Need in 2022
How to fetch data from an API in ReactJS ?
Difference between var, let and const keywords in JavaScript
Convert a string to an integer in JavaScript
Differences between Functional Components and Class Components in React
How to set the default value for an HTML <select> element ?
How to create footer to stay at the bottom of a Web page?
Node.js fs.readFileSync() Method
How to set input type date in dd-mm-yyyy format using HTML ?
File uploading in React.js
Online SQL Formatter

Editable SQL Code
1234SELECT count(*),`Column1`,`Testing`, `Testing Three` FROM `Table1`WHERE Column1 = 'testing' AND ( (`Column2` = `Column3` OR Column4 >= NOW()) )GROUP BY Column1 ORDER BY Column3 DESC LIMIT 5,10X
Privacy Policy
Cookies Policy
Terms of Use
How to add a text into a Rectangle in Matplotlib?

To add a text into a rectangle in matplotlib, we can add a label in annotate method at the center point of the rectangle.
Create a figure or activate an existing figure using figure() method.
Create a figure or activate an existing figure using figure() method.
Add a subplot arrangement in the current axis.
Add a subplot arrangement in the current axis.
To add a rectangle in the plot, use Rectangle() class to get the rectangle object.
To add a rectangle in the plot, use Rectangle() class to get the rectangle object.
Add a rectangle patch on the plot.
Add a rectangle patch on the plot.
To add text label in the rectangle, we can get the center value of the rectangle, i.e., cx and cy.
To add text label in the rectangle, we can get the center value of the rectangle, i.e., cx and cy.
Use annotate() method to place text on the rectangle.
Use annotate() method to place text on the rectangle.
Limit x and y axes to get a visible rectangle.
Limit x and y axes to get a visible rectangle.
To display the figure, use show() method.
To display the figure, use show() method.
from matplotlib import pyplot as plt, patches
plt.rcParams["figure.figsize"] = [7.00, 3.50]
plt.rcParams["figure.autolayout"] = True
fig = plt.figure()
ax = fig.add_subplot(111)
rectangle = patches.Rectangle((0, 0), 3, 3, edgecolor='orange',
facecolor="green", linewidth=7)
ax.add_patch(rectangle)
rx, ry = rectangle.get_xy()
cx = rx + rectangle.get_width()/2.0
cy = ry + rectangle.get_height()/2.0
ax.annotate("Rectangle", (cx, cy), color='black', weight='bold', fontsize=10, ha='center', va='center')
plt.xlim([-5, 5])
plt.ylim([-5, 5])
plt.show()
How to print out the first character of each list in Python?

Assuming that the list is collection of strings, the first character of each string is obtained as follows −
>>> L1=['aaa','bbb','ccc']
>>> for string in L1:
print (string[0])

a
b
c
If list is a collection of list objects. First element of each list is obtained as follows −
>>> L1=[[1,2,3],[4,5,6],[7,8,9]]
>>> for list in L1:
print (list[0])

1
4
7
Where can I set environment variables that crontab will use?

In normal cases we make use of the bash_profile or bashrc in case of Ubuntu and zshrc in case of Mac OS, to set our environment variables and then those variables are made available to us everywhere on the terminal we want.
Let’s consider a simple example where we have some environment variable in bash_profile and we are making use of it in the terminal.
Consider the bash_profile output shown below −
immukul@192 dir1 % cat ~/.bash_profile
export JAVA_HOME=$(/usr/libexec/java_home)
export PATH=$PATH:/usr/local/node/bin
export GOROOT=/usr/local/go
export GOPATH=/Users/immukul/go_projects
As we can see there are many variables present in the bash_profile file, we can use these variables in any terminal by just calling out their name.
Consider the example shown below −
echo $GOROOT
/usr/local/go
Now what we want is to be able to access these variables that we have inside the bash_profile or bashrc to be available inside the crontab.
Let’s first explore and understand what a crontab is.
A crontab is nothing but a list of commands that we can run during a cron job. A cron job is a utility that schedules automatic execution of commands at specific times.
We can start a cron job with the help of bash script by following the commands shown below −
crontab -e
This will open a file which you can edit, insert the cron job shell script in the above file and then close that file.
Just insert the code shown below in the above file.
* * * * * sample.sh
The above command contains 5 *, where each * indicates the time and then follows the stars. We have the script which we want to run as a cron job. In the sample.sh we need to write the following command to make the environment variables available to it.
Consider the example shown below (sample.sh) −
#!/bin/bash -l

echo $PATH
for f in *.txt; do mv "$f" "${f// /_}"; done
The command #!/bin/bash -l will allow your cron shell script to pick any environment variable you want.
sh-3.2# ./sample.sh
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/Library/Apple/usr/bin
wxPython - GUI Builder Tools

Creating a good looking GUI by manual coding can be tedious. A visual GUI designer tool is always handy. Many GUI development IDEs targeted at wxPython are available. Following are some of them −
wxFormBuilder
wxDesigner
wxGlade
BoaConstructor
gui2py
wxFormBuilder is an open source, cross-platform WYSIWYG GUI builder that can translate the wxWidget GUI design into C++, Python, PHP or XML format. A brief introduction to usage of wxFormBuilder is given here.
First of all the latest version of wxFormBuilder needs to be downloaded and installed from  http://sourceforge.net/projects/wxformbuilder/. On opening the application, a new project with blank grey area at the center appears.
Give a suitable name to the project and choose Python as code generation language. This is done in the Object properties window as shown in the following image −
Then from ‘Forms’ tab of components palette, choose Frame.
Add a vertical wxBoxSizer from ‘Layouts’ tab.
Add necessary controls in the Box with suitable captions. Here, a StaticText (label), two TextCtrl objects (text boxes) and a wxButton object are added. The frame looks like the following image −
Enable Expand and Stretch on these three controls. In the object properties for wxButton object, assign a function findsquare() to OnButtonClick event.
Save the project and press F8 to generate Python code for developed GUI. Let the generated file be named as Demo.py
In the executable Python script, import demo.py and define FindSquare() function. Declare Application object and start a main event loop. Following is the executable code −
import wx 
  
#import the newly created GUI file 
import demo  
class CalcFrame(demo.MyFrame1): 
   def __init__(self,parent): 
      demo.MyFrame1.__init__(self,parent)  
		
   def FindSquare(self,event): 
      num = int(self.m_textCtrl1.GetValue()) 
      self.m_textCtrl2.SetValue (str(num*num)) 
        
app = wx.App(False) 
frame = CalcFrame(None) 
frame.Show(True) 
#start the applications 
app.MainLoop() 
The above code produces the following output −
 Print
 Add Notes
 Bookmark this page
How to map two lists into a dictionary in Python?

Easiest way is to create a zip object that returns a generator of tuples, each having an item each from two lists. The zip object can then be transformed into a dictionary by using built-in dict() function
>>> l1=['name', 'age', 'marks']
>>> l2=['Ravi', 23, 56]
>>> z=zip(l1,l2)
>>> newdict=dict(z)
>>> newdict
{'name': 'Ravi', 'age': 23, 'marks': 56}
GATE | GATE-CS-2015 (Set 3) | Question 65 - GeeksforGeeks

17 Oct, 2018
Let f(n) = n and g(n) = n(1+sin n), where n is a positive integer. Which of the following statements is/are correct?
I.  f(n) = O(g(n))
II. f(n) = Ω(g(n))  
(A) Only I(B) Only II(C) Both I and II(D) Neither I nor IIAnswer: (D)Explanation: The value of sine function varies from -1 to 1.For sin = -1 or any other negative value, I becomes false.For sin = 1 or any other positive value, II becomes false.Quiz of this Question
shaztri
GATE-CS-2015 (Set 3)
GATE-GATE-CS-2015 (Set 3)
GATE
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
GATE | GATE-IT-2004 | Question 71
GATE | GATE CS 2011 | Question 7
GATE | GATE-CS-2015 (Set 3) | Question 65
GATE | GATE-CS-2014-(Set-3) | Question 38
GATE | GATE CS 2018 | Question 37
GATE | GATE-CS-2016 (Set 1) | Question 65
GATE | GATE-IT-2004 | Question 83
GATE | GATE-CS-2016 (Set 1) | Question 63
GATE | GATE-CS-2014-(Set-2) | Question 65
GATE | GATE-CS-2007 | Question 64