instruction
stringlengths
71
95.1k
I am new to python and I had the task to find the US zip code based on latitude and longitude. After messing with arcgis I realized that this was giving me empty values for certain locations. I ended up coding something that accomplishes my task by taking a dataset containing all US codes and using Euclidean distance t...
So I have encountered a problem with asking user for input to be exact what is the best way to ask yes/no, for example accepting y / n and why is if i == no or i == c_n: not working? What are other mistakes or bad practices that I'm doing here? i = input('yes/no: ') success = "Success" exit = "EXIT" error = 'ERROR' ye...
I would like to see if my code below can still be optimized, resulting in lesser lines of code. My code retrieves the values from a multiselect field and assign them to hidden fields that will be passed to an integrated googlesheet. Thanks jQuery(".ff-btn-submit").click(function() { if(jQuery("input:radio[name...
Just created my first C++ project, and wondering if I could get some feedback on where to improve? I might swap from arrays to vectors and add alpha beta pruning later, but wanted to first see where I can improve on the base code. #include <iostream> #include <cmath> const char PLAYER_ONE_MARKER = 'X'; const char PLAY...
I have made a password verification "program" which takes user input and checks whether the password is valid or not. Based on that, a reply is printed. print("Create a password! Your password must have 8 to 12 digits. Numbers and lower as well as upper case letters must be a part of it!") password = input("Enter your ...
I am working on a online newspaper/blogging application with CodeIgniter 3.1.8 and Twig. The application is meant to offer developers and designers the possibility to very easily turn their HTML templates into database-powered websites. To achieve this, I used the Twig template engine, for the frontend. The main theme ...
I have been trying to refactor my code since I found I've been doing a lot of copying and pasting to implement the logic of the web API controllers. Here's how the controllers looked like before refactoring Controller for EducationalGroups table: public class EducationalGroupsController : ApiController { pu...
This is my first program in C. Do you have any improvements to this program? The program allows you to guess a number and also returns the attempts. #include <stdio.h> #include <stdlib.h> #include <conio.h> #include <time.h> /* * Sophie * 21.03.2021 */ void main() { int secret; int guess; int try = 1;...
I have made a sorting algorithm in Python 3. This sorting algorithm is a modified optimized median of 3 quicksort, with network sorting for lists of size up to 16 and for finding the median. I have tried using the O(N) approach to finding the median, but sorting normally was faster. Can I get some advice on how to make...
I'm quite new to C, and I decided to create a generic vector library. Here is the code: #ifndef VECTOR_H #define VECTOR_H #define DEFAULT_CAPACITY 10 #define EXPAND_RATIO 1.5 #include <stdlib.h> #include <string.h> enum error { NO_ERROR, INDEX_ERROR, KEY_ERROR, NULL_POINTER_ERROR, MEMORY_ERROR };...
I have begun coding a simple graph plotter for my schoolchildren using JavaScript. I have used the paper.js library as I would like to be able to export the graphs as svg files. I am only a beginner to all this (just a humble maths teacher) so I would hugely welcome any thoughts you may have. The code does not run part...
I solved this problem: given an array/vector of numbers, return how many of them contain an even number of digits. Constraints: 1 <= nums.length <= 500 1 <= nums[i] <= 10^5 Please review the code: impl Solution { pub fn find_numbers(nums: Vec<i32>) -> i32 { let mut count = 0; let mut len = 0; ...
Here is the RPS game I made. I watched a 4 hour tutorial about C++ from freecodeacademy and produced this game right after it. If you have any feedback or suggestions please let me know. Or if there's anything I should be aware of or shouldn't be doing that would be great. #include <iostream> #include <conio.h> #includ...
I write this program that checks if a file is executable, and if so, to check if it is an ELF binary or a shell script. #include <unistd.h> #include <stdio.h> #include <sys/stat.h> #include <sys/types.h> #include <string.h> int Search_in_File(char *fname, char *str); int main(int argc, char **argv) { if(argc < 2)...
I have a cycle which goes from -55 to -1, then from 1 to 55 before going back to -55 again. I want to make a loop going from an arbitrary point in this loop to another arbitrary point, but never as far as a full cycle. Since the end value of the counter might be either a larger or smaller than the start value, I initia...
I have these two classes and they should remain separate classes, but I have a feeling that this could be implemented more efficiently and with less duplicate code. After googling around I still didn't figure a better way, so perhaps someone here could point me out. Ideally I want to get tick() method from Clock and ju...
I'd like to show you a type I made while experimenting with literal, non-type template parameters in C++20. The idea is to provide a type that wraps up tuple-like types (std::tuple, std::pair, even std::variant) and provides access to its fields using a string literal. Also, it has to respect the constexpr-ness of the ...
I have a requirement to format all my string to the format ##.###/##.### Example: If input value is 3/4 then i need to format it to 03.000/04.000 If my input value is 1.4/2.0 then i need to format it to 01.400/02.000 I have tried the below, which is giving the expected output. Can someone suggest is there any direct fu...
I saw quite a few posts about making a dynamic array so I tried making my own for learning purposes. Here it is: #ifndef VECTOR_H #define VECTOR_H #include <stdlib.h> #include <stdbool.h> #include <string.h> #ifndef VECTOR_RESERVE_SIZE #define VECTOR_RESERVE_SIZE 4 #endif //Declaration typedef struct { int...
I'm working on Rcpp and I wrote the following code #include <RcppArmadilloExtensions/sample.h> using namespace Rcpp; // [[Rcpp::export]] arma::mat SIZA(int K){ arma::mat P; P.ones(K,K); P = trimatu(P); for(int idx=1; idx<K; ++idx){ arma::mat W; arma::mat Hlp; W.ones(K-idx,K-idx); W = trimatu(...
I'm a long standing PHP, JS, C#(Unity) dev looking to get outside objects and lower down. I've written a quick program to read binary data from a .sav file, and output the data section into CSV's in either long or flat format, with optional leading row indexes. Wanted to learn more about C so I can start to play with m...
I want to create a state machine for menu in my SDL game. So this is my code without the SDL. I just want to ask if this is a good way to create it. I am trying to implement a screen and then mouse events, but I have a problem there so this is a reason why I ask if this is okay. Here is a code: #include <stdio.h> #incl...
I find that a common pattern when outputting a message is the need to pluralize a word. For example, if I need to output a count of files found I would need to write something like std::cout << "Found " << count << " " << (count == 1 ? "file" : "files"); in order to use the correct singular or plural form of "file" wi...
Write a program to read strings from standard input looking for duplicated words. The program should find places in the input where one word is followed immediately by itself. Keep track of the largest number of times a single repetition occurs and which word is repeated. Print the maximum number of duplicates, or els...
I was working on 3sum problem on leetcode Question Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero. Note: The solution set must not contain duplicate triplets. Example: Given array nums = [-1, 0, 1, 2, -1, -...
Update: Fixed last item is not removed during iteration Fixed clear() during iteration does nothing Fixed addition of removed item is ignored The lasted code can be found here. Unitest can be found here. As part of my Signals library, I needed to create a custom Linked List with the below properties It should allow...
This is a lightweight text based version of the popular game Snake written entirely in C. In order to build it, ncurses needs to be installed on the system. Navigation is done using the vim-keys and you can quit with 'q'. The bones of the snake are stored in a linked list. This is one of my personal projects and I woul...
Last week I posted a previous version of this code. I improved the program and worked on it for a few days and I would love to get reviews, feedback and tips so I could learn more and more from you guys. So here is the program: config_man.h #ifndef CONFIG_MAN_H #define CONFIG_MAN_H int check_file_existence(const char ...
So I have a square matrix with the diagonal and antidiagonal elements different from zero in a vector vector<int> matrix = {1,2,3,4,5,6,7,8}; The matrix: 1 0 0 5 0 2 6 0 0 7 3 0 8 0 0 4 I try to multiply this with another matrix xmatrix is the class for matrices I tried like this: void xmatrix::operator*(const xmatri...
The main goal of this task is to take values from the query parameter and put it in inputu. The first problem is that I don't know much about how to do it so that the code doesn't repeat itself and I don't know how specifically I could improve the code so that multiple things don't happen again. Next, the function shou...
This is a follow-up question for A recursive_count_if Function For Various Type Arbitrary Nested Iterable Implementation in C++ and A recursive_count_if Function with Unwrap Level for Various Type Arbitrary Nested Iterable Implementation in C++. The function recursive_count_if is Implemented with a std::ranges::range i...
I have made a simple Kotlin application called Rock-Paper-Scissor-Lizard-Spock. The application takes in user input and check if belongs to given set of array. If it belongs then it compares user input and random value from array to generate result. Else it prints error and asks for user input again. My code is working...
Ptera Software A Flapping Wing Aerodynamics Simulator Written in Python Motivation About a year ago, I became fascinated by how animals fly. As an aerospace engineering student, it surprised me that natural flight was barely covered in my courses. I soon realized that the reason why flapping wing aerodynamics isn't t...
I have programmed a function to split strings, and it gives the expected output. I am looking forward to write better code and I was told here is a good place to start. Here's my program: #include <stdio.h> #include <stdlib.h> #include <string.h> char **split(char *str) { int str_length = 0; int i = 0; int...
So I am trying to create a small C# application which generates a deck of cards, and ask to the user if they want to shuffle the deck, and then display 1 card at a time to the user. Would this be effective use of classes 4 rules of oop? Thanks using System; using System.Collections.Generic; using System.Linq; using Sys...
I'm writing C++ Windows code that will start a process, then read its stdout and stderr, separately, into buffers. If I try to just read the streams one at a time it may hang if the child process is trying to write to the other stream. So I learned I need to create named pipes, and then make calls to ReadFile with an O...
I have implemented a radix sort algorithm in Python 3. It first finds the maximum number of digits in the list, then changes them to strings and adds 0's. For example, [7, 23, 107, 1, 53] to ['007', '023', '107', '001', '053']. I then make a new matrix, [[] * 10]. I append the numbers with last digit of 0 in lst[0], n...
I am writing an object oriented shape detector, first time in Python. I come from a Java background. Can you provide any coding advice? https://www.pyimagesearch.com/2016/02/08/opencv-shape-detection/ @dataclass class Coordinate: x_value: int y_value: int @dataclass class Rectangle: coordinate_upper_left:...
I wrote an HTML parser in JavaScript, where it takes an a string that represents the HTML const html = `<div> <div> foo </div> <div> bar </div> </div>` And it should output an object like this { children: [ { children: ['foo'], value: 'div' }, { children: ['bar'], value: 'div' }, ], value: 'di...
I have: A dataframe with Identifiers (TermId) and Search Terms (SearchTerm). A list of text strings (MyText). This likely would be a column (series) in a dataframe. I for every string in MyText I want to get a count of hits for every regex SearchTerm, producing a table of counts. This is a scaled down example. I'd...
In this program, I have done automation using Selenium, to find english meaning of each sanskrit word from a dictionary website. The function eng_meaning accepts the word and using selenium and BeautifulSoup scarps the website and find english meaning. def eng_meaning(word): """ returns english meaning of the s...
im developing a program that will read text files and convert it to JSON format dynamically. Users are able to input the key name and their respective digit to slice the index from a raw text file. Everything is working fine when reading a small size file, but whenever the text files is huge, the program will load like...
Why after declaring a variable for String array, it can be passed to a method that accepts object array? Now, String is a class by itself so I assumed a long time ago that all variable is object at a sense. But many argued with me about it. But here it shows the same kind of behaviour. Below is given the code where the...
I asked this question on Stackoverflow as well, but I think it's best suited here because my code needs optimization instead of error checking (that I previously thought). I've made changes to my code as well. But the logic is pretty much the same: My code first checks the length of the provided sequence, if it is 2 o...
I want to use python -c to remove wheel files from the dist/ directory in my project. (*) Actually, I use the following command: python -c "from pathlib import Path; [p.unlink() for p in Path('dist').glob('Pascal_Scraper-*.whl')]" Is there a shorter/cleaner way to do that? (*) the setuptools command python setup.py r...
I have written my own take on semantic versioning. Parsing it is not really hard, but I feel like my parsing could be more optimal, more readable and feel more like a parser. Currently, there is this unread method that I don't see in most parser so if possible I would like to get rid of it, and the two methods readPrer...
I created a simple minesweeper game in c#, and wanted to know how to improve it. I didn't really understand how to make it so everything besides the zero opens up. How would I make my class Board better? using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; ...
I have a class that inherits from Dictionary<Tkey, TValue>. I need my Value part of the KeyValue pair to be a a Tuple (int, bool ) public class IssueRowValidationDictionary : Dictionary<string, (int, bool)> { public IssueRowValidationDictionary() : base() { } internal void Add(string issueR...
Is there a better way to refactor my below code where I have many conditions in if and else statement The reason for refactoring is to make code cleaner and readable public static PaymentOptions GetPaymentOptions_Auto(TestConfigurationCDO testConfiguration, int siteId) { var paymentOptions = new PaymentOptions(...
This is my first attempt at open source contribution via a Python discord bot, built to analyse user-uploaded log files and give quick, at-a-glance information for support staff. The PR is here: https://github.com/Ryujinx/ryuko-ng/pull/3 My main concerns are: Is this structured properly? What could I improve? I've att...
Given two vectors of ints, write a program to determine whether one vector is a prefix of the other. For vectors of unequal length, compare the number of elements of the smaller vector. For example, given the vectors containing 0, 1, 1, 2, and 0, 1, 1, 2, 3, 5, 8, respectively, your program should return true. #incl...
I'm working on a solution that is correct but inefficient. https://app.codility.com/programmers/task/leader_slice_inc/ This is my code : public static void main(String[] args) { int[] A = { 2, 1, 3, 1, 2, 2, 3 }; int[] B = null; int M = 5, K = 3; int array_lengh = A.length; Map<Integer, Integer> cou...
I have some code that manipulates a Pandas Dataframe containing Covid-19 vaccine data and displays it on Matplotlib. The data is here: https://covid.ourworldindata.org/data/owid-covid-data.csv (downloads CSV). I have manipulated the data so that it only shows countries whose current vaccine per hundred rate is less tha...
While posting this, I noticed there are quite a few similar C hash table implementations here already. So I figured one more wouldn't hurt. :-) In any case, I'm writing a teaching article on "how to implement a hash table in C", and I'm wondering if I can get some feedback on my implementation (ht.h and ht.c, with a us...
Background: In tcsh we can use single quotes inside single quote like this (like it said here): echo 'It'\''s Shell Programming' I want to create a method which escapes single quotes and prints it into a tcsh script I build on fly with Java. It should do: If there is a \' (two chars) in the string, it will escape it ...
I'm pretty darn new to C# and to be honest in programming. I'm experimenting on making a cash register type program and I picked WPF because its been recommended as better than Forms when it comes to resizing and graphics stuff. I'm looking for feedback on how I could better my XAML. <Page x:Class="Registry_Project...
Many times I have copy and pasted from a guide that had the following instruction: $ echo "Execute xyz" and would get the error $: command not found So I created a bash script to ignore the '$' at the beginning; The solution is as follows: Put the below script in a file called '$' vim $ Make it executable chmo...
A couple months ago I made an interactive dijktra visualizer that allowed the user to setup the map nodes and run the algorithm. I thought it was a good way to solidify my algorithm and html/css knowledge. I'd like for you guys to test my application out and give any advice in any way I could make it better. One partic...
Here is my shot at Homework 8 of CIS-194 (from Spring '13). The problem is about a hierarchy of employees at a company (a tree), each node being of type Employee, each described by a label (empName :: String) and an integer value (empFun :: Integer). We need to choose a subset of employees so that no two chosen employe...
I'm a beginner both in Python and Tensorflow. I made a toy neural network to learn both. The objective of the NN is to identify the module c, or separation between lines defined by random points, and the width ε of each line, as show on this image, which shows a single sample taken from the ones used to train the netwo...
Introduction I have implemented an algorithm that applies auto tiling to a 2D tile map for a game, selecting the correct tiles according to their neighborhood. Given a string representation in a classic roguelike form such as this the algorithm yields a generated map with properly connected tiles as follows Algorithm...
I'm a rookie in c++ programming. Recently, caesar ciphers caught my eye. I ended up making a rot<N> text converter, where N is any value between 2 and 25. Please keep in mind that I'm still new to programming and don't know advanced level stuff. All your feedbacks will be appreciated. FYI, this was developed in Visual ...
I'd like to emplace a lambda which captured a unique-pointer into a container, but it failed to compile under GCC 7.3.0 as C++17. From the error messages, it's calling the copy constructor of unique_ptr when constructing function. compile #include <memory> #include <functional> #include <string> #include <queue> int m...
here I leave my code for a repository pattern with NHibernate and Autofac. I would like to receive some feedback about it. Especially about the session handling with NHibernate. By now I don't like the way that is implemented. Currently the session is created in an IHttpModule on the beginning of the request. Could thi...
this is my very first pandas/matplotlib code and I would be grateful if you can review my code and share your thoughts or ideas for improvement. Please focus on code, not the features of resulting chart. Thank you for you opinion. The purpose of code is to create Gantt chart showing my planning for 2021 education cours...
I am currently using a SimpleConnectionPool from psycopg2 to lease transactions to a PostgreSQL database and would like a review of my current implementation. Code from contextlib import contextmanager from dataclasses import dataclass from psycopg2.pool import SimpleConnectionPool @dataclass class PostgreSQLSimpleP...
I created a tic-tac-toe game implementaiton in rust. What I can do to make this tic-tac-toe code a better code? game.rs pub struct Board { board: Vec<Vec<char>>, } pub struct Cell { x: usize, y: usize, } pub enum ErrCoordinates { InvalidSub, } pub enum ErrBoard { OutOfBounds, PossitionTaken, }...
I have a below snippet, here I am using array.find to find the first success case and end it. So here is the code snippet const USERS_LIST = [ { key: "john", location: "dublin", }, { key: "joe", subKeys: [ { key: "jane", locaction: "washington", }, { key: ...
I'm currently trying to do data quality checks in python primarily using Pandas. The code below is fit for purpose. The idea is to do the checks in Python and export to an Excel file, for audit reasons. I perform checks like the below in 4 different files, sometimes checking if entries in one are also in the other, etc...
don't blame me I am trying to learn, the code works but I am not sure it is well optimized. Please tell me if you see something wrong. My goal is to achieve most optimized code (and learn something in between). User register -> check if username or email exists , if not = insert into database User login -> check datab...
I am cleaning a HTML string to encode the less than sign (<) to a HTML entity (&lt;), but leaving the HTML tags as they are. An example is converting "<div>Total < 500</div>" to "<div>Total &lt; 500</div>". There's a number of posts addressing this including: https://stackoverflow.com/questions/5464686/html-entity-enco...
I have a dataframe data with several columns and for each columns there are 10 years of daily data on average, something around 4000 rows then. The dataframe looks like this: Date A B C ... YYYY-MM-DD 123.4 56.7 89.0 YYYY-MM-DD 12.34 -5.6 NaN ... Date is datetime64, every value is ...
Staying true to the mantra: "The third time you do something, you automate", I've built up a decent collection of shell scripts that live in ~/bin. Some of these scripts contain useful boilerplate code, or just stuff I can't bring myself to memorise (like colour output stuff). Other scripts I find myself elaborating on...
Hi everyone I'm trying to reduce the complexity of some of my Python code. The function below aims to compute the validation and test loss for a variety of PyTorch time series forecasting models. I won't go into all the intricacies but needs to support models that return multiple targets, an output distribution + std (...
I feel like this code could be cleaned up more or it could be shorter but and more understandable. Any advice/suggestion is appreciated. public string GetIPVersions(NetworkInterface @interface) { string ipVersions = ""; if (@interface.Supports(NetworkInterfaceComponent.IPv4)) ipVersions += NetworkI...
Hello StackExchange community, I am curious if there is a better solution than mine for this exercise below: Enter a regex that matches all the items in the first column (positive examples) but none of those in the second (negative examples). Positive Examples: pit spot spate slap two respite Negative Examples: pt Pot...
I have a function that creates filters for some data. The filters get added to an array and then (later) chained through the reduce function (the chaining part not part of my question). The data I receive are all strings but can actually be numbers, eg {name:"-45.6"}. If it can be a number, I want the value to be conve...
As a side project, I'm working on a Bokeh web application to display public bikeshare data on a map. The data is updated every 2 minutes using a periodic callback. Below is the full implementation. I'm using PyBikes (https://github.com/eskerda/pybikes) to scrape the bike data. I'm interested in feedback on the use of g...
I got the C++ implementation of depth-first search (DFS) from here and made slight modifications to it. The modified code is as follows: #include "stdafx.h" #include <iostream> #include<map> #include<list> class Graph { void DFSUtil(int v); public: std::map<int, bool> visited; std::map<int, std::list<int>>...
Situation: I have implemented a factory design pattern in Python as below. There are different screens which have different configurations. One can register the screen in the factory and get the screen in case correct configuration is passed to respective factory class method. Question: I am wondering if this is a clea...
This is a datasource for Achievements that can be toggled to be viewed within a grid or list layout. Thoughts/notes This code was previously duplicated in two different ViewControllers. Should the CollectionLayout code go in here? Should the SectionHeader and layout toggle button delegate go in here? Have I implemente...
I was studying resnet and wanted to program it with pytorch I searched for some examples(github, google) but it was hard to understand the code completely So I programmed resnet myself and it works. But I want to check just in case if I did something wrong Can I get some code reviews and if I had some mistakes, can som...
I have a .txt file that looks like this: SHT1 E: T1:30.45°C H1:59.14 %RH SHT2 S: T2:29.93°C H2:67.38 %RH SHT1 E: T1:30.49°C H1:58.87 %RH SHT2 S: T2:29.94°C H2:67.22 %RH SHT1 E: T1:30.53°C H1:58.69 %RH SHT2 S: T2:29.95°C H2:67.22 %RH I want to have a DataFrame that looks like this: ...
I've designed this game, it's my first project. It's a spin-off from "The Pig Game" in a JavaScript course. I tweaked the HTML and CSS templates of the Pig Game for the UI, but I did the game design and coding from scratch. You can play the game here: https://jeffparadox.000webhostapp.com/ I've got some questions, if a...
Below is my attempt to check if two types are the same without template instantiations. #include <cstddef> template<class, class> struct twoTypes; template<class T> std::size_t isSame(twoTypes<T,T>*); bool isSame(void*); template<class T, class U> using checkIfSame = decltype(isSame(static_cast<twoTypes<T,U>*>(0))); ...
Context (optional) In my job, we are interested in identifying particular events that may occur during the degradation of a physical system over its lifetime. Specifically, these are referred to as: Knee onset (the beginning of nonlinear degradation phase) Knee point (point after which accelerated degradation occurs) ...
My C++ solution for HackerRank's "Making Candies" problem, reproduced below, is as optimized as I can make it and appears similar to what others say are optimal solutions. However, six of the test cases still fail due to timing out. I would be interested to know if there are any significant opportunities to optimize my...
I have cleanly separated functionality of a message bus - namely the diagnostics (optional), sending, decoding and the bus driver, I need to now bind this together and have done so with a MessageBus class. It feels anemic though, with a lot of pass through methods. On the flip side it is necessary for coordinating Star...
This code succeeds in downloading log text files from multiple URLs. Can this be made more efficient? let private downloadLogs toDirectory = let createFileDirectories (url : string) = let directory = $@"{toDirectory}\{url.Substring(13, 3)}" try if not (Directory.Exists(directory)) ...
Hello fellow programmers, I am currently implementing a function and wanted to know if there was anything I could change to simplify the code, make it more readable, or to optimize the running time and memory usage. My current implementation works as expected, without any bugs. The function I am implementing is called ...
I've recently started programming in C and as my first serious program I thought I'd create a simple calculator. To make it a bit more complex I decided not to use the functions included in math.h (like pow) but to create these functions by myself. Let me know if there is something I can do to improve this code. #inclu...
I want to generate a random date of birth [mm/dd/yyyy]which will represent an age equal to less than 18years old My requirement is to dynamically generate test data [date of birth] to negatively test a system which needs a date of birth (age) to be always greater than 18 years old The system which I am trying to test ...
I have a some code in which eslint thrown an error of the type: import/no-cycle, but I don't understand where this cyclic dependency comes from. The exact error thrown is: ESLint: Dependency cycle via ../types:7=>./Jobs:1(import/no-cycle). File 1. jobs/Jobs import { AuthJobs } from './Auth'; export interface IJobs { ...
This is a follow-up question for A recursive_transform Template Function Implementation with std::invocable concept in C++ and A recursive_transform Template Function Implementation with recursive_invoke_result_t and std::ranges::transform in C++. Besides the version using std::invocable, I am attempting to implement a...
I've been interested in making fully repeatable, reproducible game states. This led me into the world of DDD, and specifically, the concept of Aggregates + Event Sourcing (although that's not necessarily a DDD concept). In this context, the state of the Aggregate is reconstituted from a sequence of Domain Events, each ...
My code currently: import os import pandas as pd from selenium import webdriver from tabulate import tabulate from datetime import datetime import time from bs4 import BeautifulSoup as bs start = datetime.now() browser = webdriver.Chrome() class GameData: def __init__(self): self.date = [] self...
This program tokenizes an arithmetic expression specified in infix notation. It is one of my personal projects and I would love to receive expert advice. After compiling, you can run the program with one command-line argument: $ tokenize <arith_expr> This is an example of running the program: $ tokenize "3^2 + 4.5 * (...
This is an algorithm regarding the RKF method: import numpy as np class rkf(): def __init__(self,f, a, b, x0, atol, rtol, hmax, hmin): self.f=f self.a=a self.b=b self.x0=x0 self.atol=atol self.rtol=rtol self.hmax=hmax self.hmin=hmin def solve(se...
I am working on a small side-project since a couple of weeks, I am using Flask but trying to use as few libraries as possible and no ORMs (for learning purposes. I am currently working on the User service on my application and currently stuck in the registration email confirmation part regarding my design. Since I am n...
I wrote below piece of code generating dummy data loaded to MongoDB. 2 issues : 1.customer class has subscriber class so it nested with one level customer--> subsciber. I think i'm not doing right: self.subscriber = Subscriber().returnJson() it does working , but what if need to add another class under subscriber? it ...