All Questions
77,258
questions
2
votes
0
answers
8
views
Advent of Code 2023 day 1: Trebuchet
Part 1:
The task involves analyzing a calibration document containing lines of text. Each line represents a calibration value that needs to be recovered by extracting the first and last digits and ...
0
votes
0
answers
8
views
Advent of code 2023 day 6: Count ways to win boat race - in pure Bash
Part 1
To paraphrase the puzzle, given the times and record distances of boat races like this:
Time: 7 15 30
Distance: 9 40 200
That is, the first ...
1
vote
0
answers
16
views
Fuel Gauge Python
I was wondering if my code is good or maybe if it could be written better or simpler.
The task was to implement a program that prompts the user for a fraction, formatted as X/Y, wherein each of X and ...
0
votes
0
answers
14
views
Function to find successive primes with sums of previous terms as divisiors
Is this a successful piece of code and an appropriate way to rephrase the mathematical notation? Currently it does not find pairs, so I wonder how to approach reasoning deductively about this problem ...
1
vote
1
answer
6
views
Start script for several Spring Boot services
I have several Spring Boot and Angular applications/microservices that form together a whole application. As it is tedious to start them via the terminal, I've written the following script to perform ...
0
votes
0
answers
23
views
Train Dispatcher in Java [closed]
I am developing a simplified train dispatch system as a final assessment for my CS major, first semester. I have a user interface class, with the TrainDispatch instance as a UI class variable.
...
1
vote
0
answers
15
views
AutoKeras Network Architecture Search (NAS)
I have two directories, train_data_npy and valid_data_npy where there are 3013 and 1506 *.npy...
2
votes
1
answer
59
views
Logger for a Game Engine
So I'm making a logger for a program and it has 6 levels increasing severity and things I don't think its as memory efficient as it could be but I'm just getting into c++ and memory coding. I feel ...
1
vote
1
answer
53
views
String represents a road. One character travels on the road obeying the stops - Code challenge (advent.js day 5)
This is my code to solve the 5th Adventjs challenge. In that link you can read the instructions.
How can I improve it? It's a bit messy... and I'm repeating some part of the code.
All must be in just ...
-2
votes
0
answers
26
views
C++ template function specialisation within class template [closed]
I'm not used to template programming - much more used to inheritence & composition.
But in terms of a general solution, I'm using a tiny project to ensure a reasonable approach for using class ...
0
votes
3
answers
80
views
Declaring type definition once for all variables
To avoid the use of magic numbers, I created a static class to store some integer values that are represented inside a database. I avoided using enums because I need to cast them every time I use them....
2
votes
1
answer
24
views
Using async websockets in Rust with tokio, rmp-serde and varint encoding
This is my first attempt at a real life app in Rust. I would mostly like to know if I am writing idiomatic Rust code, coming from Java and Python. I'll appreciate any pointers to improvements, though.
...
5
votes
2
answers
1k
views
Advent of code 2023 day 4: Count scratchcard points - mostly in Bash
Yesterday I thought was the last day of Advent Of Code 2023 that I do in Bash. I was wrong. I'm not even sure anymore that today will be the one. We'll just have to see tomorrow!
Part 1
To paraphrase ...
0
votes
3
answers
88
views
Java - Should I use getter in method?
I have two working solutions, but which one should I use? Which solution is correct?
Solution 1:
List<Client> myClient = new ArrayList<>();
...
0
votes
2
answers
47
views
Optimisation: Conversion from int to Roman Numeral
A while ago I made a post about optimising the multiplication of every number in an array by 2. With everyone's help I was able to go from 1,500 ns (LINQ) to 30 ns.
So I thought I'd try something ...
2
votes
1
answer
29
views
access arrow data
I am fetching arrow tabular data from an API. The content-type of the response is application/vnd.apache.arrow.stream. In my react code, I am trying to read the ...
0
votes
1
answer
30
views
Find and conditionally sort all venues matching a filter provided by an API client in PostgreSQL
I have an API where users can retrieve a list of "venues".
Every venue is a profile, but not every profile is a venue
Venues can be "parents" of other venues (think hotel - floor -...
-2
votes
0
answers
37
views
Melhorar jogo de basquete simples [closed]
Neste código, faça com que quando a tecla de espaço for pressionada, a bola deve completar o seu trajeto. Depois que a bola parar de cair, ela deve voltar para a mão do jogador, na sua posição inicial....
1
vote
0
answers
81
views
Advent of code 2023 day 3 in pure Bash
Yes I'll keep doing this until I cannot be bothered to do it in Bash ;-) (Well today is probably the last one ;-))
Part 1
To paraphrase the puzzle, given some input ("engine schematic") like ...
1
vote
0
answers
88
views
Python integer optimization with PuLP involving polynomials that I think can be faster
I have a problem where we are given multivariate polynomials in variables like y_i and z_j and the goal is to express them as sums of products of terms of the form y_i-z_j with nonnegative integer ...
2
votes
3
answers
93
views
Redouble each occurrence of char recursively, and add n
In following of this question, I would like to have a second review.
The exercise is to write a recursive method that takes a String and a ...
1
vote
0
answers
73
views
Advent of Code 2023 Day 2 in C#
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 ...
0
votes
0
answers
27
views
PHP And Reflection For Showing Available Formatters On A Report Column
I'm using reflection in PHP to load a list of available Formatter classes that all have methods that do formatting of a value in a specific CSV column.
e.g. for ...
2
votes
2
answers
43
views
A recursive_minmax Template Function Implementation in C++
This is a follow-up question for A Maximum Function For Various Type Arbitrary Nested Iterable Implementation in C++. Besides the function for finding maximum, I am trying to implement ...
0
votes
0
answers
72
views
Best Practices For A Console Menu App
I am quite fresh to c# and creating programs. I wrote a very basic program which allows you to go through menu selections via up and down arrowkeys and select your selection along with sending you to ...
0
votes
1
answer
26
views
Make a script to call pager duty's API and update on call
I made this script it works, I'm just looking for ways to make it better/reading to get better.
...
2
votes
1
answer
85
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 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
174
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
51
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
55
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
41
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
124
views
Advent of code 2023 day 1 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
107
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
42
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
29
views
Print a hollow Rhombus [closed]
I am beginner in java, here is my code to print a hollow rhombus:
...
2
votes
0
answers
34
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
23
views
Raspi5 Throws "mmap of gpio registers failed" with pwm fan script [closed]
basically the title.
the following code
...
2
votes
1
answer
49
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
62
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
78
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
0
answers
38
views
Printing more than one string variable with print in python [closed]
I am new to python and I having a hard time with a simple print of two strings. I am following some examples and I don't understand why it is giving me an error
...
-3
votes
0
answers
44
views
first snake game [closed]
I've just worked on my first game in C and have a few questions.
how would I make it where my box is nicer?
I'm having issues trying to figure out how to make the snake grow in size when it eats.
...
3
votes
1
answer
76
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
50
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
24
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 ...