All Questions

Filter by
Sorted by
Tagged with
0
votes
0answers
5 views

generating stochastic coloured noise for many oscillators

I have a system of n oscillators which oscillate with time. To each of these oscillators I am adding a fluctuating coloured noise term with a different seed for each oscillator. Here is my code for ...
0
votes
0answers
8 views

Mongo Optional Parameters to reduce proliferation of constructors?

Context As many of you may know I have a library that allows C++ objects to be converted into JSON/YAML/BSON automatically with a single declaration (see previous code reviews). I am now (trying) ...
1
vote
0answers
11 views

Are these Unit tests OK or am I implementing an antipattern or not following best practices

I am testing a Spring boot service using JUnit 5 and Mockito. I haven't spent much time on unit testing in the past so I'm not sure if I'm accidentally implementing an anti-pattern or not following ...
1
vote
2answers
21 views

Coin-flipping game

I'm 13 years old and turning 14 years soon! I Coded this simple text game in around 30 minutes, can someone rate it? and give some feedback ...
0
votes
1answer
15 views

How to apply multiple filters in one statement

While trying to grasp the potentials of the collection features in F#, I encountered this one: ...
1
vote
0answers
14 views

macOS: resetting balance to center (0.5) using Swift

Due to some bug somewhere, my speaker balance kept moving off-center and it was getting annoying. So I cobbled together the code below (based on this question) which—to my surprise—does compile and ...
-2
votes
0answers
6 views

Website SEO Optimization

I have developed website for one company and it is working good for year but my SEO is problem. Products are not displayed on first page of google and for same keyword other sites are simple wordpress ...
1
vote
1answer
37 views

Design of Experiments data structure with C++17

I've defined a data structure which represents a doe_model, providing two maps with a configuration_id as key and a ...
2
votes
1answer
19 views

grouping people with the same score

I made the code underneath to sort my array and group people with the same score to show who all got 1st, 2nd and 3rd. the "points" variable looks like this ...
-2
votes
0answers
9 views

Discord bot using puppeteer application hosted on Heroku unable to access website, but works locally

I am trying to make a discord bot using Node.js that, when typing a command, will give the top players for some leaderboard. My local version works, but my discord bot that is hosted on Heroku doesn't ...
0
votes
1answer
27 views

How to make this code follow Solid Principle C# [closed]

Currently I have this code: ...
-4
votes
0answers
13 views

Want to release the stable version on github [closed]

Recently i made a project posted on github and thats a beta release i am the solo devloper for that Github Link i want someone to review my code and library and suggest me something so i can release ...
-3
votes
0answers
7 views

Why Google Sheets Crud/ search form is not working if has more than 5 columns? [closed]

I am working on a simple app that will display search window and the results based on the range in google sheets. However I have a problem that I cannot understand at all. The code is working perfect ...
0
votes
0answers
16 views

Light weight DOM manipulation framework usage, organized with explicitly returning class constructors

This is a follow up to usage of the code shown in this review: Manifest.JS: A lightweight front-end structural framework Is this design choice good or bad? Interested in any patterns / anti-patterns ...
1
vote
0answers
19 views

make this iteration functional

I have 2 dictionaries that I have to compare, if an element of one dictionary exists in the other dictionary, then add the element to an array but only one time... here the working code ...
1
vote
0answers
8 views

Vega lite plot rendering with Yew (rust + wasm)

I wanted to render some Vega plots in a rust+wasm web application I've been building with Yew. I'm a bit new to Rust, so I'm looking for feedback on runtime safety and stylistic issues. I was ...
1
vote
0answers
39 views

Can you help me optimize this code that calculates a Simple Moving Average? [closed]

The below function takes in a dataframe consisting of an excel sheet with the Price column. It works correctly however it looks unnecessarily long for something ...
-1
votes
0answers
41 views

how to optimize this pattern [closed]

I have the following pattern showing up several times in my code: First convert a pandas dataframe, df, to a list of named tuples, ...
0
votes
0answers
22 views

Handling Circular References Without Recursion

Despite the many decent answers to this question, one was unable to find an iterative solution. Here's what I came up with: Code: ...
3
votes
0answers
20 views

Command-line Tic-Tac-Toc in Rust

I implemented Tic-Tac-Toe in Rust to learn the language. I split the implementation into two files: game.rs contains the actual game logic, and ...
-1
votes
0answers
18 views

Create an hash table from .txt file and counting the collisions [closed]

I have homework about hash tables. Introduction of teacher and where did I stuck in below: Insert 1000 password list into a hash table with an appropriate hash function. It would be better if the ...
2
votes
1answer
52 views

Applying 'Uncle Bob's Clean Code' on this small exercice

I'm trying to apply Uncle Bob's Clean Code practices onto this exercise I'm helping someone with. (The exercise assignment is in a "docstring" comment above the ...
3
votes
2answers
51 views

Improvements for a C getline implementation

I wrote a function in C that reads an entire line from a stream into a dynamically allocated buffer. What would you suggest I should do to improve its performance? Also, are there any errors that ...
1
vote
0answers
14 views

Temperature converter in Rust

I've just started learning myself Rust. I am practicing with the exercises from the book available on the official website. Here is my attempt at the temperature converter exercise at the end of ...
1
vote
0answers
9 views

Bookmarklet for selecting code snippets on StackExchange in 2021

The following code will add to each code block on https://codereview.stackexchange.com/ or https://stackoverflow.com/ a 'Select Code' button that will select the code belonging to that block. This was ...
0
votes
1answer
37 views

Methods improvements

I just recently learned how to write Methods in C#. Here is one experiment I made. It calculates addition, subtraction, division, multiplication, and the square root of a number. fill free to give me ...
-1
votes
1answer
16 views

How to Simplify Different but Similar Functions?

absolute newbie here. I need help with simplifying my code. I want to create many more similar functions as shown below. Is there a simpler way where I can code without having to manually type in the ...
9
votes
2answers
708 views

Applying random luck scores to instances of people

I'm trying to do a simulation on the role of luck in human achievement. Here is what I intend to do with my code: Create 20000 instances of people with randomly generated scores for skill, experience ...
3
votes
3answers
91 views

Summation of large inputs

Assume we are given \$ n \$ natural numbers, \$a_{1}, a_{2}, \dots, a_{n} \$ and we are supposed to calculate the following summation: \$ \sum_{i = 1}^{n}\sum_{j = 1}^{n} \left\lfloor \dfrac{a_{i}}{a_{...
1
vote
1answer
38 views

Applying stacking penalty rule in Daily Fantasy Football

My program applies stacking penalty rule in Daily Fantasy Football by choosing which players to be penalized by which amount of points. The rule is about penalizing teams with two or more defensive ...
1
vote
1answer
16 views

Parse user data in to student and teacher details

Initially I have a code in JavaScript which looks like - ...
-2
votes
0answers
22 views

even numbers from 1 to 100 using array in c++ [closed]

My code is this: ...
10
votes
1answer
657 views

Simple equation parser and evaluator

I am relatively new to C++ coming from languages such as Java and would like tips to make my code more C++ like and doing things in the C++ way. The header file: ...
1
vote
2answers
35 views

Array To Matrix

I made a method that takes an array and converts it to a matrix, given that it is a valid conversion. However, there is some redundant code in the beginning and I thought maybe you could help me? I ...
0
votes
1answer
17 views

Checking the type and validity of a credit card with Luhn's algorithm in C (CS50)

I'm taking CS50 Intro to CS. In this assignment, we're asked to make a program that can identify what type of credit card (AMEX, Visa, MasterCard) is given in the input (and whether it is valid.) ...
1
vote
1answer
55 views

Simplest possible Tic Tac Toe AI in Python

Last week I challenged myself to create the smallest possible code for a Tic Tac Toe game with an AI as opponent. Smallest possible in regards to say least number of characters used. The requirements ...
0
votes
0answers
25 views

Rainfall challenge: procedural implementation

This evening I have seen the text of the Rainfall Challenge posted seven years ago by Hunter McMillen. I did not look at his solution (besides, I have no clue about perl), but I was intrigued by the ...
-2
votes
0answers
18 views

Who should I add methods to a controller in Laravel [closed]

Who should I declare method inside a controller method in laravel, first I think in add methods inside the controller class ...
0
votes
2answers
46 views

Generating a random directed graph

I wrote a function that returns a directed graph as an adjacency matrix. The function requires two arguments: the amount of nodes and the amount of edges. At first, nodes are placed and instantly ...
2
votes
1answer
31 views

Generating random permutation with forced change of order (Secret Santa)

I wrote this function to generate random permutation of input vector, while making sure every element has switched place (for a Secret Santa like purpose). ...
1
vote
0answers
26 views

Parse proxy strings to array of objects

The goal of this module is to take in a string (user input, someone copy and pasting a large list of proxies) and parse it into an array of objects. I appreciate any and all feedback, but I'm ...
4
votes
0answers
33 views

Read MOLCAS chemistry files to create color maps

I appreciate any help or suggestions My name is Ruben and I am seeking tips on how to improve/optimize these functions. I picked up python last year and I am at a point at which I can code scripts to ...
-1
votes
0answers
20 views

Checking is one number is the part of the other number [closed]

The task is to check if the second input number is contained in the first input number. For example: Input: 2357 35 (YES), 2365 35 (NO). My code doesn't work for a=1 b=0 and I don't know why. How can ...
3
votes
1answer
63 views

Namespace list to directory structure

Namespace list to directory structure Motivation I have a list of namespaces I extracted from types, and I which to create a directory structure, that represents these namespaces. So that I can place ...
2
votes
1answer
21 views

Functions that Find Tokens, Replace Tokens, and Retrieve Property Values from Dictionaries

The module has three functions: get_property_from_dict, retrieves a dictionary property's from a given path. token_collect_from_dict, builds a list of tokens and their location from a given ...
2
votes
1answer
48 views

Hashtable with separate chaining and dynamic resizing

An attempt at a clean implementation of this important data structure in C. It's hard to make such structures generic in C without losing performance, so this specialises on ...
1
vote
1answer
52 views

Software driver for analog to digital converter

I have been developing a software driver for the internal a/d converter on this platform. The a/d converter peripheral is described in following document. The driver is written in C++ and is build ...
2
votes
0answers
17 views

A postfix (a.k.a. Reverse-Polish Notation - RPN) calculator

As an exercise, I put together a postfix calculator using modern Fortran. Language apart, I am interested in knowing your take on the algorithm. As far as I remember from my freshman year (chemistry - ...
10
votes
4answers
1k views

Fast Risk Battle Simulator

I have written some code in python to determine the outcome(including the remaining troops of both sides) of a Risk battle fought until one side is defeated. When using the Numba's njit decorator the ...
-2
votes
0answers
25 views

The sudokus I am generating has more than one possible value [closed]

I am making an amateur sudoku application with tkinter, and I just completed the logic of the system (the generator and solver), and it seemed to me that it worked perfectly, until I checked the ...

15 30 50 per page
1
2 3 4 5
1404