code-rag-bench/online-tutorials huggingface dataset:
How to convert string to numerical values in MongoDB?

You need to use some code in order to convert a string to numerical values in MongoDB.
Let us first create a collection with a document. The query to create a collection with a document is as follows:
> db.convertStringToNumberDemo.insertOne({"EmployeeId":"101","EmployeeName":"Larry"});
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5c7f56528d10a061296a3c31")
}
> db.convertStringToNumberDemo.insertOne({"EmployeeId":"1120","EmployeeName":"Mike"});
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5c7f56648d10a061296a3c32")
}
> db.convertStringToNumberDemo.insertOne({"EmployeeId":"3210","EmployeeName":"Sam"});
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5c7f566e8d10a061296a3c33")
}
Display all documents from the collection with the help of find() method. The query is as follows −
> db.convertStringToNumberDemo.find().pretty();
The following is the output −
{
   "_id" : ObjectId("5c7f56528d10a061296a3c31"),
   "EmployeeId" : "101",
   "EmployeeName" : "Larry"
}
{
   "_id" : ObjectId("5c7f56648d10a061296a3c32"),
   "EmployeeId" : "1120",
   "EmployeeName" : "Mike"
}
{
   "_id" : ObjectId("5c7f566e8d10a061296a3c33"),
   "EmployeeId" : "3210",
   "EmployeeName" : "Sam"
}
Here is the query to convert a string to numerical values in MongoDB. Change “EmployeeId” string to numerical values. The query is as follows −
> db.convertStringToNumberDemo.find().forEach(function(x)
   ... {
      ... db.convertStringToNumberDemo.update
      ... (
         ...
         ... {
            ... "_id": x._id,
            ...
         ... },
         ... {
            ... "$set":
            ... {
               ... "EmployeeId": parseInt(x.EmployeeId)
            ... }
         ... }
      ... )
   ... }
... );
Now check the documents from the collection. The query is as follows −
> db.convertStringToNumberDemo.find().pretty();
The following is the output displaying the string values (EmployeeId) converted to an integer −
{
   "_id" : ObjectId("5c7f56528d10a061296a3c31"),
   "EmployeeId" : 101,
   "EmployeeName" : "Larry"
}
{
   "_id" : ObjectId("5c7f56648d10a061296a3c32"),
   "EmployeeId" : 1120,
   "EmployeeName" : "Mike"
}
{
   "_id" : ObjectId("5c7f566e8d10a061296a3c33"),
   "EmployeeId" : 3210,
   "EmployeeName" : "Sam"
}
Updating a MySQL table with values from another table?

We can update another table with the help of inner join. Let us create two tables.
mysql> CREATE table tblFirst
   -> (
   -> id int,
   -> name varchar(100)
   -> );
Query OK, 0 rows affected (0.48 sec)

mysql> INSERT into tblFirst values(1,'John');
Query OK, 1 row affected (0.17 sec)

mysql> INSERT into tblFirst values(2,'Bob');
Query OK, 1 row affected (0.26 sec)

mysql> INSERT into tblFirst values(3,'David');
Query OK, 1 row affected (0.20 sec)

mysql> SELECT * from tblFirst;

The following is the output
+------+-------+
| id   | name  |
+------+-------+
| 1    | John  |
| 2    | Bob   |
| 3    | David |
+------+-------+
3 rows in set (0.00 sec)

mysql> CREATE table UpdTable
   -> (
   -> IncId int auto_increment,
   -> primary key(IncId),
   -> id int,
   -> name varchar(100)
   -> );
Query OK, 0 rows affected (0.57 sec)

mysql> INSERT into UpdTable(id,name) values(1,'Taylor');
Query OK, 1 row affected (0.12 sec)

mysql> INSERT into UpdTable(id,name) values(2,'jason');
Query OK, 1 row affected (0.24 sec)

mysql> INSERT into UpdTable(id,name) values(3,'carol');
Query OK, 1 row affected (0.14 sec)

mysql> INSERT into UpdTable(id,name) values(4,'john');
Query OK, 1 row affected (0.16 sec)

mysql> SELECT * from UpdTable;

The following is the output
mysql> SELECT *from UpdTable;
+-------+------+--------+
| IncId | id   | name   |
+-------+------+--------+
| 1     | 1    | Taylor |
| 2     | 2    | jason  |
| 3     | 3    | carol  |
| 4     | 4    | john   |
+-------+------+--------+
4 rows in set (0.00 sec)

Look at the above output, the last name is matching from the first table record.
Now, I will write the query for UPDATE −
mysql> UPDATE UpdTable
   -> inner join tblFirst ON (UpdTable.name = tblFirst.name)
   -> SET UpdTable.id = tblFirst.id;
Query OK, 1 row affected (0.19 sec)
Rows matched: 1 Changed: 1 Warnings: 0

We have updated the last record as follows −
The query is
mysql> SELECT * from UpdTable;

The following is the output
+-------+------+--------+
| IncId | id   | name   |
+-------+------+--------+
| 1     | 1    | Taylor |
| 2     | 2    | jason  |
| 3     | 3    | carol  |
| 4     | 1    | john   |
+-------+------+--------+
4 rows in set (0.00 sec)

Look at the sample output. The id is updated, which was 4 but now it is 1.
How to cast from VARCHAR to INT in MySQL?

To cast VARCHAR to INT, we can use the cast() function from MySQL. Here is the syntax of cast() function.
cast(anyValue as dataType)
For our example, we will create a table with the help of create command.
mysql> create table VarchartointDemo
   -> (
   -> Value varchar(100)
   -> );
Query OK, 0 rows affected (0.51 sec)
After creating a table, let us insert some records into the table with the help of INSERT command. The query is as follows −
mysql> insert into VarchartointDemo values('123');
Query OK, 1 row affected (0.26 sec)

mysql> insert into VarchartointDemo values('234');
Query OK, 1 row affected (0.16 sec)
Display all records with the help of select statement.
mysql> select *from VarchartointDemo;
The following is the output.
+-------+
| Value |
+-------+
| 123   |
| 234   |
+-------+
2 rows in set (0.00 sec)

Cast varchar to int using the following syntax.
SELECT CAST(yourColumnName AS anyDataType) FROM yourTableName;
Apply the above syntax to cast varchar to int.
mysql> SELECT CAST(Value AS UNSIGNED) FROM VarchartointDemo;
The following is the output.
+-------------------------+
| CAST(Value AS UNSIGNED) |
+-------------------------+
|                     123 |
|                     234 |
+-------------------------+
2 rows in set (0.00 sec)

Look at the above output, we have changed varchar to int.
Accenture Interview Experience for ASE | Off-Campus 2021 - GeeksforGeeks

26 Aug, 2021
Round 1: Cognitive & Technical and Coding Assessment (5th August 2021)
This assessment is split into 2 stages.
Stage 1: The Cognitive and Technical assessment is a mandatory assessment and will be an elimination round. You must meet their sectional and sub-sectional cut-off to proceed ahead in their recruitments process. You will have 90min to complete 90 questions.
Level – Easy & Medium 
When you are done with stage 1 you need to wait for 5-10 minutes.
If (stage1 == cleared){
cout<<"stage2"<<endl;
}
else{
cout<<"End"<<endl;
}
Stage 2: After clearing stage 1, you must participate in the Coding assessment and these scores will be considered for our final decisions. You will have 45min to complete 2 coding questions.
Level – Easy & Medium 
When you are done with the coding assessment, you will receive a link for the communication assessment.
Round 2: Communication Assessment (7th August 2021)
You will receive this mail within 5 days after completing your Round 1. 
Accenture communication test consists of 6 sections in total.
Every section has multiple questions and each question is asked by a different speaker (pre-recorded). Questions are asked orally and no text is displayed (except for the first section).
You need to orally answer every question.
You will be given 20-30 seconds to answer a question.
The next question will be asked immediately after the present one. In other terms, Questions are asked continuously without a break.
Section 1: Reading
Section 2: Listening
Section 3: Q & A
Section 4: Jumbled Sentences
Section 5: Retelling a story
Section 6: Speaking  
Round 3: Interview Round (13th August 2021)
You will receive this mail within a week after completing your Round 2. 
You need to book a slot for your interview. 
These are the questions that I was asked during my interview.
 Introduce Yourself
 Brief me about your project and then the questions were all about my project.
 Any hobbies? Any Extra co-curricular activity? Any Achievement 
My interview was for about 15 – 20 Minutes. 
P.S: You might need to wait for more than 10 minutes, So don’t panic. 
P.P.S: I am still waiting for my Interview result.
Accenture
Marketing
Off-Campus
Interview Experiences
Accenture
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Microsoft Interview Experience for Internship (Via Engage)
Amazon Interview Experience for SDE-1 (On-Campus)
Infosys Interview Experience for DSE - System Engineer | On-Campus 2022
Amazon Interview Experience for SDE-1
Oracle Interview Experience | Set 69 (Application Engineer)
Amazon Interview Experience for SDE1 (8 Months Experienced) 2022
Amazon Interview Experience for SDE-1(Off-Campus)
Amazon Interview Experience (Off-Campus) 2022
Amazon Interview Experience for SDE-1
Infosys DSE Interview Experience 2021
Find String Matches in a Vector or Matrix in R Programming - str_detect() Function - GeeksforGeeks

03 Jun, 2020
str_detect() Function in R Language is used to check if the specified match of the substring exists in the original string. It will return TRUE for a match found otherwise FALSE against each of the element of the Vector or matrix.
Note: This function uses 'stringr' Library.
Syntax: str_detect(string, pattern)
Parameter:string: specified stringpattern: Pattern to be matched
Example 1:
# R Program to illustrate # the use of str_detect function  # Loading librarylibrary(stringr)  # Creating vectorx <- c("Geeks", "Hello", "Welcome", "For")  # Pattern to be matchedpat <- "Geeks"  # Calling str_detect() functionstr_detect(x, pat)
Output:
[1]  TRUE FALSE FALSE FALSE

Example 2:
# R Program to illustrate # the use of str_detect function  # Loading librarylibrary(stringr)  # Creating vectorx1 <- c("Geeks", "Geeks", "Welcome", "Geeks")x2 <- c("Geeks", "Hello", "Geeks")  result <- array(c(x1, x2), dim = c(2, 2, 2))  # Pattern to be matchedpat <- "Geeks"  # Printing Matrixresult  # Calling str_detect() functionstr_detect(result, pat)
Output:
,, 1

     [, 1]    [, 2]     
[1, ] "Geeks" "Welcome"
[2, ] "Geeks" "Geeks",, 2

     [, 1]    [, 2]   
[1, ] "Geeks" "Geeks"
[2, ] "Hello" "Geeks"

[1]  TRUE  TRUE FALSE  TRUE  TRUE FALSE  TRUE  TRUE

R Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to Replace specific values in column in R DataFrame ?
How to change Row Names of DataFrame in R ?
Filter data by multiple conditions in R using Dplyr
Loops in R (for, while, repeat)
Change Color of Bars in Barchart using ggplot2 in R
Printing Output of an R Program
How to Change Axis Scales in R Plots?
Group by function in R using Dplyr
How to Split Column Into Multiple Columns in R DataFrame?
K-Means Clustering in R Programming
Plotly - Subplots and Inset Plots

Here, we will understand the concept of subplots and inset plots in Plotly.
Sometimes it is helpful to compare different views of data side by side. This supports the concept of subplots. It offers make_subplots() function in plotly.tools module. The function returns a Figure object.
The following statement creates two subplots in one row.
fig = tools.make_subplots(rows = 1, cols = 2)

We can now add two different traces (the exp and log traces in example above) to the figure.
fig.append_trace(trace1, 1, 1)
fig.append_trace(trace2, 1, 2)

The Layout of figure is further configured by specifying title, width, height, etc. using update() method.
fig['layout'].update(height = 600, width = 800s, title = 'subplots')

Here's the complete script −
from plotly import tools
import plotly.plotly as py
import plotly.graph_objs as go
from plotly.offline import iplot, init_notebook_mode
init_notebook_mode(connected = True)
import numpy as np
x = np.arange(1,11)
y1 = np.exp(x)
y2 = np.log(x)
trace1 = go.Scatter(
   x = x,
   y = y1,
   name = 'exp'
)
trace2 = go.Scatter(
   x = x,
   y = y2,
   name = 'log'
)
fig = tools.make_subplots(rows = 1, cols = 2)
fig.append_trace(trace1, 1, 1)
fig.append_trace(trace2, 1, 2)
fig['layout'].update(height = 600, width = 800, title = 'subplot')
iplot(fig)
This is the format of your plot grid: [ (1,1) x1,y1 ] [ (1,2) x2,y2 ]
To display a subplot as inset, we need to configure its trace object. First the xaxis and yaxis properties of inset trace to ‘x2’ and ‘y2’ respectively. Following statement puts ‘log’ trace in inset.
trace2 = go.Scatter(
   x = x,
   y = y2,
   xaxis = 'x2',
   yaxis = 'y2',
   name = 'log'
)
Secondly, configure Layout object where the location of x and y axes of inset is defined by domain property that specifies is position with respective to major axis.
xaxis2=dict(
   domain = [0.1, 0.5],
   anchor = 'y2'
),
yaxis2 = dict(
   domain = [0.5, 0.9],
   anchor = 'x2'
)
Complete script to display log trace in inset and exp trace on main axis is given below −
trace1 = go.Scatter(
   x = x,
   y = y1,
   name = 'exp'
)
trace2 = go.Scatter(
   x = x,
   y = y2,
   xaxis = 'x2',
   yaxis = 'y2',
   name = 'log'
)
data = [trace1, trace2]
layout = go.Layout(
   yaxis = dict(showline = True),
   xaxis2 = dict(
      domain = [0.1, 0.5],
      anchor = 'y2'
   ),
   yaxis2 = dict(
      showline = True,
      domain = [0.5, 0.9],
      anchor = 'x2'
   )
)
fig = go.Figure(data=data, layout=layout)
iplot(fig)
The output is mentioned below −

    12 Lectures 
     53 mins

 Pranjal Srivastava
 Print
 Add Notes
 Bookmark this page
How to find all pairs of elements in Java array whose sum is equal to a given number?

To find all pairs of elements in Java array whose sum is equal to a given number −
Add each element in the array to all the remaining elements (except itself).
Verify if the sum is equal to the required number.
If true, print their indices.
import java.util.Arrays;
import java.util.Scanner;
public class sample {
   public static void main(String args[]){
      //Reading the array from the user
      Scanner sc = new Scanner(System.in);
      System.out.println("Enter the size of the array that is to be created: ");
      int size = sc.nextInt();
      int[] myArray = new int[size];
      System.out.println("Enter the elements of the array: ");
      for(int i=0; i<size; i++){
         myArray[i] = sc.nextInt();
      }
      //Reading the number
      System.out.println("Enter the number: ");
      int num = sc.nextInt();
      System.out.println("The array created is: "+Arrays.toString(myArray));
      System.out.println("indices of the elements whose sum is: "+num);
      for(int i=0; i<myArray.length; i++){
         for (int j=i; j<myArray.length; j++){
            if((myArray[i]+myArray[j])== num && i!=j){
               System.out.println(i+", "+j);
            }
         }
      }
   }
}
Enter the size of the array that is to be created:
8
Enter the elements of the array:
15
12
4
16
9
8
24
0
Enter the number:
24
The array created is: [15, 12, 4, 16, 9, 8, 24, 0]
indices of the elements whose sum is: 24
0, 4
3, 5
6, 7
How to change the scale of Y-axis if the histogram bars are higher than the axis size in R?

When we create a histogram using hist function in R, often the Y-axis labels are smaller than the one or more bars of the histogram. Therefore, the histogram does not look appealing and it becomes a little difficult to match the Y-axis values with the bars size.
To solve this problem, we can use ylim argument of hist function in which the range can be supplied to plot on the Y-axis labels.
Consider the below data and its histogram −
 Live Demo
set.seed(101)
x<-runif(100,2,5)
hist(x)
Creating the same histogram with higher Y-axis −
hist(x,ylim=c(0,25))
Convert Fahrenheit to Celsius using C Program

The logic that we implement to convert Fahrenheit to Celsius is as follows −
celsius = (fahrenheit - 32)*5/9;
Refer to the algorithm given below to convert Fahrenheit to Celsius.
Step 1: Declare two variables farh, cels
Step 2: Enter Fahrenheit value at run time
Step 3: Apply formula to convert
        Cels=(farh-32)*5/9;
Step 4: Print cels
Following is the C program to convert Fahrenheit to Celsius −
 Live Demo
#include<stdio.h>
int main(){
   float fahrenheit, celsius;
   //get the limit of fibonacci series
   printf("Enter Fahrenheit: \n");
   scanf("%f",&fahrenheit);
   celsius = (fahrenheit - 32)*5/9;
   printf("Celsius: %f \n", celsius);
   return 0;
}
When the above program is executed, it produces the following result −
Enter Fahrenheit:

100
Celsius: 37.777779
Tensorflow.js tf.mean() Function - GeeksforGeeks

18 May, 2021
Tensorflow.js is an open-source library developed by Google for running machine learning models and deep learning neural networks in the browser or node environment.
The tf.mean() function is used to calculate the mean value of the specified Tensor across its dimension. It reduces the given input elements along the dimensions of axes. If the parameter “keepDims” is true, the reduced dimensions are retained with length 1 else the rank of Tensor is reduced by 1. If the axes parameter has no entries, it returns a Tensor with a single element with all reduced dimensions.
Syntax:
tf.mean (x, axis?, keepDims?)
Parameters: This function accepts three parameters which are illustrated below:
x: The input tensor for which mean value is being computed.
axis: The specified dimension(s) to reduce. By default it reduces all dimensions. It is optional parameter.
keepDims: If this parameter value is true, it retains reduced dimensions with length 1 else the rank of Tensor is reduced by 1. It is also optional parameter.
Return Value: It returns a Tensor of mean value.
Example 1:
Javascript
// Importing the tensorflow.js libraryimport * as tf from "@tensorflow/tfjs"  // Initializing a some tensors const a = tf.tensor1d([0, 1]);const b = tf.tensor1d([3, 5]);const c = tf.tensor1d([2, 4, 7]);  // Calling the .mean() function over // the above tensorsa.mean().print();b.mean().print();c.mean().print();
Output:
Tensor
   0.5
Tensor
   4
Tensor
   4.333333492279053
Example 2:
Javascript
// Importing the tensorflow.js libraryimport * as tf from "@tensorflow/tfjs"  // Initializing a some tensors const a = tf.tensor1d([0, 1]);const b = tf.tensor2d([3, 5, 2, 8], [2, 2]);const c = tf.tensor1d([2, 4, 7]);  // Initializing a axis parametersconst axis1 = -1;const axis2 = -2;const axis3 = 0;  // Calling the .mean() function over // the above tensorsa.mean(axis1).print();b.mean(axis2, true).print();c.mean(axis1, false).print();b.mean(axis3, false).print();
Output:
Tensor
   0.5
Tensor
    [[2.5, 6.5],]
Tensor
   4.333333492279053
Tensor
   [2.5, 6.5]
Reference:https://js.tensorflow.org/api/latest/#mean
Tensorflow
Tensorflow.js
JavaScript
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Remove elements from a JavaScript Array
Difference between var, let and const keywords in JavaScript
Difference Between PUT and PATCH Request
JavaScript | Promises
How to get character array from string in JavaScript?
Remove elements from a JavaScript Array
Installation of Node.js on Linux
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?
Difference between var, let and const keywords in JavaScript
Environment.NewLine in C#

The Enviornment.NewLine in C# is used to add newline.
To set a new line in between words −
str = "This is demo text!" + Environment.NewLine + "This is demo text on next line!";
The following is the code −
 Live Demo
using System;
using System.IO;
namespace Demo {
   class Program {
      static void Main(string[] args) {
         string str = "This is demo text!" + Environment.NewLine + "This is demo text on next line!";
         Console.Write(str);
      }
   }
}
This is demo text!
This is demo text on next line!
Math floorDiv() method in Java

20 Jun, 2018
The java.lang.Math.floorDiv() is a built-in math function in java which returns the largest (closest to positive infinity) int value that is less than or equal to the algebraic quotient. As floorDiv() is static, so object creation is not required.
Syntax:
public static int floorDiv(data_type x, data_type y)
Parameter: The function accepts two parameters as described below.
x: The first parameter refers to the dividend value.
y: The second parameter refers to the divisor value.
The parameters can be data-type int or long.
Exception:
ArithmeticException: It throws ArithmeticException if the divisor is zero.
Return Value: This method returns the largest (closest to positive infinity) integer value that is less than or equal to the algebraic quotient.
Below programs illustrate the java.lang.Math.floorDiv() method:
Program 1:
// Java program to demonstrate working// of java.lang.Math.floorDiv() methodimport java.lang.Math;  class Gfg1{          // driver code    public static void main(String args[])    {        int a = 25, b = 5;        System.out.println(Math.floorDiv(a, b));          // 125/50 value is 2.5, but as output is integer        // less than or equal to 2.5, So output is 2        int c = 125, d = 50;        System.out.println(Math.floorDiv(c, d));    }}
5
2

Program 2:
// Java program to demonstrate working// of java.lang.Math.floorDiv() methodimport java.lang.Math;  class Gfg2 {      // driver code    public static void main(String args[])    {        int x = 200;        int y = 0;          System.out.println(Math.floorDiv(x, y));    }}
Output:
Runtime Error :
Exception in thread "main" java.lang.ArithmeticException: / by zero
    at java.lang.Math.floorDiv(Math.java:1052)
    at Gfg2.main(File.java:13)

Java-Functions
java-math
Java
Mathematical
Mathematical
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Groovy - toUpperCase()

Converts all of the characters in this String to upper case.
String toUpperCase()

None
The modified string in upper case.
Following is an example of the usage of this method −
class Example { 
   static void main(String[] args) { 
      String a = "HelloWorld"; 
      println(a.toUpperCase()); 
   } 
}
When we run the above program, we will get the following result −
How to add Input Slider in React.js ?

28 Dec, 2021
In this article, we are going to learn how we can add input sider in ReactJs. React is a free and open-source front-end JavaScript library for building user interfaces or UI components. It is maintained by Facebook and a community of individual developers and companies.
Approach: To add our slider input we are going to use the react-input-slider package. The react-input-slider package helps us to integrate the slider input in our app. So first, we will install the react-input-slider package and then we will add a slider input on our homepage.
Create ReactJs Application: You can create a new ReactJs project using the below command:
npx create-react-app gfg
Install the required package: Now we will install the react-input-slider package using the below command:
npm i react-input-slider
Project Structure: It will look like this.
Adding the Slider Input: After installing the package we can easily add a slider input on any page in our app. For this example, we are going to add a slider input to our homepage.
Add the below content in the App.js file:
Javascript
import React, { useState } from 'react';import Slider from 'react-input-slider';  export default function GfgInput() {  const [state, setState] = useState({ x: 15, y: 15 });  return (    <div>      <h2>GeeksforGeeks ReactJs - Slider Input</h2>      <div>        ({state.x}, {state.y})        <Slider axis="xy" x={state.x} y={state.y} onChange={setState} />        <Slider          axis="x"          x={state.x}          onChange={({ x }) => setState(state => ({ ...state, x }))}        />        <Slider axis="y" y={state.y} onChange=            {({ y }) => setState(state => ({ ...state, y }))} />      </div>    </div>  );}
Explanation: In the above example first, we are importing the Slider component and useState hook from react. Then we are using the useState hook to store the value of the input. After that, we are adding our slider input using the installed package.
Steps to run the application: Run the below command in the terminal to run the app.
npm start
React-Questions
JavaScript
ReactJS
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Make Entire Custom Checkbox/Div Clickable ?

29 Jun, 2021
It is always a good option to use custom checkboxes in your websites instead of old-school HTML checkboxes.
This article provides a step-by-step implementation for the same.
Approach: 
Use the input type checkbox and link a label with it in HTML.
Hide the input checkbox and style the label as per your requirement.
Change the styling as the checkbox state changes.
HTML code:
HTML
<!DOCTYPE html><html>  <head>       <style>        label {          display:block;          border:solid 2px green;          width: 200px;          height:40px;          margin-top:10px;          color:green;          text-align:center;          line-height: 40px;       }              <!-- hide input -->       input[type=checkbox] {          display: none;       }              <!-- Add ✓ on checked before label -->       input:checked + label:before {          content: "✓ ";       }              <!--Add styling on check -->       input:checked + label {          border: solid 2px purple;          color: purple;       }      </style>  </head>  <body>    <input id="apple" type="checkbox" name="apple" />    <label for="apple">Apple</label>  </body></html>
Output: 
Result
Supported Browser: 
Google Chrome
Internet Explorer
Firefox
Opera
Safari
ysachin2314
CSS-Basics
CSS-Properties
Picked
CSS
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Design a Tribute Page using HTML & CSS
How to set space between the flexbox ?
Build a Survey Form using HTML and CSS
Design a webpage for online food delivery system using HTML and CSS
Form validation using jQuery
REST API (Introduction)
Hide or show elements in HTML using display property
How to set the default value for an HTML <select> element ?
How to set input type date in dd-mm-yyyy format using HTML ?
Design a Tribute Page using HTML & CSS
How to remove indentation from an unordered list item using CSS?

22 Apr, 2019
While designing web pages we used to add some list of items sometimes they are numbered (in various style) and sometimes they are bulleted (in various style). It might happen when we are trying to design a navigation bar or any kind list in which items are neither numbered nor bulleted we don’t need numbers or bullets and also no margin. To remove that indentation from an unordered list (a list having bullets) there needs styling to be done using CSS. The style will be implemented only on the list. So the selector would be ul.
Syntax:
ul {
    // CSS Property
}
Example: This example creates a page with a list with zero(0) indent .
<!DOCTYPE html><html>  <head>    <title>        Remove indentation from an         unordered list of items    </title>          <!-- CSS style to remove indentation    from list of items -->    <style>        ul {            list-style:none;            padding-left:0;        }    </style></head>  <body>    <h3>Computer science subjects:</h3>    <ul>        <li>Data Structure</li>        <li>Algorithms</li>        <li>Operating System</li>        <li>Computer Network</li>        <li>DBMS</li>        <li>Web Technology</li>    </ul></body>  </html>                    
Output:
In the above example, padding-left property is used to set the indentation from left. The padding-left:0 is used to remove indentation (space) from left. The list-style: none property is used to remove list-style property from the list of items.
CSS-Misc
Picked
CSS
Web Technologies
Web technologies Questions
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Types of CSS (Cascading Style Sheet)
Design a Tribute Page using HTML & CSS
How to set space between the flexbox ?
How to position a div at the bottom of its container using CSS?
How to Upload Image into Database and Display it using PHP ?
Installation of Node.js on Linux
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
Perl | Useful Array functions

04 Aug, 2021
In Perl, array is a special type of variable. The array is used to store the list of values and each object of the list is termed as an element. Elements can either be a number, string, or any type of scalar data including another variable. Array in Perl provides various inbuilt functions to perform operations like adding and removing elements from a pre-defined array.Example:  
Perl
#!/usr/bin/perl   # Initializing the array@x = ('Java', 'C', 'C++');   # Print the Initial arrayprint "Original array: @x \n"; # Using push() function# Pushing multiple values in the arraypush(@x, 'Python', 'Perl');print("Pushing new values...\n");   # Printing the arrayprint "Updated array: @x\n"; # Using pop() functionprint("\nPopping the last element...\n"); # Prints the value returned by popprint "Value returned by pop: ", pop(@x);   # Prints the array after pop operationprint "\nUpdated array: @x";
Original array: Java C C++ 
Pushing new values...
Updated array: Java C C++ Python Perl

Popping the last element...
Value returned by pop: Perl
Updated array: Java C C++ Python
 
 Some useful array functions are listed below:
 
 
gabaa406
Perl-Array-Functions
Perl-Arrays
Perl-function
Perl
Perl
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Perl | Arrays
Perl Tutorial - Learn Perl With Examples
Perl | Boolean Values
Perl | length() Function
Perl | Subroutines or Functions
Use of print() and say() in Perl
Hello World Program in Perl
Perl | ne operator
Perl | Basic Syntax of a Perl Program
Perl | eq operator
Compare two tables and return missing ids using MySQL LEFT OUTER JOIN

To compare two tables and return missing ids, you need to use MySQL LEFT OUTER JOIN.
Let us create a table with sample fields and then we will insert records. The query to create the first table −
mysql> create table First_Table
   -> (
   -> Id int
   -> );
Query OK, 0 rows affected (0.88 sec)
Now insert some records in the table using insert command. The query is as follows −
mysql> insert into First_Table values(1);
Query OK, 1 row affected (0.68 sec)
mysql> insert into First_Table values(2);
Query OK, 1 row affected (0.29 sec)
mysql> insert into First_Table values(3);
Query OK, 1 row affected (0.20 sec)
mysql> insert into First_Table values(4);
Query OK, 1 row affected (0.20 sec)
Display all records from the table using select statement. The query is as follows −
mysql> select *from First_Table;
The following is the output −
+------+
| Id   |
+------+
|    1 |
|    2 |
|    3 |
|    4 |
+------+
4 rows in set (0.00 sec)
Here is the query to create the second table −
mysql> create table Second_Table
   -> (
   -> Id int
   -> );
Query OK, 0 rows affected (0.60 sec)
Now you can insert some records in the table using insert command. The query is as follows −
mysql> insert into Second_Table values(2);
Query OK, 1 row affected (0.19 sec)
mysql> insert into Second_Table values(4);
Query OK, 1 row affected (0.20 sec)
Display all records from the table using select statement −
mysql> select *from Second_Table;
The following is the output −
+------+
| Id   |
+------+
|    2 |
|    4 |
+------+
2 rows in set (0.00 sec)
The query is as follows to compare two tables and return missing IDs using LEFT OUTER JOIN −
mysql> SELECT First_Table.Id FROM First_Table
   -> LEFT OUTER JOIN Second_Table ON First_Table.Id = Second_Table.Id
   -> WHERE Second_Table.Id IS NULL;
The following is the output −
+------+
| Id   |
+------+
| 1    |
| 3    |
+------+
2 rows in set (0.00 sec)
Parsing XML with DOM APIs in Python

The Document Object Model ("DOM") is a cross-language API from the World Wide Web Consortium (W3C) for accessing and modifying XML documents.
The DOM is extremely useful for random-access applications. SAX only allows you a view of one bit of the document at a time. If you are looking at one SAX element, you have no access to another.
Here is the easiest way to quickly load an XML document and to create a minidom object using the xml.dom module. The minidom object provides a simple parser method that quickly creates a DOM tree from the XML file.
The sample phrase calls the parse( file [,parser] ) function of the minidom object to parse the XML file designated by file into a DOM tree object.
#!/usr/bin/python
from xml.dom.minidom import parse
import xml.dom.minidom
# Open XML document using minidom parser
DOMTree = xml.dom.minidom.parse("movies.xml")
collection = DOMTree.documentElement
if collection.hasAttribute("shelf"):
   print "Root element : %s" % collection.getAttribute("shelf")
# Get all the movies in the collection
movies = collection.getElementsByTagName("movie")
# Print detail of each movie.
for movie in movies:
print "*****Movie*****"
   if movie.hasAttribute("title"):
      print "Title: %s" % movie.getAttribute("title")
   type = movie.getElementsByTagName('type')[0]
   print "Type: %s" % type.childNodes[0].data
   format = movie.getElementsByTagName('format')[0]
   print "Format: %s" % format.childNodes[0].data
   rating = movie.getElementsByTagName('rating')[0]
   print "Rating: %s" % rating.childNodes[0].data
   description = movie.getElementsByTagName('description')[0]
   print "Description: %s" % description.childNodes[0].data
This would produce the following result −
Root element : New Arrivals
*****Movie*****
Title: Enemy Behind
Type: War, Thriller
Format: DVD
Rating: PG
Description: Talk about a US-Japan war
*****Movie*****
Title: Transformers
Type: Anime, Science Fiction
Format: DVD
Rating: R
Description: A schientific fiction
*****Movie*****
Title: Trigun
Type: Anime, Action
Format: DVD
Rating: PG
Description: Vash the Stampede!
*****Movie*****
Title: Ishtar
Type: Comedy
Format: VHS
Rating: PG
Description: Viewable boredom
For a complete detail on DOM API documentation, please refer to standard Python APIs.
How to use Lambda Function in Python?

These are basically anonymous one-line functions created at runtime which are not bound to the name of the functions.
They return the definition of the function on the fly.
Lambda functions don't contain a return statement, they always return an expression.
You can always put a lambda definition anywhere a function is expected.
Suppose we have a function which is to be used only once and called from only one place, then we can use lambda functions.
So you don't need to give it a name and you can define the functionality there itself. Hence, we eliminate the use of a function and use Lambda expression.
lambda argument: manipulate(argument)
The given code defines a lambda function that gives the following output
add = lambda x, y: x + y
print(add(4, 6))
10
Framework7 - Tap Hold Event

The Tap hold event is used to trigger (enable) after a sustained and complete the touch event so only, it is called tap hold event. The Tab Hold is a built-in Fast Clicks library.
The following parameters are used to disable or enable and configured by default −
tapHold
To enable tap hold events when it is set to true.
tapHoldDelay
It specifies the duration of holding the tap before triggering taphold event on the target element.
tapHoldPreventClicks
The tap hold event will not be fired after clicking the event.
The following code is used for enable tap hold events −
var myApp = new Framework7 ({
   tapHold: true //enable tap hold events
});
 
var $$ = Dom7;
 
$$('.some-link').on('taphold', function () {
   myApp.alert('Tap hold fired!');
});

    7 Lectures 
     1 hours 

 Anadi Sharma

    22 Lectures 
     6 hours 

 Malhar Lathkar

    102 Lectures 
     8 hours 

 Karthikeya T

    19 Lectures 
     5 hours 

 Trevoir Williams

    20 Lectures 
     1 hours 

 John Elder

    13 Lectures 
     3 hours 

 Darwish
 Print
 Add Notes
 Bookmark this page
Angular FormsModule Directive - GeeksforGeeks

04 Jun, 2021
In this article, we are going to see what is FormsModule in Angular 10 and how to use it.
The FormsModule is used to make all the necessary imports for form implementation.
Syntax:
import { FormsModule } from '@angular/forms';
Approach: 
Create an Angular app to be used.
In app.component.ts import forms from FormsModules.
In app.component.html, make a form using FormsModule.
Serve the angular app using ng serve to see the output.
 
Example 1:
app.component.ts
import { NgModule } from '@angular/core';  // Importing forms moduleimport { FormsModule } from '@angular/forms';import { BrowserModule } from '@angular/platform-browser';import { BrowserAnimationsModule } from     '@angular/platform-browser/animations';   import { AppComponent }   from './app.component';   @NgModule({  bootstrap: [    AppComponent  ],  declarations: [    AppComponent  ],  imports: [    FormsModule,    BrowserModule,    BrowserAnimationsModule,  ]})export class AppModule { }
app.component.html
<form #gfgform = "ngForm">  {{ gfgform.value | json }}  <br>  <br>  Name: <input type="text" name = 'name' ngModel>  Roll: <input type="text" name = 'roll' ngModel></form>
Output:
Reference: https://angular.io/api/forms/FormsModule
Angular10
AngularJS-Directives
AngularJS
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Top 10 Angular Libraries For Web Developers
How to use <mat-chip-list> and <mat-chip> in Angular Material ?
How to make a Bootstrap Modal Popup in Angular 9/8 ?
Angular PrimeNG Dropdown Component
Angular 10 (blur) Event
Installation of Node.js on Linux
Roadmap to Become a Web Developer in 2022
How to fetch data from an API in ReactJS ?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to insert spaces/tabs in text using HTML/CSS?
JavaScript Date setTime() Function - GeeksforGeeks

04 Mar, 2021
The setTime() Function is a BuiltIn Function in Javascript Which is used to get a date object by adding given milliseconds to date 01/01/1970
Syntax:
date.setTime(milliseconds)
Parameters: setTime() Function takes parameters as follows.
milliseconds : Number of milliseconds to add to given date
Return Value: The setTime() Function returns milliseconds that you passed in parameter.
Example 1: Adding 30000 milliseconds to 01/01/1970
Javascript
<!DOCTYPE html><html lang="en"><body>    <script>        // Initialization        let date = new Date();          // Execution        let output = date.setTime(30000);          // Display Output        console.log(`setTime() Output:`, output, date);    </script></body></html>
Output:
Example 2: Adding 2000 milliseconds to 01/01/1970
Javascript
<!DOCTYPE html><html lang="en"><body>    <script>        // Initialization        let date = new Date('6-29-2000 03:15:10:50');          // Execution        let output = date.setTime(2000);          // Display Output        console.log(`setTime() Output:`, output, date);    </script></body></html>
Output:
javascript-date
javascript-functions
JavaScript
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 ?
Top 10 Front End Developer Skills That You Need in 2022
Installation of Node.js on Linux
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?
Converting any case to camelCase in JavaScript

We are required to write a JavaScript function that takes in a string, str, which can be any case
(normal, snake case, pascal case or any other).
Our function should convert this string into camelCase string.
For example, if the input to the function is −
Input
const str = 'New STRING';
Output
const output = 'newString';
Following is the code −
 Live Demo
const str = 'New STRING';
const toCamelCase = (str = '') => {
   return str
      .replace(/[^a-z0-9]/gi, ' ')
      .toLowerCase()
      .split(' ')
      .map((el, ind) => ind === 0 ? el : el[0].toUpperCase() + el.substring(1, el.length))
      .join('');
};
console.log(toCamelCase(str));
newString
How to plot multiple graphs in Matplotlib?

To plot multiple graphs in matplotlib, we will use the following steps −
Create x, y1 and y2 data points using numpy.
Create x, y1 and y2 data points using numpy.
Add a subplot to the current figure at index 1.
Add a subplot to the current figure at index 1.
Plot curve 1 using x and y1.
Plot curve 1 using x and y1.
Add a subplot to the current figure at index 2.
Add a subplot to the current figure at index 2.
Plot curve 2 using x and y2.
Plot curve 2 using x and y2.
To display the figure, use show() method.
To display the figure, use show() method.
import numpy as np
from matplotlib import pyplot as plt
plt.rcParams["figure.figsize"] = [7.50, 3.50]
plt.rcParams["figure.autolayout"] = True
x = np.linspace(-2, 2, 10)
y1 = np.sin(x)
y2 = np.cos(x)
plt.subplot(211)
plt.plot(y1)
plt.subplot(212)
plt.plot(y2)
plt.show()
Python Program to Replace all Occurrences of ‘a’ with $ in a String

04 Dec, 2020
Given a string, the task is to write a Python program to replace all occurrence of ‘a’ with $.
Examples:
Input: Ali has all aces
Output: $li h$s $ll $ces

Input: All Exams are over
Output: $ll Ex$ms $re Over
The first approach uses splitting of the given specified string into a set of characters. An empty string variable is used to store modified string . We loop over the character array and check if the character at this index is equivalent to ‘a’ , and then append ‘$’ sign, in case the condition is satisfied. Otherwise, the original character is copied into the new string.  
Python3
# declaring a string variablestr = "Amdani athani kharcha rupaiya."  # declaring an empty string variable for storing modified stringmodified_str = ''  # iterating over the stringfor char in range(0, len(str)):    # checking if the character at char index is equivalent to 'a'    if(str[char] == 'a'):        # append $ to modified string        modified_str += '$'    else:        # append original string character        modified_str += str[char]  print("Modified string : ")print(modified_str)
Output:
Modified string :
$md$ni $th$ni kh$rch$ rup$iy$.
The second approach uses the inbuilt method replace() to replace all the occurrences of a particular character in the string with the new specified character. The method has the following syntax : 
replace( oldchar , newchar)
This method doesn’t change the original string, and the result has to be explicitly stored in the String variable. 
Python3
# declaring a string variablestr = "An apple A day keeps doctor Away."  # replacing character a with $ signstr = str.replace('a', '$')print("Modified string : ")print(str)
Output:
Modified string :
$n $pple $ d$y keeps doctor $w$y.
Python string-programs
Python
Python Programs
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
Defaultdict in Python
Python | Get dictionary keys as a list
Python | Convert a list to dictionary
Python | Convert string dictionary to dictionary
Python Program for Fibonacci numbers
Difference between Nested Loop Join and Hash Join

29 Jul, 2020
1. Nested Loop Join :This is a type of physical join algorithm that is used in case of joining 2 relations. This join is an internal join technique, meaning that we cannot see the join. This is the simplest of all types of joins. This is the best-suited algorithm for small data and smaller transactions. In the case of 2 relations named R and S, the algorithm for the Nested Loop join would be as follows :
For each record x of R read in, do
Use the index on B for S
Get all the matching records (having B=x.A)
End
2. Hash Join :Hash Join is also a type of physical join algorithm that is used in case of joining two tables internally. The join being an internal join technique means that we cannot see the join. The join selection is done automatically by the query optimizer. The hash join is performed using two steps, the build, and probe. In the case of 2 relations named R and S, the algorithm for Hash join would be as follows :
Hash records of R, one by one, using A values
(Use the same M buckets and same hash function h)
Hash matching pair of records into the same bucket
End
Difference between Nested Loop Join and Hash Join :
DBMS
Difference Between
DBMS
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
CTE in SQL
Difference between Clustered and Non-clustered index
Introduction of DBMS (Database Management System) | Set 1
SQL Trigger | Student Database
Introduction of B-Tree
Class method vs Static method in Python
Difference between BFS and DFS
Difference between var, let and const keywords in JavaScript
Difference Between Method Overloading and Method Overriding in Java
Differences between JDK, JRE and JVM
Write a C program that does not terminate when Ctrl+C is pressed

21 Jun, 2022
Write a C program that doesn’t terminate when Ctrl+C is pressed. It prints a message “Cannot be terminated using Ctrl+c” and continues execution. We can use signal handling in C for this. When Ctrl+C is pressed, SIGINT signal is generated, we can catch this signal and run our defined signal handler.  C standard defines following 6 signals in signal.h header file. SIGABRT – abnormal termination. SIGFPE – floating point exception. SIGILL – invalid instruction. SIGINT – interactive attention request sent to the program. SIGSEGV – invalid memory access. SIGTERM – termination request sent to the program. Additional signals are specified Unix and Unix-like operating systems (such as Linux) defines more than 15 additional signals. See http://en.wikipedia.org/wiki/Unix_signal#POSIX_signals The standard C library function signal() can be used to set up a handler for any of the above signals. 
C
/* A C program that does not terminate when Ctrl+C is pressed */#include <stdio.h>#include <signal.h> /* Signal Handler for SIGINT */void sigintHandler(int sig_num){    /* Reset handler to catch SIGINT next time.    Refer http://en.cppreference.com/w/c/program/signal */    signal(SIGINT, sigintHandler);    printf("\n Cannot be terminated using Ctrl+C \n");    fflush(stdout);} int main (){    /* Set the SIGINT (Ctrl-C) signal handler to sigintHandler    Refer http://en.cppreference.com/w/c/program/signal */    signal(SIGINT, sigintHandler);     /* Infinite loop */    while(1)    {            }    return 0;}
Output: When Ctrl+C was pressed two times
 
 Cannot be terminated using Ctrl+C
 
 Cannot be terminated using Ctrl+C
Time Complexity: O(1)
Auxiliary Space: O(1)
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
nidhi_biet
tarakki100
cpp-puzzle
system-programming
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++