code-rag-bench/online-tutorials huggingface dataset:
Node.js push() function - GeeksforGeeks

14 Oct, 2021
push() is an array function from Node.js that is used to add element to the end of an array.
Syntax:
array_name.push(element)

Parameter: This function takes parameter that has to be added to the array. It can take multiple elements also.
Return type: The function returns the array after adding the element.
The program below demonstrates the working of the function:
Program 1:
function PUSH(){  arr.push(2);  console.log(arr);}var arr = [12, 3, 4, 6, 7, 11];PUSH();
Output:
[ 12,  3, 4, 6, 7, 11, 2]
Program 2:
function addLang(){arr.push('DS','Algo','JavaScript');console.log(arr);}var arr = ['NodeJs'];addLang();    
Output:
[ 'NodeJs', 'DS', 'Algo', 'JavaScript' ]
Program 3:
var Lang = ['java', 'c', 'python'];  console.log(Lang);// expected output: Array [ 'java', 'c', 'python' ]  Lang.push('node');  console.log(Lang);// expected output: Array [ 'java', 'c', 'python', 'node' ]
Output:
[ 'java', 'c', 'python' ]
[ 'java', 'c', 'python', 'node' ]
NodeJS-function
Node.js
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Difference between promise and async await in Node.js
How to use an ES6 import in Node.js?
Express.js res.sendFile() Function
Mongoose | findByIdAndUpdate() Function
Express.js res.redirect() Function
Top 10 Front End Developer Skills That You Need in 2022
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?
Difference between var, let and const keywords in JavaScript
strlwr() function in C - GeeksforGeeks

04 Oct, 2018
The strlwr( ) function is a built-in function in C and is used to convert a given string into lowercase.
Syntax:
char *strlwr(char *str);

Parameter:
str: This represents the given string which we want to convert into lowercase.
Returns: It returns the modified string obtained after converting the characters of the given string str to lowercase.
Note: This is a non-standard function that works only with older versions of Microsoft C.
Below programs illustrate the strlwr() function in C:
Example 1:-
// C program to demonstrate// example of strlwr() function  #include<stdio.h>#include<string.h>  int main(){    char str[ ] = "GEEKSFORGEEKS IS THE BEST";      // converting the given string into lowercase.    printf("%s\n",strlwr (str));      return  0;}
Output:
geeksforgeeks is the best

Example 2:-
// C program to demonstrate// example of strlwr() function.  #include<stdio.h>#include <string.h>  int main(){  char str[] = "CompuTer ScienCe PoRTAl fOr geeKS";    printf("Given string is: %s\n",str);    printf("\nString after converting to the "             "lowercase is: %s",strlwr(str));    return 0;}
Output:
Given string is: CompuTer ScienCe PoRTAl fOr geeKS

String after converting to the lowercase is: computer science portal for geeks

C-Functions
C-Library
C-String
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++
Left Shift and Right Shift Operators in C/C++
fork() in C
Core Dump (Segmentation fault) in C/C++
Command line arguments in C/C++
Substring in C++
Function Pointer in C
Different methods to reverse a string in C/C++
TCP Server-Client implementation in C
Java Regex Example - Character \n Match

The character \n matches the newline character.
The following example shows the usage of character matching.
package com.tutorialspoint;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class CharactersDemo {
   private static final String REGEX = "\n";
   private static final String INPUT = "abc\nabc";

   public static void main(String[] args) {
      // create a pattern
      Pattern pattern = Pattern.compile(REGEX);
      
      // get a matcher object
      Matcher matcher = pattern.matcher(INPUT); 

      if(matcher.find()) {
         //Prints the start index of the match.
         System.out.println("Match String start(): "+matcher.start());
      }
   }
}
Let us compile and run the above program, this will produce the following result −
Match String start(): 3

 Print
 Add Notes
 Bookmark this page
8085 Program to Divide two 8 Bit numbers

In this program, we will see how to divide two 8-bit numbers using 8085 microprocessor.
Write 8085 Assembly language program to divide two 8-bit numbers and store the result at locations 8020H and 8021H.
The 8085 has no division operation. To get the result of the division, we should use the repetitive subtraction method. 
By using this program, we will get the quotient and the remainder. 8020H will hold the quotient, and 8021H will hold the remainder.
We are saving the data at location 8000H and 8001H. The result is storing at location 8050H and 8051H.
The Dividend: 0EHThe Divisor 04HThe Quotient will be 3, and the remainder will be 2
The Dividend: 0EH
The Divisor 04H
The Quotient will be 3, and the remainder will be 2
How to draw on the canvas with JavaScript?

Drawing on the HTML canvas is to be done with JavaScript. Use the HTML DOM Method getElementById() and getContext() before drawing on the canvas.
For that, follow some steps −
You need to use the getElementById() method to find the canvas element.
Use the getContext(), which is drawing object for the canvas. It provides the methods and properties for drawing.
After that draw on the canvas.
You can try to run the following code to draw canvas on JavaScript −
<!DOCTYPE html>
<html>
   <head>
      <title>HTML Canvas</title>
   </head>
   <body>
      <canvas id="newCanvas" width="400" height="250" style="border:2px solid #000000;"></canvas>
      <script>
         var canvas = document.getElementById("newCanvas");
         var ctxt = canvas.getContext("2d");
         ctxt.fillStyle = "#56A7E2";
         ctxt.fillRect(0,0,250,120);
      </script>
   </body>
</html>
Generating a SHA-256 hash from the Linux command line

There are plenty of ways to generate a hash on any operating system, but when we talk about generating an almost-unique and fixed size bit hash, then nothing can replace the SHA algorithm.
Before making use of the Linux command to generate a SHA-256 hash, we must know what SHA actually is and what it is good for.
SHA-256 in very simple terms is a cryptographic hash function that has a digest length of 256 bits. It is an algorithm on its own that is able to generate an almostunique and fixed size 256-bit(32-byte) hash. It is also good to know that this algorithm was actually developed by the NSA (National Security Agency).
Now that we know a little bit about what SHA256 means, let’s explore a simple case where we will print a random hash function that is generated using the SHA256 algorithm against a string value.
Consider the example shown below −
I like Tutorialspoint
If we use the SHA256 algorithm on the above string and convert it into a hash we will get the following output −
1b2ca228e3847e330f006772aa0af2cd307f0ae92c6722cbb0c1533a84ba5339
This might look very interesting at first, and it surely is.
Now, let’s explore two examples where we will learn how we can generate a SHA256 hash on the linux command line.
In the first case, we will make use of the command shown below −
echo -n "TutorialPoint" | openssl dgst -sha256
(stdin)= 62e2de2644fa0987f79f54118c175d6a924e50aa60df1ff38e197eac0da8a963

In the second example, we can remove the openssl and the dgst command and just write the sha256sum command and we will have our hash function generated like above.
Consider the example shown below −
echo -n “TutorialsPoint” | sha256sum
62e2de2644fa0987f79f54118c175d6a924e50aa60df1ff38e197eac0da8a963
We can use either of these approaches as they more or less have the same effect on your operating system.
HTML | method Attribute - GeeksforGeeks

14 Dec, 2021
The HTML | method Attribute is used to specify the HTTP method used to send data while submitting the form. There are two kinds of HTTP Methods, which are GET and POST. The method attribute can be used with the <form> element. Attribute Values:  
GET: It is the default value. In the GET method, after the submission of the form, the form values will be visible in the address bar of the new browser tab. It has a limited size of about 3000 characters. It is only useful for non-secure data not for sensitive information.
POST: In the post method, after the submission of the form, the form values will not be visible in the address bar of the new browser tab as it was visible in the GET method. It appends form data inside the body of the HTTP request. It has no size limitation. This method does not support bookmark the result.  
Syntax:  
<form method="get|post">
Example: This Example illustrates the use of method attribute.  
html
<!DOCTYPE html><html>  <body style="text-align:center;">    <h1 style="color:green;">     GeeksForGeeks </h1>      <h2>HTML  method Attribute</h2>    <form id="users"          action="#"          method="GET"           target="_blank">        First name:          <input type="text"                name="fname"               value="Manas">          <br> Last name:        <input type="text"               name="lname"               value="Chhabra">          <br>        <input type="submit"               value="Submit">    </form>        <p>      After submitting the form,       input values are shown in the address       bar of the window.  </p>      </body>  </html>
Output: 
 
Supported Browsers: The browser supported by HTML Method Attribute are listed below:  
Google Chrome
Internet Explorer
Firefox
Opera
Safari
 
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.
hritikbhatnagar2182
chhabradhanvi
HTML-Attributes
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to Insert Form Data into Database using PHP ?
Form validation using HTML and JavaScript
Types of CSS (Cascading Style Sheet)
HTML Introduction
How to update Node.js and NPM to next version ?
Express.js express.Router() Function
Installation of Node.js on Linux
Differences between Functional Components and Class Components in React
How to create footer to stay at the bottom of a Web page?
How to float three div side by side using CSS?
Write a program in C++ to remove duplicates from a given array of prime numbers

Let us suppose we have given an array N size which consists of all the prime numbers. The task is to find the duplicates in the given array and remove them. For example,
Input-1 −
N = 8
arr[ ] = { 2 ,2 ,2 ,3 ,3 ,3 ,5 ,7 }
Output −
2 3 5 7
Explanation − In the given array of prime numbers there are some duplicates of ‘2’ and ‘3’ after removing the duplicates the output will be 2 3 5 7.
Input-2 −
N = 5
arr[ ] = { 3, 2, 7, 5, 5}
Output −
3 2 7 5
Explanation − In the given array of prime numbers there are some duplicates of ‘5’ after removing the duplicates the output will be 3 2 7 5.
In this problem, we use a number array which will verify the number is visited in the array or not. If the array element is not visited, then make it as ‘1’ and insert it into the result otherwise no need to insert the element.
Take Input of N size of the vector array with elements.
Take Input of N size of the vector array with elements.
An integer Vector array removeDuplicates(vector<int>&arr, int size) which takes an array and its size as an Input.
An integer Vector array removeDuplicates(vector<int>&arr, int size) which takes an array and its size as an Input.
An integer array which we use to detect and verify whether our current element is visited or not. If any of the elements is visited (i.e., ‘1’) in the array while inserting, then we will not push that particular element into the vector Otherwise push the element in the vector array.
An integer array which we use to detect and verify whether our current element is visited or not. If any of the elements is visited (i.e., ‘1’) in the array while inserting, then we will not push that particular element into the vector Otherwise push the element in the vector array.
The resultant vector would contain only the unique prime numbers.
The resultant vector would contain only the unique prime numbers.
#include<bits/stdc++.h>
using namespace std;
vector<int>removeDuplicates(vector<int>&arr, int size){
   int num[100] ={0};
   vector<int> vec;
   for(int i=0;i<size;i++){
      if(num[arr[i]] ==0){
         num[arr[i]]=1;
         vec.push_back(arr[i]);
      }
   }
   return vec;
}
int main(){
   int N= 8;
   vector<int>arr={2,2,2,3,3,3,5,7};
   vector<int>answer= removeDuplicates(arr,N);
   for(int i=0;i<answer.size();i++){
      cout<<removeDuplicates(arr,N)<<endl;
   }
   return 0;
}
If we will run the above code then it will print the output as,
2 3 5 7
If we remove the duplicates, the output will be 2 3 5 7.
Match MongoDB documents with field value greater than a specific number and fetch them?

To match, use $match in MongoDB. For values greater than a specific number, use $gt. Let us create a collection with documents −
> db.demo730.insertOne({"Name" : "Chris", "Marks" : 33 });
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5eac54cd56e85a39df5f6339")
}
> db.demo730.insertOne({ "Name" : "David", "Marks" : 89});
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5eac54cd56e85a39df5f633a")
}
> db.demo730.insertOne({ "Name" : "Chris", "Marks" : 45 });
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5eac54ce56e85a39df5f633b")
}
Display all documents from a collection with the help of find() method −
> db.demo730.find();
This will produce the following output −
{ "_id" : ObjectId("5eac54cd56e85a39df5f6339"), "Name" : "Chris", "Marks" : 33 }
{ "_id" : ObjectId("5eac54cd56e85a39df5f633a"), "Name" : "David", "Marks" : 89 }
{ "_id" : ObjectId("5eac54ce56e85a39df5f633b"), "Name" : "Chris", "Marks" : 45 }
Following is the query to match MongoDB documents with field value greater than a specific number and fetch them −
> db.demo730.aggregate([
...    { $sort: { _id: -1 } },
...    { $limit: 3 },
...    {$match: { $or: [ {"Name": "Chris", "Marks": { "$gt": 40 }}, {"Name": "David"} ]}}
... ])
This will produce the following output −
{ "_id" : ObjectId("5eac54ce56e85a39df5f633b"), "Name" : "Chris", "Marks" : 45 }
{ "_id" : ObjectId("5eac54cd56e85a39df5f633a"), "Name" : "David", "Marks" : 89 }
Unique Number of Occurrences in Python

Suppose we have an array. We have to check whether each element has unique number of occurrences. If no such element is present then return false, otherwise true. So if the array is like [1, 1, 2, 2, 2, 3, 4, 4, 4, 4], then it will return true as the element 1 is present two times, 2 is present three times, 3 is present once and 4 is present four times.
To solve this, we will follow these steps −
We will find the frequency of elements of the array
for each key-value pair in the frequency mapif value is present in another map mp, then return falseput mp[value] := 1
if value is present in another map mp, then return false
put mp[value] := 1
return true
Let us see the following implementation to get better understanding −
 Live Demo
class Solution(object):
   def uniqueOccurrences(self, arr):
      d = {}
      for i in arr:
         if i not in d:
            d[i] =1
         else:
            d[i]+=1
      l = {}
      for x, y in d.items():
         if y in l:
            return False
         l[y] = 1
      return True
ob1 = Solution()
print(ob1.uniqueOccurrences([1,1,2,2,2,3,4,4,4,4]))
[1,1,2,2,2,3,4,4,4,4]
true
How to save and load cookies using Python Selenium WebDriver?

We can save and load cookies with Selenium webdriver in Python. A cookie is an information saved by the browser about the application. A cookie is stored in a key value pair.
It is generally used to hold the credentials of users. It also stores information about the user actions on the browser within the cookie file. We can add, obtain and delete cookies of the browser.
c = driver.get_cookies()
ck = { 'name': 'Selenium', 'value': 'Java'}
driver.add_cookie(ck)
Code Implementation
from selenium import webdriver
driver = webdriver.Chrome (executable_path="C:\\chromedriver.exe")
driver.maximize_window()
driver.get("https://www.tutorialspoint.com/index.htm")
#get current cookies
c = driver.get_cookies()
print(c)
#count cookies with len method
print(len(c))
# load a new cookie
ck = { 'name': 'Selenium', 'value': 'Java'}
# save new cookie
driver.add_cookie(ck)
#get new cookies and total count after addition
ch = driver.get_cookies()
print(ch)
print(len(ch))
CSS cross-fade Property - GeeksforGeeks

16 Jul, 2020
The cross-fade property is used to form a kind of a blend between two given images. In simple words, it is used to mix to images into one another in terms of percentage.
Syntax:
cross-fade( <image, <image>, <percentage> )
Property value:
It has not property values, instead, it takes two images and a number indicating the amount of blending required.
Example 1:
cross-fade at 0% where the first image is white and the second image is black then blending is done in such a way that there is 85 parts of the white image and 15 parts of black.
<!DOCTYPE html><html lang="en"><head>  <meta charset="UTF-8">  <meta name="viewport"         content="width=device-width,                 initial-scale=1.0">  <title>Document</title></head><style>#box{    width: 250px;    height: 150px;    /* 15 parts of black and 85 parts of white */    background-image: -webkit-cross-fade(      url("https://media.geeksforgeeks.org/wp-content/uploads/20200714125439/w-200x141.JPG")      ,url("https://media.geeksforgeeks.org/wp-content/uploads/20200714125445/b-300x173.JPG")      ,15%);}</style><body>  <h1>Cross-fade</h1>  <div id="box">  </div></body></html>
Output:
Example 2:
cross-fade at 0% where the first image is black and the second image is white then blending is done in such a way that there is 0 parts of the white image and 100 parts of black.
<!DOCTYPE html><html lang="en"><head>  <meta charset="UTF-8">  <meta name="viewport"         content="width=device-width,                  initial-scale=1.0">  <title>Document</title></head><style>#box{    width: 250px;    height: 150px;    /* 15 parts of black and 85 parts of white */    background-image:    -webkit-cross-fade(    url("https://media.geeksforgeeks.org/wp-content/uploads/20200714125445/b-300x173.JPG"),    url("https://media.geeksforgeeks.org/wp-content/uploads/20200714130459/01.JPG"),    0%);}</style><body>  <h1>Cross-fade at 0%</h1>  <div id="box">  </div></body></html>
Output:
Supported Browsers:
Firefox 3.0
Edge
Chrome
Safari
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.
CSS-Properties
CSS
HTML
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Design a web page using HTML and CSS
Form validation using jQuery
How to set space between the flexbox ?
Search Bar using HTML, CSS and JavaScript
How to style a checkbox using CSS?
How to set the default value for an HTML <select> element ?
How to set input type date in dd-mm-yyyy format using HTML ?
Hide or show elements in HTML using display property
How to Insert Form Data into Database using PHP ?
REST API (Introduction)
Difference between res.send and res.json in Express.js

Whenever an Express application server receives an HTTP request, it will
provide the developer with an object, commonly referred to as res. For
example,
app.get('/test', (req, res) => {
   // use req and res here
})
The res object basically refers to the response that'll be sent out as
part of this API call.
The res.send function sets the content type to text/Html which means that
the client will now treat it as text. It then returns the response to the
client.
The res.json function on the other handsets the content-type header to
application/JSON so that the client treats the response string as a valid
JSON object. It also then returns the response to the client.
Write a Golang program to find duplicate elements in a given array

Input Array = [1, 3, 5, 6, 1] => Duplicate element is 1;
Input Array = [1, 3, 5, 6, 7] => return -1
Step 1: Define a method that accepts an array.
Step 2: Declare a visited map.
Step 3: Iterate the given array. If the element exists in the visited map, then return that element.
Step 4: Else, return -1.
Live Demo
package main
import "fmt"
func duplicateInArray(arr []int) int{
   visited := make(map[int]bool, 0)
   for i:=0; i<len(arr); i++{
      if visited[arr[i]] == true{
         return arr[i]
      } else {
         visited[arr[i]] = true
      }
   }
   return -1
}

func main(){
   fmt.Println(duplicateInArray([]int{1, 4, 7, 2, 2}))
   fmt.Println(duplicateInArray([]int{1, 4, 7, 2, 3}))
}
2
-1
Best way to store date/time in MongoDB?

There are two different ways by which you can store date/time in MongoDB. In the first approach, you can use Date objects like JavaScript. The Date object is the best way to store date/time in MongoDB. The syntax is as follows:
new Date();
In the second approach, you can use ISODate(). The syntax is as follows:
new ISODate();
To understand the above syntax, let us create a collection with documents following the first approach. The query to create a collection with document is as follows:
The first approach:
> db.ProductsInformation.insertOne({"ProductId":"Product-1","ProductDeliveryDateTime":new
Date()});
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5c6ec6786fd07954a4890686")
}
The second approach:
> db.ProductsInformation.insertOne({"ProductId":"Product-2","ProductDeliveryDateTime":new
ISODate()});
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5c6ec6846fd07954a4890687")
}
Display all documents from the collection with the help of find() method. The query is as follows:
> db.ProductsInformation.find().pretty();
The following is the output:
{
   "_id" : ObjectId("5c6ec6786fd07954a4890686"),
   "ProductId" : "Product-1",
   "ProductDeliveryDateTime" : ISODate("2019-02-21T15:40:40.901Z")
}
{
   "_id" : ObjectId("5c6ec6846fd07954a4890687"),
   "ProductId" : "Product-2",
   "ProductDeliveryDateTime" : ISODate("2019-02-21T15:40:52.684Z")
}
Note: The best way to store date/time objects is with Date object.
TypeScript - Array splice()

splice() method changes the content of an array, adding new elements while removing old elements.
array.splice(index, howMany, [element1][, ..., elementN]);

index − Index at which to start changing the array.
index − Index at which to start changing the array.
howMany − An integer indicating the number of old array elements to remove. If howMany is 0, no elements are removed.
howMany − An integer indicating the number of old array elements to remove. If howMany is 0, no elements are removed.
element1, ..., elementN − The elements to add to the array. If you don't specify any elements, splice simply removes the elements from the array.
element1, ..., elementN − The elements to add to the array. If you don't specify any elements, splice simply removes the elements from the array.
Returns the extracted array based on the passed parameters.
var arr = ["orange", "mango", "banana", "sugar", "tea"];  
var removed = arr.splice(2, 0, "water");  
console.log("After adding 1: " + arr );  
console.log("removed is: " + removed); 
          
removed = arr.splice(3, 1);  
console.log("After removing 1: " + arr );  
console.log("removed is: " + removed);

On compiling, it will generate the same code in JavaScript.
Its output is as follows −
After adding 1: orange,mango,water,banana,sugar,tea 
removed is:  
After removing 1: orange,mango,water,sugar,tea 
removed is: banana


    45 Lectures 
     4 hours 

 Antonio Papa

    41 Lectures 
     7 hours 

 Haider Malik

    60 Lectures 
     2.5 hours 

 Skillbakerystudios

    77 Lectures 
     8 hours 

 Sean Bradley

    77 Lectures 
     3.5 hours 

 TELCOMA Global

    19 Lectures 
     3 hours 

 Christopher Frewin
 Print
 Add Notes
 Bookmark this page
C++ Queue Library - top() Function

The C++ function std::priority_queue::top() returns a reference to the first element of the priority_queue. This element will be removed after performing pop operation on priority_queue.
Following is the declaration for std::priority_queue::top() function form std::queue header.
const value_type& top() const;

const_reference top() const;

None
Returns reference to the top element of the priority_queue.
This member function never throws exception.
Constant i.e. O(1)
The following example shows the usage of std::priority_queue::top() function.
#include <iostream>
#include <queue>

using namespace std;

int main(void) {
   auto it = {3, 1, 5, 2, 4};
   priority_queue<int> q(less<int>(), it);

   cout << "Queue contents are" << endl;
   while (!q.empty()) {
      cout << q.top() << endl;
      q.pop();
   }

   return 0;
}
Let us compile and run the above program, this will produce the following result −
Queue contents are
5
4
3
2
1

 Print
 Add Notes
 Bookmark this page
Suspense in ReactJS

In this article, we will learn how to show a loader while the component is being lazily loaded.
When the components are lazily loaded, it requires a fallback to be shown to indicate that the component is being loaded in the DOM.
<Suspense>
In this example, we will build a Routing application that lazily loads the component and displays a loader while the component is being loaded lazily.
App.jsx
import React, { Suspense, lazy } from 'react';
import { BrowserRouter as Router, Route } from 'react-router-dom';
import Loader from './Loader.js';

const Contact = lazy(() => import('./Contact'));

const App = () => (
   <Router>
   <Suspense fallback={<Loader />}>
   <Route exact path="/contact" component={Contact} />
   <Route
      path="/"
      exact
      render={() => (
         <div>
            <h1>TutorialsPoint</h1>
            <a href="/contact">Contact Us</a>
         </div>
      )}
   />
   </Suspense>
   </Router>
);
export default App;
Contact.js
import React from 'react';

const Contact = () => {
   return (
      <div>
         <h1>Contact Us</h1>
         <h4>You already know us</h4>
      </div>
   );
};
export default Contact;
Loader.js
import React from 'react';

const Loader = () => {
   return <div>Please wait...</div>;
};
export default Loader;
In the above example, when the component is being lazily loaded, the Loader component is loaded in the DOM as a fallback to this component.
This will produce the following result.
Java Program for ShellSort

Shell sort is a sorting technique that is similar to insertion sort, wherein elements are sorted which are at far ends (either ends) of the array. This way, the interval size between the next and the second to last element reduces. This happens for all the elements in the array until the interval distance is reduced to 0.
Following is an example for ShellSort in Java −
 Live Demo
public class Demo {
   int shell_sort(int my_arr[]) {
      int arr_len = my_arr.length;
      for (int gap = arr_len / 2; gap > 0; gap /= 2) {
         for (int i = gap; i < arr_len; i += 1) {
            int temp = my_arr[i];
            int j;
            for (j = i; j >= gap && my_arr[j - gap] > temp; j -= gap)
            my_arr[j] = my_arr[j - gap];
            my_arr[j] = temp;
         }
      }
      return 0;
   }
   public static void main(String args[]) {
      int my_arr[] = { 12, 34, 54, 2, 3 };
      Demo my_instance = new Demo();
      my_instance.shell_sort(my_arr);
      System.out.println("The array, after performing shell sort is : ");
      int arr_len = my_arr.length;
      for (int i = 0; i < arr_len; ++i)
      System.out.print(my_arr[i] + " ");
      System.out.println();
   }
}
The array, after performing shell sort is :
2 3 12 34 54
This algorithm sorts the elements that are far apart from each other, thereby reducing the interval between those two elements. It can be understood as being a generalized version of insertion sort. Elements at specific intervals in an array are sorted first, their interval distance reduces, thereby sorting all elements in the process.
When the first loop is iterated, the size of the array is taken and elements between size/2 are compared and swapped if they are not sorted. The same thing is repeated for all other elements. The elements are sorted by defining a temporary variable, and swapping the elements.
In the second loop iteration, size/4 elements are compared and sorted. The same process goes on for the remaining elements, thereby sorting them. In the main function, the array is defined, and ‘shell_sort’ function is called by passing this array as a parameter.
Does Python have a string 'contains' substring method?

No python doesn't have a 'contains' substring method. Instead you could use either of the below 2 methods:
Python has a keyword 'in' for finding if a string is a substring of another string. For example,
>>> 'ello' in 'hello world'
True
>>> 'no' in 'hello'
False
If you also need the first index of the substring, you can use find(substr) to find the index. If this method returns -1, it means that substring doesn't exist in the string. For example,
>>> 'hello world'.find('ello')
1
>>> 'hello'.find('no')
-1
Explain the Stroke Width property of 2D shapes in JavaFX

The stroke width property specifies the width of the boundary line of a shape. You can set the width using the setWidth() method of the javafx.scene.shape.Shape class. This method accepts double value as a parameter and draws a boundary of the specified width.
If you haven’t passed any value as a parameter to this method it considers the width as 1.0 by default.
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.scene.shape.Polygon;
import javafx.scene.text.Font;
import javafx.scene.text.FontPosture;
import javafx.scene.text.FontWeight;
import javafx.scene.text.Text;
import javafx.stage.Stage;
public class StrokeWidthExample extends Application {
   public void start(Stage stage) {
      Font font = Font.font("verdana", FontWeight.BOLD, FontPosture.REGULAR, 12);
      Text label1 = new Text("Original Image");
      label1.setFont(font);
      label1.setX(250.0);
      label1.setY(125.0);
      Polygon rhombus1 = new Polygon(300.0, 0.0, 250.0, 50.0, 300.0, 100.0, 350.0, 50.0);
      Text label2 = new Text("Stroke Width: none");
      label2.setFont(font);
      label2.setX(25.0);
      label2.setY(275.0);
      Polygon rhombus2 = new Polygon(100.0, 150.0, 50.0, 200.0, 100.0, 250.0, 150.0, 200.0);
      rhombus2.setStroke(Color.BLUE);
      Text label3 = new Text("Stroke Width: 3");
      label3.setFont(font);
      label3.setX(250.0);
      label3.setY(275.0);
      Polygon rhombus3 = new Polygon(300.0, 150.0, 250.0, 200.0, 300.0, 250.0, 350.0, 200.0);
      rhombus3.setStroke(Color.BLUE);
      rhombus3.setStrokeWidth(3.0);
      Text label4 = new Text("Stroke Width: 10");
      label4.setFont(font);
      label4.setX(430.0);
      label4.setY(275.0);
      Polygon rhombus4 = new Polygon(490.0, 150.0, 440, 200.0, 490.0, 250.0, 540.0, 200.0);
      rhombus4.setStroke(Color.BLUE);
      rhombus4.setStrokeWidth(10.0);
      //Creating a Group object
      Group root = new Group(label1, label2, label3, label4, rhombus1, rhombus2, rhombus3, rhombus4);
      //Creating a scene object
      Scene scene = new Scene(root, 595, 310);
      //Setting title to the Stage
      stage.setTitle("Stroke Width");
      //Adding scene to the stage
      stage.setScene(scene);
      //Displaying the contents of the stage
      stage.show();
   }
   public static void main(String args[]){
      launch(args);
   }
}
How to call jQuery function with JavaScript function?

To call jQuery function with a JavaScript function, try the following code.
 Live Demo
<!DOCTYPE html>
<html>
   <body>
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
      <script>
         $.myjQuery = function() {
            alert("jQuery");
         };
         $(document).ready(function() {
            alert("Welcome!");
         });
         function display() {
            $.myjQuery();
         };
      </script>
      <input type="button" value="submit" onclick=" display();">
   </body>
</html>
How to Delete Multiple Columns in R DataFrame?

19 Dec, 2021
In this article, we will discuss how to delete multiple columns in R Programming Language. We can delete multiple columns in the R dataframe by assigning null values through the list() function.
Syntax:
data[ , c(‘column_name1’, ‘column_name2’,...........,’column_nam en)] <- list(NULL)
where, data is the input dataframe
Example: R program to create a dataframe and assign columns to null.
R
# dataframedata = data.frame(column1=c(70, 76, 89),                  column2=c(90, 79, 100),                  column3=c(23, 4, 56),                  column4=c(23, 45, 21))    # displayprint(data)  # delete three columnsprint(data[, c('column1', 'column2', 'column3')] < - list(NULL))
Output:
We can also delete columns using index of columns.
Syntax:
dataframe[ , column_index_start:column_index_end] <- list(NULL)
Where , 
dataframe is the input dataframe
column_index are the column positions
Example:
R
# dataframedata = data.frame(column1=c(70, 76, 89),                  column2=c(90, 79, 100),                  column3=c(23, 4, 56),                  column4=c(23, 45, 21))    # displayprint(data)  # delete three columnsprint(data[, 1:3] < - list(NULL))
Output:
Picked
R DataFrame-Programs
R-DataFrame
R Language
R Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Split Column Into Multiple Columns in R DataFrame?
Change Color of Bars in Barchart using ggplot2 in R
Group by function in R using Dplyr
How to Change Axis Scales in R Plots?
How to import an Excel File into R ?
How to Split Column Into Multiple Columns in R DataFrame?
Replace Specific Characters in String in R
How to filter R DataFrame by values in a column?
Extract First or Last n Characters from String in R
Merge DataFrames by Column Names in R
Print pyramid of tutorialspoint in PL/SQL

PL/SQL stands for “Procedural Language extension to SQL” . It is the mixture of SQL and Procedural features provided by programming language. It was developed by Oracle Corporation in the late 1980s as procedural extension language for SQL and the Oracle relational database.
PL/SQL programs consists of blocks that can be nested and a block structure look likes this −
DECLARE
   -- it contains declaration statements
BEGIN
   -- It contains executable statements
EXCEPTIONS
   -- It contains exception handling statements
END;
In PL/SQL single-line comments begin with double hyphen(--) and Multi-line comments begin with a slash-asterisk ( /* ) and end with an asterisk-slash ( */ )
--Declaration Block
   DECLARE
-- Declaration of string for tutorialspoint
   St VARCHAR2(100) := 'tutorialspoint';
-- length(len) of string and number(numb) for rows
   len VARCHAR2(100);
   numb NUMBER(15);
-- Execution part starts from here
   BEGIN
--calculating length of string
   numb:=LENGTH(St);
-- strting of while from num to till num>1
   WHILE numb>=1
   LOOP
      len:=SUBSTR(St,1,numb);
      numb:=numb-1;
      DBMS_OUTPUT.PUT_LINE(len);
   END LOOP;
-- end of begining block
END;
-- End program
If we run above program then it will generate following output
tutorialspoint
tutorialspoin
tutorialspoi
tutorialspo
tutorialsp
tutorials
tutorial
tutoria
tutori
tutor
tuto
tut
tu 
t
HTML <td> colspan Attribute

The colspan attribute of the <td> element in HTML defines the number of columns a cell should span.
Following is the syntax −
<td colspan="num">
Above, num is the count of columns a cell should span.
Let us now see an example to implement the colspan attribute of the <td> element −
 Live Demo
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
   border: 2px solid blue;
}
</style>
</head>
<body>
<h2>Product Expenses</h2>
<table>
   <tr>
      <th>Domains</th>
      <th>Cost</th>
   </tr>
   <tr>
      <td>Product Development</td>
      <td>500000</td>
   </tr>
   <tr>
      <td>Marketing</td>
      <td>500000</td>
   </tr>
   <tr>
      <td>Services</td>
      <td>100000</td>
   </tr>
   <tr>
      <td>Support</td>
      <td>100000</td>
   </tr>
   <tr>
      <td>Maintenance</td>
      <td>100000</td>
   </tr>
   <tr>
      <td colspan="2">Total Budget = INR 1300000</td>
   </tr>
</table>
</body>
</html>
How to check if an object is an instance of a Class in JavaScript?

Following is the code to check if an object is an instance of a class 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-size: 20px;
      font-weight: 500;
      color: blueviolet;
   }
</style>
</head>
<body>
<h1>Check if an object is an instance of a Class</h1>
<div class="result"></div>
<button class="Btn">CLICK HERE</button>
<h3>Click on the above button to check if student1 object is an instance of Student</h3>
<script>
   let resEle = document.querySelector(".result");
   function Student(name, age, standard) {
      this.name = name;
      this.age = age;
      this.standard = standard;
   }
   let student1 = new Student("Rohan", 18, 12);
   document.querySelector(".Btn").addEventListener("click", () => {
      if (student1 instanceof Student) {
         resEle.innerHTML = "student1 is instance of Student";
      } else {
         resEle.innerHTML = "student1 is not an instance of Student";
      }
   });
</script>
</body>
</html>
On clicking the ‘CLICK HERE’ button −
Port Scanner using Python - GeeksforGeeks

08 Dec, 2021
Prerequisites: Socket Programming in Python
This article is just to provide a sample code to generate a Port Scanner. This Port Scanner will work for both the Web Applications as well as remote Host. This tool has been created to provide the basic functionality of a Port Scanner. The general concept of Sockets had been used to provide the functionality. Port Scanner is built on Python 3 and uses some extra libraries such as socket and pyfiglet (for a fancy banner). 
Please find the below source code for the Port Scanner : 
Source Code 
Python3
import pyfigletimport sysimport socketfrom datetime import datetime  ascii_banner = pyfiglet.figlet_format("PORT SCANNER")print(ascii_banner)  # Defining a targetif len(sys.argv) == 2:         # translate hostname to IPv4    target = socket.gethostbyname(sys.argv[1])else:    print("Invalid amount of Argument") # Add Bannerprint("-" * 50)print("Scanning Target: " + target)print("Scanning started at:" + str(datetime.now()))print("-" * 50)  try:         # will scan ports between 1 to 65,535    for port in range(1,65535):        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)        socket.setdefaulttimeout(1)                 # returns an error indicator        result = s.connect_ex((target,port))        if result ==0:            print("Port {} is open".format(port))        s.close()         except KeyboardInterrupt:        print("\n Exiting Program !!!!")        sys.exit()except socket.gaierror:        print("\n Hostname Could Not Be Resolved !!!!")        sys.exit()except socket.error:        print("\ Server not responding !!!!")        sys.exit()
Output:
Note: In the above code at line 27 i.e for the port in range(1, 65535): you can custom define your ports under which range you have to scan. This port scanner will generally take the time of 2 mins maximum to produce output in the format, that so and so ports are open or closed. 
sagar0719kumar
Python-socket
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
Enumerate() in Python
How to Install PIP on Windows ?
Iterate over a list in Python
Different ways to create Pandas Dataframe
Python String | replace()
Create a Pandas DataFrame from Lists
Reading and Writing to text files in Python
*args and **kwargs in Python
Absolute Values Sum Minimization in JavaScript

Suppose, we are given a sorted array of integers, let us call it arr. We are required to find such an integer x that the value of −
abs(a[0] - x) + abs(a[1] - x) + ... + abs(a[a.length - 1] - x)
is the smallest possible (here abs denote the absolute value). If there are several possible answers, output the smallest one.
For example −
For,
arr = [2, 4, 7],
the output should be −
absoluteValuesSumMinimization(arr) = 4
because abs(2 - 4) + abs(4 - 4) + abs(7 - 4) = 5 which is the smallest we can achieve with any number.
We know that,
arr.length/2
returns half the length.
For even-length arrays, this will be to the right of the middle. For odd-length arrays, it'll be the middle.
Math.ceil(arr.length/2) rounds up if necessary, so the middle of an array of 5 would be 2.5 -> 3. This makes the odd-length arrays off by one.
Math.ceil(arr.length/2) rounds up if necessary, so the middle of an array of 5 would be 2.5 -> 3. This makes the odd-length arrays off by one.
Math.ceil(arr.length/2)-1 goes down one index. This corrects off-by-one errors for all the arrays.
Math.ceil(arr.length/2)-1 goes down one index. This corrects off-by-one errors for all the arrays.
Following is the code −
const arr = [2, 4, 7];
const absoluteValuesSumMinimization = (arr = []) => {
   const res = [];
   arr.forEach(num => {
      const sum = arr.reduce((accum, next) => {
         return accum + Math.abs(next - num);
      }, 0);
      res.push(sum);
   });
   const lowest = Math.min(...res);
   return arr[res.indexOf(lowest)];
};
console.log(absoluteValuesSumMinimization(arr));
Following is the output on console −
4
C# | Dictionary.ContainsKey() Method - GeeksforGeeks

01 Feb, 2019
This method is used to check whether the Dictionary<TKey,TValue> contains the specified key or not.
Syntax:
public bool ContainsKey (TKey key);

Here, the key is the Key which is to be located in the Dictionary.
Return Value: This method will return true if the Dictionary contains an element with the specified key otherwise, it returns false.
Exception: This method will give ArgumentNullException if the key is null.
Below are the programs to illustrate the use of Dictionary<TKey,TValue>.ContainsKey() Method:
Example 1:
// C# code to check if a key is // present or not in a Dictionary.using System;using System.Collections.Generic;  class GFG {      // Driver code    public static void Main()    {          // Create a new dictionary of        // strings, with string keys.        Dictionary<string, string> myDict =           new Dictionary<string, string>();          // Adding key/value pairs in myDict        myDict.Add("Australia", "Canberra");        myDict.Add("Belgium", "Brussels");        myDict.Add("Netherlands", "Amsterdam");        myDict.Add("China", "Beijing");        myDict.Add("Russia", "Moscow");        myDict.Add("India", "New Delhi");          // Checking for Key "India"        if (myDict.ContainsKey("India"))            Console.WriteLine("Key : India is present");          else            Console.WriteLine("Key : India is absent");    }}
Key : India is present

Example 2:
// C# code to check if a key is // present or not in a Dictionary.using System;using System.Collections.Generic;  class GFG {      // Driver code    public static void Main()    {          // Create a new dictionary of         // strings, with string keys.        Dictionary<string, string> myDict =            new Dictionary<string, string>();          // Adding key/value pairs in myDict        myDict.Add("Australia", "Canberra");        myDict.Add("Belgium", "Brussels");        myDict.Add("Netherlands", "Amsterdam");        myDict.Add("China", "Beijing");        myDict.Add("Russia", "Moscow");        myDict.Add("India", "New Delhi");          // Checking for Key "USA"        if (myDict.ContainsKey("USA"))            Console.WriteLine("Key : USA is present");          else            Console.WriteLine("Key : USA is absent");    }}
Key : USA is absent

Reference:
https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.dictionary-2.containskey?view=netframework-4.7.2
CSharp Dictionary Class
CSharp-Generic-Namespace
CSharp-method
C#
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
C# | Class and Object
C# | String.IndexOf( ) Method | Set - 1
Extension Method in C#
C# | Constructors
C# | Delegates
Introduction to .NET Framework
C# | Data Types
Basic CRUD (Create, Read, Update, Delete) in ASP.NET MVC Using C# and Entity Framework
C# | Replace() Method
Partial Classes in C#
Count Fibonacci numbers in given range in O(Log n) time and O(1) space in C++

We are given the range having start and end numbers and the task is to calculate the total count of Fibonacci numbers available between the given range in O(Log n) time and O(1) space.
Fibonacci numbers are the sequence of numbers known as Fibonacci sequence where every new number is the sum of the last two preceding numbers.
Where, f(0) = 0 and f(1) = 1 i.e. f(0) and f(1) have fixed positions in the sequence and the calculation will start from the third number.
Formula used for calculating the sequence is −
Fn = Fn-1 + Fn-2
Where,
F0 = 0, F1 = l
For Example
Input − start = 6 and last = 100
Output − Number of fibonacci Numbers in the series are 6
Explanation − fibonacci numbers between 6 and 100 are 8, 13, 21, 34, 55, 89 i.e. total count is 6
Input − start = 0 and last = 8
Output − Number of fibonacci Numbers in the series are 7
Explanation − fibonacci numbers between 0 and 8 are 0, 1, 1, 2, 3, 5, 8 i.e. total count is 7
Input the start and end numbers to create a range
Input the start and end numbers to create a range
Declare and initialise fib1 to 0, fib2 to 1, fib3 to 1
Declare and initialise fib1 to 0, fib2 to 1, fib3 to 1
Declare a temporary variable res and initialise it with 0
Declare a temporary variable res and initialise it with 0
Start a loop, while fib1 is less than or equals to end
Start a loop, while fib1 is less than or equals to end
Inside the loop, check if fib1 is greater than or equals to the start then increment the res by 1
Inside the loop, check if fib1 is greater than or equals to the start then increment the res by 1
Set fib1 to fib2, fib2 to fib3 and fib3 to fib1 + fib2
Set fib1 to fib2, fib2 to fib3 and fib3 to fib1 + fib2
Return res
Return res
Print the result
Print the result
 Live Demo
#include <bits/stdc++.h>
using namespace std;
// function to count fibonacci numbers in range
// from start to last
int count_fibonacci(int start, int last){
   // First three Fibonacci Numbers
   int fib1 = 0, fib2 = 1, fib3 = 1;
   // res to count the number of fibonacci
   int res = 0;
   while (fib1 <= last){
      if (fib1 >= start){
         res++;
      }
      fib1 = fib2;
      fib2 = fib3;
      fib3 = fib1 + fib2;
   }
   return res;
}
// main function
int main(){
   int start = 6, last = 100;
   cout << "Number of fibonacci Numbers in the series are "
   << count_fibonacci(start, last);
   return 0;
}
If we run the above code it will generate the following output −
Number of fibonacci Numbers in the series are 6
How to plot 3D graphs using Python Matplotlib?

To plot 3D graphs using Python, we can take the following steps −
Create a new figure or activate an existing figure using figure() method.
Create a new figure or activate an existing figure using figure() method.
Get the 3D axes object.
Get the 3D axes object.
Make x, y, and z lists for data points.
Make x, y, and z lists for data points.
Add 3D scatter points using scatter3D() method, with x, y, and z data points with markersize=150 and marker=diamond.
Add 3D scatter points using scatter3D() method, with x, y, and z data points with markersize=150 and marker=diamond.
To display the figure, use show() method.
To display the figure, use show() method.
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import pyplot as plt
plt.rcParams["figure.figsize"] = [7.00, 3.50]
plt.rcParams["figure.autolayout"] = True
fig = plt.figure()
ax = Axes3D(fig)
x = [2, 4, 6, 3, 1]
y = [1, 6, 8, 1, 3]
z = [3, 4, 10, 3, 1]
ax.scatter3D(x, y, z, c=z, alpha=1, marker='d', s=150)
plt.show()