code-rag-bench/online-tutorials huggingface dataset:
Command Line Argument in Scala - GeeksforGeeks

26 May, 2021
The arguments which are passed by the user or programmer to the main() method are termed as Command-Line Arguments. main() method is the entry point of execution of a program. main() method accepts an array of strings. runtime. But it never accepts parameters from any other method in the program. Syntax:  
def main(args: Array[String])
For accessing our Scala command-line arguments using the args array, which is made available to us implicitly when we extend App. Here is an example.Example 1: Print all given objects  
Scala
// Scala Program on command line argumentobject CMDExample{    // Main method    def main(args: Array[String])    {        println("Scala Command Line Argument Example");                 // You pass any thing at runtime        // that will be print on the console        for(arg<-args)        {            println(arg);        }    }}
To Compile and execute the above program on terminal follow below commands : First save program CMDExample.scala then open CMD/Terminal and go on that directory where you save your scala program. 
Compile: scalac CMDExample.scala Execute: scala CMDExample Welcome To GeeksforGeeks!  
Output:  
Scala Command Line Argument Example
Welcome
To
GeeksforGeeks!
 
Example 2: Print some object which is given at runtime  
Scala
// Scala Program on command line argumentobject CMDExample{    // Main method    def main(args: Array[String])    {        println("Scala Command Line Argument Example");                 // You pass any thing at runtime        // that will be print on the console        println(args(0));        println(args(2));    }}
To Compile and execute the above program on terminal follow below commands :  
Compile: scalac CMDExample.scala Execute: scala CMDExample 1 Welcome To GeeksforGeeks! 2  
Output:  
Scala Command Line Argument Example
1
To
 
Note:If given index not present in array then you find this error  
 
sujayshashank
sweetyty
Picked
Scala
Scala-Basics
Scala
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Scala Tutorial – Learn Scala with Step By Step Guide
Scala List filter() method with example
Scala Map
Type Casting in Scala
Scala Lists
Scala List contains() method with example
Scala String substring() method with example
Lambda Expression in Scala
Scala String replace() method with example
Scala | Arrays
How to style text buttons with CSS?

Following is the code to style text buttons with CSS −
 Live Demo
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
button {
   border: none;
   color: white;
   font-weight: bolder;
   padding: 20px;
   font-size: 18px;
   cursor: pointer;
   border-radius: 6px;
}
.Success {
   color: #4caf50;
}
.Success:hover {
   background: #e7e7e7;
}
.Info {
   color: #2196f3;
}
.Info:hover {
   background: #e7e7e7;
}
.Warning {
   color: #ff9800;
}
.Warning:hover {
   background: #e7e7e7;
}
.Danger {
   color: #f44336;
}
.Danger:hover {
   background: #e7e7e7;
}
.Default {
   color: black;
}
.Default:hover {
   background: #e7e7e7;
}
</style>
</head>
<body>
<h1>Text Buttons Example</h1>
<button class="Success">Success</button>
<button class="Info">Info</button>
<button class="Warning">Warning</button>
<button class="Danger">Danger</button>
<button class="Default">Default</button>
</body>
</html>
The above code will produce the following output −
Give the examples of a context free language that are not regular?

A context-free grammar (CFG) consisting of a finite set of grammar rules is a quadruple (V, T, P, S)
Where,
V is a variable (non terminals).
V is a variable (non terminals).
T is a set of terminals.
T is a set of terminals.
P is a set of rules, P: V→ (V ∪ T)*, i.e., the left-hand sides of the production rule. P does have any right context or left context.
P is a set of rules, P: V→ (V ∪ T)*, i.e., the left-hand sides of the production rule. P does have any right context or left context.
S is the start symbol.
S is the start symbol.
By using the rules of any language, we can derive any strings in that language.
For language a* CFG is as follows −
S -> aS
S -> ɛ
Here,
S are the variables.
S are the variables.
a and ɛ terminals.
a and ɛ terminals.
S is the start symbol.
S is the start symbol.
By using these rules, we can derive any number of a's.
For Example, consider string aaaaa as CFG as shown below −
S
aS          rule 1
aaS       rule 1
aaaS       rule 1
aaaaS     rule 1
aaaaaS     rule 1
aaaaaɛ     rule 2
aaaaa
Context free language is created by context free grammar and it includes regular languages.
The same context free languages can be generated by multiple context free grammars.
Example 1
Example of language that is not regular but it is context free is { anbn | n >= 0 }
The above example is of all strings that have equal number of a's and b's and the notation a3b3 can be expanded out to aaabbb, where there are three a's and three b's.
The pumping Lemma provides the ability to perform negative test. If the language does not satisfy the pumping lemma, then it can be said that it is not context free. Pumping lemma is mathematical proof which takes time to apply it on context free languages.
Example 2
Consider another example of context free that is not regular.
S -> aSb | ɛ
This example is not regular because we cannot express it with a finite state machine or regular expression. We should be able to count the number of A's and check that number of B's matches. Moreover, it cannot be done with finite state as n could be anything.
Python | Convert key-value pair comma separated string into dictionary

19 Jun, 2020
Given a string, with different key-value pairs separated with commas, the task is to convert that string into the dictionary. These types of problems are common in web development where we fetch arguments from queries or get a response in the form of strings. Given below are a few methods to solve the task.
Method #1: Using dictionary comprehension
# Python3 code to demonstrate # converting comma separated string# into dictionary  # Initialising stringini_string1 = 'name = akshat, course = btech, branch = computer'  # Printing initial stringprint ("Initial String", ini_string1)  # Converting string into dictionary# using dict comprehensionres = dict(item.split("=") for item in ini_string1.split(", "))          # Printing resultant stringprint ("Resultant dictionary", str(res))     
Initial String name = akshat, course = btech, branch = computerResultant dictionary {‘branch ‘: ‘ computer’, ‘name ‘: ‘ akshat’, ‘course ‘: ‘ btech’}
 Method #2: Using Map and lambda
# Python3 code to demonstrate # converting comma separated string# into dictionary  # Initialising stringini_string1 = 'name = akshat, course = btech, branch = computer'  # Printing initial stringprint ("Initial String", ini_string1)  # Converting string into dictionary# using map and lambdares = dict(map(lambda x: x.split('='), ini_string1.split(', ')))          # Printing resultant stringprint ("Resultant dictionary", str(res))     
Initial String name = akshat, course = btech, branch = computerResultant dictionary {‘course ‘: ‘ btech’, ‘name ‘: ‘ akshat’, ‘branch ‘: ‘ computer’}
 Method #3: Using eval() function
# Python3 code to demonstrate # converting comma separated string# into dictionary  # Initialising stringini_string1 = 'name ="akshat", course ="btech", branch ="computer"'  # Printing initial stringprint ("Initial String", ini_string1)  # Converting string into dictionary# using evalres = eval('dict('+ini_string1+')')          # Printing resultant stringprint ("Resultant dictionary", str(res))   
Initial String name =”akshat”, course =”btech”, branch =”computer”Resultant dictionary {‘course’: ‘btech’, ‘name’: ‘akshat’, ‘branch’: ‘computer’}
nidhi_biet
Python dictionary-programs
Python string-programs
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python – Remove suffix from string list

14 Jun, 2022
Sometimes, while working with data, we can have a problem in which we need to filter the strings list in such a way that strings ending with specific suffix are removed. Let’s discuss certain ways in which this task can be performed. 
Method #1 : Using loop + remove() + endswith() The combination of above functions can solve this problem. In this, we remove the elements that end with particular suffix accessed using loop and return the modified list. 
Python3
# Python3 code to demonstrate working of# Suffix removal from String list# using loop + remove() + endswith() # initialize listtest_list = ['allx', 'lovex', 'gfg', 'xit', 'is', 'bestx'] # printing original listprint("The original list : " + str(test_list)) # initialize suffixsuff = 'x' # Suffix removal from String list# using loop + remove() + endswith()for word in test_list[:]:    if word.endswith(suff):        test_list.remove(word) # printing resultprint("List after removal of suffix elements : " + str(test_list))
  Method #2 : Using list comprehension + endswith() This is another way in which this task can be performed. In this, we don’t perform removal in place, instead, we recreate the list without the elements that match the suffix. 
Python3
# Python3 code to demonstrate working of# Suffix removal from String list# using list comprehension + endswith() # initialize listtest_list = ['allx', 'lovex', 'gfg', 'xit', 'is', 'bestx'] # printing original listprint("The original list : " + str(test_list)) # initialize suffsuff = 'x' # Suffix removal from String list# using list comprehension + endswith()res = [ele for ele in test_list if not ele.endswith(suff)] # printing resultprint("List after removal of suffix elements : " + str(res))
Method#3: Using filter function + endswith() This is another way in which task can be performed. In this, we can create new list with the help of filter function which filter out all the string which ends with defined suffix.
Python3
# Python3 code to demonstrate working of# Remove prefix strings from list# using filter + endswith() # initialize suffsuff = 'x' def eva(x):    return not x.endswith(suff)# initialize listtest_list = ['allx', 'lovex', 'gfg', 'xit', 'is', 'bestx'] # printing original listprint("The original list : " + str(test_list)) # Remove prefix strings from list# using filter + endswith()res = list(filter(eva, test_list)) # printing resultprint("List after removal of Kth character of each string : " + str(res))
The original list : ['allx', 'lovex', 'gfg', 'xit', 'is', 'bestx']
List after removal of Kth character of each string : ['gfg', 'xit', 'is']

satyam00so
Python list-programs
Python string-programs
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Matplotlib.pyplot.annotate() in Python

12 Apr, 2020
Matplotlib is a library in Python and it is numerical – mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface.
The annotate() function in pyplot module of matplotlib library is used to annotate the point xy with text s.
Syntax: angle_spectrum(x, Fs=2, Fc=0, window=mlab.window_hanning, pad_to=None, sides=’default’, **kwargs)
Parameters: This method accept the following parameters that are described below:
s: This parameter is the text of the annotation.
xy: This parameter is the point (x, y) to annotate.
xytext: This parameter is an optional parameter. It is The position (x, y) to place the text at.
xycoords: This parameter is also an optional parameter and contains the string value.
textcoords: This parameter contains the string value.Coordinate system that xytext is given, which may be different than the coordinate system used for xy
arrowprops : This parameter is also an optional parameter and contains dict type.Its default value is None.
annotation_clip : This parameter is also an optional parameter and contains boolean value.Its default value is None which behaves as True.
Returns: This method returns the annotation.
Below examples illustrate the matplotlib.pyplot.annotate() function in matplotlib.pyplot:
Example #1:
# Implementation of matplotlib.pyplot.annotate()# function  import matplotlib.pyplot as pltimport numpy as np    fig, geeeks = plt.subplots()  t = np.arange(0.0, 5.0, 0.001)s = np.cos(3 * np.pi * t)line = geeeks.plot(t, s, lw = 2)  # Annotationgeeeks.annotate('Local Max', xy =(3.3, 1),                xytext =(3, 1.8),                 arrowprops = dict(facecolor ='green',                                  shrink = 0.05),)  geeeks.set_ylim(-2, 2)  # Plot the Annotation in the graphplt.show()
Output:
Example #2:
# Implementation of matplotlib.pyplot.annotate()# function  import numpy as npimport matplotlib.pyplot as plt  x = np.arange(0, 10, 0.005)y = np.exp(-x / 3.) * np.sin(3 * np.pi * x)  fig, ax = plt.subplots()ax.plot(x, y)ax.set_xlim(0, 10)ax.set_ylim(-1, 1)  # Setting up the parametersxdata, ydata = 5, 0xdisplay, ydisplay = ax.transData.transform((xdata, ydata))  bbox = dict(boxstyle ="round", fc ="0.8")arrowprops = dict(    arrowstyle = "->",    connectionstyle = "angle, angleA = 0, angleB = 90,\    rad = 10")  offset = 72  # Annotationax.annotate('data = (%.1f, %.1f)'%(xdata, ydata),            (xdata, ydata), xytext =(-2 * offset, offset),            textcoords ='offset points',            bbox = bbox, arrowprops = arrowprops)    disp = ax.annotate('display = (%.1f, %.1f)'%(xdisplay, ydisplay),            (xdisplay, ydisplay), xytext =(0.5 * offset, -offset),            xycoords ='figure pixels',            textcoords ='offset points',            bbox = bbox, arrowprops = arrowprops)  # To display the annotationplt.show()
Output:
Python-matplotlib
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
time.Minutes() Function in Golang With Examples

21 Apr, 2020
In Go language, time packages supplies functionality for determining as well as viewing time. The Minutes() function in Go language is used to find the duration of time in the form of a floating-point number of minutes. Moreover, this function is defined under the time package. Here, you need to import the “time” package in order to use these functions.
Syntax:
func (d Duration) Minutes() float64

Here, d is the duration of time.
Return Value: It returns the duration value as float64.
Example 1:
// Golang program to illustrate the usage of// Minutes() function  // Including main packagepackage main  // Importing fmt and timeimport (    "fmt"    "time")  // Calling mainfunc main() {      // Defining duration     // of Minutes method    min, _ := time.ParseDuration("34h")      // Prints duration as a     // floating point number    fmt.Printf("Only %.1f minutes of"+     " task is remaining.", min.Minutes())}
Output:
Only 2040.0 minutes of task is remaining.

Example 2:
// Golang program to illustrate the usage of// Minutes() function  // Including main packagepackage main  // Importing fmt and timeimport (    "fmt"    "time")  // Calling mainfunc main() {      // Defining duration of    // Minutes method    min, _ := time.ParseDuration("3m4534s64376378ns")      // Prints duration as a    // floating point number    fmt.Printf("Only %.1f minutes of"+     " task is remaining.", min.Minutes())}
Output:
Only 78.6 minutes of task is remaining.

GoLang-time
Go Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
PHP | checkdate() Function

10 Sep, 2021
The checkdate() function is a built-in function in PHP which checks the validity of the date passed in the arguments. It accepts the date in the format mm/dd/yyyy. The function returns a boolean value. It returns true if the date is a valid one, else it returns false.  
Syntax:  
checkdate ( $month, $day, $year )
Parameters: The function accepts three mandatory parameters as shown above and described below:  
$month – This parameter specifies the month. The month has to be in between 1 to 12 for a valid date.$day – This parameter specifies the day. The day can be in range 1-31 depending on the month entered for it to be a valid day. In case of a leap year, the day is in range 1-29 and for a non-leap year the day is in range 1-28.$year – This parameter specifies the year. The year has to be in range 1-32767 inclusive depending on the $month and $day for it to be a valid date.
$month – This parameter specifies the month. The month has to be in between 1 to 12 for a valid date.
$day – This parameter specifies the day. The day can be in range 1-31 depending on the month entered for it to be a valid day. In case of a leap year, the day is in range 1-29 and for a non-leap year the day is in range 1-28.
$year – This parameter specifies the year. The year has to be in range 1-32767 inclusive depending on the $month and $day for it to be a valid date.
Return Value: The function returns a boolean value. It returns true if the passed date is a valid date. It returns false if the passed date is not a valid one. Examples:  
Input : $month = 12 $day = 31 $year = 2017
Output : true

Input : $month = 2 $day = 29 $year = 2016
Output : true 

Input : $month = 2 $day = 29 $year = 2017
Output : false
Below programs illustrate the checkdate() function in PHP :Program 1: The program below check if the date is a valid one or not. 
php
<?php// PHP program to demonstrate the checkdate() function $month = 12;$day = 31;$year = 2017; // returns a boolean value after validation of datevar_dump(checkdate($month, $day, $year)); ?>
Output: 
bool(true)
Program 2: The program below check if the date is a valid one or not in case of a leap year and non-leap year.  
php
<?php// PHP program to demonstrate the checkdate() function// in case of leap year $month = 2;$day = 29;$year = 2016; // returns a boolean value after validation of date// leap yearvar_dump(checkdate($month, $day, $year));  $month = 2;$day = 29;$year = 2017; // returns a boolean value after validation of date// non-leap yearvar_dump(checkdate($month, $day, $year)); ?>
Output:  
bool(true)
bool(false)
PHP is a server-side scripting language designed specifically for web development. You can learn PHP from the ground up by following this PHP Tutorial and PHP Examples.
adnanirshad158
PHP
Web Technologies
PHP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Download music tracks, playlists, albums from Spotify using spotDL

23 Sep, 2021
SpotDL is a cross-platform command-line utility written in Python via which we can download albums, playlists, individual tracks from Spotify. It is open-sourced and made available under the MIT License. It also applies metadata gathered from Spotify such as:
Track Name and Number
Album Name
Album Cover
Artist Name
Genre
Music Label
Release Date
Before installing spotdl make sure that the latest version of python, pip, and FFmpeg is already installed on your machine. To download and configure the above prerequisites, click on the following links.
python 3: To compile and execute the application.
pip: To download and install spotdl on your machine.
FFmpeg: To convert playlist file format such as m3u to an mp3 file.
Now let’s begin with the installation process.
For Windows, open cmd as an administrator and execute:
pip install spotdl
For Linux/Mac, execute the following command in the terminal
sudo pip3 install spotdl
To verify  the installation, run:
spotdl --version
verify version
Open Spotify in your browser and copy the URL of the track you want to download
Replace $url with the URL you just copied and run the following command :
spotdl $url
Open Spotify in your browser and copy the URL of the album you want to download
Replace $url with the URL you just copied and run the following command :
spotdl $url
Open Spotify in your browser and copy the URL of the playlist you want to download
Replace $url with the URL you just copied and run the following command :
spotdl $url
spotdl 'query'
Here, replace query with the name of the song.
spotdl 'path to the .spotdlTrackingFile'
.spotDlTrackingFile are automatically created once the download process starts, and they are deleted after the process gets completed. You can give the path to the .spotDlTrackingFile file in case of a failed/incomplete download and spotdl will automatically resume the incomplete download.
spotdl $trackUrl $albumUrl $playlistUrl 'query' ...
You can chain up multiple download tasks by separating the URL/query with spaces.
For Windows, open cmd as an administrator and execute:
pip uninstall spotdl
For Linux/Mac, execute the following command in the terminal
sudo pip3 install spotdl
Linux-Tools
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to read inputs as integers in C#?

To read inputs as integers in C#, use the Convert.ToInt32() method.
res = Convert.ToInt32(val);
Let us see how −
The Convert.ToInt32 converts the specified string representation of a number to an equivalent 32-bit signed integer.
Firstly, read the console input −
string val;
val = Console.ReadLine();
After reading, convert it to an integer.
int res;
res = Convert.ToInt32(val);
Let us see an example −
 Live Demo
using System;
using System.Collections.Generic;

class Demo {
   static void Main() {
      string val;
      int res;
   
      Console.WriteLine("Input from user: ");
      val = Console.ReadLine();

      // convert to integer
      res = Convert.ToInt32(val);

      // display the line
      Console.WriteLine("Input = {0}", res);
   }
}
Input from user:
Input = 0
The following is the output. The input is entered by the user.
Input from user: 2
Input = 2
Class getDeclaredConstructors() method in Java with Examples - GeeksforGeeks

05 Jun, 2021
The getDeclaredConstructors() method of java.lang.Class class is used to get the constructors of this class, which are the constructors that are private, public, protected or default. The method returns the constructors of this class in the form of array of Constructor objects. Syntax:  
public Constructor[] getDeclaredConstructors()
                      throws SecurityException
Parameter: This method does not accept any parameter.Return Value: This method returns the constructors of this class in the form of an array of Constructor objects. Exception This method throws SecurityException if a security manager is present and the security conditions are not met.Below programs demonstrate the getDeclaredConstructors() method.Example 1: 
Java
// Java program to demonstrate// getDeclaredConstructors() method import java.util.*; public class Test {    public static void main(String[] args)        throws ClassNotFoundException    {         // returns the Class object for this class        Class myClass = Class.forName("Test");         System.out.println("Class represented by myClass: "                           + myClass.toString());         // Get the constructors of myClass        // using getDeclaredConstructors() method        System.out.println(            "DeclaredConstructors of myClass: "            + Arrays.toString(                  myClass.getDeclaredConstructors()));    }}
Class represented by myClass: class Test
DeclaredConstructors of myClass: [public Test()]
 
Example 2: 
Java
// Java program to demonstrate//getDeclaredConstructors() method import java.util.*; class Main {     public Object obj;     private Main()    {         class Arr {        };         obj = new Arr();    }     public static void main(String[] args)        throws ClassNotFoundException    {        // returns the Class object for this class        Class myClass = Class.forName("Main");         System.out.println("Class represented by myClass: "                           + myClass.toString());         // Get the constructors of myClass        // using getDeclaredConstructors() method        System.out.println(            "DeclaredConstructors of myClass: "            + Arrays.toString(                  myClass.getDeclaredConstructors()));    }}
Class represented by myClass: class Main
DeclaredConstructors of myClass: [private Main()]
 
Reference: https://docs.oracle.com/javase/9/docs/api/java/lang/Class.html#getDeclaredConstructors– 
adnanirshad158
Java-Functions
Java-lang package
Java.lang.Class
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Functional Interfaces in Java
Stream In Java
Constructors in Java
Different ways of Reading a text file in Java
Exceptions in Java
Generics in Java
Comparator Interface in Java with Examples
Strings in Java
How to remove an element from ArrayList in Java?
Difference between Abstract Class and Interface in Java
How to convert comma seperated java string to an array.

Yes, use String.split() method to do it. See the example below −
public class Tester {
   public static void main(String[] args) {
      String text = "This,is,a,comma,seperated,string.";
      String[] array = text.split(",");
      for(String value:array) {
         System.out.print(value + " ");
      }
   }
}
This is a comma seperated string.
Difference between mutable and immutable object

In Java, state of the immutable object can’t be modified after it is created b ut definitely reference other objects. They are very useful in multithreading environment because multiple threads can’t change the state of the object so immutable objects are thread safe. Immutable objects are very helpful to avoid temporal coupling and always have failure atomicity.
On the other hand, Mutable objects have fields that can be changed, immutable objects have no fields that can be changed after the object is created.
public final class ImmutableClass {
   private String laptop;
   public String getLaptop() {
      return laptop;
   }
   public ImmutableClass(String laptop) {
      super();
      this.laptop = laptop;
   }
}
public class Main {
   public static void main(String args[]) {
      ImmutableClass immutableClass = new ImmutableClass("Dell");
      System.out.println(immutableClass.getLaptop());
   }
}
public class MuttableClass {
   private String laptop;
   public String getLaptop() {
      return laptop;
   }
   public void setLaptop(String laptop) {
      this.laptop = laptop;
   }
   public MuttableClass(String laptop) {
      super();
      this.laptop = laptop;
   }
}
public class Main {
   public static void main(String args[]) {
      MuttableClass muttableClass = new MuttableClass("Dell");
      System.out.println(muttableClass.getLaptop());
      muttableClass.setLaptop("IBM");
      System.out.println(muttableClass.getLaptop());
   }
}
Angular 10 (blur) Event - GeeksforGeeks

04 Jul, 2021
In this article, we are going to see what is blur event in Angular 10 and how to use it. The blur event is triggered when an element loses its focus.
Syntax:
<input (blur)='functionName()'/>
NgModule: Module used by blur event is:
CommonModule
Approach:
Create an Angular app to be used.
In app.component.ts make a function that triggers on blur event.
In app.component.html make an input element and set blur event.
Serve the angular app using ng serve to see the output.
 
Example 1:
app.component.ts
import { Component } from '@angular/core';  @Component({    selector: 'app-root',    templateUrl: './app.component.html',    styleUrls: ['./app.component.css']})  export class AppComponent {    onBlur(): void {        console.log('Focus Is Lost for this Element');    }}
app.component.html
<br><form>    <input placeholder="Name" (blur) = 'onBlur()'></form>
Output:
Example 2:
app.component.ts
import { Component } from '@angular/core';  @Component({    selector: 'app-root',    templateUrl: './app.component.html',    styleUrls: ['./app.component.css']})  export class AppComponent {    onBlur(): void {        console.log('Focus Is Lost for this Element');    }}
app.component.html
<br><form>    <button  (blur) = 'onBlur()'>Click Here!!</button></form>
Output:
Angular10
AngularJS
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Angular PrimeNG Dropdown Component
Angular PrimeNG Calendar Component
Angular PrimeNG Messages Component
How to make a Bootstrap Modal Popup in Angular 9/8 ?
Angular 10 (focus) Event
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 ?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to Install Scala IDE For Eclipse? - GeeksforGeeks

06 Dec, 2021
In this tutorial, we’ll look at how to set up the Eclipse IDE for Scala. This tutorial is for those who are new to Scala.
Eclipse (Install link) if you don’t know how to install Eclipse then refer to this article.
JDK 11 (you may use JDK 6 onwards)
Note: If you do not have JDK installed, you may get them from this link.
Follow the below steps to install Scala IDE for Eclipse
Step 1: Open the eclipse and click on the “Help” and select “Install New Software”
Step 2: Now click the “Add” button to add the new repository.
Step 3: Add Scala IDE update site, You can use the most recent Scala update site
Step 4: Select Scala IDE for Eclipse to download it, you can choose which Scala IDE you want to download
Step 5: After installation, the system will ask you to restart the Eclipse.
Using the Eclipse IDE, we will create a simple Hello World program in Scala.
Open the Eclipse, click on the menu and click on the “New” ->Scala project.
Give the name to your project.
Create a new Scala Object, File -> New -> Scala Object 
Give your Scala application a name and then click Finish to create the file.
Add code that prints Hello World
Scala
// Scala program to print Hello World!object Geeks{    // Main Method    def main(args: Array[String])    {        // prints Hello World        println("Hello World!")    }}
Output:
how-to-install
Picked
Scala
How To
Installation Guide
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install FFmpeg on Windows?
How to Add External JAR File to an IntelliJ IDEA Project?
How to Set Git Username and Password in GitBash?
How to Install Jupyter Notebook on MacOS?
How to create a nested RecyclerView in Android
Installation of Node.js on Linux
How to Install FFmpeg on Windows?
How to Install Pygame on Windows ?
How to Add External JAR File to an IntelliJ IDEA Project?
How to Install Jupyter Notebook on MacOS?
Reading Images With Python - Tkinter - GeeksforGeeks

20 Oct, 2021
There are numerous tools for designing GUI (Graphical User Interface) in Python such as tkinter, wxPython, JPython, etc where Tkinter is the standard Python GUI library, it provides a simple and efficient way to create GUI applications in Python.
In order to do various operations and manipulations on images, we require Python Pillow package. If the Pillow package is not present in the system then it can be installed using the below command.
In Command prompt:pip install Pillow
pip install Pillow
In Anaconda prompt:conda install -c anaconda pillow
conda install -c anaconda pillow
Example 1: The below program demonstrates how to read images with tkinter using PIL.
# importing required packagesimport tkinterfrom PIL import ImageTk, Imageimport os  # creating main windowroot = tkinter.Tk()  # loading the imageimg = ImageTk.PhotoImage(Image.open("gfg.jpeg"))  # reading the imagepanel = tkinter.Label(root, image = img)  # setting the applicationpanel.pack(side = "bottom", fill = "both",           expand = "yes")  # running the applicationroot.mainloop()
Output:
In the above program, an image is loaded using the PhotoImage() method and then it is read by using the Label() method.The pack() method arranges the main window and the mainloop() function is used to run the application in an infinite loop.
Example 2: Let us look at another example where we arrange the image parameters along with application parameters.
# importing required packagesimport tkinter  from PIL import ImageTk, Image    # creating main windowroot = tkinter.Tk()    # arranging application parameterscanvas = tkinter.Canvas(root, width = 500,                         height = 250)    canvas.pack()    # loading the imageimg = ImageTk.PhotoImage(Image.open("gfg.ppm"))    # arranging image parameters # in the applicationcanvas.create_image(135, 20, anchor = NW,                   image = img)   # running the applicationroot.mainloop() 
Output:
In the above program, the application parameters are handled by using the Canvas() method and the image parameters are handled using create_image() method such that the image gfg.ppm is displayed in the main window having defined height and width.Note: The Canvas method create_image(x0,y0, options ...) is used to draw an image on a canvas. create_image doesn’t accept an image directly. It uses an object which is created by the PhotoImage() method. The PhotoImage class can only read GIF and PGM/PPM images from files.
Python-gui
Python-tkinter
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Read a file line by line in Python
How to Install PIP on Windows ?
Enumerate() in Python
Different ways to create Pandas Dataframe
Iterate over a list in Python
Python String | replace()
*args and **kwargs in Python
Reading and Writing to text files in Python
Create a Pandas DataFrame from Lists
Upload Progress Bar in PHP - GeeksforGeeks

17 Jul, 2019
XAMPP is a free and open source cross-platform web server solution stack package developed by Apache which allows a web application to be easily tested on the local web server. But when it comes to uploading files to the server using PHP it is a headache. In most of the cases, PHP servers do not allow to upload files bigger than 30 MegaByte (30MB).
Using PHP only we can not create a progress bar interface as PHP would not provide a response until the upload is done. So to create a progress bar interface we have to use JavaScript along with PHP.
Change the limit of file upload size:Edit php.ini file to change the upload file size on ther server. To ensure that file upload works correctly, the post_max_size directive should be a little larger than the upload_max_filesize. For example, the following settings demonstrate how to set a file upload limit to 100 megabytes:
upload_max_filesize = 100M
post_max_size = 101M

Now, What if your hosting provider does not allow you to access the “php.ini” file?In this case, it is suggested to use JavaScript to upload your big file to the server in small blobs. JavaScript will break your local file into multiple files and it will try to upload the files to the server. Here you have to keep in mind that your blob size must not exceed the upload size limit of your PHP hosting.
Steps to run Upload ProgressBar Project:
Download complete project from Github.
Use Winrar to extract the zipped file.
Save the extracted file in XAMPP htdocs folder.
Run XAMPP server.
Now, open browser tab and type localhost/geeks/index.php or localhost/geeks on the address bar. It will display the output.
Picked
PHP
PHP Programs
Web Technologies
Web technologies Questions
PHP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to convert array to string in PHP ?
Split a comma delimited string into an array in PHP
How to declare a global variable in PHP?
How to fetch data from localserver database and display on HTML table using PHP ?
Removing Array Element and Re-Indexing in PHP
How to convert array to string in PHP ?
How to call PHP function on the click of a Button ?
Split a comma delimited string into an array in PHP
How to declare a global variable in PHP?
How to fetch data from localserver database and display on HTML table using PHP ?
Scala Set count() method with example - GeeksforGeeks

15 Oct, 2019
The count() method is utilized to count the number of elements in the set.
Method Definition: def count(p: (A) => Boolean): Int
Return Type: It returns the number of elements present in the set.
Example #1:
// Scala program of count()// method  // Creating object object GfG {       // Main method     def main(args:Array[String])     {               // Creating sets         val s1 = Set(1, 2, 3, 4, 5)                   // Applying count method         val result = s1.count(z=>true)                   // Displays output         println(result)           } } 
5

Example #2:
// Scala program of count()// method  // Creating object object GfG {       // Main method     def main(args:Array[String])     {               // Creating sets         val s1 = Set()                   // Applying count method         val result = s1.count(z=>true)                   // Displays output         println(result)           } } 
0

Scala
scala-collection
Scala-Method
Scala-Set
Scala
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Inheritance in Scala
Scala | Traits
Scala ListBuffer
Scala | Case Class and Case Object
Hello World in Scala
Scala | Functions - Basics
Scala | Decision Making (if, if-else, Nested if-else, if-else if)
Scala List map() method with example
Comments In Scala
Abstract Classes in Scala
Display Hostname and IP address in Python - GeeksforGeeks

05 Oct, 2021
There are many ways to find hostname and IP address of a local machine. Here is a simple method to find hostname and IP address using python code. Library used – socket: This module provides access to the BSD socket interface. It is available on all modern Unix systems, Windows, MacOS, and probably additional platforms. Method used : 
gethostname() : The gethostname function retrieves the standard host name for the local computer.
gethostbyname() : The gethostbyname function retrieves host information corresponding to a host name from a host database. 
Python3
# Python3 code to display hostname and# IP address # Importing socket libraryimport socket # Function to display hostname and# IP addressdef get_Host_name_IP():    try:        host_name = socket.gethostname()        host_ip = socket.gethostbyname(host_name)        print("Hostname :  ",host_name)        print("IP : ",host_ip)    except:        print("Unable to get Hostname and IP") # Driver codeget_Host_name_IP() #Function call #This code is contributed by "Sharad_Bhardwaj".
Output: 
Hostname :   pppContainer
IP :  10.98.162.168
NOTE : Output varies machine to machine. 
sagar0719kumar
Computer Networks-IP Addressing
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
How to Install PIP on Windows ?
Enumerate() in Python
Different ways to create Pandas Dataframe
Iterate over a list in Python
Python String | replace()
*args and **kwargs in Python
Reading and Writing to text files in Python
Create a Pandas DataFrame from Lists
Convert integer to string in Python
Mixture and Alligation | Set 2 - GeeksforGeeks

08 Sep, 2021
Question 1: 30 litres of a mixture of milk and water contains 10% of water, the water to be added, to make the water content 25% in the new mixture. Find how many litres water will be added? Solution : Water in the 30 litre of mixture = 30 x 10/100 = 3 litres Milk in the mixture = 30 – 3 = 27 litres Let x litres of water is mixed. Acc. to question (3 + x)/(30 + x) = 25/100 4(3 + x) = 30 + x 12 + 4x = 30 + x 3x = 18 x = 6 Hence, 6 litres of water to be added in the mixture. 
Alternate :  
Question 2: 25000 students appeared in an exam. 60% of the boys and 40% of the girls cleared the examination. If the total percent of students qualifying is 55%, how many girls appeared in the exam? Solution : By alligation method  
4 -> 25000 1 -> 6250 Hence, number of girls passed in the exam is 6250. 
Question 3: In what ratio must a shopkeeper mix sugar at Rs 30/kg and Rs 32.5/kg, so that by selling the mixture at Rs 34.1/kg he may gain 10%. Solution : Acc. to question SP of 1 kg of mixture = Rs 34.1 Profit = 10% = 10/100 = 1/10 SP = 1 + 10 = 11 unit 11 units ->34.1 1 unit -> 3.1 10 unit -> 31 We obtain the CP of the mixture Rs 31. To obtain the ratio use alligation method  
Hence, the ratio in which he mixed is 3:2 
Question 4: Two vessels A and B contain mixture of milk and water in ratios 3:4 and 4:1 respectively. In what ratio should quantities of mixture be taken from A and B to form a mixture in which milk to water is in the ratio 5:2? Solution :Acc. to question  
                   Milk        Water        total
Mixture A          3x5     :    4x5      ->    7       LCM(7, 5, 7)=35
Mixture B          4x7     :    1x7      ->    5 
Final mixture      5x5     :    2x5      ->    7
To make quantity equal of both multiply with 7 and 5 respectively.  
                   Milk       Water          
Mixture A          15     :    20      
Mixture B          28     :    7    
Final mixture      25     :    10    
To obtain the ratio in which A and B mixed we apply alligation rule  
Hence, the required ratio is 3:10. 
Question 5: 40 kg of an alloy mixed with 100 kg of alloy B. If alloy A has lead and copper in the ratio 3:2 and alloy B has copper and tin in the ratio 1:3., then the amount of copper in the new alloy is Solution :Alloy A 40 kg contains lead and copper in ratio 3:2 So, 3+2 = 5 5 unit -> 40 1 unit -> 8 2 unit -> 16 Amount of copper in alloy A is 16 kg. Alloy B contains copper and tin in ratio 1:3 So, 1+3 = 4 4 unit -> 100 1 -> 25 Amount of copper in alloy B is 25 kg Hence, amount of copper in the new alloy is 16 + 25 = 41 kg. 
rajeev0719singh
Placements
QA - Placements
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Top 20 Puzzles Commonly Asked During SDE Interviews
Codenation Recruitment Process
Minimum changes required to make all Array elements Prime
Permutation and Combination
Interview Preparation
Permutation and Combination
Problem on Numbers
Probability
Clocks
Problems on Work and Wages
Bootstrap - Jumbotron

This chapter will discuss one more feature that Bootstrap supports, the Jumbotron. As the name suggest this component can optionally increase the size of headings and add a lot of margin for landing page content. To use the Jumbotron −
Create a container <div> with the class of .jumbotron.
Create a container <div> with the class of .jumbotron.
In addition to a larger <h1>, the font-weight is reduced to 200px.
In addition to a larger <h1>, the font-weight is reduced to 200px.
The following example demonstrates this −
<div class = "container">

   <div class = "jumbotron">
      <h1>Welcome to landing page!</h1>
      <p>This is an example for jumbotron.</p>
      
      <p>
         <a class = "btn btn-primary btn-lg" role = "button">Learn more</a>
      </p>
   </div>
   
</div>
This is an example for jumbotron.

               Learn more

To get a jumbotron of full width, and without rounded corners use the  .jumbotron class outside all .container classes and instead add a .container within, as shown in the following example −
<div class = "jumbotron">
   
   <div class = "container">
      <h1>Welcome to landing page!</h1>
      <p>This is an example for jumbotron.</p>
      
      <p>
         <a class = "btn btn-primary btn-lg" role = "button">Learn more</a>
      </p>
   </div>
   
</div>
This is an example for jumbotron.

               Learn more


    26 Lectures 
     2 hours 

 Anadi Sharma

    54 Lectures 
     4.5 hours 

 Frahaan Hussain

    161 Lectures 
     14.5 hours 

 Eduonix Learning Solutions

    20 Lectures 
     4 hours 

 Azaz Patel

    15 Lectures 
     1.5 hours 

 Muhammad Ismail

    62 Lectures 
     8 hours 

 Yossef Ayman Zedan
 Print
 Add Notes
 Bookmark this page
MySQL query to display structure of a table

To display structure of a table, following is the syntax −
show create table yourTableName;
Let us first create a table −
mysql> create table DemoTable
   -> (
   -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,
   -> EmployeeFirstName varchar(100),
   -> EmployeeLastName varchar(100),
   -> EmployeeAge int,
   -> isMarried tinyint(1),
   -> EmployeeAddress varchar(100),
   -> EmployeeCountryName varchar(100)
   -> );
Query OK, 0 rows affected (0.62 sec)
Here is the query to display structure −
mysql> show create table DemoTable;
This will produce the following output −
+--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table        | Create Table                      
|
+--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| DemoTable | CREATE TABLE `DemoTable` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `EmployeeFirstName` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
  `EmployeeLastName` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
  `EmployeeAge` int(11) DEFAULT NULL,
  `isMarried` tinyint(1) DEFAULT NULL,
  `EmployeeAddress` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
  `EmployeeCountryName` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci |
+--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
How to extract data from a Matplotlib plot?

To extract data from a plot in matplotlib, we can use get_xdata() and get_ydata() methods.
Set the figure size and adjust the padding between and around the subplots.
Create y data points using numpy.
Plot y data points with color=red and linewidth=5.
Print a statment for data extraction.
Use get_xdata() and get_ydata() methods to extract the data from the plot (step 3).
Print x and y data (Step 5).
To display the figure, use show() method.
import numpy as np
from matplotlib import pyplot as plt
plt.rcParams["figure.figsize"] = [7.50, 3.50]
plt.rcParams["figure.autolayout"] = True
y = np.array([1, 3, 2, 5, 2, 3, 1])
curve, = plt.plot(y, c='red', lw=5)
print("Extracting data from plot....")
xdata = curve.get_xdata()
ydata = curve.get_ydata()
print("X data points for the plot is: ", xdata)
print("Y data points for the plot is: ", ydata)
plt.show()
Extracting data from plot....
X data points for the plot is: [0. 1. 2. 3. 4. 5. 6.]
Y data points for the plot is: [1 3 2 5 2 3 1]