code-rag-bench/online-tutorials huggingface dataset:
What is the MySQL VARCHAR max size?

The MySQL version before 5.0.3 was capable of storing 255 characters but from the version 5.0.3 , it is capable of storing 65,535 characters.
MySQL official documentation states −
The effective maximum length of a VARCHAR in MySQL 5.0.3 and later is subject to the maximum row size (65,535 bytes, which is shared among all columns) and the character set used. For example, utf8 characters can require up to three bytes per character, so a VARCHAR column that uses the utf8 character set can be declared to be a maximum of 21,844 characters. 
Keep in mind that the limitation of maximum row size is 65,535 bytes.This states that including all columns it shouldn't be more than 65,535 bytes.
Let us see what happens if this is violated −
Here is a table with two columns, “one” varchar with the length of 32,765 and “two” with 32766.
Length = 32765+2 + 32766 + 2 = 65535.
CREATE TABLE IF NOT EXISTS `mytable` (
`one` varchar(32765) NOT NULL,
`two` varchar(32766) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
Now let us increase the column length −
CREATE TABLE IF NOT EXISTS `mytable` (
`one` varchar(32767) NOT NULL,
`two` varchar(32770) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
Above gives the following error −
#1118 - Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs
The above itself states that −
The maximum row size is 65,535 bytes. If it exceeds, an error will be visible.
Get the absolute values in Pandas - GeeksforGeeks

18 Aug, 2020
Let us see how to get the absolute value of an element in Python Pandas. We can perform this task by using the abs() function. The abs() function is used to get a Series/DataFrame with absolute numeric value of each element.
Syntax : Series.abs() or DataFrame.abs()Parameters : NoneReturns : Series/DataFrame containing the absolute value of each element.
Example 1 : Absolute numeric values in a Series.
# import the libraryimport pandas as pd  # create the Seriess = pd.Series([-2.8, 3, -4.44, 5])print(s)  # fetching the absolute valuesprint("\nThe absolute values are :")print(s.abs())
Output :
Example 2 : Absolute numeric values in a Series with complex numbers.
# import the libraryimport pandas as pd  # create the Seriess = pd.Series([2.2 + 1j])print(s)  # fetching the absolute valuesprint("\nThe absolute values are :")print(s.abs())
Output :
Example 3 : Absolute numeric values in a Series with a Timedelta element.
# import the libraryimport pandas as pd  # create the Seriess = pd.Series([pd.Timedelta('2 days')])print(s)  # fetching the absolute valuesprint("\nThe absolute values are :")print(s.abs())
Output :
Example 4 : Fetching the absolute values from a DataFrame column.
# import the libraryimport pandas as pd  # create the DataFramedf = pd.DataFrame({'p' : [2, 3, 4, 5],                   'q' : [10, 20, 30, 40],                   'r' : [200, 60, -40, -60]})display(df)  # fetching the absolute valuesprint("\nThe absolute values are :")display(df.r.abs())
Output :
Python Pandas-exercise
Python pandas-series
Python-pandas
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
How To Convert Python Dictionary To JSON?
Check if element exists in list in Python
How to drop one or multiple columns in Pandas Dataframe
Python Classes and Objects
Python | os.path.join() method
Create a directory in Python
Python | Get unique values from a list
Python | Pandas dataframe.groupby()
Defaultdict in Python
Concatenate two columns in MySQL?

To concatenate two columns, use CONCAT() function in MySQL. The syntax is as follows −
select CONCAT(yourColumnName1, ' ',yourColumnName2) as anyVariableName from yourTableName;
To understand the above concept, let us create a table. The query to create a table is as follows −
mysql> create table concatenateTwoColumnsDemo
   −> (
   −> StudentId int,
   −> StudentName varchar(200),
   −> StudentAge int
   −> );
Query OK, 0 rows affected (1.06 sec)
Now you can insert some records in the table. The query to insert records is as follows −
mysql> insert into concatenateTwoColumnsDemo values(1,'Sam',21);
Query OK, 1 row affected (0.18 sec)

mysql> insert into concatenateTwoColumnsDemo values(2,'David',24);
Query OK, 1 row affected (0.17 sec)

mysql> insert into concatenateTwoColumnsDemo values(3,'Carol',22);
Query OK, 1 row affected (0.13 sec)

mysql> insert into concatenateTwoColumnsDemo values(4,'Johnson',19);
Query OK, 1 row affected (0.17 sec)
Display all records from the table with the help of select statement. The query is as follows −
mysql> select *from concatenateTwoColumnsDemo;
The following is the output −
+-----------+-------------+------------+
| StudentId | StudentName | StudentAge |
+-----------+-------------+------------+
|         1 | Sam         |         21 |
|         2 | David       |         24 |
|         3 | Carol       |         22 |
|         4 | Johnson     |         19 |
+-----------+-------------+------------+
4 rows in set (0.00 sec)
Implement the CONCAT() function to concatenate two columns. Here, we are concatenating columns StudentName and StudentAge. The query is as follows −
mysql> select CONCAT(StudentName, ' ',StudentAge) as NameAndAgeColumn from concatenateTwoColumnsDemo;
The following is the output displaying the concatenated columns −
+------------------+
| NameAndAgeColumn |
+------------------+
| Sam 21           |
| David 24         |
| Carol 22         |
| Johnson 19       |
+------------------+
4 rows in set (0.00 sec)
numpy.asarray() in Python - GeeksforGeeks

12 Nov, 2021
numpy.asarray()function is used when we want to convert input to an array. Input can be lists, lists of tuples, tuples, tuples of tuples, tuples of lists and arrays.
Syntax : numpy.asarray(arr, dtype=None, order=None)
Parameters :arr : [array_like] Input data, in any form that can be converted to an array. This includes lists, lists of tuples, tuples, tuples of tuples, tuples of lists and ndarrays.dtype : [data-type, optional] By default, the data-type is inferred from the input data.order : Whether to use row-major (C-style) or column-major (Fortran-style) memory representation. Defaults to ‘C’.
Return : [ndarray] Array interpretation of arr. No copy is performed if the input is already ndarray with matching dtype and order. If arr is a subclass of ndarray, a base class ndarray is returned.
Code #1 : List to array
# Python program explaining# numpy.asarray() function  import numpy as geekmy_list = [1, 3, 5, 7, 9]  print ("Input  list : ", my_list)       out_arr = geek.asarray(my_list)print ("output array from input list : ", out_arr) 
Output :
Input  list :  [1, 3, 5, 7, 9]
output array from input list :  [1 3 5 7 9]

 Code #2 : Tuple to array
# Python program explaining# numpy.asarray() function  import numpy as geek  my_tuple = ([1, 3, 9], [8, 2, 6])   print ("Input  tuple : ", my_tuple)    out_arr = geek.asarray(my_tuple) print ("output array from input tuple : ", out_arr) 
Output :
Input  tuple :  ([1, 3, 9], [8, 2, 6])
output array from input tuple :  [[1 3 9]
 [8 2 6]]

gulshankumarar231
Pyhton numpy-arrayCreation
Python-numpy
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Enumerate() in Python
How to Install PIP on Windows ?
Different ways to create Pandas Dataframe
Python String | replace()
Create a Pandas DataFrame from Lists
sum() function in Python
*args and **kwargs in Python
How to drop one or multiple columns in Pandas Dataframe
Print lists in Python (4 Different Ways)
How To Convert Python Dictionary To JSON?
How to convert Java object to JSON using Jackson library?

JSON or JavaScript Object Notation is a lightweight text-based open standard designed for human-readable data interchange. Conventions used by JSON are known to programmers, which include C, C++, Java, Python, Perl, etc.
There are several Java libraries available to handle JSON objects. Jackson is a simple java based library to serialize java objects to JSON and vice versa.
The ObjectMapper class of the Jackson API in Java provides methods to convert a Java object to JSON object and vice versa.
The writeValueAsString() method of this class accepts a JSON object as a parameter and returns its respective JSON String
Therefore, to convert a Java object to a JSON String using Jackson library −
Add the following maven dependency to your pom.xml
Add the following maven dependency to your pom.xml
<dependency>
   <groupId>com.fasterxml.jackson.core</groupId>
   <artifactId>jackson-databind</artifactId>
   <version>2.10.0.pr2</version>
</dependency>
Create a javabean/POJO object with private variables and setter/getter methods.
Create a javabean/POJO object with private variables and setter/getter methods.
Create another class (make sure that the POJO class is available to this).
Create another class (make sure that the POJO class is available to this).
In it, create an object of the POJO class, set required values to it using the setter methods.
In it, create an object of the POJO class, set required values to it using the setter methods.
Instantiate the ObjectMapper class.
Instantiate the ObjectMapper class.
Invoke the writeValueAsString() method by passing the above created POJO object.
Invoke the writeValueAsString() method by passing the above created POJO object.
Retrieve and print the obtained JSON.
Retrieve and print the obtained JSON.
import com.google.gson.Gson;
class Student {
   private int id;
   private String name;
   private int age;
   private long phone;
   public int getId() {
      return id;
   }
   public void setId(int id) {
      this.id = id;
   }
   public String getName() {
      return name;
   }
   public void setName(String name) {
      this.name = name;
   }
   public int getAge() {
      return age;
   }
   public void setAge(int age) {
      this.age = age;
   }
   public long getPhone() {
      return phone;
   }
   public void setPhone(long phone) {
      this.phone = phone;
   }
}
public class JacksionExample {
   public static void main(String args[]) throws Exception {
      Student std = new Student();
      std.setId(001);
      std.setName("Krishna");
      std.setAge(30);
      std.setPhone(9848022338L);
      //Creating the ObjectMapper object
      ObjectMapper mapper = new ObjectMapper();
      //Converting the Object to JSONString
      String jsonString = mapper.writeValueAsString(std);
      System.out.println(jsonString);
   }
}
{"id":1,"name":"Krishna","age":30,"phone":9848022338}
URL getProtocol() method in Java with Examples

27 Dec, 2018
The getProtocol() function is a part of URL class. The function getProtocol() returns the Protocol of a specified URL.
Function Signature
public String getProtocol()

Syntax
url.getProtocol()

Parameter This function does not require any parameter
Return Type: The function returns String Type
Below programs illustrates the use of getProtocol() function:
Example 1:
// Java program to show the// use of the function getProtocol()  import java.net.*;  class GFG {    public static void main(String args[])    {        // url object        URL url = null;          try {            // create a URL            url = new URL("https:// www.geeksforgeeks.org");              // get the Protocol            String Protocol = url.getProtocol();              // display the URL            System.out.println("URL = " + url);              // display the Protocol            System.out.println("Protocol = " + Protocol);              // create a URL            url = new URL("http:// www.geeksforgeeks.org");              // get the Protocol            Protocol = url.getProtocol();              // display the URL            System.out.println("URL = " + url);              // display the Protocol            System.out.println("Protocol = " + Protocol);              // create a URL            url = new URL("ftp:// www.geeksforgeeks.org");              // get the Protocol            Protocol = url.getProtocol();              // display the URL            System.out.println("URL = " + url);              // display the Protocol            System.out.println("Protocol = " + Protocol);        }          // if any error occurs        catch (Exception e) {              // display the error            System.out.println(e);        }    }}
URL = https:// www.geeksforgeeks.org
Protocol = https
URL = http:// www.geeksforgeeks.org
Protocol = http
URL = ftp:// www.geeksforgeeks.org
Protocol = ftp

Java-Functions
Java-net-package
Java-URL
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Auxiliary Space with Recursive Functions in C Program?

Here we will see how the auxiliary space is required for recursive function call. And how it is differing from the normal function call?
Suppose we have one function like below −
long fact(int n){
   if(n == 0 || n == 1)
      return 1;
   return n * fact(n-1);
}
This function is recursive function. When we call it like fact(5), then it will store addresses inside the stack like below −
fact(5) --->
fact(4) --->
fact(3) --->
fact(2) --->
fact(1)
As the recursive functions are calling itself again and again, addresses are added into stack. So if the function is called n times recursively, it will take O(n) auxiliary space. But that does not mean that if one normal function is called n times, the space complexity will be O(n). For normal function when it is called, the address is pushed into the stack. After that when it is completed, it will pop address from stack and come into the invoker function. Then call again. So it will be O(1).
How do we use Python in interactive mode?

Execute Python from command prompt to run Python interactive shell.
C:\user>python
 >>>
Python prompt is made up of three greater than symbols. Any valid expression can now be evaluated interactively. Let us start with evaluating arithmetic expression.
>>> 2+3*5
 17
You can assign value to a variable or accept input from user, and print its value.
>>> name=input("enter your name")
enter your name TutorialsPoint
>>> name
 ' TutorialsPoint'
How to run Invoke-Command in PowerShell Workflow?

To run Invoke-Command in PowerShell Workflow we need to use the InlineScript block because Invoke-Command is not supported directly in the workflow. The below example is without using the InlineScript block we get an error.
Workflow TestInvokeCommand{
   Invoke-Command -ComputerName LabMachine2k16 -ScriptBlock{
      Get-Service WINRM
   }
}
At line:2 char:5
+    Invoke-Command -ComputerName LabMachine2k16 -ScriptBlock{
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Cannot call the 'Invoke-Command' command. Other commands from this module have been packaged as workflow activities, but this
command was specifically excluded. This is likely because the command requires an interactive Windows PowerShell session, or has
behavior not suited for workflows. To run this command anyway, place it within an inline-script (InlineScript { Invoke-Command })
where it will be invoked in isolation.
   + CategoryInfo : ParserError: (:) [], ParseException
   + FullyQualifiedErrorId : CommandActivityExcluded
The above error indicates that the Invoke-Command can’t be directly used with the PowerShell and we need to use it inside the InlineScript block as shown below.
Workflow TestInvokeCommand{
   InlineScript{
      Invoke-Command -ComputerName LabMachine2k16 -ScriptBlock{
         Get-Service WINRM
      }
   }
}

TestInvokeCommand
To use the outside variable in the scriptblock inside InlineScript block, we need to use $Using:VariableName. For example,
Workflow TestInvokeCommand{
$server = "Labmachine2k16"
   InlineScript{
       Invoke-Command -ComputerName $using:Server -ScriptBlock{
           Get-Service WINRM
       }
   }
}

TestInvokeCommand
To store the output variable,
Workflow TestInvokeCommand{
   $server = "Labmachine2k16"
   $Status =  InlineScript{
      Invoke-Command -ComputerName $using:Server -ScriptBlock{
         return( Get-Service WINRM).Status
      }
   }
   Write-Output "WinRM Status: $status"
}
 
TestInvokeCommand
How to create a thread using lambda expressions in Java?


The lambda expressions are introduced in Java 8. It is one of the most popular features of Java 8 and brings functional programming capabilities to Java. By using a lambda expression, we can directly write the implementation for a method in Java.
In the below program, we can create a thread by implementing the Runnable interface using lamda expression. While using the lambda expressions, we can skip the new Runnable() and run() method because the compiler knows that Thread object takes a Runnable object and that contains only one method run() that takes no argument.
public class LambdaThreadTest {
   public static void main(String args[]) {
      // Child thread
      new Thread(() -> { // Lambda Expression
         for(int i=1; i <= 5; i++) {
            System.out.println("Child Thread: "+ i);
            try {
               Thread.sleep(500);
            } catch(Exception e) {
               e.printStackTrace();
            }
         }
      }).start();
      // Main Thead
      for(int j=1; j < 5; j++) {
         System.out.println("Main Thread: "+ j);
         try {
            Thread.sleep(500);
         } catch(Exception e) {
            e.printStackTrace();
         }
      }
   }
}
Main Thread: 1
Child Thread: 1
Child Thread: 2
Main Thread: 2
Main Thread: 3
Child Thread: 3
Main Thread: 4
Child Thread: 4
Child Thread: 5
How to detect faces in an image using Java OpenCV library?

The CascadeClassifier class of is used to load the classifier file and detects the desired objects in the image.
The detectMultiScale() of this class detects multiple objects of various sizes. This method accepts −
An object of the class Mat holding the input image.
An object of the class Mat holding the input image.
An object of the class MatOfRect to store the detected faces.
An object of the class MatOfRect to store the detected faces.
To get the number of faces in the image −
Load the lbpcascade_frontalface.xml file using the CascadeClassifier class.
Load the lbpcascade_frontalface.xml file using the CascadeClassifier class.
Invoke the detectMultiScale() method.
Invoke the detectMultiScale() method.
Convert the MatOfRect object to an array.
Convert the MatOfRect object to an array.
The length of the array is the number of faces in the image.
The length of the array is the number of faces in the image.
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.MatOfRect;
import org.opencv.core.Point;
import org.opencv.core.Rect;
import org.opencv.core.Scalar;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.imgproc.Imgproc;
import org.opencv.objdetect.CascadeClassifier;
public class FaceDetection {
   public static void main (String[] args) {
      //Loading the OpenCV core library
      System.loadLibrary( Core.NATIVE_LIBRARY_NAME );
      //Reading the Image from the file
      String file ="D:\\Images\\faces.jpg";
      Mat src = Imgcodecs.imread(file);
      //Instantiating the CascadeClassifier
      String xmlFile = "lbpcascade_frontalface.xml";
      CascadeClassifier classifier = new CascadeClassifier(xmlFile);
      //Detecting the face in the snap
      MatOfRect faceDetections = new MatOfRect();
      classifier.detectMultiScale(src, faceDetections);
      System.out.println(String.format("Detected %s faces",
      faceDetections.toArray().length));
      //Drawing boxes
      for (Rect rect : faceDetections.toArray()) {
         Imgproc.rectangle(
            src,
            new Point(rect.x, rect.y),
            new Point(rect.x + rect.width, rect.y + rect.height),
            new Scalar(0, 0, 255),
            3
         );
      }
      //Writing the image
      Imgcodecs.imwrite("D:\\Images\\face_Detection.jpg", src);
      System.out.println("Image Processed");
   }
}
No of faces detected: 3
Aptitude | GATE CS 1998 | Question 9 - GeeksforGeeks

21 May, 2020
If the regular set ‘A’ is represented by A= (01+1)* and the regular set ‘B’ is represented by B= ((01)* 1*)*, which of the following is true ?(A) A ⊂ B(B) B ⊂ A(C) A and B are incomparable(D) A = BAnswer: (D)Explanation: Some of the regular expression always equivalent to (0+1)* such that
(0+1)* 
= (0*+1*)* 
= (01*)* 
= (0*+1)* 
= (0+1*)* 
= 0*(10*)* 
= 1*(01*)* 
Since,
(01+1)* = ((01)* 1* )*  
Therefore A = B.Quiz of this Question
vivekkumarmth0077
Aptitude
Aptitude-GATE CS 1998
GATE CS 1998
GATE
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
GATE | GATE-IT-2004 | Question 71
GATE | GATE CS 2011 | Question 7
GATE | GATE-CS-2015 (Set 3) | Question 65
GATE | GATE-CS-2014-(Set-3) | Question 38
GATE | GATE CS 2018 | Question 37
GATE | GATE-CS-2016 (Set 1) | Question 65
GATE | GATE-IT-2004 | Question 83
GATE | GATE-CS-2016 (Set 1) | Question 63
GATE | GATE-CS-2014-(Set-2) | Question 65
GATE | GATE-CS-2007 | Question 64
Matplotlib - Scatter Plot

Scatter plots are used to plot data points on horizontal and vertical axis in the attempt to show how much one variable is affected by another. Each row in the data table is represented by a marker the position depends on its values in the columns set on the X and Y axes. A third variable can be set to correspond to the color or size of the markers, thus adding yet another dimension to the plot.
The script below plots a scatter diagram of grades range vs grades of boys and girls in two different colors.
import matplotlib.pyplot as plt
girls_grades = [89, 90, 70, 89, 100, 80, 90, 100, 80, 34]
boys_grades = [30, 29, 49, 48, 100, 48, 38, 45, 20, 30]
grades_range = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
fig=plt.figure()
ax=fig.add_axes([0,0,1,1])
ax.scatter(grades_range, girls_grades, color='r')
ax.scatter(grades_range, boys_grades, color='b')
ax.set_xlabel('Grades Range')
ax.set_ylabel('Grades Scored')
ax.set_title('scatter plot')
plt.show()

    63 Lectures 
     6 hours 

 Abhilash Nelson

    11 Lectures 
     4 hours 

 DATAhill Solutions Srinivas Reddy

    9 Lectures 
     2.5 hours 

 DATAhill Solutions Srinivas Reddy

    32 Lectures 
     4 hours 

 Aipython

    10 Lectures 
     2.5 hours 

 Akbar Khan

    63 Lectures 
     6 hours 

 Anmol
 Print
 Add Notes
 Bookmark this page
Java String length() Method

❮ String Methods

Return the number of characters in a string:
String txt = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
System.out.println(txt.length());

Try it Yourself »

The length() method returns the length of a specified string.
Note: The length of an empty string is 0.
public int length()

None.
We just launchedW3Schools videos
Get certifiedby completinga course today!
If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:
help@w3schools.com
Your message has been sent to W3Schools.
What is an anonymous function in Python?

In Python, anonymous function is a function that is defined without a name. While normal functions are defined using the def keyword, in Python anonymous functions are defined using the lambda keyword. Hence, anonymous functions are also called lambda functions.
 If we run the given code we get the following output
C:/Users/TutorialsPoint1/~.py
[(13, -3), (4, 1), (1, 2), (9, 10)]
Python Pandas - Get the levels in MultiIndex

To get the levels in MultiIndex, use the MultiIndex.levels property in Pandas. At first, import the required libraries −
import pandas as pd
MultiIndex is a multi-level, or hierarchical, index object for pandas objects. Create arrays −
arrays = [[1, 2, 3, 4, 5], ['John', 'Tim', 'Jacob', 'Chris', 'Keiron']]

The "names" parameter sets the names for each of the index levels. The from_arrays() is used to create a Multiindex −
multiIndex = pd.MultiIndex.from_arrays(arrays, names=('ranks', 'student'))
Get the levels in Multiindex −
print("\nThe levels in Multi-index...\n",multiIndex.levels)

Following is the code −
import pandas as pd

# MultiIndex is a multi-level, or hierarchical, index object for pandas objects
# Create arrays
arrays = [[1, 2, 3, 4, 5], ['John', 'Tim', 'Jacob', 'Chris', 'Keiron']]

# The "names" parameter sets the names for each of the index levels
# The from_arrays() uis used to create a Multiindex
multiIndex = pd.MultiIndex.from_arrays(arrays, names=('ranks', 'student'))

# display the Multiindex
print("The Multi-index...\n",multiIndex)

# get the levels in Multiindex
print("\nThe levels in Multi-index...\n",multiIndex.levels)
This will produce the following output −
The Multi-index...
MultiIndex([(1, 'John'),
            (2, 'Tim'),
            (3, 'Jacob'),
            (4, 'Chris'),
            (5, 'Keiron')],
            names=['ranks', 'student'])

The levels in Multi-index...
   [[1, 2, 3, 4, 5], ['Chris', 'Jacob', 'John', 'Keiron', 'Tim']]
Collections singletonMap() method in Java with Examples - GeeksforGeeks

11 May, 2021
The singletonMap() method of java.util.Collections class is used to return an immutable map, mapping only the specified key to the specified value. The returned map is serializable.
Syntax: 
public static  Map singletonMap(K key, V value)
Parameters: This method takes the following parameters as a argument: 
key – the sole key to be stored in the returned map.
value – the value to which the returned map maps key.
Return Value: This method returns an immutable map containing only the specified key-value mapping.
Below are the examples to illustrate the singletonMap() method
Example 1:  
Java
// Java program to demonstrate// singletonMap() method// for <String, String> Value import java.util.*; public class GFG1 {    public static void main(String[] argv)        throws Exception    {         try {             // create singleton map            // using singletonMap() method            Map<String, String>                map = Collections                          .singletonMap("key", "Value");             // printing the singletonMap            System.out.println("Singleton map is: "                               + map);        }         catch (IllegalArgumentException e) {            System.out.println("Exception thrown : " + e);        }    }}
Singleton map is: {key=Value}
 
Example 2:
Java
// Java program to demonstrate// singletonMap() method// for <Integer, Boolean> Value import java.util.*; public class GFG1 {    public static void main(String[] argv)        throws Exception    {         try {             // create singleton map            // using singletonMap() method            Map<Integer, Boolean>                map = Collections                          .singletonMap(100, true);             // printing the singletonMap            System.out.println("Singleton map is: "                               + map);        }         catch (IllegalArgumentException e) {            System.out.println("Exception thrown : " + e);        }    }}
Singleton map is: {100=true}
 
sweetyty
Java - util package
Java-Collections
Java-Functions
Java
Java
Java-Collections
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Stream In Java
Constructors in Java
Exceptions in Java
Functional Interfaces in Java
Different ways of Reading a text file in Java
Generics in Java
Introduction to Java
Comparator Interface in Java with Examples
Internal Working of HashMap in Java
Strings in Java
Perl | exists() Function - GeeksforGeeks

07 May, 2019
The exists() function in Perl is used to check whether an element in an given array or hash exists or not. This function returns 1 if the desired element is present in the given array or hash else returns 0.
Syntax: exists(Expression)
Parameters:Expression : This expression is either array or hash on which exists function is to be called.
Returns: 1 if the desired element is present in the given array or hash else returns 0.
Example 1: This example uses exists() function over an array.
#!/usr/bin/perl   # Initialising an array@Array = (10, 20, 30, 40, 50);  # Calling the for() loop over# each element of the Array# using index of the elementsfor ($i = 0; $i < 10; $i++){          # Calling the exists() function    # using index of the array elements    # as the parameter    if(exists($Array[$i]))    {        print "Exists\n";    }    else    {        print "Not Exists\n"    }}
Output:
Exists
Exists
Exists
Exists
Exists
Not Exists
Not Exists
Not Exists
Not Exists
Not Exists

In the above code, it can be seen that parameter of the exists() function is the index of each element of the given array and hence till index 4 (index starts from 0) it gives output as “Exists” and later gives “Not Exists” because index gets out of the array.
Example 2: This example uses exists() function over a hash.
#!/usr/bin/perl   # Initialising a Hash%Hash = (Mumbai => 1, Kolkata => 2, Delhi => 3);  # Calling the exists() functionif(exists($Hash{Mumbai})){    print "Exists\n";}else{    print "Not Exists\n"}  # Calling the exists() function# with different parameterif(exists($Hash{patna})){    print "Exists\n";}else{    print "Not Exists\n"}
Output :
Exists
Not Exists

In the above code, exists() function takes the key of the given hash as the parameter and check whether it is present or not.
Perl-Array-Functions
Perl-function
Perl-Hash-Functions
Perl
Perl
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Perl | Arrays (push, pop, shift, unshift)
Perl | Arrays
Perl Tutorial - Learn Perl With Examples
Use of print() and say() in Perl
Perl | join() Function
Perl | Basic Syntax of a Perl Program
Perl | Boolean Values
Perl | Subroutines or Functions
Perl | sleep() Function
Perl | Multidimensional Arrays
Python Number degrees() Method

Python number  method degrees() converts angle x from radians to degrees.
Following is the syntax for degrees() method −
degrees(x)

Note − This function is not accessible directly, so we need to import math module and then we need to call this function using math static object.
x − This must be a numeric value.
x − This must be a numeric value.
This method returns degree value of an angle.
The following example shows the usage of degrees() method.
#!/usr/bin/python
import math

print "degrees(3) : ",  math.degrees(3)
print "degrees(-3) : ",  math.degrees(-3)
print "degrees(0) : ",  math.degrees(0)
print "degrees(math.pi) : ",  math.degrees(math.pi)
print "degrees(math.pi/2) : ",  math.degrees(math.pi/2)
print "degrees(math.pi/4) : ",  math.degrees(math.pi/4)
When we run above program, it produces following result −
degrees(3) :  171.887338539
degrees(-3) :  -171.887338539
degrees(0) :  0.0
degrees(math.pi) :  180.0
degrees(math.pi/2) :  90.0
degrees(math.pi/4) :  45.0


    187 Lectures 
     17.5 hours 

 Malhar Lathkar

    55 Lectures 
     8 hours 

 Arnab Chakraborty

    136 Lectures 
     11 hours 

 In28Minutes Official

    75 Lectures 
     13 hours 

 Eduonix Learning Solutions

    70 Lectures 
     8.5 hours 

 Lets Kode It

    63 Lectures 
     6 hours 

 Abhilash Nelson
 Print
 Add Notes
 Bookmark this page
How to delete a particular element from a JavaScript array?

To delete an element from a JavaScript array, firstly use the indexOf() method to get the index of the element to be deleted. After that use splice() method −
Live Demo
<html>    
   <body>              
      <script>  
         var array = [40, 20, 70, 50];        
         var index = array.indexOf(70);                
         document.write("Original array: "+array);  
         if (index > -1) {          
            array.splice(index, 1);      
         }  
         document.write("<br>New array after deletion: "+array);  
      </script>          
   </body>
</html>
Original array: 40,20,70,50
New array after deletion: 40,20,50
Neo4j CQL - AGGREGATION

Like SQL, Neo4j CQL has provided some aggregation functions to use in RETURN clause. It is similar to GROUP BY clause in SQL
We can use this RETURN + Aggregation Functions in MATCH command to work on a group of nodes and return some aggregated value.
Now we will discuss each Neo4j CQL AGGREGATION Functions in detail with examples
It takes results from MATCH clause and counts the number of rows presents in that results and return that count value. All CQL Functions should use "( )" brackets.
COUNT(<value>)
NOTE -
<value> may be *, a node or relationship label name or a property name.
Example -
This example demonstrates how to use COUNT(*) function to return number of Employee nodes available in the Database.
Step 1 - Type the below command at dollar prompt in Data Browser.
MATCH (e:Employee) 
RETURN e.id,e.name,e.sal,e.deptno
Step 2 - Click on Execute button and observe the results.
We can observe that this query returns 4 rows.
Step 3 - Type the below command and click on Execute button.
MATCH (e:Employee) RETURN COUNT(*)
This query returns value 4 because Database contains 4 Employee nodes.
It takes set of rows and a <property-name> of a Node or Relationship as input and find the minimum value from the give <property-name> column of given rows.
MAX(<property-name> )
It takes set of rows and a <property-name> of a Node or Relationship as input and find the minimum value from the give <property-name> column of given rows.
MIN(<property-name> )
NOTE -
< property-name > should be name of a node or relationship.
Let us examine the MAX and MIN functions with an example.
Example -
This example demonstrates how to find the highest and lowest salary value from all Employee Nodes
Step 1 - Type the below command at dollar prompt in Data Browser.
MATCH (e:Employee) 
RETURN e.id,e.name,e.sal,e.deptno
Step 2 - Click on Execute button and observe the results.
We can observe that this query returns 4 rows.
Step 3 - Type the below command and click on Execute button.
MATCH (e:Employee) 
RETURN MAX(e.sal),MIN(e.sal)
This command finds max and min salary value from all Employee nodes available in the Database.
It takes set of rows and a <property-name> of a Node or Relationship as input and find the average value from the give <property-name> column of given rows.
AVG(<property-name> )
It takes set of rows and a <property-name> of a Node or Relationship as input and find the summation value from the give <property-name> column of given rows.
SUM(<property-name> )
Let us examine the SUM and AVG functions with an example.
Example1 -
This example demonstrates how to find the total and average salary value of all Employee Nodes
Step 1 - Type the below command at dollar prompt in Data Browser.
MATCH (e:Employee) 
RETURN e.id,e.name,e.sal,e.deptno
Step 2 - Click on Execute button and observe the results.
We can observe that this query returns 4 rows.
Step 3 - Type the below command and click on Execute button.
MATCH (e:Employee) 
RETURN SUM(e.sal),AVG(e.sal)
This command finds total and average salary value from all Employee nodes available in the Database.
 Print
 Add Notes
 Bookmark this page
Merge two sorted arrays in Java

Two sorted arrays can be merged so that a single resultant sorted array is obtained. An example of this is given as follows.
Array 1 = 1 3 7 9 10
Array 2 = 2 5 8
Merged array = 1 2 3 5 7 8 9 10
A program that demonstrates this is given as follows.
 Live Demo
public class Example {
   public static void main (String[] args) {
      int[] arr1 = {11, 34, 66, 75};
      int n1 = arr1.length;
      int[] arr2 = {1, 5, 19, 50, 89, 100};
      int n2 = arr2.length;
      int[] merge = new int[n1 + n2];
      int i = 0, j = 0, k = 0, x;
      System.out.print("Array 1: ");
      for (x = 0; x < n1; x++)
      System.out.print(arr1[x] + " ");
      System.out.print("\nArray 2: ");
      for (x = 0; x < n2; x++)
      System.out.print(arr2[x] + " ");
      while (i < n1 && j < n2) {
         if (arr1[i] < arr2[j])
            merge[k++] = arr1[i++];
         else
            merge[k++] = arr2[j++];
      }
      while (i < n1)
      merge[k++] = arr1[i++];
      while (j < n2)
      merge[k++] = arr2[j++];
      System.out.print("\nArray after merging: ");
      for (x = 0; x < n1 + n2; x++)
      System.out.print(merge[x] + " ");
   }
}
Array 1: 11 34 66 75
Array 2: 1 5 19 50 89 100
Array after merging: 1 5 11 19 34 50 66 75 89 100
Now let us understand the above program.
First the 2 sorted arrays arr1 and arr2 are displayed. The code snippet that demonstrates this is given as follows.
System.out.print("Array 1: ");
for (x = 0; x < n1; x++)
System.out.print(arr1[x] + " ");
System.out.print("\nArray 2: ");
for (x = 0; x < n2; x++)
System.out.print(arr2[x] + " ");
The sorted arrays are merged into a single array using a while loop. After the while loop, if any elements are left in arr1 or arr2, then they are added to the merged array. The code snippet that demonstrates this is given as follows.
while (i < n1 && j < n2) {
   if (arr1[i] < arr2[j])
      merge[k++] = arr1[i++];
   else
      merge[k++] = arr2[j++];
}
while (i < n1)
merge[k++] = arr1[i++];
while (j < n2)
merge[k++] = arr2[j++];
Finally the merged array is displayed. The code snippet that demonstrates this is given as follows.
System.out.print("\nArray after merging: ");
for (x = 0; x < n1 + n2; x++)
System.out.print(merge[x] + " ");
Python – Tensorflow math.add() method

07 Jan, 2022
Tensorflow math.add() method returns the a + b of the passes inputs. The operation is done on the representation of a and b. This method belongs to math module.
Syntax: tf.math.add(a, b, name=None)
Arguments
a: This parameter should be a Tensor and also from the one of the following types: bfloat16, half, float32, float64, uint8, int8, int16, int32, int64, complex64, complex128, string
b: This should also be a Tensor and must have the same type as a.
name: This is optional parameter and this is the name of the operation.
Return: It returns a Tensor having the same shape as of input a.
Python3
# Importing the Tensorflow library import tensorflow as tf   # A constant a and ba = tf.constant(3)b = tf.constant(6)    # Applying the math.add() function # storing the result in 'c' c = tf.math.add(a, b)  # Initiating a Tensorflow session with tf.Session() as sess:    print("Input 1", a)    print(sess.run(a))    print("Input 2", b)    print(sess.run(b))    print("Output: ", c)    print(sess.run(c))
Input 1 Tensor("Const_79:0", shape=(), dtype=int32)
3
Input 2 Tensor("Const_80:0", shape=(), dtype=int32)
6
Output:  Tensor("Add_1:0", shape=(), dtype=int32)
9

Example 2:
Python3
# Importing the Tensorflow library import tensorflow as tf   # A constant a and ba = tf.constant(u"This is ")b = tf.constant(u"GeeksForGeeks")    # Applying the math.add() function # storing the result in 'c' c = tf.math.add(a, b)  # Initiating a Tensorflow session with tf.Session() as sess:    print("Input 1", a)    print(sess.run(a))    print("Input 2", b)    print(sess.run(b))    print("Output: ", c)    print(sess.run(c))
Input 1 Tensor("Const_87:0", shape=(), dtype=string)
b'This is '
Input 2 Tensor("Const_88:0", shape=(), dtype=string)
b'GeeksForGeeks'
Output:  Tensor("Add_5:0", shape=(), dtype=string)
b'This is GeeksForGeeks'

sumitgumber28
Python Tensorflow-math-functions
Python-Tensorflow
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Python Classes and Objects
Python OOPs Concepts
Introduction To PYTHON
How to drop one or multiple columns in Pandas Dataframe
Python | os.path.join() method
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
Python | Get unique values from a list
Python | datetime.timedelta() function
Python Program for Pigeonhole Sort

30 Dec, 2020
Pigeonhole sorting is a sorting algorithm that is suitable for sorting lists of elements where the number of elements and the number of possible key values are approximately the same.It requires O(n + Range) time where n is number of elements in input array and \’Range\’ is number of possible values in array.
Working of Algorithm :
Find minimum and maximum values in array. Let the minimum and maximum values be \’min\’ and \’max\’ respectively. Also find range as \’max-min-1\’.Set up an array of initially empty “pigeonholes” the same size as of the range.Visit each element of the array and then put each element in its pigeonhole. An element arr[i] is put in hole at index arr[i] – min.Start the loop all over the pigeonhole array in order and put the elements from non- empty holes back into the original array.
Find minimum and maximum values in array. Let the minimum and maximum values be \’min\’ and \’max\’ respectively. Also find range as \’max-min-1\’.
Set up an array of initially empty “pigeonholes” the same size as of the range.
Visit each element of the array and then put each element in its pigeonhole. An element arr[i] is put in hole at index arr[i] – min.
Start the loop all over the pigeonhole array in order and put the elements from non- empty holes back into the original array.
# Python program to implement Pigeonhole Sort */  # source code : "https://en.wikibooks.org/wiki/#   Algorithm_Implementation/Sorting/Pigeonhole_sort"def pigeonhole_sort(a):    # size of range of values in the list     # (ie, number of pigeonholes we need)    my_min = min(a)    my_max = max(a)    size = my_max - my_min + 1      # our list of pigeonholes    holes = [0] * size      # Populate the pigeonholes.    for x in a:        assert type(x) is int, "integers only please"        holes[x - my_min] += 1      # Put the elements back into the array in order.    i = 0    for count in range(size):        while holes[count] > 0:            holes[count] -= 1            a[i] = count + my_min            i += 1                a = [8, 3, 2, 7, 4, 6, 8]print("Sorted order is : ", end =" ")  pigeonhole_sort(a)          for i in range(0, len(a)):    print(a[i], end =" ")     
Output:
Sorted order is : 2 3 4 6 7 8 8 
Please refer complete article on Pigeonhole Sort for more details!
python sorting-exercises
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python | Convert a list to dictionary
Python | Convert string dictionary to dictionary
Python Program for Fibonacci numbers
Python program to check whether a number is Prime or not
Python program to add two numbers
Python Program for Binary Search (Recursive and Iterative)
Python Program for factorial of a number
Python program to find second largest number in a list
Iterate over characters of a string in Python
Python program to interchange first and last elements in a list
Flutter – Setup for Web Development

16 Oct, 2020
As we know, the Flutter is growing day by day and become more powerful in just a small-time span. Initially, the flutter SDK released for Mobile App Development. But, now it is not limited to Mobile Apps, It also is available for Web and Desktop Application.
Today, We learn how to make your first Web App using Flutter.  Switching Flutter to the web does not require any hard configuration. By using some commands we can easily move to the web. Let’s get to one of the most exciting features on the Horizon for Flutter which is Web Development.
   1. Let’s start by switching to the Master Channel. Run the following command in your terminal.
flutter channel master
   2. Then upgrade your channel to the latest version
flutter upgrade
  3. Then you have to enable the web flag to get Web Support for your project. You may restart your project after this step.
flutter config --enable-web 
  4. Now, we can check that is every this is fine working by running the doctor command in the terminal.
flutter doctor
You can check that your channel is which to Master Successfully
We can also check the devices which are available for launching your Web App. Because web app needs a browser to be run. Run the following command and you will see the list of the browser available on your system.
flutter devices
Output
 1.   Let’s start to create a Flutter Project by running the simple and most powerful command in the Flutter. If everything is going to be fine. We see the index.html file in the terminal
flutter create <your _projectName>
# In this case we named the project is web_flutter
See index.html file is added to our project
  2. Now, Your Project is ready to run on the Web. Just run the last Command which is.
flutter run -d chrome
 You can use any of the available devices. After running this just wait for some time, it may take some time for the first time. 
If you get the error regarding firewalls. You can run the following commands.
flutter clean
And then
flutter run -d chrome
 If you have to move again to Mobile development, then you have to switch to the stable channel.
Now, all flutter web setup is done. Hope this is helpful and if there is any correction. 
android
Web technologies
Flutter
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Flutter - Search Bar
Flutter - Pop Up Menu
Flutter - BorderRadius Widget
Flutter - Card Widget
Flutter - Positioned Widget
Flutter - Padding Widget
Flutter - Modal Bottom Sheet
Flutter - Managing the MediaQuery Object
Flutter - dispose() Method with Example
Format Dates in Flutter
Python - Matplotlib

Matplotlib is a python library used to create 2D graphs and plots by using python scripts. It has a module named pyplot which makes things easy for plotting by providing feature to control line styles, font properties, formatting axes etc. It supports a very wide variety of graphs and plots namely - histogram, bar charts, power spectra, error charts etc. It is used along with NumPy to provide an environment that is an effective open source alternative for MatLab. It can also be used with graphics toolkits like PyQt and wxPython.
Conventionally, the package is imported into the Python script by adding the following statement −
from matplotlib import pyplot as plt

The following script produces the sine wave plot using matplotlib.
import numpy as np 
import matplotlib.pyplot as plt  

# Compute the x and y coordinates for points on a sine curve 
x = np.arange(0, 3 * np.pi, 0.1) 
y = np.sin(x) 
plt.title("sine wave form") 

# Plot the points using matplotlib 
plt.plot(x, y) 
plt.show() 
Its output is as follows −
We will see lots of examples on using Matplotlib library of python in Data science work in the next chapters.
PHP | intval() Function

12 Sep, 2019
The intval() function is an inbuilt function in PHP which returns the integer value of a variable.
Syntax:
int intval ( $var, $base )

Parameters: This function accepts two parameters out of which one is mandatory while the other one is optional. Parameters are described below:
$var: It is a mandatory parameter serves as the variable which needs to be converted to its integer value.
$base: It ia a optional parameter specifies the base for conversion of $var to its corresponding integer. If $base is not specified.If $var contains 0x (or 0X) as prefix, the base is taken as 16.If $var starts with 0, the base is taken as 8Otherwise, the base is taken as 10.
If $var contains 0x (or 0X) as prefix, the base is taken as 16.
If $var starts with 0, the base is taken as 8
Otherwise, the base is taken as 10.
Return Value: It returns the corresponding integer value of $var.
Examples:
Input : $var = '120', $base = 8
Output : 80

Input : $var = 0x34
Output : 52

Input : $var = 034
Output : 28

Below programs illustrate the use of intval() function in PHP:
Program 1:
<?php$var = '7.423';$int_value = intval($var);echo $int_value;?>
7

Program 2:
<?php$var = 0x423;$int_value = intval($var);echo $int_value;?>
1059

Program 3:
<?php$var = "64";echo intval($var)."\n".intval($var, 8);  ?>
64
52

Reference: http://php.net/manual/en/function.intval.php
bansalpiyush177
PHP-function
PHP
Web Technologies
PHP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to fetch data from localserver database and display on HTML table using PHP ?
Difference between HTTP GET and POST Methods
Different ways for passing data to view in Laravel
PHP | file_exists( ) Function
PHP | Ternary Operator
Installation of Node.js on Linux
Top 10 Projects For Beginners To Practice HTML and CSS Skills
Difference between var, let and const keywords in JavaScript
How to insert spaces/tabs in text using HTML/CSS?
How to fetch data from an API in ReactJS ?