23
votes
1answer
35k views

Very simple PHP PDO class

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 ...
16
votes
2answers
3k 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>. ...
33
votes
6answers
4k views

My C++ code involving an fstream failed review

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 ...
30
votes
4answers
4k 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 good. It's been nice to learn LINQ also and I am very impressed by the features, and perhaps I have ...
16
votes
1answer
2k 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 ...
7
votes
2answers
756 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. ...
7
votes
4answers
2k 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 ...
26
votes
3answers
2k views

Avoiding Python multiline string indentation

I want to make this code: ...
26
votes
5answers
738 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 ...
27
votes
3answers
795 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 ...
14
votes
3answers
2k 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# ...
11
votes
4answers
3k 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 ...
4
votes
3answers
279 views

Readable code with many components (Swing)

Please help me to make more readable and simple code like this. What if I had 20 components? Is it right to organize code like this? ...
36
votes
1answer
2k 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 ...
64
votes
8answers
11k 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: ...
26
votes
2answers
419 views

Tool for creating CR questions

To download the tool and for usage instructions, see the follow up to this question Description I have realized that there's a whole bunch of code I want to have reviewed, but copying file by ...
13
votes
3answers
15k views

Conversion between enum and string in C++ class header

I have the following redundant-feeling design to convert between enums and strings regarding a class that stores enums. The ...
11
votes
1answer
789 views

Responsive/adaptive website code

I have all these functions that work together to create functionality on a page. Is the structure of these functions OK? Can I do anything to speed this up or make my code better? I'm not exactly ...
18
votes
2answers
566 views

Dynamically call lambda based on stream input

Some context: I have code that looks like this (minor issue noted here): ...
13
votes
1answer
588 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 ...
8
votes
2answers
294 views

Materializing any ADODB Query

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 ...
7
votes
1answer
697 views

Critique Request: PHP Request-Method Class

I'm working on a general Requestmethod class which sanitizes and recasts the input of users in an automatic fashion. I've also tried to do array-access in cookies. ...
6
votes
4answers
5k 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 ...
4
votes
1answer
753 views

OOP-style FizzBuzz program in PHP

I've tried to write a configurable OOP-style FizzBuzz program in PHP for learning purposes. I hope everything is quite easy to understand. What do you think of the overall architecture? Are OOP ...
1
vote
2answers
582 views

Critique sanitized user email PHP Script

So, I have a basic 'contact us' form that i have built, and I do some jQuery checking first (that a phone number is only numbers, email address doesn't contain unneeded characters, etc), but I also ...
7
votes
1answer
116 views

Log probe requests of WiFi devices

I developed a program that collect probe requests from WiFi devices. It already works but I think that a programmer can improve it. ...
5
votes
1answer
1k views

Yii exception usage

I've never used a framework before, so I wanted to see if this fairly simple scenario was done correctly or could be improved: ...
5
votes
1answer
266 views

MVC - Control Module - Version 2

All models are in the model namespace and follow a naming convention. This makes it easy to consolidate control into cType() as shown below. All control passes ...
2
votes
2answers
138 views

A package for sort algorithms - v2

Looking for general feedback and praise. This is for learning an not implementation as I would expect the built is sort algos to be much faster. Addressed issues here: A package for sort algorithms ...
0
votes
1answer
60 views

EF Code First Seed Method for States/Countries Part I

I am working to complete this even further, but here's what I've got thus far... (See my other post for the definition.) ...
25
votes
2answers
1k 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 ...
41
votes
4answers
5k views

Ternary operation in Java - isn't this abuse?

I think the below code is difficult to understand. I also feel it abuses Java's ternary operator. ...
27
votes
8answers
15k views

Efficiently checking if a number is divisible by 3

I'm looking for code review, best practices and optimizations. ...
18
votes
5answers
8k views

Brute Force Algorithm in C

This is a simple brute force algorithm I have in C. All the program does it print out every possible combination of the given alphabet for the given length. I ...
6
votes
4answers
21k views

Different way of writing multiple click functions

I have the following .click() functions: ...
6
votes
3answers
10k 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 ...
14
votes
9answers
7k views

Text-based adventure game with too many conditional statements

For a school project, I am creating a text-based adventure game in C++. I have shown my code to my teacher and he is stating my code is not entirely logical in sequence and that I should make my ...
7
votes
2answers
158 views

Basic Imitation of C# Enumerable in VBA - or any other static class

Since implementing static classes in VBA actually seems possible I came up with an idea to try to imitate C#' Enumerable class (well, to some extent...). This is ...
15
votes
6answers
1k views

Are there any open vulnerabilities in this mailer script?

I made a PHP mailer script does the basic validation of fields, return errors, else submit if all is good. But it also has a honeypot field that is not required to be filled in (I'm assuming by hiding ...
13
votes
5answers
235 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, ...
10
votes
2answers
290 views

Number to Words

I have to convert positive numbers, that are less than 1000, to words. A quick search didn't find anything that looked good to my eye, so I came up with the following. While I was at it I expanded ...
7
votes
1answer
1k views

Solving 15 puzzle

I'm trying to solve 15 puzzle using A* algorithm, but something really bad goes on in my get_solution() function that ruins performance. I guess there is a too much ...
7
votes
3answers
604 views

Quick Sort Implementation

I have written the below code for quick sort in Java: ...
5
votes
2answers
597 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 ...
5
votes
7answers
954 views

Calculate shipping cost

Could I code differently to slim down the point of this Python source code? The point of the program is to get the user's total amount and add it to the shipping cost. The shipping cost is determined ...
4
votes
2answers
871 views

Converting between data and presentation types

Below is how I'm solving the problem of converting between data and presentation types, I'd like to know if that's a good way to go about it, and if not, what would be a better way to go about it. I ...
2
votes
1answer
304 views

How can I make this code safer against XSS attacks?

I'm not sure what I'm doing wrong, but I run the code using a Web Vulnerability software and I get a lot of XSS attacks against the code. Is there something I could do better? ...
16
votes
1answer
203 views

Follow-up to tool for posting CodeReview questions

Description This is a follow-up question to Tool for creating CR questions. Things that has changed include: Removed replacing four spaces with one tab, all tabs and all spaces in the code itself ...
15
votes
3answers
805 views

Celsius → Fahrenheit conversion table

It's harder to do than criticize. Here's my attempt to implement a Celsius-to-Fahrenheit conversion table in C++. ...
12
votes
7answers
876 views

Quadratic expression calculator

I'm hoping to get some feedback on how to improve and optimise a program I wrote which takes three values as input (via the terminal) and uses them in the quadratic formula. I'm aware this is mostly ...

15 30 50 per page