Newest Questions
77,863 questions
0
votes
0
answers
8
views
A Java program for compressing/decompressing files via Huffman algorithms
Intro
(The full repository is here. It contains also some unit tests that do not fit in this post due to size limits.)
I am making my very first steps in data compression, and so, decided to practice ...
-4
votes
0
answers
43
views
Object oriented programming deque implementation (after another second thought)
After another second thought from the second thoughts series Object oriented programming deque implementation (after second thought) it turns out using static methods alternatively to method ...
0
votes
0
answers
28
views
WebSocketStream implementation, JavaScript runtime agnostic
References
WebSocketStream Explained
WebSocketStream API design
Source code
https://github.com/guest271314/websocket-stream-impl
Implementation
...
3
votes
1
answer
417
views
Term only, arrow-only category foundations in C
I am learning to write an arrows-only, Term only foundations in C, because I noticed Lean4 has types and terms, so I thought maybe it would be nice to have term as the basic building block.
Please ...
3
votes
5
answers
373
views
List folders with size
This code below aim to listing all folders in one directory and get size of each in byte. It uses only pathlib module for that.
...
1
vote
1
answer
109
views
A different way to create HTML elements
I created this module to help with the creation of HTML elements:
...
6
votes
2
answers
713
views
C++17/20 templated LRU cache : how should get* handle misses? (exception vs std::optional vs pointer)
I’m implementing a templated LRU cache in C++17 and C++20.
High-level design:
Recency: ...
0
votes
0
answers
45
views
Сreating a digital twin of the enterprise
I am creating a program to create digital twins of enterprises. I am using the Simpy framework for this purpose.
I'm creating a universal system that can model almost any enterprise, but I have a ...
0
votes
0
answers
33
views
Builder pattern with nested struct
I've been looking on how to use Builder pattern on rust with structs, but all examples I've seen only use primitive data.
Given the structs:
...
2
votes
1
answer
102
views
Huffman code builder in Java - computing prefix codes for arbitrary (generic) alphabets - Take II
Intro
(This is the continuation of HuffmannEncoder.java - computing prefix codes for arbitrary (generic) alphabets.)
(See the GitHub repository.)
This time:
I have fixed the misspelled ...
-1
votes
0
answers
45
views
Which design is better to handle timeout condition in Bash? [closed]
I am designing Bash functions that take a timeout argument. The question is, what would be the best way to notify the user that the operation has timeouted, as compared to normal or error condition.
...
6
votes
2
answers
439
views
Implementation of a balanced binary tree
I never remember without looking how to write RB or AVL balancing.
but I wanted to make sure I would be able to still write a reasonable dynamically balanced binary tree. If it is asked of me in ...
4
votes
2
answers
339
views
HuffmannEncoder.java - computing prefix codes for arbitrary (generic) alphabets
(See the continuation of this post at HuffmanEncoder.java - computing prefix codes for arbitrary (generic) alphabets - Take II.)
I have this Java implementation of the Huffmann encoding. It looks like ...
3
votes
1
answer
706
views
"Frankenmallow" C code uses arc4 to choose flavors and coatings in arrays for mallow ideas, w/ switch cases, and countdown, functions: rngch ctdn
Is there any way to improve my spaghetti as a new C programmer? I'm both trying to make my program functional and nice, as well as easy to debug, and I've done a lot for this, can the codebase be ...
9
votes
2
answers
818
views
Arena Allocator in C
This is my first time doing any kind of serious coding in C. I watched a Youtube video on what an Arena Allocator should do and I tried my best to make an implementation for it.
As of now, we have the ...
2
votes
3
answers
1k
views
LeetCode 3542: Minimum Operations to Convert All Elements to Zero
I am working on this LeetCode problem where I have to count the minimum number of operations to make all elements in an array equal to zero 3542. Minimum Operations to Convert All Elements to Zero
...
7
votes
3
answers
773
views
Custom Error Exception Class in Python
I've written a class to handle my custom errors in Python. The idea is to simplify raising exception with custom messages, all you should do is raise the class and pass it a message.
Everything in the ...
4
votes
1
answer
222
views
Use z3py to solve one logic constraint puzzle
I decided to practice by modeling some simple, hand-solvable problems using z3py. Below is an example:
...
6
votes
4
answers
762
views
InsertOnlyHashSet in C++
First C++ project: write a hash set for a specific scenario where I only need inserts and containment checks.
This is not AI slop, everything except for the avalanche function is hand written. Please ...
7
votes
6
answers
768
views
Computing the smallest number of the form floor(8^N / 7) that is greater or equal to a number
Is there a more direct way (loop-free) to compute this number than computing a level and then going back?
...
5
votes
1
answer
456
views
+300
Revised and documented version of a 6500-line parsing project
I'm finishing my parsing tool split into three libraries, the first two being:
https://github.com/pczarn/cfg
https://github.com/pczarn/gearley
I am working on PR https://github.com/pczarn/cfg/pull/...
4
votes
3
answers
82
views
Optimizing DataFrame iteration when generating large hierarchical text files
I have a custom object which stores dataframes in memory given a certain hierarchy, and I want to store this data in a file while maintaining the hierarchy. This hierarchy involved parents, children, ...
4
votes
1
answer
198
views
Weight balanced tree in OCaml
The objective was to create a weight-balanced binary search tree with a well-defined interface. Any critiques or suggestions for improvement are welcome.
...
2
votes
1
answer
112
views
Using a dynamic custom 404 template in Laravel
I have made a Laravel 8 blogging application that supports themes.
I had made a custom 404 template for every theme, the path to it being ...
8
votes
3
answers
123
views
Test to ensure CGI can be invoked on a local server
I am writing tests for legacy software which has a dependency on CGI scripts on a remote machine.
Mocking the dependency would entail modifying the code under test, which is a thing I cannot do at the ...
1
vote
0
answers
25
views
SvelteKit authentication hook with token refresh and request deduplication
I've implemented a SvelteKit handleFetch hook that manages authentication for API requests with automatic token refresh. The API provides a 15-second grace period where a refresh token remains valid ...
3
votes
0
answers
78
views
Self / Unit test of polymorphic database model
I originally titled my last question as a Unit Test and there was a comment that it was a integration test rather than a unit test. I will say this, indi that comment was an answer and you could have ...
-1
votes
2
answers
178
views
Object oriented programming deque implementation (another second thought)
Another second thought from the second thoughts series Object oriented programming deque implementation (after second thought) led to disposing if statements ...
6
votes
2
answers
496
views
Tilemap implemented in pygame
This code requires:
tile map exported as .csv file
tile set as .png
knowing tile size
knowing the rows and cols of the tile set .png
For example, this tileset has 2 rows and 6 cols
...
2
votes
0
answers
56
views
Native Messaging performance test
I put together this Native Messaging performance test to determine based on evidence which programming language, JavaScript engine or runtime, and WebAssembly compiled code is fastest to round trip 1 ...
2
votes
2
answers
838
views
Three non-negative integer encoding techniques in Java
Intro
In this post, I will present three (3) non-negative integer encoding techniques:
Elias gamma coding
Elias delta coding
Golomb-Rice coding
Code
...
8
votes
3
answers
2k
views
Replacement for "make" in Python
I'm working on a replacement for make written in Python. Instead of a Makefile, you create a Wormfile.py. This file gets imported dynamically and a Context object ...
4
votes
3
answers
468
views
A simple method for compressing white space in text (Java) - Take II
Intro
In this post, I will elaborate on A simple method for compressing white space in text (Java). Here, I have incorporated some advice offered by Chris. Also, this version preserves a single new ...
2
votes
2
answers
252
views
Benchmarking in Java some super linearithmic sorting algorithms
Intro
A sort is called super linearithmic if its running time is \$\omega(N \log N)\$. For example, \$f(N) = \omega(g(N))\$ means that \$f(N)\$ grows "faster" than \$g(N)\$. In this post, I ...
8
votes
1
answer
371
views
S-expression parser in Rust
I wrote a toy s-expression parser, and I'd like to know if I can make it more Rusty.
I'm not terribly worried about the functionality. It's only a Rust exercise for me.
...
5
votes
1
answer
524
views
A simple method for compressing white space in text (Java)
(The story continues in A simple method for compressing white space in text (Java) - Take II.)
Intro
Now I have that text space compressor. For example,
...
1
vote
0
answers
29
views
Working on HIMS SaaS using MEAN stack
I was facing an issue with changing models on the fly — since we don’t just need isolation based on string or ID, but also data-level differences for each HIMS instance. To handle this, I created a ...
3
votes
4
answers
2k
views
Python project to scrape webpages and build text datasets for ML purposes
Context
I'm returning to Python development after a break and actively learning AI/ML. As part of my learning journey, I'm building a dozen pet projects to strengthen my skills. This is my first ...
6
votes
3
answers
968
views
Moving ball simulation within a donut
How do I optimise my code more?
The goal is to have my code work with more than 200 moving balls, but that takes forever right now and doesn't look smooth at all. Furthermore, I can't get the sizing ...
-6
votes
1
answer
122
views
Object oriented programming deque implementation (after second thought)
The java.util.Deque implementation from Object oriented programming deque implementation that consists of three elements linked arrays, each array holding reference ...
2
votes
1
answer
145
views
ShannonFanoEncoder.java - computing prefix codes in Java
Intro
This time, I have implemented the Shannon-Fano coding.
Code
io.github.coderodde.compression.ShannonFanoEncoder.java
...
0
votes
0
answers
37
views
SpiderMonkey JavaScript engine Native Messaging host
Native Messaging host using Mozilla SpiderMonkey JavaScript/WebAssembly engine.
Documentations
Chrome Developers
MDN Web Docs
Microsoft Edge Developer documentation
Messaging between the app and ...
1
vote
1
answer
108
views
Jump point search in Java for faster pathfinding in grid mazes
(Refer to the entire repository in GitHub.)
How it looks like
Intro
This time, I present my take on Jump point search that I translated from Javascript (PathFinding.js/src/finders/JumpPointFinderBase....
3
votes
1
answer
74
views
Managing a global backend/device state when making a deep learning framework
I have been making a deep learning framework modelled after Pytorch in pure Python. I have made good progress but my framework is currently not seamless to use because the end user of the framework ...
7
votes
4
answers
651
views
CSV handling class
I'm a hobby coder at best. I know enough to make helpful programs to assist me with day to day life and work (mostly with PHP/JS, some C#). I'm wanting to learn more about good coding practices. I ...
8
votes
1
answer
106
views
Mandelbrot set visualizer using GTK4, Cairo and POSIX threads in C
I have recently implemented a Mandelbrot set visualizer, which I used to reacquaint myself with multithreading using pthreads.
I'm just wondering whether the way ...
11
votes
5
answers
904
views
Python program that iterates over audio files with a progress bar interface
I have a utility that updates, transcodes and renames audio files. Previously I used a function that simply yielded every file that was a good match (based on file extension).
As some tasks can take ...
10
votes
4
answers
664
views
Split flap clock stepper code
I've built a Split Flap Clock, and the code has grown quite a lot, and although it does work in its current state, I am wondering if it could be cleaned up.
The whole thing runs on an ESP32 and is ...
2
votes
0
answers
180
views
Indexing into Nested Data Structures in VBA
Project
I have created a VBA module called Idx which you may find here on GitHub. It is inspired by pluck() and ...
0
votes
1
answer
185
views
Does an indentation style which uniquely identifies a column position to its role in the construct it belongs to make Bash code more readable?
What I'm asking here is whether do you think the facts
there is no type enforcing;
there is no indentation enforcing
consoles do not syntax highlight
consoles do not emphasize multi-line input a-la ...