« first day (2478 days earlier)      last day (1531 days later) » 

12:00 AM
RELOAD! There are 6408 unanswered questions (90.0813% answered)
 
0
Q: Better representation of class type/instance, as oposed to using enum

RobertoI want to represent the "status" of a thing and use a static representation to refer to it along the code. The best representation for this would be an enum, but I need polymorphism, so I came up with this: public interface IStatus {} public abstract class StatusBase<T> : IStatus where T : Stat...

 
12:28 AM
0
Q: Decorator to instantiate class on another process

JosiahMotivation I want to run some compute heavy tasks on a separate process, so that they don't hog the GIL and I can make effective use of a multi-core machine. Where those tasks are pure functions, I'd just use the provided multiprocessing.Pool. That, however, doesn't work as well for tasks that...

 
1:06 AM
1) A single blank line of white space in source code is all that is ever needed. Blank lines after { or before } are also typically redundant. 2) See also the File Browser GUI. — Andrew Thompson 6 secs ago
 
1:29 AM
So you want a codereview? — Twenty 7 secs ago
 
2:08 AM
-1
Q: Returned Value suddenly "None" on Simple Recursive Function

1ndigoI am Python student in the very early stages of learning. Today I learned about Recursive Functions, and in an attempt to try it I wrote the following code. The goal was to eventually trigger a message by checking for a boolean return, but the return keeps coming up as None. I'd like to add tha...

 
 
5 hours later…
 
2 hours later…
9:25 AM
This seems more appropriate for CodeReview. — MisterMiyagi 15 secs ago
 
 
2 hours later…
11:27 AM
-1
Q: Python function will ask user to enter a no and checks if it is in the tuple and prints a message

sbabudef ck_no(prompt): while True: try: lst = (2,3,4) if prompt not in lst: print("not in list") raise ValueError else: print("In the List") except ValueError as e: print(e) ...

 
11:40 AM
possible answer invalidation by Vogel612 on question by keyz_: codereview.stackexchange.com/posts/236937/revisions
 
@Duga Looks ok
 
12:08 PM
-1
Q: OOP paradigm in python - Extend class functionalities

StefanoI am a novice of Python and I am trying to understand how to use OOP paradigm to improve my scripts. My scripts usually read some data from a formatted csv file and perform some numerical analysis. Here is a short example: SIMPLY SUPPORTED BEAM NNODES <NNnodes><Node,X,Y> 2 1,0,0 2,1,0 This in...

 
@MisterMiyagi The count is in that way because I've just translated the code from fortran. Thanks you for your suggestions (I posted the same questions with improvements on CodeReview) — Stefano 10 secs ago
 
 
2 hours later…
2:01 PM
Monkihng
 
2:29 PM
0
Q: Fire Spread Algorithm (how to optimize it)?

SchytheronSo I am attempting to do this programming task: Here is my current "code": matrix fireForecast(n, d, start) { M = [n-1][n-1]; M[start.x][start.y] = 0; burningPoints = []; burningPoints.addPoint(start); for(int i = 1; i < (d+1); i++) { setWindType(); for...

 
2:50 PM
0
Q: Fetch and add data to MySql

SebbHere is my very first code which fetch data and add it to MySql. Please review my code and let me know if I'm on the right path. Is there anything I can improve? connect.php class dbh{ private $host = "localhost"; private $user = "root"; private $pwd = ""; priv...

 
3:10 PM
0
Q: Computing the probabilists' hermite polynomials in R

ClarinetistHere is my sessionInfo() so you have it: > sessionInfo() R version 3.6.2 (2019-12-12) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 17763) Matrix products: default locale: [1] LC_COLLATE=English_United States.1252 [2] LC_CTYPE=English_United States.1252 [3]...

 
possible answer invalidation by Stefano on question by Stefano: codereview.stackexchange.com/posts/237322/revisions
 
3:29 PM
@Duga Eh
 
3:50 PM
possible answer invalidation by Stefano on question by Stefano: codereview.stackexchange.com/posts/237322/revisions
 
4:12 PM
This question belongs to codereview.stackexchange.comTamás 33 secs ago
 
4:31 PM
-1
Q: Compare two map objects and show relative information Java 8

Tishy TashI have 2 maps. First map consists of order in which a specific set of services is executed. Second map contains execution time each service took. I need to display this information. Following is my piece of code. How can this be improved by performance and syntax? public static String getAllExe...

 
4:43 PM
@MisterMiyagi May be hard to see, but this question is just a "giv meh te solution plz" question. I've answered it on Code Review and it's just chameleoned to something off-topic there, and the OP is adamant in keeping it off-topic. — Peilonrayz just now
 
 
1 hour later…
5:52 PM
0
Q: Loading weak cache in typescript

maaartinusIn Java, I use a LoadingCache which offers weakKeys and I need something similar in Typescript, so I wrote the following: function loadingWeakCache<K extends object, V>(loader: (k: K) => V) : ((k: K) => V) { const cache = new WeakMap<K, V>(); return function(k: K) : V { let v = ...

 
6:18 PM
Shouldn't this be in codereview.stackexchange.com? — NomadMaker 8 secs ago
@johnoliver, This would be better asked at codereview.stackexchange.comRichard Crossley 22 secs ago
 
7:13 PM
0
Q: Export csv file using asp.net core web api and react

john oliverI'm intend to create an export function that allow user to export filtered into CSV file. I worked on a sample using the following method csv CSVHelper = new CSVHelper() // it's a function that fetch data and add comma seperate string. var exportData = csv.Write(mydata) ; var bytes = UnicodeEnco...

0
Q: Finding Common Items in arrays

user12904402My goal is to get a list of related setnteceIds in order of most repeated. In my database I have stems(Words): +---------+-----------------+ | Stem | SentenceId | +---------+-----------------+ | Hello | [2,46,62] | | Good | [1,123,45] | | Morning | [23,2436,12312] | +---...

 
7:24 PM
@Progman The big problem is i cannot pass code review, i want to focus on delivering features, but this immutable trend is like over engineering to me. If it's really complicated code and inexperienced ppl cannot handle the cases, i'm fine with immutable. But for a simple case like this, i don't understand why ppl ask for immutable. So i'm looking for a best practice and trying to convince the team to be reasonable. — user3552178 54 secs ago
 
8:10 PM
As @Zabuza said, this is opinion-based. If you think this is over engineering, so be it. But if your code doesn't pass code review, you should rewrite it so it does pass. Although not everyone have the same opinion/coding style, you should respect the one that your instructor/team leader/superior has. — Sweeper 31 secs ago
 
8:23 PM
If you want a code review you should ask on Code Review. — mkrieger1 11 secs ago
 
8:34 PM
0
Q: Find common substring that starts a set of strings

BazHow would you in a pythonic manner write a function that returns the common substring found at the beginning of a set of strings? This is my ugly attempt: def common_start(s): l = len(s) if l == 0: return None elif l == 1: return next(iter(s)) else: i = iter(s) start = next...

 
I'd recommend reading "Stack Overflow question checklist" and "Writing The Perfect Question". Your question doesn't mention having a problem with the code so you want a code-review? If so, SO isn't really the right place as it's a site to help with coding problems. Once the code is written and working then codereview.stackexchange.com would possibly be a better fit. — the Tin Man 43 secs ago
 
9:14 PM
Hey salparadise, I jumped on you on Code Review. Your answer can be good if you explain why you think zip is better. After reading your answer I do believe it's better than the ops, I'm writing up my answer now, and basically came to the conclusion you did. — Peilonrayz 5 secs ago
 
9:34 PM
0
Q: Non-nullable reference type default parameters in C# 8

Daniel A. WhiteI was working to upgrade some code to C# 8.0 and came across an interesting pattern with default parameters and non-nullable reference types. I'm working if it's clear enough to the caller. Given this pre C# 8.0 code, Task FooAsync( Bar bar = null, CancellationToken ct = default) { ba...

 
10:35 PM
0
Q: Questions about Command-line Pattern and coding style

Ludwig von DrakeI am currently using the following command line pattern, for which I have a few questions. I don't quite understand the initialisation of the COMMAND_PACKAGE method. Especially this part: COMMAND_PACKAGE = new HashMap<Pattern, Class<? extends Command>>() { {. This looks like an unus...

0
Q: Testable random number generator

Dmitry NoginHere is a custom Random<T> class which could be used as: Random<int> random = Random<int>(10); int zeroToTen = random.Next(); I also made it seedable through the ambient context, so the following is observed allowing to potentially have Seed anywhere above in the call stack to simplify unit te...

 
 
1 hour later…
11:56 PM
0
Q: Grading Students - Hackerrank

King ColdHere is my solution to Grading Students courtesy of HackerRank. My code passes all tests in the testing suite but I feel like there could be a better implementation of it. But nonetheless, what are some pros/cons of my current implementation? Thank you for answering. def gradingStudents(grades)...

 

« first day (2478 days earlier)      last day (1531 days later) »