Newest Questions
77,604 questions
0
votes
1
answer
91
views
2D line-of-sight recalculation code causes lag whenever a door is opened [closed]
My 2D video game recalculates into a cache the line-of-sight from every tile to every other tile and whether that line-of-sight provides clear shot, cover, greater cover or is blocked.
Each time a ...
5
votes
1
answer
243
views
Parsing Markdown with bare hyperlinks: Hoping to find a way to workaround the "noscript" workaround
The following example shows how to use markdown-it to parse and render Markdown.
It works, but there is a dirty trick there, which I absolutely don't like: to ...
3
votes
1
answer
104
views
Time series prediction by LSTM model
I have a collection of TEC data. My data sample for example: day1, day2, day3, day4.
Case1:
I have the following task to do: Training by the consecutive 3 days to predict the each 4th day. Each day ...
7
votes
3
answers
1k
views
Naive attempt at implementing a dictionary in C. Stack-based and O(n)
I am a C++ programmer trying to learn C.
Please critique my C code here. I am trying to make a small "hash table" that's \$O(n)\$ lookup. But, it is stack-based and so should be no slower ...
5
votes
1
answer
83
views
Histogram Class Implementation for Image in C++
This is a follow-up question for An Updated Multi-dimensional Image Data Structure with Variadic Template Functions in C++, histogram Template Function Implementation for Image in C++, Histogram of ...
1
vote
0
answers
37
views
SwiftUI NavigationSplitView three-column layout
For getting familiar with SwiftUI NavigationSplitView, I created a prototype, which implements a three-column view.
Screenshot:
Code (View):
...
5
votes
0
answers
136
views
FractalRendering on GPU with CUDA
I am doing a fractal renderer using CUDA, SFML, C++, recently optimized it to eat less memory, now I am going to optimize the actual fractals, because for some reason, it is the most holding back ...
1
vote
1
answer
77
views
React component
The code makes unnecessary API calls because there are two useEffect hooks that both fetch data. The first useEffect runs on mount and fetches data for page 1, while the second useEffect runs whenever ...
5
votes
2
answers
169
views
Design By Contract Library in C++
I asked this question on StackOverflow, and got exactly the answer I needed at the time. I am now here to ask - Is this a good design?
The motivation for writing up this library: my shop writes ...
4
votes
0
answers
73
views
Correct abstractions/organisation of a NodeJS GraphQL API
I recently did a quick take-home test for a potential job opportunity. It included building a GraphQL API with nodeJS. I am not an expert in node (mostly use Python at work) but I have used it for ...
1
vote
0
answers
99
views
Runtime function overloading / dynamic dispatch for Python (2nd revision)
Second revision of the original post: Function overloading / dynamic dispatch for Python
TL;DR:
Improved version of this library[^1] based on previous reviews and criticism. It provides runtime ...
3
votes
2
answers
152
views
Numerical integration using Gauss and trapezoidal methods [closed]
I have written a code that performs numerical integrations—one using the Gauss method and the other using the trapezoidal method. For the Gauss method, I have five separate text files containing the ...
1
vote
1
answer
87
views
Creating functions that send and receive atomic messages in Rust paradigm
I'm converting a library from C to Rust, and I want to see if this is the optimal way to implement network communication. This ...
1
vote
3
answers
218
views
fibonacci sequence generator
I have a piece of code that attempts to reduce the work and span in making a Fibonacci sequence. My approach is to parallelize the code as much as possible, along with doing matrix multiplication and ...
4
votes
1
answer
343
views
Optimizing Image Processing in OpenCV: Using cv::Mat with Reference Counting Mechanisms and C++ ref qualifiers
I have questions regarding this code:
As the cv::Mat copy constructor involves only pointer copying due to the reference counting mechanism, in the ...