code-rag-bench/online-tutorials huggingface dataset:
RequireJS - AMD Modules

A module in RequireJS is a scoped object and is not available in the global namespace. Hence, global namespace will not be polluted. RequireJS syntax allows to load modules faster without worrying about keeping track of the order of dependencies. You can load multiple versions of the same module in the same page.
Module is defined using the define() function; the same function is used for loading the module as well.
If the module is just a collection of name and value pairs, then you can use the following syntax −
define({
   state: "karnataka",
   city: "bangalore"
});
A module can also use a function for frameworks, without having dependencies. This can be done by using the following syntax −
define(function () {
   
   //Do setup work here
   return {
      state: "karnataka",
      city: "bangalore"
   }
});
If the module is having dependencies, the placement of the first argument (array of dependency names), the second argument (defining function) and the return object that defines the module is shown in the following syntax −
define(["./mnc", "./startup"], 
   function(mnc, startup) {
        
      return {
         state: "karnataka",
         city: "bangalore",
      
         addCompany: function() {
            mnc.decrement(this);
            startup.add(this);
         }
      
      }
   }
);
It is not mandatory for a module to return only objects, any valid value from a function can also be returned. The following syntax is used to define a module as a function −
define(["./mnc", "./startup"],
   function(mnc, startup) {
       
      return function(title) {
         return title ? (window.title = title) :
         startup.storeName + ' ' + mnc.name;
      }
      
   }
);
In some cases you may have to include a name for the module as the first argument to define(). This can be done by using the following syntax −
define("js2/title",
   ["js1/mnc", "js1/startup"],
   
   function(mnc, startup) {
      //Define js2/title object in here.
   }
   
);
Module Loading
 Print
 Add Notes
 Bookmark this page
Implement Your Own sizeof

15 Mar, 2019
Here is an implementation.
#include<stdio.h>#define my_sizeof(type) (char *)(&type+1)-(char*)(&type)int main(){    double x;    printf("%ld", my_sizeof(x));    getchar();    return 0;}
Type is like a local variable to the macro. &type gives the address of the variable (double x) declared in the program and incrementing it with 1 gives the address where the next variable of type x can be stored (here addr_of(x) + 8, for the size of a double is 8B).The difference gives the result that how many variables of type of x can be stored in that amount of memory which will obviously be 1 for the type x (for incrementing it with 1 and taking the difference is what we’ve done). Typecasting it into char* and taking the difference will tell us how many variables of type char can be stored in the given memory space (the difference). Since each char requires the only 1B of memory, therefore (amount of memory)/1 will give the number of bytes between two successive memory locations of the type of the variable passed on to the macro and hence the amount of memory that the variable of type x requires.But you won’t be able to pass any literal to this macro and know their size.
You can also implement using the function instead of a macro, but function implementation cannot be done in C as C doesn’t support function overloading and sizeof() is supposed to receive parameters of all data types.
Note that the above implementation assumes that the size of character is one byte.
Time Complexity: O(1)Space Complexity: O(1)
romeosaurabh
c-puzzle
C Language
C++
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Substring in C++
Function Pointer in C
Multidimensional Arrays in C / C++
Left Shift and Right Shift Operators in C/C++
Different Methods to Reverse a String in C++
Vector in C++ STL
Map in C++ Standard Template Library (STL)
Initialize a vector in C++ (7 different ways)
Set in C++ Standard Template Library (STL)
vector erase() and clear() in C++
Difference between ISO9000 and SEI-CMM

14 Aug, 2021
ISO 9000: It is a set of International Standards on quality management and quality assurance developed to help companies effectively document the quality system elements needed to an efficient quality system. 
SEICMM: SEI (Software Engineering Institute), Capability Maturity Model (CMM) specifies an increasing series of levels of a software development organization. 
Difference between ISO9000 and SEI-CMM:  
It has 5 levels:  
(a). Initial
(b). Repeatable
(c). Defined
(d). Managed
(e). Optimized 
 
ruhelaa48
Difference Between
Software Engineering
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Difference between var, let and const keywords in JavaScript
Difference Between Method Overloading and Method Overriding in Java
Difference between Compile-time and Run-time Polymorphism in Java
Similarities and Difference between Java and C++
Difference between DELETE and TRUNCATE
Types of Software Testing
Functional vs Non Functional Requirements
Software Engineering | COCOMO Model
Differences between Verification and Validation
Software Engineering | White box Testing
How to add a checkbox in forms using HTML ?

29 Sep, 2021
In this article, we will learn how to add a checkbox in HTML Forms. Basically, the checkbox is used to select one or more options from a variety of options. It is a multi-control unit that will be presented as a small square box on the screen. Normally, Checkbox has 3 states namely- Checked, unchecked & indeterminate. It is required in forms when the user allows choosing multiple choices. 
Approach: We have a simple approach to complete the task that given below-
Firstly, create an HTML document that contains a <input> tag.
Now use the type attribute with <input> element.
Set the type attribute to value “checkbox”
Syntax
<input type="checkbox">
Example: 
HTML
<!DOCTYPE html><html>  <head>    <title>        How to add a checkbox in         forms using HTML?    </title></head>  <body style="text-align: center;">    <h1 style="color:green;">        GeeksforGeeks    </h1>      <h2>        How to add a checkbox in         forms using HTML?    </h2>      <form>        <h4>            choose any your 2 favourite Dishes        </h4>          Rajna chawal -->        <input type="checkbox" name="dish1"             id="GFG" value="Rajma chawal" checked>        <br>          Shahi paneer -->        <input type="checkbox" name="dish2"             value="Shahi paneer">        <br>          Kadi Chawal -->        <input type="checkbox" name="dish3"                 value="kadi Chawal">        <br>          Idli Sambhar -->        <input type="checkbox" name="dish4"             value="Idli sambhar">        <br>        <input type="submit" value="submit">    </form>    <br></body>  </html>
Output:
HTML-Attributes
HTML-Questions
HTML-Tags
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Pandas – How to shuffle a DataFrame rows

10 Jul, 2020
Let us see how to shuffle the rows of a DataFrame. We will be using the sample() method of the pandas module to to randomly shuffle DataFrame rows in Pandas.
Algorithm :
Import the pandas and numpy modules.Create a DataFrame.Shuffle the rows of the DataFrame using the sample() method with the parameter frac as 1, it determines what fraction of total instances need to be returned.Print the original and the shuffled DataFrames.
Import the pandas and numpy modules.
Create a DataFrame.
Shuffle the rows of the DataFrame using the sample() method with the parameter frac as 1, it determines what fraction of total instances need to be returned.
Print the original and the shuffled DataFrames.
# import the modulesimport pandas as pdimport numpy as np  # create a DataFrameODI_runs = {'name': ['Tendulkar', 'Sangakkara', 'Ponting',                      'Jayasurya', 'Jayawardene', 'Kohli',                      'Haq', 'Kallis', 'Ganguly', 'Dravid'],            'runs': [18426, 14234, 13704, 13430, 12650,                     11867, 11739, 11579, 11363, 10889]}df = pd.DataFrame(ODI_runs)  # print the original DataFrameprint("Original DataFrame :")print(df)  # shuffle the DataFrame rowsdf = df.sample(frac = 1)  # print the shuffled DataFrameprint("\nShuffled DataFrame:")print(df)
Output :
Python pandas-dataFrame
Python-pandas
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Different ways to create Pandas Dataframe
Enumerate() in Python
Read a file line by line in Python
How to Install PIP on Windows ?
*args and **kwargs in Python
Python Classes and Objects
Python OOPs Concepts
Introduction To PYTHON
Iterate over a list in Python
HTML | <col> width Attribute

29 May, 2019
The HTML <col> width Attribute is used to specify the width of <col> element. It sets the fixed width of column element. In general, the width of <col> element is the width needed to display its content.
Syntax:
<col width="pixels | % | relative_length">
Attribute Values:
pixels: It sets the width of <col> attribute in terms of pixels.
%: It sets the width of <col> attribute in terms of percentage (%).
relative_length: It sets the width of <col> element attribute relative to its other content.
Note: The <col> width attribute is not supported by HTML 5.
Example:
<!DOCTYPE html><html>  <head>    <title>        HTML col width Attribute    </title></head>  <body>    <h1>GeeksforGeeks</h1>      <h2>HTML col width Attribute</h2>      <table border="1">        <caption>Author Details</caption>          <col width="150">            <col width="80">                <col width="120">                    <tr>                        <th>NAME</th>                        <th>AGE</th>                        <th>BRANCH</th>                    </tr>                    <tr>                        <td>BITTU</td>                        <td>22</td>                        <td>CSE</td>                    </tr>                    <tr>                        <td>RAM</td>                        <td>21</td>                        <td>ECE</td>                    </tr>    </table></body>  </html>
Output:
Supported Browsers: The browser supported by HTML <col> width attribute are listed below:
Google Chrome
Internet Explorer
Firefox
Safari
Opera
HTML-Attributes
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Grammar Checker in Python using Language-check

10 May, 2020
Python is an open-source programming language. It offers a vast variety of libraries that provide greater functionalities. The one such library is language_check. The language_check library doesn’t come bundled with Python 3. Instead, you have to manually download it from the command line or download it from the pypi.org and then install it manually.
To install via pip:
$ pip install --upgrade language-check
If you are using Python 2, you’ll need to install 3to2 beforehand:
$ pip install --upgrade 3to2
Python v3.3+ (or 2.7)
Java v6.0 or higher.
The language_check specifies the mistakes along with Rule Id, Message, Suggestion, and line number in the document. Also using this we can directly correct the mistakes in the file only. It points out the mistakes accurately but it doesn’t guarantee 100% success in finding mistakes. Sometimes it may happen that it misses out some important mistake. So relying on it completely is not advisable.
Below python code demonstrates the use of language_check on Text Document.
import language_check    # Mention the language keywordtool = language_check.LanguageTool('en-US')i = 0  # Path of file which needs to be checkedwith open(r'transcript1.txt', 'r') as fin:                     for line in fin:        matches = tool.check(line)        i = i + len(matches)             pass  # prints total mistakes which are found # from the documentprint("No. of mistakes found in document is ", i)print()    # prints mistake one by one for mistake in matches:    print(mistake)    print()
Output :
No. of mistakes found in document is 3
Line 1, column 1, Rule ID: UPPERCASE_SENTENCE_STARTMessage: This sentence does not start with an uppercase letterSuggestion: Soso as you can see buying a new car doesn’t...^^
Line 1, column 102, Rule ID: ENGLISH_WORD_REPEAT_RULEMessage: Possible typo: you repeated a wordSuggestion: research...ing if you’ll follow three simple steps research research research read and find out everything y...^^^^^^^^^^^^^^^^^
Line 1, column 1025, Rule ID: MORFOLOGIK_RULE_EN_USMessage: Possible spelling mistake foundSuggestion: speech; spec; specs; speck; spec h...unny way to start the speech and in the spech and now use the listener knew that I’m ...
python-utility
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
math.ceil() function in Lua programming

There are several occurrences when we want to get the ceil value of an integer to round it off and then use that value later on.
The Ceiling value of a number is the value that is rounded to the closest integer greater than or equal to that integer.
Lua provides us with a math.ceil() function that we can use to find the ceil value of a number.
Let’s consider a simple example where we will make use of the math.ceil() function in Lua −
 Live Demo
a = math.ceil(3.3)
b = math.ceil(7.1)
print(a)
print(b)
4
8
It should be noted that if we try to find ceil of a number which is already the closest integer to itself, then we will get the same number as the output. Consider the example shown below −
 Live Demo
c = math.ceil(8)
print(c)
8
We can also pass negative numbers in the math.ceil() function as an argument.
Consider the example shown below −
Live Demo
d = math.ceil(-3.3)
print(d)
-3
Create a Scatter Chart using Recharts in ReactJS - GeeksforGeeks

27 Jul, 2021
Introduction: RechartJS is a library that is used for creating charts for React JS. This library is used for building Line charts, Bar charts, Pie charts, etc, with the help of React and D3 (Data-Driven Documents).
To create a Scatter chart using Recharts, we create a dataset with x and y coordinate details. Then we create a cartesian grid and both axes using data coordinates. Finally using Scatter element scatter points will be drawn in the cartesian grid.
Creating React Application And Installing Module:
Step 1: Create a React application using the following command.npx create-react-app foldername 
Step 1: Create a React application using the following command.
npx create-react-app foldername
 
Step 2: After creating your project folder i.e. foldername, move to it using the following command.cd foldername
Step 2: After creating your project folder i.e. foldername, move to it using the following command.
cd foldername
Step 3: After creating the ReactJS application, Install the required modules using the following command.npm install --save recharts
Step 3: After creating the ReactJS application, Install the required modules using the following command.
npm install --save recharts
Project Structure: It will look like the following.
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 from 'react';import { ScatterChart, Scatter, XAxis,     YAxis, CartesianGrid } from 'recharts';  const App = () => {      // Sample data    const data = [        { x: 1, y: 23 },        { x: 2, y: 3 },        { x: 3, y: 15 },        { x: 4, y: 35 },        { x: 5, y: 45 },        { x: 6, y: 25 },        { x: 7, y: 17 },        { x: 8, y: 32 },        { x: 9, y: 43 },    ];      return (        <ScatterChart width={400} height={400}>            <CartesianGrid />            <XAxis type="number" dataKey="x" />            <YAxis type="number" dataKey="y" />            <Scatter data={data} fill="green" />        </ScatterChart>    );}  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:
Output
React-Questions
Recharts
JavaScript
ReactJS
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Difference between var, let and const keywords in JavaScript
Difference Between PUT and PATCH Request
How to get character array from string in JavaScript?
Remove elements from a JavaScript Array
How to get selected value in dropdown list using JavaScript ?
How to fetch data from an API in ReactJS ?
How to redirect to another page in ReactJS ?
How to pass data from child component to its parent in ReactJS ?
How to pass data from one component to other component in ReactJS ?
ReactJS Functional Components
Discrete Colour Scale in Plotly Python | by Kyle Pastor | Towards Data Science

I like to use the python library for Plotly, however I noticed that when I am trying to use the Graph Object to do things like make Choropleth maps I was having trouble getting discrete colour ranges for my data.
I like to segment my data into regions based on category. For example if I am trying to show three categories of data I will use the ranges of 0–33 for the first set set, 34–66 for the second and finally 67–100. Within each of these categories I wanted to display its own set of discrete colours (see the main image above). To do this I wrote the following function that I hope will help anyone out there trying to do the same!
All the function does is take in a list of lists of colour elements. It then figures out how to make discrete blocks of colour for the various inputs. Take a read and see how to actually call it below.
def generateDiscreteColourScale(colour_set):    #colour set is a list of lists    colour_output = []    num_colours = len(colour_set)    divisions = 1./num_colours    c_index = 0.    # Loop over the colour set    for cset in colour_set:        num_subs = len(cset)        sub_divisions = divisions/num_subs        # Loop over the sub colours in this set        for subcset in cset:            colour_output.append((c_index,subcset))            colour_output.append((c_index + sub_divisions-                .001,subcset))            c_index = c_index + sub_divisions    colour_output[-1]=(1,colour_output[-1][1])    return colour_output
The above is a pretty short piece of code but it does a lot of work for us.
To plot the main header image I actually had 4 categories (Harry Potter Houses) and wanted to not only display the 4 categories as solid colours, but also subdivide them based on occurence (light to dark). I had all the data ready to go but needed to get the colour scale. In the below we define the scheme. Each list element is for a category (ie. a Harry Potter house), and this list element actually contains a list of the colour ranges I want to use (from lightest colour to darkest).
# Harry Potter Housescolor_schemes = [    ['#890000','#890000','#5c0000'],    ['#2a6b28','#0b4c07','#003206'],    ['#4f5a90','#374798','#30375a'],    ['#fff4b1','#ffed86','#ffdb00']]
Now I can call the function above to get back the appropriate format to pass into the go.Choropleth plotly object.
colorscale = generateDiscreteColourScale(color_schemes)
And finally adding to our plot.
fig.add_trace(go.Choropleth(    geojson=counties,    locations=fips,    z=final['split'].astype(float),    colorscale=colorscale,   <--- THE MONEY    marker_line_width=0.0, # line markers between states    marker_line_color='rgba(0,0,0,0.1)',    text=final['label'], # hover text))
It is as easy as that! You can use it to make a bunch of nice plots. Below are just some examples where I have used it.
Of course this is not limited to maps and can be used in any case you use the colourscale input in plotly.
Hope this helps! Feel free to contact me if you have any questions!
Creating a Page with Sidebar and Main Content Area using HTML & CSS

A webpage with fluid sidebar and main content area is created by setting the size of html and body to 100%.
The following example illustrates this.
 Live Demo
<!DOCTYPE html>
<html>
<head>
<style>
html,body {
   height: 100%;
   color: white;
   font-size: 2em;
   line-height: 200px;
}
#parent {
   display: table;
   width: 100%;
   height: 100%;
}
#side {
   display: table-cell;
   background-color: turquoise;
   width: 20%;
   vertical-align: top;
   box-shadow: inset 0 0 10px black;
}
#main {
   display: table-cell;
   width: 80%;
   background: url("https://images.unsplash.com/photo-1611944444060- b50a1d80cfe6?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=800&ixlib=rb1.2.1&q=80&w=600");
}
</style>
</head>
<body>
<div id="parent">
<div id="side">Side</div>
<div id="main">Main</div>
</div>
</body>
</html>
This will produce the following result −
Bootstrap 4 .d-inline-flex class

Use the d-inline-flex class in Bootstrap to create an inline flexbox container −
<div class="d-inline-flex p-3 bg-primary">
Now add the flex-items inside it as in the following code snippet −
<div class="d-inline-flex p-3 bg-primary">  
  <div class="p-2 bg-danger">
    One
  </div>
  <div class="p-2 bg-warning">
    Two
  </div>
  <div class="p-2 bg-primary">
    Three
  </div>
</div>
You can try to run the following code to implement the .d-inline class −
Live Demo
<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Bootstrap Example</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
  </head>

<body>
  <div class="container mt-3">
    <h2>Understanding Inline Flex</h2>
    <div class="d-inline-flex p-3 bg-primary">  
      <div class="p-2 bg-danger">One</div>
      <div class="p-2 bg-warning">Two</div>
      <div class="p-2 bg-primary">Three</div>
    </div>
  </div>
</body>
</html>
Common Bus System using multiplexers

20 May, 2020
A typical computer has many registers and we need to transfer the information between these registers. A way to transfer the information is using the common bus system. In this article we shall discuss the common bus system using multiplexers.
Let’s discuss the common bus system with multiplexers.
The construction of this bus system for 4 registers is shown above. The bus consists of 4×1 multiplexers with 4 inputs and 1 output and 4 registers with bits numbered 0 to 3. There are 2 select inputs S0 and S1 which are connected to the select inputs of the multiplexers.
The output 1 of register A is connected to input 0 of MUX 1 and similarly other connections are made as shown in the diagram. The data transferred to the bus depends upon the select lines. A table for the various combinations of select lines is shown below.
As we can see that when S1S0=00, register A is selected because on 00 the 0 data inputs of all the multiplexers are applied to the common bus.
Since the 0 data inputs of all the multiplexers receive the inputs from the register A, thus register A gets selected. Similarly for other combinations of S1S0 other register are selected.
Note-
No. of multiplexers needed = No. of bits in each register 
Computer Organization & Architecture
Write From Home
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Direct Access Media (DMA) Controller in Computer Architecture
Logical and Physical Address in Operating System
Control Characters
Computer Organization | RISC and CISC
Memory Hierarchy Design and its Characteristics
Convert integer to string in Python
Convert string to integer in Python
How to set input type date in dd-mm-yyyy format using HTML ?
Python infinity
Factory method design pattern in Java
Get the second last row of a table in MySQL?

You need to use ORDER BY clause to get the second last row of a table in MySQL.
The syntax is as follows.
select *from yourTableName order by yourColumnName DESC LIMIT 1,1;
To understand the above syntax, let us create a table. The query to create a table is as follows.
mysql> create table secondLastDemo
   -> (
   -> StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY,
   -> StudentName varchar(10)
   -> );
Query OK, 0 rows affected (0.52 sec)
Insert some records in the table using insert command.
The query is as follows.
mysql> insert into secondLastDemo(StudentName) values('Larry');
Query OK, 1 row affected (0.15 sec)
mysql> insert into secondLastDemo(StudentName) values('Carol');
Query OK, 1 row affected (0.09 sec)
mysql> insert into secondLastDemo(StudentName) values('Bob');
Query OK, 1 row affected (0.10 sec)
mysql> insert into secondLastDemo(StudentName) values('Sam');
Query OK, 1 row affected (0.09 sec)
mysql> insert into secondLastDemo(StudentName) values('Mike');
Query OK, 1 row affected (0.10 sec)
mysql> insert into secondLastDemo(StudentName) values('David');
Query OK, 1 row affected (0.08 sec)
mysql> insert into secondLastDemo(StudentName) values('Maxwell');
Query OK, 1 row affected (0.10 sec)
mysql> insert into secondLastDemo(StudentName) values('Robert');
Query OK, 1 row affected (0.13 sec)
mysql> insert into secondLastDemo(StudentName) values('James');
Query OK, 1 row affected (0.14 sec)
mysql> insert into secondLastDemo(StudentName) values('Chris');
Query OK, 1 row affected (0.11 sec)
mysql> insert into secondLastDemo(StudentName) values('Ramit');
Query OK, 1 row affected (0.08 sec)
Display all records from the table using select statement.
The query is as follows.
mysql> select *from secondLastDemo;
The following is the output.
+-----------+-------------+
| StudentId | StudentName |
+-----------+-------------+
| 1         | Larry       |
| 2         | Carol       |
| 3         | Bob         |
| 4         | Sam         |
| 5         | Mike        |
| 6         | David       |
| 7         | Maxwell     |
| 8         | Robert      |
| 9         | James       |
| 10        | Chris       |
| 11        | Ramit       |
+-----------+-------------+
11 rows in set (0.00 sec)
Here is the query to get the second last row of a table in MySQL.
mysql> select *from secondLastDemo order by StudentId DESC LIMIT 1,1;
The output displays the second last record.
+-----------+-------------+
| StudentId | StudentName |
+-----------+-------------+
| 10        | Chris       |
 +-----------+-------------+
1 row in set (0.00 sec)
TypeScript | Array pop() Method

18 Jun, 2020
The Array.pop() is an inbuilt TypeScript function which is used to removes the last element from an array and returns that element. Syntax:
array.pop(); 
Parameter: This methods does not accept any parameter. Return Value: This method returns the removed element from the array. Below examples illustrate Array pop() method in TypeScript.
Example 1: 
JavaScript
<script>    // Driver code    var arr = [ 11, 89, 23, 7, 98 ];       // use of pop() method     var val = arr.pop()           // printing element    console.log( val );</script>
Output: 
98

Example 2: 
JavaScript
<script>    // Driver code    var arr = [2, 5, 6, 3, 8, 9];     var val,j=0;       // use of pop() method        for(j=0; j<4 ; j++){      val = arr.pop()             // printing element      console.log(val);    }</script>
Output: 
9
8
3
6

TypeScript
JavaScript
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Difference between var, let and const keywords in JavaScript
Differences between Functional Components and Class Components in React
Remove elements from a JavaScript Array
How to append HTML code to a div using JavaScript ?
Difference Between PUT and PATCH Request
Top 10 Projects For Beginners To Practice HTML and CSS Skills
Installation of Node.js on Linux
Difference between var, let and const keywords in JavaScript
How to insert spaces/tabs in text using HTML/CSS?
How to fetch data from an API in ReactJS ?
SVN - Checkout Process

Subversion provides the checkout command to check out a working copy from a repository. Below command will create a new directory in the current working directory with the name project_repo. Don't bother about the repository URL, as most of the time, it is already provided by the subversion administrator with appropriate access.
[tom@CentOS ~]$ svn checkout http://svn.server.com/svn/project_repo --username=tom

The above command will produce the following result.
A    project_repo/trunk
A    project_repo/branches
A    project_repo/tags
Checked out revision 1.

After every successful checkout operation, the revision number will get printed. If you want to view more information about the repository, then execute the info command.
[tom@CentOS trunk]$ pwd
/home/tom/project_repo/trunk

[tom@CentOS trunk]$ svn info

The above command will produce the following result.
Path: .
URL: http://svn.server.com/svn/project_repo/trunk
Repository Root: http://svn.server.com/svn/project_repo
Repository UUID: 7ceef8cb-3799-40dd-a067-c216ec2e5247
Revision: 1
Node Kind: directory
Schedule: normal
Last Changed Author: jerry
Last Changed Rev: 0
Last Changed Date: 2013-08-24 18:15:52 +0530 (Sat, 24 Aug 2013)
GATE | GATE CS 2021 | Set 2 | Question 63

23 May, 2021
Consider a pipelined processor with 5 stages, Instruction Fetch(IF), Instruction Decode(ID), Execute (EX), Memory Access (MEM), and Write Back (WB). Each stage of the pipeline, except the EX stage, takes one cycle. Assume that the ID stage merely decodes the instruction and the register read is performed in the EX stage. The EX stage takes one cycle for ADD instruction and the register read is performed in the EX stage, The EX stage takes one cycle for ADD instruction and two cycles for MUL instruction. Ignore pipeline register latencies.
Consider the following sequence of 8 instructions:
ADD, MUL, ADD, MUL, ADD, MUL, ADD, MUL 
Assume that every MUL instruction is data-dependent on the ADD instruction just before it and every ADD instruction (except the first ADD) is data-dependent on the MUL instruction just before it. The speedup defined as follows.
Speedup = (Execution time without operand forwarding) / (Execution time with operand forwarding)

The Speedup achieved in executing the given instruction sequence on the pipelined processor (rounded to 2 decimal places) is _____________ .(A) 1.875(B) 1.5625(C) 2(D) 1.667Answer: (A)Explanation: The timing diagrams for the without operand forwarding and with operand forwarding are givenbelow:
Without operand forwarding :
Time taken without Operand Forwarding = 30
With Operand Forwarding :
Time taken with Operand Forwarding = 16
Therefore,
Speedup = 30 /16 = 1.875Quiz of this Question
GATE
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
GATE | GATE-CS-2014-(Set-2) | Question 65
GATE | Sudo GATE 2020 Mock I (27 December 2019) | Question 33
GATE | GATE CS 2008 | Question 46
GATE | GATE-CS-2015 (Set 3) | Question 65
GATE | GATE-CS-2014-(Set-3) | Question 65
GATE | GATE CS 2011 | Question 49
GATE | GATE CS 1996 | Question 63
GATE | GATE-CS-2004 | Question 31
GATE | GATE CS 1996 | Question 38
GATE | GATE-CS-2014-(Set-1) | Question 51
Node.js process.stdin Property

16 Mar, 2021
The process.stdin property is an inbuilt application programming interface of the process module which listens for the user input. The stdin property of the process object is a Readable Stream. It uses on() function to listen for the event.
Syntax:
process.stdin.on();
Return Value: It doesn’t return any value.
Parameters: This property takes Input from the user.
Below examples illustrate the use of process.stdin property in Node.js:
Example 1: Create a JavaScript file and name this file as index.js.
Javascript
// Node.js program to demonstrate the // process.stdin Property   // Enter any texts ( User input)process.stdin.on('data', data => {  console.log(`You typed ${data.toString()}`);  process.exit();});
Run the index.js file using the following command:
node index.js
Output: Now type any text from the terminal, as shown below we have typed GeeksforGeeks
GeeksforGeeks
You typed GeeksforGeeks
Example 2: Create a JavaScript file and name this file as index.js.
Javascript
// Node.js program to demonstrate the // process.stdin Property   process.stdin.on('readable', () => {  let chunk;  // Use a loop to make sure we read all available data.  while ((chunk = process.stdin.read()) !== null) {   process.stdout.write(`data: ${chunk}`);  }});
Run the index.js file using the following command:
node index.js
Output: Now type any text from the terminal, as shown below we have typed One, followed by Two and so on.
One
data: One
Two
data: Two
Reference: https://nodejs.org/api/process.html#process_process_stdin
Node.js-Methods
Node.js-process-module
Node.js
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Installation of Node.js on Windows
JWT Authentication with Node.js
Difference between dependencies, devDependencies and peerDependencies
Mongoose Populate() Method
Mongoose find() Function
Top 10 Projects For Beginners To Practice HTML and CSS Skills
Difference between var, let and const keywords in JavaScript
How to insert spaces/tabs in text using HTML/CSS?
How to fetch data from an API in ReactJS ?
Differences between Functional Components and Class Components in React
Batch Script - Deleting Files

For deleting files, Batch Script provides the DEL command.
DEL [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names

Following are the description of the options which can be presented to the DEL command.
Names
Specifies a list of one or more files or directories. Wildcards may be used to delete multiple files. If a directory is specified, all files within the directory will be deleted
/P
Prompts for confirmation before deleting each file.
/F
Force deletes of read-only files.
/S
Deletes specified files from all subdirectories.
/Q
Quiet mode, do not ask if ok to delete on global wildcard.
/A
Selects files to delete based on attributes.
attributes
R Read-only files, S System files, H Hidden files, A Files ready for archiving - Prefix meaning not
Following examples show how the DEL command can be used.
del test.bat

The above command will delete the file test.bat in the current directory, if the file exists.
del c:\test.bat

The above command will delete the file C:\test.bat in the current directory, if the file exists.
del c:\*.bat

The * (asterisks) is a wild character. *.bat indicates that you would like to delete all bat files in the c:\directory.
del c:\?est.tmp

The ? (question mark) is a single wild character for one letter. The use of this command in the above example will delete any file ending with "est.tmp", such as pest.tmp or test.tmp.
 Print
 Add Notes
 Bookmark this page
\hspace - Tex Command

\hspace - Used to create horizontal space.
{ \hspace }
\hspace command draws horizontal space.

s\hspace7ex k\hspace6ex i\hspace5ex n\hspace4ex n\hspace3ex i\hspace2ex e\hspace1ex r

skinnier



s\hspace7ex k\hspace6ex i\hspace5ex n\hspace4ex n\hspace3ex i\hspace2ex e\hspace1ex r

skinnier


s\hspace7ex k\hspace6ex i\hspace5ex n\hspace4ex n\hspace3ex i\hspace2ex e\hspace1ex r

    14 Lectures 
     52 mins

 Ashraf Said

    11 Lectures 
     1 hours 

 Ashraf Said

    9 Lectures 
     1 hours 

 Emenwa Global, Ejike IfeanyiChukwu

    29 Lectures 
     2.5 hours 

 Mohammad Nauman

    14 Lectures 
     1 hours 

 Daniel Stern

    15 Lectures 
     47 mins

 Nishant Kumar
 Print
 Add Notes
 Bookmark this page
Bootstrap - Labels

This chapter covers Bootstrap labels. Labels are great for offering counts, tips, or other markup for pages. Use class .label to display labels as shown in the following example −

<h1>Example Heading <span class = "label label-default">Label</span></h1>
<h2>Example Heading <span class =" label label-default">Label</span></h2>
<h3>Example Heading <span class = "label label-default">Label</span></h3>
<h4>Example Heading <span class = "label label-default">Label</span></h4>
You can modify the appearance of the labels using the modifier classes such as, label-default, label-primary, label-success, label-info, label-warning, label-danger as shown in the following example −
<span class = "label label-default">Default Label</span>
<span class = "label label-primary">Primary Label</span>
<span class = "label label-success">Success Label</span>
<span class = "label label-info">Info Label</span>
<span class = "label label-warning">Warning Label</span>
<span class = "label label-danger">Danger Label</span>

    26 Lectures 
     2 hours 

 Anadi Sharma

    54 Lectures 
     4.5 hours 

 Frahaan Hussain

    161 Lectures 
     14.5 hours 

 Eduonix Learning Solutions

    20 Lectures 
     4 hours 

 Azaz Patel

    15 Lectures 
     1.5 hours 

 Muhammad Ismail

    62 Lectures 
     8 hours 

 Yossef Ayman Zedan
 Print
 Add Notes
 Bookmark this page
C# program to check password validity

While creating a password, you may have seen the validation requirements on a website like a password should be strong and have −
Min 8 char and max 14 char
One lower case
No white space
One upper case
One special char
Let us see how to check the conditions one by one −
if (passwd.Length < 8 || passwd.Length > 14)
return false;
if (!passwd.Any(char.IsLower))
return false;
if (passwd.Contains(" "))
return false;
if (!passwd.Any(char.IsUpper))
return false;
string specialCh = @"%!@#$%^&*()?/>.<,:;'\|}]{[_~`+=-" + "\"";
char[] specialCh = specialCh.ToCharArray();
foreach (char ch in specialChArray) {
   if (passwd.Contains(ch))
      return true;
}
Java Program to generate random numbers with no duplicates

For random numbers in Java, create a Random class object −
Random randNum = new Random();
Now, create a HashSet to get only the unique elements i.e. no duplicates −
Set<Integer>set = new LinkedHashSet<Integer>();
Generate random numbers with Random class nextInt −
while (set.size() < 5) {
   set.add(randNum.nextInt(5)+1);
}
import java.util.LinkedHashSet;
import java.util.Random;
import java.util.Set;
public class Demo {
   public static void main(final String[] args) throws Exception {
      Random randNum = new Random();
      Set<Integer>set = new LinkedHashSet<Integer>();
      while (set.size() < 5) {
         set.add(randNum.nextInt(5)+1);
      }
      System.out.println("Random numbers with no duplicates = "+set);
   }
}
Random numbers with no duplicates = [2, 4, 1, 3, 5]
How to match a non-white space equivalent using Java RegEx?

You can match the non-white space characters using the meta character "\\S".
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Example {
   public static void main(String args[]) {
      //Reading String from user
      System.out.println("Enter a String");
      Scanner sc = new Scanner(System.in);
      String input = sc.nextLine();
      String regex = "\\S";
      //Compiling the regular expression
      Pattern pattern = Pattern.compile(regex);
      //Retrieving the matcher object
      Matcher matcher = pattern.matcher(input);
      int count = 0;
      while(matcher.find()) {
         count++;
      }
      System.out.println("Number of characters (not spaces): "+count);
   }
}
Enter a String
Hello how are you welcome to tutorialspoint
Number of characters (not spaces): 37
NodeJS process.nextTick() Method

08 Mar, 2021
The process object is one of the few global objects provided by the NodeJS core API. It can be accessed from anywhere, thus its methods can also be accessed. Such is a method called process.nextTick() which is used by developers in real-time applications every day to defer the execution of a function until the next Event Loop Iteration.
Syntax:
process.env
Return Value:
In the code of snippet, the second console is printed first because this is a part of the current iteration of the event loop, and the first console is a part of a callback function that is associated with the process.nextTick() executed in the next iteration of the event loop.
Below examples illustrate the use of the process.nextTick() property in NodeJS:
Example:
Javascript
// Node.js program to demonstrate the // process.nextTick() Property      // Include process module const process = require('process');  process.nextTick(() => {  console.log('Executed in the next iteration');});  console.log('Executed in the current iteration');
Command to run:
node filename
Output:
Node.js-Methods
Picked
Node.js
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Installation of Node.js on Windows
JWT Authentication with Node.js
Difference between dependencies, devDependencies and peerDependencies
Mongoose Populate() Method
Mongoose find() Function
Express.js req.params Property
How to connect Node.js with React.js ?
Mongoose | updateOne() Function
File uploading in Node.js
Mongoose | findById() Function
Maltego Tool in Kali Linux

06 Jan, 2021
Maltego is an open-source intelligence forensic application. Which will help you to get more accurate information and in a smarter way. In simple words, it is an information-gathering tool. 
Features of Maltego: 
It is used for gathering information for security related work. It will save your time and make you work smarter and accurately.
It will help you in the thinking process by demonstrating connected links between all the searched items.
If you want to get hidden information, it(Maltego) can help you to discover it.
It is pre-installed (in the information gathering section )in Kali Linux.
Using Maltego tool in Kali Linux
1. Open Terminal and type “maltego” to run Maltego tool:
maltego
2. You have to register yourself first to use Maltego and remember your password as you will need it again the next time you login into Maltego. After the registration process, you can log in to Maltego. After that click on Machines and then choose Run Machine.
 3. Machine: A machine is simply what type of foot printing we want to do against our target. Select the machine that you want to use.
4. Once we are done with the process of choosing a machine for our footprinting. We need to choose a Target.
5. Maltego will now begin to gather info on our target and display it on screen as below:
Kali-Linux
Technical Scripter 2020
Linux-Unix
Technical Scripter
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Docker - COPY Instruction
scp command in Linux with Examples
chown command in Linux with Examples
SED command in Linux | Set 2
Introduction to Linux Operating System
Array Basics in Shell Scripting | Set 1
nohup Command in Linux with Examples
chmod command in Linux with examples
mv command in Linux with examples
Basic Operators in Shell Scripting
Vector toString() method in Java with Example

29 Jul, 2021
The java.util.Vector.toString() is an inbuilt method of Vector that is used to get a string representation of the objects of Vector in the form of a String representation of entries separated by “, “. So basically the toString() method is used to convert all the elements of Vector into String.Syntax: 
Vector.toString()
Parameter: The method does not take any parameters.Return value: The method returns the String representation consisting of the string representation of the elements of the Vector.Below programs illustrate the working of java.util.Vector.toString() method:Program 1: 
Java
// Java code to illustrate the toString() method import java.util.*; public class GFG {    public static void main(String[] args)    {         // creating vector type object        Vector<String> vector = new Vector<String>();         // Inserting elements into the table        vector.add("Geeks");        vector.add("4");        vector.add("Geeks");        vector.add("Welcomes");        vector.add("You");         // Displaying the Vector        System.out.println("Vector: " + vector);         // Displaying the string representation        System.out.println("The String representation is: "                           + vector.toString());    }}
Vector: [Geeks, 4, Geeks, Welcomes, You]
The String representation is: [Geeks, 4, Geeks, Welcomes, You]
 
Program 2:  
Java
// Java code to illustrate the toString() methodimport java.util.*; public class GFG {    public static void main(String[] args)    {         // Creating an empty Vector        Vector<Integer> vector            = new Vector<Integer>();         // Inserting elements into the table        vector.add(10);        vector.add(15);        vector.add(20);        vector.add(25);        vector.add(30);         // Displaying the Vector        System.out.println("Initial Vector is: " + vector);         // Displaying the string representation        System.out.println("The String representation is: "                           + vector.toString());    }}
Initial Vector is: [10, 15, 20, 25, 30]
The String representation is: [10, 15, 20, 25, 30]
 
sagar0719kumar
Java - util package
Java-Collections
Java-Functions
Java-Vector
Picked
Java
Technical Scripter
Java
Java-Collections
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
I want to call JButton doClick() method to simulate a click action in Java

Let us first set a JButton:
JButton btn = new JButton("DemoButton");
Now, attach action listener:
btn.addActionListener(new ClickListener());
If you have an ActionListener attached to your button it'll fire when you call the method doClick():
btn.doClick();
The following is an example to call JButton doClick() method to simulate a click action:
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JOptionPane;
public class SwingDemo {
   public static void main(final String args[]) {
      JButton btn = new JButton("DemoButton");
      btn.addActionListener(new ClickListener());
      JOptionPane.showMessageDialog(null, btn);
      btn.doClick();
   }
}
class ClickListener implements ActionListener {
   public void actionPerformed(ActionEvent e) {
      System.out.println("Clicked!");
   }
}
On clicking “DemoButton” above, the following is the output visible:
Tryit Editor v3.7

Tryit: transition properties
How do I close a tkinter window?

Creating an application using tkinter is easy but sometimes, it becomes difficult to close the window or the frame without closing it through the button on the title bar. In such cases, we can use the .destroy() method to close the window.
As tkinter attributes are independent of each other, we can create a separate
method to close the window using a button.
#Import the library
from tkinter import *

#Create an instance of window
win = Tk()

#Set the geometry of the window
win.geometry("700x400")

#Define a function to close the window
def close_win():
   win.destroy()

#Create a label
Label(win, text="Click the button to Close the window",
font=('Poppins bold', 25)).pack(pady= 20)

#Create a Button

Button(win, text= "Close", font=('Poppins bold', 16),
command=close_win).pack(pady=20)

win.mainloop()
If we run the above code, it will produce the following output window −