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

Filter by
Sorted by
Tagged with
7
votes
3answers
332 views

Mimicking the basic interface of std::stack

I am trying to mimic std::stack in my implementation (just the basic interface - no iterators / allocators). Since I was having trouble handling all the memory ...
5
votes
2answers
3k views

Reading and parsing CSV files

This is my first real attempt at a Scala program. I come from a predominantly Java background, so I'd like to know if the program sticks to Scala conventions well. Is it well readable or should it ...
5
votes
2answers
6k views

HMAC-SHA1 implementation

I am trying out a small piece of code that would generate HMAC-SHA1. I have been asked to code the HMAC implementation myself using the OpenSSL libs for SHA1 calculation. After 'wiki'ing for the ...
8
votes
1answer
665 views

Python reversed in C++11

I was playing with some of the wonderful new C++11 features and tried to reimplement a function reversed that would behave just like the one in Python to allow ...
10
votes
2answers
2k views

Custom nullptr_t class

I tried to write a nullptr_t class based on the official proposal to be used in C++03 only. The only differences with the proposal are that we can compare two ...
5
votes
4answers
6k views

C getline function

I was looking for a C function that reads lines of arbitrary length from a file. I didn't find anything absolutely portable and safe from buffer overflows, so I tried writing my own. Does it look ...
5
votes
4answers
8k views

Optimizing a thread safe Java NIO / Serialization / FIFO Queue

I've written a thread safe, persistent FIFO for Serializable items. The reason for reinventing the wheel is that we simply can't afford any third party dependencies ...
4
votes
1answer
1k views

Iterator and Generator versions of Python's range()

I have created iterator and generator versions of Python's range(): Generator version ...
0
votes
1answer
3k views

My own implementation of Linq SelectMany extension method

What do you think of my own implementation of the extension method SelectMany? Motivating criticism is always welcome. ...
8
votes
2answers
34k views

Generating all combinations and permutations of a set of symbols

I am new to Python and want to have a "pythonic" coding style from the very beginning. Following is a piece of codes I wrote to generate all combinations and permutations of a set of symbols, e.g. <...
4
votes
2answers
2k views

Rounding a date to a dynamic unit of time, using only JDK 6

Question originally posted on Stack Overflow here. I'm trying to do an elegant round method that only use the JDK methods and leverage the TimeUnit class of that ...
6
votes
3answers
22k views

Splitting a string into tokens in C

I am trying to improve my skill in C, and this time by getting away from strtok. The following code splits the input string into ...
2
votes
1answer
3k views

Determine total number of seconds since the epoch

I am looking for ways to enhance this function in C++. The function gets a date and returns the total number of seconds since the epoch (01/01/1970). Do you have any suggestion regarding the ...
9
votes
3answers
40k views

Converting int value to String without using toString and parseInt method

I am studying about the converting int to string and string to int without using toString and parseInt method. I already made ...
4
votes
1answer
2k views

Monkeypatching builtin open and File Mock-Up for unit testing

For a specific test-scenario I wanted: avoid accessing the file system through pythons builtin open-function don't want to use 3rd party libraries like Michael ...
11
votes
4answers
7k views

My own SHA-256 code implementation

I'm worried about my code performance. The code I've written is an implementation of SHA-256 using pseudocode from Wikipedia. It works fine, but I want to speed it up. With a buffer of 4096 bytes, I ...
5
votes
1answer
4k views

Implementation of the atof() function

I am looking for feedback on coding style. I know this function already exists, and I would never use my version over a well tested one. I am just practicing. ...
1
vote
1answer
2k views

Shared Pointer implementation

Before you say anything: Due to project constraints, we cannot use Boost and we cannot use C++11 (yet; perhaps this will change some day). The fact that I was unable to use smart pointers was nagging ...
4
votes
2answers
267 views

Optimizing error-sorting method

I just made this sort method. It runs fine and the code looks okay in my eyes. Is is possible to optimize it so it runs faster? If it's \$O(n^3)\$ now, it would be interesting changing it to \$O(n^2)...
7
votes
2answers
8k views

Implementation of itoa()

How can this solution be improved? ...
15
votes
5answers
18k views

Sine function in C / C++

Due to software constraints, I cannot use the standard libraries, cmath, algorithm, templates, inline, or boost. I am also using ...
3
votes
2answers
554 views

Matlab any function in C / C++

Due to software constraints, I cannot use the standard libraries, math.h, algorithm, templates, inline, or boost. I am also ...
13
votes
3answers
24k views

Min / Max function of 1D array in C / C++

Due to software constraints, I cannot use the standard libraries, <math.h>, <algorithm>, templates, ...
6
votes
2answers
11k views

Parsing JSON with JavaScript

I need to write some JavaScript code that will take a JSON string, parse it, and return the names of the most-deeply nested properties. For example, for this input: ...
11
votes
3answers
2k views

My own C++ Format function

I've never been satisfied with any of the possible sprintf()-like functions in C++: sprintf() is a C function and it's very ...
5
votes
3answers
935 views

Quicksort application

What do you think about this code? ...

1
12 13 14 15
16