code-rag-bench/online-tutorials huggingface dataset:
Kibana - Dev Tools

We can use Dev Tools to upload data in Elasticsearch, without using Logstash. We can post, put, delete, search the data we want in Kibana using Dev Tools.
To create new index in Kibana we can use following command in dev tools −
The command to create index is as shown here −
PUT /usersdata?pretty

Once you execute this, an empty index userdata is created.
We are done with the index creation. Now will add the data in the index −
You can add data to an index as follows −
We will add one more record in usersdata index −
So we have 2 records in usersdata index.
We can get the details of record 1 as follows −
You can get all records as follows −
Thus, we can get all the records from usersdata as shown above.
To update the record, you can do as follows −
We have changed the name from “Ervin Howell” to “Clementine Bauch”. Now we can get all records from the index and see the updated record as follows −
You can delete the record as shown here −
Now if you see the total records we will have only one record −
We can delete the index created as follows −
Now if you check the indices available we will not have usersdata index in it as deleted the index.
 Print
 Add Notes
 Bookmark this page
Compute the condition number of a given matrix using NumPy

29 Aug, 2020
In this article, we will use the cond() function of the NumPy package to calculate the condition number of a given matrix. cond() is a function of linear algebra module in NumPy package.
Syntax: 
numpy.linalg.cond(x, p=None)
Example 1: Condition Number of 2X2 matrix
Python3
# Importing libraryimport numpy as np  # Creating a 2X2 matrixmatrix = np.array([[4, 2], [3, 1]])  print("Original matrix:")print(matrix)  # Outputresult =  np.linalg.cond(matrix)  print("Condition number of the matrix:")print(result)
Output:
Original matrix:
[[4 2]
 [3 1]]
Condition number of the matrix:
14.933034373659256

Example 2: Condition Number of 3X3 matrix
Python3
# Importing libraryimport numpy as np  # Creating a 3X3 matrixmatrix = np.array([[4, 2, 0], [3, 1, 2], [1, 6, 4]])  print("Original matrix:")print(matrix)  # Outputresult =  np.linalg.cond(matrix)  print("Condition number of the matrix:")print(result)
Output:
Original matrix:
[[4 2 0]
 [3 1 2]
 [1 6 4]]
Condition number of the matrix:
5.347703616656448

Example 3: Condition Number of 4X4 matrix
Python3
# Importing libraryimport numpy as np  # Creating a 4X4 matrixmatrix = np.array([[4, 1, 4, 2], [3, 1, 2, 0],                    [3, 5, 7 ,1], [0, 6, 8, 4]])  print("Original matrix:")print(matrix)  # Outputresult =  np.linalg.cond(matrix)  print("Condition number of the matrix:")print(result)
Output:
Original matrix:
[[4 1 4 2]
 [3 1 2 0]
 [3 5 7 1]
 [0 6 8 4]]
Condition number of the matrix:
57.34043866386226

Python numpy-Linear Algebra
Python-numpy
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
JSON with Perl

This chapter covers how to encode and decode JSON objects using Perl programming language. Let's start with preparing the environment to start our programming with Perl for JSON.
Before you start encoding and decoding JSON using Perl, you need to install JSON module, which can be obtained from CPAN. Once you downloaded JSON-2.53.tar.gz or any other latest version, follow the steps mentioned below −
$tar xvfz JSON-2.53.tar.gz
$cd JSON-2.53
$perl Makefile.PL
$make
$make install

Perl encode_json() function converts the given Perl data structure to a UTF-8 encoded, binary string.
$json_text = encode_json ($perl_scalar );
or
$json_text = JSON->new->utf8->encode($perl_scalar);

The following example shows arrays under JSON with Perl −
#!/usr/bin/perl
use JSON;

my %rec_hash = ('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5);
my $json = encode_json \%rec_hash;
print "$json\n";
While executing, this will produce the following result −
{"e":5,"c":3,"a":1,"b":2,"d":4}

The following example shows how Perl objects can be converted into JSON −
#!/usr/bin/perl

package Emp;
sub new {
   my $class = shift;
	
   my $self = {
      name => shift,
      hobbies  => shift,
      birthdate  => shift,
   };
	
   bless $self, $class;
   return $self;
}

sub TO_JSON { return { %{ shift() } }; }

package main;
use JSON;

my $JSON = JSON->new->utf8;
$JSON->convert_blessed(1);

$e = new Emp( "sachin", "sports", "8/5/1974 12:20:03 pm");
$json = $JSON->encode($e);
print "$json\n";
On executing, it will produce the following result −
{"birthdate":"8/5/1974 12:20:03 pm","name":"sachin","hobbies":"sports"}

Perl decode_json() function is used for decoding JSON in Perl. This function returns the value decoded from json to an appropriate Perl type.
$perl_scalar = decode_json $json_text
or
$perl_scalar = JSON->new->utf8->decode($json_text)

The following example shows how Perl can be used to decode JSON objects. Here you will need to install Data::Dumper module if you already do not have it on your machine.
#!/usr/bin/perl
use JSON;
use Data::Dumper;

$json = '{"a":1,"b":2,"c":3,"d":4,"e":5}';

$text = decode_json($json);
print  Dumper($text);
On executing, it will produce following result −
$VAR1 = {
   'e' => 5,
   'c' => 3,
   'a' => 1,
   'b' => 2,
   'd' => 4
Python | Pandas dataframe.std()

22 Oct, 2019
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 dataframe.std() function return sample standard deviation over requested axis. By default the standard deviations are normalized by N-1. It is a measure that is used to quantify the amount of variation or dispersion of a set of data values. For more information click here
Syntax : DataFrame.std(axis=None, skipna=None, level=None, ddof=1, numeric_only=None, **kwargs)
Parameters :axis : {index (0), columns (1)}skipna : Exclude NA/null values. If an entire row/column is NA, the result will be NAlevel : If the axis is a MultiIndex (hierarchical), count along a particular level, collapsing into a Seriesddof : Delta Degrees of Freedom. The divisor used in calculations is N – ddof, where N represents the number of elements.numeric_only : Include only float, int, boolean columns. If None, will attempt to use everything, then use only numeric data. Not implemented for Series.
Return : std : Series or DataFrame (if level specified)
For link to the CSV file used in the code, click here
Example #1: Use std() function to find the standard deviation of data along the index axis.
# importing pandas as pdimport pandas as pd  # Creating the dataframe df = pd.read_csv("nba.csv")  # Print the dataframedf
Now find the standard deviation of all the numeric columns in the dataframe. We are going to skip the NaN values in the calculation of the standard deviation.
# finding STDdf.std(axis = 0, skipna = True)
Output : 
Example #2: Use std() function to find the standard deviation over the column axis.
Find the standard deviation along the column axis. We are going to set skipna to be true. If we do not skip the NaN values then it will result in NaN values.
# importing pandas as pdimport pandas as pd  # Creating the dataframe df = pd.read_csv("nba.csv")  # STD over the column axis.df.std(axis = 1, skipna = True)
Output :
Akanksha_Rai
Python pandas-dataFrame
Python pandas-dataFrame-methods
Python-pandas
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Different ways to create Pandas Dataframe
Enumerate() in Python
How to Install PIP on Windows ?
*args and **kwargs in Python
Python Classes and Objects
Python OOPs Concepts
Convert integer to string in Python
Introduction To PYTHON
How to drop one or multiple columns in Pandas Dataframe
Matplotlib.figure.Figure.show() in Python

03 May, 2020
Matplotlib is a library in Python and it is numerical – mathematical extension for NumPy library. The figure module provides the top-level Artist, the Figure, which contains all the plot elements. This module is used to control the default spacing of the subplots and top level container for all plot elements.
The show() method figure module of matplotlib library is used to display the figure window.
Syntax: show(self, warn=True)
Parameters: This method accept the following parameters that are discussed below:
warn : This parameter contains the boolean value.
Returns: This method does not returns any value.
Below examples illustrate the matplotlib.figure.Figure.show() function in matplotlib.figure:
Example 1:
# Implementation of matplotlib functionimport matplotlib.pyplot as pltimport numpy as np     fig = plt.figure()x = np.arange(20) / 50y = (x + 0.1)*2   val1 = [True, False] * 10val2 = [False, True] * 10   plt.errorbar(x, y,              xerr = 0.1,             xlolims = True,             label ='Line 1')y = (x + 0.3)*3   plt.errorbar(x + 0.6, y,             xerr = 0.1,             xuplims = val1,             xlolims = val2,             label ='Line 2')   y = (x + 0.6)*4plt.errorbar(x + 1.2, y,             xerr = 0.1,             xuplims = True,             label ='Line 3')   plt.legend()  fig.suptitle("""matplotlib.figure.Figure.show()function Example\n\n""", fontweight ="bold")   fig.show() 
Output:
Example 2:
# Implementation of matplotlib functionimport numpy as npimport matplotlib.pyplot as plt     x = np.linspace(0, 10, 500)y = np.sin(x**2)+np.cos(x)   fig, ax = plt.subplots()   ax.plot(x, y, label ='Line 1')   ax.plot(x, y - 0.6, label ='Line 2')   ax.legend()  fig.suptitle("""matplotlib.figure.Figure.show()function Example\n\n""", fontweight ="bold")   fig.show() 
Output:
Matplotlib figure-class
Python-matplotlib
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Python Classes and Objects
Python OOPs Concepts
Introduction To PYTHON
How to drop one or multiple columns in Pandas Dataframe
Python | os.path.join() method
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
Python | Get unique values from a list
Create a directory in Python
Convert values of an Object to Logical Vector in R Programming – as.logical() Function

08 Nov, 2021
as.logical() function in R Language is used to convert an object to a logical vector.
Syntax: as.logical(x)Parameters: x: Numeric or character object
R
# R Program to convert# an object to logical vector # Creating a vectorx <- c(1, 2, 3, 0, 1.4, NA) # Calling as.logical() functionas.logical(T)as.logical("F")as.logical(2)as.logical(x)
Output: 
[1] TRUE
[1] FALSE
[1] TRUE
[1]  TRUE  TRUE  TRUE FALSE  TRUE    NA
R
# R Program to convert# an object to logical vector # Creating matrixx1 <- matrix(c(1:4), 2, 2)x2 <- matrix(c(2, 0, 1, 1.3), 2, 2) # Calling as.logical() functionas.logical(x1)as.logical(x2)
Output: 
[1] TRUE TRUE TRUE TRUE
[1]  TRUE FALSE  TRUE  TRUE
kumar_satyam
R Array-Functions
R DataFrame-Function
R List-Function
R Matrix-Function
R Object-Function
R Vector-Function
R Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Filter data by multiple conditions in R using Dplyr
How to Replace specific values in column in R DataFrame ?
Loops in R (for, while, repeat)
How to Split Column Into Multiple Columns in R DataFrame?
Change Color of Bars in Barchart using ggplot2 in R
Group by function in R using Dplyr
How to change Row Names of DataFrame in R ?
Printing Output of an R Program
How to Change Axis Scales in R Plots?
How to filter R DataFrame by values in a column?
What are virtual functions in C#?

The virtual keyword is useful in modifying a method, property, indexer, or event. When you have a function defined in a class that you want to be implemented in an inherited class(es), you use virtual functions. The virtual functions could be implemented differently in different inherited class and the call to these functions will be decided at runtime.
The following is a virtual function
public virtual int area() { }
Here is an example showing how to work with virtual functions −
using System;

namespace PolymorphismApplication {
   class Shape {
      protected int width, height;
   
      public Shape( int a = 0, int b = 0) {
         width = a;
         height = b;
      }

      public virtual int area() {
         Console.WriteLine("Parent class area :");
         return 0;
      }
   }

   class Rectangle: Shape {
      public Rectangle( int a = 0, int b = 0): base(a, b) {

      }

      public override int area () {
         Console.WriteLine("Rectangle class area ");
         return (width * height);
      }
   }

   class Triangle: Shape {
      public Triangle(int a = 0, int b = 0): base(a, b) {
   }

   public override int area() {
      Console.WriteLine("Triangle class area:");
      return (width * height / 2);
   }
}

class Caller {
   public void CallArea(Shape sh) {
      int a;
      a = sh.area();
      Console.WriteLine("Area: {0}", a);
   }
}

class Tester {
   static void Main(string[] args) {
      Caller c = new Caller();
      Rectangle r = new Rectangle(10, 7);
      Triangle t = new Triangle(10, 5);

      c.CallArea(r);
      c.CallArea(t);
      Console.ReadKey();
   }
   }
}
Python VLC MediaListPlayer – Getting Current State

29 Aug, 2020
In this article we will see how we can current state of the MediaListPlayer object in the python vlc module. VLC media player is a free and open-source portable cross-platform media player software and streaming media server developed by the VideoLAN project. Media list player is used to play multiple media in a row for example playing a series, instead of taking single media it accepts media list. Its working is almost similar like the MediaPlayer object but it is capable of playing list of media. State can be playing paused or closed, we can pause and resume the media list player any time with the help of set_pause method, and it can be start playing with the help of play method.
In order to do this we will use get_state method with the MediaListPlayer object
Syntax : media_list_player.get_state()
Argument : It takes no argument
Return : It returns State object
Below is the implementation
# importing vlc moduleimport vlc  # importing time moduleimport time  # creating a media player objectmedia_player = vlc.MediaListPlayer()  # creating Instance class objectplayer = vlc.Instance()  # creating a new media list objectmedia_list = player.media_list_new()  # creating a new mediamedia = player.media_new("death_note.mkv")  # adding media to media listmedia_list.add_media(media)  # setting media list to the media playermedia_player.set_media_list(media_list)    # start playing videomedia_player.play()    # wait so the video can be played for 5 seconds# irrespective for length of videotime.sleep(5)  # getting media player current statevalue = media_player.get_state()  # printing valueprint(value)
Output :
State.Playing

Another exampleBelow is the implementation
# importing vlc moduleimport vlc  # importing time moduleimport time  # creating a media player objectmedia_player = vlc.MediaListPlayer()  # creating Instance class objectplayer = vlc.Instance()  # creating a new media listmedia_list = player.media_list_new()  # creating a new mediamedia = player.media_new("1.mp4")  # adding media to media listmedia_list.add_media(media)  # setting media list to the media playermedia_player.set_media_list(media_list)    # start playing videomedia_player.play()  # wait so the video can be played for 5 seconds# irrespective for length of videotime.sleep(5)  # getting media player current statevalue = media_player.get_state()  # printing valueprint(value)
Output :
State.Playing

Python vlc-mediaPlayer
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Different ways to create Pandas Dataframe
Enumerate() in Python
Read a file line by line in Python
How to Install PIP on Windows ?
*args and **kwargs in Python
Python Classes and Objects
Iterate over a list in Python
Convert integer to string in Python
Python OOPs Concepts
HTML5 - MathML

The HTML syntax of HTML5 allows for MathML elements to be used inside a document using <math>...</math> tags.
Most of the web browsers can display MathML tags. If your browser does not support MathML, then I would suggest you to use latest version of Firefox.
Following is a valid HTML5 document with MathML −
<!doctype html>

<html>
   <head>
      <meta charset = "UTF-8">
      <title>Pythagorean theorem</title>
   </head>
	
   <body>
      <math xmlns = "http://www.w3.org/1998/Math/MathML">
		
         <mrow>
            <msup><mi>a</mi><mn>2</mn></msup>
            <mo>+</mo>
				
            <msup><mi>b</mi><mn>2</mn></msup>
            <mo> = </mo>
				
            <msup><mi>c</mi><mn>2</mn></msup>
         </mrow>
			
      </math>
   </body>
</html> 
This will produce the following result −
Consider, following is the markup which makes use of the characters &InvisibleTimes; −
<!doctype html>

<html>
   <head>
      <meta charset = "UTF-8">
      <title>MathML Examples</title>
   </head>
	
   <body>
      <math xmlns = "http://www.w3.org/1998/Math/MathML">
		
         <mrow>			
            <mrow>
				
               <msup>
                  <mi>x</mi>
                  <mn>2</mn>
               </msup>
					
               <mo>+</mo>
					
               <mrow>
                  <mn>4</mn>
                  <mo>⁢</mo>
                  <mi>x</mi>
               </mrow>
					
               <mo>+</mo>
               <mn>4</mn>
					
            </mrow>
				
            <mo>=</mo>
            <mn>0</mn>
				 
         </mrow>
      </math>
   </body>
</html> 
This would produce the following result. If you are not able to see proper result like x2 + 4x + 4 = 0, then use Firefox 3.5 or higher version.
This will produce the following result −
Consider the following example which would be used to represent a simple 2x2 matrix −
<!doctype html>

<html>
   <head>
      <meta charset = "UTF-8">
      <title>MathML Examples</title>
   </head>
	
   <body>
      <math xmlns = "http://www.w3.org/1998/Math/MathML">
		
         <mrow>
            <mi>A</mi>
            <mo>=</mo>
			
            <mfenced open = "[" close="]">
			
               <mtable>
                  <mtr>
                     <mtd><mi>x</mi></mtd>
                     <mtd><mi>y</mi></mtd>
                  </mtr>
					
                  <mtr>
                     <mtd><mi>z</mi></mtd>
                     <mtd><mi>w</mi></mtd>
                  </mtr>
               </mtable>
               
            </mfenced>
         </mrow>
      </math>

   </body>
</html> 
This will produce the following result −
This would produce the following result. If you are not able to see proper result, then use Firefox 3.5 or higher version.

    19 Lectures 
     2 hours 

 Anadi Sharma

    16 Lectures 
     1.5 hours 

 Anadi Sharma

    18 Lectures 
     1.5 hours 

 Frahaan Hussain

    57 Lectures 
     5.5 hours 

 DigiFisk (Programming Is Fun)

    54 Lectures 
     6 hours 

 DigiFisk (Programming Is Fun)

    45 Lectures 
     5.5 hours 

 DigiFisk (Programming Is Fun)
 Print
 Add Notes
 Bookmark this page
Python program to list Sort by Number value in String - GeeksforGeeks

18 Jul, 2021
Given a List of strings, the task is to write a Python program to sort list by the number present in the Strings. If no number is present, they will be taken to the front of the list.
Input : test_list = [“gfg is 4”, “all no 1”, “geeks over 7 seas”, “and 100 planets”] Output : [‘all no 1’, ‘gfg is 4’, ‘geeks over 7 seas’, ‘and 100 planets’] Explanation : 1 < 4 < 7 < 100, numbers in strings deciding order.
Input : test_list = [“gfg is 4”, “geeks over 7 seas”, “and 100 planets”] Output : [‘gfg is 4’, ‘geeks over 7 seas’, ‘and 100 planets’] Explanation : 4 < 7 < 100, numbers in strings deciding order. 
Method 1 : Using sort(), split() and isdigit()
In this, we perform the task of in-place sorting using sort(), and perform task of getting number from string using split() and final detection is done using isdigit(). 
Example: 
Python3
import sys  def num_sort(strn):      # getting number using isdigit() and split()    computed_num = [ele for ele in strn.split() if ele.isdigit()]      # assigning lowest weightage to strings     # with no numbers    if len(computed_num) > 0:        return int(computed_num[0])    return -1    # initializing Matrixtest_list = ["gfg is", "all no 7", "geeks over seas", "and planets 5"]  # printing original listprint("The original list is : " + str(test_list))  # performing sorttest_list.sort(key=num_sort)  # printing resultprint("Sorted Strings : " + str(test_list))
Output:
The original list is : [‘gfg is’, ‘all no 7’, ‘geeks over seas’, ‘and planets 5’]
Sorted Strings : [‘gfg is’, ‘geeks over seas’, ‘and planets 5’, ‘all no 7’]
Method 2 : Using sorted(), lambda,  split() and isdigit()
In this, lambda function is used to inject sort functionality performed using sorted(). Rest each process is similar to above explained method.
Example:
Python3
# initializing Matrixtest_list = ["all no 100", "gfg is", "geeks over seas 62", "and planets 3"]  # printing original listprint("The original list is : " + str(test_list))  # performing sorting# lambda function injecting functionalityres = sorted(test_list, key=lambda strn: -1              if len([ele for ele in strn.split()                      if ele.isdigit()]) == 0              else int([ele for ele in strn.split()                        if ele.isdigit()][0]))  # printing resultprint("Sorted Strings : " + str(res))
Output:
The original list is : [‘all no 100’, ‘gfg is’, ‘geeks over seas 62’, ‘and planets 3’]
Sorted Strings : [‘gfg is’, ‘and planets 3’, ‘geeks over seas 62’, ‘all no 100’]
Python list-programs
Python string-programs
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
How To Convert Python Dictionary To JSON?
How to drop one or multiple columns in Pandas Dataframe
Check if element exists in list in Python
Python | os.path.join() method
Defaultdict in Python
Python | Split string into list of characters
Python | Get dictionary keys as a list
Python | Convert a list to dictionary
Python program to check whether a number is Prime or not
Errors in C/C++

In C or C++, we face different kinds of errors. These errors can be categorized into five different types. These are like below −
Syntax Error
Run-Time Error
Linker Error
Logical Error
Semantic Error
Let us see these errors one by one −
This kind of errors are occurred, when it violates the rule of C++ writing techniques or syntaxes. This kind of errors are generally indicated by the compiler before compilation. Sometimes these are known as compile time error.
In this example, we will see how to get syntax error if we do not put semicolon after one line.
#include<stdio.h>
main() {
   printf("Hello World")
}
Error] expected ';' before '}' token
This kind of errors are occurred, when the program is executing. As this is not compilation error, so the compilation will be successfully done. We can check this error if we try to divide a number with 0.
#include<stdio.h>
main() {
   int x = 52;
   int y = 0;
   printf("Div : %f", x/y);
}
Program crashes during runtime.
This kind of errors are occurred, when the program is compiled successfully, and trying to link the different object file with the main object file. When this error is occurred, the executable is not generated, For example some wrong function prototyping, incorrect header file etc. If the main() is written as Main(), this will generate linked error.
#include<stdio.h>
main() {
   int x = 52;
   int y = 0;
   printf("Div : %f", x/y);
}
C:\crossdev\src\mingw-w64-v3-git\mingw-w64-crt\crt\crt0_c.cundefined reference to `WinMain'
Sometimes, we may not get the desired output. If the syntax and other things are correct, then also, we may not get correct output due to some logical issues. These are called the logical error. Sometimes, we put a semicolon after a loop, that is syntactically correct, but will create one blank loop. In that case, it will show desired output.
#include<stdio.h>
main() {
   int i;
   for(i = 0; i<5; i++); {
      printf("Hello World");
   }
}
Here we want the line will be printed five times. But only one time it will be printed for the block of code.
This kind of error occurs when it is syntactically correct but has no meaning. This is like grammatical mistakes. If some expression is given at the left side of assignment operator, this may generate semantic error.
#include<stdio.h>

main() {
   int x, y, z;
   x = 10;
   y = 20;
   x + y = z;
}
[Error] lvalue required as left operand of assignment
Check if an Object is of Type Numeric in R Programming - is.numeric() Function - GeeksforGeeks

16 Jun, 2020
is.numeric() function in R Language is used to check if the object passed to it as argument is of numeric type.
Syntax: is.numeric(x)
Parameters:x: Object to be checked
Example 1:
# R program to check if # object is of numeric type  # Calling is.numeric() functionis.numeric(1)is.numeric(1.5)is.numeric(-1.5)
Output:
[1] TRUE
[1] TRUE
[1] TRUE

Example 2:
# R program to check if # object is of numeric type  # Creating a matrixx1 <- matrix(c(1:9), 3, 3)  # Calling is.numeric() functionis.numeric(x1)
Output:
[1] TRUE

R List-Function
R Math-Function
R Matrix-Function
R Object-Function
R Vector-Function
R Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Filter data by multiple conditions in R using Dplyr
Loops in R (for, while, repeat)
Change Color of Bars in Barchart using ggplot2 in R
How to change Row Names of DataFrame in R ?
How to Change Axis Scales in R Plots?
Group by function in R using Dplyr
K-Means Clustering in R Programming
Remove rows with NA in one column of R DataFrame
How to Split Column Into Multiple Columns in R DataFrame?
R Programming Language - Introduction
How to perform Increment in MySQL Update?

To update values incrementally in MySQL, you need to create a variable with the help of SET command. The syntax to create a variable is as follows −
set @anyVariableName := 0;
To update value, you need to use UPDATE command. Let us begin with creating a table. The query to create a table −
mysql> create table UpdateValueIncrementally
   −> (
   −> ProductId int
   −> );
Query OK, 0 rows affected (0.90 sec)
Insert records in the table with the help of select statement. The query is as follows −
mysql> insert into UpdateValueIncrementally values(10);
Query OK, 1 row affected (0.15 sec)

mysql> insert into UpdateValueIncrementally values(100);
Query OK, 1 row affected (0.16 sec)

mysql> insert into UpdateValueIncrementally values(1000);
Query OK, 1 row affected (0.09 sec)

mysql> insert into UpdateValueIncrementally values(110);
Query OK, 1 row affected (0.17 sec)

mysql> insert into UpdateValueIncrementally values(102);
Query OK, 1 row affected (0.11 sec)
Display all records from the table with the help of select statement. The query is as follows −
mysql> select *from UpdateValueIncrementally;
The following is the output −
+-----------+
| ProductId |
+-----------+
|        10 |
|       100 |
|      1000 |
|       110 |
|       102 |
+-----------+
5 rows in set (0.00 sec)
The following is the query to update values incrementally −
mysql> set @incrementValue := 33333;
Query OK, 0 rows affected (0.00 sec)
A variable is created above and the value is initialized to 33333. The following is the query to update the values and incrementing −
mysql> update UpdateValueIncrementally set ProductId = (select @incrementValue := @incrementValue + @incrementValue);
Query OK, 5 rows affected (0.21 sec)
Rows matched: 5 Changed: 5 Warnings: 0
In the above query, I have incremented the value with the current value of @incrementValue. Now you can check whether the value is updated or not −
mysql> select *from UpdateValueIncrementally ;
The following is the output −
+-----------+
| ProductId |
+-----------+
|     66666 |
|    133332 |
|    266664 |
|    533328 |
|   1066656 |
+-----------+
5 rows in set (0.00 sec)
Set Flex Items into equal width columns with Bootstrap

To set flex items to be of equal width column, use the flex-fill class. The class displays the items as equal width. In the below example screenshot, you can see that we have four flex items with equal width columns −
The flex-fill class is used for every flex items and in this way, we can set equal width. Below, we have two flex items −
<div class="p-2 flex-fill">
Example 1
</div>
<div class="p-2 flex-fill">
Example 2
</div>
Live Demo
The following is an example showing how to set flex items into equal width columns using the flex-fill class −
<!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">
      <p>With flex-fill</p>
      <div class="d-flex mb-3 bg-primary">
        <div class="p-2 flex-fill bg-danger">Example 1</div>
        <div class="p-2 flex-fill bg-warning">Example 2</div>
        <div class="p-2 flex-fill bg-info">Example 3</div>
        <div class="p-2 flex-fill bg-danger">Example 4</div>
      </div>
      <p>Without .flex-fill:</p>
      <div class="d-flex mb-3 bg-secondary">
        <div class="p-2 bg-danger">Example 1</div>
        <div class="p-2 bg-warning">Example 2</div>
        <div class="p-2 bg-info">Example 3</div>
        <div class="p-2 bg-warning">Example 4</div>
      </div>
     </div>
  </body>
</html>
100% Stacked Column Chart

Following is an example of a 100% stacked bar chart. We've already seen the configuration used to draw this chart in Google Charts Configuration Syntax chapter. So, let's see the complete example.
We've used isStacked configuration to show stacked chart.
// Set chart options
var options = {
   isStacked: 'percent'
};
googlecharts_column_percentage.htm
<html>
   <head>
      <title>Google Charts Tutorial</title>
      <script type = "text/javascript" src = "https://www.gstatic.com/charts/loader.js">
      </script>
      <script type = "text/javascript">
         google.charts.load('current', {packages: ['corechart']});     
      </script>
   </head>
   
   <body>
      <div id = "container" style = "width: 550px; height: 400px; margin: 0 auto">
      </div>
      <script language = "JavaScript">
         function drawChart() {
            // Define the chart to be drawn.
            var data = google.visualization.arrayToDataTable([
               ['Year', 'Asia', 'Europe'],
               ['2012',  900,      390],
               ['2013',  1000,      400],
               ['2014',  1170,      440],
               ['2015',  1250,       480],
               ['2016',  1530,      540]
            ]);

            var options = {
               title: 'Population (in millions)',
               isStacked:'percent'	  
            };  

            // Instantiate and draw the chart.
            var chart = new google.visualization.ColumnChart(document.getElementById('container'));
            chart.draw(data, options);
         }
         google.charts.setOnLoadCallback(drawChart);
      </script>
   </body>
</html>
Verify the result.
 Print
 Add Notes
 Bookmark this page
DAX Date & Time - EDATE function

Returns the date that is the indicated number of months before or after the start date.
EDATE (<start_date>, <month>) 

start_date
A date that represents the start date.
It can be in datetime or text format.
months
An integer that represents the number of months before or after start_date.
If months is not an integer, it is truncated.
A date in datetime format.
You can use EDATE to calculate maturity dates or due dates that fall on the same day of the month as the date of issue.
DAX works with dates in datetime format. Dates stored in other formats are converted implicitly.
If start_date is not a valid date, EDATE returns an error value.
Make sure that the column reference or date that you supply as the first parameter is a date.
If start_date is not a valid date, EDATE returns an error value.
Make sure that the column reference or date that you supply as the first parameter is a date.
DAX EDATE function uses the locale and date/time settings of the client computer to understand the text value in order to perform the conversion. For example,

If the current date/time settings represent dates in the format of Month/Day/Year, then the string, "1/8/2016" is understood as a datetime value equivalent to 8th January, 2016.
If the current date/time settings represent dates in the format of Day/Month/Year, the same string would be understood as a datetime value equivalent to 1st August, 2016.


DAX EDATE function uses the locale and date/time settings of the client computer to understand the text value in order to perform the conversion. For example,
If the current date/time settings represent dates in the format of Month/Day/Year, then the string, "1/8/2016" is understood as a datetime value equivalent to 8th January, 2016.
If the current date/time settings represent dates in the format of Month/Day/Year, then the string, "1/8/2016" is understood as a datetime value equivalent to 8th January, 2016.
If the current date/time settings represent dates in the format of Day/Month/Year, the same string would be understood as a datetime value equivalent to 1st August, 2016.
If the current date/time settings represent dates in the format of Day/Month/Year, the same string would be understood as a datetime value equivalent to 1st August, 2016.
= EDATE (DATE (2015,1,1),9) returns 10/1/2015 12:00:00 AM 
= EDATE (DATE (2015,1,30),1) returns 2/28/2015 12:00:00 AM 
= EDATE (DATE (2015,1,29),1) returns 2/28/2015 12:00:00 AM 

    53 Lectures 
     5.5 hours 

 Abhay Gadiya

    24 Lectures 
     2 hours 

 Randy Minder

    26 Lectures 
     4.5 hours 

 Randy Minder
 Print
 Add Notes
 Bookmark this page
Create a paragraph element with some text and append it to end of document body using jQuery - GeeksforGeeks

31 Dec, 2020
In this article, we will create a paragraph element with some text and append it to the end of the document body using jQuery. To append some text at the end of the document body, we use add() and appendTo() methods. The jQuery add() method is used to add elements to the existing group of elements. This method can add elements to the whole document, or just inside the context element if the context parameter is defined.
Syntax:
$(selector).add(element, context_parameter)
The jQuery appendTo() is an inbuilt method that is used to insert an HTML element at the end of the selected element.
Syntax:
$(content).appendTo(selector)
Example:
HTML
<!DOCTYPE html><html lang="en">  <head>         <!-- Import jQuery cdn library -->    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">    </script>      <script>        $(document).ready(function () {            $("button").click(function () {                $("button").add("                    <p>Hello World!</p>")                    .appendTo(document.body);            });        });    </script></head>  <body style="text-align: center;">    <h1 style="color: green;">        GeeksforGeeks    </h1>      <h3>        How to create a paragraph element with        some text and append it <br>to the end        of the document body using jQuery?    </h3>          <p>GeeksforGeeks computer science portal</p>      <span>GeeksforGeeks</span>    <br><br>      <button>Click Here!</button></body>  </html>
Output:
Before Click Button:
After Click Button:
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.
CSS-Misc
HTML-Misc
jQuery-Misc
CSS
HTML
JQuery
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Design a web page using HTML and CSS
Form validation using jQuery
How to set space between the flexbox ?
Search Bar using HTML, CSS and JavaScript
How to Create Time-Table schedule using HTML ?
How to set the default value for an HTML <select> element ?
How to set input type date in dd-mm-yyyy format using HTML ?
Hide or show elements in HTML using display property
How to Insert Form Data into Database using PHP ?
REST API (Introduction)
Python | Pandas Timestamp.weekday - GeeksforGeeks

21 Jan, 2019
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 Timestamp.weekday() function return the day of the week represented by the date in the given Timestamp object. Monday == 0 ... Sunday == 6.
Syntax :Timestamp.weekday()
Parameters : None
Return : day of the week
Example #1: Use Timestamp.weekday() function to return the day of the week for the date in the given Timestamp object.
# importing pandas as pdimport pandas as pd  # Create the Timestamp objectts = pd.Timestamp(year = 2011,  month = 11, day = 21,                   hour = 10, second = 49, tz = 'US/Central')   # Print the Timestamp objectprint(ts)
Output :
Now we will use the Timestamp.weekday() function to return the day of the week.
# return the day of the weekts.weekday()
Output :
As we can see in the output, the Timestamp.weekday() function has returned 0 indicating that the day is Monday. Example #2: Use Timestamp.weekday() function to return the day of the week for the date in the given Timestamp object.
# importing pandas as pdimport pandas as pd  # Create the Timestamp objectts = pd.Timestamp(year = 2009, month = 5, day = 31,                   hour = 4, second = 49, tz = 'Europe/Berlin')  # Print the Timestamp objectprint(ts)
Output :
Now we will use the Timestamp.weekday() function to return the day of the week.
# return the day of the weekts.weekday()
Output :
As we can see in the output, the Timestamp.weekday() function has returned 6 indicating that the day is Sunday.
Python Pandas-Timestamp
Python-pandas
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Enumerate() in Python
How to Install PIP on Windows ?
Different ways to create Pandas Dataframe
Create a Pandas DataFrame from Lists
*args and **kwargs in Python
How To Convert Python Dictionary To JSON?
sum() function in Python
How to drop one or multiple columns in Pandas Dataframe
Print lists in Python (4 Different Ways)
SQL - UNIQUE Constraint

The UNIQUE Constraint prevents two records from having identical values in a column. In the CUSTOMERS table, for example, you might want to prevent two or more people from having an identical age.
For example, the following SQL query creates a new table called CUSTOMERS and adds five columns. Here, the AGE column is set to UNIQUE, so that you cannot have two records with the same age.
CREATE TABLE CUSTOMERS(
   ID   INT              NOT NULL,
   NAME VARCHAR (20)     NOT NULL,
   AGE  INT              NOT NULL UNIQUE,
   ADDRESS  CHAR (25) ,
   SALARY   DECIMAL (18, 2),       
   PRIMARY KEY (ID)
);
If the CUSTOMERS table has already been created, then to add a UNIQUE constraint to the AGE column. You would write a statement like the query that is given in the code block below.
ALTER TABLE CUSTOMERS
   MODIFY AGE INT NOT NULL UNIQUE;
You can also use the following syntax, which supports naming the constraint in multiple columns as well.
ALTER TABLE CUSTOMERS
   ADD CONSTRAINT myUniqueConstraint UNIQUE(AGE, SALARY);
To drop a UNIQUE constraint, use the following SQL query.
ALTER TABLE CUSTOMERS
   DROP CONSTRAINT myUniqueConstraint;
If you are using MySQL, then you can use the following syntax −
ALTER TABLE CUSTOMERS
   DROP INDEX myUniqueConstraint;


    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
How to make Rounded buttons in Tkinter - GeeksforGeeks

17 Dec, 2020
Tkinter is a Python module that is used to create GUI (Graphical User Interface) applications with the help of a variety of widgets and functions. Like any other GUI module, it also supports images i.e you can use images in the application to make it more attractive.
In this article, we will discuss How to make a Rounded Button in Tkinter, There is no in-built method to make rounded buttons in Tkinter. For making the button rounded we will define borderwidth value to zero
borderwidth: It will represent the size of the border around the label. By default, borderwidth is 2 pixels. “bd” can also be used as a shorthand for borderwidth.
Step-by-step implementation:
Step 1: Create a Normal Tkinter Window.
Python3
# Import modulefrom tkinter import *  # Create objectroot = Tk()  # Adjust sizeroot.geometry("400x400")  # Execute tkinterroot.mainloop()
Output:
Step 2: Add button and image.
Python3
# Add Imagelogin_btn = PhotoImage(file = "Image Path")  # Create button and imageimg = Button(root, image = login_btn,             borderwidth = 0)  img.pack()
Output:
Below is the full implementation:
Python3
# Import Modulefrom tkinter import *  # Create Objectroot = Tk()  # Set geometryroot.geometry("400x400")  # Add Imagelogin_btn = PhotoImage(file = "Image Path")  # Create button and imageimg = Button(root, image = login_btn,             borderwidth = 0)  img.pack()  # Execute Tkinterroot.mainloop()
Output:
Python-tkinter
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to Install PIP on Windows ?
How to drop one or multiple columns in Pandas Dataframe
How To Convert Python Dictionary To JSON?
Check if element exists in list in Python
Python | Pandas dataframe.groupby()
Python | Get unique values from a list
Defaultdict in Python
Python | os.path.join() method
Python Classes and Objects
Create a directory in Python
SQL Tryit Editor v1.6

CREATE VIEW [Products Above Average Price] AS
SELECT ProductName, Price
FROM Products
WHERE Price > (SELECT AVG(Price) FROM Products); 
​
Edit the SQL Statement, and click "Run SQL" to see the result.
This SQL-Statement is not supported in the WebSQL Database.
The example still works, because it uses a modified version of SQL.
Your browser does not support WebSQL.
Your are now using a light-version of the Try-SQL Editor, with a read-only Database.
If you switch to a browser with WebSQL support, you can try any SQL statement, and play with the Database as much as you like. The Database can also be restored at any time.
Our Try-SQL Editor uses WebSQL to demonstrate SQL.
A Database-object is created in your browser, for testing purposes.
You can try any SQL statement, and play with the Database as much as you like. The Database can be restored at any time, simply by clicking the "Restore Database" button.
WebSQL stores a Database locally, on the user's computer. Each user gets their own Database object.
WebSQL is supported in Chrome, Safari, Opera, and Edge(79).
If you use another browser you will still be able to use our Try SQL Editor, but a different version, using a server-based ASP application, with a read-only Access Database, where users are not allowed to make any changes to the data.
MySQL query to get a substring from a string except the last three characters?

For this, you can use SUBSTR along with length().
Let us first create a table −
mysql> create table DemoTable
   (
   Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,
   FirstName varchar(20)
   );
Query OK, 0 rows affected (1.31 sec)
Following is the query to insert some records in the table using insert command −
mysql> insert into DemoTable(FirstName) values('John');
Query OK, 1 row affected (0.14 sec)
mysql> insert into DemoTable(FirstName) values('Carol');
Query OK, 1 row affected (0.22 sec)
mysql> insert into DemoTable(FirstName) values('Robert');
Query OK, 1 row affected (0.14 sec)
mysql> insert into DemoTable(FirstName) values('Chris');
Query OK, 1 row affected (0.16 sec)
mysql> insert into DemoTable(FirstName) values('David');
Query OK, 1 row affected (0.17 sec)
Following is the query to display records from the table using select command −
mysql> select *from DemoTable;
This will produce the following output −
+----+-----------+
| Id | FirstName |
+----+-----------+
| 1  | John      |
| 2  | Carol     |
| 3  | Robert    |
| 4  | Chris     |
| 5  | David     |
+----+-----------+
5 rows in set (0.00 sec)
Following is the query to get a substring removing the last 3 characters −
mysql> select substr(FirstName,1,length(FirstName)-3) from DemoTable;
This will produce the following output −
+-----------------------------------------+
| substr(FirstName,1,length(FirstName)-3) |
+-----------------------------------------+
| J                                       |
| Ca                                      |
| Rob                                     |
| Ch                                      |
| Da                                      |
+-----------------------------------------+
5 rows in set (0.00 sec)
To get same output, you can use following alternate query −
mysql> select left(FirstName,length(FirstName)-3) from DemoTable;
This will produce the following output −
+-------------------------------------+
| left(FirstName,length(FirstName)-3) |
+-------------------------------------+
| J                                   |
| Ca                                  |
| Rob                                 |
| Ch                                  |
| Da                                  |
+-------------------------------------+
5 rows in set (0.00 sec)
To get last three characters, you can use the following query −
mysql> select substr(FirstName,-3) from DemoTable;
This will produce the following output −
+----------------------+
| substr(FirstName,-3) |
+----------------------+
| ohn                  |
| rol                  |
| ert                  |
| ris                  |
| vid                  |
+----------------------+
5 rows in set (0.00 sec)
Program to find the maximum element in a Matrix in C++

In this problem, we are given a matrix of size nXm. Our task is to create a
program to find the maximum element in a Matrix in C++.
Problem Description − Here, we need to simply find the largest element of matrix.
Let’s take an example to understand the problem,
mat[3][3] = {{4, 1, 6},
{5, 2, 9},
{7, 3, 0}}
9
The solution to the problem is by simply traversing the matrix. This is done by using two nested loops, and checking whether each element of the matrix is greater than maxVal. And return the maxVal at the end.
Program to illustrate the working of our solution,
 Live Demo
#include <iostream>
using namespace std;
#define n 3
#define m 3
int CalcMaxVal(int mat[n][m]) {
   int maxVal = mat[0][0];
   for (int i = 0; i < n; i++)
      for (int j = 0; j < m; j++)
         if (mat[i][j] > maxVal)
            maxVal = mat[i][j];
   return maxVal;
}
int main(){
   int mat[n][m] = {{4, 1, 6},{5, 2, 9},{7, 3, 0}};
   cout<<"The maximum element in a Matrix is "<<CalcMaxVal(mat);
   return 0;
}
The maximum element in a Matrix is 9
What are predefined attributes in C#?

The following are the predefined attributes in C# −
AttributeUsage
Conditional
Obsolete
The pre-defined attribute AttributeUsage describes how a custom attribute class can be used. Here is the syntax −
[AttributeUsage (
   validon,
   AllowMultiple = allowmultiple,
   Inherited = inherited
)]
This predefined attribute marks a conditional method whose execution depends on a specified preprocessing identifier. It causes conditional compilation of method calls, depending on the specified value such as Debug or Trace.
The following is the syntax −
[Conditional(
   conditionalSymbol
)]
This predefined attribute marks a program entity that should not be used. It enables you to inform the compiler to discard a particular target element. Here is the syntax −
[Obsolete (
   message
)]

[Obsolete (
   message,
   iserror
)]