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).

46 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
8
votes
0answers
118 views

Binary Search Tree Implementation in C++17

I am a hobbyist computer programmer trying to learn modern C++ (in this case C++17). I thought it might be an interesting challenge to write a Binary Search Tree similar to ...
7
votes
0answers
47 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 ...
7
votes
0answers
120 views

C++17 is_integral trait implementation

This is a C++17 is_integral trait implementation. Most implementations exhaust all integral types: bool ...
6
votes
0answers
103 views

Quicksort template (for sorting corresponding arrays)

I needed a function for sorting two corresponding arrays. So I wrote this code to sort N corresponding arrays! The really "metaprogrammy" way to do it would be to use ...
6
votes
0answers
291 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 ...
5
votes
0answers
92 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 ...
5
votes
0answers
3k views

Java AES-256 GCM file encryption

I wrote my first file encryption program, that encrypts a file with AES-256 GCM and stores IV and salt prepended to the file content, so it's likely that I did something worse than possible. I ...
5
votes
0answers
673 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 ...
4
votes
1answer
96 views

Find website URLs that begin with http:// or https://

This is a problem from Automate the Boring Stuff from "Pattern Matching with Regular Expression". I am a beginner in Python and the purpose of this program is to match urls which start with ...
4
votes
0answers
50 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
155 views

Character-based transitions (part of a lexer)

As part of my prep for the Code Rreview 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 ...
4
votes
0answers
8k 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
3k 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 ...
3
votes
1answer
89 views

C++ Arraylist Implementation

I am a new C++ developer who, coming from Java, am having issues in understanding some of C++'s key memory management features. Below is my attempt at an ArrayList implementation and I would really ...
3
votes
0answers
46 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
44 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 ...
3
votes
0answers
82 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
60 views

Fast prime generator

I wanted to test my performance optimizing skills, and so wanted to find how fast I could get the first \$n\$ prime numbers. I limited myself to only the standard library, as I'm sure ...
3
votes
0answers
64 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
105 views

C++ program that processes unique markup language similar to HTML

I have solved a task which takes input in a unique markup language. In this language each element consists of a starting and closing tag. Only starting tags can have attributes. Each attribute has a ...
3
votes
0answers
27 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
67 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. ...
3
votes
0answers
219 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
105 views

Command line arguments adhering Posix and GNU standards

The following code extracts command line parameters and modifies argc and argv parameters of the. After all parameters are read ...
3
votes
0answers
276 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, ...
3
votes
0answers
246 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 ...
2
votes
0answers
49 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
1answer
67 views

Python implementation of Conway's chained arrow notation

A year ago, I implemented an evaluation algorithm for Conway's chained arrow notation in Python. I'd like to get a review on my code, especially about readability and if it is pythonic. I'd also like ...
2
votes
0answers
162 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
88 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
480 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
92 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
85 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
25 views

shared_ptr alternative with no dependencies

An alternative to shared_ptr to minimize compile time. Intrusive. Reference count changes are not thread safe. (...
1
vote
0answers
58 views

`std::optional` under C++14 v1

This is a first version of an implementation of std::optional it is supposed to compile under C++14. The public interface of the class is complete, but there are ...
1
vote
0answers
34 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
431 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 ...
1
vote
0answers
219 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
345 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
523 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
115 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
11 views

Super-minimal implementation for inference only of fully a connected neural network in Python + Numpy

There are a lot of Neural Networks Frameworks available but in order to understand how things work internally reimplementing can be a good exercise In this case the goal is to develop a super-...
0
votes
0answers
34 views

Mutex implementation using Windows APC

I just wrote this now and didn't test it much. This isn't a replacement for std::mutex, but for something like fun. I may develop it to make it shared across processes by storing the counters in a ...
0
votes
1answer
38 views

Throttle redraw requests fired from pointer events

I am working on a photo editor, which displays a preview to the user on a canvas. At various points in the app, the user may use sliders to adjust properties of the photo, such as scaling, rotation, ...
-1
votes
0answers
58 views

Sobel filter for edge detection

I've tried to implement my own Canny edge detector and tried to make it as fast as possible. I tried to code most of the needed function myself and only used opencv as input/output. However, the ...