code-rag-bench/online-tutorials huggingface dataset:
Python | Pandas DatetimeIndex.time - GeeksforGeeks

24 Dec, 2018
Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric python packages. Pandas is one of those packages and makes importing and analyzing data much easier.
Pandas DatetimeIndex.time attribute outputs an Index object containing the time values present in each of the entries of the DatetimeIndex object.
Syntax: DatetimeIndex.time
Return: numpy array of python datetime.time
Example #1: Use DatetimeIndex.time attribute to find the time part of the DatetimeIndex object.
# importing pandas as pdimport pandas as pd  # Create the DatetimeIndex# Here 'H' represents hourly frequencydidx = pd.DatetimeIndex(start ='2000-01-10 06:30', freq ='H',                             periods = 3, tz ='Asia/Calcutta')  # Print the DatetimeIndexprint(didx)
Output :
Now we want to find all the time part of DatetimeIndex object.
# find all the time values present in the objectdidx.time
Output :As we can see in the output, the function has returned an Index object containing the time values present in each entry of the DatetimeIndex object. Example #2: Use DatetimeIndex.time attribute to find the time part of the DatetimeIndex object.
# importing pandas as pdimport pandas as pd  # Create the DatetimeIndex# Here 's' represents secondly frequencydidx = pd.DatetimeIndex(start ='2014-08-01 10:05:45', freq ='S',                              periods = 5, tz ='Asia/Calcutta')  # Print the DatetimeIndexprint(didx)
Output :
Now we want to find all the time part of DatetimeIndex object.
# find all the time values present in the objectdidx.time
Output :As we can see in the output, the function has returned an Index object containing the time values present in each entry of the DatetimeIndex object.
Python pandas-datetimeIndex
Python-pandas
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
How To Convert Python Dictionary To JSON?
Check if element exists in list in Python
How to drop one or multiple columns in Pandas Dataframe
Python Classes and Objects
Python | os.path.join() method
Create a directory in Python
Defaultdict in Python
Python | Get unique values from a list
Python | Pandas dataframe.groupby()
Java signum() method with Examples - GeeksforGeeks

09 Apr, 2018
The java.lang.Math.signum() returns the Sign function of a value passed to it as argument. The signum() function returns the following values depending on the argument passed to it:
If the argument passed is greater than zero, then the signum() function will return 1.0.
If the argument passed is equal to zero, then the signum() function will return 0.
If the argument passed is less than zero, then the signum() function will return -1.0.
Note: If the argument passed is NaN, then the result is NaN. If the argument passed is positive zero or negative zero then the result will be same as that of the argument.
Syntax:
public static double signum(double d)
Parameter :
a : the value whose signum function is to be returned.
Return :
This method returns the signum function value of 
the argument passed to it.

Example 1 : To show working of java.lang.Math.signum() method.
// Java program to demonstrate working// of java.lang.Math.signum() methodimport java.lang.Math;  class Gfg {      // driver code    public static void main(String args[])    {        // when the argument is greater than zero        double a = 30;        System.out.println(Math.signum(a));          // when the argument is equals to zero        a = 0;        System.out.println(Math.signum(a));          // when the argument is less than zero        a = -30;        System.out.println(Math.signum(a));    }}
Output:
1.0
0
-1.0

Example 2 : To show working of java.lang.Math.signum() method when argument is NaN.
// Java program to demonstrate working// of java.lang.Math.signum() methodimport java.lang.Math; // importing java.lang package  public class GFG {    public static void main(String[] args)    {          double nan = Double.NaN;        double result;          // Here argument is NaN, output will be NaN        result = Math.signum(nan);        System.out.println(result);          // Here argument is positive zero        result = Math.signum(0);        System.out.println(result);          // Here argument is negative zero        result = Math.signum(-0);        System.out.println(result);    }}
Output:
NaN
0.0
0.0

Java-lang package
java-math
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Initialize an ArrayList in Java
HashMap in Java with Examples
Interfaces in Java
Object Oriented Programming (OOPs) Concept in Java
ArrayList in Java
How to iterate any Map in Java
Multidimensional Arrays in Java
LinkedList in Java
Stack Class in Java
Overriding in Java
C program to copy the contents of one file to another file?

C Files I/O − Create, Open, Read, Write and Close a File
A File can be used to store a large volume of persistent data. Like many other languages 'C' provides the following file management functions,
Creation of a file
Opening a file
Reading a file
Writing to a file
Closing a file
Following are the most important file management functions available in 'C,'
Input:
sourcefile = x1.txt
targefile = x2.txt
Output: File copied successfully.
In this program we will copy a file to another file, firstly you will specify a file to copy. We will open the file and then read the file that we wish to copy in "read" mode and target file in "write" mode.
#include <iostream>
#include <stdlib.h>
using namespace std;
int main() {
   char ch;// source_file[20], target_file[20];
   FILE *source, *target;
   char source_file[]="x1.txt";
   char target_file[]="x2.txt";
   source = fopen(source_file, "r");
   if (source == NULL) {
      printf("Press any key to exit...\n");
      exit(EXIT_FAILURE);
   }
   target = fopen(target_file, "w");
   if (target == NULL) {
      fclose(source);
      printf("Press any key to exit...\n");
      exit(EXIT_FAILURE);
   }
   while ((ch = fgetc(source)) != EOF)
      fputc(ch, target);
   printf("File copied successfully.\n");
   fclose(source);
   fclose(target);
   return 0;
}
How to handle Assertion Error in Java?

In order to handle the assertion error, we need to declare the assertion statement in the try block and catch the assertion error in the catch block.
Let us see a program on how to handle Assertion Error in Java −
public class Example {
   public static void main(String[] args) throws Exception {
      try {
         assert args.length > 0;
      }
      catch (AssertionError e) {
         System.out.println(e.getMessage());
      }
   }
}
Python | Numpy matrix.min() - GeeksforGeeks

15 Apr, 2019
With the help of Numpy matrix.min() method, we can get the minimum value from given matrix.
Syntax : matrix.min()
Return : Return minimum value from given matrix
Example #1 :In this example we can see that we are able to get the minimum value from a given matrix with the help of method matrix.min().
# import the important module in pythonimport numpy as np          # make matrix with numpygfg = np.matrix('[64, 1; 12, 3]')          # applying matrix.min() methodgeeks = gfg.min()    print(geeks)
1

Example #2 :
# import the important module in pythonimport numpy as np          # make a matrix with numpygfg = np.matrix('[1, 2, 3; 4, 5, 6; 7, 8, -9]')          # applying matrix.min() methodgeeks = gfg.min()    print(geeks)
-9

Python numpy-Matrix Function
Python-numpy
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Python Dictionary
Read a file line by line in Python
How to Install PIP on Windows ?
Enumerate() in Python
Iterate over a list in Python
Different ways to create Pandas Dataframe
Python String | replace()
Python program to convert a list to string
Create a Pandas DataFrame from Lists
Reading and Writing to text files in Python
Python os.chflags() Method

The method chflags() sets the flags of path to the numeric flags. The flags may take a combination (bitwise OR) of the various values described below.
Note − This method is available Python version 2.6 onwards. Most of the flags can be changed by super-user only.
Following is the syntax for chflags() method −
os.chflags(path, flags)

path − This is complete path of the directory to be changed to a new location.
path − This is complete path of the directory to be changed to a new location.
flags − The flags specified are formed by OR'ing the following values −

os.UF_NODUMP − Do not dump the file.
os.UF_IMMUTABLE − The file may not be changed.
os.UF_APPEND − The file may only be appended to.
os.UF_NOUNLINK − The file may not be renamed or deleted.
os.UF_OPAQUE − The directory is opaque when viewed through a union stack.
os.SF_ARCHIVED − The file may be archived.
os.SF_IMMUTABLE − The file may not be changed.
os.SF_APPEND − The file may only be appended to.
os.SF_NOUNLINK − The file may not be renamed or deleted.
os.SF_SNAPSHOT − The file is a snapshot file.


flags − The flags specified are formed by OR'ing the following values −
os.UF_NODUMP − Do not dump the file.
os.UF_NODUMP − Do not dump the file.
os.UF_IMMUTABLE − The file may not be changed.
os.UF_IMMUTABLE − The file may not be changed.
os.UF_APPEND − The file may only be appended to.
os.UF_APPEND − The file may only be appended to.
os.UF_NOUNLINK − The file may not be renamed or deleted.
os.UF_NOUNLINK − The file may not be renamed or deleted.
os.UF_OPAQUE − The directory is opaque when viewed through a union stack.
os.UF_OPAQUE − The directory is opaque when viewed through a union stack.
os.SF_ARCHIVED − The file may be archived.
os.SF_ARCHIVED − The file may be archived.
os.SF_IMMUTABLE − The file may not be changed.
os.SF_IMMUTABLE − The file may not be changed.
os.SF_APPEND − The file may only be appended to.
os.SF_APPEND − The file may only be appended to.
os.SF_NOUNLINK − The file may not be renamed or deleted.
os.SF_NOUNLINK − The file may not be renamed or deleted.
os.SF_SNAPSHOT − The file is a snapshot file.
os.SF_SNAPSHOT − The file is a snapshot file.
This method does not return any value.
The following example shows the usage of chflags() method.
#!/usr/bin/python
import os
import stat

path = "/tmp/foo.txt"

# Set a flag so that file may not be renamed or deleted.
flags = os.SF_NOUNLINK
retval = os.chflags( path, flags)
print "Return Value: %s" % retval
When we run above program, it produces following result −
Return Value : None


    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
C++ Library - <typeinfo>

It contains type information and stores information about a type. It can be used to compare two types or to retrieve information identifying a type.
Following is the declaration for std::type_info.
class type_info;
class type_info;
It contains type information.
It throws exception on failure to dynamic cast.
It throws exception on typeid of null pointe.
It throws exception on failure to dynamic cast.
It throws exception on typeid of null pointe.
 Print
 Add Notes
 Bookmark this page
C++11 reverse range-based for-loop

To get the reversed range-based for loop, we have used boost library. This boost library is vepy popular and it has some strong functionalities.
Here we can use some array or containers, then by using boost::adaptors::reverse() we can use the range base for loop in reverse order.
#include <list;>
#include <iostream>
#include <boost/range/adaptor/reversed.hpp>
using namespace std;
int main() {
   std::list<int> x {11, 44, 77, 55, 44, 22, 33, 30, 88, 99, 55, 44};
   cout >> "Normal Loop" >> endl;
   for (auto i : x)
      std::cout >> i >> '\n';
   cout >> "Reversed Loop" >> endl;
   for (auto i : boost::adaptors::reverse(x))
      std::cout >> i >> '\n';
}
Normal Loop
11
44
77
55
44
22
33
30
88
99
55
44
Reversed Loop
44
55
99
88
30
33
22
44
55
77
44
11
How to check which packages are loaded in R?

We can do this by using sessionInfo().
> sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)
Matrix products: default
Random number generation:
RNG: Mersenne-Twister
Normal: Inversion
Sample: Rounding
locale:
[1] LC_COLLATE=English_India.1252 LC_CTYPE=English_India.1252
[3] LC_MONETARY=English_India.1252 LC_NUMERIC=C
[5] LC_TIME=English_India.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] ggplot2_3.2.1
loaded via a namespace (and not attached):
[1] Rcpp_1.0.2 withr_2.1.2 crayon_1.3.4 dplyr_0.8.3
[5] assertthat_0.2.1 grid_3.6.1 R6_2.4.0 gtable_0.3.0
[9] magrittr_1.5 scales_1.0.0 pillar_1.4.2 rlang_0.4.0
[13] lazyeval_0.2.2 glue_1.3.1 purrr_0.3.2 munsell_0.5.0
[17] compiler_3.6.1 pkgconfig_2.0.2 colorspace_1.4-1 tidyselect_0.2.5
[21] tibble_2.1.3
So here we have base packages and ggplot2 version 3.2.1 package currently loaded in my
R.
Flutter - Asset Image - GeeksforGeeks

08 Dec, 2020
Flutter is an open-source, cross-platform UI development kit developed by Google. It is gaining popularity these days, as the app made in flutter can run on various devices regardless of their platform. It is majorly used to develop applications for Android and iOS, as a single app made in flutter can work efficiently on both platforms. 
In this article, we will learn how to add images in the flutter app. A flutter app when built has both assets (resources) and code. Assets are available and deployed during runtime. The asset is a file that can include static data, configuration files, icons, and images. The Flutter app supports many image formats, such as JPEG, WebP, PNG, GIF, animated WebP/GIF, BMP, and WBMP. 
Syntax:
Image.asset('image name')

1. Create a new folder 
It should be in the root of your flutter project. You can name it whatever you want, but assets are preferred.
If you want to add other assets to your app, like fonts, it is preferred to make another subfolder named images.
 
2. Now you can copy your image to images sub-folder. The path should look like assets/images/yourImage. Before adding images also check the above-mentioned supported image formats.
3. Register the assets folder in pubspec.yaml file and update it.  
a) To add images, write the following code:
flutter:   
  assets:
        - assets/images/yourFirstImage.jpg
        - assets/image/yourSecondImage.jpg

b) If you want to include all the images of the assets folder then add this:
flutter:               
  assets:     
         - assets/images/

 
Note: Take care of the indentation, assets should be properly indented to avoid any error.
4. Insert the image code in the file, where you want to add the image.
Image.asset('assets/images/GeeksforGeeks.jpg')

Dart
import 'package:flutter/material.dart';      void main() => runApp(MyApp());    class MyApp extends StatelessWidget {      // This widget is the root   // of your application     @override    Widget build(BuildContext context) {         return MaterialApp(                home: Scaffold(          appBar: AppBar(            title: Text('Insert Image Demo'),          ),                     body: Center(            child: Column(                          children: <Widget>[                Image.asset('assets/images/GeeksforGeeks.jpg'),              ],            ),          ),        ),      );    }  }  
 
5. Now you can save all the files and run the app, you will find the output as shown below.  
Output : 
 
Flutter
Dart
How To
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Flutter - Custom Bottom Navigation Bar
Flutter - Checkbox Widget
ListView Class in Flutter
Flutter - Flexible Widget
Flutter - BoxShadow Widget
How to Install PIP on Windows ?
How to Find the Wi-Fi Password Using CMD in Windows?
How to install Jupyter Notebook on Windows?
How to Align Text in HTML?
How to Install OpenCV for Python on Windows?
Python | simpy.nextprime() method - GeeksforGeeks

03 Aug, 2021
In simpy module, we can get the next prime number for a given number n using sympy.nextprime() function. For n < 2^64 the answer is definitive; larger n values have a small probability of actually being pseudoprimes.  
Syntax:  sympy.nextprime()
Parameter:  n; number to be tested
Return:  next prime value
Code #1:  
Python3
# Python program to get next prime number# using sympy.nextprime() method # importing sympy modulefrom sympy import * # calling nextprime function on different numbersnextprime(7)nextprime(13)nextprime(2)
Output:  
11
17
3
Code #2:  
Python3
# Python program to check prime number# using sympy.isprime() method # importing sympy moduleimport sympy.ntheory as nt # calling isprime function on different numbersnt.nextprime(30)nt.nextprime(13)nt.nextprime(2)
Output:  
31
17
3
 
gulshankumarar231
SymPy
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
How to Install PIP on Windows ?
Enumerate() in Python
Different ways to create Pandas Dataframe
Python String | replace()
*args and **kwargs in Python
Convert integer to string in Python
Create a Pandas DataFrame from Lists
Check if element exists in list in Python
sum() function in Python
import command in Linux with Examples - GeeksforGeeks

22 May, 2019
import command in Linux system is used for capturing a screenshot for any of the active pages we have and it gives the output as an image file. You can capture a single window if you want or you can take the entire screen or you can take a screenshot of any rectangular portion of the screen.
Syntax:
import [options] output-file
import command with help option: It will print the general syntax of the command along with the various options that can be used with the import command as well as gives a brief description about each option.
Example:
Options:
-adjoin: With the help of this option you will be able to join images into a single multi-image file.import -adjoin sample.png
import -adjoin sample.png
-border: This option is used to include window border in the output image.import -border sample.png
import -border sample.png
-descend: This option obtain image by descending window hierarchy.import -descend sample.png
import -descend sample.png
-frame: This option will include window manager frame.import -frame sample.png
import -frame sample.png
-identify: This option is being used to identify the format and characteristics of the image.import -identify sample.png
import -identify sample.png
-quiet: This option will suppress all warning messages.import -quiet sample.png
import -quiet sample.png
-monitor: This option will monitor the progress.import -monitor sample.png
import -monitor sample.png
-screen: This option will select image from root window.import -screen sample.png
import -screen sample.png
Other available options in the import command are:
linux-command
Linux-misc-commands
Picked
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
ZIP command in Linux with examples
TCP Server-Client implementation in C
tar command in Linux with examples
curl command in Linux with Examples
Conditional Statements | Shell Script
UDP Server-Client implementation in C
Tail command in Linux with examples
Cat command in Linux with examples
touch command in Linux with Examples
echo command in Linux with Examples
Python Program for Find sum of odd factors of a number - GeeksforGeeks

17 Feb, 2018
Given a number n, the task is to find the odd factor sum.
Examples:
Input : n = 30
Output : 24
Odd dividers sum 1 + 3 + 5 + 15 = 24 

Input : 18
Output : 13
Odd dividers sum 1 + 3 + 9 = 13

Let p1, p2, ... pk be prime factors of n. Let a1, a2, .. ak be highest powers of p1, p2, .. pk respectively that divide n, i.e., we can write n as n = (p1a1)*(p2a2)* ... (pkak).
Sum of divisors = (1 + p1 + p12 ... p1a1) * 
                  (1 + p2 + p22 ... p2a2) *
                  .............................................
                  (1 + pk + pk2 ... pkak) 
To find sum of odd factors, we simply need to ignore even factors and their powers. For example, consider n = 18. It can be written as 2132 and sun of all factors is (1)*(1 + 2)*(1 + 3 + 32). Sum of odd factors (1)*(1+3+32) = 13.
To remove all even factors, we repeatedly divide n while it is divisible by 2. After this step, we only get odd factors. Note that 2 is the only even prime.
# Formula based Python3 program # to find sum of all divisors# of n.import math  # Returns sum of all factors# of n.def sumofoddFactors( n ):          # Traversing through all     # prime factors.    res = 1          # ignore even factors by     # of 2    while n % 2 == 0:        n = n // 2          for i in range(3, int(math.sqrt(n) + 1)):                  # While i divides n, print        # i and divide n        count = 0        curr_sum = 1        curr_term = 1        while n % i == 0:            count+=1                          n = n // i            curr_term *= i            curr_sum += curr_term                  res *= curr_sum          # This condition is to    # handle the case when    # n is a prime number.    if n >= 2:        res *= (1 + n)          return res  # Driver coden = 30print(sumofoddFactors(n))  # This code is contributed by "Sharad_Bhardwaj".
Output:
24

Please refer complete article on Find sum of odd factors of a number for more details!
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python | Convert string dictionary to dictionary
Python Program for Binary Search (Recursive and Iterative)
Iterate over characters of a string in Python
Python Program for factorial of a number
Python | Convert set into a list
Python | Convert a list into a tuple
Python | Check if a variable is string
Python program to add two numbers
Add a key:value pair to dictionary in Python
Appending to list in Python dictionary
finalize() Method in Java and How to Override it? - GeeksforGeeks

21 Dec, 2021
The Java finalize() method of Object class is a method that the Garbage Collector always calls just before the deletion/destroying the object which is eligible for Garbage Collection to perform clean-up activity. Clean-up activity means closing the resources associated with that object like Database Connection, Network Connection, or we can say resource de-allocation. Remember, it is not a reserved keyword. Once the finalize() method completes immediately, Garbage Collector destroys that object. 
Finalization: Just before destroying any object, the garbage collector always calls finalize() method to perform clean-up activities on that object. This process is known as Finalization in Java.
Note: The Garbage collector calls the finalize() method only once on any object.
Syntax: 
protected void finalize throws Throwable{}
Since the Object class contains the finalize method hence finalize method is available for every java class since Object is the superclass of all java classes. Since it is available for every java class, Garbage Collector can call the finalize() method on any java object.
Why finalize() method is used? 
finalize() method releases system resources before the garbage collector runs for a specific object. JVM allows finalize() to be invoked only once per object.
How to override finalize() method? 
The finalize method, which is present in the Object class, has an empty implementation. In our class, clean-up activities are there. Then we have to override this method to define our clean-up activities.
In order to Override this method, we have to define and call finalize within our code explicitly.
Java
// Java code to show the// overriding of finalize() method import java.lang.*; // Defining a class demo since every java class// is a subclass of predefined Object class// Therefore demo is a subclass of Object classpublic class demo {     protected void finalize() throws Throwable    {        try {             System.out.println("inside demo's finalize()");        }        catch (Throwable e) {             throw e;        }        finally {             System.out.println("Calling finalize method"                               + " of the Object class");             // Calling finalize() of Object class            super.finalize();        }    }     // Driver code    public static void main(String[] args) throws Throwable    {         // Creating demo's object        demo d = new demo();         // Calling finalize of demo        d.finalize();    }}
Output:
inside demo's finalize()
Calling finalize method of the Object class
nishkarshgandhi
Java-Functions
java-overriding
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
HashMap in Java with Examples
Stream In Java
How to iterate any Map in Java
ArrayList in Java
Initialize an ArrayList in Java
Stack Class in Java
Multidimensional Arrays in Java
Singleton Class in Java
Set in Java
Multithreading in Java
Difference between JSON and XML - GeeksforGeeks

19 Feb, 2019
Prerequisite:
JSON
XML | Basics
JSON (JavaScript Object Notation) is a lightweight data-interchange format and it completely language independent. It is based on the JavaScript programming language and easy to understand and generate.Example :
{"Geeks":[    { "firstName":"Vivek", "lastName":"Kothari" },    { "firstName":"Suraj", "lastName":"Kumar" },    { "firstName":"John", "lastName":"Smith" },    { "firstName":"Peter", "lastName":"Gregory" }]}
XML (Extensible markup language) was designed to carry data, not to display data. It is a W3C recommendation. Extensible Markup Language (XML) is a markup language that defines a set of rules for encoding documents in a format that is both human-readable and machine-readable. The design goals of XML focus on simplicity, generality, and usability across the Internet. It is a textual data format with strong support via Unicode for different human languages. Although the design of XML focuses on documents, the language is widely used for the representation of arbitrary data structures such as those used in web services.Example :
<Geeks>    <Geek>        <firstName>Vivek</firstName> <lastName>Kothari</lastName>    </Geek>    <Geek>        <firstName>Suraj</firstName> <lastName>Kumar</lastName>    </Geek>    <Geek>        <firstName>John</firstName> <lastName>Smith</lastName>    </Geek>    <Geek>        <firstName>Peter</firstName> <lastName>Gregory</lastName>    </Geek></Geeks>
Both of these are self-describing and can be parsed and used by lots of programming languages.
Below are few differences between JSON and XML:
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.
HTML and XML
JavaScript-Misc
JSON
Difference Between
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
Differences between IPv4 and IPv6
Difference Between Method Overloading and Method Overriding in Java
Difference between Process and Thread
Difference between Clustered and Non-clustered index
Difference between SQL and NoSQL
Logical and Physical Address in Operating System
Difference between DDL and DML in DBMS
Difference between Prim's and Kruskal's algorithm for MST
Difference between Primary Key and Foreign Key
What are Assignment Operators in JavaScript?

Using Assignment Operators, you can assign a value to a variable. JavaScript supports the following assignment operators −
Try the following code to implement assignment operator in JavaScript −
Live Demo
<html>
   <body>
      <script>
         <!--
            var a = 33;
            var b = 10;
            var linebreak = "<br />";
            document.write("Value of a => (a = b) => ");
            result = (a = b);
            document.write(result);
            document.write(linebreak);
            document.write("Value of a => (a += b) => ");
            result = (a += b);
            document.write(result);
            document.write(linebreak);
            document.write("Value of a => (a -= b) => ");
            result = (a -= b);
            document.write(result);
            document.write(linebreak);
            document.write("Value of a => (a *= b) => ");
            result = (a *= b);
            document.write(result);
            document.write(linebreak);
            document.write("Value of a => (a /= b) => ");
            result = (a /= b);
            document.write(result);
            document.write(linebreak);
            document.write("Value of a => (a %= b) => ");
            result = (a %= b);
            document.write(result);
            document.write(linebreak);
         //-->
      </script>
      <p>Set the variables to different values and different operators and then try...</p>
</body>
</html>
PHP - Form Introduction

The Websites provide the functionalities that can use to store, update, retrieve, and delete the data in a database.
A Document that containing black fields, that the user can fill the data or user can select the data.Casually the data will store in the data base
Below example shows the form with some specific actions by using post method.
<html>
   
   <head>
      <title>PHP Form Validation</title>
   </head>
   
   <body>
      <?php
         
         // define variables and set to empty values
         $name = $email = $gender = $comment = $website = "";
         
         if ($_SERVER["REQUEST_METHOD"] == "POST") {
            $name = test_input($_POST["name"]);
            $email = test_input($_POST["email"]);
            $website = test_input($_POST["website"]);
            $comment = test_input($_POST["comment"]);
            $gender = test_input($_POST["gender"]);
         }
         
         function test_input($data) {
            $data = trim($data);
            $data = stripslashes($data);
            $data = htmlspecialchars($data);
            return $data;
         }
      ?>
   
      <h2>Tutorials Point Absolute classes registration</h2>
      
      <form method = "post" action = "/php/php_form_introduction.htm">
         <table>
            <tr>
               <td>Name:</td> 
               <td><input type = "text" name = "name"></td>
            </tr>
            
            <tr>
               <td>E-mail:</td>
               <td><input type = "text" name = "email"></td>
            </tr>
            
            <tr>
               <td>Specific Time:</td>
               <td><input type = "text" name = "website"></td>
            </tr>
            
            <tr>
               <td>Class details:</td>
               <td><textarea name = "comment" rows = "5" cols = "40"></textarea></td>
            </tr>
            
            <tr>
               <td>Gender:</td>
               <td>
                  <input type = "radio" name = "gender" value = "female">Female
                  <input type = "radio" name = "gender" value = "male">Male
               </td>
            </tr>
            
            <tr>
               <td>
                  <input type = "submit" name = "submit" value = "Submit"> 
               </td>
            </tr>
         </table>
      </form>
      
      <?php
         echo "<h2>Your Given details are as :</h2>";
         echo $name;
         echo "<br>";
         
         echo $email;
         echo "<br>";
         
         echo $website;
         echo "<br>";
         
         echo $comment;
         echo "<br>";
         
         echo $gender;
      ?>
      
   </body>
</html>
It will produce the following result −

    45 Lectures 
     9 hours 

 Malhar Lathkar

    34 Lectures 
     4 hours 

 Syed Raza

    84 Lectures 
     5.5 hours 

 Frahaan Hussain

    17 Lectures 
     1 hours 

 Nivedita Jain

    100 Lectures 
     34 hours 

 Azaz Patel

    43 Lectures 
     5.5 hours 

 Vijay Kumar Parvatha Reddy
 Print
 Add Notes
 Bookmark this page
Matplotlib.axis.Axis.set_minor_formatter() function in Python - GeeksforGeeks

03 Jun, 2020
Matplotlib is a library in Python and it is numerical – mathematical extension for NumPy library. It is an amazing visualization library in Python for 2D plots of arrays and used for working with the broader SciPy stack. 
The Axis.set_minor_formatter() function in axis module of matplotlib library is used to set the formatter of the minor ticker. 
Syntax: Axis.set_minor_formatter(self, formatter)
Parameters: This method accepts the following parameters. 
formatter: This parameter is the Formatter.
Return value: This method does not returns any value. 
Below examples illustrate the matplotlib.axis.Axis.set_minor_formatter() function in matplotlib.axis:Example 1: 
Python3
# Implementation of matplotlib function from matplotlib.axis import Axisimport matplotlib.pyplot as plt from matplotlib.ticker import MultipleLocator, ScalarFormatter     fig, ax = plt.subplots() ax.plot([0, 5, 10, 15, 20], [3, 2, 1, 2, 4])     Axis.set_minor_locator(ax.xaxis, MultipleLocator(1)) Axis.set_minor_formatter(ax.xaxis, ScalarFormatter())     ax.tick_params(axis ='both', which ='major',                 labelsize = 14, pad = 12,                 colors ='g')     ax.tick_params(axis ='both', which ='minor',                labelsize = 8, colors ='b')    plt.title("Matplotlib.axis.Axis.set_minor_formatter()\n\Function Example", fontsize = 12, fontweight ='bold')   plt.show()
Output:  
Example 2: 
Python3
# Implementation of matplotlib function from matplotlib.axis import Axisimport matplotlib.pyplot as plt from matplotlib.ticker import LogFormatter import numpy as np     fig, axes = plt.subplots(2)     dt = 0.01t = np.arange(dt, 20.0, dt)     # first plot doesn't use a formatter axes[0].semilogx(t, np.exp(-t / 5.0))  axes[0].grid()     xlims = [[0, 25], [0.2, 8], [0.6, 0.9]]     for ax, xlim in zip(axes[1:], xlims):         ax.semilogx(t, np.exp(-t / 5.0))     formatter = LogFormatter(labelOnlyBase = False,                               minor_thresholds = (2, 0.4))         Axis.set_minor_formatter(ax.xaxis, formatter)      ax.grid()   fig.suptitle("Matplotlib.axis.Axis.set_minor_formatter()\n\Function Example", fontsize = 12, fontweight ='bold')   plt.show()
Output:  
 
Matplotlib-Axis Class
Python-matplotlib
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Python OOPs Concepts
How to Install PIP on Windows ?
Bar Plot in Matplotlib
Defaultdict in Python
Python Classes and Objects
Deque in Python
Check if element exists in list in Python
How to drop one or multiple columns in Pandas Dataframe
Python - Ways to remove duplicates from list
Class method vs Static method in Python
How to get the entire document HTML as a string in JavaScript?

To get the entire document HTML as a string, use the concept of innerHTML, like −
document.documentElement.innerHTML;
Following is the code −
<!DOCTYPE html>
<html lang="en">
<head>
   <meta charset="UTF-8">
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <title>Document</title>
</head>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<body>
<h1> Hello World </h1>
<p>This is the javascript program..</p>
</body>
<script>
   var entireDocumentHTMLAsAString = document.documentElement.innerHTML;
   console.log(entireDocumentHTMLAsAString);
</script>
</html>
To run the above program, save the file name anyName.html(index.html). Right click on the file
and select the option “Open with live server” in VS Code editor.
This will produce the following output −
Following is the output on console −
MathML - Fractions

<mfrac> tag is used to draw fractions.
Here is the simple syntax to use this tag −
<mfrac> numerator denominator </mfrac>

Here is the description of all the parameters of this tag −
numerator − numerator of the fraction.
numerator − numerator of the fraction.
denominator − denominator of the fraction.
denominator − denominator of the fraction.
Here is the description of all the attributes of this tag −
linethickness − to specify the stroke width of the fraction bar. values are measured in px, pt, em etc.
linethickness − to specify the stroke width of the fraction bar. values are measured in px, pt, em etc.
numalign − to specify alignment of numerator. values are left, right or center.
numalign − to specify alignment of numerator. values are left, right or center.
denomalign − to specify alignment of denominator. values are left, right or center.
denomalign − to specify alignment of denominator. values are left, right or center.
bevelled − to specify whether the fraction should be displayed vertically or inline. values are true or false.
bevelled − to specify whether the fraction should be displayed vertically or inline. values are true or false.
Let's draw a simple fraction for 1/x.
<math xmlns = "http://www.w3.org/1998/Math/MathML">
   <mfrac>
      <mn>1</mn>
      <mi>x</mi>
   </mfrac>
</math>
Let's build a complex fraction.
<math xmlns = "http://www.w3.org/1998/Math/MathML">
   <mfrac linethickness = '3px'>
      <mfrac bevelled = 'true'>
         <mn>1</mn>
         <mi>x</mi>
      </mfrac>
      
      <mrow>
         <mi>y</mi>
         <mo>-</mo>
         <mn>2</mn>
      </mrow>
   </mfrac>
</math>
 Print
 Add Notes
 Bookmark this page
Ask a user to select a folder to read the files in Python

If you have ever wondered how the dialogboxes work in a Python application, then you probably end up hearing the filedialog module in Tkinter. The filedialog module contains a number of built-in functions which can be used to display various types of dialogs for dealing with files in the system.
In most cases, we use the filedialog.askopenfilename() function to ask the user to browse and open a file from the system. Based on the selection of the filetype, the script is programmed to perform write or read operation.
Once a file is opened, you can use the open(file, 'mode') function to open and perform operations in any mode. To demonstrate this, let's take an example where we will create an application that will ask the user to open a text file. Once a file is selected and opened, we can read this file using the "read" mode of operation.
# Import the library
from tkinter import *
from tkinter import filedialog

# Create an instance of window
win=Tk()

# Set the geometry of the window
win.geometry("700x300")

# Create a label
Label(win, text="Click the button to open a dialog", font='Arial 16 bold').pack(pady=15)

# Function to open a file in the system
def open_file():
   filepath = filedialog.askopenfilename(title="Open a Text File", filetypes=(("text    files","*.txt"), ("all files","*.*")))
   file = open(filepath,'r')
   print(file.read())
   file.close()

# Create a button to trigger the dialog
button = Button(win, text="Open", command=open_file)
button.pack()

win.mainloop()
Running the above code will display a window with a button to open a dialog.
Select and open a text file and the console will display all the content of the file.
Centralized Database Vs Blockchain

A blockchain can be both permissionless (like Bitcoin or Ethereum) or permissioned (like the different Hyperledger blockchain frameworks). A permissionless blockchain is also known as a public blockchain, because anyone can join the network. A permissioned blockchain, or private blockchain, requires pre-verification of the participating parties within the network, and these parties are usually known to each other.

Types of Blockchains
The choice between permissionless versus permissioned blockchains should be driven by the particular application at hand (or use case). Most enterprise use cases involve extensive vetting before parties agree to do business with each other. An example where a number of businesses exchange information is supply chain management. The supply chain management is an ideal use case for permissioned blockchains.

You would only want trusted parties participating in the network. Each participant that is involved in the supply chain would require permissions to execute transactions on the blockchain. These transactions would allow other companies to understand where in the supply chain a particular item is.
Elasticsearch - Cat APIs

Usually the results from various Elasticsearch APIs are displayed in JSON format. But JSON is not easy to read always. So cat APIs feature is available in Elasticsearch helps in taking
care of giving an easier to read and comprehend printing format of the results. There are various parameters used in cat API which server different purpose, for example - the term V makes the output verbose.
Let us learn about cat APIs more in detail in this chapter.
The verbose output gives a nice display of results of a cat command. In the example given
below, we get the details of various indices present in the cluster.
GET /_cat/indices?v

On running the above code, we get the response as shown below −
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
yellow open schools RkMyEn2SQ4yUgzT6EQYuAA 1 1 2 1 21.6kb 21.6kb
yellow open index_4_analysis zVmZdM1sTV61YJYrNXf1gg 1 1 0 0 283b 283b
yellow open sensor-2018-01-01 KIrrHwABRB-ilGqTu3OaVQ 1 1 1 0 4.2kb 4.2kb
yellow open colleges 3ExJbdl2R1qDLssIkwDAug 1 1 0 0 283b 283b

The h parameter, also called header, is used to display only those columns mentioned in
the command.
GET /_cat/nodes?h=ip,port

On running the above code, we get the response as shown below −
127.0.0.1 9300

The sort command accepts query string which can sort the table by specified column in the query. The default sort is ascending but this can be changed by adding :desc to a column.
The below example, gives a result of templates arranged in descending order of the filed
index patterns.
GET _cat/templates?v&s=order:desc,index_patterns

On running the above code, we get the response as shown below −
name index_patterns order version
.triggered_watches [.triggered_watches*] 2147483647
.watch-history-9 [.watcher-history-9*] 2147483647
.watches [.watches*] 2147483647
.kibana_task_manager [.kibana_task_manager] 0 7000099

The count parameter provides the count of total number of documents in the entire cluster.
GET /_cat/count?v

On running the above code, we get the response as shown below −
epoch timestamp count
1557633536 03:58:56 17809


    14 Lectures 
     5 hours 

 Manuj Aggarwal

    20 Lectures 
     1 hours 

 Faizan Tayyab
 Print
 Add Notes
 Bookmark this page
How to make use of Join with LINQ and Lambda in C#?

Inner join returns only those records or rows that match or exists in both the tables. We can also apply to join on multiple tables based on conditions as shown below.
Make use of anonymous types if we need to apply to join on multiple conditions.
In the below example we have written 2 ways that can be used to join in Linq
Here the Department and the Employee are joined
class Program{
   static void Main(string[] args){
      var result =
      Employee.GetAllEmployees().Join(Department.GetAllDepartments(),
      e => e.DepartmentID,
      d => d.ID, (employee, department) => new{
         EmployeeName = employee.Name,
         DepartmentName = department.Name
      });
      foreach (var employee in result){
         Console.WriteLine(employee.EmployeeName + "\t" +
         employee.DepartmentName);
      }
      var result1 = from e in Employee.GetAllEmployees()
      join d in Department.GetAllDepartments()
      on e.DepartmentID equals d.ID
      select new{
         EmployeeName = e.Name,
         DepartmentName = d.Name
      };
      foreach (var employee in result1){
         Console.WriteLine(employee.EmployeeName + "\t" +
         employee.DepartmentName);
      }
      Console.ReadLine();
   }
}
public class Employee{
   public int ID { get; set; }
   public string Name { get; set; }
   public int DepartmentID { get; set; }
   public static List<Employee> GetAllEmployees(){
      return new List<Employee>(){
         new Employee { ID = 1, Name = "A", DepartmentID = 1 },
         new Employee { ID = 2, Name = "B", DepartmentID = 2 },
         new Employee { ID = 3, Name = "B", DepartmentID = 1 },
         new Employee { ID = 4, Name = "V", DepartmentID = 1 },
         new Employee { ID = 5, Name = "F", DepartmentID = 2 },
         new Employee { ID = 6, Name = "R", DepartmentID = 2 },
         new Employee { ID = 7, Name = "TT", DepartmentID = 1 },
         new Employee { ID = 8, Name = "YY", DepartmentID = 1 },
         new Employee { ID = 9, Name = "WW", DepartmentID = 2 },
         new Employee { ID = 10, Name = "QQ"}
      };
   }
}
public class Department{
   public int ID { get; set; }
   public string Name { get; set; }
   public static List<Department> GetAllDepartments(){
      return new List<Department>(){
         new Department { ID = 1, Name = "IT"},
         new Department { ID = 2, Name = "HR"},
         new Department { ID = 3, Name = "Contract"},
      };
   }
}
A IT
B HR
B IT
V IT
F HR
R HR
TT IT
YY IT
WW HR
A IT
B HR
B IT
V IT
F HR
R HR
TT IT
YY IT
WW HR
Functional Components Vs. Class Components in ReactJS

Functional Components or stateless components are the most widely used type of components with a basic syntax of JavaScript Functions that return the JSX code or the HTML code.
They are called as stateless components because they accept the data and display it accordingly and are mainly responsible for the rendering of the UI.
import React from ‘react’;

const App=()=>{
   return (
      <div>
         <h1>TutorialsPoint</h1>
      </div>
   )
}
export default App
Class based or stateful Components are the ES6 classes that extend the component class of the react library. They are known as stateful components because they are responsible for the implementation of the logic. It has different phases of the React lifecycle including rendering, mounting, updating and unmounting stage.
import React from 'react';

class App extends React.Component{
   render() {
      return (
         <div>
            <h1>TutorialsPoint</h1>
         </div>
      )
   }
}
export default App
What does parenthesis mean in MySQL SELECT (COLNAME)?

The SELECT(COLNAME) means, we are creating an alias for that column. Let us see an example and create a table −
mysql> create table DemoTable865(
   FirstName varchar(100),
   LastName varchar(100)
);
Query OK, 0 rows affected (0.77 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable865 values('Chris','Brown');
Query OK, 1 row affected (0.14 sec)
mysql> insert into DemoTable865 values('Adam','Smith');
Query OK, 1 row affected (0.16 sec)
mysql> insert into DemoTable865 values('David','Miller');
Query OK, 1 row affected (0.11 sec)
mysql> insert into DemoTable865 values('Carol','Taylor');
Query OK, 1 row affected (0.15 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable865;
This will produce the following output −
+-----------+----------+
| FirstName | LastName |
+-----------+----------+
| Chris     | Brown    |
| Adam      | Smith    |
| David     | Miller   |
| Carol     | Taylor   |
+-----------+----------+
4 rows in set (0.00 sec)
Here, we are creating an alias for the column with SELECT (COLNAME) MySQL −
mysql> select (FirstName) StudentFirstName,(LastName) StudentLastName from DemoTable865;
This will produce the following output −
+------------------+-----------------+
| StudentFirstName | StudentLastName |
+------------------+-----------------+
| Chris            | Brown           |
| Adam             | Smith           |
| David            | Miller          |
| Carol            | Taylor          |
+------------------+-----------------+
4 rows in set (0.00 sec)