code-rag-bench/online-tutorials huggingface dataset:
XML | Tags

12 Apr, 2021
XML tags are the important features of XML document. It is similar to HTML but XML is more flexible then HTML. It allows to create new tags (user defined tags). The first element of XML document is called root element. The simple XML document contain opening tag and closing tag. The XML tags are case sensitive i.e. <root> and <Root> both tags are different. The XML tags are used to define the scope of elements in XML document.Property of XML Tags: There are many property of XML tags which are discussed below:  
Every XML document must have a root tag which enclose the XML document. It is not necessary to name of root tag is root. The name of root tag is any possible tag name. Example:  
html
<root>    <name>GeeksforGeeks</name>    <address>        <sector>142</sector>        <location>Noida</location>    </address></root>
The XML document must have start-tag, so first starting tag is known as root tag. The opening tag started with < bracket followed by tag name or element name and close with > bracket. Example:  
html
<Name>GeeksforGeeks<address>Noida
The tag which is started by start tag must end with the same tag with forward slash (end tag), or in other words every XML document must be ended with end-tag. The end tag started with < followed by / and its pair tag name ended with > Example:  
html
<Name>GeeksforGeeks</Name><address>Noida</address>
In XML, tags are case sensitive. It means that <Root> and <root> both are different tags. Example:  
html
<Name>Case sensitive</Name><name>name and Name are different tag</name>
The tag which contains no content are known as empty tags. Example:  
html
<name> </name><address/>
XML tag must be close in appropriate order. For example an XML tag opened inside another element must be closed before the outer element is closed.  
html
<root>    <name>GeeksforGeeks</name>    <address>        <add>Sector 142 Noida</add>        <pin>201302</pin>        <country>India</country>    </address></root>
 
simranarora5sos
HTML and XML
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
How to fetch data from an API in ReactJS ?
Differences between Functional Components and Class Components in React
Remove elements from a JavaScript Array
REST API (Introduction)
How to create footer to stay at the bottom of a Web page?
Difference Between PUT and PATCH Request
How to Open URL in New Tab using JavaScript ?
Roadmap to Learn JavaScript For Beginners
How to float three div side by side using CSS?
p5.js | quad() Function

12 Apr, 2019
The quad() function is an inbuilt function in p5.js which is used to draw a quadrilateral. A quadrilateral is a four-sided polygon. It function creates a shape similar to rectangle, but the angles between two edges are not constrained to 90 degrees.
Syntax:
quad(x1, y1, x2, y2, x3, y3, x4, y4)
or
quad(x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4)
Parameters: This function accepts twelve parameters as mentioned above and described below:
x1: This parameter takes the x-coordinate of the first point.
y1: This parameter takes the y-coordinate of the first point.
z1: This parameter takes the z-coordinate of the first point.
x2: This parameter takes the x-coordinate of the second point.
y2: This parameter takes the y-coordinate of the second point.
z2: This parameter takes the z-coordinate of the second point.
x3: This parameter takes the x-coordinate of the third point.
y3: This parameter takes the y-coordinate of the third point.
z3: This parameter takes the z-coordinate of the third point.
x4: This parameter takes the z-coordinate of the fourth point.
y4: This parameter takes the z-coordinate of the fourth point.
z4: This parameter takes the z-coordinate of the fourth point.
Below programs illustrates the quad() function in P5.js:
Example 1: This example uses quad() function to create a polygon without using z-coordinate.
function setup() {          // Create canvas of given size    createCanvas(400, 400);}   function draw() {          // Set the background color    background(220);          noStroke();          // Set the fill color    fill('green');          // x1, y1 = 38, 31; x2, y2 = 300, 20;    // x3, y3 = 100, 63; x4, y4 = 130, 250    quad(38, 31, 300, 20, 100, 63, 130, 250); }
Output:
Example 2: This example uses quad() function to create polygon with z-coordinate.
function setup() {          // Create canvas of given size    createCanvas(400, 400);}   function draw() {      // Set the background color    background(99);          noStroke();          // Set the filled color    fill('pink');          // x1, y1, z1 = 38, 131, 100;    // x2, y2, z2 = 320, 100, 63;     // x3, y3, z3 = 130, 150, 134;     // x4, y4, z4 = 155, 66, 88;    quad(38, 131, 100, 320, 100, 63,        130, 150, 134, 155, 66, 88); }
Output:
Reference: https://p5js.org/reference/#/p5/quad
JavaScript-p5.js
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
Node.js | fs.writeFileSync() Method
Remove elements from a JavaScript Array
Form validation using HTML and JavaScript
How to insert spaces/tabs in text using HTML/CSS?
Installation of Node.js on Linux
Top 10 Projects For Beginners To Practice HTML and CSS Skills
Node.js fs.readFileSync() Method
How to set the default value for an HTML <select> element ?
How to show/hide data when the particular condition is true in AngularJS ?

18 Nov, 2020
In AngularJS, in order to hide or show data or content, we can use *ngIf structural directive. By using this, we can evaluate conditions and then *ngIf based on the condition displays the content. For example, if the condition for *ngIf is true then the content will be displayed and if the condition is false then the content is not displayed.
Approach:
In order to give a lucid and elaborate view, I’ll explain the concept using an example.
Consider we have an array of objects in .ts file and the objects in the array contain a list of technical and non-technical companies.
The objective of this experiment is to display the data for all the technical companies and to hide all the non-technical companies.
In order to traverse through the array, we will use the *ngFor directive in .html file.
Once you are done with the implementation start the server.
Implementation:
app.component.ts:
Javascript
import { Component } from '@angular/core';  @Component({  selector: 'my-app',  templateUrl: './app.component.html',  styleUrls: [ './app.component.css' ]})export class AppComponent  {      companies = [    {      name: "Microsoft",      isTechnical  : true,    },      {      name: "GeeksForGeeks",      isTechnical : true    },      {      name: "Netflix",      isTechnical : false    },    {      name: "TCS",      isTechnical : true    }  ]}
app.module.ts:
Javascript
import { NgModule } from '@angular/core';import { BrowserModule } from '@angular/platform-browser';import { FormsModule } from '@angular/forms';  import { AppComponent } from './app.component';  @NgModule({  imports:      [ BrowserModule, FormsModule ],  declarations: [ AppComponent ],  bootstrap:    [ AppComponent ]})export class AppModule { }
app.component.html: 
HTML
<ol>    <li *ngFor="let company of companies">        <i *ngIf="company.isTechnical"> {{company.name}} </i>    </li>    </ol>
Output: You can clearly see the 3rd item is hidden because its condition is false. In order to give a more-visible example, I left it blank. 
AngularJS-Misc
AngularJS
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Routing in Angular 9/10
Angular PrimeNG Dropdown Component
Angular 10 (blur) Event
How to make a Bootstrap Modal Popup in Angular 9/8 ?
How to create module with Routing in Angular 9 ?
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 ?
get_window_size driver method – Selenium Python

03 Dec, 2020
Selenium’s Python Module is built to perform automated testing with Python. Selenium Python bindings provides a simple API to write functional/acceptance tests using Selenium WebDriver. To open a webpage using Selenium Python, checkout – Navigating links using get method – Selenium Python. Just being able to go to places isn’t terribly useful. What we’d really like to do is to interact with the pages, or, more specifically, the HTML elements within a page. There are multiple strategies to find an element using Selenium, checkout – Locating Strategies. Selenium WebDriver offers various useful methods to control the session, or in other words, browser. For example, adding a cookie, pressing back button, navigating among tabs, etc. 
This article revolves around get_window_size driver method in Selenium. get_window_size method gets the width and height of the current window.
Syntax – 
driver.get_window_size()
Example – Now one can use get_window_size method as a driver method as below – 
driver.get("https://www.geeksforgeeks.org/")
driver.get_window_size()
To demonstrate, get_window_size method of WebDriver in Selenium Python. Let’ s visit https://www.geeksforgeeks.org/ and operate on driver object. Let’s get window size,
Program – 
Python3
# import webdriverfrom selenium import webdriver # create webdriver objectdriver = webdriver.Firefox() # get geeksforgeeks.orgdriver.get("https://www.geeksforgeeks.org/")  # get window sizeprint(driver.get_window_size())
Output – Screenshot added –  
Terminal output –  
 
Akanksha_Rai
Python-selenium
selenium
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Different ways to create Pandas Dataframe
Enumerate() in Python
How to Install PIP on Windows ?
*args and **kwargs in Python
Python Classes and Objects
Python OOPs Concepts
Convert integer to string in Python
Introduction To PYTHON
How to drop one or multiple columns in Pandas Dataframe
Python | os.path.join() method
SASS | Interpolation

11 Oct, 2019
Interpolation is basically an insertion. Interpolation allows us to interpolate sass expressions into a simple SASS or CSS code. Means, you can define ( some part or the whole ) selector name, property name, CSS at-rules, quoted or unquoted strings etc, as a variable. Interpolation is a new principle and it is widely used in SASS.
To interpolate an expression we need to wrap the expression using #{ }.
Syntax:
......#{$variable_name}........
where ..... represents some text.
See the example below to get more understanding:SASS file:
@mixin interpolation($changeable, $val, $val2, $prop1, $prop2)
{
    background-#{$changeable}: $val;
    position: $val2;
    #{$prop1}: 0px; 
    #{$prop2}: 0px;
}


.blockarea{
    @include interpolation("image", url("img.png"), absolute, top, right);
}

.anotherbloakarea{
    @include interpolation("color", lightgray, absolute, top, left);
}

Compiled CSS file:
.blockarea {
    background-image: url("img.png");
    position: absolute;
    top: 0px;
    right: 0px;
}
  
.anotherbloakarea {
   background-color: lightgray;
   position: absolute;
   top: 0px;
   left: 0px;
}

Interpolation in SASS expressions always returns an unquoted string, no matter whether the string is quoted or not.
Uses of Interpolation:
To use dynamically created names as a property name, a variable name or for any other same purposes.To create a very reusable code; where you can define a property name, strings, selector names etc, as a variable.
To use dynamically created names as a property name, a variable name or for any other same purposes.
To create a very reusable code; where you can define a property name, strings, selector names etc, as a variable.
CSS-Advanced
SASS
CSS
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to update Node.js and NPM to next version ?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to insert spaces/tabs in text using HTML/CSS?
How to create footer to stay at the bottom of a Web page?
CSS to put icon inside an input element in a form
Installation of Node.js on Linux
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 ?
Convert a Set of String to a comma separated String in Java - GeeksforGeeks

11 Dec, 2018
Given a Set of String, the task is to convert the Set to a comma separated String in Java.
Examples:
Input: Set<String> = ["Geeks", "ForGeeks", "GeeksForGeeks"]
Output: "Geeks, For, Geeks"

Input: Set<String> = ["G", "e", "e", "k", "s"]
Output: "G, e, e, k, s"

Approach: This can be achieved with the help of join() method of String as follows.
Get the Set of String.Form a comma separated String from the Set of String using join() method by passing comma ‘, ‘ and the set as parameters.Print the String.
Get the Set of String.
Form a comma separated String from the Set of String using join() method by passing comma ‘, ‘ and the set as parameters.
Print the String.
Below is the implementation of the above approach:
// Java program to convert Set of String// to comma separated String  import java.util.*;  public class GFG {    public static void main(String args[])    {          // Get the Set of String        Set<String>            set = new HashSet<>(                Arrays                    .asList("Geeks",                            "ForGeeks",                            "GeeksForGeeks"));          // Print the Set of String        System.out.println("Set of String: " + set);          // Convert the Set of String to String        String string = String.join(", ", set);          // Print the comma separated String        System.out.println("Comma separated String: "                           + string);    }}
Set of String: [ForGeeks, Geeks, GeeksForGeeks]
Comma separated String: ForGeeks, Geeks, GeeksForGeeks

java-set
Java-Set-Programs
Java-String-Programs
Java-Strings
Java
Java-Strings
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Initialize an ArrayList in Java
Interfaces in Java
ArrayList in Java
Multidimensional Arrays in Java
Stack Class in Java
Singleton Class in Java
LinkedList in Java
Collections in Java
Overriding in Java
Queue Interface In Java
Get the fully-qualified name of a class in Java

A fully-qualified class name in Java contains the package that the class originated from. An example of this is java.util.ArrayList. The fully-qualified class name can be obtained using the getName() method.
A program that demonstrates this is given as follows −
 Live Demo
public class Demo {
   public static void main(String[] argv) throws Exception {
      Class c = java.util.ArrayList.class;
      String className = c.getName();
      System.out.println("The fully-qualified name of the class is: " + className);
   }
}
The fully-qualified name of the class is: java.util.ArrayList
Now let us understand the above program.
The getName() method is used to get the fully-qualified name of the class c which is stored in className. Then this is displayed. A code snippet which demonstrates this is as follows −
Class c = java.util.ArrayList.class;
String className = c.getName();
System.out.println("The fully-qualified name of the class is: " + className);
Difference between Schema and Database in MySQL?

In MySQL, schema is synonymous with database. As the query is written to create the
database, similarly the query can be written to create the schema.
Logical structure can be used by the schema to store data while memory component can be
used by the database to store data. Also, a schema is collection of tables while a database is a
collection of schema.
To clarify this concept, a database and a schema are created. The steps for this are as follows −
First, a database is created with the following syntax −
create database yourDatabaseName;
The above syntax is used in a query as follows −
mysql> create database DatabaseSample;
Query OK, 1 row affected (0.14 sec)
The syntax to create a schema is as follows −
create schema yourSchemaName;

The above syntax is used in a query as follows −
mysql> create schema SchemaSample;
Query OK, 1 row affected (0.19 sec)
Now both the database and the schema have been created
To display the database and the schema as well, the show command is used. The query for that
is as follows −
mysql> show databases;

The following is the output of the above query
+--------------------+
| Database           |
+--------------------+
| business           |
| databasesample     |
| hello              |
| information_schema |
| mybusiness         |
| mysql              | 
| performance_schema |
| sample             |
| schemasample       |
| sys                | 
| test               |
+--------------------+
11 rows in set (0.07 sec)
In the oracle database, the schema can be used to represent a part of the database.
How to submit a form using jQuery click event?

To submit a form using jQuery click event, you need to detect the submit event. Let’s submit a form using click event and without using click event.
You can try to run the following code to learn how to submit a form using jQuery click event −
Live Demo
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $(function() {
   $('#submit1').click(function(e) {
        e.preventDefault();
        $("#Demo").submit();
    });

   $('#submit2').click(function(e) {
        e.preventDefault();
        $("#Demo").submit();
    });
});
});
</script>

</head>
<body>
<form action="javascript:alert('submitted');" method="post" id="Demo">
    <label>Team</label>
    <input type="text" name="name" value="" />
    <input type="submit" name="submitme" value="Submit" id="submit1" />
    <p><a href="#" id="submit2">Submit</a></p>
</form>
</body>
</html>
How to enable the “disabled” attribute using jQuery on button click?

Set the disabled property to true in jQuery −
<input type="text" disabled=true id="showTxtBoxHide" value="My Name is David..">
Following is the code −
 Live Demo
<!DOCTYPE html>
<html lang="en">
 
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
 
<body>
  <input type="text" disabled=true id="showTxtBoxHide" value="My Name is David..">
  <br>
  <br>
  <input type="button" id="change" value="ClickTheButtonToEnableTextBox">
</body>
<script>
  $("#change").click(function (buttonEvent) {
    buttonEvent.preventDefault();
    $('#showTxtBoxHide').prop("disabled", false);
  });
</script>
 
</html>
To run the above program, save the file name anyName.html(index.html). Right click on the file and select the option “Open with live server” in VS Code editor −
The output is as follows −
The text box property is disabled. To enable, you need to click the button −
NumPy - right_shift

The numpy.right_shift() function shift the bits in the binary representation of an array element to the right by specified positions, and an equal number of 0s are appended from the left.
import numpy as np 

print 'Right shift 40 by two positions:' 
print np.right_shift(40,2) 
print '\n'  

print 'Binary representation of 40:' 
print np.binary_repr(40, width = 8) 
print '\n'  

print 'Binary representation of 10' 
print np.binary_repr(10, width = 8)  
# Two bits in '00001010' are shifted to right and two 0s appended from left.
Its output would be as follows −
Right shift 40 by two positions:
10

Binary representation of 40:
00101000

Binary representation of 10
00001010


    63 Lectures 
     6 hours 

 Abhilash Nelson

    19 Lectures 
     8 hours 

 DATAhill Solutions Srinivas Reddy

    12 Lectures 
     3 hours 

 DATAhill Solutions Srinivas Reddy

    10 Lectures 
     2.5 hours 

 Akbar Khan

    20 Lectures 
     2 hours 

 Pruthviraja L

    63 Lectures 
     6 hours 

 Anmol
 Print
 Add Notes
 Bookmark this page
Loading Model for Predictions

To predict the unseen data, you first need to load the trained model into the memory. This is done using the following command −
model = load_model ('./models/handwrittendigitrecognition.h5')

Note that we are simply loading the .h5 file into memory. This sets up the entire neural network in memory along with the weights assigned to each layer.
Now, to do your predictions on unseen data, load the data, let it be one or more items, into the memory. Preprocess the data to meet the input requirements of our model as what you did on your training and test data above. After preprocessing, feed it to your network. The model will output its prediction.

    87 Lectures 
     11 hours 

 Abhilash Nelson

    106 Lectures 
     13.5 hours 

 Abhilash Nelson

    28 Lectures 
     4 hours 

 Abhilash Nelson

    58 Lectures 
     8 hours 

 Soumyadeep Dey

    59 Lectures 
     2.5 hours 

 Mike West

    128 Lectures 
     5.5 hours 

 TELCOMA Global
 Print
 Add Notes
 Bookmark this page
Copy elision in C++ - GeeksforGeeks

29 May, 2017
Copy elision (or Copy omission) is a compiler optimization technique that avoids unnecessary copying of objects. Now a days, almost every compiler uses it. Let us understand it with the help of an example.
#include <iostream>using namespace std;   class B{public:        B(const char* str = "\0") //default constructor    {        cout << "Constructor called" << endl;    }              B(const B &b)  //copy constructor    {        cout << "Copy constructor called" << endl;    } };   int main(){     B ob = "copy me";     return 0;}
The output of above program is:
Constructor called

Why copy constructor is not called?According to theory, when the object “ob” is being constructed, one argument constructor is used to convert “copy me” to a temporary object & that temporary object is copied to the object “ob”. So the statement
     B ob = "copy me"; 
should be broken down by the compiler as
     B ob = B("copy me");
However, most of the C++ compilers avoid such overheads of creating a temporary object & then copying it.
The modern compilers break down the statement
    B ob = "copy me"; //copy initialization
as
    B ob("copy me"); //direct initialization
and thus eliding call to copy constructor.

However, if we still want to ensure that the compiler doesn’t elide the call to copy constructor [disable the copy elision], we can compile the program using “-fno-elide-constructors” option with g++ and see the output as following:
  aashish@aashish-ThinkPad-SL400:~$ g++ copy_elision.cpp -fno-elide-constructors
  aashish@aashish-ThinkPad-SL400:~$ ./a.out
  Constructor called
  Copy constructor called

If “-fno-elide-constructors” option is used, first default constructor is called to create a temporary object, then copy constructor is called to copy the temporary object to ob.
Reference:http://en.wikipedia.org/wiki/Copy_elision
This article is compiled by Aashish Barnwal and reviewed by GeeksforGeeks team. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above
C Language
C++
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Multidimensional Arrays in C / C++
rand() and srand() in C/C++
Left Shift and Right Shift Operators in C/C++
Different methods to reverse a string in C/C++
Core Dump (Segmentation fault) in C/C++
Vector in C++ STL
Inheritance in C++
Initialize a vector in C++ (6 different ways)
Socket Programming in C/C++
Map in C++ Standard Template Library (STL)
How to concatenate lists in java?

The addAll(Collection<? extends E> c) method of the class java.util.ArrayList appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's Iterator. Using this method you can concatenate two lists.
Example:
import java.util.ArrayList;

public class Sample {
   public static void main(String[] args) {
      ArrayList<String> list = new ArrayList<String>();
      list.add("JavaFx");
      list.add("Java");
      list.add("WebGL");
      list.add("OpenCV");
      System.out.println(list);
      ArrayList<String> newList = new ArrayList<String>();
      list.add("HBase");
      list.add("Neo4j");
      list.add("MangoDB");
      list.add("Cassandra");
      list.addAll(newList);
      System.out.println(list);
   }
}
Output:
[JavaFx, Java, WebGL, OpenCV]
[JavaFx, Java, WebGL, OpenCV, HBase, Neo4j, MangoDB, Cassandra]
Angular ngx bootstrap Pagination Component - GeeksforGeeks

02 Sep, 2021
Angular ngx bootstrap is a bootstrap framework used with angular to create components with great styling and this framework is very easy to use and is used to make responsive websites. In this article, we will know how to use Pagination in angular ngx bootstrap.
Installation syntax:
npm install ngx-bootstrap --save 
Approach:
First, install the angular ngx bootstrap using the above-mentioned command.
Add the following script in index.html<link href=”https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css” rel=”stylesheet”>
<link href=”https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css” rel=”stylesheet”>
Import Pagination component in module.ts
In app.component.html, make a Pagination component.
Serve the app using ng serve.
 
Example 1:
index.html
<!doctype html><html lang="en">  <head>    <meta charset="utf-8">    <title>Demo</title>    <base href="/">    <meta name="viewport" content=        "width=device-width,initial-scale=1">    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"        rel="stylesheet">      <link rel="icon" type="image/x-icon" href="favicon.ico">    <link rel="preconnect" href="https://fonts.gstatic.com">    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap"        rel="stylesheet">    <link href="https://fonts.googleapis.com/icon?family=Material+Icons"        rel="stylesheet"></head>  <body class="mat-typography">    <app-root></app-root></body>  </html>
app.component.html
<div class="row">    <div class="col-xs-12 col-12">        <pagination [totalItems]="totalItems"             [(ngModel)]="currentPage">        </pagination>    </div></div>
app.module.ts
import { NgModule } from '@angular/core';  // Importing forms moduleimport { FormsModule, ReactiveFormsModule } from '@angular/forms';import { BrowserModule } from '@angular/platform-browser';import { BrowserAnimationsModule }    from '@angular/platform-browser/animations';import { PaginationModule } from 'ngx-bootstrap/pagination';  import { AppComponent } from './app.component';  @NgModule({    bootstrap: [        AppComponent    ],    declarations: [        AppComponent    ],    imports: [        FormsModule,        BrowserModule,        BrowserAnimationsModule,        ReactiveFormsModule,        PaginationModule    ]})export class AppModule { }
Output:
Reference: https://valor-software.com/ngx-bootstrap/pagination
ysachin2314
Angular-ngx-bootstrap
AngularJS
Bootstrap
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Angular PrimeNG Dropdown Component
How to make a Bootstrap Modal Popup in Angular 9/8 ?
Angular 10 (blur) Event
How to setup 404 page in angular routing ?
How to create module with Routing in Angular 9 ?
How to change navigation bar color in Bootstrap ?
Form validation using jQuery
How to align navbar items to the right in Bootstrap 4 ?
How to pass data into a bootstrap modal?
How to Show Images on Click using HTML ?
What are forward declarations in C++?

Forward declaration lets the code following the declaration know that there is are classes with the name Person. This satisfies the compiler when it sees these names used. Later the linker will find the definition of the classes.
Class Person;

void myFunc(Person p1) {
   // ...
}
Class Person {
   // Class definition here
};
So in this case when the compiler encounters myFunc, it'll know that it's going to encounter this class somewhere down in the code. This can be used in cases where code using the class is placed/included before the code containing the class definition.
How to get first and last date of the current month with JavaScript?

To get the first and last date of current month in JavaScript, you can try to run the following code −
<html>
   <head>
      <title>JavaScript Dates</title>
   </head>
   <body>
      <script>
         var date = new Date();
         document.write("Current Date: " + date );
         var firstDay = new Date(date.getFullYear(), date.getMonth(), 1);
         document.write("<br>"+firstDay);
         var lastDay = new Date(date.getFullYear(), date.getMonth() + 1, 0);
         document.write("<br>"+lastDay);
      </script>
   </body>
</html>
Python | Pandas DataFrame.to_html() method - GeeksforGeeks

17 Sep, 2019
With help of DataFrame.to_html() method, we can get the html format of a dataframe by using DataFrame.to_html() method.
Syntax : DataFrame.to_html()Return : Return the html format of a dataframe.
Example #1 :In this example we can say that by using DataFrame.to_html() method, we are able to get the html format of a dataframe.
# import DataFrameimport pandas as pd  # using DataFrame.to_html() methodgfg = pd.DataFrame({'Name': ['Marks'],                     'Jitender': ['78'],                    'Rahul': ['77.9']})  print(gfg.to_html())
Output :
Example #2 :
# import DataFrameimport pandas as pd  # using DataFrame.to_html() methodgfg = pd.DataFrame({'Name': ['Marks', 'Gender'],                    'Jitender': ['78', 'Male'],                    'Purnima': ['78.9', 'Female']})  print(gfg.to_html())
Output :
Python pandas-dataFrame
Python pandas-dataFrame-methods
Python-pandas
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Python Dictionary
Read a file line by line in Python
Enumerate() in Python
How to Install PIP on Windows ?
Iterate over a list in Python
Python program to convert a list to string
Reading and Writing to text files in Python
sum() function in Python
Create a Pandas DataFrame from Lists
How to drop one or multiple columns in Pandas Dataframe
C++ Program to Convert Octal Number to Binary Number

In a computer system, the binary number is expressed in the binary numeral system while the octal number is in the octal numeral system. The binary number is in base 2 while the octal number is in base 8.
Examples of binary numbers and their corresponding octal numbers are as follows −
A program that converts the octal numbers into binary is given as follows −
 Live Demo
#include <iostream>
#include <cmath>
using namespace std;
int OctalToBinary(int octalNum) {
   int decimalNum = 0, binaryNum = 0, count = 0;

   while(octalNum != 0) {
      decimalNum += (octalNum%10) * pow(8,count);
      ++count;
      octalNum/=10;
   }
   count = 1;
   while (decimalNum != 0) {
      binaryNum += (decimalNum % 2) * count;
      decimalNum /= 2;
      count *= 10;
   }
   return binaryNum;
}
int main() {
   int octalNum = 33;
   cout <<"Octal to Binary"<<endl;
   cout<<"Octal number: "<<octalNum<<endl;
   cout<<"Binary number: "<<OctalToBinary(octalNum)<<endl;
   return 0;
}
The output of the above program is as follows −
Octal to Binary
Octal number: 33
Binary number: 11011
In the given program, the function OctalToBinary() converts the given octal number into a binary number This is done by first converting the octal number into a decimal number and then converting the decimal number into an binary number. This is seen in the following code snippet −
int OctalToBinary(int octalNum) {
   int decimalNum = 0, binaryNum = 0, count = 0;
   while(octalNum != 0) {
      decimalNum += (octalNum%10) * pow(8,count);
      ++count;
      octalNum/=10;
   }
   count = 1;
   while (decimalNum != 0) {
      binaryNum += (decimalNum % 2) * count;
      decimalNum /= 2;
      count *= 10;
   }
   return binaryNum;
}
In the function main(), the octal number is given. Then its corresponding binary number is calculated by calling OctalToBinary(). This is shown below −
int main() {
   int octalNum = 33;
   cout <<"Octal to Binary"<<endl;
   cout<<"Octal number: "<<octalNum<<endl;
   cout<<"Binary number: "<<OctalToBinary(octalNum)<<endl;
   return 0;
}
Are arrays zero indexed in C#?

Yes, arrays zero indexed in C#. Let us see how −
If the array is empty, it has zero elements and has length 0.
If the array has one element in 0 indexes, then it has length 1.
If the array has two elements in 0 and 1 indexes, then it has length 2.
If the array has three elements in 0, 1 and 2 indexes, then it has length 3.
The following states that an array in C# begins with index 0 −
/* begin from index 0 */
for ( i = 0; i < 5; i++ ) {
   n[ i ] = i + 5;
}
You can try to run the following to see how array indexing implements in C# −
Live Demo
using System;
namespace ArrayApplication {
   class MyArray {
      static void Main(string[] args) {
         int [] n = new int[5];
         int i,j;
         /* begings from index 0 */
         for ( i = 0; i < 5; i++ ) {
            n[ i ] = i + 5;
         }
         for (j = 0; j < 5; j++ ) {
            Console.WriteLine("Element[{0}] = {1}", j, n[j]);
         }
         Console.ReadKey();
      }
   }
}
Element[0] = 5
Element[1] = 6
Element[2] = 7
Element[3] = 8
Element[4] = 9
Adding only odd or even numbers JavaScript

We are required to make a function that given an array of numbers and a string that can take
any of the two values “odd” or “even”, adds the numbers which match that condition. If no
values match the condition, 0 should be returned.
For example −
console.log(conditionalSum([1, 2, 3, 4, 5], "even")); => 6
console.log(conditionalSum([1, 2, 3, 4, 5], "odd")); => 9
console.log(conditionalSum([13, 88, 12, 44, 99], "even")); => 144
console.log(conditionalSum([], "odd")); => 0
So, let’s write the code for this function, we will use the Array.prototype.reduce() method here −
const conditionalSum = (arr, condition) => {
   const add = (num1, num2) => {
      if(condition === 'even' && num2 % 2 === 0){
         return num1 + num2;
      }
      if(condition === 'odd' && num2 % 2 === 1){
         return num1 + num2;
      };
      return num1;
   }
   return arr.reduce((acc, val) => add(acc, val), 0);
}
console.log(conditionalSum([1, 2, 3, 4, 5], "even"));
console.log(conditionalSum([1, 2, 3, 4, 5], "odd"));
console.log(conditionalSum([13, 88, 12, 44, 99], "even"));
console.log(conditionalSum([], "odd"));
The output in the console will be −
6
9
144
0
N-Knights Tour | Practice | GeeksforGeeks

Popular Company Tags

Amazon
Microsoft
Oracle
Samsung
Adobe
Synopsys
Infosys
Cisco
Wipro
Ola-Cabs
Morgan-Stanley
Goldman-Sachs
show more


Amazon
Microsoft
Oracle
Samsung
Adobe
Synopsys
Infosys
Cisco
Wipro
Ola-Cabs
Morgan-Stanley
Goldman-Sachs


Popular Topic Tags

Maths
Array
Dynamic-Programming
Greedy-Algorithm
Hashing
Tree
Bit-Algorithm
Matrix
Backtracking
Operating System
Linked-List
Graph
show more


Maths
Array
Dynamic-Programming
Greedy-Algorithm
Hashing
Tree
Bit-Algorithm
Matrix
Backtracking
Operating System
Linked-List
Graph


'School' level Subjective Problems 

							This Question's [Answers : 0] [Views : 3781]
						


'School' level Subjective Problems 

							This Question's [Answers : 0] [Views : 3781]
						
Hi friend, I am Java Learner, I would like to seek for help on my coding. The requirement is as below, The knights must visits the maximum number of board positions without attacking each other. The Knight can move in the shape of the letter, 'L', over two in one direction and then over one in a perpendicular direction. If the Knight rests at the square marked X. Please assist, thanks.
Package knightstour;
import java.util.*;

public class KnightsTour {
    private static int board[][] = new int[8][8];
    private static int stepCounter = 1;
   
    public KnightsTour() { 
        initBoard(board);
        tour(0,0); 
        printSol(board); 
    }

    public static void printSol(int[][] a) { 
        for (int i = 0; i < a.length; i++) {
            for (int j = 0; j < a[i].length; j++) {
                if(a[i][j]>9) { 
                    System.out.print(a[i][j] + " ");
                } else { 
                    System.out.print(a[i][j] + " ");
                } 
            }
        System.out.println(); } System.out.println();
       }

     public static void initBoard(int[][] a) {
         for (int i = 0; i < a.length; i++) {
             for (int j = 0; j < a[i].length; j++) { 
                 a[i][j] = -1; 
              } 
         } 
     }

     public void tour(int x, int y) {
         if (((x < 0) || (x >= 8) || (y < 0) || (y >= 8)) || (board[x][y] != -1)){ 
            return;
         } else { 
             stepCounter++;
             board[x][y] = stepCounter;
             tour(x+2, y+1);
             tour(x+1, y-2);
             tour(x+1, y+2);
             tour(x-1, y+2);
             tour(x-2, y-1);
             tour(x-2, y+1);
             tour(x-1, y-2);
             tour(x+2, y-1);
        } 
     }

     public boolean spaceAvailable(int X, int Y) { }

     Public static void main(String[] args) {
          new KnightsTour(); 
     }
}
 
Error
Content Related Issue
Sofware Related Issue
How can I subtract tuple of tuples from a tuple in Python?

The direct way to subtract tuple of tuples from a tuple in Python is to use loops directly. For example, if
you have a tuple of tuples
((0, 1, 2), (3, 4, 5), (6, 7, 8), (9, 10, 11), (12, 13, 14))
and want to subtract (1, 2, 3, 4, 5) from each of the inner tuples, you can do it as follows
my_tuple = ((0, 1, 2), (3, 4, 5), (6, 7, 8), (9, 10, 11), (12, 13, 14))
sub = (1, 2, 3, 4, 5)
tuple(tuple(x - sub[i] for x in my_tuple[i]) for i in range(len(my_tuple)))
This will give the output
((-1, 0, 1), (1, 2, 3), (3, 4, 5), (5, 6, 7), (7, 8, 9))
Comparison of dates in PHP

Matching two dates in PHP is quite smooth when both the dates are in a similar format but php failed to analyze when the two dates are in an unrelated format. In this article, we will discuss different cases of date comparison in PHP. We will figure out how to utilize DateTime class,strtotime() in comparing dates.
we can analyze the dates by simple comparison operator if the given dates are in a similar format.
<?php
   $date1 = "2018-11-24";
   $date2 = "2019-03-26";
   if ($date1 > $date2)
     echo "$date1 is latest than $date2";
   else
     echo "$date1 is older than $date2";
?>
2019-03-26 is latest than 2018-11-24
Here we have declared two dates date1anddate2 in the same format. So we have used a comparison operator(>) to compare the dates.
If the given dates are in various formats at that point we can utilize the strtotime() function to convert the given dates into the UNIX timestamp format and analyze these numerical timestamps to get the expected result.
<?php
   $date1 = "18-03-22";
   $date2 = "2017-08-24";
   $curtimestamp1 = strtotime($date1);
   $curtimestamp2 = strtotime($date2);
   if ($curtimestamp1 > $curtimestamp2)
      echo "$date1 is latest than $date2";
   else
      echo "$date1 is older than $date2";
?>
18-03-22 is latest than 2017-08-24
In this example, we have two Dates which are in a different format. So we have used predefined function strtotime() convert them into numeric UNIX timestamp, then to compare those timestamps we use different comparison operators to get the desired result.
Comparing two dates by creating the object of the DateTime class.
<?php
   $date1 = new DateTime("18-02-24");
   $date2 = new DateTime("2019-03-24");
   if ($date1 > $date2) {
    echo 'datetime1 greater than datetime2';
   }
   if ($date1 < $date2) {
    echo 'datetime1 lesser than datetime2';
   }
  if ($date1 == $date2) {
    echo 'datetime2 is equal than datetime1';
   }
?>
datetime1 lesser than datetime2
In this example, we created two DateTime objects. In order to compare those two dates, we use different comparison operators to get the desired result.
C++ Array Library - begin() Function

The C++ function std::array::begin() returns an iterator which points to the start of the array.
Following is the declaration for std::array::begin() function form std::array header.
iterator begin() noexcept;
const_iterator begin() const noexcept;
None
If array object is const-qualified, method returns const random access iterator otherwise random access iterator.
This member function never throws exception.
Constant i.e. O(1)
The following example shows the usage of std::array::begin() function.
#include <iostream>
#include <array>

using namespace std;

int main(void) {

   array <int, 5> arr = {1, 2, 3, 4, 5};

   /* iterator pointing at the start of the array */
   auto itr = arr.begin();

   /* traverse complete container */
   while (itr != arr.end()) {
      cout << *itr << " ";
      ++itr;   /* increment iterator */
   }

   cout << endl;

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

 Print
 Add Notes
 Bookmark this page
Quotation in Python

Python accepts single ('), double (") and triple (''' or """) quotes to denote string literals, as long as the same type of quote starts and ends the string.
The triple quotes are used to span the string across multiple lines. For example, all the following are legal −
word = 'word'
sentence = "This is a sentence."
paragraph = """This is a paragraph. It is
made up of multiple lines and sentences."""
stopImmediatePropagation() Method

The stopImmediatePropagation() method stops the rest of the handlers from being executed. This method also stops the bubbling by calling event.stopPropagation().
You can use event.isImmediatePropagationStopped() to know whether this method was ever called (on that event object).
Here is the simple syntax to use this method −
event.stopImmediatePropagation() 

Here is the description of all the parameters used by this method −
NA
NA
Following is a simple example a simple showing the usage of this method −
<html>
   <head>
      <title>The jQuery Example</title>
      <script type = "text/javascript" 
         src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js">
      </script>
		
      <script type = "text/javascript" language = "javascript">
         $(document).ready(function() {
			
            $("div").click(function(event){
               alert("1 - This is : " + $(this).text());
               // Comment the following to see the effect.
               event.stopImmediatePropagation();
            });
				
            // This won't be executed.
            $("div").click(function(event){
               alert("2 - This is : " + $(this).text());
            });
				
         });
      </script>
		
      <style>
         div{ margin:10px;padding:12px; border:2px solid #666; width:160px;}
      </style>
   </head>
	
   <body>
      <p>Click on any box to see the result:</p>
		
      <div id = "div1" style = "background-color:blue;">
         BOX 1
      </div>
		
      <div id = "div2" style = "background-color:red;">
         BOX 2
      </div> 
   </body>
</html>
This will produce following result −
Click on any box to see the result −

    27 Lectures 
     1 hours 

 Mahesh Kumar

    27 Lectures 
     1.5 hours 

 Pratik Singh

    72 Lectures 
     4.5 hours 

 Frahaan Hussain

    60 Lectures 
     9 hours 

 Eduonix Learning Solutions

    17 Lectures 
     2 hours 

 Sandip Bhattacharya

    12 Lectures 
     53 mins

 Laurence Svekis
 Print
 Add Notes
 Bookmark this page
phpMyAdmin - Databases

Start the Apache Server and open /localhost/phpmyadmin phpmyadmin in web browser to open the phpMyAdmin interface.
As we have configured a database MySQL during Environment Setup, we've root user with password as root@123. Once phpMyAdmin opens up, you need to enter same credential to login to database.
Once logged in, you can see the following sections on the phpMyAdmin page loaded. The left section shows the databases available, it shows system as well user created databases.
On the right side, dashboard shows a tabbed interface to do all the database administration operations as shown below.
Click on Database Tab, to see the list of databases with more details. We can create database, iterate databases and do other operations here.
Click on any listed database to see the list of tables with more details. Tabs changes as per the context. Now tabs will shows as per the database. 
Now in the schema browser, click on any table, right side section will load the table details as shown with updated tabbed interface to do various operations on that table as shown below −
Double clicking on any cell, makes it editable, where you can edit and save data. Pressing esc key, will not save data. Once you move out of editing cell, it will show the update query and status of operation as shown below −
You can verify the update statement as well as show below −
UPDATE `employees` SET `AGE` = '28' WHERE `employees`.`ID` = 1;

Now click on Structure tab, it will show the table structural details as shown below −
 Print
 Add Notes
 Bookmark this page
What are the differences between import and static import statements in Java?

We can use an import statement to import classes and interface of a particular package. Whenever we are using import statement it is not required to use the fully qualified name and we can use short name directly. We can use static import to import static member from a particular class and package. Whenever we are using static import it is not required to use the class name to access static member and we can use directly.
To access a class or method from another package we need to use the fully qualified name or we can use import statements.
The class or method should also be accessible. Accessibility is based on the access modifiers.
Private members are accessible only within the same class. So we won't be able to access a private member even with the fully qualified name or an import statement.
The java.lang package is automatically imported into our code by Java.
Live Demo
import java.util.Vector;
public class ImportDemo {
   public ImportDemo() {
   //Imported using keyword, hence able to access directly in the code without package qualification.
      Vector v = new Vector();
      v.add("Tutorials");
      v.add("Point");
      v.add("India");
      System.out.println("Vector values are: "+ v);
   //Package not imported, hence referring to it using the complete package.
      java.util.ArrayList list = new java.util.ArrayList();
      list.add("Tutorix");
      list.add("India");
      System.out.println("Array List values are: "+ list);
   }
   public static void main(String arg[]) {
      new ImportDemo();
   }
}
Vector values are: [Tutorials, Point, India]
Array List values are: [Tutorix, India]
Static imports will import all static data so that can use without a class name.
A static import declaration has two forms, one that imports a particular static member which is known as single static import and one that imports all static members of a class which is known as a static import on demand.
Static imports introduced in Java5 version.
One of the advantages of using static imports is reducing keystrokes and re-usability.
Live Demo
import static java.lang.System.*; //Using Static Import
public class StaticImportDemo {
   public static void main(String args[]) {
      //System.out is not used as it is imported using the keyword stati.
      out.println("Welcome to Tutorials Point");
   }
}
Welcome to Tutorials Point