All Questions
77,787
questions
1
vote
0
answers
9
views
C++ std::function-like queue
I aim to create a call queue to schedule work for another thread.
I'm using a virtual base class for type erasure and placement new for reducing the number of allocations, but, as far as I know, ...
1
vote
0
answers
12
views
Accelerating computation of a "2D Variance" using C++ and Eigen in a MEX function
I have the following function in Matlab:
...
-3
votes
0
answers
23
views
Tried making an infinite marquee in react [closed]
I was making a marquee which would show "We are ochi" marquee infinitely but I was not able to make it infinite so just made it by adding "We are ochi" into an array by 9999 times ...
6
votes
1
answer
120
views
VBA: Efficiently Organise Data with Missing Values to Achieve Minimum Number of Tables
The task is to create sub-tables from an original table (like below) that contain the missing data columns (missing data is highlighted in red). The important part of this task is to make the smallest ...
-1
votes
0
answers
24
views
Use of std::future vs. std::thread in grep clone [migrated]
I wrote a grep clone recently. It does a recursive search of a string query through all files of a specified directory. The core of program is the function shown ...
3
votes
1
answer
146
views
Calculating probability of offspring having dominant phenotype given a random mating - Mendel's First Law
I'm a beginner to python and have been working through the Rosalind problems. If you're unfamiliar with Rosalind, they're a website where you can practice bioinformatic coding through problem solving.
...
-3
votes
0
answers
52
views
C# Optimization. It is not valid; only numbers 1-20 are acceptable [closed]
My code filters any VarChar entered into a console application, followed by a governor of 1 - 20 as acceptable code. I have had help from the Stack Overflow question "4804968." I copied some ...
3
votes
1
answer
61
views
C parser for reading 3D ASCII scene files
I have been interested in the project of writing a parser that reads ASCII files for a long time, mostly for educational reasons. My idea was not to use tools like Bison or Yacc but to write a hand-...
3
votes
2
answers
44
views
Using git autobackup with shell script
I have php website for prevent hacker modify any file and inject backdoor.
I want to use git as a file tracking solution. This is my shell script:
...
2
votes
1
answer
44
views
Command-line parser for multiple subcommands
Explanation
I have done another command-line parser here -- I am kinda obsessed. It was really verbose for the user of the parser, it grew complicated quickly with option parsing and a regular command-...
-5
votes
0
answers
24
views
Find the maximum possible score in a two player card game when both optimum players can see the whole deck [closed]
I was asked this question and I couldn't solve it. Here is the problem.
There are N cards, each numbered randomly with a number between -K...0...K. Two players can see the entire deck at all times but ...
1
vote
0
answers
11
views
Multi Step Record Creation Form with Validation Using Formik, Yup, and MUI
This component is a multistep popup form designed to handle job vacancy creation. It uses MUI for the UI, Formik and Yup for form handling and validation. The form is divided into 4 steps: Job Details,...
2
votes
0
answers
36
views
Type-state pattern and state management for credentials struct used with Spotify web API
I am implementing authentication with the Spotify web API as part of a larger project. Yes I know there are already crates that can handle it for me but that is no fun. I am implementing the auth code ...
2
votes
1
answer
20
views
Update user name within participants of chats
I have the function which updates user data (currently only name). I would like to optimize its logic and particularly logic of updating participant name in chats. Currently I get entire chats ...
3
votes
2
answers
579
views
Text processing: Filter & re-publish HTML table
Background
Some years back, with a surfeit of free time, I would scan through a webpage listing of "today's" free-to-air television listings hoping to find an interesting program or movie (&...
1
vote
0
answers
38
views
Connection pool design for Boost MySQL
I had to design a connection pool that handles Boost MySQL connection to use the asynchronous functions.
Here is the code:
...
0
votes
0
answers
27
views
set Member Function Implementation for Image in C++
This is a follow-up question for draw_if_possible Template Function Implementation for Image in C++. In G. Sliepen's answer, set member function has been mentioned. ...
-1
votes
0
answers
47
views
handling symbolical and numerical nested integrals [closed]
I'm working on reproducing a calculation from this paper https://arxiv.org/abs/1712.03972 for my thesis but I'm struggling with how to properly implement the nested integrals in Python, specifically ...
5
votes
2
answers
548
views
Thread-safe write-efficient register() method for a Load balancer
The code below was written for an interview question of designing a load balancer with only a register() method.
...
-2
votes
0
answers
55
views
how to avoid copying of data between two classes [closed]
I have 3 variant classes namely A, B, C and Variant. Due to historical reasons they are being designed as independent classes(no inheritance). Then there is a ...
4
votes
1
answer
304
views
Python function to expand regex with ranges
I attempted to implement a python version of this function in my previous question. Given a regular expression with range(s) of alphabets/numbers, the function will expand the brackets and return a ...
3
votes
1
answer
51
views
Assemble and link assembly makefile
This is a GNU Makefile I made for a collection of assembly listings. It uses static pattern rules to group together similar rules.
...
6
votes
3
answers
784
views
Generate all the free polyominoes who's width and height is no larger than 8
I'm working on a puzzle game and I need all the free polyominoes that can fit into an 8 by 8 grid. My code uses Redelmeier's Alogorithm for enumerating them, checks them for rotations and reflections, ...
2
votes
0
answers
60
views
R function to expand range of numbers/alphabets in a regex
I tried writing a short function that expands brackets [] within a regular expression. Given a regular expression, the function will expand the brackets and return ...
0
votes
0
answers
22
views
Securely send data as a parameter in a Livewire action method
I have friendship functionality in my Laravel application and saw Crypt is available from within blade view templates. Is this a common practice when trying to send ...
2
votes
1
answer
89
views
Number of Islands, C++17, Visual Studio
I have written a program in C++ to answer the problem of the number of islands, I receive a text file that consists of an array where '.' is water, and the rest is land, and I need to find the number ...
4
votes
1
answer
244
views
Hashable and ordered enums to describe states of a process
I am wiriting am application which needs to store information about an industrial process where products go through the following, strictly sequential phases:
...
-3
votes
0
answers
51
views
Mathematically Simulating a Queue [closed]
I have spent the past few weeks (using the R programming language) trying to simulate a (MMK) Queue (e.g. customers entering and exiting a cafe, First In First Out) and have been running into ...
1
vote
2
answers
124
views
How to optimize and refactor C# method for validating business rules in terms of readability, maintainability, and performance?
I'm working on a C# project and have a bloater method ValidateBusinessRules that checks a series of business rules for validating the operations. The current code ...
-3
votes
0
answers
14
views
.htaccess configuration, how to deny directory listings but allow some? [closed]
How do i configure my htaccess file for Apache to allow users to view a certain directory listing, but deny all others.
...
2
votes
1
answer
30
views
Created a Scala (Native-compatible) program that scores words in Scrabble. Any refactor tips?
As said in the title, I used Scala to make a simple little program that takes a formatted input string representing a word in Scrabble and spits out its score, including a message explaining where the ...
0
votes
0
answers
110
views
Fuzz-test the performance of SmokeDetector's keywords regex
I had an idea for attempting to detect bad performing regexes in Charcoal-SE/SmokeDetector, by using Atheris (a fuzzer for python code).
The theory behind it is that a bad performing regex will most ...
-2
votes
0
answers
60
views
Modifying type traits in C++ via "runes" [closed]
The Problem
I have a whole lot of type traits to be able to constrain my struct/function/constructor templates and I want to impose some structure onto them. Let's say, I want to constrain a templated ...
3
votes
3
answers
434
views
Matrix Multiplication & Addition
I created this small library to perform basic arithmetic on matrices. I have written the code, and it runs fine. Is there any unexpected behavior or memory leaks? Any room for improvement?
...
1
vote
1
answer
79
views
Python preprocessor for pipes
I wrote this preprocessor just to add a couple features to Python (pipes mostly.) Is there any way I could improve it?
...
1
vote
2
answers
119
views
syslog formatted logger
I have a logging example that I wrote myself and it currently consists of a single file.
In this code, I aim to reduce the number of parameters of the functions, increase the processing speed and make ...
4
votes
5
answers
904
views
Creating Layout of 2D Board game
I am quite new to c, and I'm trying to get better in it.
I want to create a simple snake & ladder game.
I achieved the layout of the board that I wanted, but I'm not sure if this is really an ...
0
votes
0
answers
25
views
Duplicating answers from a multi-section form populating multiple tables
I am implementing a system in which a client fills a form. Each form has multiple sections and each section populates multiple tables, thus user fills each section separately.
I was asked to make a ...
-3
votes
0
answers
66
views
Simulating a Queue in R [closed]
A few months ago, I learned how to simulate a simple queue in R https://stackoverflow.com/questions/77734912/r-how-to-simulate-a-queue . Now, I am trying to a make a more complicated version of this ...
4
votes
3
answers
89
views
How to optimize the algorithm of generating images in javascript canvas?
I added this question on Stackoverflow, but it was suggested that I post it here.
Currently, I create 2000x2000 pixels canvas and tile the image on it, and then tiling the texture on top and applying <...
2
votes
2
answers
124
views
Todo List app using C
I just learned to deal with pointers and memory allocation stuff. Using that, I built a todo list app, and it works as far as I tested it.
I didn't account for many user errors, so any suggestion to ...
1
vote
1
answer
103
views
Calculate directed acyclic graph dependency level [closed]
This code calculates the directed acyclic graph dependency level for each row of the pre-sorted CSR-format lower triangular sparse matrix lower. The result is used ...
4
votes
1
answer
62
views
Local Discovery Protocol v4
The following is a minimal implementation of syncthing's Local Discovery Protocol.
I am looking for feedback on:
Improving the efficiency and reliability of the code.
Best practices for this kind of ...
3
votes
1
answer
103
views
Script to format Markdown as plain text
The following script is to convert Markdown files to something closer to my aesthetical expectations. It is not assumed to be bulletproof accurate and I don't mind to slightly adjust the output ...
4
votes
3
answers
211
views
Gomoku game 5 in a row. Javascript simple game Canvas
Gomoku ★★★ (Tic Tac Toe)
There are many Gomoku (5 in a row) game projects on the Internet.
The scripts of these projects are freely available. Having analyzed them, I created my own
game code based on ...
3
votes
1
answer
116
views
VBA code used to build a diverse portfolio of DFS lineups to minimize risk
This code works great and does exactly what I want but it takes around 10 minutes for the code for find 150 lineups. I am hoping to get help and learn how to make it much faster.
The goal of this code ...
5
votes
1
answer
86
views
Simple tile navigation system
I haven't done any programming in quite a bit of time, and I tried to make a program where a player navigates up, down, left and right on a grid. I haven't used a tutorial for that, and I'm not ...
4
votes
3
answers
1k
views
Coding exercise to represent an integer as words using python
Context:
Convert a non-negative integer num to its English words representation.
Example 1:
Input: num = 123
Output: "One Hundred Twenty Three"
Example 2:
Input: num = 12345
Output: "...
0
votes
0
answers
19
views
How to insert a custom vector into a simulation?
Using the simmer package in R (https://r-simmer.org/), I made this queue simulation that shows how the percent of all customers that waited more than 15 minutes changes when more servers are added to ...
8
votes
2
answers
310
views
Determining Error Rate of Phase Shift Keying via Monte Carlo Simulation
My program calculates the symbol error rate for various signal-to-noise ratio (SNR) and modulation orders using Monte Carlo simulation on Phase Shift Keying (PSK). How can it be improved?
...