« first day (3497 days earlier)      last day (506 days later) » 

12:07 AM
REFRESH! There are 7627 unanswered questions (90.0083 answered)
 
12:18 AM
0
Q: More elegant solution for stackalloc and ArrayPool

Perfect28I'm dealing with some intensive char processing application and I found the following block repeating too much. Any ideas to improve it ? var length = ....; char[]? heapBuffer = null; Span<char> buffer = length < 1024 ? stackalloc char[length] : heapBuffer = ArrayPool<char>.Shared.Rent(len...

 
1:02 AM
First off, there is this line in the doc: The parent cannot track when the socket is destroyed. which implies the parent loses access to the socket. Beyond that, I'd say you have two options here. 1) You can delve into the code involved in sending a socket and attempt to fully understand exactly what it is doing on all platforms you expect to run on. 2) You can figure out what bad consequence you are afraid of, devise a test for that and see if your parent is affected by that scenario in any way. In other words, code review or test or both. — jfriend00 39 secs ago
 
0
Q: My C program won't run

LenI keep getting all types of errors. I don't know how to fix it. When I try to fix it I get more errors. It says I'm missing a declaration. Also, error with using printf. #include <stdio.h> #include <stdlib.h> #define _CRT_SECURE_NO_WARNINGS void addContact(); void viewContact(); char firstName()...

 
1:20 AM
@CaptainObvious Title says it all.
 
1:31 AM
@CaptainObvious MRC.
 
 
1 hour later…
2:48 AM
0
Q: Programming Error

LenI have a programming error that I can't resolve. The issue stems from the void addContact function. What is my mistake in addContact function? Any help would be appreciated! #include <stdio.h> #include <stdlib.h> #define _CRT_SECURE_NO_WARNINGS void addContact(); void viewCon...

 
3:33 AM
@torek Is there a suitable command that is smart enough to detect single "word" changes but is "lossless"? To rephrase, what command would the code review function in Bitbucket use? — Tim Morris 1 min ago
 
 
1 hour later…
4:54 AM
0
Q: Alternative to using set difference?

Victor CuiI have some code that needs to branch depending on if a value from a database is absent. Essentially our database contains some key value pairs from a dictionary. If the key is absent from a set, we should append zero as the value for that key. Otherwise, we should append the value from the datab...

 
 
2 hours later…
7:24 AM
0
Q: Algorithm to traverse a path through several data points and draw a patterned line

pepoluanBased on this question and my own answer, I created the following: from __future__ import annotations import math from itertools import cycle, pairwise from typing import NamedTuple from PIL import Image, ImageDraw class Point(NamedTuple): x: float y: float def rounded(self) -> t...

 
possible answer invalidation by Toby Speight on question by Pedro: codereview.stackexchange.com/posts/281477/revisions
possible answer invalidation by Toby Speight on question by Pedro: codereview.stackexchange.com/posts/281477/revisions
 
8:18 AM
@Duga Code fence
 
8:48 AM
Monking
 
@Federico I think that explaining why "if not contains then insert pattern is a bad practice because of double hashing" is very useful also for juniors. If someone runs away from C++ after this, then I am pretty sure they will run into the very same problem in any other language. After spending many years with StackOverflow I can say for sure this is not the right place where absolute beginners are supposed to learn their very first steps. Programming is a complex craft and let's not pretend it is not. if not contains then insert pattern must not pass any code review. Period. — HiFile.app - best file manager 12 secs ago
 
 
3 hours later…
11:34 AM
0
Q: An encryption/decryption program with two different algorithms, Caesar Cipher and a Unicode Cipher

booma vijayThis project was part of the JetBrains Academy Java course. The project was about implementing an Encryption program that uses either a simple Caesar Cipher (or) a Unicode Cipher depending on the arguments being passed to the program. The data to be Encrypted/Decrypted is just one line. The diffe...

 
12:18 PM
Monking
 
0
Q: Happy Eyeballs with Scala Futures

FlowThis is my take on Happy Eyeballs in Scala, but I don't like the outcome. However, I was unable to come up with something "better". The requirements for the code are must close all created, or going to be created, sockets in case the method does not return a socket, to avoid leaking resources mu...

 
12:52 PM
StackOverflow is not really the right place for your request. Maybe try codereview.stackexchange.comMauriceNino 35 secs ago
 
1:14 PM
0
Q: The Probability of an odd total of the dots if the sum of the dots is 11 or larger

Hello worldI am trying to solve a question in javascript but I get an answer that is passing the test but my solution is wrong. The question is as follow. A six-sided die is rolled twice. Determine the probability of an odd total of the dots if the sum of the dots is 11 or larger. The probability of two dic...

 
1:46 PM
Looks like the point is a bit of over-specificity. Rather than testing if is_int($a) == is_int($b), you want to check if is_array($a) || is_array($b) and return false if so. (Really, the whole thing could be simplified with a couple of guard clauses. But that's more a job for Code Review, once the problem's fixed.) — cHao 50 secs ago
 
2:11 PM
Ryan Donovan on November 30, 2022
Dynamic application security testing (DAST) can help catch security flaws in your code. And it can do it automatically in your build process.
 
2:31 PM
possible answer invalidation by Victor Cui on question by Victor Cui: codereview.stackexchange.com/posts/281580/revisions
possible answer invalidation by Victor Cui on question by Victor Cui: codereview.stackexchange.com/posts/281580/revisions
possible answer invalidation by Victor Cui on question by Victor Cui: codereview.stackexchange.com/posts/281580/revisions
 
3:12 PM
@CaptainObvious They edited it based on my comments, removed my down vote and close vote and all comments. Became HNQ.
 
3:43 PM
Questions related to optimization of running code are more suited to be asked in the Code Review Forum. Code Review is a question and answer site for peer programmer code reviews. Please read the relevant guidance related to how to properly ask questions on this site before posting your question. — itprorh66 40 secs ago
 
4:10 PM
0
Q: minimax algorithm optimization for connect 4

HyrhooI made a minimax algorithm for a connect 4 and I would like to optimize it to improve the calculation time. I have already done the classic optimization such as alpha beta pruning and a variable where I store all the play already calculated so as not to recalculate them. I think there are still o...

 
4:32 PM
Monking
 
5:00 PM
0
Q: How to add simple memoization to the sequential graph coloring algorithm?

JonasI have the following graph coloring algorithm, which uses the sequential (and slow) technique to find if a given graph is k-colorable (with a plus of also returning a mapped graph if it is). def try_coloring(graph, num_colors):     assert num_colors >= 0, "Invalid number of colors: %s" % num_colo...

 
5:15 PM
Monking
 
6:16 PM
0
Q: Which is more complicated? [Remove letter from string]

Scripts// A is my code // B is anothers code Background: My IT teacher told me without giving a proper explaination when questioned, that my code is too complicated, Id like to know why that is and what I can do to Improve upon this code. #A def A(string, vowel): string = string.lower() vowel = ...

 
 
2 hours later…
7:46 PM
Terraform typically just does what it's told and assumes that you'll use processes like code review or automated checks to ensure that the input source code is compliant with your local policy. What I described in my answer was a way to impose policy after the plan has been created, which gives the most information to make decisions on. However, if you can define your policy rules in a way that relies only on the static, provider-agnostic parts of the configuration then it might be better in your case to use an automated check as part of your code review process. — Martin Atkins 34 secs ago
 
7:56 PM
possible answer invalidation by Victor Cui on question by Victor Cui: codereview.stackexchange.com/posts/281580/revisions
possible answer invalidation by Victor Cui on question by Victor Cui: codereview.stackexchange.com/posts/281580/revisions
 
8:45 PM
@Giltom09 "I am not sure but I think there might be a simpler way to write my code that does exactly the same thing" - for future reference, when you have working code and just want to simplify/clean it, you should consideer asking on CodeReview instead of StackOverflow. — Remy Lebeau 9 secs ago
 
 
2 hours later…
10:37 PM
@Duga Rolled back and commented.
 
 
1 hour later…
11:42 PM
0
Q: A continuous increase seen in the brightness when a FITS file is opened. How can this be removed?

snow_razerI am trying to open a FITS file using the AstroPy package in Python. In the code I have basically opened the fits file, and displayed the corresponding FITS object. For some reason a continious decrease in the brightness of the image is seen. When looking at the 3D graph of the pixel-values in th...

 

« first day (3497 days earlier)      last day (506 days later) »