code-rag-bench/online-tutorials huggingface dataset:
Convert list of string into sorted list of integer in Python

Analysing data using python can bring us scenario when we have to deal with numbers represented as strings. In this article we will take a list which has numbers present as strings and we need to convert then to integers and then represent them in a sorted manner.
In this approach we apply the int function to every element of the list using map. Then we apply the sorted function to the list which sorts the numbers. It can handle negative numbers also.
 Live Demo
listA = ['54', '21', '-10', '92', '5']
# Given lists
print("Given list : \n", listA)
# Use mapp
listint = map(int, listA)
# Apply sort
res = sorted(listint)
# Result
print("Sorted list of integers: \n",res)
Running the above code gives us the following result −
Given list :
['54', '21', '-10', '92', '5']
Sorted list of integers:
[-10, 5, 21, 54, 92]
In this approach we apply the int function by using a for loop and store the result into a list. Then the sort function is applied to the list. The final result shows the sorted list.
 Live Demo
listA = ['54', '21', '-10', '92', '5']
# Given lists
print("Given list : \n", listA)
# Convert to int
res = [int(x) for x in listA]
# Apply sort
res.sort()
# Result
print("Sorted list of integers: \n",res)
Running the above code gives us the following result −
Given list :
['54', '21', '-10', '92', '5']
Sorted list of integers:
[-10, 5, 21, 54, 92]
This approach is similar to above except that we apply int function through a for loop and enclose the result in the sorted function. It is a single expression which gives us the final result.
 Live Demo
listA = ['54', '21', '-10', '92', '5']
# Given lists
print("Given list : \n", listA)
# Convert to int
res = sorted(int(x) for x in listA)
# Result
print("Sorted list of integers: \n",res)
Running the above code gives us the following result −
Given list :
['54', '21', '-10', '92', '5']
Sorted list of integers:
[-10, 5, 21, 54, 92]
How to get the first day of the previous month in MySQL?

With the help of following MySQL query, we can get the first day of previous month −
mysql> SELECT DATE_FORMAT(CURDATE() - INTERVAL 1 MONTH,'%Y-%m-01') AS 'FIRST DAY OF PREVOIUS MONTH';
+-----------------------------+
| FIRST DAY OF PREVOIUS MONTH |
+-----------------------------+
| 2017-09-01                  |
+-----------------------------+
1 row in set (0.00 sec)
IntStream sum() in Java - GeeksforGeeks

06 Dec, 2018
IntStream sum() returns the sum of elements in this stream. This is a special case of a reduction. IntStream sum() is a terminal operation i.e, it may traverse the stream to produce a result or a side-effect.
Note : A reduction operation (also called a fold) takes a sequence of input elements and combines them into a single summary result by repeated application of a combining operation, such as finding the sum or maximum of a set of numbers.
Syntax :
int sum()

Return Value : The function returns the sum of elements in this stream.
Example 1 :
// Java code for IntStream.sum() to// find the sum of elements in IntStreamimport java.util.*;import java.util.stream.IntStream;  class GFG {      // Driver code    public static void main(String[] args)    {        // Creating an IntStream        IntStream stream = IntStream.of(2, 4, 6, -2, -4);          // Using IntStream.sum() to find        // sum of elements in IntStream        int sumOfElements = stream.sum();          // Displaying the calculated sum        System.out.println(sumOfElements);    }}
6

Example 2 :
// Java code for IntStream.sum() to// find the sum of elements// divisible by 3 in given rangeimport java.util.*;import java.util.stream.IntStream;  class GFG {      // Driver code    public static void main(String[] args)    {        // Using IntStream.sum() to find        // sum of elements dividible by 3        // in given range        int sumOfElements = IntStream.range(2, 10)                           .filter(num -> num % 3 == 0)                           .sum();          // Displaying the calculated sum        System.out.println(sumOfElements);    }}
18

Java - util package
Java-Functions
java-intstream
java-stream
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
HashMap in Java with Examples
Object Oriented Programming (OOPs) Concept in Java
Initialize an ArrayList in Java
Interfaces in Java
ArrayList in Java
How to iterate any Map in Java
Multidimensional Arrays in Java
Multithreading in Java
Singleton Class in Java
LinkedList in Java
How to customize the position of an alert box using JavaScript?

To customize the position of an alert box, use the CSS “top” and “left” properties. We have a custom alert box, which we’ve created using jQuery and styled with CSS.
You can try to run the following code to customize the position of an alert box −
Live Demo
<!DOCTYPE html>
<html>
   <head>
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
      <script>
         function functionAlert(msg, myYes) {
            var confirmBox = $("#confirm");
            confirmBox.find(".message").text(msg);
            confirmBox.find(".yes").unbind().click(function() {
               confirmBox.hide();
            });
            confirmBox.find(".yes").click(myYes);
            confirmBox.show();
         }
      </script>
      <style>
         #confirm {
            display: none;
            background-color: #F3F5F6;
            color: #000000;
            border: 1px solid #aaa;
            position: fixed;
            width: 300px;
            height: 100px;
            left: 30%;
            top: 30%;
            box-sizing: border-box;
            text-align: center;
         }
         #confirm button {
            background-color: #FFFFFF;
            display: inline-block;
            border-radius: 12px;
            border: 4px solid #aaa;
            padding: 5px;
            text-align: center;
            width: 60px;
            cursor: pointer;
         }
         #confirm .message {
            text-align: left;
         }
      </style>
   </head>
   <body>
      <div id="confirm">
         <div class="message">This is a warning message.</div><br>
         <button class="yes">OK</button>
      </div>
      <input type="button" value="Click Me" onclick="functionAlert();" />
   </body>
</html>
MySQL Tryit Editor v1.0

SELECT SUBSTR(CustomerName, 2, 5) AS ExtractString
FROM Customers;
​
        
Edit the SQL Statement, and click "Run SQL" to see the result.
This SQL-Statement is not supported in the WebSQL Database.
The example still works, because it uses a modified version of SQL.
Your browser does not support WebSQL.
Your are now using a light-version of the Try-SQL Editor, with a read-only Database.
If you switch to a browser with WebSQL support, you can try any SQL statement, and play with the Database as much as you like. The Database can also be restored at any time.
Our Try-SQL Editor uses WebSQL to demonstrate SQL.
A Database-object is created in your browser, for testing purposes.
You can try any SQL statement, and play with the Database as much as you like. The Database can be restored at any time, simply by clicking the "Restore Database" button.
WebSQL stores a Database locally, on the user's computer. Each user gets their own Database object.
WebSQL is supported in Chrome, Safari, and Opera.
If you use another browser you will still be able to use our Try SQL Editor, but a different version, using a server-based ASP application, with a read-only Access Database, where users are not allowed to make any changes to the data.
GATE | GATE-CS-2015 (Set 1) | Question 62 - GeeksforGeeks

09 Dec, 2021
Suppose that the stop-and-wait protocol is used on a link with a bit rate of 64 kilobits per second and 20 milliseconds propagation delay. Assume that the transmission time for the acknowledgment and the processing time at nodes are negligible. Then the minimum frame size in bytes to achieve a link utilization of at least 50% is _________.(A) 160(B) 320(C) 640(D) 220Answer: (B)Explanation:
Transmission or Link speed = 64 kb per sec
Propagation Delay = 20 millisec

Since stop and wait is used, a packet is sent only
when previous one is acknowledged.

Let x be size of packet, transmission time = x / 64 millisec

Since utilization is at least 50%, minimum possible total time
for one packet is twice of transmission delay, which means 
x/64 * 2 = x/32

x/32 > x/64 + 2*20
x/64 > 40
x > 2560 bits = 320 bytes
Answer in GATE keys says 160 bytes, but the answer keys seem incorrect. See question 36 here.Quiz of this Question
adnanirshad158
GATE-CS-2015 (Set 1)
GATE-GATE-CS-2015 (Set 1)
GATE
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
GATE | GATE-CS-2016 (Set 2) | Question 48
GATE | GATE-CS-2014-(Set-1) | Question 30
GATE | GATE-CS-2001 | Question 23
GATE | GATE-CS-2015 (Set 1) | Question 65
GATE | GATE CS 2010 | Question 45
GATE | GATE-CS-2015 (Set 3) | Question 65
GATE | GATE-CS-2004 | Question 3
GATE | GATE-CS-2014-(Set-1) | Question 65
C++ Program to count Vowels in a string using Pointer
GATE | GATE-CS-2015 (Set 1) | Question 42
Scala - while Loop

Repeats a statement or group of statements while a given condition is true. It tests the condition before executing the loop body. A while loop statement repeatedly executes a target statement as long as a given condition is true.
The following is a syntax for while loop.
while(condition){
   statement(s);
}

Here, statement(s) may be a single statement or a block of statements. The condition may be any expression, and true is any nonzero value. The loop iterates while the condition is true. When the condition becomes false, program control passes to the line immediately following the loop.
Here, key point of the while loop is that the loop might not ever run. When the condition is tested and the result is false, the loop body will be skipped and the first statement after the while loop will be executed.
Try the following example program to understand loop control statements (while statement) in Scala Programming Language.
object Demo {
   def main(args: Array[String]) {
      // Local variable declaration:
      var a = 10;

      // while loop execution
      while( a < 20 ){
         println( "Value of a: " + a );
         a = a + 1;
      }
   }
}
Save the above program in Demo.scala. The following commands are used to compile and execute this program.
\>scalac Demo.scala
\>scala Demo

value of a: 10
value of a: 11
value of a: 12
value of a: 13
value of a: 14
value of a: 15
value of a: 16
value of a: 17
value of a: 18
value of a: 19


    82 Lectures 
     7 hours 

 Arnab Chakraborty

    23 Lectures 
     1.5 hours 

 Mukund Kumar Mishra

    52 Lectures 
     1.5 hours 

 Bigdata Engineer

    76 Lectures 
     5.5 hours 

 Bigdata Engineer

    69 Lectures 
     7.5 hours 

 Bigdata Engineer

    46 Lectures 
     4.5 hours 

 Stone River ELearning
 Print
 Add Notes
 Bookmark this page
p5.js | position() Function - GeeksforGeeks

20 Aug, 2019
The position() function is used to set the position of the element relative to origin (0, 0) coordinate. If this function is not containing any parameters then it returns the x and y position of the element.
Note: This function requires the p5.dom library. So add the following line in the head section of the index.html file.
<script language="javascript"     type="text/javascript" src="path/to/p5.dom.js"></script>
Syntax:
position()
or
position( x, y )
Parameters:
x: This parameter holds the x-position relative to top-left of window.
y: This parameter holds the y-position relative to top-left of window.
Return Value: This function returns an object containing the x and y position of the element.
Below examples illustrate the position() function in p5.js:
Example 1:
function setup() {          // Create canvas of given size    createCanvas(400, 200);          // Set background color    background('green');          // Create an input element    var div_cont = createDiv('Welcome to GeeksforGeeks');          // Set the position of div element    div_cont.position(60, 80);         // Set font color    div_cont.style('color', '#ffffff');          // Set width of input field    div_cont.style('width', '250px');        // Set font-size of input text    div_cont.style('font-size', '20px');  } 
Output:
Example 2:
function setup() {          // Create canvas of given size    createCanvas(400, 200);          // Set background color    background('green');          // Create an input element    var input_val = createInput('');              // Set the attribute and its value        input_val.attribute('value', 'Welcome to GeeksforGeeks');          // Set the position of div element    input_val.position(60, 80);         // Set width of input field    input_val.style('width', '250px');        // Set font-size of input text    input_val.style('font-size', '20px');  } 
Output:
JavaScript-p5.js
JavaScript
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Convert a string to an integer in JavaScript
Set the value of an input field in JavaScript
Differences between Functional Components and Class Components in React
How to Open URL in New Tab using JavaScript ?
Form validation using HTML and JavaScript
Express.js express.Router() Function
Installation of Node.js on Linux
Convert a string to an integer in JavaScript
How to set the default value for an HTML <select> element ?
Top 10 Angular Libraries For Web Developers
Batch Script - Moving Folders

For moving folders, Batch Script provides the MOVE command.
MOVE [/Y | /-Y] [drive:][path]filename1[,...] destination

Following are the description of the options which can be presented to the DEL command.
[drive:][path]filename1
Specifies the location and name of the file or files you want to move
destination
Specifies the new location of the file. Destination can consist of a drive letter and colon, a directory name, or a combination. If you are moving only one file, you can also include a filename if you want to rename the file when you move it.
[drive:][path]dirname1
Specifies the directory you want to rename.
dirname2
Specifies the new name of the directory.
/Y
Suppresses prompting to confirm you want to overwrite an existing destination file.
/-Y
Causes prompting to confirm you want to overwrite an existing destination file.
Let’s look at some examples of moving folders.
move *.* C:\Example

The above command will move all files from the current directory to the folder C:\Example.
move *.txt C:\Example

The above command will move all files with the txt extension from the current directory to the folder C:\Example.
move C:\old\*.* C:\Example

The above command will move all files from the folder called ‘old’ in C drive to the folder C:\Example.
 Print
 Add Notes
 Bookmark this page
Check if a large number is divisible by 11 or not in C++

Here we will see how to check a number is divisible by 11 or not. In this case the number is very large number. So we put the number as string.
To check whether a number is divisible by 11, if the sum of odd position values and the sum of even position values are same, then the number is divisible by 11.
 Live Demo
#include <bits/stdc++.h>
using namespace std;
bool isDiv11(string num){
   int n = num.length();
   long odd_sum = 0, even_sum = 0;
   for(int i = 0; i < n; i++){
      if(i % 2 == 0){
         odd_sum += num[i] - '0';
      } else {
         even_sum += num[i] - '0';
      }
   }
   if(odd_sum == even_sum)
      return true;
      return false;
}
int main() {
   string num = "1234567589333892";
   if(isDiv11(num)){
      cout << "Divisible";
   } else {
      cout << "Not Divisible";
   }
}
Divisible
Function to compute factorial of a number in JavaScript

We are required to write a simple JavaScript function that takes in a Number, say n and
computes its factorial.
Maintain a count and a result variable. We will keep multiplying the count into result and
simultaneously decreasing the count by 1, until it reaches 1.
And then finally we return the result.
Therefore, let’s write the code for this function −
The code for this will be −
const num = 14;
const factorial = num => {
   let res = 1;
   for(let i = num; i > 1; i--){
      res *= i;
   };
   return res;
};
console.log(factorial(num));
The output in the console will be −
87178291200
jQuery UI menu collapse() Method - GeeksforGeeks

24 Jan, 2021
jQuery UI consists of GUI widgets, visual effects, and themes implemented using jQuery, CSS, and HTML. jQuery UI is great for building UI interfaces for the webpages. jQuery UI menu is a themeable menu that is used with mouse and keyboard interactions for navigating between pages. In this article, we will use the collapse option to collapse the active sub-menu. 
Syntax:
$(".selector").menu( "collapse" );
Approach:
First, add jQuery UI scripts needed for your project.
<link href = “https://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css” rel = “stylesheet”>
<script src = “https://code.jquery.com/jquery-1.10.2.js”></script>
<script src = “https://code.jquery.com/ui/1.10.4/jquery-ui.js”></script>
Example 1: In this example, we will be using the collapse option for the menu() method. 
HTML
<!doctype html><html lang="en">  <head>    <meta charset="utf-8">    <link href="https://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css"            rel="stylesheet">    <script src="https://code.jquery.com/jquery-1.10.2.js"></script>      <script src="https://code.jquery.com/ui/1.10.4/jquery-ui.js">    </script>      <style>        .ui-menu {            width: 200px;        }    </style>      <script>        $(function() {            var menu = $("#gfg").menu();            $("#gfg").menu()            $(menu).mouseleave(function() {                menu.menu('collapse');            });        });    </script></head>  <body>    <h1>jQuery UI | menu collapse method</h1>    <ul id="gfg">        <li><a href="#">Menu</a>            <ul>                <li><a href="#">Submenu</a>                    <ul>                        <li><a href="#">                            Sub-Submenu                        </a></li>                    </ul>                </li>            </ul>        </li>    </ul></body>  </html>
Output: 
With collapse method.
Without collapse method. In the following image, please notice that the sub-sub menu is not getting collapsed as in the first image.
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.
jQuery-UI
HTML
JQuery
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 spaces/tabs in text using HTML/CSS?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
HTML | <img> align Attribute
Types of CSS (Cascading Style Sheet)
How to set the default value for an HTML <select> element ?
JQuery | Set the value of an input text field
Form validation using jQuery
How to change selected value of a drop-down list using jQuery?
How to change the background color after clicking the button in JavaScript ?
How to add options to a select element using jQuery?
C Program to check if a number is divisible by sum of its digits

Given a number n we have to check whether the sum of its digits divide the number n or not. To find out we have to sum all the numbers starting from the unit place and then divide the number with the final sum.
Like we have a number “521” so we have to find the sum of its digit that will be “5 + 2 + 1 = 8” but 521 is not divisible by 8 without leaving any remainder.
Let’s take another example “60” where “6+0 = 6” which can divide 60 and will not leave any remainder.
Input: 55
Output: No
Explanation: 5+5 = 10; 55 not divisible by 10
Input: 12
Output: Yes
Explanation: 1+2 = 3; 12 is divisible by 3
The approach used below is as follows −
To solve this problem we have to fetch each digit from the input and find the sum of each digit of a number, then check whether it is dividing the number or not.
Take input
Take each number from the unit place using and add it to a sum variable which should be initially zero
Divide the input with the sum of the number.
Return the result.
In function int isDivisible(long int num)
   Step 1-> Declare and initialize temp = num, sum = 0
   Step 2-> Loop While num
      Declare and initialize k as num % 10
   Set sum as sum + k
      Set num as num / 10
   End Loop
   Step 3-> If temp % sum == 0 then,
      Return 1
   Step 4-> Return 0
      End function
In main()
   Step 1-> Declare and initialize num as 55
   Step 2-> If isDivisible(num) then,
      Print "yes "
   Step 3-> Else
Print "no "
 Live Demo
#include <stdio.h>
// This function will check
// whether the given number is divisible
// by sum of its digits
int isDivisible(long int num) {
   long int temp = num;
   // Find sum of digits
   int sum = 0;
   while (num) {
      int k = num % 10;
      sum = sum + k;
      num = num / 10;
   }
   // check if sum of digits divides num
   if (temp % sum == 0)
      return 1;
      return 0;
}
int main() {
   long int num = 55;
   if(isDivisible(num))
      printf("yes\n");
   else
      printf("no\n");
      return 0;
}
If run the above code it will generate the following output −
No
How to copy files/folders to the remote location in the PowerShell?

To copy files or folders to or from the remote location, you need to provide the UNC path of the items. For example, here we are going to copy a file from the local computer to a remote computer called Test-PC.
Copy-Item D:\Temp\PowerShellcommands.csv -Destination \\Test-
PC\Sharedpath\PScommands.ps1 -PassThru
Here, file PowerShellcommands.csv is copied to the remote computer and renamed it with PSCommands.ps1
You can also copy files from the one shared location to another shared location.
For example,
Copy-Item \\Test-PC1\\D$\PowerShellcommands.csv -Destination \\Test-
PC\Sharedpath\PScommands.ps1 -PassThru
There is another way to copy items to the remote location is, you can use the ToSession parameter. To use the ToSesssion parameter, you need to connect a remote computer using PSRemote computer session and if destination files/folder is in the different domain or the workstation then you need to use the different credentials while remoting.
For example,
$destsession = New-PSSession -ComputerName Test-PC -Credential (Get-Credential)
Copy-Item D:\Temp\PowerShellcommands.csv -ToSession $destsession -PassThru
You can also copy folder(s) with the same method described above.
For example,
$destsession = New-PSSession -ComputerName Test-PC -Credential (Get-Credential)
Copy-Item D:\Temp\* -ToSession $destsession -Force -PassThru
You can also copy files from the one session to another session with the source path should mention with –FromSession parameter, while the destination path should mention with –ToSession parameter.
For example,
$destsession = New-PSSession -ComputerName Test-PC -Credential (Get-Credential)
$sourcesession = New-PSSession -ComputerName Test1-PC -Credential (Get-Credential)
Copy-Item -FromSession $sourcesession -ToSession $destsession -PassThru
D3.js | d3.set.clear() Function - GeeksforGeeks

28 Jun, 2019
The set.clear() function in D3.js is used to remove all values from the set. It clears the set and holds that blank set you can check that in the 2nd example.
Syntax:
d3.set().clear();
Parameters: This function does not accept any parameters.
Return Value: This function does not returns any values.
Below programs illustrate the d3.set.clear() function in D3.js:
Example 1:
<!DOCTYPE html><html>  <head>    <title> d3.set.clear() Function</title>      <script src='https://d3js.org/d3.v4.min.js'></script></head>  <body>    <script>          // Initialising the set        var set = d3.set(["1", "2", "a", "b", "Geeks"]);          // Checking the set        console.log(set);        // Calling the set.clear() function        set.clear();          // Checking whether any element is present        // in the set or not        A = set.has("a");        B = set.has("Geeks");          // Getting the output of true or false        console.log(A);        console.log(B);    </script></body>  </html>
Output:
{"$1":"1","$2":"2","$a":"a","$b":"b","$Geeks":"Geeks"}
  false
  false

Example 2:
<!DOCTYPE html><html>  <head>    <title> d3.set.clear() Function</title>      <script src='https://d3js.org/d3.v4.min.js'></script></head>  <body>  <script>           // Initialising the set     var set = d3.set(["1", "2", "a", "b", "Geeks"]);            // Checking whether any element is present     // in the set or not before calling set.clear() function     A = set.has("a");     B = set.has("Geeks");            // Getting the output of true or false     console.log(A);     console.log(B);           // Calling the set.clear() function     set.clear();           // Checking whether any element is present     // in the set or not after calling set.clear() function     C = set.has("a");     D = set.has("Geeks");            // Getting the output of true or false     console.log(C);     console.log(D);        </script></body>  </html>
Output:
true
true
false
false

Ref: https://devdocs.io/d3~5/d3-collection#set_clear
D3.js
JavaScript
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Convert a string to an integer in JavaScript
Difference between var, let and const keywords in JavaScript
Differences between Functional Components and Class Components in React
How to append HTML code to a div using JavaScript ?
How to Open URL in New Tab using JavaScript ?
Roadmap to Become a Web Developer in 2022
Installation of Node.js on Linux
How to fetch data from an API in ReactJS ?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
Convert a string to an integer in JavaScript
How to add function to the clear button icon in Material UI Autocomplete ? - GeeksforGeeks

22 Feb, 2021
In this article, We are going to add an extra function to the clear button of Material UI Autocomplete. Take Reference to the clear button in code and then add a click event listener on it.
Creating React Application And Installing Module:
Step 1: Create a React application using the following command.
npx create-react-app foldername
Step 2: After creating your project folder, i.e., folder name, move to it using the following command:
cd foldername
Step 3: Install required modules
npm install @material-ui/core
npm install @material-ui/lab
Project Structure: 
Example: Now write down the following code in the App.js file. Here, App is our default component where we have written our code.
App.js
import React,{ Component }  from 'react';import TextField from "@material-ui/core/TextField";import Autocomplete from "@material-ui/lab/Autocomplete";  class App extends Component {    constructor(props) {    super(props);    this.state = {      list: [        { title: "Title 1"},        { title: "Title 2"},        { title: "Title 3"},        { title: "Title 4"},      ]    }  }    componentDidMount(){      // Take the Reference of Close Button    const close = document.getElementsByClassName(      "MuiAutocomplete-clearIndicator"    )[0];          // Add a Click Event Listener to the button    close.addEventListener("click", () => {      alert("Add your Own Functionality Here...");    });  }    render() {    return (      <Autocomplete        options={this.state.list}        getOptionLabel={(option) => option.title}        style={{ width: 300 }}        renderInput={(params) => (          <TextField {...params} label="Combo box" variant="outlined" />        )}    />    );  }    }  export default App;
Step to Run Application: Run the application using the following command from the root directory of the project:
npm start
Output: Now open your browser and go to http://localhost:3000/, you will see the following output:
Picked
React-Questions
Technical Scripter 2020
ReactJS
Technical Scripter
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to redirect to another page in ReactJS ?
How to pass data from one component to other component in ReactJS ?
ReactJS setState()
Re-rendering Components in ReactJS
ReactJS defaultProps
Roadmap to Become a Web Developer in 2022
Installation of Node.js on Linux
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to insert spaces/tabs in text using HTML/CSS?
Convert a string to an integer in JavaScript
MySQL: selecting rows where a column is null?

To select rows where a column is null, you can use IS NULL from MySQL with the help of where clause.
The syntax is as follows −
select *from yourTableName where yourColumnName IS NULL;
Let us first create a table to understand the concept −
mysql> create table NULLDemo1
   -> (
   -> StudentId int,
   -> StudentName varchar(100)
   -> );
Query OK, 0 rows affected (1.48 sec)
Inserting records into the table. The query to insert records is as follows −
mysql> insert into NULLDemo1 values(NULL,'John');
Query OK, 1 row affected (0.25 sec)
mysql> insert into NULLDemo1 values(100,'Johnson');
Query OK, 1 row affected (0.38 sec)
mysql> insert into NULLDemo1 values(NULL,'Carol');
Query OK, 1 row affected (0.25 sec)
mysql> insert into NULLDemo1 values(101,'Sam');
Query OK, 1 row affected (0.25 sec)
Now you can display all the records with the help of select statement. The query is as follows −
mysql> select *from NULLDemo1;
The following is the output −
+-----------+-------------+
| StudentId | StudentName |
+-----------+-------------+
| NULL      | John        |
| 100       | Johnson     |
| NULL      | Carol       |  
| 101       | Sam         |   
+-----------+-------------+
4 rows in set (0.00 sec)
Apply the above syntax which was discussed in the beginning to select row where column is NULL. The query is as follows for the above table.
mysql> select *from NULLDemo1 where StudentId IS NULL;
Here is the output −
+-----------+-------------+
| StudentId | StudentName |
+-----------+-------------+
| NULL      | John        |
| NULL      | Carol       |
+-----------+-------------+
2 rows in set (0.00 sec)
How to sort the output in PowerShell?

To sort the output in the PowerShell you need to use Sort-Object Pipeline cmdlet. In the below example, we will retrieve the output from the Get-Process command and we will sort the, according to memory and CPU usage.
Get-Process | Sort-Object WorkingSet | Select -First 10
Handles  NPM(K)    PM(K)      WS(K)     CPU(s)     Id  SI ProcessName
-------  ------    -----      -----     ------     --  -- -----------
      0       0       60          8                 0   0 Idle
    144       8     1840        232       0.14   8396   1 SkypeBackgroundHost
    514      26    19280        300       0.73  16872   1 Calculator
   1140      50    63584        464      15.86  10688   1 ksdeui
     53       3     1212        816       0.30    580   0 smss
    217      17     3432       1848      37.03  13272   1 ptim
    486      26     7404       2228     168.86  13732   1 ptsrv
     32       6     1636       2440       0.16   1092   0 fontdrvhost
     86       5      968       3620       0.00   1060   0 svchost
     85       6     1208       4104       0.59   4116   0 ibtsiva
In the above example, the output is stored into ascending order which is the default order and then we have retrieved the first 10 processes.
If you want to output in Descending order then you need to add the parameter − Descending.
Get-Process | Sort-Object WorkingSet -Descending | Select -First 10
Handles  NPM(K)    PM(K)      WS(K)     CPU(s)     Id  SI ProcessName
     -------  ------    -----      -----     ------     --  -- -----------
           0       0     3660     719552     544.86   2580   0 Memory Compression
         968     125  1132200     487196   6,867.28   4228   1 chrome
        1867     150   294740     332516   1,136.42  19036   1 WINWORD
        1137      46   446876     305092   2,470.48  14560   1 chrome
         583      38   309476     250312     755.97  15652   1 chrome
        3597     107   275080     226752  11,615.69  12712   1 chrome
         464      59   179012     172652   1,938.55  18732   1 chrome
         350      31   191756     157716     339.11   5952   1 chrome
         607      61   129380     156224     106.52   7712   1 Code
         536      31   186496     146176      35.81  10352   1 Code
Similarly, you can sort CPU and other properties as well in the ascending / descending order as shown in the below example.
Get-Process | Sort-Object CPU | Select -First 10
Get-Process | Sort-Object CPU -Descending | Select -First 10
OrientDB - Create Database

The SQL Reference of the OrientDB database provides several commands to create, alter, and drop databases.
The following statement is a basic syntax of Create Database command.
CREATE DATABASE <database-url> [<user> <password> <storage-type> [<db-type>]]
Following are the details about the options in the above syntax.
<database-url> − Defines the URL of the database. URL contains two parts, one is <mode> and the second one is <path>.
<mode> − Defines the mode, i.e. local mode or remote mode.
<path> − Defines the path to the database.
<user> − Defines the user you want to connect to the database.
<password> − Defines the password for connecting to the database.
<storage-type> − Defines the storage types. You can choose between PLOCAL and MEMORY.
You can use the following command to create a local database named demo.
Orientdb> CREATE DATABASE PLOCAL:/opt/orientdb/databses/demo
If the database is successfully created, you will get the following output.
Database created successfully. 
Current database is: plocal: /opt/orientdb/databases/demo

orientdb {db = demo}>

 Print
 Add Notes
 Bookmark this page
How to read data in from a file to String using java?

In Java you can read the contents of a file in several ways one way is to read it to a string using the java.util.Scanner class, to do so,
Instantiate the Scanner class, with the path of the file to be read, as a parameter to its constructor.
Instantiate the Scanner class, with the path of the file to be read, as a parameter to its constructor.
Create an empty String buffer.
Create an empty String buffer.
Start a while loop with condition, if the Scanner has next line. i.e. hasNextLine() at while.
Start a while loop with condition, if the Scanner has next line. i.e. hasNextLine() at while.
Within the loop append each line of the file to the StringBuffer object using the append() method.
Within the loop append each line of the file to the StringBuffer object using the append() method.
Convert the contents of the contents of the buffer to String using the toString() method.
Convert the contents of the contents of the buffer to String using the toString() method.
Create a file with name sample.txt in the C directory in your system, copy and paste the following content in it.
Tutorials Point is an E-learning company that set out on its journey to provide
knowledge to that class of readers that responds better to online content. With
Tutorials Point, you can learn at your own pace, in your own space.

After a successful journey of providing the best learning content at
tutorialspoint.com, we created our subscription based premium product called
Tutorix to provide Simply Easy Learning in the best personalized way for K-12
students, and aspirants of competitive exams like IIT/JEE and NEET.
Following Java program reads the contents of the file sample.txt in to a String and prints it.
import java.io.File;
import java.io.IOException;
import java.util.Scanner;
public class FileToString {
   public static void main(String[] args) throws IOException {
      Scanner sc = new Scanner(new File("E://test//sample.txt"));
      String input;
      StringBuffer sb = new StringBuffer();
      while (sc.hasNextLine()) {
         input = sc.nextLine();
         sb.append(" "+input);
      }
      System.out.println("Contents of the file are: "+sb.toString());
   }
}
Contents of the file are: Tutorials Point is an E-learning company that set out on its journey to provide
knowledge to that class of readers that responds better to online content. With Tutorials Point, you can
learn at your own pace, in your own space. After a successful journey of providing the best learning content
at tutorialspoint.com, we created our subscription based premium product called Tutorix to provide Simply
Easy Learning in the best personalized way for K-12 students, and aspirants of competitive exams like
IIT/JEE and NEET.
Multidimensional Collections in Java

Multidimensional collections are also known as Nested collections. It is a group of objects wherein every group has any number of objects that can be created dynamically. They can be stored in any position as well. In case of arrays, the user would be bound to a specific number of rows and columns, hence multidimensional structure helps create and add elements dynamically.
ArrayList<ArrayList<Object>> object_name = new ArrayList<ArrayList<Object>>();
Following is an example of multidimensional collections in Java −
Import java.util.*;
public class Demo {
   static List multi_dimensional() {
      ArrayList<ArrayList<Integer> > x = new ArrayList<ArrayList<Integer> >();
      x.add(new ArrayList<Integer>());
      x.get(0).add(0, 45);
      x.add(new ArrayList<Integer>(Arrays.asList(56, 67, 89)));
      x.get(1).add(0, 67);
      x.get(1).add(4, 456);
      x.add(2, new ArrayList<>(Arrays.asList(23, 32)));
      x.add(new ArrayList<Integer>(Arrays.asList(83, 64, 77)));
      x.add(new ArrayList<>(Arrays.asList(8)));
      return x;
   }
   public static void main(String args[]) {
      System.out.println("The multidimensional arraylist is :");
      System.out.println(multi_dimensional());
   }
}
The multidimensional arraylist is :
[[45], [67, 56, 67, 89, 456], [23, 32], [83, 64, 77], [8]]
A class named Demo contains a function named ‘multi_dimensional’, that declares an arraylist of arraylist of integers, and the ‘add’ function is used to add elements to it. First, in the 0th position, an element is added. Next, three more elements are added to the row. To the first row, 0th column, one more element is added. Another value is placed in the 1st row of the 4th column. Next, values are added to 2nd, 3rd and 4th rows respectively. In the main function, the function ‘multi_dimensional’ is called and the output is printed on the console.
What does .shape[] do in “for i in range(Y.shape[0])” using Matplotlib?

The shape property is usually used to get the current shape of an array, but it may also be used to reshape the array in-place by assigning a tuple of array dimensions to it.
Get an array Y using np.array method.
Get an array Y using np.array method.
Y.shape would return a tuple (4, ).
Y.shape would return a tuple (4, ).
Y.shape[0] method would return 4, i.e., the first element of the tuple.
Y.shape[0] method would return 4, i.e., the first element of the tuple.
import numpy as np

Y = np.array([1, 2, 3, 4])
print("Output of .show method would be: ", Y.shape, " for ", Y)
print("Output of .show[0] method would be: ", Y.shape[0], " for ", Y)
print("Output for i in range(Y.shape[0]): ", end=" ")
for i in range(Y.shape[0]):
   print(Y[i], end=" ")
Output of .show method would be: (4,) for [1 2 3 4]
Output of .show[0] method would be: 4 for [1 2 3 4]
Output for i in range(Y.shape[0]): 1 2 3 4
Neo4j CQL - Sorting

Neo4j CQL has provided "ORDER BY" Clause in MATCH Command to sort the results returned by a MATCH query.
We can sort rows either ascending order or descending order.
By default, it sorts rows in ascending order. If we want to sort them in descending order, we need to use DESC clause
ORDER BY  <property-name-list>  [DESC]	
<node-label-name>.<property1-name>,
<node-label-name>.<property2-name>, 
.... 
<node-label-name>.<propertyn-name> 
Syntax Description
NOTE -
We should use comma(,) operator to separate the property names list.
This example demonstrates how to use sort results in Ascending order by Employee name.
Step 1 - Open Neo4j Data Browser
Step 2 - Type the below command on Data Browser
MATCH (emp:Employee)
RETURN emp.empid,emp.name,emp.salary,emp.deptno
Step 3 - Click on "Execute" button and observe the results.
It returns total number of results available in the database: 4 records
Step 4 - Type the below command on Data Browser
MATCH (emp:Employee)
RETURN emp.empid,emp.name,emp.salary,emp.deptno
ORDER BY emp.name
Step 5 - Click on "Execute" button and observe the results.
If we observe the results, now records are sorted by Employee.name in ascending order.
This example demonstrates how to use sort results in Descending order by Employee name.
Step 1 - Open Neo4j Data Browser
Step 2 - Type the below command on Data Browser
MATCH (emp:Employee)
RETURN emp.empid,emp.name,emp.salary,emp.deptno
Step 3 - Click on "Execute" button and observe the results.
It returns total number of results available in the database: 4 records
Step 4 - Type the below command on Data Browser
MATCH (emp:Employee)
RETURN emp.empid,emp.name,emp.salary,emp.deptno
ORDER BY emp.name DESC
Step 5 - Click on "Execute" button and observe the results.
If we observe the results, now records are sorted by Employee.name in Descending order.
 Print
 Add Notes
 Bookmark this page
Selenium with C Sharp - How to perform Explicit Wait method?

We can perform explicit wait with Selenium webdriver in C#. This is done to achieve synchronization between our tests and the elements on the page. For implementation of explicit wait, we have to take the help of the WebDriverWait and ExpectedCondition classes.
We shall create an object of the WebDriverWait class. The webdriver waits tillspecified wait time waiting for the expected condition for an element is satisfied.
After the time has elapsed, an exception is raised by Selenium.
The explicit waits are dynamic in nature which means if we have an explicit wait of five seconds and the expected condition is met at the third second, then the webdriver shall move to the next step immediately. It does not wait till the entirefive seconds.
Some of the expected conditions are −
UrlToBe
UrlToBe
VisibilityOfAllElementsLocatedBy
VisibilityOfAllElementsLocatedBy
UrlContains
UrlContains
AlertIsPresent
AlertIsPresent
AlertState
AlertState
ElementToBeSelected
ElementToBeSelected
ElementIsVisible
ElementIsVisible
ElementExists
ElementExists
ElementSelectionStateToBe
ElementSelectionStateToBe
ElementToBeClickable
ElementToBeClickable
InvisibilityOfElementWithText
InvisibilityOfElementWithText
InvisibilityOfElementLocated
InvisibilityOfElementLocated
TextToBePresentInElementLocated
TextToBePresentInElementLocated
TextToBePresentInElementValue
TextToBePresentInElementValue
TextToBePresentInElement
TextToBePresentInElement
StalenessOf
StalenessOf
TitleContains
TitleContains
FrameToBeAvailableAndSwitchToIt
FrameToBeAvailableAndSwitchToIt
PresenceOfAllElementsLocatedBy
PresenceOfAllElementsLocatedBy
TitleIs
TitleIs
WebDriverWait w =
new WebDriverWait(driver, TimeSpan.FromSeconds(20));
w.Until(ExpectedConditions.ElementIsVisible(By.TagName("h1")));
Let us try to wait for the text - Team @ Tutorials Point to be visible on the page −
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
using System;
using OpenQA.Selenium;
using OpenQA.Selenium.Support.UI;
namespace NUnitTestProject2{
   public class Tests{
      String url = "https://www.tutorialspoint.com/about/about_careers.htm";
      IWebDriver driver;
      [SetUp]
      public void Setup(){
         //creating object of FirefoxDriver
         driver = new FirefoxDriver("");
      }
      [Test]
      public void Test2(){
         //URL launch
         driver.Navigate().GoToUrl(url);
         //identify element then click
         IWebElement t = driver.FindElement(By.XPath("//*[text()='Team']"));
         t.Click();
         //expected condition of Element visibility
         WebDriverWait w = new WebDriverWait(driver, TimeSpan.FromSeconds(20));
         w.Until
         (ExpectedConditions.ElementIsVisible(By.TagName("h1")));
         //identify element then obtain text
         IWebElement n = driver.FindElement(By.TagName("h1"));
         Console.WriteLine("Text is: " + n.Text);
      }
      [TearDown]
      public void close_Browser(){
         driver.Quit();
      }
   }
}
egrep command in Linux with examples - GeeksforGeeks

15 May, 2019
egrep is a pattern searching command which belongs to the family of grep functions. It works the same way as grep -E does. It treats the pattern as an extended regular expression and prints out the lines that match the pattern. If there are several files with the matching pattern, it also displays the file names for each line.
Syntax:
egrep [ options ] 'PATTERN' files 

Example:
Note: The egrep command used mainly due to the fact that it is faster than the grep command. The egrep command treats the meta-characters as they are and do not require to be escaped as is the case with grep. This allows reducing the overhead of replacing these characters while pattern matching making egrep faster than grep or fgrep.
Options: Most of the options for this command are same as grep.
-c: Used to counts and prints the number of lines that matched the pattern and not the lines.
-v: It prints the lines that does not match with the pattern.
-i: Ignore the case of the pattern while matching.
-l: Prints only the names of the files that matched. It does not mention the matching line numbers or any other information.
-L: Prints only the names of the files that did not have the pattern. Opposite of -l flag.
-e: Allows to use a ‘-‘ sign in the beginning of the pattern. If not mentioned the shell tries to execute the pattern as an option and returns an error.
-w: Prints only those lines that contain the whole words. Word-constituent characters are letters, digits and underscore. The matching substring must be seperated by non-word constituent characters.
-x: Prints only those lines that matches an entire line of the file.
-m NUMBER: Continue to search for matches till the count reaches NUMBER mentioned as argument.
-o: Prints only the matched parts of the line and not the entire line for each match.
-n: Prints each matched line along with the respective line numbers. For multiple files, prints the file names along with line numbers.
-r: Recursively search for the pattern in all the files of the directory. The last argument is the directory to check. ‘.’ (dot) represents the current directory.
linux-command
Linux-misc-commands
Picked
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
tar command in Linux with examples
UDP Server-Client implementation in C
Conditional Statements | Shell Script
Cat command in Linux with examples
echo command in Linux with Examples
touch command in Linux with Examples
Mutex lock for Linux Thread Synchronization
Tail command in Linux with examples
Compiling with g++
ps command in Linux with Examples