# All Questions

5,250 questions
Filter by
Sorted by
Tagged with
7k views

### Guessing a number, but comments concerning

I always get marked down for my comments and I just wanted to see if these comments are acceptable or what I should include/where I should include them. ...
58k views

### Class for reducing development time

There are many PHP PDO classes out there, agreed. However I find they do not allow for flexibility. So I created one that helps reduce development time as little as it may be but it does the job (...
10k views

### FizzBuzz in Brainfuck

Inspired a bit by a previous Brainfuck question and the recent fizzbuzz invasion, I decided to make FizzBuzz in Brainfuck. The code is entirely my own, except for the inclusion of the Printing a ...
12k views

### List<T> implementation for VB6/VBA

Recently I decided VB6's Collection wasn't enough for my needs, so I decided to implement something like C#'s List<T>. ...
23k views

### SudokuSharp Solver with advanced features

Even though it's the first time I'm writing something this "big", it feels like I know C# quite well (it is very similar to Java after all). It's been nice to learn LINQ also and I am very impressed ...
3k views

### infix_iterator code

I've previously posted this on Stack Overflow, and am considering submitting it to Boost for wider distribution, but thought perhaps it would be best to put it up here for peer review first, and see ...
3k views

### Analyzing Minesweeper Probabilities

Calculating probabilities in Minesweeper might sound like an easy task, but I've seen so many probability calculators that's either incorrect, horribly slow, or with ugly code (or all of them) so I ...
2k views

### My first implementation of a linked list in C++

This is my very first implementation of a full-fledged ADT, which could potentially be use-ready. Now, I'm still learning, therefore I would like to ask you what I can do to further improve the ...
7k views

### Sieve of Eratosthenes - Python

I've been doing a lot of Project Euler lately and just wanted to make sure my implementation was as good as it could be. Does anyone have any suggestions to speed this up? ...
7k views

### Weekend Challenge - Poker Hand Evaluation

Weekend Challenge #2 - Poker Hand Evaluation Very early I decided to support the usage of wild jokers, even though I knew that this was going to lead to trouble more work. I also wanted to support ...
9k views

### A lightning-fast StringBuilder

In the process of trying to build a serializable data structure, I found myself building large strings, which gets very slow because VBA copies a string every time concatenation is performed. To ...
9k views

### Open, write and close a file

I have a small 10-liner function that writes some data to a file using an std::ofstream. I did not explicitly call .close() at ...
14k views

### Creating ADODB Parameters on the fly

I have put together a small wrapper class to simplify creating parameterized ADODB queries with VB6/VBA. At this point I'm keeping things simple, so it's only supporting input parameters and from what ...
4k views

### Project Euler #3 - largest prime factor

I was going through the Project Euler problem #3 and made a program to solve it. The problem is as follows: The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the ...
20k views

### Function to print command-line usage for a program [closed]

The following function works well to print out a help message for the program I have written. It prints a multi-line string message that describes the command line usage with some examples: ...
2k views

### A CSharpish String.Format formatting helper

A while ago I implemented .net's string.Format() method in VB6; it works amazingly well, but I'm sure there has to be a way to make it more efficient. I'll start ...
4k views

### Stopwatch template

It's often useful to be able to time code, for instance, to evaluate alternative approaches to the same problem. Because this is a thing I use frequently, I have created this Stopwatch templated ...
2k views

Following-up on Creating ADODB Parameters on the fly and pushing the "wrapping" of ADODB a step further, I have written two more classes that allows me to expose methods that don't require a ...
27k views

### '100' is a magic number

Magic numbers are bad... I totally agree. But there's one magic number I find hard to fix: '100' is a magic number. Consider this code: ...
2k views

### Plot timings for a range of inputs

When writing Code Review answers, it becomes often necessary to measure how long the modified code takes vs how long the OP's code takes. I needed a nice way to visualize this as a function of the ...
6k views

### Rainfall challenge

About a year ago when I was applying to jobs for the first time, I had an interview at a company and they posed the following problem to me, which I preceded to bomb. A year later I actually came up ...
3k views

### Automagic testing framework for VBA

Building on @RubberDuck's recommendations, I now have something I find... beautiful. I'm sure there's a couple of things left to polish - this site is about making great code out of good any code, ...
410 views

### C++ string Formatter

I had an uneventful afternoon, so I thought I might try and write a string formatter. This is based on the documentation I found here. ...
20k views

### Split a string into chunks of the same length

Inspired by this question in chat Is there an easy way in .NET to split a string into an array by pulling chunks of the text in. I.e. I have an 18 character string I would like in 3 6-character ...
644 views

### Sieve31, my sieve of Eratosthenes returning IEnumerable<int>

This very fast, simple sieve quickly finds 31 bit primes. It uses a memory efficient BitArray for odd numbers. How a 32 bit int...
5k views

### Sound manager for Android

I created a singleton class for managing sound effects on Android. This class will only be instanced and loaded once at the beginning, and each activity will use the loaded songs. I don't know either ...
3k views

### Recursive and flexible approach to Tic-Tac-Toe

Description This is my code for the Weekend Challenge Reboot - Tic Tac Toe Ultimate. The game can be played here: http://www.zomis.net/ttt (along with some other variations that are also use the ...
15k views

### Random walk on a 2D grid

The program assignment: A drunkard in a grid of streets randomly picks one of four directions and stumbles to the next intersection, then again randomly picks one of four directions, and so on. ...
36k views

### Balanced parentheses

Given an expression string exp, write a program to examine whether the pairs and the orders of "{","}","(",")","[","]" are correct in exp. For example,...
3k views

### Extensible logging

Whenever I need logging functionality in .net, I use a logging framework, such as NLog. Obviously there's no logging framework for vba, at least none that I know of. As much as I love using NLog, the ...
47k views

### Snake game using PyGame

I wrote a simple Python snake game which is about 250 lines of code. Can someone give me some advice on how I can refactor/make it better? game.py ...
4k views

### ASCII table in Brainfuck

I made my first Brainfuck program today, which prints the numbers 0-255 and the corresponding character. I was wondering if I could improve my program, as I'm repeating myself a lot (e.g. 3 x copy &...
13k views

### Linked list implemented as classes, not imperative code

As an update to previous code I've submitted: Improvements this time are mainly having everything moved to a class, before I plough on and add more functionality (I've come back to C++ after a few ...
3k views

### Charmander Brainfuck interpreter in Haskell

I just started learning Haskell and this is my first big project (ie not factorials, fibonacci or graphers). This is kind of a gift for somebody so the language is a bit different. The program works, ...
1k views

### Compile-time sieve of Eratosthenes

There are many instances of prime number sieve implementation both here and other places on the web, but I wanted something a little different. In particular, I wanted to create a static array of the ...
4k views

### RPSLS Game in C#

I went with what I know and can use well, not what I know and can't figure the syntax out to make it look good. So please enjoy the code and prepare to school me (probably in the basics) in C# ...
1k views

### Comparing std::vector<bool> to std::vector<char>

A recent comment to an answer of mine here on Code Review brought up an interesting point. The comment was that one should use std::vector<char> over ...
2k views

### VBA Class to persist and restore Excel Application properties

Very often on Stack Overflow, and even on Code Review, I've seen questions and answers that have code that begins by persisting Excel properties like DisplayAlerts ...
5k views

### Project Euler Problem 12 - triangle number with 500 divisors

I've just done Problem 12 of Project Euler: What is the value of the first triangle number to have over five hundred divisors? The $N$'th triangle number is the sum of all natural numbers ...
3k views

### Z-Algorithm for pattern matching in strings

I was trying to refactor the following Python code (keeping the same time-complexity) which is an implementation of Z-Algorithm for pattern matching in strings. ...
177 views

### Updating register_globals code for importing $_GET and$_POST data

I'm updating a bunch of PHP code that relies on register_globals and uses request data globally. In the process of fixing/updating I spend a lot of time writing ...
152 views

### YAuB - Micro Benchmark Follow-on

Following some great advice here from Simon, I realized that I had over-engineered things, and that the Task builder methods were a horrible Java8 abstraxction. In Simon's words: "From a usability ...
87 views

### Nisse Server: Part 1 Helper Functions

Getting close to a release of generic server. So a couple of reviews will be coming this way over the next few weeks. Stating with the lowest levels and working up to the main server. The result is ...
156 views

### Scheduler built with observables v2 (follow-up)

It would probably be too easy if the old Scheduler worked as intended being that simple. But an eye-openig review showed that from time to time it'll miss one ...
482 views

105 views

### Sign an EC2/S3 URL Version 3

From the previous 2 versions: Sign an EC2/S3 URL Version 2 I fixed the comments from the previous version. Most of the code remains the same (so I have split out the new code for review). The main ...
10k views

### Exporting doc types using queues and multithreading

For a while I have been interested in seeing if some tasks work well when split across multiple threads. On the one project I have been busy with I have been creating a lot of small utility apps, to ...
20k views

### Seed std::mt19937 from std::random_device

Many people seed their Mersenne Twister engines like this: std::mt19937 rng(std::random_device{}()); However, this only provides a single ...