Questions tagged [reinventing-the-wheel]

For when you know you are reinventing the wheel, but are doing it anyways. Questions with this tag involve code that is already fully implemented (such as from a library).

38 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
7
votes
0answers
145 views

c++ std::function implementation

When I first tried to implement std::function I thought it would as easy as creating a class that holds a function pointer. Consequently, I quickly figured out that ...
7
votes
0answers
104 views

C++17 pointer_traits implementation

pointer_traits is a lightweight trait that provides a uniform interface to builtin pointers and user-defined fancy pointers. That said, things like ...
6
votes
0answers
409 views

C - fully threaded binary search trees

For learning purposes, I've decided to implement several classic data structures, starting with binary search trees. The entire code can be seen here, in a frozen branch ...
6
votes
0answers
172 views

Character-based transitions (part of a lexer)

As part of my prep for the Code Review community-challenge (which looks like it will be Write your own programming language), I've been working on an LL(1) lexer generator in Rust. Yes, lexer ...
6
votes
1answer
766 views

Simulate object.__getattribute__ in Python

I want a Python example that illustrates how object.__getattribute__ resolves instance attribute lookups. I'm looking for feedback about the following code. Is it ...
5
votes
0answers
43 views

Sequence and Series Calculator

The Sequences & Series involved are Arithmetic and Geometric. stores and allows you to calculate using these given formulas and import fractions into micropython Support for micropython! ...
5
votes
0answers
103 views

Scanning a string into a list of tokens

Here is my code: ...
5
votes
0answers
95 views

Huffman encoding in Rust

An implementation of Huffman encoding / decoding as a learning exercise. I'm still new to Rust, so any tips about making things more natural for the language are appreciated. ...
4
votes
0answers
84 views

Sorting Algorithm (from scratch) in Python

Updated (at the bottom) I am attempting to write a Python program where I have to create a sorting algorithm without the assistance of the built-ins (like the sort()...
4
votes
0answers
174 views

C++17 implementation of std::invoke

C++17 introduces std::invoke which calls the exposition-only INVOKE. Here is an implementation. This isn't a large amount of ...
4
votes
0answers
83 views

SHA256 implemented in Rust

I just finished making an implementation of a SHA256 hashing function (https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf) in Rust and I was looking for some feedback. As far as I can tell it ...
4
votes
0answers
133 views

Java multithreading many readers one writer implementations

I have a shared data object with writer threads and reader threads. Number of threads can read from the shared data at the same time (in the code getmethod), and ...
4
votes
0answers
10k views

Logging into Database with ASP.NET Core

In the Startup.cs of my ASP.NET Core application I want to configure the LoggingFactory so that it logs into the database. ...
4
votes
0answers
4k views

Network Bandwidth Usage Monitor

I have written a very basic bandwidth usage monitor in C++/winpcap. I would like to get some feedback, regarding design choices, implementation, style, correctness. (Or anything else you care to ...
4
votes
0answers
273 views

C++ vector implementation errors

I haven't really programmed in C++ for about a year, and realised that I should get back into it, and tried my abilities out by remaking the STD vector class. However, my C++ is a bit rusty at the ...
4
votes
2answers
909 views

Custom Thread Pool - Reusing non-busy threads

This is an exercise in thread pooling in which I attempt (hopefully in a successful manner) to reuse existing threads (much like Java's own ...
3
votes
0answers
157 views

Sorting Algorithms in C++ - Insertion Sort and some variants

I'm learning C++, data structures and algorithms and decided to implement some sorting algorithms using generic iterators instead of array indices. This post contains code for insertion sort and ...
3
votes
0answers
131 views

Circular doubly linked list implementation in Cython

This is a follow-up from my previous question. In summary, I am trying to implement a BVH module with Cython and need a way to keep track of the volumes during the construction of the hierarchy. I ...
3
votes
0answers
145 views

Strongly Connected component algorithm implementation(Python)

My goal is to implement Strongly Connected Components algorithm using python. I have splitted up my code on 3 parts: Data Load: ...
3
votes
0answers
153 views

A fixed-size dynamic array

Background I implemented the historic std::dynarray according to the specification under the name dynamic_array in C++17. ...
3
votes
0answers
89 views

Naive Implementation of A Least Recently Used (LRU) Cache Memoiser

I wrote code to (naively) perform lru memoisation. I tried to write it in a functional programming style, and so did not make use of any global variables. My Code ...
3
votes
0answers
28 views

Use a pattern for fields validation

I need to validate the fields of user sent by an API. All works fine but the only one problem is that I don't like the solution is not an OOP solution. In the controller I call the service created by ...
3
votes
0answers
274 views

ECDH implementation in python (part 3)

After the first and second part, the primary feedback I got was to rename a lot of my variables as I used the same name for different local variables which is really confusing. I tried to hotfix that, ...
3
votes
0answers
331 views

Two reimplementations of the Underscore _.reduce function

I am working on rewriting the underlying code for some Underscore.js functions. Re-writing the reduce function has been causing a lot of headaches. I have been able to re-write it two different ways, ...
2
votes
0answers
86 views

Parallel Miller-Rabin Prime Test in Haskell

I implemented a prime number finder using the Miller-Rabin prime test in Haskell and it seems to be working. You enter a number and it finds the next prime following that number. I also tried to make ...
2
votes
0answers
336 views

Drawing an ASCII grid in Ruby based on a 2D array

I'm writing a function that renders a grid using ASCII line-drawing characters, based on a provided 2D array (or array of arrays), with each top-level array representing a row, and the items inside ...
2
votes
0answers
132 views

A simple tokenizer in Erlang

I'm trying to learn Functional Programming and I picked Erlang because I will have to use it eventually. In the meantime, I'm trying to build a simple lexer to stumble upon problems and solve them ...
2
votes
0answers
784 views

Iterator for custom List class

I have extended a custom list class I have been working on with a Iterator class. I have not used std::iterator as a base class as it will be deprecated in C++17. ...
2
votes
0answers
95 views

Porting Java semaphore to MacOSX

I wanted to write some more JNI code and decided to (re)implement a semaphore for MacOSX. In order to assert somehow correctness of my implementation I hereby supply a (multi)consumer/(multi)producer ...
2
votes
0answers
86 views

NodeJS, status propagation to interface

If you have an interface served by a NodeJS API, what is the most clean way to propagate status changes to the interface? For example, I have a page that has 2 statuses, user logged in and guest. How ...
1
vote
0answers
45 views

Determine the hyper-parameters of an Approximate Bayesian computation

I created my own Approximate Bayesian computation algorithm in Python 3 and I try to find the best hyper-parameters for it but it is really slow. This question is not about the math involved in it. ...
1
vote
0answers
88 views

Custom Vector and Matrix classes in python for machine learning

I am creating a machine learning tool set from scratch in python. I have never done something of this kind and I don't usually use python but I thought it would be good to expand my horizons. I am ...
1
vote
0answers
246 views

Permutation of a given set

A simple aspect of brute forcing certain problems is that you may have to do a large numbers of tasks in large numbers of possible orders, as such an algorithm for calculating all these possible ...
1
vote
0answers
443 views

Shared_Ptr Implementation

I have tried to Implement Shared_Ptr and learned a lot while Implementing it. So guys please review my Implementation. Any Suggestions,Feed backs are highly appreciated. and Thanks in Advance. Asad. ...
1
vote
0answers
546 views

Simple Promise implementation

I am trying to hack together a simple promise implementation. Is the following approach of maintaining a single async call and linking nested promises dynamically using their ...
1
vote
0answers
134 views

jQuery custom slider

I'm new to jQuery and JS and have recently tried turning a working slider into a plugin for the first time for a small project. I would love some feedback, code improvement, optimization and any do's/...
1
vote
0answers
37 views

Small Map library written in Haskell

I wrote the following Map "library", and would like general feedback. It's my first major use of Binary Trees, so if I'm doing anything dangerous, I'd like to know. Specifically, I "brute-forced" the ...
0
votes
0answers
51 views

Bubble sort optimization

This bubble sort code is very slow compared to the original. ...