code-rag-bench/online-tutorials huggingface dataset:
How to use Alert Component in ReactJS? - GeeksforGeeks

05 Mar, 2021
Alerts are urgent interruptions, requiring acknowledgment, that inform the user about a situation. Material UI for React has this component available for us, and it is very easy to integrate. We can use Alert Component in ReactJS using the following approach.
Creating React Application And Installing Module:
Step 1: Create a React application using the following command.
npx create-react-app foldername
Step 2: After creating your project folder i.e. foldername, move to it using the following command.
cd foldername
Step 3: After creating the ReactJS application, Install the material-ui modules using the following command.
npm install @material-ui/core
npm install @material-ui/lab
Project Structure: It will look like the following.
Project Structure
Example: Now write down the following code in the App.js file. Here, App is our default component where we have written our code.
App.js
import React from "react";import MuiAlert from "@material-ui/lab/Alert";  function Alert(props) {  return <MuiAlert elevation={6}                    variant="filled" {...props} />;}  export default function App() {  return (    <div>      <h4>How to use Alert Component in ReactJS?</h4>      <Alert severity="success">Sample Success Message</Alert>      <Alert severity="error">Sample Error Message</Alert>    </div>  );}
Step to Run Application: Run the application using the following command from the root directory of the project.
npm start
Output: Now open your browser and go to http://localhost:3000/, you will see the following output.
Reference: https://material-ui.com/components/dialogs/#alerts
Material-UI
React-Questions
ReactJS
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to set background images in ReactJS ?
How to create a table in ReactJS ?
How to navigate on path by button click in react router ?
ReactJS useNavigate() Hook
React-Router Hooks
Roadmap to Become a Web Developer in 2022
Installation of Node.js on Linux
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to insert spaces/tabs in text using HTML/CSS?
Convert a string to an integer in JavaScript
How to check Azure VM Power state using PowerShell?

To check if the VMs are running, deallocated, or stopped using PowerShell, we need to use the - Status parameter.
If you write only the Get-AzVM command to get the VM details, it won’t show up the Azure VM power status default.
To check the Azure VM Power Status,
Get-AzVM -status
 
The above command will show the Power State for all VMs for that particular subscription. For different subscriptions, you need to change the subscription and run this command.
To get the VM Power State for the specific ResourceGroup, use the ResourceGroup name parameter.
For example,
Get-AzVM -ResourceGroupName TestVMRG -Status
The above command will retrieve all VM Power states from the resource group TestVMRG.
For the specific VM Power state, you need to provide a particular VM name, as shown below.
Get-AzVM -VMName Win2k16vm1 -Status
Gerrit - Push Your Change Set to Gerrit

You can submit the patches for review by using the git-review command. The change set can be pushed to Gerrit, by running the git review -R command as shown in the following screenshot.
The -R option informs git-review not to complete rebase before submitting git changes to Gerrit.
You can submit the code to other branch rather than the master, using the following command.
git review name_of_branch

It is also possible to submit the code to a different remote, using the following command.
git review -r name_of_remote

 Print
 Add Notes
 Bookmark this page
Dart Programming - Map Property isEmpty

Returns true if the Map is empty.
Map.isEmpty 

void main() { 
   var details = {'Usrname':'tom','Password':'pass@123'}; 
   print(details.isEmpty); 
   var hosts = {}; 
   print(hosts.isEmpty); 
}
It will produce the following output −
false 
true


    44 Lectures 
     4.5 hours 

 Sriyank Siddhartha

    34 Lectures 
     4 hours 

 Sriyank Siddhartha

    69 Lectures 
     4 hours 

 Frahaan Hussain

    117 Lectures 
     10 hours 

 Frahaan Hussain

    22 Lectures 
     1.5 hours 

 Pranjal Srivastava

    34 Lectures 
     3 hours 

 Pranjal Srivastava
 Print
 Add Notes
 Bookmark this page
How can I display an image inside SVG circle in HTML5?

To display an image inside SVG circle, use the <circle> element and set the clipping path. The <clipPath> element is used to define a clipping path. Image in SVG is set using the <image> element.
You can try to run the following code to learn how to display an image inside SVG circle in HTML5
Live Demo
<!DOCTYPE html>
<html>
   <head>
      <title>HTML5 SVG Image</title>
   <head>
   <body>
      <svg width="500" height="350">
         <defs>
            <clipPath id="myCircle">
               <circle cx="250" cy="145" r="125" fill="#FFFFFF" />
            </clipPath>
         </defs>
         <image width="500" height="350" xlink:href="https://www.tutorialspoint.com/videotutorials/images/coding_ground_home.jpg" clip-path="url(#myCircle)" />
      </svg>
   </body>
</html>
Find X and Y in Linear Equation | Practice | GeeksforGeeks

Given A, B and N. Find x and y that satisfies equation Ax + By = N. If there's no solution print -1 in place of both x and y. 
Note: There are Multiple solutions possible. Find the solution where x is minimum. x and y should both be non-negative.
 
Example 1:
Input:
A = 2, B = 3, N = 7
Output:
2 1
Explanation:
2*2 + 3*1 = 7.
Example 2:
Input:
A = 4, B = 2, N = 7
Output:
-1 -1
Explanation:
There's no solution for x and y the equation.
 
Your Task:
You don't need to read input or print anything. Your task is to complete the function findXandY() which takes 3 Integers A,B and N as input and returns a list of 2 integers with the first integer x and the second being y.
 
Expected Time Complexity: O(N)
Expected Auxiliary Space: O(1)
 
Constraints:
1 <= A,B <= 105
0 <= N <= 105
No Comments to load
We strongly recommend solving this problem on your own before viewing its editorial. Do you still
                    want to view the editorial?
 Login to access your submissions. 

Problem


Contest

Reset the IDE using the second button on the top right corner.
Avoid using static/global variables in your code as your code is tested against multiple test cases and these tend to retain their previous values.
Passing the Sample/Custom Test cases does not guarantee the correctness of code. On submission, your code is tested against multiple test cases consisting of all possible corner cases and stress constraints.
You can access the hints to get an idea about what is expected of you as well as the final solution code.
You can view the solutions submitted by other users from the submission tab.
How to Insert an Image in HTML Page?

Images can be easily inserted at any section in an HTML page. To insert image in an HTML page, use the <img> tags. It is an empty tag, containing only attributes since the closing tag is not required.
Just keep in mind that you should use the <img> tag inside <body>...</body> tag. The src attribute is used to add the image source i.e. URL of the image. The alt attribute is for adding alternate text, width for adding width, and height for adding the height of the image.
You can try the following code to insert an image in an HTML page −
<!DOCTYPE html>
<html>
   <head>
      <title>HTML img Tag</title>
   </head>

   <body>
      <img src="https://www.tutorialspoint.com/html/images/test.png" alt="Simply Easy Learning" width="200" height="80">
   </body>
</html>
C++ break statement

The break statement has the following two usages in C++ −
When the break statement is encountered inside a loop, the loop is immediately terminated and program control resumes at the next statement following the loop.
When the break statement is encountered inside a loop, the loop is immediately terminated and program control resumes at the next statement following the loop.
It can be used to terminate a case in the switch statement (covered in the next chapter).
It can be used to terminate a case in the switch statement (covered in the next chapter).
If you are using nested loops (i.e., one loop inside another loop), the break statement will stop the execution of the innermost loop and start executing the next line of code after the block.
The syntax of a break statement in C++ is −
break;

#include <iostream>
using namespace std;
 
int main () {
   // Local variable declaration:
   int a = 10;

   // do loop execution
   do {
      cout << "value of a: " << a << endl;
      a = a + 1;
      if( a > 15) {
         // terminate the loop
         break;
      }
   } while( a < 20 );
 
   return 0;
}
When the above code is compiled and executed, it produces the following result −
value of a: 10
value of a: 11
value of a: 12
value of a: 13
value of a: 14
value of a: 15


    154 Lectures 
     11.5 hours 

 Arnab Chakraborty

    14 Lectures 
     57 mins

 Kaushik Roy Chowdhury

    30 Lectures 
     12.5 hours 

 Frahaan Hussain

    54 Lectures 
     3.5 hours 

 Frahaan Hussain

    77 Lectures 
     5.5 hours 

 Frahaan Hussain

    12 Lectures 
     3.5 hours 

 Frahaan Hussain
 Print
 Add Notes
 Bookmark this page
Spread operator for arrays in JavaScript

The spread (...) syntax allow us to expand an iterable like array in places where 0+ arguments are expected. It allows us to pass a number of parameters as an array to a
function.
Following is the code to implement spread operator for arrays in JavaScript −
 Live Demo
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<style>
   body {
      font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
   }
   .result,
   .sample {
      font-size: 20px;
      font-weight: 500;
      color: blueviolet;
   }
   .sample {
      color: red;
}
</style>
</head>
<body>
<h1>Spread operator for arrays JavaScript</h1>
<div class="sample">[22,55,11,19,55]</div>
<div class="result"></div>
<br />
<button class="Btn">CLICK HERE</button>
<h3>Click on the above button to call the add function and pass the above
array as parameter</h3>
<script>
   let BtnEle = document.querySelector(".Btn");
   let resEle = document.querySelector(".result");
   function add(num1, num2, num3, num4, num5) {
      return num1 + num2 + num3 + num4 + num5;
   }
   let arr = [22, 55, 11, 19, 55];
   BtnEle.addEventListener("click", (event) => {
      resEle.innerHTML = "The sum of the above array = " + add(...arr);
   });
</script>
</body>
</html>
On clicking the ‘CLICK HERE’ button −
Command Line arguments in Lua

Handling command line arguments in Lua is one of the key features of any programming language. In Lua, the command line arguments are stored in a table named args and we can use the indices to extract any particular command line argument we require.
lua [options] [script [args]]
The options are −
-e stat− executes string stat;
-l mod− "requires" mod;
-i− enters interactive mode after running script;
-v− prints version information;
--− stops handling options;
-− executes stdin as a file and stops handling
options.
Let’s consider an example where we will open a Lua shell in interactive mode and we will pass the script as dev/null and then we will pass our arguments.
lua -i -- /dev/null one two three
It should be noted that the above command will work only if Lua is installed on your local machine.
The above command opens the terminal in an interactive mode.
Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio
Now we can access the arguments that we passed, as we know they are stored in a table named args.
Consider the example shown below −
lua -i -- /dev/null one two three
Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio
>print(arg[1]) one
>print(arg[2]) two
>print(arg[3]0
stdin:1: ')' expected near '0'
>print(arg[3]) three
>print(arg[0])
/dev/null
one
two
three
/dev/null
Print "Even" or "Odd" without using conditional statement - GeeksforGeeks

17 Aug, 2021
Write a program that accepts a number from the user and prints “Even” if the entered number is even and prints “Odd” if the number is odd. You are not allowed to use any comparison (==, <,>,...etc) or conditional statements (if, else, switch, ternary operator,. Etc).
Method 1 Below is a tricky code can be used to print “Even” or “Odd” accordingly. 
C++
Java
Python3
C#
PHP
Javascript
#include <iostream> using namespace std; int main(){    char arr[2][5] = { "Even", "Odd" };    int no;    cout << "Enter a number: ";    cin >> no;    cout << arr[no % 2];    getchar();    return 0;}
import java.util.Scanner;class GFG{    public static void main(String[] args)    {                 String[] arr = {"Even", "Odd"};                 Scanner s = new Scanner(System.in);                 System.out.print("Enter the number: ");        int no = s.nextInt();         System.out.println(arr[no%2]);    }} // This code is contributed by divyeshrabadiya07.
arr = ["Even", "Odd"]print ("Enter the number")no = int(input())print (arr[no % 2])
using System;class GFG {  static void Main() {    string[] arr = {"Even", "Odd"};          Console.Write("Enter the number: ");         string val;    val = Console.ReadLine();    int no = Convert.ToInt32(val);     Console.WriteLine(arr[no%2]);  }} // This code is contributed by divyesh072019.
<?php$arr = ["Even", "Odd"];$input = 5;echo ($arr[$input % 2]); // This code is contributed// by Aman ojha?>
<script>     let arr = ["Even", "Odd"];    let no = prompt("Enter a number: ");         document.write(arr[no % 2]);        // This code is contributed by suresh07    </script>
Method 2 Below is another tricky code can be used to print “Even” or “Odd” accordingly. Thanks to student for suggesting this method.
C++
#include<stdio.h>int main(){    int no;    printf("Enter a no: ");    scanf("%d", &no);    (no & 1 && printf("odd"))|| printf("even");    return 0;}
Enter a no: even
Please write comments if you find the above code incorrect, or find better ways to solve the same problem
Method 3This can also be done using a concept known as Branchless Programming. Essentially, make use of the fact that a true statement in Python (other some other languages) evaluates to 1 and a false statements evaluates to false. 
Python3
# coden = int(input("Enter a number: "))print("Even" * (n % 2 == 0), "Odd" * (n % 2 != 0))
Enter a number: Even 
Prateek Bajaj
Aman ojha
divyeshrabadiya07
divyesh072019
kumarv456
suresh07
mv72d9gyw3u06zvq4i4elurjcmu1d239e0cn047m
sarcasm1o1
C Language
C++
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Multidimensional Arrays in C / C++
rand() and srand() in C/C++
fork() in C
Core Dump (Segmentation fault) in C/C++
Left Shift and Right Shift Operators in C/C++
Vector in C++ STL
Initialize a vector in C++ (6 different ways)
Inheritance in C++
Map in C++ Standard Template Library (STL)
C++ Classes and Objects
Machine Learning with Python - Extra Trees

It is another extension of bagged decision tree ensemble method. In this method, the random trees are constructed from the samples of the training dataset.
In the following Python recipe, we are going to build extra tree ensemble model by using ExtraTreesClassifier class of sklearn on Pima Indians diabetes dataset.
First, import the required packages as follows −
from pandas import read_csv
from sklearn.model_selection import KFold
from sklearn.model_selection import cross_val_score
from sklearn.ensemble import ExtraTreesClassifier
Now, we need to load the Pima diabetes dataset as did in previous examples −
path = r"C:\pima-indians-diabetes.csv"
headernames = ['preg', 'plas', 'pres', 'skin', 'test', 'mass', 'pedi', 'age', 'class']
data = read_csv(path, names = headernames)
array = data.values
X = array[:,0:8]
Y = array[:,8]
Next, give the input for 10-fold cross validation as follows −
seed = 7
kfold = KFold(n_splits = 10, random_state = seed)

We need to provide the number of trees we are going to build. Here we are building 150 trees with split points chosen from 5 features −
num_trees = 150
max_features = 5

Next, build the model with the help of following script −
model = ExtraTreesClassifier(n_estimators = num_trees, max_features = max_features)

Calculate and print the result as follows −
results = cross_val_score(model, X, Y, cv = kfold)
print(results.mean())

Output
0.7551435406698566

The output above shows that we got around 75.5% accuracy of our bagged extra trees classifier model.

    168 Lectures 
     13.5 hours 

 Er. Himanshu Vasishta

    64 Lectures 
     10.5 hours 

 Eduonix Learning Solutions

    91 Lectures 
     10 hours 

 Abhilash Nelson

    54 Lectures 
     6 hours 

 Abhishek And Pukhraj

    49 Lectures 
     5 hours 

 Abhishek And Pukhraj

    35 Lectures 
     4 hours 

 Abhishek And Pukhraj
 Print
 Add Notes
 Bookmark this page
How can we remove NOT NULL constraint from a column of an existing MySQL table?

We can remove a NOT NULL constraint from a column of an existing table by using the ALTER TABLE statement.
Suppose we have a table ‘test123’ having a NOT NULL constraint on column ‘ID’ as follows −
mysql> DESCRIBE test123;
+-------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra    |
+-------+---------+------+-----+---------+-------+
| ID    | int(11) | NO   |     |   NULL  |       |
| Date  | date    | YES  |     |   NULL  |       |
+-------+---------+------+-----+---------+-------+
2 rows in set (0.04 sec)
Now if we want to remove the NOT NULL constraint then we can use ALTER TABLE statement as follows −
mysql> ALTER TABLE test123 MODIFY ID INT NULL;
Query OK, 0 rows affected (0.20 sec)
Records: 0 Duplicates: 0 Warnings: 0

mysql> DESCRIBE test123;
+-------+---------+------+-----+---------+-------+
| Field | Type    | Null | Key | Default | Extra |
+------ +---------+------+-----+---------+-------+
| ID    | int(11) | YES  |     |   NULL  |       |
| Date  | date    | YES  |     |   NULL  |       |
+-------+---------+------+-----+---------+-------+
2 rows in set (0.06 sec)
The above result set shows that NOT NULL constraint on column ‘ID’ has been removed.
In the query above, the keyword NULL after keyword MODIFY is optional. The following query will also produce the same result as above −
mysql> ALTER TABLE test123 MODIFY ID INT;
Query OK, 0 rows affected (0.20 sec)
Records: 0 Duplicates: 0 Warnings: 0
Matlab program to rotate an image 180 degrees clockwise without using function - GeeksforGeeks

07 Aug, 2020
An image is defined as two-dimensional function, f(x, y), where x and y are spatial (plane) coordinates, and the amplitude of f at any pair of coordinates(x, y) is called the Intensity or the Gray level of the image at that point. When x, y and the intensity values of f are all finite, discrete quantities, the image is digital image.
Digital image is composed of a finite number of elements, each of which has a particular location and value. These elements are called picture elements, image elements and pixels. Pixel is the smallest element of an image. Each pixel corresponds to any one value. For an 8-bit gray scale image, the value of the pixel is between 0-255.
The rows are rotated from end to -1 keeping the step size 1. To rotate the image clockwise, the columns are rotated from end to -1 keeping the step size 1.
Approach:
Read the image using imread function.
Show the image using imshow function.
Rotate the image.
Display the image using imshow.
Below is the implementation:
% Read the Imagea = imread("cameraman.png");  % Display the imageimshow(a);  % Rotate the image clockwisei = a(end:-1 : 1, end:-1 : 1);  % Display the rotated imagefigure, imshow(i);
Output:
Original Image –
Rotated Image –
Akanksha_Rai
Image-Processing
MATLAB
Advanced Computer Subject
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
ML | Stochastic Gradient Descent (SGD)
Copying Files to and from Docker Containers
Principal Component Analysis with Python
ML | Principal Component Analysis(PCA)
ML | Types of Learning – Supervised Learning
Q-Learning in Python
Classifying data using Support Vector Machines(SVMs) in Python
Getting Started with System Design
Deep Learning | Introduction to Long Short Term Memory
Learning Model Building in Scikit-learn : A Python Machine Learning Library
JavaScript Convert an array to JSON

To convert an array to JSON in JavaScript, the code is as follows −
 Live Demo
<!DOCTYPE html>
<html>
<head>
<style>
   body {
      font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
   }
</style>
</head>
<body>
<h1>Converting an array to JSON</h1>
<button class="Btn">CLICK HERE</button>
<p class="sample"></p>
<h3>Click the above button to convert the array into JSON</h3>
<script>
   let sampleEle = document.querySelector(".sample");
   let arr = [22, "A", 1, "HELLO", "J", 9, 22];
   sampleEle.innerHTML = arr + "<br>";
   document.querySelector(".Btn").addEventListener("click", () => {
      sampleEle.innerHTML += JSON.stringify(arr);
   });
</script>
</body>
</html>
On clicking the “CLICK HERE” button −
Java Program to check if a particular key exists in TreeMap

To check if a particular key exists in TreeMap, use the containsKey() method.
Create a TreeMap first and add some elements −
TreeMap<Integer,String> m = new TreeMap<Integer,String>();
m.put(1,"PHP");
m.put(2,"jQuery");
m.put(3,"JavaScript");
m.put(4,"Ruby");
m.put(5,"Java");
m.put(6,"AngularJS");
m.put(7,"ExpressJS");
Now, let’s say we need to check that key 5 exists or not. For that, set the containsKey() method like this −
m.containsKey(5)
The following is an example to check if a particular key exists in TreeMap −
 Live Demo
import java.util.*;
public class Demo {
   public static void main(String args[]) {
      TreeMap<Integer,String> m = new TreeMap<Integer,String>();
      m.put(1,"PHP");
      m.put(2,"jQuery");
      m.put(3,"JavaScript");
      m.put(4,"Ruby");
      m.put(5,"Java");
      m.put(6,"AngularJS");
      m.put(7,"ExpressJS");
      System.out.println("TreeMap Elements...\n"+m);
      System.out.println("Does key 5 exist in the TreeMap = "+m.containsKey(5));
   }
}
TreeMap Elements...
{1=PHP, 2=jQuery, 3=JavaScript, 4=Ruby, 5=Java, 6=AngularJS, 7=ExpressJS}
Does key 5 exist in the TreeMap = true
How to create a custom unchecked exception in Java?

We can create the custom unchecked exception by extending the RuntimeException in Java.
Unchecked exceptions inherit from the Error class or the RuntimeException class. Many programmers feel that we cannot handle these exceptions in our programs because they represent the type of errors from which programs cannot be expected to recover while the program is running. When an unchecked exception is thrown, it is usually caused by misuse of code, passing a null or otherwise incorrect argument.
public class MyCustomException extends RuntimeException {
   public MyCustomException(String message) {
      super(message);
   }
}
The implementation of a custom unchecked exception is almost similar to a checked exception in Java. The only difference is that an unchecked exception has to extend RuntimeException instead of Exception.
public class CustomUncheckedException extends RuntimeException {
   /*
   * Required when we want to add a custom message when throwing the exception
   * as throw new CustomUncheckedException(" Custom Unchecked Exception ");
   */
   public CustomUncheckedException(String message) {
      // calling super invokes the constructors of all super classes
      // which helps to create the complete stacktrace.
      super(message);
   }
   /*
   * Required when we want to wrap the exception generated inside the catch block and rethrow it
   * as catch(ArrayIndexOutOfBoundsException e) {
      * throw new CustomUncheckedException(e);
   * }
   */
   public CustomUncheckedException(Throwable cause) {
      // call appropriate parent constructor
      super(cause);
   }
   /*
   * Required when we want both the above
   * as catch(ArrayIndexOutOfBoundsException e) {
      * throw new CustomUncheckedException(e, "File not found");
   * }
   */
   public CustomUncheckedException(String message, Throwable throwable) {
      // call appropriate parent constructor
      super(message, throwable);
   }
}
Python String isalpha() Method

Python string  method isalpha() checks whether the string consists of alphabetic characters only.
Following is the syntax for islpha() method −
str.isalpha()

NA
NA
This method returns true if all characters in the string are alphabetic and there is at least one character, false otherwise.
The following example shows the usage of isalpha() method.
#!/usr/bin/python

str = "this";  # No space & digit in this string
print str.isalpha()

str = "this is string example....wow!!!";
print str.isalpha()
When we run above program, it produces following result −
True
False


    187 Lectures 
     17.5 hours 

 Malhar Lathkar

    55 Lectures 
     8 hours 

 Arnab Chakraborty

    136 Lectures 
     11 hours 

 In28Minutes Official

    75 Lectures 
     13 hours 

 Eduonix Learning Solutions

    70 Lectures 
     8.5 hours 

 Lets Kode It

    63 Lectures 
     6 hours 

 Abhilash Nelson
 Print
 Add Notes
 Bookmark this page
Can we have a private method or private static method in an interface in Java 9?


Yes, we can have private methods or private static methods in an interface in Java 9. We can use these methods to remove the code redundancy. Private methods can be useful or accessible only within that interface only. We can't access or inherit private methods from one interface to another interface or class.
interface <interface-name> {
   private static void methodName() {
      // some statements
   }
   private void methodName() {
      // some statements
   }
}
interface Java9Interface {
   public abstract void method1();
   public default void method2() {
      method4();
      method5();
      System.out.println("Inside default method");
   }
   public static void method3() {
      method5();    //  static method inside other static method
      System.out.println("Inside static method");
   }
   private void method4() {    // private method
      System.out.println("Inside private method");
   }
   private static void method5() {    // private static method
      System.out.println("Inside private static method");
   }
}
public class PrivateStaticMethodTest implements Java9Interface {
   @Override
   public void method1() {
       System.out.println("Inside abstract method");
   }
   public static void main(String args[]) {
      Java9Interface instance = new PrivateStaticMethodTest();
      instance.method1();
      instance.method2();
      Java9Interface.method3();
   }
}
Inside abstract method
Inside private method
Inside private static method
Inside default method
Inside private static method
Inside static method
Convert text to uppercase with CSS

To convert text to uppercase with CSS, use the text-transform property with value uppercase.
You can try to run the following code to convert text to uppercase:
<html>
   <head>
   </head>
   <body>
      <p>Normal Text</p>
      <p style = "text-transform:uppercase;">
         Normal Text! This will be in uppercase!
      </p>
   </body>
</html>
Docker - HEALTHCHECK Instruction - GeeksforGeeks

28 Oct, 2020
A HEATHCHECK instruction determines the state of a Docker Container. It determines whether the Container is running in a normal state or not. It performs health checks at regular intervals. The initial state is starting and after a successful checkup, the state becomes healthy. If the test remains unsuccessful, it turns into an unhealthy state. 
Some options provided by the HEALTHCHECK instruction are – 
–interval=: It determines the interval between 2 health check-ups. The default interval is the 30s.
–timeout=: If the HEALTHCHECK command exceeds the specified duration, it is categorized as a failure. The default duration is the 30s.
–retries=: If it reaches the specified number of retries, the state is considered to be unhealthy. The default number of retries is 3.
In this article, we will see practical examples of how to use the HEALTHCHECK command in your Dockerfile. We will create an Nginx Container and determine it states. Follow the below steps to Check the health of your dockerfile:
You can use the following template to create the Dockerfile.
FROM nginx:latest
HEALTHCHECK --interval=35s --timeout=4s CMD curl -f https://localhost/ || exit 1
EXPOSE 80

In the above Dockerfile, we pull the nginx base image and perform a HEALTHCHECK with the specified interval and timeout. 
We can build the Docker Image using the build command.
sudo docker build -t healthcheck-demo .

Here, we will check whether the nginx.conf file exists or not. We will set the Command while running the Docker Container.
sudo docker run --name=healthcheck-demo -d
--health-cmd='stat /etc/nginx/nginx.conf 
|| exit 1' healthcheck-demo

/* This line must be without the breaks, it's done for viewing purpose*/
You can use the inspect command to determine the state of the Container.
sudo docker inspect --format='' healthcheck-demo

You will get all the details regarding the Container along with the states during all the health checkups.
To conclude, in this article we discussed what is HEALTHCHECK instructions, what are its uses, the various options you can use along with it. We used the nginx container to demonstrate the same with practical examples.
Docker Container
linux
Advanced Computer Subject
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Copying Files to and from Docker Containers
ML | Stochastic Gradient Descent (SGD)
Principal Component Analysis with Python
Fuzzy Logic | Introduction
How to create a REST API using Java Spring Boot
Classifying data using Support Vector Machines(SVMs) in Python
ML | Data Preprocessing in Python
Q-Learning in Python
Basics of API Testing Using Postman
Monolithic vs Microservices architecture
Can I get the count of repeated values in a column with MySQL?

Yes, you can use ORDER BY DESC with GROUP BY. Let us first create a table −
mysql> create table DemoTable
   -> (
   -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,
   -> PostMessage varchar(100)
   -> );
Query OK, 0 rows affected (0.69 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable(PostMessage) values('Hi');
Query OK, 1 row affected (0.14 sec)

mysql> insert into DemoTable(PostMessage) values('Hello');
Query OK, 1 row affected (0.16 sec)

mysql> insert into DemoTable(PostMessage) values('Hi');
Query OK, 1 row affected (0.12 sec)

mysql> insert into DemoTable(PostMessage) values('Awesome');
Query OK, 1 row affected (0.18 sec)

mysql> insert into DemoTable(PostMessage) values('Hello');
Query OK, 1 row affected (0.19 sec)

mysql> insert into DemoTable(PostMessage) values('Hi');
Query OK, 1 row affected (0.09 sec)

mysql> insert into DemoTable(PostMessage) values('Awesome');
Query OK, 1 row affected (0.33 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable;
This will produce the following output −
+----+-------------+
| Id | PostMessage |
+----+-------------+
|  1 | Hi          |
|  2 | Hello       |
|  3 | Hi          |
|  4 | Awesome     |
|  5 | Hello       |
|  6 | Hi          |
|  7 | Awesome     |
+----+-------------+
7 rows in set (0.00 sec)
Following is the query to get the highest amount of a value in a MySQL database −
mysql> select PostMessage,count(Id) from DemoTable group by PostMessage
    -> order by count(Id) DESC;
This will produce the following output −
+-------------+-----------+
| PostMessage | count(Id) |
+-------------+-----------+
| Hi          | 3         |
| Hello       | 2         |
| Awesome     | 2         |
+-------------+-----------+
3 rows in set (0.00 sec)
If you want only highest, you can use the following query −
mysql> select PostMessage,count(Id)  from DemoTable group by PostMessage having count(Id) > 2;
This will produce the following output −
+-------------+-----------+
| PostMessage | count(Id) |
+-------------+-----------+
| Hi          | 3         |
+-------------+-----------+
1 row in set (0.00 sec)
Display databases in MongoDB

To display number of databases in MongoDB, you need to create atleast one document in a database.
Let’s say, you have created a database, but did not added any document in it. Then in the list of databases that particular database won’t be visible.
Following is the query to create a database −
> use app;
switched to db app
Following is the query to display all databases −
> show dbs;
This will produce the following output. The new database “app” won’t be visible since we haven’t added atleast one document in it −
admin                0.002GB
business             0.000GB
config               0.000GB
local                0.000GB
main                 0.000GB
my                   0.001GB
sample               0.003GB
sampleDemo         0.000GB
studentSearch 0.000GB
test 0.022GB
university 0.000GB
web 0.001GB
webcustomertracker 0.000GB
Let us first create a collection with documents in the “app” database −
> db.demo.insert({"StudentName":"Chris"});
WriteResult({ "nInserted" : 1 })
Following is the query to display all documents from a collection with the help of find() method −
> db.demo.find();
This will produce the following output −
{ "_id" : ObjectId("5e07250e25ddae1f53b62204"), "StudentName" : "Chris" }
Here is the query to display all the databases in MongoDB −
> show dbs;
This will produce the following output. Now the “app” database will be visible in the list of databases −
admin                      0.002GB
app                        0.000GB
business                   0.000GB
config                     0.000GB
local                      0.000GB
main                       0.000GB
my                         0.001GB
sample                     0.003GB
sampleDemo                 0.000GB
studentSearch            0.000GB
test 0.022GB
university 0.000GB
web 0.001GB
webcustomertracker 0.000GB
How to validate email address in JavaScript?

To validate email address in JavaScript, check the condition for “@” and “.” i.e. for abc@gmail.com . Let’s try the following code to validate email
Live Demo
<!DOCTYPE html>
<html>
   <body>
      <script>
         var emailID;
         function validateEmail(emailID) {
            atpos = emailID.indexOf("@");
            dotpos = emailID.lastIndexOf(".");
            if (atpos < 1 || ( dotpos - atpos < 2 )) {
               document.write("Please enter correct email ID")
               document.myForm.EMail.focus() ;
               return false;
            }
            return( true );
         }
         document.write(validateEmail("abc@gmail.com"));
      </script>
   </body>
</html>
C program to find sum and difference using pointers in function

Suppose we have two numbers a and b. We shall have to define a function that can calculate (a + b) and (a - b) both. But using a function in C, we can return at most one value. To find more than one output, we can use output parameters into function arguments using pointers. Here in this problem we shall update a with a+b and b with a-b. When we call the function we shall have to pass the address of these two variables.
So, if the input is like a = 5, b = 8, then the output will be a + b = 13 and a - b = -3
To solve this, we will follow these steps −
define a function solve(), this will take addresses of a and b
define a function solve(), this will take addresses of a and b
temp := sum of the values of variable whose addresses are given
temp := sum of the values of variable whose addresses are given
b := difference of the values of variable whose addresses are given
b := difference of the values of variable whose addresses are given
a = temp
a = temp
Let us see the following implementation to get better understanding −
#include <stdio.h>
int solve(int *a, int *b){
    int temp = *a + *b;
    *b = *a - *b;
    *a = temp;
}
int main(){
    int a = 5, b = 8;
    solve(&a, &b);
    printf("a + b = %d and a - b = %d", a, b);
}

a = 5, b = 8
a + b = 13 and a - b = -3
Create an alert message box with Bootstrap

Use the .alert class in Bootstrap to create an alert message box −
Live Demo
<!DOCTYPE html>
<html>
   <head>
      <title>Bootstrap Example</title>
      <link rel = "stylesheet" href = "https://maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css">
      <script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
      <script src = "https://maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
   </head>
   <body>
      <div class = "container">
         <div class = "alert alert-warning">
            <p>Warning!</p>
         </div>
      </div>
   </body>
</html>
Tryit Editor v3.6 - Show Python

mydb = mysql.connector.connect(
  host="localhost",
  user="myusername",
  password="mypassword",
  database="mydatabase"
)
​
#If this page is executed with no error, the database "mydatabase" exists in your system
How to convert a string in lower case in Golang? - GeeksforGeeks

26 Aug, 2019
In Go language, strings are different from other languages like Java, C++, Python, etc. It is a sequence of variable-width characters where each and every character is represented by one or more bytes using UTF-8 Encoding.In Go string, you are allowed to convert a string in the lowercase using ToLower() function. This function returns a copy of the given string in which all the Unicode letters mapped into lower case. This function is defined under strings package, so you have to import strings package in your program to access this function.
Syntax:
func ToLower(str string) string
Here, str represents a string which you want to convert to lowercase.
Example:
// Go program to illustrate how to convert// the given string to lowercasepackage main  import (    "fmt"    "strings")  // Main methodfunc main() {      // Creating and initializing string    // Using shorthand declaration    str1 := "WelcomE, GeeksforGeeks**"    str2 := "$$This is the, tuTorial oF Golang##"    str3 := "HELLO! GOLANG"    str4 := "lowercase conversion"      // Displaying strings    fmt.Println("Strings (before):")    fmt.Println("String 1: ", str1)    fmt.Println("String 2:", str2)    fmt.Println("String 3:", str3)    fmt.Println("String 4:", str4)      // Converting all the string into lowercase    // Using ToLower() function    res1 := strings.ToLower(str1)    res2 := strings.ToLower(str2)    res3 := strings.ToLower(str3)    res4 := strings.ToLower(str4)      // Displaying the results    fmt.Println("\nStrings (after):")    fmt.Println("Result 1: ", res1)    fmt.Println("Result 2:", res2)    fmt.Println("Result 3:", res3)    fmt.Println("Result 4:", res4)}
Output:
Strings (before):
String 1:  WelcomE, GeeksforGeeks**
String 2: $$This is the, tuTorial oF Golang##
String 3: HELLO! GOLANG
String 4: lowercase conversion

Strings (after):
Result 1:  welcome, geeksforgeeks**
Result 2: $$this is the, tutorial of golang##
Result 3: hello! golang
Result 4: lowercase conversion

Golang
Golang-String
Go Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
strings.Replace() Function in Golang With Examples
fmt.Sprintf() Function in Golang With Examples
How to Split a String in Golang?
Arrays in Go
Golang Maps
Slices in Golang
How to compare times in Golang?
How to Trim a String in Golang?
Inheritance in GoLang
Different Ways to Find the Type of Variable in Golang
Sum of n numbers in Python using while loop

Theory of Computation
In this post, you will learn how to find the sum of n numbers in Python using a while loop. The while loop in Python is used to iterate over a block of code as long as the truth expression (condition) is true.
In the given example, we have used the if..else statement in combination with a while loop to calculate the sum of n numbers. First, we have taken a number input from the user and stored it in a variable num. Initially, the sum is initialized to 0. Then, we have used the while loop to iterate until num gets zero. In every iteration of the loop, we have added the num to sum, and the value of num is decreased by 1.
# Sum of natural numbers up to num

num = int(input("Enter a number: ")) 

if num < 0:
   print("Please enter a positive number")
else:
   sum = 0
   
   # use while loop to iterate until zero
   while(num > 0):
       sum += num
       num -= 1
   print("The result is", sum)
Enter a number: 15
The result is 120
The above example shows the sum of the first 15 positive numbers (0-15).
Enter a number: 22
The result is 253

Jan 3
Stateful vs Stateless
A Stateful application recalls explicit subtleties of a client like profile, inclinations, and client activities...

A Stateful application recalls explicit subtleties of a client like profile, inclinations, and client activities...

Dec 29
Best programming language to learn in 2021
In this article, we have mentioned the analyzed results of the best programming language for 2021...

In this article, we have mentioned the analyzed results of the best programming language for 2021...

Dec 20
How is Python best for mobile app development?
Python has a set of useful Libraries and Packages that minimize the use of code...

Python has a set of useful Libraries and Packages that minimize the use of code...

July 18
Learn all about Emoji
In this article, we have mentioned all about emojis. It's invention, world emoji day, emojicode programming language and much more...

In this article, we have mentioned all about emojis. It's invention, world emoji day, emojicode programming language and much more...

Jan 10
Data Science Recruitment of Freshers
In this article, we have mentioned about the recruitment of data science. Data Science is a buzz for every technician...

In this article, we have mentioned about the recruitment of data science. Data Science is a buzz for every technician...






eTutorialsPoint©Copyright 2016-2022. All Rights Reserved.
Perl goto Statement

Perl does support a goto statement. There are three forms: goto LABEL, goto EXPR, and goto &NAME.
goto LABEL
The goto LABEL form jumps to the statement labeled with LABEL and resumes execution from there.
goto EXPR
The goto EXPR form is just a generalization of goto LABEL. It expects the expression to return a label name and then jumps to that labeled statement.
goto &NAME
It substitutes a call to the named subroutine for the currently running subroutine.
The syntax for a goto statements is as follows −
goto LABEL

or

goto EXPR

or

goto &NAME

The following program shows the most frequently used form of goto statement −
#/usr/local/bin/perl
   
$a = 10;

LOOP:do {
   if( $a == 15) {
      # skip the iteration.
      $a = $a + 1;
      # use goto LABEL form
      goto LOOP;
   }
   print "Value of a = $a\n";
   $a = $a + 1;
} while( $a < 20 );
When the above code is executed, it produces the following result −
Value of a = 10
Value of a = 11
Value of a = 12
Value of a = 13
Value of a = 14
Value of a = 16
Value of a = 17
Value of a = 18
Value of a = 19

Following example shows the usage of goto EXPR form. Here we are using two strings and then concatenating them using string concatenation operator (.). Finally, its forming a label and goto is being used to jump to the label −
#/usr/local/bin/perl
   
$a = 10;
$str1 = "LO";
$str2 = "OP";

LOOP:do {
   if( $a == 15) {
      # skip the iteration.
      $a = $a + 1;
      # use goto EXPR form
      goto $str1.$str2;
   }
   print "Value of a = $a\n";
   $a = $a + 1;
} while( $a < 20 );
When the above code is executed, it produces the following result −
Value of a = 10
Value of a = 11
Value of a = 12
Value of a = 13
Value of a = 14
Value of a = 16
Value of a = 17
Value of a = 18
Value of a = 19


    46 Lectures 
     4.5 hours 

 Devi Killada

    11 Lectures 
     1.5 hours 

 Harshit Srivastava

    30 Lectures 
     6 hours 

 TELCOMA Global

    24 Lectures 
     2 hours 

 Mohammad Nauman

    68 Lectures 
     7 hours 

 Stone River ELearning

    58 Lectures 
     6.5 hours 

 Stone River ELearning
 Print
 Add Notes
 Bookmark this page
Angular Material 7 - Toolbar

The <mat-toolbar>, an Angular Directive, is used to create a toolbar to show title, header or any action button.
<mat-toolbar> - Represents the main container.
<mat-toolbar> - Represents the main container.
<mat-toolbar-row> - Add a new row.
<mat-toolbar-row> - Add a new row.
In this chapter, we will showcase the configuration required to draw a toolbar 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 {MatToolbarModule} from '@angular/material'
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
@NgModule({
   declarations: [
      AppComponent
   ],
   imports: [
      BrowserModule,
      BrowserAnimationsModule,
      MatToolbarModule,
      FormsModule,
      ReactiveFormsModule
   ],
   providers: [],
   bootstrap: [AppComponent]
})
export class AppModule { }
Following is the content of the modified CSS file app.component.css.
.filler {
   flex: 1 1 auto;
}
.gap {
   margin-right: 10px;
}
Following is the content of the modified HTML host file app.component.html.
<mat-toolbar color = "primary">
   <span class = "gap">File</span>
   <span>Edit</span>
   <span class = "filler"></span>
   <span>About</span>
</mat-toolbar>
Verify the result.
As first, we've created a toolbar spanning the complete page.
Then labels are added.

    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
Python Program to Check if a Number is a Strong Number

Strong number is a number whose sum of all digits’ factorial is equal to the number ‘n’. Factorial implies when we find the product of all the numbers below that number including that number and is denoted by ! (Exclamation sign), For example: 5! = 5x4x3x2x1 = 120. When it is required to check if a number is a strong number or not, the remainder/modulus operator and the ‘while’ loop can be used.
Below is the demonstration of the same −
 Live Demo
my_sum=0
my_num = 296
print("The number is")
print(my_num)
temp = my_num
while(my_num):
   i=1
   fact=1
   remainder = my_num%10
   while(i<=remainder):
      fact=fact*i
      i=i+1
   my_sum = my_sum+fact
   my_num=my_num//10
if(my_sum == temp):
   print("The number is a strong number")
else:
   print("The number is not a strong number")
The number is
296
The number is not a strong number
A sum is initialized to 0.
A sum is initialized to 0.
The number is defined and is displayed on the console.
The number is defined and is displayed on the console.
The number is defined to a temporary variable.
The number is defined to a temporary variable.
The while loop is used where the remainder is determined.
The while loop is used where the remainder is determined.
The while loop is used again to see whether the iterator is less than or equal to the remainder.
The while loop is used again to see whether the iterator is less than or equal to the remainder.
If it is less, the ‘fact’ variable is multiplied with the iterator.
If it is less, the ‘fact’ variable is multiplied with the iterator.
It is then incremented by 1.
It is then incremented by 1.
The sum value is added to the ‘fact’ variable.
The sum value is added to the ‘fact’ variable.
If the ‘temp’ variable and the sum are equal, it is considered a string number.
If the ‘temp’ variable and the sum are equal, it is considered a string number.