code-rag-bench/online-tutorials huggingface dataset:
Angular Material 7 - Icons

The <mat-icon>, an Angular Directive, is used to add a vector/svg based icon with material styling.
In this chapter, we will showcase the configuration required to draw a icon control using Angular Material.
Follow the following steps to update the Angular application we created in Angular 6 - Project Setup chapter −
Following is the content of the modified module descriptor app.module.ts.
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import {MatIconModule} from '@angular/material'
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
@NgModule({
   declarations: [
      AppComponent
   ],
   imports: [
      BrowserModule,
      BrowserAnimationsModule,
      MatIconModule,
      FormsModule,
      ReactiveFormsModule
   ],
   providers: [],
   bootstrap: [AppComponent]
})
export class AppModule { }
Following is the content of the modified HTML host file app.component.html.
<mat-icon>home</mat-icon>
Verify the result.
Here, we've created home icon using mat-icon. We're using google material icons.

    16 Lectures 
     1.5 hours 

 Anadi Sharma

    28 Lectures 
     2.5 hours 

 Anadi Sharma

    11 Lectures 
     7.5 hours 

 SHIVPRASAD KOIRALA

    16 Lectures 
     2.5 hours 

 Frahaan Hussain

    69 Lectures 
     5 hours 

 Senol Atac

    53 Lectures 
     3.5 hours 

 Senol Atac
 Print
 Add Notes
 Bookmark this page
select command in Linux with examples - GeeksforGeeks

27 May, 2019
select command in Linux is used to create a numbered menu from which a user can select an option. If the user enters a valid option then it executes the set of command written in select block and then ask again to enter a number, if a wrong option is entered it does nothing. If user enters nothing and simply press ‘enter‘ the option menu gets printed.
Syntax:
select NAME [in WORDS ... ;] do COMMANDS; done
Example:
Options:
help select : It displays help information.
linux-command
Linux-misc-commands
Linux-Unix
Technical Scripter
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
tar command in Linux with examples
Conditional Statements | Shell Script
UDP Server-Client implementation in C
Tail command in Linux with examples
Cat command in Linux with examples
touch command in Linux with Examples
echo command in Linux with Examples
Compiling with g++
scp command in Linux with Examples
ps command in Linux with Examples
HTML <address> Tag - GeeksforGeeks

17 Mar, 2022
The <address> tag in HTML indicates the contact information of a person or an organization. If <address> tag is used inside the <body> tag then it represents the contact information of the document and if the <address> tag is used inside the <article> tag, then it represents the contact information of the article. The text inside the <address> tag will display in italic format. Some browsers add a line break before and after the address element.
Syntax: 
<address> Address... </address>
Example: 
html
<!DOCTYPE html><html><body>              <!-- address tag starts from here -->     <address>         Organization Name: GeeksforGeeks <br>         Web Site:         <a href="https://www.geeksforgeeks.org/about/contact-us/">         GeeksforGeeks</a><br>         visit us:<br>         GeeksforGeeks<br>         710-B, Advant Navis Business Park, <br>         Sector-142, Noida Uttar Pradesh – 201305     </address>     <!-- address tag ends here --> </body></html>                   
Output:  
Supported Browsers: 
Google Chrome
Internet Explorer
Firefox
Opera
Safari
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.
shubhamyadav4
vshylaja
HTML-Tags
Picked
HTML
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to insert spaces/tabs in text using HTML/CSS?
How to update Node.js and NPM to next version ?
How to set the default value for an HTML <select> element ?
Hide or show elements in HTML using display property
How to set input type date in dd-mm-yyyy format using HTML ?
How to Insert Form Data into Database using PHP ?
REST API (Introduction)
CSS to put icon inside an input element in a form
Types of CSS (Cascading Style Sheet)
What is Stored Procedures in SQL ? - GeeksforGeeks

20 May, 2021
Stored Procedures are created to perform one or more DML operations on Database. It is nothing but the group of SQL statements that accepts some input in the form of parameters and performs some task and may or may not returns a value. 
Syntax : Creating a Procedure  
CREATE or REPLACE PROCEDURE name(parameters)
IS
variables;
BEGIN
//statements;
END;
The most important part is parameters. Parameters are used to pass values to the Procedure. There are 3 different types of parameters, they are as follows:  
IN: This is the Default Parameter for the procedure. It always receives the values from calling program.OUT: This parameter always sends the values to the calling program.IN OUT: This parameter performs both the operations. It Receives value from as well as sends the values to the calling program.
IN: This is the Default Parameter for the procedure. It always receives the values from calling program.
OUT: This parameter always sends the values to the calling program.
IN OUT: This parameter performs both the operations. It Receives value from as well as sends the values to the calling program.
Example: Imagine a table named with emp_table stored in Database. We are Writing a Procedure to update a Salary of Employee with 1000.  
CREATE or REPLACE PROCEDURE INC_SAL(eno IN NUMBER, up_sal OUT NUMBER)
IS
BEGIN
UPDATE emp_table SET salary = salary+1000 WHERE emp_no = eno;
COMMIT;
SELECT sal INTO up_sal FROM emp_table WHERE emp_no = eno;
END; 
 
Declare a Variable to Store the value coming out from Procedure :  
VARIABLE v NUMBER;
 
Execution of the Procedure:  
EXECUTE INC_SAL(1002, :v);
 
To check the updated salary use SELECT statement:  
 SELECT * FROM emp_table WHERE emp_no = 1002;
 
or Use print statement :  
PRINT :v
 
adnanirshad158
DBMS
SQL
DBMS
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
SQL Interview Questions
CTE in SQL
Difference between Clustered and Non-clustered index
Data Preprocessing in Data Mining
Difference between SQL and NoSQL
SQL | DDL, DQL, DML, DCL and TCL Commands
How to find Nth highest salary from a table
SQL | ALTER (RENAME)
SQL Interview Questions
CTE in SQL
Constants vs Variables in C language - GeeksforGeeks

28 Jun, 2019
As the name suggests the name constants is given to such variables or values in C programming language which cannot be modified once they are defined. They are fixed values in a program. There can be any types of constants like integer, float, octal, hexadecimal, character constants etc. Every constant has some range. The integers that are too big to fit into an int will be taken as a long. Now there are various ranges that differ from unsigned to signed bits. Under the signed bit, the range of an int varies from -128 to +127 and under the unsigned bit, int varies from 0 to 255.
Example:
#include <stdio.h>  // Constants#define val 10#define floatVal 4.5#define charVal 'G'  // Driver codeint main(){    printf("Integer Constant: %d\n", val);    printf("Floating point Constant: %f\n", floatVal);    printf("Character Constant: %c\n", charVal);      return 0;}
Integer Constant: 10
Floating point Constant: 4.500000
Character Constant: G

A variable in simple terms is a storage place which has some memory allocated to it. Basically, a variable used to store some form of data. Different types of variables require different amounts of memory and have some specific set of operations which can be applied to them.
Variable Declaration:A typical variable declaration is of the form:
type variable_name;

or for multiple variables:
type variable1_name, variable2_name, variable3_name;

A variable name can consist of alphabets (both upper and lower case), numbers and the underscore ‘_’ character. However, the name must not start with a number.
Example:
#include <stdio.h>int main(){    // declaration and definition of variable 'a123'    char a123 = 'a';      // This is also both declaration    // and definition as 'b' is allocated    // memory and assigned some garbage value.    float b;      // multiple declarations and definitions    int _c, _d45, e;      // Let us print a variable    printf("%c \n", a123);      return 0;}
a

C Basics
C Language
Difference Between
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Multidimensional Arrays in C / C++
Left Shift and Right Shift Operators in C/C++
Function Pointer in C
Substring in C++
rand() and srand() in C/C++
Difference between BFS and DFS
Class method vs Static method in Python
Differences between TCP and UDP
Difference between var, let and const keywords in JavaScript
Differences between IPv4 and IPv6
UNIX - GeeksforGeeks

03 Oct, 2019
ln -s file 1 file 2
ln -s file 2 file 3
find -name passwd -print
find –name “filename” –print
grep name “filename”
permission for owner
permission for group
permission for othersFor more information on UNIX OS Refer:Operating System | Unix File System
Both (a) and (b) are coreect.
So, option (C) is correct.
In UNIX Wait() is used to WaitForSingleObject() .In UNIX Fork() is used for create-process().In UNIX Create() is used for CreateFile().In UNIX Close() is used for CloseHandle()So, option (A) is correct.
In UNIX Wait() is used to WaitForSingleObject() .
In UNIX Fork() is used for create-process().
In UNIX Create() is used for CreateFile().
In UNIX Close() is used for CloseHandle()So, option (A) is correct.
process id (PID) = 1It is generally the parent of the login shell."init" forks and execs a ‘getty’ process at every port connected to a terminal.But it is not the first process in the systemSo, option (C) is correct.
process id (PID) = 1
It is generally the parent of the login shell.
"init" forks and execs a ‘getty’ process at every port connected to a terminal.
But it is not the first process in the systemSo, option (C) is correct.
w vi command in unix saves file and remains in editing mode.x vi command in unix saves the file and quits editing modeq vi command in unix quits editing mode and no changes are saved to the filesh vi command in unix escapes unix shellSo, option (D) is correct.
w vi command in unix saves file and remains in editing mode.
x vi command in unix saves the file and quits editing mode
q vi command in unix quits editing mode and no changes are saved to the file
sh vi command in unix escapes unix shellSo, option (D) is correct.
Writing code in comment? Please use ide.geeksforgeeks.org, generate link and share the link here.
Best Time to Buy and Sell Stock
Must Do Coding Questions for Product Based Companies
How to Convert Categorical Variable to Numeric in Pandas?
How to Replace Values in Column Based on Condition in Pandas?
C Program to read contents of Whole File
Insert Image in a Jupyter Notebook
How to Replace Values in a List in Python?
How to Read Text Files with Pandas?
How to Compare Two Columns in Pandas?
Python Data Structures and Algorithms
Python | Interval Initialization in list - GeeksforGeeks

20 Feb, 2019
There are numerous ways to initialize the list with the elements, but sometimes, its required to initialize the lists with the numbers in a sliced way. This can be custom and hence knowledge of this can come handy. Let’s discuss certain ways in which this can be done.
Method #1 : Using list comprehension + enumerate()The list comprehension can do the possible iteration part and enumerate can help in the part of logic and checking for the valid elements required in the list.
# Python3 code to demonstrate # interval initializing in list # using list comprehension + enumerate()  # initializing liststest_list = list(range(50))  # printing original listprint ("The original list is : " + str(test_list))  # interval elementsN = 5  # interval differenceK = 15  # using list comprehension + enumerate()# interval initializing in list res =  [i for j, i in enumerate(test_list) if j % K < N ]      # printing result print ("The modified initialized list : " +  str(res))
Output :
The original list is : [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49]The modified initialized list : [0, 1, 2, 3, 4, 15, 16, 17, 18, 19, 30, 31, 32, 33, 34, 45, 46, 47, 48, 49]
 
Method #2 : Using itertools.compress() + itertools.cycle()The above two function can combine to facilitate the solution of the discussed problem. The cycle function can to the task of repetition and the compress function can be beneficial when it comes to clubbing the segments together.
# Python3 code to demonstrate # interval initializing in list # using itertools.compress() + itertools.cycle()from itertools import compress, cycle   # initializing liststest_list = list(range(50))  # printing original listprint ("The original list is : " + str(test_list))  # interval elementsN = 5  # interval differenceK = 15  # using itertools.compress() + itertools.cycle()# interval initializing in list func = cycle([True] * N + [False] * (K - N))res = list(compress(test_list, func))      # printing result print ("The modified initialized list : " +  str(res))
Output :
The original list is : [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49]The modified initialized list : [0, 1, 2, 3, 4, 15, 16, 17, 18, 19, 30, 31, 32, 33, 34, 45, 46, 47, 48, 49]
Python list-programs
python-list
Python
Python Programs
python-list
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
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 program to convert a list to string
Defaultdict in Python
Python | Get dictionary keys as a list
Python | Split string into list of characters
Python | Convert a list to dictionary
Python | Count tuples occurrence in list of tuples - GeeksforGeeks

03 Apr, 2019
Many a time while developing web and desktop product in Python, we use nested lists and have several queries about how to find count of unique tuples. Let’s see how to get count of unique tuples in given list of tuples.
Below are some ways to achieve the above task.
Method #1: Using Iteration
# Python code to count unique # tuples in list of list  import collections Output = collections.defaultdict(int)  # List initializationInput = [[('hi', 'bye')], [('Geeks', 'forGeeks')],         [('a', 'b')], [('hi', 'bye')], [('a', 'b')]]  # Using iterationfor elem in Input:      Output[elem[0]] += 1      # Printing outputprint(Output)
defaultdict(<class 'int'>, {('Geeks', 'forGeeks'): 1, ('hi', 'bye'): 2, ('a', 'b'): 2})

 
Method #2: Using chain and Counter
# Python code to count unique # tuples in list of list  # Importingfrom collections import Counterfrom itertools import chain  # List initializationInput = [[('hi', 'bye')], [('Geeks', 'forGeeks')],         [('a', 'b')], [('hi', 'bye')], [('a', 'b')]]  # Using counter and chainOutput = Counter(chain(*Input))  # Printing outputprint(Output)
Counter({('hi', 'bye'): 2, ('a', 'b'): 2, ('Geeks', 'forGeeks'): 1})

Python tuple-programs
Python
Python Programs
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
Python program to convert a list to string
Defaultdict in Python
Python | Get dictionary keys as a list
Python | Split string into list of characters
Python | Convert a list to dictionary
How to get current year in PHP ? - GeeksforGeeks

31 Jul, 2021
The Date is an inbuilt function used to format the timestamp. The computer stores date and time in UNIX Timestamp. This time is measured as a number of seconds since Jan 1, 1970. Since this is impractical for humans to read, PHP converts timestamp to a format that is readable and more understandable to humans.
Syntax:
date( format, timestamp )
Explanation:
The format parameter in the date() function specifies the format of returned date and time.
The timestamp is an optional parameter. If it is not included then the current date and time will be used.
In order to get the current year as four digits, Y is used as a parameter to date() function as shown in the below:
Program:
<?php // PHP program to get the// current year  echo "Current Year is :";   // Store the year to// the variable$year = date("Y");   // Display the yearecho $year;   ?> 
Current Year is :2019

Format options available in date() function: The format parameter of the date() function is a string that can contain multiple characters allowing to generate dates in various formats are listed below:
d – Represents the day of the month. It uses two digits with leading zeros (01 or 31).
D – Represents day of the week in the text (Mon to Sun).
m – Represents month in numbers with leading zeros (01 or 12).
M – Represents month in text, abbreviated (Jan to Dec).
y – Represents year in two digits (08 or 14).
Y – Represents year in four digits (2008 or 2014).
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.
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 Insert Form Data into Database using PHP ?
How to convert array to string in PHP ?
How to check whether an array is empty using PHP?
PHP | Converting string to Date and DateTime
Comparing two dates in PHP
How to Insert Form Data into Database using PHP ?
How to convert array to string in PHP ?
How to call PHP function on the click of a Button ?
How to check whether an array is empty using PHP?
Comparing two dates in PHP
How do I generate random integers within a specific range in Java? - GeeksforGeeks

27 Dec, 2019
Given two numbers Min and Max, the task is to generate a random integer within this specific range in Java.
Examples:
Input: Min = 1, Max = 100
Output: 89

Input: Min = 100, Max = 899
Output: 514

Approach:
Get the Min and Max which are the specified range.
Call the nextInt() method of ThreadLocalRandom class (java.util.concurrent.ThreadLocalRandom) and specify the Min and Max value as the parameter asThreadLocalRandom.current().nextInt(min, max + 1);
ThreadLocalRandom.current().nextInt(min, max + 1);
Return the received random value
// Java program to generate a random integer// within this specific range  import java.util.concurrent.ThreadLocalRandom;  class GFG {      public static int getRandomValue(int Min, int Max)    {          // Get and return the random integer        // within Min and Max        return ThreadLocalRandom            .current()            .nextInt(Min, Max + 1);    }      // Driver code    public static void main(String[] args)    {          int Min = 1, Max = 100;          System.out.println("Random value between "                           + Min + " and " + Max + ": "                           + getRandomValue(Min, Max));    }}
Random value between 1 and 100: 35

Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Object Oriented Programming (OOPs) Concept in Java
HashMap in Java with Examples
Stream In Java
Interfaces in Java
How to iterate any Map in Java
ArrayList in Java
Initialize an ArrayList in Java
Stack Class in Java
Multidimensional Arrays in Java
Singleton Class in Java
Check for a Pattern in the Vector in R Programming - grepl() Function - GeeksforGeeks

24 Jun, 2020
grepl() function in R Language is used to return the value True if the specified pattern is found in the vector and false if it is not found.
Syntax: grepl(pattern, string, ignore.case=FALSE)
Parameters:pattern: regular expressions patternstring: character vector to be searchedignore.case: whether to ignore case in the search. Here ignore.case is an optional parameter as is set to FALSE by default.
Example 1:
# R program to illustrate# grepl function  # Initializing a character vectorstr <- c("GFG", "gfg", "Geek", "Geeks")   # Calling the grepl() function to# find whether any instance(s) of# ‘GF’ and 'G' are present in the stringgrepl('GF', str, ignore.case ="True") grepl('G', str, ignore.case ="True") 
Output:
[1]  TRUE  TRUE FALSE FALSE
[1] TRUE TRUE TRUE TRUE

Example 2:
# R program to illustrate# grepl function  # Initializing a character vectorstr <- c("GFG", "gfg", "Geek", "Geeks")   # Calling the grepl() function to# find whether any instance(s) of# ‘gfg’ and 'Geek' are present in the stringgrepl('gfg', str) grepl('Geek', str) 
Output:
[1] FALSE  TRUE FALSE FALSE
[1] FALSE FALSE  TRUE  TRUE

R String-Functions
R Vector-Function
R Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Change Color of Bars in Barchart using ggplot2 in R
Group by function in R using Dplyr
How to Change Axis Scales in R Plots?
How to Split Column Into Multiple Columns in R DataFrame?
Replace Specific Characters in String in R
How to filter R DataFrame by values in a column?
How to import an Excel File into R ?
Time Series Analysis in R
R - if statement
How to filter R dataframe by multiple conditions?
Spacing between boxplots in ggplot2 in R - GeeksforGeeks

18 Jul, 2021
In this article, we are going to see how to add space between the boxplots in ggplot2 using R programming language.
Dataset in use: Crop_recommendation
Here we will use width attributes to define space between the boxplot. In this the value is passed to the attribute.
Syntax: geom_boxplot(width)
Program:
R
library(ggplot2)  # loading data set and storing it in ds variabledf <- read.csv("Crop_recommendation.csv", header = TRUE)  # create a boxplot by using geom_boxplot() function# of ggplot2 packageplot = ggplot(data=df,              mapping=aes(                x=label, y=temperature))+geom_boxplot(width = 0.5)plot 
Output:
Here we will use position_dodge to define the vertical position of a geom while adjusting the horizontal position. position_dodge() requires the grouping variable to be specified position.
Syntax: 
geom_boxplot( position = position_dodge(width))
Program:
Python3
library(ggplot2)  # loading data set and storing it in ds variabledf <- read.csv("Crop_recommendation.csv", header = TRUE)  # create a boxplot by using geom_boxplot() function# of ggplot2 packageplot= ggplot(data=df,             mapping=aes(x=label,                          y=temperature))+geom_boxplot(width=0.1, position = position_dodge(width=0.5))plot
Output:
Picked
R-ggplot
R Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Change Color of Bars in Barchart using ggplot2 in R
Group by function in R using Dplyr
How to Change Axis Scales in R Plots?
How to Split Column Into Multiple Columns in R DataFrame?
Replace Specific Characters in String in R
How to filter R DataFrame by values in a column?
How to import an Excel File into R ?
Time Series Analysis in R
R - if statement
How to filter R dataframe by multiple conditions?
Ruby Integer even? function with example - GeeksforGeeks

24 Jun, 2020
The even? function in Ruby returns a boolean value. It returns true if the number is even, else it returns false.
Syntax: number.even?
Parameter: The function takes the integer which is to be checked for even or not.
Return Value: The function returns a boolean value which determines if the value is even or not.
Example #1:
# Ruby program of Integer even? function  # Initializing the numbers num1 = 19num2 = 2num3 = 28num4 = 13   # Prints the integer division # and its remainder puts num1.even? puts num2.even?puts num3.even? puts num4.even?
Output:
false
true
true
false

Example #2:
# Ruby program of Integer even? function  # Initializing the numbers num1 = 18num2 = 200num3 = 2987num4 = 13   # Prints the integer division # and its remainder puts num1.even? puts num2.even?puts num3.even? puts num4.even?
Output:
true
true
false
false

Akanksha_Rai
Ruby Integer-class
Ruby-Methods
Ruby
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Ruby | Types of Variables
Ruby | Enumerator each_with_index function
Ruby | Decision Making (if, if-else, if-else-if, ternary) | Set - 1
Ruby For Beginners
Ruby Mixins
Ruby | Array collect() operation
Ruby | Array shift() function
Ruby | String concat Method
Ruby | unless Statement and unless Modifier
Ruby | Module
getent command in Linux with examples - GeeksforGeeks

20 May, 2019
getent is a Linux command that helps the user to get the entries in a number of important text files called databases. This includes the passwd and the group of databases which stores the user information. Hence getent is a common way to look up in user details on Linux. Since getent uses the same name of service as the system, getent will be going to show all information, including that gained from the network information sources such as LDAP. The databases it usually searches in are: ahosts, ahostsv4, ahostsv6, aliases, ethers (Ethernet addresses), group, gshadow, hosts, netgroup, networks, passwd, protocols, rpc, services, and shadow.
Example 1: Fetch the list of user accounts on a Linux system (stored in a database known as ‘passwd’). This will show all the user accounts, regardless of the type of name service being used. For example, if both the local and the LDAP name service are used for user accounts, the results will include all the local and the LDAP users:
Syntax:
getent database [key ...]
Example 2: If we want to fetch details for a particular user called rahul then
Syntax:
getent passwd rahul
Example 3: If we want to fetch a list of group accounts on a Unix system (stored in a database called ‘group’) then
Syntax:
getent group
Options:
-s service, --service service: This option overrides all the databases with the specified service.(Since glibc 2.2.5.)
-s database:service, --service database:service: This option override only the specified databases with the specified service. The option may be used for multiple times, but only the last service for each of the database will be used.(Since glibc 2.4.)
-i, --no-idn: This option disables IDN encoding in the lookups for ahosts/getaddrinfo(3) (Since glibc-2.13.)
-?, --help: This option prints a usage summary and exit.
--usage: This option prints a short usage summary and exit.
-V, --version: This option prints the version number, license, and the disclaimer of warranty for getent.
Exit Status: One of the following exit values can be used to returned by getent:
0: This exit status shows that the Command completed successfully.
1: This exit status shows that there’s a Missing arguments, or database unknown.
2: This exit status shows that One or more supplied key could not be found in the database.
3: This exit status shows that the Enumeration not supported on this database.
linux-command
Linux-file-commands
Picked
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
scp command in Linux with Examples
Docker - COPY Instruction
mv command in Linux with examples
SED command in Linux | Set 2
chown command in Linux with Examples
nohup Command in Linux with Examples
Named Pipe or FIFO with example C program
Thread functions in C/C++
uniq Command in LINUX with examples
Start/Stop/Restart Services Using Systemctl in Linux
Boolean toString() method in Java with examples - GeeksforGeeks

03 Mar, 2021
The toString() method of Boolean class is a built in method to return the boolean value in string format.
There are 2 overloads of toString() methods in Boolean class of Java:
Syntax
Boolean.toString(boolean value)
Parameter: It takes a boolean value as input which is to be converted to string.
Return Type: The returned value is String representation of the Boolean Value.
Below are programs to illustrate toString() method:
Program 1:
// java code to demonstrate// Boolean toString() method  class GFG {    public static void main(String[] args)    {          // boolean type value        boolean value = true;          // static toString() method of Boolean class        String output = Boolean.toString(value);          // printing the value        System.out.println(output);    }}
true

Program 2:
// java code to demonstrate// Boolean toString() method  class GFG {    public static void main(String[] args)    {          // boolean type value        boolean value = false;          // static toString() method of Boolean class        String output = Boolean.toString(value);          // printing the value        System.out.println(output);    }}
false

Syntax
BooleanObject.toString()
Return Type: The returned value is a String representation of the boolean instance by which this method is called.
Below are programs to illustrate above defined method:
Program 1:
// java code to demonstrate// Boolean toString() method  class GFG {    public static void main(String[] args)    {          // creating a Boolean object        Boolean b = new Boolean(true);          // toString method of Boolean class        String output = b.toString();          // printing the output        System.out.println(output);    }}
true

Program 2:
// Java code to demonstrate// Boolean toString() method  class GFG {    public static void main(String[] args)    {          // creating a Boolean object        Boolean b = new Boolean(false);          // toString method of Boolean class        String output = b.toString();          // printing the output        System.out.println(output);    }}
false

Java - util package
Java-Byte
Java-Functions
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Initialize an ArrayList in Java
Object Oriented Programming (OOPs) Concept in Java
Interfaces in Java
HashMap in Java with Examples
ArrayList in Java
How to iterate any Map in Java
Multidimensional Arrays in Java
Stack Class in Java
Singleton Class in Java
Stream In Java
How to maximize JFrame in Java Swing

To maximize JFrame in Java Swing, use the following −
JFrame.MAXIMIZED_BOTH
The following is an example to maximize JFrame in Java −
package my;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class SwingDemo extends JFrame {
   JPanel panel = new JPanel();
   public SwingDemo() {
      setVisible(true);
      setDefaultCloseOperation(EXIT_ON_CLOSE);
      setAlwaysOnTop(true);
      setResizable(true);
      setExtendedState(this.getExtendedState() | JFrame.MAXIMIZED_BOTH);
   }
   public static void main(String[] args) { new SwingDemo();
   }
}
The output is as follows. Here, the JFrame is visible with no border and title −
Program to check whether we can pick up and drop every passenger in given list in Python

Suppose we have a matrix called requested_trips where each row containing [start_x, end_x, num_passengers], and we also have a capacity value. Now each requested trip asks to pick up num_passengers passenger at start_x and drop them off at end_x. We also have a car with the capacity that is given, and start at position x = 0. We want to to pick up every passenger and can only move right side, we have to check whether we can pick up and drop off everyone.
So, if the input is like trips = [[1, 25, 2], [3, 4, 3],[5, 12, 3]] capacity = 6, then the output will be True
To solve this, we will follow these steps −
events := a new list
events := a new list
for each set (sx, ex, np) in trips, doinsert pair (sx, np) at the end of eventsinsert pair (ex, −np) at the end of events
for each set (sx, ex, np) in trips, do
insert pair (sx, np) at the end of events
insert pair (sx, np) at the end of events
insert pair (ex, −np) at the end of events
insert pair (ex, −np) at the end of events
carrying := 0
carrying := 0
for each pair (loc, delta) in the list of events (in sorted order), docarrying := carrying + deltaif carrying > capacity, thenreturn False
for each pair (loc, delta) in the list of events (in sorted order), do
carrying := carrying + delta
carrying := carrying + delta
if carrying > capacity, thenreturn False
if carrying > capacity, then
return False
return False
return True
return True
Let us see the following implementation to get better understanding −
 Live Demo
class Solution:
   def solve(self, trips, capacity):
      events = []
      for sx, ex, np in trips:
         events.append((sx, np))
         events.append((ex, -np))
      carrying = 0
      for loc, delta in sorted(events):
         carrying += delta
         if carrying > capacity:
            return False
      return True
ob = Solution()
trips = [
   [1, 25, 2],
   [3, 4, 3],
   [5, 12, 3]
]
capacity = 6
print(ob.solve(trips, capacity))
trips = [
[1, 25, 2],
[3, 4, 3],
[5, 12, 3] ]
capacity = 6
True
How to find the number of digits in a given number using Python?

In this program, we have to find the number of digits in an integer given by the user.
User Input: 123, Output: 3
User Input: 1987, Output: 4
Step 1: Take Integer value as input value from the userStep 2: Divide the number by 10 and convert the quotient into Integer typeStep 3: If quotient is not 0, update count of digit by 1Step 4: If quotient is 0, stop the countStep 5: STOP
Step 1: Take Integer value as input value from the user
Step 2: Divide the number by 10 and convert the quotient into Integer type
Step 3: If quotient is not 0, update count of digit by 1
Step 4: If quotient is 0, stop the count
Live Demo
x = int(input("User Input: "))
count_of_digits = 0
while x > 0:
   x = int(x/10)
   count_of_digits += 1
print("Number of Digits: ",count_of_digits)
User Input: 123
Number of Digits: 3

User Input: 1987
Number of Digits: 4
When we divide a number by 10 and convert the result into type int, the unit's place digit gets deleted. So, by dividing the result each time by 10 will give us the number of digits in the integer. Once the result becomes 0, the program will exit the loop and we will get the number of digits in the integer.
F# - if/else statement

An if/then statement can be followed by an optional else statement, which executes when the Boolean expression is false.
The syntax of an if/then/else statement in F# programming language is −
if expr then
   expr
else
   expr

let a : int32 = 100

(* check the boolean condition using if statement *)

if (a < 20) then
   printfn "a is less than 20\n"
else
   printfn "a is not less than 20\n"
   printfn "Value of a is: %d" a
When you compile and execute the program, it yields the following output −
a is not less than 20

Value of a is: 100

 Print
 Add Notes
 Bookmark this page
ExpressJS - Routing

Web frameworks provide resources such as HTML pages, scripts, images, etc. at different routes.
The following function is used to define routes in an Express application −
This METHOD can be applied to any one of the HTTP verbs – get, set, put, delete. An alternate method also exists, which executes independent of the request type.
Path is the route at which the request will run.
Handler is a callback function that executes when a matching request type is found on the relevant route. For example,
var express = require('express');
var app = express();

app.get('/hello', function(req, res){
   res.send("Hello World!");
});

app.listen(3000);
If we run our application and go to localhost:3000/hello, the server receives a get request at route "/hello", our Express app executes the callback function attached to this route and sends "Hello World!" as the response.
We can also have multiple different methods at the same route. For example,
var express = require('express');
var app = express();

app.get('/hello', function(req, res){
   res.send("Hello World!");
});

app.post('/hello', function(req, res){
   res.send("You just called the post method at '/hello'!\n");
});

app.listen(3000);
To test this request, open up your terminal and use cURL to execute the following request −
curl -X POST "http://localhost:3000/hello"

A special method, all, is provided by Express to handle all types of http methods at a particular route using the same function. To use this method, try the following.
app.all('/test', function(req, res){
   res.send("HTTP method doesn't have any effect on this route!");
});
This method is generally used for defining middleware, which we'll discuss in the middleware chapter.
Defining routes like above is very tedious to maintain. To separate the routes from our main index.js file, we will use Express.Router. Create a new file called things.js and type the following in it.
var express = require('express');
var router = express.Router();

router.get('/', function(req, res){
   res.send('GET route on things.');
});
router.post('/', function(req, res){
   res.send('POST route on things.');
});

//export this router to use in our index.js
module.exports = router;
Now to use this router in our index.js, type in the following before the app.listen function call.
var express = require('Express');
var app = express();

var things = require('./things.js');

//both index.js and things.js should be in same directory
app.use('/things', things);

app.listen(3000);
The app.use function call on route '/things' attaches the things router with this route. Now whatever requests our app gets at the '/things', will be handled by our things.js router. The '/' route in things.js is actually a subroute of '/things'. Visit localhost:3000/things/ and you will see the following output.
Routers are very helpful in separating concerns and keep relevant portions of our code together. They help in building maintainable code. You should define your routes relating to an entity in a single file and include it using the above method in your index.js file.

    16 Lectures 
     1 hours 

 Anadi Sharma
 Print
 Add Notes
 Bookmark this page
Batch Script - Adding to the Registry

Adding to the registry is done via the REG ADD command. Note that in order to add values to the registry you need to have sufficient privileges on the system to perform this operation.
The REG ADD command has the following variations. In the second variation, no name is specified for the key and it will add the name of “(Default)” for the key.
REG ADD [ROOT\]RegKey /v ValueName [/t DataType] [/S Separator] [/d Data] [/f]
REG ADD [ROOT\]RegKey /ve [/d Data] [/f]

Where
ValueName − The value, under the selected RegKey, to edit.
ValueName − The value, under the selected RegKey, to edit.
/d Data − The actual data to store as a "String", integer, etc.
/d Data − The actual data to store as a "String", integer, etc.
/f − Force an update without prompting "Value exists, overwrite Y/N".
/f − Force an update without prompting "Value exists, overwrite Y/N".
/S Separator − Character to use as the separator in REG_MULTI_SZ values. The default is "\0".
/S Separator − Character to use as the separator in REG_MULTI_SZ values. The default is "\0".
/t DataType − These are the data types defined as per the registry standards which can be −

REG_SZ (default)
REG_DWORD
REG_EXPAND_SZ
REG_MULTI_SZ


/t DataType − These are the data types defined as per the registry standards which can be −
REG_SZ (default)
REG_SZ (default)
REG_DWORD
REG_DWORD
REG_EXPAND_SZ
REG_EXPAND_SZ
REG_MULTI_SZ
REG_MULTI_SZ
@echo off 
REG ADD HKEY_CURRENT_USER\Console /v Test /d "Test Data" 
REG QUERY HKEY_CURRENT_USER\Console /v Test
In the above example, the first part is to add a key into the registry under the location HKEY_CURRENT_USER\Console. This key will have a name of Test and the value assigned to the key will be Test Data which will be of the default string type.
The second command just displays what was added to the registry by using the REG QUERY command.
Following will be the output of the above program. The first line of the output shows that the ‘Add’ functionality was successful and the second output shows the inserted value into the registry.
The operation completed successfully. 
HKEY_CURRENT_USER\Console 
   Test REG_SZ Test Data

 Print
 Add Notes
 Bookmark this page
ES6 - Math sqrt() Function

This method returns the square root of a number. If the value of a number is negative, sqrt returns NaN.
Math.sqrt ( x );  

x − represents a number
Returns the square root of the number.
console.log("---Math.sqrt()---") 
console.log("Math.sqrt(16) : "+Math.sqrt(16) 
console.log("Math.sqrt(15.5) : "+Math.sqrt(15.5))           
---Math.sqrt()--- 
Math.sqrt(16) : 4 
Math.sqrt(15.5) : 3.9370039370059056             


    32 Lectures 
     3.5 hours 

 Sharad Kumar

    40 Lectures 
     5 hours 

 Richa Maheshwari

    16 Lectures 
     1 hours 

 Anadi Sharma

    50 Lectures 
     6.5 hours 

 Gowthami Swarna

    14 Lectures 
     1 hours 

 Deepti Trivedi

    31 Lectures 
     1.5 hours 

 Shweta
 Print
 Add Notes
 Bookmark this page
How to copy files from one folder to another using Python?

The shutil module provides functions for copying files, as well as entire folders. For copying multiple files at once, you'll have to have a list of all files you want to copy and loop over them to copy them.
Calling shutil.copy(source, destination) will copy the file at the path source to the folder at the path destination. (Both source and destination are strings.) If destination is a filename, it will be used as the new name of the copied file. This function returns a string of the path of the copied file. 
import shutil, os
files = ['file1.txt', 'file2.txt', 'file3.txt']
for f in files:
    shutil.copy(f, 'dest_folder')
Tryit Editor v3.7

Tryit: HTML introduction
Arduino - infinite loop

It is the loop having no terminating condition, so the loop becomes infinite.
for (;;) {
   // statement block
}

while(1) {
   // statement block
}

do {
   Block of statements;
} 
while(1);


    65 Lectures 
     6.5 hours 

 Amit Rana

    43 Lectures 
     3 hours 

 Amit Rana

    20 Lectures 
     2 hours 

 Ashraf Said

    19 Lectures 
     1.5 hours 

 Ashraf Said

    11 Lectures 
     47 mins

 Ashraf Said

    9 Lectures 
     41 mins

 Ashraf Said
 Print
 Add Notes
 Bookmark this page
C program to find permutations of given strings

Suppose we have few strings in an array. We shall have to find all permutations of them in different line.
So, if the input is like strings = ["abc", "def", "ghi"], then the output will be
abc def ghi
abc ghi def
def abc ghi
def ghi abc
ghi abc def
ghi def abc
To solve this, we will follow these steps −
Define a function next_permutation(), this will take n, string array s,
for initialize i := n - 1, when i > 0, update (decrease i by 1), do:if s[i] > s[i - 1]), then:j := i + 1for j < n, update (increase j by 1), do:if s[j] <= s[i - 1]), then:Come out from the loopt := s[i - 1]s[i - 1] = s[j - 1]s[j - 1] = tfor i < n - 1, update (increase i by 1), (decrease n by 1), do:t := s[i]s[i] := s[n - 1]s[n - 1] = treturn 1
if s[i] > s[i - 1]), then:j := i + 1
j := i + 1
for j < n, update (increase j by 1), do:if s[j] <= s[i - 1]), then:Come out from the loopt := s[i - 1]
if s[j] <= s[i - 1]), then:Come out from the loop
Come out from the loop
t := s[i - 1]
s[i - 1] = s[j - 1]
s[j - 1] = t
for i < n - 1, update (increase i by 1), (decrease n by 1), do:t := s[i]s[i] := s[n - 1]s[n - 1] = t
t := s[i]
s[i] := s[n - 1]
s[n - 1] = t
return 1
for initialize i := 0, when i < n - 1, update (increase i by 1), (decrease n by 1), do:t := s[i]s[i] := s[n - 1]s[n - 1] = t
t := s[i]
s[i] := s[n - 1]
s[n - 1] = t
return 0
From the main method do the following
do the following infinitely until next_permutation(n, strings) is 0{for initialize i := 0, when i < n, update (increase i by 1), do:display strings[i] then (if i is same as n - 1, then go to next line, otherwise print blank space
for initialize i := 0, when i < n, update (increase i by 1), do:display strings[i] then (if i is same as n - 1, then go to next line, otherwise print blank space
display strings[i] then (if i is same as n - 1, then go to next line, otherwise print blank space
Let us see the following implementation to get better understanding −
#include <stdio.h>
#include <string.h>
int next_permutation(int n, char **s){
    for (int i = n - 1; i > 0; i--)
        if (strcmp(s[i], s[i - 1]) > 0){
            int j = i + 1;
            for (; j < n; j++)
                if (strcmp(s[j], s[i - 1]) <= 0)
                    break;
            char *t = s[i - 1];
            s[i - 1] = s[j - 1];
            s[j - 1] = t;
            for (; i < n - 1; i++, n--){
                t = s[i];
                s[i] = s[n - 1];
                s[n - 1] = t;
            }
            return 1;
        }
    for (int i = 0; i < n - 1; i++, n--){
        char *t = s[i];
        s[i] = s[n - 1];
        s[n - 1] = t;
    }
    return 0;
}
int main(){
    char *strings[] = {"abc", "def", "ghi"};
    int n = 3;
    do{
        for (int i = 0; i < n; i++)
            printf("%s%c", strings[i], i == n - 1 ? '\n' : ' ');
    } while (next_permutation(n, strings));
}

{"abc", "def", "ghi"}
abc def ghi
abc ghi def
def abc ghi
def ghi abc
ghi abc def
ghi def abc
SQL - CONCAT Function

SQL CONCAT function is used to  concatenate two strings to form a single string. Try out the following example −
SQL> SELECT CONCAT('FIRST ', 'SECOND');
+----------------------------+
| CONCAT('FIRST ', 'SECOND') |
+----------------------------+
| FIRST SECOND               |
+----------------------------+
1 row in set (0.00 sec)
To understand CONCAT  function in more detail, consider an employee_tbl table, which is having the following records −
SQL> SELECT * FROM employee_tbl;
+------+------+------------+--------------------+
| id   | name | work_date  | daily_typing_pages |
+------+------+------------+--------------------+
|    1 | John | 2007-01-24 |                250 |
|    2 | Ram  | 2007-05-27 |                220 |
|    3 | Jack | 2007-05-06 |                170 |
|    3 | Jack | 2007-04-06 |                100 |
|    4 | Jill | 2007-04-06 |                220 |
|    5 | Zara | 2007-06-06 |                300 |
|    5 | Zara | 2007-02-06 |                350 |
+------+------+------------+--------------------+
7 rows in set (0.00 sec)
Now suppose based on the above table you want to  concatenate all the names employee ID and work_date, then you can do it using the following command −
SQL> SELECT CONCAT(id, name, work_date)
   -> FROM employee_tbl;
+-----------------------------+
| CONCAT(id, name, work_date) |
+-----------------------------+
| 1John2007-01-24             |
| 2Ram2007-05-27              |
| 3Jack2007-05-06             |
| 3Jack2007-04-06             |
| 4Jill2007-04-06             |
| 5Zara2007-06-06             |
| 5Zara2007-02-06             |
+-----------------------------+
7 rows in set (0.00 sec)

    42 Lectures 
     5 hours 

 Anadi Sharma

    14 Lectures 
     2 hours 

 Anadi Sharma

    44 Lectures 
     4.5 hours 

 Anadi Sharma

    94 Lectures 
     7 hours 

 Abhishek And Pukhraj

    80 Lectures 
     6.5 hours 

 Oracle Master Training | 150,000+ Students Worldwide

    31 Lectures 
     6 hours 

 Eduonix Learning Solutions
 Print
 Add Notes
 Bookmark this page
What are the differences between “untyped” & “dynamically typed” programming languages?

Dynamically typed language is called so because the type is associated with run-time values. You don’t have to specify types every time. As the name suggests, variables' types are dynamic, means even after you set a variable to a type you can change it.
Some dynamically typed languages include Python, Perl, Ruby, etc.
Untyped languages, also known as dynamically typed languages, are programming languages that do not make you define the type of a variable.
JavaScript is untyped language. This means that a JavaScript variable can hold a value of any data type. To declare variables in JavaScript, you need to use the var keyword. Whether it is a number or string, use the var keyword for declaration.
Here’s how you can declare numbers in JavaScript −
var points = 100;
var rank = 5;