code-rag-bench/online-tutorials huggingface dataset:
How to convert a string in to a function in JavaScript?

To convert a string in to function "eval()" method should be used. This method takes a string as a parameter and converts it into a function.
eval(string);
In the following example, in a string itself, a property called 'age' is assigned with a function. Later on, using eval() function the property age is converted into a function and displayed as shown in the output.
 Live Demo
<html>
<body>
<script>
   var string = '{"name":"Ram", "age":"function() {return 27;}", "city":"New jersey"}';
   var fun = JSON.parse(string);
   fun.age = eval("(" + fun.age + ")");
   document.write(fun.name + " "+ "of Age" + " "+ fun.age()+ " " + "from city" +" "+ fun.city);
</script>
</body>
</html>
Ram of Age 27 from city New jersey
Material Design Lite - Checkboxes

MDL provides a range of CSS classes to apply various predefined visual and behavioral
enhancements and display the different types of checkboxes. The following table lists down
the available classes and their effects.
mdl-checkbox
Identifies label as an MDL component and is required on label element.
mdl-js-checkbox
Sets basic MDL behavior to label and is required on label element.
mdl-checkbox__input
Sets basic MDL behavior to checkbox and is required on input element (checkbox).
mdl-checkbox__label
Sets basic MDL behavior to caption and is required on span element (caption).
mdl-js-ripple-effect
Sets ripple click effect and is optional; goes on the label element and not on the input element (checkbox).
The following example will help you understand the use of the mdl-slider classes to show
the different types of check boxes.
<html>
   <head>
      <script 
         src = "https://storage.googleapis.com/code.getmdl.io/1.0.6/material.min.js">
      </script>
      <link rel = "stylesheet" 
         href = "https://storage.googleapis.com/code.getmdl.io/1.0.6/material.indigo-pink.min.css">
      <link rel = "stylesheet" 
         href = "https://fonts.googleapis.com/icon?family=Material+Icons">	  
      
      <script langauage = "javascript">
         function showMessage(value) {
            document.getElementById("message").innerHTML  =  value;
         }	  
      </script>
   </head>
   
   <body>
      <table>
         <tr><td>Default CheckBox</td><td>CheckBox with Ripple Effect</td>
            <td>Disabled CheckBox</td></tr>
         
         <tr>
            <td> 
               <label class = "mdl-checkbox mdl-js-checkbox" for = "checkbox1">
                  <input type = "checkbox" id = "checkbox1" 
                     class = "mdl-checkbox__input" checked>
                  <span class = "mdl-checkbox__label">Married</span>
               </label>
            </td>
         
            <td>
               <label class = "mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect" 
                  for = "checkbox2">
                  <input type = "checkbox" id = "checkbox2" class = "mdl-checkbox__input">
                  <span class = "mdl-checkbox__label">Single</span>
               </label>	  
            </td>
         
            <td>
               <label class = "mdl-checkbox mdl-js-checkbox" for = "checkbox3">
                  <input type = "checkbox" id = "checkbox3" 
                     class = "mdl-checkbox__input" disabled>
                  <span class = "mdl-checkbox__label">Don't know (Disabled)</span>
               </label>	   
            </td>
         </tr>
      </table>   
   
   </body>
</html>
Verify the result.
 Print
 Add Notes
 Bookmark this page
Sort Dataframe according to row frequency in Pandas

24 Feb, 2021
In this article, we will discuss how to use count() and sort_values() in pandas. So the count in pandas counts the frequency of elements in the dataframe column and then sort sorts the dataframe according to element frequency.
count(): This method will show you the number of values for each column in your DataFrame.
sort_values(): This method helps us to sort our dataframe. In this method, we pass the column and our data frame is sorted according to this column.
Example 1: Program to sort data frame in descending order according to the element frequency.
Python
# import pandasimport pandas as pd  # create dataframedf = pd.DataFrame({'Name': ['Mukul', 'Rohan', 'Mukul', 'Manoj',                            'Kamal', 'Rohan', 'Robin'],                                        'age': [22, 22, 21, 20, 21, 24, 20]})  # print dataframeprint(df)  # use count() and sort()df = df.groupby(['Name'])['age'].count().reset_index(  name='Count').sort_values(['Count'], ascending=False)  # print dataframeprint(df)
Output:
Example 2: Program to sort data frame in ascending order according to the element frequency.
Python
# import pandasimport pandas as pd  # create dataframedf = pd.DataFrame({'Name': ['Mukul', 'Rohan', 'Mukul', 'Manoj',                            'Kamal', 'Rohan', 'Robin'],                                        'age': [22, 22, 21, 20, 21, 24, 20]})  # print dataframeprint(df)  # use count() and sort()df = df.groupby(['Name'])['age'].count().reset_index(  name='Count').sort_values(['Count'], ascending=True)  # print dataframeprint(df)
Output:
Picked
Python pandas-dataFrame
Python Pandas-exercise
Python-pandas
Technical Scripter 2020
Python
Technical Scripter
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python NLTK | nltk.tokenizer.word_tokenize()

12 Jun, 2019
With the help of nltk.tokenize.word_tokenize() method, we are able to extract the tokens from string of characters by using tokenize.word_tokenize() method. It actually returns the syllables from a single word. A single word can contain one or two syllables.
Syntax : tokenize.word_tokenize()Return : Return the list of syllables of words.
Example #1 :In this example we can see that by using tokenize.word_tokenize() method, we are able to extract the syllables from stream of words or sentences.
# import SyllableTokenizer() method from nltkfrom nltk import word_tokenize     # Create a reference variable for Class word_tokenizetk = SyllableTokenizer()     # Create a string inputgfg = "Antidisestablishmentarianism"     # Use tokenize methodgeek = tk.tokenize(gfg)     print(geek)
Output :
[‘An’, ‘ti’, ‘dis’, ‘es’, ‘ta’, ‘blish’, ‘men’, ‘ta’, ‘ria’, ‘nism’]
Example #2 :
# import SyllableTokenizer() method from nltkfrom nltk.tokenize import word_tokenize     # Create a reference variable for Class word_tokenizetk = SyllableTokenizer()     # Create a string inputgfg = "Gametophyte"     # Use tokenize methodgeek = tk.tokenize(gfg)     print(geek)
Output :
[‘Ga’, ‘me’, ‘to’, ‘phy’, ‘te’]
Python-nltk
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Different ways to create Pandas Dataframe
Enumerate() in Python
Python String | replace()
How to Install PIP on Windows ?
*args and **kwargs in Python
Python Classes and Objects
Python OOPs Concepts
Convert integer to string in Python
Introduction To PYTHON
How to drop one or multiple columns in Pandas Dataframe
Matplotlib.axes.Axes.remove() in Python

19 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.remove() function in axes module of matplotlib library is used to remove the artist from the figure if possible.
Syntax:
Axes.remove(self)

Below examples illustrate the matplotlib.axes.Axes.remove() function in matplotlib.axes:
Example 1:
# Implementation of matplotlib functionimport matplotlib.pyplot as plt  fig, axs = plt.subplots()axs.plot([1, 2, 3])axs.remove()  fig.suptitle('matplotlib.axes.Axes.remove()\ function Example', fontweight ="bold")  plt.show()
Output:
Example 2:
# Implementation of matplotlib functionimport matplotlib.pyplot as plt  fig, (axs, axs2) = plt.subplots(2, 1)gs = axs2.get_gridspec()  axs.remove()      axbig = fig.add_subplot(gs[1:, -1])axbig.annotate("Removed one Axes",               (0.4, 0.5),               xycoords ='axes fraction',               va ='center')   fig.suptitle('matplotlib.axes.Axes.remove()\ function Example', fontweight ="bold")plt.show()
Output:
Python-matplotlib
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Python Classes and Objects
Python OOPs Concepts
Python | os.path.join() method
How to drop one or multiple columns in Pandas Dataframe
Introduction To PYTHON
How To Convert Python Dictionary To JSON?
Check if element exists in list in Python
Python | datetime.timedelta() function
Python | Get unique values from a list
Inshackle – Tool for Instagram Hacks in Kali Linux

13 Jun, 2022
Inshackle – Instagram Hacks: is an open-source intelligence tool available freely on GitHub.  Inshackle is written in bash language.  Inshackle is used to perform reconnaissance on Instagram accounts and profiles.  Inshackle is very helpful when you want to get information about any Instagram profile that a normal user cannot see. The tool can be used to increase followers, download stories of the profiles, track unfollows etc.  As this tool is open source so you can contribute to this tool. Inshackle  gives you the location, timestamp of posts posted by Instagram users. Inshackle is a powerful tool for manipulating social media using linux technology.
Inshackle can be used to Unfollow Tracker.
Inshackle can be used to Increase Followers.
Inshackle can be used to Download: Stories, Saved Content, Following/followers list, Profile Info.
Inshackle can be used to Unfollow all your following.
Step 1: Open your kali linux operating system and use the following command to install the tool.
git clone https://github.com/thelinuxchoice/inshackle
Step 2: Now use the following command to move into the directory of the tool.
cd inshackle
Step 3: Now use the following command to run the tool.
bash inshackle.sh
The tool has been downloaded and running successfully. Now we will see examples to use the tool.
Example 1: Use the Inshackle tool to increase followers.
choose option 2
2
Now login with your username and password.
The tool has started increasing followers.
This is how you can increase your followers.
krishna_97
Kali-Linux
Linux-Tools
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Docker - COPY Instruction
scp command in Linux with Examples
chown command in Linux with Examples
SED command in Linux | Set 2
mv command in Linux with examples
nohup Command in Linux with Examples
chmod command in Linux with examples
Introduction to Linux Operating System
Array Basics in Shell Scripting | Set 1
Basic Operators in Shell Scripting
HTML DOM Window localStorage Properties

25 Nov, 2021
HTML DOM Window localStorage Properties allow you to store value pairs in web browsers using objects. It is a read-only
property. This object is not expired even if the browser is closed. So, the data is never lost.
Return Values: It returns  a Storage object.
Syntax:
SAVING data to localStorage using:localStorage.setItem("key", "value");
SAVING data to localStorage using:
localStorage.setItem("key", "value");
READING data from localStorage using:var name = localStorage.getItem("key");
READING data from localStorage using:
var name = localStorage.getItem("key");
REMOVING data from localStorage using:localStorage.removeItem("key");
REMOVING data from localStorage using:
localStorage.removeItem("key");
Example1: This example describes the Save, Read and Remove data to localStorage.
HTML
<!DOCTYPE html><html>  <head>    <title> HTML DOM Window localStorage Properties </title>    <script>          //Saving data locally    function save() {        var fieldValue = document.getElementById('textfield').value;        localStorage.setItem('text', fieldValue);    }            // Reading data    function get() {        var storedValue = localStorage.getItem('text');        if(storedValue) {            document.getElementById('textfield').value = storedValue;        }    }            // Removing stored data    function remove() {        document.getElementById('textfield').value = '';        localStorage.removeItem('text');    }    </script></head>  <body onload="get()">    <p1>        Type something in the text field and         It will Get stored locally by Browser      </p1>    <input type="text" id="textfield" />    <input type="button" value="save" onclick="save()" />    <input type="button" value="clear" onclick="remove()" />    <p2>        when you reopen or reload this page,        your text is still there.    </p2>    <p3>        <br>click on clear to remove it.</p3></body>  </html>
Output:
Window localStorage
Example 2: This example describes the check storage type and saves data.
HTML
<!DOCTYPE html><html>  <head>    <title>HTML DOM Window localStorage Properties</title></head>  <body>    <div id="SHOW"></div>    <script>    if(typeof(Storage) !== "undefined") {        localStorage.setItem("name", "GeeksforGeeks");        document.getElementById("SHOW").innerHTML =         localStorage.getItem("name");    } else {        document.getElementById("SHOW").innerHTML =         "YOUR BROWSER DOES NOT" + "SUPPORT LOCALSTORAGE PROPERTY";    }    </script></body>  </html>
Output:
Window localStorage Property
Supported Browsers: The browser supported by DOM Window localStorage are listed below:
Google Chrome 4.0
Internet Explorer 8.0
Microsoft Edge 12.0
Firefox 3.5
Opera 10.5
Safari 4.0
bhaskargeeksforgeeks
ManasChhabra2
HTML-DOM
Picked
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Extracting Image Metadat using Exif Tool in Linux

12 Mar, 2021
Exif stands for Exchangeable image file format. It is a standard that specifies the formats for images, sound, and ancillary tags used by cameras, scanners, and other systems handling image and sound files recorded by cameras. Developed by Japan Electronic Industries Development Association (JEIDA).
Metadata contained in images and other files can give a lot of information that can not be seen by our eyes. For example, see the image of this beach. When you see an image, it seems like a normal image, but it contains metadata.
Exif tool is used to get the metadata contained in an image such as:
The camera used to capture the image such as the phone manufacturer and model number.
Date and time, when the image was taken
Geolocation attached to that image.
Use of flash.
ISO speed rating.
Use of Metadata:
Metadata, or data that describes files such as photos or videos, is useful during detection by investigators because they are often overlooked by other targeted objects. Now, many social media platforms have removed this problem by removing metadata from files but there are still many images online and this data has been completely omitted.
Required Installations:
For Linux OS
apt install exif
For MacOS
brew install exif 
 Note: exif tool that comes pre-installed in Kali Linux.
To view more information about the tool, you can use :
man exif
OR
exif --help
Extracting Metadata:
exif image.jpg
If you get a “corrupt data” error, there may be two cases:
No metadata in the file
Or you’re scanning a file other than JPG.
Linux-Tools
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python – Escape reserved characters in Strings List

09 Jul, 2021
Given List of Strings, escape reserved characters in each String.
Input : test_list = [“Gf-g”, “be)s(t”] Output : [‘Gf\\-g’, ‘be\\)s\\(t’] Explanation : All reserved character elements escaped, by adding double \\.
Input : test_list = [“Gf-g”] Output : [‘Gf\\-g’] Explanation : All reserved character elements escaped, by adding double \\.  
Method #1 : Using join() + list comprehension
In this, we construct the dictionary to map each of reserved character to its escaped version, and then perform the task of replacement in list comprehension and join the result to form Strings.
Python3
# Python3 code to demonstrate working of# Escape reserved characters in Strings List# Using list comprehension + join() # initializing listtest_list = ["Gf-g", "is*", "be)s(t"] # printing stringprint("The original list : " + str(test_list)) # the reserved stringreserved_str = """? & | ! { } [ ] ( ) ^ ~ * : \ " ' + -""" # the mapped escaped valuesesc_dict = { chr : f"\\{chr}" for chr in reserved_str} # performing transformation using join and list comprehensionres = [ ''.join(esc_dict.get(chr, chr) for chr in sub) for sub in test_list] # printing resultsprint("The resultant escaped String : " + str(res))
The original list : ['Gf-g', 'is*', 'be)s(t']
The resultant escaped String : ['Gf\\-g', 'is\\*', 'be\\)s\\(t']
Method #2 : Using maketrans() + translate() + zip()
In this, the escaping is made by pairing using zip() and maketrans() rather than dictionary for mapping. The translation is done using the result of maketrans().
Python3
# Python3 code to demonstrate working of# Escape reserved characters in Strings List# Using maketrans() + translate() + zip() # initializing listtest_list = ["Gf-g", "is*", "be)s(t"] # printing stringprint("The original list : " + str(test_list)) # reserved_charsreserved_chars = '''?&|!{}[]()^~*:\\"'+-''' # the escaping logicmapper = ['\\' + ele for ele in reserved_chars]result_mapping = str.maketrans(dict(zip(reserved_chars, mapper))) # reforming resultres = [sub.translate(result_mapping) for sub in test_list] # printing resultsprint("The resultant escaped String : " + str(res))
The original list : ['Gf-g', 'is*', 'be)s(t']
The resultant escaped String : ['Gf\\-g', 'is\\*', 'be\\)s\\(t']
sagar0719kumar
Python string-programs
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How To Reset Identity Column Values In SQL

11 May, 2022
Identity column of a table is a column whose value increases automatically. A user generally cannot insert a value into an identity column. A table can have only one column that is defined with the identity attribute.
Syntax :
IDENTITY [ ( seed , increment ) ]
Default value of identity is IDENTITY (1,1).
Seed : The seed represents the starting value of an ID and the default value of seed is 1.
Increment : It will represent the incremental value of the ID and the default value of increment is 1.
For Example :
Step 1 : Create a table named school.
CREATE TABLE school (
student_id INT IDENTITY,
student_name VARCHAR(200),
marks INT
);
Here, the ‘student_id’ column of the table starts from 1 as the default value of seed is 1 and each row is incremented by 1.
Step 2 : Insert some value into a table.
INSERT INTO school (student_name, marks) VALUES ('Sahil', 100);
INSERT INTO school (student_name, marks) VALUES ('Raj', 78);
INSERT INTO school (student_name, marks) VALUES ('Navneet', 80);
INSERT INTO school (student_name, marks) VALUES ('Rahul', 75);
INSERT INTO school (student_name, marks) VALUES ('Sudeep', 82);
INSERT INTO school (student_name, marks) VALUES ('Azaan', 75);
Step 3 : To see the records in the table ‘school’ , we can use the following code:
SELECT * FROM school;
Output :
Step 4 : Lets delete a record.
DELETE FROM school WHERE student_id = 4;
Step 5 : To see the records in the table.
SELECT * FROM school;
Output :
Now, you can see that the student_id column is not in order, So you have to reset the Identity Column. 
Here, to reset the Identity column  in SQL Server you can use DBCC CHECKIDENT method.
Syntax :
DBCC CHECKIDENT ('table_name', RESEED, new_value);
Note : If we reset the existing records in the table and insert new records, then it will show an error.
So, we need to :
Create a new table as a backup of the main table (i.e. school).
Delete all the data from the main table.
And now reset the identity column.
Re-insert all the data from the backup table to main table.
Step 6 : Create backup table named ‘new_school’ .
CREATE TABLE new_school AS SELECT student_id, student_name, marks FROM school;
Step 7 : Delete all the data from school.
DELETE FROM school;
Step 8 : Reset the Identity column.
DBCC CHECKIDENT ('school', RESEED, 0);
Step 9 : Re-insert all the data from the backup table to main table.
INSERT INTO school (student_name, marks) SELECT student_name, marks FROM new_school ORDER BY student_id ASC;
Step 10 : See the records of the table.
SELECT * FROM school;
Output :
This is how you can reset Identity Column values in SQL .
sagartomar9927
DBMS-SQL
SQL-Server
SQL
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python | Uncommon elements in Lists of List

16 Aug, 2021
This particular article aims at achieving the task of finding uncommon two list, in which each element is in itself a list. This is also a useful utility as this kind of task can come in life of programmer if he is in the world of development. Lets discuss some ways to achieve this task.
Method 1 : Naive Method This is the simplest method to achieve this task and uses the brute force approach of executing a loop and to check if one list contains similar list as of the other list, not including that. 
Python3
# Python 3 code to demonstrate# Uncommon elements in List# using naive method # initializing liststest_list1 = [ [1, 2], [3, 4], [5, 6] ]test_list2 = [ [3, 4], [5, 7], [1, 2] ] # printing both listsprint ("The original list 1 : " + str(test_list1))print ("The original list 2 : " + str(test_list2)) # using naive method# Uncommon elements in Listres_list = []for i in test_list1:    if i not in test_list2:        res_list.append(i)for i in test_list2:    if i not in test_list1:        res_list.append(i)         # printing the uncommonprint ("The uncommon of two lists is : " + str(res_list))
The original list 1 : [[1, 2], [3, 4], [5, 6]]
The original list 2 : [[3, 4], [5, 7], [1, 2]]
The uncommon of two lists is : [[5, 6], [5, 7]]
 
 Method 2 : Using set() + map() and ^ The most efficient and recommended method to perform this task is using the combination of set() and map() to achieve it. Firstly converting inner lists to tuples using map, and outer lists to set, use of ^ operator can perform the set symmetric difference and hence perform this task. Further if it is required to get in lists of list fashion, we can convert outer and inner containers back to list using map().
Python3
# Python 3 code to demonstrate# Uncommon elements in Lists of List# using map() + set() + ^ # initializing liststest_list1 = [ [1, 2], [3, 4], [5, 6] ]test_list2 = [ [3, 4], [5, 7], [1, 2] ] # printing both listsprint ("The original list 1 : " + str(test_list1))print ("The original list 2 : " + str(test_list2)) # using map() + set() + ^# Uncommon elements in Lists of Listres_set = set(map(tuple, test_list1)) ^ set(map(tuple, test_list2))res_list = list(map(list, res_set)) # printing the uncommonprint ("The uncommon of two lists is : " + str(res_list))
The original list 1 : [[1, 2], [3, 4], [5, 6]]
The original list 2 : [[3, 4], [5, 7], [1, 2]]
The uncommon of two lists is : [[5, 6], [5, 7]]
 
as5853535
Python list-programs
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Iterate over a list in Python
How to iterate through Excel rows in Python?
Enumerate() in Python
Python Dictionary
Deque in Python
Python program to convert a list to string
Python program to add two numbers
Python | Get dictionary keys as a list
Python Program for Fibonacci numbers
Python Program for factorial of a number
Shell Script to Read Data From a File

20 Apr, 2021
File reading is quite an important task in a Programmer’s life as it makes some tasks quite comfortable and automates certain repetitive and time-consuming things. File reading is quite an interesting concept to learn as it gives insight into quite a lot of things that can be done in the Programming world. In Linux, we have shell scripting that can do it with just a few lines.
We need to print the contents of a file after reading through it. Firstly, we will need a file to work with so a user input that gets a filename or path. Next, we need to iterate through the file and display the content character by character. The while loops and certain arguments can be used to do it more efficiently. 
To read a file, we need a file in the first place. We will simply read from the user input the path to the file or the file name if the file is in the same directory. We are using the read command to input the file path also we are making use of -p argument to pass in a prompt to the user as a text message giving concise information before the user actually types in anything. After the input has been stored in a preferable variable name we then move towards the actual reading of the file.
To read in from a file, we are going to use while loop that reads in from a stream of characters of the file. We used to read and then a variable that stores the current character. We output the character using echo. But the argument we have passed in to read i.e. n1 will allow us to read the file character by character *Note that if you don’t include the argument -n1 you will read the file line by line.* We will continue to loop through unless we are at the EOF or End of File as depicted in the done statement, We can also say the file stream has ended at EOF.  If you want to go by more characters we can increment the -n to any desirable number. 
Example 1: Script to read file character by character.
#!/bin/bash
read -p "Enter file name : " filename
while read -n1 character
do 
echo $character
done < $filename
Output:
Example 2: Read line by line:
#!/bin/bash
read -p "Enter file name : " filename
while read line
do 
echo $line
done < $filename
Output:
Picked
Shell Script
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Docker - COPY Instruction
scp command in Linux with Examples
chown command in Linux with Examples
SED command in Linux | Set 2
mv command in Linux with examples
nohup Command in Linux with Examples
chmod command in Linux with examples
Introduction to Linux Operating System
Array Basics in Shell Scripting | Set 1
Basic Operators in Shell Scripting
SQL Query to Find the Sum of all Values in a Column

13 Apr, 2021
In this article, we will look into the process of querying the sum of all values in a column of a database table. But before finding the sum of all values in a column, let us create a table with some columns and data. In this article, we will be using the Microsoft SQL Server as our database. 
Use the below syntax to create a table inside the database
Syntax :
create table table_name( column_name 1 data type ( size ) ,
        column_name 2 data type ( size) ,
          . . . . column_name n data type ( size ) )
For the sake of illustration, we will be creating a department table and operate on the same. The department table will have 3 fields namely deptid, deptname, totalemployees. To do so use the below statement:
CREATE TABLE department( deptid integer ,
                 deptname varchar(20) ,
                  totalemployees integer );
This will create the table. To insert values into the table we need to use the INSERT statement. So let us see add some data to the department table that we created:
Note: We have to insert values according to the table created. For example, we created a department table with deptid as integer, deptname as varchar, and totalemployees as an integer. So, we need to insert an integer, a character, and an integer respectively. 
Now let us insert some rows into the department table using the below query:
INSERT INTO department values(1,'IT',32);
INSERT INTO department values(2,'CSE',56);
INSERT INTO department values(1,'ECE',28);
Output:
Following the same pattern we have inserted some rows into the table, now let us print the data available in the table using the SELECT statement as shown below:
SELECT * FROM department;
Note: Here * represents all. If we execute this query, the entire table will be displayed.
Output :
For this, we need to use the sum() function. We have to pass the column name as a parameter.
This sum() function can be used with the SELECT query for retrieving data from the table.
The below example shows to find the sum of all values in a column.
Example :
SELECT SUM(totalemployees) FROM department;
Output :
Conclusion: Using the sum() function we can get the sum of values in a column using the column name.
SQL-Query
DBMS
SQL
DBMS
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to rotate a text 360 degrees on hover using HTML and CSS?

20 May, 2021
The Text can be rotated 360 degrees using basic HTML and CSS, this animation can be used as a heading or subheadings in the website to make it look more attractive. The below sections will guide you on how to create the desired effect.
HTML Code: In this section we will create a basic div element which will have some text inside of it.
HTML
<!DOCTYPE html><html lang="en" dir="ltr">   <head>    <meta charset="utf-8">    <title>Rotate text 360 degrees</title>     </head>   <body>    <div>        <h2>GeeksforGeeks</h2>    </div></body></html>
CSS Code: In this section first we will design the text using basic CSS properties and then  we will create the animation using @keyframes rule, we will use the transform property to rotate the text 360 degrees at regular intervals. 
css
<style>        body {            margin: 0;            padding: 0;            font-family: serif;            justify-content: center;            align-items: center;            display: flex;            background-color: #65E73C;        }           div {            content: '';            font-size: 2em;            position: absolute;            top: 50%;            left: 50%;            transform: translate(-50%, -50%);        }           h2:hover{            animation: rotate 1s linear;        }                // Rotate using @keyframes        @keyframes rotate{            0%{                transform: rotate(0deg);            }            50%{                transform: rotate(180deg);            }            100%{                transform: rotate(360deg);            }        }    </style>
Final Code: It is the combination of above two code sections.
HTML
<!DOCTYPE html><html lang="en" dir="ltr">   <head>    <meta charset="utf-8">    <title>Rotate text 360 degrees</title>     </head><style>    body {        margin: 0;        padding: 0;        font-family: serif;        justify-content: center;        align-items: center;        display: flex;        background-color: #65E73C;    }     div {        content: '';        font-size: 2em;        position: absolute;        top: 50%;        left: 50%;        transform: translate(-50%, -50%);    }     h2:hover{        animation: rotate 1s linear;    }     @keyframes rotate{        0%{            transform: rotate(0deg);        }        50%{            transform: rotate(180deg);        }        100%{            transform: rotate(360deg);        }    }</style>   <body>    <div>        <h2>GeeksforGeeks</h2>    </div></body></html>
Output:
Code_Mech
CSS-Misc
CSS
HTML
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python | Add comma between numbers

01 Jul, 2019
Sometimes, while working with currencies, we need to put commas between numbers to represent a currency, hence given a string, we can have a problem to insert commas into them. Let’s discuss certain ways in which this task can be performed.
Method #1 : Using str.format()The string format function can be used by supplying the valid formatter to perform the formatting. The string formatter is called with the value as argument to perform this particular task.
# Python3 code to demonstrate working of# Adding comma between numbers# Using str.format()  # initializing numbertest_num = 1234567  # printing original number print("The original number is : " + str(test_num))  # Using str.format()# Adding comma between numbersres = ('{:, }'.format(test_num))  # printing result print("The number after inserting commas : " + str(res))
The original number is : 1234567
The number after inserting commas : 1, 234, 567

 
Method #2 : Using format()This task can also be performed without taking the help of format library of strings but the normal format library that can use the “d” notation of numbers and simply insert the commas where required.
# Python3 code to demonstrate working of# Adding comma between numbers# Using format()  # initializing numbertest_num = 1234567  # printing original number print("The original number is : " + str(test_num))  # Using format()# Adding comma between numbersres = (format (test_num, ', d'))  # printing result print("The number after inserting commas : " + str(res))
The original number is : 1234567
The number after inserting commas : 1, 234, 567

Python string-programs
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Different ways to create Pandas Dataframe
Enumerate() in Python
Read a file line by line in Python
Python String | replace()
Python program to convert a list to string
Defaultdict in Python
Python | Get dictionary keys as a list
Python | Convert a list to dictionary
Python Program for Fibonacci numbers
Java toRadians() method with Example

11 Aug, 2021
The java.lang.Math.toRadians() is used to convert an angle measured in degrees to an approximately equivalent angle measured in radians. Note: The conversion from degrees to radian is generally inexact. 
Syntax:  
public static double toRadians(double deg)

Parameter:
deg : This parameter is an angle in degrees which
we want to convert in radians.
Return :
This method returns the measurement of the angle 
deg in radians.
Example: To show working of java.lang.Math.toRadians() method. 
Java
// Java program to demonstrate working// of java.lang.Math.toRadians() methodimport java.lang.Math; class Gfg {     // driver code    public static void main(String args[])    {        // converting PI from degree to radian        double deg = 180.0;        System.out.println(Math.toRadians(deg));         // converting PI/2 from degree to radian        deg = 90.0;        System.out.println(Math.toRadians(deg));         // converting PI/4 from degree to radian        deg = 45.0;        System.out.println(Math.toRadians(deg));    }}
Output: 
3.141592653589793
1.5707963267948966
0.7853981633974483
sagar0719kumar
Java-lang package
java-math
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Validate an IP address using Python without using RegEx

13 Apr, 2022
Given an IP address as input, the task is to write a Python program to check whether the given IP Address is Valid or not without using RegEx.
What is an IP (Internet Protocol) Address? Every computer connected to the Internet is identified by a unique four-part string, known as its Internet Protocol (IP) address. An IP address (version 4) consists of four numbers (each between 0 and 255) separated by periods. The format of an IP address is a 32-bit numeric address written as four decimal numbers (called octets) separated by periods; each number can be written as 0 to 255 (E.g. – 0.0.0.0 to 255.255.255.255).
Examples: 
Input:  192.168.0.1Output: Valid IP address
Input: 110.234.52.124Output: Valid IP address
Input: 666.1.2.2Output: Invalid IP address
Method #1: Checking the number of periods using count() method and then the range of numbers between each period.
Python3
# Python program to verify IP without using RegEx # explicit function to verify IPdef isValidIP(s):     # check number of periods    if s.count('.') != 3:        return 'Invalid Ip address'     l = list(map(str, s.split('.')))     # check range of each number between periods    for ele in l:        if int(ele) < 0 or int(ele) > 255 or (ele[0]=='0' and len(ele)!=1):            return 'Invalid Ip address'     return 'Valid Ip address'  # Driver Codeprint(isValidIP('666.1.2.2'))
Invalid Ip address

Method #2: Using a variable to check the number of periods and using a set to check if the range of numbers between periods is between 0 and 255(inclusive).
Python3
# Python program to verify IP without using RegEx # explicit function to verify IPdef isValidIP(s):     # initialize counter    counter = 0     # check if period is present    for i in range(0, len(s)):        if(s[i] == '.'):            counter = counter+1    if(counter != 3):        return 0     # check the range of numbers between periods    st = set()    for i in range(0, 256):        st.add(str(i))    counter = 0    temp = ""    for i in range(0, len(s)):        if(s[i] != '.'):            temp = temp+s[i]        else:            if(temp in st):                counter = counter+1            temp = ""    if(temp in st):        counter = counter+1     # verifying all conditions    if(counter == 4):        return 'Valid Ip address'    else:        return 'Invalid Ip address'  # Driver Codeprint(isValidIP('110.234.52.124'))
Valid Ip address

simmytarika5
chinmayi
niharikajune23
Python Regex-programs
python-regex
Python
Python Programs
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
Defaultdict in Python
Python | Get dictionary keys as a list
Python | Convert a list to dictionary
Python Program for Fibonacci numbers
Python | Convert string dictionary to dictionary
Click button by text using Python and Selenium

03 Mar, 2021
Selenium is a tool that provides APIs to automate a web application to aid in its testing. In this article, we discuss the use of Selenium Python API bindings to access the Selenium WebDrivers to click a button by text present in the button. In the following example, we take the help of Chrome. The method used is the find_element_by_link_text() which scrapes the element using the text present. In case there is no such element with the given text attribute, NoSuchElementException is returned.
Make sure you have Selenium installed using
pip3 install Selenium
And also download the WebDriver for your web browser :
Chrome : https://chromedriver.chromium.org/downloads
Firefox : https://github.com/mozilla/geckodriver/releases
Safari : https://webkit.org/blog/6900/webdriver-support-in-safari-10/
Once Selenium is installed along with the desired WebDriver, we create a file script.py and using our code editor write the python script below which opens up the geeksforgeeks website using the Selenium WebDriver and clicks the Sign In button using the link text.
Syntax:
driver.find_element_by_link_text("sample text")
Steps by step Approach:
Import required modules.
Create webdriver object.
Assign URL.
Use maximize_window() method to maximize the browser window. And then wait 10 seconds using sleep() method.
Use find_element_by_link_text() method to click button by text.
Below is the implementation.
Python3
# import modulefrom selenium import webdriverimport time  # Create the webdriver object. Here the # chromedriver is present in the driver # folder of the root directory.driver = webdriver.Chrome(r"./driver/chromedriver")  # get https://www.geeksforgeeks.org/driver.get("https://www.geeksforgeeks.org/")  # Maximize the window and let code stall # for 10s to properly maximise the window.driver.maximize_window()time.sleep(10)  # Obtain button by link text and click.button = driver.find_element_by_link_text("Sign In")button.click()
Output:
First, the WebDriver opens up the window with geeksforgeeks, maximizes it, and waits for 10 seconds. Then it clicks the Sign In button and opens up the sign-up panel.
Picked
Python Selenium-Exercises
Python-selenium
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Tailwind CSS Container

23 Mar, 2022
In Tailwind CSS, a container is used to fix the max-width of an element to match the min-width of the breakpoint. It comes very handy when content has to be displayed in a responsive manner to every breakpoint.
Breakpoints in tailwind CSS are as follows.
Tailwind CSS does not center itself automatically and also does not contain any pre-defined padding. The following are some utility classes that make the container class stand out.
mx-auto: To center the container, we use mx-auto utility class. It adjust the margin of the container automatically so that the container appears to be in center. 
 
Syntax:
<element class="mx-auto">...</element>
Example:
HTML
<!DOCTYPE html><html>  <head>    <link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css"        rel="stylesheet">      <style>        .container {            background-color: rgb(2, 201, 118);            color: white;        }          h2 {            text-align: center;        }    </style></head>  <body>    <h2 style="color:green">        GeeksforGeeks    </h2><br />          <div class="container mx-auto">        This is mx-auto class    </div></body>  </html>
Output:
mx-auto class
px-{size}: To add padding the container, we use px-{size} utility class. It adds horizontal padding to the container which is equal to the size mentioned.
Syntax:
<element class="px-20">...</element>
Example:
HTML
<!DOCTYPE html><html>  <head>    <link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css"        rel="stylesheet">      <style>        .container {            background-color: rgb(2, 201, 118);            color: white;        }          h2 {            text-align: center;        }    </style></head>  <body>    <h2 style="color:green">        GeeksforGeeks    </h2>    <br />          <div class="container mx-auto px-20">        This is px-20 class    </div></body>  </html>
Output:
px-size class
Picked
Tailwind CSS
Tailwind-Layout
CSS
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to create the Azure Storage context using PowerShell?

Storage context is helpful when you are working with the Storage accounts in the PowerShell session. It is like authenticating for Azure storage. Generally, we use the Azure storage account key and the connection string to create the Azure storage context.
To create a new storage context, we need to use the New-AzStorageContext command but to use this command we need a storage account key or the connection string.
We will use here Storage account key. We have the resource group “Az204” and the Storage account name “az204storage05june” which are stored in a variable.
$rg = "az204"
$storageaccount = "az204storage05june"
To get the storage account key,
$key = (Get-AzStorageAccountKey -ResourceGroupName $rg -
Name $storageaccount)[0].Value
To generate the storage context,
$context = New-AzStorageContext -StorageAccountName $storageaccount -
StorageAccountKey $key
You can use this storage context in the various storage commands to deal with the storage operations.
Online JSON Editor

Editable JSON Code
12345678910111213141516{    "Company": {        "Employee": {            "FirstName": "Tanmay",            "LastName": "Patil",            "ContactNo": "1234567890",            "Email": "tanmaypatil@xyz.com",            "Address": {                "City": "Bangalore",                "State": "Karnataka",                "Zip": "560212"            }        }    }}X
Privacy Policy
Cookies Policy
Terms of Use
Non-negative Integers without Consecutive Ones in C++

Suppose we have a positive integer n. We have to find the non-negative integers less than or equal to n. The constraint is that the binary representation will not contain consecutive ones. So if the input is 7, then the answer will be 5, as binary representation of 5 is 101.
To solve this, we will follow these steps −
Define a function convert(), this will take n,
ret := empty string
while n is non-zero, do −ret := ret + (n mod 2)n := right shift n, 1 time
ret := ret + (n mod 2)
n := right shift n, 1 time
return ret
From the main method, do the following −
bits := call the function convert(num)
n := size of bits
Define an array ones of size n, Define an array zeroes of size n
ones[0] := 1, zeroes[0] := 1
for initialize i := 1, when i < n, update (increase i by 1), do −zeroes[i] := zeroes[i - 1] + ones[i - 1]ones[i] := zeroes[i - 1]
zeroes[i] := zeroes[i - 1] + ones[i - 1]
ones[i] := zeroes[i - 1]
ret := ones[n - 1] + zeroes[n - 1]
for initialize i := n - 2, when i >= 0, update (decrease i by 1), do −if bits[i] is same as '0' and bits[i + 1] is same as '0', then −ret := ret - ones[i]otherwise when bits[i] is same as '1' and bits[i + 1] is same as '1', then −Come out from the loop
if bits[i] is same as '0' and bits[i + 1] is same as '0', then −ret := ret - ones[i]
ret := ret - ones[i]
otherwise when bits[i] is same as '1' and bits[i + 1] is same as '1', then −Come out from the loop
Come out from the loop
return ret
Let us see the following implementation to get better understanding −
 Live Demo
#include <bits/stdc++.h>
using namespace std;
class Solution {
public:
   string convert(int n){
      string ret = "";
      while(n){
         ret += (n % 2) + '0';
         n >>= 1;
      }
      return ret;
   }
   int findIntegers(int num) {
      string bits = convert(num);
      int n = bits.size();
      vector <int> ones(n);
      vector <int> zeroes(n);
      ones[0] = zeroes[0] = 1;
      for(int i = 1; i < n; i++){
         zeroes[i] = zeroes[i - 1] + ones[i - 1];
         ones[i] = zeroes[i - 1];
      }
      int ret = ones[n - 1] + zeroes[n - 1];
      for(int i = n - 2; i >= 0; i--){
         if(bits[i] == '0' && bits[i + 1] == '0') ret -= ones[i];
         else if(bits[i] == '1' && bits[i + 1]== '1') break;
      }
      return ret;
   }
};
main(){
   Solution ob;
   cout << (ob.findIntegers(7));
}
7
5