code-rag-bench/online-tutorials huggingface dataset:
Loader in C/C++

18 Nov, 2018
Loader is the program of the operating system which loads the executable from the disk into the primary memory(RAM) for execution. It allocates the memory space to the executable module in main memory and then transfers control to the beginning instruction of the program .
Example:
akash @aix(/ u / akash) #cat./ ak1.cpp#include<stdio.h>int main(){    printf("Testing of Loader !");    return 0;}
Compiling by xlC compiler:
akash @aix(/ u / akash) #xlC – o ak1.out./ ak1.cpp akash @aix(/ u / akash) #ls – lrt ak1 * -rw – rw – r– 1 akash dev 74 Nov 12 06 : 10 ak1.cpp– rwxrwxr – x 1 akash dev 8562 Nov 12 06 : 34 ak1.out akash @aix(/ u / akash) #
What really happens while running the executable: One could also use strace command for the same.
akash@aix(/u/akash)# truss ./ak1.outexecve(“./ak1.out”, 0x2FF20A00, 0x200138A8) argc: 1read_sysconfig(0xF06F8278, 0x00000010, 0xFFFFFFF9, 0x10000000, 0x200007BC, 0x000000C0, 0x06010000, 0xF076A0F0) = 0x00000000sbrk(0x00000000) = 0x20000998vmgetinfo(0x2FF20350, 7, 16) = 0sbrk(0x00000000) = 0x20000998sbrk(0x00000008) = 0x20000998__libc_sbrk(0x00000000) = 0x200009A0loadquery(2, 0x200009C8, 0x00001000) = 0__loadx(0x0A040000, 0xF06F599C, 0x00000000, 0xF05BE208, 0x20001D20) = 0xF05BFD64loadbind(0, 0xF0760BBC, 0xF06D0E54) = 0kfcntl(0, F_GETFL, 0x00000000) = 67110914kfcntl(1, F_GETFL, 0x00000000) = 67110914kfcntl(2, F_GETFL, 0x00000000) = 67110914kfcntl(2, F_GETFL, 0x00000000) = 67110914kioctl(1, 22528, 0x00000000, 0x00000000) = 0Testing of Loader !kwrite(1, ” T e s t i n g o f L”.., 19) = 19kfcntl(1, F_GETFL, 0x00000070) = 67110914kfcntl(2, F_GETFL, 0x2FF22FFC) = 67110914_exit(0)
The first call which is displayed is ‘execve()‘ which actually is the loader . This loader creates the process which involves:
Reading the file and creating an address space for the process.
Page table entries for the instructions, data and program stack are created and the register set is initialized.
Then, Executes a jump instruction to the first instruction of the program which generally causes a page fault and the first page of your instructions is brought into memory.
Below two points are not related to loader and are for just more information:
Another thing we got is the kwrite call with the argument value which one passed to the printf function in our program. kwrite is system call which actually gets called from the printf function with the value passed to it and this is function is responsible to display the value to console with value passed to it.
We also got the _exit(0) call at last instruction which is the _exit system call with argument status as 0 which signifies to return back to operating system with successful signal. This _exit got called from return(0) statement.
system-programming
C Language
C++
Compiler Design
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Teradata - Table Types

Teradata supports the following table types to hold temporary data.
Derived Table
Volatile Table
Global Temporary Table
Derived tables are created, used and dropped within a query. These are used to store intermediate results within a query.
The following example builds a derived table EmpSal with records of employees with salary greater than 75000.
SELECT 
Emp.EmployeeNo, 
Emp.FirstName, 
Empsal.NetPay 
FROM 
Employee Emp, 
(select EmployeeNo , NetPay 
from Salary
where NetPay >= 75000) Empsal 
where Emp.EmployeeNo = Empsal.EmployeeNo;
When the above query is executed, it returns the employees with salary greater than 75000.
*** Query completed. One row found. 3 columns returned. 
*** Total elapsed time was 1 second. 
 EmployeeNo            FirstName               NetPay 
-----------  ------------------------------  ----------- 
    103                  Peter                 83000 

Volatile tables are created, used and dropped within a user session. Their definition is not stored in data dictionary. They hold intermediate data of the query which is frequently used. Following is the syntax.
CREATE [SET|MULTISET] VOALTILE TABLE tablename 
<table definitions> 
<column definitions> 
<index definitions> 
ON COMMIT [DELETE|PRESERVE] ROWS

CREATE VOLATILE TABLE dept_stat ( 
   dept_no INTEGER, 
   avg_salary INTEGER, 
   max_salary INTEGER, 
   min_salary INTEGER 
) 
PRIMARY INDEX(dept_no) 
ON COMMIT PRESERVE ROWS;
When the above query is executed, it produces the following output.
*** Table has been created. 
*** Total elapsed time was 1 second.

The definition of Global Temporary table is stored in data dictionary and they can be used by many users/sessions. But the data loaded into global temporary table is retained only during the session. You can materialize up to 2000 global temporary tables per session. Following is the syntax.
CREATE [SET|MULTISET] GLOBAL TEMPORARY TABLE tablename 
<table definitions> 
<column definitions> 
<index definitions> 

CREATE SET GLOBAL TEMPORARY TABLE dept_stat ( 
   dept_no INTEGER, 
   avg_salary INTEGER, 
   max_salary INTEGER, 
   min_salary INTEGER 
) 
PRIMARY INDEX(dept_no);
When the above query is executed, it produces the following output.
*** Table has been created. 
*** Total elapsed time was 1 second.

 Print
 Add Notes
 Bookmark this page
C++ String Library - back

It returns a reference to the last character of the string.
Following is the declaration for std::string::back.
char& back();
const char& back() const;
none
It returns a reference to the last character of the string.
if an exception is thrown, there are no changes in the string.
In below example for std::string::back.
#include <iostream>
#include <string>

int main () {
   std::string str ("sairamkrishna mammahe.");
   str.back() = '!';
   std::cout << str << '\n';
   return 0;
}
sairamkrishna mammahe!

 Print
 Add Notes
 Bookmark this page
Disable a dropdown item with Bootstrap

To disable to dropdown item in Bootstrap, use the .disabled class with the .dropdown-menu class.
You can try to run the following code to disable dropdown item −
Live Demo
<!DOCTYPE html>
<html>
   <head>
      <title>Bootstrap Example</title>
      <link href = "/bootstrap/css/bootstrap.min.css" rel = "stylesheet">
      <script src = "/scripts/jquery.min.js"></script>
      <script src = "/bootstrap/js/bootstrap.min.js"></script>
   </head>
   <body>
      <div class = "container">
         <h2>Beverages</h2>
         <p>The following are the beverages available in India:</p>
         <div class = "dropdown">
            <button class = "btn btn-primary dropdown-toggle" type = "button" data-toggle="dropdown">Beverages
            <span class="caret"></span></button>
            <ul class = "dropdown-menu">
               <li><a href = "#">Gatorade</a></li>
               <li class = "disabled"><a href = "#">Sting</a></li>
               <li><a href = "#">Red Bull</a></li>
               <li><a href = "#">Pepsi</a></li>
               <li><a href = "#">Coca Cola</a></li>
            </ul>
         </div>
      </div>
   </body>
</html>
Lodash _.range() Method - GeeksforGeeks

09 Sep, 2020
Lodash is a JavaScript library that works on the top of underscore.js. Lodash helps in working with arrays, strings, objects, numbers, etc.
The _.range() method is used to create an array of numbers progressing from the given start value up to, but not including the end value. A step of -1 is used if a negative value of start is specified without an end or step. If the end is not specified, it’s set to start with the start then set to 0.
Syntax:
_.range( start, end, step )
Parameters: This method accepts three parameters as mentioned above and described below:
start: It is a number that specifies the start of the range. It is an optional value. The default value is 0.
end: It is a number that specifies the end of the range.
step: It is a number that specifies the amount that the value in the range is incremented or decremented. The default value is 1.
Return Value: It returns an array with the given range of numbers.
Example 1:
Javascript
// Requiring the lodash library  const _ = require("lodash");                // Using the _.range() method let range_arr = _.range(5);         // Printing the output  console.log(range_arr);
Output:
[0, 1, 2, 3, 4]

Example 2:
Javascript
// Requiring the lodash library  const _ = require("lodash");                // Using the _.range() method// with the step taken as 2let range_arr = _.range(0,10,2);         // Printing the output  console.log(range_arr);
Output:
[0, 2, 4, 6, 8]

Example 3:
Javascript
// Requiring the lodash library  const _ = require("lodash");                // Using the _.range() method// with the step taken as -2let range_arr = _.range(-1,-11,-2);         // Printing the output  console.log(range_arr);
Output:
[-1, -3, -5, -7, -9]

JavaScript-Lodash
JavaScript
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Difference between var, let and const keywords in JavaScript
Difference Between PUT and PATCH Request
How to detect browser or tab closing in JavaScript ?
How to get character array from string in JavaScript?
How to filter object array based on attributes?
Roadmap to Become a Web Developer in 2022
Installation of Node.js on Linux
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?
jQuery | blur() with Examples - GeeksforGeeks

12 Feb, 2019
The blur() is an inbuilt method is jQuery that is used to remove focus from the selected element. This method start the blur event or it can be attached a function to run when a blur event occurs.Syntax:
$(selector).blur(function)

Parameter: It accepts an optional parameter “function”.Return Value: It does not return anything, it simply trigger the blur event on the selected element.
<html>  <head>    <script src="https://ajax.googleapis.com/ajax/libs/               jquery/3.3.1/jquery.min.js"></script>    <script>        $(document).ready(function() {            $("#btn").click(function() {                $("input").blur();                $("p").html("This is blur method that is used!!!");            });        });    </script></head>  <body>    <!--enter value and click on the button -->    Enter Value:    <input type="text">    <br>    <br>    <button id="btn">start blur event!!!</button>    <p style="color:green"></p></body>  </html>
Output:Before entering any value to the “Enter Value” box-After entering a value of “GeeksforGeeks” to the “Enter Value” box-After clicking the “start blur event” button-
Code #2:In the below code, function is passed to the blur method.
<html>  <head>    <script src="https://ajax.googleapis.com/ajax/libs/             jquery/3.3.1/jquery.min.js"></script>    <script>        <!-- jQuery code to show blur method -->        $(document).ready(function() {            $("input").blur(function() {                $(this).css("background-color", "#ADFF2F");            });        });    </script></head>  <body>    <!-- Enter a value to the field and click outside         to see the change -->    Enter Value:    <input type="text" name="fullname"></body>  </html>
Output:Before entering any value to the “Enter Value” box-
After entering a value of “GeeksforGeeks” to the “Enter Value” box-
After clicking the mouse button anywhere on the screen-
jQuery-Events
JavaScript
JQuery
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
Difference between var, let and const keywords in JavaScript
How to calculate the number of days between two dates in javascript?
Differences between Functional Components and Class Components in React
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 ?
Groovy - split()

Splits this String around matches of the given regular expression.
String[] split(String regex)

regex - the delimiting regular expression.
It returns the array of strings computed by splitting this string around matches of the given regular expression.
Following is an example of the usage of this method −
class Example {
   static void main(String[] args) {
      String a = "Hello-World";
      String[] str;
      str = a.split('-');
      
      for( String values : str )
      println(values);
   } 
}
When we run the above program, we will get the following result −
Hello 
World 


    52 Lectures 
     8 hours 

 Krishna Sakinala

    49 Lectures 
     2.5 hours 

 Packt Publishing
 Print
 Add Notes
 Bookmark this page
Node.js vs Java - GeeksforGeeks

08 Jun, 2021
Node.js: Node.js a library that is used to create runtime applications. It was initially written by Rayn Dahl for using the JavaScript outside the browser and later on it was managed by Joyent. Node.js is used for both front-end and back-end and developers can build mobile applications as well. With its capabilities, It can handle the server-side, a user can request a packet and at the same time, it can access the database. JavaScript has plenty of frameworks that are based on Express.js and Node.js. But when depending on the type of application these frameworks are decided to be used. This is an advantage of node.js that it can connect to devices using APIs and can connect to libraries written in other languages too.Example: Printing ‘Welcome to GeeksforGeeks’ in Node.js.  
javascript
// Syntax to printconsole.log("Welcome to GeeksforGeeks");
Java: Java was developed at Sun Microsystems by James Gosling and later on, Oracle took it over. Java is an object-oriented language whose most of its syntax is derived from C++ and its concepts remain the same with some modifications. Whole Java comes in a bundle with JDK called Java Development Kit, and it is enough for a java program to be get run. The code written in Java is converted into byte code which can be run on any machine irrespective of the operating system that has Java and this one of the biggest advantages of this language. Java has a huge community, and it supports networking and GUI. Many games are built on Java and are used extensively. Several frameworks are built on Java for web development, for Server-sideexample Spring.Example: Printing ‘Welcome to GeeksforGeeks’ in Java.  
Java
// Syntax to printSystem.out.println("Welcome to GeeksforGeeks");
Difference between Node.js and Java:  
 
divyak
roneetmichael
Node.js-Misc
Difference Between
Java
JavaScript
Node.js
Web Technologies
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Difference between var, let and const keywords in JavaScript
Difference Between Method Overloading and Method Overriding in Java
Difference between Prim's and Kruskal's algorithm for MST
Difference between Internal and External fragmentation
Difference between Compile-time and Run-time Polymorphism in Java
Arrays in Java
Split() String method in Java with examples
For-each loop in Java
Stream In Java
Object Oriented Programming (OOPs) Concept in Java
Find rows which are not in other dataframe in R - GeeksforGeeks

07 Apr, 2021
To find rows present in one dataframe that are not present in the other is known as set-difference. In this article, we will see different ways to do the same.
In this method simply the sql query to find set-difference is passed
Syntax:
sqldf(“sql query”)
Our query will be sqldf(‘SELECT * FROM df1 EXCEPT SELECT * FROM df2’). It will exclude all the rows from df1 that are also present in df2 and will return only rows that are only present in df1.
Example 1:
R
require(sqldf)df1 <- data.frame(a = 1:5, b=letters[1:5])df2 <- data.frame(a = 1:3, b=letters[1:3])  print("df1 is ")print(df1)  print("df2 is ")print(df2)  res <- sqldf('SELECT * FROM df1 EXCEPT SELECT * FROM df2')print("rows from df1 which are not in df2")print(res)
Example 2:
R
require(sqldf)df1 <- data.frame(name = c("kapil","sachin","rahul"), age=c(23,22,26))df2 <- data.frame(name = c("kapil"), age = c(23))  print("df1 is ")print(df1)  print("df2 is ")print(df2)  res <- sqldf('SELECT * FROM df1 EXCEPT SELECT * FROM a2')print("rows from df1 which are not in df2")print(res)
This is an R built-in function to find the set difference of two dataframes.
Syntax:
setdiff(df1,df2)
It will return rows in df1 that are not present in df2.
Example 1:
R
df1 <- data.frame(a = 1:5, b=letters[1:5], c= c(1,3,5,7,9))df2 <- data.frame(a = 1:5, b=letters[1:5], c = c(2,4,6,8,10))  print("df1 is ")print(df1)  print("df2 is ")print(df2)  res <-setdiff(df1, df2)print("rows from df1 which are not in df2")print(res)
Output:
Example 2:
R
df1 <- data.frame(name = c("kapil","sachin","rahul"), age=c(23,22,26))df2 <- data.frame(name = c("kapil","rahul", "sachin"), age = c(23, 22, 26))  print("df1 is ")print(df1)  print("df2 is ")print(df2)  res <- setdiff(df1, df2)print("rows from df1 which are not in df2")print(res)
Output:
Picked
R DataFrame-Programs
R-DataFrame
R Language
R Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Change Color of Bars in Barchart using ggplot2 in R
How to Change Axis Scales in R Plots?
Group by function in R using Dplyr
How to Split Column Into Multiple Columns in R DataFrame?
How to filter R DataFrame by values in a column?
How to Split Column Into Multiple Columns in R DataFrame?
How to filter R DataFrame by values in a column?
How to filter R dataframe by multiple conditions?
Replace Specific Characters in String in R
Convert Matrix to Dataframe in R
How to use Selenium webdriver to click google search?

We can click on Google search with Selenium webdriver. First of all we need to identify the search edit box with help of any of the locators like id, class,name, xpath or css.
Then we will input some text with the sendKeys() method. Next we have to identify the search button with help of any of the locators like id, class, name, xpath or css and finally apply click() method on it or directly apply submit() method. We will wait for the search results to appear with presenceOfElementLocatedexpected condition.
We need to import org.openqa.selenium.support.ui.ExpectedConditions and import org.openqa.selenium.support.ui.WebDriverWait to incorporate expected
conditions and WebDriverWait class. This concept comes from the explicit wait condition in synchronization.
Let us try to implement the below scenario.
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 org.openqa.selenium.support.ui.WebDriverWait;
import org.openqa.selenium.support.ui.ExpectedConditions;

public class SearchAction{
   public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver","C:\\Users\\ghs6kor\\Desktop\\Java\\chromedriver.exe");
      WebDriver driver = new ChromeDriver();
      driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
      driver.get("https://www.google.com/");
      // identify element
      WebElement p=driver.findElement(By.name("q"));
      //enter text with sendKeys() then apply submit()
      p.sendKeys("Selenium Java");
      // Explicit wait condition for search results
      WebDriverWait w = new WebDriverWait(driver, 5);
      w.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//ul")));
      p.submit();
      driver.close();
   }
}
Obtain the Previous Index and Next Index in an ArrayList using the ListIterator in Java

The previous index and next index in an ArrayList can be obtained using the methods previousIndex() and nextIndex() respectively in the ListIterator Interface.
The previousIndex() method returns the index of the element that is returned by the previous() method while the nextIndex() method returns the index of the element that is returned by the next() method. Neither of these methods require any parameters.
A program that demonstrates this is given as follows
 Live Demo
import java.util.ArrayList;
import java.util.ListIterator;
public class Demo {
   public static void main(String[] args) {
      ArrayList<String> aList = new ArrayList<String>();
      aList.add("Amy");
      aList.add("Peter");
      aList.add("Justin");
      aList.add("Emma");
      aList.add("James");
      System.out.println("The ArrayList elements are: "+ aList);
      ListIterator<String> li = aList.listIterator();
      System.out.println("The previous index is: " + li.previousIndex());
      System.out.println("The next index is: " + li.nextIndex());
   }
}
The output of the above program is as follows
The ArrayList elements are: [Amy, Peter, Justin, Emma, James]
The previous index is: -1
The next index is: 0
Now let us understand the above program.
The ArrayList is created and ArrayList.add() is used to add the elements to the ArrayList. Then the ArrayList elements are displayed. The previous index and next index in an is obtained using the methods previousIndex() and nextIndex() respectively. A code snippet which demonstrates this is as follows
ArrayList<String> aList = new ArrayList<String>();
aList.add("Amy");
aList.add("Peter");
aList.add("Justin");
aList.add("Emma");
aList.add("James");
System.out.println("The ArrayList elements are: "+ aList);
ListIterator<String> li = aList.listIterator();
System.out.println("The previous index is: " + li.previousIndex());
System.out.println("The next index is: " + li.nextIndex());
Finding gcd of two strings in JavaScript

In the number system, the Greatest Common Divisor (GCD) of two numbers is that greatest number which divides both the numbers. Similarly, if we apply this concept to strings, the gcd of two strings is the greatest substring (greatest in length) that is present in both the strings.
For example −
If the two strings are −
const str1 = 'abcabc';
const str2 = 'abc';
Then the gcd of these strings will be −
const gcd = 'abc';
We are required to write a JavaScript function that takes in two strings str1 and str2 and computes and returns their gcd.
The code for this will be −
 Live Demo
const str1 = 'abcabc';
const str2 = 'abc';
const findGCD = (str1 = '', str2 = '') => {
   if (str1 + str2 !== str2 + str1){
      // not possible
      // no common element
      return "";
   } else if (str1 == str2){
      return str1;
   } else if (str1.length > str2.length){
      return findGCD(str1.slice(str2.length), str2);
   } else {
      return findGCD(str2.slice(str1.length), str1);
   }
};
console.log(findGCD(str1, str2));
And the output in the console will be −
abc
Find the next occurrence of pattern in string in Julia - findnext() Method - GeeksforGeeks

23 Feb, 2021
The findnext() is an inbuilt function in julia that is used to return the next occurrence of the specified pattern in a specified string starting from the specified position. 
Syntax: 
findnext(pattern::AbstractString, string::AbstractString, start::Integer)
Parameters:  
pattern::AbstractString: Specified pattern
string::AbstractString: Specified string
start::Integer: It is the start position from where matching going to be performed.
Returns: It returns the next occurrence of the specified pattern in a specified string starting from the specified position.  Example 1: 
Python
# Julia program to illustrate# the use of String findnext() method  # Here the pattern is "g", String is# "geeks" and position is 1Println(findnext("g", "geeks", 1)) # Here the pattern is "G", String is# "GeeksforGeeks" and position is 6Println(findnext("G", "GeeksforGeeks", 6)) # Here the pattern is "e", String is# "GeeksforGeeks" and position is 5Println(findnext("G", "GeeksforGeeks", 5)) # Here the pattern is "k", String is# "GeeksforGeeks" and position is 2Println(findnext("G", "GeeksforGeeks", 2))
Output:  
Example 2: 
Python
# Julia program to illustrate# the use of String findnext() method  # Here the pattern is "23", String is# "12345" and position is 1Println(findnext("23", "12345", 1)) # Here the pattern is "23", String is# "12345" and position is 2Println(findnext("23", "12345", 2)) # Here the pattern is "3", String is# "12345" and position is 5Println(findnext("3", "12345", 5)) # Here the pattern is "123", String is# "123123123" and position is 4Println(findnext("123", "123123123", 4))
Output:  
 
arorakashish0911
Julia
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Get array dimensions and size of a dimension in Julia - size() Method
Searching in Array for a given element in Julia
Find maximum element along with its index in Julia - findmax() Method
Get number of elements of array in Julia - length() Method
Exception handling in Julia
Getting the maximum value from a list in Julia - max() Method
Working with Excel Files in Julia
Decision Making in Julia (if, if-else, Nested-if, if-elseif-else ladder)
Working with Date and Time in Julia
Getting the absolute value of a number in Julia - abs() Method
Multiply two polynomials in C++

The coefficients of each term of the polynomial are given in an array. We need to multiply the two polynomials. Let's see an example.
Input
A = [1, 2, 3, 4]
B = [4, 3, 2, 1]
Output
4x6 + 11x5 + 20x4 + 30x3 + 20x2 + 11x1 + 4
Initialise two polynomials.
Initialise two polynomials.
Create a new array with a length of two polynomials.
Create a new array with a length of two polynomials.
Iterate over the two polynomials.Take one term from the first polynomial and multiply it with all the terms in the second polynomial.Store the result in the resultant polynomial.
Iterate over the two polynomials.
Take one term from the first polynomial and multiply it with all the terms in the second polynomial.
Take one term from the first polynomial and multiply it with all the terms in the second polynomial.
Store the result in the resultant polynomial.
Store the result in the resultant polynomial.
Following is the implementation of the above algorithm in C++
#include <bits/stdc++.h>
using namespace std;
int *multiplyTwoPolynomials(int A[], int B[], int m, int n) {
   int *productPolynomial = new int[m + n - 1];
   for (int i = 0; i < m + n - 1; i++) {
      productPolynomial[i] = 0;
   }
   for (int i = 0; i < m; i++) {
      for (int j = 0; j < n; j++) {
         productPolynomial[i + j] += A[i] * B[j];
      }
   }
   return productPolynomial;
}
void printPolynomial(int polynomial[], int n) {
   for (int i = n - 1; i >= 0; i--) {
      cout << polynomial[i];
      if (i != 0) {
         cout << "x^" << i;
         cout << " + ";
      }
   }
   cout << endl;
}
int main() {
   int A[] = {1, 2, 3, 4};
   int B[] = {4, 3, 2, 1};
   int m = 4;
   int n = 4;
   cout << "First polynomial: ";
   printPolynomial(A, m);
   cout << "Second polynomial: ";
   printPolynomial(B, n);
   int *productPolynomial = multiplyTwoPolynomials(A, B, m, n);
   cout << "Product polynomial: ";
   printPolynomial(productPolynomial, m + n - 1);
   return 0;
}
If you run the above code, then you will get the following result.
First polynomial: 4x^3 + 3x^2 + 2x^1 + 1
Second polynomial: 1x^3 + 2x^2 + 3x^1 + 4
Product polynomial: 4x^6 + 11x^5 + 20x^4 + 30x^3 + 20x^2 + 11x^1 + 4
Address of a function in C or C++ - GeeksforGeeks

20 May, 2018
We all know that code of every function resides in memory and so every function has an address like all others variables in the program. We can get the address of a function by just writing the function’s name without parentheses. Please refer function pointer in C for details.
Address of function main() is 004113C0Address of function funct() is 00411104
In C/C++, name of a function can be used to find address of function.
// C program to addresses of a functions// using its name#include<stdio.h>  void funct(){    printf("GeeksforGeeks");}  int main(void){    printf("address of function main() is :%p\n", main);    printf("address of function funct() is : %p\n", funct);    return 0;}
address of function main() is :0x40053c
address of function funct() is : 0x400526

C-Functions
C Language
C++
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
TCP Server-Client implementation in C
Multithreading in C
Exception Handling in C++
Arrow operator -> in C/C++ with Examples
'this' pointer in 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
Float floatToIntBits() method in Java with examples

26 Oct, 2018
The floatToIntBits() method in Float Class is a built-in function in java that returns a representation of the specified floating-point value according to the IEEE 754 floating-point “single format” bit layout.
Syntax:
public static int floatToIntBits(float val)

Parameter: The method accepts only one parameter val which specifies a floating-point number to be converted into integer bits.
Return Values: The function returns the integer bits that represent the floating-point number. Below are the special cases:
If the argument is positive infinity, the result is 0x7f800000.
If the argument is negative infinity, the result is 0xff800000.
If the argument is NaN, the result is 0x7fc00000.
Below programs illustrates the use of Float.floatToIntBits() method:
Program 1:
// Java program to demonstrate// Float.floatToIntBits() methodimport java.lang.*;  class Gfg1 {      public static void main(String args[])    {          float val = 1.5f;          // function call        int answer = Float.floatToIntBits(val);          // print        System.out.println(val + " in int bits: "                           + answer);    }}
1.5 in int bits: 1069547520

Program 2:
// Java program to demonstrate// Float.floatToIntBits() method  import java.lang.*;  class Gfg1 {      public static void main(String args[])    {          float val = Float.POSITIVE_INFINITY;        float val1 = Float.NEGATIVE_INFINITY;        float val2 = Float.NaN;          // function call        int answer = Float.floatToIntBits(val);          // print        System.out.println(val + " in int bits: "                           + answer);          // function call        answer = Float.floatToIntBits(val1);          // print        System.out.println(val1 + " in int bits: "                           + answer);          // function call        answer = Float.floatToIntBits(val);          // print        System.out.println(val2 + " in int bits: "                           + answer);    }}
Infinity in int bits: 2139095040
-Infinity in int bits: -8388608
NaN in int bits: 2139095040

Reference: https://docs.oracle.com/javase/7/docs/api/java/lang/Float.html#floatToIntBits(float)
java-basics
Java-Float
Java-Functions
Java-lang package
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to iterate any Map in Java
HashMap in Java with Examples
ArrayList in Java
Collections in Java
Stream In Java
Multidimensional Arrays in Java
Singleton Class in Java
Set in Java
Stack Class in Java
Initialize an ArrayList in Java
How to center the absolutely positioned element in div using CSS ?

03 Nov, 2021
In this article, we will know how to centre the absolutely positioned element using the <div> tag in CSS, & will understand their implementation through the examples. Sometimes we need to place an element into the centre with absolute position, relative to its nearest positioned ancestor in HTML to make it look more presentable. For centring an absolute positioned element in div we use the following examples.
Example 1: This example demonstrates the centring of an absolute positioned element using the <div> tag.
HTML
<!DOCTYPE html><html> <head>    <style>    #content {        position: absolute;        left: 50%;        transform: translateX(-50%)    }    </style></head> <body>    <div id="content">        <img src="https://media.geeksforgeeks.org/wp-content/cdn-uploads/20190710102234/download3.png" />    </div></body> </html>
Output: Here, the left is given 50% to place it in the centre horizontal. Transform is used to pull back the item with half of its width to place it exactly in the centre from the middle of the element. left: 50% is relative to the parent element while the translate transform is relative to the elements width/height.
Example 2: This example demonstrates the centring of the absolutely positioned element in horizontal & vertical directions in the <div> tag.
HTML
<!DOCTYPE html><html> <head>    <style>    .content {        height: 400px;        position: relative;        border: 4px solid green;    }         .content img {        margin: 0;        position: absolute;        top: 50%;        left: 50%;        -ms-transform: translate(-50%, -50%);        transform: translate(-50%, -50%);    }    </style></head> <body>     <p>        Centering an absolute positioned        element inside a div both horizontally        and vertically    </p>     <div class="content">        <img src="https://media.geeksforgeeks.org/wp-content/cdn-uploads/20190710102234/download3.png" />    </div></body> </html>
Output: Here left and the top is given 50% to place it in the centre horizontally and vertically. Transform is used to pull back the item with half of its width to place it exactly in the centre from the middle of the element. Therefore transform: translate is given -50% for both horizontal and vertical to adjust it centrally.
ysachin2314
sweetyty
bhaskargeeksforgeeks
CSS-Misc
HTML-Misc
Picked
CSS
HTML
Web Technologies
Web technologies Questions
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python | Convert case of elements in a list of strings

13 Feb, 2019
Given a list of strings, write a Python program to convert all string from lowercase/uppercase to uppercase/lowercase.
Input : ['GeEk', 'FOR', 'gEEKS']
Output: ['geeks', 'for', 'geeks']

Input : ['fun', 'Foo', 'BaR']
Output: ['FUN', 'FOO', 'BAR']
 Method #1 : Convert Uppercase to Lowercase using map function
# Python code to convert all string# from uppercase to lowercase.  # Using map functionout = map(lambda x:x.lower(), ['GeEk', 'FOR', 'gEEKS'])  # Converting it into listoutput = list(out)  # printing outputprint(output)
['geek', 'for', 'geeks']

 Method #2: Convert Lowercase to Uppercase using List comprehension
# Python code to convert all string# from uppercase to lowercase.  # Initialisationinput = ['fun', 'Foo', 'BaR']  # Convertinglst = [x.upper() for x in input]  # printing outputprint(lst)
['FUN', 'FOO', 'BAR']

Python list-programs
python-list
python-string
Python
Python Programs
python-list
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
Python String | replace()
How to Install PIP on Windows ?
Defaultdict in Python
Python | Get dictionary keys as a list
Python | Convert a list to dictionary
Python | Convert string dictionary to dictionary
Python Program for Fibonacci numbers
Python | Split list into lists by particular value

25 Apr, 2019
The splitting of lists is quite common utility nowadays and there can be many applications and use cases of the same. Along with these always come the variations. One such variation can be split the list by particular value. Let’s discuss a certain way in which list split can be performed.
Method : Using list comprehension + zip() + slicing + enumerate()
This problem can be solved in two parts, in first part we get the index list by which split has to be performed using enumerate function. And then we can join the values according to the indices using zip and list slicing.
# Python3 code to demonstrate# Split list into lists by particular value# Using list comprehension + zip() + slicing + enumerate()  # initializing listtest_list = [1, 4, 5, 6, 4, 5, 6, 5, 4]  # printing original listprint("The original list : " + str(test_list))  # using list comprehension + zip() + slicing + enumerate()# Split list into lists by particular valuesize = len(test_list)idx_list = [idx + 1 for idx, val in            enumerate(test_list) if val == 5]    res = [test_list[i: j] for i, j in        zip([0] + idx_list, idx_list +         ([size] if idx_list[-1] != size else []))]  # print resultprint("The list after splitting by a value : " + str(res))
The original list : [1, 4, 5, 6, 4, 5, 6, 5, 4]
The list after splitting by a value : [[1, 4, 5], [6, 4, 5], [6, 5], [4]]

 
Python list-programs
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Different ways to create Pandas Dataframe
Enumerate() in Python
Python String | replace()
How to Install PIP on Windows ?
Defaultdict in Python
Python | Get dictionary keys as a list
Python | Convert a list to dictionary
Python Program for Fibonacci numbers
Python | Convert string dictionary to dictionary
How to pass an array by value in C ?

21 Dec, 2018
In C, array name represents address and when we pass an array, we actually pass address and the parameter receiving function always accepts them as pointers (even if we use [], refer this for details).
How to pass array by value, i.e., how to make sure that we have a new copy of array when we pass it to function?This can be done by wrapping the array in a structure and creating a variable of type of that structure and assigning values to that array. After that, passing the variable to some other function and modifying it as per requirements. Note that array members are copied when passed as parameter, but dynamic arrays are not. So this solution works only for non-dynamic arrays (created without new or malloc).
Let’s see an example to demonstrate the above fact using a C program:
// C program to demonstrate passing an array// by value using structures.#include<stdio.h>#include<stdlib.h>  # define SIZE 5  // A wrapper for array to make sure that array// is passed by value.struct ArrayWrapper{    int arr[SIZE];};  // An array is passed by value wrapped in tempvoid modify(struct ArrayWrapper temp){    int *ptr = temp.arr;    int i;      // Display array contents    printf("In 'modify()', before modification\n");    for (i = 0; i < SIZE; ++i)        printf("%d ", ptr[i]);      printf("\n");      // Modify the array    for (i = 0; i < SIZE; ++i)        ptr[i] = 100; // OR *(ptr + i)      printf("\nIn 'modify()', after modification\n");    for (i = 0; i < SIZE; ++i)        printf("%d ", ptr[i]); // OR *(ptr + i)}  // Driver codeint main(){    int i;    struct ArrayWrapper obj;    for (i=0; i<SIZE; i++)        obj.arr[i] = 10;      modify(obj);      // Display array contents    printf("\n\nIn 'Main', after calling modify() \n");    for (i = 0; i < SIZE; ++i)        printf("%d ", obj.arr[i]); // Not changed      printf("\n");      return 0;}
Output:
In 'modify()', before modification
10 10 10 10 10 

In 'modify()', after modification
100 100 100 100 100 

In 'Main', after calling modify() 
10 10 10 10 10 

This article is contributed by MAZHAR IMAM KHAN. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
C-Arrays
C Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Substring in C++
Function Pointer in C
Left Shift and Right Shift Operators in C/C++
std::string class in C++
Unordered Sets in C++ Standard Template Library
rand() and srand() in C/C++
Enumeration (or enum) in C
What is the purpose of a function prototype?
C Language Introduction
Command line arguments in C/C++
queue::swap() in C++ STL

08 Aug, 2019
Queue is also an abstract data type or a linear data structure, which follows a particular order in which the operations are performed. The order is First In First Out (FIFO). In a FIFO data structure, the first element added to the queue will be the first one to be removed.
queue::swap()swap() function is used to exchange the contents of two queues but the queues must be of same type, although sizes may differ.
Syntax:
queue1.swap(queue2)
            OR
swap(queue1, queue2)

Parameters:
queue1 is the first queue object.
queue2 is the second queue object.

Return value: None
Examples:
Input :  queue1 = {1, 2, 3, 4}
         queue2 = {5, 6, 7, 8}
         queue1.swap(queue2);
Output : queue1 = {5, 6, 7, 8}
         queue2 = {1, 2, 3, 4}

Input  : queue1 = {'a', 'b', 'c', 'd', 'e'}
         queue2 = {'f', 'g', 'h', 'i'}
         queue1.swap(queue2);
Output : queue1 = {'f', 'g', 'h', 'i'}
         queue2 = {'a', 'b', 'c', 'd', 'e'}

Errors and Exceptions
1. It throws an error if the queues are not of the same type.2. It has a basic no exception throw guarantee otherwise.
// CPP program to illustrate// Implementation of swap() function#include <bits/stdc++.h>using namespace std;  int main(){    // Take any two queues    queue<char> queue1, queue2;    int v = 96;    for (int i = 0; i < 5; i++) {      queue1.push(v + 1);      v++;    }     for (int i = 0; i < 4; i++) {      queue2.push(v + 1);      v++;    }            // Swap elements of queues    queue1.swap(queue2);      // Print the first queue    cout << "queue1 = ";    while (!queue1.empty()) {      cout << queue1.front() << " ";      queue1.pop();   }      // Print the second set    cout << endl << "queue2 = ";    while (!queue2.empty()) {      cout << queue2.front() << " ";      queue2.pop();   }              return 0;}
Output:
queue1 = f g h i 
queue2 = a b c d e 

Time complexity: Linear i.e. O(n)
AnshumanSrivastava1
cpp-queue
STL
C++
STL
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Sorting a vector in C++
Polymorphism in C++
std::string class in C++
Friend class and function in C++
Pair in C++ Standard Template Library (STL)
Queue in C++ Standard Template Library (STL)
Unordered Sets in C++ Standard Template Library
List in C++ Standard Template Library (STL)
std::find in C++
Inline Functions in C++
What is first child in CSS ?

15 Mar, 2021
The first-child is a pseudo class in CSS which represents the first element among a group of sibling elements. The :first-child Selector is used to target the first child element of it’s parent for styling.
Syntax:
:first-child {
 //property
}
Example:
HTML
<!DOCTYPE html> <html>     <head>     <style>         p:first-child {             background: limegreen;             color: white;             font-style: italic;             font-size: 1.875em;         }     </style> </head>     <body>     <p>I am first child.</p>    <p>I am second child.</p>    <p>I am third child.</p>    <p>I am last child.</p></body>   </html> 
Output:
CSS-Questions
CSS-Selectors
Picked
CSS
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Design a Tribute Page using HTML & CSS
How to set space between the flexbox ?
Build a Survey Form using HTML and CSS
Design a web page using HTML and CSS
Form validation using jQuery
Installation of Node.js on Linux
Difference between var, let and const keywords in JavaScript
How to fetch data from an API in ReactJS ?
Differences between Functional Components and Class Components in React
Remove elements from a JavaScript Array
Python program to Recursively scrape all the URLs of the website - GeeksforGeeks

26 Mar, 2020
In this tutorial we will see how to we can recursively scrape all the URLs from the website
Recursion in computer science is a method of solving a problem where the solution depends on solutions to smaller instances of the same problem. Such problems can generally be solved by iteration, but this needs to identify and index the smaller instances at programming time.
Note: For more information, refer to Recursion
Requests :Requests allows you to send HTTP/1.1 requests extremely easily. There’s no need to manually add query strings to your URLs.pip install requests
pip install requests
Beautiful Soup:Beautiful Soup is a library that makes it easy to scrape information from web pages. It sits atop an HTML or XML parser, providing Pythonic idioms for iterating, searching, and modifying the parse tree.pip install beautifulsoup4
pip install beautifulsoup4
Code :
from bs4 import BeautifulSoupimport requests   # listsurls=[]   # function createddef scrape(site):           # getting the request from url    r = requests.get(site)           # converting the text    s = BeautifulSoup(r.text,"html.parser")           for i in s.find_all("a"):                  href = i.attrs['href']                   if href.startswith("/"):            site = site+href                           if site not in  urls:                urls.append(site)                 print(site)                # calling it self                scrape(site)   # main functionif __name__ =="__main__":       # website to be scrape    site="http://example.webscraping.com//"       # calling function    scrape(site)    
Output :
python-utility
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
response.ok - Python requests - GeeksforGeeks

31 Jul, 2020
response.ok returns True if status_code is less than 400, otherwise False. Python requests are generally used to fetch the content from a particular resource URI. Whenever we make a request to a specified URI through Python, it returns a response object. Now, this response object would be used to access certain features such as content, headers, etc. This article revolves around how to check the response.ok out of a response object.
To illustrate use of response.ok, let’s ping geeksforgeeks.org. To run this script, you need to have Python and requests installed on your PC.
Download and Install Python 3 Latest Version
How to install requests in Python – For windows, linux, mac
# import requests moduleimport requests  # Making a get requestresponse = requests.get('https://api.github.com/')  # print responseprint(response)  # print if status code is less than 400print(response.ok)
Save above file as request.py and run using
Python request.py

Check that True which matches the condition of request being less than or equal to 400.
There are many libraries to make an HTTP request in Python, which are httplib, urllib, httplib2, treq, etc., but requests is the one of the best with cool features. If any attribute of requests shows NULL, check the status code using below attribute.
requests.status_code
If status_code doesn’t lie in range of 200-29. You probably need to check method begin used for making a request + the url you are requesting for resources.
Python-requests
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()