All Questions
76,783
questions
0
votes
0
answers
15
views
Does my python Sudoku solver cut the mustard?
I wrote a Sudoku solver in Python and would love any feedback you can give on anything you see fit - the code, the solution, layout, coding principals, format etc.
The program awaits input of an 81 ...
0
votes
1
answer
24
views
Multithreaded Conway's Game of Life implementation written in C and Java using JNI
I had some multithreading C programming experience from school last year but I wanted a bit more so I tried to program a Conway's Game of Life implementation from scratch.
Code is mainly written in C ...
-1
votes
1
answer
21
views
any bits unsigned integer
This is a class that acts as an unsigned integer with a variable amount of bits.
...
4
votes
1
answer
114
views
Rust book exercise
Going through the Rust book for the second time as I've been wrapped up in Typescript for a while and I want to build a personal project in Rust.
In chapter 8.3, there's an exercise:
...
0
votes
0
answers
34
views
Getting and setting dict items via paths
I wanted to have something more convenient to work with nested dictionaries that come from yaml files so I wrote this ...
5
votes
2
answers
244
views
Proper implementation of signal handler and multithreading (pthread)
I am trying to implement a "proper" signal handler that works correctly for multiple threads, and to be as C-standard-conforming and POSIX-conforming as possible. The below is my ...
-3
votes
0
answers
27
views
Prime Number Program In Java [closed]
As a Java developer, I'm examining my code before releasing it to consumers. But, throughout the code review, I discovered some implementation mistakes. My code is as follows:
...
3
votes
0
answers
48
views
Instance specific code generation
Disclaimer: I've asked this question before on Stack overflow and got a response that this place would be a better fit so I am copy pasting the question here.
I've come up with two different ...
0
votes
1
answer
27
views
Find Free Appointment Slots given Opening Times and Booked Appointment Times
Any ideas to make it better or more efficient? any edge cases that are not covered?
Opening times:
...
0
votes
0
answers
19
views
Generate INSERTs from function parameters with jinja2
I'm writing unit-tests with pytest for sqlite database and reporting functions and I need to arrange them by inserting minimal ...
0
votes
0
answers
13
views
Python script for a Timeline widget for an audio player
I used to use the Tkinter scale widget for this, but it is limited in several ways. So I made a custom Timeline with the Canvas widget, which makes a more dynamically changeable Timeline.
...
-1
votes
0
answers
5
views
Extract column values from pubsub output using apache beam in python [closed]
I am trying to extract data from the PubSub subscription using Beam and finally, once the data is extracted I want to do some transformation. Currently, it's in bytes format. I have tried multiple ...
1
vote
0
answers
14
views
Protecting functions from empty DataFrames
Pandas likes to throw cryptic errors when you feed its functions with empty DataFrames saying nothing that would help you to identify the root cause. In order to ...
5
votes
1
answer
253
views
Most compact data format for a shopping cart
I'm trying to build a format that can represent the user's cart on my website in the most compact way. The website is related to computer parts and there are 23 product categories. Each product has an ...
1
vote
1
answer
16
views
Mapping pandas' Series to dataclasses
I've got something really simple this time where I'm mapping pandas' Series to dataclasses with a oneliner helper function (as ...
8
votes
2
answers
962
views
Check validity of string, used return False too often? (CS50 plates.py)
Firstly, yes I'm a beginner. The code does function correctly but it looks ugly and I'm unsure if it is easily readable.
I think my issue is the fact I've used 'return False' 5 times in a single ...
1
vote
0
answers
46
views
A simple probabilistic AI for generating random sentences in Java
Motivation
I have this repository. It contains a program that analyzes an input text file and builds a word graph: in the graph, each node represents a word in the analyzed text. Now, if there are two ...
6
votes
2
answers
105
views
Arduino library to simplify differential drive robots
I've written code for an Arduino library to abstract away some of the underlying logic in a particular way of moving robots. Code is posted after explanations.
I'm not assuming a high degree of ...
2
votes
1
answer
68
views
IEnumerable<T>.Tee implementation
I am trying to write A C# version of a method in the Java Stream API called Collectors.teeing() (It's like Aggregate but with multiple accumulator functions), just for educational purposes.
I want to ...
2
votes
0
answers
40
views
2-Player Chess in WinForms V.2 (With Separation of Concerns)
Introduction
After getting initial feedback on my first working version of this Chess WinForms game here, I have used the suggestions and comments from there to come up with this new version, trying ...
0
votes
0
answers
14
views
React Native app custom Loading while fetching data Component
I have a loading component (shown while fetching data for example), thats supposed to not immediately start and stop at a specified amount of time. Then a popup will be shown saying "something ...
0
votes
0
answers
48
views
Js vanilla button - does it make sense
Button component that I really would like to be perfect, but I'm not confident about it.
Should I keep working on it or start over?
...
-2
votes
0
answers
84
views
Simplifying a Jetpack Compose modifier [closed]
I have a modifier from Jetpack Compose that I want to customize.
The original code is this.
...
3
votes
0
answers
39
views
Building an API for an e-commerce system to allow third party software to import products
I am working on an e-commerce website called Shopless, which is similar to E-bay/Gumtree. Our website integrates with other DMS systems, in order to allow organisations to import products into our ...
-1
votes
0
answers
15
views
MVVM + CoreData + SwiftUI and updating view problems [closed]
Immagine you have to do an app using CoreData and SwiftUI and sticking on the MVVM pattern.
You have a ParentView (ContentView) with his ViewModel (ContentViewModel) and a ChildView (ContentDetail) ...
-3
votes
0
answers
24
views
How do i get the value of a dictionary object in <string,Object> [closed]
the dictionary as returned by an api is
Dictionary<string, object> dict2 = new Dictionary<string, object>();
the items in question resides in the ...
-1
votes
0
answers
19
views
Python code for Timetable generation needs to be reviewed for the error [closed]
this code is to generate a time table for the school.
import random
class SchoolTimetable:
def init(self, num_teachers, teacher_subjects, teacher_classes, periods_per_subject):
self.num_teachers = ...
3
votes
2
answers
65
views
Algorithm to find sequential ID gaps in List<long>
I had to develop an algorithm that will find gap between sequential Ids within a List<long>.
For example as input we had the following ...
0
votes
1
answer
60
views
Copy object without reference using reflection
Recently I was in need of a method to copy an object and pass it to a method which alters the data. Since a class is passed by reference this would alter the class in the caller which I don't want.
So,...
1
vote
0
answers
31
views
Building a UITableView with fixed number of cells progammatically
I am building this pet project with UIKit. The App's main goal is to keep track of my daily expenses.
The AddExpenseViewController is responsible for capturing user ...
9
votes
2
answers
904
views
Binary adder implemented in Rust
I implemented a ripple carry adder in Rust. The function takes and outputs strings of 1s and 0s.
How can I improve this ...
3
votes
1
answer
119
views
Fast approximate sin/cos function in Rust
Over the past month or so, I’ve been trying to create an extremely fast, platform agnostic, auto-vectorizing sin/cos function for fun. I initially started with sleef-rs’s fast sin function, and ...
-4
votes
0
answers
30
views
Shrinking my pygame draft creating acceleration for sprites when a key is pressed [closed]
I did a test program that simulates acceleration of a sprite when the key is pressed the velocity increases until a max speed is reached. When no key is pressed a slow deceleration is occuring. The ...
2
votes
1
answer
101
views
Using Ada's access type and generics to solve an ODE
This post is linked to Ada: Convert float to decimal
I have produced Ada codes which uses the Euler algorithm Euler method to solve an ordinary differential equation. The codes given below are working ...
0
votes
0
answers
13
views
Preventing insertion of same codes into usage table
There are 2 tables: codes and usage.
I need to get a list of codes from codes table, do some ...
3
votes
3
answers
104
views
IPv4 filter in Java
I have a simple class for representing IPv4-addresses via int values, and a simple IP-address filter that works like a set of IPv4-addresses.
...
3
votes
1
answer
67
views
Calculator (Java/Beginner)
I finished my first calculator using Java!
I try to apply Object-Oriented Programming!
I'll add my gitHub link if you're suited to viewing code on gitHub.
Here is a link to my GitHub Calculator ...
1
vote
1
answer
43
views
Rewritten Python script to split Insyde H2O firmware files
I’ve recently tried to update my Lenovo laptop’s firmware without installing Windows. I haven’t done it yet, but during their research someone on Matrix linked me to this page (original source, ...
7
votes
2
answers
179
views
Tar implementation
I am writing a tar implementation for education purposes and I started with reading from a tar file and printing the file content.
I use recursion for getting the next tar header and googled "...
-3
votes
0
answers
27
views
VBA Conditional Formatting with Multiple Conditions [closed]
I am currently trying to use VBA to highlight certain cells in red if the date in Colum X is older than 14 days ago AND if the answer in Column U is "No". If The answer in Column U is "...
6
votes
2
answers
210
views
Bellman-Ford optimisation in C with Shortest Path Algorithm (SPFA) and Small Label first (SLF)
I am trying to code an optimized version of Bellman-Ford algorithm. This post is a continuation of the following post Bellman-Ford optimisation in C in which I posted a first version of the classic ...
4
votes
1
answer
87
views
Transcoding UTF-8 to UTF-16-LE in VBA
VBA is a language that's lacking a lot of basic functionality. (Pun intended)
Most libraries, if they exist in the first place, are OS-specific, and even some of the inbuilt functions don't work on ...
-1
votes
0
answers
54
views
Using another class's methods without inheritance but type hinted otherwise [closed]
I have a class which "inherits" str's methods using the __getattr__ dunder method instead of true inheritance. For ...
2
votes
3
answers
420
views
Recursive palindrome check
I'm trying to solve this which basically calls for a recursive palindrome check with some minor extra steps (Special characters and whitespace can be ignored). The test inputs' length can be 100000 ...
0
votes
1
answer
24
views
Function to return a file name from lists/dictionary constants
I'm reworking a set of two functions that return a text file name, constructed from a string argument and string variables from a module called inventory. It seems ...
3
votes
1
answer
72
views
Unit of Work & Repository Pattern - Injecting UoW into Repository Base
Description
I am implementing the Unit of Work & Repository Pattern with Dapper as my ORM and PostgreSQL as the relational database. I have seen examples of UoW where:
The UoW class creates an ...
0
votes
0
answers
8
views
Grouping and summing by condition from three mongodb collections
I have three mongodb collections. I would like to group the collections by date, month and year, then sum by condition in order to display totals from the three collections in one table. However, i ...
3
votes
1
answer
29
views
Running multiple concurrent processes in a bash script, such that if one dies it takes the other ones down with it
This is my solution using job control.
Whenever a job dies, it kills the parent script
When the parent script dies, it kill the whole process group, including all jobs
I would hope that there's ...
5
votes
2
answers
2k
views
Bellman-Ford optimisation in C
Here is my current code:
...
5
votes
1
answer
87
views
A parse function for text line with fields separated by a comma with the known number and their type, simplified version
simplifying this question, taking most of the comment into considerations, I ended up with this version, looking for some feedback
...