All Questions
77,256
questions
2
votes
1
answer
92
views
Advent of Code Day 2 in Python
problem for day 2
Part 1
You're launched high into the atmosphere! The apex of your trajectory just barely reaches the surface of a large island floating in the sky. You gently land in a fluffy pile ...
6
votes
2
answers
1k
views
Advent of code 2023 day 2: count possible qube games - in pure Bash
To paraphrase the puzzle, Santa takes a walk with an Elf, and they play a game involving a bag of colorful cubes. In each game, there is an unknown number of each colored cubes in the bag, and the Elf ...
5
votes
2
answers
178
views
Binary file reader and writer
I want to write a simple binary file reader and writer class. The class below can read or write file. main.cpp read 500 bytes from tmp.bin and copy at the end of ...
0
votes
1
answer
43
views
DB Layer of a project management CLI
I am (re)writing a project management CLI and want to put it on a solid foundation concerning the database connections and testing. My focus was to build a DB class which is easy to test and could be ...
2
votes
1
answer
61
views
A simple threadpool in C++17
Implemented a simple thread pool that executes task asyncly, and returns a simple future you can wait on. Can you please suggest improvements?
...
3
votes
1
answer
57
views
Simulating a Moving Average Process
I was studying stochastic processes and thought to independently simulate a moving average process.
...
2
votes
1
answer
46
views
How better methods of remaking the code by array without changing its functionality, and performance but reducing amount by ~10 times
Can anybody help me with examples of code?
How is the approach to optimize code relative to my example with using "switch case" to "arrays"? Without changing its functionality, but ...
1
vote
1
answer
43
views
Asynchronous OOP-based networking using the Epic EOS SDK
There is also a limitation from the Epic EOS SDK in the absence of thread safety, all "C" calls can only be made from one thread. And from the thread where the SDK was initialized.
Based on ...
5
votes
1
answer
149
views
Advent of code 2023 day 1: count trebuchet calibration numbers - mostly in Bash
It's that time of the year again!
Although there's no more Winter Bash, we can still have all the Bash we want in winter ;-)
Part 1
To paraphrase the description:
For each line in the input:
Find ...
3
votes
0
answers
129
views
Parse two-digit numbers from text
I am participating in this year's Advent of Code for fun.
Challenge 1.2 states:
The newly-improved calibration document consists of lines of text; each line originally contained a specific ...
1
vote
1
answer
61
views
Managing users via SQLAlchemy DB model (updated)
I am currently in the process of writing a system application that will be operated by multiple users. This will require individual users to access the application while limiting access to those that ...
0
votes
1
answer
30
views
Print a hollow Rhombus [closed]
I am beginner in java, here is my code to print a hollow rhombus:
...
2
votes
0
answers
35
views
SEDE query to count questions, views and unanswered for a set of tags
This query selects the number of SO questions, the number of views and the number of unanswered questions for each tag (the list of the tags is the user input). It works fine when it works, but it ...
0
votes
0
answers
50
views
Is this iterative inorder traversal algorithm well-known?
I was concerned about the approach in Morris traversal algorithm and came up with simpler solution that uses parent pointers in nodes.
The constraints were following:
Time Complexity: O(n)
Space ...
-3
votes
0
answers
26
views
Raspi5 Throws "mmap of gpio registers failed" with pwm fan script [closed]
basically the title.
the following code
...
2
votes
1
answer
59
views
Finding the longest path on a grid with obstacles from the top to the bottom
I have a rectangle of . (platforms) and # (obstacles). I can start at any platform in the top row and go to the left, right or ...
3
votes
1
answer
63
views
C++ printing library with templates
I was mad C++ did not have support for printing containers. I also could not find a header only library for printing containers so I decided to make my own. My goals were: 1) practicing templates 2) ...
0
votes
0
answers
41
views
Todo application using Spring Boot 3, Dockerized Postgres, Java 17, Maven
I'd like to have code review for backend of todo app.
It has 2 main functionalities:
Authentication and authorization using Spring Security and JWT token.
CRUD for tasks
In particular I'd like to ...
2
votes
1
answer
80
views
Double each occurrence of a char recursively
The exercise is to write a recursive method that takes a String and a char parameter and returns a ...
3
votes
1
answer
81
views
Simple hash table written in C with REPL
This is a simple hash table I've written in C. It is a closed-addressing hash table with TABLE_SIZE number of buckets. The hash ...
1
vote
1
answer
51
views
Simple .NET Web App for managing family budget
I am creating some small project for my portfolio. It will be an app written in .NET and React but for now I've done backend part and I seek code review. I wanted it to be aligned with DDD principles ...
2
votes
0
answers
26
views
Ringbuffer over a const generic Array in Rust
I implemented this generic ringbuffer over a const generic array with the usage of the MaybeUninit type.
Is there something which is maybe unsound (having the lines ...
1
vote
1
answer
36
views
LinearUpscale2DArrayInPlace in Unity Jobs
Well,
I have this function which is called in the Unity Job system, I'm profiling it:
The code:
...
1
vote
0
answers
29
views
Simple Todo app using latest React and TypeScript
I would like to ask your advice on the frontend code of todo app.
Main functionalities:
The app has authorization and authentication using backend.
The CRUD functionality for managing tasks
What may ...
1
vote
2
answers
85
views
Domain Driven Desing aggregate for ticket booking
What do you think about this aggregator (DDD) for booking and cancelling tickets? Is it ok, or would you do it differently somehow?
...
1
vote
1
answer
77
views
Simple text file encryption and decryption
Short introduction; recently I've completed a basic course on C but other than that I have no programming experience and I am a total beginner.
As a practice project and to practice reading from and ...
2
votes
1
answer
18
views
Do you think it's a good schema.prisma?
i'm trying to learn backend with Next JS, and i'm using Prisma + MongoDB. I want to create a simple website with a user with a cart and some products. here my schema :
...
6
votes
1
answer
78
views
Optimizing __getitem__ for a bioinformatics script in Python
I'm writing a script for a bioinformatics application in Python that iterates through several sequences looking for amino acids in specific positions to calculate their frequency in relation to a ...
0
votes
1
answer
76
views
Move timestamp to the next Monday 10:01 AM
I've been battling ChatGPT for hours now and can't get satisfied with this simple algorithm in TypeScript. These two (hopefully correct) TypeScript+ReactNative solutions should move the timestamp ...
2
votes
0
answers
77
views
NLP pre-processing function optimization as it is extremely low on 92Mb data set
I have a data set that is of 300,000 rows approximately and two columns, each row contains a string, some might be larger than others. All in all, the data set in a ...
10
votes
4
answers
2k
views
Number to text in Python
I'm kind of new to programming and I would need a suggestion whether there is a better way to solve this exercise.
I need to write a function dict_of_numbers() that ...
0
votes
0
answers
38
views
Waiting time display app in Python
This application is for restaurant patrons to know how long they have to wait in line.
We would like to design a more sophisticated GUI interface, but do not know how to go about it.
Please let me ...
5
votes
9
answers
284
views
In-memory cache class
The following is a simple cache that I have written in java. It uses the LRU replacement policy and also evicts items based on a refresh interval (default 5 secs). Right now, the class is not thread ...
1
vote
0
answers
34
views
Go log file swapper
Please review my code. I left some comments where I think something might be wrong, but any comment is appreciated.
I am writing a package for a project I am currently building. Its purpose is simply ...
3
votes
1
answer
78
views
Implementing an Object type in C++
I'm currently working through the "Crafting Interpreters" book by Robert Nystrom. He uses Java to implement the visitor pattern in which the visitor functions return the Object type. C++ ...
4
votes
2
answers
440
views
Spatial radius search in Boid simulation
I am working on a Boid simulation with 10,000 boids. I've successfully utilized geometry shaders and an array<GLfloat[3], MAX_BOIDS> for vertices to enhance ...
1
vote
1
answer
76
views
Simple Tic-tac-toe in Python
I am a beginner programmer who coded a simple Tic-tac-toe in Python for practice. Any feedback, especially regarding best practices and tidying up the code, is appreciated.
...
1
vote
1
answer
90
views
Is it a correct way to read a file contents using paramiko (SSH, SFTP client)?
Is my implementation of _read_contents (3 lines) fine, or does it create a potential problem (e.g. passing part of an object that has to be destroyed, or a ...
7
votes
2
answers
2k
views
Gaussian elimination algorithm in C++
Given:
j-g-h-i=0
a+b-c-j=0
c+i-d-e=0
e+g-f=0
And known:
a=10
b=7
d=3
e=2
f=3
j=14
I want to solve this (or similar equations) ...
2
votes
1
answer
58
views
Data structure to hold elements for script execution
I am building a solution to iterate over Python scripts in a folder and execute them. Each script will return a Pandas data-frame which needs to be saved as a Parquet file. The first stage is the data ...
2
votes
2
answers
73
views
Dictionary additional function implementations
I've written a utility class BetterDict to help me on some of my other projects. I've implemented the &, ...
3
votes
1
answer
89
views
Pentomino solver in Python
When I was a child, I used to play Ubongo board game, recently I discovered Pentomino puzzle and I wanted to create a custom solver in python for it. Here is what I got:
...
2
votes
1
answer
74
views
Casino Number Guessing Game
I have created a casino number guessing game in C++:
...
1
vote
1
answer
80
views
Rubik's cube scrambler with timer and list of solves
This is a work in progress Rubik's Cube scramble generator with timer and list of solves. The list of solves is stored using localstorage so that it stays on page reload. A solve can also be deleted ...
1
vote
1
answer
75
views
Lazy/deferred OOP-based networking using the Epic EOS SDK
For gaming applications, networking looks strange from the point of view of traditional approaches.
Much of the game logic is based on "ticks"; Most often this is a mandatory item of ...
0
votes
1
answer
65
views
HackerRank Algorithm Problem: Climbing the Leaderboard (Python)
Here is the Hackerrank problem which is related to dense ranking and below is my solution which didn't pass the time limit cases. Any better way to optimize this?
...
1
vote
0
answers
59
views
My code.org Game Lab project is running really slowly, how can I optimize the code further?
I'm working on my final project, and it is a game made with Java Script in code.org's Game Lab. The code worked fine, and it was not slow at all, but as I worked on it, it became much slower! The ...
2
votes
1
answer
69
views
An implementation of encryption cascade
I'm looking for feedback on some source code, I have everything documented and have corrected some errors. Looking to see what I did correctly, incorrectly, and what can be improved.
...
0
votes
0
answers
42
views
PHP implementing Dependency Injection
I'm trying to implement Dependency Injection in one of my projects. It's a project that when I started I didn't had much experience with sotware development, but now I feel like it's time to do a bit ...
0
votes
0
answers
23
views
cubic spline routine
I tried to implement the cubic spline algorithm in cython. I want to ask how I can make the code more efficient in terms of speed. Any suggestions or references ...