code-rag-bench/online-tutorials huggingface dataset:
Difference between int* p() and int (*p)()? - GeeksforGeeks

11 Dec, 2020
A pointer is a variable whose value is the address of another variable, i.e., direct address of the memory location. Like any variable or constant, a pointer must be declare before storing any variable address. The general form of a pointer variable declaration is:
Syntax:
type *var_name;
Here, type is the pointers base type. It must be a valid C/C++ data type and var-name is the name of the pointer variable. The asterisk * is being used to designate a variable as a pointer. Following are the valid pointer declaration for their respective data type:
int *ip;
float *fp;
double *dp;
char *cp;

In this article, the focus is to differentiate int* p() and int (*p)().
int* p(): Here “p” is a function that has no arguments and returns an integer pointer.
int* p()
returntype function_name (arguments)
Below is the program to illustrate the use of int* p():
C++
// C++ program to demonstrate the use// of int* p()#include <bits/stdc++.h>using namespace std;  // Function that returns integer pointer// and no argumentsint* p(){    int a = 6, b = 3;    int c = a + b;    int* t = &c;    return t;}  // Driver Codeint main(){    // Declare pointer a    int* a = p();    cout << *a;}
9

int (*p)(): Here “p” is a function pointer which can store the address of a function taking no arguments and returning an integer. *p is the function and ‘p‘ is a pointer.
Below is the program to illustrate the use of int (*p)():
C++
// C++ program to demonstrate the use// of int* (*p)()#include <bits/stdc++.h>using namespace std;  // Function with no arguments// and return integerint gfg(){    int a = 5, b = 9;    return a + b;}  // Driver Codeint main(){    // Declaring Function Pointer    int (*p)();      // Storing the address of    // function gfg in function    // pointer    p = gfg;      // Invoking function using    // function pointer    cout << p() << endl;}
14

C Basics
C++-new and delete
cpp-pointer
Pointers
C Language
C++
Pointers
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Substring in C++
Multidimensional Arrays in C / C++
Converting Strings to Numbers in C/C++
Left Shift and Right Shift Operators in C/C++
Core Dump (Segmentation fault) in C/C++
Vector in C++ STL
Initialize a vector in C++ (6 different ways)
Inheritance in C++
Map in C++ Standard Template Library (STL)
C++ Classes and Objects
Profit and Loss - GeeksforGeeks

30 Apr, 2016
For a shirt cost price is Rs. 400. Shopkeeper prints a tag on it with Markup% = 20% to earn a profit of 7.5%. What is markup?
For a shirt cost price = 400Rs. Shopkeeper prints a tag on it with Markup% = 20% to earn a profit of 7.5%. What is marked price
For a shirt cost price = 400Rs. Shopkeeper prints a tag on it with Markup% = 20% to earn a profit of 7.5%. How much profit shopkeeper earns?
Writing code in comment? Please use ide.geeksforgeeks.org, generate link and share the link here.
Must Do Coding Questions for Product Based Companies
C Program For Finding Length Of A Linked List
How to calculate MOVING AVERAGE in a Pandas DataFrame?
How to Convert Categorical Variable to Numeric in Pandas?
How to Replace Values in Column Based on Condition in Pandas?
How to Fix: SyntaxError: positional argument follows keyword argument in Python
How to Fix: KeyError in Pandas
C Program to read contents of Whole File
How to Append Pandas DataFrame to Existing CSV File?
How to Replace Values in a List in Python?
PyQt5 - Setting role to item in ComboBox - GeeksforGeeks

22 Apr, 2020
In this article we will see how we can set the item role in combo box, by default when we create a combo box and add items to it no role is set to the items, in order to set this we will use setItemData method
Syntax : combo_box.setItemData(index, role)
Argument : It takes two argument one is integer i.e index or item and other is the string i.e role of item
Action performed : It will assign role to the item
Below is the implementation –
# importing librariesfrom PyQt5.QtWidgets import * from PyQt5 import QtCore, QtGuifrom PyQt5.QtGui import * from PyQt5.QtCore import * import sys    class Window(QMainWindow):      def __init__(self):        super().__init__()          # setting title        self.setWindowTitle("Python ")          # setting geometry        self.setGeometry(100, 100, 600, 400)          # calling method        self.UiComponents()          # showing all the widgets        self.show()      # method for widgets    def UiComponents(self):          # creating a combo box widget        self.combo_box = QComboBox(self)          # setting geometry of combo box        self.combo_box.setGeometry(200, 150, 120, 30)          # geek list        geek_list = ["Geek", "Geeky Geek", "Legend Geek", "Ultra Legend Geek"]          # adding list of items to combo box        self.combo_box.addItems(geek_list)          # setting roles to the items        self.combo_box.setItemData(0, "First role")        self.combo_box.setItemData(1, "Second role")        self.combo_box.setItemData(2, "Third role")        self.combo_box.setItemData(3, "Forth role")        # create pyqt5 appApp = QApplication(sys.argv)  # create the instance of our Windowwindow = Window()  # start the appsys.exit(App.exec())
Output :
Python PyQt5-ComboBox
Python-gui
Python-PyQt
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
How to drop one or multiple columns in Pandas Dataframe
Python Classes and Objects
Python | Get unique values from a list
Python | os.path.join() method
Create a directory in Python
Defaultdict in Python
Python | Pandas dataframe.groupby()
How to get ID of the last updated row in MySQL? - GeeksforGeeks

13 Jun, 2019
Many times, we require updating the data based on the last updated table id.
We should write an update query in such a way that we can get the last updated ID in the update statement itselfThe code mentioned below has been created in a generalized sense and can be used easily just by replacing the values in ”, which is demonstrated below:
CREATING A TABLE

CREATE TABLE 
tbl(Rno INTEGER AUTO_INCREMENT ,
      Name VARCHAR(50) ,
       CONSTRAINT tbl_Rno PRIMARY KEY(Rno));
INSERT INTO tbl (Name) VALUES ('value1');
INSERT INTO tbl (Name) VALUES ('value2');
INSERT INTO tbl (Name) VALUES ('value3');


GETTING THE LAST UPDATED IDThe Logic over here suggests that we first update our last updated ID to 0 since it clears out any function previously performed then we update our values using the where clause/query in SQL and select the last updated ID using the @lastupdatedID query

SET @LastUpdateID := 0;
UPDATE tbl SET Name = 'value_new',Rno = (SELECT @LastUpdateID := Rno) 
   WHERE Name = 'value3';
SELECT @LastUpdateID AS LastUpdateID;


GETTING MULTIPLE LAST UPDATED IDThe Logic over here suggests that we update our values using the where clause/query in SQL and select the last updated ID using the @lastupdatedID query and to select multiple ID’s we use Concat query since it this code starts its searching from the bottom you would get our answer in a descending order as shown in the example.
SET @LastUpdateID = NULL;

UPDATE tbl SET Name = 'changed' WHERE Name 'changed'
AND (SELECT @LastUpdateID := CONCAT_WS(',', Rno, @LastUpdateID));
SELECT @LastUpdateID;


EXAMPLE #1 (For Last Updated ID)
Example #2 (For multiple Last Updated ID’s)
SohomPramanick
mysql
Picked
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Remove elements from a JavaScript Array
Convert a string to an integer in JavaScript
How to fetch data from an API in ReactJS ?
Difference between var, let and const keywords in JavaScript
How to create footer to stay at the bottom of a Web page?
Differences between Functional Components and Class Components in React
Node.js fs.readFileSync() Method
How to set the default value for an HTML <select> element ?
File uploading in React.js
How to set input type date in dd-mm-yyyy format using HTML ?
Lucky Numbers in a Matrix in JavaScript

Given a m * n matrix of distinct numbers, we have to return all lucky numbers in the 2-D array (matrix) in any order.
A lucky number is an element of the matrix such that it is the minimum element in its row and maximum in its column.
For example − If the input array is −
const arr = [
   [3,7,8],
   [9,11,13],
   [15,16,17]
];
Then the output should be −
const output = [15];
because 15 is the only lucky number since it is the minimum in its row and the maximum in its column.
The code for this will be −
const arr = [
   [3,7,8],
   [9,11,13],
   [15,16,17]
];
const luckyNumbers = (arr, res = []) => {
   let M = arr.length, N = arr[0].length;
   let min = Array(M).fill( Infinity);
   let max = Array(N).fill(-Infinity);
   for (let i = 0; i < M; ++i)
   for (let j = 0; j < N; ++j)
   min[i] = Math.min(min[i], arr[i][j]),
   max[j] = Math.max(max[j], arr[i][j]);
   for (let i = 0; i < M; ++i)
   for (let j = 0; j < N; ++j)
   if (min[i] == max[j])
   res.push(arr[i][j]);
   return res;
};
console.log(luckyNumbers(arr));
And the output in the console will be −
[15]
How to get all the options in the dropdown in Selenium?

We can extract all the options in a dropdown in Selenium with the help of Select class which has the getOptions() method. This retrieves all the options on a Select tag and returns a list of web elements. This method does not accept any arguments.
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import java.util.concurrent.TimeUnit;
import java.util.List;
import org.openqa.selenium.support.ui.Select;
public class DropdownOptions{
   public static void main(String[] args) {
      System.setProperty("webdriver.chrome.driver", "C:\\Users\\ghs6kor\\Desktop\\Java\\chromedriver.exe");
      WebDriver driver = new ChromeDriver();
      String url = " https://www.tutorialspoint.com/tutor_connect/index.php";
      driver.get(url);
      driver.manage().timeouts().implicitlyWait(12, TimeUnit.SECONDS);
      Select s = new Select(driver.findElement(By.xpath("//select[@name=’selType’]")));
      // getting the list of options in the dropdown with getOptions()
      List <WebElement> op = s.getOptions();
      int size = op.size();
      for(int i =0; i<size ; i++){
         String options = op.get(i).getText();
         System.out.println(options);
      }
      driver.quit()
   }
}
How to create a Hash Table in PowerShell?

There are several ways to create a Hash Table in PowerShell. We will discuss here the standard method @{} for creating the Hash Table.
You can use @{} method to create a hash table. Key-Value pair is separated with the Semi-Colon (;). You can only add unique keys. Duplicate keys are not accepted.
$htable = @{EmpName="Charlie";City="New York";EmpID="001"}
Name       Value
----       -----
EmpID      001
City       New York
EmpName    Charlie
Here, you will not get the output in an ordered fashion. To get the ordered output, you need to write [Ordered] ahead of the Hash table. For Example,
$htable = [Ordered]@{EmpName="Charlie";City="New York";EmpID="001"}
PS C:\WINDOWS\system32> $htable

Name       Value
----       -----
EmpName    Charlie
City       New York
EmpID      001
To access only Hash table keys, you can use the below command.
$htable.Keys
PS C:\WINDOWS\system32> $htable.Keys
EmpName
City
EmpID
To access only Hash table values,
$htable.Values
PS C:\WINDOWS\system32>$htable.Values
Charlie
New York
001
You can access the individual Key as well. To access the Employee Name (Key:EmpName), you need to use the below command.
$htable["EmpName"]
PS C:\WINDOWS\system32> $htable["EmpName"]
Charlie
You can also access the same value with the Dot (.) method as shown below.
$htable.EmpName
Similarly, you can access different values by using respective keys.
To get the multiple values, use multiple keys.
$htable["EmpName","EmpID"]
PS C:\WINDOWS\system32> $htable["EmpName","EmpID"]
Charlie
001
Big Data Analytics - Data Exploration

Exploratory data analysis is a concept developed by John Tuckey (1977) that consists on a new perspective of statistics. Tuckey’s idea was that in traditional statistics, the data was not being explored graphically, is was just being used to test hypotheses. The first attempt to develop a tool was done in Stanford, the project was called prim9. The tool was able to visualize data in nine dimensions, therefore it was able to provide a multivariate perspective of the data.
In recent days, exploratory data analysis is a must and has been included in the big data analytics life cycle. The ability to find insight and be able to communicate it effectively in an organization is fueled with strong EDA capabilities.
Based on Tuckey’s ideas, Bell Labs developed the S programming language in order to provide an interactive interface for doing statistics. The idea of S was to provide extensive graphical capabilities with an easy-to-use language. In today’s world, in the context of Big Data, R that is based on the S programming language is the most popular software for analytics.
The following program demonstrates the use of exploratory data analysis.
The following is an example of exploratory data analysis. This code is also available in part1/eda/exploratory_data_analysis.R file.
library(nycflights13) 
library(ggplot2) 
library(data.table) 
library(reshape2)  

# Using the code from the previous section 
# This computes the mean arrival and departure delays by carrier. 
DT <- as.data.table(flights) 
mean2 = DT[, list(mean_departure_delay = mean(dep_delay, na.rm = TRUE), 
   mean_arrival_delay = mean(arr_delay, na.rm = TRUE)), 
   by = carrier]  

# In order to plot data in R usign ggplot, it is normally needed to reshape the data 
# We want to have the data in long format for plotting with ggplot 
dt = melt(mean2, id.vars = ’carrier’)  

# Take a look at the first rows 
print(head(dt))  

# Take a look at the help for ?geom_point and geom_line to find similar examples 
# Here we take the carrier code as the x axis 
# the value from the dt data.table goes in the y axis 

# The variable column represents the color 
p = ggplot(dt, aes(x = carrier, y = value, color = variable, group = variable)) +
   geom_point() + # Plots points 
   geom_line() + # Plots lines 
   theme_bw() + # Uses a white background 
   labs(list(title = 'Mean arrival and departure delay by carrier', 
      x = 'Carrier', y = 'Mean delay')) 
print(p)  

# Save the plot to disk 
ggsave('mean_delay_by_carrier.png', p,  
   width = 10.4, height = 5.07)

The code should produce an image such as the following −

    65 Lectures 
     6 hours 

 Arnab Chakraborty

    18 Lectures 
     1.5 hours 

 Pranjal Srivastava, Harshit Srivastava

    23 Lectures 
     2 hours 

 John Shea

    18 Lectures 
     1.5 hours 

 Pranjal Srivastava

    46 Lectures 
     3.5 hours 

 Pranjal Srivastava

    37 Lectures 
     3.5 hours 

 Pranjal Srivastava, Harshit Srivastava
 Print
 Add Notes
 Bookmark this page
How to change login screen background in Ubuntu - GeeksforGeeks

18 Feb, 2019
You may get bored with ordinary purple-colored background screen whenever you login into your computer. To replace this purple-colored background to your favorite background screen it is not as easy as in Windows.
Steps to change login screen background in Ubuntu:
Step 1: Copy your favorite background image and paste in below mentioned folder:
/usr/share/backgrounds
or type this command in terminal and enter your password.
sudo cp Path_of_Image/NAME_OF_THE_FAVORITE_IMAGE /usr/share/backgrounds/
Step 2: We need to modify a CSS file which is responsible for the background image. Open the terminal and paste this command and you will able to see a CSS file.
For ubuntu 17.10xhost +local: && sudo gedit /etc/alternatives/gdm3.css
xhost +local: && sudo gedit /etc/alternatives/gdm3.css
For ubuntu 18.04sudo gedit /usr/share/gnome-shell/theme/ubuntu.css
sudo gedit /usr/share/gnome-shell/theme/ubuntu.css
Step 3: Press ctrl+f and you will see insert box at top right corner of the window. Type #lockDialogGroup in the box then you can see the “#lockDialogGroup” highlighting on the screen.
Step 4: Find out the following section.
#lockDialogGroup {
  background: #2c001e url(resource:///org/gnome/shell/theme/noise-texture.png);
  background-repeat: repeat; }

Replace this with following:
#lockDialogGroup {
  background: #2c001e url(file:///usr/share/backgrounds/NAME_OF_THE_FAVOURITE_IMAGE);
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center; }

Write your image name in place of “NAME_OF_THE_FAVORITE_IMAGE” in the above section and save the file.
Step 5: Restart the computer and you will find your favorite background screen at the time of login.
GBlog
Linux-Unix
TechTips
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
DSA Sheet by Love Babbar
Roadmap to Become a Web Developer in 2022
ML | Underfitting and Overfitting
Top 10 Angular Libraries For Web Developers
A Freshers Guide To Programming
Sed Command in Linux/Unix with examples
AWK command in Unix/Linux with examples
grep command in Unix/Linux
TCP Server-Client implementation in C
cut command in Linux with examples
CSS | Tooltip Fade In Animation - GeeksforGeeks

29 May, 2020
Tooltip is used to display information about an element when the mouse has hovered over that element. Tooltips are by default displayed with no delay (animation).
How to add animation to Tooltip?We can add fade-in effect to the tooltip text before it becomes visible. This can be done by changing the opacity from 0 to full in a given number of seconds using the transition property in CSS.
Syntax:
 .tooltip .tooltip_text {
      opacity: 0;
      transition: opacity 3s;
 }

 .tooltip:hover .tooltip_text {
      visibility: visible;
      opacity: 1;
 }


Example:
<!DOCTYPE html><html>  <head>    <style>        .tooltip {            position: relative;            display: inline-block;            color: green;            font-size: 30px;        }          .tooltip .tooltip_text {            visibility: hidden;            font-size: 15px;            padding: 5px;            background-color: #cceabb;            color: black;            text-align: center;            position: absolute;            z-index: 1;            top: 120%;            left: 5%;            opacity: 0;            transition: opacity 3s;        }          .tooltip .tooltip_text::after {            content: "";            position: absolute;            bottom: 100%;            left: 50%;            margin-left: -6px;            border-width: 8px;            border-style: solid;            border-color: transparent transparent #cceabb transparent;        }          .tooltip:hover .tooltip_text {            visibility: visible;            opacity: 1;        }    </style></head>  <body>    <div class="tooltip">GeeksforGeeks        <span class="tooltip_text">            A Computer science portal for geeks        </span>    </div></body>  </html>
Output:
Initially, the opacity of tooltip text is set to 0 and then the transition is applied to the opacity with a delay of 3s.When we hover over “GeeksforGeeks” text, tooltip becomes 100% visible in 3s. This leads to a fade-in effect/ animation.
CSS-Misc
CSS-Properties
CSS
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to create footer to stay at the bottom of a Web page?
Types of CSS (Cascading Style Sheet)
Create a Responsive Navbar using ReactJS
Design a web page using HTML and CSS
How to position a div at the bottom of its container using CSS?
Top 10 Front End Developer Skills That You Need in 2022
Installation of Node.js on Linux
How to fetch data from an API in ReactJS ?
Difference between var, let and const keywords in JavaScript
Convert a string to an integer in JavaScript
Java Read Files

In the previous chapter, you learned how to create and write to a file.
In the 
following example, we use the Scanner class to read the contents of the text file we created in the previous chapter:
import java.io.File;  // Import the File class
import java.io.FileNotFoundException;  // Import this class to handle errors
import java.util.Scanner; // Import the Scanner class to read text files

public class ReadFile {
  public static void main(String[] args) {
    try {
      File myObj = new File("filename.txt");
      Scanner myReader = new Scanner(myObj);
      while (myReader.hasNextLine()) {
        String data = myReader.nextLine();
        System.out.println(data);
      }
      myReader.close();
    } catch (FileNotFoundException e) {
      System.out.println("An error occurred.");
      e.printStackTrace();
    }
  }
}

The output will be:
To get more information about a file, use any of the File methods:
import java.io.File;  // Import the File class

public class GetFileInfo {   public static void main(String[] args) {
    File myObj = new File("filename.txt");
    if (myObj.exists()) {
      System.out.println("File name: " + myObj.getName());
      System.out.println("Absolute path: " + myObj.getAbsolutePath());
      System.out.println("Writeable: " + myObj.canWrite());
      System.out.println("Readable " + myObj.canRead());
      System.out.println("File size in bytes " + myObj.length());
    } else {
      System.out.println("The file does not exist.");
    }
  }
}

The output will be:
Note: There are many available classes in the Java API that can be used to read and write files in Java: FileReader, BufferedReader, Files, Scanner, FileInputStream, FileWriter, BufferedWriter, FileOutputStream, etc. Which one to use depends on the Java version you're working with and whether you need to read bytes or characters, and the size of the file/lines etc.
Tip: To delete a file, read our Java Delete Files chapter.
We just launchedW3Schools videos
Get certifiedby completinga course today!
If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:
help@w3schools.com
Your message has been sent to W3Schools.
How to use placeholder attribute in HTML?

If you want to set a hint for text area or input field, then use the HTML placeholder attribute. The hint is the expected value, which gets displayed before the user enters a value, for example, name, details, etc.
You can try to run the following code to learn how to use placeholder attribute in HTML.
<!DOCTYPE html>
<html>
   <body>
      <h2>Register</h2>
      <form action="/new.php">
         <input type="text" placeholder="Student UserName" name="name"/><br>
         <input type="password" placeholder="Password" name="password"> <br><br>
         <input type="submit" value="Submit">
      </form>
   </body>
</html>
Creating a Table from an Existing Table

A copy of an existing table can be created using a combination of the CREATE TABLE statement and the SELECT statement. The new table has the same column definitions. All columns or specific columns can be selected. When you will create a new table using the existing table, the new table would be populated using the existing values in the old table.
The basic syntax for creating a table from another table is as follows −
CREATE TABLE NEW_TABLE_NAME AS
   SELECT [ column1, column2...columnN ]
   FROM EXISTING_TABLE_NAME
   [ WHERE ]

Here, column1, column2... are the fields of the existing table and the same would be used to create fields of the new table.
Following is an example, which would create a table SALARY using the CUSTOMERS table and having the fields customer ID and customer SALARY −
SQL> CREATE TABLE SALARY AS
   SELECT ID, SALARY
   FROM CUSTOMERS;
This would create a new table SALARY which will have the following records −
+----+----------+
| ID | SALARY   |
+----+----------+
|  1 |  2000.00 |
|  2 |  1500.00 |
|  3 |  2000.00 |
|  4 |  6500.00 |
|  5 |  8500.00 |
|  6 |  4500.00 |
|  7 | 10000.00 |
+----+----------+

    42 Lectures 
     5 hours 

 Anadi Sharma

    14 Lectures 
     2 hours 

 Anadi Sharma

    44 Lectures 
     4.5 hours 

 Anadi Sharma

    94 Lectures 
     7 hours 

 Abhishek And Pukhraj

    80 Lectures 
     6.5 hours 

 Oracle Master Training | 150,000+ Students Worldwide

    31 Lectures 
     6 hours 

 Eduonix Learning Solutions
 Print
 Add Notes
 Bookmark this page
CSS | :not Selector - GeeksforGeeks

04 Jan, 2019
The :not(selector) selector is used to style every element that is not the specified by selector. Since it prevents specific items from being selected, it is also known as the negation pseudo-class.
Syntax:
:not(selector) {
  //CSS Property
}

Example-1:
<!DOCTYPE html><html>  <head>    <title>        CSS :not selector    </title>    <style>        p {            color: #000000;        }                  :not(p) {            color: green;        }    </style></head>  <body style="text-align: center;">      <h1>            CSS :not selector    </h1>      <p>        A computer science portal for geeks.    </p>      <div>        Geeks classes an extensive classroom programme.    </div></body>  </html>
Output:
Example-2:
<!DOCTYPE html><html>  <head>    <title>        CSS :not selector    </title>    <style>        /* Style everything but not          one named .geek class */                  li:not(.geek) {            color: green;        }    </style></head>  <body style="text-align: center;">      <h1 style="color:green;">            CSS :not selector        </h1>      <p>        Sorting Algorithms    </p>    <ul>        <li>Merge sort</li>        <li class="geek">Bubble sort</li>        <li>Quick sort</li>    </ul></body>  </html>
Output:Supported Browsers: The browser supported by :not selector are listed below:
Apple Safari 3.2
Google Chrome 4.0
Firefox 3.5
Opera 9.6
Internet Explorer 9.0
CSS-Selectors
CSS
Web Technologies
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 create footer to stay at the bottom of a Web page?
How to update Node.js and NPM to next version ?
CSS to put icon inside an input element in a form
Roadmap to Become a Web Developer in 2022
Installation of Node.js on Linux
How to fetch data from an API in ReactJS ?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to insert spaces/tabs in text using HTML/CSS?
What is encapsulation in C#?

Encapsulation in C# prevents access to implementation details. Implement Encapsulation in C# using access specifiers.
The following are the access specifiers supported by C# −
Public
Private
Protected
Internal
Protected internal
Encapsulation can be understood by taking an example of private access specifier that allows a class to hide its member variables and member functions from other functions and objects.
In the following example we have length and width as variables assigned private access specifier −
 Live Demo
using System;

namespace RectangleApplication {
   class Rectangle {
      private double length;
      private double width;

      public void Acceptdetails() {
         length = 10;
         width = 15;
      }

      public double GetArea() {
         return length * width;
      }

      public void Display() {
         Console.WriteLine("Length: {0}", length);
         Console.WriteLine("Width: {0}", width);
         Console.WriteLine("Area: {0}", GetArea());
      }
   }

   class ExecuteRectangle {
      static void Main(string[] args) {
         Rectangle r = new Rectangle();
         r.Acceptdetails();
         r.Display();
         Console.ReadLine();
      }
   }
}
Length: 10
Width: 15
Area: 150
CSS Margin Collapse - GeeksforGeeks

02 Jul, 2021
The CSS margin property is used to set a margin on all four sides of an element. When two elements are next to each other on a page vertically, one of the elements might lose its vertical margin. This means the top and bottom margins of elements are sometimes combined into a single margin. The single margin is equal to the largest of the two margins getting collapsed.Example: 
html
<!DOCTYPE html><!DOCTYPE html><html lang="en" dir="ltr">    <head>       <style>           p{               margin: 20px 0 10px;               background-color:rgb(79, 236, 119);           }       </style>    </head>    <body>         <p>This paragraph's bottom margin is collapsed.</p>          <p>This paragraph is 20px below the above text.</p>     </body></html>
You would expect the margin between the two paragraphs to be 30px (10px bottom margin of 1st paragraph + 20px top margin of next paragraph). But in CSS the bigger margin overrides and the actual margin is the bigger one (20px).Output:  
If one element has a negative margin, the negative margin is subtracted from the positive margin. For example, resultant margin of 40px and -30px will be 10px (40px-30px). If both the margins are negative, greater negative value is used. For example, resultant margin of -20px and -50px will be -50px.The margins of floating and absolutely positioned elements never collapse. Some specific cases of margins collapse:  
Between adjacent elements: The margins of vertically adjacent elements collapse as we saw in the previous example.
Between parent and child elements: Adjacent margins of parent and child elements collapse when no padding, borders, or content exist between the adjacent margins.
Example:  
html
<!DOCTYPE html><html lang="en" dir="ltr">    <head>       <style>           h1{              margin: 0;              background-color: rgb(79, 236, 119);           }            div{               margin: 30px 0 20px ;           }            p{               margin: 20px 0 10px;               background-color: #f0f0f0;           }       </style>    </head>    <body>        <h1>Geeks For Geeks</h1>        <div>             <p>This paragraph's top              margin is collapsed.</p>         </div>    </body></html>
Output:  
Here the margin between h1 and div is 30px and not 50px (30px + 20px).
Supported Browsers:
Google Chrome
Internet Explorer
Firefox
Opera
Safari 
ysachin2314
CSS-Properties
CSS
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to create footer to stay at the bottom of a Web page?
Types of CSS (Cascading Style Sheet)
How to position a div at the bottom of its container using CSS?
Create a Responsive Navbar using ReactJS
Design a web page using HTML and CSS
Roadmap to Become a Web Developer in 2022
Installation of Node.js on Linux
How to fetch data from an API in ReactJS ?
Convert a string to an integer in JavaScript
Difference between var, let and const keywords in JavaScript
What is emplace_back( ) in C++?

This function is used to insert new element at the end of deque.
dequename.emplace_back(value)
Value − It defines the element to be inserted at the end of deque.
Input Deque − 11 12 13 14 15
Output New Deque − 11 12 13 14 15 16
Input Deque − M O M E N T
Output New Deque − M O M E N T S
First we declare the deque.
First we declare the deque.
Then we print the deque.
Then we print the deque.
Then we define the emplace_back( ) function.
Then we define the emplace_back( ) function.
Then we print the new deque after inserting new element.
Then we print the new deque after inserting new element.
By using above approach we can enter new element at end. While defining function we define the new element as parameter. New element should have same data type as deque.
// C++ code to demonstrate the working of deque emplace_back( ) function
#include<iostream.h>
#include<deque.h>
Using namespace std;
int main( ){
   // initializing deque
   deque<int> deque ={ 14, 15, 16, 17, 18 };
   cout<< “ Deque: “;
   for( auto x = deque.begin( ); x != deque.end( ); ++x)
      cout<< *x << “ “;
   // defining the emplace_back( ) function
   deque.emplace_back(19);
   // printing deque in after inserting new element
   cout<< “ New deque:”;
   for( auto x = deque.begin( ) ; x >= deque.end( ); ++x)
      cout<< “ “ <<*x;
   return 0;
}
If we run the above code then it will generate the following output
Input: 14 15 16 17 18
Output: 14 15 16 17 18 19
Input: P O I N T
Output: P O I N T S
AttrDict module in Python - GeeksforGeeks

31 Aug, 2021
AttrDict is an MIT-licensed library which provides mapping objects that allow their elements to be accessed both as keys and as attributes. So we can think of the dictionary that we import and use.
Installation: 
To install AttrDict, use the pip command as follows:
pip install attrdict
Having installed it, let us understand it with the working of a program:
Example 1 :Here we will show how to create a dictionary pair using the module.
Python3
# importing the modulefrom attrdict import AttrDict # creating a dictionary pairdictionary = AttrDict({"Geeks" : "forGeeks"}) # accessing the value using key# method 1print(dictionary.Geeks) # method 2print(dictionary["Geeks"])
Output :  
forGeeks
forGeeks
Example 2 :Making a Nested dictionary of multiple elements and printing them. 
Python3
# importing the modulefrom attrdict import AttrDict # creating a dictionarydictionary = AttrDict({'foo': 'bar',                       'alpha': {'beta': 'a',                                 'a': 'a'}}) # printing the valuesfor key in dictionary:    print(dictionary[key])
Output : 
bar
{'beta': 'a', 'a': 'a'}
Example 3 :Adding another dictionary to a dictionary.
Python3
# importing the modulefrom attrdict import AttrDict # creating the first dictionarya = {'foo': 'bar', 'alpha': {'beta': 'a', 'a': 'a'}} # creating the second dictionaryb = {'lorem': 'ipsum', 'alpha': {'bravo': 'b', 'a': 'b'}} # combining the dictionariesc = AttrDict(a) + b print(type(c))print(c)
Output : 
<class 'attrdict.dictionary.AttrDict'>
AttrDict({'foo': 'bar', 'lorem': 'ipsum', 'alpha': {'beta': 'a', 'bravo': 'b', 'a': 'b'}})
sagar0719kumar
python-modules
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
How to drop one or multiple columns in Pandas Dataframe
How To Convert Python Dictionary To JSON?
Check if element exists in list in Python
Defaultdict in Python
Python | os.path.join() method
Python | Get unique values from a list
Selecting rows in pandas DataFrame based on conditions
Create a directory in Python
Python | Pandas dataframe.groupby()
How to get a JSON field in a nested JSON using Rest Assured?

We can get a JSON field in a complex nested JSON using Rest Assured. First, we shall obtain a Response body which is in JSON format from a request. Then convert it to string.
We shall send a GET request via Postman on a mock API URL and observe its Response.
Using Rest Assured, let us get the value of the Price field having the value as $150. It is part of the Items. We shall get the value of the Item Count field by traversing the path - Items.Price.
Code Implementation
import static io.restassured.RestAssured.given;
import org.testng.annotations.Test;
import io.restassured.RestAssured;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
public class NewTest {
   @Test
   public void jsonValue() {

      //base URI with Rest Assured class
      RestAssured.baseURI = "https://run.mocky.io/v3";

      //obtain Response from GET request
      Response res = given()
      .when()
      .get("/8ec8f4f7-8e68-4f4b-ad18-4f0940d40bb7");

      //convert JSON to string
      JsonPath j = new JsonPath(res.asString());

      //get a field value from nested JSON
      String p = j.getString("Items.Price");
      System.out.println("Price is: " + p);
   }
}
How does a process look like in memory?

A program loaded into memory and executing is called a process. In simple, a process is a program in execution.
When a program is created then it is just some pieces of Bytes which is stored in Hard Disk as a passive entity. Then the program starts loading in memory and become an active entity, when a program is double-clicked in windows or entering the name of the executable file on the command line. (i.e. a.out or prog.exe)
Let’s look at each memory segment and how does a process look like within memory −
Figure: Process in Memory
A process is more than the program code or a code segment is known as Text Section. This section of memory contains the executable instructions of a program. It also contains constants, macros and it is read-only segment to prevent accidentally modification of an instruction. It is also sharable so that the so that another process can use this whenever it is required.
Next Data Section segment of memory contains the global and static variables that are initialized by the programmer prior to the execution of a program. This segment is not read-only, as the value of the variables can be changed at the runtime.
For an Example in C program −
#include<stdio.h>
int b;//will be stored in data section
int main(){
   static int a; //will be stored in data section
   return;
}
To allocate memory for variables whose size cannot be statically determined by the compiler before program execution, requested by the programmer, there is a requirement of dynamic allocation of memory which is done in heap segment. It can be only determined at run-time. It is managed via system calls to malloc, calloc, free, delete etc. An C example: malloc(2) return the starting address of the 2 BYTE block which is in heap area.
A process generally also includes the process stack, which contains temporary data i.e. function parameters, return addresses, and local variables. On the standard x86 architecture it grows downwards to lower addresses but on some other architectures it may grow the opposite direction.it is shown in the diagram that stack grows opposite direction of heap for avoiding overlapping problem. This section is committed to store all the data needed by a function call in a program.
A stack pointer register keeps the tracks of the top of the stack i.e., how much of the stack area using by the current process, and it is modified each time a value is “pushed” onto the stack. If the stack pointer meets the heap pointer the available free memory is depleted.
Perform Multi-table delete in MySQL

For this, you can use DELETE command. Let us first create a table −
mysql> create table DemoTable1
(
   Id int,
   Name varchar(20)
);
Query OK, 0 rows affected (0.63 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable1 values(1,'Chris');
Query OK, 1 row affected (0.30 sec)
mysql> insert into DemoTable1 values(2,'David');
Query OK, 1 row affected (0.15 sec)
mysql> insert into DemoTable1 values(3,'Bob');
Query OK, 1 row affected (0.20 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable1;
This will produce the following output −
+------+-------+
| Id   | Name  |
+------+-------+
|    1 | Chris |
|    2 | David |
|    3 | Bob   |
+------+-------+
3 rows in set (0.00 sec)
Here is the query to create second table −
mysql> create table DemoTable2
(
   ClientId int,
   ClientName varchar(20)
);
Query OK, 0 rows affected (1.19 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable2 values(101,'Mike');
Query OK, 1 row affected (0.10 sec)
mysql> insert into DemoTable2 values(110,'Bob');
Query OK, 1 row affected (0.13 sec)
mysql> insert into DemoTable2 values(120,'Adam');
Query OK, 1 row affected (0.60 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable2;
This will produce the following output −
+----------+------------+
| ClientId | ClientName |
+----------+------------+
|      101 | Mike       |
|      110 | Bob        |
|      120 | Adam       |
+----------+------------+
3 rows in set (0.00 sec)
Here is the query for multi-table delete −
mysql> delete from DemoTable1 where Name='Bob';
Query OK, 1 row affected (0.23 sec)
mysql> delete from DemoTable2 where ClientName='Bob';
Query OK, 1 row affected (0.27 sec)
Let us check the first table records −
mysql> select *from DemoTable1;
This will produce the following output −
+------+-------+
| Id   | Name  |
+------+-------+
| 1    | Chris |
| 2    | David |
+------+-------+
2 rows in set (0.00 sec)
Let us check the second table records −
mysql> select *from DemoTable2;
This will produce the following output −
+----------+------------+
| ClientId | ClientName |
+----------+------------+
|      101 | Mike       |
|      120 | Adam       |
+----------+------------+
2 rows in set (0.00 sec)
What is hysteresis thresholding? How can it be achieved using scikit-learn in Python?

Hysteresis refers to the lagging effect of a result. With respect to threshold, hysteresis refers to the areas that are above a specific low threshold value or above high threshold values. It refers to areas that are highly-confident in nature.
With the help of hysteresis, the noise outside the edges of the object in the image can be ignored.
Let us see how hysteresis threshold can be achieved using scikit-learn library:
import matplotlib.pyplot as plt
from skimage import data, filters
fig, ax = plt.subplots(nrows=2, ncols=2)
orig_img = data.coins()
edges = filters.sobel(orig_img)
low = 0.1
high = 0.4
lowt = (edges > low).astype(int)
hight = (edges > high).astype(int)
hyst = filters.apply_hysteresis_threshold(edges, low, high)
ax[0, 0].imshow(orig_img, cmap='gray')
ax[0, 0].set_title('Original image')
ax[0, 1].imshow(edges, cmap='magma')
ax[0, 1].set_title('Sobel edges')
ax[1, 0].imshow(lowt, cmap='magma')
ax[1, 0].set_title('Low threshold')
ax[1, 1].imshow(hight + hyst, cmap='magma')
ax[1, 1].set_title('Hysteresis threshold')
for a in ax.ravel():
a.axis('off')
plt.tight_layout()
plt.show()
The required libraries are imported.
The required libraries are imported.
The subplot function is used to set the plot area before plotting the images on the console.
The subplot function is used to set the plot area before plotting the images on the console.
The ‘coin’ data already present in scikit-learn package is used as input.
The ‘coin’ data already present in scikit-learn package is used as input.
The ‘sobel’ filter is used to get the ‘sobel’ image of the input, wherein the edges are emphasized in the resultant image
The ‘sobel’ filter is used to get the ‘sobel’ image of the input, wherein the edges are emphasized in the resultant image
The function ‘apply_hysteresis_threshold’ is used to get values above and below a certain threshold.
The function ‘apply_hysteresis_threshold’ is used to get values above and below a certain threshold.
This data is displayed on the console using the function ‘imshow’.
This data is displayed on the console using the function ‘imshow’.
Perl Conditional Statements - IF...ELSE

Perl conditional statements helps in the decision making, which require that the programmer specifies one or more conditions to be evaluated or tested by the program, along with a statement or statements to be executed if the condition is determined to be true, and optionally, other statements to be executed if the condition is determined to be false.
Following is the general from of a typical decision making structure found in most of the programming languages −
The number 0, the strings '0' and "" , the empty list () , and undef are all false in a boolean context and all other values are true. Negation of a true value by ! or not returns a special false value.
Perl programming language provides the following types of conditional statements.
An if statement consists of a boolean expression followed by one or more statements.
An if statement can be followed by an optional else statement.
An if statement can be followed by an optional elsif statement and then by an optional else statement.
An unless statement consists of a boolean expression followed by one or more statements.
An unless statement can be followed by an optional else statement.
An unless statement can be followed by an optional elsif statement and then by an optional else statement.
With the latest versions of Perl, you can make use of the switch statement. which allows a simple way of comparing a variable value against various conditions.
Let's check the conditional operator ? :which can be used to replace if...else statements. It has the following general form −
Exp1 ? Exp2 : Exp3;

Where Exp1, Exp2, and Exp3 are expressions. Notice the use and placement of the colon.
The value of a ? expression is determined like this: Exp1 is evaluated. If it is true, then Exp2 is evaluated and becomes the value of the entire ? expression. If Exp1 is false, then Exp3 is evaluated and its value becomes the value of the expression. Below is a simple example making use of this operator −
#!/usr/local/bin/perl
 
$name = "Ali";
$age = 10;

$status = ($age > 60 )? "A senior citizen" : "Not a senior citizen";

print "$name is  - $status\n";
This will produce the following result −
Ali is - Not a senior citizen


    46 Lectures 
     4.5 hours 

 Devi Killada

    11 Lectures 
     1.5 hours 

 Harshit Srivastava

    30 Lectures 
     6 hours 

 TELCOMA Global

    24 Lectures 
     2 hours 

 Mohammad Nauman

    68 Lectures 
     7 hours 

 Stone River ELearning

    58 Lectures 
     6.5 hours 

 Stone River ELearning
 Print
 Add Notes
 Bookmark this page
Node.js stream.Readable.from() Method - GeeksforGeeks

11 Oct, 2021
The stream.Readable.from() method is an inbuilt application programming interface of the Stream module which is used to construct Readable Streams out of iterators.
Syntax:
stream.Readable.from( iterable, options )
Parameters: This method accept two parameters as mentioned above and described below:
iterable: It is an object which implements the Symbol.asyncIterator or Symbol.iterator iterable protocol.
options: It is an options provided to the new stream.Readable([options]). By default, the Readable.from() method will set options.objectMode to true, unless its not set to false manually.
Return Value: It returns stream.Readable.
Below examples illustrate the use of stream.Readable.from() method in Node.js:
Example 1:
// Node.js program to demonstrate the     // stream.Readable.from() method  // Constructing readable from streamconst { Readable } = require('stream');  // Using async functionasync function * generate() {  yield 'GfG';  yield 'CS-Portal...';}// Using stream.Readable.from() methodconst readable = Readable.from(generate());  // Handling data eventreadable.on('data', (chunk) => {  console.log(chunk);});console.log("Program completed!!");
Output:
Program completed!!
GfG
CS-Portal...

Example 2:
// Node.js program to demonstrate the     // stream.Readable.from()// method  // Constructing readable from streamconst { Readable } = require('stream');  // Using async functionasync function * generate() {  yield 'Nidhi';  yield 'GeeksforGeeks';}// Using stream.Readable.from() methodconst readable = Readable.from(generate());  // Handling data eventreadable.on('data', (chunk) => {  console.log(chunk.length);});console.log("Program completed!!");
Output:
Program completed!!
5
13

Reference: https://nodejs.org/api/stream.html#stream_stream_readable_from_iterable_options
Node.js-Stream-module
Node.js
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Express.js express.Router() Function
Mongoose Populate() Method
Express.js req.params Property
Mongoose find() Function
How to connect Node.js with React.js ?
Express.js express.Router() Function
How to set input type date in dd-mm-yyyy format using HTML ?
Differences between Functional Components and Class Components in React
How to create footer to stay at the bottom of a Web page?
Convert a string to an integer in JavaScript