27
votes
2answers
42k 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 ...
26
votes
5answers
2k 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. ...
19
votes
2answers
4k 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>. ...
36
votes
4answers
6k 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 ...
36
votes
6answers
4k views

Implementation using fstream failed evaluation

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 ...
28
votes
3answers
1k 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 ...
17
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 ...
44
votes
2answers
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 ...
7
votes
4answers
3k 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 on speed this up? ...
6
votes
1answer
1k 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. ...
6
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 ...
68
votes
8answers
13k 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: ...
27
votes
5answers
857 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 ...
26
votes
3answers
4k views

Avoiding Python multiline string indentation

I want to make this code: ...
17
votes
5answers
331 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, ...
13
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# ...
10
votes
1answer
2k 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 ...
13
votes
1answer
751 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 ...
12
votes
4answers
4k 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
297 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? ...
32
votes
2answers
488 views

Tool for creating CodeReview 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 ...
14
votes
3answers
18k 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 ...
7
votes
4answers
26k views

Different way of writing multiple click functions

I have the following .click() functions: ...
11
votes
1answer
871 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 ...
6
votes
3answers
11k 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 ...
5
votes
2answers
1k 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 ...
21
votes
2answers
667 views

Dynamically call lambda based on stream input

Some context: I have code that looks like this (minor issue noted here): ...
8
votes
2answers
389 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
782 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
2answers
584 views

How can I quickly find unique list items?

I use the loop-every-single-list-item approach to filter out unique elements in a given list, which tends to be very inefficient way as a list grow in size, or as function call frequency increases. ...
6
votes
4answers
6k 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
903 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
699 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 ...
15
votes
4answers
228 views

Int extension for translating integer to plain English

This code was inspired by this question: Number to Words ...
9
votes
2answers
812 views

Simple calculator that seems inefficient

I have a simple calculator program that needs some reviewing. Is this as efficient as it can get, or is there a better way? ...
7
votes
1answer
300 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
2k 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
281 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
1answer
137 views

Swap items of a linked list in pairs

Here is the source of the question: GitHub Given a singly linked list, swap the list items in pairs (reconnect the pointers, not simply swap the values). For example: Before: A->B->C->D ...
2
votes
2answers
143 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
106 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.) ...
-1
votes
3answers
130 views

Algorithm of combinations (problem with time and space)

My algorithm generates combinations of elements. For example, having [A, B, C ] creates the following combinations [ A ], [ B ], [ C ], [ AB ], [ AC ], [ B, C ], [ ABC ]. Unfortunately for items too ...
31
votes
3answers
8k 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 ...
30
votes
8answers
18k views

Efficiently checking if a number is divisible by 3

I'm looking for code review, best practices and optimizations. ...
17
votes
6answers
1k views

Is this FizzBuzz Swift-y?

...
39
votes
4answers
6k 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. ...
28
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 ...
21
votes
5answers
11k 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 ...
21
votes
7answers
4k views

Finding words of different lengths given six letters

I'm trying to find all the 3, 4, 5, and 6 letter words given 6 letters. I am finding them by comparing every combination of the 6 letters to an ArrayList of words ...
11
votes
2answers
291 views

Determining winning hand in poker

After having reviewed this question, I recalled that I haven't solved Project Euler's problem 54. So I did it, however, I fount out that implementing the exact rules is rather tricky. So I ...

15 30 50 per page