title stringlengths 3 221 | text stringlengths 17 477k | parsed listlengths 0 3.17k |
|---|---|---|
Python | Display text to PyGame window | 09 Apr, 2022
Pygame is a cross-platform set of Python modules designed for writing video games. It includes computer graphics and sound libraries designed to be used with the Python programming language. Now, itβs up to the imagination or necessity of the developer, what type of game he/she wants to develop using this ... | [
{
"code": null,
"e": 54,
"s": 26,
"text": "\n09 Apr, 2022"
},
{
"code": null,
"e": 371,
"s": 54,
"text": "Pygame is a cross-platform set of Python modules designed for writing video games. It includes computer graphics and sound libraries designed to be used with the Python progr... |
Planar Graphs and their Properties | A graph 'G' is said to be planar if it can be drawn on a plane or a sphere so that no two edges cross each other at a non-vertex point.
Every planar graph divides the plane into connected areas called regions.
Degree of a bounded region r = deg(r) = Number of edges enclosing the regions r.
deg(1) = 3
deg(2) = 4
deg(3) ... | [
{
"code": null,
"e": 1323,
"s": 1187,
"text": "A graph 'G' is said to be planar if it can be drawn on a plane or a sphere so that no two edges cross each other at a non-vertex point."
},
{
"code": null,
"e": 1397,
"s": 1323,
"text": "Every planar graph divides the plane into conn... |
Program to convert polar co-ordinates to equivalent cartesian co-ordinates | 21 Dec, 2021
Given two integers r and ΞΈ (in degree) representing polar coordinates of a point (r, ΞΈ), the task is to find the Cartesian coordinates of the given point.
Examples:
Input: r = 1.4142, ΞΈ = 45Output: 1.000, 1.000
Input: r = 3, ΞΈ = 30Output: 2.598, 1.500
Approach: Let the cartesian coordinates of the point be... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n21 Dec, 2021"
},
{
"code": null,
"e": 183,
"s": 28,
"text": "Given two integers r and ΞΈ (in degree) representing polar coordinates of a point (r, ΞΈ), the task is to find the Cartesian coordinates of the given point."
},
{
"code"... |
Write a C program that wonβt compile in C++ | 22 Nov, 2021
Although C++ is designed to have backward compatibility with C, there can be many C programs that would produce compiler errors when compiled with a C++ compiler. Following is the list of the C programs that wonβt compile in C++:
Calling a function before the declarationUsing normal pointer with const vari... | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n22 Nov, 2021"
},
{
"code": null,
"e": 282,
"s": 52,
"text": "Although C++ is designed to have backward compatibility with C, there can be many C programs that would produce compiler errors when compiled with a C++ compiler. Following i... |
p5.js | translate() function | 16 Apr, 2019
The translate() function in p5.js is used to specify the amount to displace objects within the display window. The x parameter is used to specify the left/right translation and y parameter is used to specify up/down translation.
Syntax:
translate(x, y, [z])
or
translate(vector)
Parameters: This function ac... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n16 Apr, 2019"
},
{
"code": null,
"e": 257,
"s": 28,
"text": "The translate() function in p5.js is used to specify the amount to displace objects within the display window. The x parameter is used to specify the left/right translation an... |
Matlab | Erosion of an Image | 30 Nov, 2021
Morphology is known as the broad set of image processing operations that process images based on shapes. It is also known as a tool used for extracting image components that are useful in the representation and description of region shape.
The basic morphological operations are:
Erosion
Dilation
In this... | [
{
"code": null,
"e": 54,
"s": 26,
"text": "\n30 Nov, 2021"
},
{
"code": null,
"e": 295,
"s": 54,
"text": "Morphology is known as the broad set of image processing operations that process images based on shapes. It is also known as a tool used for extracting image components that ... |
Check if a line passes through the origin | 16 Jun, 2022
Given two coordinates of a line as (x1, y1) and (x2, y2), find if the line passing through these points also passes through origin or not.
Examples:
Input : (x1, y1) = (10, 0)
(x2, y2) = (20, 0)
Output : Yes
The line passing through these points
clearly passes through the origin as
the line is ... | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n16 Jun, 2022"
},
{
"code": null,
"e": 192,
"s": 52,
"text": "Given two coordinates of a line as (x1, y1) and (x2, y2), find if the line passing through these points also passes through origin or not. "
},
{
"code": null,
"e... |
Matching using regexp in GoLang | 14 Oct, 2020
Regexp is the short form of Regular expressions. People generally confuse regexp with regex, and thatβs obvious because other programming languages such as Python use the term regex for their regular expression library, but Go uses regexp and itβs important to remember it as regexp as it is the name of the... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n14 Oct, 2020"
},
{
"code": null,
"e": 406,
"s": 28,
"text": "Regexp is the short form of Regular expressions. People generally confuse regexp with regex, and thatβs obvious because other programming languages such as Python use the term... |
How to Find & Drop duplicate columns in a Pandas DataFrame? | 02 Jul, 2020
Letβs discuss How to Find & Drop duplicate columns in a Pandas DataFrame. First, Letβs create a simple dataframe with column names βNameβ, βAgeβ, βDomicileβ, and βMarksβ.
# Import pandas library import pandas as pd # List of Tuplesstudents = [ ('Ankit', 34, 'Uttar pradesh', 34), ('Ri... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n02 Jul, 2020"
},
{
"code": null,
"e": 199,
"s": 28,
"text": "Letβs discuss How to Find & Drop duplicate columns in a Pandas DataFrame. First, Letβs create a simple dataframe with column names βNameβ, βAgeβ, βDomicileβ, and βMarksβ."
}... |
How to set default button for JFrame in Java? | To set default button for JFrame, use the setDefaultButton() method β
JFrame frame = new JFrame();
frame.getRootPane().setDefaultButton(button);
The following is an example to set default button for JFrame β
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import ... | [
{
"code": null,
"e": 1132,
"s": 1062,
"text": "To set default button for JFrame, use the setDefaultButton() method β"
},
{
"code": null,
"e": 1207,
"s": 1132,
"text": "JFrame frame = new JFrame();\nframe.getRootPane().setDefaultButton(button);"
},
{
"code": null,
"e":... |
C++ Program to Find the Connected Components of an UnDirected Graph | Weakly or Strongly Connected for a given a undirected graph can be found out using DFS. This is a C++ program of this problem.
Begin
Function fillorder() = fill stack with all the vertices.
a) Mark the current node as visited and print it
b) Recur for all the vertices adjacent to this vertex
c) All vertices re... | [
{
"code": null,
"e": 1189,
"s": 1062,
"text": "Weakly or Strongly Connected for a given a undirected graph can be found out using DFS. This is a C++ program of this problem."
},
{
"code": null,
"e": 1575,
"s": 1189,
"text": "Begin\nFunction fillorder() = fill stack with all the v... |
Byte-compile Python libraries | Python is an interpreter based language. However it internally compiles the source code to byte code when a script (.py extension) is run and afterwards the bytecode version is automatically removed. When a module (apart from the precompiled built-in modules) is first imported, its compiled version is also automaticall... | [
{
"code": null,
"e": 1551,
"s": 1062,
"text": "Python is an interpreter based language. However it internally compiles the source code to byte code when a script (.py extension) is run and afterwards the bytecode version is automatically removed. When a module (apart from the precompiled built-in mo... |
How to Convert Two Arrays Containing Keys and Values to HashMap in Java? - GeeksforGeeks | 17 Dec, 2020
HashMap is part of the Collections framework of java. It stores the data in the form of key-value pairs. These values of the HashMap can be accessed by using their respective keys or the key-value pairs can be accessed using their indexes (of Integer type). HashMap is similar to Hashtable in java. The ma... | [
{
"code": null,
"e": 23948,
"s": 23920,
"text": "\n17 Dec, 2020"
},
{
"code": null,
"e": 24656,
"s": 23948,
"text": "HashMap is part of the Collections framework of java. It stores the data in the form of key-value pairs. These values of the HashMap can be accessed by using thei... |
Query By Example (QBE) - GeeksforGeeks | 09 Aug, 2021
If we talk about normal queries we fire on the database they should be correct and in a well-defined structure which means they should follow a proper syntax if the syntax or query is wrong definitely we will get an error and due to that our application or calculation definitely going to stop. So to overco... | [
{
"code": null,
"e": 25573,
"s": 25545,
"text": "\n09 Aug, 2021"
},
{
"code": null,
"e": 26001,
"s": 25573,
"text": "If we talk about normal queries we fire on the database they should be correct and in a well-defined structure which means they should follow a proper syntax if th... |
Minimum MEX from all subarrays of length K - GeeksforGeeks | 30 Sep, 2021
Given an array arr[] consisting of N distinct positive integers and an integer K, the task is to find the minimum MEX from all subarrays of length K.
The MEX is the smallest positive integer that is not present in the array.
Examples:
Input: arr[] = {1, 2, 3}, K = 2Output: 1Explanation:All subarrays of len... | [
{
"code": null,
"e": 26195,
"s": 26167,
"text": "\n30 Sep, 2021"
},
{
"code": null,
"e": 26345,
"s": 26195,
"text": "Given an array arr[] consisting of N distinct positive integers and an integer K, the task is to find the minimum MEX from all subarrays of length K."
},
{
... |
Breacher - Tool To Find Admin Login Pages And EAR Vulnerabilites - GeeksforGeeks | 18 Jul, 2021
Breacher is a free and open-source tool available on GitHub. Breacher is used as an information-gathering tool. This tool can be used to get information about our target(domain). We can target any domain using Breacher. The interactive console provides a number of helpful features, such as command comple... | [
{
"code": null,
"e": 25651,
"s": 25623,
"text": "\n18 Jul, 2021"
},
{
"code": null,
"e": 26088,
"s": 25651,
"text": "Breacher is a free and open-source tool available on GitHub. Breacher is used as an information-gathering tool. This tool can be used to get information about our... |
Iterative Postorder Traversal | Set 2 (Using One Stack) - GeeksforGeeks | 02 May, 2022
We have discussed a simple iterative postorder traversal using two stacks in the previous post. In this post, an approach with only one stack is discussed.
The idea is to move down to leftmost node using left pointer. While moving down, push root and rootβs right child to stack. Once we reach leftmost node... | [
{
"code": null,
"e": 37091,
"s": 37063,
"text": "\n02 May, 2022"
},
{
"code": null,
"e": 37247,
"s": 37091,
"text": "We have discussed a simple iterative postorder traversal using two stacks in the previous post. In this post, an approach with only one stack is discussed."
},
... |
Clock tick() Method in Java with Examples - GeeksforGeeks | 08 Jun, 2020
tick(Clock baseClock, Duration tickDuration) method of java.time.Clock is a static method of Clock class that returns a clock that returns instants from the base clock rounded to the nearest occurrence of the specified duration in the parameter. The specified base clock duration must be positive, neither n... | [
{
"code": null,
"e": 25499,
"s": 25471,
"text": "\n08 Jun, 2020"
},
{
"code": null,
"e": 26092,
"s": 25499,
"text": "tick(Clock baseClock, Duration tickDuration) method of java.time.Clock is a static method of Clock class that returns a clock that returns instants from the base c... |
GATE | GATE CS 2020 | Question 30 - GeeksforGeeks | 27 Sep, 2021
If there are m input lines n output lines for a decoder that is used to uniquely address a byte addressable 1 KB RAM, then the minimum value of m+n is ________ .
Note β This question was Numerical Type.(A) 18(B) 1034(C) 10(D) 1024Answer: (B)Explanation: According to Decoder:
We need 210 outputs to map 1 KB... | [
{
"code": null,
"e": 25743,
"s": 25715,
"text": "\n27 Sep, 2021"
},
{
"code": null,
"e": 25905,
"s": 25743,
"text": "If there are m input lines n output lines for a decoder that is used to uniquely address a byte addressable 1 KB RAM, then the minimum value of m+n is ________ ."
... |
Python delattr() Function - GeeksforGeeks | 03 Dec, 2021
Python delattr() Function is used to delete attributes from a class. It takes two arguments, the first one is the class object from which we want to delete, second is the name of the attribute which we want to delete.
Syntax
delattr (object, name)
Parameters
Parameter
Description
object
An object from wh... | [
{
"code": null,
"e": 25537,
"s": 25509,
"text": "\n03 Dec, 2021"
},
{
"code": null,
"e": 25755,
"s": 25537,
"text": "Python delattr() Function is used to delete attributes from a class. It takes two arguments, the first one is the class object from which we want to delete, second... |
Python - Avoid Spaces in string length - GeeksforGeeks | 05 Sep, 2020
Given a String, compute all the characters, except spaces.
Input : test_str = βgeeksforgeeks 33 bestβOutput : 19Explanation : Total characters are 19.
Input : test_str = βgeeksforgeeks bestβOutput : 17Explanation : Total characters are 17 except spaces.
Method #1 : Using isspace() + sum()
In this, we check... | [
{
"code": null,
"e": 26265,
"s": 26237,
"text": "\n05 Sep, 2020"
},
{
"code": null,
"e": 26324,
"s": 26265,
"text": "Given a String, compute all the characters, except spaces."
},
{
"code": null,
"e": 26416,
"s": 26324,
"text": "Input : test_str = βgeeksforgee... |
Product of all leaf nodes of binary tree - GeeksforGeeks | 27 May, 2021
Given a binary tree, find the product of all the leaf nodes.Examples:
Input :
1
/ \
2 3
/ \ / \
4 5 6 7
\
8
Output :
product = 4 * 5 * 8 * 7 = 1120
The idea is to traverse the tree in any fashion and check if the node is the leaf node or not. ... | [
{
"code": null,
"e": 26433,
"s": 26405,
"text": "\n27 May, 2021"
},
{
"code": null,
"e": 26505,
"s": 26433,
"text": "Given a binary tree, find the product of all the leaf nodes.Examples: "
},
{
"code": null,
"e": 26643,
"s": 26505,
"text": "Input : \n ... |
Flutter - Shimmer - GeeksforGeeks | 28 Oct, 2020
In Flutter, Shimmer is used to add beautiful animations while content is loading from the servers in an application. This makes the UI look more responsive and secures users from leaving a slow internet interaction. It can be used instead of conventional ProgressBar or usual loaders available in the Flutte... | [
{
"code": null,
"e": 25261,
"s": 25233,
"text": "\n28 Oct, 2020"
},
{
"code": null,
"e": 25581,
"s": 25261,
"text": "In Flutter, Shimmer is used to add beautiful animations while content is loading from the servers in an application. This makes the UI look more responsive and sec... |
Create Scatter Plot with smooth Line using Python - GeeksforGeeks | 15 Mar, 2021
A curve can be smoothened to reach a well approximated idea of the visualization. In this article, we will be plotting a scatter plot with the smooth line with the help of the SciPy library. To plot a smooth line scatter plot we use the following function:
scipy.interpolate.make_interp_spline() from the Sc... | [
{
"code": null,
"e": 24212,
"s": 24184,
"text": "\n15 Mar, 2021"
},
{
"code": null,
"e": 24469,
"s": 24212,
"text": "A curve can be smoothened to reach a well approximated idea of the visualization. In this article, we will be plotting a scatter plot with the smooth line with the... |
Offset Columns in Bootstrap | An offset is used to push columns over for more spacing. To use offsets on large displays, use the .col-md-offset-* classes.
You can try to run the following code to learn how to work with offset columns in Bootstrap β
Live Demo
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap Example</title>
<link href ... | [
{
"code": null,
"e": 1188,
"s": 1062,
"text": "An offset is used to push columns over for more spacing. To use offsets on large displays, use the .col-md-offset-* classes. "
},
{
"code": null,
"e": 1282,
"s": 1188,
"text": "You can try to run the following code to learn how to wo... |
Fast Fourier Transform. How to implement the Fast Fourier... | by Cory Maklin | Towards Data Science | If you have a background in electrical engineering, you will, in all probability, have heard of the Fourier Transform. In layman's terms, the Fourier Transform is a mathematical operation that changes the domain (x-axis) of a signal from time to frequency. The latter is particularly useful for decomposing a signal cons... | [
{
"code": null,
"e": 582,
"s": 172,
"text": "If you have a background in electrical engineering, you will, in all probability, have heard of the Fourier Transform. In layman's terms, the Fourier Transform is a mathematical operation that changes the domain (x-axis) of a signal from time to frequency... |
Difference between segments, packets and frames - GeeksforGeeks | 28 Mar, 2020
In this article, we learn whatβs the exact difference between the term which is often misused in Computer Networks and a lot of confusion prevails on the usage of these terms.
Before starting it is better to get acquainted with a term called Protocol Data Unit (PDU).The term PDU is used to refer to the pac... | [
{
"code": null,
"e": 24456,
"s": 24428,
"text": "\n28 Mar, 2020"
},
{
"code": null,
"e": 24632,
"s": 24456,
"text": "In this article, we learn whatβs the exact difference between the term which is often misused in Computer Networks and a lot of confusion prevails on the usage of ... |
C# - Logical Operators | Following table shows all the logical operators supported by C#. Assume variable A holds Boolean value true and variable B holds Boolean value false, then β
The following example demonstrates all the logical operators available in C# β
using System;
namespace OperatorsAppl {
class Program {
static void Main(s... | [
{
"code": null,
"e": 2427,
"s": 2270,
"text": "Following table shows all the logical operators supported by C#. Assume variable A holds Boolean value true and variable B holds Boolean value false, then β"
},
{
"code": null,
"e": 2506,
"s": 2427,
"text": "The following example dem... |
How to make Dropdown using Angular UI Bootstrap ? - GeeksforGeeks | 06 Jun, 2021
In this article, we will see how to make Dropdown using Angular UI bootstrap. Angular UI Bootstrap is an Angular JS framework created by Angular UI developers for providing better UI which can be used easily.
Syntax:
<div uib-dropdown></div>
Download AngularUI from the link:
https://angular-ui.github.io/bo... | [
{
"code": null,
"e": 25029,
"s": 25001,
"text": "\n06 Jun, 2021"
},
{
"code": null,
"e": 25238,
"s": 25029,
"text": "In this article, we will see how to make Dropdown using Angular UI bootstrap. Angular UI Bootstrap is an Angular JS framework created by Angular UI developers for ... |
Angular Material 7 - Stepper | The <mat-stepper>, an Angular Directive, is used to create a wizard like work-flow steps.
In this chapter, we will showcase the configuration required to draw a stepper control using Angular Material.
Follow the following steps to update the Angular application we created in Angular 6 - Project Setup chapter β
Followin... | [
{
"code": null,
"e": 2845,
"s": 2755,
"text": "The <mat-stepper>, an Angular Directive, is used to create a wizard like work-flow steps."
},
{
"code": null,
"e": 2956,
"s": 2845,
"text": "In this chapter, we will showcase the configuration required to draw a stepper control using... |
Building a Convolutional Neural Network (CNN) in Keras | by Eijaz Allibhai | Towards Data Science | Deep Learning is becoming a very popular subset of machine learning due to its high level of performance across many types of data. A great way to use deep learning to classify images is to build a convolutional neural network (CNN). The Keras library in Python makes it pretty simple to build a CNN.
Computers see image... | [
{
"code": null,
"e": 348,
"s": 47,
"text": "Deep Learning is becoming a very popular subset of machine learning due to its high level of performance across many types of data. A great way to use deep learning to classify images is to build a convolutional neural network (CNN). The Keras library in P... |
Keras 101: A simple (and interpretable) Neural Network model for House Pricing regression | by Rodrigo Bressan | Towards Data Science | TL;DR: Predict House Pricing using Boston dataset with Neural Networks and adopting SHAP values to explain our model. Full notebook can be found here.
In this post, we will be covering some basics of data exploration and building a model with Keras in order to help us on predicting the selling price of a given house in... | [
{
"code": null,
"e": 323,
"s": 172,
"text": "TL;DR: Predict House Pricing using Boston dataset with Neural Networks and adopting SHAP values to explain our model. Full notebook can be found here."
},
{
"code": null,
"e": 750,
"s": 323,
"text": "In this post, we will be covering s... |
OpenShift - CLI | OpenShift CLI is used for managing OpenShift applications from the command line. OpenShift CLI has the capability to manage end-to-end application life cycle. In general, we would be using OC which is an OpenShift client to communicate with OpenShift.
In order to set up the OC client on a different operating system, we... | [
{
"code": null,
"e": 2200,
"s": 1948,
"text": "OpenShift CLI is used for managing OpenShift applications from the command line. OpenShift CLI has the capability to manage end-to-end application life cycle. In general, we would be using OC which is an OpenShift client to communicate with OpenShift."
... |
How can I create a stacked line graph with matplotlib? | To create a stacked lines graph with Python, we can take the following Steps β
Create x, y, y1 and y2 points using numpy.
Create x, y, y1 and y2 points using numpy.
Plot the lines using numpy with the above data (Step 1) and labels mentioned.
Plot the lines using numpy with the above data (Step 1) and labels mentioned.... | [
{
"code": null,
"e": 1141,
"s": 1062,
"text": "To create a stacked lines graph with Python, we can take the following Steps β"
},
{
"code": null,
"e": 1184,
"s": 1141,
"text": "Create x, y, y1 and y2 points using numpy."
},
{
"code": null,
"e": 1227,
"s": 1184,
... |
Simple Text Generation. How to teach a machine to βspeakβ | by Jeremy Chow | Towards Data Science | If youβd like to see the entire code, here is the Github link.
In this article, Iβll briefly go over a simple way to code and train a text generation model in Python using Keras and Tensorflow. Our goal is to train a model to emulate the speaking style of the text it is trained on. In this case, our data set is 7009 se... | [
{
"code": null,
"e": 234,
"s": 171,
"text": "If youβd like to see the entire code, here is the Github link."
},
{
"code": null,
"e": 536,
"s": 234,
"text": "In this article, Iβll briefly go over a simple way to code and train a text generation model in Python using Keras and Tens... |
How to inject JavaScript in WebBrowser control? | To inject JavaScript in WebBrowser control, use the following steps β
Firstly, create a Windows Forms application in Visual Studio.
Now, drag a WebBrowser control to the form
Set the Url property.
Right-click the project, choose to Add reference... β COM β Type Libraries
Select "Microsoft HTML Object Library"
Ad... | [
{
"code": null,
"e": 1132,
"s": 1062,
"text": "To inject JavaScript in WebBrowser control, use the following steps β"
},
{
"code": null,
"e": 1195,
"s": 1132,
"text": " Firstly, create a Windows Forms application in Visual Studio."
},
{
"code": null,
"e": 1239,
"s... |
Program to check we can make arithmetic progression from sequence in Python | Suppose we have a list of numbers called nums. We have to check whether the elements present in nums are forming AP series or not. As we know in AP (Arithmetic Progression) series the common difference between any two consecutive elements is the same.
So, if the input is like nums = [9,1,17,5,13], then the output will ... | [
{
"code": null,
"e": 1314,
"s": 1062,
"text": "Suppose we have a list of numbers called nums. We have to check whether the elements present in nums are forming AP series or not. As we know in AP (Arithmetic Progression) series the common difference between any two consecutive elements is the same."
... |
Time Series Analysis and Forecasting for A&E Attendances and Emergency Admission in England | by Ahmed Qassim | Towards Data Science | This projectβs objective is to analyze and forecast real time series data. The reports and dataset were pulled out from the NHS England website that reports the number of Accident and Emergency Attendance and Emergency Admission to National health services and independent sector organizations in England.
Data period is... | [
{
"code": null,
"e": 478,
"s": 172,
"text": "This projectβs objective is to analyze and forecast real time series data. The reports and dataset were pulled out from the NHS England website that reports the number of Accident and Emergency Attendance and Emergency Admission to National health service... |
Select Features for Machine Learning Model with Mutual Information | by Andrew Zhu | Towards Data Science | Machine Learning models are amazing when trained with an appropriate set of training data. ML models described in the textbook and using datasets from Scikit-learn, sample datasets are already carefully curated and effective for targeting ML models.
The problem is, in real life, training data could be a mass and not fi... | [
{
"code": null,
"e": 422,
"s": 172,
"text": "Machine Learning models are amazing when trained with an appropriate set of training data. ML models described in the textbook and using datasets from Scikit-learn, sample datasets are already carefully curated and effective for targeting ML models."
},... |
Setting the focus to a specific Tkinter entry widget | Tkinter has many universal methods that add functionalities to widgets and elements. In order to set the focus to a particular widget, we have the focus_set() method which is used to focus a specific widget in a group of widgets present in an application.
In this example, we have created numeric keys in the range 0-9. ... | [
{
"code": null,
"e": 1318,
"s": 1062,
"text": "Tkinter has many universal methods that add functionalities to widgets and elements. In order to set the focus to a particular widget, we have the focus_set() method which is used to focus a specific widget in a group of widgets present in an applicatio... |
Java program to generate a calculator using the switch case | The following program accepts two integer variables, takes an operator regarding the operation. According to the selected operator, the program performs the respective operation and print the result.
import java.util.Scanner;
public class ab39_CalculatorUsingSwitch {
public static void main(String args[]) {
Sc... | [
{
"code": null,
"e": 1262,
"s": 1062,
"text": "The following program accepts two integer variables, takes an operator regarding the operation. According to the selected operator, the program performs the respective operation and print the result."
},
{
"code": null,
"e": 2262,
"s": 1... |
Program to check if two strings are same or not - GeeksforGeeks | 07 Aug, 2019
Given two strings, the task is to check if these two strings are identical(same) or not.
Examples:
Input: string1 = βGeeksforGeeksβ, string2 = βGeeksforGeeksβOutput: Yes
Input: string1 = βGeeks for Geeksβ, string2 = βGeeks for GeeksβOutput: Yes
Input: string1 = βGeeksforGeeksβ, string2 = βGeeksβOutput: No
... | [
{
"code": null,
"e": 23986,
"s": 23958,
"text": "\n07 Aug, 2019"
},
{
"code": null,
"e": 24075,
"s": 23986,
"text": "Given two strings, the task is to check if these two strings are identical(same) or not."
},
{
"code": null,
"e": 24085,
"s": 24075,
"text": "E... |
Erlang - register | This is used to register a process in the system.
register(atom,pid)
atom β This is the registered name to give to the process.
atom β This is the registered name to give to the process.
Pid β this is the process id which needs to be bound to the atom.
Pid β this is the process id which needs to be bound to the atom.
... | [
{
"code": null,
"e": 2351,
"s": 2301,
"text": "This is used to register a process in the system."
},
{
"code": null,
"e": 2371,
"s": 2351,
"text": "register(atom,pid)\n"
},
{
"code": null,
"e": 2430,
"s": 2371,
"text": "atom β This is the registered name to gi... |
An Underappreciated Workflow Tool for ML/AI: MLOps Airflow | by Shyam BV | Towards Data Science | Airflow is a workflow management tool that is often under-appreciated and used less in MLOps. I use airflow in various tasks to automate a lot of them from running an AI model at specific intervals, to retraining the model, batch processing, scraping websites, portfolio tracking, custom news feeds, etc. In this article... | [
{
"code": null,
"e": 556,
"s": 172,
"text": "Airflow is a workflow management tool that is often under-appreciated and used less in MLOps. I use airflow in various tasks to automate a lot of them from running an AI model at specific intervals, to retraining the model, batch processing, scraping webs... |
Program to Implement Queue in Python | When it is required to implement a queue using Python, a queue class is created, and methods to add and delete elements are defined. An instance of the class is created, and these methods are called using the instance and relevant output is displayed.
Below is a demonstration of the same β
Live Demo
class Queue_struct... | [
{
"code": null,
"e": 1314,
"s": 1062,
"text": "When it is required to implement a queue using Python, a queue class is created, and methods to add and delete elements are defined. An instance of the class is created, and these methods are called using the instance and relevant output is displayed."
... |
Can we create an object for the abstract class in java? | A method which does not have body is known as abstract method. It contains only method signature with a semi colon and, an abstract keyword before it.
public abstract myMethod();
To use an abstract method, you need to inherit it by extending its class and provide implementation to it.
A class which contains 0 or more a... | [
{
"code": null,
"e": 1213,
"s": 1062,
"text": "A method which does not have body is known as abstract method. It contains only method signature with a semi colon and, an abstract keyword before it."
},
{
"code": null,
"e": 1241,
"s": 1213,
"text": "public abstract myMethod();"
... |
Ray Tune: a Python library for fast hyperparameter tuning at any scale | by Richard Liaw | Towards Data Science | If youβve ever tried to tune hyperparameters for a machine learning model, you know that it can be a very painful process. Simple approaches quickly become time-consuming.
And now more than ever, you absolutely need cutting-edge hyperparameter tuning tools to keep up with the state-of-the-art.
Model advancements are be... | [
{
"code": null,
"e": 344,
"s": 172,
"text": "If youβve ever tried to tune hyperparameters for a machine learning model, you know that it can be a very painful process. Simple approaches quickly become time-consuming."
},
{
"code": null,
"e": 467,
"s": 344,
"text": "And now more t... |
mformat - Unix, Linux Command | The mformat command is used to add an MS-DOS filesystem to a
low-level formatted diskette. Its syntax is:
mformat [-t cylinders] [-h heads] [-n sectors]
[-f size] [-1] [-4] [-8]
[-v volume_label]
[-F] [-S sizecode] [-X]
[-2 sectors_on_track_0] [-3]
[-0 rate_on_track_0] [-A rate_on_other_tracks]
[-M softw... | [
{
"code": null,
"e": 10694,
"s": 10586,
"text": "\nThe mformat command is used to add an MS-DOS filesystem to a\nlow-level formatted diskette. Its syntax is:\n"
},
{
"code": null,
"e": 11083,
"s": 10696,
"text": "mformat [-t cylinders] [-h heads] [-n sectors]\n [-f size] [-1] [-... |
How to Build a Rock Paper Scissor Game in Android Studio? - GeeksforGeeks | 08 Feb, 2022
Rock Paper Scissor (which is also called Stone Paper Scissor) is a hand game and played between two people, in which each player simultaneously forms one of three shapes. The winner of the game is decided as per the below rules:
Rock vs Paper -> Paper wins.
Rock vs Scissor -> Rock wins.
Paper vs Scissor ->... | [
{
"code": null,
"e": 24725,
"s": 24697,
"text": "\n08 Feb, 2022"
},
{
"code": null,
"e": 24954,
"s": 24725,
"text": "Rock Paper Scissor (which is also called Stone Paper Scissor) is a hand game and played between two people, in which each player simultaneously forms one of three ... |
How to pull value from array of ObjectIDs in MongoDB? | To pull value from array of ObjectIDs, use $pull in MongoDB. Let us create a collection with documents β
> db.demo258.insertOne({"arrayOfObjectsId":[ ObjectId("5e47a5e81627c0c63e7dba92"),ObjectId("5e47a5e51627c0c63e7dba91")]});
{
"acknowledged" : true,
"insertedId" : ObjectId("5e47a8211627c0c63e7dba97")
}
Display... | [
{
"code": null,
"e": 1167,
"s": 1062,
"text": "To pull value from array of ObjectIDs, use $pull in MongoDB. Let us create a collection with documents β"
},
{
"code": null,
"e": 1375,
"s": 1167,
"text": "> db.demo258.insertOne({\"arrayOfObjectsId\":[ ObjectId(\"5e47a5e81627c0c63e7... |
HTML5 video full preload in JavaScript | Use the oncanplaythrough event to completely preload video. You can try to run the following code.
<!DOCTYPE html>
<html>
<body>
<video id="myVideo" width="400" height="200" controls oncanplaythrough="display()">
<source src="/html5/foo.ogg" type="video/ogg" />
<source src="/html5/foo.mp4" ty... | [
{
"code": null,
"e": 1161,
"s": 1062,
"text": "Use the oncanplaythrough event to completely preload video. You can try to run the following code."
},
{
"code": null,
"e": 1621,
"s": 1161,
"text": "<!DOCTYPE html>\n<html>\n <body>\n <video id=\"myVideo\" width=\"400\" heigh... |
How to draw sine waves with HTML5 SVG? | To draw sine waves with SVG, use the following that closely approximates half of a sine wave. I have used a cubic-bezier approximation. Use the <path> element.
<!DOCTYPE html>
<html>
<head>
<title>SVG</title>
<meta charset = "utf-8" />
</head>
<body>
<h2 align = "center">HTML5 SVG Sine Waves<... | [
{
"code": null,
"e": 1222,
"s": 1062,
"text": "To draw sine waves with SVG, use the following that closely approximates half of a sine wave. I have used a cubic-bezier approximation. Use the <path> element."
},
{
"code": null,
"e": 1577,
"s": 1222,
"text": "<!DOCTYPE html>\n<html... |
Identify Top Topics using Word Cloud | by Karan Bhanot | Towards Data Science | I was recently working with textual data when I discovered Word Clouds. I was really fascinated by how they could reveal so much information just through an image and how easily they could be created through a library. Thus, I decided to work on a quick project to understand them.
Word clouds or tag clouds are graphica... | [
{
"code": null,
"e": 454,
"s": 172,
"text": "I was recently working with textual data when I discovered Word Clouds. I was really fascinated by how they could reveal so much information just through an image and how easily they could be created through a library. Thus, I decided to work on a quick p... |
Python PIL | composite() method | 15 Nov, 2021
Syntax: PIL.Image.composite(image1, image2, mask)
Parameters:image1 β The first image.image2 β The second image. Must have the same mode and size as the first image.mask β A mask image. This image can have mode β1β, βLβ, or βRGBAβ, and must have the same size as the other two images.
# Importing Image modu... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n15 Nov, 2021"
},
{
"code": null,
"e": 78,
"s": 28,
"text": "Syntax: PIL.Image.composite(image1, image2, mask)"
},
{
"code": null,
"e": 313,
"s": 78,
"text": "Parameters:image1 β The first image.image2 β The second im... |
Python β Find consecutive dates in a list of dates | 16 May, 2021
Given a list of dates, the task is to write a Python program to check if all the dates are consecutive in the list.
Input : [datetime(2019, 12, 30), datetime(2019, 12, 31), datetime(2020, 1, 1), datetime(2020, 1, 2), datetime(2020, 1, 3), datetime(2020, 1, 4)]
Output : True
Explanation : All dates are cons... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n16 May, 2021"
},
{
"code": null,
"e": 144,
"s": 28,
"text": "Given a list of dates, the task is to write a Python program to check if all the dates are consecutive in the list."
},
{
"code": null,
"e": 289,
"s": 144,
... |
SQL | LIMIT Clause | 06 Nov, 2019
If there are a large number of tuples satisfying the query conditions, it might be resourceful to view only a handful of them at a time.
The LIMIT clause is used to set an upper limit on the number of tuples returned by SQL.
It is important to note that this clause is not supported by all SQL versions.
The... | [
{
"code": null,
"e": 53,
"s": 25,
"text": "\n06 Nov, 2019"
},
{
"code": null,
"e": 190,
"s": 53,
"text": "If there are a large number of tuples satisfying the query conditions, it might be resourceful to view only a handful of them at a time."
},
{
"code": null,
"e": ... |
Flutter β Pick and Open Files From Storage | 07 Dec, 2021
Sometimes in an app, we need to pick and open a file from the phoneβs storage, in this article, we will achieve the same using file_picker and open_file flutter packages.
Create a new flutter app by running the below command on your terminal:
flutter create your_app_name
Now open your flutter project in an... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n07 Dec, 2021"
},
{
"code": null,
"e": 199,
"s": 28,
"text": "Sometimes in an app, we need to pick and open a file from the phoneβs storage, in this article, we will achieve the same using file_picker and open_file flutter packages."
}... |
User defined function in MATLAB | 20 Aug, 2020
Functions let you do a specific task. User defined functions are the functions created by the users according to their needs. This article explains how the user defined function in MATLAB is created.
Syntax : function [a1,...,an] = func(x1,...,xm)func is the function namea1,...,an are outputsx1,...,xm are ... | [
{
"code": null,
"e": 54,
"s": 26,
"text": "\n20 Aug, 2020"
},
{
"code": null,
"e": 254,
"s": 54,
"text": "Functions let you do a specific task. User defined functions are the functions created by the users according to their needs. This article explains how the user defined funct... |
Program to find the largest and smallest ASCII valued characters in a string | 11 Jul, 2022
Given a string of lower case and uppercase characters, your task is to find the largest and smallest alphabet (according to ASCII values) in the string. Note that in ASCII, all capital letters come before all small letters.
Examples :
Input : sample string
Output : Largest = t, Smallest = a
Input : Geeks... | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n11 Jul, 2022"
},
{
"code": null,
"e": 276,
"s": 52,
"text": "Given a string of lower case and uppercase characters, your task is to find the largest and smallest alphabet (according to ASCII values) in the string. Note that in ASCII, a... |
Python | Calculate geographic coordinates of places using google geocoding API | 15 Feb, 2022
Geocoding is the process of converting addresses into geographic coordinates like latitude and longitude, which can be used to mark position on map.To use the Google Maps Geocoding API, one must need an API key, which can be get form here. Modules needed :
Below is the implementation :
Python3
# Pyth... | [
{
"code": null,
"e": 54,
"s": 26,
"text": "\n15 Feb, 2022"
},
{
"code": null,
"e": 314,
"s": 54,
"text": "Geocoding is the process of converting addresses into geographic coordinates like latitude and longitude, which can be used to mark position on map.To use the Google Maps Geo... |
How to Create a Poisson Probability Mass Function Plot in Python? | 13 Jan, 2022
In this article, we will see how we can create a Poisson probability mass function plot in Python. In probability theory and statistics, the Poisson distribution is a discrete probability distribution that expresses the probability of a given number of events occurring in a fixed interval of time or space ... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n13 Jan, 2022"
},
{
"code": null,
"e": 572,
"s": 28,
"text": "In this article, we will see how we can create a Poisson probability mass function plot in Python. In probability theory and statistics, the Poisson distribution is a discrete... |
negate function in C++ STL | 18 Jul, 2018
This function is used to negate the given values i.e. to change the sign of the values. It changes the positive values to negative and vice-versa.
Note: Objects of this class can be used on standard algorithms such as transform.Syntax:
transform(arr_begin, arr_end, arr2_begin, negate())
Parameters: It acc... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n18 Jul, 2018"
},
{
"code": null,
"e": 175,
"s": 28,
"text": "This function is used to negate the given values i.e. to change the sign of the values. It changes the positive values to negative and vice-versa."
},
{
"code": null,
... |
eval command in Linux with Examples | 15 May, 2019
eval is a built-in Linux command which is used to execute arguments as a shell command. It combines arguments into a single string and uses it as an input to the shell and execute the commands.
Syntax
eval [arg ...]
Example: In the below figure, you can see that cd Desktop command is stored in a variable β... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n15 May, 2019"
},
{
"code": null,
"e": 222,
"s": 28,
"text": "eval is a built-in Linux command which is used to execute arguments as a shell command. It combines arguments into a single string and uses it as an input to the shell and exe... |
Print 2-D co-ordinate points in ascending order followed by their frequencies | 19 Aug, 2021
Given two arrays x[] and y[] where x[i] represents the x coordinate and y[i] represent the corresponding y coordinate of a 2-D point, the task is to print the coordinate points in ascending order followed by their frequencies.Examples:
Input: x[] = {1, 2, 1, 1, 1}, y[] = {1, 1, 3, 1, 3} Output: 1 1 2 1 3 ... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n19 Aug, 2021"
},
{
"code": null,
"e": 265,
"s": 28,
"text": "Given two arrays x[] and y[] where x[i] represents the x coordinate and y[i] represent the corresponding y coordinate of a 2-D point, the task is to print the coordinate point... |
How to Override compareTo Method in Java? | 23 May, 2021
As we know, there are basically two types of sorting technique in Java:
First is internal sorting i.e that uses predefined sorting method ascending order Arrays.sort() for Primitive class arrays and wrapper class arrays and Collections.sort() for collections both methods sort the elements in ascending ord... | [
{
"code": null,
"e": 54,
"s": 26,
"text": "\n23 May, 2021"
},
{
"code": null,
"e": 126,
"s": 54,
"text": "As we know, there are basically two types of sorting technique in Java:"
},
{
"code": null,
"e": 365,
"s": 126,
"text": "First is internal sorting i.e tha... |
How to create an object with prototype in JavaScript ? | 01 Dec, 2021
In this article, we will discuss object creation & prototypes, along with understanding the different ways for object creation & their implementation through the examples. Prototypes are the mechanism by which objects in JavaScript inherit features from another object. A prototype property is also an objec... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n01 Dec, 2021"
},
{
"code": null,
"e": 403,
"s": 28,
"text": "In this article, we will discuss object creation & prototypes, along with understanding the different ways for object creation & their implementation through the examples. Pro... |
C# | EndsWith() Method - GeeksforGeeks | 04 Aug, 2021
In C#, EndsWith() is a string method. This method is used to check whether the ending of the current string instance matches with a specified string or not. If it matches, then it returns the string otherwise false. Using βforeachβ loop, it is possible to check many strings. This method can be overloaded b... | [
{
"code": null,
"e": 24222,
"s": 24194,
"text": "\n04 Aug, 2021"
},
{
"code": null,
"e": 24586,
"s": 24222,
"text": "In C#, EndsWith() is a string method. This method is used to check whether the ending of the current string instance matches with a specified string or not. If it ... |
Java program to Find the first non-repeating character from a stream of characters | To find the first non-repeating character from a stream of characters, the Java code is as follows β
Live Demo
import java.util.ArrayList;
import java.util.List;
public class Demo{
final static int max_chars = 256;
static void non_repeating_char(){
List<Character> my_list = new ArrayList<Character>();
... | [
{
"code": null,
"e": 1163,
"s": 1062,
"text": "To find the first non-repeating character from a stream of characters, the Java code is as follows β"
},
{
"code": null,
"e": 1174,
"s": 1163,
"text": " Live Demo"
},
{
"code": null,
"e": 2054,
"s": 1174,
"text": ... |
Angular 6 - Pipes | In this chapter, we will discuss what are Pipes in Angular 6. Pipes were earlier called filters in Angular1 and called pipes in Angular 2 onwards.
The | character is used to transform data. Following is the syntax for the same
{{ Welcome to Angular 6 | lowercase}}
It takes integers, strings, arrays, and date as input ... | [
{
"code": null,
"e": 2142,
"s": 1995,
"text": "In this chapter, we will discuss what are Pipes in Angular 6. Pipes were earlier called filters in Angular1 and called pipes in Angular 2 onwards."
},
{
"code": null,
"e": 2222,
"s": 2142,
"text": "The | character is used to transfor... |
LINQ - Lambda Expressions | The term βLambda expressionβ has derived its name from βlambdaβ calculus which in turn is a mathematical notation applied for defining functions. Lambda expressions as a LINQ equationβs executable part translate logic in a way at run time so it can pass on to the data source conveniently. However, lambda expressions ar... | [
{
"code": null,
"e": 2109,
"s": 1736,
"text": "The term βLambda expressionβ has derived its name from βlambdaβ calculus which in turn is a mathematical notation applied for defining functions. Lambda expressions as a LINQ equationβs executable part translate logic in a way at run time so it can pass... |
Node.js Global Objects - GeeksforGeeks | 06 Dec, 2021
Node.js is an open-source project that can be used for server-side scripting. Node.js Global Objects are the objects that are available in all modules. Global Objects are built-in objects that are part of the JavaScript and can be used directly in the application without importing any particular module. Th... | [
{
"code": null,
"e": 36865,
"s": 36837,
"text": "\n06 Dec, 2021"
},
{
"code": null,
"e": 37217,
"s": 36865,
"text": "Node.js is an open-source project that can be used for server-side scripting. Node.js Global Objects are the objects that are available in all modules. Global Obje... |
Prophet and R: Forecasting Air Passenger Numbers | by Michael Grogan | Towards Data Science | This is a follow-up to a previous article illustrating time series forecasting with Python, whereby a Prophet model was built in order to forecast air passenger numbers using Python. The data in question was sourced from San Francisco Open Data.
In this example, the same analysis will be conducted β but using R.
The da... | [
{
"code": null,
"e": 417,
"s": 171,
"text": "This is a follow-up to a previous article illustrating time series forecasting with Python, whereby a Prophet model was built in order to forecast air passenger numbers using Python. The data in question was sourced from San Francisco Open Data."
},
{... |
Robust Python with Type Hints. Type hinting is an optional feature in... | by Amine Kaabachi | Towards Data Science | As for all dynamic languages, there are few challenges to write robust and high-quality code. To cite the main ones:
As there are no indications on Types of the objects that are passed around, programs usually end up with runtime issues. The developers gain time by writing typeless code but then lose it to write exhaus... | [
{
"code": null,
"e": 289,
"s": 172,
"text": "As for all dynamic languages, there are few challenges to write robust and high-quality code. To cite the main ones:"
},
{
"code": null,
"e": 549,
"s": 289,
"text": "As there are no indications on Types of the objects that are passed a... |
Presentational vs container components - GeeksforGeeks | 12 Oct, 2021
In react the components are divided into two categories: presentational components and container components. Each of these have their own characteristics. Letβs look at both of these components in details.Presentational components
Mainly concerned with how things look.
Have no major dependencies on the res... | [
{
"code": null,
"e": 27062,
"s": 27034,
"text": "\n12 Oct, 2021"
},
{
"code": null,
"e": 27293,
"s": 27062,
"text": "In react the components are divided into two categories: presentational components and container components. Each of these have their own characteristics. Letβs lo... |
maxsize() method in Tkinter | Python - GeeksforGeeks | 28 Nov, 2021
This method is used to set the maximum size of the root window (maximum size a window can be expanded). User will still be able to shrink the size of the window to the minimum possible.
Syntax :
master.maxsize(height, width)
Here, height and width are in pixels.
Code #1:
# importing only those functions#... | [
{
"code": null,
"e": 24323,
"s": 24295,
"text": "\n28 Nov, 2021"
},
{
"code": null,
"e": 24509,
"s": 24323,
"text": "This method is used to set the maximum size of the root window (maximum size a window can be expanded). User will still be able to shrink the size of the window to... |
Converting one string to other using append and delete last operations - GeeksforGeeks | 30 Apr, 2021
Given an integer k and two strings str1 and str2 determine whether or not we can convert str1 to str2 by performing exactly k of the below operations on str1. a) Append a lowercase English alphabetic letter to the end of the str1. b) Delete the last character in str1 (Performing this operation on an empty ... | [
{
"code": null,
"e": 24393,
"s": 24365,
"text": "\n30 Apr, 2021"
},
{
"code": null,
"e": 24746,
"s": 24393,
"text": "Given an integer k and two strings str1 and str2 determine whether or not we can convert str1 to str2 by performing exactly k of the below operations on str1. a) A... |
How to find inverse Laplace Transforms using MATLAB ? - GeeksforGeeks | 21 Apr, 2021
In this article, we will see how to find Laplace Transform in MATLAB. Laplace Transform helps to simplify problems that involve Differential Equations into algebraic equations. Inverse Laplace Transform converts Laplace Domain Function F(s) into time-domain function f(t)
Using the above function one can ge... | [
{
"code": null,
"e": 24171,
"s": 24143,
"text": "\n21 Apr, 2021"
},
{
"code": null,
"e": 24443,
"s": 24171,
"text": "In this article, we will see how to find Laplace Transform in MATLAB. Laplace Transform helps to simplify problems that involve Differential Equations into algebra... |
Difference between useRef and createRef in ReactJS - GeeksforGeeks | 22 Mar, 2022
What is a ref ?A ref is defined as any value that does not trigger a component re-render when it is changed. This behavior is contrary to the function of states and props. A ref can be created in two ways- by the useRef hook or by the createRef function.
useRef: The useRef is a hook that uses the same ref ... | [
{
"code": null,
"e": 24792,
"s": 24764,
"text": "\n22 Mar, 2022"
},
{
"code": null,
"e": 25047,
"s": 24792,
"text": "What is a ref ?A ref is defined as any value that does not trigger a component re-render when it is changed. This behavior is contrary to the function of states an... |
jps - Unix, Linux Command | If
jps is run without specifying a hostid, it will look for instrumented JVMs
on the local host. If started with a hostid, it will look for JVMs
on the indicated host, using the specified protocol and port.
A jstatd process is assumed to be running on the target host.
The jps command will report the local VM identifi... | [
{
"code": null,
"e": 10848,
"s": 10577,
"text": "\nIf\njps is run without specifying a hostid, it will look for instrumented JVMs\non the local host. If started with a hostid, it will look for JVMs\non the indicated host, using the specified protocol and port.\nA jstatd process is assumed to be runn... |
Program for printing array in Pendulum Arrangement. | To arrange elements of the array following pendulum arrangement.
Sort the given array, create an empty array to store the result.
Store the 0th element in a variable say temp.
Store the element at index 1 in the sorted array in (mid+1)st position of the resultant array, and the next element int the (mid-1)st position a... | [
{
"code": null,
"e": 1127,
"s": 1062,
"text": "To arrange elements of the array following pendulum arrangement."
},
{
"code": null,
"e": 1192,
"s": 1127,
"text": "Sort the given array, create an empty array to store the result."
},
{
"code": null,
"e": 1238,
"s": ... |
How to set a Timeout for an AsyncTask in Android? | This example demonstrates how do I set a Timeout for an AsyncTask in android.
Step 1 β Create a new project in Android Studio, go to File β New Project and fill all required details to create a new project.
Step 2 β Add the following code to res/layout/activity_main.xml.
<?xml version="1.0" encoding="utf-8"?>
<Relative... | [
{
"code": null,
"e": 1140,
"s": 1062,
"text": "This example demonstrates how do I set a Timeout for an AsyncTask in android."
},
{
"code": null,
"e": 1269,
"s": 1140,
"text": "Step 1 β Create a new project in Android Studio, go to File β New Project and fill all required details ... |
PyQt - QSlider Widget & Signal | QSlider class object presents the user with a groove over which a handle can be moved. It is a classic widget to control a bounded value. Position of the handle on the groove is equivalent to an integer between the lower and the upper bounds of the control.
A slider control can be displayed in horizontal or vertical ma... | [
{
"code": null,
"e": 2184,
"s": 1926,
"text": "QSlider class object presents the user with a groove over which a handle can be moved. It is a classic widget to control a bounded value. Position of the handle on the groove is equivalent to an integer between the lower and the upper bounds of the cont... |
Bootstrap Contextual classes | The Bootstrap Contextual Class allows you to change the background color of your table rows or individual cells.
The following are the classes β
The following is an example of the active class β
Live Demo
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap Table</title>
<link href = "/bootstrap/css/bootstrap.... | [
{
"code": null,
"e": 1175,
"s": 1062,
"text": "The Bootstrap Contextual Class allows you to change the background color of your table rows or individual cells."
},
{
"code": null,
"e": 1207,
"s": 1175,
"text": "The following are the classes β"
},
{
"code": null,
"e": ... |
How to find the cube root of a number in JavaScript? | Using Math object in javascript any kind of operation can be done. Math.cbrt() is a method especially used to find the cube root of a number. It takes a number as a parameter and returns its cube root.
Math.cbrt(64);
It takes a number as a parameter and returns its cube root value as the output.
In the following exampl... | [
{
"code": null,
"e": 1264,
"s": 1062,
"text": "Using Math object in javascript any kind of operation can be done. Math.cbrt() is a method especially used to find the cube root of a number. It takes a number as a parameter and returns its cube root."
},
{
"code": null,
"e": 1279,
"s":... |
Capacity of a List in C# | To get the capacity of a list, the code is as follows β
Live Demo
using System;
using System.Collections.Generic;
public class Demo {
public static void Main(String[] args){
List<string> list1 = new List<string>();
list1.Add("One");
list1.Add("Two");
list1.Add("Three");
list1.Add("Four... | [
{
"code": null,
"e": 1118,
"s": 1062,
"text": "To get the capacity of a list, the code is as follows β"
},
{
"code": null,
"e": 1129,
"s": 1118,
"text": " Live Demo"
},
{
"code": null,
"e": 2081,
"s": 1129,
"text": "using System;\nusing System.Collections.Gene... |
10 Popular Coding Interview Questions on Recursion | by Rashida Nasrin Sucky | Towards Data Science | It takes a sizeable amount of time to prepare for a coding interview. There are so many different topics, data structures, and algorithms to go over. Recursion is one of the most important algorithm types. Because it is the basis for so many important algorithms like divide and conquers, graph algorithms, dynamic progr... | [
{
"code": null,
"e": 661,
"s": 172,
"text": "It takes a sizeable amount of time to prepare for a coding interview. There are so many different topics, data structures, and algorithms to go over. Recursion is one of the most important algorithm types. Because it is the basis for so many important alg... |
Compute the Covariance between Two Vectors in R Programming - cov() Function - GeeksforGeeks | 10 Jun, 2020
cov() function in R Language is used to measure the covariance between two vectors.
Syntax: cov(x, y, method)
Parameters:x, y: Data vectorsmethod: Type of method to be used
Example 1:
# Data vectors x <- c(1, 3, 5, 10) y <- c(2, 4, 6, 20) # Print covariance using Pearson methodprint(cov(x, y, metho... | [
{
"code": null,
"e": 25162,
"s": 25134,
"text": "\n10 Jun, 2020"
},
{
"code": null,
"e": 25246,
"s": 25162,
"text": "cov() function in R Language is used to measure the covariance between two vectors."
},
{
"code": null,
"e": 25272,
"s": 25246,
"text": "Syntax... |
Espresso Testing Framework - View Assertions | As discussed earlier, view assertion is used to assert that both the actual view (found using view matchers) and expected views are the same. A sample code is as follows,
onView(withId(R.id.my_view)) .check(matches(withText("Hello")))
Here,
onView() returns ViewInteration object corresponding to matched view. ViewInte... | [
{
"code": null,
"e": 2147,
"s": 1976,
"text": "As discussed earlier, view assertion is used to assert that both the actual view (found using view matchers) and expected views are the same. A sample code is as follows,"
},
{
"code": null,
"e": 2212,
"s": 2147,
"text": "onView(with... |
How can I save new Date() in MongoDB? | To save new Date() in MongoDB, you can use new ISODate(). Let us create a collection with documents β
> db.saveDateDemo.insertOne({"UserName":"John","UserLoginDatetime":new ISODate('2018-01-31 12:34:56')});
{
"acknowledged" : true,
"insertedId" : ObjectId("5cbd67d4de8cc557214c0e04")
}
> db.saveDateDemo.insertOne(... | [
{
"code": null,
"e": 1164,
"s": 1062,
"text": "To save new Date() in MongoDB, you can use new ISODate(). Let us create a collection with documents β"
},
{
"code": null,
"e": 1734,
"s": 1164,
"text": "> db.saveDateDemo.insertOne({\"UserName\":\"John\",\"UserLoginDatetime\":new ISO... |
ES6 - Events | JavaScript is meant to add interactivity to your pages. JavaScript does this using a mechanism using events. Events are a part of the Document Object Model (DOM) Level 3 and every HTML element contains a set of events that can trigger JavaScript Code.
An event is an action or occurrence recognized by the software. It c... | [
{
"code": null,
"e": 2529,
"s": 2277,
"text": "JavaScript is meant to add interactivity to your pages. JavaScript does this using a mechanism using events. Events are a part of the Document Object Model (DOM) Level 3 and every HTML element contains a set of events that can trigger JavaScript Code."
... |
Pattern.matches() method in Java Regular Expressions | The java.util.regex.Pattern.matches() method matches the regular expression and the given input. It has two parameters i.e. the regex and the input. It returns true if the regex and the input match and false otherwise.
A program that demonstrates the method Pattern.matches() in Java regular expressions is given as foll... | [
{
"code": null,
"e": 1281,
"s": 1062,
"text": "The java.util.regex.Pattern.matches() method matches the regular expression and the given input. It has two parameters i.e. the regex and the input. It returns true if the regex and the input match and false otherwise."
},
{
"code": null,
"e... |
CSS Layout - Horizontal & Vertical Align | To horizontally center a block element (like <div>), use margin: auto;
Setting the width of the element will prevent it from stretching out to the
edges of its container.
The element will then take up the specified width, and the remaining space
will be split equally between the two margins:
This div element is cente... | [
{
"code": null,
"e": 71,
"s": 0,
"text": "To horizontally center a block element (like <div>), use margin: auto;"
},
{
"code": null,
"e": 172,
"s": 71,
"text": "Setting the width of the element will prevent it from stretching out to the \nedges of its container."
},
{
"co... |
How to create a dropdown navigation bar with CSS? | Following is the code to create a dropdown navigation bar β
Live Demo
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
.menu-btn {
background-color: #040008;
color: white;
padding: 16px;
font-size: 20px;
font-weight: bolder;
font-family: 'Se... | [
{
"code": null,
"e": 1122,
"s": 1062,
"text": "Following is the code to create a dropdown navigation bar β"
},
{
"code": null,
"e": 1133,
"s": 1122,
"text": " Live Demo"
},
{
"code": null,
"e": 2609,
"s": 1133,
"text": "<!DOCTYPE html>\n<html>\n<head>\n<meta n... |
How to Replace Values by Index in a Tensor with TensorFlow-2.0 | by Riccardo Di Sipio | Towards Data Science | Have you ever tried to replace only certain values of array, based on their indices?
>>> import numpy as np>>> a = np.array( [1,2,3,4,5] )>>> print(a)[1 2 3 4 5]>>> i = [ 0, 1, 3 ]>>> a[i] = -1>>> print(a)[-1 -1 3 -1 5]
A more involved use case may be, for example, to clip to a maximum all values above a certain thre... | [
{
"code": null,
"e": 257,
"s": 172,
"text": "Have you ever tried to replace only certain values of array, based on their indices?"
},
{
"code": null,
"e": 394,
"s": 257,
"text": ">>> import numpy as np>>> a = np.array( [1,2,3,4,5] )>>> print(a)[1 2 3 4 5]>>> i = [ 0, 1, 3 ]>>> a[... |
Using find() to search for nested keys in MongoDB? | For find() to search for nested keys in MongoDB, you can use dot(.) notation. Following is the
syntax
db.yourCollectionName.find({"yourOuterFieldName.yourInnerFieldName":"yourValue"}).pretty();
Let us first create a collection with documents:
>db.searchForNestedKeysDemo.insertOne({"ClientName":"Larry","ClientAge":28,"C... | [
{
"code": null,
"e": 1164,
"s": 1062,
"text": "For find() to search for nested keys in MongoDB, you can use dot(.) notation. Following is the\nsyntax"
},
{
"code": null,
"e": 1256,
"s": 1164,
"text": "db.yourCollectionName.find({\"yourOuterFieldName.yourInnerFieldName\":\"yourVal... |
How to convert the hashtable to the JSON format using PowerShell? | To convert the hashtable to the JSON format we can use the ConvertTo-Json command. First, we have the following hashtable,
$Body = [PSCustomObject]@{
AppName = 'StorageXIO'
AppID ='xo2ss-12233-2nn12'
License = 'valid'
}
To convert the hashtable to the JSON format,
$Body | ConvertTo-Json
Once you run the above ... | [
{
"code": null,
"e": 1185,
"s": 1062,
"text": "To convert the hashtable to the JSON format we can use the ConvertTo-Json command. First, we have the following hashtable,"
},
{
"code": null,
"e": 1291,
"s": 1185,
"text": "$Body = [PSCustomObject]@{\n AppName = 'StorageXIO'\n A... |
HTML hidden Attribute | The HTML hidden attribute is used to communicate to the user that element with hidden attribute is no longer relevant to the document and should not be visible to the user.
Let us see an example of hidden attribute β
Live Demo
<!DOCTYPE html>
<html>
<head>
<title>HTML hidden attribute</title>
<style>
form {
w... | [
{
"code": null,
"e": 1235,
"s": 1062,
"text": "The HTML hidden attribute is used to communicate to the user that element with hidden attribute is no longer relevant to the document and should not be visible to the user."
},
{
"code": null,
"e": 1279,
"s": 1235,
"text": "Let us se... |
pthread_equal() in C with example - GeeksforGeeks | 14 Oct, 2019
Prerequisite : Multithreading, pthread_self() in C with Example
pthread_equal() = This compares two thread which is equal or not. This function compares two thread identifiers. It return β0β and non zero value. If it is equal then return non zero value else return 0.
Syntax:- int pthread_equal (pthread_t t... | [
{
"code": null,
"e": 25921,
"s": 25893,
"text": "\n14 Oct, 2019"
},
{
"code": null,
"e": 25985,
"s": 25921,
"text": "Prerequisite : Multithreading, pthread_self() in C with Example"
},
{
"code": null,
"e": 26189,
"s": 25985,
"text": "pthread_equal() = This com... |
How to map array values without using map method in JavaScript ? - GeeksforGeeks | 06 Dec, 2021
Array elements can be mapped by using looping methods in JavaScript. The map() method creates a new array with the results of the output of a function called for each element of the array. This can also be implemented using for loop in JavaScript.
Approach: For this, we can create two arrays, in which one ... | [
{
"code": null,
"e": 26655,
"s": 26627,
"text": "\n06 Dec, 2021"
},
{
"code": null,
"e": 26903,
"s": 26655,
"text": "Array elements can be mapped by using looping methods in JavaScript. The map() method creates a new array with the results of the output of a function called for e... |
Output of the program | Dereference, Reference, Dereference, Reference.... - GeeksforGeeks | 09 Aug, 2018
Predict the output of below program
#include<stdio.h>int main(){ char *ptr = "geeksforgeeks"; printf("%c\n", *&*&*ptr); getchar(); return 0;}
Output: g
Explanation: The operator * is used for dereferencing and the operator & is used to get the address. These operators cancel effect of each other when us... | [
{
"code": null,
"e": 24706,
"s": 24678,
"text": "\n09 Aug, 2018"
},
{
"code": null,
"e": 24742,
"s": 24706,
"text": "Predict the output of below program"
},
{
"code": "#include<stdio.h>int main(){ char *ptr = \"geeksforgeeks\"; printf(\"%c\\n\", *&*&*ptr); getchar(); r... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.