code-rag-bench/online-tutorials huggingface dataset:
Powershell - Format-List Cmdlet

Format-List cmdlet can be used to formats the output as a list of properties where a property appears on a new line.
In these examples, we're see the Format-List cmdlet in action.
In this example, first we've a file test.txt in D:\temp\test with content "Welcome to TutorialsPoint.Com" and test1.txt with content "Hello World!" and "Welcome to TutorialsPoint.Com" in two lines.
Get the file details in a variable.
$A = Get-ChildItem D:\temp\test\*.txt
Get the file details using Format-List cmdlet.
Format-List -InputObject $A
You can see following output in PowerShell console.
Directory: D:\temp\test

Name           : test.txt
Length         : 31
CreationTime   : 4/4/2018 4:48:38 PM
LastWriteTime  : 4/11/2018 4:40:15 PM
LastAccessTime : 4/4/2018 4:48:38 PM
VersionInfo    : File:             D:\temp\test\test.txt
                 InternalName:     
                 OriginalFilename: 
                 FileVersion:      
                 FileDescription:  
                 Product:          
                 ProductVersion:   
                 Debug:            False
                 Patched:          False
                 PreRelease:       False
                 PrivateBuild:     False
                 SpecialBuild:     False
                 Language:         
                 

Name           : test1.txt
Length         : 44
CreationTime   : 4/12/2018 6:54:48 PM
LastWriteTime  : 4/12/2018 6:56:21 PM
LastAccessTime : 4/12/2018 6:54:48 PM
VersionInfo    : File:             D:\temp\test\test1.txt
                 InternalName:     
                 OriginalFilename: 
                 FileVersion:      
                 FileDescription:  
                 Product:          
                 ProductVersion:   
                 Debug:            False
                 Patched:          False
                 PreRelease:       False
                 PrivateBuild:     False
                 SpecialBuild:     False
                 Language:         

Get the list of services
Type the following command in PowerShell ISE Console
Get-Service | Format-List
You can see following output in PowerShell console.
Name                : AdobeARMservice
DisplayName         : Adobe Acrobat Update Service
Status              : Running
DependentServices   : {}
ServicesDependedOn  : {}
CanPauseAndContinue : False
CanShutdown         : False
CanStop             : True
ServiceType         : Win32OwnProcess

Name                : AdobeFlashPlayerUpdateSvc
DisplayName         : Adobe Flash Player Update Service
Status              : Stopped
DependentServices   : {}
ServicesDependedOn  : {}
CanPauseAndContinue : False
CanShutdown         : False
CanStop             : False
ServiceType         : Win32OwnProcess
...         


    15 Lectures 
     3.5 hours 

 Fabrice Chrzanowski

    35 Lectures 
     2.5 hours 

 Vijay Saini

    145 Lectures 
     12.5 hours 

 Fettah Ben
 Print
 Add Notes
 Bookmark this page
\widetilde - Tex Command

\widetilde - Used to create widetilde symbol.
{ \widetilde}
\widetilde command draws widetilde symbol.

\widetilde a

a~


\widetilde A

A~


\widetilde AB

A~B


\widetilde{AB}

AB~



\widetilde a

a~


\widetilde a
\widetilde A

A~


\widetilde A
\widetilde AB

A~B


\widetilde AB
\widetilde{AB}

AB~


\widetilde{AB}

    14 Lectures 
     52 mins

 Ashraf Said

    11 Lectures 
     1 hours 

 Ashraf Said

    9 Lectures 
     1 hours 

 Emenwa Global, Ejike IfeanyiChukwu

    29 Lectures 
     2.5 hours 

 Mohammad Nauman

    14 Lectures 
     1 hours 

 Daniel Stern

    15 Lectures 
     47 mins

 Nishant Kumar
 Print
 Add Notes
 Bookmark this page
Drawing an SVG file on an HTML5 canvas

To drawHTMLImageElements on a canvas element, use the drawImage() method.This method defines an Image variable with src=”mySVG.svg”, anduse drawImage on load.
var myImg = new Image();
myImg.onload = function() {
   ctx.drawImage(myImg, 0, 0);
}
img.src = "http://www.example.com/files/sample.svg ";
How to convert a string into a integer without using parseInt() function in JavaScript ? - GeeksforGeeks

02 Jun, 2021
In JavaScript, there is a simple function parseInt() to convert a string to an integer. In order to know more about the function, you can refer to this. In this article, we will learn how to convert the string to integer without using the parseInt() function. Advantage of parseInt() over this method. The parseInt() function converts number which is present in any base to base 10 which is not possible using the method discusses above.
The very simple idea is to multiply the string with 1. If the string contains a number it will convert to an integer otherwise NaN will be returned
Example 1:
Javascript
<script>        function convertStoI() {        var a = "100";        var b = a*1;        console.log(typeof(b));        var d = "3 11 43"*1;        console.log(typeof(d));    }convertStoI();</script>    
Output:
number
number
Example 2:
Javascript
</script>    function convertStoI() {      // The second argument specifies      // the number passes is in base 2              var r = parseInt("111", 2);             console.log('Integer value is ' + r);                // The second argument specifies       // the number passes is in base 8      var p = parseInt("156", 8);             console.log('Integer value is ' + p);                // The second argument specifies       // the number passes is in base 16      var q = parseInt("AE", 16);             console.log('Integer value is ' + q);                       }convertStoI();</script>
Output:
Integer value is 7
Integer value is 110
Integer value is 174
javascript-basics
JavaScript-Questions
javascript-string
JavaScript
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Difference between var, let and const keywords in JavaScript
Difference Between PUT and PATCH Request
How to get character array from string in JavaScript?
How to filter object array based on attributes?
Remove elements from a JavaScript Array
Roadmap to Become a Web Developer in 2022
Installation of Node.js on Linux
How to fetch data from an API in ReactJS ?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to insert spaces/tabs in text using HTML/CSS?
Find the most repeated word in a text file - GeeksforGeeks

25 Oct, 2021
Python provides inbuilt functions for creating, writing, and reading files. Two types of files can be handled in python, normal text files, and binary files (written in binary language,0s and 1s).
Text files: In this type of file, Each line of text is terminated with a special character called EOL (End of Line), which is the new line character (‘\n’) in python by default.
Binary files: In this type of file, there is no terminator for a line, and the data is stored after converting it into machine-understandable binary language.
Here we are operating on the .txt file in Python. Through this program, we will find the most repeated word in a file.
Approach:
We will take the content of the file as input.
We will save each word in a list after removing spaces and punctuation from the input string.
Find the frequency of each word.
Print the word which has a maximum frequency.
Input File:
Below is the implementation of the above approach:
Python3
# Python program to find the most repeated word# in a text file # A file named "gfg", will be opened with the # reading mode.file = open("gfg.txt","r")frequent_word = ""frequency = 0 words = [] # Traversing file line by linefor line in file:         # splits each line into    # words and removing spaces    # and punctuations from the input    line_word = line.lower().replace(',','').replace('.','').split(" ");          # Adding them to list words    for w in line_word:         words.append(w);          # Finding the max occurred wordfor i in range(0, len(words)):          # Declaring count    count = 1;          # Count each word in the file     for j in range(i+1, len(words)):         if(words[i] == words[j]):             count = count + 1;      # If the count value is more    # than highest frequency then    if(count > frequency):         frequency = count;         frequent_word = words[i];  print("Most repeated word: " + frequent_word)print("Frequency: " + str(frequency))file.close();
Output:
Most repeated word: well
Frequency: 3
saurabh1990aror
Python file-handling-programs
python-file-handling
Technical Scripter 2020
Python
Technical Scripter
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
How to drop one or multiple columns in Pandas Dataframe
Python Classes and Objects
Python | os.path.join() method
Python | Get unique values from a list
Create a directory in Python
Defaultdict in Python
Python | Pandas dataframe.groupby()
regexp_like(string, pattern)

presto:default> SELECT regexp_like('1a 2b 3c 6f', '\d+c') as expression; 
 expression 
------------ 
   true

Here, the digit 3 has character c, hence the result is true.
presto:default> SELECT regexp_like('1a 2b 3c 6f', '\d+e') as expression; 
 expression 
------------ 
   false 

Here, the character e is not in the regular expression.

    46 Lectures 
     3.5 hours 

 Arnab Chakraborty

    23 Lectures 
     1.5 hours 

 Mukund Kumar Mishra

    16 Lectures 
     1 hours 

 Nilay Mehta

    52 Lectures 
     1.5 hours 

 Bigdata Engineer

    14 Lectures 
     1 hours 

 Bigdata Engineer

    23 Lectures 
     1 hours 

 Bigdata Engineer
 Print
 Add Notes
 Bookmark this page
How to generate a 24bit hash using Python?

A random 24 bit hash is just random 24 bits. You can generate these just using the random module. 
import random
hash = random.getrandbits(24)
print(hex(hash))
This will give the output
0x94fbee
Is there any equivalent to typedef of C/C++ in Java ? - GeeksforGeeks

30 Mar, 2020
In one line, There is nothing in Java which is equivalent to typedef of C++.
In Java, class is used to name and construct types or we can say that class is the combined function of C++’s struct and typedef. But that is totally different thing and not the equivalent of typedef anywhere.
typedef: It is a keyword not a function that is used in C/C++ language to assign alternative names to existing data types. It is used with the user defined data types when the name of data types get little bit complicated that time the typedef keyword is used, unless it is unnecessary.Syntax of using typedef:
typedef existing_name alias_name;

C++
C
// C++ program to demonstrate typedef #include <bits/stdc++.h>using namespace std;   // After this line BYTE can be used // in place of unsifted char typedef unsigned char BYTE;   int main() {     BYTE b1, b2;     b1 = 'a';     cout << b1 ;     return 0; }   // This code is contributed by shubhamsingh10
// C program to demonstrate typedef#include <stdio.h>  // After this line BYTE can be used// in place of unsifted chartypedef unsigned char BYTE;  int main(){    BYTE b1, b2;    b1 = 'a';    printf("%c ", b1);    return 0;}
a

typedef with pointers:typedef will also work with the pointer in C/C++ language like renaming existing keywords. In case of pointers * binds in the right not the left side.
int* x, y;

In the above syntax, we are actually declaring x as a pointer of type int, whereas y will be declared as a plain integer But if we use typedef then we can declare any number of pointers in a single statement like below.
typedef int* IntPtr ;
IntPtr x, y, z;

typedef can be used for :
typedef can provide a simple name for a complicated type cast
typedef can also be used to give names to unnamed types. In such cases, the typedef will be the only name for said type
SHUBHAMSINGH10
C-Data Types
cpp-data-types
Picked
Technical Scripter 2018
C Language
C++
Java
Java
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Multidimensional Arrays in C / C++
rand() and srand() in C/C++
Core Dump (Segmentation fault) in C/C++
Command line arguments 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)
Socket Programming in C/C++
How to create an empty plot using ggplot2 in R?

The two most easy ways to create an empty plot using ggplot2 are using geom_blank function and also adding the theme_bw along with the geom_blank. The geom_blank will create an empty plot with white gridlines and grey background, on the other hand, addition of theme_bw will create the empty plot with grey gridlines and white background.
Consider the below data frame:
Live Demo
> set.seed(151)
> x<-rnorm(20)
> y<-rnorm(20,1,0.5)
> df<-data.frame(x,y)
> df
      x         y
1  -0.05153895 0.3139643
2   0.76573738 0.1816184
3  -0.14673959 0.8201743
4  -0.11318581 1.6005576
5  -0.39551140 0.6770630
6  0.78227595 0.7446956
7  -1.39747811 0.7004385
8  -1.01883832 1.2728014
9   0.22947586 0.7543531
10  0.67217297 1.0957678
11 -0.48455178 0.7207362
12  0.56060896 1.4613498
13  0.06615648 1.5769990
14 -1.34987612 0.3137949
15 -0.24291581 1.6450906
16 -1.23674102 1.5774510
17 -1.47467765 1.7228397
18  2.43715892 1.1305064
19  0.67352581 1.9645730
20  0.31003951 0.7000570
Loading ggplot2 package and creating an empty plot with grey background:
> library(ggplot2)
> ggplot(df,aes(x,y))+geom_blank()
Creating an empty plot with white background:
> ggplot(df,aes(x,y))+geom_blank()+theme_bw()
Double compare() Method in Java with Examples - GeeksforGeeks

22 Jun, 2021
The compare() method of Double Class is a built-in method in Java that compares the two specified double values. The sign of the integer value returned is the same as that of the integer that would be returned by the function call. 
Syntax: 
public static int compare(double d1, double d2)
Parameters: The function accepts two parameters:  
d1: The first double value to be compared.
d2: The second double value to be compared.
Return Value: The function returns value as below:  
0: if d1 is numerically equal to d2.
Negative value: if d1 is numerically less than d2.
Positive value: if d1 is numerically greater than d2.
Below programs illustrates the use of Double.compare() function:
Program 1: When two integers are same  
Java
// Java Program to illustrate// the Double.compare() method import java.lang.Double; public class GFG {    public static void main(String[] args)    {         // Get the two double values        // to be compared        Double d1 = 1023d;        Double d2 = 1023d;         // function call to compare two double values        if (Double.compare(d1, d2) == 0) {             System.out.println("d1=d2");        }        else if (Double.compare(d1, d2) < 0) {             System.out.println("d1<d2");        }        else {             System.out.println("d1>d2");        }    }}
d1=d2
 
Program 2 : When d1<d2
Java
// Java Program to illustrate// the Double.compare() method import java.lang.Double; public class GFG {    public static void main(String[] args)    {         // Get the two double values        // to be compared        Double d1 = 10d;        Double d2 = 1023d;         // function call to compare two double values        if (Double.compare(d1, d2) == 0) {             System.out.println("d1=d2");        }        else if (Double.compare(d1, d2) < 0) {             System.out.println("d1<d2");        }        else {             System.out.println("d1>d2");        }    }}
d1
Program 3 : When d1>d2
Java
// Java Program to illustrate// the Double.compare() method import java.lang.Double; public class GFG {    public static void main(String[] args)    {         // Get the two double values        // to be compared        Double d1 = 1023d;        Double d2 = 10d;         // function call to compare two double values        if (Double.compare(d1, d2) == 0) {             System.out.println("d1=d2");        }        else if (Double.compare(d1, d2) < 0) {             System.out.println("d1<d2");        }        else {             System.out.println("d1>d2");        }    }}
d1>d2
 
Reference: https://docs.oracle.com/javase/7/docs/api/java/lang/Double.html#compare(double, %20double) 
rajeev0719singh
Java-Double
Java-Functions
Java-lang package
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Initialize an ArrayList in Java
Interfaces in Java
ArrayList in Java
Multidimensional Arrays in Java
Stack Class in Java
Stream In Java
Singleton Class in Java
Set in Java
Overriding in Java
LinkedList in Java
Solidity - While Loop

The most basic loop in Solidity is the while loop which would be discussed in this chapter. The purpose of a while loop is to execute a statement or code block repeatedly as long as an expression is true. Once the expression becomes false, the loop terminates.
The flow chart of while loop looks as follows −
The syntax of while loop in Solidity is as follows −
while (expression) {
   Statement(s) to be executed if expression is true
}

Try the following example to implement while loop.
pragma solidity ^0.5.0;

contract SolidityTest {
   uint storedData; 
   constructor() public{
      storedData = 10;   
   }
   function getResult() public view returns(string memory){
      uint a = 10; 
      uint b = 2;
      uint result = a + b;
      return integerToString(result); 
   }
   function integerToString(uint _i) internal pure 
      returns (string memory) {
      
      if (_i == 0) {
         return "0";
      }
      uint j = _i;
      uint len;
      
      while (j != 0) {
         len++;
         j /= 10;
      }
      bytes memory bstr = new bytes(len);
      uint k = len - 1;
      
      while (_i != 0) { // while loop
         bstr[k--] = byte(uint8(48 + _i % 10));
         _i /= 10;
      }
      return string(bstr);
   }
}
Run the above program using steps provided in Solidity First Application chapter.
0: string: 12


    38 Lectures 
     4.5 hours 

 Abhilash Nelson

    62 Lectures 
     8.5 hours 

 Frahaan Hussain

    31 Lectures 
     3.5 hours 

 Swapnil Kole
 Print
 Add Notes
 Bookmark this page
HTML | <form> name Attribute - GeeksforGeeks

27 May, 2019
The HTML <form> name Attribute is used to specify the name of a form Element. It is used to reference the form-data after submitting the form or to reference the element in a JavaScript.
Syntax:
<form name="name"> 
Attribute Values: It contains a single value name which describes the name of the <form> element.
Example:
<!DOCTYPE html><html>  <body style="text-align:center;">    <h1 style="color:green;">     GeeksForGeeks </h1>      <h2>HTML Form name Attribute.</h2>    <form id="users" action="#" name="Geeks">        First name:          <input type="text" name="fname" value="Manas">        <br> Last name:          <input type="text" name="lname" value="Chhabra">        <br>          <input type="submit" value="Submit">    </form></body>  </html>
Output:
Supported Browsers:
Google Chrome
Firefox
Edge
Opera
Apple Safari
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.
HTML-Attributes
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to Insert Form Data into Database using PHP ?
REST API (Introduction)
Design a web page using HTML and CSS
Form validation using HTML and JavaScript
How to position a div at the bottom of its container using CSS?
Top 10 Front End Developer Skills That You Need in 2022
Installation of Node.js on Linux
How to fetch data from an API in ReactJS ?
Difference between var, let and const keywords in JavaScript
Convert a string to an integer in JavaScript
Explain final class and final method in PHP.

The final keyword is introduced by PHP5 related to the object-oriented programming concept.
But before we move on to the final, we need to ensure that we have a good understanding of the inheritance concept. In inheritance, we can inherit a class from another class. Also, we can override a function in an inherited class, to replace the behavior originally provided. In some cases, we might need to keep a class from being inherited from or we may need to prevent a function to be overridden. This can be achieved with the final, by prefixing the class and function with the final keyword.which essentially causes PHP to produced an error in the event that anybody attempts to extend a final class or override final function.
we can only use the final keyword with methods and classes.
Let's demonstrate the concept with the help of the below examples.
We can't override the parent class function.
<?php
   class BaseClass{
      final function calculate($val1,$val2){
         $sum = $val1+$val2;
         echo "Sum of given no=".$sum;
         }
      }
   class ChildClass extends BaseClass{
      function calculate($x,$y){
         $mult=$val1*$val2;
         echo "Multiplication of given no=".$mult;
         }
      }
   $obj= new ChildClass();
   $obj->show(10,10);
?>
PHP Fatal error: Cannot override final method BaseClass::calculate()
In the above example the class BaseClass which is parent class. In which the calculate method is marked as final. It implies that we cannot override the show method in any of its child classes. To identify the error  ChildClass is trying to define the final method show (). This will produce a fatal error, It implies that the final method of parent class can't be defined in its child class.
Utilize of "Final" keyword Before The Class
<?php
   final Class BaseClass{
      function printData($val1,$val2){
         $add=$val1+$val2;
         echo "Sum of given no=".$s;
         }
      }
   class Child extends BaseClass{
      function printData($val1,$val2){
         $m=$val1*$val2;
         echo "Multiplication of given no=".$m;
         }
      }
   $obj= new Child();
   $obj->printData(20,20);
?>
PHP Fatal error: Class Child may not inherit from final class (BaseClass)
In the above example class BaseClass define with the final, that result we can not extend this class. When class Child tries to extend from BaseClass ( which implies Child is the child class of BaseClass). For this situation, PHP throws an error message “Class Child may not inherit from the final class (BaseClass)”.It implies that it won't permit creating any child class of BaseClass.
PHP while Loop

The while loop - Loops through 
a block of code as long as the specified condition is true.
The while loop executes a block of code as long as the specified condition is true.
The example below displays the numbers from 1 to 5:
$x = 1; - Initialize the loop counter ($x), and set the start value to 1
$x <= 5 - Continue the loop as long as $x is less than or equal to 5
$x++; - Increase the loop counter value by 1 for each iteration
This example counts to 100 by tens:
$x = 0; - Initialize the loop counter ($x), and set the start value to 0
$x <= 100 - Continue the loop as long as $x is less than or equal to 100
$x+=10; - Increase the loop counter value by 10 for each iteration
Output $i as long as $i is less than 6.
$i = 1; 

 ($i < 6) 
  echo $i;
  $i++;


We just launchedW3Schools videos
Get certifiedby completinga course today!
If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:
help@w3schools.com
Your message has been sent to W3Schools.
Difference Between for and while loop

In this post, we will understand the difference between the ‘for’ and the ‘while’ loop.
The initialization, condition checking, and the iteration statements are written at the beginning of the loop.
The initialization, condition checking, and the iteration statements are written at the beginning of the loop.
It is used only when the number of iterations is known beforehand.
It is used only when the number of iterations is known beforehand.
If the condition is not mentioned in the 'for' loop, then the loop iterates infinite number of times.
If the condition is not mentioned in the 'for' loop, then the loop iterates infinite number of times.
The initialization is done only once, and it is never repeated.
The initialization is done only once, and it is never repeated.
The iteration statement is written at the beginning.
The iteration statement is written at the beginning.
Hence, it executes once all statements in loop have been executed.
Hence, it executes once all statements in loop have been executed.
for(initialization; condition; iteration){
   //body of the 'for' loop
}
Following is the flowchart of for loop −
The initialization and the condition checking is done at the beginning of the loop.
The initialization and the condition checking is done at the beginning of the loop.
It is used only when the number of iterations isn’t known.
It is used only when the number of iterations isn’t known.
If the condition is not mentioned in the 'while' loop, it results in a compilation error.
If the condition is not mentioned in the 'while' loop, it results in a compilation error.
If the initialization is done when the condition is being checked, then initialization occurs every time the loop is iterated through.
If the initialization is done when the condition is being checked, then initialization occurs every time the loop is iterated through.
The iteration statement can be written within any point inside the loop.
The iteration statement can be written within any point inside the loop.
while ( condition) {
   statements;
   //body of the loop
}
Following is the flowchart of while loop −
How to calculate transpose of a matrix using C program?

The transpose of a matrix is the one whose rows are columns of the original matrix, i.e. if A and B are two matrices such that the rows of the matrix B are the columns of the matrix A then Matrix B is said to be the transpose of Matrix A.
The logic used to change m(i,j) matrix to m(j,i) is as follows −
for (i = 0;i < m;i++)
   for (j = 0; j < n; j++)
      transpose[j][i] = matrix[i][j];
In this example, we shall print the transpose of a matrix using for loop.
 Live Demo
#include <stdio.h>
int main(){
   int m, n, i, j, matrix[10][10], transpose[10][10];
   printf("Enter rows and columns :\n");
   scanf("%d%d", &m, &n);
   printf("Enter elements of the matrix\n");
   for (i= 0; i < m; i++)
      for (j = 0; j < n; j++)
         scanf("%d", &matrix[i][j]);
   for (i = 0;i < m;i++)
      for (j = 0; j < n; j++)
         transpose[j][i] = matrix[i][j];
   printf("Transpose of the matrix:\n");
   for (i = 0; i< n; i++) {
      for (j = 0; j < m; j++)
         printf("%d\t", transpose[i][j]);
      printf("\n");
   }
   return 0;
}
Enter rows and columns :
2 3
Enter elements of the matrix
1 2 3
2 4 5
Transpose of the matrix:
1    2
2    4
3    5
 Live Demo
#include<stdio.h>
#define ROW 2
#define COL 5
int main(){
   int i, j, mat[ROW][COL], trans[COL][ROW];
   printf("Enter matrix: \n");
   // input matrix
   for(i = 0; i < ROW; i++){
      for(j = 0; j < COL; j++){
         scanf("%d", &mat[i][j]);
      }
   }
   // create transpose
   for(i = 0; i < ROW; i++){
      for(j = 0; j < COL; j++){
         trans[j][i] = mat[i][j];
      }
   }
   printf("\nTranspose matrix: \n");
   // print transpose
   for(i = 0; i < COL; i++){
      for(j = 0; j < ROW; j++){
         printf("%d ", trans[i][j]);
      }
      printf("\n");
   }
   return 0;
}
Enter matrix:
1 2 3 4 5
5 4 3 2 1

Transpose matrix:
1 5
2 4
3 3
4 2
5 1
Align gathered items at the end in Bootstrap 4

Use .align-content-end class to align gathered items at the end in Bootstrap 4.
To set the items at the end −
<div class="d-flex flex-wrap align-content-end”>
You need to now add the flex items as shown below −
<div class="d-flex flex-wrap align-content-end bg-primary" style="height:250px">
  <div class="p-2 border">One</div>
  <div class="p-2 border">Two</div>
  <div class="p-2 border">Three</div>
  <div class="p-2 border">Four</div>
  <div class="p-2 border">Five</div>
  <div class="p-2 border">Six</div>
</div>
Let us see an example to learn how to align gathered items at the end in Bootstrap 4 −
Live Demo
<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Bootstrap Example</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/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.0/js/bootstrap.min.js"></script>
  </head>
<body>
<div class="container mt-3">
  <h2>Example</h2>
  <div class="d-flex flex-wrap align-content-end bg-primary" style="height:250px">
    <div class="p-2 border">One</div>
    <div class="p-2 border">Two</div>
    <div class="p-2 border">Three</div>
    <div class="p-2 border">Four</div>
    <div class="p-2 border">Five</div>
    <div class="p-2 border">Six</div>
    <div class="p-2 border">Seven</div>
    <div class="p-2 border">Eight</div>
    <div class="p-2 border">Nine</div>
    <div class="p-2 border">Ten</div>
    <div class="p-2 border">Eleven</div>
    <div class="p-2 border">Twelve</div>
    <div class="p-2 border">Thirteen</div>
    <div class="p-2 border">Fourteen</div>
  </div>
 </div>
</body>
</html>
Initialization of variables sized arrays in C - GeeksforGeeks

28 Sep, 2018
The C99 standard allows variable sized arrays (see this). But, unlike the normal arrays, variable sized arrays cannot be initialized.
For example, the following program compiles and runs fine on a C99 compatible compiler.
#include<stdio.h>  int main(){  int M = 2;  int arr[M][M];  int i, j;  for (i = 0; i < M; i++)  {    for (j = 0; j < M; j++)    {       arr[i][j] = 0;       printf ("%d ", arr[i][j]);    }    printf("\n");  }  return 0;}
Output:
0 0
0 0

But the following fails with compilation error.
#include<stdio.h>  int main(){  int M = 2;  int arr[M][M] = {0}; // Trying to initialize all values as 0  int i, j;  for (i = 0; i < M; i++)  {    for (j = 0; j < M; j++)       printf ("%d ", arr[i][j]);    printf("\n");  }  return 0;}
Output:
Compiler Error: variable-sized object may not be initialized

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
C Array and String
C Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
rand() and srand() in C/C++
fork() in C
Left Shift and Right Shift Operators in C/C++
Command line arguments in C/C++
Different methods to reverse a string in C/C++
Substring in C++
Function Pointer in C
TCP Server-Client implementation in C
Enumeration (or enum) in C
Structures in C
W3.CSS - Containers

HTML5 has the following container elements −
<div> − Provides a generic container to HTML content.
<div> − Provides a generic container to HTML content.
<header> − Represents the header section.
<header> − Represents the header section.
<footer> − Represents the footer section.
<footer> − Represents the footer section.
<article> − Represents articles.
<article> − Represents articles.
<section> − Provides a generic container for various types of sections.
<section> − Provides a generic container for various types of sections.
W3.CSS provides w3-container as a primary class to style all the above-mentioned containers. W3.CSS also has other classes like w3-border, w3-red, w3-teal, w3-padding-32 to add further styling attributes to the containers.
The following example showcases the use of w3-container class to style various containers.
<html>
   <head>
      <title>The W3.CSS Containers</title>
      <meta name = "viewport" content = "width = device-width, initial-scale = 1">
      <link rel = "stylesheet" href = "https://www.w3schools.com/lib/w3.css">
   </head>
   
   <body>
      <header class = "w3-container w3-red">
         <h1>HTML5 Tutorial</h1>
      </header>
      
      <div class = "w3-container w3-border w3-teal">
         <p>HTML5 is the latest and most enhanced version of HTML. Technically, HTML is not a programming language, but rather a mark up language.</p>
      </div>
      
      <article class = "w3-container">
         <p>The latest versions of Apple Safari, Google Chrome, Mozilla Firefox, and Opera all support many HTML5 features and Internet Explorer 9.0 will also have support for some HTML5 functionality. The mobile web browsers that come pre-installed on iPhones, iPads, and Android phones all have excellent support for HTML5.</p>
      </article>
      
      <section class = "w3-container">
         <p>HTML5 is designed, as much as possible, to be backward compatible with existing web browsers. New features build on existing features and allow you to provide fallback content for older browsers.</p>
      </section>
      
      <footer class = "w3-container w3-red">
         <p>Copyright @TutorialsPoint.COM</p>
      </footer>
   </body>
</html>
Verify the result.
HTML5 is the latest and most enhanced version of HTML. Technically, HTML is not a programming language, but rather a mark up language.
The latest versions of Apple Safari, Google Chrome, Mozilla Firefox, and Opera all support many HTML5 features and Internet Explorer 9.0 will also have support for some HTML5 functionality. The mobile web browsers that come pre-installed on iPhones, iPads, and Android phones all have excellent support for HTML5.
HTML5 is designed, as much as possible, to be backward compatible with existing web browsers. New features build on existing features and allow you to provide fallback content for older browsers.
SQL - AVG Function

SQL AVG function is used to find out the average of a field in various records.
To understand AVG function, 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 calculate average of all the dialy_typing_pages, then you can do so by using the following command −
SQL> SELECT AVG(daily_typing_pages)
    -> FROM employee_tbl;
+-------------------------+
| AVG(daily_typing_pages) |
+-------------------------+
|                230.0000 |
+-------------------------+
1 row in set (0.03 sec)
You can take average of various records set using GROUP BY clause. Following example will take average all the records related to a single person and you will have average typed pages by every person.
SQL> SELECT name, AVG(daily_typing_pages)
   -> FROM employee_tbl GROUP BY name;
+------+-------------------------+
| name | AVG(daily_typing_pages) |
+------+-------------------------+
| Jack |                135.0000 |
| Jill |                220.0000 |
| John |                250.0000 |
| Ram  |                220.0000 |
| Zara |                325.0000 |
+------+-------------------------+
5 rows in set (0.20 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
java.util.regex.Pattern.compile() Method

The java.util.regex.Pattern.compile(String regex, int flags) method compiles the given regular expression into a pattern.
Following is the declaration for java.util.regex.Pattern.compile(String regex, int flags) method.
public static Pattern compile(String regex, int flags)

regex − The expression to be compiled.
regex − The expression to be compiled.
flags − Match flags, a bit mask that may include CASE_INSENSITIVE, MULTILINE, DOTALL, UNICODE_CASE, CANON_EQ, UNIX_LINES, LITERAL, UNICODE_CHARACTER_CLASS and COMMENTS.
flags − Match flags, a bit mask that may include CASE_INSENSITIVE, MULTILINE, DOTALL, UNICODE_CASE, CANON_EQ, UNIX_LINES, LITERAL, UNICODE_CHARACTER_CLASS and COMMENTS.
IllegalArgumentException − If bit values other than those corresponding to the defined match flags are set in flags.
IllegalArgumentException − If bit values other than those corresponding to the defined match flags are set in flags.
PatternSyntaxException − If the expression's syntax is invalid.
PatternSyntaxException − If the expression's syntax is invalid.
The following example shows the usage of java.util.regex.Pattern.compile(String regex, int flags) method.
package com.tutorialspoint;

import java.util.regex.MatchResult;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class PatternDemo {
   private static final String REGEX = "(.*)(\\d+)(.*)?# 3 capturing groups";
   private static final String INPUT = "This is a sample Text, 1234, with numbers in between.";

   public static void main(String[] args) {
      // create a pattern
      Pattern pattern = Pattern.compile(REGEX,Pattern.COMMENTS);
      
      // get a matcher object
      Matcher matcher = pattern.matcher(INPUT); 

      if(matcher.find()) {
         //get the MatchResult Object 
         MatchResult result = matcher.toMatchResult();

         //Prints the offset after the last character matched.
         System.out.println("First Capturing Group - Match String end(): "+result.end());         
      }
   }
}
Let us compile and run the above program, this will produce the following result −
First Capturing Group - Match String end(): 53

 Print
 Add Notes
 Bookmark this page
Print all the duplicates in the input string in C++

In this problem, we are given a string and we have to find all the characters that are duplicated along with their number of occurrences in the string.
Let’s take an example to understand the problem −
Input:
TutorialsPoint
Output:
t (3)
o (2)
i (2)
Explanation− The frequencies of occurrence of each character are t → 3; u → 1; o → 2; r → 1; i → 2; a → 1; s → 1; n → 1.
Now, to solve this problem we will find the character count and store it in an
array from the string. And then print the characters and occurrences where freq. It is more than 1.
 Live Demo
# include <iostream>
using namespace std;
# define NO_OF_CHARS 256
class duplicate_char{
   public :
   void charCounter(char *str, int *count){
      int i;
      for (i = 0; *(str + i); i++)
      count[*(str + i)]++;
   }
   void printDuplicateCharacters(char *str){
      int *count = (int *)calloc(NO_OF_CHARS, sizeof(int));
      charCounter(str, count);
      int i;
      for (i = 0; i < NO_OF_CHARS; i++)
         if(count[i] > 1)
            printf("%c\t\t %d \n", i, count[i]);
      free(count);
   }
};
int main(){
   duplicate_char dupchar ;
   char str[] = "tutorialspoint";
   cout<<"The duplicate characters in the string\n";
   cout<<"character\tcount\n";
   dupchar.printDuplicateCharacters(str);
   return 0;
}
The duplicate characters in the string
character count
i 2
o 2
t 3
How to write a function in Typescript ? - GeeksforGeeks

09 Aug, 2021
Writing a function in TypeScript is similar to writing them in JavaScript but with added parameters and return type. Note that any JavaScript function is a perfectly valid TypeScript function. However, we can do better by adding type.
Syntax: Let’s see a basic TypeScript function syntax (with two arguments)
function functionName(arg1: <arg1Type>, 
        arg2: <arg2Type>): <returnType> {
    // Function body...
}
Below are some functions to help better understand.
Example 1: In this example, we are writing a function to add two numbers 
Javascript
// TypeScript Code// Following function returns the addition// of it's two parametersfunction addTwo(a: number, b: number): number {    return a + b;} console.log(addTwo(7, 8)); // logs 15
Output:
15
Example 2: Add two numbers and return equivalent hexadecimal string.
Javascript
// Following function adds it's two parameters then// returns it as string form in base 16function getHexAddition(a: number, b: number): string {    return (a + b).toString(16);} console.log(getHexAddition(10, 16)); // logs '1a'
Output:
1a
Adding Optional and Default Parameters: Adding an optional parameter is super simple, just add ? to the end of the argument name.  
Example 3: Write a function that logs a Good Morning message with a name, if a name is not passed then logs only Good Morning.
Javascript
// Following function returns good morning// message based on value of name passedfunction goodMorning(name?: string): string {        // if name exits use it as suffix else ignore name    const suffix = (name ? `, ${name}.` : '.');    return 'Good Morning' + suffix;} // logs 'Good Morning.'console.log(goodMorning()); // logs 'Good Morning, Sam.'console.log(goodMorning('Sam'));
Output: For default argument suffix it with an equal sign and default value (TS compiler will automatically deduce the type for default argument based on provided value).
Good Morning.
Good Morning, Sam.
Example 4: Write a function that returns the base^{power}, if power is not provided then it is assumed to be 1.
Javascript
function pow(base: number, power = 1): number {   return Math.pow(base, power);} console.log(pow(7));    // logs 7console.log(pow(7, 2)); // logs 49
Output:
7
49
 
simmytarika5
JavaScript-Questions
Picked
TypeScript
JavaScript
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Difference between var, let and const keywords in JavaScript
Difference Between PUT and PATCH Request
How to get character array from string in JavaScript?
Remove elements from a JavaScript Array
How to get selected value in dropdown list using JavaScript ?
Top 10 Front End Developer Skills That You Need in 2022
Installation of Node.js on Linux
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?
C++ String Library - substr

It returns a newly constructed string object with its value initialized to a copy of a substring of this object.
Following is the declaration for std::string::substr.
string substr (size_t pos = 0, size_t len = npos) const;
string substr (size_t pos = 0, size_t len = npos) const;
string substr (size_t pos = 0, size_t len = npos) const;
str − It is a string object.
str − It is a string object.
len − It is used to copy the characters.
len − It is used to copy the characters.
pos − Position of the first character to be copied.
pos − Position of the first character to be copied.
It returns a string object with a substring of this object.
if an exception is thrown, there are no changes in the string.
In below example for std::string::substr.
#include <iostream>
#include <string>

int main () {
   std::string str="Tutorialspoit is a one the best site in the world, hope so it will move same .";

   std::string str2 = str.substr (3,5);

   std::size_t pos = str.find("live");

   std::string str3 = str.substr (pos);

   std::cout << str2 << ' ' << str3 << '\n';

   return 0;
}
The sample output should be like this −
Hello, 1!

 Print
 Add Notes
 Bookmark this page
Kubernetes - Labels & Selectors

Labels are key-value pairs which are attached to pods, replication controller and services. They are used as identifying attributes for objects such as pods and replication controller. They can be added to an object at creation time and can be added or modified at the run time.
Labels do not provide uniqueness. In general, we can say many objects can carry the same labels. Labels selector are core grouping primitive in Kubernetes. They are used by the users to select a set of objects.
Kubernetes API currently supports two type of selectors −
Equality-based selectors
Set-based selectors
They allow filtering by key and value. Matching objects should satisfy all the specified labels.
Set-based selectors allow filtering of keys according to a set of values.
apiVersion: v1
kind: Service
metadata:
   name: sp-neo4j-standalone
spec:
   ports:
      - port: 7474
      name: neo4j
   type: NodePort
   selector:
      app: salesplatform ---------> 1
      component: neo4j -----------> 2

In the above code, we are using the label selector as app: salesplatform and component as component: neo4j.
Once we run the file using the kubectl command, it will create a service with the name sp-neo4j-standalone which will communicate on port 7474. The ype is NodePort with the new label selector as app: salesplatform and component: neo4j.

    41 Lectures 
     5 hours 

 AR Shankar

    15 Lectures 
     2 hours 

 Harshit Srivastava, Pranjal Srivastava

    18 Lectures 
     1.5 hours 

 Nigel Poulton

    25 Lectures 
     1.5 hours 

 Pranjal Srivastava

    18 Lectures 
     1 hours 

 Pranjal Srivastava

    26 Lectures 
     1.5 hours 

 Pranjal Srivastava
 Print
 Add Notes
 Bookmark this page
How to check if two dates are equal in Java 8?

The java.time package of Java provides API’s for dates, times, instances and durations. It provides various classes like Clock, LocalDate, LocalDateTime, LocalTime, MonthDay,Year, YearMonth etc. Using classes of this package you can get details related to date and time in much simpler way compared to previous alternatives.
Java.time.LocalDate − This class represents a date object without time zone in ISO-8601 calendar system. The now() method of this class obtains the current date from the system clock.
The of() method of the java.time.LocalDate class accepts three integer parameters representing and year, a month of an year, day of a month and, returns the instance of the LocalDate object from the given details.
The now() method of the java.time.LocalDate obtains and returns the current date from the system clock.
The equals() method of the java.time.LocalDate class accepts an object (representing a LocalDate ) and compares it with the current LocalDate object, if both are equal this method returns true else it returns false. If the object you pass to this method is not of type LocalDate this method returns false.
Following Java example reads date values from user and constructs a LocalDate instance. Retrieves the current Date and compares these two values and prints the result.
import java.time.LocalDate;
import java.util.Scanner;
public class LocalDateJava8 {
   public static void main(String args[]) {
      Scanner sc = new Scanner(System.in);
      System.out.println("Enter the year: ");
      int year = sc.nextInt();
      System.out.println("Enter the month: ");
      int month = sc.nextInt();
      System.out.println("Enter the day: ");
      int day = sc.nextInt();
      //Getting the current date value
      LocalDate givenDate = LocalDate.of(year, month, day);
      System.out.println("Date: "+givenDate);
      //Retrieving the current date
      LocalDate currentDate = LocalDate.now();
      //Comparing both values
      boolean bool = givenDate.equals(currentDate);
      if(bool) {
         System.out.println("Given date is equal to the current date ");
      }else {
         System.out.println("Given date is not equal to the current date ");
      }
   }
}
Enter the year:
2019
Enter the month:
07
Enter the day:
24
Date: 2019-07-24
Given date is equal to the current date