code-rag-bench/online-tutorials huggingface dataset:
JavaScript Function.prototype.bind() Method - GeeksforGeeks

08 Dec, 2021
A function is a set of statements that take inputs, do some specific computation, and produce output. There are various scenarios in programming in which we need to pre-configure this keyword or function arguments and we can easily do that in JavaScript with the help of the bind() method. The bind() method creates a new function based on the function on which it is called. Using the bind() method, we can pre-configure this keyword and arguments for the function using the syntax shown below.
Syntax:
const newFunction = oldFunction.bind(thisArg, arg1, ag2, ..., argN)
Using the above syntax, a new function is created based on the old function with this keyword set to thisArg, and function arguments are preconfigured as arg1, agr2, and so on. The example mentioned below demonstrates the use of the bind() method with the help of an example.
Example:
Javascript
<script>    const car = {        brand: 'Lamborghini',    };     // As of now, 'this' keyword refers    // to 'window' object.    const printDetail = function (model, topSpeed) {        console.log(`${this.brand} ${model} has a        top speed of ${topSpeed} mph`);    };     // Calling the function without using bind which    // means 'this' still refers to 'window' object    // so accessing this.brand will give undefined    printDetail('Diablo Coatl', 239);     // Creating a new function based on printDetail    // with 'this' keyword referring to car object    // so accessing this.brand will give 'Lamborgini'    const lamboPrintDetail = printDetail.bind(car);    lamboPrintDetail('Diablo VTTT', 222);     // Creating another function based on printDetail    // with it's arguments pre-configured and 'this'    // keyword referring to car object    const reventonPrintDetail        = printDetail.bind(car, 'Reventon', 221);     // Since the arguments are preconfigured so we don't    // need to pass any argument to call this function    reventonPrintDetail();</script>
Output:
undefined Diablo Coatl has a top speed of 239 mph
Lamborghini Diablo VTTT has a top speed of 222 mph
Lamborghini Reventon has a top speed of 221 mph
varshagumber28
JavaScript-Methods
Picked
JavaScript
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Remove elements from a JavaScript Array
Difference between var, let and const keywords in JavaScript
Difference Between PUT and PATCH Request
JavaScript | Promises
How to get character array from string in JavaScript?
Remove elements from a JavaScript Array
Installation of Node.js on Linux
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?
Difference between var, let and const keywords in JavaScript
Difference between Console.Write and Console.WriteLine in C# - GeeksforGeeks

26 May, 2020
In C#, to print the data on the console output screen the following method are used – Console.Write() and Console.WriteLine() method. Console is a predefined class of System namespace. While Write() and WriteLine() both are the Console Class methods.
The only difference between the Write() and WriteLine() is that Console.Write is used to print data without printing the new line, while Console.WriteLine  is used to print data along with printing the new line.
Program 1: Example of Console.Write() in C#.
C#
// C# program to show the difference// between Console.Write and // Console.WriteLine    using System;  public class GFG{        static void Main(string[] args)    {        // use of Write() method        Console.Write("Geeks");        Console.Write("For");        Console.Write("Geeks");    }}
Output:
GeeksForGeeks

Program 2: Example of Console.WriteLine() in C#.
C#
// C# program to show the difference// between Console.Write and // Console.WriteLine    using System;  public class GFG{        static void Main(string[] args)    {        // use of WriteLine() method        Console.WriteLine("Geeks");        Console.WriteLine("For");        Console.WriteLine("Geeks");    }}
Output:
Geeks
For
Geeks

In the above code, program 1 shows the output without including the newline in the each console output and program 2 shows the output including the newline in the each console output.
C#
Difference Between
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Extension Method in C#
HashSet in C# with Examples
C# | Inheritance
Partial Classes in C#
C# | Generics - Introduction
Difference between BFS and DFS
Class method vs Static method in Python
Differences between TCP and UDP
Difference between var, let and const keywords in JavaScript
Differences between IPv4 and IPv6
Dynamic SQL - GeeksforGeeks

08 Sep, 2020
Prerequisite – Difference between Static and Dynamic SQL
Dynamic SQL is a programming technique that could be used to write SQL queries during runtime. Dynamic SQL could be used to create general and flexible SQL queries.
Syntax for dynamic SQL is to make it string as below :
'SELECT statement';
To run a dynamic SQL statement, run the stored procedure sp_executesql as shown below :
EXEC sp_executesql N'SELECT statement';
Use prefix N with the sp_executesql to use dynamic SQL as a Unicode string.Steps to use Dynamic SQL :
Declare two variables, @var1 for holding the name of the table and @var 2 for holding the dynamic SQL :DECLARE 
@var1 NVARCHAR(MAX), 
@var2 NVARCHAR(MAX);Set the value of the @var1 variable to table_name :SET @var1 = N'table_name';Create the dynamic SQL by adding the SELECT statement to the table name parameter :SET @var2= N'SELECT * 
FROM ' + @var1;Run the sp_executesql stored procedure by using the @var2 parameter :EXEC sp_executesql @var2;
Declare two variables, @var1 for holding the name of the table and @var 2 for holding the dynamic SQL :DECLARE 
@var1 NVARCHAR(MAX), 
@var2 NVARCHAR(MAX);
DECLARE 
@var1 NVARCHAR(MAX), 
@var2 NVARCHAR(MAX);
Set the value of the @var1 variable to table_name :SET @var1 = N'table_name';
SET @var1 = N'table_name';
Create the dynamic SQL by adding the SELECT statement to the table name parameter :SET @var2= N'SELECT * 
FROM ' + @var1;
SET @var2= N'SELECT * 
FROM ' + @var1;
Run the sp_executesql stored procedure by using the @var2 parameter :EXEC sp_executesql @var2;
EXEC sp_executesql @var2;
Example –
SELECT * 
from geek;
Table – Geek
Using Dynamic SQL :
DECLARE 
@tab NVARCHAR(128), 
@st NVARCHAR(MAX);
SET @tab = N'geektable';
SET @st = N'SELECT * 
FROM ' + @tab;
EXEC sp_executesql @st;
Table – Geek
DBMS-SQL
SQL
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Update Multiple Columns in Single Update Statement in SQL?
How to Create a Table With Multiple Foreign Keys in SQL?
What is Temporary Table in SQL?
SQL | Subquery
SQL Query to Convert VARCHAR to INT
SQL Query to Find the Name of a Person Whose Name Starts with Specific Letter
SQL using Python
How to Write a SQL Query For a Specific Date Range and Date Time?
How to Select Data Between Two Dates and Times in SQL Server?
SQL Query to Compare Two Dates
C program to print digital clock with current time - GeeksforGeeks

16 Nov, 2021
The time.h header defines four variable types, two macro and various functions for manipulating date and time. A brief description of the variable types defined in the header time.h is as :  
size_t : This is the unsigned integral type and is the result of the sizeof keyword.
clock_t : This is a type suitable for storing the processor time.
time_t is : This is a type suitable for storing the calendar time.
struct tm : This is a structure used to hold the time and date.
Below is the implementation of digital clock. On executing the program, the output window will show the time when the program was executed.  
C
// C implementation of digital clock#include <stdio.h>#include <time.h> // driver codeint main(){    time_t s, val = 1;    struct tm* current_time;     // time in seconds    s = time(NULL);     // to get current time    current_time = localtime(&s);     // print time in minutes,    // hours and seconds    printf("%02d:%02d:%02d",           current_time->tm_hour,           current_time->tm_min,           current_time->tm_sec);     return 0;}
Output :  
Below is the C program to show the current time inside a rectangular bar. The output window shows the day, month, date, current time and year. 
C
// C program to print digital// clock using graphics#include <graphics.h>#include <time.h> // driver codeint main(){    // DETECT is a macro defined in    // "graphics.h" header file    int dt = DETECT, gmode, midx, midy;    long current_time;    char strftime[30];     // initialize graphic mode    initgraph(&dt, &gmode, "");     // to find mid value in horizontal    // and vertical axis    midx = getmaxx() / 2;    midy = getmaxy() / 2;     // set current colour to white    setcolor(WHITE);     // make a rectangular box in    // the middle of screen    rectangle(midx - 200, midy - 40, midx + 200,                                     midy + 40);     // fill rectangle with white color    floodfill(midx, midy, WHITE);    while (!kbhit()) {         // get current time in seconds        current_time = time(NULL);         // store time in string        strcpy(strftime, ctime(¤t_time));         // set color of text to red        setcolor(RED);         // set the text justification        settextjustify(CENTER_TEXT, CENTER_TEXT);         // to set styling to text        settextstyle(SANS_SERIF_FONT, HORIZ_DIR, 3);         // locate position to write        moveto(midx, midy);         // print current time        outtext(strftime);    }    getch();     // deallocate memory for graph    closegraph();}
Output :  
References : cprogramforbeginners 
kalrap615
c-graphics
date-time-program
C Language
C Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
TCP Server-Client implementation in C
Exception Handling in C++
'this' pointer in C++
Multithreading in C
Arrow operator -> in C/C++ with Examples
Strings in C
Arrow operator -> in C/C++ with Examples
Header files in C/C++ and its uses
C Program to read contents of Whole File
UDP Server-Client implementation in C
Java Program to Display Transpose Matrix - GeeksforGeeks

07 Jan, 2021
Transpose of a matrix is obtained by changing rows to columns and columns to rows. In other words, transpose of A[][] is obtained by changing A[i][j] to A[j][i].
Approach:
Create a 2-D Array.
Insert the values in the array by running two nested loops. The outer ith loop will go till the no.of rows and the inner jth loop will run till the number of columns.
For displaying the transpose of the matrix, run the same loop as explained in the above step but print the a[j[i] th element every time we are traversing inside the loop.
Example:
Java
// Java Program to Display Transpose Matrix  import java.util.*;public class GFG {    public static void main(String args[])    {        // initialize the array of 3*3 order        int[][] arr = new int[3][3];          System.out.println("enter the elements of matrix");          int k = 1;          // get the elements from user        for (int i = 0; i < 3; i++) {            for (int j = 0; j < 3; j++) {                arr[i][j] = k++;            }        }          System.out.println("Matrix before Transpose ");          // display original matrix        for (int i = 0; i < 3; i++) {            for (int j = 0; j < 3; j++) {                System.out.print(" " + arr[i][j]);            }            System.out.println();        }          System.out.println("Matrix After Transpose ");          // transpose and print matrix        for (int i = 0; i < 3; i++) {            for (int j = 0; j < 3; j++) {                System.out.print(" " + arr[j][i]);            }            System.out.println();        }    }}
enter the elements of matrix
Matrix before Transpose 
 1 2 3
 4 5 6
 7 8 9
Matrix After Transpose 
 1 4 7
 2 5 8
 3 6 9
Picked
Technical Scripter 2020
Java
Java Programs
Technical Scripter
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Stream In Java
Exceptions in Java
Constructors in Java
Functional Interfaces in Java
Different ways of Reading a text file in Java
Java Programming Examples
Convert Double to Integer in Java
Implementing a Linked List in Java using Class
How to Iterate HashMap in Java?
Iterate through List in Java
isgraph() C library function - GeeksforGeeks

24 Oct, 2017
The C library function isgraph() checks whether a character is a graphic character or not.Characters that have graphical representation are known are graphic characters. For example: ‘:’ ‘;’ ‘?’ ‘@’ etc.
Syntax –
#include <ctype.h>
int isgraph(int ch);

Return Value – function returns nonzero if ch is any printable character other than a space, else it returns 0.
For ASCII environments, printable characters are in the range of 0X21 through 0X7E.
Code –
// code to check graphical character#include <stdio.h>#include <ctype.h>  int main(){    char var1 = 'g';    char var2 = ' ';    char var3 = '1';      if (isgraph(var1))         printf("var1 = |%c| can be printed\n", var1);    else         printf("var1 = |%c| can't be printed\n", var1);      if (isgraph(var2))         printf("var2 = |%c| can be printed\n", var2);    else         printf("var2 = |%c| can't be printed\n", var2);          if (isgraph(var3))         printf("var3 = |%c| can be printed\n", var3);    else         printf("var3 = |%c| can't be printed\n", var3);      return (0);}
Output –
var1 = |g| can be printed
var2 = | | can't be printed
var3 = |1| can be printed

Code –
// code to print all Graphical Characters#include <stdio.h>#include <ctype.h>  int main(){     int i;    printf("In C programming All graphic "            "characters are: \n");      for (i = 0; i <= 127; ++i)         if (isgraph(i) != 0)            printf("%c ", i);          return 0;}
Output –
In C programming All graphic characters are: 
! " # $ % & ' ( ) * +, - . / 0 1 2 3 4 5 6 7 8 9 
: ;  ? @ A B C D E F G H I J K L M N O P Q R S T U
 V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n
 o p q r s t u v w x y z { | } ~ 

This article is contributed by Shivani Ghughtyal. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
C-Library
C Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
TCP Server-Client implementation in C
Exception Handling in C++
'this' pointer in C++
Multithreading in C
Arrow operator -> in C/C++ with Examples
Multiple Inheritance in C++
Smart Pointers in C++ and How to Use Them
Understanding "extern" keyword in C
How to split a string in C/C++, Python and Java?
UDP Server-Client implementation in C
Partial functions in Python. Reduce the complexity of your code. | by Dhanesh Budhrani | Towards Data Science

In this post I’ll be talking about partial functions and how we can use them to make our code cleaner.
A partial function allows us to call a second function with fixed values in certain arguments. For instance, we may have a function that computes an exponentiation. Then, we may need to create a new function that assigns a fixed value to either the base or the exponent. We can easily do this by using functool’s partial function, without having to replicate the body of the original function. Let’s go through the implementation of the above example to get a better understanding.
First of all, we’ll need the function from which the partial function will be based on. As mentioned before, we’ll implement an exponentiation function:
def power(base, exponent):  return base ** exponent
Now, we may want to implement a function that computes the squared value of a number. If we didn’t have partial functions available in Python, we’d have to replicate (and adapt) our code:
def squared(base):  return base ** 2
In this case, it wasn’t much of a big deal, since we only had to replicate one line of code. However, in most situations, you’ll have to deal with larger functions. Let’s see how to reuse “power()” with a partial function:
from functools import partialdef power(base, exponent):  return base ** exponentsquared = partial(power, exponent=2)
Finally, we may call “squared()” as simply as follows:
squared(3)squared(base=7)
That’s it! I hope that partial functions become a useful tool for you and help you reduce complexity in your code!
How to create a String object in C#?

To create a string object in C#, use any of the below given method.
By assigning a string literal to a String variable
By using a String class constructor
By using the string concatenation operator (+)
By retrieving a property or calling a method that returns a string
By calling a formatting method to convert a value or an object to its string representation
The following is an example showing different ways to create a string object in C#.
 Live Demo
using System;
namespace Demo {
   class Program {
      static void Main(string[] args) {
         //from string literal and string concatenation
         string fname, lname;
         fname = "Brad ";
         lname = "Pitt";
         char []letters= { 'W', 'e', 'b'};
         string [] sarray={ "Web", "World"};
         string fullname = fname + lname;
         Console.WriteLine("Full Name: {0}", fullname);
         //by using string constructor { 'W, 'e', 'b'};
         string greetings = new string(letters);
         Console.WriteLine("Greetings: {0}", greetings);
         //methods returning string { "Web", "World" };
         string message = String.Join(" ", sarray);
         Console.WriteLine("Message: {0}", message);
         //formatting method to convert a value
         DateTime waiting = new DateTime(2012, 10, 10, 17, 58, 1);
         string chat = String.Format("Message sent at {0:t} on {0:D}", waiting);
         Console.WriteLine("Message: {0}", chat);
      }
   }
}
Full Name: Brad Pitt
Greetings: Web
Message: Web World
Message: Message sent at 5:58 PM on Wednesday, October 10, 2012
Java - String toLowerCase() Method

This method has two variants. The first variant converts all of the characters in this String to lower case using the rules of the given Locale. This is equivalent to calling toLowerCase(Locale.getDefault()).
The second variant takes locale as an argument to be used while converting into lower case.
Here is the syntax of this method −
public String toLowerCase()

Here is the detail of parameters −
NA
NA
It returns the String, converted to lowercase.
import java.io.*;
public class Test {

   public static void main(String args[]) {
      String Str = new String("Welcome to Tutorialspoint.com");

      System.out.print("Return Value :");
      System.out.println(Str.toLowerCase());
   }
}
This will produce the following result −
Return Value :welcome to tutorialspoint.com


    16 Lectures 
     2 hours 

 Malhar Lathkar

    19 Lectures 
     5 hours 

 Malhar Lathkar

    25 Lectures 
     2.5 hours 

 Anadi Sharma

    126 Lectures 
     7 hours 

  Tushar Kale

    119 Lectures 
     17.5 hours 

 Monica Mittal

    76 Lectures 
     7 hours 

 Arnab Chakraborty
 Print
 Add Notes
 Bookmark this page
Change x axes scale in matplotlib

Using plt.xticks, we can change the X-axis scale.
Using plt.plot() method, we can create a line with two lists that are passed in its argument.
Using plt.plot() method, we can create a line with two lists that are passed in its argument.
Add text to the axes. Add the text *s* to the axes at location *x*, *y* in data coordinates, using plt.text() method, where the font size can be customized by changing the font-size value.
Add text to the axes. Add the text *s* to the axes at location *x*, *y* in data coordinates, using plt.text() method, where the font size can be customized by changing the font-size value.
Using xticks method, get or set the current tick locations and labels of the X-axis.
Using xticks method, get or set the current tick locations and labels of the X-axis.
To show the figure, use plt.show() method.
To show the figure, use plt.show() method.
import matplotlib.pyplot as plt

plt.plot([1, 2, 4], [1, 2, 4])

plt.text(2, 3, "y=x", color='red', fontsize=20)

plt.xticks([1, 2, 3, 4, 5])    # changing x scale by own

plt.show()
How to Create a Progress Bar using HTML5 ? - GeeksforGeeks

28 May, 2020
In this article, we are creating the progress bar of a task by using a <progress> tag. It is used to represent the progress of a task. It is also defined as how much work is done and how much is left. It is not used to represent the disk space or relevant query.
Syntax:
<progress attributes...> </progress>
Example:
<!DOCTYPE html><html>  <head>    <title>        Represent the progress of a task    </title></head>  <body>    <h1 style="color:green;">        GeeksForGeeks    </h1>      <h2>        HTML5: How to represent         the progress of a task    </h2>          Downloading progress for a song:    <progress value="57" max="100">    </progress></body>  </html>               
Output:
Supported Browsers are listed below:
Google Chrome
Internet Explorer
Firefox
Opera
Safari
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.
HTML-Misc
HTML5
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to update Node.js and NPM to next version ?
How to Insert Form Data into Database using PHP ?
REST API (Introduction)
Types of CSS (Cascading Style Sheet)
Form validation using HTML and JavaScript
Roadmap to Become a Web Developer in 2022
Installation of Node.js on Linux
How to fetch data from an API in ReactJS ?
Top 10 Angular Libraries For Web Developers
Convert a string to an integer in JavaScript
How to create an impressive GUI in Python using Tkinter?

Tkinter is a standard Python GUI library in Python, which gives us an object-oriented interface with Tk GUI Toolkit. It's amazing how quickly one can create some really impressive looking apps. Actions in GUI are usually performed through direct manipulation of graphical elements.
We will take a simple "addition" application to show how easy it is to create an impressive GUI in Python using tkinter. GUI is all about widgets and windows and these are available in Tkinter.
First, we will import the Tkinter library, then create a window object (class Tk is used to create window object) and create a label widget in which we can show any text or image (used in GUI application). The widget is in the insert window and on executing, we will get the output screen.
# Import the required libraries
from tkinter import *
win=Tk()
win.geometry("700x300")

def sum():
   a=int(entry1.get())
   b=int(entry2.get())
   c=a+b
   # insert(index,value)
   entry3.insert(0,c)

def clearing():
   # delete(0,END)
   entry1.delete(0,END)
   entry2.delete(0,END)
   entry3.delete(0,END)

label1=Label(win, text="Enter number 1:", padx=20, pady=10)
label2=Label(win, text="Enter number 2:", padx=20, pady=10)

entry1=Entry(win, width=30, borderwidth=2)
entry2=Entry(win, width=30, borderwidth=2)
entry3=Entry(win, width=30, borderwidth=2)

add=Button(win, text="Add", padx=20, pady=10, command=sum)

clear=Button(win, text="Clear", padx=20, pady=10, command=clearing)

label1.grid(row=0, column=0)
label2.grid(row=1, column=0)

entry1.grid(row=0, column=1)
entry2.grid(row=1, column=1)
add.grid(row=2, column=0)
entry3.grid(row=3, column=0)
clear.grid(row=2, column=1)

win.mainloop()
If we run the above code, it will display a window with a basic addition widget.
Now, insert two numbers (number 1 and number 2) and click the Add button to show the summation of number 1 and number 2 or click the Clear button to refresh the output screen.
map::clear() in C++ STL

In this article we will be discussing the working, syntax and examples of map::clear() function in C++ STL.
Maps are the associative container, which facilitates to store the elements formed by a combination of key value and mapped value in a specific order. In a map container the data is internally always sorted with the help of its associated keys. The values in the map container are accessed by its unique keys.
map::clear() function is an inbuilt function in C++ STL, which is defined in  header file. clear() is used to remove all the content from the associated map container. This function removes all the values and makes the size of the container as 0.
Map_name.clear();
This function accepts no parameter.
This function returns nothing
map<char, int> newmap;
newmap[‘a’] = 1;
newmap[‘b’] = 2;
newmap[‘c’] = 3;
newmap.clear();
size of the map is: 0
 Live Demo
#include <bits/stdc++.h>
using namespace std;
int main() {
   map<int, string> TP_1, TP_2;
   //Insert values
   TP_1[1] = "Tutorials";
   TP_1[2] = "Point";
   TP_1[3] = "is an";
   TP_1[4] = "education portal";
   //size of map
   cout<< "Map size before clear() function: \n";
   cout << "Size of map1 = "<<TP_1.size() << endl;
   cout << "Size of map2 = "<<TP_2.size() << endl;
   //call clear() to delete the elements
   TP_1.clear();
   TP_2.clear();
   //now print the size of maps
   cout<< "Map size after applying clear() function: \n";
   cout << "Size of map1 = "<<TP_1.size() << endl;
   cout << "Size of map2 = "<<TP_2.size() << endl;
   return 0;
}
Map size before clear() function:
Size of map1 = 4
Size of map2 = 0
Map size after applying clear() function:
Size of map1 = 0
Size of map2 = 0
What is the difference between custom and built-in functions in JavaScript?

The custom functions in JavaScript are user-defined functions. JavaScript allows us to write our own functions. The following is the syntax −
<script>
   <!--
      function functionname(parameter-list)
      {
         statements
      }
   //-->
</script>
Bult-in functions are functions already provided by JavaScript library, for example, the following are string functions −
The following is an example of a built-in function in JavaScript to concatenate strings −
 Live Demo
<html>
   <head>
      <title>JavaScript String concat() Method</title>
   </head>
   
   <body>
      <script>
         var str1 = new String( "This is string one" );
         var str2 = new String( "This is string two" );
         var str3 = str1.concat( str2 );
         
         document.write("Concatenated String :" + str3);
      </script>
   </body>
</html>
Bootstrap - Images

This chapter covers the Bootstrap support for images. Bootstrap provides three classes that can be used to apply some simple styles to images −
.img-rounded − adds border-radius:6px to give the image rounded corners.
.img-rounded − adds border-radius:6px to give the image rounded corners.
.img-circle − makes the entire image round by adding border-radius:500px.
.img-circle − makes the entire image round by adding border-radius:500px.
.img-thumbnail − adds a bit of padding and a gray border −
.img-thumbnail − adds a bit of padding and a gray border −
The following example demonstrates this −
<img src = "/bootstrap/images/download.png" class = "img-rounded">
<img src = "/bootstrap/images/download.png" class = "img-circle">
<img src = "/bootstrap/images/download.png" class = "img-thumbnail">

    26 Lectures 
     2 hours 

 Anadi Sharma

    54 Lectures 
     4.5 hours 

 Frahaan Hussain

    161 Lectures 
     14.5 hours 

 Eduonix Learning Solutions

    20 Lectures 
     4 hours 

 Azaz Patel

    15 Lectures 
     1.5 hours 

 Muhammad Ismail

    62 Lectures 
     8 hours 

 Yossef Ayman Zedan
 Print
 Add Notes
 Bookmark this page
Explain about regular expressions in TOC?

A regular expression is basically a shorthand way of showing how a regular language is built from the base set of regular languages.
The symbols are identical which are used to construct the languages, and any given expression that has a language closely associated with it.
For each regular expression E, there is a regular language L(E).
Example 1
If the regular expression is as follows −
a + b · a*
It can be written in fully parenthesized form as follows −
(a + (b · (a*)))
Regular expressions vs. Languages
The symbols of the regular expressions are distinct from those of the languages. These symbols are given below −
Operators in Regular expression −
There are two binary operations on regular expressions (+ and ·) and one unary operator (*)
These are closely associated with the union, product and closure operations on the corresponding languages.
Example 1
The regular expression a + bc* is basically shorthand for the regular language {a} ∪ ({b} · ({c}*)).
Example 2
Find the language of the given regular expression. It is explained below −
a + bc*.
L(a + bc*) = L(a) ∪ L(bc*)
               = L(a) ∪ (L(b) · L(c*))
               = L(a) ∪ (L(b) · L(c)*)
               = {a} ∪ ({b} · {c}*)
               = {a} ∪ ({b} · {∧, c, c2, . . . , cn, . . . , })
               = {a} ∪ {b, bc, bc2, . . . , bcn, . . . }
               = {a, b, bc, bc2, . . . , bcn, . . . }.
Python | Pandas Period.freq

06 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 Period.freq attribute returns the frequency applied on the given Period object.
Syntax : Period.freq
Parameters : None
Return : frequency
Example #1: Use Period.freq attribute to find the time series frequency applied on the given Period object.
# importing pandas as pdimport pandas as pd  # Create the Period objectprd = pd.Period(freq ='D', year = 2001, month = 2, day = 21)  # Print the Period objectprint(prd)
Output :
Now we will use the Period.freq attribute to find the frequency applied on prd object.
# return the frequencyprd.freq
Output :
As we can see in the output, the Period.freq attribute has returned ‘Day’ indicating that the time series frequency applied on the given object was day.
Example #2: Use Period.freq attribute to find the time series frequency applied on the given Period object.
# importing pandas as pdimport pandas as pd  # Create the Period objectprd = pd.Period(freq ='Q', year = 2006, quarter = 1)  # Print the objectprint(prd)
Output :
Now we will use the Period.freq attribute to find the frequency applied on prd object.
# return the frequencyprd.freq
Output :
As we can see in the output, the Period.freq attribute has returned ‘QuarterEnd’ indicating that the time series frequency applied on the given object was ‘Quarter’.
Pandas scalar-period
Python-pandas
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Add QT GUI to Python for plotting graphics - GeeksforGeeks

19 Feb, 2020
Qt framework (with QT Creator IDE) can be used to create a fancy interfaces for Python GUI application. Plotting graphics on a GUI is possible with pyqtgraph library.
Installing pyqtgraph –There are several ways of installing pyqtgraph depending on your needs.
If you are using Anaconda you can install with:
conda install -c anaconda pyqtgraph

Or with pip command:
pip install pyqtgraph

Creation of plot widgets with QT Creator –
Add the buttons, text areas and other stuffs as usually done with QT Creator. To create a plot area you need to follow the steps:
Add widget to UI and give it a proper name like “widgetSignal”Promote the widget to pyqtgraph
Add widget to UI and give it a proper name like “widgetSignal”
Promote the widget to pyqtgraph
Load UI to Python –
In your python code call the UI you created with QT Creator.Create a sin wave for plottingDraw the graph on UI
In your python code call the UI you created with QT Creator.
Create a sin wave for plotting
Draw the graph on UI
from PyQt5 import QtWidgets, uicimport sysimport numpy as np  class MainWindow(QtWidgets.QMainWindow):          def __init__(self, *args, **kwargs):        super(MainWindow, self).__init__(*args, **kwargs)         # Load the UI Page        self. ui = uic.loadUi('mainwindow.ui', self)        # Create a sin wave        x_time = np.arange(0, 100, 0.1);        y_amplitude = np.sin(x_time)                  pltSignal = self.widgetSignal        pltSignal.clear()        pltSignal.setLabel('left', 'Signal Sin Wave', units ='(V)')        pltSignal.setLabel('bottom', 'Time', units ='(sec)')        pltSignal.plot(x_time, y_amplitude, clear = True)          self.ui.show()  def main():    app = QtWidgets.QApplication(sys.argv)    window = MainWindow()    sys.exit(app.exec_())  if __name__ == '__main__':    main()     
Output:
Python-gui
Python-PyQt
Technical Scripter 2019
Python
Technical Scripter
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
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 | Pandas dataframe.groupby()
Python | Get unique values from a list
3 bit Synchronous Down Counter - GeeksforGeeks

19 May, 2021
Prerequisite : Counter , Synchronous counter.
3 bit Synchronous Down Counter :
In synchronous counter clock is provided to all the flip-flops simultaneously.
Circuit becomes complex as the number of states increases.
Speed is high.
Design : The steps involves in design are 
  1. Decide the number of Flip flops – 
N number of Flip flop(FF) required for N bit counter.
For 3 bit counter we require 3 FF.
Maximum count = 2n-1, where n is a number of bits.
For n= 3, Maximum count = 7.
Here T FF is used.
   2. Write excitation table of FF –
 3. Draw State diagram and circuit excitation table –      Number of states = 2n, where n is number of bits.
Here T = 1, then there is output state(next state changes from previous state) changes i.e Q changes from 0 to 1 or 1 to 0 T= 0 then, there is no state output state changes i.e Q remains same 
 4. Find simplified equation using k map –
K map for 3 bit synchronous down counter 
 5.  Create circuit diagram –The clock is provided to every Flip flop at same instant of time. The toggle(T) input is provided to every Flip flop according to the simplified equation of K map.
Timing diagram of 3 bit synchronous Down counter.
Explanation :  Here -ve edge triggered clock is used for toggling purpose.
As we see from characteristics table when T = 1, then toggling takes place and T =0 then it stores the output state.
Initially Q3 = 0, Q2= 0, Q1= 0.
In simplified equation of K map we get T1 = 1, therefore Flip flop 1 output Q1 is toggle for every negative edge(because clock is negative edge triggered). Flip-flop(FF) 2 toggle input(T2) is connected to Q’1. Therefore, Flip Flop 2 output state Q2 is toggle only when there is clock falling edge  (i.e -ve edge triggering) and Q’1 =1.
Similarly, Flip flop 3 toggle input(T) is connected to Q’2 and Q’1. Therefore, Flip flop 3 output is toggle when there is clock falling edge and Q’2=1 and Q’1 = 1 .(as you can see from timing diagram)
Therefore, we get output(as down counting Q3(MSB) Q2 Q1(LSB) after 8th -ve edge triggered clock the output of the three Flip flops again becomes Q3 = 0, Q2 = 0, Q1 =0.
We get output(state changes) after every -ve edge clock pulse.
By 3 Flip flop we get output as 23-1= 7 to 0.
Digital Electronics & Logic Design
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
4-bit binary Adder-Subtractor
Multiplexers in Digital Logic
Magnitude Comparator in Digital Logic
BCD to 7 Segment Decoder
Full Subtractor in Digital Logic
Carry Look-Ahead Adder
Encoder in Digital Logic
Half Adder in Digital Logic
Difference between Unipolar, Polar and Bipolar Line Coding Schemes
Encoders and Decoders in Digital Logic
ios good() function in C++ with Examples - GeeksforGeeks

02 Sep, 2019
The good() method of ios class in C++ is used to check if the stream is good enough to work. It means that this function will check if this stream has raised any error or not.
Syntax:
bool good() const;

Parameters: This method does not accept any parameter.
Return Value: This method returns true if the stream is good, else false.
Example 1:
// C++ code to demonstrate// the working of good() function  #include <bits/stdc++.h>using namespace std;  int main(){      // Stream    stringstream ss;      // Using good() function    bool isGood = ss.good();      // print result    cout << "is stream good: "         << isGood << endl;      return 0;}
is stream good: 1

Example 2:
// C++ code to demonstrate// the working of good() function  #include <bits/stdc++.h>using namespace std;  int main(){      // Stream    stringstream ss;    ss.clear(ss.eofbit);      // Using good() function    bool isGood = ss.good();      // print result    cout << "is stream good: "         << isGood << endl;      return 0;}
is stream good: 0

Reference: hhttp://www.cplusplus.com/reference/ios/ios/good/
CPP-Functions
cpp-ios
C++
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Operator Overloading in C++
Sorting a vector in C++
Polymorphism in C++
Friend class and function in C++
List in C++ Standard Template Library (STL)
Convert string to char array in C++
new and delete operators in C++ for dynamic memory
Destructors in C++
Pair in C++ Standard Template Library (STL)
Inline Functions in C++
Kotlin When Expressions

Instead of writing many if..else expressions, you can use the when 
expression, which is much easier to read.
It is used to select one of many code blocks to be executed:
Use the weekday number to calculate the weekday name:
val day = 4

val result = when (day) {
  1 -> "Monday"
  2 -> "Tuesday"
  3 -> "Wednesday"
  4 -> "Thursday"
  5 -> "Friday"
  6 -> "Saturday"
  7 -> "Sunday"
  else -> "Invalid day."
}
println(result)

// Outputs "Thursday" (day 4)
The when expression is similar to the switch statement in Java.
This is how it works:
The when variable (day) is evaluated once
The value of the day variable is compared with the values of each "branch"
Each branch starts with a value, followed by an arrow (->) and a result
If there is a match, the associated block of code is executed
else is used to specify some code to run if there is no match
In the example above, the value of day is 4, meaning "Thursday" will be printed
We just launchedW3Schools videos
Get certifiedby completinga course today!
If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:
help@w3schools.com
Your message has been sent to W3Schools.
Assertions in Python 3

An assertion is a sanity-check that you can turn on  or turn off when you are done with your testing of the program.
The easiest way to think of an assertion is to liken it to a raise-if statement (or to be more accurate, a raise-if-not statement). An expression is tested, and if the result comes up false, an exception is raised.
Assertions are carried out by the assert statement, the newest keyword to Python, introduced in version 1.5.
Programmers often place assertions at the start of a function to check for valid input, and after a function call to check for valid output.
When it encounters an assert statement, Python evaluates the accompanying expression, which is hopefully true. If the expression is false, Python raises an AssertionError exception.
The syntax for assert is:
assert Expression[, Arguments]
If the assertion fails, Python uses ArgumentExpression as the argument for the AssertionError. AssertionError exceptions can be caught and handled like any other exception using the try-except statement, but if not handled, they will terminate the program and produce a traceback.
Here is a function that converts a temperature from degrees Kelvin to degrees Fahrenheit. Since zero degrees Kelvin is as cold as it gets, the function bails out if it sees a negative temperature:
#!/usr/bin/python3

def KelvinToFahrenheit(Temperature):
   assert (Temperature >= 0),"Colder than absolute zero!"
   return ((Temperature-273)*1.8)+32

print (KelvinToFahrenheit(273))
print (int(KelvinToFahrenheit(505.78)))
print (KelvinToFahrenheit(-5))
When the above code is  executed, it produces the following result:
32.0
451
Traceback (most recent call last):
  File "test.py", line 9, in <module>
    print KelvinToFahrenheit(-5)
  File "test.py", line 4, in KelvinToFahrenheit
    assert (Temperature >= 0),"Colder than absolute zero!"
AssertionError: Colder than absolute zero!

    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
HTTP headers | Content-Language - GeeksforGeeks

23 Oct, 2019
HTTP headers are used to provide additional information in HTTP request and HTTP response. HTTP headers Content-Language is used to define, which language speaker document is intended to. It doesn’t define the language of the document. In case this header is not specified, it is assumed that the document is intended for all language speakers.
Syntax:
When only one language is specifiedContent-Language: <language-tag>

Content-Language: <language-tag>

When multiple languages are specifiedContent-Language: <language-tag>, <language-tag>, <language-tag>

Content-Language: <language-tag>, <language-tag>, <language-tag>

Directive:
language-tag: It is the case-insensitive directive which defines the language. Generally, it consists of two parts. First part defines the primary language which defines a broad family of related languages (e.g., “en” = English) and the optional second part which is separated by “-” and used to narrow the language range.
Example:
It says that English speakers are the intended audience of the page.Content-Language: en
Content-Language: en
It says that German and English speakers are the intended audience of the page.Content-Language: de, en
Content-Language: de, en
To check the Content-language in action go to Inspect Element -> Network check the request header for content-language like below.
Supported Browsers: The browsers compatible with HTTP headers Content-language are listed below:
Google Chrome
Internet Explorer
Firefox
Safari
Opera
HTTP-headers
Picked
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Top 10 Front End Developer Skills That You Need in 2022
How to fetch data from an API in ReactJS ?
Difference between var, let and const keywords in JavaScript
Convert a string to an integer in JavaScript
Differences between Functional Components and Class Components in React
How to set the default value for an HTML <select> element ?
How to create footer to stay at the bottom of a Web page?
Node.js fs.readFileSync() Method
File uploading in React.js
How to set input type date in dd-mm-yyyy format using HTML ?
Need help selecting non-empty column values from MySQL?

Select non-empty column values using NOT IS NULL and TRIM() function. The syntax is as follows.
SELECT * FROM yourTableName WHERE yourColumnName IS NOT NULL AND TRIM(yourColumnName) <> ' ';
You can select non-empty value as well as whitespace from column using the same TRIM() function.
To understand the syntax we discussed above, let us create a table. The query to create a table is as follows −
mysql> create table SelectNonEmptyValues
   -> (
   -> Id int not null auto_increment,
   -> Name varchar(30),
   -> PRIMARY KEY(Id)
   -> );
Query OK, 0 rows affected (0.62 sec)
Insert records in the table using insert command. The query is as follows −
mysql> insert into SelectNonEmptyValues(Name) values('John Smith');
Query OK, 1 row affected (0.20 sec)

mysql> insert into SelectNonEmptyValues(Name) values(NULL);
Query OK, 1 row affected (0.13 sec)

mysql> insert into SelectNonEmptyValues(Name) values('');
Query OK, 1 row affected (0.24 sec)

mysql> insert into SelectNonEmptyValues(Name) values('Carol Taylor');
Query OK, 1 row affected (0.13 sec)

mysql> insert into SelectNonEmptyValues(Name) values('DavidMiller');
Query OK, 1 row affected (0.28 sec)

mysql> insert into SelectNonEmptyValues(Name) values(' ');
Query OK, 1 row affected (0.18 sec)
Display all records from the table using select statement −
mysql> select *from SelectNonEmptyValues;
The following is the output −
+----+-----------------------+
| Id | Name                  |
+----+-----------------------+
|  1 | John Smith            |
|  2 | NULL                  |
|  3 |                       |
|  4 | Carol Taylor          |
|  5 | DavidMiller           |
|  6 |                       |
+----+-----------------------+
6 rows in set (0.00 sec)
Here is the query to select non-empty values. The below query works for all cases − if the column has NULL, empty string or whitespaces −
mysql> SELECT * FROM SelectNonEmptyValues WHERE Name IS NOT NULL AND TRIM(Name) <> '';
The following is the output −
+----+--------------+
| Id | Name         |
+----+--------------+
|  1 | John Smith   |
|  4 | Carol Taylor |
|  5 | DavidMiller  |
+----+--------------+
3 rows in set (0.00 sec)
Remove Leading Zeros from a String in C#

Let’s say the following is our string with leading zeros.
String str ="000234";
Use the TrimStart() method and set the 0 to remove it.
TrimStart(new Char[] { '0' } )
The following is the complete code to remove leading zeros.
 Live Demo
using System;
class Program {
   static void Main() {

      String str ="000234".TrimStart(new Char[] { '0' } );
      Console.WriteLine(str);
   }
}
234
PHP mysqli_connect_error() Function

During the attempt to connect to a MySQL server, if an occurs, the mysqli_connect_error() function returns the description of the error occurred (during the last connect call).
mysqli_connect_error()

This method doesn't accept any parameters.
PHP mysqli_connect_error() function returns an string value representing the description of the error from the last connection call, incase of a failure. If the connection was successful this function returns Null.
This function was first introduced in PHP Version 5 and works works in all the later versions.
Following example demonstrates the usage of the mysqli_connect_error() function (in procedural style) −
<?php
   //Creating a connection
   $con = @mysqli_connect("localhost", "root", "wrong_password", "mydb");

   //Connection Error
   $error = mysqli_connect_error($con);
   print("Error: ".$error);
?>
This will produce following result −
Error: Access denied for user 'root'@'localhost' (using password: YES)

In object oriented style the syntax of this function is $con -> connect_error. Following is the example of this function in object oriented style −
<?php
   //Creating a connection
   $con = @new mysqli("localhost", "root", "wrong_password", "mydb");

   //Connection Error
   $error = $con->connect_error;
   print("Error: ".$error);
?>
This will produce following result −
Error: Access denied for user 'root'@'localhost' (using password: YES)

Following example demonstrates the behaviour of the mysqli_connect_error() function incase of a successful connection −
<?php
   //Creating a connection
   $con = @mysqli_connect("localhost", "root", "password", "mydb");
   
   //Connection Error
   $error = mysqli_connect_error();
   if(!$con){
      print("Connection Failed: ".$error);
   }else{
      print("Connection Established Successfully");
   }
?>
This will produce following result −
Connection Established Successfully

<?php
   $connection = @mysqli_connect("localhost","root","wrong_pass","wrong_db");
   
   if (!$connection){
      die("Connection error: " . mysqli_connect_error());
   }
?>
This will produce following result −
Connection error: Access denied for user 'root'@'localhost' (using password: YES)