code-rag-bench/online-tutorials huggingface dataset:
Fabric.js | Text shadow Property - GeeksforGeeks

31 Aug, 2021
In this article, we are going to see how to add shadow to the text canvas using FabricJS. The canvas means text written is movable, rotatable, resizable, and can be stretched. But in this article, we will add shadow to it. Further, the text itself cannot be edited like a textbox.
Approach: To make it possible, we are going to use a JavaScript library called FabricJS. After importing the library using CDN, we will create a canvas block in the body tag which will contain our text. After this, we will initialize instances of Canvas and Text provided by FabricJS and use the shadow property to add shadow and render the Canvas on the Text as given in the example below.
Syntax: 
fabric.text(text :string, shadow: fabric.shadow); 
Parameters: This function accepts two parameters as mentioned above and described below:  
text: It specifies the text content.
shadow: It specifies the shadow object.
Program: This example uses FabricJS to add shadow to the text canvas. 
HTML
<!DOCTYPE html><html> <head>    <title>        Fabric.js | Text shadow Property    </title>     <!-- Loading the FabricJS library -->    <script src="https://cdnjs.cloudflare.com/ajax/libs/fabric.js/3.6.2/fabric.min.js">    </script></head> <body>    <canvas id="canvas" width="600" height="200"        style="border:1px solid #000000;">    </canvas>     <script>         // Create a new instance of Canvas        var canvas = new fabric.Canvas("canvas");         // Create shadow object        var shadow = new fabric.Shadow({            color: 'black',            blur: 5        });         // Create a new Text instance        var text = new fabric.Text('GeeksforGeeks', {            shadow: shadow        });         // Render the text on Canvas        canvas.add(text);    </script></body> </html>
Output: 
 
abhishek0719kadiyan
Fabric.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 append HTML code to a div using 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
Getting first element of an array in Julia - first() Method - GeeksforGeeks

26 Mar, 2020
The first() is an inbuilt function in julia which is used to return the first element of the specified iterable collection.
Syntax: first(coll)
Parameters:
coll: Specified iterable collection.
Returns: It returns the first element of the specified iterable collection.
Example 1:
# Julia program to illustrate # the use of first() method   # Getting the first element of # the specified iterable collection# or 1D arrayprintln(first(1:2:3))println(first(5:10))println(first([3, 5, 7, 9]))println(first([2, 4, 6, 8]))
Output:
1
5
3
2

Example 2:
# Julia program to illustrate # the use of first() method   # Getting the first element of # the specified 2D and 3D arrayprintln(first([3 5; 7 9]))println(first(["a" "b"; "c" "d"]))println(first(cat([1 2; 3 4], [5 6; 7 8],                   [2 2; 3 4], dims = 3)))println(first(cat(["a" "b"; "c" "d"],                   ["e" "f"; "g" "h"],                   ["i" "j"; "k" "l"], dims = 3)))
Output:
Julia
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Decision Making in Julia (if, if-else, Nested-if, if-elseif-else ladder)
Get array dimensions and size of a dimension in Julia - size() Method
Exception handling in Julia
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
Join an array of strings into a single string in Julia - join() Method
Working with Excel Files in Julia
File Handling in Julia
Getting last element of an array in Julia - last() Method
DAX Time Intelligence - LASTDATE function

Returns the last date in the current context for the specified column of dates.
LASTDATE (<dates>) 

dates
A column that contains dates.
A table containing a single column and a single row with a date value.
The dates parameter can be any of the following −
A reference to a date/time column.
A reference to a date/time column.
A table expression that returns a single column of date/time values.
A table expression that returns a single column of date/time values.
A Boolean expression that defines a single-column table of date/time values.
A Boolean expression that defines a single-column table of date/time values.
Constraints on Boolean expressions −
The expression cannot reference a calculated field.
The expression cannot reference a calculated field.
The expression cannot use CALCULATE function.
The expression cannot use CALCULATE function.
The expression cannot use any function that scans a table or returns a table, including aggregation functions.
The expression cannot use any function that scans a table or returns a table, including aggregation functions.
However, a Boolean expression can use any function that looks up a single value, or that calculates a scalar value.
When the current context is a single date, the dates returned by the DAX FIRSTDATE function and DAX LASTDATE function will be the same.
As DAX LASTDATE function returns a table that contains a single column and single value, it can be used as a parameter to any DAX function that requires a table in its parameters. Further, the returned value can be used wherever a date value is required.
= LASTDATE (Sales [Date]) 

    53 Lectures 
     5.5 hours 

 Abhay Gadiya

    24 Lectures 
     2 hours 

 Randy Minder

    26 Lectures 
     4.5 hours 

 Randy Minder
 Print
 Add Notes
 Bookmark this page
Python | Pandas Series.autocorr() - GeeksforGeeks

17 Feb, 2019
Pandas series is a One-dimensional ndarray with axis labels. The labels need not be unique but must be a hashable type. The object supports both integer- and label-based indexing and provides a host of methods for performing operations involving the index.
Pandas Series.autocorr() function compute the lag-N autocorrelation. This method computes the Pearson correlation between the Series and its shifted self.
Syntax: Series.autocorr(lag=1)
Parameter :lag : Number of lags to apply before performing autocorrelation.
Returns : float
Example #1: Use Series.autocorr() function to compute the lag-N auto-correlation of the underlying data for the given series object.
# importing pandas as pdimport pandas as pd  # Creating the Seriessr = pd.Series([11, 21, 8, 18, 65, 18, 32, 10, 5, 32, None])  # Create the Indexindex_ = pd.date_range('2010-10-09 08:45', periods = 11, freq ='H')  # set the indexsr.index = index_  # Print the seriesprint(sr)
Output :Now we will use Series.autocorr() function to compute the lag-n auto-correlation of the underlying data for the given series object.
# return the auto correlationresult = sr.autocorr()  # Print the resultprint(result)
Output :
As we can see in the output, the Series.autocorr() function has successfully returned the auto correlation of the underlying data of the given series object by lag 1. Example #2 : Use Series.autocorr() function to compute the lag-N auto-correlation of the underlying data for the given series object. Take the lag value equal to 3.
# importing pandas as pdimport pandas as pd  # Creating the Seriessr = pd.Series([34, 5, 13, 32, 4, 15])  # Create the Indexindex_ = ['Coca Cola', 'Sprite', 'Coke', 'Fanta', 'Dew', 'ThumbsUp']  # set the indexsr.index = index_  # Print the seriesprint(sr)
Output :
Now we will use Series.autocorr() function to compute the lag-n auto-correlation of the underlying data for the given series object.
# return the auto correlation# by lag-3result = sr.autocorr(lag = 3)  # Print the resultprint(result)
Output :
As we can see in the output, the Series.autocorr() function has successfully returned the auto correlation of the underlying data of the given series object by lag 1.
Python pandas-series
Python pandas-series-methods
Python-pandas
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
Reading and Writing to text files in Python
*args and **kwargs in Python
Create a Pandas DataFrame from Lists
How To Convert Python Dictionary To JSON?
Overloading stream insertion (<>) operators in C++

16 Jun, 2021
In C++, stream insertion operator “<<” is used for output and extraction operator “>>” is used for input. We must know the following things before we start overloading these operators. 1) cout is an object of ostream class and cin is an object of istream class 2) These operators must be overloaded as a global function. And if we want to allow them to access private data members of the class, we must make them friend. Why these operators must be overloaded as global? In operator overloading, if an operator is overloaded as a member, then it must be a member of the object on the left side of the operator. For example, consider the statement “ob1 + ob2” (let ob1 and ob2 be objects of two different classes). To make this statement compile, we must overload ‘+’ in a class of ‘ob1’ or make ‘+’ a global function. The operators ‘<<‘ and ‘>>’ are called like ‘cout << ob1’ and ‘cin >> ob1’. So if we want to make them a member method, then they must be made members of ostream and istream classes, which is not a good option most of the time. Therefore, these operators are overloaded as global functions with two parameters, cout and object of user-defined class.Following is a complete C++ program to demonstrate overloading of <> operators. 
CPP
#include <iostream>using namespace std; class Complex{private:    int real, imag;public:    Complex(int r = 0, int i =0)    {  real = r;   imag = i; }    friend ostream & operator << (ostream &out, const Complex &c);    friend istream & operator >> (istream &in,  Complex &c);}; ostream & operator << (ostream &out, const Complex &c){    out << c.real;    out << "+i" << c.imag << endl;    return out;} istream & operator >> (istream &in,  Complex &c){    cout << "Enter Real Part ";    in >> c.real;    cout << "Enter Imaginary Part ";    in >> c.imag;    return in;} int main(){   Complex c1;   cin >> c1;   cout << "The complex object is ";   cout << c1;   return 0;}
Output: 
Enter Real Part 10
Enter Imaginary Part 20
The complex object is 10+i20
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above 
jacksonthall22
1devyansh1
cpp-operator-overloading
cpp-overloading
C++
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Bitwise Operators in C/C++
Templates in C++ with Examples
Inheritance in C++
Socket Programming in C/C++
Polymorphism in C++
Queue in C++ Standard Template Library (STL)
Virtual Function in C++
vector erase() and clear() in C++
C++ Classes and Objects
List in C++ Standard Template Library (STL)
PostgreSQL – Size of Indexes

22 Feb, 2021
In this article, we will look into a function that is used to get the size of the PostgreSQL database indexes of a table. The pg_indexes_size() function takes in the table name or respective OID and returns the size of all the attached indexes from a table.For the purpose of example, we will be using a sample database for reference which is described here and can be downloaded from here The pg_indexes_size() function is used to get the total size of all indexes attached to a table. 
Syntax: select pg_indexes_size('table_name');
Example 1: Here we will query for the total size of indexes attached to the “film” table of our sample database using the below command:  
SELECT pg_indexes_size('film');
Output:  
To make the result readable, one can use the pg_size_pretty() function. The pg_size_pretty() function takes the result of another function and formats it using bytes, KB, MB, GB, or TB as required.  
SELECT pg_size_pretty (pg_indexes_size('film'));
Output:  
Example 2: Here we will query for the total size of indexes attached to the “customer” table of our sample database using the below command:  
SELECT pg_size_pretty (pg_indexes_size('customer'));
Output:  
Example 3: Here we will query for the total size of indexes attached to the “actor” table of our sample database using the below command: 
SELECT pg_size_pretty (pg_indexes_size('actor'));
Output: 
 
 
RajuKumar19
PostgreSQL-function
PostgreSQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
PostgreSQL - IF Statement
PostgreSQL - DROP TABLE
PostgreSQL - For Loops
PostgreSQL - Function Returning A Table
PostgreSQL - LIMIT with OFFSET clause
PostgreSQL - Rename Table
PostgreSQL - Joins
PostgreSQL - Variables
PostgreSQL - ARRAY_AGG() Function
PostgreSQL - REPLACE Function
NLP | Extracting Named Entities

26 Feb, 2019
Recognizing named entity is a specific kind of chunk extraction that uses entity tags along with chunk tags.Common entity tags include PERSON, LOCATION and ORGANIZATION. POS tagged sentences are parsed into chunk trees with normal chunking but the trees labels can be entity tags in place of chunk phrase tags. NLTK has already a pre-trained named entity chunker which can be used using ne_chunk() method in the nltk.chunk module. This method chunks a single sentence into a Tree.
Code #1 : Using ne-chunk() on tagged sentence of the treebank_chunk corpus
from nltk.corpus import treebank_chunkfrom nltk.chunk import ne_chunk  ne_chunk(treebank_chunk.tagged_sents()[0])
Output :
Tree('S', [Tree('PERSON', [('Pierre', 'NNP')]), Tree('ORGANIZATION', 
[('Vinken', 'NNP')]), (', ', ', '), ('61', 'CD'), ('years', 'NNS'), 
('old', 'JJ'), (', ', ', '), ('will', 'MD'), ('join', 'VB'), ('the', 'DT'),
('board', 'NN'), ('as', 'IN'), ('a', 'DT'), ('nonexecutive', 'JJ'), 
('director', 'NN'), ('Nov.', 'NNP'), ('29', 'CD'), ('.', '.')])

two entity tags are found: PERSON and ORGANIZATION. Each of these subtrees contains a list of the words that are recognized as a PERSON or ORGANIZATION. Code #2 : Method to extract named entites using leaves of all the subtrees
def sub_leaves(tree, label):    return [t.leaves()             for t in tree.subtrees(                    lambda s: label() == label)]
 Code #3 : using method to get all the PERSON or ORGANIZATION leaves from a tree
tree = ne_chunk(treebank_chunk.tagged_sents()[0])  from chunkers import sub_leavesprint ("Named entities of PERSON : ",        sub_leaves(tree, 'PERSON'))  print ("\nNamed entites of ORGANIZATION : ",        sub_leaves(tree, 'ORGANIZATION'))
Output :
Named entities of PERSON : [[('Pierre', 'NNP')]]

Named entites of ORGANIZATION : [[('Vinken', 'NNP')]]

To process multiple sentences at a time, chunk_ne_sents() is used. In the code below, first 10 sentences from treebank_chunk.tagged_sents() are processed to get ORGANIZATION sub_leaves(). Code #4 : Let’s understand chunk_ne_sents()
from nltk.chunk import chunk_ne_sentsfrom nltk.corpus import treebank_chunk  trees = chunk_ne_sents(treebank_chunk.tagged_sents()[:10])[sub_leaves(t, 'ORGANIZATION') for t in trees]
Output :
[[[('Vinken', 'NNP')]], [[('Elsevier', 'NNP')]], [[('Consolidated', 'NNP'), 
('Gold', 'NNP'), ('Fields', 'NNP')]], [], [], [[('Inc.', 'NNP')], 
[('Micronite', 'NN')]], [[('New', 'NNP'), ('England', 'NNP'),
('Journal', 'NNP')]], [[('Lorillard', 'NNP')]], [], []]

Natural-language-processing
Python-nltk
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Different ways to create Pandas Dataframe
Enumerate() in Python
Python String | replace()
How to Install PIP on Windows ?
*args and **kwargs in Python
Python Classes and Objects
Python OOPs Concepts
Convert integer to string in Python
Introduction To PYTHON
Querying Multiple Tables in SQL

21 Apr, 2021
Here, we are going to see how to query multiple tables in SQL.  For example, here, we will first create a database named “geeks” then we will create 2 tables “department” and “employee” in that database. After, that we will execute our query on the tables.
Use the below SQL statement to create a database called geeks:
CREATE DATABASE geeks;
USE geeks;
We have the following department table in our geeks database :
Create Table department(
   ID int,
   SALARY int,
   NAME Varchar(20),
   DEPT_ID Varchar(255));
Output:
You can use the below statement to query the description of the created table:
EXEC SP_COLUMNS department;
The date data type uses the format ‘YYYY-MM-DD‘. Use the below statement to add data to the department table:
INSERT INTO department VALUES (1,'Neha','F','1994-06-03');
INSERT INTO department VALUES (2,'Harsh','M','1996-03-12');
INSERT INTO department VALUES (3,'Harsh','M','1995-05-01');
INSERT INTO department VALUES (4,'Rupali','F',1996-11-11');
INSERT INTO department VALUES (5,'Rohan','M','1992-03-08');
To verify the contents of the table use the below statement:
SELECT * FROM department;
Now create another table called employee:
CREATE TABLE employee(
  ID int,
  Email Varchar(255),
  City Varchar(20) );
Add values into the table “employee“:
INSERT INTO employee VALUES (1, "ANURAG@xyz.com", "Noida");
INSERT INTO employee VALUES (2, "HARSH@xyz.com", "Jaipur");
INSERT INTO employee VALUES (3, "SUMIT@xyz.com", "Noida");
INSERT INTO employee VALUES (4, "RUHI@xyz.com", "Jaipur");
INSERT INTO employee VALUES (5, "KAE@xyz.com", "Noida");
To verify the contents of the table use the below statement:
SELECT * FROM employee;
Method 1:
The most common way to query multiple tables is with a simple SELECT expression. To integrate results from different tables, use the FROM clause to name more than one table. Here’s how it works in practice:
Syntax: 
SELECT table1name.column1name, table2name.column2name FROM table1name, table2name 
WHERE table1name.column1name = table2name.column1name;
Example:
SELECT department.ID, department.NAME, employee.Email, employee.City FROM department, employee 
WHERE department.ID = employee.ID;
Output:
Method 2: Using JOINS
SQL Joins can also be used for the same purpose using the below syntax:
Syntax:
SELECT table1.column1,table1.column2,table2.column1,....
FROM table1  
JOIN table2
ON table1.matching_column = table2.matching_column;
Example:
SELECT department.ID, department.NAME, employee.Email, employee.City  
FROM department JOIN employee ON department.ID = employee.ID;
Output:
Picked
SQL-Query
SQL
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
GATE | GATE-CS-2005 | Question 76

28 Jun, 2021
The following table has two attributes A and C where A is the primary key and C is the foreign key referencing A with on-delete cascade.
A   C
-----
2   4
3   4
4   3
5   2
7   2
9   5
6   4 
The set of all tuples that must be additionally deleted to preserve referential integrity when the tuple (2,4) is deleted is:(A) (3,4) and (6,4)(B) (5,2) and (7,2)(C) (5,2), (7,2) and (9,5)(D) (3,4), (4,3) and (6,4)Answer: (C)Explanation: See question 2 of https://www.geeksforgeeks.org/database-management-systems-set-8/Quiz of this Question
GATE-CS-2005
GATE-GATE-CS-2005
GATE
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
GATE | GATE-CS-2014-(Set-2) | Question 65
GATE | Sudo GATE 2020 Mock I (27 December 2019) | Question 33
GATE | GATE CS 2008 | Question 46
GATE | GATE-CS-2015 (Set 3) | Question 65
GATE | GATE CS 2008 | Question 40
GATE | GATE-CS-2014-(Set-3) | Question 65
GATE | GATE CS 1996 | Question 63
GATE | GATE-CS-2014-(Set-1) | Question 51
GATE | GATE CS 2011 | Question 49
GATE | GATE-CS-2004 | Question 31
HTML Mapping Image

The HTML mapping image is a client-side image-map with clickable areas which acts as hyperlinks in an HTML document. To create the relationship between the map and img HTML element the name attribute of map element is associated with the img usermap attribute.
Following is the syntax −
<img src=”” alt=”’ usemap=”#name_value”>
<map name=”name_value”>
<area shape=”” coords=”” href=”” alt=”’>
<area shape=”” coords=”” href=”” alt=”’>
</map>
Let us see an example of HTML mapping image−
 Live Demo
<!DOCTYPE html>
<html>
<head>
<style>
   body {
      color: #000;
      height: 100vh;
      background-color: #FBAB7E;
      background-image: linear-gradient(62deg, #FBAB7E 0%, #F7CE68 100%);
      text-align: center;
   }
   img {
      width: 200px;
      height: 200px;
   }
</style>
</head>
<body>
<h1>HTML Mapping Image</h1>
<img src="https://www.tutorialspoint.com/hadoop/images/hadoop-mini-logo.jpg" alt="Learn Hadoop" usemap="#hadoopImg">
<map name="hadoopImg">
<area shape="rect" coords="0,0,400,100" alt="Hadoop Logo" href="https://www.tutorialspoint.com/hadoop/images/hadoop.jpg" width="100" height="100">
</map>
<p>Click on the above logo</p>
</body>
</html>
Click on the logo part (elephant) of Hadoop in the image to observe how HTML mapping image works−
What is Robocopy in Windows?

28 Jul, 2020
Microsoft Windows’s file replication command is known as “Robust file copy” or simply called Robocopy. It uses the concept of timestamp and datestamp for incomplete file transfers, that help in tolerating network interruptions. It knows where to start from using that recovery record having the date/time stamp information. Robocopy eliminates the chance of failure as it skips NTFS junction points as NTFS happens to cause infinite loops. Robocopy replaces all other copy commands with multiple exceptional features.  
The concept used in Robocopy to copy multiple files simultaneously is multithreading. The usage of multithreading makes it much faster than standard copy and also Xcopy.  The basic syntax is: 
robocopy <Source> <Destination> [<File>[ ...]] [<Options>] 
Features: 
You can pre-specify what to do with conflicting file names.
You can exclude some files or folders.
You can schedule a copy and paste operation.
You can mirror 1 folder to another, deleting files in the destination that don’t exist in the source folder.
Here are a few copy options available to Robocopy:  
There are a lot more, please feel free to run Robocopy/? on your command prompt to explore more about it.  
Example: 
robocopy <Source> <Destination> /E
Here /E is used to copy sub-directories and folders along with files.  
Why one should know it? Well, you can write a Robocopy script to synchronize folders, you can make backup much faster and secured. It helps to transfer files over servers and a lot more. 
GBlog
TechTips
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
GEEK-O-LYMPICS 2022 - May The Geeks Force Be With You!
Geek Streak - 24 Days POTD Challenge
What is Hashing | A Complete Tutorial
GeeksforGeeks Jobathon - Are You Ready For This Hiring Challenge?
GeeksforGeeks Job-A-Thon Exclusive - Hiring Challenge For Amazon Alexa
How to Find the Wi-Fi Password Using CMD in Windows?
Docker - COPY Instruction
Setting up the environment in Java
How to Run a Python Script using Docker?
Running Python script on GPU.
numpy.hsplit() function | Python

22 Apr, 2020
numpy.hsplit() function split an array into multiple sub-arrays horizontally (column-wise). hsplit is equivalent to split with axis=1, the array is always split along the second axis regardless of the array dimension.
Syntax : numpy.hsplit(arr, indices_or_sections)Parameters :arr : [ndarray] Array to be divided into sub-arrays.indices_or_sections : [int or 1-D array] If indices_or_sections is an integer, N, the array will be divided into N equal arrays along axis.If indices_or_sections is a 1-D array of sorted integers, the entries indicate where along axis the array is splitReturn : [ndarray] A list of sub-arrays.
Code #1 :
# Python program explaining# numpy.hsplit() function  # importing numpy as geek import numpy as geek  arr = geek.arange(16.0).reshape(4, 4)  gfg = geek.hsplit(arr, 2)  print (gfg)
Output :
[array([[  0.,   1.],
       [  4.,   5.],
       [  8.,   9.],
       [ 12.,  13.]]), array([[  2.,   3.],
       [  6.,   7.],
       [ 10.,  11.],
       [ 14.,  15.]])]

 Code #2 :
# Python program explaining# numpy.hsplit() function  # importing numpy as geek import numpy as geek  arr = geek.arange(27.0).reshape(3, 3, 3)  gfg = geek.hsplit(arr, 1)  print (gfg)
Output :
[array([[[  0.,   1.,   2.],
        [  3.,   4.,   5.],
        [  6.,   7.,   8.]],

       [[  9.,  10.,  11.],
        [ 12.,  13.,  14.],
        [ 15.,  16.,  17.]],

       [[ 18.,  19.,  20.],
        [ 21.,  22.,  23.],
        [ 24.,  25.,  26.]]])]

Python numpy-arrayManipulation
Python-numpy
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
JavaScript string.toString() Method

07 Oct, 2021
Below is the example of the string.toString() Method.  
Example:  
javascript
<script>    // Taking a string as input and printing it    // with the help of string.toString() function    var a = new String("GfG");    document.write(a.toString());</script>
Output:  
GfG
The string.toString() is an inbuilt method in JavaScript which is used to return the given string itself.Syntax:  
string.toString()
Parameters: It does not accept any parameter.Return Values: It returns a new string represent the given string object.JavaScript code to show the working of string.toString() method: Code #1:  
javascript
<script>     // Taking a string as input and printing it    // with the help of string.toString() function    var a = new String("GeeksforGeeks");    document.write(a.toString()); </script>
Output:  
GeeksforGeeks
Code #2:  
javascript
 
Output:  
GfGGfG
Supported Browsers:  
Google Chrome 1 and above
Edge 12 and above
Firefox 1 and above
Internet Explorer 3 and above
Opera 3 and above
Safari 1 and above
 
Pallavi Yadav
ysachin2314
JavaScript-Methods
javascript-string
JavaScript
Web Technologies
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
Differences between Functional Components and Class Components in React
Remove elements from a JavaScript Array
Difference Between PUT and PATCH Request
Roadmap to Learn JavaScript For Beginners
Top 10 Projects For Beginners To Practice HTML and CSS Skills
Installation of Node.js on Linux
Difference between var, let and const keywords in JavaScript
How to insert spaces/tabs in text using HTML/CSS?
How to fetch data from an API in ReactJS ?
Ruby Break and Next Statement

13 Aug, 2019
In Ruby, we use a break statement to break the execution of the loop in the program. It is mostly used in while loop, where value is printed till the condition, is true, then break statement terminates the loop.
Syntax :
Break 
Example :
# Ruby program to use break statement#!/usr/bin/ruby -w      i = 1      # Using While Loop     while true          # Printing Values        puts i * 3        i += 1        if i * 3 >= 21              # Using Break Statement             break        end            end  
Output:
3
6
9
12
15
18
In examples, break statement used with if statement. By using break statement the execution will be stopped. in above example, when i*3 will be greater than equal to 21 than execution will be stopped.
Example :
# Ruby program to use break statement  #!/usr/bin/ruby -w  x = 0      # Using while    while true do          # Printing Value        puts x        x += 1      # Using Break Statement    break if x > 3end
Output:
0
1
2
3
The above code restricts the number of loop iterations to 3.
To skip the rest of the current iteration we use next statement. When next statement is executed no other iteration will be performed. next statement is similar as continue statement in any other language.
Syntax:
next
Example :
# Ruby program of using next statement #!/usr/bin/ruby -w  for x  in  0..6          # Used condition         if  x+1 < 4 then              # Using next statement            next         end           # Printing values         puts "Value of x is : #{x}"      end
Output :
Value of x is : 3
Value of x is : 4
Value of x is : 5
Value of x is : 6
In above example, where value is not printed till the condition is true and go to next iteration. when condition is false than value of x will be printed.
Ruby-Decision-Making
Ruby
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Laravel - Cookie

Cookies play an important role while dealing a user’s session on a web application. In this chapter, you will learn about working with cookies in Laravel based web applications.
Cookie can be created by global cookie helper of Laravel. It is an instance of Symfony\Component\HttpFoundation\Cookie. The cookie can be attached to the response using the withCookie() method. Create a response instance of Illuminate\Http\Response class to call the withCookie() method. Cookie generated by the Laravel are encrypted and signed and it can’t be modified or read by the client.
Here is a sample code with explanation.
//Create a response instance
$response = new Illuminate\Http\Response('Hello World');

//Call the withCookie() method with the response method
$response->withCookie(cookie('name', 'value', $minutes));

//return the response
return $response;
Cookie() method will take 3 arguments. First argument is the name of the cookie, second argument is the value of the cookie and the third argument is the duration of the cookie after which the cookie will get deleted automatically.
Cookie can be set forever by using the forever method as shown in the below code.
$response->withCookie(cookie()->forever('name', 'value'));

Once we set the cookie, we can retrieve the cookie by cookie() method. This cookie() method will take only one argument which will be the name of the cookie. The cookie method can be called by using the instance of Illuminate\Http\Request.
Here is a sample code.
//’name’ is the name of the cookie to retrieve the value of
$value = $request->cookie('name');

Observe the following example to understand more about Cookies −
Step 1 − Execute the below command to create a controller in which we will manipulate the cookie.
php artisan make:controller CookieController --plain

Step 2 − After successful execution, you will receive the following output −
Step 3 − Copy the following code in
app/Http/Controllers/CookieController.php file.
app/Http/Controllers/CookieController.php
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Http\Response;
use App\Http\Requests;
use App\Http\Controllers\Controller;

class CookieController extends Controller {
   public function setCookie(Request $request) {
      $minutes = 1;
      $response = new Response('Hello World');
      $response->withCookie(cookie('name', 'virat', $minutes));
      return $response;
   }
   public function getCookie(Request $request) {
      $value = $request->cookie('name');
      echo $value;
   }
}
Step 4 − Add the following line in app/Http/routes.php file.
app/Http/routes.php
Route::get('/cookie/set','CookieController@setCookie');
Route::get('/cookie/get','CookieController@getCookie');

Step 5 − Visit the following URL to set the cookie.
http://localhost:8000/cookie/set

Step 6 − The output will appear as shown below. The window appearing in the screenshot is taken from firefox but depending on your browser, cookie can also be checked from the cookie option.
Step 7 − Visit the following URL to get the cookie from the above URL.
http://localhost:8000/cookie/get

Step 8 − The output will appear as shown in the following image.
PostgreSQL – LAST_VALUE Function

10 Feb, 2021
In PostgreSQL, the LAST_VALUE() function returns the last value in an ordered partition of the query result set .
Syntax:
LAST_VALUE ( expression )  
OVER ( 
    [PARTITION BY partition_expression, ... ]
    ORDER BY sort_expression [ASC | DESC], ...
)

Let’s analyze the above syntax:
The expression is single value integer used to evaluated against the value of the last row in an ordered partition of the query result set. It can be an expression, column, or subquery.
The PARTITION BY clause is used to divide the query result into sets.
The ORDER BY clause is used to order the result query set in each partition.
The frame_clause is used to specify the subset of rows in the current partition.
Example 1:
First, create two tables named Mammals and Animal_groups for the demonstration:
CREATE TABLE Animal_groups (
    animal_id serial PRIMARY KEY,
    animal_name VARCHAR (255) NOT NULL
);

CREATE TABLE Mammals (
    mammal_id serial PRIMARY KEY,
    mammal_name VARCHAR (255) NOT NULL,
    lifespan DECIMAL (11, 2),
    animal_id INT NOT NULL,
    FOREIGN KEY (animal_id) REFERENCES Animal_groups (animal_id)
);



Now insert some data to the table:
INSERT INTO Animal_groups (animal_name)
VALUES
    ('Terrestrial'),
    ('Aquatic'),
    ('Winged');

INSERT INTO Mammals(mammal_name, animal_id, lifespan)
VALUES
    ('Cow', 1, 10),
    ('Dog', 1, 7),
    ('Ox', 1, 13),
    ('Wolf', 1, 11),
    ('Blue Whale', 2, 80),
    ('Dolphin', 2, 5),
    ('Sea Horse', 2, 3),
    ('Octopus', 2, 8),
    ('Bat', 3, 4),
    ('Flying Squirrels', 3, 1),
    ('Petaurus', 3, 2);

The following query uses the LAST_VALUE() function to return all Mammals together with the mammal that has the highest lifespan:
SELECT 
    mammal_id,
    mammal_name,
    lifespan,
    LAST_VALUE(mammal_name) 
    OVER(
        ORDER BY lifespan
        RANGE BETWEEN 
            UNBOUNDED PRECEDING AND 
            UNBOUNDED FOLLOWING
    ) longest_lifespan
FROM 
    Mammals;

Output:
Example 2:
The following query uses the LAST_VALUE() function to return all mammals together with the mammal with longest lifespan per animal group:
SELECT 
    mammal_id,
    mammal_name,
    animal_id,
    lifespan,
    LAST_VALUE(mammal_name) 
    OVER(
    PARTITION BY animal_id
        ORDER BY lifespan
        RANGE BETWEEN 
            UNBOUNDED PRECEDING AND 
            UNBOUNDED FOLLOWING
    ) longest_life
FROM 
    Mammals;

Output:
PostgreSQL-function
PostgreSQL-Window-function
PostgreSQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
PostgreSQL - LIMIT with OFFSET clause
PostgreSQL - Rename Table
PostgreSQL - REPLACE Function
PostgreSQL - DROP INDEX
PostgreSQL - INSERT
PostgreSQL - Copy Table
PostgreSQL - TIME Data Type
PostgreSQL - ROW_NUMBER Function
PostgreSQL - Identity Column
PostgreSQL - SELECT
How to create a TabPane in JavaFX?

A TabPane is a GUI component using which you can load multiple documents in a single window. A tab pane has a title area and a content area, you can switch between tabs by clicking on their respective title. You can create tab pane by instantiating the javafx.scene.control.TabPane class.
Each tab in a tab-pane is represented by the javafx.scene.control.Tab class, you can set the title and content of a tab using the setText() and setContent() methods of this class respectively.
Once you create all the required tabs you need to add them to the pane as −
tabPane.getTabs().addAll(tab1, tab2);
Following JavaFX program demonstrates the creation of a TabPane.
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;
public class TabPaneExample extends Application {
   public void start(Stage stage) throws FileNotFoundException {
      //Creating ImageView object1
      Image img1 = new Image(new FileInputStream("D:\\images\\elephant.jpg"));
      ImageView view1 = new ImageView(img1);
      view1.setFitWidth(595);
      view1.setFitHeight(270);
      //Creating ImageView object2
      Image img2 = new Image(new FileInputStream("D:\\images\\boy.jpg"));
      ImageView view2 = new ImageView(img2);
      view2.setFitWidth(595);
      view2.setFitHeight(270);
      //Creating a TabPane
      TabPane tabPane = new TabPane();
      //Creating the first tab
      Tab tab1 = new Tab();
      //Setting the text
      tab1.setText("Elephant");
      //Setting the content
      tab1.setContent(view1);
      //Creating the second tab
      Tab tab2 = new Tab();
      //Setting the text
      tab2.setText("Boy");
      //Setting the content
      tab2.setContent(view2);
      //Adding tabs to the tab pane
      tabPane.getTabs().addAll(tab1, tab2);
      //Setting anchor pane as the layout
      AnchorPane pane = new AnchorPane();
      AnchorPane.setTopAnchor(tabPane, 15.0);
      AnchorPane.setRightAnchor(tabPane, 15.0);
      AnchorPane.setBottomAnchor(tabPane, 15.0);
      AnchorPane.setLeftAnchor(tabPane, 15.0);
      pane.getChildren().addAll(tabPane);
      pane.setStyle("-fx-background-color: BEIGE");
      //Setting the stage
      Scene scene = new Scene(pane, 595, 300);
      stage.setTitle("Tab Pane");
      stage.setScene(scene);
      stage.show();
   }
   public static void main(String args[]){
      launch(args);
   }
}
Boy −
Elephant −
Calculate exponential of a number in R Programming - exp() Function - GeeksforGeeks

01 Jun, 2020
exp() function in R Language is used to calculate the power of e i.e. e^y or we can say exponential of y. The value of e is approximately equal to 2.71828.....
Syntax: exp(y)
Parameters:y: It is any valid R number either positive or negative.
Returns: Floating point number by calculating e^y.
Example 1:
# R program to calculate exp value     # Using exp() method answer1 <- exp(4) answer2 <- exp(-3)  answer3 <- exp(0.0)  print(answer1) print(answer2) print(answer3) 
Output:
54.59815
0.04978707
1

Example 2:
# R program to calculate exp value     # Using exp() method answer1 <- exp(c(pi, exp(1)))   print(answer1)  
Output:
23.14069 15.15426

R Math-Function
R Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to Replace specific values in column in R DataFrame ?
Loops in R (for, while, repeat)
Filter data by multiple conditions in R using Dplyr
How to change Row Names of DataFrame in R ?
Change Color of Bars in Barchart using ggplot2 in R
Printing Output of an R Program
Remove rows with NA in one column of R DataFrame
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?
Data analysis and Visualization with Python program

In this tutorial, we are going to learn about data analysis and visualization using modules like pandas and matplotlib in Python. Python is an excellent fit for the data analysis things. Install the modules pandas and matplotlib using the following commands.
pip install pandas
pip install matplotlib
You will get a success message after the completion of the installation process. We will first learn about the pandas and then will see matplotlib.
Pandas is an open-source library of Python which provides data analysis tools. We are going to see some useful methods from the pandas for data analysis.
We need multiple rows to create a DataFrame. Let's see how to do it.
# importing the pands package
import pandas as pd
# creating rows
hafeez = ['Hafeez', 19]
aslan = ['Aslan', 21]
kareem = ['Kareem', 18]
# pass those Series to the DataFrame
# passing columns as well
data_frame = pd.DataFrame([hafeez, aslan, kareem], columns = ['Name', 'Age'])
# displaying the DataFrame
print(data_frame)
If you run the above program, you will get the following results.
Name Age
0 Hafeez 19
1 Aslan 21
2 Kareem 18
Go to the link and download CSV file. The data in the CSV will be in rows with a comma(,) separated. Let's see how to import and use the data using pandas.
# importing pandas package
import pandas as pd
# importing the data using pd.read_csv() method
data = pd.read_csv('CountryData.IND.csv')
# displaying the first 5 rows using data.head() method
print(data.head())
If you run the above program, you will get the following results.
Let's see how many rows and columns are there using the shape variable.
# importing pandas package
import pandas as pd
# importing the data using pd.read_csv() method
data = pd.read_csv('CountryData.IND.csv')
# no. of rows and columns
print(data.shape)
If you run the above program, you will get the following results.
(29, 16)
We have a method called describe() which computes various statistics excluding NaN. Let's see it once.
# importing pandas package
import pandas as pd
# importing the data using pd.read_csv() method
data = pd.read_csv('CountryData.IND.csv')
# no. of rows and columns
print(data.describe())
If you run the above program, you will get the following results.
We have package matplotlib to create graphs using the data. Let's see how to create various types of graphs using matplotlib.
# importing the pyplot module to create graphs
import matplotlib.pyplot as plot
# importing the data using pd.read_csv() method
data = pd.read_csv('CountryData.IND.csv')
# creating a histogram of Time period
data['Time period'].hist(bins = 10)
If you run the above program, you will get the following results.
<matplotlib.axes._subplots.AxesSubplot at 0x25e363ea8d0>
We can create different types of graphs using the matplotlib package.
If you have any doubts regarding the tutorial, mention them in the comment section.
Internal working of Set/HashSet in Java

Set data structure is used to store unique values only, meaning no duplicate values would be stored in a set. When a HashSet is created, it internally implements a HashMap. An element can be inserted into the HashSet using the ‘add’ function. This internally calls the ‘put’ function since a HashMap would have been internally created. Hence, Set takes in unique values with the help of HashMap.
HashMap contains unique key and value pairs, wherein the key and value pairs are inserted using the ‘put’ function. Upon calling the ‘put’ function, a previous value associated with the key or null is returned depending on whether a mapping is present for the key or not.
LinkedHashSet extends to the HashSet class, meaning LinkedHashSet calls the constructors of HashSet class using the ‘super’ function.
 Live Demo
import java.util.HashSet;
public class Demo{
   public static void main(String args[]){
      HashSet my_hashset = new HashSet();
      boolean my_b1 = my_hashset.add("only");
      boolean my_b2 = my_hashset.add("sample");
      boolean my_b3 = my_hashset.add("sample");
      System.out.println("The value of first boolean is " + my_b1);
      System.out.println("The value of second boolean is = "+my_b2);
      System.out.println("The value of third boolean is = "+my_b3);
      System.out.println(my_hashset);
   }
}
The value of first boolean is true
The value of second boolean is = true
The value of third boolean is = false
[only, sample]
A class named Demo contains the main function where an instance of HashSet is defined. Elements are added into the hashset using the ‘add’ function. These elements are then displayed on the screen.
Installing and Configure vim Plugin in Ubuntu - GeeksforGeeks

26 Aug, 2019
There are several plugin managers like Vundle, Pathogen, Vim-plug, VAM which are used to install vim plugin, These plugin increase speed, productivity, and look and feel of vim text-editor but here we will use the Pathogen plugin manager.
Prerequisites : VIM editor
This is the command to install vim editor in the ubuntu.
sudo apt-get install vim
Plugin Manager Installation: To install vim plugin you need to make to directories autoload and bundle inside .vim directory and curl pathogen.vim to autoload.
mkdir -p ~/.vim/autoload ~/.vim/bundle && \
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim

Note: If the curl is not installed on your system, then use the below command:
$ sudo apt-get install curl
After running these commands make vimrc file inside .vim file in the home directory. The contents of minimal .vimrc is given below. Now, .vim directory will look like this.
Configure vimrc file: This is super-minimal code just to activate pathogen.
execute pathogen#infect()
syntax on
filetype plugin indent on

Installing Plugin: To install any plugins you like to install just clone it form git to a subdirectory under ~/.vim/bundle, and they will be added to the ‘runtimepath’.
cd ~/.vim/bundle && \
git clone [repository-url]

Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
scp command in Linux with Examples
SED command in Linux | Set 2
mv command in Linux with examples
Docker - COPY Instruction
chown command in Linux with Examples
nohup Command in Linux with Examples
Thread functions in C/C++
Named Pipe or FIFO with example C program
uniq Command in LINUX with examples
Start/Stop/Restart Services Using Systemctl in Linux
Why is C considered faster than other languages ? - GeeksforGeeks

14 Aug, 2021
You might have came across these statements, C is more optimised or performance of C is better than higher languages, so I’ll be discussing the reasons for this hypothesis. 
First let’s list out functionalities which are provided by languages like Java and not C : 
Array index bound checkingUninitialized variable values checkingCheck for memory leaksCheck for null pointer dereferenceAutomatic garbage collectionRun-time type checkingException handling
Array index bound checking
Uninitialized variable values checking
Check for memory leaks
Check for null pointer dereference
Automatic garbage collection
Run-time type checking
Exception handling
and there are more such features which are not present in C. Extra features comes at cost and the cost includes decreased speed and increased size. Let’s take an example for dynamic allocation in C and Java Java:
MyClass obj = new MyClass();
Did you considered size of obj, the answer is No. The reason being it is automatically handled by language itself in background and you don’t have to write specific code for it. But in case of C 
struct MyStruct *obj = malloc(sizeof(struct MyStruct));
As you can see in above code the tasks of assigning reference to pointer, allocation of size is done explicitly by programmer and at last free up allocated memory. The array bound check is supported by Thumb Execution Environment (ThumbEE), its other features includes automatic null pointer checks on every load and store instruction, an special instruction that call a handler. Another reason is closeness of C to the Assembly language, in most of the cases its instructions directly map to assembly language, C is only one or level two levels of abstraction away from assembly language while Java is at minimum 3 levels abstraction away from assembler. 
References : 1) why-is-c-so-fast-and-why-arent-other-languages-as-fast-or-faster 2) ARM_architecture#Thumb_Execution_Environment_.28ThumbEE.29 3) Linus Torvalds view 
This article is contributed by Mandeep Singh. If you like GeeksforGeeks and would like to contribute, you can also write an article using write.geeksforgeeks.org or mail your article to review-team@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. 
ruhelaa48
C Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Multidimensional Arrays in C / C++
rand() and srand() in C/C++
Core Dump (Segmentation fault) in C/C++
Left Shift and Right Shift Operators in C/C++
Command line arguments in C/C++
fork() in C
Different methods to reverse a string in C/C++
Function Pointer in C
TCP Server-Client implementation in C
Substring in C++