« first day (2726 days earlier)      last day (35 days later) » 

12:00 AM
RELOAD! There are 7057 unanswered questions (89.7466% answered)
1:02 AM
Q: Need to know what is correct for my first vm and what I should change when I write my next

Joe DimagioI wrote my first virtual machine recently, and I need to know what I should change in my next vm to make it an actual vm. I created this one as more of just an interpreter with a instruction set you would see in assembly. I did not create this using many things a vm should have, and I put it toge...

2 hours later…
3:15 AM
You'll have to take the time to understand the advice you have been given above. Often it is good to take a break and come back fresh to think about your problems. I also recommend that you paste your code into shellcheck.net and fix any errors or warnings. You can also delete your question here and repost it to Code Review , which is the proper forum for requests for help like this. Please read Help On-topic and Help How-to-ask before posting more Qs here. Good luck! — shellter 25 secs ago
3:32 AM
Q: This bash script do not create the saved.tmp file

Magdiel Hernández RamosI have this script. Is supposed that the script in some point should create a file named saved.tmp as is created files for available_ip.tmp and wg0.conf.tmp But is not working. Any help will be higly appreciated because I do not know anything about bash. The file is correctly deleted when the scr...

4:05 AM
4:35 AM
Yeah, you will have to type std:: in front of the standard library functions if you remove using namespace std; but it's worth it and you'll have to get used to it eventually anyway. using namespace std; will not pass through a real code review - especially if it's in a header file. If you've used the GCD function I suggested, at least that part should be ok. — Ted Lyngmo 28 secs ago
1 hour later…
6:02 AM
Q: A Flappy bird Game

Aryan ParekhHere is a project that I have been working on for the past few days. I have used the SFML library in C++ to make a flappy bird game of my own. I made this as a step towards learning GUI in C++. The program is Object-Oriented as I believe this made it a little easier to maintain. Although this ...

6:21 AM
2 hours later…
8:08 AM
Q: Managing redux state of mutiple switch components

Great Khan 2016I have a react native native app and I am fetching the state of the toggle buttons from an API and then putting them into redux state. I do not like the way I have implemented it cause it seems very messy and was wondering if anyone would have any suggestions on how to refactor the code. Below is...

8:27 AM
If your code works, but you just want a way to speed it up, your question belongs on Code Review instead: codereview.stackexchange.combraX 38 secs ago
8:37 AM
I've since realised the issue is only the last code on the final line above. So it could be an Excel fault / technical issue relating to Excels ExportAsFixedFormat. Should I still close this and move to code review? — pablorenato 46 secs ago
8:58 AM
Q: A Maximum Function For Various Type Arbitrary Nested Iterable Implementation in C++

JimmyHuThis is the follow-up question for A Summation Function For Various Type Arbitrary Nested Iterable Implementation in C++. Besides the summation case, I am trying to implement a Max function which can find the maximum value in various type (comparable) arbitrary nested iterable things as the furth...

9:23 AM
Q: How to refactor Symfony 5 controller to comply with SOLID design principles

anonymous007I am trying to create this API endpoint that will accept JSON payload and will calculate quote based on provided factors and their ratings. I have Entities that contain information about "age", "postcode" and "ABI code" ratings. These AgeRating, PostcodeRating and AbiRating entities implement R...

10:13 AM
Q: Rust blog backend in Rocket and Diesel, lots of clones

jlaI have a small blog backend in Rust with Rocket and Diesel on Postgres. It reads and writes to and from the database fine, but to get to where it is I used a lot of clone() calls on strings. I feel like it could be written more efficiently with lifetimes, but my grasp of lifetimes in Rust is quit...

If this is working code that you think could be improved, see Code Review. — jonrsharpe 37 secs ago
10:57 AM
@anonymous007 I'll continue in the question on codereview codereview.stackexchange.com/questions/250896/…Astaroth 19 secs ago
SO is not for code review. If you have a specific question - please ask, but "is this code okay" - is beyond the scope of this website. — Shai 58 secs ago
Coffee without close votes in the queue, what am I to do?
11:25 AM
I believe you should put this code to code review since there are a lot of improvements that makes this a whole new project rather than minor fixes. Since you are creating sheets on the fly, you should create a json array and use as keys the sheet objects and as values an array of the elements you want to append. In this way, you will fill in this json array and then use it to setValues() in every sheet and you will get rid of all the appendRows()s you are using. — Marios 1 min ago
Q: Parking Lot Management System in JavaScript

Razvan ZamfirHypothesis There is a paid parking lot, with the following rates: $1 for the first hour and $0.5 for every subsequent hour. The parking capacity is of 10 spaces. Required Make an activity management system for the Parking with the following characteristics: Any parking interval is rounded up, to...

11:59 AM
This question isn't suited for stack overflow. Please use codereview.stackexchange.com for peer reviews. — Arnold Daniels 11 secs ago
12:22 PM
@pacmaninbw enjoy :)
12:40 PM
Q: I just wanted to prove Fermat's last theorem true for the first 1000 numbers using a python script, but there is an error I'm not able to find

Chezhiiyan SabapathyFermat's last theorem states that there are no natural numbers (1, 2, 3,…) x, y, and z such that x^n + y^n = z^n, in which n is a natural number greater than 2. Here is the code, you can ignore the first 2 functions. def diff(n, mid) : if (n > (mid * mid * mid)) : return (n - (mid * ...

1:08 PM
Q: Is there a way to configure Symfony service dependency injection to accept argument which is array of objects in config/services.yaml

anonymous007I have a controller: QuoteController class QuoteController extends AbstractController { /** * @Route("/", name="quote") * * @param Request $request * @param QuoteCalculator $quoteCalculator * @return JsonResponse */ public function index(Request $request, Quo...

1 hour later…
2:24 PM
Q: Clean up directory and file artifacts

Pin_EipolI have some directories with artifacts in them, and I want to clean them up by deleting them. The requirements are: Keep the 3 most recent directories Keep only one snapshot folder Keep only one rc folder Delete everything else The print commands should be written to a log file for posterity Th...

2:49 PM
Q: Approximation search implementation

KeithMadisonI've ported a C++ approximation search algorithm to Python. Unfortunately, my Python is a bit rusty, so this could probably use some (read: a lot) of cleaning up. Additionally, I remember a better way of working with instance variables than using self repeatedly, which I find a bit cumbersome. I ...

3:07 PM
3:35 PM
Q: NEA Computing Task 2 Dice Game

EvorageI was recently set Task 2 as seen below and I realise someone answer the question on this site here but I wanted a fresh opinion TASK 2: Allows two players to enter their details, which are then authenticated to ensure that they are authorised players. Allows each player to roll two 6-sided dic...

Thank you very much for explaining that to me in depth along with better place for code review- I was not aware and truly appreciate your input! — tryingsomethingnew 1 min ago
4:01 PM
@RMunroe yeah... at least those users are getting their money's worth and not wasting the money spent on the devices and the service that provides data for said devices!
Q: Basic Event Cancellation

TacoI recently came across the need to allow consumers to prevent further execution of methods and I utilized an event driven system that allows the consumer to specify if the execution should cancel. I've tested it in a multi-threaded environment and everything is working as expected so as a simple ...

4:24 PM
@RMunroe There's a difference between 10,000 hours of experience and 10 hours of experience a thousand times.
"is there anything computational or analytical I can do to optimize this code?"... ask hereryyker 39 secs ago
@Astaroth fair enough. In theory I absolutely agree, as you noted it's all about tradeoffs. I would probably move it to another service as soon as a second client is added that needs the same logic. also, nice code review. — Jakumi 44 secs ago
Q: When loading the header from a folder buttons getting error message

Abuaarah let myBtn = document.querySelector(".mainBtn"); let myManu = document.querySelector(".manu"); let manuOpen = false; myManu.style.marginTop="-200px"; function menuFunction() { if(manuOpen == false) { myManu.style.marginTop = "0px"; manuOpen = true; } else if (manuOpe...

4:40 PM
Q: Syntax highlighting for C++ for variables assigned with `=` vs `()` for C++

Aryan ParekhHere is the example int a = 5; int c(5); I hope the syntax highlighting works for you, if not then the way a and c are highlighted is different, shouldn't they be highlighted the same way? c has the same highlighting as a function would have (bright orange)whereas a has no highlight.

@Mast Kind of like the observation I think was in The Mythical Man Month about 9 women could have a baby in 1 month.
@SᴀᴍOnᴇᴌᴀ Finished the coffee more than 3 hours ago, but I just put another nail in the coffin of that one. Needs 1 VTC to close.
Q: sharing an Arc<tokio::sync::Mutex>> with double closure

AnUknownAliasWhen using Arc<tokio::sync::Mutex> and passing an arc into double closures, is it good practice to clone the "challenge_ref" here. Without the clone the compiler will complain about "cannot move out of challenge_ref a captured variable in a FnMut closure". this is in a hyper http server were "ser...

4:55 PM
@Feeds Not quite so much a bug as a user error.
5:11 PM
@CaptainObvious stub-code/best practice?
Q: Experimenting with C++20 coroutines to create Python-style generator functions

Daniel ScheplerI've been playing around with the coroutines implementation in gcc 10.2.0 (Debian build) based on the sparse documentation at https://en.cppreference.com/w/cpp/language/coroutines . The target, for now, was to see how to use the functionality to enable creation of Python-style generator function...

1 hour later…
6:23 PM
@pacmaninbw Probably, but I'm planning to let them find that out on their own.
There are enough comments to enlighten them.
7:00 PM
codereview.stackexchange.com is meant for such discussions, on stackoverflow they are considered offtopic. — Deykun 48 secs ago
Q: LeetCode 535: Encode and Decode TinyURL

EmmaI'm posting a solution for LeetCode's "Print FooBar Alternately". If you'd like to review, please do. Thank you! Problem TinyURL is a URL shortening service where you enter a URL such as https://leetcode.com/problems/design-tinyurl and it returns a short URL such as http://tinyurl.com/4e9iAk. Des...

Q: Syntax highlighting for C++ code, initializing with `()` vs `=`

Aryan ParekhI had initially asked this on Code review meta but @Mast in the comments suggested me to ask this on the main meta site. I have tested it on Stack overflow, Code review, and Software Engineering sites. I think stack exchange uses the same syntax highlighting engine so it should apply to all Quest...

7:55 PM
Q: Using inspect.signature with higher order functions in Python: good practice?

MetropolisConsider a function that accepts a Callable as a parameter and a dictionary of arguments as another then simply applies the parameters to the function: def call_f(f: Callable[..., int], p: Dict[str, Any] -> int: return f(**p) The function will often be something like a random number generato...

Q: Basic python calculator

L. FarosI have a young friend of mine who is starting to learn python in school and asked me to give me a little assignment (I am in no way a teacher nor a python expert but I accepted). At first I thought it would be fun to start with a bit of parsing for the operation's input, like : Enter your operat...

Q: Simple Logger in C++

coolmouse21I'm currently making a game using C++. I eventually needed a logger, but I wasn't satisfied with any of the existing solutions. After a while, I wrote my own header called log.h: #include <iostream> #include <iomanip> #include <string> #include <ctime> #include <fstream> #include <sstream> clas...

8:45 PM
Q: this is my realloc version, is it good ? any suggestions are welcomed

user12143547i am trying to recode some c functions myself, This is an my implementation of realloc function, any updates or suggestion about how to improve it ? are welcomed. void *ft_realloc(void *old_ptr, size_t old_size, size_t size) { void *new_ptr; if (size == 0 && old_ptr != NULL) {...

Q: Creating logic gates objects - Code style

paladinI would like to create a small virtual PLC application, where the user may choose from a variety of logic gates and put them together to form a boolean program. I just have written the logic gates, which all work as intended. May you give me some tips in regarding programming style? My class Gate...

I’m voting to close this question because it is asking for peer review of working code and therefore belongs on Code Review instead. CR was created for that exact purpose. — Ken White 17 secs ago
9:10 PM
Q: What are the best practices for defining multi word command line parameters (Python)?

brikasA common parameter parser for Python seems to be argparse. Its parameter keywords are indicated by "--keyword", such as "--nogui" or "--debug". However, I want to use a multi word argument such as "output name" and "output dir. parser.add_argument("-on", "--output-name", help = "Custom output fil...

9:41 PM
@CaptainObvious - too hypothetical...
the best practices questions are coming out of the woodwork today!
@SᴀᴍOnᴇᴌᴀ 2 down 3 to go.
10:06 PM
@CaptainObvious Missing context.
Anyone want to tell this person what's wrong with their answer? I am afraid if I do they will think I am picking on them.
@pacmaninbw I left a comment
@SᴀᴍOnᴇᴌᴀ Thank you.
10:25 PM
Are you just asking for a code-review of tested working code, or are you not sure this gives the right answer? If it gives correct answers, it belongs on codereview.stackexchange.comPeter Cordes 5 secs ago
10:47 PM
There is no question asked here. If you can post complete, working code that you're looking to improve, you can try codereview.stackexchange.comjaco0646 35 secs ago

« first day (2726 days earlier)      last day (35 days later) »