instruction
stringlengths
71
95.1k
I started coding blackjack from scratch and just finished the basics so I would love some insight. I would really appreciate if any of you could look through it and let me know if there's anything I can do to improve my code. Since I'm doing this on my own knowledge it would really help to learn if there are places whe...
This is my first WIP backend asp.net application, which I will pair with react to create a full stack app. The thing I'm mostly worried about is model conversion to DTO and custom policy authorization, as It has 2 contexts I feel like it's bloated, and hacked. I will be grateful for any tips, from experienced developer...
I work with Linux-based devices, and, both at work and in my personal life, it's necessary to wipe these devices every so often - sometimes as frequently as multiple times per week. In this context, it's obviously very useful to have some sort of script which reinstalls a suite of useful software. For the past couple o...
There is now a Follow up question to this question. Abstract The VBA solution didn't work on the clients computer because Office 2010 Starter Edition doesn't support VBA. I decided to try a C# solution instead. The portion of the tool presented in this question is the interface to the Excel interop library which allows...
This is the Microsoft Word portion of the application described in this question. It is considerably simpler than the excel portion of the project. Any classes not defined in this question can be found in the excel question. The full source code for this project including the UI can be found in my GitHub repository. Th...
I made the game of Life in C++ for a highschool class project. The website we're using doesn't have an autograder for C++, and my programming teacher doesn't really know how to program... so I'd love some external feedback! While I believe this simulation works, I'm not sure about the quality of the code. I tried makin...
I have been dipping my toe into programming for a number of years, mainly following tutorials and then giving up when trying to build my own projects. This time I bit the bullet and didn't give in and wrote the below. Can someone tell me how I can improve on this for future projects as i want to start building bigger t...
I'm working on a Angular Electron application where we display loading screen while the application is starting up. This means we have to do couple of BE requests and only remove the loader when we receive desired answers. We only read data in those calls, there are no write calls there. Everything works but the INITIA...
We have a PowerPoint VBA addin which is installed using an MSI installer written with WIX (Windows Installer XML). For the addin to be picked up (for all users) by PowerPoint, name-value pairs need to be added to this registry key in HKLM: SOFTWARE\Microsoft\Office\[POWERPOINT_VERSION_NUMBER]\PowerPoint\AddIns\OurAddin...
I would like to get some feedback on the below python code. It works correctly when run, but I am concerned about efficiency as it's not the fastest to run and also about whether I should be using a with open statement. Any feedback would be greatly appreciated as this is the first time I've written something like this...
I made a tic tac toe win checker that represents a 3 x 3 board as a list of list with variables X O B as 'X', 'O' and ' '. However the input can be any valid and invalid board of tic tac toe game. e.g. board = [[X,X,X], [X,X,X], [O,O,B]] board = [[X,O,X], [X,O,X], [O,O,B]] I've crea...
I wrote this simple calculator and I want to know if there is any problems in it or if there is any way to enhance the code and make it simpler and easier and I also want to know if I'm starting to get into the intermediate level instead of beginners level and thank you #include<stdio.h> void main() { int mode, n1, n...
I've recently learned how to implement linked list in Python. Can anyone help me to refine my code of implementing methods 'insert()', and 'pop()'. pop(pos) - remove and return item at position pos. insert(pos, item) - adds a new item to the list at position pos. Did I consider all the cases? Thank you in advance! EDIT...
Attempt to implement undirected graph with intentions of making a directed implementation too. I'm also new to Generics. I'm sure there's a lot of things I can do better public class UndirectedGraph<T> implements Graph<T> { private Map<T, List<T>> adjacencyList; public UndirectedGraph() { adjacencyLi...
I decided to up my PHP game and learn some OOP. I am re-building my website from procedural to OOP, but since I don't want to use a full framework I fiddle with some components. As a router I use https://github.com/skipperbent/simple-php-router As templating engine I use Twig. Before I start do more coding I just wante...
Update: there are new versions of this code: v2 is posted here, v3 is posted here and v4 is posted here Goal: implement traits that for anything callable return its arity, return type and the argument types. Since pointers to data members are also callable, those should be handled (and be considered 0-arity). Code bel...
So I have been coding for just under 6 months now. I've made many projects but I don't have a clue if I am writing good code. So I did this frontendmentor challenge which includes HTML CSS and JS. It's mobile responsive and a good all-round challenge. So could anyone please review this code. Tell me what I should work ...
I have been searching for ways to make my algorithm more efficient but most answers told me to divide the array into two differente arrays one of less elements and one of greater elements and then merge it, but that would make the QuickSort a non in-place sort anymore. So, if someone could tell me a way of improving th...
So I (a newbie to programming) wrote this password-generator as one of my very first programs in Kotlin. I started with Java a few weeks ago. I soon realized that Java was too hard for me, so I switched to Kotlin. And this is the result. A cmd-only password-generator. I'd like to know if this code is useful at all and ...
i have logic module for head, last, page, limit and offset filter. such as : ../example/param if no query, return all value ../example/param?limit=10 return the first 10 value ..example/param?offset=3 return value from number 4 to 23 (default limit is 20) ..example/param?limit=15&offset=2 return value 3 to 17 ../exam...
This code searches for a lookup value (Worksheet "Price", Column B13:B31) from the table array in (Worksheet "Sheet1", Column A4:Z10000). Can this be done in a simpler or shorter way? Please find my code below; Sub Lookup1() Dim r, i As Long, rngLU As Range, j As Long Dim price, descr As String i...
I'm brand new to cpp and tried implementing a simple Vector class that supports abs(), equality and addition operators. I just wanted a quick set of eyes to tell me if I'm doing anything egregious in my constructor/operators and finally their usage. Note: the [[nodiscard]] was recommended by the clion IDE. #include <io...
This is the code for adding addon product to carts. Suppose the cart has a cake so a candle would be an addon. I see this addonCart.getItems().stream().findFirst().get() repeated and want to use this once among other usages. Also how do I remove this declaration of exception: catch (UnsupportedOperationException e) Add...
I used factory design pattern to identify the service according to the enum that comes from the api uri as request param. Everything seems okay according to me but cannot be sure if I used it right. @RestController @RequestMapping(GA) public class GaController { @Autowired private GaServiceFactory factory; ...
Update: there are new versions of this code: v3 is posted here and v4 is posted here Goal: implement traits that for anything callable return its arity, return type and the argument types. Since pointers to data members are also callable, those should be handled (and be considered 0-arity). Code below, try here. This ...
How can I rewrite this in a cleaner way? I have this function that takes a list of contacts of different types (are being called relationships. If there are contacts of type A the list should be filtered to only include contacts of type A, otherwise, it should only include contacts of type B. const getContactNames = ()...
I've noticed I'm not the first to post this topic. As a matter of fact, I have taken some inspiration from Victor Nguyen Bao's post to help structure my code. Here's the link to his code: Structured blackjack game in Python 3 The other source of my code is from Anthony Tapias. https://medium.com/@anthonytapias/build-a-...
I have the following data const data = [ { _id: "John Doe", cashShare: 2, stockShare: 3000, }, { _id: "Jane Doe", cashShare: 0, stockShare: 20, }, { _id: "Jack Doe", cashShare: 311, stockShare: 1311, }, ]; I want to transform it into: [ { _id: 'John Doe', label: 'Cash ...
note: A version of this code without link lifetime management was previously reviewed. Adding lifetime management actually made the code simpler, and the class simpler to use. I have written a class that handles listeners registering callbacks to receive messages. Link lifetime is managed. Code is multithreaded in that...
I built my first program to solve an issue occurring at my self-owned business.. This program I made after learning a bit of C. It took about a month to make and what it performs is various functions within the program mostly file operations, It takes and records an inventory of stock, the amount available for x stock...
A Posix function for finding the nearest parent file. For example "what .git/ am I working in?" or "is there an .npmrc affecting npm from this path?" This implementation specifically follows the symbolic links toward root rather than the canonical path. Looking for improvements and potential edge cases. lsup() { path...
Walking my first steps in Python from C, I find myself missing pointers from time to time. In this case I want to go through a list processing two element at a time, where those elements are step places away. This is my initial approach, but I would be happy to learn a couple alternatives, and their advantages. v = [0,...
I am trying to exclude some elements from array items that include properties from array excludes. I wrote this code which works fine. However, due to nested iterations, time complexity is O(n^3). Is there a way to do better? const items = [ { color: 'red', type: 'tv', age: 18 }, { color: 'silver', type: 'phone', a...
INTRODUCTION I am studying the book Five Lines of Code (2021) by Christian Clause. The book covers several techniques regarding refactoring legacy code. I am learning much and applying several of its refactoring patterns. The book gives rules that makes a lot of sense and I have been applying them to great success. RU...
I have written a python program with backtracking that fills a n * n magic square. It solves for n = 4 in 4.5 seconds but gets stuck when I run it for n = 5 on my machine. How can I optimize the algorithm to make it run faster? from time import perf_counter def fillMatrix(n): nSquared = n * n lineSum = n * (nS...
The following is an implementation of Tic-Tac-Toe game. I tried to incorporate S and O principles without violating L,I,D (hopefully) principles of SOLID. The main aim is to design in such a way that it is extensible so that any new feature additions in the future won't break the current architecture (Ex: If I Need to ...
I want to make this code better , its works now, but i think it can be better , i have a hook and one property is onChange that get value and can setState and return that value for value of input , in the middle of code , i should check two regex and if is not valid skip the setState and return that . onChange: (va...
So I've been working on this for a few days actually. I implemented a solution to the LeetCode problem: 567. Permutation in String The Problem Given two strings s1(queryStr) and s2(sourceStr), return true if s2 contains a permutation of s1, or false otherwise.In other words, return true if one of s1's permutations is t...
The following aliases return all the same number of results, on my Cygwin (on Windows): file-history1 = log -- file-history2 = log file-history5 = "!f() { git show -s $(git rev-list --date-order HEAD -- $1); }; f" file-history6 = !sh -c 'git show -s $(git rev-list --date-order HEAD -- $0)' But what would be the best /...
This is my first year at university, and I'm trying to learn everything about fundamentals. I've coded a snake game recently in C. This is a programming-challenge that I've given to myself to practice arrays and pointers. I don't need a solution to my code because it works the way I want. I create a snake and its body ...
note: This is v2 of code that was previously reviewed. I have written a class that handles listeners registering callbacks to receive messages. Link lifetime is managed (or is it?). Code is multithreaded in that any thread can broadcast to the listeners, and any thread can add or remove listeners. I have two concerns: ...
Update: there is a new version of this code: v4 is posted here Goal: implement traits that for anything callable return its arity, return type and the argument types. Since pointers to data members are also callable, those should be handled (and be considered 0-arity). Code below, try here. This is v3 (v2 here), incor...
Background I frequently develop ORM libraries using the peewee framework. On one particularly large ORM library, representing a proprietary data format, I have a lot of coupled ORM models representing different nodes in an XML document. The library also provides de-/serialization methods for each ORM model from/to JSON...
I want to make this code better. It works now but I think it can be better. I have a working sample on jsfiddle. When the page loads I have the End IP Address disable until the data is entered. Then I take the values of the input with id attribute txtstartIpAddr and use it as the value for the input with id attribute t...
I posted an answer on StackOverflow about periodic table sometime back and ever since then I've been thinking about improving/optimizing it and worked up a completely different version of it that opens the wiki link once you click on any element. I have created 4 files: load.py that loads the data from the csv file wi...
I am trying to run a series of keywords against a series of categories and then within those categories there are some options. So I have ended up doing a forEach over for of over a every method and when dealing with a lot of entries node consumes way too much memory. When dealing with 300K objects from a 29MB csv conv...
I recently asked this question and got a response. I made improvements, it now checks if the file is an image and/or used UUID to store the images, and now I want to see if it's good or not. How secure is my upload script? include 'includes/header.php'; if ($_SERVER['REQUEST_METHOD'] != 'POST' || !isset($userLoggedIn)...
This function removes a JSON element from a JSON file. In may case, the ID element. I am able to get the desired result. But the code looks very verbose; can it be written in a better way without hindering the performance? The path for removal is provided from the root node: /glossary/GlossDiv/GlossList/GlossEntry/ID ...
Recently I have been developing a library for Java which provides utility functions for arrays, strings, etc.. While researching string similarity algorithms, I managed to write one of my own. I am curious as to if anyone has come across a similar approach or if it is a commonly known one. The code is sampled below. pu...
This question is a sequel to one I asked the other day. The previous question examined the core of my repo; this one examines the user-facing part. If you're curious to see what the repo as a whole is trying to achieve, feel free to check out the previous question, but it shouldn't be necessary for the purposes of this...
Given 2 numpy arrays a1 and a2 (composed only of 0 and 1's), find index locations of all 0's in a1 and a2. Find matching index positions if any between array a1 and a2. Calculate a metric. a1 array shape is 2161 a2 array shape is 2161 e.g. a1 = [0,1,1,0,1,0,1] a2 = [1,1,0,0,1,1,0] The indices of all 0's in a1 are...
Update: there is a new version of this code: v5 is posted here Goal: implement traits that for anything callable return its arity, return type and the argument types. Since pointers to data members are also callable, those should be handled (and be considered 0-arity). Code below, try here. This is v4 (v3 here), incor...
I am working on a project which requires comparing the performance of SHA3 on different values of rate and capacity. I have implemented the same in Python and my program works fine, however, the performance of my program is slow in comparison to the standard SHA3 implementation. The standard implementation of SHA3-512 ...
Coming from another language than Python, I would like to see if my code is "pythonic" enough and follows good practices. It compares two directories, showing all files that are in one and not in the other. Moreover, you can add up to two options: a to also compare the content of the files s to save the results into a...
I have to turn an array of objects that look this this: [ { "id": 15, "log_name": "default", "description": "updated", "properties": "{\"message\":{\"old\":\"It's 2022! Wow!\",\"new\":\"It's 2022!\"}}", "created_at": "2022-01-05 19:05:12", "updated_at": "2022-01-05 19:05:...
What I have is a simple express js server where user sends an image url with a specific width all in the URL query. the code will get the image stream pipe it into a sharp.js module then send it back. here is my code flow in my radis cache database check if similar image URL with similar width already saved, if so jus...
I am working to solve an issue that my company is currently having, We have an extremely large share drive that is over 20 years old. There are so many security groups attached to some of these folder as well as individual users that no longer exist and appear as scrambled text. We would like to scan through the entire...
I played around with some optimizations when answering this SO question. Sought is a function which given matrices x of size (m, l) and y of size (n, l) returns a matrix of size (n, k) where each row consist of the k row numbers in x closest to the corresponding row of y. The important requirement was that this shoul...
Please provide your honest feedback. Thanks Doing Angela Yu's 100 days of code. Have not seen the videos on this section yet. This is just my attempt. here is the link to run the code. Hangman game """Hangman Game""" import random import os #word list word_list = ["aardvark", "baboon", "camel"] HANGMANPICS = [''' +...
I wrote this UserScript for personal use to allow me to click the main comic panel in order to navigate to the next panel, a feature which I consider essential for any webcomic, to the point that before this script I simply did not bother trying to read any comics that don't have this feature. This is for use on the co...
I started this side project years ago. The goal is to eventually provide tooling that can process version strings based on the schema defined in an XML file (example provided below). I wrote this XSD to define a legal version schema XML file. In the process, I learned a good bit about XML and XML Schemas, but I am no e...
I'm writing a very basic crater-detection code using Hough Circular Transforms. By far, the longest part of my code is actually doing the transform, which involves numerous nested loops/conditions. I've tried several things to try to speed it up, succeeding with some but not others, but I'm also not great with writin...
(English) I was recently challenged to make a simple program that does the following: Function f accepts as a parameter a function g, which returns a value. Function f must return a function h which returns and prints the value that function g returns. After some research I got the solution and the program was successf...
Decided to write something simple and came up with idea to write simple single linked list in C++ to improve my knowledge about pointers and memory management in C++, and wrote this: #include <iostream> void pause() { std::cout << '\n' << "Press <Enter> to continue..."; std::cin.clear(); std::cin.ignore(st...
As part of a physics simulation written in C++ using SFML I needed a vector3d class. Here is my implementation: #include <cmath> #include <ostream> template <typename T> class vector3d { public: T x{}; T y{}; T z{}; T norm() { return std::hypot(x, y, z); } vector3d<T> unit() { return vector3d<T>(*this) / ...
I'm learning Java in a MOOC right now and this is my solution for exercise Big year. This is the exercise: In this exercise you will design and implement a database for bird-watchers. The database contains birds, each of which has a name (string) and a name in Latin (string). The database also counts the observations ...
A list is said to have a “majority element” if more than half of its entries are identical. In this classical problem the goal consists of determining whether a list a of length n has a majority element, and, if so, to find that element. A tuple the final method returns, which contains a) Whether the list contains a ...
I'm creating a tool to analyze a card game which is played by three players. A Card is associated with a number of points and looks like this: public enum Card { FIRST_CARD(1), SECOND_CARD(2); private final int points; private Card(final int points) { this.points = points; } ...
I am fairly new to Python, C# is what I usually code in. I have the following: https://www.youtube.com/embed/FjHGZj2IjBk?controls=2&fs=0&rel=0&modestbranding=1&showinfo=0&autohide=1&iv_load_policy=3&cc_load_policy=0&autoplay=0 And I want to convert it to: https://www.youtube.com/watch?v=FjHGZj2IjBk I wrote a basic fu...
As a project I have worked on implementing and benchmarking two different minimum spanning tree algorithms in rust. My main concern is adhering to good style and not programming any glaring inefficiencies. lib.rs: #![allow(dead_code)] #![feature(test)] use std::cmp::{Ord, Ordering, PartialOrd}; use std::collections::{...
Main File import java.util.Scanner; public class packApp extends items { public static void main(String[] args) { while (itemEnter.nextOrder==0) { //while loop for continuing with new order items.show(); // function displays and generates list and number of items items.sh...
I was trying to implement an efficient (in terms of size of code (such as using one liners) and time and memory-efficient) of Infix to Postfix in python without the use of any external modules i.e using only inbuilt modules and with only necessary addition (such as without class to implement stack probably not needed)...
I am an algo-newbie and this is my first attempt at writing binary search and it worked on the first try. But something about it tells me that its far from perfect. Please tell me how I can improve. using System; class Program { public static void Main() { int[] arr = { 40, 67, 34, 25, 65, 87, 23 }; ...
This is a toy design analysis utility meant to support decisions around configuring a timer on a microcontroller. The initial configuration is an example meant to partially represent the possible configuration space for timer 0 on a PIC18F66K40. Features Architecture- and device-agnostic Selection of a target timer ex...
From a public dataset available on film rating I created a contingency table as follow. Honestly I don't like all these "for-loops" I think the quality of the code can be definitely improved in a more pythonic way. import pandas as pd import numpy as np movies_df = pd.read_csv("https://raw.githubusercontent.com/uomode...
I want to make this code better and easier to read. It works now but I think it can be better. When there is an Inbound request I check to see if that accessKey is setup for IP address Range that will return a bool flag. If its true I then need to get the IPStartAddress and IPEndAddress from the database. With that dat...
I have a sample Json as mentioned below [{ "Name": "Kim", "Details": { "Age": 43, "Gender": "Male", "Education": [{ "Primary": "Xavier", "Percentage": 90, "subject": [{ "sub": "Math", "Perf": ...
Exercise is here: https://go.dev/tour/concurrency/10 Prompt: In this exercise you'll use Go's concurrency features to parallelize a web crawler. Modify the Crawl function to fetch URLs in parallel without fetching the same URL twice. Hint: you can keep a cache of the URLs that have been fetched on a map, but maps alon...
Project Euler #1 asks: Find the sum of all the multiples of 3 or 5 below 1000. In ARM Assembly; I did this in 3 loops, which avoids any MOD or DIV. Each loop is written out, without a common subroutine, since loop 3 is different than loops 1 and 2, and the space savings in combining 1 and 2 are negated by the bl / b...
The goal of my program is to calculate the chances of a person to survive during Titanic accident, after receiving information such as person's age, class, sex, etc. There's a dataset full of information, that was splitted into testing and training dataset. Any tips for improvement, different data visualization and etc...
In one sentence Is there a way to use class instantiation to return an instance of a subclass? (for ABC in particular) Setup I have an abstract base class with several sub-classes, which I can instantiate and use just fine. Here a reduced (and nonsensical) example to illustrate: from abc import abstractmethod, ABC from...
I wrote a utility library inspired by functools that adds some common operations on functions I frequently use in my projects. As usual I'd appreciate any feed back. functoolsplus.py """More higher-order functions and operations on callable objects.""" from dataclasses import dataclass from time import perf_counter fr...
I implemented the Abstract Factory design pattern as follows. Concrete Implementation interface VideoExporter { void exportVideo(); } interface AudioExporter { void exportAudio(); } class HQVideoExporter implements VideoExporter { @Override public void exportVideo() { System.out.println("Expo...
I wrote the following CLI for playing the popular word game - Wordle. Wordle is a word game in which players are trying to guess a 5 letter word. Each turn they guess one 5 letter word, and for each letter are told that it either isn't in the word, is in the word, but not here, or is correctly placed. This CLI attempts...
Unbounded threadsafe suspending priority queue Items are ordered by an integer priority value passed into the enqueue() method dequeue() retrieves and removes the head of the queue or suspends until an item is available enqueue(item, priority) inserts an item into the queue. suspends while aquiring a lock Instead of ...
In this task I had to create simple IP address / subnet calculator in Python. I'm just wondering how you see this problem. There is my code: def toBinary(integer): binary = ['{0:0>8}'.format(bin(int(x))[2:]) for x in integer.split(".")] return binary def ip_information(ip, mask): binary_ip = toBinary(ip) ...
I'm relatively new to Python, and I've been using the language for about a month. I set out to do the Hangman game. I would like to know if there are things to improve in the code of the program I made. This is the code: import random HANGMAN_PICS = (''' +---+ | | | | | | =========''', ''...
I wanted to make a feature rich string in C++. Similar to one in python. I am using C++14. I have not added much yet, I just want to get my code reviewed to ensure I am going the right way. Features: Negative indexing.(.at(-i)) (Slices coming soon) Mutable string, no fixed length. Can delete according to index.(.pop(i...
I have a MultiIndex pd.DataFrame that I generated from a .txt that is forecast model data. Edit: per request I've included a small data sample to generate the DataFrame The dict below can be used to generate a more concise version of my data DataFrame data_dict: {0: {('1000mb', 'gph'): 166.88, ('1000mb', 'temp'): 283.8...
I have a data frame with columns for three predictors that try to predict the target variable 'change' with values 'yes' and 'no'. The data frame is grouped by id, and for every id, I have 4 years. Per id number, I want to summarize the combination of the predictors and the change-variable according to the following ru...
Just looking for a little feedback on the below tip calculator I've coded rounding the output to nearest 2 decimal places. Just wondered if it was readable and code friendly? bill = float(input("What was the total bill? $")) tip = float(input("How much tip would you like to give? 10, 12, or 15 ")) no_of_people = float...
This is my below code which accepts the date in specific format and generates the N number of rolling date which consists the first and last date of each month in reverse manner. import calendar from datetime import datetime, date def generate_rolling_date(input_date, number_of_dates): """ Generate Rolling Da...
I wrote this Dockerfile (multi-stage) where the first stage builds the project and in the second stage we just copy the stuff over. I am wondering can I please get some feedback? more specifically the use of apk add --no-cache --virtual= and how I install packages and whether I am following the best practices. Thank yo...
I'm creating a simple windows form application containing a combo box, a text box, a datagridview, a button and some radio buttons. The idea is upon the form loading the combo box is to be populated with the data of a specific column ("Party") of a source excel file. Then when a valid item is selected from the combo bo...
Currently I have two tables Plan (plans) and User (users) and there is a foreign key constraint on users which references plans.id When I create a new user I want to assign a plan to that user via plan.id Here is how I am currently accomplishing this but I do feel there must be a better approach as it feels very manual...
Goal: implement traits that for anything callable return its arity, return type and the argument types. Since pointers to data members are also callable, those should be handled (and be considered 0-arity). Code below, try here (EDIT: updated with new HasCallOperator concept that now works on MSVC, GCC and clang, based...
I want to make a function to retry calling callback n times until it return TRUE; Here's my current code: function RetryX(callback, delay, retries) { (function wait() { if( callback() !== true && --retries > 0 ){ setTimeout(wait, delay); } }()); } Question: Is it correct way to...
I want to add a unique ID to every element in a collection (before output it as a JSON object). A collection can be any set of items, as long as it has a map method implemented (Array, List and other custom collections such as trees comply with this requirement). (** For a collection 'a t returns a collection of type (...
While migrating to structured concurrency it may be sometimes convenient to temporarily make a blocking call to an async function - e.g.: let x: Int = try blocking { try await Task.sleep(nanoseconds: 1) return 5 } print(x) I have this implemented like so at the moment, but I’m not in love with it: @available(...
I want to perform some calculations over rolling periods of a pandas DataFrame and to abstract all this in a dedicated class. The job of the class below is simply, given backward and forward looking parameters to slice a column, perform some calculations and append the results as new columns of the original DataFrame. ...