title stringlengths 3 221 | text stringlengths 17 477k | parsed listlengths 0 3.17k |
|---|---|---|
Python – Extract ith column values from jth column values | 10 Jul, 2020
Sometimes, while working with Python Matrix, we can have a problem in which we need to extract ith column values from comparing values from jth column. This kind of problem can occur in domains such as school programming or web development. Let’s discuss certain ways in which this task can be performed.
In... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n10 Jul, 2020"
},
{
"code": null,
"e": 333,
"s": 28,
"text": "Sometimes, while working with Python Matrix, we can have a problem in which we need to extract ith column values from comparing values from jth column. This kind of problem ca... |
Java Program to Print Mirror Upper Star Triangle Pattern | 24 Nov, 2021
The pattern has two parts – both mirror reflections of each other. The base of the triangle has to be at the bottom of the imaginary mirror and the tip at the top.
Illustration:
Input:
size = 7
Output:
*
* *
* * *
* * * *
* * * * *
* * * * * *
* * * * * * *
* * * * * * *
* *... | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n24 Nov, 2021"
},
{
"code": null,
"e": 216,
"s": 52,
"text": "The pattern has two parts – both mirror reflections of each other. The base of the triangle has to be at the bottom of the imaginary mirror and the tip at the top."
},
{
... |
Do Not Use sizeof For Array Parameters in C | 01 Jul, 2022
Using sizeof directly to find the size of arrays can result in an error in the code, as array parameters are treated as pointers. Consider the below program.
C
// C Program to demonstrate incorrect usage of sizeof() for// arrays#include <stdio.h> void fun(int arr[]){ int i; // sizeof should not be... | [
{
"code": null,
"e": 54,
"s": 26,
"text": "\n01 Jul, 2022"
},
{
"code": null,
"e": 214,
"s": 54,
"text": "Using sizeof directly to find the size of arrays can result in an error in the code, as array parameters are treated as pointers. Consider the below program. "
},
{
... |
Wand text() function in Python | 10 May, 2020
Text can also be added using wand.drawing object. text() function is used to add text in the Drawing object. It takes x and y coordinates and string that we wan to write on (x, y) position.
Syntax :
wand.drawing.text(x, y, body)
Parameters :
Example #1:
# Import different modules of wandfrom wand.image im... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n10 May, 2020"
},
{
"code": null,
"e": 218,
"s": 28,
"text": "Text can also be added using wand.drawing object. text() function is used to add text in the Drawing object. It takes x and y coordinates and string that we wan to write on (x... |
How to sort a slice in Golang? | 28 Aug, 2019
In Go language slice is more powerful, flexible, convenient than an array, and is a lightweight data structure. The slice is a variable-length sequence which stores elements of a similar type, you are not allowed to store different type of elements in the same slice.In Go language, you can sort a slice wit... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n28 Aug, 2019"
},
{
"code": null,
"e": 722,
"s": 28,
"text": "In Go language slice is more powerful, flexible, convenient than an array, and is a lightweight data structure. The slice is a variable-length sequence which stores elements o... |
Python string | isdecimal() | 05 Jan, 2018
isdecimal()-It is a function in Python that returns true if all characters in a string are decimal. If all characters are not decimal then it returns false.
Syntax:
string_name.isdecimal()Here string_name is the string whose characters are to be checked
Parameters:This method does not takes any parameters ... | [
{
"code": null,
"e": 54,
"s": 26,
"text": "\n05 Jan, 2018"
},
{
"code": null,
"e": 211,
"s": 54,
"text": "isdecimal()-It is a function in Python that returns true if all characters in a string are decimal. If all characters are not decimal then it returns false."
},
{
"co... |
LocalDate toString() method in Java with Examples | 17 Dec, 2018
The toString() method of a LocalDate class is used to get this date as a String, such as 2019-01-01.The output will be in the ISO-8601 format uuuu-MM-dd.
Syntax:
public String toString()
Parameters: This method does not accepts any parameters.
Return value: This method returns String which is the represen... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n17 Dec, 2018"
},
{
"code": null,
"e": 182,
"s": 28,
"text": "The toString() method of a LocalDate class is used to get this date as a String, such as 2019-01-01.The output will be in the ISO-8601 format uuuu-MM-dd."
},
{
"code":... |
HTTP headers | Vary | 27 Feb, 2020
The HTTP Vary header is a response-type type header. It is used to indicate which headers it used when selecting a representation of a resource in a content negotiation algorithm and determines how to match future request headers to decide whether a cached response can be used rather than requesting a fres... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n27 Feb, 2020"
},
{
"code": null,
"e": 609,
"s": 28,
"text": "The HTTP Vary header is a response-type type header. It is used to indicate which headers it used when selecting a representation of a resource in a content negotiation algori... |
Queue Program In C | We shall see the stack implementation in C programming language here. You can try the program by clicking on the Try-it button. To learn the theory aspect of stacks, click on visit previous page.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#define MAX 6
int intArray[MAX];
int front... | [
{
"code": null,
"e": 2776,
"s": 2580,
"text": "We shall see the stack implementation in C programming language here. You can try the program by clicking on the Try-it button. To learn the theory aspect of stacks, click on visit previous page."
},
{
"code": null,
"e": 4795,
"s": 2776,... |
Java program to find the LCM of two numbers | L.C.M. or Least Common Multiple of two values is the smallest positive value which the multiple of both values.
For example multiples of 3 and 4 are:
3 → 3, 6, 9, 12, 15 ...
4 → 4, 8, 12, 16, 20 ...
The smallest multiple of both is 12, hence the LCM of 3 and 4 is 12.
Initialize A and B with positive integers.
Store ma... | [
{
"code": null,
"e": 1174,
"s": 1062,
"text": "L.C.M. or Least Common Multiple of two values is the smallest positive value which the multiple of both values."
},
{
"code": null,
"e": 1212,
"s": 1174,
"text": "For example multiples of 3 and 4 are:"
},
{
"code": null,
... |
How To Programmatically Obtain Chemical Data From PubChem | by Hien Vo, M.S. | Towards Data Science | Have you ever wondered how scientists used to communicate back when the internet wasn’t around? I hadn’t thought about it either until I heard this story from a professor I worked with as an undergraduate. Apparently, organic chemists used to make new molecules and then didn’t make much of an effort to tell anybody abo... | [
{
"code": null,
"e": 746,
"s": 171,
"text": "Have you ever wondered how scientists used to communicate back when the internet wasn’t around? I hadn’t thought about it either until I heard this story from a professor I worked with as an undergraduate. Apparently, organic chemists used to make new mol... |
JavaScript exec() Method | The exec() method executes the search for match and if the matched text is found in the specified string then it is returned otherwise null is returned.
Following is the code for the JavaScript exec() Method −
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-w... | [
{
"code": null,
"e": 1215,
"s": 1062,
"text": "The exec() method executes the search for match and if the matched text is found in the specified string then it is returned otherwise null is returned."
},
{
"code": null,
"e": 1272,
"s": 1215,
"text": "Following is the code for the... |
Convert matrix or dataframe to sparse Matrix in R - GeeksforGeeks | 21 Dec, 2021
Sparse matrices are in column-oriented format and they contain mostly null values. The elements in the sparse matrix which are non-null are arranged in ascending order. In this article, we will convert the matrix and dataframe to a sparse matrix in R programming language.
As we know, matrices in R programm... | [
{
"code": null,
"e": 25242,
"s": 25214,
"text": "\n21 Dec, 2021"
},
{
"code": null,
"e": 25515,
"s": 25242,
"text": "Sparse matrices are in column-oriented format and they contain mostly null values. The elements in the sparse matrix which are non-null are arranged in ascending o... |
super keyword in Java | super variable refers immediate parent class instance.
super variable can invoke immediate parent class method.
super() acts as immediate parent class constructor and should be first line in child class constructor.
When invoking a superclass version of an overridden method the super keyword is used.
Live Demo
class An... | [
{
"code": null,
"e": 1117,
"s": 1062,
"text": "super variable refers immediate parent class instance."
},
{
"code": null,
"e": 1174,
"s": 1117,
"text": "super variable can invoke immediate parent class method."
},
{
"code": null,
"e": 1278,
"s": 1174,
"text": ... |
How to start windows service with display name in PowerShell? | To stop the service using display name, use the parameter –DisplayName.
For Example,
PS C:\> Start-Service -DisplayName "Print Spooler" -Verbose
VERBOSE: Performing the operation "Start-Service" on target "Print Spooler (Spooler)".
You can also start the service with display name using,
PS C:\> Get-Service -DisplayName... | [
{
"code": null,
"e": 1134,
"s": 1062,
"text": "To stop the service using display name, use the parameter –DisplayName."
},
{
"code": null,
"e": 1147,
"s": 1134,
"text": "For Example,"
},
{
"code": null,
"e": 1294,
"s": 1147,
"text": "PS C:\\> Start-Service -Di... |
Design data structures and algorithms for in-memory file system - GeeksforGeeks | 20 Jun, 2017
Explain the data structures and algorithms that you would use to design an in-memory file system. Illustrate with an example in the code logic where possible.
Asked In: Amazon
A file system, in its most simplistic version, consists of Files and Directories. Each Directory contains a set of Files and Direct... | [
{
"code": null,
"e": 24223,
"s": 24195,
"text": "\n20 Jun, 2017"
},
{
"code": null,
"e": 24382,
"s": 24223,
"text": "Explain the data structures and algorithms that you would use to design an in-memory file system. Illustrate with an example in the code logic where possible."
}... |
break - Unix, Linux Command | break - To make exit from a for, while, until, or select loop.
break [n]
Create a Utility Class to use break.
#breaksample
for myloop in 1 2 3 4 5
do
echo -n "$myloop"
if [ "$myloop" -eq 3 ]
then
break # This line will break out of the loop
fi
done
Run the utility
$ chmod a+x breaksample
$ ./breaksampl... | [
{
"code": null,
"e": 10640,
"s": 10577,
"text": "break - To make exit from a for, while, until, or select loop."
},
{
"code": null,
"e": 10650,
"s": 10640,
"text": "break [n]"
},
{
"code": null,
"e": 10687,
"s": 10650,
"text": "Create a Utility Class to use br... |
Graph Neural Network predicts traffic | Towards Data Science | Graph neural network (GNN) is an active frontier of deep learning, with a lot of applications, e.g., traffic speed/time prediction and recommendation system. In this blog, we will build our first GNN model to predict travel speed. We will run a spatio-temporal GNN model with example code from dgl library.
We will train... | [
{
"code": null,
"e": 478,
"s": 171,
"text": "Graph neural network (GNN) is an active frontier of deep learning, with a lot of applications, e.g., traffic speed/time prediction and recommendation system. In this blog, we will build our first GNN model to predict travel speed. We will run a spatio-tem... |
Switch Statements in VBScript | When a user wants to execute a group of statements depending upon a value of an expression, then he can use Select Case statements. Each value is called a Case, and the variable being switched ON based on each case. Case Else statement is executed if test expression doesn't match any of the Case specified by the user.
... | [
{
"code": null,
"e": 2400,
"s": 2080,
"text": "When a user wants to execute a group of statements depending upon a value of an expression, then he can use Select Case statements. Each value is called a Case, and the variable being switched ON based on each case. Case Else statement is executed if te... |
Class and Static Variables in Java | Class variables are also known as static variables, and they are declared outside a method, with the
help of the keyword ‘static’.
Static variable is the one that is common to all the instances of the class. A single copy of the
variable is shared among all objects.
Live Demo
public class Demo{
static int my_count=... | [
{
"code": null,
"e": 1193,
"s": 1062,
"text": "Class variables are also known as static variables, and they are declared outside a method, with the\nhelp of the keyword ‘static’."
},
{
"code": null,
"e": 1329,
"s": 1193,
"text": "Static variable is the one that is common to all t... |
Sum of all substrings of a number | Practice | GeeksforGeeks | Given an integer S represented as a string, the task is to get the sum of all possible sub-strings of this string.
As the answer will be large, print it modulo 10^9+7.
Example 1:
Input:
S = 1234
Output: 1670
Explanation: Sum = 1 + 2 + 3 + 4 + 12 +
23 + 34 + 123 + 234 + 1234 = 1670
Example 2:
Input:
S = 421
Output: 491... | [
{
"code": null,
"e": 458,
"s": 290,
"text": "Given an integer S represented as a string, the task is to get the sum of all possible sub-strings of this string.\nAs the answer will be large, print it modulo 10^9+7."
},
{
"code": null,
"e": 469,
"s": 458,
"text": "Example 1:"
},
... |
How to Install conda in Windows? - GeeksforGeeks | 20 Apr, 2022
Anaconda is open-source software that contains Jupyter, spyder, etc that is used for large data processing, data analytics, heavy scientific computing.
Conda is a package and environment management system that is available across Windows, Linux, and MacOS, similar to PIP. It helps in the installation of p... | [
{
"code": null,
"e": 24380,
"s": 24352,
"text": "\n20 Apr, 2022"
},
{
"code": null,
"e": 24533,
"s": 24380,
"text": "Anaconda is open-source software that contains Jupyter, spyder, etc that is used for large data processing, data analytics, heavy scientific computing. "
},
{
... |
How to make collapsible button appear only in mobile view using Bootstrap ? - GeeksforGeeks | 14 Dec, 2020
Collapsible button is used to hide or display the list of contents on clicking the button. On clicking collapsible button, it expands and displays list of contents to select, which then mapped to specific content. Bootstrap has different classes for creating collapsible elements.
Collapsible button in mob... | [
{
"code": null,
"e": 25227,
"s": 25199,
"text": "\n14 Dec, 2020"
},
{
"code": null,
"e": 25509,
"s": 25227,
"text": "Collapsible button is used to hide or display the list of contents on clicking the button. On clicking collapsible button, it expands and displays list of contents... |
SQLAlchemy Core - Creating Table | Let us now discuss how to use the create table function.
The SQL Expression Language constructs its expressions against table columns. SQLAlchemy Column object represents a column in a database table which is in turn represented by a Tableobject. Metadata contains definitions of tables and associated objects such as in... | [
{
"code": null,
"e": 2397,
"s": 2340,
"text": "Let us now discuss how to use the create table function."
},
{
"code": null,
"e": 2686,
"s": 2397,
"text": "The SQL Expression Language constructs its expressions against table columns. SQLAlchemy Column object represents a column in... |
VBA - Left | The Left function returns a specified number of characters from the left side of the given input string.
Left(String, Length)
String − A required parameter. Input String from which the specified number of characters to be returned from the left side.
String − A required parameter. Input String from which the specified... | [
{
"code": null,
"e": 2040,
"s": 1935,
"text": "The Left function returns a specified number of characters from the left side of the given input string."
},
{
"code": null,
"e": 2062,
"s": 2040,
"text": "Left(String, Length)\n"
},
{
"code": null,
"e": 2187,
"s": 20... |
Face Detection For Beginners. In the past few years, face recognition... | by Divyansh Dwivedi | Towards Data Science | In the past few years, face recognition owned significant consideration and appreciated as one of the most promising applications in the field of image analysis. Face detection can consider a substantial part of face recognition operations. According to its strength to focus computational resources on the section of an... | [
{
"code": null,
"e": 797,
"s": 172,
"text": "In the past few years, face recognition owned significant consideration and appreciated as one of the most promising applications in the field of image analysis. Face detection can consider a substantial part of face recognition operations. According to i... |
Check if a number is binary or not in Java - GeeksforGeeks | 09 Sep, 2021
Given a number N, the task is to check first whether the given number is binary or not and its value should be greater than 1. print true if N is the binary representation else print false.
Examples:
Input: N = 1010 Output: true Explanation: Given number is greater than 1 and none of its digits is greater... | [
{
"code": null,
"e": 25324,
"s": 25296,
"text": "\n09 Sep, 2021"
},
{
"code": null,
"e": 25514,
"s": 25324,
"text": "Given a number N, the task is to check first whether the given number is binary or not and its value should be greater than 1. print true if N is the binary repres... |
What is Bitwise Left Shift Operator (<<) in JavaScript? | The left shift operator moves all the bits in its first operand to the left by the number of places specified in the second operand. New bits are filled with zeros.Shifting a value left by one position is equivalent to multiplying it by 2, shifting two positions is equivalent to multiplying by 4, and so on.
You can try... | [
{
"code": null,
"e": 1371,
"s": 1062,
"text": "The left shift operator moves all the bits in its first operand to the left by the number of places specified in the second operand. New bits are filled with zeros.Shifting a value left by one position is equivalent to multiplying it by 2, shifting two ... |
Array Oriented Programming with Python NumPy | by Semi Koen | Towards Data Science | NumPy is the most popular Python library for high-performance array implementation: operations on arrays are a lot faster than those on lists, which in the world of big-data it can make an amplified runtime difference. According to libraries.io (as of Apr 2020) over 4K libraries depend on NumPy, including the most popu... | [
{
"code": null,
"e": 536,
"s": 171,
"text": "NumPy is the most popular Python library for high-performance array implementation: operations on arrays are a lot faster than those on lists, which in the world of big-data it can make an amplified runtime difference. According to libraries.io (as of Apr... |
How to measure elapsed time in python? | To measure time elapsed during program's execution, either use time.clock() or time.time() functions. The python docs state that this function should be used for benchmarking purposes.
import time
t0= time.clock()
print("Hello")
t1 = time.clock() - t0
print("Time elapsed: ", t1) # CPU seconds elapsed (floating point)
... | [
{
"code": null,
"e": 1248,
"s": 1062,
"text": "To measure time elapsed during program's execution, either use time.clock() or time.time() functions. The python docs state that this function should be used for benchmarking purposes. "
},
{
"code": null,
"e": 1382,
"s": 1248,
"text... |
Flask â Variable Rules | It is possible to build a URL dynamically, by adding variable parts to the rule parameter. This variable part is marked as <variable-name>. It is passed as a keyword argument to the function with which the rule is associated.
In the following example, the rule parameter of route() decorator contains <name> variable par... | [
{
"code": null,
"e": 2259,
"s": 2033,
"text": "It is possible to build a URL dynamically, by adding variable parts to the rule parameter. This variable part is marked as <variable-name>. It is passed as a keyword argument to the function with which the rule is associated."
},
{
"code": null,... |
grp module in Python - GeeksforGeeks | 02 Aug, 2019
grp module in Python provides access to the Unix group database. Each entry of Unix group database is reported as a tuple-like object whose attributes are similar as the members of group structure defined in <grp.h> header.
Following are the attributes of the tuple-like object which represents the entries ... | [
{
"code": null,
"e": 24292,
"s": 24264,
"text": "\n02 Aug, 2019"
},
{
"code": null,
"e": 24516,
"s": 24292,
"text": "grp module in Python provides access to the Unix group database. Each entry of Unix group database is reported as a tuple-like object whose attributes are similar ... |
CSS | zoom Property - GeeksforGeeks | 19 May, 2020
The zoom property in CSS is used to scale-up or scale-down the content. This property was implemented for Internet Explorer before the latter is supported by a few other browsers.
Syntax:
zoom: percentage | number | normal;
Property Value: This property accepts three types of values as mentioned above and ... | [
{
"code": null,
"e": 25254,
"s": 25226,
"text": "\n19 May, 2020"
},
{
"code": null,
"e": 25434,
"s": 25254,
"text": "The zoom property in CSS is used to scale-up or scale-down the content. This property was implemented for Internet Explorer before the latter is supported by a few... |
How to build a Digital Twin in Python. Implementation of a digital twin... | by Javier Marin | Jul, 2021 | Towards Data Science | Towards Data Science | In this tutorial, we will show how to create a simple but functional Digital Twin in Python. A Li-ion battery will be our physical asset. This Digital Twin will enable us to analyze and predict battery behavior, and it can be integrated into any virtual asset management workflow.
Digital twins are a critical component ... | [
{
"code": null,
"e": 453,
"s": 172,
"text": "In this tutorial, we will show how to create a simple but functional Digital Twin in Python. A Li-ion battery will be our physical asset. This Digital Twin will enable us to analyze and predict battery behavior, and it can be integrated into any virtual a... |
col command in Linux with Examples - GeeksforGeeks | 15 May, 2019
col command in Linux system is used to filter out reverse line feeds such that the output looks much more in the correct order with only forward and half forward line feeds and replaces the whitespace characters with tabs wherever possible. This can be proven useful in the processing of the output of nroff... | [
{
"code": null,
"e": 24326,
"s": 24298,
"text": "\n15 May, 2019"
},
{
"code": null,
"e": 24727,
"s": 24326,
"text": "col command in Linux system is used to filter out reverse line feeds such that the output looks much more in the correct order with only forward and half forward l... |
Embedding small plots inside subplots in Matplotlib | To embed small plots inside subplots, we can take the following Steps −
Using subplots() method, create a figure and a set of subplots (fig, ax1).
Using subplots() method, create a figure and a set of subplots (fig, ax1).
On ax1, plot a line with color red, line width=4, label=”outer plot”.
On ax1, plot a line with col... | [
{
"code": null,
"e": 1134,
"s": 1062,
"text": "To embed small plots inside subplots, we can take the following Steps −"
},
{
"code": null,
"e": 1209,
"s": 1134,
"text": "Using subplots() method, create a figure and a set of subplots (fig, ax1)."
},
{
"code": null,
"e"... |
Angular CLI - Overview | Angular command-line interface (CLI) makes it easy to start with any Angular project. It comes with commands that help us create and start on our project very fast. Let us now go through the commands available to create a project, a component and services, change the port, etc.
To work with Angular CLI, we need to have... | [
{
"code": null,
"e": 2354,
"s": 2075,
"text": "Angular command-line interface (CLI) makes it easy to start with any Angular project. It comes with commands that help us create and start on our project very fast. Let us now go through the commands available to create a project, a component and servic... |
java.time.Period Class | The java.time.Period class models a quantity or amount of time in terms of years, months and days.
Following is the declaration for java.time.Period class −
public final class Period
extends Object
implements ChronoPeriod, Serializable
Following are the fields for Java.time.Period class −
static Period ZERO −... | [
{
"code": null,
"e": 2014,
"s": 1915,
"text": "The java.time.Period class models a quantity or amount of time in terms of years, months and days."
},
{
"code": null,
"e": 2072,
"s": 2014,
"text": "Following is the declaration for java.time.Period class −"
},
{
"code": nul... |
MongoDB $addToSet to add a deep nested array of object? | The addToSetoperatoraddsavaluetoanarrayunlessthevalueisalreadypresent,inwhichcaseaddToSet does nothing to that array.
Let us first create a collection with documents −
> db.demo380.insertOne({
...
... "details" : [
... {
... "Name" : "Chris",
... "details1" : [ ]
... },
... {
... ... | [
{
"code": null,
"e": 1180,
"s": 1062,
"text": "The addToSetoperatoraddsavaluetoanarrayunlessthevalueisalreadypresent,inwhichcaseaddToSet does nothing to that array."
},
{
"code": null,
"e": 1230,
"s": 1180,
"text": "Let us first create a collection with documents −"
},
{
... |
How to output JavaScript into a Textbox? | You can use the concept of value(). Following is the JavaScript code −
Live Demo
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.c... | [
{
"code": null,
"e": 1133,
"s": 1062,
"text": "You can use the concept of value(). Following is the JavaScript code −"
},
{
"code": null,
"e": 1144,
"s": 1133,
"text": " Live Demo"
},
{
"code": null,
"e": 2121,
"s": 1144,
"text": "<!DOCTYPE html>\n<html lang=\... |
Calculating median of an array in JavaScript | Following is the code for calculating median of an array in JavaScript −
Live Demo
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<style>
body {
font-family: "Segoe UI", Tahoma, Geneva, Verdana, ... | [
{
"code": null,
"e": 1135,
"s": 1062,
"text": "Following is the code for calculating median of an array in JavaScript −"
},
{
"code": null,
"e": 1146,
"s": 1135,
"text": " Live Demo"
},
{
"code": null,
"e": 2374,
"s": 1146,
"text": "<!DOCTYPE html>\n<html lang... |
10 Best Practices to Write Readable and Maintainable SQL Code | by David Martins | Towards Data Science | It’s easy to mess with SQL without proper guidelines. Since everybody in your team might have their own habits of writing SQL, you can quickly end up with a confusing code that nobody understands.
You probably realized the importance of following a set of good practices.May this article give you the guidance you’re loo... | [
{
"code": null,
"e": 369,
"s": 172,
"text": "It’s easy to mess with SQL without proper guidelines. Since everybody in your team might have their own habits of writing SQL, you can quickly end up with a confusing code that nobody understands."
},
{
"code": null,
"e": 502,
"s": 369,
... |
Node.js fs.accessSync() Method - GeeksforGeeks | 08 Oct, 2021
The fs.accessSync() method is used to synchronously test the permissions of a given file or directory. The permissions to be checked can be specified as a parameter using file access constants. It is also possible to check multiple file permissions by using the bitwise OR operator to create a mask with mor... | [
{
"code": null,
"e": 24071,
"s": 24043,
"text": "\n08 Oct, 2021"
},
{
"code": null,
"e": 24404,
"s": 24071,
"text": "The fs.accessSync() method is used to synchronously test the permissions of a given file or directory. The permissions to be checked can be specified as a paramete... |
C++ Program to Implement Fusion Tree | A fusion tree is a tree data structure that implements an associative array on w-bit integers. This is a C++ Program to Implement Fusion Tree Which generated an array of 6-bit integers on given binary tree as input.
Required functions and inputs −
Begin
Take the no of elements of the tree and take the elements.
C... | [
{
"code": null,
"e": 1278,
"s": 1062,
"text": "A fusion tree is a tree data structure that implements an associative array on w-bit integers. This is a C++ Program to Implement Fusion Tree Which generated an array of 6-bit integers on given binary tree as input."
},
{
"code": null,
"e": ... |
LIME: How to Interpret Machine Learning Models With Python | by Dario Radečić | Towards Data Science | Black-box models aren’t cool anymore. It’s easy to build great models nowadays, but what’s going on inside? That’s what Explainable AI and LIME try to uncover.
Don’t feel like reading? Check out my video on the topic:
Knowing why the model makes predictions the way it does is essential for tweaking. Just think about it... | [
{
"code": null,
"e": 332,
"s": 172,
"text": "Black-box models aren’t cool anymore. It’s easy to build great models nowadays, but what’s going on inside? That’s what Explainable AI and LIME try to uncover."
},
{
"code": null,
"e": 390,
"s": 332,
"text": "Don’t feel like reading? C... |
How to remove text from a label in Python? | 20 Jul, 2021
Prerequisite: Python GUI – tkinter
In this article, the Task is to remove the text from label, once text is initialized in Tkinter. Python offers multiple options for developing GUI (Graphical User Interface) out of which Tkinter is the most preferred means. It is a standard Python interface to the Tk GUI ... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n20 Jul, 2021"
},
{
"code": null,
"e": 63,
"s": 28,
"text": "Prerequisite: Python GUI – tkinter"
},
{
"code": null,
"e": 468,
"s": 63,
"text": "In this article, the Task is to remove the text from label, once text is ... |
Create a simple Animation using Turtle in Python | 20 Jan, 2022
Prerequisites: Turtle Programming in PythonTurtle is a Python feature like a drawing board, which lets us command a turtle to draw all over it! We can use functions like turtle.forward(...) and turtle.right(...) which can move the turtle around. Let’s create a basic animation where different little turtles... | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n20 Jan, 2022"
},
{
"code": null,
"e": 399,
"s": 52,
"text": "Prerequisites: Turtle Programming in PythonTurtle is a Python feature like a drawing board, which lets us command a turtle to draw all over it! We can use functions like turt... |
Open shortest path first (OSPF) router roles and configuration | 25 Oct, 2021
Prerequisite – Open shortest path first (OSPF)Open shortest path first (OSPF) is a link-state routing protocol which is used to find the best path between the source and the destination router using its own SPF algorithm.
Open shortest path first (OSPF) router roles –An area is a group of contiguous networ... | [
{
"code": null,
"e": 53,
"s": 25,
"text": "\n25 Oct, 2021"
},
{
"code": null,
"e": 275,
"s": 53,
"text": "Prerequisite – Open shortest path first (OSPF)Open shortest path first (OSPF) is a link-state routing protocol which is used to find the best path between the source and the ... |
ML | Voting Classifier using Sklearn | 25 Nov, 2019
A Voting Classifier is a machine learning model that trains on an ensemble of numerous models and predicts an output (class) based on their highest probability of chosen class as the output.It simply aggregates the findings of each classifier passed into Voting Classifier and predicts the output class base... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n25 Nov, 2019"
},
{
"code": null,
"e": 610,
"s": 28,
"text": "A Voting Classifier is a machine learning model that trains on an ensemble of numerous models and predicts an output (class) based on their highest probability of chosen class... |
Priority Queue in Python | 25 May, 2022
Priority Queues are abstract data structures where each data/value in the queue has a certain priority. For example, In airlines, baggage with the title “Business” or “First-class” arrives earlier than the rest.Priority Queue is an extension of the queue with the following properties.
An element with high ... | [
{
"code": null,
"e": 54,
"s": 26,
"text": "\n25 May, 2022"
},
{
"code": null,
"e": 340,
"s": 54,
"text": "Priority Queues are abstract data structures where each data/value in the queue has a certain priority. For example, In airlines, baggage with the title “Business” or “First-... |
How to find longitude and latitude for a list of Regions or Country using Python | 16 Jul, 2020
Geopy is a Python 2 and 3 client for several popular geocoding web services. Geocoding is the process to identify geographic coordinates like latitude and longitude of a given city/country/address. This is very useful during marking position on the map in data visualization. We use geopy.exec, geocodertime... | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n16 Jul, 2020"
},
{
"code": null,
"e": 432,
"s": 52,
"text": "Geopy is a Python 2 and 3 client for several popular geocoding web services. Geocoding is the process to identify geographic coordinates like latitude and longitude of a give... |
Python – Sum of different length Lists of list | 14 May, 2020
Getting the sum of list is quite common problem and has been dealt with and discussed many times, but sometimes, we require to better it and total sum, i.e. including those of nested list as well. Let’s try and get the total sum and solve this particular problem.
Method #1 : Using list comprehension + sum(... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n14 May, 2020"
},
{
"code": null,
"e": 292,
"s": 28,
"text": "Getting the sum of list is quite common problem and has been dealt with and discussed many times, but sometimes, we require to better it and total sum, i.e. including those of... |
How to Call a C function in Python | 12 Apr, 2021
Have you ever came across the situation where you have to call C function using python? This article is going to help you on a very basic level and if you have not come across any situation like this, you enjoy knowing how it is possible.First, let’s write one simple function using C and generate a shared ... | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n12 Apr, 2021"
},
{
"code": null,
"e": 416,
"s": 52,
"text": "Have you ever came across the situation where you have to call C function using python? This article is going to help you on a very basic level and if you have not come acros... |
Check if a large number is divisible by 8 or not | 23 May, 2022
Given a number, the task is to check if a number is divisible by 8 or not. The input number may be large and it may not be possible to store even if we use long long int.Examples:
Input : n = 1128
Output : Yes
Input : n = 1124
Output : No
Input : n = 363588395960667043875487
Output : No
Since input... | [
{
"code": null,
"e": 53,
"s": 25,
"text": "\n23 May, 2022"
},
{
"code": null,
"e": 235,
"s": 53,
"text": "Given a number, the task is to check if a number is divisible by 8 or not. The input number may be large and it may not be possible to store even if we use long long int.Exam... |
Lodash _.forEach() Method | 16 Sep, 2020
The _.forEach() method iterates over elements of collection and invokes iteratee for each element.
Syntax:
_.forEach( collection, [iteratee = _.identity] )
Parameters: This method accepts two parameters as mentioned above and described below:
collection: This parameter holds the collection to iterate over... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n16 Sep, 2020"
},
{
"code": null,
"e": 127,
"s": 28,
"text": "The _.forEach() method iterates over elements of collection and invokes iteratee for each element."
},
{
"code": null,
"e": 135,
"s": 127,
"text": "Syntax:... |
Removing whitespaces using Regex in Java | 29 Oct, 2021
Given a string, your task is to remove the whitespaces in the string using Java Regex (Regular Expressions).
Examples
Input : Hello Everyone .
Output : HelloEveryone.
Input : Geeks for Geeks .
Output : GeeksforGeeks.
Regular Expressions or Regex is an API for defining String patterns that can... | [
{
"code": null,
"e": 53,
"s": 25,
"text": "\n29 Oct, 2021"
},
{
"code": null,
"e": 162,
"s": 53,
"text": "Given a string, your task is to remove the whitespaces in the string using Java Regex (Regular Expressions)."
},
{
"code": null,
"e": 171,
"s": 162,
"text... |
Seaborn - Visualizing Pairwise Relationship | Datasets under real-time study contain many variables. In such cases, the relation between each and every variable should be analyzed. Plotting Bivariate Distribution for (n,2) combinations will be a very complex and time taking process.
To plot multiple pairwise bivariate distributions in a dataset, you can use the pa... | [
{
"code": null,
"e": 2411,
"s": 2173,
"text": "Datasets under real-time study contain many variables. In such cases, the relation between each and every variable should be analyzed. Plotting Bivariate Distribution for (n,2) combinations will be a very complex and time taking process."
},
{
"... |
Mockito - Overview | Mocking is a way to test the functionality of a class in isolation. Mocking does not require a database connection or properties file read or file server read to test a functionality. Mock objects do the mocking of the real service. A mock object returns a dummy data corresponding to some dummy input passed to it.
Mock... | [
{
"code": null,
"e": 2430,
"s": 2114,
"text": "Mocking is a way to test the functionality of a class in isolation. Mocking does not require a database connection or properties file read or file server read to test a functionality. Mock objects do the mocking of the real service. A mock object return... |
Difference between Array and String in Java | 02 Sep, 2020
An array is a collection of similar type of elements that are stored in a contiguous memory location. Arrays can contain primitives(int, char, etc) as well as object(non-primitives) references of a class depending upon the definition of the array. In the case of primitive data type, the actual values are s... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n02 Sep, 2020"
},
{
"code": null,
"e": 679,
"s": 28,
"text": "An array is a collection of similar type of elements that are stored in a contiguous memory location. Arrays can contain primitives(int, char, etc) as well as object(non-primi... |
Preorder from Inorder and Postorder traversals | 29 Jun, 2022
Given Inorder and Postorder traversals of a binary tree, print Preorder traversal. Example:
Input: Postorder traversal post[] = {4, 5, 2, 6, 3, 1}
Inorder traversal in[] = {4, 2, 5, 1, 3, 6}
Output: Preorder traversal 1, 2, 4, 5, 3, 6
Traversals in the above example represents following tree
... | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n29 Jun, 2022"
},
{
"code": null,
"e": 144,
"s": 52,
"text": "Given Inorder and Postorder traversals of a binary tree, print Preorder traversal. Example:"
},
{
"code": null,
"e": 435,
"s": 144,
"text": "Input: Postor... |
Introduction to Morgan.js | 15 Dec, 2021
Morgan is a middleware that logs HTTP requests and errors. Middleware is simply a function that has access to the request and response lifecycle methods. We can either use predefined formats or create new ones to format our logs.
Installation of morgan:
Step 1: You can visit morgan for the documentation. T... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n15 Dec, 2021"
},
{
"code": null,
"e": 258,
"s": 28,
"text": "Morgan is a middleware that logs HTTP requests and errors. Middleware is simply a function that has access to the request and response lifecycle methods. We can either use pre... |
Teradata - JOIN strategies | This chapter discusses the various JOIN strategies available in Teradata.
Teradata uses different join methods to perform join operations. Some of the commonly used Join methods are −
Merge Join
Nested Join
Product Join
Merge Join method takes place when the join is based on the equality condition. Merge Join requires ... | [
{
"code": null,
"e": 2838,
"s": 2764,
"text": "This chapter discusses the various JOIN strategies available in Teradata."
},
{
"code": null,
"e": 2948,
"s": 2838,
"text": "Teradata uses different join methods to perform join operations. Some of the commonly used Join methods are ... |
C# | IndexOfAny() Method | 30 Jul, 2021
In C#, IndexOfAny() method is a String Method. It is used to search the specified character index present in the string which will be the first occurrence from start index. It returns index as an integer value. This method can be overloaded by changing the number of arguments passed to it.
IndexOfAny Metho... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n30 Jul, 2021"
},
{
"code": null,
"e": 319,
"s": 28,
"text": "In C#, IndexOfAny() method is a String Method. It is used to search the specified character index present in the string which will be the first occurrence from start index. It... |
Python - Diagonal element addition among lists - GeeksforGeeks | 26 Mar, 2020
Sometimes, while working with Python lists, we can have a problem in which we need to perform addition of lists in diagonal manner that i.e. adding ith element of 1 list to i + 1 element of other list. This kind of problem can have application in day-day programming. Lets discuss certain ways in which this... | [
{
"code": null,
"e": 24318,
"s": 24290,
"text": "\n26 Mar, 2020"
},
{
"code": null,
"e": 24649,
"s": 24318,
"text": "Sometimes, while working with Python lists, we can have a problem in which we need to perform addition of lists in diagonal manner that i.e. adding ith element of ... |
Vision Transformers in PyTorch. When convolutions stopped being a... | by Ta-Ying Cheng | Towards Data Science | Convolutional neural networks (CNNs) have been the pre-dominant backbone for almost all networks used in computer vision and image-related tasks due to the advantages they have in 2D neighbourhood awareness and translation equivariance compared to traditional multi-layer perceptrons (MLPs). However, with the recent shi... | [
{
"code": null,
"e": 656,
"s": 172,
"text": "Convolutional neural networks (CNNs) have been the pre-dominant backbone for almost all networks used in computer vision and image-related tasks due to the advantages they have in 2D neighbourhood awareness and translation equivariance compared to traditi... |
MySQL Tryit Editor v1.0 | SELECT COALESCE(NULL, 1, 2, 'W3Schools.com');
Edit the SQL Statement, and click "Run SQL" to see the result.
This SQL-Statement is not supported in the WebSQL Database.
The example still works, because it uses a modified version of SQL.
Your browser does not support WebSQL.
Your are now using a light-version... | [
{
"code": null,
"e": 46,
"s": 0,
"text": "SELECT COALESCE(NULL, 1, 2, 'W3Schools.com');"
},
{
"code": null,
"e": 48,
"s": 46,
"text": ""
},
{
"code": null,
"e": 120,
"s": 57,
"text": "Edit the SQL Statement, and click \"Run SQL\" to see the result."
},
{
... |
Combine Vectors, Matrix or Data Frames by Columns in R Language - cbind() Function - GeeksforGeeks | 01 Jun, 2020
cbind() function in R Language is used to combine specified Vector, Matrix or Data Frame by columns.
Syntax: cbind(x1, x2, ..., deparse.level = 1)
Parameters:x1, x2: vector, matrix, data framesdeparse.level: This value determines how the column names generated. The default value of deparse.level is 1.
Exam... | [
{
"code": null,
"e": 24852,
"s": 24824,
"text": "\n01 Jun, 2020"
},
{
"code": null,
"e": 24953,
"s": 24852,
"text": "cbind() function in R Language is used to combine specified Vector, Matrix or Data Frame by columns."
},
{
"code": null,
"e": 24999,
"s": 24953,
... |
How to Install C++ Compiler on Linux? | There are several alternatives for compiling C++ on Linux. Let's look at 2 of them −
Almost all Linux distros come with GCC installed. Check whether GCC is installed on your system by entering the following command from the command line −
$ g++ -v
If you have installed GCC, then it should print a message such as the fo... | [
{
"code": null,
"e": 1147,
"s": 1062,
"text": "There are several alternatives for compiling C++ on Linux. Let's look at 2 of them −"
},
{
"code": null,
"e": 1301,
"s": 1147,
"text": "Almost all Linux distros come with GCC installed. Check whether GCC is installed on your system b... |
Java Inheritance | Practice | GeeksforGeeks | Inheritance is an important pillar of OOP(Object Oriented Programming). It is the mechanism in java by which one class is allow to inherit the features(fields and methods) of another class.
Consider the following class cls1:
class cls1
{
void add(int p,int q){
System.out.println(p+q);
}
}
There is anoth... | [
{
"code": null,
"e": 416,
"s": 226,
"text": "Inheritance is an important pillar of OOP(Object Oriented Programming). It is the mechanism in java by which one class is allow to inherit the features(fields and methods) of another class."
},
{
"code": null,
"e": 532,
"s": 416,
"text... |
Java Program to check if a file or directory is readable | The method java.io.File.canRead() is used to check if a file or directory is readable in Java. This method returns true if the file specified by the abstract path name can be read by an application and false otherwise.
A program that demonstrates this is given as follows −
Live Demo
import java.io.File;
public class D... | [
{
"code": null,
"e": 1281,
"s": 1062,
"text": "The method java.io.File.canRead() is used to check if a file or directory is readable in Java. This method returns true if the file specified by the abstract path name can be read by an application and false otherwise."
},
{
"code": null,
"e... |
What is the difference between "var" and "val" in Kotlin? | In Kotlin, we can declare a variable using two different keywords: one is var and the other one is val. In this article, we will take an example and demonstrate how these declarations are different from each other.
In the following example, we will see how we can declare two different variables using "val" and "var". W... | [
{
"code": null,
"e": 1277,
"s": 1062,
"text": "In Kotlin, we can declare a variable using two different keywords: one is var and the other one is val. In this article, we will take an example and demonstrate how these declarations are different from each other."
},
{
"code": null,
"e": 1... |
How to perform shapiro test for all columns in an R data frame? | The shapiro test is used to test for the normality of variables and the null hypothesis for this test is the variable is normally distributed. If we have numerical columns in an R data frame then we might to check the normality of all the variables. This can be done with the help of apply function and shapiro.test as s... | [
{
"code": null,
"e": 1409,
"s": 1062,
"text": "The shapiro test is used to test for the normality of variables and the null hypothesis for this test is the variable is normally distributed. If we have numerical columns in an R data frame then we might to check the normality of all the variables. Thi... |
How to close all the opened files using Python? | There is no way in python natively to track all opened files. To do that you should either track all the files yourself or always use the with statement to open files which automatically closes the file as it goes out of scope or encounters an error.
with open('file.txt') as f:
# do something with f here
You can al... | [
{
"code": null,
"e": 1313,
"s": 1062,
"text": "There is no way in python natively to track all opened files. To do that you should either track all the files yourself or always use the with statement to open files which automatically closes the file as it goes out of scope or encounters an error."
... |
Lambda Expressions in C# | 02 Dec, 2021
Lambda expressions in C# are used like anonymous functions, with the difference that in Lambda expressions you don’t need to specify the type of the value that you input thus making it more flexible to use. The ‘=>’ is the lambda operator which is used in all lambda expressions. The Lambda expression is di... | [
{
"code": null,
"e": 54,
"s": 26,
"text": "\n02 Dec, 2021"
},
{
"code": null,
"e": 443,
"s": 54,
"text": "Lambda expressions in C# are used like anonymous functions, with the difference that in Lambda expressions you don’t need to specify the type of the value that you input thus... |
Designing Finite Automata from Regular Expression (Set 4) | 26 Nov, 2021
Prerequisite: Finite automata, Regular expressions, grammar and language, Designing finite automata from Regular expression (Set 3)
In the below article, we shall see some Designing of Finite Automata form the given Regular Expression-
Regular Expression 1: Regular language,
L1 = (a+b)(a+b)
The langua... | [
{
"code": null,
"e": 53,
"s": 25,
"text": "\n26 Nov, 2021"
},
{
"code": null,
"e": 186,
"s": 53,
"text": "Prerequisite: Finite automata, Regular expressions, grammar and language, Designing finite automata from Regular expression (Set 3) "
},
{
"code": null,
"e": 291,... |
Command Line Interface Programming in Python | 07 Mar, 2022
This article discusses how you can create a CLI for your python programs using an example in which we make a basic “text file manager”. Let us discuss some basics first.
What is a Command Line Interface(CLI)?
A command-line interface or command language interpreter (CLI), also known as command-line user ... | [
{
"code": null,
"e": 54,
"s": 26,
"text": "\n07 Mar, 2022"
},
{
"code": null,
"e": 226,
"s": 54,
"text": "This article discusses how you can create a CLI for your python programs using an example in which we make a basic “text file manager”. Let us discuss some basics first. "
... |
Tail Recursion in Scala | 19 Jul, 2019
Recursion is a method which breaks the problem into smaller subproblems and calls itself for each of the problems. That is, it simply means function calling itself. The tail recursive functions better than non tail recursive functions because tail-recursion can be optimized by compiler. A recursive functio... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n19 Jul, 2019"
},
{
"code": null,
"e": 483,
"s": 28,
"text": "Recursion is a method which breaks the problem into smaller subproblems and calls itself for each of the problems. That is, it simply means function calling itself. The tail r... |
Lodash _.reduce() Method | 06 Sep, 2020
Lodash is a JavaScript library that works on the top of underscore.js. Lodash helps in working with arrays, collection, strings, objects, numbers etc.The _.reduce() method reduces collection to value which is accumulated result of running each element in the collection through iteratee, where each successi... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n06 Sep, 2020"
},
{
"code": null,
"e": 608,
"s": 28,
"text": "Lodash is a JavaScript library that works on the top of underscore.js. Lodash helps in working with arrays, collection, strings, objects, numbers etc.The _.reduce() method red... |
HTML | Marquee hspace attribute - GeeksforGeeks | 20 Jan, 2022
The Marquee hspace attribute in HTML is used to set the horizontal margin. A given value is used to set the space between the marquee element and other contents.
Note: This attribute is not supported by HTML5. Syntax:
<marquee hspace="px/%" >
Attribute value:
px: Specify horizontal space around marquee... | [
{
"code": null,
"e": 24503,
"s": 24475,
"text": "\n20 Jan, 2022"
},
{
"code": null,
"e": 24665,
"s": 24503,
"text": "The Marquee hspace attribute in HTML is used to set the horizontal margin. A given value is used to set the space between the marquee element and other contents."
... |
GATE | GATE-CS-2003 | Question 30 - GeeksforGeeks | 14 Feb, 2018
Consider the following SQL query
select distinct al, a2,........., an
from r1, r2,........, rm
where P
For an arbitrary predicate P, this query is equivalent to which of the following relational algebra expressions ?A: B: C: D: (A) A(B) B(C) C(D) DAnswer: (A)Explanation:Cross product (x) combines the tupl... | [
{
"code": null,
"e": 24075,
"s": 24047,
"text": "\n14 Feb, 2018"
},
{
"code": null,
"e": 24108,
"s": 24075,
"text": "Consider the following SQL query"
},
{
"code": null,
"e": 24179,
"s": 24108,
"text": "select distinct al, a2,........., an\nfrom r1, r2,.......... |
How to convert Python DateTime string into integer milliseconds? | You can get the current time in milliseconds in Python using the time module. You can get the time in seconds using time.time function(as a floating point value). To convert it to milliseconds, you need to multiply it with 1000 and round it off.
import time
milliseconds = int(round(time.time() * 1000))
print(millisecon... | [
{
"code": null,
"e": 1308,
"s": 1062,
"text": "You can get the current time in milliseconds in Python using the time module. You can get the time in seconds using time.time function(as a floating point value). To convert it to milliseconds, you need to multiply it with 1000 and round it off."
},
... |
How to convert OpenCV Mat object to BufferedImage object using Java? | If you try to read an image using the OpenCV imread() method it returns a Mat object. If you want to display the contents of the resultant Mat object using an AWT/Swings window You need to convert the Mat object to an object of the class java.awt.image.BufferedImage. To do so, you need to follow the steps given below −... | [
{
"code": null,
"e": 1383,
"s": 1062,
"text": "If you try to read an image using the OpenCV imread() method it returns a Mat object. If you want to display the contents of the resultant Mat object using an AWT/Swings window You need to convert the Mat object to an object of the class java.awt.image.... |
How to reverse a string using lambda expression in Java? | A String is an object that represents a sequence of characters and immutable in Java. We can reverse a string entered by the user using the charAt() method of String class to extract characters from the string and append them in reverse order to reverse the entered string.
In the below example, we need to reverse a str... | [
{
"code": null,
"e": 1336,
"s": 1062,
"text": "A String is an object that represents a sequence of characters and immutable in Java. We can reverse a string entered by the user using the charAt() method of String class to extract characters from the string and append them in reverse order to reverse... |
How can we specify default values in MySQL INSERT statement? | At the time of creation of a table, if any column is defined with default values then by using the keyword ‘DEFAULT’ in the INSERT statement, we can take default value for that column. For example, we have created a table ‘employee’ with a default value of column ‘DOJ’ as follows −
mysql> Create table employee(id int, ... | [
{
"code": null,
"e": 1345,
"s": 1062,
"text": "At the time of creation of a table, if any column is defined with default values then by using the keyword ‘DEFAULT’ in the INSERT statement, we can take default value for that column. For example, we have created a table ‘employee’ with a default value... |
C++ program to calculate Profit Or Loss | Given with the cost price(CP) and the selling price(SP) and the task is to calculate the profit gained or loss incurred.
Cost price or CP is the price at which the product is purchased by the seller and the selling price or SP is the price at which the product is sold by the seller.
There is a formula to calculate prof... | [
{
"code": null,
"e": 1183,
"s": 1062,
"text": "Given with the cost price(CP) and the selling price(SP) and the task is to calculate the profit gained or loss incurred."
},
{
"code": null,
"e": 1346,
"s": 1183,
"text": "Cost price or CP is the price at which the product is purchas... |
How do I change focus to a new popup tab in Selenium? | We can change focus to a new popup tab with Selenium webdriver. The getWindowHandles and getWindowHandle methods are available to handle new popup tabs. The getWindowHandles method stores all the currently opened window handles in Set data structure.
The getWindowHandle method stores the window handle of the opened bro... | [
{
"code": null,
"e": 1313,
"s": 1062,
"text": "We can change focus to a new popup tab with Selenium webdriver. The getWindowHandles and getWindowHandle methods are available to handle new popup tabs. The getWindowHandles method stores all the currently opened window handles in Set data structure."
... |
Batch Script - SORT | This batch command takes the input from a source file and sorts its contents alphabetically, from A to Z or Z to A. It prints the output on the console.
Sort [filename]
Where filename is the file whose contents need to be sorted.
@echo off
Sort C:\tp\lists.txt
Print
Add Notes
Bookmark this page | [
{
"code": null,
"e": 2322,
"s": 2169,
"text": "This batch command takes the input from a source file and sorts its contents alphabetically, from A to Z or Z to A. It prints the output on the console."
},
{
"code": null,
"e": 2339,
"s": 2322,
"text": "Sort [filename]\n"
},
{
... |
Check if given Sudoku solution is valid or not - GeeksforGeeks | 08 Jul, 2021
Given a 2D array, board[][] of size 9 × 9, which represents a solution to the Sudoku puzzle, the task is to check if the given representation of a solved Sudoku puzzle is valid or not.
Examples:
Input:
board[][] = {{7, 9, 2, 1, 5, 4, 3, 8, 6},
{6, 4, 3, 8, 2, 7, 1, 5, 9},
{8, 5,... | [
{
"code": null,
"e": 25330,
"s": 25302,
"text": "\n08 Jul, 2021"
},
{
"code": null,
"e": 25515,
"s": 25330,
"text": "Given a 2D array, board[][] of size 9 × 9, which represents a solution to the Sudoku puzzle, the task is to check if the given representation of a solved Sudoku pu... |
Batch Script - If/else Statement | The next decision making statement is the If/else statement. Following is the general form of this statement.
If (condition) (do_something) ELSE (do_something_else)
The general working of this statement is that first a condition is evaluated in the ‘if’ statement. If the condition is true, it then executes the stateme... | [
{
"code": null,
"e": 2279,
"s": 2169,
"text": "The next decision making statement is the If/else statement. Following is the general form of this statement."
},
{
"code": null,
"e": 2335,
"s": 2279,
"text": "If (condition) (do_something) ELSE (do_something_else)\n"
},
{
"... |
D3 and R, a match made in heaven. A step by step tutorial for converting... | by Kendon Darlington | Towards Data Science | You have seen the gorgeous D3 graphs galleries. You have seen the amazing infographics on the New York Times website. Maybe, you felt inspired and went through a few D3 tutorials, bought an online course or a book on the topic. And most likely you have thrown your hands up in frustration when you learned the cold, hard... | [
{
"code": null,
"e": 500,
"s": 172,
"text": "You have seen the gorgeous D3 graphs galleries. You have seen the amazing infographics on the New York Times website. Maybe, you felt inspired and went through a few D3 tutorials, bought an online course or a book on the topic. And most likely you have th... |
C# OfType() Method | Filter a collection on the basis of each of its elements type.
Let’s say you have the following list with integer and string elements −
list.Add("Katie");
list.Add(100);
list.Add(200);
To filter collection and get only elements with string type.
var myStr = from a in list.OfType<string>() select a;
Work the same for in... | [
{
"code": null,
"e": 1125,
"s": 1062,
"text": "Filter a collection on the basis of each of its elements type."
},
{
"code": null,
"e": 1198,
"s": 1125,
"text": "Let’s say you have the following list with integer and string elements −"
},
{
"code": null,
"e": 1247,
... |
How to create custom color maps in Java using OpenCV? | The applyColorMap() method of the Imgproc class applies specified color map to the given image. This method accepts three parameters −
Two Mat objects representing the source and destination images.
Two Mat objects representing the source and destination images.
An integer variable representing the type of the color ma... | [
{
"code": null,
"e": 1197,
"s": 1062,
"text": "The applyColorMap() method of the Imgproc class applies specified color map to the given image. This method accepts three parameters −"
},
{
"code": null,
"e": 1261,
"s": 1197,
"text": "Two Mat objects representing the source and des... |
Laravel - Middleware | Middleware acts as a bridge between a request and a response. It is a type of filtering mechanism. This chapter explains you the middleware mechanism in Laravel.
Laravel includes a middleware that verifies whether the user of the application is authenticated or not. If the user is authenticated, it redirects to the hom... | [
{
"code": null,
"e": 2634,
"s": 2472,
"text": "Middleware acts as a bridge between a request and a response. It is a type of filtering mechanism. This chapter explains you the middleware mechanism in Laravel."
},
{
"code": null,
"e": 2850,
"s": 2634,
"text": "Laravel includes a m... |
Contrastive Loss Explained. Contrastive loss has been used recently... | by Brian Williams | Towards Data Science | Contrastive loss has been used recently in a number of papers showing state of the art results with unsupervised learning. MoCo, PIRL, and SimCLR all follow very similar patterns of using a siamese network with contrastive loss. When reading these papers I found that the general idea was very straight forward but the t... | [
{
"code": null,
"e": 789,
"s": 171,
"text": "Contrastive loss has been used recently in a number of papers showing state of the art results with unsupervised learning. MoCo, PIRL, and SimCLR all follow very similar patterns of using a siamese network with contrastive loss. When reading these papers ... |
Delete Operation in B-Tree - GeeksforGeeks | 23 Feb, 2022
It is recommended to refer following posts as prerequisite of this post.B-Tree | Set 1 (Introduction) B-Tree | Set 2 (Insert)B-Tree is a type of a multi-way search tree. So, if you are not familiar with multi-way search trees in general, it is better to take a look at this video lecture from IIT-Delhi, bef... | [
{
"code": null,
"e": 29704,
"s": 29676,
"text": "\n23 Feb, 2022"
},
{
"code": null,
"e": 34483,
"s": 29704,
"text": "It is recommended to refer following posts as prerequisite of this post.B-Tree | Set 1 (Introduction) B-Tree | Set 2 (Insert)B-Tree is a type of a multi-way search... |
Java Program to calculate Sum of squares of first n natural numbers | To calculate the sum of squares of first n natural numbers, the Java code is as follows −
Live Demo
import java.io.*;
import java.util.*;
public class Demo{
public static int sum_of_squares(int val){
return (val * (val + 1) / 2) * (2 * val + 1) / 3;
}
public static void main(String[] args){
int va... | [
{
"code": null,
"e": 1152,
"s": 1062,
"text": "To calculate the sum of squares of first n natural numbers, the Java code is as follows −"
},
{
"code": null,
"e": 1163,
"s": 1152,
"text": " Live Demo"
},
{
"code": null,
"e": 1522,
"s": 1163,
"text": "import jav... |
File.WriteAllText(String, String, Encoding) Method in C# with Examples - GeeksforGeeks | 01 Jun, 2020
File.WriteAllText(String, String, Encoding) is an inbuilt File class method that is used to create a new file, writes the specified string to the file using the specified encoding, and then closes the file. If the target file already exists, it is overwritten.
Syntax:
public static void WriteAllText (strin... | [
{
"code": null,
"e": 24816,
"s": 24788,
"text": "\n01 Jun, 2020"
},
{
"code": null,
"e": 25077,
"s": 24816,
"text": "File.WriteAllText(String, String, Encoding) is an inbuilt File class method that is used to create a new file, writes the specified string to the file using the sp... |
C# | Remove the first occurrence of a specific object from the ArrayList - GeeksforGeeks | 20 Nov, 2019
ArrayList represents an ordered collection of an object that can be indexed individually. It is basically an alternative to an array. It also allows dynamic memory allocation, adding, searching and sorting items in the list. ArrayList.Remove(Object) method is used to remove the first occurrence of a specif... | [
{
"code": null,
"e": 24302,
"s": 24274,
"text": "\n20 Nov, 2019"
},
{
"code": null,
"e": 24639,
"s": 24302,
"text": "ArrayList represents an ordered collection of an object that can be indexed individually. It is basically an alternative to an array. It also allows dynamic memory... |
Distributed Kafka Consumers Using Ray — Python | by Bikas Katwal | Towards Data Science | Through this blog, I will try to give a gist of —
a few Ray components that we will be using
then work towards how we can use Ray to create Distributed Kafka Consumers for our Stream processing. Providing at least one guarantee.
and finally, expose REST APIs to manage these consumers.
Many teams are using python on dai... | [
{
"code": null,
"e": 222,
"s": 172,
"text": "Through this blog, I will try to give a gist of —"
},
{
"code": null,
"e": 265,
"s": 222,
"text": "a few Ray components that we will be using"
},
{
"code": null,
"e": 401,
"s": 265,
"text": "then work towards how we... |
Find and replace a part of URL records in MySQL? | The simplest way to replace records is using MySQL REPLACE() −
mysql> create table DemoTable2025
-> (
-> URL text
-> );
Query OK, 0 rows affected (0.88 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable2025 values('http=//www.facebook.com');
Query OK, 1 row affected (0.23... | [
{
"code": null,
"e": 1125,
"s": 1062,
"text": "The simplest way to replace records is using MySQL REPLACE() −"
},
{
"code": null,
"e": 1228,
"s": 1125,
"text": "mysql> create table DemoTable2025\n -> (\n -> URL text\n -> );\nQuery OK, 0 rows affected (0.88 sec)"
},
{
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.