« first day (3299 days earlier)      last day (701 days later) » 

12:01 AM
REFRESH! There are 8076 unanswered questions (89.3010 answered)
 
 
4 hours later…
3:42 AM
Monking
 
3:53 AM
0
Q: can the design of this class be improved?

Swapan SurI am very new to kotlin and is still learning. I am looking at this class and have a feeling that this class is too long and should be better designed. But not sure how should i design it or what are the problems with this class. Can someone give me some pointers what are the issues here? Also is...

 
 
3 hours later…
6:43 AM
 
7:15 AM
You have a lot of questions in a single post and there doesn't seem to be anything wrong with your code, which is out of the scope of SO. Your question might be more suitable at codereview.stackexchange. — Emiel Zuurbier 52 secs ago
 
0
Q: Navigating a javascript object (previous and next)

oliverbjI am using Vue3 together with Collect.js. I have an object records that can have n number of items. On my website, I display these records - one by one. The current record is captured by a variable called current Users can navigate through the records (previous or next): <button @click="navigateR...

 
 
1 hour later…
8:33 AM
0
Q: Optimization of A* implementation in python

user354113To solve problem 83 of project euler I tried to use the A* algorithm. The algorithm works fine for the given problem and I get the correct result. But when I visualized the algorithm I realized that it seems as if the algorithm checked way to many possible nodes. Is it because I didn't implement ...

 
9:29 AM
@Lundin So one could create checklists for safety critical code review out of the 1000 pages? ;-) — Sebastian 43 secs ago
@Lundin So one could create checklists for safety critical code review out of the 1000 pages? ;-) you mean those? github.com/ISO-IEC-JTC1-SC22-WG23-CPP/wg23-tr24772-10-public or the standard itself? — Sebastian 12 secs ago
 
9:49 AM
0
Q: Split string by last occurence of character within a range

anastaciuSo I would like to split a string in two by the last space within the first 40 characters, the best solution I could think of: public static void Main(string[] sargs) { var address = "...Are included in two of the " + "substrings. If you want to exclude the " + ...

 
10:15 AM
0
Q: How to write Mathjax's long formulas in a narrow screen?

Jaakko SeppäläI'm learning MathJax for on my own. I saw that if I type a long math formula and try to see in Firefox's mobile view, the formula does not fit to screen. How one can improve the code such that the formula would be seen nicely in Firefox no matter the width of the Firefox window? <!DOCTYPE html> <...

0
Q: Laravel 9 - Metadata creation using middleware?

MaximilianI wrote a middleware for laravel that grabs the current metadata for the specific URL you visit. How it works: we use the $request and compare the current URL: $request->getRequestUri() with the URL in the database table: So a User visits e.g. /features/landing my code would display the metadat...

 
10:29 AM
I would start with the Learning Perl book. That's the best beginner resource. OP's company should be willing to pay for that if money is an issue. Gabor's perlmaven.com is a very good free resource, although it's not really a class. SO is of course good, and I would also look at Code Review. Post some finished code there and we'll give you constructive feedback. There are also Facebook groups for help, and of course perlmonks. perl-community.de is a German language message board that is quite helpful, too. — simbabque 25 secs ago
 
 
1 hour later…
11:31 AM
0
Q: Beginner bank app withdrawal transaction

Harshit ChaturvediPooja would like to withdraw X $US from an ATM. The cash machine will only accept the transaction if X is a multiple of 5, and Pooja's account balance has enough cash to perform the withdrawal transaction (including bank charges). For each successful withdrawal, the bank charges 0.50 $US. Calcula...

0
Q: What is correct approach to use httpClient in class library with console application?

Prasad GavandeI have one console application and class library in .net core 6 project. I want to call external API in class library. For this, I have written following code in class library project I am taking https://jsonplaceholder.typicode.com/todos/ for this example. Below is my code. Model class : Todo.cs...

 
11:48 AM
quite clever, but I'd reject this in a code review :) — Sergio Tulentsev 59 secs ago
 
12:14 PM
If this is functional code, I suspect codereview.stackexchange.com would be a better place to ask. — Borgleader 52 secs ago
If you want help improving working code, you should post this on CodeReview.SE. If you do decide to do so, please delete the question here. — NathanOliver 7 secs ago
Seems like your teacher is a bit frustrated and out of shape if apart from that comment he did not give you any clues. Raw pointers are OK, as long as the ownership is clearly defined. To make it easier, just use unique_ptr and shared_ptr (but careful with that if you have cyclic dependencies). Anyway, there are many other things that might be improved in the code, go for codereview as suggested. — pptaszni 26 secs ago
I’m voting to close this question because it belongs to Code Review. — CherryDT just now
I think this question belongs to: codereview.stackexchange.comTheTanic 23 secs ago
 
12:33 PM
@CaptainObvious MRC among other problems, I don't think the post can be saved by the community.
@CaptainObvious @SᴀᴍOnᴇᴌᴀ The way I read this question, the OP didn't write the code.
 
0
Q: i want to create a system where i can add different activities to my catalog so for example a footballgame, when it will end and start etc. in c#

NewProgrammer123I was told from stackoverflow that i should put the question in here I want to know if my constructor and list are correct and dry coding? i want to create a system where i can add activities to my catalog so for example footballgame, when it will end and start etc. public class AktivitetsKatalog...

0
Q: Extra space C++ string

Nazar Extra gaps A string is given. Write an application that will remove all extra spaces from this string. A space will be considered superfluous if: it is at the beginning of the line, before the first word; it is at the end of the line, after the last word; several spaces are located between two w...

 
1:12 PM
0
Q: How can I make this code for a family tree more object oriented?

ShayezaI have an assignment due Friday to make a family tree. Started to code in January. My reviews from the teacher for this code was that the use of pointers was horrendous and it wasn't OOP enough. This code compiles and works. What can I do better to make the code more object oriented? The best com...

0
Q: Usage of ternary statements like an if condition

SherifSome of the code I review contains ternary statements like this $request->state_id == OrderState::PROCESSING && !$order->warehouse_reference ? $this->aramexService->importSO($order) : ''; $request->state_id == OrderState::ONDELIVERY && !$order->retail_order_id ? LsService::createOrderByUserCardID...

 
1:38 PM
0
Q: Refactor JS code to properly use event delegation and best practices

grizzled_carcassI have some questions regarding event delegation and also best practices. I was told to ask for advice here. I have this code(html): <div id='container'> <button>Press me!</button> <button>Press this button!</button> <ul id="list"> </ul> </div> I have this in my js: let buttons = d...

0
Q: C++20 Multi-queue Thread Pool with Work Stealing

Developer PaulThis is a follow up to my previous post which also follows up on my first post regarding my thread pool implementation. I have since made some further changes and attempted to improve performance with work stealing. The most up to date version of the code is available on my Github. Previously, I ...

 
2:10 PM
Josh Zhang on May 16, 2022
When the bots came for us, we strengthened our defenses. Here’s what we learned about parrying a few DDoS attacks.
 
2:27 PM
@pacmaninbw I'm not sure about this one. It may just be that the poster's English isn't clear enough about this; I added a comment asking for clarification, in case that's what happened.
 
0
Q: is this code is working properly if there is any mistake please help me out there?

Harshit ChaturvediThe purpose of this problem is to verify whether the method you are using to read input data is sufficiently fast to handle problems branded with the enormous Input/Output warning. You are expected to be able to process at least 2.5MB of input data per second at runtime. const n = parse...

 
Is it September already?
3
 
2:56 PM
... code review part 2 ... the implementation of pushFakemon method (either own or prototypal) is dispensable. Instead push the newly created instance directly. — Peter Seliger 38 secs ago
 
3:09 PM
Monking
 
It ensures that the source code is formatted uniformly across all the codebase, thus saving time during code reviews and eliminating a potential source of tension due to different code style preferences among team members. It also reduces cognitive load when writing the code: often it's very convenient not to indent a piece of code too precisely, knowing that the formatter will take care of that as soon as I build the project. — Vadim Belyaev 43 secs ago
 
 
1 hour later…
4:20 PM
I like to have interfaces hiding implementation details and usually start with one or more basic interfaces. Exposing raw structs leads to coupling the internal representation with what you give your users, making it impossible to change the implementation without breaking the users. I realise this goes against your second link, which seems the default for Go, but it does say "generaly", not "always". Accessing external dependencies would make a valid exception for that in mind mind, but I might be missing something from that codereview link. — pedromss 51 secs ago
DoSomethingAPIClient seems fine to me, but possibly just have 1 method as that's all the users seem to care about. Yes, it goes "agaisnt" the codereview link, but I consider those guidelines, not rules. Just a thought, don't think you'll really find a correct answer here, seems very subjective. — pedromss 50 secs ago
 
4:31 PM
@Jimmy You may very well like the answer. Many beginners want to do something like that. But doing it it is nearly always unnecessary. It is also brittle, hard to maintain, and a potent source of bugs. The advice from the duplicate was to use a dictionary or a list. That is good advice. I know you can't see why this is a duplicate question: it's because it tells you your approach is wrong. But if you present this sort of thing to a code review, you may find your colleagues unsympathetic. — BoarGules 14 secs ago
 
0
Q: Best practice of Requests POST python script to a networking device

pythontestuserRequest to review my code please and see if I am following the best practices. This is sending a POST operation via a Python script using the requests library to a networking cloud orchestration endpoint import requests import sys requests.packages.urllib3.disable_warnings() token = input("Plea...

0
Q: Split large strings into parts by last index of character and by max length

anastaciuThis is my method to split strings into parts by last index of character and by max length: public IEnumerable<string> SplitStringByLastIndexOfAndMaxLength(string stringToSplit, int splitMaxLength, char delimiter) { var stringList = new List<string>(); try { while (!string.Is...

 
 
2 hours later…
6:17 PM
0
Q: Database design for a recommendation system

PixDI am new to databases and I am trying to design a database for a project that I am currently working on, so I wanted to know if this design is good or not. knowing that the database should serve a recommendation system,and the website would work as follows: user will enter his data on the regist...

 
6:59 PM
multiprocessing or multithreading won't make things better there:there are lots of things to improve in this script before thinking about that. And even when it is fixed, it may be that parallelising this brings no further improvements. Maybe you'd be better posting this on codereview.stackexchange.com , another site on stackoverflow's network, since this requires a major rewrite, with several points where one can teach you interesting stuff. — jsbueno 12 secs ago
 
@TobySpeight On this site, isn't it always September?
 
 
1 hour later…
8:30 PM
possible answer invalidation by denies on question by denies: codereview.stackexchange.com/posts/276506/revisions
"What do you think?" seems to be the only question here - Stack Overflow is for specific programming problems, not generalised feedback on particular code that you have written. If your code works correctly and you want someone to review it, see codereview.stackexchange.com instead. — kaya3 31 secs ago
 
@Duga I don't see any problems, the OP added the input.
@Reinderien Not really sure what I'm looking at here, my code is a lot simpler
 
9:00 PM
possible answer invalidation by Ave Milia on question by Ave Milia: codereview.stackexchange.com/posts/276545/revisions
 
@CaptainObvious Great diagram, no code!
 
@Duga rolled back
@pacmaninbw the one answer contains "... and I am assuming that your input is also an indexed array of indexed arrays" so that could be updated, and mick might likely do that soon after coming online... the OP notified mick in a comment
 
OK, my bad I guess.
 
I'll keep an eye on it
Thank you very much, some concepts I didn't even knew, like transposition. I've updated the question with a input example if you want to write more. — denies 32 mins ago
what if mick doesn't want to write more??
 
0
Q: Toggle 2 LEDs using a timer XMEGA-A3BU Xplained

pacmaninbwI’m currently taking an online embedded programming course. This was our 4th programming assignment. The device is Microchip(Atmel) XMEGA-A3BU Xplained Development Kit, Mfr. Part Number: ATXMEGAA3BU-XPLD, the short name is Atxmega256A3BU. The device has an 8 bit data bus and a 16 bit address bus....

0
Q: Using buttons as common for child forms c#

GokhanI have mini ERP project in C# winform. So I have too many forms in the project. I have buttons and I want want to use these buttons as common for all forms. I implement codes below but i am not sure this is the best way. So i need yours valuable comments. These codes add child form into main for...

 
9:14 PM
@pacmaninbw That's not runtime code - it's an analysis tool to help you choose scaling values and frequencies.
 
@Reinderien Okay, I didn't have a choice in the scaling this time. Any suggestions on how to get the time to as close to 1 second as possible? That's how long the LEDs are supposed to be lit before the toggle. It isn't even close to 1 second now.
 
Yes! Lemme get through a separate answer first.
 
9:39 PM
0
Q: dataset anonymizing algorithm implementation with Spark

marc nicoleI am trying to implement the following algorithm in Spark / Java: https://en.wikipedia.org/wiki/K-anonymity. My code class is the following: public class KAnonymity { /** * @param sparksession spark session * @param k_anonymity_constant k constant * @param qidAtts ...

 
10:03 PM
Welcome to Stack Overflow. Please read How to Ask, try to identify one specific problem, and then ask a question about it. "Any ideas on what to improve" is out of scope here; we want don't want questions to be subjective (try Code Review for code review) or too open-ended. "it seems there are a few problems with insert and delete method" isn't helpful; what are those problems? How do you test the code? What is supposed to happen when you do that, what actually happens instead, and how is that different? — Karl Knechtel 13 secs ago
 
10:20 PM
@EmielZuurbier The question is too theoretical for code review. We review working code from a project. We don't answer best practice questions. — pacmaninbw 17 secs ago
 
 
1 hour later…
11:38 PM
 
0
Q: Use multithreading or Multiprocessing to speed up my script, or getting better ideas

Sp3kTr0I was redirected from StackOverflow to your community in hope to get some help and improve my script. Problem description on SoF My script '''Create script that generate readable english words from given letters''' from math import factorial from itertools import permutations from time import ti...

 

« first day (3299 days earlier)      last day (701 days later) »