title stringlengths 3 221 | text stringlengths 17 477k | parsed listlengths 0 3.17k |
|---|---|---|
3 Libraries You Should Know to Master Apache Kafka in Python | by Xiaoxu Gao | Towards Data Science | The world is empowered by data. We get tons of information every second, we clean it up, analyze it and create more valuable output, whether it is a log file, user activity, a chat message or something else. The faster we deliver, the more value we will bring to our customers. We’re in the era of a fast-paced and ever-... | [
{
"code": null,
"e": 514,
"s": 172,
"text": "The world is empowered by data. We get tons of information every second, we clean it up, analyze it and create more valuable output, whether it is a log file, user activity, a chat message or something else. The faster we deliver, the more value we will b... |
A hands-on introduction to Propensity Score use for beginners | by Núria Correa Mañas | Towards Data Science | This is a joint work with Aleix Ruiz, Jesús Cerquides, Joan Capdevila and Borja Velasco within the Causal ALGO Bcn. You can find a theory post explaining the same topic here.
A common data problem to be solved in any field involves figuring out if a treatment has any effect on a certain outcome. Now, this at first gla... | [
{
"code": null,
"e": 348,
"s": 172,
"text": "This is a joint work with Aleix Ruiz, Jesús Cerquides, Joan Capdevila and Borja Velasco within the Causal ALGO Bcn. You can find a theory post explaining the same topic here."
},
{
"code": null,
"e": 883,
"s": 348,
"text": "A common d... |
Java Scope | In Java, variables are only accessible inside the region they are created. This is called
scope.
Variables declared directly inside a method are available anywhere in the method following the line of code in which they were declared:
public class Main {
public static void main(String[] args) {
// Code here CANNO... | [
{
"code": null,
"e": 97,
"s": 0,
"text": "In Java, variables are only accessible inside the region they are created. This is called\nscope."
},
{
"code": null,
"e": 234,
"s": 97,
"text": "Variables declared directly inside a method are available anywhere in the method following t... |
D Programming - Data Types | In the D programming language, data types refer to an extensive system used for declaring variables or functions of different types. The type of a variable determines how much space it occupies in storage and how the stored bit pattern is interpreted.
The types in D can be classified as follows −
Basic Types
They are a... | [
{
"code": null,
"e": 2856,
"s": 2604,
"text": "In the D programming language, data types refer to an extensive system used for declaring variables or functions of different types. The type of a variable determines how much space it occupies in storage and how the stored bit pattern is interpreted."
... |
Default constructor in Java | Java compiler automatically creates a default constructor (Constructor with no arguments) in case no constructor is present in the java class. Following are the motive behind a default constructor.
Create the Object
Create the Object
Call the super class constructor()
Call the super class constructor()
Initialize all t... | [
{
"code": null,
"e": 1260,
"s": 1062,
"text": "Java compiler automatically creates a default constructor (Constructor with no arguments) in case no constructor is present in the java class. Following are the motive behind a default constructor."
},
{
"code": null,
"e": 1278,
"s": 126... |
C++ List Library - pop_front() Function | The C++ function std::list::pop_front() removes first element from list and reduces size of list by one.
Following is the declaration for std::list::pop_front() function form std::list header.
void pop_front();
None
None
This member function never throws exception. Calling this function on empty list causes undefined ... | [
{
"code": null,
"e": 2708,
"s": 2603,
"text": "The C++ function std::list::pop_front() removes first element from list and reduces size of list by one."
},
{
"code": null,
"e": 2796,
"s": 2708,
"text": "Following is the declaration for std::list::pop_front() function form std::li... |
Basic Operators in Relational Algebra - GeeksforGeeks | 26 Apr, 2022
Basics of Relational model: Relational Model
Relational Algebra is a procedural query language that takes relations as an input and returns relations as an output. There are some basic operators which can be applied on relations to producing the required results which we will discuss one by one. We will u... | [
{
"code": null,
"e": 29544,
"s": 29516,
"text": "\n26 Apr, 2022"
},
{
"code": null,
"e": 29590,
"s": 29544,
"text": "Basics of Relational model: Relational Model "
},
{
"code": null,
"e": 29995,
"s": 29590,
"text": "Relational Algebra is a procedural query lan... |
AI Driven Snake Game using Deep Q Learning - GeeksforGeeks | 01 Feb, 2022
Introduction: This Project is based on Reinforcement Learning which trains the snake to eat the food present in the environment.
A sample gif is given below, that you can get an idea of what we are going to build.
Snake Driven by AI
The Prerequisite for this project are:
Reinforcement Learning
Deep Learnin... | [
{
"code": null,
"e": 26593,
"s": 26565,
"text": "\n01 Feb, 2022"
},
{
"code": null,
"e": 26722,
"s": 26593,
"text": "Introduction: This Project is based on Reinforcement Learning which trains the snake to eat the food present in the environment."
},
{
"code": null,
"e... |
How to Implement ColoredShadowImageView Library in Android? - GeeksforGeeks | 13 Jan, 2022
Android is an open-source operating system, based on the Linux kernel and used in mobile devices like smartphones, tablets, etc. Further, it was developed for smartwatches and Android TV. Each of them has a specialized interface. Android has been one of the best-selling OS for smartphones. Android OS was d... | [
{
"code": null,
"e": 25116,
"s": 25088,
"text": "\n13 Jan, 2022"
},
{
"code": null,
"e": 25788,
"s": 25116,
"text": "Android is an open-source operating system, based on the Linux kernel and used in mobile devices like smartphones, tablets, etc. Further, it was developed for smar... |
How to include() all PHP files from a directory ? - GeeksforGeeks | 10 Jan, 2019
Given list of PHP files in a directory and the task is to include all files from a directory. In order to include all PHP files from directory at once need a foreach-loop.
Example: This example contains four PHP files (file1.php, file2.php, file3.php, file4.php) in a directory. Create one file named as mai... | [
{
"code": null,
"e": 26399,
"s": 26371,
"text": "\n10 Jan, 2019"
},
{
"code": null,
"e": 26571,
"s": 26399,
"text": "Given list of PHP files in a directory and the task is to include all files from a directory. In order to include all PHP files from directory at once need a forea... |
PyQt5 - Add Label to StatusBar - GeeksforGeeks | 22 Apr, 2020
In this article we will see how to add label to a status bar. We can set text to status bar by using showMessage method.
Label and StatusBar ?A label is a graphical control element which displays text on a form. It is usually a static control; having no interactivity. A label is generally used to identify ... | [
{
"code": null,
"e": 25647,
"s": 25619,
"text": "\n22 Apr, 2020"
},
{
"code": null,
"e": 25768,
"s": 25647,
"text": "In this article we will see how to add label to a status bar. We can set text to status bar by using showMessage method."
},
{
"code": null,
"e": 26142... |
GATE | GATE-CS-2017 (Set 1) | Question 25 - GeeksforGeeks | 13 Aug, 2021
Consider the following functions from positives integers to real numbers
10, √n, n, log2n, 100/n.
The CORRECT arrangement of the above functions in increasing order of asymptotic complexity is:(A) log2n, 100/n, 10, √n, n(B) 100/n, 10, log2n, √n, n(C) 10, 100/n ,√n, log2n, n(D) 100/n, log2n, 10 ,√n, nAnswer... | [
{
"code": null,
"e": 25847,
"s": 25819,
"text": "\n13 Aug, 2021"
},
{
"code": null,
"e": 25920,
"s": 25847,
"text": "Consider the following functions from positives integers to real numbers"
},
{
"code": null,
"e": 25945,
"s": 25920,
"text": "10, √n, n, log2n,... |
How to stack elements in CSS ? - GeeksforGeeks | 10 Jul, 2020
In order to create attractive and unique web pages, it is eventually required to add one element on top of the other, completely or just a section of it. There are two methods to achieve this.
Using CSS position property.
Using CSS grids.
Using CSS position property: The position: absolute; property is use... | [
{
"code": null,
"e": 25885,
"s": 25857,
"text": "\n10 Jul, 2020"
},
{
"code": null,
"e": 26078,
"s": 25885,
"text": "In order to create attractive and unique web pages, it is eventually required to add one element on top of the other, completely or just a section of it. There are... |
How to set the size of the NumericUpDown in C#? | 26 Jul, 2019
In windows forms, NumericUpDown control is used to provide Windows spin box or an up-down control which displays the numeric values. Or in other words, NumericUpDown control provides an interface which moves using up and down arrow and holds some pre-defined numeric value. In NumericUpDown control, you can... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n26 Jul, 2019"
},
{
"code": null,
"e": 477,
"s": 28,
"text": "In windows forms, NumericUpDown control is used to provide Windows spin box or an up-down control which displays the numeric values. Or in other words, NumericUpDown control p... |
How to change the text of a label using JavaScript ? | 21 Jul, 2021
Given an HTML document and the task is to change the text of a label using JavaScript.
What is a label ?The <label>tag is used to provide a usability improvement for mouse users i.e, if a user clicks on the text within the <label> element, it toggles the control.
Approach:
Create a label element and assign... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n21 Jul, 2021"
},
{
"code": null,
"e": 115,
"s": 28,
"text": "Given an HTML document and the task is to change the text of a label using JavaScript."
},
{
"code": null,
"e": 292,
"s": 115,
"text": "What is a label ?Th... |
Python program for multiplication and division of complex number | 30 Jan, 2020
Given two complex numbers. The task is to multiply and divide them.
Multiplication of complex number: In Python complex numbers can be multiplied using * operator
Examples:
Input: 2+3i, 4+5i
Output: Multiplication is : (-7+22j)
Input: 2+3i, 1+2i
Output: Multiplication is : (-4+7j)
# Python program to ... | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n30 Jan, 2020"
},
{
"code": null,
"e": 120,
"s": 52,
"text": "Given two complex numbers. The task is to multiply and divide them."
},
{
"code": null,
"e": 215,
"s": 120,
"text": "Multiplication of complex number: In ... |
Program for Method Of False Position | 13 Apr, 2021
Given a function f(x) on floating number x and two numbers ‘a’ and ‘b’ such that f(a)*f(b) < 0 and f(x) is continuous in [a, b]. Here f(x) represents algebraic or transcendental equation. Find root of function in interval [a, b] (Or find a value of x such that f(x) is 0).
Input: A function of x, for examp... | [
{
"code": null,
"e": 54,
"s": 26,
"text": "\n13 Apr, 2021"
},
{
"code": null,
"e": 328,
"s": 54,
"text": "Given a function f(x) on floating number x and two numbers ‘a’ and ‘b’ such that f(a)*f(b) < 0 and f(x) is continuous in [a, b]. Here f(x) represents algebraic or transcenden... |
ColorMaps in Seaborn HeatMaps | 25 Nov, 2020
Colormaps are used to visualize heatmaps effectively and easily. One might use different sorts of colormaps for different kinds of heatmaps. In this article, we will look at how to use colormaps while working with seaborn heatmaps.
Sequential Colormaps: We use sequential colormaps when the data values(nume... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n25 Nov, 2020"
},
{
"code": null,
"e": 260,
"s": 28,
"text": "Colormaps are used to visualize heatmaps effectively and easily. One might use different sorts of colormaps for different kinds of heatmaps. In this article, we will look at h... |
How to make a text input non-editable using jQuery ? | 22 Apr, 2020
An HTML document containing the input text area and the task is to make the text input non-editable with the help of jQuery. There are two approaches that are discussed below:
Approach 1: We are going to set the property readonly to true. To set the readonly property, we will use a prop() method.
Example:<... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n22 Apr, 2020"
},
{
"code": null,
"e": 204,
"s": 28,
"text": "An HTML document containing the input text area and the task is to make the text input non-editable with the help of jQuery. There are two approaches that are discussed below:... |
Spam bot using PyAutoGUI | 02 Feb, 2021
PyAutoGUI is a Python module that helps us automate the key presses and mouse clicks programmatically. In this article we will learn to develop a spam bot using PyAutoGUI.
Spamming – Refers to sending unsolicited messages to large number of systems over the internet.
This mini-project can be used for many... | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n02 Feb, 2021"
},
{
"code": null,
"e": 224,
"s": 52,
"text": "PyAutoGUI is a Python module that helps us automate the key presses and mouse clicks programmatically. In this article we will learn to develop a spam bot using PyAutoGUI."
... |
ReactJS | Calculator App ( Adding Functionality ) | 20 Jan, 2022
In our previous article, we had built the structure of our UI, but we haven’t added styles to it neither we have added any functionality. You can see that if you click the buttons for now then nothing is getting typed on the screen. So, in this article, we will try to make our Calculator app fully function... | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n20 Jan, 2022"
},
{
"code": null,
"e": 1225,
"s": 52,
"text": "In our previous article, we had built the structure of our UI, but we haven’t added styles to it neither we have added any functionality. You can see that if you click the b... |
ReactJS | Rendering Elements | 14 Jan, 2021
In the previous article on introduction to JSX, we got to see how to create a React element. React element is the smallest renderable unit available in React. We can render such elements using the ReactDOM as described in the previous article. React elements are different from DOM elements as React element... | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n14 Jan, 2021"
},
{
"code": null,
"e": 890,
"s": 52,
"text": "In the previous article on introduction to JSX, we got to see how to create a React element. React element is the smallest renderable unit available in React. We can render s... |
PHP sizeof() Function | 02 Dec, 2021
In this article, we will see how to get the length of the array using the sizeof() function in PHP. The sizeof() function is a built-in function in PHP and is used to count the number of elements present in an array or any other countable object.
Syntax:
int sizeof(array, mode);
Parameter: This function ac... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n02 Dec, 2021"
},
{
"code": null,
"e": 275,
"s": 28,
"text": "In this article, we will see how to get the length of the array using the sizeof() function in PHP. The sizeof() function is a built-in function in PHP and is used to count th... |
Find the longest path in a matrix with given constraints | 28 Jun, 2022
Given a n*n matrix where all numbers are distinct, find the maximum length path (starting from any cell) such that all cells along the path are in increasing order with a difference of 1. We can move in 4 directions from a given cell (i, j), i.e., we can move to (i+1, j) or (i, j+1) or (i-1, j) or (i, j-1)... | [
{
"code": null,
"e": 54,
"s": 26,
"text": "\n28 Jun, 2022"
},
{
"code": null,
"e": 429,
"s": 54,
"text": "Given a n*n matrix where all numbers are distinct, find the maximum length path (starting from any cell) such that all cells along the path are in increasing order with a dif... |
Comparison of Inheritance in C++ and Java | 22 Nov, 2021
The purpose of inheritance is the same in C++ and Java. Inheritance is used in both languages for reusing code and/or creating an ‘is-a’ relationship. The following examples will demonstrate the differences between Java and C++ that provide support for inheritance.
1) In Java, all classes inherit from the... | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n22 Nov, 2021"
},
{
"code": null,
"e": 319,
"s": 52,
"text": "The purpose of inheritance is the same in C++ and Java. Inheritance is used in both languages for reusing code and/or creating an ‘is-a’ relationship. The following examples ... |
Coin Change | BFS Approach | 31 May, 2022
Given an integer X and an array arr[] of length N consisting of positive integers, the task is to pick minimum number of integers from the array such that they sum up to N. Any number can be chosen infinite number of times. If no answer exists then print -1.Examples:
Input: X = 7, arr[] = {3, 5, 4} Output... | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n31 May, 2022"
},
{
"code": null,
"e": 321,
"s": 52,
"text": "Given an integer X and an array arr[] of length N consisting of positive integers, the task is to pick minimum number of integers from the array such that they sum up to N. A... |
Python | Check if two lists are identical | 24 Nov, 2018
This article deals with the task of ways to check if two unordered list contains exact similar elements in exact similar position, i.e to check if two lists are exactly equal. This is quite a useful utility and can be used in day-day programming.
Method 1 : Using list.sort() and == operatorsort() coupled w... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n24 Nov, 2018"
},
{
"code": null,
"e": 275,
"s": 28,
"text": "This article deals with the task of ways to check if two unordered list contains exact similar elements in exact similar position, i.e to check if two lists are exactly equal.... |
Spring Boot – CRUD Operations using MySQL Database | 24 Dec, 2021
CRUD stands for Create, Read/Retrieve, Update and Delete and these are the four basic operations that we perform on persistence storage. CRUD is data-oriented and the standardized use of HTTP methods. HTTP has a few methods which work as CRUD operations and do note they are very vital from a developmental ... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n24 Dec, 2021"
},
{
"code": null,
"e": 470,
"s": 28,
"text": "CRUD stands for Create, Read/Retrieve, Update and Delete and these are the four basic operations that we perform on persistence storage. CRUD is data-oriented and the standard... |
File Searching using Python | 21 Feb, 2022
There may be many instances when you want to search a system.Suppose while writing an mp3 player you may want to have all the ‘.mp3’ files present. Well here’s how to do it in a simple way. This code searches all the folders in the file it’s being run. If you want some other kinds of files just change the ... | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n21 Feb, 2022"
},
{
"code": null,
"e": 371,
"s": 52,
"text": "There may be many instances when you want to search a system.Suppose while writing an mp3 player you may want to have all the ‘.mp3’ files present. Well here’s how to do it i... |
Finding minimum vertex cover size of a graph using binary search | 04 Jul, 2022
A vertex cover of an undirected graph is a subset of its vertices such that for every edge (u, v) of the graph, either ‘u’ or ‘v’ is in vertex cover. There may be a lot of vertex covers possible for a graph.
Problem Find the size of the minimum size vertex cover, that is, cardinality of a vertex cover wit... | [
{
"code": null,
"e": 54,
"s": 26,
"text": "\n04 Jul, 2022"
},
{
"code": null,
"e": 263,
"s": 54,
"text": "A vertex cover of an undirected graph is a subset of its vertices such that for every edge (u, v) of the graph, either ‘u’ or ‘v’ is in vertex cover. There may be a lot of ve... |
Program to calculate Surface Area of Ellipsoid | 17 Aug, 2021
Given the length of the three semi-axes as A, B, and C, the task is to find the surface area of the given Ellipsoid.
Ellipsoid is a closed surface of which all plane cross-sections are either ellipses or circles. An ellipsoid is symmetrical about the three mutually perpendicular axes that intersect at the ... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n17 Aug, 2021"
},
{
"code": null,
"e": 145,
"s": 28,
"text": "Given the length of the three semi-axes as A, B, and C, the task is to find the surface area of the given Ellipsoid."
},
{
"code": null,
"e": 448,
"s": 145,
... |
ReactJS UI Ant Design Form Component | 30 Jun, 2021
Ant Design Library has this component pre-built, and it is very easy to integrate as well. Form Component is used when the user needs to create an instance or collect information. We can use the following approach in ReactJS to use the Ant Design Form Component.
Form Props:
colon: It is used to configure t... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n30 Jun, 2021"
},
{
"code": null,
"e": 291,
"s": 28,
"text": "Ant Design Library has this component pre-built, and it is very easy to integrate as well. Form Component is used when the user needs to create an instance or collect informat... |
Python Program for Sum the digits of a given number | 11 Aug, 2021
Given a number and the task is to find sum of digits of this number in Python. Examples:
Input : n = 87 Output : 15 Input : n = 111 Output : 3
Below are the methods to sum of the digits. Method-1: Using str() and int() methods.: The str() method is used to convert the number to string. The int() method ... | [
{
"code": null,
"e": 53,
"s": 25,
"text": "\n11 Aug, 2021"
},
{
"code": null,
"e": 144,
"s": 53,
"text": "Given a number and the task is to find sum of digits of this number in Python. Examples: "
},
{
"code": null,
"e": 198,
"s": 144,
"text": "Input : n = 87... |
How to validate if input date (end date) in input field must be after a given date (start date) using express-validator ? | 11 Jan, 2022
In HTML forms, we often required validation of different types. Validate existing email, validate password length, validate confirm password, validate to allow only integer inputs, these are some examples of validation. In certain cases, we want the user to type a date that must come after some given date(... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n11 Jan, 2022"
},
{
"code": null,
"e": 539,
"s": 28,
"text": "In HTML forms, we often required validation of different types. Validate existing email, validate password length, validate confirm password, validate to allow only integer in... |
How to use Mat-Dialog in Angular ? | 26 Oct, 2020
Introduction:Angular Material is a UI component library that is developed by the Angular team to build design components for desktop and mobile web applications. In order to install it, we need to have angular installed in our project, once you have it you can enter the below command and can download it.
I... | [
{
"code": null,
"e": 54,
"s": 26,
"text": "\n26 Oct, 2020"
},
{
"code": null,
"e": 360,
"s": 54,
"text": "Introduction:Angular Material is a UI component library that is developed by the Angular team to build design components for desktop and mobile web applications. In order to ... |
Touch module in Python | 21 Apr, 2020
In Python, the Touch module is used to create any file on any specified directory. The touch module is equivalent to linux command ‘touch‘ or to the windows’ cmd command ‘ type null > ‘.
Installation:
This module does not come built-in with Python. To install this module type the below command in the termi... | [
{
"code": null,
"e": 54,
"s": 26,
"text": "\n21 Apr, 2020"
},
{
"code": null,
"e": 241,
"s": 54,
"text": "In Python, the Touch module is used to create any file on any specified directory. The touch module is equivalent to linux command ‘touch‘ or to the windows’ cmd command ‘ ty... |
Time Durations in Golang | 10 Sep, 2021
Operations related to time and date are a crucial part of software development (example log keeping). Go standard library provides a time package that has many functions and methods to deal with date and time. The operating system measures two types of time “Wall clock” time and “Monotonic” time. Wall cloc... | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n10 Sep, 2021"
},
{
"code": null,
"e": 906,
"s": 52,
"text": "Operations related to time and date are a crucial part of software development (example log keeping). Go standard library provides a time package that has many functions and ... |
How to create copy to clipboard button ? | 16 Nov, 2021
In this article, we will discuss how to create a copy to the clipboard button.
There are multiple scenarios in web development where we have to give user functionality to copy certain data into a clipboard using a button. Whether it is a sample of code or it is the User’s own information, we can create a c... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n16 Nov, 2021"
},
{
"code": null,
"e": 107,
"s": 28,
"text": "In this article, we will discuss how to create a copy to the clipboard button."
},
{
"code": null,
"e": 554,
"s": 107,
"text": "There are multiple scenario... |
What does the @ prefix do on string literals in C#? | The @prefix states hat you don't need to escape special characters in the string following to the symbol.
The following statement
@"D:\new"
is equal to:
"D:\\new"
The @ prefix is also used if you want to have large strings and want it to be displayed across multiple lines. The following is an example showing multi-line... | [
{
"code": null,
"e": 1168,
"s": 1062,
"text": "The @prefix states hat you don't need to escape special characters in the string following to the symbol."
},
{
"code": null,
"e": 1192,
"s": 1168,
"text": "The following statement"
},
{
"code": null,
"e": 1202,
"s": ... |
Gradio: graphical interfaces for Machine Learning models | by Pier Paolo Ippolito | Towards Data Science | 1
2
3
4
5
6
7
8
9
10
Powered by Play.ht
Create audio with Play.ht
Create Audio Narrations with Play.ht
Creating Machine Learning models is nowadays becoming increasingly easy thanks to many open-source and proprietary based services (e.g. Python, R, SAS). Although, practitioners might always find it difficult to effici... | [
{
"code": null,
"e": 174,
"s": 172,
"text": "1"
},
{
"code": null,
"e": 176,
"s": 174,
"text": "2"
},
{
"code": null,
"e": 178,
"s": 176,
"text": "3"
},
{
"code": null,
"e": 180,
"s": 178,
"text": "4"
},
{
"code": null,
"e": 182... |
Monthly Spot Price Prediction - Time Series Analysis by State Space Method | by Sarit Maitra | Towards Data Science | ERROR: type should be string, got "https://sarit-maitra.medium.com/membership\nSARIMAX application to original series have the advantages e.g. interpret-ability of model parameters. The objective here is to develop a Seasonal Autoregressive Integrated Moving Average with external variables (SARIMAX) model which tries to account all the effects due to the price influencing factors, to forecast the monthly spot price at Henry Hub. Natural gas price is a random variable which follows a stochastic process with a random trend.\nThe ability to predict trends is more useful rather than point forecasts in a complex system like stock market. We can predict trends with greater confidence and reliability, rather than the values or levels of these quantities.\nHere, our time series forecasting model will use the past price and other variables e.g. climate, storage etc. to predict their future values Natural Gas. Our time series are influenced by lot of external factors. SARIMAX has the capability to incorporate both seasonal and non-seasonal factors in a multiplicative model. Therefore, when the time series exhibits a seasonal variation, the SARIMAX model is usually applied.\nSARIMAX model is a SARIMA model with external variables, called SARIMAX (p,d,q) (P,D,Q)S (X), where X is the vector of external variables.\nData related to prices, consumption, reserves, storage, productions, pipelines etc., and climate data including cooling/heating degree days, extreme maximum/minimum temperature, mean temperature, and mean maximum/minimum temperature for New Orleans, LA. All these data were combined together in a single file as an input data file.\nWe can see that our time-series has more than one time-dependent variable. Each variable depends on its past values and also has some dependency on other variables. We will use this dependency here to predict future values.\nSARIMAX is an example of a fully fledged model created using the state space back-end for estimation. SARIMAX model consists of five iterative steps-\nModel identification where we identify order of differencing (d), order of seasonal differencing (D), seasonal length (S), non-seasonal autoregressive order (p), seasonal autoregressive order (P), non-seasonal moving average order (q), and seasonal moving average order (Q).Parameter estimation where parameters of the identified model from step 1 are estimated.The fitness of model is diagnosed using Ljung-Box Q statistic to check the adequacy. If the residuals are not normally distributed, we need go to step 4. Otherwise, proceed to step 5.Inclusion of external variables: The relevant external variables are included into the SARIMA model using linear regression.The diagnosed model is validated using out-sample. The validated model is used for forecasting the future values.\nModel identification where we identify order of differencing (d), order of seasonal differencing (D), seasonal length (S), non-seasonal autoregressive order (p), seasonal autoregressive order (P), non-seasonal moving average order (q), and seasonal moving average order (Q).\nParameter estimation where parameters of the identified model from step 1 are estimated.\nThe fitness of model is diagnosed using Ljung-Box Q statistic to check the adequacy. If the residuals are not normally distributed, we need go to step 4. Otherwise, proceed to step 5.\nInclusion of external variables: The relevant external variables are included into the SARIMA model using linear regression.\nThe diagnosed model is validated using out-sample. The validated model is used for forecasting the future values.\nplt.figure()plt.subplot(211)plot_acf(df['hh_sp'], ax=plt.gca())plt.subplot(212)plot_pacf(df['hh_sp'], ax=plt.gca())plt.xlabel('Lag')plt.tight_layout()plt.show()\ndf = data.copy()df.set_index('Date', inplace=True)print(df.info())df = df.astype(float)res = sm.tsa.seasonal_decompose(df['hh_sp'],freq=12)fig = res.plot()fig.set_figheight(8)fig.set_figwidth(15)plt.show()\nFrom the trend plot, we do not observe any clear trend which follows somewhat stochastic movement here (random walk with drift).\nWe can see here that, just differencing is not helping to normalize the data set.\ndf.isnull().sum()def fill_missing(df):for row in range(df.shape[0]):for col in range(df.shape[1]):if np.isnan(df[row,col]):df[row,col]= df[row-1, col]fill_missing(df.values)np.isnan(df).sum()fill_missing(df.values)np.isnan(df).sum()\nWe have used feature ranking with recursive feature elimination and cross- validated selection of the best number of features using linear regression as the model.\nThe feature ranking, such that ranking_[i] corresponds to the ranking position of the i-th feature. Selected (i.e., estimated best) features are assigned rank 1.\ny = df['hh_sp']X = df.drop(['hh_sp'], axis=1)names=pd.DataFrame(X.columns)lin_reg = LinearRegression()mod = RFECV(lin_reg, step=1, cv=20) mod_fit = mod.fit(X,y) rankings=pd.DataFrame(mod_fit.ranking_, index=names) #Make it into data framerankings.rename(columns ={0: 'Rank'}, inplace=True)rankings.transpose()\n14 features are selected for inclusion in the model\nLet us define our target; we will project next 5 months spot price.\ndf['target'] = df['hh_sp'].shift(-5)df.dropna(inplace=True)n = df.drop(['target'], axis=1) # storing in a dataframe for future usedataset = df[['im_pr','ex_pr','prod_mp','prod_liq','prod_dng','imp_tot','imp_pip','ImpLiq', 'mean_max_txt', 'mean_min_txt', 'mean_txt', 'mean_max_lat', 'mean_min_lat','mean_lat', 'target' ]]dataset.describe()\nX = np.array(dataset.drop(['target'], 1))y = np.array(dataset['target'])tscv = TimeSeriesSplit(max_train_size=None, n_splits=5)for train_samples, test_samples in tscv.split(X):#print(\"TRAIN:\", train_samples, \"TEST:\", test_samples)X_train, X_test = X[train_samples], X[test_samples]y_train, y_test = y[train_samples], y[test_samples]print(X_train.shape, y_train.shape, X_test.shape, y_test.shape)feature_names = ['im_pr','ex_pr','prod_mp','prod_liq','prod_dng','imp_tot','imp_pip','ImpLiq','mean_max_tx', 'mean_min_txt', 'mean_txt', 'mean_max_lat', 'mean_min_lat','mean_lat' ]X_train = pd.DataFrame(data=X_train, columns=feature_names)X_train.index = dataset[:186].indexy_train = pd.DataFrame(y_train, columns = ['target'])y_train.index = X_train.indexX_test = pd.DataFrame(data=X_test, columns=feature_names)X_test.index = dataset[186:].indexy_test = pd.DataFrame(y_test, columns = ['target'])y_test.index = X_test.index\nKnowing that, stock price in general follow random walk; the first stage is to generate a set of changes or differences for each of the variables, since spot price can be explained by reference to the unexpected changes in the set of chosen variables rather than their levels. The unexpected value of a variable can be defined as the difference between the actual value of the variable and its expected value. The entire change in the variables from one period to the next is the unexpected change\nThe advantage of series being stationary is that, the effect of a shock will ease out gradually compared to non-stationary system where effect of shock is permanent.\nWhether or not to use differencing partially conditional maximum likelihood estimation. If True, differencing is performed prior to estimation, which discards the first sD+d initial rows but results in a smaller state-space formulation. See the Notes section for important details about interpreting results when this option is used. If False, the full SARIMAX model is put in state-space form so that all data points can be used in estimation. Default is False.\nAs we know that, SARIMAX combines the ARIMA model with the ability to perform the same auto-regression, differencing, and moving average modeling at the seasonal level. Let us estimate the parameters using maximum likelihood method.\n# Fit auto_arima functionstepwise_fit = auto_arima(y_train_tran, X_train_tran, start_p = 1, start_q = 1, max_p = 7, max_q = 7, m = 12, start_P = 0, seasonal = True,d = None, D = 1, trace = True, error_action ='ignore', suppress_warnings = True, stepwise = True) # To print the summarystepwise_fit.summary()\nThe p-values of the parameters of the model shows that the seasonal and non-seasonal AR and MA values are not significant at 5% level .\nHere, exogenous variables are given as parallel input sequences that have observations at the same time steps as the endogenous series.\n# fit modelmodel = sm.tsa.statespace.SARIMAX( endog = y_train_tran, exog = X_train_tran, order = (0, 0, 0), seasonal_order = (2, 1, 1, 12), enforce_invertibility = False, enforce_stationarity = False)model_fit = model.fit(disp = False)model_fit.summary()\nThis tests the null hypothesis of all the slope parameters being jointly zero. The p-value of zero attached to the test statistic shows that this null hypothesis should be rejected. Here, all our parameters are having p> 0.05 and therefore null hypothesis cannot be rejected.\nThe model is diagnosed using the Ljung-Box Q statistic which indicates that the residuals are not white noise. The null hypothesis of the Box Ljung Test, H0, is that our model does not show lack of fit.\nDiagnostic plots help us determine visually how our model is fitting the data and if any of the basic assumptions of an SARIMAX model are being violated.\nWe can see that, the underlying error distribution is Gaussian with constant mean and standard deviation of parametric assumptions.\n# Fit a local level modelendog = ytest_tranlocal_model = sm.tsa.UnobservedComponents(endog, 'local level')# Fit the model via maximum likelihoodresult = local_model.fit()# result is an instance of the Unobserved Components Results classprint(result.summary())# Show a plot of the estimated level and trend component seriesfig = result.plot_components()plt.tight_layout()\nX_test_tran = np.log(X_test).diff()Xtest_tran = X_test_tran.copy()Xtest_tran = Xtest_tran[~Xtest_tran.isin([np.nan, np.inf, -np.inf]).any(1)]Xtest_tran.describe()y_test_log = np.log(y_test['target']).dropna()y_test_tran = y_test_log.diff().dropna()ytest_tran = y_test_tran.copy()#ytest_tran = ytest_tran[~ytest_tran.isin([np.nan, np.inf, -np.inf]).any(1)]ytest_tran.describe()\nrebuilt = pred.cumsum().fillna(0)print('\\nCumsum:\\n', rebuilt.tail())rebuilt_further = rebuilt + y_test_log[-1:] # last value of test setprint('\\nDe-difference:\\n',rebuilt_further.tail())original = np.exp(rebuilt_further)print('\\nOriginal form:\\n',original.tail())\nWe had shifted our target variables to 5 periods (months); therefore, above should be future 5 months forecast. Let us do some data manipulation to get future dates as shown below.\nIt can be noticed that, setting up monthly frequency by fault shows future all dates are end of month instead 15 as per original data set. Well, this can also be fixed to synchronize with original data.\n# Graphfig, ax = plt.subplots(figsize=(10,5))ax.set(title='Henry Hub Spot price', xlabel='Date', ylabel='USD / Mbtu')# Plot data pointsy_test.plot(ax=ax, label='Observed')# Plot predictionsoriginal.plot(ax=ax, style='r--', label='One-step-ahead forecast')legend = ax.legend(loc='best')\nMoreover, it is also possible to get the the confidence interval between upper and lower level of predicted price and draw confidence interval plot too.\nIt is always a good idea to start with a simple model and test whether it is good enough for its purpose. Applying iterative modeling approach we can add features gradually. Comparing results of successive models provides a form of internal validation, so we can catch conceptual, mathematical, and software errors. By adding and removing features, we can tell which ones have the biggest effect on the results, and which can be ignored.\nThe important assumption of time series forecasting is the current price is a function of the demand and past price. However, the relation is not just straight forward; demand also depends on climatic condition, import/export price etc. A set of 14 variables are found through recursive feature elimination methods. These variables are found to be important to determine monthly Natural Gas spot price. SARIMAX model is used here for price forecasting, which has a distinct advantage in its explanation of the outlying data. Based on prediction, we could see that SARIMAX prediction can follow the pattern of actual data smoothly.\nI can be reached here." | [
{
"code": null,
"e": 214,
"s": 171,
"text": "https://sarit-maitra.medium.com/membership"
},
{
"code": null,
"e": 663,
"s": 214,
"text": "SARIMAX application to original series have the advantages e.g. interpret-ability of model parameters. The objective here is to develop a Seaso... |
Flipkart Interview | Set 3 - GeeksforGeeks | 27 Sep, 2021
Recently I appeared for Flipkart Interview. I would like to share my experience.
Round-1: Telephonic (45 mins)
Given an array of n distinct integers sorted in ascending order. Find an index i s.t ar[i] = i. Return -1 if no such index exists. Note that integers in array can be negative. Article Link: h... | [
{
"code": null,
"e": 24994,
"s": 24966,
"text": "\n27 Sep, 2021"
},
{
"code": null,
"e": 25076,
"s": 24994,
"text": "Recently I appeared for Flipkart Interview. I would like to share my experience. "
},
{
"code": null,
"e": 25110,
"s": 25078,
"text": "Round-1:... |
Sqoop - List Tables | This chapter describes how to list out the tables of a particular database in MySQL database server using Sqoop. Sqoop list-tables tool parses and executes the ‘SHOW TABLES’ query against a particular database. Thereafter, it lists out the present tables in a database.
The following syntax is used for Sqoop list-tables... | [
{
"code": null,
"e": 2057,
"s": 1787,
"text": "This chapter describes how to list out the tables of a particular database in MySQL database server using Sqoop. Sqoop list-tables tool parses and executes the ‘SHOW TABLES’ query against a particular database. Thereafter, it lists out the present table... |
Detecting Objects in Flutter. Using tflite and SSD-MobileNet | by Rupak Karki | Towards Data Science | In this guide, we will be developing an application in Flutter using the tflite package and a pre-trained SSD-MobileNet model, capable of detecting objects in images and real-time camera stream. This application is capable of detecting objects offline. We will also be able to take pictures from within the app and feed ... | [
{
"code": null,
"e": 522,
"s": 171,
"text": "In this guide, we will be developing an application in Flutter using the tflite package and a pre-trained SSD-MobileNet model, capable of detecting objects in images and real-time camera stream. This application is capable of detecting objects offline. We... |
Hadoop – getmerge Command | 29 Jun, 2020
Hadoop -getmerge command is used to merge multiple files in an HDFS(Hadoop Distributed File System) and then put it into one single output file in our local file system.
We want to merge the 2 files present inside are HDFS i.e. file1.txt and file2.txt, into a single file output.txt in our local file system... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n29 Jun, 2020"
},
{
"code": null,
"e": 198,
"s": 28,
"text": "Hadoop -getmerge command is used to merge multiple files in an HDFS(Hadoop Distributed File System) and then put it into one single output file in our local file system."
},... |
Implicit Type Conversion in C with Examples | 25 Nov, 2019
Prerequisite: Data Types, Type Conversion
Implicit Type Conversion is also known as ‘automatic type conversion‘. It is done by the compiler on its own, without any external trigger from the user. It generally takes place when in an expression more than one data type is present. In such condition type conve... | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n25 Nov, 2019"
},
{
"code": null,
"e": 94,
"s": 52,
"text": "Prerequisite: Data Types, Type Conversion"
},
{
"code": null,
"e": 527,
"s": 94,
"text": "Implicit Type Conversion is also known as ‘automatic type convers... |
Different ways to create objects in Java | 13 Jun, 2022
There are several ways by which we can create objects of a class in java as we all know a class provides the blueprint for objects, you create an object from a class. This concept is under-rated and sometimes proves to be beneficial as this concept is bypassed by many programmers and sometimes even do ask ... | [
{
"code": null,
"e": 54,
"s": 26,
"text": "\n13 Jun, 2022"
},
{
"code": null,
"e": 388,
"s": 54,
"text": "There are several ways by which we can create objects of a class in java as we all know a class provides the blueprint for objects, you create an object from a class. This co... |
Concept of Isolates in Dart | 20 Jul, 2020
Dart was traditionally designed to create single-page applications. And we also know that most computers, even mobile platforms, have multi-core CPUs. To take advantage of all those cores, developers traditionally use shared-memory threads running concurrently. However, shared-state concurrency is error-pr... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n20 Jul, 2020"
},
{
"code": null,
"e": 541,
"s": 28,
"text": "Dart was traditionally designed to create single-page applications. And we also know that most computers, even mobile platforms, have multi-core CPUs. To take advantage of all... |
Implement Splash Screen and Authentication in Social Media Android App | 13 Jun, 2022
This is the Part 1 of “Build a Social Media App on Android Studio” tutorial, and we are going to cover the following functionalities in this article:
Creating a Splash Screen
Authentication Part:Registration, andLogin
Registration, and
Login
Step 1: Create a New Project
To create a new project in Android S... | [
{
"code": null,
"e": 54,
"s": 26,
"text": "\n13 Jun, 2022"
},
{
"code": null,
"e": 204,
"s": 54,
"text": "This is the Part 1 of “Build a Social Media App on Android Studio” tutorial, and we are going to cover the following functionalities in this article:"
},
{
"code": nu... |
Number of Symmetric Relations on a Set | 19 May, 2022
Given a number n, find out the number of Symmetric Relations on a set of first n natural numbers {1, 2, ..n}.
Examples:
Input : n = 2
Output : 8
Given set is {1, 2}. Below are all symmetric relation.
{}
{(1, 1)},
{(2, 2)},
{(1, 1), (2, 2)},
{(1, 2), (2, 1)}
{(1, 1), (1, 2), (2, 1)},
{(2, 2), (1, 2),... | [
{
"code": null,
"e": 54,
"s": 26,
"text": "\n19 May, 2022"
},
{
"code": null,
"e": 164,
"s": 54,
"text": "Given a number n, find out the number of Symmetric Relations on a set of first n natural numbers {1, 2, ..n}."
},
{
"code": null,
"e": 175,
"s": 164,
"tex... |
What are Wild Pointers? How can we avoid? | 01 Oct, 2018
Uninitialized pointers are known as wild pointers because they point to some arbitrary memory location and may cause a program to crash or behave badly.
int main(){ int *p; /* wild pointer */ /* Some unknown memory location is being corrupted. This should never be done. */ *p = 12; }
Please note t... | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n01 Oct, 2018"
},
{
"code": null,
"e": 205,
"s": 52,
"text": "Uninitialized pointers are known as wild pointers because they point to some arbitrary memory location and may cause a program to crash or behave badly."
},
{
"code":... |
Secure coding – What is it all about? | 21 Jan, 2022
So you think you can code? Well that’s great to know... The world definitely needs more geeks and nerds like you and me... But, are your programs secure? This is what this whole article is all about.
As a programmer, it is not only your job but also moral responsibility to ensure that your codes don’... | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n21 Jan, 2022"
},
{
"code": null,
"e": 256,
"s": 56,
"text": "So you think you can code? Well that’s great to know... The world definitely needs more geeks and nerds like you and me... But, are your programs secure? This is what this wh... |
Printing Items in 0/1 Knapsack | 23 Jun, 2022
Given weights and values of n items, put these items in a knapsack of capacity W to get the maximum total value in the knapsack. In other words, given two integer arrays, val[0..n-1] and wt[0..n-1] represent values and weights associated with n items respectively. Also given an integer W which represents k... | [
{
"code": null,
"e": 54,
"s": 26,
"text": "\n23 Jun, 2022"
},
{
"code": null,
"e": 619,
"s": 54,
"text": "Given weights and values of n items, put these items in a knapsack of capacity W to get the maximum total value in the knapsack. In other words, given two integer arrays, val... |
Add a key value pair to dictionary in Python | Python dictionaries are an unordered collection of key value pairs. In this tutorial we will see how we can add new key value pairs to an already defined dictionary. Below are the two approaches which we can use.
We add a new element to the dictionary by using a new key as a subscript and assigning it a value.
CountryC... | [
{
"code": null,
"e": 1275,
"s": 1062,
"text": "Python dictionaries are an unordered collection of key value pairs. In this tutorial we will see how we can add new key value pairs to an already defined dictionary. Below are the two approaches which we can use."
},
{
"code": null,
"e": 137... |
MongoDB - Sort Records | In this chapter, we will learn how to sort records in MongoDB.
To sort documents in MongoDB, you need to use sort() method. The method accepts a document containing a list of fields along with their sorting order. To specify sorting order 1 and -1 are used. 1 is used for ascending order while -1 is used for descending ... | [
{
"code": null,
"e": 2616,
"s": 2553,
"text": "In this chapter, we will learn how to sort records in MongoDB."
},
{
"code": null,
"e": 2880,
"s": 2616,
"text": "To sort documents in MongoDB, you need to use sort() method. The method accepts a document containing a list of fields ... |
How to sort, select and query subdocument in MongoDB? | To sort, use $sort in MongoDB. Let us create a collection with documents −
> db.demo236.insertOne({"details":{"Name":"Chris","Age":21}});
{
"acknowledged" : true,
"insertedId" : ObjectId("5e419015f4cebbeaebec514c")
}
> db.demo236.insertOne({"details":{"Name":"David","Age":23}});
{
"acknowledged" : true,
"in... | [
{
"code": null,
"e": 1137,
"s": 1062,
"text": "To sort, use $sort in MongoDB. Let us create a collection with documents −"
},
{
"code": null,
"e": 1579,
"s": 1137,
"text": "> db.demo236.insertOne({\"details\":{\"Name\":\"Chris\",\"Age\":21}});\n{\n \"acknowledged\" : true,\n ... |
DateTimeOffset.ToOffset() Method in C# | The DateTimeOffset.ToOffset() method in C# is used to convert the value of the current DateTimeOffset object to the date and time specified by an offset value.
Following is the syntax −
public DateTimeOffset ToOffset (TimeSpan val);
Above, the value is the offset to convert the DateTimeOffset value to.
Let us now see a... | [
{
"code": null,
"e": 1222,
"s": 1062,
"text": "The DateTimeOffset.ToOffset() method in C# is used to convert the value of the current DateTimeOffset object to the date and time specified by an offset value."
},
{
"code": null,
"e": 1248,
"s": 1222,
"text": "Following is the synta... |
Visualizing Location based data in R | by Aditya Tandel | Towards Data Science | I recently got an opportunity to work on spatial data and wanted to share my analysis on one such dataset.
The data consisted of various registered business in the San Francisco Bay Area which can be found here. An updated version can be found here.
Spatial data pertains to data which is associated with locations. Typi... | [
{
"code": null,
"e": 278,
"s": 171,
"text": "I recently got an opportunity to work on spatial data and wanted to share my analysis on one such dataset."
},
{
"code": null,
"e": 421,
"s": 278,
"text": "The data consisted of various registered business in the San Francisco Bay Area... |
How to set encoding in PHP FPDI library? | Below is the same code to set encoding for FPDI library−
Add new fonts that have the correct alphabets.
$pdf->AddFont('DejaVu','','DejaVuSansCondensed.php');
$pdf->SetFont('DejaVu', '', 10, '', false);
The following are three possible encodings that are possible.
cp1250 (Central Europe)
cp1251 (Cyrillic)
cp1252 (Wester... | [
{
"code": null,
"e": 1119,
"s": 1062,
"text": "Below is the same code to set encoding for FPDI library−"
},
{
"code": null,
"e": 1166,
"s": 1119,
"text": "Add new fonts that have the correct alphabets."
},
{
"code": null,
"e": 1264,
"s": 1166,
"text": "$pdf->A... |
C# | Math.Tan() Method - GeeksforGeeks | 31 Jan, 2019
Math.Tan() is an inbuilt Math class method which returns the tangent of a given double value argument(specified angle).
Syntax:
public static double Tan(double num)
Parameter:
num: It is the angle(measured in radian) whose tangent is to be returned and the type of this parameter is System.Double.
Return Va... | [
{
"code": null,
"e": 24222,
"s": 24194,
"text": "\n31 Jan, 2019"
},
{
"code": null,
"e": 24342,
"s": 24222,
"text": "Math.Tan() is an inbuilt Math class method which returns the tangent of a given double value argument(specified angle)."
},
{
"code": null,
"e": 24350,... |
Kalman Filter in a Nutshell. Taking a tour through Kalman filter... | by Shuo Wang | Towards Data Science | When I first started learning to use Kalman filter, it seemed very complicated to me, mainly because there were so many inputs to it and you never really knew if you’ve set them correctly. By going through this example, I hope my readers will understand that the motivations and logic behind it is really very pragmatic ... | [
{
"code": null,
"e": 535,
"s": 171,
"text": "When I first started learning to use Kalman filter, it seemed very complicated to me, mainly because there were so many inputs to it and you never really knew if you’ve set them correctly. By going through this example, I hope my readers will understand t... |
Importance of Loss Function in Machine Learning | by Aditya Rakhecha | Towards Data Science | Originally published at OpenGenus IQ.
Assume you are given a task to fill a bag with 10 Kg of sand. You fill it up till the measuring machine gives you a perfect reading of 10 Kg or you take out the sand if the reading exceeds 10kg.
Just like that weighing machine, if your predictions are off, your loss function will o... | [
{
"code": null,
"e": 210,
"s": 172,
"text": "Originally published at OpenGenus IQ."
},
{
"code": null,
"e": 405,
"s": 210,
"text": "Assume you are given a task to fill a bag with 10 Kg of sand. You fill it up till the measuring machine gives you a perfect reading of 10 Kg or you ... |
Explain the performance of Addition and Subtraction with signed magnitude data in computer architecture? | A signed-magnitude method is used by computers to implement floating-point operations. Signed-2’s complement method is used by most computers for arithmetic operations executed on integers. In this approach, the leftmost bit in the number is used for signifying the sign; 0 indicates a positive integer, and 1 indicates ... | [
{
"code": null,
"e": 1474,
"s": 1062,
"text": "A signed-magnitude method is used by computers to implement floating-point operations. Signed-2’s complement method is used by most computers for arithmetic operations executed on integers. In this approach, the leftmost bit in the number is used for si... |
Python Number min() Method | Python number method min() returns the smallest of its arguments: the value closest to negative infinity.
Following is the syntax for min() method −
min( x, y, z, .... )
x − This is a numeric expression.
x − This is a numeric expression.
y − This is also a numeric expression.
y − This is also a numeric expression.
z ... | [
{
"code": null,
"e": 2351,
"s": 2244,
"text": "Python number method min() returns the smallest of its arguments: the value closest to negative infinity."
},
{
"code": null,
"e": 2394,
"s": 2351,
"text": "Following is the syntax for min() method −"
},
{
"code": null,
... |
How we can update a Python tuple element value? | Python tuple is an immutable object. Hence any operation that tries to update it is not allowed. However, following workaround can be used.
First, convert tuple to list by built-in function list(). You can always update an item to list object assigning new value to element at certain index. Then use another built-in fu... | [
{
"code": null,
"e": 1327,
"s": 1187,
"text": "Python tuple is an immutable object. Hence any operation that tries to update it is not allowed. However, following workaround can be used."
},
{
"code": null,
"e": 1565,
"s": 1327,
"text": "First, convert tuple to list by built-in f... |
Signals in C language | 08 Feb, 2018
Prerequisite : Fork system call, Wait system callA signal is a software generated interrupt that is sent to a process by the OS because of when user press ctrl-c or another process tell something to this process.There are fix set of signals that can be sent to a process. signal are identified by integers.S... | [
{
"code": null,
"e": 54,
"s": 26,
"text": "\n08 Feb, 2018"
},
{
"code": null,
"e": 498,
"s": 54,
"text": "Prerequisite : Fork system call, Wait system callA signal is a software generated interrupt that is sent to a process by the OS because of when user press ctrl-c or another p... |
Shallow Copy and Deep Copy in C++ | 16 Jun, 2022
In general, creating a copy of an object means to create an exact replica of the object having the same literal value, data type, and resources.
Copy Constructor
Default assignment operator
// Copy ConstructorGeeks Obj1(Obj);orGeeks Obj1 = Obj;
// Default assignment operatorGeeks Obj2;Obj2 = Obj1;
Dependin... | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n16 Jun, 2022"
},
{
"code": null,
"e": 197,
"s": 52,
"text": "In general, creating a copy of an object means to create an exact replica of the object having the same literal value, data type, and resources."
},
{
"code": null,
... |
Find the number of paths of length K in a directed graph | 19 Jul, 2021
Given a directed, unweighted graph with N vertices and an integer K. The task is to find the number of paths of length K for each pair of vertices (u, v). Paths don’t have to be simple i.e. vertices and edges can be visited any number of times in a single path. The graph is represented as adjacency matrix ... | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n19 Jul, 2021"
},
{
"code": null,
"e": 503,
"s": 52,
"text": "Given a directed, unweighted graph with N vertices and an integer K. The task is to find the number of paths of length K for each pair of vertices (u, v). Paths don’t have to... |
Method and Block Synchronization in Java | 16 Oct, 2019
Threads communicate primarily by sharing access to fields and the objects reference fields refer to. This form of communication is extremely efficient, but makes two kinds of errors possible: thread interference and memory consistency errors. Some synchronization constructs are needed to prevent these erro... | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n16 Oct, 2019"
},
{
"code": null,
"e": 430,
"s": 52,
"text": "Threads communicate primarily by sharing access to fields and the objects reference fields refer to. This form of communication is extremely efficient, but makes two kinds of... |
Java Program to Swap two Variables | 08 Jun, 2021
Given two numbers x and y, we need to swap their valuesExamples:
Input : x = 10, y = 20;
Output : x = 20, y = 10
Input : x = 200, y = 100
Output : x = 100, y = 200
Below are the simple steps we follow: 1) Assign x to a temp variable : temp = x 2) Assign y to x : x = y 3) Assign temp to y : y = tempL... | [
{
"code": null,
"e": 53,
"s": 25,
"text": "\n08 Jun, 2021"
},
{
"code": null,
"e": 120,
"s": 53,
"text": "Given two numbers x and y, we need to swap their valuesExamples: "
},
{
"code": null,
"e": 220,
"s": 120,
"text": "Input : x = 10, y = 20;\nOutput : x = ... |
Python – Status object in Tweepy | 03 Jul, 2020
Twitter is a popular social network where users share messages called tweets. Twitter allows us to mine the data of any user using Twitter API or Tweepy. The data will be tweets extracted from the user. The first thing to do is get the consumer key, consumer secret, access key and access secret from twitte... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n03 Jul, 2020"
},
{
"code": null,
"e": 428,
"s": 28,
"text": "Twitter is a popular social network where users share messages called tweets. Twitter allows us to mine the data of any user using Twitter API or Tweepy. The data will be twee... |
Transpose a matrix in Single line in Python | 24 Dec, 2021
Transpose of a matrix is a task we all can perform very easily in python (Using a nested loop). But there are some interesting ways to do the same in a single line.In Python, we can implement a matrix as nested list (list inside a list). Each element is treated as a row of the matrix. For example m = [[1, ... | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n24 Dec, 2021"
},
{
"code": null,
"e": 506,
"s": 52,
"text": "Transpose of a matrix is a task we all can perform very easily in python (Using a nested loop). But there are some interesting ways to do the same in a single line.In Python,... |
Reversal algorithm for right rotation of an array | 09 Jun, 2022
Given an array, right rotate it by k elements.
After K=3 rotation
Examples:
Input: arr[] = {1, 2, 3, 4, 5,
6, 7, 8, 9, 10}
k = 3
Output: 8 9 10 1 2 3 4 5 6 7
Input: arr[] = {121, 232, 33, 43 ,5}
k = 2
Output: 43 5 121 232 33
Note : In the below solution, k is ... | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n09 Jun, 2022"
},
{
"code": null,
"e": 101,
"s": 52,
"text": "Given an array, right rotate it by k elements. "
},
{
"code": null,
"e": 122,
"s": 101,
"text": "After K=3 rotation "
},
{
"code": null,
"e"... |
Snowflakes Fractal using Python | 23 Sep, 2021
To create Snowflake fractals using Python programmingWhat are fractals
A fractal is a never-ending pattern. Fractals are infinitely complex patterns that are self-similar across different scales. They are created by repeating a simple process over and over in an ongoing feedback loop. Driven by recursion,... | [
{
"code": null,
"e": 54,
"s": 26,
"text": "\n23 Sep, 2021"
},
{
"code": null,
"e": 126,
"s": 54,
"text": "To create Snowflake fractals using Python programmingWhat are fractals "
},
{
"code": null,
"e": 426,
"s": 126,
"text": "A fractal is a never-ending patte... |
Difference between semantic and non-semantic elements | 11 Sep, 2020
Semantic HTML elements:These elements simply mean, elements with meaning. The reason being, there definition in the code tells the browser and the developer what they are supposed to do. Framing in simpler words, these elements describe the type of content they are supposed to contain.
Following is the lis... | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n11 Sep, 2020"
},
{
"code": null,
"e": 339,
"s": 52,
"text": "Semantic HTML elements:These elements simply mean, elements with meaning. The reason being, there definition in the code tells the browser and the developer what they are sup... |
Insert a node in Linked List before a given node | 24 Sep, 2021
Given a node of Linked List N and a value K, the task is to insert the node with value K in the linked list before the given node N.
Structure of the Node:
C++
Java
Python3
C#
Javascript
// Structure of Nodestruct Node { int data; Node* next; // Constructor of Node Node(int val, Node* link = 0... | [
{
"code": null,
"e": 53,
"s": 25,
"text": "\n24 Sep, 2021"
},
{
"code": null,
"e": 186,
"s": 53,
"text": "Given a node of Linked List N and a value K, the task is to insert the node with value K in the linked list before the given node N."
},
{
"code": null,
"e": 209,... |
Difference between Queue and Deque in C++ - GeeksforGeeks | 02 Nov, 2021
Queue: A Queue is a linear data structure that follows a First In First Out (FIFO) order in which the operations are performed. It is a type of container adaptor where elements are inserted into one end of the container and deleted from the other.
Functions:
empty(): Tests whether the queue is empty.
size(... | [
{
"code": null,
"e": 24200,
"s": 24172,
"text": "\n02 Nov, 2021"
},
{
"code": null,
"e": 24448,
"s": 24200,
"text": "Queue: A Queue is a linear data structure that follows a First In First Out (FIFO) order in which the operations are performed. It is a type of container adaptor w... |
Make HTML5 Canvas fill the whole page | To make canvas fill the whole page, you need to be 100% in width and height of the page.
* {
margin: 0;
padding: 0;
}
body, html {
height:100%;
}
#canvas {
position:absolute;
height:100%; width:100%;
} | [
{
"code": null,
"e": 1151,
"s": 1062,
"text": "To make canvas fill the whole page, you need to be 100% in width and height of the page."
},
{
"code": null,
"e": 1279,
"s": 1151,
"text": "* {\n margin: 0;\n padding: 0;\n}\nbody, html {\n height:100%;\n}\n#canvas {\n positi... |
Updating Data into MySQL Database | Data can be updated into MySQL tables by executing SQL UPDATE statement through PHP function mysql_query.
Below is a simple example to update records into employee table. To update a record in any table it is required to locate that record by using a conditional clause. Below example uses primary key to match a record ... | [
{
"code": null,
"e": 2863,
"s": 2757,
"text": "Data can be updated into MySQL tables by executing SQL UPDATE statement through PHP function mysql_query."
},
{
"code": null,
"e": 3096,
"s": 2863,
"text": "Below is a simple example to update records into employee table. To update a... |
MongoDB - $pop Operator - GeeksforGeeks | 10 May, 2020
MongoDB provides different types of array update operators to update the values of the array fields in the documents and $pop operator is one of them. This operator is used to remove the first or the last item from the array.
Syntax:
{ $pop: { <field>: <-1 | 1>, ... } }
Here, <field> can specify with dot n... | [
{
"code": null,
"e": 23879,
"s": 23851,
"text": "\n10 May, 2020"
},
{
"code": null,
"e": 24105,
"s": 23879,
"text": "MongoDB provides different types of array update operators to update the values of the array fields in the documents and $pop operator is one of them. This operato... |
AWS Cloud Computing | The client-server model is an important concept in cloud computing.
It is about many clients using services from a centralized server.
Read about the Benefits of Cloud Computing at: Cloud Benefits
The Client-Server model is about a client that interacts and makes requests to a computer server.
A client is the way that ... | [
{
"code": null,
"e": 68,
"s": 0,
"text": "The client-server model is an important concept in cloud computing."
},
{
"code": null,
"e": 135,
"s": 68,
"text": "It is about many clients using services from a centralized server."
},
{
"code": null,
"e": 197,
"s": 135,... |
How to delete last element from a List in C++ STL - GeeksforGeeks | 18 Jan, 2019
Given a List, the task is to remove the last element from this List in C++.
Examples:
Input: list = [10 20 30 70 80 90 100 40 50 60]
Output: 10 20 30 40 50 60 70 80 90
Input: list = [1 2 3 4 5]
Output: 1 2 3 4
Lists are a type of associative containers in which each element has to be unique because the v... | [
{
"code": null,
"e": 24599,
"s": 24571,
"text": "\n18 Jan, 2019"
},
{
"code": null,
"e": 24675,
"s": 24599,
"text": "Given a List, the task is to remove the last element from this List in C++."
},
{
"code": null,
"e": 24685,
"s": 24675,
"text": "Examples:"
}... |
Print sorted distinct elements of array - GeeksforGeeks | 09 Jun, 2021
Given an array that might contain duplicates, print all distinct elements in sorted order.
Examples:
Input : 1, 3, 2, 2, 1
Output : 1 2 3
Input : 1, 1, 1, 2, 2, 3
Output : 1 2 3
Simple Solution is to sort the array first, then traverse the array and print only first occurrences of elements.
Another App... | [
{
"code": null,
"e": 26921,
"s": 26893,
"text": "\n09 Jun, 2021"
},
{
"code": null,
"e": 27012,
"s": 26921,
"text": "Given an array that might contain duplicates, print all distinct elements in sorted order."
},
{
"code": null,
"e": 27023,
"s": 27012,
"text": ... |
Position monitor detector in Ubuntu(build with opencv on python3) | by Dmitriy Kisil | Towards Data Science | And keep distance appropriate, because sitting to close is not good for your eyes. After learning a bit of opencv library, I am thinking about the simple implementation of this idea.
According to ergonomics tips(get it from here):
Adjust the monitor height so that the top of the screen is at — or slightly below — eye l... | [
{
"code": null,
"e": 354,
"s": 171,
"text": "And keep distance appropriate, because sitting to close is not good for your eyes. After learning a bit of opencv library, I am thinking about the simple implementation of this idea."
},
{
"code": null,
"e": 402,
"s": 354,
"text": "Acc... |
C# - Strings | In C#, you can use strings as array of characters, However, more common practice is to use the string keyword to declare a string variable. The string keyword is an alias for the System.String class.
You can create string object using one of the following methods −
By assigning a string literal to a String variable
By ... | [
{
"code": null,
"e": 2470,
"s": 2270,
"text": "In C#, you can use strings as array of characters, However, more common practice is to use the string keyword to declare a string variable. The string keyword is an alias for the System.String class."
},
{
"code": null,
"e": 2536,
"s": 2... |
Tryit Editor v3.7 | Tryit: Using the animation-delay property | [] |
How to use Style Sheet in HTML? | The stylesheet is used in HTML to describe how a document is presented on screen. With CSS, easily specify a number of style properties for an HTML element. Each property has a name and a value, which is separated by a colon (:).
You can use CSS in three ways in your HTML document −
External Style Sheet − Define style ... | [
{
"code": null,
"e": 1292,
"s": 1062,
"text": "The stylesheet is used in HTML to describe how a document is presented on screen. With CSS, easily specify a number of style properties for an HTML element. Each property has a name and a value, which is separated by a colon (:)."
},
{
"code": n... |
java.time.ZonedDateTime. withZoneSameInstant() Method Example | The java.time.ZonedDateTime.withZoneSameInstant(ZoneId zone) method returns a copy of this date-time with a different time-zone, retaining the instant.
Following is the declaration for java.time.ZonedDateTime.withZoneSameInstant(ZoneId zone) method.
public ZonedDateTime withZoneSameInstant(ZoneId zone)
zone − the time... | [
{
"code": null,
"e": 2067,
"s": 1915,
"text": "The java.time.ZonedDateTime.withZoneSameInstant(ZoneId zone) method returns a copy of this date-time with a different time-zone, retaining the instant."
},
{
"code": null,
"e": 2165,
"s": 2067,
"text": "Following is the declaration f... |
Magnitude Comparator in Digital Logic - GeeksforGeeks | 19 Feb, 2021
A magnitude digital Comparator is a combinational circuit that compares two digital or binary numbers in order to find out whether one binary number is equal, less than or greater than the other binary number. We logically design a circuit for which we will have two inputs one for A and other for B and hav... | [
{
"code": null,
"e": 26754,
"s": 26726,
"text": "\n19 Feb, 2021"
},
{
"code": null,
"e": 27166,
"s": 26754,
"text": "A magnitude digital Comparator is a combinational circuit that compares two digital or binary numbers in order to find out whether one binary number is equal, less... |
Change the size of MessageBox - Tkinter - GeeksforGeeks | 21 Aug, 2021
Python have many libraries for GUI. Tkinter is one of the libraries that provides a Graphical user interface. For the Short Message, we can use the MessageBox Library. It has many functions for the effective interface. In this MessageBox library provide different type of functions to Display Message Box.
s... | [
{
"code": null,
"e": 24372,
"s": 24344,
"text": "\n21 Aug, 2021"
},
{
"code": null,
"e": 24678,
"s": 24372,
"text": "Python have many libraries for GUI. Tkinter is one of the libraries that provides a Graphical user interface. For the Short Message, we can use the MessageBox Libr... |
How to change Input characters to Upper Case while typing using CSS/jQuery ? - GeeksforGeeks | 20 Dec, 2019
Given an input text area and the task is to transform the lowercase characters into uppercase characters while taking input from user. It can be done using CSS or JavaScript. The first approach uses CSS transform property and the second approach uses JavaScript to convert the lowercase character to upper c... | [
{
"code": null,
"e": 27089,
"s": 27061,
"text": "\n20 Dec, 2019"
},
{
"code": null,
"e": 27411,
"s": 27089,
"text": "Given an input text area and the task is to transform the lowercase characters into uppercase characters while taking input from user. It can be done using CSS or ... |
JavaScript - Void Keyword | void is an important keyword in JavaScript which can be used as a unary operator that appears before its single operand, which may be of any type. This operator specifies an expression to be evaluated without returning a value.
The syntax of void can be either of the following two −
<head>
<script type = "text/javas... | [
{
"code": null,
"e": 2694,
"s": 2466,
"text": "void is an important keyword in JavaScript which can be used as a unary operator that appears before its single operand, which may be of any type. This operator specifies an expression to be evaluated without returning a value."
},
{
"code": nul... |
How to use both Tailwind CSS and Bootstrap 4 at the same time ? | 24 Dec, 2021
In this article, we will know how to use Bootstrap with Tailwind CSS, at a moment, in the same code. We can use both the CSS frameworks together but it is not recommended. Because few classes will contradict with each other like “container”, “clearfix”, etc. As we know that Bootstrap is a known CSS framewo... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n24 Dec, 2021"
},
{
"code": null,
"e": 704,
"s": 28,
"text": "In this article, we will know how to use Bootstrap with Tailwind CSS, at a moment, in the same code. We can use both the CSS frameworks together but it is not recommended. Bec... |
Program for Area Of Square | 21 Jun, 2022
A square is a flat shape, in one plane, defined by four points at the four corners. A square has four sides all of equal length, and four corners, all right angles (90 degree angles). A square is a kind of rectangle.
Examples :
Input : 4
Output :16
Input :8
Output :64
Formula
C++
Java
Python3
C#
P... | [
{
"code": null,
"e": 54,
"s": 26,
"text": "\n21 Jun, 2022"
},
{
"code": null,
"e": 273,
"s": 54,
"text": "A square is a flat shape, in one plane, defined by four points at the four corners. A square has four sides all of equal length, and four corners, all right angles (90 degree... |
Handling the Divide by Zero Exception in C++ | 23 Jan, 2019
We use Exception Handling to overcome exceptions occurred in execution of a program in a systematic manner.
Dividing a number by Zero is a mathematical error (not defined) and we can use exception handling to gracefully overcome such operations. If you write a code without using exception handling then the... | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n23 Jan, 2019"
},
{
"code": null,
"e": 160,
"s": 52,
"text": "We use Exception Handling to overcome exceptions occurred in execution of a program in a systematic manner."
},
{
"code": null,
"e": 448,
"s": 160,
"text"... |
Python String – removesuffix() | 01 Nov, 2020
If the string ends with the suffix and the suffix is not empty, the str.removesuffix(suffix, /) function removes the suffix and returns the rest of the string. If the suffix string is not found then it returns the original string. It is introduced in Python 3.9.0 version.
Syntax: str.removesuffix(suffix, /... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n01 Nov, 2020"
},
{
"code": null,
"e": 301,
"s": 28,
"text": "If the string ends with the suffix and the suffix is not empty, the str.removesuffix(suffix, /) function removes the suffix and returns the rest of the string. If the suffix s... |
PHP | array_count_values() Function | 09 Aug, 2019
The array_count_values() is an inbuilt function in PHP which is used to count all the values inside an array. In other words we can say that array_count_values() function is used to calculate the frequency of all of the elements of an array.
Syntax:
array array_count_values( $array )
Parameters: This func... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n09 Aug, 2019"
},
{
"code": null,
"e": 270,
"s": 28,
"text": "The array_count_values() is an inbuilt function in PHP which is used to count all the values inside an array. In other words we can say that array_count_values() function is u... |
Java Math max() method with Examples | 16 Apr, 2018
The Java.lang.math.max() function is an inbuilt function in Java which returns maximum of two numbers. The arguments are taken in int, double, float and long.If a negative and a positive number is passed as argument then the positive result is generated. And if both parameters passed are negative then the ... | [
{
"code": null,
"e": 53,
"s": 25,
"text": "\n16 Apr, 2018"
},
{
"code": null,
"e": 416,
"s": 53,
"text": "The Java.lang.math.max() function is an inbuilt function in Java which returns maximum of two numbers. The arguments are taken in int, double, float and long.If a negative an... |
Python | Pandas Index.is_unique | 20 Feb, 2019
Pandas Index is an immutable ndarray implementing an ordered, sliceable set. It is the basic object which stores the axis labels for all pandas objects.
Pandas Index.is_unique attribute return True if the underlying data in the given Index object is unique else it return False.
Syntax: Index.is_unique
Para... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n20 Feb, 2019"
},
{
"code": null,
"e": 181,
"s": 28,
"text": "Pandas Index is an immutable ndarray implementing an ordered, sliceable set. It is the basic object which stores the axis labels for all pandas objects."
},
{
"code": ... |
Scala List contains() method with example | 26 Jul, 2019
The contains() method is utilized to check whether a certain element is present in the list or not.
Method Definition: def contains(elem: Any): Boolean
Return Type: It returns true if the element present in the contains method as argument is also present in the stated list else it returns false.
Example #1... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n26 Jul, 2019"
},
{
"code": null,
"e": 128,
"s": 28,
"text": "The contains() method is utilized to check whether a certain element is present in the list or not."
},
{
"code": null,
"e": 180,
"s": 128,
"text": "Method... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.