Newest Questions
77,865 questions
2
votes
0
answers
52
views
React modal form implementation for name, image and weather
I'm building a modal form in React. It collects a name, image URL, and weather selection. It works, but I’d like to improve:
Code structure
State handling
Reusability
Accessibility
Here’s the code:
<...
5
votes
1
answer
129
views
Macros that won't compile in release builds
We all have put in debugging statements, like println!("Here"), when we're trying to diagnose an issue. Often, especially at work, I forget to remove ...
4
votes
1
answer
78
views
Catch2 Sections as Macros
I like from the C++ unit test framework Catch2 its sections -- much more than the xUnit test fixtures. Therefore I wrote me some macros which mimic the Catch2 sections.
This is the first macro heavy ...
1
vote
0
answers
73
views
Combine and Propagate "Vectors" in Power Query M
Background
In an earlier post, I prototyped an M equivalent of tidyselect in R: in particular, its general syntax and selection helpers. In this post, I prototype ...
6
votes
2
answers
395
views
Operator associativity while writing tokenizer using regex match
I am trying to write a simple tokenizer for a basic arithmetic calculator. Here's the code:
...
2
votes
1
answer
335
views
General Two-dimensional Elliptical Gaussian Image Filter in C++
This is a follow-up question for Two dimensional gaussian image generator in C++, Three dimensional gaussian image generator in C++, General Two-dimensional Elliptical Gaussian Image Generator in C++ ...
5
votes
1
answer
407
views
Positive Integer Class Supporting Arbitrary Number of Digits
I have implemented an elementary positive integer class that supports addition, subtraction, and multiplication for an arbitrary number of digits using a singly linked list.
...
2
votes
1
answer
140
views
ds (directory switcher): a *nix program for tagging directories with (short) tags and switching between them via tags
Repo
The complete program: GitHub repository
How it works
After you have cloned the above repository, change directory inside it and type make in order to compile ...
2
votes
1
answer
128
views
Swift: Find neighbor-elements within an array
I need a function which finds the left and right neighbor-element within an integer-array, based upon a given index. If the given element is 0, then it shall return largest index as left neighbor. ...
11
votes
4
answers
1k
views
A simple server-client application in C
I am reading "The Linux Programming Interface" by Michael Kerrisk. I'm studying about sockets, and I made a simple application using sockets on the unix domain.
I want to know if I'm using ...
4
votes
1
answer
111
views
Lock-free queues and stacks
I am currently working on implementing lock-free stacks and queues. So far, they seem to function properly in test programs, but I am unsure if there are any underlying issues or areas for improvement(...
14
votes
5
answers
2k
views
I implemented FFT in C
I wrote Cooley-Tukey's FFT algorithm in C. And I want to know how safe is this code? Is it just trash? How can I make it more memory safe?
...
7
votes
1
answer
240
views
Optimizing a Rust permutation chooser for the most subsequences
I had semi-recently asked a question (well a couple closely related questions) on math.stackexchange. The simplest question is phrased as follows: You are allowed to make 3 permutations of length n. ...
5
votes
4
answers
901
views
A program to solve quadratic equations ax² + bx + c = 0 with imaginary results
This is my second post and my second “tough” question I came across while reading PPP3.
I graduated a while ago and honestly forgot the equation... The question didn’t explicitly say I needed to find ...
1
vote
1
answer
110
views
Is this how Flutter BloC is suppose to be used?
I'm new to Flutter and BloC and it just seems quite different than what I've been using until now. In terms of state, I'm coming from the JS world of Vuex, Pinia and Redux and I've also worked a with ...
4
votes
5
answers
772
views
Password storage with gatherer plugin in Python
First the PasswordStore, which is pretty straight-forward. It stores title-password association, but it is important that a title can have multiple passwords.
The <...
7
votes
1
answer
364
views
General Two-dimensional Elliptical Gaussian Image Generator in C++
This is a follow-up question for Two dimensional gaussian image generator in C++ and Three dimensional gaussian image generator in C++. According to the statement in https://fabiandablander.com/...
2
votes
0
answers
110
views
Simple image captcha test in Java and JS (revised version)
Following on from my previous question, I would like to know what could be improved here and whether it is now secure.
I had to use Java 8 because the Blade lib was built with it, and I want to extend ...
11
votes
3
answers
1k
views
Golden-section optimization with complication
I'm trying to implement the so-called golden-section optimization in C++.
This is a simple algorithm to find an extremum of a univariate function \$f\$ within an interval \$[a,b]\$.
The crux is to ...
2
votes
1
answer
89
views
Encapsulating status codes and messages à la absl::Status
I'm new to Lua and thought a decent way of familiarizing myself with the language would be to implement some basic utility functionality around status codes. In particular I've reimplemented a subset ...
4
votes
1
answer
143
views
Implement a simple image captcha test yourself in Java and JS
First of all: I was looking for a simple image captcha solution for a website, but all I found were "Over-the-top" solutions for me. So I decided to write something to self.
I mainly use two ...
6
votes
0
answers
184
views
Markdown parser library in C
For a side project, I needed a markdown parser and I decided to roll my own.
It is a SAX-style parser, i.o.w. you can hook into parser events on consumer side and do whatever you want with the content....
1
vote
1
answer
84
views
Runtime agnostic WebSocket server
A runtime agnostic WebSocket server. Tested with node, deno, bun, ...
5
votes
2
answers
936
views
rock paper scissors game with randomized system choices. NOT using rnd()
Here is the question I was trying to answer:
[11] Write a program that plays the game “Rock, Paper, Scissors.” If you are
not familiar with the game do some research (e.g., on the Web using
Google). ...
8
votes
1
answer
614
views
Shared-Memory Queue Implementation in C
Recently I am working on implementing a shared-memory based IPC message queue in C programming language on Linux system. A few design choices I've made include
The queue will have only 1 producer, ...
4
votes
2
answers
200
views
Class for validating code in different Conda environments with PyTorch
I wrote the Validator class. In the project, the presented code is located at the path ".../validator/init.py". It is needed for testing code in different virtual Conda environments, in the ...
3
votes
1
answer
153
views
SystemVerilog: LED blinker control logic
I built this simple blinker in SystemVerilog and would very much like some help to make it better:
control.sv
...
2
votes
1
answer
148
views
F# - Recursively find the first available item in a range definition
I have the following EF Core table:
...
6
votes
3
answers
148
views
Function to reduce dead band when reading a pressure transducer that has calibration device under test information
When reading a pressure transducer, I'm currently using the following code to apply the "device under test data" from the calibration report.
How can I determine which range segment of ...
9
votes
5
answers
3k
views
Console-based Casino Game in C++
I made a casino game that runs in the console for my grade 10 final project, and I received a 93% as my grade. I'm looking for feedback in areas such as syntax, user experience and efficiency. I would ...
4
votes
1
answer
110
views
Style taking applying control's DataContext property as converter input
In my Avalonia app using the MVVM Community Toolkit, I want to have a number of buttons in multiple user controls in my application to have as their content a ...
9
votes
3
answers
1k
views
Repository with SQLite in Python
This repository class is supposed to be used for saving information extracted from RAR, SFV archives or files that contain the hash sum in their filenames.
The abstract parent class can be found here)....
9
votes
2
answers
861
views
My shared_ptr implementation
I would like to ask for a code review of my shared_ptr<T> implementation for design, code style. Any nitpicks will extremely useful for me. The features ...
3
votes
2
answers
249
views
Third way to place queens and rooks with the higher score (extension of the queen problem)
Here is a third implementation, the second is in my question Place queens and rooks with the higher score (extension of the queen problem) and an initial one is in my answer for the question N queen ...
5
votes
4
answers
303
views
Swift for CLI tools (traversing directories, reading text files)
To compare ergonomics and performance of some languages for my hobby projects, I have written a simple lines of code counter in Swift, Go, Rust and Python. It scans a given directory tree for source ...
3
votes
2
answers
171
views
A Pacman clone in Javascript with binary heap and A*-based AI
rodde's Pacman clone
I have this clone implementation of Pacman. It looks pretty much like the original, yet I had to impose some relaxations as I am not sufficiently masochistic to implement all the ...
11
votes
2
answers
1k
views
Parsing HTTP headers in C
I'm new to C and just finished K&R. This is a code that I've written to parse headers of a HTTP request.
I want to know if my code:
Is safe? (after all this is C)
Does proper exit on failure? Are ...
2
votes
1
answer
160
views
Blazor web app using .NET 9: SQLDbSettings Code Optimization
I am developing a Blazor web app using C# .NET 9 in Visual Studio Code. I am using SQL Server 2017. This project is intended for internal company use.
In the ...
4
votes
1
answer
167
views
openprocessing.org program - After screen tap, erase red circle, pause and lastly draw new white circle
I am new to programming using the site openprocessing.org.
The code given does the following on my iPad:
Draw a red circle
Wait until I finger tap near the red circle’s center
Erase the red circle
...
2
votes
1
answer
109
views
Code to add order orderitems and payment details
This is order, orderitems and payment linked by foreign key.
Controller:
...
2
votes
0
answers
56
views
Vite ReactJS Case opener
I build project Case opening simulator in React JS + tailwind.
I am looking for maybe another way to implement the structure of code and tell me if I've done something wrong, what I should do better ...
4
votes
1
answer
212
views
Telegram userbot in python
I have a telegram userbot, monitoring certain group topic and answering certain messages.
I want it to be faster than human, now it's surprisingly not.
But I need to speed up its reaction, any tips?
<...
11
votes
4
answers
2k
views
Builder pattern in Rust
I tried to implement Builder pattern, a popular design pattern for constructing objects consisting of different components, in Rust.
Here is my attempt:
...
3
votes
1
answer
71
views
Ruby Array#own_uniq method
I have implemented my own version of Ruby's Array uniq-method (Ruby docs - Class array) as a monkey patch on Array.
Method-impl.:
...
3
votes
1
answer
186
views
Rendering data from mutiple models using controller and send to a single view
I have a master page, where I need to render data from multiple models. I have made a prototype of that page to show only the required conditions.
What is the best approach for controller to retrieve ...
4
votes
1
answer
138
views
Higher-kinded types in Rust
Also posted on Reddit.
As a small personal exercise, I'm trying to implement a notion of higher-kinded types in Rust using type-level defunctionalisation based on the "Lightweight higher-kinded ...
4
votes
2
answers
183
views
SimpleStackMachine.java - A virtual stack machine written in Java
In this post, I present my most recent result, a stack-based virtual machine programmed in Java. Frankly, I am lazy to write the unit tests since I am pretty much burned out with it. The full ...
1
vote
0
answers
65
views
Lock free Leaky Bucket Rate Limiter
I want to validate my solution for a lock-free leaky bucket rate limiter. Given a queuing capacity and rate limit per second, it should queue requests till capacity is reached and it should allow only ...
4
votes
1
answer
195
views
Place queens and rooks with the higher score (extension of the queen problem)
This is a continuation of the question N queen problem-like (+rooks and a different goal) written by someone else, where I answered.
EDIT I continued to work on the subject and a third implementation ...
5
votes
2
answers
470
views
Weakly-Referencing Tree Structure in Python
For another project of mine, I decided that it would be handy to have a tree structure to dictate hierarchy between pieces of data, but I didn't want to unnecessarily keep that data alive if it would ...