« first day (2521 days earlier)      last day (1483 days later) » 

12:00 AM
RELOAD! There are 6442 unanswered questions (90.1382% answered)
 
12:40 AM
possible answer invalidation by marcellobello on question by marcellobello: codereview.stackexchange.com/posts/239521/revisions
 
 
1 hour later…
1:57 AM
0
Q: Using try/catch to set default value in case of error

abstractmindI have a function that parses JSON string and sets the result as a variable for further usage. function funcA(string) { let result = {}; const defaultValue = { foo: 'foo', bar: 'bar' }; try { result = JSON.parse(string); } catch(e) { result = defaultValue; } // further resu...

 
2:34 AM
0
Q: C# maths project adding a function

crazydanyal1414I am making a C# maths console-project where the user answers addition, subtraction, multiplication, division, power and square root questions based on the difficulty they choose! I am trying to add a function for the scores of separate operations, but I am struggling to make it work with the re...

 
 
4 hours later…
6:21 AM
0
Q: A job sequencing solution

cpploverI have written this code as a college assignment fot the famous job sequencing problem. Please tell me any improvements if possible. Oh, for algorithms.h header file, refer my github repo The code: #include "algorithms.h" struct Job { int index = 0; int time_slot = 0; int profit ...

0
Q: Is there something inherently wrong with this bash cache

Christian BongiornoI was working on making a cache in bash and I found this link - But this guy is attempting to generate new bash functions by introspecting their source and generating a new one as a cache. This seems to me, way overkill. Here is my implementation and it works just fine: cache() { local file ...

 
 
1 hour later…
7:35 AM
1
Q: Adding a function to show the score for each maths operation in my C# maths project

danyalqureshi1414I am making a C# maths console project where the user answers addition, subtraction, multiplication, division, power and square root questions based on the difficulty they choose! I am trying to add a function for the scores of separate operations, but I am struggling to make it work with the re...

 
8:12 AM
-1
Q: Connect-4 Python

coder1532I have the following Connect 4 implementation in Python. However for my check_won function I want to look for at least 4 matches within a given grid list, and stop once I have 4. Right now it matches the full grid size before returning true. How can I exit as soon as 4 column values or 4 row valu...

 
8:31 AM
-1
Q: tic tac toe written in c#

pepethefrokmy first project in c# (i already code in python so any help in migrating to c# is appreciated) had a little trouble with 2d arrays vs jagged arrays but nothing a little SO can't fix using System; using System.Linq; namespace take2 { class maine { const char X = 'X'; cons...

 
8:50 AM
0
Q: LRU Cache Example

BiancaPlease check the following the LRU cache implementation. Thanks for the valuable comments import java.util.HashMap; import java.util.Map; public class LRUCache { HashMap<Integer, Node> lruHashMap = new HashMap<>(); private final int DEFAULT_CACHE_SIZE =5; int capacity = 0; ...

 
 
1 hour later…
10:03 AM
codereview.stackexchange.com might be a better fit. — Lou 41 secs ago
 
10:27 AM
If you have a working program and want to know what you can do better, you can ask on Code Review. — mkrieger1 20 secs ago
 
10:39 AM
I was looking for an inbuilt .net solution. Your tag "limited concurrency TaskScheduler" led me to Johnbot's comment codereview.stackexchange.com/questions/203213/… "Take a look at ConcurrentExclusiveSchedulerPair or more specifically ConcurrentExclusiveSchedulerPair.ConcurrentScheduler which is the built-in way of doing it. – Johnbot Aug 1 '19 at 9:22" Tested, this is sufficient. Thank you. — Abin 44 secs ago
 
11:08 AM
0
Q: Where can I ask review of an explanation of a code?

JohnDoeaIn Unix and Linux StackExchange I wrote this question and later answered it myself. I want to ensure that my explanation of the specific tar option (or shall I say, function, in a broad sense) is accurate. Where could I ask for a review of my answer while quoting it inside a question? Perhaps y...

 
 
1 hour later…
12:15 PM
0
Q: Loading Files from a Directory in Haskell

Erty SeidohlI'm a very new Haskell programmer, and I've written the following code for loading TSV files. I think it can be improved, but I'm not sure how. I feel like the giant "do" block in loadData is inelegant, and that there's likely a better way to approach this. I think I'm trying to avoid the IO mo...

 
12:49 PM
Monking
 
1:29 PM
-1
Q: TapeEquilibrium - codility - JavaScript

MoamenProblem A non-empty array A consisting of N integers is given. Array A represents numbers on a tape. Any integer P, such that 0 < P < N, splits this tape into two non-empty parts: A[0], A[1], ..., A[P − 1] and A[P], A[P + 1], ..., A[N − 1]. The difference between the two parts is the value of:...

 
1:49 PM
Try codereview.stackexchange.com, but read their Help Center first.Robert Harvey 42 secs ago
 
2:06 PM
Supposing that (to the best of your knowledge) the makefile works in all respects the way you want it to do, this sort of general "how do I make it better?" question belongs on Code Review, not SO. — John Bollinger 23 secs ago
 
 
1 hour later…
3:21 PM
0
Q: Python DP Natural Solution to Knapsack 01

Permianclass Solution(object): def coinChange(self, coins, amount): dp = [0] + [float('inf')] * amount for i in range(1,amount+1): for coin in coins: dp[i] = min(dp[i], dp[i-coin]+1) return dp[-1] if dp[-1] != float('inf') else -1``` For me it ...

0
Q: Design that avoids endesired dependencies in Kotlin for a chess engine

Klaas van AarsenI'm trying to come up with a design for a chess engine in Kotlin that hides implementation details, and that ensures that such an implementation cannot accidentally become spaghetti. Client side example code I envision that a client would access the chess engine with something like: package ch...

 
Difference between Code Review and Stack Overflow tl;dr: Stack Overflow = broken code usually including compiler errors and/or stack trace. Code Review = working code looking for suggestions or improvements on structure, formatting, style etc. — Eliel Amora 26 secs ago
 
3:40 PM
0
Q: Need technical advice about passing data through UINavigationController

ARamDevFirst of all a small introduction, im relatively new to Swift and to programming in general, been doing it for the last year and loving every and each new thing of this vast world. My post is about some technical advices and to know if the decisions that are being made in my company makes any se...

 
3:53 PM
 
0
Q: Simple BASIC to Simpletron Machine Language compiler in C

barthooperI implemented a compiler that compiles a dialect of BASIC known as SimpleBASIC into Simpletron Machine Language to be run by the Simpletron simulator. I wrote the manual for the SimpleBASIC compiler in troff, it contains the commands of the SimpleBASIC language and some example programs. simple...

 
4:54 PM
1
Q: OpenGL rendering does not work

galaxy001I am following this tutorial. I made some changes, and I am using GLAD instead of GLEW. I have some problem that I can't render anything, and it either doesn't render any black shape (tested with glClearColor(1.0f, 0.0f, 1.0f, 1.0f)). I think that the bug is somewhere there: void SpriteRenderer:...

 
5:50 PM
0
Q: 0/1 knapsack algorithm implementation with possibilities vector

cpploverThe following code uses dynamic approach to solve 0/1 knapsack problem. (I know the maximum profit function I have used is not as good as the one I have defined here and I still am working on that 😅. Are any optimizations possible for the following code? #include "algorithms.h" struct Item { ...

 
6:09 PM
0
Q: A camera controller API for my game engine

Rick NijhuisAs a hobby I am working on a game engine in order to learn c++ and graphics programming, now I have completed my first iteration of my camera system using OpengGL and GLM. Because I am mostly self taught I am searching for some feedback. I am mostly searching for feedback regarding the following...

 
6:40 PM
possible answer invalidation by 1201ProgramAlarm on question by Rick Nijhuis: codereview.stackexchange.com/posts/239619/revisions
 
7:25 PM
possible answer invalidation by marcellobello on question by marcellobello: codereview.stackexchange.com/posts/239521/revisions
 
@Peilonrayz Yea, that's the "we don't have much of a choice" part.
 
@Mast I was really confused why you were talking about tea for a second XD
 
Check here I think you're calling subdirectories incorrectly: codereviewvideos.com/course/how-to-use-gulp/video/…Nathaniel Flick 38 secs ago
 
Meh, more ppl will complain in the future, so at some point it's going to happen. Or we'll have absolute garbage on the site.
 
 
2 hours later…
9:15 PM
-1
Q: How to get all paths from leaf to the root in a special graph

AlexI am trying to implement an algorithm in a special data structure in graph form. my goal ist to get all paths from leaf (Target element) to the root. This is how the graph looks like the image below. and this is my try code: this code make the iterating through the graph from leaf(targetState) to...

 
10:11 PM
0
Q: log_e approximation, as fast as possible

akuzminykhI've implemented a function to approximate \$ln(x)\$. The function is based on the following formula. $$ln(x) = 2\sum_{k = 0}^{\infty}\frac{(x-1)^{2k+1}}{(2k+1)(x+1)^{2k+1}}$$ I've developed the algorithm in Java and tried to optimize it as much as possible. You can find details about that in t...

 
I'm voting to close this question as off-topic because the code works and the author is asking for a better way to write the code. This is better off asked on CodeReview: codereview.stackexchange.comTerry 13 secs ago
 
10:26 PM
code review better place to ask your question — sahasrara62 18 secs ago
 
10:49 PM
0
Q: Is my async websocket python code correct?

NewskoolerThis is the first time I am posting here, so please go easy on me : ). I am also writing for the first time python code which uses async / await for streaming web-socket information. My main goal is to: Connect to a web-socket String info from websocket Continuously save the streaming info so...

 
11:26 PM
0
Q: Flask main file is too long

oamandawiSo, I am quite new to Flask. I am making an application, and my main.py file is getting really long because of all the routes. Is there a way to shorten the file by dividing its content into other files (for each route, perhaps)? How would I go about doing that? Thanks! YouTube tutorial I am...

 

« first day (2521 days earlier)      last day (1483 days later) »