code-rag-bench/online-tutorials huggingface dataset:
Decimal.Multiply() Method in C#

The Decimal.Add() method in C# is used to multiply two specified Decimal values.
Following is the syntax −
public static decimal Multiply (decimal val1, decimal val2);
Above, va1 is the multiplicand, whereas val2 is the multiplier.
Let us now see an example to implement the Decimal.Multiply() method −
using System;
public class Demo {
   public static void Main(){
      Decimal val1 = 3.45m;
      Decimal val2 = 2.35m;
      Console.WriteLine("Decimal 1 = "+val1);
      Console.WriteLine("Decimal 2 = "+val2);
      Decimal res = Decimal.Multiply(val1, val2);
      Console.WriteLine("Result (Multiplication) = "+res);
   }
}
This will produce the following output −
Decimal 1 = 3.45
Decimal 2 = 2.35
Result (Multiplication) = 8.1075
Let us now see another example to implement the Decimal.Multiply() method −
using System;
public class Demo {
   public static void Main(){
      Decimal val1 = Decimal.MinValue;
      Decimal val2 = 1.21m;
      Console.WriteLine("Decimal 1 = "+val1);
      Console.WriteLine("Decimal 2 = "+val2);
      Decimal res = Decimal.Multiply(val1, val2);
      Console.WriteLine("Result (Multiplication) = "+res);
   }
}
This will produce the following output displaying exception that the value exceeded for decimal −
Decimal 1 = -79228162514264337593543950335
Decimal 2 = 1.21
Run-time exception (line 13): Value was either too large or too small for a Decimal.
Stack Trace:
[System.OverflowException: Value was either too large or too small for a Decimal.]
   at System.Decimal.FCallMultiply(Decimal& d1, Decimal& d2)
   at System.Decimal.Multiply(Decimal d1, Decimal d2)
   at Demo.Main() :line 13
Update each element in tuple list in Python

When it is required to update every element in a tuple list (i.e list of tuples), list comprehension can be used.
The list comprehension is a shorthand to iterate through the list and perform operations on it.
Below is a demonstration of the same −
Live Demo
my_list_1 = [(7, 8, 0), (3, 45, 3), (2, 22,4)]

print ("The list of tuple is : " )
print(my_list_1)
element_to_add = 41

my_result = [tuple(j + element_to_add for j in sub ) for sub in my_list_1]

print("List of tuple after update is : ")
print(my_result)
The list of tuple is :
[(7, 8, 0), (3, 45, 3), (2, 22, 4)]
List of tuple after update is :
[(48, 49, 41), (44, 86, 44), (43, 63, 45)]
A list of tuple is defined, and is displayed on the console.
An element that needs to be added to the list of tuple is defined.
This list of tuple is iterated over, and the element is added to every tuple in the list of tuples.
This result is assigned to a value.
It is displayed as output on the console.
How to create a Box (3D) in JavaFX?

A box is a three-dimensional shape with a length (depth), width, and a height. In JavaFX a box is represented by the javafx.scene.shape.Box class. This class contains 3 properties they are −
depth − This property represents depth of the box, you can set value to this property using the setDepth() method.
depth − This property represents depth of the box, you can set value to this property using the setDepth() method.
height − This property represents the height of the box, you can set value to this property using the setHeight() method.
height − This property represents the height of the box, you can set value to this property using the setHeight() method.
width − This property represents the width of the box, you can set value to this property using the setWidth() method.
width − This property represents the width of the box, you can set value to this property using the setWidth() method.
To create a 3D Box you need to −
Instantiate this class.
Instantiate this class.
Set the required properties using the setter methods or, by passing them as arguments to the constructor.
Set the required properties using the setter methods or, by passing them as arguments to the constructor.
Add the created node (shape) to the Group object.
Add the created node (shape) to the Group object.
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.PerspectiveCamera;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.scene.paint.PhongMaterial;
import javafx.stage.Stage;
import javafx.scene.shape.Box;
import javafx.scene.shape.CullFace;
import javafx.scene.shape.DrawMode;
public class DrawingBox extends Application {
   public void start(Stage stage) {
      //Drawing a Box
      Box cube = new Box();
      //Setting the properties of the Box(cube)
      cube.setDepth(150.0);
      cube.setHeight(150.0);
      cube.setWidth(150.0);
      //Setting other properties
      cube.setCullFace(CullFace.BACK);
      cube.setDrawMode(DrawMode.FILL);
      PhongMaterial material = new PhongMaterial();
      material.setDiffuseColor(Color.BROWN);
      cube.setMaterial(material);
      //Translating the box
      cube.setTranslateX(300.0);
      cube.setTranslateY(150.0);
      cube.setTranslateZ(150.0);
      //Setting the perspective camera
      PerspectiveCamera cam = new PerspectiveCamera();
      cam.setTranslateX(-150);
      cam.setTranslateY(25);
      cam.setTranslateZ(150);
      //Setting the Scene
      Group root = new Group(cube);
      Scene scene = new Scene(root, 595, 300, Color.BEIGE);
      scene.setCamera(cam);
      stage.setTitle("Drawing A Cube");
      stage.setScene(scene);
      stage.show();
   }
   public static void main(String args[]){
      launch(args);
   }
}
PrintWriter close() method in Java with Examples - GeeksforGeeks

31 Jan, 2019
The close() method of PrintWriter Class in Java is used to close the stream. Closing a stream deallocates any value in it or any resources associated with it. The PrintWriter instance once closed won’t work. Also a PrintWriter instance once closed cannot be closed again.
Syntax:
public void close()
Parameters: This method do not accepts any parameter.
Return Value: This method do not returns any value. It just closes the Stream.
Below methods illustrates the working of close() method:
Program 1:
// Java program to demonstrate// PrintWriter close() method  import java.io.*;  class GFG {    public static void main(String[] args)    {          // The string to be written in the Writer        String str = "GeeksForGeeks";          try {              // Create a PrintWriter instance            PrintWriter writer                = new PrintWriter(System.out);              // Write the above string to this writer            // This will put the string in the stream            // till it is printed on the console            writer.write(str);              // Now close the stream            // using close() method            writer.close();        }        catch (Exception e) {            System.out.println(e);        }    }}
GeeksForGeeks

Program 2:
// Java program to demonstrate// PrintWriter close() method  import java.io.*;  class GFG {    public static void main(String[] args)    {          try {              // Create a PrintWriter instance            PrintWriter writer                = new PrintWriter(System.out);              // Write the char to this writer            // This will put the char in the stream            // till it is printed on the console            writer.write(65);              // Now close the stream            // using close() method            writer.close();        }        catch (Exception e) {            System.out.println(e);        }    }}
A

Java-Functions
Java-IO package
Java-PrintWriter
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Object Oriented Programming (OOPs) Concept in Java
HashMap in Java with Examples
Interfaces in Java
Stream In Java
How to iterate any Map in Java
ArrayList in Java
Initialize an ArrayList in Java
Stack Class in Java
Multidimensional Arrays in Java
Singleton Class in Java
p5.js | strokeCap() Function - GeeksforGeeks

05 Sep, 2019
The strokeCap() function in p5.js is used to set the style of line endings. The ends of line can be rounded, squared or extended based on their parameters SQUARE, PROJECT, and ROUND. The default value is ROUND.
Syntax:
strokeCap( cap )
Parameters: This function accepts single parameter cap which holds the style of end of line (ROUND, SQUARE or PROJECT).
Example: This example shows all the different kinds of line ending edges.
function setup() {      // Create canvas of given size    createCanvas(400, 400);}  function draw() {      // Set the background color    background(50);      // Set the weight of line stroke    strokeWeight(15);      // Set the color of line stroke    stroke(20, 250, 100);      // Set different edges style    strokeCap(SQUARE);    line(100, 200, 300, 200);      strokeCap(ROUND);    line(100, 100, 300, 100);      strokeCap(PROJECT);    line(100, 300, 300, 300);}
Output:
Reference: https://p5js.org/reference/#/p5/strokeCap
JavaScript-p5.js
JavaScript
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
Difference between var, let and const keywords in JavaScript
Differences between Functional Components and Class Components in React
How to calculate the number of days between two dates in javascript?
Remove elements from a JavaScript Array
Installation of Node.js on Linux
Convert a string to an integer in JavaScript
How to fetch data from an API in ReactJS ?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
GATE | GATE-CS-2004 | Question 23 - GeeksforGeeks

28 Jun, 2021
Identify the correct translation into logical notation of the following assertion.
"Some boys in the class are taller than all the girls" 
Note : taller(x,y) is true if x is taller than y.
(A) (∃x) (boy(x) → (∀y) (girl(y) ∧ taller(x,y)))(B) (∃x) (boy(x) ∧ (∀y) (girl(y) ∧ taller(x,y)))(C) (∃x) (boy(x) → (∀y) (girl(y) → taller(x,y)))(D) (∃x) (boy(x) ∧ (∀y) (girl(y) → taller(x,y)))Answer: (D)Explanation:Now many people get confused when to use ∧ and when to use →. This question tests exactly that.
We use ∧ when we want to say that the both predicates in this statement are always true, no matter what the value of x is.We use → when we want to say that although there is no need for left predicate to be true always, but whenever it becomes true, right predicate must also be true.
D means there exist some boys x which taller than all girls y.
Quiz of this Question
GATE-CS-2004
GATE-GATE-CS-2004
GATE
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
GATE | Gate IT 2007 | Question 25
GATE | GATE-CS-2001 | Question 39
GATE | GATE-CS-2000 | Question 41
GATE | GATE-CS-2005 | Question 6
GATE | GATE MOCK 2017 | Question 21
GATE | GATE-CS-2006 | Question 47
GATE | GATE MOCK 2017 | Question 24
GATE | Gate IT 2008 | Question 43
GATE | GATE-CS-2009 | Question 38
GATE | GATE-CS-2003 | Question 90
_Find_first() function in C++ bitset with Examples - GeeksforGeeks

03 Dec, 2019
The _Find_first() is a built-in function in C++ Biteset class which returns an integer that refers the position of first set bit in bitset. If there isn’t any set bit, _Find_first() will return the size of the bitset.
Syntax:
iterator bitset._Find_first()
           or
int bitset._Find_first()

Parameters: The function accepts no parameter.
Return Value: The function returns an integer which refers to the position of first set bit in bitset. If there isn’t any set bit, _Find_first() will return the size of the bitset.
Below is the illustration of the above function:
// C++ program for illustration// of _Find_first() function  #include <bits/stdc++.h>using namespace std;  #define M 32  int main(){    // default constructor initializes with all bits 0    bitset<M> bset;    bitset<M> bset1;      // 00000000000000000000000000100000    bset[5] = 1;      // 00000000000000000000010000100000    bset[10] = 1;      // function returns the first set bit in Bitset    cout << "position of first set bit in bset\n";    cout << bset._Find_first() << "\n";      // function returns bset1.size()    // when no bit is set in bitset.    cout << "position of first set bit in bset1\n";    cout << bset1._Find_first() << "\n";      return 0;}
position of first set bit in bset
5
position of first set bit in bset1
32

Reference: https://gcc.gnu.org/onlinedocs/libstdc++/libstdc++-html-USERS-3.4/bitset-source.html
CPP-bitset
CPP-Functions
C++
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Operator Overloading in C++
Polymorphism in C++
Sorting a vector in C++
Friend class and function in C++
std::string class in C++
Pair in C++ Standard Template Library (STL)
Queue in C++ Standard Template Library (STL)
Inline Functions in C++
Array of Strings in C++ (5 Different Ways to Create)
Convert string to char array in C++
PHP | array_diff() function - GeeksforGeeks

23 Oct, 2019
The array_diff() is an inbuilt function in PHP ans is used to calculate the difference between two or more arrays. This function computes difference according to the values of the elements, between one or more array and return differences in the form of a new array. This function basically returns all the entries that are present in the first array which are not present in any other arrays.
Syntax:
array_diff($array1, $array2, $array3, ...,$arrayn)

Parameters: The function can take any number of arrays as parameters needed to be compared.
Return Type: This function compares the first array in parameters with rest of the arrays and returns an array containing all the entries from $array1 that are not present in any of the other arrays.
Examples:
Input :  $array1 = ('a', 'b', 'c');
         $array2 = ('a', 'd', 'e');
         $array3 = ('a', 'b', 'f');
         array_diff($array1, $array2, $array3); 
Output :
         Array
         (
           [2] => c
         )

Input : $array1 = ('a', 'b', 'a');
        $array2 = ('a', 'd', 'e');
Output :
         Array
         (
           [1] => b
         )

Below program illustrates the working of array_diff() in PHP:
<?php// PHP code to illustrate the working of array_diff()function Difference($array1, $array2, $array3){    return(array_diff($array1, $array2, $array3));}  // Driver Code$array1 = array('a', 'b', 'c', 'd', 'e', 'f');$array2 = array('a', 'b', 'g', 'h');$array3 = array('a', 'f', 'i');print_r(Difference($array1, $array2, $array3));?>
Output:
Array
(
    [2] => c
    [3] => d
    [4] => e
)

Important points to note:
It compares the elements in their string representation. That is, 1 and ‘1’ are both equal for array_diff().
The number of repetition of element in first array doesn’t matter. That is if an element occurs 3 times in $array1 and only 1 time in other arrays then all of the 3 occurrences of that element in first array will be omitted in output.
For multi-dimensional arrays, we need to compare each of the dimensions separately. For example:- $array1[2],$array2[2] etc.
Reference: http://php.net/manual/en/function.array-diff.php
Akanksha_Rai
PHP-array
PHP-function
PHP
Web Technologies
PHP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to execute PHP code using command line ?
How to Insert Form Data into Database using PHP ?
How to convert array to string in PHP ?
PHP in_array() Function
How to pop an alert message box using PHP ?
Remove elements from a JavaScript Array
Installation of Node.js on Linux
Convert a string to an integer in JavaScript
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?
turtle.circle() method in Python - GeeksforGeeks

01 Aug, 2020
The Turtle module provides turtle graphics primitives, in both object-oriented and procedure-oriented ways. Because it uses Tkinter for the underlying graphics, it needs a version of Python installed with Tk support.
This method is used to draw a circle with a given radius.
Syntax: turtle.circle(radius, extent=None, steps=None)
Parameters: 
radius: Radius of the circle.
extent: The part of the circle in degrees as an arc.
steps: Divide the shape in the equal number of given steps.
Below is the implementation of the above method with some examples :
Example 1:
Python3
# importing turtle packageimport turtle  # draw circle of radius # 80 pixelturtle.circle(80)
Output :
Example 2:
Python3
# importing turtle packageimport turtle  # draw circle of radius 80 # pixel and extent = 180# so it draw half circleturtle.circle(80,               extent = 180)
Output :
Example 3:
Python3
# importing turtle packageimport turtle  # draw circle of radius 80# pixel and steps = 5# so it draw pentagon with# equal length 5 sidesturtle.circle(80,               steps = 5)
Output :
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
Defaultdict in Python
Create a directory in Python
Python | Pandas dataframe.groupby()
Scala Map remove() method with example - GeeksforGeeks

13 Aug, 2019
The remove() method is utilized to remove a key from the map and return its value only.
Method Definition: def remove(key: A): Option[B]
Return Type: It returns the value of the key present in the above method as argument.
Example #1:
// Scala program of remove()// method  // Creating objectobject GfG{       // Main method    def main(args:Array[String])    {              // Creating map        val m1 = scala.collection.mutable.Map("geeks" -> 5,                                     "for" -> 3, "cs" -> 2)                  // Applying remove method        val result = m1.remove("for")                  // Displays output        println(result)          }}
Some(3)

We use mutable map here, as remove method is a member of mutable map.Example #2:
// Scala program of remove()// method  // Creating objectobject GfG{       // Main method    def main(args:Array[String])    {              // Creating map        val m1 = scala.collection.immutable.Map("geeks" -> 5,                                         "for" -> 3, "cs" -> 2)                  // Applying remove method        val result = m1.remove("for")                  // Displays output        println(result)          }}
prog.scala:16: error: value remove is not a member of scala.collection.immutable.Map[String, Int]val result = m1.remove(“for”)^one error found
So, if we use immutable map then there is a compile time error.
Scala
Scala-Map
Scala-Method
Scala
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Type Casting in Scala
Class and Object in Scala
Scala Lists
Scala Tutorial – Learn Scala with Step By Step Guide
Inheritance in Scala
Operators in Scala
Scala Constructors
Scala | Arrays
Scala String substring() method with example
Lambda Expression in Scala
Insert NULL value into INT column in MySQL?

You can insert NULL value into an int column with a condition i.e. the column must not have NOT NULL constraints. The syntax is as follows.
INSERT INTO yourTableName(yourColumnName) values(NULL);
To understand the above syntax, let us first create a table. The query to create a table is as follows.
mysql> create table InsertNullDemo
-> (
-> StudentId int,
-> StudentName varchar(100),
-> StudentAge int
-> );
Query OK, 0 rows affected (0.53 sec)
Here is the query to insert NULL whenever you do not pass any value for column. Here this column is StudentAge. MySQL inserts null value by default. The query to insert records is as follows.
mysql> insert into InsertNullDemo(StudentId,StudentName) values(101,'Mike');
Query OK, 1 row affected (0.19 sec)

mysql> insert into InsertNullDemo values(101,'Mike',NULL);
Query OK, 1 row affected (0.24 sec)
Display all records from the table to check the NULL value is inserted or not into INT column. The query is as follows.
mysql> select *from InsertNullDemo;
The following is the output displaying NULL in INT column.
+-----------+-------------+------------+
| StudentId | StudentName | StudentAge |
+-----------+-------------+------------+
| 101       | Mike       | NULL       |
| 101       | Mike       | NULL       |
+-----------+-------------+------------+
2 rows in set (0.00 sec)
Printing Integer between Strings in Java - GeeksforGeeks

11 Dec, 2018
Try to figure out the output of this code:
public class Test{    public static void main(String[] args)    {        System.out.println(45+5 + "=" +45+5);    }}
Output:
50=455
The reason behind this is – Initially the integers are added and  we get the L.H.S. as 50. But, as soon as a string is encountered it is appended and we get “50=” . Now the integers after ‘=’ are also considered as a string  and so are appended.
To make the output 50=50, we need to add a bracket around the sum statement to overload the concatenation operation.
This will enforce the sum to happen before string concatenation as bracket as the highest precedence.
public class Test{    public static void main(String[] args)    {        System.out.println(45+5 + "=" +(45+5));    }}
Output:
50=50
This article is contributed by Himanshi Gupta. If you like GeeksforGeeks and would like to contribute, you can also write an article and 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
Java-Integer
Java-String-Programs
Java-Strings
Java
Java-Strings
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Object Oriented Programming (OOPs) Concept in Java
HashMap in Java with Examples
Stream In Java
Interfaces in Java
How to iterate any Map in Java
Initialize an ArrayList in Java
ArrayList in Java
Stack Class in Java
Singleton Class in Java
Multidimensional Arrays in Java
How to sort an ArrayList in Java in ascending order?

You can sort an ArrayList using the sort() method of the Collections class this method accepts a list object as a parameter and sorts the contents of it in ascending order.
Example:
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.Set;

public class ArrayListSample {
   public static void main(String[] args) {
      ArrayList<String> list = new ArrayList<String>();
      list.add("JavaFx");
      list.add("Java");
      list.add("WebGL");
      list.add("OpenCV");
      Set<String> set = new LinkedHashSet<String>(list);
      Collections.sort(list);
      System.out.println(list);
   }
}
Output:
[Java, JavaFx, OpenCV, WebGL]
How to use Box Component in ReactJS? - GeeksforGeeks

18 Jan, 2021
The Box component serves as a wrapper component for most of the CSS utility needs. Material UI for React has this component available for us and it is very easy to integrate. We can use the Box component in ReactJS using the following approach.
Creating React Application And Installing Module:
Step 1: Create a React application using the following command:
npx create-react-app foldername
Step 2: After creating your project folder i.e. foldername, move to it using the following command:
cd foldername
Step 3: After creating the ReactJS application, Install the material-ui modules using the following command:
npm install @material-ui/core
Project Structure: It will look like the following.
Project Structure
App.js: Now write down the following code in the App.js file. Here, App is our default component where we have written our code.
Javascript
import React from 'react'import Box from '@material-ui/core/Box';  const App = () => {    return (    <div style={{ marginLeft: '40%', marginTop: '60px', width: '30%' }}>    <Box color="white" bgcolor="palevioletred" p={1}>      Greetings from GeeksforGeeks!    </Box>    </div>  );}  export default App
Step to Run Application: Run the application using the following command from the root directory of the project:
npm start
Output: Now open your browser and go to http://localhost:3000/, you will see the following output:
Box Component Output
JavaScript
ReactJS
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
Difference between var, let and const keywords in JavaScript
Differences between Functional Components and Class Components in React
How to append HTML code to a div using JavaScript ?
How to fetch data from an API in ReactJS ?
How to redirect to another page in ReactJS ?
How to pass data from child component to its parent in ReactJS ?
How to pass data from one component to other component in ReactJS ?
Create a Responsive Navbar using ReactJS
Difference between next() and nextLine() methods in Java - GeeksforGeeks

27 Dec, 2021
The Scanner class in java.util package used for obtaining the input of the primitive types like int, double, etc. and strings. It is the easiest way to read input in a Java program, though not very efficient if you want an input method for scenarios where time is a constraint like in competitive programming. The scanner class consists next() and nextLine() methods. In this article, the difference between these two methods is discussed. 
next() Method: The next() method in java is present in the Scanner class and is used to get the input from the user. In order to use this method, a Scanner object needs to be created. This method can read the input only until a space(” “) is encountered. In other words, it finds and returns the next complete token from the scanner. 
The following is an example of how the next() method is implemented in Java: 
Java
// Java program to demonstrate// the next() method import java.util.Scanner; class GFG {    public static void main(String[] args)    {        // Creating the Scanner object        Scanner sc = new Scanner(System.in);         // Use of the next() method        String Input = sc.next();        System.out.println(Input);    }}
Input: 
Geeks for  
geeks
Output:  
Geeks
nextLine() Method: The nextLine() method in java is present in the Scanner class and is used to get the input from the user. In order to use this method, a Scanner object needs to be created. This method can read the input till the end of line. In other words, it can take input until the line change or new line and ends input of getting ‘\n’ or press enter. The following is an example of how the nextLine() method is implemented in Java:
Java
// Java program to demonstrate// the nextLine() method import java.util.Scanner; class GFG {    public static void main(String[] args)    {        // Creating the object of the        // Scanner class        Scanner sc = new Scanner(System.in);         // Use of nextLine() method        String Input = sc.nextLine();        System.out.println(Input);    }}
Input: 
Geeks for  
geeks
Output:  
Geeks for 
The following table describes the difference between the next() and the nextLine() method:
 
gulshankumarar231
Input and Output
Java-Scanner
Difference Between
Java
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
Object Oriented Programming (OOPs) Concept in Java
Arrays.sort() in Java with examples
sdiff command in Linux with Examples - GeeksforGeeks

27 May, 2019
sdiff command in linux is used to compare two files and then writes the results to standard output in a side-by-side format. It displays each line of the two files with a series of spaces between them if the lines are identical. It displays greater than sign if the line only exists in the file specified by the File2 parameter, and a | (vertical bar) for lines that are different.
Syntax:
sdiff [  -l | -s ] [  -o OutFile ] [  -w Number ] File1 File2
Example:Text File 1:
Geeks
For 
Geeks

A 
Computer
Science
Portal
For
Geeks

Text File 2:
Geeks
For 
Geeks

Technical
Scripter
2018

Options of sdiff command:
sdiff -l file1 file2 : It displays only the left side when lines are identical.
sdiff -s file1 file2 : It does not display the identical identical lines.
sdiff -w Number file1 file2 : It sets the width of the output line. The default value of the Number variable is 130 characters. The maximum width of the Number variable is 2048. The minimum width of the Number variable is 20. The sdiff command uses 2048 if a value greater than 2048 is specified.
sdiff -o OutFile file1 file2 : Creates a third file, specified by the OutFile variable, by a controlled line-by-line merging of the two files specified by the File1 and the File2 parameters. The following subcommands govern the creation of this file:Output File:Geeks
For 
Geeks

--- geek1.txt 5, 10
A 
Computer
Science
Portal
For
Geeks
+++ geek2.txt 5, 8
Technical
Scripter
2018

Geeks
For 
Geeks

--- geek1.txt 5, 10
A 
Computer
Science
Portal
For
Geeks
+++ geek2.txt 5, 8
Technical
Scripter
2018

Reference: https://www.tecmint.com/linux-sdiff-command-examples/
linux-command
Linux-file-commands
Picked
Technical Scripter 2018
Linux-Unix
Technical Scripter
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
scp command in Linux with Examples
Docker - COPY Instruction
mv command in Linux with examples
SED command in Linux | Set 2
chown command in Linux with Examples
nohup Command in Linux with Examples
Named Pipe or FIFO with example C program
Thread functions in C/C++
uniq Command in LINUX with examples
Start/Stop/Restart Services Using Systemctl in Linux
How to add a new class to an element that already has a class using jQuery ? - GeeksforGeeks

31 Dec, 2020
In this article, we will learn to add a new class to an element that already has a class using jQuery. To add a new class, we use jQuery addClass() method. The addClass() method is used to add more classes and their attributes to each selected element. It can also be used to change the property of the selected element.
Syntax:
$(selector).addClass(className);
Parameters: It accepts a parameter “className”, the name of the new class that is to be added.
Example:
HTML
<!DOCTYPE html><html lang="en">  <head>    <style>        .GFG1 {            color: green;            font-weight: bold;        }          .GFG2 {            font-size: 24px;        }    </style>      <!-- Import jQuery cdn library -->    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">    </script>      <script>        $(document).ready(function () {            $("button").click(function () {                $("p").addClass("GFG2");            });        });    </script></head>  <body style="text-align: center;">    <h1 style="color: green;">        GeeksforGeeks    </h1>      <h3>        How to add a new class to an element that        <br>already has a class using jQuery?    </h3>      <p class="GFG1">        GeeksforGeeks computer science portal    </p>      <button>Click Here!</button></body>  </html>
Output:
Before Click the Button:
After Click Button:
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.
CSS-Misc
HTML-Misc
jQuery-Misc
CSS
HTML
JQuery
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to apply style to parent if it has child with CSS?
Types of CSS (Cascading Style Sheet)
How to position a div at the bottom of its container using CSS?
Design a web page using HTML and CSS
How to Upload Image into Database and Display it using PHP ?
How to set the default value for an HTML <select> element ?
Hide or show elements in HTML using display property
How to set input type date in dd-mm-yyyy format using HTML ?
How to Insert Form Data into Database using PHP ?
REST API (Introduction)
Python - Elements with same index - GeeksforGeeks

11 Oct, 2020
Given a List, get all elements which are at its index value.
Input : test_list = [3, 1, 8, 5, 4, 10, 6, 9] Output : [1, 4, 6] Explanation : These elements are at same position as its number.
Input : test_list = [3, 10, 8, 5, 14, 10, 16, 9] Output : [] Explanation : No number at its index. 
Method #1: Using loop
In this, we check for each element, if it equates to its index, it’s added to result list.
Python3
# Python3 code to demonstrate working of # Elements with same index# Using loop  # initializing listtest_list = [3, 1, 2, 5, 4, 10, 6, 9]  # printing original listprint("The original list is : " + str(test_list))  # enumerate to get index and elementres = []for idx, ele in enumerate(test_list):    if idx == ele:        res.append(ele)  # printing result print("Filtered elements : " + str(res))
The original list is : [3, 1, 2, 5, 4, 10, 6, 9]
Filtered elements : [1, 2, 4, 6]


Method #2 : Using list comprehension + enumerate()
In this, we perform a similar function as the above method, change being we use list comprehension to make the solution compact.
Python3
# Python3 code to demonstrate working of # Elements with same index# Using list comprehension + enumerate()  # initializing listtest_list = [3, 1, 2, 5, 4, 10, 6, 9]  # printing original listprint("The original list is : " + str(test_list))  # enumerate to get index and elementres = [ele for idx, ele in enumerate(test_list) if idx == ele]  # printing result print("Filtered elements : " + str(res))
The original list is : [3, 1, 2, 5, 4, 10, 6, 9]
Filtered elements : [1, 2, 4, 6]


Python list-programs
Python
Python Programs
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
Python program to convert a list to string
Defaultdict in Python
Python | Get dictionary keys as a list
Python | Split string into list of characters
Python | Convert a list to dictionary
How to pass arguments to anonymous functions in JavaScript?

Following is the code for passing arguments to anonymous functions in JavaScript −
 Live Demo
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<style>
   body {
      font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
   }
   .result {
      font-weight: 500;
      font-size: 20px;
      color: blueviolet;
   }
</style>
</head>
<body>
<h1>Pass arguments to anonymous functions</h1>
<div class="result"></div>
<br />
<button class="Btn">CLICK HERE</button>
<h3>Click on the above button to call an anonymous function and pass
parameters to it</h3>
<script>
   let BtnEle = document.querySelector(".Btn");
   let resEle = document.querySelector(".result");
   let add = function (a, b) {
      return a + b;
   };
   BtnEle.addEventListener("click", (event) => {
      resEle.innerHTML = "The sum of 22 and 19 = " + add(22, 19);
   });
</script>
</body>
</html>
On clicking the ‘CLICK HERE’ button −
Get the substring after the first occurrence of a separator in Java

We have the following string with a separator.
String str = "Tom-Hanks";
We want the substring after the first occurrence of the separator i.e.
Hanks
For that, first you need to get the index of the separator and then using the substring() method get, the substring after the separator.
String separator ="-";
int sepPos = str.indexOf(separator);
System.out.println("Substring after separator = "+str.substring(sepPos + separator.length()));
The following is an example.
 Live Demo
public class Demo {
   public static void main(String[] args) {
      String str = "Tom-Hanks";
      String separator ="-";
      int sepPos = str.indexOf(separator);
      if (sepPos == -1) {
         System.out.println("");
      }
      System.out.println("Substring after separator = "+str.substring(sepPos +       separator.length()));
   }
}
Substring after separator = Hanks
Program to convert integer to roman numeral in Python

Suppose we have a number num. We have to convert it into its equivalent roman numeral. Roman numerals contain the symbols and values like below −
"I" = 1
"V" = 5
"X" = 10
"L" = 50
"C" = 100
"D" = 500
"M" = 1000
These symbols are typically written largest to smallest, and from left to right order, and can be computed by summing the values of all the symbols. But there are some special cases, where a symbol of lower value is to the left of a symbol of higher value, his indicates the lower value is subtracted from the higher one.
These are examples of such cases −
"I" is before "V", value 4.
"I" is before "X", value 9.
"X" is before "L", value 40.
"X" is before "C", value 90.
"C" is before "D", value 400.
"C" is before "M", value 900.
In Roman numerals there are also few rules −
No symbol is repeated more than 3 times.
The symbols "V", "L", and "D" are not repeated.
So, if the input is like n = 1520, then the output will be "MDXX", because "MDXX" indicates 1000 + 500 + 10 + 10 = 1520.
To solve this, we will follow these steps −
res := blank string
table = a list containing pairs (val, symbol) in this format, where val is the value and symbol is the associated symbol [(1000, "M"), (900, "CM"), (500, "D"), (400, "CD"), (100, "C"), (90, "XC"), (50, "L"), (40, "XL"), (10, "X"), (9, "IX"), (5, "V"), (4, "IV"), (1, "I")]
for each pair (cap, roman) in table, dod := floor of num/capm := num mod capres := res + roman * dnum := m
d := floor of num/cap
m := num mod cap
res := res + roman * d
num := m
return res
Let us see the following implementation to get better understanding −
def solve(num):
   res = ""
   table = [
      (1000, "M"),
      (900, "CM"),
      (500, "D"),
      (400, "CD"),
      (100, "C"),
      (90, "XC"),
      (50, "L"),
      (40, "XL"),
      (10, "X"),
      (9, "IX"),
      (5, "V"),
      (4, "IV"),
      (1, "I"),
   ]
   for cap, roman in table:
      d, m = divmod(num, cap)
      res += roman * d
      num = m

   return res

num = 1520
print(solve(num))
1520
MDXX
AngularJS HttpRequest

AngularJS provides $https: control which works as a service to read data from the server. Server can make a database call to get the records. AngularJS needs data in JSON format. Once data is ready, $https: can be used to get the data from server in the following manner.
function studentController($scope,$https:) {
   var url="data.txt";
   $https:.get(url).success( function(response) {
      $scope.students = response; 
   });
}
Here data.txt contains the student records. $https: service makes an ajax call and set response to its property students. "students" model can be used to be used to draw tables in the html.
[
   {
      "Name" : "Mahesh Parashar",
      "RollNo" : 101,
      "Percentage" : "80%"
   },
   {
      "Name" : "Dinkar Kad",
      "RollNo" : 201,
      "Percentage" : "70%"
   },
   {
      "Name" : "Robert",
      "RollNo" : 191,
      "Percentage" : "75%"
   },
   {
      "Name" : "Julian Joe",
      "RollNo" : 111,
      "Percentage" : "77%"
   }
]
<html>
<head>
<title>Angular JS Includes</title>
<style>
table, th , td {
   border: 1px solid grey;
   border-collapse: collapse;
   padding: 5px;
}
table tr:nth-child(odd) {
   background-color: #f2f2f2;
}
table tr:nth-child(even) {
   background-color: #ffffff;
}
</style>
</head>
<body>
<h2>AngularJS Sample Application</h2>
<div ng-app="" ng-controller="studentController">
<table>
   <tr>
      <th>Name</th>
      <th>Roll No</th>
	   <th>Percentage</th>
   </tr>
   <tr ng-repeat="student in students">
      <td>{{ student.Name }}</td>
      <td>{{ student.RollNo }}</td>
	   <td>{{ student.Percentage }}</td>
   </tr>
</table>
</div>
<script>
function studentController($scope,$https:) {
   var url="data.txt";
   $https:.get(url).success( function(response) {
      $scope.students = response;
   });
}
</script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js"></script>
</body>
</html>
To run this example, you need to deploy textAngularJS.htm, data.txt to a webserver. Open textAngularJS.htm using url of your server in a web browser. See the result.

    16 Lectures 
     1.5 hours 

 Anadi Sharma

    40 Lectures 
     2.5 hours 

 Skillbakerystudios
 Print
 Add Notes
 Bookmark this page
Add PHP variable inside echo statement as href link address?

echo "<a href='".$link_address."'>Link</a>";
or
echo "<a href='$link_address'>Link</a>";
<a href="<?php echo $link_address;?>"> Link </a>
How to use an alias() for the parameter in PowerShell?

PowerShell alias is a good way to use the shortcut name for the Parameter instead of writing the full name of the parameter. For example, you can refer to Server as ServerName, AppID as the ApplicationID.
So you don’t have to use the whole name of the parameter and it is easy to remember as well.
function Aliastest{
   param(
      [parameter(Mandatory=$true)]
      [Alias("Server")]
      [string]$ServerName
   )
   Write-Output "Server name is $ServerName"
}
Now we can use the Server instead of ServerName while passing the arguments.
PS C:\> Aliastest -server "Test1-Win2k16"
Server name is Test1-Win2k16
How to detect the user's device using jQuery ? - GeeksforGeeks

24 Jun, 2019
The task is to determine the user’s device, whether it is iPad or not, using JQuery. Below are the required methods:
Navigator userAgent Property:This property returns the value of the header of user-agent which is sent by the browser to the server.Returned value, have information like name, version, and platform of the browser.Syntax:navigator.userAgent
Return value:It returns a string, which represents the user agent string of the current browser.
Syntax:
navigator.userAgent

Return value:It returns a string, which represents the user agent string of the current browser.
Example: This example uses the navigator.userAgent property to identify the user’s device.
<!DOCTYPE HTML><html>  <head>    <title>        JQuery       | Detect iPad users.    </title></head><script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>  <body style="text-align:center;"       id="body">    <h1 style="color:green;">              GeeksForGeeks          </h1>    <p id="GFG_UP"        style="font-size: 17px;               font-weight: bold;">    </p>    <button>        click here    </button>    <p id="GFG_DOWN"        style="color: green;               font-size: 24px;               font-weight: bold;">    </p>    <script>        $('#GFG_UP').text(          "Click on the button to see "+          "whether user's device is iPad or not");                $('button').on('click', function() {            var is_iPad =                 navigator.userAgent.match(/iPad/i) != null;            $('#GFG_DOWN').text(is_iPad);        });    </script></body>  </html>
Output:
Before reaching the bottom:
After reaching the bottom:
jQuery-Misc
JQuery
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Show and Hide div elements using radio buttons?
How to prevent Body from scrolling when a modal is opened using jQuery ?
jQuery | ajax() Method
jQuery | removeAttr() with Examples
How to get the value in an input text box using jQuery ?
Remove elements from a JavaScript Array
Installation of Node.js on Linux
Convert a string to an integer in JavaScript
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?
Python - Group Adjacent Coordinates - GeeksforGeeks

11 Jun, 2021
Sometimes, while working with Python lists, we can have a problem in which we need to perform the grouping of all the coordinates which occur adjacent on a matrix, i.e horizontally and vertically at distance 1. This is called Manhatten distance. This kind of problem can occur in competitive programming domain. Let’s discuss certain way in which this task can be performed. 
Input : test_list = [(4, 4), (6, 4), (7, 8)] Output : [[(7, 8)], [(6, 4)], [(4, 4)]]Input : test_list = [(4, 4), (5, 4)] Output : [[(5, 4), (4, 4)]]  
Method : Using product() + groupby() + list comprehension The combination of above methods can be used to solve this problem. In this, we perform the task of grouping of elements using groupby() and check for pairs using product(). The logic driving this solution is similar to union find algorithm. 
Python3
# Python3 code to demonstrate working of# Group Adjacent Coordinates# Using product() + groupby() + list comprehensionfrom itertools import groupby, product def Manhattan(tup1, tup2):    return abs(tup1[0] - tup2[0]) + abs(tup1[1] - tup2[1]) # initializing listtest_list = [(4, 4), (6, 4), (7, 8), (11, 11),                     (7, 7), (11, 12), (5, 4)] # printing original listprint("The original list is : " + str(test_list)) # Group Adjacent Coordinates# Using product() + groupby() + list comprehensionman_tups = [sorted(sub) for sub in product(test_list, repeat = 2)                                         if Manhattan(*sub) == 1] res_dict = {ele: {ele} for ele in test_list}for tup1, tup2 in man_tups:    res_dict[tup1] |= res_dict[tup2]    res_dict[tup2] = res_dict[tup1] res = [[*next(val)] for key, val in groupby(        sorted(res_dict.values(), key = id), id)] # printing resultprint("The grouped elements : " + str(res))
The original list is : [(4, 4), (6, 4), (7, 8), (11, 11), (7, 7), (11, 12), (5, 4)]
The grouped elements : [[(6, 4), (5, 4), (4, 4)], [(7, 8), (7, 7)], [(11, 12), (11, 11)]]

  
anikakapoor
Python list-programs
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
How to drop one or multiple columns in Pandas Dataframe
Python Classes and Objects
Defaultdict in Python
Python | Get dictionary keys as a list
Python | Split string into list of characters
Python | Convert a list to dictionary
How to print without newline in Python?
users command in Linux with Examples - GeeksforGeeks

22 Apr, 2021
users command in Linux system is used to show the user names of users currently logged in to the current host. It will display who is currently logged in according to FILE. If the FILE is not specified, use /var/run/utmp. /var/log/wtmp as FILE is common. 
Syntax: 
 
users [OPTION]... [FILE]
Example: users command without any option will print the users currently logged in. 
 
Options:  
users –help: This option will display the help message and exit.  
 
users --help
 
 
 
users –version: This option will show the version information and exit.  
 
users --version
 
 
 
simmytarika5
linux-command
Linux-system-commands
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
TCP Server-Client implementation in C
curl command in Linux with Examples
Conditional Statements | Shell Script
UDP Server-Client implementation in C
Tail command in Linux with examples
Cat command in Linux with examples
touch command in Linux with Examples
echo command in Linux with Examples
Compiling with g++
scp command in Linux with Examples