code-rag-bench/online-tutorials huggingface dataset:
Fabric.js Image Width Property - GeeksforGeeks

25 Jan, 2021
Fabric.js is a JavaScript library that is used to work with canvas. The canvas image is one of the class of fabric.js that is used to create image instances. The canvas image means the Image is movable and can be stretched according to requirement. The width property of the image is used to set the width of the image.
Approach: First import the fabric.js library. After importing the library, create a canvas block in the body tag which will contain the image. After this, initialize an instance of Canvas and image class provided by Fabric.JS and use the width property to set the height of the canvas image. After this render the image on the canvas.
Syntax:
fabric.Image(image, {
    width: Number
});
Parameters: This function takes a single parameter as mentioned above and described below:
Width: This parameter takes a number to set the width of the canvas image.
Example: This example uses FabricJS to set the width of the canvas image as shown in the below example:
HTML
<!DOCTYPE html> <html>   <head>     <!-- Adding the FabricJS library -->    <script src= "https://cdnjs.cloudflare.com/ajax/libs/fabric.js/3.6.2/fabric.min.js">     </script> </head>   <body>     <h1 style="color: green;">         GeeksforGeeks     </h1>       <b>         Fabric.js | Image visible Property     </b>           <canvas id="canvas" width="400" height="300"        style="border:2px solid #000000">     </canvas>       <img src= "https://media.geeksforgeeks.org/wp-content/uploads/20200327230544/g4gicon.png"        width="100" height="100" id="my-image"        style="display: none;">     <br>       <button onclick="wid()">Clickme</button>       <script>           // Creating the instance of canvas object         var canvas = new fabric.Canvas("canvas");           // Getting the image         var img = document.getElementById('my-image');           // Creating the image instance         var imgInstance = new fabric.Image(img, {         });           function wid() {             imgInstance = new fabric.Image(img, {                  width: 250            });             canvas.clear();               // Rendering the image to canvas             canvas.add(imgInstance);               canvas.centerObject(imgInstance);         }         canvas.add(imgInstance);         canvas.centerObject(imgInstance);     </script> </body>   </html>
Output:
Before clicking the Button:
After Clicking the Button:
Fabric.js
JavaScript
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Difference between var, let and const keywords in JavaScript
Difference Between PUT and PATCH Request
How to get character array from string in JavaScript?
Remove elements from a JavaScript Array
How to get selected value in dropdown list using JavaScript ?
Top 10 Front End Developer Skills That You Need in 2022
Installation of Node.js on Linux
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?
maximize_window driver method – Selenium Python

15 May, 2020
Selenium’s Python Module is built to perform automated testing with Python. Selenium Python bindings provides a simple API to write functional/acceptance tests using Selenium WebDriver. To open a webpage using Selenium Python, checkout – Navigating links using get method – Selenium Python. Just being able to go to places isn’t terribly useful. What we’d really like to do is to interact with the pages, or, more specifically, the HTML elements within a page. There are multiple strategies to find an element using Selenium, checkout – Locating Strategies. Selenium WebDriver offers various useful methods to control the session, or in other words, browser. For example, adding a cookie, pressing back button, navigating among tabs, etc.
This article revolves around maximize_window driver method in Selenium. maximize_window method maximizes the current window that webdriver is using.
Syntax –
driver.maximize_window()
Example –Now one can use maximize_window method as a driver method as below –
diver.get("https://www.geeksforgeeks.org/")
driver.maximize_window()

To demonstrate, maximize_window method of WebDriver in Selenium Python. Let’ s visit https://www.geeksforgeeks.org/ and operate on driver object. Let’s maximize window,
Program –
# import webdriverfrom selenium import webdriver  # create webdriver objectdriver = webdriver.Firefox()  # get geeksforgeeks.orgdriver.get("https://www.geeksforgeeks.org/")    # maximize window positiondriver.maximize_window()
Output –Screenshot added –
Python-selenium
selenium
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
Check if element exists in list in Python
Python | os.path.join() method
How To Convert Python Dictionary To JSON?
Python | Get unique values from a list
Defaultdict in Python
How to convert special characters to HTML in Javascript?

27 Sep, 2019
In HTML there are many cases in which the browser gets confused while rendering the page. In HTML the less-than sign ( < ) means the opening of some tag and if we place an element an after it like ‘a’ or ‘h’ then browser identifies them as an anchor and heading tab respectively. Similar is the case with some special character including less than, at the rate (@), front and backslash, etc.
Example of Problem: This example is an illustration of the problem caused when the HTML text is not converted to the special format.
<html>    <head>    </head>    <body>        <div>        If b<a and a<h then b<h. <!-- the browser understands it as anchor tag-->        </div>    </body></html>
The part b<a is problematic. The browser understands it as anchor tags. Similar is the case with b<hOutput:
If b
Solution 1: One way to solve it is to manually by putting special symbols in the pace of the respective special character which is problematic. But for very heavy websites it is very difficult to draw all the characters and then render it in HTML.
<html>  <head></head>  <body>    <div>        If b        < a and ab < h then b < h.       <!-- the browser understands it as less than-->    </div></body>  </html>
Output:
If b < a and ab < h then b < h.
JavaScript based Solution One another way is to convert each special character to its respective HTML code using javascript. Within the script we will replace all the special charters with the help of a regular expression which is “&#” + ASCII value of character + “;”. We apply the same rule with all the text on the page.
<html>  <head>    <script>        function Encode(string) {            var i = string.length,                a = [];              while (i--) {                var iC = string[i].charCodeAt();                if (iC < 65 || iC > 127 || (iC > 90 && iC < 97)) {                    a[i] = '&#' + iC + ';';                } else {                    a[i] = string[i];                }            }            return a.join('');        }    </script></head>  <body>    <script>        document.write(Encode("If b<a and a<h then b<h"));    </script></body>  </html>
Output:
If b<a and a<h then b<h
Picked
JavaScript
Web Technologies
Web technologies Questions
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Difference between var, let and const keywords in JavaScript
Differences between Functional Components and Class Components in React
Remove elements from a JavaScript Array
Roadmap to Learn JavaScript For Beginners
Difference Between PUT and PATCH Request
Installation of Node.js on Linux
Top 10 Projects For Beginners To Practice HTML and CSS Skills
Difference between var, let and const keywords in JavaScript
How to insert spaces/tabs in text using HTML/CSS?
How to fetch data from an API in ReactJS ?
Basics of File Handling in C

Here we will see some basic file handling operations in C. The operations are listed below:
Writing into a File
Reading from File
Appending in a File
See the code to get the idea how we write into a file
#include <stdio.h>
int main() {
   FILE *fp;
   char *filename = "sample.txt";
   char *content = "Hey there! You've successfully created a file with content in c programming language.";
   /* open for writing */
   fp = fopen(filename, "w");
   if( fp == NULL ) {
      printf("%s: failed to open. \n", filename);
      return -1;
   } else {
      printf("%s: opened in write mode.\n", filename);
   }
   /* Write content to file */
   fprintf(fp, "%s\n", content);
   if( !fclose(fp) )
      printf("%s: closed successfully.\n", filename);
   return 0;
}
sample.txt: opened in write mode.
sample.txt: closed successfully.
Se the code to get the idea how we read from a file
Make a file (file_read.txt):
You have opened a file using C programming language, in read-only mode.
#include <stdio.h>
int main() {
   FILE *fp;
   char *filename = "file_read.txt";
   char ch;
   /* open for writing */
   fp = fopen(filename, "r");
   if (fp == NULL) {
      printf("%s does not exists \n", filename);
      return;
   } else {
      printf("%s: opened in read mode.\n\n", filename);
   }
   while ((ch = fgetc(fp) )!= EOF) {
      printf ("%c", ch);
   }
   if (!fclose(fp))
      printf("\n%s: closed.\n", filename);
   return 0;
}
file_read.txt: opened in read mode.
You have opened a file using C programming language, in read-only mode.
file_read.txt: closed.
Se the code to get the idea how we can append lines into a file.
This text was already there in the file.
#include <stdio.h>
int main() {
   FILE *fp;
   char ch;
   char *filename = "file_append.txt";
   char *content = "This text is appeneded later to the file, using C programming.";
   /* open for writing */
   fp = fopen(filename, "r");
   printf("\nContents of %s -\n\n", filename);
   while ((ch = fgetc(fp) )!= EOF) {
      printf ("%c", ch);
   }
   fclose(fp);
   fp = fopen(filename, "a");
   /* Write content to file */
   fprintf(fp, "%s\n", content);
   fclose(fp);
   fp = fopen(filename, "r");
   printf("\nContents of %s -\n", filename);
   while ((ch = fgetc(fp) )!= EOF) {
      printf ("%c", ch);
   }
   fclose(fp);
   return 0;
}
Contents of file_append.txt -
This text was already there in the file.
Appending content to file_append.txt...
Content of file_append.txt after 'append' operation is -
This text was already there in the file.
This text is appeneded later to the file, using C programming.
How to clear cache memory using JavaScript? - GeeksforGeeks

27 Mar, 2020
Unlike mobile applications, a web browser doesn’t allow to clear its cache memory. Though we cannot clear all cache of the client browser it is still possible to load the webpage without caching by using meta tags in the HTML code.
The only way to do this is by making few changes in the code which says the browser not remember the recently loaded memory which is nothing but the chache memory.
The following are two examples that explainNOTE: The following codes cannot be run as it is and does not have an output. It has to added to an already existing code to see the Outputs.
Method 1:
<meta http-equiv='cache-control' content='no-cache'><meta http-equiv='expires' content='0'><meta http-equiv='pragma' content='no-cache'>
Add this part of HTML code which makes the browser to not record the cache memory.
Method 2:Appending a parameter to the filename in the script tag. Change it when the file changes.
Example:Let this be the name of the file. Every time you load this page just change the version of the script.
<script src = "filename.js?version = 1.0"></script>
The next time you load this page it should be something like this.
<script src = "newfile.js?version = 1.1"></script>
NOTE:
A browser is designed in such a way that it saves all the temporary cache.
It is so because cache memory is the main reason for the website to load faster.
Hence there is no direct way to permanently delete it’s cache memory unless certain codings are changed in your HTML code.
There may be few other ways to achieve this, but these two are the easiest and most effective one.
JavaScript-Misc
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
Convert a string to an integer in JavaScript
Difference between var, let and const keywords in JavaScript
Differences between Functional Components and Class Components in React
How to append HTML code to a div using JavaScript ?
Remove elements from a JavaScript Array
Installation of Node.js on Linux
Convert a string to an integer in JavaScript
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?
SELECT Statement and its Clauses in DBMS

The select statement is used to get the required data from the database according to the conditions, if any. This data is returned in the form of a table.
The basic syntax of the select statement is −
Select column 1, column 2 ... column N
From table_name
An example of the select statement is −
<Student>
Query −
Select Student_Name
From Student
This query yields the following result −
The example of select statement given above is quite simple and not that useful in practice. So, there are many other clauses associated with select statement that make it more meaningful. Some of these are −
The where clause is used to filter out data i.e it returns information that satisfies a certain condition. For example −
Select Student_Name
From Student
Where Student_Marks >50
This query will return the following result:
This is mostly used with aggregate functions to group the result set according to the value of a column. For example −
Select Count (Student_Number), Student_MajorSubject
From Student
Group by Student_MajorSubject
This query will return the following result −
This is used along with Group By clause because Where clause could not be used by aggregate functions. For Example − 
Select Count(Student_number), Student_MajorSubject
From Student
Group by Student_MajorSubject
Having Count(Student_Number) > 2
This query will return the following result −
The order by keyword is used to sort the results in ascending or descending order. By default, the order is assumed to be ascending. For Example −
Select Student_Name
From Student
Where Student_Marks>50
Order by Student_Marks
This query will return the following result −
wxPython - SetFont() function in wx.MenuItem - GeeksforGeeks

09 Jun, 2020
In this article we are going to learn about SetFont() function associated with wx.MenuItem class of wxPython. SetFont() function is used to set the font associated with the menu item.It takes font as parameter which is wx.Font object.
Syntax:
wx.MenuItem.SetFont(self, font)

Parameters:
Code Example:
import wx    class Example(wx.Frame):      def __init__(self, *args, **kwargs):        super(Example, self).__init__(*args, **kwargs)          self.InitUI()      def InitUI(self):        # CREATE FONT         fnt = wx.Font(pointSize = 8, family = wx.FONTFAMILY_MODERN, style = wx.FONTSTYLE_ITALIC, weight = wx.FONTWEIGHT_BOLD)        self.locale = wx.Locale(wx.LANGUAGE_ENGLISH)        self.menubar = wx.MenuBar()        self.fileMenu = wx.Menu()        self.item = wx.MenuItem(self.fileMenu, 1, '&Radio', helpString ="Check Help", kind = wx.ITEM_CHECK)        # SET FONT FOR MENU ITEM self.item        self.item.SetFont(fnt)        self.item.Enable(False)        self.fileMenu.Append(self.item)        self.menubar.Append(self.fileMenu, '&File')        self.SetMenuBar(self.menubar)        self.SetSize((350, 250))        self.SetTitle('Icons and shortcuts')        self.Centre()  def main():    app = wx.App()    ex = Example(None)    ex.Show()    app.MainLoop()    if __name__ == '__main__':    main()
Output:
Python-gui
Python-wxPython
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
How To Convert Python Dictionary To JSON?
Check if element exists in list in Python
How to drop one or multiple columns in Pandas Dataframe
Python Classes and Objects
Python | os.path.join() method
Create a directory in Python
Defaultdict in Python
Python | Get unique values from a list
Python | Pandas dataframe.groupby()
Python heapq to find K'th smallest element in a 2D array - GeeksforGeeks

26 Dec, 2017
Given an n x n matrix and integer k. Find the k’th smallest element in the given 2D array.
Examples:
Input : mat = [[10, 25, 20, 40],
               [15, 45, 35, 30],
               [24, 29, 37, 48],
               [32, 33, 39, 50]]
        k =  7 
Output : 7th smallest element is 30

We will use similar approach like K’th Smallest/Largest Element in Unsorted Array to solve this problem.
Create an empty min heap using heapq in python.Now assign first row (list) in result variable and convert result list into min heap using heapify method.Now traverse remaining row elements and push them into created min heap.Now get k’th smallest element using nsmallest(k, iterable) method of heapq module.
Create an empty min heap using heapq in python.
Now assign first row (list) in result variable and convert result list into min heap using heapify method.
Now traverse remaining row elements and push them into created min heap.
Now get k’th smallest element using nsmallest(k, iterable) method of heapq module.
# Function to find K'th smallest element in # a 2D array in Pythonimport heapq  def kthSmallest(input):      # assign first row to result variable    # and convert it into min heap    result = input[0]     heapq.heapify(result)      # now traverse remaining rows and push    # elements in min heap    for row in input[1:]:         for ele in row:              heapq.heappush(result,ele)      # get list of first k smallest element because    # nsmallest(k,list) method returns first k     # smallest element now print last element of     # that list    kSmallest = heapq.nsmallest(k,result)    print (k,"th smallest element is ",kSmallest[-1])  # Driver programif __name__ == "__main__":    input = [[10, 25, 20, 40],           [15, 45, 35, 30],           [24, 29, 37, 48],           [32, 33, 39, 50]]    k = 7    kthSmallest(input)
Output:
7th smallest element is 30

Order-Statistics
Heap
Matrix
Python
Matrix
Heap
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Insertion and Deletion in Heaps
Priority Queue in Python
Priority Queue using Binary Heap
Difference between Min Heap and Max Heap
Min Heap in Python
Matrix Chain Multiplication | DP-8
Program to find largest element in an array
Print a given matrix in spiral form
Divide and Conquer | Set 5 (Strassen's Matrix Multiplication)
Sudoku | Backtracking-7
Java Program to create a HashMap and add key-value pairs

To create a HashMap, use the HashMap class −
HashMap hm = new HashMap();
Add elements to the HashMap in the form of key-value pair −
hm.put("Bag", new Integer(1100));
hm.put("Wallet", new Integer(700));
hm.put("Belt", new Integer(600));
The following is an example to create HashMap and add key-value pair −
 Live Demo
import java.util.*;
public class Demo {
   public static void main(String args[]) {
      // Create a hash map
      HashMap hm = new HashMap();
      // Put elements to the map
      hm.put("Bag", new Integer(1100));
      hm.put("Wallet", new Integer(700));
      hm.put("Belt", new Integer(600));
      // Get a set of the entries
      Set set = hm.entrySet();
      // Get an iterator
      Iterator i = set.iterator();
      // Display elements
      while(i.hasNext()) {
         Map.Entry me = (Map.Entry)i.next();
         System.out.print(me.getKey() + ": ");
         System.out.println(me.getValue());
      }
      System.out.println();
   }
}
Belt: 600
Wallet: 700
Bag: 1100
jQuery - Multiple Elements Selector

This Multiple Elements selector selects the combined results of all the specified selectors E, F or G.
You can specify any number of selectors to combine into a single result. Here order of the DOM elements in the jQuery object aren't necessarily identical.
Here is the simple syntax to use this selector −
$('E, F, G,....')

Here is the description of all the parameters used by this selector −
E − Any valid selector
E − Any valid selector
F − Any valid selector
F − Any valid selector
G − Any valid selector
G − Any valid selector
....
....
Like any other jQuery selector, this selector also returns an array filled with the found elements.
$('div, p') − selects all the elements matched by div or p.
$('div, p') − selects all the elements matched by div or p.
$('p strong, .myclass') − selects all elements matched by strong that are descendants of an element matched by p as well as all elements that have a class of myclass.
$('p strong, .myclass') − selects all elements matched by strong that are descendants of an element matched by p as well as all elements that have a class of myclass.
$('p strong, #myid') − selects a single elements matched by strong that is descendant of an element matched by p as well as element whose id is myid.
$('p strong, #myid') − selects a single elements matched by strong that is descendant of an element matched by p as well as element whose id is myid.
Following example would select elements with class ID big and element with ID div3 and will apply yellow color to its background −
<html>
   <head>
      <title>The Selecter Example</title>
      <script type = "text/javascript" 
         src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js">
      </script>
   
      <script type = "text/javascript" language = "javascript">
         $(document).ready(function() {
            $(".big, #div3").css("background-color", "yellow");
         });
      </script>
   </head>
	
   <body>
      <div class = "big" id = "div1">
         <p>This is first division of the DOM.</p>
      </div>

      <div class = "medium" id = "div2">
         <p>This is second division of the DOM.</p>
      </div>

      <div class = "small" id = "div3">
         <p>This is third division of the DOM</p>
      </div>
   </body>
</html>
This will produce following result −
This is first division of the DOM.
This is second division of the DOM.
This is third division of the DOM

    27 Lectures 
     1 hours 

 Mahesh Kumar

    27 Lectures 
     1.5 hours 

 Pratik Singh

    72 Lectures 
     4.5 hours 

 Frahaan Hussain

    60 Lectures 
     9 hours 

 Eduonix Learning Solutions

    17 Lectures 
     2 hours 

 Sandip Bhattacharya

    12 Lectures 
     53 mins

 Laurence Svekis
 Print
 Add Notes
 Bookmark this page
C/C++ Program to check whether it is possible to make a divisible by 3 number using all digits in an array - GeeksforGeeks

05 Dec, 2018
Given an array of integers, the task is to find whether it is possible to construct an integer using all the digits of these numbers such that it would be divisible by 3. If it is possible then print “Yes” and if not print “No”.
Examples:
Input : arr[] = {40, 50, 90}
Output : Yes
We can construct a number which is
divisible by 3, for example 945000. 
So the answer is Yes. 

Input : arr[] = {1, 4}
Output : No
The only possible numbers are 14 and 41,
but both of them are not divisible by 3, 
so the answer is No.

// C++ program to find if it is possible// to make a number divisible by 3 using// all digits of given array#include <bits/stdc++.h>using namespace std;  bool isPossibleToMakeDivisible(int arr[], int n){    // Find remainder of sum when divided by 3    int remainder = 0;    for (int i = 0; i < n; i++)        remainder = (remainder + arr[i]) % 3;      // Return true if remainder is 0.    return (remainder == 0);}  // Driver codeint main(){    int arr[] = { 40, 50, 90 };    int n = sizeof(arr) / sizeof(arr[0]);    if (isPossibleToMakeDivisible(arr, n))        printf("Yes\n");    else        printf("No\n");      return 0;}
Yes

Time Complexity: O(n)
Please refer complete article on Possible to make a divisible by 3 number using all digits in an array for more details!
C Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
C Program to read contents of Whole File
Producer Consumer Problem in C
C program to find the length of a string
Exit codes in C/C++ with Examples
Handling multiple clients on server with multithreading using Socket Programming in C/C++
Regular expressions in C
C / C++ Program for Dijkstra's shortest path algorithm | Greedy Algo-7
Create n-child process from same parent process using fork() in C
Conditional wait and signal in multi-threading
Lamport's logical clock
Collect.js reject() Method - GeeksforGeeks

30 Nov, 2020
The reject() method is used to filter the given collection of elements using the given callback function. If the callback function returns true, then the element is removed from the resulting collection, otherwise, it is not removed.
Syntax:
collect(array).reject(callback)
Parameters: The collect() method takes one argument that is converted into the collection and then reject() method is applied to it. The reject() method holds the callback as a parameter.
Return Value: This method returns the filtered elements from the collection.
Below example illustrate the reject() method in collect.js:
Example 1:
Javascript
const collect = require('collect.js');  let obj = ['Geeks', 'GFG', 'GeeksforGeeks'];  const collection = collect(obj);  const filtered = collection.reject(    element => element.length > 4);  console.log(filtered.all());
Output:
[ 'GFG' ]
Example 2:
Javascript
const collect = require('collect.js');  let obj = [    {        name: 'Rahul',        marks: 88    },    {        name: 'Aditya',        marks: 78    },    {        name: 'Abhishek',        marks: 87    }];  const collection = collect(obj);  const filtered = collection.reject(    element => element.name.length > 5);  console.log(filtered.all());
Output:
[ { name: 'Rahul', marks: 88 } ]
Collect.js
JavaScript
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Difference between var, let and const keywords in JavaScript
Difference Between PUT and PATCH Request
How to get character array from string in JavaScript?
Remove elements from a JavaScript Array
How to get selected value in dropdown list using JavaScript ?
Express.js express.Router() Function
How to set input type date in dd-mm-yyyy format using HTML ?
Installation of Node.js on Linux
How to create footer to stay at the bottom of a Web page?
How to float three div side by side using CSS?
Python program to count positive and negative numbers in a list

In this article, we will learn about the solution and approach to solve the given problem statement.
Given a list iterable we need to count all the positive and negative numbers available in the iterable.
Her we will be discussing two approaches −
Brute-force approach
Using lambda inline function
 Live Demo
list1 = [1,-9,15,-16,13]
pos_count, neg_count = 0, 0
for num in list1:
   if num >= 0:
      pos_count += 1
   else:
      neg_count += 1
print("Positive numbers : ", pos_count)
print("Negative numbers : ", neg_count)
Positive numbers : 3
Negative numbers : 2
 Live Demo
list1 = [1,-9,15,-16,13]
neg_count = len(list(filter(lambda x: (x < 0), list1)))
pos_count = len(list(filter(lambda x: (x >= 0), list1)))
print("Positive numbers : ", pos_count)
print("Negative numbers : ", neg_count)
Positive numbers : 3
Negative numbers : 2
In this article, we learned about the approach to count positive & negative numbers in a list.
Matplotlib.markers module in Python - GeeksforGeeks

07 Oct, 2021
Matplotlib is an amazing visualization library in Python for 2D plots of arrays. Matplotlib is a multi-platform data visualization library built on NumPy arrays and designed to work with the broader SciPy stack. 
The matplotlib.dates module provides functions to handle markers in Matplotlib. It is used both by the marker functionality of the plot and scatter.Below is the table defining all possible markers in matplotlib:
 
 
Note: It is important to note that the two lines of code below are equivalent,  
# line 1
plt.plot([1, 2, 3], marker = 9)

# line 2
plt.plot([1, 2, 3], marker = matplotlib.markers.CARETRIGHTBASE)
Example 1:  
Python3
import numpy as npimport matplotlib.pyplot as pltfrom matplotlib.lines import Line2D  # Draw 5 points for each lineeach_point = np.ones(5) style = dict(color = 'tab:green',             linestyle = ':',             marker = 'D',             markersize = 15,             markerfacecoloralt = 'tab:red') figure, axes = plt.subplots() # Plot all filling styles.for y, fill_style in enumerate(Line2D.fillStyles):         axes.text(-0.5, y,              repr(fill_style),              horizontalalignment = 'center',              verticalalignment = 'center')         axes.plot(y * each_point, fillstyle = fill_style,              **style) axes.set_axis_off()axes.set_title('filling style') plt.show()
Output:  
Example 2:  
Python3
import numpy as npimport matplotlib.pyplot as pltfrom matplotlib.lines import Line2D  # Drawing 3 points for each lineplotted_points = np.ones(4)txt_style = dict(horizontalalignment = 'right',                 verticalalignment = 'center',                 fontsize = 12,                 fontdict = {'family': 'monospace'}) style = dict(linestyle = ':',             color ='0.5',             markersize = 10,             mfc ="C0",             mec ="C0")  # helper function for axes formattingdef format_ax(ax):         ax.margins(0.2)    ax.set_axis_off()    ax.invert_yaxis()  # helper function for splitting listdef split(a_list):         i_half = len(a_list) // 2    return (a_list[:i_half], a_list[i_half:]) figure, axes = plt.subplots(ncols = 2) for ax, markers in zip(axes, split(Line2D.filled_markers)):         for y, marker in enumerate(markers):                 ax.text(-0.5, y, repr(marker), **txt_style)        ax.plot(y * plotted_points, marker = marker,                **style)             format_ax(ax)     figure.suptitle('filled markers', fontsize = 14) plt.show()
Output:  
 
anikaseth98
Matplotlib markers-class
Python-matplotlib
Python
Write From Home
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Box Plot in Python using Matplotlib
Bar Plot in Matplotlib
Python | Get dictionary keys as a list
Python | Convert set into a list
Ways to filter Pandas DataFrame by column values
Convert string to integer in Python
Python infinity
How to set input type date in dd-mm-yyyy format using HTML ?
Matplotlib.pyplot.title() in Python
Factory method design pattern in Java
How to Count Number of Files and Subdirectories inside a Given Linux Directory?

It often becomes essential to know not just the count of files in my current directory but also the count of files from all the subdirectories inside the current directory. This can be found out using the
we can use ls to list the files, then choose only the ones that start with ‘-‘ symbol. The R option along with the l option does a recursive search. The ‘-c’ option counts the number of lines which is the number of files.
ls -lR . | egrep -c '^-'
Running the above code gives us the following result −
13
The find command helps us find the files with certain criteria by recursively traversing all the directories and there subdirectories. We use it with the type option to get only files by supplying the argument f. Here it also counts all the hidden files.
find . -type f | wc -l
Running the above code gives us the following result −
1505

We use the same approach as in the previous command, but use a regular expression pattern to avoid the . character by using the escape character \.
find . -not -path '*/\.*' -type f | wc -l
Running the above code gives us the following result −
13
Restoring a Docker Container

30 Sep, 2021
If you have a backup of your Docker Container stored as a Tar File in your local machine or pushed it on the Docker Hub account, you can restore that Tar File back into a Docker Image, create a Container and use it. In this article, we are going to discuss how to restore a Docker Image from a Tar File or pulling it from your private Docker Hub account.
You can follow these steps to restore a Docker Container:
If you have a Tar file of a Docker Image as a previous backup, you can load it using the following command. In this example, we have a Tar File called my-backup in the home directory which is the backup of an Ubuntu Image with a text file inside it.
sudo docker load -i ~/my-backup.tar
Tar File
Docker Load Command
After you have loaded the Tar File, you can verify if the Image has been added to your local repository using the following command.
sudo docker images
Verifying Image
Step 3 (Optional): Pull a backed up Image from Docker Registry
If you have a backed-up Image that you pushed it earlier into your private Docker Hub account, you can pull it back using the following command.
sudo docker pull my-backup:latest
To run the Container associated with the restored image, you can use the Docker Run command. Using the ls command, you will find the files intact inside the Docker Container.
sudo docker run -it my-backup:latest
ls
Running Container
reimarunger
Docker Container
linux
Advanced Computer Subject
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
getx() function in C

25 Jan, 2018
The header file graphics.h contains getx() function which returns the X coordinate of the current position.Syntax :
int getx();

Example :


Explanation : Initially, the X coordinate of the current position is 0. On moving the coordinates using moveto() function, the X coordinate changes to 80.
Below is the implementation of getx() function:
// C Implementation for getx()#include <graphics.h>#include <stdio.h>  // driver codeint main(){    // gm is Graphics mode which is    // a computer display mode that    // generates image using pixels.    // DETECT is a macro defined in    // "graphics.h" header file    int gd = DETECT, gm;    char arr[100];      // initgraph initializes the    // graphics system by loading a    // graphics driver from disk    initgraph(&gd, &gm, "");      // sprintf stands for “String print”.    // Instead of printing on console, it    // store output on char buffer which    // are specified in sprintf    sprintf(arr, "Current position of x = %d",                                      getx());      // outtext function displays text at    // current position.    outtext(arr);      // moveto function    moveto(80, 50);    sprintf(arr, "Current position of x = %d",                                      getx());      // outtext function displays text at    // current position.    outtext(arr);      getch();      // closegraph function closes the    // graphics mode and deallocates    // all memory allocated by    // graphics system .    closegraph();      return 0;}
Output :


c-graphics
computer-graphics
C Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Java program to check palindrome (using library methods)

28 Jun, 2021
Given a string, write a Java function to check if it is palindrome or not. A string is said to be palindrome if reverse of the string is same as string. For example, “abba” is palindrome, but “abbc” is not palindrome. The problem here is solved using string reverse function.
Examples:
Input : malayalam
Output : Yes

Input : GeeksforGeeks
Output : No


// Java program to illustrate checking of a string// if its palindrome or not using reverse functionclass Palindrome{  public static void checkPalindrome(String s)  {    // reverse the given String    String reverse = new StringBuffer(s).reverse().toString();      // check whether the string is palindrome or not    if (s.equals(reverse))      System.out.println("Yes");      else      System.out.println("No");  }    public static void main (String[] args)               throws java.lang.Exception  {    checkPalindrome("malayalam");    checkPalindrome("GeeksforGeeks");  }}
Output:
Yes
No

Related Article :C program to check whether a given string is palindrome or not
This article is contributed by Bhargav Sai Gajula. If you like GeeksforGeeks and would like to contribute, you can also write an article using write.geeksforgeeks.org or mail your article to review-team@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.
palindrome
Java
School Programming
Java
palindrome
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Specifying the increment in for-loops in Python

01 Oct, 2020
Let us see how to control the increment in for-loops in Python. We can do this by using the range() function.
range() allows the user to generate a series of numbers within a given range. Depending on how many arguments the user is passing to the function, the user can decide where that series of numbers will begin and end as well as how big the difference will be between one number and the next.
Syntax: range(start, stop, step)
Parameters:
start: integer starting from which the sequence of integers is to be returned
stop: integer before which the sequence of integers is to be returned
step: integer value which determines the increment between each integer in the sequence
Returns: a list
Example 1: Incrementing the iterator by 1.
Python3
for i in range(5):  print(i)
Output:
0
1
2
3
4

Example 2: Incrementing the iterator by an integer value n.
Python3
# increment valuen = 3  for i in range(0, 10, n):  print(i)
Output:
0
3
6
9

Example 3: Decrementing the iterator by an integer value -n.
Python3
# decrement valuen = -3  for i in range(10, 0, n):  print(i)
Output:
10
7
4
1

Example 4: Incrementing the iterator by exponential values of n. We will be using list comprehension.
Python3
# exponential valuen = 2  for i in ([n**x for x in range(5)]):  print(i)
Output:
1
2
4
8
16

python-basics
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
turtle.shape() function in Python

20 Jul, 2020
The turtle module provides turtle graphics primitives, in both object-oriented and procedure-oriented ways. Because it uses tkinter for the underlying graphics, it needs a version of Python installed with Tk support.
This function is used to set the turtle shape to shape with a given name or, if the name is not given, return the name of the current shape.
Syntax:
turtle.shape(name=None)

Shape with name must exist in the Turtle Screen’s shape dictionary. Initially, there are the following polygon shapes: “arrow”, “turtle”, “circle”, “square”, “triangle”, “classic”.  These images are shown below.
default : ‘classic’
‘arrow’
‘turtle’
‘circle’
‘square’
‘triangle’
Example:
Python3
# import packageimport turtle     # for default shapeturtle.forward(100)  # for circle shapeturtle.shape("circle")turtle.right(60)turtle.forward(100)  # for triangle shapeturtle.shape("triangle")turtle.right(60)turtle.forward(100)  # for square shapeturtle.shape("square")turtle.right(60)turtle.forward(100)  # for arrow shapeturtle.shape("arrow")turtle.right(60)turtle.forward(100)  # for turtle shapeturtle.shape("turtle")turtle.right(60)turtle.forward(100)
Output:
Python-turtle
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Create a Basic Project using MVT in Django ?

16 Aug, 2021
Prerequisite – Django Project MVT Structure 
Assuming you have gone through the previous article. This article focuses on creating a basic project to render a template using MVT architecture. We will use MVT (Models, Views, Templates) to render data to a local server. 
Create a basic Project: 
To initiate a project of Django on Your PC, open Terminal and Enter the following command 
django-admin startproject projectName
A New Folder with the name projectName will be created. To enter in the project using the terminal enter command 
cd projectName
Create a new file views.py inside the project folder where settings.py, urls.py and other files are stored and save the following code in it- 
Python3
# HttpResponse is used to# pass the information# back to viewfrom django.http import HttpResponse # Defining a function which# will receive request and# perform task depending# upon function definitiondef hello_geek (request) :     # This will return Hello Geeks    # string as HttpResponse    return HttpResponse("Hello Geeks")
Open urls.py inside project folder (projectName) and add your entry- Import hello_geek function from views.py file. 
Import hello_geek function from views.py file. 
from projectName.views import hello_geeks
Add an entry in url field inside url patterns- 
path('geek/', hello_geek), 

Now to run the server follow these steps- Open command prompt and change directory to env_site by this command- 
Open command prompt and change directory to env_site by this command- 
$ cd env_site
Go to Script directory inside env_site and activate virtual environment- 
$ cd Script
$ activate
Return to the env_site directory and goto the project directory- 
$ cd ..
$ cd geeks_site
Start the server- Start the server by typing following command in cmd- 
$ python manage.py runserver
Checking – Open the browser and type this url- 
http://127.0.0.1:8000/geek/
ddeevviissaavviittaa
Django-basics
Python Django
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Read JSON file using Python
Adding new column to existing DataFrame in Pandas
Python map() function
How to get column names in Pandas dataframe
Different ways to create Pandas Dataframe
Enumerate() in Python
Read a file line by line in Python
Python String | replace()
How to Install PIP on Windows ?
Iterate over a list in Python
Python | Pair iteration in list

22 Jan, 2019
List iteration is common in programming, but sometimes one requires to print the elements in consecutive pairs. This particular problem is quite common and having a solution to it always turns out to be handy. Let’s discuss certain ways in which this problem can be solved.
Method #1 : Using list comprehensionList comprehension can be used to print the pairs by accessing current and next element in the list and then printing the same. Care has to be taken while pairing the last element with the first one to form a cyclic pair.
# Python3 code to demonstrate # pair iteration in list # using list comprehensionfrom itertools import compress  # initializing list  test_list = [0, 1, 2, 3, 4, 5]  # printing original listprint ("The original list is : " + str(test_list))  # using list comprehension# to perform pair iteration in list res = [((i), (i + 1) % len(test_list))          for i in range(len(test_list))]  # printing resultprint ("The pair list is : " + str(res))
The original list is : [0, 1, 2, 3, 4, 5]
The pair list is : [(0, 1), (1, 2), (2, 3), (3, 4), (4, 5), (5, 0)]

 Method #2 : Using zip() + list slicing
zip function can be used to extract pairs over the list and slicing can be used to successively pair the current element with the next one for the efficient pairing.
# Python3 code to demonstrate # pair iteration in list # using zip() + list slicing from itertools import compress  # initializing list  test_list = [0, 1, 2, 3, 4, 5]  # printing original listprint ("The original list is : " + str(test_list))  # using zip() + list slicing # to perform pair iteration in list res = list(zip(test_list, test_list[1:] + test_list[:1]))  # printing resultprint ("The pair list is : " + str(res))
The original list is : [0, 1, 2, 3, 4, 5]
The pair list is : [(0, 1), (1, 2), (2, 3), (3, 4), (4, 5), (5, 0)]

Python list-programs
python-list
Python
Python Programs
python-list
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
Python String | replace()
Python program to convert a list to string
Defaultdict in Python
Python | Get dictionary keys as a list
Python | Convert a list to dictionary
Python Program for Fibonacci numbers
Keras - Locally connected layer

Locally connected layers are similar to Conv1D layer but the difference is Conv1D layer weights are shared but here weights are unshared. We can use different set of filters to apply different patch of input.
Locally connected layer has one arguments and it is as follows −
keras.layers.LocallyConnected1D(n)

A simple example to use Locally connected 1D layer is as follows −
>>> from keras.models import Sequential 
>>> from keras.layers import Activation, Dense,LocallyConnected1D 
>>> model = Sequential() 

# apply a unshared weight convolution 1-dimension of length 3 to a sequence with 
# 10 timesteps, with 16 output filters 

>>> model.add(LocallyConnected1D(16, 3, input_shape = (10, 8))) 

# add a new conv1d on top 
>>> model.add(LocallyConnected1D(8, 3))
The signature of the Locally connected 1D layer function and its arguments with default value is as follows −
keras.layers.LocallyConnected1D (
   filters, 
   kernel_size, 
   strides = 1, 
   padding = 'valid', 
   data_format = None, 
   activation = None, 
   use_bias = True, 
   kernel_initializer = 'glorot_uniform', 
   bias_initializer = 'zeros', 
   kernel_regularizer = None, 
   bias_regularizer = None, 
   activity_regularizer = None, 
   kernel_constraint = None, 
   bias_constraint = None
)
Here,
kernel_initializer refers initializer for the kernel weights matrix
kernel_initializer refers initializer for the kernel weights matrix
kernel_regularizer is used to apply regularize function to the kernel weights matrix.
kernel_regularizer is used to apply regularize function to the kernel weights matrix.
bias_regularizer is used to apply regularizer function to the bias vector.
bias_regularizer is used to apply regularizer function to the bias vector.
activity_regularizer is used to apply regularizer function to the output of the layer.
activity_regularizer is used to apply regularizer function to the output of the layer.
Similarly, we can use 2D and 3D layers as well.
It is used in Recurrent neural networks(RNN). It is defined as shown below −
keras.engine.base_layer.wrapped_fn()

It supports the following parameters −
cell refers an instance.
cell refers an instance.
return_sequences return the last output in the output sequence, or the full sequence.
return_sequences return the last output in the output sequence, or the full sequence.
return_state returns the last state in addition to the output.
return_state returns the last state in addition to the output.
go_backwards returns a boolean result. If the value is true, then process the input sequence backwards otherwise return the reversed sequence.
go_backwards returns a boolean result. If the value is true, then process the input sequence backwards otherwise return the reversed sequence.
stateful refers the state for each index.
stateful refers the state for each index.
unroll specifies whether the network to be unrolled or not.
unroll specifies whether the network to be unrolled or not.
input_dim refers the input dimension.
input_dim refers the input dimension.
input_length refers the length of input sequence.
input_length refers the length of input sequence.