All Questions
77,270
questions
1
vote
0
answers
10
views
Advent of Code 2023 day 1: Trebuchet (Part 1 and 2) Follow-up
This is a follow-up to the question asked here: Advent of Code 2023 day 1:
Trebuchet (Part 1 and 2)
Changes made:
The code no longer assumes that all lines will fit into a fixed-size buffer. Although ...
0
votes
0
answers
15
views
How Can I make Performance Better For Custom ComboBox?
I created a package for Windows Form Application UI and among those control my biggest problem is slow loading big list in CesSimpleComboBox. How can I improve loading big data?
My solution: I created ...
0
votes
0
answers
31
views
Write new method base on old method without or fewer copy-paste code in java
description:
old method
I wrote an old method:
get data from parameters
check it, throw an exception if failed
save them into database.
e.g. If I have 3 different parameters, I'll call them in this ...
0
votes
0
answers
10
views
Logger with a Core and Client side
This logger is for a game engine I'm writing it has a core side which is the game itself and a client side which is the engine. The architecture of the code I feel like is messy it has the main log ...
2
votes
0
answers
18
views
Schedule a series of 1:1 contests so that each entrant plays against every other
My sister is organizing a Majong tournament. She wants to set up a set of round-robin rounds.
There will be 16 players at 4 tables; 4 players per table. Players will play 5 rounds. She wants every ...
4
votes
2
answers
516
views
1
vote
1
answer
37
views
Advent of Code 2023 - Day 2: Cube Conundrum
Part 1:
The challenge involves analyzing recorded games where an Elf reveals subsets of cubes in a bag, each identified by a game ID. The goal is to determine which games would be possible if the bag ...
4
votes
2
answers
330
views
Given a type, search for an item of that type in a std::tuple
In my project, I want to search for an item of a given type in a std::tuple at compile time. The given type might not be present in the tuple at all, in which case ...
0
votes
0
answers
32
views
Fetching seats for screening
Each screening has an assigned room and the room has seats. I need to display the seats for the given screening with information if it is free. The way I do it now is that I get the id of the ...
-3
votes
0
answers
15
views
Buggy VHDL for 3 item Vending Machine [closed]
im new here and am studying on how to code in VHDL for about 4 months now and have been doing well until i gave myself the project to build a small vending machine in VHDL.
The way i have the VHDL set ...
0
votes
0
answers
45
views
1
vote
2
answers
68
views
Advent of Code 2023 Day 3, Part 2 in Python
Part 2
I'm not sure if my solution covers all edge cases. The puzzle goes as follows: Given some input like this:
...
2
votes
1
answer
23
views
Encrypted websocket chat using AES (EAX) and RSA for signing
For learning purposes and because it really interests me I am trying to get a better understanding of cryptography by trying to make my own basic secure chat-application. I posted a first version of ...
1
vote
0
answers
24
views
Advent of code 2023 day 9: Sequence extrapolation - in pure Bash
Part 1
Today's task involves extrapolating the next value in sequences, given in this format:
0 3 6 9 12 15
1 3 6 10 15 21
10 13 16 21 30 45
The task is to ...
0
votes
0
answers
71
views
How to reduce the build time/cache Docker image layer in subsequent GitHub Actions runs?
I have a Dockerfile with ubuntu:22.04 as a base image and a manual Python installation(specific version i.e., 3.11.1) layer which takes a long time. How to cache ...
0
votes
1
answer
26
views
Implementing Preconditioned conjugate gradient
I have implemented the Preconditioned Conjugate Gradient (PCG) method for solving a system of linear equations in Python and I would appreciate it if someone could verify its correctness since I am ...
1
vote
2
answers
31
views
Script to automate testing solutions
Here's a script I wrote to automate testing for multiple sample files across two solutions, aiming to streamline the process. The script, provided below, compares expected results with the output of ...
2
votes
1
answer
70
views
Encryption implementation for websocket chat (RSA + AES)
For learning purposes I am trying to make a encrypted chat in Python using Websockets. I am using AES and RSA to make it safe.
The idea of the chat is that it's a group-chat. Users can join a chat by ...
2
votes
1
answer
32
views
Are there other means to apply place holders to an array in a loop for pdo statements for search functions with unknown numbers of keywords in php
I'm a newbie to PHP and other programming for that matter.
I'm doing this simply to learn. Figured the code could be used to search through a police database or something.
The statements are Microsoft ...
3
votes
1
answer
62
views
Advent of Code 2023, Day 8 Part 1 - Beginner Rust Solution
Context
I'm doing Advent of Code as a way of learning Rust, and have a working solution to Day 8, Part 1. This involves moving between nodes, starting at AAA and ...
0
votes
0
answers
21
views
Advent of code 2023 day 8: Path finding in the desert - in pure Bash
Part 1
In today's task, a network of paths is defined like this:
LLR
AAA = (BBB, BBB)
BBB = (AAA, ZZZ)
ZZZ = (ZZZ, ZZZ)
The first line ...
-1
votes
0
answers
50
views
Looping without looping statement
An alternative to loop statements handy when the domain-specific language (DSL) prevails over the programming language technicalities, is implemented with two instances calling each other while ...
2
votes
1
answer
50
views
Advent of Code 2023 day 1: Trebuchet (Part 1 and 2)
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 ...
4
votes
2
answers
1k
views
How to reduce the build time of Docker image layer in GitHub Actions?
I have a Dockerfile with ubuntu:22.04 as a base image and a manual Python installation(specific version i.e., 3.11.1) layer which takes a long time.
Approach 1:
...
2
votes
1
answer
45
views
Python optimization search pythagorean triplets
I have an optimization problem. Be it about code, algorithm or maths, that, i don't know.
My goal is to find pythagorean triplets satisfying a = b + 1 or a = b - 1.
m and n are the triplets generators....
-2
votes
0
answers
32
views
Im new to Programming and my code doesnt work [closed]
This program should output the smallest array index of the most common letter in the string and it works for some inputs but for example "zzz" and "AAA" outputs 1 instead of 0 :(
<...
1
vote
0
answers
13
views
Nodejs Websocket pulling new data from InfluxDB
I have a nodejs server with websocket which is pulling the new data from InfluxDB and send it to client.
The piece of code is this:
...
0
votes
0
answers
50
views
Summing Duplicates Across Sublists in a Nested List [closed]
I hope my message finds you well. I am seeking your expertise and feedback on a specific issue I have encountered in the repeat_sum function within the codebase. ...
1
vote
1
answer
58
views
Advent of Code Day 8
The task
A file similar to the following is provided.
...
0
votes
1
answer
34
views
Advent of Code 2023 day 1: Trebuchet in JS, part 2
The task involves analyzing a bunch of lines containing lines of text. Each line represents a calibration value that needs to be recovered by extracting the first and last digits and combining them ...
1
vote
1
answer
51
views
Python Runtime Config
I am implementing runtime configuration for a python package. I am doing this in mypkg.config.__init__.py. The idea is to load the configuration from a JSON file ...
2
votes
0
answers
55
views
Advent of code 2023 day 7: Ranking Camel Cards hands - mostly in Bash
Part 1
Today's task is to rank hands in a Camel Cards game and compute the total score.
In Camel Cards, you get a list of hands, and your goal is to order
them based on the strength of each hand. A ...
3
votes
2
answers
414
views
Hardware API, primarily for Error handling
I have a piece of equipment that I am interacting with. The manufacturer provided an SDK and some simple examples of how to interact with the device. However, I need to write an API for interacting ...
2
votes
1
answer
44
views
Advent of Code 2023 day 1: Trebuchet in JS
The task involves analyzing a bunch of lines containing lines of text. Each line represents a calibration value that needs to be recovered by extracting the first and last digits and combining them ...
-1
votes
0
answers
41
views
Stopping a running thread without testing variables
The Thread stop method is deprecated. The recommendation is to stop running threads by updating a variable.
Many uses of stop ...
4
votes
1
answer
222
views
A simple mmap(2) wrapper
I've written a wrapper for the mmap syscall. It's quite limited in functionality at the moment (there are lots of flags to support) but it's sufficient for mapping ...
-3
votes
0
answers
12
views
Trouble converting recursion to dp [closed]
I am stuck in what looks like minor but annoying issue for the minumin sum path leetcode question:https://leetcode.com/problems/minimum-path-sum/
below is my code:`class Solution {
public:
...
1
vote
1
answer
76
views
Extra 0's after rounding [closed]
In a project i am doing for AP CSP, I am attempting to make a calculator that can do sig figs, and there is always a ton of extra 0's after i round the number as seen in the picture i attached
the ...
7
votes
4
answers
954
views
Matrix Class Implementation
I have written a minimal matrix class. I would like to utilize the latest C++ features, follow best practices, and utilize multi-threading in some of the operations. I have also setup a GoogleTest ...
0
votes
1
answer
22
views
Copying data from a network share to another
The code below copies large amount of data. It does so in 2 steps. I was wondering if both step1 and step2 can be done in parallel.
...
4
votes
1
answer
261
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 ...
2
votes
0
answers
41
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 ...
3
votes
1
answer
51
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 ...
-1
votes
0
answers
31
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 ...
2
votes
2
answers
21
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
28
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
23
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
83
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
63
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
33
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 ...