title stringlengths 3 221 | text stringlengths 17 477k | parsed listlengths 0 3.17k |
|---|---|---|
Python | Subtraction of dictionaries | 27 Aug, 2021
Sometimes, while working with dictionaries, we might have a utility problem in which we need to perform elementary operations among the common keys of dictionaries. This can be extended to any operation to be performed. Let’s discuss subtraction of like key values and ways to solve it in this article.
The... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n27 Aug, 2021"
},
{
"code": null,
"e": 332,
"s": 28,
"text": "Sometimes, while working with dictionaries, we might have a utility problem in which we need to perform elementary operations among the common keys of dictionaries. This can b... |
Multiply two numbers represented by Linked Lists | 22 Jun, 2022
Given two numbers represented by linked lists, write a function that returns the multiplication of these two linked lists.
Examples:
Input : 9->4->6
8->4
Output : 79464
Input : 3->2->1
1->2
Output : 3852
Solution: Traverse both lists and generate the required numbers to be multiplied and ... | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n22 Jun, 2022"
},
{
"code": null,
"e": 175,
"s": 52,
"text": "Given two numbers represented by linked lists, write a function that returns the multiplication of these two linked lists."
},
{
"code": null,
"e": 186,
"s": ... |
Difference between the COPY and ADD commands in a Dockerfile | 10 May, 2022
When creating Dockerfiles, it’s often necessary to transfer files from the host system into the Docker image. These could be property files, native libraries, or other static content that our applications will require at runtime.
The Dockerfile specification provides two ways to copy files from the source ... | [
{
"code": null,
"e": 53,
"s": 25,
"text": "\n10 May, 2022"
},
{
"code": null,
"e": 283,
"s": 53,
"text": "When creating Dockerfiles, it’s often necessary to transfer files from the host system into the Docker image. These could be property files, native libraries, or other static... |
How to close all activities at once in android? | This example demonstrates how do I close all activities at once in android app.
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"?>
<Relativ... | [
{
"code": null,
"e": 1142,
"s": 1062,
"text": "This example demonstrates how do I close all activities at once in android app."
},
{
"code": null,
"e": 1271,
"s": 1142,
"text": "Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required detail... |
Simulating Tennis Matches with Python or Moneyball for Tennis | by Osho Jha | Towards Data Science | Over the past few months, I’ve thought a lot about sports betting. Sure the regulatory changes help, but mostly it’s hard for me to look at a problem with so much widely available data and not attempt it.
I grew up both playing and watching tennis. When I started really getting into the sport, Pete Sampras’s had more o... | [
{
"code": null,
"e": 377,
"s": 172,
"text": "Over the past few months, I’ve thought a lot about sports betting. Sure the regulatory changes help, but mostly it’s hard for me to look at a problem with so much widely available data and not attempt it."
},
{
"code": null,
"e": 1506,
"s"... |
RESTful Web Services - First Application | Let us start writing the actual RESTful web services with Jersey Framework. Before you start writing your first example using the Jersey Framework, you have to make sure that you have setup your Jersey environment properly as explained in the RESTful Web Services - Environment Setup chapter. Here, I am also assuming th... | [
{
"code": null,
"e": 2230,
"s": 1855,
"text": "Let us start writing the actual RESTful web services with Jersey Framework. Before you start writing your first example using the Jersey Framework, you have to make sure that you have setup your Jersey environment properly as explained in the RESTful We... |
SAP ABAP - Polymorphism | The term polymorphism literally means ‘many forms’. From an object-oriented perspective, polymorphism works in conjunction with inheritance to make it possible for various types within an inheritance tree to be used interchangeably. That is, polymorphism occurs when there is a hierarchy of classes and they are related ... | [
{
"code": null,
"e": 3384,
"s": 2898,
"text": "The term polymorphism literally means ‘many forms’. From an object-oriented perspective, polymorphism works in conjunction with inheritance to make it possible for various types within an inheritance tree to be used interchangeably. That is, polymorphis... |
Teradata - SET Operators | SET operators combine results from multiple SELECT statement. This may look similar to Joins, but joins combines columns from multiple tables whereas SET operators combines rows from multiple rows.
The number of columns from each SELECT statement should be same.
The number of columns from each SELECT statement should b... | [
{
"code": null,
"e": 2828,
"s": 2630,
"text": "SET operators combine results from multiple SELECT statement. This may look similar to Joins, but joins combines columns from multiple tables whereas SET operators combines rows from multiple rows."
},
{
"code": null,
"e": 2893,
"s": 282... |
How to get top values of a numerical column of an R data frame in decreasing order? | To get the top values in an R data frame, we can use the head function and if we want the values in decreasing order then sort function will be required. Therefore, we need to use the combination of head and sort function to find the top values in decreasing order. For example, if we have a data frame df that contains ... | [
{
"code": null,
"e": 1497,
"s": 1062,
"text": "To get the top values in an R data frame, we can use the head function and if we want the values in decreasing order then sort function will be required. Therefore, we need to use the combination of head and sort function to find the top values in decre... |
How to Analyze a PDF with the layout-parser package. | by Brendan Ferris | Towards Data Science | I recently was involved with a project that required parsing of a PDF in order to identify the regions of page and return the text from those regions. The text regions would then be fed to a Q/A model (farm-haystack), and return extracted data from the PDF. Essentially, we wanted the computer to read PDF’s for us and t... | [
{
"code": null,
"e": 772,
"s": 172,
"text": "I recently was involved with a project that required parsing of a PDF in order to identify the regions of page and return the text from those regions. The text regions would then be fed to a Q/A model (farm-haystack), and return extracted data from the PD... |
text preprocessing using scikit-learn and spaCy | Towards Data Science | Text preprocessing is the process of getting the raw text into a form which can be vectorized and subsequently consumed by machine learning algorithms for natural language processing (NLP) tasks such as text classification, topic modeling, name entity recognition etc.
Raw text extensively preprocessed by all text analy... | [
{
"code": null,
"e": 440,
"s": 171,
"text": "Text preprocessing is the process of getting the raw text into a form which can be vectorized and subsequently consumed by machine learning algorithms for natural language processing (NLP) tasks such as text classification, topic modeling, name entity rec... |
Creating and training a U-Net model with PyTorch for 2D & 3D semantic segmentation: Model building [2/4] | by Johannes Schmidt | Towards Data Science | In the previous chapter we built a dataloader that picks up our images and performs some transformations and augmentations so that they can be fed in batches to a neural network like the U-Net. In this part, we focus on building a U-Net from scratch with the PyTorch library. The goal is to implement the U-Net in such a... | [
{
"code": null,
"e": 630,
"s": 171,
"text": "In the previous chapter we built a dataloader that picks up our images and performs some transformations and augmentations so that they can be fed in batches to a neural network like the U-Net. In this part, we focus on building a U-Net from scratch with ... |
Java String indexOf() Method | ❮ String Methods
Search a string for the first occurrence of "planet":
String myStr = "Hello planet earth, you are a great planet.";
System.out.println(myStr.indexOf("planet"));
Try it Yourself »
The indexOf() method returns the position of the first occurrence of specified character(s) in a string.
Tip: Use the las... | [
{
"code": null,
"e": 19,
"s": 0,
"text": "\n❮ String Methods\n"
},
{
"code": null,
"e": 73,
"s": 19,
"text": "Search a string for the first occurrence of \"planet\":"
},
{
"code": null,
"e": 180,
"s": 73,
"text": "String myStr = \"Hello planet earth, you are a... |
C# | How to play Beep sound through Console - GeeksforGeeks | 29 Jan, 2019
Given a normal Console in C#, the task is to play Beep sound through the Console.
Approach: This can be achieved with the help of Beep() method of Console Class in System package of C#.
The Beep() method of Console Class is used to play a Beep sound through the Console speaker.
Syntax: public static void B... | [
{
"code": null,
"e": 24717,
"s": 24689,
"text": "\n29 Jan, 2019"
},
{
"code": null,
"e": 24799,
"s": 24717,
"text": "Given a normal Console in C#, the task is to play Beep sound through the Console."
},
{
"code": null,
"e": 24903,
"s": 24799,
"text": "Approach... |
Python – Split a String by Custom Lengths | 11 Oct, 2020
Given a String, perform split of strings on the basis of custom lengths.
Input : test_str = ‘geeksforgeeks’, cus_lens = [4, 3, 2, 3, 1] Output : [‘geek’, ‘sfo’, ‘rg’, ‘eek’, ‘s’] Explanation : Strings separated by custom lengths.Input : test_str = ‘geeksforgeeks’, cus_lens = [10, 3] Output : [‘geeksforge’,... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n11 Oct, 2020"
},
{
"code": null,
"e": 101,
"s": 28,
"text": "Given a String, perform split of strings on the basis of custom lengths."
},
{
"code": null,
"e": 396,
"s": 101,
"text": "Input : test_str = ‘geeksforgeeks... |
Implementing Photomosaics | 27 Dec, 2021
Introduction
A photomosaic is an image split into a grid of rectangles, with each replaced by another image that matches the target (the image you ultimately want to appear in the photomosaic). In other words, if you look at a photomosaic from a distance, you see the target image; but if you come closer, y... | [
{
"code": null,
"e": 54,
"s": 26,
"text": "\n27 Dec, 2021"
},
{
"code": null,
"e": 67,
"s": 54,
"text": "Introduction"
},
{
"code": null,
"e": 477,
"s": 67,
"text": "A photomosaic is an image split into a grid of rectangles, with each replaced by another image... |
Difference between Public and Private blockchain | 11 May, 2022
1. What is Public Blockchain ? Public blockchains are open networks that allow anyone to participate in the network i.e. public blockchain is permissionless. In this type of blockchain anyone can join the network and read, write, or participate within the blockchain. A public blockchain is decentralized an... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n11 May, 2022"
},
{
"code": null,
"e": 530,
"s": 28,
"text": "1. What is Public Blockchain ? Public blockchains are open networks that allow anyone to participate in the network i.e. public blockchain is permissionless. In this type of b... |
Calculate the Sum of Matrix or Array columns in R Programming – colSums() Function | 03 Jun, 2020
colSums() function in R Language is used to compute the sums of matrix or array columns.
Syntax: colSums (x, na.rm = FALSE, dims = 1)
Parameters:x: matrix or arraydims: this is integer value whose dimensions are regarded as ‘columns’ to sum over. It is over dimensions 1:dims.
Example 1:
# R program to illu... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n03 Jun, 2020"
},
{
"code": null,
"e": 117,
"s": 28,
"text": "colSums() function in R Language is used to compute the sums of matrix or array columns."
},
{
"code": null,
"e": 162,
"s": 117,
"text": "Syntax: colSums (... |
Check whether a Numpy array contains a specified row | 05 Sep, 2020
In this article we will learn about checking a specified row is in NumPy array or not. If the given list is present in a NumPy array as a row then the output is True else False. The list is present in a NumPy array means any row of that numpy array matches with the given list with all elements in given ord... | [
{
"code": null,
"e": 53,
"s": 25,
"text": "\n05 Sep, 2020"
},
{
"code": null,
"e": 558,
"s": 53,
"text": "In this article we will learn about checking a specified row is in NumPy array or not. If the given list is present in a NumPy array as a row then the output is True else Fal... |
Sum of dependencies in a graph
| 08 Jul, 2022
Given a directed and connected graph with n nodes. If there is an edge from u to v then u depends on v. Our task was to find out the sum of dependencies for every node.
Example:
For the graph in diagram,
A depends on C and D i.e. 2
B depends on C i.e. 1
D depends on C i.e. 1
And C depends on none.
... | [
{
"code": null,
"e": 58,
"s": 27,
"text": " \n08 Jul, 2022\n"
},
{
"code": null,
"e": 228,
"s": 58,
"text": "Given a directed and connected graph with n nodes. If there is an edge from u to v then u depends on v. Our task was to find out the sum of dependencies for every node. "
... |
Python | Remove last character in list of strings - GeeksforGeeks | 15 Mar, 2019
Sometimes, we come across an issue in which we require to delete the last character from each string, that we might have added by mistake and we need to extend this to the whole list. This type of utility is common in web development. Having shorthands to perform this particular job is always a plus. Let’s... | [
{
"code": null,
"e": 24938,
"s": 24910,
"text": "\n15 Mar, 2019"
},
{
"code": null,
"e": 25298,
"s": 24938,
"text": "Sometimes, we come across an issue in which we require to delete the last character from each string, that we might have added by mistake and we need to extend thi... |
Tryit Editor v3.7 | Tryit: Automatic numbering with counters | [] |
Fix ERROR 1093 (HY000): You can't specify target table for update in FROM clause while deleting the lowest value from a MySQL column? | Let us first create a table −
mysql> create table DemoTable1597
-> (
-> Marks int
-> );
Query OK, 0 rows affected (0.69 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable1597 values(45);
Query OK, 1 row affected (0.21 sec)
mysql> insert into DemoTable1597 values(59);
Quer... | [
{
"code": null,
"e": 1092,
"s": 1062,
"text": "Let us first create a table −"
},
{
"code": null,
"e": 1196,
"s": 1092,
"text": "mysql> create table DemoTable1597\n -> (\n -> Marks int\n -> );\nQuery OK, 0 rows affected (0.69 sec)"
},
{
"code": null,
"e": 1252,
... |
Minimum Cost Path | Practice | GeeksforGeeks | Given a square grid of size N, each cell of which contains integer cost which represents a cost to traverse through that cell, we need to find a path from top left cell to bottom right cell by which the total cost incurred is minimum.
From the cell (i,j) we can go (i,j-1), (i, j+1), (i-1, j), (i+1, j).
Note: It is ass... | [
{
"code": null,
"e": 543,
"s": 238,
"text": "Given a square grid of size N, each cell of which contains integer cost which represents a cost to traverse through that cell, we need to find a path from top left cell to bottom right cell by which the total cost incurred is minimum.\nFrom the cell (i,j)... |
Automate Microsoft Excel and Word Using Python | by M Khorasani | Towards Data Science | Microsoft Excel and Word are without a shred of doubt the two most abundantly used software in the corporate and non-corporate world. They are practically synonymous with the term ‘work’ itself. Oftentimes, not a week goes by without us firing up the combination of the two and one way or another putting their goodness ... | [
{
"code": null,
"e": 1045,
"s": 172,
"text": "Microsoft Excel and Word are without a shred of doubt the two most abundantly used software in the corporate and non-corporate world. They are practically synonymous with the term ‘work’ itself. Oftentimes, not a week goes by without us firing up the com... |
Modelling the coronavirus epidemic in a city with Python | by Gevorg Yeghikyan | Towards Data Science | You can learn the entire modelling, simulation and spatial visualization of the Covid-19 epidemic spreading in a city using just Python in this online course or in this one.
The recent 2019-nCoV Wuhan coronavirus outbreak in China has sent shocks through financial markets and entire economies, and has duly triggered pa... | [
{
"code": null,
"e": 345,
"s": 171,
"text": "You can learn the entire modelling, simulation and spatial visualization of the Covid-19 epidemic spreading in a city using just Python in this online course or in this one."
},
{
"code": null,
"e": 1542,
"s": 345,
"text": "The recent ... |
__rmul__ in Python - GeeksforGeeks | 04 May, 2020
For every operator sign, there is an underlying mechanism. This underlying mechanism is a special method that will be called during the operator action. This special method is called magical method. For every arithmetic calculation like +, -, *, /, we require 2 operands to carry out operator functionality.... | [
{
"code": null,
"e": 23901,
"s": 23873,
"text": "\n04 May, 2020"
},
{
"code": null,
"e": 24209,
"s": 23901,
"text": "For every operator sign, there is an underlying mechanism. This underlying mechanism is a special method that will be called during the operator action. This speci... |
Matrix Interchange - Java | Practice | GeeksforGeeks | Working with 2D arrays is quite important. Here we will do swapping of column in a 2D array. You are given a matrix M or r rows and c columns. You need to swap the first column with the last column.
Example:
Input:
3 4
1 2 3 4
4 3 2 1
6 7 8 9
Output:
4 2 3 1
1 3 2 4
9 7 8 6
Your Task:
Since this is a function problem,... | [
{
"code": null,
"e": 489,
"s": 290,
"text": "Working with 2D arrays is quite important. Here we will do swapping of column in a 2D array. You are given a matrix M or r rows and c columns. You need to swap the first column with the last column."
},
{
"code": null,
"e": 498,
"s": 489,
... |
Next greater number set digits | Practice | GeeksforGeeks | Given a number n, find the smallest number that has same set of digits as n and is greater than n. If n is the greatest possible number with its set of digits, report it.
Example 1:
Input:
N = 143
Output: 314
Explanation: Numbers possible with digits
1, 3 and 4 are: 134, 143, 314, 341, 413, 431.
The first greater numb... | [
{
"code": null,
"e": 409,
"s": 238,
"text": "Given a number n, find the smallest number that has same set of digits as n and is greater than n. If n is the greatest possible number with its set of digits, report it."
},
{
"code": null,
"e": 420,
"s": 409,
"text": "Example 1:"
}... |
Print a matrix in alternate manner (left to right then right to left) - GeeksforGeeks | 22 Apr, 2021
Given a 2D array, the task is to print the 2D in alternate manner (First row from left to right, then from right to left, and so on). Examples:
Input : arr[][2] = {{1, 2}
{2, 3}};
Output : 1 2 3 2
Input :arr[][3] = { { 7 , 2 , 3 },
{ 2 , 3 , 4 },
... | [
{
"code": null,
"e": 26352,
"s": 26324,
"text": "\n22 Apr, 2021"
},
{
"code": null,
"e": 26498,
"s": 26352,
"text": "Given a 2D array, the task is to print the 2D in alternate manner (First row from left to right, then from right to left, and so on). Examples: "
},
{
"co... |
fsync() - Unix, Linux System Call | Unix - Home
Unix - Getting Started
Unix - File Management
Unix - Directories
Unix - File Permission
Unix - Environment
Unix - Basic Utilities
Unix - Pipes & Filters
Unix - Processes
Unix - Communication
Unix - The vi Editor
Unix - What is Shell?
Unix - Using Variables
Unix - Special Variables
Unix - Using Arrays
Unix -... | [
{
"code": null,
"e": 1466,
"s": 1454,
"text": "Unix - Home"
},
{
"code": null,
"e": 1489,
"s": 1466,
"text": "Unix - Getting Started"
},
{
"code": null,
"e": 1512,
"s": 1489,
"text": "Unix - File Management"
},
{
"code": null,
"e": 1531,
"s": 1... |
Groovy - Relational Operators | Relational operators allow of the comparison of objects. Following are the relational operators available in Groovy −
The following code snippet shows how the various operators can be used.
class Example {
static void main(String[] args) {
def x = 5;
def y = 10;
def z = 8;
if(x == y) {
... | [
{
"code": null,
"e": 2356,
"s": 2238,
"text": "Relational operators allow of the comparison of objects. Following are the relational operators available in Groovy −"
},
{
"code": null,
"e": 2428,
"s": 2356,
"text": "The following code snippet shows how the various operators can b... |
How to declare global Variables in JavaScript? | A global variable has global scope. The scope of a variable is the region of your program in which it is defined. JavaScript variables have only two scopes.
Global Variables − A global variable has global scope which means it can be defined anywhere in your JavaScript code.
Local Variables − A local variable will be vi... | [
{
"code": null,
"e": 1219,
"s": 1062,
"text": "A global variable has global scope. The scope of a variable is the region of your program in which it is defined. JavaScript variables have only two scopes."
},
{
"code": null,
"e": 1337,
"s": 1219,
"text": "Global Variables − A glob... |
Sort id and reverse the items with MongoDB | The $natural returns the documents in natural order. To reverse the items, use $natural:-1. Let us create a collection with documents −
> db.demo710.insertOne({id:101,Name:"Robert"});
{
"acknowledged" : true,
"insertedId" : ObjectId("5ea83a855d33e20ed1097b7a")
}
> db.demo710.insertOne({id:102,Name:"Carol"});
{
... | [
{
"code": null,
"e": 1198,
"s": 1062,
"text": "The $natural returns the documents in natural order. To reverse the items, use $natural:-1. Let us create a collection with documents −"
},
{
"code": null,
"e": 1724,
"s": 1198,
"text": "> db.demo710.insertOne({id:101,Name:\"Robert\"... |
Composite Transformation in 2-D graphics - GeeksforGeeks | 06 Aug, 2021
Prerequisite – Basic types of 2-D Transformation :
TranslationScalingRotationReflectionShearing of a 2-D object
Translation
Scaling
Rotation
Reflection
Shearing of a 2-D object
Composite Transformation : As the name suggests itself Composition, here we combine two or more transformations into one single ... | [
{
"code": null,
"e": 24443,
"s": 24415,
"text": "\n06 Aug, 2021"
},
{
"code": null,
"e": 24496,
"s": 24443,
"text": "Prerequisite – Basic types of 2-D Transformation : "
},
{
"code": null,
"e": 24557,
"s": 24496,
"text": "TranslationScalingRotationReflectionS... |
Automate Creating a New GitHub Repository with “Gitstart” | by Shinichi Okada | Towards Data Science | [Update: 2021–06–09][Update: 2021–05–23][Updated: 2021–4–17]
(Homebrew version and the newer version are available.)
The Gitstart will remove all the hassle when creating a new GitHub repository. After creating a repository at GitHub, you have to type the following as a standard procedure:
Line 1: Adding “My Repo” to t... | [
{
"code": null,
"e": 233,
"s": 172,
"text": "[Update: 2021–06–09][Update: 2021–05–23][Updated: 2021–4–17]"
},
{
"code": null,
"e": 289,
"s": 233,
"text": "(Homebrew version and the newer version are available.)"
},
{
"code": null,
"e": 463,
"s": 289,
"text": "... |
Building a Translation System In Minutes | by Ceshine Lee | Towards Data Science | Sequence-to-sequence(seq2seq)[1] is a versatile structure and capable of many things (language translation, text summarization[2], video captioning[3], etc.). For a short introduction to seq2seq, here are some good posts: [4][5].
Sean Robertson’s tutorial notebook[6] and Jeremy Howard’s lectures [6][7] are great starti... | [
{
"code": null,
"e": 402,
"s": 172,
"text": "Sequence-to-sequence(seq2seq)[1] is a versatile structure and capable of many things (language translation, text summarization[2], video captioning[3], etc.). For a short introduction to seq2seq, here are some good posts: [4][5]."
},
{
"code": nul... |
Docker - Building Files | We created our Docker File in the last chapter. It’s now time to build the Docker File. The Docker File can be built with the following command −
docker build
Let’s learn more about this command.
This method allows the users to build their own Docker images.
docker build -t ImageName:TagName dir
-t − is to mention ... | [
{
"code": null,
"e": 2486,
"s": 2340,
"text": "We created our Docker File in the last chapter. It’s now time to build the Docker File. The Docker File can be built with the following command −"
},
{
"code": null,
"e": 2501,
"s": 2486,
"text": "docker build \n"
},
{
"code"... |
How can I write a MySQL stored function that calculates the factorial of a given number? | Following is the example of a stored function that can calculate the factorial of a given number −
CREATE FUNCTION factorial (n DECIMAL(3,0))
RETURNS DECIMAL(20,0)
DETERMINISTIC
BEGIN
DECLARE factorial DECIMAL(20,0) DEFAULT 1;
DECLARE counter DECIMAL(3,0);
SET counter = n;
factorial_loop: REPEAT
SET factorial = factori... | [
{
"code": null,
"e": 1161,
"s": 1062,
"text": "Following is the example of a stored function that can calculate the factorial of a given number −"
},
{
"code": null,
"e": 1756,
"s": 1161,
"text": "CREATE FUNCTION factorial (n DECIMAL(3,0))\nRETURNS DECIMAL(20,0)\nDETERMINISTIC\nB... |
H2 Database - Create | CREATE is a generic SQL command used to create Tables, Schemas, Sequences, Views, and Users in H2 Database server.
Create Table is a command used to create a user-defined table in the current database.
Following is the generic syntax for the Create Table command.
CREATE [ CACHED | MEMORY ] [ TEMP | [ GLOBAL | LOCAL ] T... | [
{
"code": null,
"e": 2222,
"s": 2107,
"text": "CREATE is a generic SQL command used to create Tables, Schemas, Sequences, Views, and Users in H2 Database server."
},
{
"code": null,
"e": 2309,
"s": 2222,
"text": "Create Table is a command used to create a user-defined table in th... |
How to integrate Sikuli scripts into Selenium? | We can integrate Sikuli scripts into Selenium webdriver. Sikuli is an automation tool which is open-source. It has the feature to capture the images on the elements as well as perform operations on them.
Some of the advantages of Sikuli are −
Desktop or Windows applications can be automated.
Desktop or Windows applicat... | [
{
"code": null,
"e": 1266,
"s": 1062,
"text": "We can integrate Sikuli scripts into Selenium webdriver. Sikuli is an automation tool which is open-source. It has the feature to capture the images on the elements as well as perform operations on them."
},
{
"code": null,
"e": 1305,
"s... |
Groovy - String Length | Syntax − The length of the string determined by the length() method of the string.
Parameters − No parameters.
Return Value − An Integer showing the length of the string.
Following is an example of the usage of strings in Groovy −
class Example {
static void main(String[] args) {
String a = "Hello";
prin... | [
{
"code": null,
"e": 2321,
"s": 2238,
"text": "Syntax − The length of the string determined by the length() method of the string."
},
{
"code": null,
"e": 2349,
"s": 2321,
"text": "Parameters − No parameters."
},
{
"code": null,
"e": 2409,
"s": 2349,
"text": "... |
Basics of Discrete Event Simulation using SimPy - GeeksforGeeks | 19 Nov, 2020
SimPy is a powerful process-based discrete event simulation framework written in Python.
Installation :To install SimPy, use the following command –
pip install simpy
Basic Concepts :
The core idea behind SimPy is the generator function in Python. The difference between a normal function and a generator is... | [
{
"code": null,
"e": 24292,
"s": 24264,
"text": "\n19 Nov, 2020"
},
{
"code": null,
"e": 24381,
"s": 24292,
"text": "SimPy is a powerful process-based discrete event simulation framework written in Python."
},
{
"code": null,
"e": 24441,
"s": 24381,
"text": "I... |
How do I delete SharedPreferences data for my Android App using Kotlin? | This example demonstrates how to delete SharedPreferences data for my Android App using Kotlin.
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="... | [
{
"code": null,
"e": 1158,
"s": 1062,
"text": "This example demonstrates how to delete SharedPreferences data for my Android App using Kotlin."
},
{
"code": null,
"e": 1287,
"s": 1158,
"text": "Step 1 − Create a new project in Android Studio, go to File ? New Project and fill all... |
Count odd and even digits in a number in PL/SQL | We are given a positive integer of digits and the task is to calculate the count of odd and even digits in a number using PL/SQL.
PL/SQL is a combination of SQL along with the procedural features of programming languages. It was developed by Oracle Corporation in the early 90's to enhance the capabilities of SQL.
PL/SQ... | [
{
"code": null,
"e": 1192,
"s": 1062,
"text": "We are given a positive integer of digits and the task is to calculate the count of odd and even digits in a number using PL/SQL."
},
{
"code": null,
"e": 1377,
"s": 1192,
"text": "PL/SQL is a combination of SQL along with the proced... |
How to convert CSV File to PDF File using Python? - GeeksforGeeks | 16 Mar, 2021
In this article, we will learn how to do Conversion of CSV to PDF file format. This simple task can be easily done using two Steps :
Firstly, We convert our CSV file to HTML using the Pandas
In the Second Step, we use PDFkit Python API to convert our HTML file to the PDF file format.
Firstly, We convert... | [
{
"code": null,
"e": 24595,
"s": 24564,
"text": " \n16 Mar, 2021\n"
},
{
"code": null,
"e": 24728,
"s": 24595,
"text": "In this article, we will learn how to do Conversion of CSV to PDF file format. This simple task can be easily done using two Steps :"
},
{
"code": null,... |
Node.js Date.format() API - GeeksforGeeks | 21 Jan, 2022
The date-and-time.Date.format() is a minimalist collection of functions for manipulating JS date and time module which is used to format the date according to a certain pattern.
Required Module: Install the module by npm or used it locally.
By using npm.
npm install date-and-time --save
By using CDN link.... | [
{
"code": null,
"e": 24531,
"s": 24503,
"text": "\n21 Jan, 2022"
},
{
"code": null,
"e": 24710,
"s": 24531,
"text": "The date-and-time.Date.format() is a minimalist collection of functions for manipulating JS date and time module which is used to format the date according to a ce... |
Scala | String Interpolation - GeeksforGeeks | 26 Feb, 2019
String Interpolation refers to substitution of defined variables or expressions in a given String with respected values. String Interpolation provides an easy way to process String literals. To apply this feature of Scala, we must follow few rules:
String must be defined with starting character as s / f /r... | [
{
"code": null,
"e": 24427,
"s": 24399,
"text": "\n26 Feb, 2019"
},
{
"code": null,
"e": 24676,
"s": 24427,
"text": "String Interpolation refers to substitution of defined variables or expressions in a given String with respected values. String Interpolation provides an easy way ... |
Kubernetes - Setup | It is important to set up the Virtual Datacenter (vDC) before setting up Kubernetes. This can be considered as a set of machines where they can communicate with each other via the network. For hands-on approach, you can set up vDC on PROFITBRICKS if you do not have a physical or cloud infrastructure set up.
Once the Ia... | [
{
"code": null,
"e": 2504,
"s": 2195,
"text": "It is important to set up the Virtual Datacenter (vDC) before setting up Kubernetes. This can be considered as a set of machines where they can communicate with each other via the network. For hands-on approach, you can set up vDC on PROFITBRICKS if you... |
Training RetinaNet on Google Colab to detect pliers, hammers, and screwdrivers from KTH Handtools Dataset. | by Iustina Ivanova | Towards Data Science | In this article, RetinaNet is trained in Google Colab to detect plier, hammer and screwdriver instruments. The dataset was taken from an opened source called KTH Handtools Dataset. It consists of 3 types of images for the handtools: hammer, plier and screwdriver in different illuminations and different locations.
Jupyt... | [
{
"code": null,
"e": 487,
"s": 172,
"text": "In this article, RetinaNet is trained in Google Colab to detect plier, hammer and screwdriver instruments. The dataset was taken from an opened source called KTH Handtools Dataset. It consists of 3 types of images for the handtools: hammer, plier and scre... |
Contour hatching in Matplotlib plot | To plot contour with hatching, we can take the following steps −
Set the figure size and adjust the padding between and around the subplots.
Create x, y and z data points using numpy.
Flat the x and y data points.
Create a figure and a set of subplots.
Plot a contour with different hatches.
Create a colorbar for a scal... | [
{
"code": null,
"e": 1127,
"s": 1062,
"text": "To plot contour with hatching, we can take the following steps −"
},
{
"code": null,
"e": 1203,
"s": 1127,
"text": "Set the figure size and adjust the padding between and around the subplots."
},
{
"code": null,
"e": 1246... |
How to Install MySQL and Create a Sample Database | Towards Data Science | Data scientists and analyst are expected to be able to write and execute complex queries in SQL. If you’re just getting started with SQL or are looking for a sandbox to test queries, then this guide is for you.
There are some great resources for SQL such as HackerRank, LeetCode, and W3Schools, but I think one of the be... | [
{
"code": null,
"e": 382,
"s": 171,
"text": "Data scientists and analyst are expected to be able to write and execute complex queries in SQL. If you’re just getting started with SQL or are looking for a sandbox to test queries, then this guide is for you."
},
{
"code": null,
"e": 589,
... |
Querying PostgreSQL data with BigQuery | by Antonio Cachuan | Towards Data Science | Query data in your Cloud SQL instance in real-time, reducing ELT development time, avoid copying and moving data thanks to BigQuery Cloud SQL federation.
As you know Cloud SQL is a fully-managed relational database service for MySQL, PostgreSQL, and SQL Server. These kinds of databases are oriented to host applications... | [
{
"code": null,
"e": 326,
"s": 172,
"text": "Query data in your Cloud SQL instance in real-time, reducing ELT development time, avoid copying and moving data thanks to BigQuery Cloud SQL federation."
},
{
"code": null,
"e": 572,
"s": 326,
"text": "As you know Cloud SQL is a fully... |
Simple registration form using Python Tkinter | Tkinter is a python library for developing GUI (Graphical User Interfaces). We use the tkinter library for creating an application of UI (User Interface), to create windows and all other graphical user interfaces.
If you’re using python 3.x(which is recommended), Tkinter will come with Python as a standard package, so ... | [
{
"code": null,
"e": 1276,
"s": 1062,
"text": "Tkinter is a python library for developing GUI (Graphical User Interfaces). We use the tkinter library for creating an application of UI (User Interface), to create windows and all other graphical user interfaces."
},
{
"code": null,
"e": 14... |
Determine the type of an image in Python? | In this section we are going to see the type of image file we have. So consider a situation, where in a directory we have hundreds of image file and we want to get all the jgeg(or any particular image file type) file type. All this we are going to do programmatically using python.
Python provide
library to determine th... | [
{
"code": null,
"e": 1344,
"s": 1062,
"text": "In this section we are going to see the type of image file we have. So consider a situation, where in a directory we have hundreds of image file and we want to get all the jgeg(or any particular image file type) file type. All this we are going to do pr... |
How to create a 3D-array from data frame in R? | A 3D-array is a 3-dimensional array and it is actually a collection of 2D arrays. We can create a 3D-array of a data frame in R by using simplify2array function, this function will break the data frame into arrays that will form a 3D-array.
Consider the below data frame:
Live Demo
> set.seed(254)
> x<-sample(0:1,20,rep... | [
{
"code": null,
"e": 1303,
"s": 1062,
"text": "A 3D-array is a 3-dimensional array and it is actually a collection of 2D arrays. We can create a 3D-array of a data frame in R by using simplify2array function, this function will break the data frame into arrays that will form a 3D-array."
},
{
... |
How to replace NA with 0 and other values to 1 in an R data frame column? | Sometimes we want to convert a column of an R data frame to binary column using 0 and 1, it is especially done in situations where we have some NAs in the column of the data frame and the other values can be converted to 1 due to some characteristics. To replace NA with 0 and other values to 1, we can use ifelse functi... | [
{
"code": null,
"e": 1386,
"s": 1062,
"text": "Sometimes we want to convert a column of an R data frame to binary column using 0 and 1, it is especially done in situations where we have some NAs in the column of the data frame and the other values can be converted to 1 due to some characteristics. T... |
Practical Cython— Music Retrieval: Short Time Fourier Transform | by Stefano Bosisio | Towards Data Science | medium.com
I love so much Cython, as it takes the best of the two main programming worlds: C and Python. Both languages can be combined together in a straightforward way, in order to give you more computational efficient APIs or scripts. Furthermore, coding in Cython and C helps you to understand what is underneath com... | [
{
"code": null,
"e": 183,
"s": 172,
"text": "medium.com"
},
{
"code": null,
"e": 654,
"s": 183,
"text": "I love so much Cython, as it takes the best of the two main programming worlds: C and Python. Both languages can be combined together in a straightforward way, in order to giv... |
Designing Intelligent Python Dictionaries | by Chaitanya Baweja | Towards Data Science | Last week while working on a hobby project, I encountered a very interesting design problem:
How do you deal with wrong user input?
Let me explain.
Dictionaries in Python represent pairs of keys and values. For example:
student_grades = {'John': 'A', 'Mary': 'C', 'Rob': 'B'}# To check grade of John, we callprint(studen... | [
{
"code": null,
"e": 264,
"s": 171,
"text": "Last week while working on a hobby project, I encountered a very interesting design problem:"
},
{
"code": null,
"e": 303,
"s": 264,
"text": "How do you deal with wrong user input?"
},
{
"code": null,
"e": 319,
"s": 303... |
Redis - String Get Command | Redis GET command is used to get the value stored in the specified key. If the key does not exist, then nil is returned. If the returned value is not a string, then error is returned.
Simple string reply. Value or key or nil.
Following is the basic syntax of Redis GET command.
redis 127.0.0.1:6379> GET KEY_NAME
First,... | [
{
"code": null,
"e": 2229,
"s": 2045,
"text": "Redis GET command is used to get the value stored in the specified key. If the key does not exist, then nil is returned. If the returned value is not a string, then error is returned."
},
{
"code": null,
"e": 2271,
"s": 2229,
"text":... |
Convert short to String in Java | The valueOf() method is used in Java to convert short to string.
Let’s say we have the following short value.
short val = 20;
Converting the above short value to string.
String.valueOf(val);
Live Demo
public class Demo {
public static void main(String[] args) {
short shortVal = 55;
// converting short t... | [
{
"code": null,
"e": 1127,
"s": 1062,
"text": "The valueOf() method is used in Java to convert short to string."
},
{
"code": null,
"e": 1172,
"s": 1127,
"text": "Let’s say we have the following short value."
},
{
"code": null,
"e": 1188,
"s": 1172,
"text": "s... |
Bernoulli Distribution in R - GeeksforGeeks | 21 Apr, 2021
Bernoulli Distribution is a special case of Binomial distribution where only a single trial is performed. It is a discrete probability distribution for a Bernoulli trial (a trial that has only two outcomes i.e. either success or failure). For example, it can be represented as a coin toss where the probabil... | [
{
"code": null,
"e": 25242,
"s": 25214,
"text": "\n21 Apr, 2021"
},
{
"code": null,
"e": 25823,
"s": 25242,
"text": "Bernoulli Distribution is a special case of Binomial distribution where only a single trial is performed. It is a discrete probability distribution for a Bernoulli... |
Connecting to the Internet Using Command Line in Linux - GeeksforGeeks | 10 May, 2020
Many of the times you may use a Linux system that does not have a GUI after install and it needs an internet connection to set up a desktop environment, also you may use Linux servers without a GUI and you need to connect over a wireless network using the command line. Below you will see Steps to connect t... | [
{
"code": null,
"e": 24526,
"s": 24498,
"text": "\n10 May, 2020"
},
{
"code": null,
"e": 24878,
"s": 24526,
"text": "Many of the times you may use a Linux system that does not have a GUI after install and it needs an internet connection to set up a desktop environment, also you m... |
Convert given time into words - GeeksforGeeks | 29 Apr, 2021
Given a time in the format of hh:mm (12-hour format) 0 < hh < 12, 0 <= mm < 60. The task is to convert it into words as shown:Examples :
Input : h = 5, m = 0
Output : five o' clock
Input : h = 6, m = 24
Output : twenty four minutes past six
Corner cases are m = 0, m = 15, m = 30 and m = 45.
6:00 six o'... | [
{
"code": null,
"e": 25574,
"s": 25546,
"text": "\n29 Apr, 2021"
},
{
"code": null,
"e": 25713,
"s": 25574,
"text": "Given a time in the format of hh:mm (12-hour format) 0 < hh < 12, 0 <= mm < 60. The task is to convert it into words as shown:Examples : "
},
{
"code": nu... |
Binomial Coefficient in C++ | Binomial coefficient denoted as c(n,k) or ncr is defined as coefficient of xk in the binomial expansion of (1+X)n.
The Binomial coefficient also gives the value of the number of ways in which k items are chosen from among n objects i.e. k-combinations of n-element set. The order of selection of items not considered.
He... | [
{
"code": null,
"e": 1177,
"s": 1062,
"text": "Binomial coefficient denoted as c(n,k) or ncr is defined as coefficient of xk in the binomial expansion of (1+X)n."
},
{
"code": null,
"e": 1380,
"s": 1177,
"text": "The Binomial coefficient also gives the value of the number of ways... |
UCL Data Science Society: Pandas. Workshop 6: What is Pandas, Pandas... | by Philip Wilkinson | Towards Data Science | This year, as Head of Science for the UCL Data Science Society, the society is presenting a series of 20 workshops covering topics such as introduction to Python, a Data Scientists toolkit and Machine learning methods, throughout the academic year. For each of these the aim is to create a series of small blogposts that... | [
{
"code": null,
"e": 720,
"s": 172,
"text": "This year, as Head of Science for the UCL Data Science Society, the society is presenting a series of 20 workshops covering topics such as introduction to Python, a Data Scientists toolkit and Machine learning methods, throughout the academic year. For ea... |
SparkSession vs SparkContext vs SQLContext | by Giorgos Myrianthous | Towards Data Science | In the big data era, Apache Spark is probably one of the most popular technologies as it offers a unified engine for processing enormous amount of data in a reasonable amount of time.
In this article, I am going to cover the various entry points for Spark Applications and how these have evolved over the releases made. ... | [
{
"code": null,
"e": 231,
"s": 47,
"text": "In the big data era, Apache Spark is probably one of the most popular technologies as it offers a unified engine for processing enormous amount of data in a reasonable amount of time."
},
{
"code": null,
"e": 553,
"s": 231,
"text": "In ... |
Tutorial: Stop Running Jupyter Notebooks from your Command Line | by Ashton Sidhu | Towards Data Science | Jupyter Notebook provides a great platform to produce human-readable documents containing code, equations, analysis, and their descriptions. Some even consider it a powerful development when combining it with NBDev. For such an integral tool, the out of the box start up is not the best. Each use requires starting the J... | [
{
"code": null,
"e": 791,
"s": 172,
"text": "Jupyter Notebook provides a great platform to produce human-readable documents containing code, equations, analysis, and their descriptions. Some even consider it a powerful development when combining it with NBDev. For such an integral tool, the out of t... |
Durbin Watson Test - GeeksforGeeks | 09 Mar, 2021
Durbin Watson Test: A test developed by statisticians professor James Durbin and Geoffrey Stuart Watson is used to detect autocorrelation in residuals from the Regression analysis. It is popularly known as Durbin-Watson d statistic, which is defined as
Let us first look at some terms to have a clear under... | [
{
"code": null,
"e": 23953,
"s": 23925,
"text": "\n09 Mar, 2021"
},
{
"code": null,
"e": 24207,
"s": 23953,
"text": "Durbin Watson Test: A test developed by statisticians professor James Durbin and Geoffrey Stuart Watson is used to detect autocorrelation in residuals from the Reg... |
How to subtract days from a date in JavaScript? | To subtract days to a JavaScript Date object, use the setDate() method. Under that, get the current days and subtract days. JavaScript date setDate() method sets the day of the month for a specified date according to local time.
You can try to run the following code to subtract 10 days from the current date.
Live Demo... | [
{
"code": null,
"e": 1291,
"s": 1062,
"text": "To subtract days to a JavaScript Date object, use the setDate() method. Under that, get the current days and subtract days. JavaScript date setDate() method sets the day of the month for a specified date according to local time."
},
{
"code": nu... |
Chef - Resources | Chef resource represents a piece of the operating system at its desired state. It is a statement of configuration policy that describes the desired state of a node to which one wants to take the current configuration to using resource providers. It helps in knowing the current status of the target machine using the Oha... | [
{
"code": null,
"e": 2898,
"s": 2380,
"text": "Chef resource represents a piece of the operating system at its desired state. It is a statement of configuration policy that describes the desired state of a node to which one wants to take the current configuration to using resource providers. It help... |
Recursive factorial method in Java | The factorial of any non-negative integer is basically the product of all the integers that are smaller than or equal to it. The factorial can be obtained using a recursive method.
A program that demonstrates this is given as follows:
Live Demo
public class Demo {
public static long fact(long n) {
if (n <= 1)... | [
{
"code": null,
"e": 1243,
"s": 1062,
"text": "The factorial of any non-negative integer is basically the product of all the integers that are smaller than or equal to it. The factorial can be obtained using a recursive method."
},
{
"code": null,
"e": 1297,
"s": 1243,
"text": "A... |
Python Plotting Basics. Simple Charts with Matplotlib, Seaborn... | by Laura Fedoruk | Towards Data Science | This tutorial will cover the basics of how to use three Python plotting libraries — Matplotlib, Seaborn, and Plotly. After reviewing this tutorial you should be able to use these three libraries to:
Plot basic bar charts and pie charts
Set up and customize plot characteristics such as titles, axes, and labels
Set gener... | [
{
"code": null,
"e": 371,
"s": 172,
"text": "This tutorial will cover the basics of how to use three Python plotting libraries — Matplotlib, Seaborn, and Plotly. After reviewing this tutorial you should be able to use these three libraries to:"
},
{
"code": null,
"e": 408,
"s": 371,
... |
Boolean.ToString() Method in C# | The Boolean.ToString() method in C# converts the value of this instance to its equivalent string representation (either "True" or "False").
Following is the syntax −
public override string ToString ();
Let us now see an example to implement the Boolean.ToString() method −
using System;
public class Demo {
public sta... | [
{
"code": null,
"e": 1202,
"s": 1062,
"text": "The Boolean.ToString() method in C# converts the value of this instance to its equivalent string representation (either \"True\" or \"False\")."
},
{
"code": null,
"e": 1228,
"s": 1202,
"text": "Following is the syntax −"
},
{
... |
AWS Lambda â Function in C# | This chapter will explain you how to work with AWS Lambda function in C# in detail. Here, we are going to use visual studio to write and deploy the code to AWS Lambda. For any information and help regarding installation of Visual studio and adding AWS toolkit to Visual Studio, please refer to the Introduction chapter i... | [
{
"code": null,
"e": 2899,
"s": 2406,
"text": "This chapter will explain you how to work with AWS Lambda function in C# in detail. Here, we are going to use visual studio to write and deploy the code to AWS Lambda. For any information and help regarding installation of Visual studio and adding AWS t... |
Choosing a hyperparameter tuning library — ray[tune] or aisaratuners? | by Nouman | Towards Data Science | Creating a model is easy. What’s hard is building a model with optimal hyperparameters!. You can create a neural network with a random number of hidden layers and it will probably give you results better than random. But to get optimal results, you need to get the best hyperparameters that optimize the results. This pr... | [
{
"code": null,
"e": 570,
"s": 172,
"text": "Creating a model is easy. What’s hard is building a model with optimal hyperparameters!. You can create a neural network with a random number of hidden layers and it will probably give you results better than random. But to get optimal results, you need t... |
Creating Art with Conv Neural Nets | by Viv | Towards Data Science | In this post, I am using a convolutional neural network to make some neat art!
Up until now, art has always been a work of imagination left best with creatives. Artists have had a unique way of expressing themselves and the times they lived in through a unique lens, specific to the way they viewed the world around them... | [
{
"code": null,
"e": 250,
"s": 171,
"text": "In this post, I am using a convolutional neural network to make some neat art!"
},
{
"code": null,
"e": 650,
"s": 250,
"text": "Up until now, art has always been a work of imagination left best with creatives. Artists have had a unique... |
Detecting leakage in machine learning pipelines using NANs/complex numbers | by Abhay Pawar | Towards Data Science | Data leakage in machine learning pipelines can cause havoc for your model. In this post, I’m going to share an amazingly simple way to detect data leakages using NANs and complex numbers while treating your ML pipeline as a black box. I’ll talk very briefly about what data leakage is. I’ll also talk about leak-detect, ... | [
{
"code": null,
"e": 556,
"s": 172,
"text": "Data leakage in machine learning pipelines can cause havoc for your model. In this post, I’m going to share an amazingly simple way to detect data leakages using NANs and complex numbers while treating your ML pipeline as a black box. I’ll talk very brief... |
Github Autocompletion with Machine Learning | by Oscar D. Lara Yejas | Towards Data Science | Written by Óscar D. Lara Yejas and Ankit Jha
As data scientists, one of the fields that comes closer our hearts is software development since, after all, we are avid users of all sorts of packages and frameworks that help us build our models.
GitHub is one of the key technologies to support the software development li... | [
{
"code": null,
"e": 217,
"s": 171,
"text": "Written by Óscar D. Lara Yejas and Ankit Jha"
},
{
"code": null,
"e": 415,
"s": 217,
"text": "As data scientists, one of the fields that comes closer our hearts is software development since, after all, we are avid users of all sorts ... |
How to create pill buttons with CSS? | Following is the code to create pill buttons −
Live Demo
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
button {
font-family: "Lucida Sans", "Lucida Sans Regular", "Lucida Grande",
"Lucida Sans Unicode", Geneva, Verdana, sans-serif;
background-color: ... | [
{
"code": null,
"e": 1109,
"s": 1062,
"text": "Following is the code to create pill buttons −"
},
{
"code": null,
"e": 1120,
"s": 1109,
"text": " Live Demo"
},
{
"code": null,
"e": 1860,
"s": 1120,
"text": "<!DOCTYPE html>\n<html>\n<head>\n<meta name=\"viewpor... |
Sum of Subarray Minimums in C++ | Suppose we have an array of integers A. We have to find the sum of min(B), where B ranges over every (contiguous) subarray of A. Since the answer may be very large, then return the answer in modulo 10^9 + 7. So if the input is like [3,1,2,4], then the output will be 17, because the subarrays are [3], [1], [2], [4], [3,... | [
{
"code": null,
"e": 1487,
"s": 1062,
"text": "Suppose we have an array of integers A. We have to find the sum of min(B), where B ranges over every (contiguous) subarray of A. Since the answer may be very large, then return the answer in modulo 10^9 + 7. So if the input is like [3,1,2,4], then the o... |
C++ Memory Library - make_shared | It constructs an object of type T passing args to its constructor, and returns an object of type shared_ptr that owns and stores a pointer to it.
Following is the declaration for std::make_shared.
template <class T, class... Args>
shared_ptr<T> make_shared (Args&&... args);
template <class T, class... Args>
share... | [
{
"code": null,
"e": 2749,
"s": 2603,
"text": "It constructs an object of type T passing args to its constructor, and returns an object of type shared_ptr that owns and stores a pointer to it."
},
{
"code": null,
"e": 2800,
"s": 2749,
"text": "Following is the declaration for std... |
While chaining, can we throw unchecked exception from a checked exception in java? | When an exception is cached in a catch block, you can re-throw it using the throw keyword (which is used to throw the exception objects).
While re-throwing exceptions you can throw the same exception as it is with out adjusting it as −
try {
int result = (arr[a])/(arr[b]);
System.out.println("Result of "+arr[a]+"... | [
{
"code": null,
"e": 1200,
"s": 1062,
"text": "When an exception is cached in a catch block, you can re-throw it using the throw keyword (which is used to throw the exception objects)."
},
{
"code": null,
"e": 1298,
"s": 1200,
"text": "While re-throwing exceptions you can throw t... |
The Upgraded “Top N” Analysis You Haven’t Seen Yet with Pandas | by Byron Dolon | Towards Data Science | Did you know that you can have a Top N analysis based on more than one column in Pandas?
A Top N analysis can be useful to select a subset of your data matching a specific condition. For example, what if you owned a restaurant and wanted to look at which customers contributed most to your overall sales? The easiest way... | [
{
"code": null,
"e": 260,
"s": 171,
"text": "Did you know that you can have a Top N analysis based on more than one column in Pandas?"
},
{
"code": null,
"e": 607,
"s": 260,
"text": "A Top N analysis can be useful to select a subset of your data matching a specific condition. For... |
C# Program to perform all Basic Arithmetic Operations | Basic Arithmetic Operators in C#, include the following −
To add, use the Addition Operator −
num1 + num2;
In the same way, it works for Subtraction, Multiplication, Division, and other operators.
Let us see a complete example to learn how to implement Arithmetic operators in C#.
Live Demo
using System;
namespace Sampl... | [
{
"code": null,
"e": 1120,
"s": 1062,
"text": "Basic Arithmetic Operators in C#, include the following −"
},
{
"code": null,
"e": 1156,
"s": 1120,
"text": "To add, use the Addition Operator −"
},
{
"code": null,
"e": 1169,
"s": 1156,
"text": "num1 + num2;"
}... |
A Minimal Working Example for Deep Q-Learning in TensorFlow 2.0 | by Wouter van Heeswijk, PhD | Towards Data Science | Deep Q-learning is a staple in the arsenal of any Reinforcement Learning (RL) practitioner. It neatly circumvents some shortcomings of traditional Q-learning, and leverages the power of neural network for complex value function approximations.
This article shows how to implement and train a deep Q-network in TensorFlow... | [
{
"code": null,
"e": 416,
"s": 172,
"text": "Deep Q-learning is a staple in the arsenal of any Reinforcement Learning (RL) practitioner. It neatly circumvents some shortcomings of traditional Q-learning, and leverages the power of neural network for complex value function approximations."
},
{
... |
How to import local json file data to my JavaScript variable? | We have an employee.json file in a directory, within the same directory we have a js file, in
which we want to import the content of the json file.
The content of employees.json −
employees.json
"Employees" : [
{
"userId":"ravjy", "jobTitleName":"Developer", "firstName":"Ran","lastName":"Vijay",
"preferr... | [
{
"code": null,
"e": 1210,
"s": 1062,
"text": "We have an employee.json file in a directory, within the same directory we have a js file, in\nwhich we want to import the content of the json file."
},
{
"code": null,
"e": 1242,
"s": 1210,
"text": "The content of employees.json −"
... |
Calendar.get() Method in Java - GeeksforGeeks | 02 Mar, 2018
java.util.Calendar.get() method is a method of java.util.Calendar class. The Calendar class provides some methods for implementing a concrete calendar system outside the package. Some examples of Calendar fields are : YEAR, DATE, MONTH, DAY_OF_WEEK, DAY_OF_YEAR, WEEK_OF_YEAR, MINUTE, SECOND, HOUR, AM_PM, W... | [
{
"code": null,
"e": 24091,
"s": 24063,
"text": "\n02 Mar, 2018"
},
{
"code": null,
"e": 24447,
"s": 24091,
"text": "java.util.Calendar.get() method is a method of java.util.Calendar class. The Calendar class provides some methods for implementing a concrete calendar system outsi... |
Add DATE and TIME fields to get DATETIME field in MySQL? | You can use CONCAT() function to set date and time fields to get DATETIME field.
Let us create a demo table
mysql> create table getDateTimeFieldsDemo
-> (
-> ShippingDate date,
-> ShippingTime time,
-> Shippingdatetime datetime
-> );
Query OK, 0 rows affected (0.50 sec)
Insert some records in the table u... | [
{
"code": null,
"e": 1143,
"s": 1062,
"text": "You can use CONCAT() function to set date and time fields to get DATETIME field."
},
{
"code": null,
"e": 1170,
"s": 1143,
"text": "Let us create a demo table"
},
{
"code": null,
"e": 1348,
"s": 1170,
"text": "mys... |
__attribute__((constructor)) and __attribute__((destructor)) syntaxes in C - GeeksforGeeks | 02 Jun, 2017
Write two functions in C using GCC compiler, one of which executes before main function and other executes after the main function.
GCC specific syntaxes :
1. __attribute__((constructor)) syntax : This particular GCC syntax, when used with a function, executes the same function at the startup of the progra... | [
{
"code": null,
"e": 23843,
"s": 23815,
"text": "\n02 Jun, 2017"
},
{
"code": null,
"e": 23975,
"s": 23843,
"text": "Write two functions in C using GCC compiler, one of which executes before main function and other executes after the main function."
},
{
"code": null,
... |
How to produce Interactive Matplotlib Plots in Jupyter Environment | by Abdishakur | Towards Data Science | Matplotlib is extremely powerful visualization library and is the default backend for many other python libraries including Pandas, Geopandas and Seaborn, to name just a few.
Today, there are different options to enable interactivity with Matplotlib plots. However, the new native Matplotlib/Jupyter Interactive widgets ... | [
{
"code": null,
"e": 347,
"s": 172,
"text": "Matplotlib is extremely powerful visualization library and is the default backend for many other python libraries including Pandas, Geopandas and Seaborn, to name just a few."
},
{
"code": null,
"e": 581,
"s": 347,
"text": "Today, ther... |
Find the Number of Quadrilaterals Possible from the Given Points using C++ | A quadrilateral forms a polygon with four vertices and four edges in Euclidean plane geometry. The name 4-gon etc. Included in other names of quadrilaterals and sometimes they are also known as a square, display style, etc.
In this article, we will explain the approaches to finding the number of quadrilaterals possible... | [
{
"code": null,
"e": 1286,
"s": 1062,
"text": "A quadrilateral forms a polygon with four vertices and four edges in Euclidean plane geometry. The name 4-gon etc. Included in other names of quadrilaterals and sometimes they are also known as a square, display style, etc."
},
{
"code": null,
... |
Average of a stream of numbers - GeeksforGeeks | 20 Oct, 2021
Difficulty Level: Rookie Given a stream of numbers, print the average (or mean) of the stream at every point. For example, let us consider the stream as 10, 20, 30, 40, 50, 60, ...
Average of 1 numbers is 10.00
Average of 2 numbers is 15.00
Average of 3 numbers is 20.00
Average of 4 numbers is 25.... | [
{
"code": null,
"e": 24614,
"s": 24586,
"text": "\n20 Oct, 2021"
},
{
"code": null,
"e": 24796,
"s": 24614,
"text": "Difficulty Level: Rookie Given a stream of numbers, print the average (or mean) of the stream at every point. For example, let us consider the stream as 10, 20, 30... |
How to access nested Python dictionary items via a list of keys? | The easiest and most readable way to access nested properties in a Python dict is to use for loop and loop over each item while getting the next value, until the end.
def getFromDict(dataDict, mapList):
for k in mapList: dataDict = dataDict[k]
return dataDict
a = {
'foo': 45,'bar': {
'baz': 100,'tru': "Hello"... | [
{
"code": null,
"e": 1230,
"s": 1062,
"text": "The easiest and most readable way to access nested properties in a Python dict is to use for loop and loop over each item while getting the next value, until the end. "
},
{
"code": null,
"e": 1428,
"s": 1230,
"text": "def getFromDic... |
Logo - Strings | Any sequence of alpha-numeric characters, for example – “america”, “emp1234”, etc. are examples of a string. Counting the characters is the most basic of all string processes. The answer to the question stringlength "abc12ef is given by the following procedure −
to stringlength :s
make "inputstring :s
make "count... | [
{
"code": null,
"e": 2097,
"s": 1834,
"text": "Any sequence of alpha-numeric characters, for example – “america”, “emp1234”, etc. are examples of a string. Counting the characters is the most basic of all string processes. The answer to the question stringlength \"abc12ef is given by the following p... |
Longest Palindromic Substring | In a given string, we have to find a substring, which is a palindrome and it is longest.
To get the longest palindromic substring, we have to solve many subproblems, some of the subproblems are overlapping. They are needed to be solved for multiple times. For that reason, the Dynamic programming is helpful. Using a tab... | [
{
"code": null,
"e": 1151,
"s": 1062,
"text": "In a given string, we have to find a substring, which is a palindrome and it is longest."
},
{
"code": null,
"e": 1488,
"s": 1151,
"text": "To get the longest palindromic substring, we have to solve many subproblems, some of the subp... |
HTML | <form> enctype Attribute - GeeksforGeeks | 10 Jun, 2019
The HTML <form> enctype Attribute is used to specify that data that will be present in form should be encoded when submitting to the server. This type of attribute can be used only if method = “POST”.
Syntax:
<form enctype="value">
Attribute Value: This attribute contains three value which are listed belo... | [
{
"code": null,
"e": 24503,
"s": 24475,
"text": "\n10 Jun, 2019"
},
{
"code": null,
"e": 24704,
"s": 24503,
"text": "The HTML <form> enctype Attribute is used to specify that data that will be present in form should be encoded when submitting to the server. This type of attribute... |
How to append data to a file in Java? | In most scenarios if you try to write contents to a file, using the classes of the java.io package, the file will be overwritten i.e. data existing in the file is erased and the new data is added to it.
But, in certain scenarios like logging exceptions into a file (without using logger frame works) you need to append d... | [
{
"code": null,
"e": 1265,
"s": 1062,
"text": "In most scenarios if you try to write contents to a file, using the classes of the java.io package, the file will be overwritten i.e. data existing in the file is erased and the new data is added to it."
},
{
"code": null,
"e": 1426,
"s"... |
Minimum Number in a sorted rotated array | Practice | GeeksforGeeks | Given an array of distinct elements which was initially sorted. This array is rotated at some unknown point. The task is to find the minimum element in the given sorted and rotated array.
Example 1:
Input:
N = 10
arr[] = {2,3,4,5,6,7,8,9,10,1}
Output: 1
Explanation: The array is rotated
once anti-clockwise. So minium... | [
{
"code": null,
"e": 427,
"s": 238,
"text": "Given an array of distinct elements which was initially sorted. This array is rotated at some unknown point. The task is to find the minimum element in the given sorted and rotated array. "
},
{
"code": null,
"e": 438,
"s": 427,
"text"... |
How to call another enum value in an enum's constructor using java? | Enumeration (enum) in Java is a datatype which stores a set of constant values. You can use enumerations to store fixed values such as days in a week, months in a year etc.
You can define an enumeration using the keyword enum followed by the name of the enumeration as −
enum Days {
SUNDAY, MONDAY, TUESDAY, WEDNESDAY... | [
{
"code": null,
"e": 1235,
"s": 1062,
"text": "Enumeration (enum) in Java is a datatype which stores a set of constant values. You can use enumerations to store fixed values such as days in a week, months in a year etc."
},
{
"code": null,
"e": 1333,
"s": 1235,
"text": "You can d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.