code-rag-bench/online-tutorials huggingface dataset:
Jackson Annotations - @JsonDeserialize

@JsonDeserialize is used to specify custom deserializer to unmarshall the json object.
import java.io.IOException; 
import java.text.ParseException; 
import java.text.SimpleDateFormat; 
import java.util.Date; 

import com.fasterxml.jackson.core.JsonParser; 
import com.fasterxml.jackson.core.JsonProcessingException; 
import com.fasterxml.jackson.databind.DeserializationContext; 
import com.fasterxml.jackson.databind.ObjectMapper; 
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 
import com.fasterxml.jackson.databind.deser.std.StdDeserializer; 

public class JacksonTester {
   public static void main(String args[]) throws ParseException{ 
      ObjectMapper mapper = new ObjectMapper(); 
      String jsonString = "{\"name\":\"Mark\",\"dateOfBirth\":\"20-12-1984\"}"; 
      try {     
         Student student = mapper
            .readerFor(Student.class) 
            .readValue(jsonString); 
         System.out.println(student.dateOfBirth); 
      } 
      catch (IOException e) { 
         e.printStackTrace(); 
      }   
   }
}
class Student {
   public String name; 
   @JsonDeserialize(using = CustomDateDeserializer.class) 
   public Date dateOfBirth; 
}
class CustomDateDeserializer extends StdDeserializer<Date> {
   private static final long serialVersionUID = 1L;
   private static SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy");
   public CustomDateDeserializer() { 
      this(null); 
   } 
   public CustomDateDeserializer(Class<Date> t) { 
      super(t); 
   } 
   @Override 
   public Date deserialize(JsonParser parser, DeserializationContext context) 
      throws IOException, JsonProcessingException { 
      
      String date = parser.getText(); 
      try { 
         return formatter.parse(date); 
      } 
      catch (ParseException e) { 
         e.printStackTrace(); 
      }    
      return null; 
   }   
}
Thu Dec 20 00:00:00 IST 1984 

 Print
 Add Notes
 Bookmark this page
Print the string after the specified character has occurred given no. of times in C Program

Task is to print the given after the specified character occurrence for given number of times which is specified by the user
Input : string = {“I am harsh vaid “}
   Char =’a’
   Count =2
Output : rsh vaid
It means user specified character ‘a’ and its occurrence 2 so the output string should be displayed after two occurrences of a.
START
Step 1 -> input character in ch(e.g. ‘a’) and count(e.g. 2) as int
Step 2 -> declare and initialize n with size of a string by sizeof(string)/sizeof(string[0])
Step 3 - > Loop For i to 0 and i<n and i++
   IF count > 0
      IF string[i]==ch
         Count=count-1
      End IF
      Continue
   End IF
   Else
      Print string[i]
   End Else
Step 4 -> End For
STOP
#include <stdio.h>
int main(int argc, char const *argv[]) {
   char string[] = {"I am Harsh Vaid"};
   char ch = 'a';
   int i, count = 2;
   int n = sizeof(string)/sizeof(string[0]);
   for( i = 0; i < n; i++ ) {
      if(count>0) {
         if(string[i]==ch) {
            count--;
         }
         continue;
      }
      else
      printf("%c", string[i]);
   }
   return 0;
}
If we run above program then it will generate following output
rsh Vaid
How to take MySQL database backup using MySQL Workbench?

To make MySQL database backup using MySQL, first we need to install MySQL Workbench. Follow the below link to install MySQL workbench.
https://dev.mysql.com/downloads/windows/installer/8.0.html
After installing successfully, we need to open MySQL Workbench. Choose the option “Data Export”. Here is the snapshot.
Select the database you want to export. You can also set the path here where you want to save the database.
After successful completion, you can see the following screenshot.
You have successfully created a backup of the above database. The following message is now visible.
Export of E:\BackupDatabase has finished
How to create an exponential curve in R?

To create an exponential curve, we can use exp function inside the plot function for the variable that we want to plot. For example, if we have a vector x then the exponential curve for the vector x can be created by using plot(x,exp(x)). We can use the exponential function for the variable that is appropriate based on the objective of the analysis, here we have shown only an example of how it works.
Live Demo
> x<-rpois(1000,5)
> plot(x,exp(x))
Live Demo
> y<-runif(50,2,8)
> plot(y,exp(y))
VBA - Exit Do

An Exit Do Statement is used when we want to exit the Do Loops based on certain criteria. It can be used within both Do...While and Do...Until Loops.
When Exit Do is executed, the control jumps to the next statement immediately after the Do Loop.
Following is the syntax for Exit Do Statement in VBA.
 Exit Do

The following example uses Exit Do. If the value of the Counter reaches 10, the Do Loop is exited and the control jumps to the next statement immediately after the For Loop.
Private Sub Constant_demo_Click()
   i = 0
   Do While i <= 100
      If i > 10 Then
         Exit Do   ' Loop Exits if i>10
      End If
      MsgBox ("The Value of i is : " & i)
      i = i + 2
   Loop
End Sub
When the above code is executed, it prints the following output in a message box.
The Value of i is : 0

The Value of i is : 2

The Value of i is : 4

The Value of i is : 6

The Value of i is : 8

The Value of i is : 10


    101 Lectures 
     6 hours 

 Pavan Lalwani

    41 Lectures 
     3 hours 

 Arnold Higuit

    80 Lectures 
     5.5 hours 

 Prashant Panchal

    25 Lectures 
     2 hours 

 Prashant Panchal

    26 Lectures 
     2 hours 

 Arnold Higuit

    92 Lectures 
     10.5 hours 

 Vijay Kumar Parvatha Reddy
 Print
 Add Notes
 Bookmark this page
How to change an element color based on value of the color picker value using onclick? - GeeksforGeeks

20 Sep, 2019
We can define color picker by input type=”color”. It provides a user interface element that lets a user specify a color, either by using a visual color picker interface or by entering the color into a text field in #rrggbb hexadecimal format. Only the colors without alpha channel are allowed. Though CSS colors have more formats, e.g. color names, functional notations and a hexadecimal format with an alpha channel.
Approach:
To change the color of our element based on the value of color picker we have to use onclick() event of the element and change its CSS color property as per the selected value in color picker element.
This value appears as color picker’s value attribute. using javascript, we will change the color of our element as the chosen value in color picker.
Syntax:
HTML: < div id="elementId" onclick="fn_name()"></div>
      < input name="ColorPickerId" type="color" id="ColorPickerName" />
 < div id="elementId" onclick="fn_name()"></div>
      < input name="ColorPickerId" type="color" id="ColorPickerName" />
JavaScript:document.getElementById("elementID").style.Color = 
      document.getElementById("ColorPickerId").value;
document.getElementById("elementID").style.Color = 
      document.getElementById("ColorPickerId").value;
Example 1:
<html>  <head>    <style>        #Myelement {            background-color: black;            width: 500px;            height: 100px;        }    </style></head>  <body>    <div id="Myelement"          onclick="changeColor()">  </div>    <input name="MyColorPicker"           type="color"           id="MyColorPicker" />    <script>        function changeColor() {            document.getElementById(              "Myelement").style.backgroundColor =                document.getElementById(              "MyColorPicker").value;        }    </script></body>  </html>
Output:Before:After picking the color:After clicking the div:
Example 2:
<html>  <head></head>  <body>    <h1 id="Myelement"        onclick="changeColor()">        GeeksforGeeks    </h1>    <input name="MyColorPicker"            type="color"           id="ColorPicker1" />    <script>        function changeColor() {            document.getElementById("Myelement").style.color =                document.getElementById("ColorPicker1").value;        }    </script></body>  </html>
Output:Before:After picking the color:After clicking the div:
JavaScript-Misc
JavaScript
Web Technologies
Web technologies Questions
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
Convert a string to an integer in JavaScript
Differences between Functional Components and Class Components in React
Difference Between PUT and PATCH Request
How to Use the JavaScript Fetch API to Get Data?
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?
Access Modifiers in Scala - GeeksforGeeks

26 Feb, 2019
Access Modifiers in scala are used to define the access field of members of packages, classes or objects in scala.For using an access modifier, you must include its keyword in the definition of members of package, class or object.These modifiers will restrict accesses to the members to specific regions of code.There are Three types of access modifiers available in Scala:
PrivateProtectedPublic
Private
Protected
Public
Table:
What is companion in above table? It is a singleton object named same as the class.
1. Private: When a member is declared as private, we can only use it inside defining class or through one of its objects.
Example:
// Scala program of private access modifierclass abc{     private var a:Int = 123    def display()    {        a = 8        println(a)    }}  object access extends App{    // class abc is accessible     // because this is in the same enclosing scope    var e = new abc()    e.display()}
Output:
8
Here we declared a variable ‘a’ private and now it can be accessed only inside it’s defining class or through classes object.
2. Protected: They can be only accessible from sub classes of the base class in which the member has been defined.
Example:
// Scala program of protected access modifier  class gfg{     // declaration of protected member    protected var a:Int = 123    def display()    {        a = 8        println(a)    }}  // class new1 extends by class gfgclass new1 extends gfg{    def display1()    {        a = 9        println(a)    }}  object access extends App{    // class abc is accessible because this    // is in the same enclosing scope    var e = new gfg()    e.display()    var e1 = new new1()     e1.display1()          }
Output:
8
9
When we extended abc in class new1, protected variable a is now available to be modified cause new1 is a subclass of class abc.
3. Public: There is no public keyword in Scala. The default access level (when no modifier is specified) corresponds to Java’s public access level.We can access these anywhere.
// Scala program of protected access modifier  class gfg{    var a:Int = 123}object access extends App{    var e = new gfg()    e.a = 444        println(e.a)}
Output:
444
Scala
Scala-OOPS
Scala
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Scala Lists
Scala Tutorial – Learn Scala with Step By Step Guide
Scala Map
Throw Keyword in Scala
Lambda Expression in Scala
Scala | Option
How to get the first element of List in Scala
Scala List mkString() method with a separator with example
Scala | Case Class and Case Object
How to install Scala on Windows?
compress command in Linux with examples - GeeksforGeeks

15 May, 2019
compress command is used to reduce the file size. After compression, the file will be available with an added .Z extension. File permissions will still remain the same as before using compress command. This command uses the adaptive Lempel-Ziv coding and it ignores the symbolic links. And also this command is part of ncompress package, which contains utilities for fast compression and decompression.
Note: If no files are specified then the standard input is compressed to the standard output.
Syntax:
compress [OPTION]... [FILE]...

Options:
-v Option: It is used to print the percentage reduction of each file. This option is ignored if the -c option is also used. Compress example.xls and rename that file to example.xls.Z with a percentage reduction of 70.41%.compress -v example.xls

compress -v example.xls

-c Option: Compressed or uncompressed output is written to the standard output. No files are modified. The -v option is ignored. Compression is attempted even if the results will be larger than the original.Example:compress -c example.xls > new.Z

Example:
compress -c example.xls > new.Z

-r Option: This will compress all the files in the given directory and sub-directories recursively. It is helpful to combine the -r option with -v to see exactly what the command is doing.Example:compress -rv abc
This will compress all the files within abc.
Example:
compress -rv abc

This will compress all the files within abc.
-f Option: This will compress files without any guarantee of size reduction, meaning it will compress files even if the file size is not reduced.compress -f asc.txt
This will convert asc.txt into asc.txt.Z but size reduction is not assured.
compress -f asc.txt

This will convert asc.txt into asc.txt.Z but size reduction is not assured.
linux-command
Linux-file-commands
Picked
Technical Scripter 2018
Linux-Unix
Technical Scripter
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
scp command in Linux with Examples
mv command in Linux with examples
chown command in Linux with Examples
Docker - COPY Instruction
nohup Command in Linux with Examples
SED command in Linux | Set 2
Named Pipe or FIFO with example C program
uniq Command in LINUX with examples
Thread functions in C/C++
Array Basics in Shell Scripting | Set 1
Morphological operations in MATLAB - GeeksforGeeks

17 Aug, 2020
Morphological Operations is a broad set of image processing operations that process digital images based on their shapes. In a morphological operation, each image pixel is corresponding to the value of other pixel in its neighborhood. By choosing the shape and size of the neighborhood pixel, you can construct a morphological operation that is sensitive to specific shapes in the input image. Morphological operations apply a structuring element called strel in Matlab, to an input image, creating an output image of the same size. 
Types of Morphological operations:  
Dilation: Dilation adds pixels on the object boundaries.
Erosion: Erosion removes pixels on object boundaries.
Open: The opening operation erodes an image and then dilates the eroded image, using the same structuring element for both operations.
Close: The closing operation dilates an image and then erodes the dilated image, using the same structuring element for both operations.
The number of pixels added or removed from the object in an image depends on the shape and size of the structuring element used to process the image. In the morphological dilation and erosion operations, the state of any given pixel in the output image is determined by applying a rule to the corresponding pixel and its neighbors in the input image. The rule used to process the pixels defines the morphological operation as a dilation or an erosion. 
Below is the Matlab code for Morphological operations: 
# Importing the imageI = imread("flowers.jpg"); subplot(2, 3, 1),  imshow(I); title("Original image");   % Dilated Image se = strel("line", 7, 7); dilate = imdilate(I, se); subplot(2, 3, 2),  imshow(dilate); title("Dilated image");   % Eroded image erode = imerode(I, se); subplot(2, 3, 3),  imshow(erode); title("Eroded image");   % Opened image open = imopen(I, se); subplot(2, 3, 4),  imshow(open); title("Opened image");   % Closed image close = imclose(I, se); subplot(2, 3, 5),  imshow(close); title("Closed image"); 
Image-Processing
MATLAB
Advanced Computer Subject
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Copying Files to and from Docker Containers
Principal Component Analysis with Python
OpenCV - Overview
Fuzzy Logic | Introduction
Classifying data using Support Vector Machines(SVMs) in Python
Mounting a Volume Inside Docker Container
Getting Started with System Design
How to create a REST API using Java Spring Boot
Basics of API Testing Using Postman
Q-Learning in Python
What is the maximum length of a table name in MySQL?

The maximum length of a table name is 64 characters long according to MySQl version 8.0.12.
Check your installed MySQL version.
mysql> select version();
The following is the output.
+-----------+
| version() |
+-----------+
| 8.0.12    |
+-----------+
1 row in set (0.03 sec)

We can check the maximum length of the table name at the time of creating it. If we give more than 64 characters, then it will not create a table and an error is thrown.
Creating a table which has more than 64 characters of table name.
mysql> create table tableNameDemotableableNameDemotableableNameDemotableableNameDemotable
   -> (
   -> id int
   -> );
ERROR 1059 (42000): Identifier name 'tableNameDemotableableNameDemotableableNameDemotableableNameDemotable' is too long
In the above, we get an error that the identifier name (yourTableName) is too long.
To check if it will work for 64 characters or below −
mysql> create table Demo
   -> (
   -> id int
   -> );
Query OK, 0 rows affected (0.46 sec)
Yes, less than 64 characters for a table name works correctly.
Can Static Functions Be Virtual in C++? - GeeksforGeeks

22 Dec, 2021
In C++, a static member function of a class cannot be virtual. Virtual functions are invoked when you have a pointer or reference to an instance of a class. Static functions aren’t tied to the the instance of a class but they are tied to the class. C++ doesn’t have pointers-to-class, so there is no scenario in which you could invoke a static function virtually.
For example, below program gives compilation error,
CPP
// CPP Program to demonstrate Virtual member functions// cannot be static#include <iostream>  using namespace std;  class Test {public:    virtual static void fun() {}};
Output
prog.cpp:9:29: error: member ‘fun’ cannot be declared both virtual and static
    virtual static void fun() {}
                            ^
Also, static member function cannot be const and volatile. Following code also fails in compilation,
CPP
// CPP Program to demonstrate Static member function cannot// be const#include <iostream>  using namespace std;  class Test {public:    static void fun() const {}};
Output
prog.cpp:8:23: error: static member function ‘static void Test::fun()’ cannot have cv-qualifier
    static void fun() const {}
                      ^
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
anshikajain26
C++-Static Keyword
Static Keyword
C Language
C++
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
rand() and srand() in C/C++
fork() in C
Command line arguments in C/C++
Different methods to reverse a string in C/C++
Function Pointer in C
Vector in C++ STL
Inheritance in C++
Initialize a vector in C++ (6 different ways)
Map in C++ Standard Template Library (STL)
C++ Classes and Objects
Bash shell script to swap two numbers - GeeksforGeeks

05 Jul, 2018
Given two numbers and the task is to swap them using the third variable.
Examples:
Input: first = 2, second = 4
Output: first = 4, second = 2

Input: first = 5, second = 7
Output: first = 7, second = 5

Approach:
Store the value of the first number into a temp variable.Store the value of the second number in the first number.Store the value of temp into the second variable.
Store the value of the first number into a temp variable.
Store the value of the second number in the first number.
Store the value of temp into the second variable.
# !/bin/bash   # Program to swap two numbers   # Static input of the# numberfirst=5second=10   temp=$firstfirst=$secondsecond=$temp  echo "After swapping, numbers are:"echo "first = $first, second = $second"
Output:
After swapping, numbers are:
first = 10, second = 5

How to execute the bash files?
Write the bash code into a file and save that file with .sh extension i.e. filename.shOpen terminal and execute the file using below command:./filename.sh

Write the bash code into a file and save that file with .sh extension i.e. filename.sh
Open terminal and execute the file using below command:./filename.sh

./filename.sh

Shell Script
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
scp command in Linux with Examples
SED command in Linux | Set 2
mv command in Linux with examples
Docker - COPY Instruction
chown command in Linux with Examples
nohup Command in Linux with Examples
Named Pipe or FIFO with example C program
Thread functions in C/C++
uniq Command in LINUX with examples
Array Basics in Shell Scripting | Set 1
p5.js mousePressed() Function - GeeksforGeeks

04 Mar, 2021
The mousePressed() function in p5.js works when mouse clicked on the document. The mouseButton variable is used to specify which button is pressed. The touchStarted() function is used instead of mousePressed() function if mousePressed() function is not defined.
Syntax:
mousePressed(Event)
Below programs illustrate the mousePressed() function in p5.js:
Example 1: This example uses mousePressed() function.
function setup() {          // Create Canvas    createCanvas(500, 500);}   let value = 0;  function draw() {          // Set background color    background(200);          // Fill the color    fill(value, value-50, value-100);          // Create rectangle    rect(25, 25, 460, 440);          // Set the color of text    fill('lightgreen');          // Set font size    textSize(15);          // Display content    text('Keep on Clicking the Mouse Across'        + 'the page \nto change Canvas Color.',            windowHeight/10, windowWidth/4);}  function mousePressed() {          value = value + 5;          if (value > 255) {        value = 0;    }}
Output:
Example 2:
let valueX;let valueY;  function setup() {        // Create Canvas    createCanvas(500, 500);}   function draw() {          // Set background color    background(200);           // Set the text color    fill('green');          // Set text size    textSize(25);          text('Drag mouse to change color', 30, 30);          // Fill color according to mouseMoved()     fill(valueX, 255-valueY, 255-valueX);          // Draw ellipse      ellipse(mouseX, mouseY, 115, 115);}  function mousePressed() {    valueX = mouseX%255;    valueY = mouseY%255;}
Output:
Reference: https://p5js.org/reference/#/p5/mousePressed
JavaScript-p5.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
Convert a string to an integer in JavaScript
Difference between var, let and const keywords in JavaScript
Differences between Functional Components and Class Components in React
How to calculate the number of days between two dates in javascript?
Remove elements from a JavaScript Array
Installation of Node.js on Linux
Convert a string to an integer in JavaScript
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?
Python Program to Convert a list of multiple integers into a single integer

03 Dec, 2020
Given a list of integers, write a Python program to convert the given list into a single integer.
Examples:
Input : [1, 2, 3]
Output : 123

Input : [55, 32, 890]
Output : 5532890
There are multiple approaches possible to convert the given list into a single integer. Let’s see each one by one.
Approach #1 : Naive MethodSimply iterate each element in the list and print them without space in between.
# Python3 program to convert a list# of integers into a single integer  # creating a listlst = [12, 15, 17]  # iterating each elementfor i in lst:    print(i, end="")
Output:
121517
 Approach #2 : Using join()
Use the join() method of Python. First convert the list of integer into a list of strings( as join() works with strings only). Then, simply join them using join() method. It takes a time complexity of O(n).
# Python3 program to convert a list# of integers into a single integerdef convert(list):          # Converting integer list to string list    s = [str(i) for i in list]          # Join list items using join()    res = int("".join(s))          return(res)  # Driver codelist = [1, 2, 3]print(convert(list))
Output:
123
 Approach #3 : Using map()
Another approach to convert a list of multiple integers into a single integer is to use map() function of Python with str function to convert the Integer list to string list. After this, join them on the empty string and then cast back to integer.
# Python3 program to convert a list# of integers into a single integerdef convert(list):          # Converting integer list to string list    # and joining the list using join()    res = int("".join(map(str, list)))          return res  # Driver codelist = [1, 2, 3]print(convert(list))
Output:
123
 Approach #4 : Multiplying by corresponding power of 10
A more mathematical way, which does not require to convert the integer list to string list is, to multiply each integer element with its corresponding power of 10, and then summing it up. It takes a time complexity of O(n).
# Python3 program to convert a list# of integers into a single integerdef convert(list):          # multiply each integer element with its     # corresponding power and perform summation      res = sum(d * 10**i for i, d in enumerate(list[::-1]))          return(res)  # Driver codelist = [1, 2, 3]print(convert(list))
Output:
123
A small variation to this program leads to less computation in calculation of sum, i.e. using reduce(). This makes use of Horner’s rule, which factors the polynomial representing the number to reduce the number of multiplications.
res = functools.reduce(lambda total, d: 10 * total + d, list, 0)
Python list-programs
python-list
Python
python-list
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Scala String replace() method with example

03 Oct, 2019
The replace() method is used to replace the old character of the string with the new one which is stated in the argument.
Method Definition: String replace(char oldChar, char newChar)Return Type: It returns the stated string after replacing the old character with the new one.
Example #1:
// Scala program of replace()// method  // Creating objectobject GfG{      // Main methoddef main(args:Array[String]){  // Applying replace methodval result = "Nidhi".replace('N', 'n')    // Displays outputprintln(result)      }} 
nidhi

Example #2:
// Scala program of replace()// method  // Creating objectobject GfG{      // Main methoddef main(args:Array[String]){  // Applying replace methodval result = "Nidhi".replace('h', '#')    // Displays outputprintln(result)      }} 
Nid#i

Scala
Scala-Method
Scala-Strings
Scala
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to create an empty vector in R ?

21 Apr, 2021
In this article, we are going to see how to create an empty vector in R Programming Language. There are five ways of creating an empty vector and each of them will be discussed in detail below:
Using c()
Using vector()
Creating empty vectors using NULL
Using numeric() method
Using rep() method
Here in this, we need not pass anything while creating an empty vector as we are creating empty vector.
Syntax:
vector name <- c()
Where, vector name can be any valid identifier.
Example :
R
# Here we are creating empty# vector using c().vect <- c()  vect
Output:
NULL
Output is null as we are not passing any data to it.
Here in this, we need not pass anything as we are creating an empty vector:
Syntax:
vector name  <- vector()
Where, vector name can be any valid identifier.
Example
R
# Here we are creating empty vector# using vector().vect <- vector()  vect
Output:
logical(0)
Output is empty as we are not passing any data.
 Here we are creating empty vector by passing null.
Syntax:
 vector name  <- NULL
Where, vector name can be any valid identifier.
Example 
R
# Here we are creating empty # vector using NULLa<- NULL  a
Output:
NULL
Here we are creating empty vector by using numeric().
Syntax:
vector name <- numeric()
Where, vector name can be any valid identifier.
Example
R
# creating empty vector vec using # numeric function.vec <- numeric()  vec
Output:
numeric(0)
Here we can directly use rep() to create empty vector.
Syntax:
vector name<- rep()
where, vector name can be any valid identifier.
Example:
R
# creating empty vector vec using# numeric function.vec <- rep()  vec
Output:
NULL
Picked
R Vector-Programs
R-Vectors
R Language
R Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to add Radio Buttons in form using HTML ?

22 Jul, 2021
We know that Radio Buttons are used to select only one option out of the several options. It is generally used in HTML form. 
Approach: To add a radio buttons in a webpage, the HTML provides a <input> element with type attribute is set to “radio”.  
Syntax:
<input type="radio">  
Example: Below code illustrates that how to add a radio button in the webpage. 
HTML
<!DOCTYPE html><html>  <head>              <style>        body {            text-align: center;        }        h2 {            color: green;                     }    </style></head>  <body>    <h2>        GeeksforGeeks    </h2>      <h3>        How to add a Radio Buttons in form using HTML?    </h3>    <h4>    Select Gender    </h4>          Male    <input type="radio" checked=true name="user_gender">    Female    <input type="radio"  name="user_gender">             </body>  </html>                    
Output:
gender of user
HTML-Questions
HTML-Tags
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
REST API (Introduction)
Design a Tribute Page using HTML & CSS
Build a Survey Form using HTML and CSS
Angular File Upload
Form validation using jQuery
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
Pandas Scatter Plot – DataFrame.plot.scatter()

25 Feb, 2021
A Scatter plot is a type of data visualization technique that shows the relationship between two numerical variables. For plotting to scatter plot using pandas there is DataFrame class and this class has a member called plot. Calling the scatter() method on the plot member draws a plot between two variables or two columns of pandas DataFrame. 
Syntax: DataFrame.plot.scatter(x, y, s = none, c = none)
Parameter:
x: column name to be used as horizontal coordinates for each pointy: column name to be used as vertical coordinates for each points: size of dotsc: color of dots
Import necessary libraries.
Prepare a data
Convert prepared data into DataFrame
Draw a scatter plot
Example 1: In this example, we will plot the scatter plot using dataframe, Here we will create the dataframe and plot the scatter plot using different columns.
Python3
# Program to draw scatter plot using Dataframe.plot# Import librariesimport pandas as pd  # Prepare datadata={'Name':['Dhanashri', 'Smita', 'Rutuja',              'Sunita', 'Poonam', 'Srushti'],      'Age':[20, 18, 27, 50, 12, 15]}  # Load data into DataFramedf = pd.DataFrame(data = data);  # Draw a scatter plotdf.plot.scatter(x = 'Name', y = 'Age', s = 100);
Output:
Example 2: Here we will create the dataframe and plot the scatter plot using different columns with style data points.
Python3
# Program to draw scatter plot using Dataframe.plot# Import librariesimport pandas as pd  # Prepare datadata={'Name':['Dhanashri', 'Smita', 'Rutuja',              'Sunita', 'Poonam', 'Srushti'],      'Age':[ 20, 18, 27, 50, 12, 15]}  # Load data into DataFramedf = pd.DataFrame(data = data);  # Draw a scatter plot and here size of dots determined by age of persondf.plot.scatter(x = 'Name', y = 'Age', s = 'Age', c = 'red');
Output:
Picked
Python pandas-plotting
Python-pandas
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Different ways to create Pandas Dataframe
Enumerate() in Python
Python String | replace()
How to Install PIP on Windows ?
*args and **kwargs in Python
Python Classes and Objects
Convert integer to string in Python
Python | os.path.join() method
Create a Pandas DataFrame from Lists
Comments in C++

Program comments are explanatory statements that you can include in the C++ code. These comments help anyone reading the source code. All programming languages allow for some form of comments.
C++ supports single-line and multi-line comments. All characters available inside any comment are ignored by C++ compiler.
C++ comments start with /* and end with */. For example −
/* This is a comment */

/* C++ comments can also
   * span multiple lines
*/

A comment can also start with //, extending to the end of the line. For example −
#include <iostream>
using namespace std;

main() {
   cout << "Hello World"; // prints Hello World
   
   return 0;
}
When the above code is compiled, it will ignore // prints Hello World and final executable will produce the following result −
Hello World

Within a /* and */ comment, // characters have no special meaning. Within a // comment, /* and */ have no special meaning. Thus, you can "nest" one kind of comment within the other kind. For example −
/* Comment out printing of Hello World:

cout << "Hello World"; // prints Hello World
Draw Colourful Star Pattern in Turtle – Python

08 Jun, 2020
In this article we will use Python’s turtle library to draw a spiral of stars, filled with randomly generated colours. We can generate different patterns by varying some parameters.
modules required:
turtle:
turtle library enables users to draw picture or shapes using commands, providing them with a virtual canvas.turtle comes with Python’s Standard Library. It needs a version of Python with Tk support, as it uses tkinter for the graphics.
Explanation:First we set each of the parameters for the spiral: number of stars, exterior angle of the stars and angle of rotation for the spiral. The colours are chosen randomly by choosing three random integers for rgb values, and so each time we get a different colour combination.In the implementation below, we will draw a pattern of 30 stars, with exterior angle 144 degrees and angle of rotation 18 degrees.
from turtle import * import random  speed(speed ='fastest')  def draw(n, x, angle):    # loop for number of stars    for i in range(n):                  colormode(255)                  # choosing random integers         # between 0 and 255        # to generate random rgb values         a = random.randint(0, 255)        b = random.randint(0, 255)        c = random.randint(0, 255)                  # setting the outline         # and fill colour        pencolor(a, b, c)        fillcolor(a, b, c)                  # begins filling the star        begin_fill()                  # loop for drawing each star        for j in range(5):                           forward(5 * n-5 * i)            right(x)            forward(5 * n-5 * i)            right(72 - x)                      # colour filling complete        end_fill()                  # rotating for        # the next star        rt(angle)            # setting the parametersn = 30    # number of starsx = 144   # exterior angle of each starangle = 18    # angle of rotation for the spiral  draw(n, x, angle)
Output:
By changing the exterior angle to 72, we can get a pattern of pentagons as such:
20 pentagons, 18 degree spiral
Python-turtle
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Scala sum Map values

26 Jul, 2019
In Scala, the sum of the map elements can be done by utilizing foldLeft method.
Syntax : m1.foldLeft(0)(_+_._1)
Here, m1 is used for a Map, foldLeft is a method that takes an initial value zero. it will take previous result and add it to the next map key value.
Return Type: It returns the sum of all the elements of the map.
Example #1:
// Scala program of sum()// method  // Creating objectobject GfG{       // Main method    def main(args:Array[String])    {              // Creating a map        val m1 = Map(3 -> "geeks", 1 -> "for", 2 -> "cs")                  // Applying sum method        val result = m1.foldLeft(0)(_+_._1)                  // Displays output        println(result)          }}
6

Here, zero in the foldLeft method is the initial value.Example #2:
// Scala program of sum()// method  // Creating objectobject GfG{       // Main method    def main(args:Array[String])    {              // Creating a map        val m1 = Map(3 -> "geeks", 1 -> "for", 1 -> "for")                  // Applying sum method        val result = m1.foldLeft(0)(_+_._1)                  // Displays output        println(result)          }}
4

Scala
Scala-Map
Scala-Method
Scala
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Class and Object in Scala
Type Casting in Scala
Scala Tutorial – Learn Scala with Step By Step Guide
Scala Lists
Operators in Scala
Scala | Arrays
Scala Constructors
Scala String substring() method with example
Lambda Expression in Scala
Scala Singleton and Companion Objects
Angular forms FormControlName Directive - GeeksforGeeks

03 Jun, 2021
In this article, we are going to see what is FormControlName in Angular 10 and how to use it.
FormControlName is used to sync a FormControl in an existing FormGroup to a form control element by name.
Syntax:
<form [FormControlName] ="name">
Exported from:
ReactiveFormsModule
 
Selectors:
[FormControlName]
Approach: 
Create the Angular app to be used
In app.component.ts make an object that contain value for the input.
In app.component.html use FormControlName to get values.
Serve the angular app using ng serve to see the output.
Example 1:
app.component.ts
import { Component, Inject } from '@angular/core';  import { FormGroup, FormControl, FormArray } from '@angular/forms'  @Component({    selector: 'app-root',    templateUrl: './app.component.html',    styleUrls: [ './app.component.css' ]  })  export class AppComponent  {    form = new FormGroup({        name: new FormControl(),        rollno: new FormControl()     });      get name(): any {      return this.form.get('name');    }    get rollno(): any {      return this.form.get('rollno');    }        onSubmit(): void {      console.log(this.form.value);     }      }
app.component.html
<br><form [formGroup]="form" (ngSubmit)="onSubmit()">    <input formControlName="name" placeholder="Name">    <input formControlName="rollno" placeholder="RollNo">  <br>  <button type='submit'>Submit</button>  <br>  <br></form>
Output:
Reference: https://angular.io/api/forms/FormControlName
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 10 (blur) Event
Angular PrimeNG Dropdown Component
Roadmap to Become a Web Developer in 2022
Installation of Node.js on Linux
How to fetch data from an API in ReactJS ?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to insert spaces/tabs in text using HTML/CSS?
How to reset all form values using a button in HTML ? - GeeksforGeeks

30 Jun, 2021
You can easily reset all form values using the HTML button using <input type=”reset”> attribute. Clicking the reset button restores the form to its original state (the default value) before the user started entering values into the fields, selecting radio buttons, checkboxes, etc. There could be many scenarios. 
In this article, we are going to learn about how to clear the input field.
Syntax:
<input type="reset">
Example:
HTML
<!DOCTYPE html><html>  <body>    <center>        <h1 style="color: green;">            GeeksforGeeks        </h1>                  <form>            <input type="text"                 placeholder="Email address"                 id="email" name="email" />            <br /><br />              <input type="password"                 placeholder="Password" id="pin"                 name="password" maxlength="8" />            <br /><br />              <input type="reset" value="Reset"                 style="background-color: red;                         color: white" />            <input type="submit" value="Submit"                 style="background-color: green;                         color: white" />        </form>    </center></body>  </html>
Output:
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.
HTML-Attributes
HTML-Questions
Picked
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
REST API (Introduction)
Design a web page using HTML and CSS
Angular File Upload
Form validation using jQuery
DOM (Document Object Model)
Roadmap to Become a Web Developer in 2022
Installation of Node.js on Linux
How to fetch data from an API in ReactJS ?
Convert a string to an integer in JavaScript
Difference between var, let and const keywords in JavaScript
Bootstrap class pull-left

Float an element to the left with class pull-left.
You can try to run the following code to implement the pull-left class −
Live Demo
<!DOCTYPE html>
<html>
   <head>
      <title>Bootstrap Example</title>
      <link href = "/bootstrap/css/bootstrap.min.css" rel="stylesheet">
      <script src = "/scripts/jquery.min.js"></script>
      <script src = "/bootstrap/js/bootstrap.min.js"></script>
   </head>
   <body>
      <div class = "pull-left">
         Float to left
      </div>
   </body>
</html>
Clojure - Lists cons

Returns a new list wherein an element is added to the beginning of the list.
Following is the syntax.
(cons element lst)

Parameters − ‘element’ is the element which needs to be added to the list. ‘lst’ is the list of items.
Return Value − The list with the appended value.
Following is an example of cons in Clojure.
(ns clojure.examples.example
   (:gen-class))
(defn example []
   (println (cons 0 (list 1 2,3))))
(example)
The above program produces the following output.
(0 1 2 3)

 Print
 Add Notes
 Bookmark this page
FIND_IN_SET() Function in MySQL - GeeksforGeeks

02 Sep, 2020
FIND_IN_SET() function used to find the position of a string within a list of strings. If the string is repeated multiple time, the output will be the first position of that string.
Point to be noted :
If string is not found in string_list, the result is 0
If string or string_list is NULL, the result is NULL
If string_list is an empty string (“”), the result is 0
Syntax :
FIND_IN_SET("string", "string_list")
Note : Parameter string is mandatory to search for string_list; string_list is list of string values.
Example-1:Search for “a” within the list of strings :
SELECT FIND_IN_SET("a", "g, e, e, k, s, f, o, r, g, e, e, k, s"); 
Result –
Example-2:Search for “q” within the list of strings (string list is NULL) :
SELECT FIND_IN_SET("a", null); 
Result –
Example-3:Search for “q” within the list of strings :
SELECT FIND_IN_SET("g", "g, e, e, k, s, f, o, r, g, e, e, k, s"); 
Result –
DBMS-SQL
mysql
SQL
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to Update Multiple Columns in Single Update Statement in SQL?
How to Alter Multiple Columns at Once in SQL Server?
What is Temporary Table in SQL?
SQL Query to Find the Name of a Person Whose Name Starts with Specific Letter
SQL using Python
SQL | Subquery
SQL Query to Convert VARCHAR to INT
SQL | Date functions
SQL - SELECT from Multiple Tables with MS SQL Server
SQL Query to Insert Multiple Rows
Check whether given key already exists in a dictionary in Python

The dictionary containers in pipeline old both key and values as pairs. Sometimes we may need to find if a given key is already present in the dictionary. In this article we will see the various ways to check for the presence of a key in a dictionary.
This is a very straightforward way in which we just check for the presence of the key in the dictionary using in operator. If the the keys part of dictionary we print the result as present else absent.
 Live Demo
Adict = {'Mon':3,'Tue':5,'Wed':6,'Thu':9}
print("The given dictionary : ",Adict)
check_key = "Fri"
if check_key in Adict:
   print(check_key,"is Present.")
else:
   print(check_key, " is not Present.")
Running the above code gives us the following result −
The given dictionary : {'Thu': 9, 'Wed': 6, 'Mon': 3, 'Tue': 5}
Fri is not Present.
The dict.keys() method gives us all the keys that are present in a given dictionary. We can use the in operator how to find out if the given key belongs to the given dictionary.
 Live Demo
Adict = {'Mon':3,'Tue':5,'Wed':6,'Thu':9}
print("The given dictionary : ",Adict)
check_key = "Wed"
if check_key in Adict.keys():
   print(check_key,"is Present.")
else:
   print(check_key, " is not Present.")
Running the above code gives us the following result −
The given dictionary : {'Thu': 9, 'Wed': 6, 'Mon': 3, 'Tue': 5}
Wed is Present.
How to handle newlines in JSON ? - GeeksforGeeks

11 Jan, 2021
JSON is a language-independent data format. It is a JavaScript Object Notation. Basically, it is a text-based format used to represent structured data. Data is being sent in this format from the server to the client.
In this article, we will see how to approach or handle newlines in JSON.
Syntax: 
'\\n'
About ‘\\n’: The above syntax is used whenever we want to sent data in multiple lines in a JSON format. Generally, it is difficult to send data in new lines from server to web. But by using this we can achieve the following requirement.
Approach:
First, we need to declare a variable as “json1” and then we need to assign the JSON to it.
In JSON object make sure that you are having a sentence where you need to print in different lines.
Now in-order to print the statements in different lines we need to use ‘\\n’ (backward slash).
As we now know the technique to print in newlines, now just add ‘\\n’ wherever you want.
Now, as it is a JSON we need to parse it in order to print it. So use JSON.parse() method and parse the JSON.
After completing the above steps write a console.log() statement to print the output.
Once you are done with it, execute the file to get the output.
Code implementation:
Example 1:
Javascript
var json = '{    "companyInfo" :     "GeeksForGeeks\\n\\nOne stop solution for CS subjects"}';                          let finalJson=JSON.parse(json);  console.log(finalJson.companyInfo)
Output:
GeeksForGeeks


One stop solution for CS subjects
Example 2:
Javascript
var student = '{    "details" :     "P.V.Ramesh\\nC.S.E.\\nI.I.T. Hyderabad"}';              let finalJson = JSON.parse(student);  console.log(finalJson.details)
Output:
P.V.Ramesh
C.S.E.
I.I.T. Hyderabad
JavaScript-Misc
JSON
Picked
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
Convert a string to an integer in JavaScript
Difference between var, let and const keywords in JavaScript
Differences between Functional Components and Class Components in React
How to append HTML code to a div using JavaScript ?
Remove elements from a JavaScript Array
Installation of Node.js on Linux
Convert a string to an integer in JavaScript
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?