code-rag-bench/online-tutorials huggingface dataset:
QUOTE () function in MySQL - GeeksforGeeks

09 Dec, 2020
QUOTE() :This function in MySQL is used to return a result that can be used as a properly escaped data value in an SQL statement. The string is returned enclosed by single quotation marks and with each instance of backslash (\), single quote (‘), ASCII NULL, and Control+Z preceded by a backslash. If the argument is NULL, the return value is the word “NULL” without enclosing single quotation marks.
Syntax :
QUOTE(string)
Parameters :This method accepts one parameter.
string – The Input String.
Returns :It returns a string with properly escaped data value in an SQL statement.
Example-1 :Escaping single quotes in the string ‘geeks”for”geeks’ with the help of QUOTE Function.
SELECT QUOTE('geeks''for''geeks' ) 
AS Escaped_String;
Output :
Example-2 :Escaping backslash in the string ‘geeks\for’\geeks’ with the help of QUOTE Function.
SELECT QUOTE('geeks\for\geeks' ) 
AS Escaped_String;
Output :
Example-3 :QUOTE Function can also be used in column data. To demonstrate create a table named Student.
CREATE TABLE Student
(
Student_id INT AUTO_INCREMENT,  
Student_name VARCHAR(100) NOT NULL,
Roll INT NOT NULL,
Department VARCHAR(10) NOT NULL,
PRIMARY KEY(Student_id )
);
Inserting some data to the Student table :
INSERT INTO Student
(Student_name, Roll, Department )
VALUES
('Anik Biswas ', 10100, 'CSE'),
('Bina Mallick', 11000, 'ECE' ),
('Aniket Sharma', 12000, 'IT' ),
('Sayani Samanta', 13000, 'ME'  ),
('Riyanka Shah ', 14000, 'EE' ) ;
So, the Student Table is as follows.
SELECT  * from Student ;

Output :
Now, we are going to use QUOTE Function on Department column.
SELECT *, QUOTE (Department) FROM Student;
Output :
DBMS-SQL
mysql
SQL
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Update Multiple Columns in Single Update Statement in SQL?
SQL | Subquery
How to Create a Table With Multiple Foreign Keys in SQL?
What is Temporary Table in SQL?
SQL Query to Find the Name of a Person Whose Name Starts with Specific Letter
SQL Query to Convert VARCHAR to INT
SQL using Python
How to Write a SQL Query For a Specific Date Range and Date Time?
How to Select Data Between Two Dates and Times in SQL Server?
SQL Query to Compare Two Dates
Wand local_contrast() function - Python - GeeksforGeeks

07 Jul, 2021
The local_contrast() function is an inbuilt function in the Python Wand ImageMagick library which is used to increase light-dark transitions within the image. 
Syntax:  
local_contrast(radius, strength)
Parameters: This function accepts two parameters as mentioned above and defined below:  
radius: This parameter is used to store the size of the Gaussian operator. Default value is 10.0
strength: This parameter is used to store the percentage of blur mask to apply. Default value is 12.5 and it can range from 0 to 100.
Return Value: This function returns the Wand ImageMagick object.
Original Image:  
Example 1:  
Python3
# Import library from Imagefrom wand.image import Image # Import the imagewith Image(filename ='../geeksforgeeks.png') as image:    # Clone the image in order to process    with image.clone() as local_contrast:        # Invoke local_contrast function with radius 12 and sigma 3        local_contrast.local_contrast(12, 3)        # Save the image        local_contrast.save(filename ='local_contrast1.jpg')
Output:  
Example 2:  
Python3
# Import libraries from the wand from wand.image import Imagefrom wand.drawing import Drawingfrom wand.color import Color with Drawing() as draw:    # Set Stroke color the circle to black    draw.stroke_color = Color('black')    # Set Width of the circle to 2    draw.stroke_width = 1    # Set the fill color to 'White (# FFFFFF)'    draw.fill_color = Color('white')     # Invoke Circle function with center at 50, 50 and radius 25    draw.circle((200, 200), # Center point                (100, 100)) # Perimeter point    # Set the font style    draw.font = '../Helvetica.ttf'    # Set the font size    draw.font_size = 30         with Image(width = 400, height = 400, background = Color('# 45ff33')) as pic:        # Set the text and its location        draw.text(int(pic.width / 3), int(pic.height / 2), 'GeeksForGeeks !')        # Draw the picture        draw(pic)        # Invoke local_contrast function with radius 15 and sigma 78        pic.local_contrast(15, 78)        # Save the image        pic.save(filename ='local_contrast2.jpg')
Output:  
 
sagartomar9927
Image-Processing
Python-wand
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
How to drop one or multiple columns in Pandas Dataframe
Python Classes and Objects
Python | os.path.join() method
Python | Get unique values from a list
Create a directory in Python
Defaultdict in Python
Python | Pandas dataframe.groupby()
Python Pillow - Blur an Image - GeeksforGeeks

28 Apr, 2022
Blurring an image is a process of reducing the level of noise in the image, and it is one of the important aspects of image processing. In this article, we will learn to blur an image using a pillow library. To blur an image we make use of some methods of ImageFilter class of this library on image objects.
Note: The image used to blur in all different methods is given below:
1. PIL.ImageFilter.BoxBlur(): Blurs the image by setting each pixel to the average value of the pixels in a square box extending radius pixels in each direction. Supports float radius of arbitrary size. Uses an optimized implementation that runs in linear time relative to the size of the image for any radius value.
Syntax: PIL.ImageFilter.BoxBlur(radius)
Parameters:  
radius: Size of the box in one direction. Radius 0 does not blur, returns an identical image. Radius 1 takes 1 pixel in each direction, i.e. 9 pixels in total.
Python3
# Importing Image class from PIL modulefrom PIL import Image # Opens a image in RGB modeim = Image.open(r"geek.jpg") # Blurring the imageim1 = im.filter(ImageFilter.BoxBlur(4)) # Shows the image in image viewerim1.show()
Output :  
 2. PIL.ImageFilter.GaussianBlur(): This method creates a Gaussian blur filter. The filter uses radius as a parameter and by changing the value of this radius, the intensity of the blur over the image gets changed. The parameter radius in the function is responsible for the blur intensity. By changing the value of the radius, the intensity of GaussianBlur is changed.
Syntax: PIL.ImageFilter.GaussianBlur(radius=5)
Parameters:
radius – blur radius. Changing value of radius the different intensity of GaussianBlur image were obtain.
Returns type: An image.
Python3
# Importing Image class from PIL modulefrom PIL import Image # Opens a image in RGB modeim = Image.open(r"geek.jpg") # Blurring the imageim1 = im.filter(ImageFilter.GaussianBlur(4)) # Shows the image in image viewerim1.show()
Output : 
3. Simple blur: It applies a blurring effect to the image as specified through a specific kernel or a convolution matrix. It does not require any parameters.
Syntax: filter(ImageFilter.BLUR)
Python3
# Importing Image class from PIL modulefrom PIL import Image # Opens a image in RGB modeim = Image.open(r"geek.jpg") # Blurring the imageim1 = im.filter(ImageFilter.BLUR) # Shows the image in image viewerim1.show()
Output :
simranarora5sos
kalrap615
simmytarika5
Picked
Python-pil
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
How to drop one or multiple columns in Pandas Dataframe
Python Classes and Objects
Python | Get unique values from a list
Python | os.path.join() method
Create a directory in Python
Defaultdict in Python
Python | Pandas dataframe.groupby()
Pattern compile(String) method in Java with Examples - GeeksforGeeks

31 Aug, 2021
The compile(String) method of the Pattern class in Java is used to create a pattern from the regular expression passed as parameter to method. Whenever you need to match a text against a regular expression pattern more than one time, create a Pattern instance using the Pattern.compile() method.Syntax: 
public static Pattern compile(String regex)
Parameters: This method accepts one single parameter regex which represents the given regular expression compiled into a pattern.Return Value: This method returns the pattern compiled from the regex passed to the method as a parameter.Exception: This method throws following exception:  
PatternSyntaxException: This exception is thrown if the expression’s syntax is invalid.
Below programs illustrate the compile(String) method: Program 1:  
Java
// Java program to demonstrate// Pattern.compile() method import java.util.regex.*; public class GFG {    public static void main(String[] args)    {        // create a REGEX String        String REGEX = ".*www.*";         // creare the string        // in which you want to search        String actualString            = "www.geeksforgeeks.org";         // compile the regex to create pattern        // using compile() method        Pattern pattern = Pattern.compile(REGEX);         // get a matcher object from pattern        Matcher matcher = pattern.matcher(actualString);         // check whether Regex string is        // found in actualString or not        boolean matches = matcher.matches();         System.out.println("actualString "                           + "contains REGEX = "                           + matches);    }}
actualString contains REGEX = true
 
Program 2: 
Java
// Java program to demonstrate// Pattern.compile method import java.util.regex.*; public class GFG {    public static void main(String[] args)    {        // create a REGEX String        String REGEX = "brave";         // creare the string        // in which you want to search        String actualString            = "Cat is cute";         // compile the regex to create pattern        // using compile() method        Pattern pattern = Pattern.compile(REGEX);         // check whether Regex string is        // found in actualString or not        boolean matches = pattern                              .matcher(actualString)                              .matches();         System.out.println("actualString "                           + "contains REGEX = "                           + matches);    }}
actualString contains REGEX = false
 
Reference: https://docs.oracle.com/javase/10/docs/api/java/util/regex/Pattern.html#compile(java.lang.String)
badjatiyaanimesh
singghakshay
Java 8
Java-Functions
Java-Pattern
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Interfaces in Java
Stream In Java
ArrayList in Java
Initialize an ArrayList in Java
Stack Class in Java
Multidimensional Arrays in Java
Singleton Class in Java
Set in Java
Collections in Java
Queue Interface In Java
Make an area plot in Python using Bokeh - GeeksforGeeks

22 Jun, 2020
Bokeh is a Python interactive data visualization. Unlike Matplotlib and Seaborn, Bokeh renders its plots using HTML and JavaScript. It targets modern web browsers for presentation providing elegant, concise construction of novel graphics with high-performance interactivity.
Area plots are defined as the filled regions between two series that share a common areas. Bokeh Figure class has two methods which are given below:
varea()
harea()
1. varea() method:  varea() method is a vertical directed area which has one x coordinate array and two y coordinate arrays, y1 and y2, that will be filled between.
Syntax: varea(x, y1, y2, **kwargs)
Parameter:This method accept the following parameters that are described below:
x: This parameter is the x-coordinates for the points of the area.
y1: This parameter is the y-coordinates for the points of one side of the area.
y2: This parameter is the y-coordinates for the points of other side of the area.
Example:
Python3
# Implementation of bokeh function    import numpy as np from bokeh.plotting import figure, output_file, show    x = [1, 2, 3, 4, 5]y1 = [2, 4, 5, 2, 4]y2 = [1, 2, 2, 3, 6]   output_file("geeksforgeeks.html")   p = figure(plot_width=300, plot_height=300)   # area plotp.varea(x=x, y1=y1, y2=y2,fill_color="green")   show(p)
Output:
2. harea() method:  harea() method is a horizontal directed area which has one x coordinate array and two y coordinate arrays, y1 and y2, that will be filled between.
Syntax: harea(x1, x2, y, **kwargs)
Parameter:This method accept the following parameters that are described below:
x1: This parameter is the x-coordinates for the points of one side of the area.
x2: This parameter is the x-coordinates for the points of other side of the area.
y: This parameter is the y-coordinates for the points of the area.
Example:
Python3
# Implementation of bokeh function    import numpy as np from bokeh.plotting import figure, output_file, show    y = [1, 2, 3, 4, 5]x1 = [2, 4, 5, 2, 4]x2 = [1, 2, 2, 3, 6]   output_file("geeksforgeeks.html")   p = figure(plot_width=300, plot_height=300)   # area plotp.harea(x1=x1, x2=x2, y=y,fill_color="green")   show(p)
Output:
Python-Bokeh
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
How to get column names in Pandas dataframe
Python Dictionary
Taking input in Python
Read a file line by line in Python
How to Install PIP on Windows ?
Enumerate() in Python
Different ways to create Pandas Dataframe
What is a use of DSNTIAR? How will you implement it in a COBOLDB2 program?

We use fields of SQLCA to enquire about the status of the most recently executed SQL query. The SQLCODE is one such field which can take the various values and each value indicates specific error code. For example, -180 error code represents incorrect timestamp format. However, in the logs we only get the error code and every time we have to refer to the IBM documentation to check the description of the error code.
To overcome this problem, we use DSNTIAR. The DSNTIAR is an inbuilt utility which is provided by IBM to be used in a COBOL-DB2 program.This utility displays the error code
and its description in the logs in a well formatted manner, which saves time. The DSNTIAR utility can be called using SQLCA as below.
CALL ‘DSNTIAR’ USING SQLCA,
ERROR-MESSAGE
The DSNTIAR utility populates the error description in the ERROR-MESSAGE variable.
Python - Index Frequency Alphabet List - GeeksforGeeks

11 Sep, 2021
Create a String list with each character repeated as much as its position number.
Method #1 : Using ascii_lowercase + ord() + loop
In this, task of getting index is done using ord(), and ascii lowercase() is used for extracting alphabets. Loop is used to perform task for each letter.
Python3
# Python3 code to demonstrate working of# Index Frequency Alphabet List# Using ascii_lowercase + ord() + loopfrom string import ascii_lowercase # extracting start indexstrt_idx = ord('a') - 1 res = []for ele in ascii_lowercase:         # multiplying Frequency    res.append(ele * (ord(ele) - strt_idx)) # printing resultprint("The constructed list : " + str(res))
The constructed list : ['a', 'bb', 'ccc', 'dddd', 'eeeee', 'ffffff', 'ggggggg', 'hhhhhhhh', 'iiiiiiiii', 'jjjjjjjjjj', 'kkkkkkkkkkk', 'llllllllllll', 'mmmmmmmmmmmmm', 'nnnnnnnnnnnnnn', 'ooooooooooooooo', 'pppppppppppppppp', 'qqqqqqqqqqqqqqqqq', 'rrrrrrrrrrrrrrrrrr', 'sssssssssssssssssss', 'tttttttttttttttttttt', 'uuuuuuuuuuuuuuuuuuuuu', 'vvvvvvvvvvvvvvvvvvvvvv', 'wwwwwwwwwwwwwwwwwwwwwww', 'xxxxxxxxxxxxxxxxxxxxxxxx', 'yyyyyyyyyyyyyyyyyyyyyyyyy', 'zzzzzzzzzzzzzzzzzzzzzzzzzz']
Method #2 : Using list comprehension + ascii_lowercase + ord()
In this, list comprehension is used to solve this problem. This is shorthand of above method.
Python3
# Python3 code to demonstrate working of# Index Frequency Alphabet List# Using list comprehension + ascii_lowercase + ord()from string import ascii_lowercase # extracting start indexstrt_idx = ord('a') - 1 # list comprehension to solve as one linerres = [ele * (ord(ele) - strt_idx) for ele in ascii_lowercase] # printing resultprint("The constructed list : " + str(res))
The constructed list : ['a', 'bb', 'ccc', 'dddd', 'eeeee', 'ffffff', 'ggggggg', 'hhhhhhhh', 'iiiiiiiii', 'jjjjjjjjjj', 'kkkkkkkkkkk', 'llllllllllll', 'mmmmmmmmmmmmm', 'nnnnnnnnnnnnnn', 'ooooooooooooooo', 'pppppppppppppppp', 'qqqqqqqqqqqqqqqqq', 'rrrrrrrrrrrrrrrrrr', 'sssssssssssssssssss', 'tttttttttttttttttttt', 'uuuuuuuuuuuuuuuuuuuuu', 'vvvvvvvvvvvvvvvvvvvvvv', 'wwwwwwwwwwwwwwwwwwwwwww', 'xxxxxxxxxxxxxxxxxxxxxxxx', 'yyyyyyyyyyyyyyyyyyyyyyyyy', 'zzzzzzzzzzzzzzzzzzzzzzzzzz']
akshaysingh98088
Python string-programs
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Python Dictionary
Enumerate() in Python
Read a file line by line in Python
Defaultdict in Python
Different ways to create Pandas Dataframe
Defaultdict in Python
Python | Get dictionary keys as a list
Python | Split string into list of characters
Python | Convert a list to dictionary
How to print without newline in Python?
Python | Numpy matrix.astype() - GeeksforGeeks

10 Apr, 2019
With the help of Numpy matrix.astype() method, we are able to convert the type of matrix but the problem is data loss if we want to convert float to int then some of the data will loss. This method helps in type conversion of a matrix.
Syntax : matrix.astype()
Return : Return the matrix after type conversion.
Example #1 :In this example we can see that how we convert the floating type matrix to int type matrix using matrix.astype() method.
# import the important module in pythonimport numpy as np            # make a matrix with numpygfg = np.matrix('[1.2, 2.8, 3.1, 4.5]')            # applying matrix.astype() methodgeeks = gfg.astype(int)      print(geeks)
[[1 2 3 4]]

Example #2 :
# import the important module in pythonimport numpy as np            # make a matrix with numpygfg = np.matrix('[1.1, 2, 3.5; 4.2, 5.5, 6; 7, 8, 9.3]')            # applying matrix.astype() methodgeeks = gfg.astype(int)      print(geeks)
[[1 2 3]
 [4 5 6]
 [7 8 9]]

Python numpy-Matrix Function
Python-numpy
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
How To Convert Python Dictionary To JSON?
Check if element exists in list in Python
How to drop one or multiple columns in Pandas Dataframe
Python Classes and Objects
Python | os.path.join() method
Create a directory in Python
Defaultdict in Python
Python | Pandas dataframe.groupby()
Python | Get unique values from a list
How MySQL LEFT JOIN can be used to simulate the MySQL MINUS query?

Since we cannot use MINUS query in MySQL, we will use LEFT JOIN to simulate the MINUS query. It can be understood with the help of the following example:
In this example, we are two tables namely Student_detail and Student_info having the following data −
mysql> Select * from Student_detail;
+-----------+---------+------------+------------+
| studentid | Name    | Address    | Subject    |
+-----------+---------+------------+------------+
| 101       | YashPal | Amritsar   | History    |
| 105       | Gaurav  | Chandigarh | Literature |
| 130       | Ram     | Jhansi     | Computers  |
| 132       | Shyam   | Chandigarh | Economics  |
| 133       | Mohan   | Delhi      | Computers  |
| 150       | Rajesh  | Jaipur     | Yoga       |
| 160       | Pradeep | Kochi      | Hindi      |
+-----------+---------+------------+------------+
7 rows in set (0.00 sec)

mysql> Select * from Student_info;
+-----------+-----------+------------+-------------+
| studentid | Name      | Address    | Subject     |
+-----------+-----------+------------+-------------+
| 101       | YashPal   | Amritsar   | History     |
| 105       | Gaurav    | Chandigarh | Literature  |
| 130       | Ram       | Jhansi     | Computers   |
| 132       | Shyam     | Chandigarh | Economics   |
| 133       | Mohan     | Delhi      | Computers   |
| 165       | Abhimanyu | Calcutta   | Electronics |
+-----------+-----------+------------+-------------+
6 rows in set (0.00 sec)
Now, the following query using LEFT JOIN will simulate MINUS to return the ‘studentid’ values in student_info but not in Student_detail table.
mysql> SELECT studentid from student_info LEFT JOIN Student_detail USING(studentid) WHERE student_detail.studentid IS NULL;
+-----------+
| studentid |
+-----------+
|       165 |
+-----------+
1 row in set (0.07 sec)
Now, the following query will give us the opposite result of above query i.e. it will return the ‘studentid’ values in student_detail but not in Student_info table.
mysql> SELECT studentid from student_detail LEFT JOIN Student_info USING(studentid) WHERE student_info.studentid IS NULL;
+-----------+
| studentid |
+-----------+
|       150 |
|      160  |
+-----------+
2 rows in set (0.00 sec)
JavaScript - Date getMinutes() Method

Javascript date getMinutes() method returns the minutes in the specified date according to local time. The value returned by getMinutes() is an integer between 0 and 59.
Its syntax is as follows −
Date.getMinutes()

Returns the minutes in the specified date according to local time.
Try the following example.
<html>
   <head>
      <title>JavaScript getMinutes Method</title>
   </head>
   
   <body>   
      <script type = "text/javascript">
         var dt = new Date( "December 25, 1995 23:15:00" );
         document.write("getMinutes() : " + dt.getMinutes() ); 
      </script>      
   </body>
</html>
getMinutes() : 15 


    25 Lectures 
     2.5 hours 

 Anadi Sharma

    74 Lectures 
     10 hours 

 Lets Kode It

    72 Lectures 
     4.5 hours 

 Frahaan Hussain

    70 Lectures 
     4.5 hours 

 Frahaan Hussain

    46 Lectures 
     6 hours 

 Eduonix Learning Solutions

    88 Lectures 
     14 hours 

 Eduonix Learning Solutions
 Print
 Add Notes
 Bookmark this page
How to import other Python files?

To use any package in your code, you must first make it accessible. You have to import it. You can't use anything in Python before it is defined. Some things are built in, for example the basic types (like int, float, etc) can be used whenever you want. But most things you will want to do will need a little more than that. For example, if you want to calculate cosine of 1 radian, if you run math.cos(0), you'll get a NameError as math is not defined.
You need to tell python to first import that module in your code so that you can use it.
>>> math.cos(0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'math' is not defined
>>> import math
>>> math.cos(0)
1.0
If you have your own python files you want to import, you can use the import statement as follows:
>>> import my_file # assuming you have the file, my_file.py in the current directory.
                   # For files in other directories, provide path to that file, absolute or relative.
How to change password of superuser in Django? - GeeksforGeeks

04 Jan, 2021
Django provides us Admin Panel for it’s users to look over the database and other activities. If you dont know how to create superuser then you can refer to How to create superuser in Django?
How to change password of superuser in Django?
For changing password of superuser, first reach the same directory as that of manage.py and run the following command:
python manage.py changepassword user_name
Changing password for user ‘user_name’
Enter the Password in-front of the Password field and press enter. Enter a strong password so as to keep it secure.
Password: ******
Then again enter the same Password for confirmation.
Password (again): ******
This password is too short. It must contain at least 8 characters.
Enter the Password again in-front of the Password field and press enter. Enter a strong password and at least of 8 characters so as to keep it secure.
Password: ********
Password (again): ********
Password changed successfully for user ‘user_name’.
Python Django
Technical Scripter 2020
Python
Technical Scripter
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
How to drop one or multiple columns in Pandas Dataframe
Python Classes and Objects
Python | os.path.join() method
Python | Pandas dataframe.groupby()
Create a directory in Python
Defaultdict in Python
Python | Get unique values from a list
jQuery UI Buttonset enable() Method - GeeksforGeeks

07 Jan, 2022
jQuery UI consists of GUI widgets, visual effects, and themes implemented using HTML, CSS, and jQuery. jQuery UI is great for building UI interfaces for the webpages. The jQuery UI buttonset widget is used to give a visual grouping for a group of related buttons.
The jQuery UI buttonset enable() method is used for enabling the buttonset widget.
Syntax:
$( ".selector" ).buttonset( "enable" );
Parameters: This method does not accept any parameter.
Return values: This method does not return any values.
CDN Link: First, add jQuery UI scripts needed for your project.
<link rel=”stylesheet” href=”//code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css”><script src=”//code.jquery.com/jquery-1.12.4.js”></script><script src=”//code.jquery.com/ui/1.12.1/jquery-ui.js”></script>
Example: This example demonstrates the jQuery UI buttonset enable() Method.
HTML
<!doctype html><html lang="en">  <head>    <meta charset="utf-8">    <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css">    <script src="//code.jquery.com/jquery-1.12.4.js">    </script>    <script src="//code.jquery.com/ui/1.12.1/jquery-ui.js">    </script></head>  <body>    <center>        <h1 style="color:green;">            GeeksforGeeks        </h1>        <h3>jQuery UI Buttonset enable() method</h3>        <form>            <fieldset>                <legend>Button_Set</legend>                <div id="ButtonSet_Radio">                    <input id="Company" type="radio"                            checked="checked">                    <label for="Company">GeeksforGeeks</label>                    <input id="Department" type="radio">                    <label for="Department">Computer Science</label>                </div>            </fieldset>        </form>        <input type="button" id="Button_for_enable"                style="padding:5px 15px; margin-top:40px;"               value="Enable the Widget">    </center>    <script>        $(document).ready(function () {            $("#ButtonSet_Radio").buttonset({                disabled: true            });            $("#ButtonSet_Radio").buttonset("option", "disabled", true);            $("#Button_for_enable").on('click', function () {                $("#ButtonSet_Radio").buttonset("enable");            });        });    </script></body></html>
Output:
Reference: https://api.jqueryui.com/buttonset/#method-enable
jQuery-UI
jQuery-UI-Buttonset
JQuery
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Show and Hide div elements using radio buttons?
How to prevent Body from scrolling when a modal is opened using jQuery ?
jQuery | ajax() Method
jQuery | removeAttr() with Examples
How to get the value in an input text box using jQuery ?
Remove elements from a JavaScript Array
Installation of Node.js on Linux
Convert a string to an integer in JavaScript
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?
How to Convert Hexadecimal to Decimal?

Whereas Hexadecimal number is one of the number systems which has value is 16 and it has only 16 symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 and A, B, C, D, E, F. Where A, B, C, D, E and F are single bit representations of decimal value 10, 11, 12, 13, 14 and 15 respectively. Whereas Decimal system is most familiar number system to the general public. It is base 10 which has only 10 symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9.
There are various indirect or direct methods to convert a hexadecimal number into decimal number. In an indirect method, you need to convert a hexadecimal number into binary or octal number, then you can convert it into decimal number.
Example − Convert hexadecimal number F1 into decimal number.
First convert it into binary or octal number,
= (F1)16
= (1111 0001)2 or (011 110 001)2
Because in binary, value of F and 1 are 1111 and 0001 respectively. Then convert it into decimal number multiplying power of its position of base.
= (1x27+1x26+1x25+1x24+0x23+0x22+0x21+1x20)10
or (3 6 1)8

= (1x27+1x26+1x25+1x24+0x23+0x22+0x21+1x20)10 or (3x82+6x81+1x80)10
= (241)10


However, there is a simple direct method to convert a hexadecimal number to decimal number. Since, there are only 16 digits (from 0 to 7 and A to F) in hexadecimal number system, so we can represent any digit of hexadecimal number system using only 4 bit as following below.
Hexadecimal number system provides convenient way of converting large binary numbers into more compact and smaller groups. These are weights of hexadecimal of respective position of hexadecimal (value of base is 16).
Since number numbers are type of positional number system. That means weight of the positions from right to left are as 160, 161, 162, 163and so on. for the integer part and weight of the positions from left to right are as 16-1, 16-2, 16-3and so on. for the fractional part.
You can directly convert a hexadecimal number into decimal number using reverse method of decimal to hexadecimal number.
Assume any unsigned hexadecimal number is hnh(n-1) ... h1h0.h-1h-2 ... h(m-1)hm. Then the decimal number is equal to the sum of hexadecimal digits (hn) times their power of 16 (16n), i.e.,
= hnh(n-1) ... h1h0.h-1h-2 ... h(m-1)hm
= hnx16n+h(n-1)x16(n-1)+ ... +h1x161+h0x160+h-1x16-1+h-2x16-2+ ... +h(m-1)x16-(m-1)+h-mx16-m
This is simple algorithm where you have to multiply positional value of binary with their digit and get the sum of these steps.
Example-1 − Convert hexadecimal number ABCDEF into decimal number.
Since value of Symbols − A, B, C, D, E, F are 10, 11, 12, 13, 14, 15 respectively. Therefore equivalent decimal number is,
= (ABCDEF)16
= (10x165+11x164+12x163+13x162+14x161+15x160)10

= (10485760+720896+49152+3328+224+15)10
= (11259375)10 which is answer.


Example-2 − Convert hexadecimal number 1F.01B into decimal number.
Since value of Symbols: B and F are 11 and 15 respectively. Therefore equivalent decimal number is,
= (1F.01B)16
= (1x161+15x160 +0x16-1+1x16-2+11x16-3)10
= (31.0065918)10 which is answer.
Lambda expression in C++

C++ STL includes useful generic functions like std::for_each. Unfortunately they can also be quite cumbersome to use, particularly if the functor you would like to apply is unique to the particular function. So this function that you'll create will be in that namespace just being used at that one place. The solution to this is using anonymous functions.
C++ has introduced lambda expressions in C++11 to allow creating anonymous function. For example,
 Live Demo
#include<iostream>
#include<vector>
#include <algorithm> // for_each
using namespace std;
int main() {
   vector<int> myvector;
   myvector.push_back(1);
   myvector.push_back(2);
   myvector.push_back(3);
   for_each(myvector.begin(), myvector.end(), [](int x) {
      cout << x*x << endl;
   });
}
1
4
9
The (int x) is used to define the arguments that the lambda expression would be called with. The [] are used to pass variables from the local scope to the inner scope of the lambda, this is called capturing variables. These expressions if simple, can auto deduce their types. You can also explicitly provide type information using the following syntax
[](int x) -> double {
   return x/2.0;
}
Impala - Truncate a Table

The Truncate Table Statement of Impala is used to remove all the records from an existing table.
You can also use DROP TABLE command to delete a complete table, but it would remove the complete table structure from the database and you would need to re-create this table once again if you wish you store some data.
Following is the syntax of the truncate table statement.
truncate table_name;

Suppose, we have a table named customers in Impala, and if you verify its contents, you are getting the following result. This means that the customers table contains 6 records.
[quickstart.cloudera:21000] > select * from customers; 

Query: select * from customers 
+----+----------+-----+-----------+--------+--------+ 
| id | name     | age | address   | salary | e_mail | 
+----+----------+-----+-----------+--------+--------+
| 1  | Ramesh   | 32  | Ahmedabad | 20000  | NULL   | 
| 2  | Khilan   | 25  | Delhi     | 15000  | NULL   | 
| 3  | kaushik  | 23  | Kota      | 30000  | NULL   |
| 4  | Chaitali | 25  | Mumbai    | 35000  | NULL   | 
| 5  | Hardik   | 27  | Bhopal    | 40000  | NULL   | 
| 6  | Komal    | 22  | MP        | 32000  | NULL   | 
+----+----------+-----+-----------+--------+--------+

Following is an example of truncating a table in Impala using truncate statement. Here we are removing all the records of the table named customers.
[quickstart.cloudera:21000] > truncate customers;

On executing the above statement, Impala deletes all the records of the specified table, displaying the following message.
Query: truncate customers 

Fetched 0 row(s) in 0.37s

If you verify the contents of the customers table, after the delete operation, using select statement, you will get an empty row as shown below.
[quickstart.cloudera:21000] > select * from customers;
Query: select * from customers 

Fetched 0 row(s) in 0.12s

Open Impala Query editor and type the truncate Statement in it. And click on the execute button as shown in the following screenshot.
After executing the query/statement, all the records from the table are deleted.
 Print
 Add Notes
 Bookmark this page
MATLAB - Bitwise Operations

MATLAB provides various functions for bit-wise operations like 'bitwise and', 'bitwise or' and 'bitwise not' operations, shift operation, etc.
The following table shows the commonly used bitwise operations −
Create a script file and type the following code −
a = 60;               % 60 = 0011 1100   
b = 13;               % 13 = 0000 1101 
c = bitand(a, b)      % 12 = 0000 1100  
c = bitor(a, b)       % 61 = 0011 1101 
c = bitxor(a, b)      % 49 = 0011 0001 
c = bitshift(a, 2)    % 240 = 1111 0000 */
c = bitshift(a,-2)    % 15 = 0000 1111 */
When you run the file, it displays the following result −
c =  12
c =  61
c =  49
c =  240
c =  15


    30 Lectures 
     4 hours 

 Nouman Azam

    127 Lectures 
     12 hours 

 Nouman Azam

    17 Lectures 
     3 hours 

 Sanjeev

    37 Lectures 
     5 hours 

 TELCOMA Global

    22 Lectures 
     4 hours 

 TELCOMA Global

    18 Lectures 
     3 hours 

 Phinite Academy
 Print
 Add Notes
 Bookmark this page
Python time sleep() Method

Python time method sleep() suspends execution for the given number of seconds. The argument may be a floating point number to indicate a more precise sleep time.
The actual suspension time may be less than that requested because any caught signal will terminate the sleep() following execution of that signal's catching routine.
Following is the syntax for sleep() method −
time.sleep(t)

t − This is the number of seconds execution to be suspended.
t − This is the number of seconds execution to be suspended.
This method does not return any value.
The following example shows the usage of sleep() method.
#!/usr/bin/python
import time

print "Start : %s" % time.ctime()
time.sleep( 5 )
print "End : %s" % time.ctime()
When we run above program, it produces following result −
Start : Tue Feb 17 10:19:18 2009
End : Tue Feb 17 10:19:23 2009


    187 Lectures 
     17.5 hours 

 Malhar Lathkar

    55 Lectures 
     8 hours 

 Arnab Chakraborty

    136 Lectures 
     11 hours 

 In28Minutes Official

    75 Lectures 
     13 hours 

 Eduonix Learning Solutions

    70 Lectures 
     8.5 hours 

 Lets Kode It

    63 Lectures 
     6 hours 

 Abhilash Nelson
 Print
 Add Notes
 Bookmark this page
SQL Tryit Editor v1.6

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

30 Apr, 2020
Selenium’s Python Module is built to perform automated testing with Python. Selenium Python bindings provides a simple API to write functional/acceptance tests using Selenium WebDriver. To open a webpage using Selenium Python, checkout – Navigating links using get method – Selenium Python. Just being able to go to places isn’t terribly useful. What we’d really like to do is to interact with the pages, or, more specifically, the HTML elements within a page. There are multiple strategies to find an element using Selenium, checkout – Locating Strategies
This article revolves around how to use tag_name method in Selenium. tag_name method is used to get name of tag you are referring to.
element.tag_name
Example –
<input type="text" name="passwd" id="passwd-id" />
To find an element one needs to use one of the locating strategies, For example,
element = driver.find_element_by_id("passwd-id")
element = driver.find_element_by_name("passwd")
element = driver.find_element_by_xpath("//input[@id='passwd-id']")
Also, to find multiple elements, we can use –
elements = driver.find_elements_by_name("passwd")
Now one can get tag name of this element with –
element.tag_name
Let’s try to get element and its tag_name at geeksforgeeks using tag_name method.Program –
# import webdriverfrom selenium import webdriver  # create webdriver objectdriver = webdriver.Firefox()  # get geeksforgeeks.orgdriver.get("https://www.geeksforgeeks.org/")  # get element element = driver.find_element_by_id("gsc-i-id2")  # get tag_nameprint(element.tag_name)
Output-
Terminal Output –
Python-selenium
selenium
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to create pie chart in react using material UI and DevExpress ?

19 Jul, 2021
DevExpress: DevExpress is a package for controlling and building the user interface of the Window, Mobile, and other applications.
Pie Charts: A pie chart is a circular statistical graphic, which is divided into slices to illustrate numerical proportions. It depicts a special chart that uses “pie slices”, where each sector shows the relative sizes of data. 
Steps for creating React Application And Installing Module:
Step 1: Create a React application using the following command.npx create-react-app foldername
Step 1: Create a React application using the following command.
npx create-react-app foldername
 
Step 2: After creating your project folder i.e. folder name, move to it using the following command.cd foldername
Step 2: After creating your project folder i.e. folder name, move to it using the following command.
cd foldername
Step 3: After creating the ReactJS application, install the required modules using the following command.npm i --save @devexpress/dx-react-core @devexpress/dx-react-chart
npm install @material-ui/core
npm i --save @devexpress/dx-react-chart-material-ui
Step 3: After creating the ReactJS application, install the required modules using the following command.
npm i --save @devexpress/dx-react-core @devexpress/dx-react-chart
npm install @material-ui/core
npm i --save @devexpress/dx-react-chart-material-ui
Project Structure: It will look like the following :
Project Structure
Example: Now write down the following code in the App.js file. Here, the App is our default component where we have written our code.
App.js
import React from "react";import Paper from '@material-ui/core/Paper';import {  Chart,  PieSeries,  Title} from '@devexpress/dx-react-chart-material-ui';    const App = () => {  // Sample dataconst data = [  { argument:'Monday', value:10 },  { argument:'Tuesday', value:40 },  { argument:'Wednesday', value:10 },  { argument:'Thursday', value:20 },  { argument:'Friday', value:20 },];return (    <Paper>    <Chart      data={data}    >      <PieSeries valueField="value" argumentField="argument" />      <Title text="Studies per day"/>    </Chart>  </Paper>);}  export default App;
Step to Run Application: Run the application using the following command from the root directory of the project:
npm start
Output: Now open your browser and go to http://localhost:3000/, you will see the following output:
Output
Material-UI
Picked
React-Questions
JavaScript
ReactJS
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Difference between var, let and const keywords in JavaScript
Differences between Functional Components and Class Components in React
Remove elements from a JavaScript Array
Roadmap to Learn JavaScript For Beginners
Difference Between PUT and PATCH Request
How to fetch data from an API in ReactJS ?
Axios in React: A Guide for Beginners
How to redirect to another page in ReactJS ?
ReactJS Functional Components
Fakemailer – Send email anonymously in Kali Linux

23 Aug, 2021
Anonymity plays an important role in the life of a cybersecurity researchers and law and enforcement agencies. Sometimes a situation occurs in which you have to send an email anonymously to another security researcher in order to maintain integrity which is a third important part of the CIA model. So here Fakemailer plays an important role to send mails anonymously. Fakemailer is a free and open-source tool available on GitHub. Fakemailer provides a command-line interface that you can run on Kali Linux. The interactive console provides a number of helpful features, such as command completion and contextual help. Fakemailer helps law and enforcement agencies to investigate cybercrimes such as cyber grooming, cyberstalking, cyberbullying, and spreading misinformation.
Step 1: Open your kali linux operating system terminal and use the following command to install the tool.
git clone https://github.com/htr-tech/fake-mailer
cd fake-mailer
Step 2: Now you are in the directory of Fakemailer tool. Now use the following command to run the tool.
python2 mailer.py
Now we will see an example to use the tool.
You can see we have provided the necessary details to the tool and the tool has sent the mail anonymously. This is a very useful tool for security researchers. Similarly, you can perform experiments.
Kali-Linux
Linux-Tools
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
ZIP command in Linux with examples
tar command in Linux with examples
curl command in Linux with Examples
SORT command in Linux/Unix with examples
Conditional Statements | Shell Script
'crontab' in Linux with Examples
TCP Server-Client implementation in C
Tail command in Linux with examples
Docker - COPY Instruction
scp command in Linux with Examples
Python | Search elements in a Matrix

30 Dec, 2020
Python supports a list as its list element and hence a matrix can be formed. Sometimes we might have a utility in which we require to perform a search in that list of list i.e matrix and its a very common in all the domains of coding. Let’s discuss certain ways in which this can be performed.
Method #1 : Using any() + list comprehensionThe any function can be used to perform the task of if condition and the check for each element in the nested list can be computed using the list comprehension.
# Python3 code to demonstrate# Search in Matrix# using any() + list comprehension  # initializing listtest_list = [[4, 5, 6],             [10, 2, 13],             [1, 11, 18]]  # printing original list print("The original list : " + str(test_list))  # using any() + list comprehension# to Search in Matrixres = any(13 in sub for sub in test_list)  # printing resultprint("Is 13 present in Matrix ? : " + str(res))
The original list : [[4, 5, 6], [10, 2, 13], [1, 11, 18]]
Is 13 present in Matrix ? : True

 
Method #2 : Using set.issubset() + itertools.chain()The issubset method can be used to check for the membership in sublist and chain function can be used to perform this task for the each element in the Matrix, in a faster way as it works on iterators.
# Python3 code to demonstrate# Search in Matrix# using set.issubset() + itertools.chain()from itertools import chain  # initializing listtest_list = [[4, 5, 6],             [10, 2, 13],             [1, 11, 18]]  # printing original list print("The original list : " + str(test_list))  # using set.issubset() + itertools.chain()# to Search in Matrixres = {13}.issubset(chain.from_iterable(test_list))  # printing resultprint("Is 13 present in Matrix ? : " + str(res))
The original list : [[4, 5, 6], [10, 2, 13], [1, 11, 18]]
Is 13 present in Matrix ? : True

Marketing
Python list-programs
Python matrix-program
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Importance of yield() method in Java?

A yield() method is a static method of Thread class and it can stop the currently executing thread and will give a chance to other waiting threads of the same priority. If in case there are no waiting threads or if all the waiting threads have low priority then the same thread will continue its execution. The advantage of yield() method is to get a chance to execute other waiting threads so if our current thread takes more time to execute and allocate processor to other threads.
public static void yield()
class MyThread extends Thread {
   public void run() {
      for (int i = 0; i < 5; ++i) {
         Thread.yield(); // By calling this method, MyThread stop its execution and giving a chance to a main thread
         System.out.println("Thread started:" + Thread.currentThread().getName());
      }
      System.out.println("Thread ended:" + Thread.currentThread().getName());
   }
}
public class YieldMethodTest {
   public static void main(String[] args) {
      MyThread thread = new MyThread();
      thread.start();
      for (int i = 0; i < 5; ++i) {
         System.out.println("Thread started:" + Thread.currentThread().getName());
      }
      System.out.println("Thread ended:" + Thread.currentThread().getName());
   }
}
Thread started:main
Thread started:Thread-0
Thread started:main
Thread started:Thread-0
Thread started:main
Thread started:Thread-0
Thread started:main
Thread started:Thread-0
Thread started:main
Thread started:Thread-0
Thread ended:main
Thread ended:Thread-0