« first day (2971 days earlier)      last day (1038 days later) » 

12:02 AM
REFRESH! There are 7639 unanswered questions (89.4211 answered)
 
12:44 AM
0
Q: How to avoid retracing in tensorflow when predicting scores for inputs with different sizes

SuperKogitoI use the following code in order to assess the quality of an audio, which is based on this original-project: MOSNet. I call compute_mosnet_score() in a loop with a different audio file in each iteration. import os import scipy import librosa import numpy as np import tensorflow as tf from tensor...

0
Q: Filtering a file name based on Ignore pattern in Python

kryslerI have a definition of copy_tree where, I need to ignore files if they end with txt. I need to check if the non-directory file matches the ignore pattern being sent. How do I achieve that? Specifically the if not os.path.basename(s) in ignore(os.fspath(src), [x.name for x in list(os.scandir(src))...

0
Q: React - Show more and search functionality

Jordan BaronI created a rough implementation of a component that lists stuff based on data has the option to enable searching for that data. I've not used React all that much so it's probably a terrible way to implement it. I looked into passing state upwards and the most common way I saw was to do what I di...

 
You are probably not using connection pools and failing to close connections when the request completes. Your question does provide details that can solve your problem. You will need to involve your app developers to do a code review on database connection management. — John Hanley 14 secs ago
 
 
4 hours later…
4:17 AM
Monking
 
They do the same thing... they diff. What ... does differently is that it first finds (roughly) the last common ancestor of the branches you are comparing and then compares with the second branch provided (which is what you probably want to do when attempting code review in a PR/MR). — eftshift0 41 secs ago
.. should also work but in a very narrow scope. It will make it difficult to do code review if there are things merged into the target branch after the feature branch is started. — eftshift0 54 secs ago
 
5:16 AM
0
Q: Python Math Quiz

ShaneIn the process of trying to learn python, and also help my daughter with some elementary math practice over the summer, I'm trying to write a simple math quiz which will reinforce what she learned over the last year. I am using the following, which works ok: import random import operator def qui...

 
5:41 AM
1
Q: Python script to collect NWS gridpoint forecast data (JSON) and push it into MariaDB

dialupisbadThis script is my first-ever attempt at writing anything in python. Though I have an electrical engineering background and therefore got a little programming education in college, it was fairly limited and I am definitely no big-time coder, so much of this script may be very rudimentary. I've n...

 
6:32 AM
possible answer invalidation by Naresh on question by Naresh: codereview.stackexchange.com/posts/263277/revisions
possible answer invalidation by Naresh on question by Naresh: codereview.stackexchange.com/posts/263277/revisions
 
@Duga rolled back both
 
possible answer invalidation by Naresh on question by Naresh: codereview.stackexchange.com/posts/263277/revisions
 
7:23 AM
@Duga false positive
 
8:09 AM
0
Q: Laravel: refactor code using solid principles

Andreas HunterI have like this method in my controller which is written as hardcode. How I can refactor this method by doing it readable using SOLID, DRY, KISS principles? public function parseDataLayerEvent() { $events = $this->logger->data['dataLayer']; if (!is_array($events)) { throw new \E...

0
Q: Last digit of any (reasonably large) a^b (Analytically)

Mastermind817num = int(input("Enter number: ")) lastdigit_num = int(repr(num)[-1]) exp = int(input("Enter exponent: ")) lastdigit_exp = int(repr(exp)[-1]) last2digit_exp = 10*int(repr(exp)[-2])+int(repr(exp)[-1]) mod_exp_2_3_7_8 = last2digit_exp % 4 if lastdigit_exp % 2 == 1: mod_exp_4_9 = 1 else: ...

 
8:51 AM
If your code is working, perhaps you'd be better off posting to Code Review if you want to find out how to optimize it? — Llama 12 secs ago
 
0
Q: Chess using pygame

MichaelI just completed my second python project which is a chess game. At the moment I have included a mechanism for pieces to lock onto a square based on the nearest square when moved. And I have introduced a mechanism to take pieces. I haven't yet checked for legal moves but I plan on doing that soon...

 
9:22 AM
Also if complete with code, the question is a better match at codereview — mplungjan 53 secs ago
 
0
Q: why it isn't pushing data to database?

waleed naderi am a student and this is my first php project , i know its vulnerable to SQL injection , but i want to know what did i do wrong so i can improve my basics understanding, Thank you !! ` <div class="product-item"> <form method="POST" action="add.php"> <div class="product-image" name="image"><

 
9:49 AM
0
Q: Last occurrence of word found in a collapsed item is not displayed

onwebIn my small script I'm looking for words which are found among collapsed items. I used a loop to look for the term from input field and all the matches found are stored as indexes in a variable called occurences. Each time I'm clicking on button Find I'm going to the searched and found word and o...

 
As the dry tag info suggests, this is a question better suited for Code Review. — Filburt 24 secs ago
 
10:13 AM
0
Q: Most efficient way to avoid locking with RwLock in Rust

KannajIm trying to find the most efficient way to handle shared mutable state across threads in actix server. the state is basically a hashmap wrapped in rwLock the first version is pretty straightforward. the hashmap is wrapped in an RwLock which is wrapped in an Arc and shared across threads. theres ...

 
This questions should be asked here instead: codereview.stackexchange.comulou 45 secs ago
 
10:33 AM
Monking
 
0
Q: Lambda expression that joins on another list and also code makes use of lookup utility

user244048This is the code that joins the list with another one. Also makes use of a static utility to makes use of hashmap for id and name. I've added null checks to safeguard the code with NPE. Could someone help code review this? public List<PGRatingResponse> collatePGRatingsbyVendor(List<PGRatingConfig>...

 
11:21 AM
"how can i fix..Can anyone improve?" - I’m voting to close this question because the way it is written will lead to answers that rather than exploring the original cause of the issue, instead go about re-writing (thus we don't learn) the code entirely thus becoming nothing more than a code review - which is off-topic for SO. It may be better suited for another SE site but be sure to read the relevant FAQ; and/or re-wording your question as necessary before cross-posting. How to Ask. — MickyD 20 secs ago
stackexchange code review is right place to ask this question, i think — sahasrara62 29 secs ago
 
Monking
 
11:44 AM
SO can provide solution here, but i think code review might give better, plus i didn't downvote or closed it, if you want to improve try to seperate different logic in different class and create a abstract method, then inherit them in final class which would be interface for your project code, that way you can make it clean — sahasrara62 34 secs ago
As usual, an ns2 awk script must be a match for the trace.tr . ..... The word NCR (or ncr) does not appear in DSR.tr . ... If you want an answer (in codereview), then the file.tcl or the trace.tr must be available. — Knud Larsen 6 secs ago
Unresolved; We ended up switching to built-in code review tool in gitlab — wojteo 53 secs ago
@sahasrara62 Never said you were one of the people who downvoted/vote to close. I didn't think so as you at least added a comment. I will try on Code Review. For this case, an ABC abstract class doesn't make sense as this will be the only class inheriting from it. — Mathieu 10 secs ago
 
12:17 PM
0
Q: What is the most robust and cleanest way to structure a class which methods share common bits of code?

MathieuI am looking for the cleanest, robust, better way to implement the structure below. I have a class, Foo, which can connect to multiple data streams. Once connected, I have a couple of methods that all start with the same test/couple line of codes. For instance, in the example below, I check if th...

 
 
1 hour later…
1:31 PM
0
Q: Dictionary comprehensions - Filling a column based on Accessing data from 2 different spreadsheets (Code improvements)

Ravindra RaoI am working on some claims data, where I have features such as (image is embedded below): The descriptions of columns are: (A)the year of claim, (B) who's the insuring company (C) whether the vehicle is driven, (D) circumstance code (E) delay in raising claim (F) Vehicle age (G) Damages (H) Sav...

 
2:20 PM
0
Q: How do I distinguish the difference in naming and file structure between components and mobile components in React?

Yoki YuHere is my example structure: . ├── App.jsx ├── index.js └── src └── components ├── Button.jsx └── Header └── Header.jsx Question: Should I name Header.jsx inside Header folder? (I personally prefer this way insteade of Header/index.jsx because I though it would ...

0
Q: How to structure and write exchangable calculation models (in python3 modules)?

Andreas SchuldeiI do research and compare different numeric models to each other. Therefore, I want to easily switch out the numeric models in my simulations and evaluation code. Some models work in cartesian coordinates, some in cylindrical coordinates. Some don't have a z-coordinate (yet), since they are prima...

 
2:56 PM
Monking
 
@CaptainObvious How to with no code.
 
@CaptainObvious closed
 
3:34 PM
Someone keeps upvoting garbage.
 
0
Q: concise alternative to a while loop

knot22The following code works fine to generate an array of 6 random values (or however many are specified by iterations). I'm wondering if there's a more concise way than using a while loop to achieve the same result. const seedValue = 31; const iterations = 6; let i = 0; const results = []; while (i

 
4:24 PM
1
Q: Create a Time class - OOP in Python

Daro1234451Create a Time class. Time is on my side Specification Basic attributes: hour, minute, second and day (default is 0), + getters, + setters (using a decorator) If you try to initialize an incorrect value of seconds or minutes, i.e. greater than or equal to 60, raise an exception from your own Wro...

 
4:35 PM
posted on June 22, 2021 by CommitStrip

3
 
Monk-ing
 
5:14 PM
0
Q: MethodArgumentNotValidException handling, @JsonProperty value in error message

George LvovIf the validation in RestController fails, I need to handle MethodArgumentNotValidException and provide an errorMessage, that contains info about all rejected fields of passed object. If any rejected field has @JsonProperty annotation with non-empty value, then I need to replace field name with t...

 
6:04 PM
I found that every time I found a good case for goto I spent so much time defending the use of the goto in code reviews that the goto just wasn't effective. I don't think I ever had maintenance come along and break the goto code because it never lasted long enough before I got tired of, "Dude, why's there a goto here?" — user4581301 26 secs ago
 
6:53 PM
0
Q: Rust returning multiple errors

Yohannes KifleI am learning Rust and I faced an issue with handling multiple error types. In the function get_account_with_creds I am trying to return a struct AccountForResponse if the credentials match. The function could possibly run into a database error, so the Result could be a PoolError. I am using unwr...

 
7:49 PM
This question is more suitable for Code Review, not Stack Overflow codereview.stackexchange.com/questions/tagged/powershellDaniel 11 secs ago
 
8:07 PM
0
Q: How to continiously read data from a NetworkStream

VargaDevSo I'm currently learning about networking between a client and a server and I decided to try to write my own client and server. I implemented a way of receiving data and it goes as follows.. The server expects a packet that is structured like this.. [ packetSize(2bytes), [data] ], so the first t...

0
Q: How to implement a 2D Cellular Automaton in JavaScript?

Lance PollardSo far I have this: const rand = (min, max) => Math.floor(Math.random() * (max - min + 1) + min) // rule: // if an even number of nodes are touching // the center node, then flip // else skip. // rule: // for the start nodes (top row), // they are randomly turned on and off. cons...

 
8:25 PM
There's a lot wrong with your code that's not part of your current problem. Please submit it to codereview.stackexchange.com after (!) fixing it. Make sure you first read the posting guidelines there, though. — Ulrich Eckhardt just now
 
0
Q: is there a way to make this code more understandable at first glance?

ThomasThis code represents logic used to retry failed calls to a crypto exchange: let retries = [ TimeSpan.FromSeconds(1.) TimeSpan.FromSeconds(3.) TimeSpan.FromSeconds(5.) TimeSpan.FromSeconds(10.) TimeSpan.FromSeconds(30.) ] let rec retryAsync (retryA...

0
Q: Thread unwanted behavior

binyyIm trying to make an animation with a thread. The animation should go by the following: each iteration moving a rectangle with the time of the animation multiplied by a function to get the correct value. When the time reaches the end, the function returns 1 and the animation should stop, because ...

0
Q: Rust program to create mail.tm accounts

cavalry1223I have created a rust program to create https://mail.tm accounts, but I think there are things I could have done better. Are there things I can do to improve performance? Are there any unnecessary things I have done? I am new to rust, please give examples of what you mean when you suggest improve...

 
 
1 hour later…
9:47 PM
0
Q: digital clock python

TheHappyBeewhile learning about python tkinter, I decided to make a digital clock: from datetime import datetime import tkinter as tk from threading import Thread import time class clock(): def __init__(self): self.display = tk.Tk() def start(self): def get(): se...

 
10:08 PM
Appreciate the info @a on dropping the array. I'll take a look at rearranging that. Also, thanks for the link to codereview. I actually wasn't aware that was a destination. I'll keep that in mind in the future. — knowbody 51 secs ago
 

« first day (2971 days earlier)      last day (1038 days later) »