All Questions
76,785
questions
0
votes
0
answers
5
views
Comparing date in RPGLE
I have an RPG program which processes a file containing records of subscription details of users. Each subscription record has a "valid from date" and "valid to date" - indicating ...
1
vote
0
answers
9
views
Queue-mergesort: a mergesort that does optimal number of comparisons in the worst case in Java
Here is the code for (queue-mergesort) by Mordecai J. Golin and Robert Sedgewick:
com.github.coderodde.util.QueueMergesort.java:
...
-3
votes
0
answers
11
views
calculate geographic points using latitude longitude while getting its data from a database and displaying a GUI. however the GUI is is beingstubborn [closed]
"I am new to programming and was given the task of creating a GUI that allows users to input their coordinates, and the program will output the location closest to them. Although the math portion ...
2
votes
0
answers
12
views
More efficient way to generate Tkinter buttons in loops
I designed a game of Minesweeper where the board was displayed using text, and it worked fine. Using the same pseudocode, I tried to write the game with a GUI using Tkinter, and made a few ...
-2
votes
0
answers
15
views
Is this emulation of inherited tables for microsoft sql-server fault-free?
I use the bellow construct to emulate a child_table inheriting from parent_table.
The parent table redundant-entries (name & display-name) should be updated if relevant fields in the child table ...
-2
votes
0
answers
16
views
Comparing dates in RPG [closed]
I have an RPG program which processes a file containing records of subscription details of users. Each subscription record has a "valid from date" and "valid to date" - indicating ...
0
votes
0
answers
20
views
Generate html from input fiels
I am building a small tool to generate a copy and paste HTML block, based on the user inputs.
In the html file, I have all my inputs (select, checkboc, text inputs etc).
I based myself on the JS of an ...
1
vote
0
answers
28
views
Diamond printing code Kata
the code implements this code kata: https://codingdojo.org/kata/Diamond/
This is my very first ocaml program, looking for any kind of feedback, as I'm a total ocaml noob.
It uses JaneStreet's Base and ...
1
vote
1
answer
19
views
Creating multiple conditions in objects preventing nesting
My class is a factory-method that allows to instantiate it only when the parameter $type (string) is "regular or premium" and when parameter $months (integer) is lower than 6.
If $months is ...
0
votes
0
answers
20
views
Promise queue Typescript
As an exercise, I wrote a promise queue in Typescript. The point of it is to parallelise a maximum number of promises, and not just Promise.all() to batter the ...
5
votes
2
answers
301
views
C++ Thread Pool Implementation using Lock Free Queue
Topic: C++ Implementation of Lock-Free Queue and ThreadPool classes
In a project I'm currently working on, I need the implementation of ThreadPool along with a thread-safe queue. I've tried ...
0
votes
0
answers
18
views
Refactoring a template literal to virtual DOM tree class
I created a class to convert some template literal strings to a JSX-like tree. I need some help refactoring it to make it smoother and faster.
...
7
votes
1
answer
139
views
Implementing a `concat` range view using C++ std::ranges
The code below is my first attempt to create a concat "range adapter" using C++20 ranges. It compiles and runs with the latest Clang. The little test ...
4
votes
0
answers
25
views
SNTPv4 server based on rfc 4330 in C++
Please review my SNTPv4 server based on rfc 4330
I tested running 3 instances of ntp-check.exe from Galleon systems and 1 instance of Microsoft w32tm - w32tm /stripchart /computer:
No crash!
This is a ...
2
votes
1
answer
41
views
First attempt using Rust, to create a simple API backing onto a JSON file
I'm trying to learn Rust, and have taken a stab at it by create a REST API, that stores the data in a local JSON file. Before I get deeper into things I'd like some feedback on if I'm doing things in ...
3
votes
1
answer
31
views
General bytes to number converter (c++)
I've written a bytes to number converter for cpp similar to the python int.from_bytes.
It does not make any assumptions on:
The endianness of the input buffer
The ...
1
vote
0
answers
42
views
DOM manipulating that I called Framework
I'm building a framework like this that can turn SASS-like code into CSS, a template engine like Mustache, a DOM manipulator like React, and a router to add a single page app, and I'm having a ...
0
votes
0
answers
27
views
Deletion of nodes of degree <=1 from a Python igraph graph
I have a working way of deleting all vertices of degree less than 2 in a graph until no more can be found.
But my solution has a significant issue which is that it calls ...
1
vote
1
answer
28
views
A CUDA compatible Vector class
Please review the following CUDA-compatible Vector class in C++.
...
-5
votes
0
answers
22
views
Same button style but different output [closed]
I have a div with 3 buttons in it. Same style but the back button is not aligned at the center but at the left side. Does anyone know what is the problem here? The first 2 buttons is working fine ...
1
vote
1
answer
73
views
Local solver built into a global one
I am trying to optimize writing a script that has 2 minimizations, one dependent on the other. My code is a bit bloated, and I find the global parameters that I am solving for depend quite strongly on ...
0
votes
1
answer
25
views
Trie Data Structure in R7RS Scheme
Making the transition from R6RS Scheme to R7RS has been very educational and
fun. Chibi Scheme is my favorite because of its close compliance with the
standard.
When starting a new project, I wanted ...
5
votes
2
answers
140
views
Deserialize bytes from the network into a struct
I want to deserialize bytes coming from the network to a struct. The bytes come in big-endian order (BE) and my computer is using little-endian order (LE).
I'd like your advice concerning in order:
...
4
votes
1
answer
751
views
Monad object in C++
Have I defined a Monad object for C++? Below is a class called var which I created years ago to implement a lambda calculus like interpreter in C++. The class ...
-3
votes
0
answers
20
views
How do I use :before and :after in React? [closed]
I am having my first go at React. (code at end of post)
For one particular component, I want to achieve this:
A p or h1 element with inline icons from an icon font. Icons contained in an element ...
6
votes
2
answers
2k
views
Game of life(random generation)
I wrote a simple game using python, but I wonder: how I can improve it? Any opinions will be useful.
I thought about optimization, since the program consumes 20% processor resources, but don't know ...
-4
votes
0
answers
16
views
Use const or constexpr in c++? [closed]
I'm reading some code from https://github.com/ApolloAuto/apollo/blob/266afbf68d83fa6fac7a812ff8a950223f5ab2c0/cyber/record/record_reader_test.cc#L31
...
6
votes
3
answers
1k
views
The Game of Nim
I am currently looking for a language to program a game for my FYP which is to program the game "The game of nim". I am currently looking at pygame for this program, I hope someone can give ...
-2
votes
0
answers
28
views
Multi tabs dash app Repo [closed]
I have an Dash App with multiple tabs, that all rely on the same data (which takes some time to import). So currently I have all the tab's layouts and ...
-4
votes
0
answers
32
views
Trying to write a JS dice rolling game that compares the current roll which is an array, against all previous rolls, for a set number of unique rolls [closed]
I'm having a lot of trouble figuring this out. I'm new to coding so might be an obvious mistake.
The goal is to:
Make an array of more than 1 elements or a current roll
Compare it to an array of ...
-3
votes
0
answers
35
views
Parsing soccer data from Oddsportal [closed]
I want to parse data from oddsportal.com but it gives me only 10 results probably due to automation detection.
I'm using python and selenium with Firefox driver.
...
2
votes
1
answer
43
views
Class for packing two 4 bit unsigned integer in uint8_t
The purpose for this class is to pack two 4 bit unsigned integer into 8 bit unsigned integer, e.g. uint8_t.
It is made in a way, so the class to resemble array of ...
-3
votes
0
answers
44
views
Dice Rolling Game in C language runs but it gives the wrong answer every player doesn't get a new random number, how can I fix it? [closed]
it deals with as many players as u want with 6 dice, and wants to find the sum for each player and then find the player that has the biggest sum but the sum is the same for every player and I don't ...
-2
votes
1
answer
52
views
Moving increments into condition checks? [closed]
I am reading the second edition of the C Programming Language by Kernighan and Ritchie. In it, the authors introduce things like:
...
3
votes
2
answers
103
views
Sudoku Solver in Python Using Backtracking
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 ...
2
votes
1
answer
101
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 ...
-4
votes
1
answer
50
views
any bits unsigned integer [closed]
This is a class that acts as an unsigned integer with a variable amount of bits.
...
7
votes
2
answers
1k
views
Calculating the median and mode of a list of integers
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:
Given a list of ...
1
vote
3
answers
164
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 ...
7
votes
2
answers
1k
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 ...
-4
votes
0
answers
37
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:
...
4
votes
1
answer
87
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 ...
2
votes
2
answers
55
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
29
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
16
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
6
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
1
answer
48
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
268
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
24
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 ...
9
votes
2
answers
1k
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 ...