« first day (3134 days earlier)      last day (57 days later) » 

12:00 AM
REFRESH! There are 7951 unanswered questions (89.2471 answered)
 
 
3 hours later…
2:56 AM
0
Q: Why is following python code executing slowly?

Ach113I am trying to solve a needle in haystack using Rabin-Karp algorithm, but for large inputs my code takes way too long time. Here is the part which apparently is too slow: char_map = dict(zip(list("abcdefghijklmnopqrstuvwxyz"), list(range(1, 29)))) def hash_function(s): hash = 0 n = len(s...

 
3:13 AM
 
 
3 hours later…
6:35 AM
possible answer invalidation by Amit on question by Amit: codereview.stackexchange.com/posts/270565/revisions
 
6:47 AM
0
Q: Are Advent Of Code questions on topic once we receive no points for them?

Gaurang TandonI'm trying to learn Rust via Advent of Code 2021, and am obviously hitting various roadblocks and solving them via Google. It would be great if someone could review my code to see how to make it fit idiomatic Rust standards. According to AoC FAQ once you receive no points for the solution - which...

 
This question is more appropriate for codereview.stackexchange.com. Please post it there — Goion 36 secs ago
 
7:11 AM
There's not enough information. It's unclear if the whole app or its part doesn't work. It's unknown what exactly happens when it does not work. It's unknown what the project looks like, including the setup. See stackoverflow.com/help/how-to-ask . Depending on your case, you may need to provide stackoverflow.com/help/mcve , regardless of whether you need code review or not. — Estus Flask just now
 
7:57 AM
So are you saying that each double is really just 4 bytes (32-bit) of colour in ARGB format that have been stored as a double? Before reading your reply I guessed it might be heightmap information (which would lead to a grayscale image). This is why such information is key to making your question understandable. You should also show your attempt, though if it's only optimisation you seek (and it 100%) works then it's probably better suited to the Code Review Stack Exchange site. — Llama 33 secs ago
 
8:27 AM
@Duga OP added sample output - no new code. I've added the "none" language to its code fence so that it's not prettified as Java.
 
@Goion: the question needs work before it's suited to Code Review. You should have pointed the asker at A guide to Code Review for Stack Overflow users, as some things are done differently over there - e.g. we need a good description of the purpose of the code to give context, and question titles should simply say what the code does (the question is always, "How can I improve this?"). It's important that the code works correctly; include the unit tests if possible. — Toby Speight 8 secs ago
 
 
1 hour later…
9:52 AM
"so far i'm really enjoying this project" <-- good, keep this up, it makes learning easier :) . I don't think this is the place for these kinds of questions though. Normally, an SO question is very short and concise with a clear answer. You are more likely asking for a general code review of things you made so far. I think you'd be better of finding a senior software engineer/programmer to review your code and functionality. — JustLudo 55 secs ago
 
10:22 AM
0
Q: Serve rescaled jpg images on demand with myphoto!500.jpg syntax (here 500px-width rescaled)

BasjOn web pages, obviously we cannot serve 4000x4000px photos and just let CSS do the resizing: it would be too slow for end users and too bandwidth-consuming for the server. So it's important to rescale photos to the desired size that will be actually used on the website. For this reason I usually ...

 
If your code works correctly (to the best of your knowledge) and you are looking for a review and improvements, then codereview.stackexchange.com/questions is a better place to ask. They have dedicated programming-challenge and time-limit-exceeded tags. – Before you post there I suggest to run more test cases. Unless I am mistaken, the output of (e.g.) minWindowSlidingWindow("ABCYAYBYCY", "ABC") is wrong. — Martin R 42 secs ago
 
10:47 AM
0
Q: Retrying a RestRequest

Erick SantanderI wrote a method that lets me retry RestSharp requests when a specific exception is thrown. Here's the code for that method: private async Task<T_Out> RunRequestWithRetry<T_In, T_Out>(Func<SignatureAccount, T_In, T_Out> request, SignatureAccount signatureAccount, T_In requestBody) where T_Out : T...

 
Thanks for pointing out the error @MartinR - You are right and now I have run about 8 - 10 test cases which seem to give the desired output, however with the time limit exceeded issue. I will look at codereview stack exchange, thanks for that suggestion as I was not aware of it before. — Shawn Frank 50 secs ago
 
11:10 AM
Now posted on Code Review: codereview.stackexchange.com/q/270609/35991. You might consider to delete it here. — Martin R 25 secs ago
 
1
Q: Minimum Window Substring in Swift exceeds LeetCode runtime check

Shawn FrankThis is a popular question on LeetCode: Given two strings s and t of lengths m and n respectively, return the minimum window substring of s such that every character in t (including duplicates) is included in the window. If there is no such substring, return the empty string "". The testcases ...

0
Q: Advent of Code 2021: day 1

Lord RatteI am doing the Advent of Code challenge to learn Rust (obviously there may be spoilers if you still want to do the challenge). The instructions are too long to include verbatim so I will link them and give a summary for the two parts. In part 1, the programme must compare a user-provided list of ...

 
11:36 AM
0
Q: Refactoring existing code with some design pattern

yemenI have the following code, like a git command line system with various supported parameters and commands. But as can be seen, it involves a lot of if-else conditions which It doesn't seem that clean and is error-prone. Could there be a way to restructure it using some design pattern public static...

 
11:49 AM
Monking
 
And if you ever try something like this in a real application, please never, ever use scanf in this way, or you will be grilled during the next code review.... — user1934428 5 secs ago
 
0
Q: Reading input in idiomatic Rust for Advent of Code Day 2

Gaurang TandonI'm trying to write idiomatic and fast Rust code by solving AoC challenges this year! :-) Link to AoC Day 2 problem The input format in this problem is a list of lines each containing one string token (one of forward/down/up) and one integer, separated by whitespace. The number of lines is not kn...

 
12:17 PM
Just wanted to point out, that your Q was posted 2 minute ago, so if you don't get an answer in 2 minutes.. It might have been faster to just proceed with what you've got! What have you got, by the way? (post your code and your json); maybe we can point out some obvious improvements (or send you to codereview so they can) — Caius Jard 1 min ago
 
0
Q: Order guaranteed recursive_transform template function implementation with execution policy in C++

JimmyHuThis is a follow-up question for A recursive_transform Template Function with Execution Policy, A recursive_transform Template Function Implementation with std::invocable Concept and Execution Policy in C++, A recursive_transform Template Function with Unwrap Level for Various Type Arbitrary Nest...

 
0
Q: Code improvements filtering and mapping in React

JosephI have some filtering and mapping etc... functions on MediaCard.js and ProductCard.js Is there a better/efficient/recommended way to do this? Codesandbox is here: CLICK HERE const getContentSlotsForImage = (productImages, currentProductImage) => { const otherContentSlots = productImages ...

 
 
1 hour later…
2:30 PM
0
Q: Creating a program to generate Newton's Fractal in C

MarinoI written the below code to generate Newton's Fractal with the given function, but it's keeping getting a segmentation erro. I would like to know if has something to improve or if have something written wrongly. Basically the program would work as call the function fractal, the pass the function ...

 
To be fair, I have not been in a team yet that want to be able to do this, they say they need to be able to keep everyone's work separate for purposes of doing peer code reviews on pull requests. Therefore, they need to be able to see only the code that was changed by a specific person on a specific branch - and this cannot be done through filtering on git/bitbucket itself. So everyone is wondering whether you can absorb commits without merging — marcz2007 46 secs ago
 
3:19 PM
0
Q: converting iteration of maps to streams

yemenI need help refactoring the following code using something simpler: HashMap<String, Blob> blobmap = new HashMap<>(); blobmap.putAll(brLast.getParentTracked()); for (Blob blob : blobmap.values()) { Blob t; try { t = brCommit.getBlobHashMap(...

 
4:09 PM
0
Q: I wrote a script that produces a list of every 1st, 3rd, and 5th Friday of each month in a date range

Stephen WilliamsWhen fridays_135 is called, a list of dates between the start date and end date is produces. That list is then narrowed down to just the Friday dates and then grouped by month by fridays_by_month. Finally, fridays_135 loops through those groups of months, extracts the 0th, 2nd, and 4th element in...

 
4:45 PM
Monking
 
5:22 PM
Monking
 
possible answer invalidation by phentnil on question by Jony: codereview.stackexchange.com/posts/267830/revisions
 
@Duga its okay - just removed duplicated code
 
5:42 PM
@SᴀᴍOnᴇᴌᴀ Are you sure it was duplicate code. It's been there 2 months.
 
@pacmaninbw yes - the only difference is indentation; I almost missed the repeated text above the code - i.e. There is a function that draws triangles on the canvas area in each lines:
 
6:12 PM
This is more suitable for codereview. Anyway - don't check that file exists - it is prone to race condition, just try to work with it and handle the error if the file is missing. Explicitly return None is also questionable. — buran 2 mins ago
@buran thank you, did not know about "codereview" :-) — DSGym 21 secs ago
 
6:38 PM
0
Q: Custom function to read file from current path in Python needs refactoring

DSGymI had to write a custom function to load a yaml file from the current working directory. The function itself works and my intention was to write it in a pure fashion but my senior colleague told me that the way I wrote this function is utterly bad and I have to rewrite it. Which commandment in Py...

 
 
1 hour later…
7:52 PM
0
Q: How can I optimise my recursive backtracking sudoku algorithm?

Rohit JohnI've tried optimising my program by removing invalid values for possible spaces instead of searching from 1-9, and by choosing values with the lowest number of empty spaces in its row and column, but these are marginal improvements and sometimes slow it down. I've heard of constraint satisfaction...

 
What exactly do you think could be improved? readability, performance, coverage of edge cases, ...? On the surface it seems fine, though I can think of other ways to do it that might be better depending on your goals. If you don't have anything specific, it might be better to ask on Code Review instead, but first read their How to Ask page since they work differently to SO; to start you'd need to provide context. — wjandrea 41 secs ago
 
8:23 PM
tell me what you think. I[…]can't find a way in my limited (programming) knowledge to improve it What improvements I see waiting are in the way the solution is denoted. — greybeard 23 secs ago
 
8:43 PM
There is a LOT of broken logic in this code. I've found a dozen separate issues across most of the functions. Too many issues to list in comments. This code really needs a good code review and rewrite. — Remy Lebeau 1 min ago
 
8:58 PM
Based on your question text, it looks like you already have a workable solution and are looking for ways to improve your code. It seems to me this question is 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 43 secs ago
 
0
Q: Rock Paper Scissors pygame

KekeI am trying to write a simple rock paper scissors game in pycharm using classes and pygame. So far, I have not incorporated pygame yet. My idea is to import images that change in regards to the user's choice and the computer's random choice. This is what I have so far: import random class RockPap...

 
9:16 PM
Thank you for letting me know about the code review forum, that looks like a great resource. I personally see both of my workable solutions to be unsuitable for my current need. I provided them purely to further demonstrate what I am asking and to avoid them as answers. — Nick Frev 58 secs ago
 
9:27 PM
You seem to be looking for the Code Review Stack ExchangeRandom Davis 5 secs ago
codereview.stackexchange.com/questions/109821 is a good example of a way to do it. It is even code reviewed :-) — Jeffrey 6 secs ago
SO is for specific problems, but when you have your code working you might want to visit codereview.stackexchange.com and ask for some more general feedback on style and approach. — JeffUK just now
 
9:49 PM
This question might be a better fit for CodeReviewMoshe Katz 48 secs ago
That's a starting point. To get an idea of how it grows, at scale, consider: codereview.stackexchange.com/questions/109821Jeffrey 35 secs ago
 
0
Q: Make Bash case expression more succinct

craigIs there a more-succinct way to write this (parse.sh) Bash case statement that parse day, month, year and month and year from arguments? #!/usr/bin/env bash for arg do day= month= year= case $arg in */*/*|*-*-*) read -r year month day <<< "$(date '+%Y %m %d' -d "$arg")" ...

 
10:08 PM
In future, after you fix the functional bugs, you can then post your (working) code over on CodeReview.SE to get feedback like this. It's pretty useful. — smci just now
 
10:21 PM
0
Q: Calculate values inside unit circle

DojjeI'm fairly new to python and am exploring how to fix functions and make code 'more effective and readable'. As a first step, I would want to try to make shorter snippets of code here, for example by dividing it into more functions. Would also appreciate further improvements regarding possible err...

 
10:45 PM
0
Q: How can I make this form handler clearer/better?

MartinoTo start I'd like say that I'm a beginner writing my first Next.js app though I feel this question is more React related. I'm building an app where an user can add/edit stored food, recipes etc. which means I use a lot of submit form handlers. In every handler I: Check if inputs are correct (I a...

 
11:34 PM
As you don't have specific questions this may be better suited for code reviewMatt 18 secs ago
 

« first day (3134 days earlier)      last day (57 days later) »