All Questions

Filter by
Sorted by
Tagged with
6
votes
1answer
98 views

Generic container similar supporting PeekMax, PeekMin, Sum, and PeekNextToMax

I needed to implement a data structure that supports the following operations: create from an existing collection get the maximum item ("Alpha") get the nearest-to-maximum item ("Beta") get the ...
5
votes
1answer
1k views

Pretty print dice faces from multiple rolls of multi-sided dices

In this question related to rolling multiple dices, the OP pretty prints for a single case where number of dices is less than or equal to 6. This led to me finding this code golf on "Draw dice result ...
5
votes
3answers
563 views

Console Application Customizer - GetBootstrap v2.0

GetBootstrap-2.0 update from GetBootstrap-1.0.0.2 I just update my console application customizer and add some new features like disable minimize, maximize and close button, new color and simple ...
5
votes
2answers
185 views

Stack implementation using vectors with no overflow version 1.0

This is an implementation of a stack where I have used vectors. Can anyone please review it and let me know how I can improve this code and overall coding practice? ...
5
votes
0answers
169 views

Chaining JSON transformations with visitors

I have currently two use-cases that require JSON transformations before it can be deserialized. The first use-case requires changing the custom short type property name from ...
5
votes
4answers
595 views

Class Seperation vs Polymorphism

I'm interested in optimizing my code. Can someone help me understand the best way to trim this code down with DRY methodology? So I've got these two classes here preforming WMI queries on two ...
5
votes
1answer
140 views

Arabic language lesson program

The program I have been working on has been developed almost exclusively as "train-of-thought" style code. Things happen linearly (for the most part) thru the code. The goal of the program is to house ...
5
votes
1answer
175 views

Overhauled tokenizer for markargs

In the previous post I've started writing a tokenizer for my imaginary programming language (which I decided to name markargs; trivia at the end of the post). Problem definition: Read the line and ...
5
votes
3answers
377 views

Should I refactor for DRY?

I'd like to get some input on whether or not to DRY up this code. And if so how to implement it correctly. How do I know when it's worth refactoring? ...
5
votes
4answers
2k views

Project Euler #5 - Lowest common multiple of 1 through 20

This is my code. All comments welcome. Last time run it only took 335 milliseconds: ...
5
votes
1answer
163 views

Android game inspired by Space Invaders and Moon Patrol

I'm creating a mini game for Android inspired by space invaders and Moon Patrol. I have completed the important part except for collision detection. Before I do collision detection I want to clean the ...
4
votes
0answers
2k views

Generic sliding window

The code implements fully generic sliding window with linear complexity. It should usually be paired with transforming iterator to reach full potential. Sliding window is a grouping of elements by ...
4
votes
4answers
500 views

Creating an array that loops out on the frontend - Don't Repeat Yourself?

Entire Code Here Don't repeat yourself I know of the "Don't repeat yourself". Still it's getting messy in some places. The code below contains three blocks of code. They are similar in some ways ...
4
votes
3answers
544 views

TicTacToe game with functional AI in ruby - follow-up

A month ago I posted an earlier version of the game here, and got a great response, which was mainly about the structure of my code. I freed some time today and reworked the code from scratch. Things ...
4
votes
1answer
2k views

Simplifying and optimizing factors and prime factorization generator

My first algorithm for finding the factors of a number was pretty slow and horrible (it started at \$O(n^2)\$, where n was not even the inputted number), but I eventually came up with this new code. ...
4
votes
2answers
3k views

Python - Game Of Life

Here is my implementation of John Conway's Game of Life in Python: ...
4
votes
2answers
2k views

Platform independant thread pool v3

This is a continuation of this question, v4 can be found here Taking the advise given previously, the deadlock was fixed in the non-yielding code. The next problem comes from the suggestion to make ...
4
votes
0answers
24 views

JSON Test Harness: Part 2

Part 1: JSON Test Harness: Part 1 Part 3: JSON Test Harness: Part 3 Part 4: JSON Test Harness: Part 4 Time to review some test harness code I have written. https://github.com/Loki-Astari/...
4
votes
3answers
407 views

Find the largest odd number (follow-up code)

Ask user to input 10 integers and then print the largest odd number that was entered. If no odd number was entered, print a message to that effect. This is a follow-up code on feedback from Find the ...
4
votes
2answers
242 views

Genericizing PropertyValues

This should be the last iteration for this code. Does this approach make sense or am I heading down the wrong path? The only thing I can see to make this better is to genericize the ...
3
votes
4answers
2k views

Sieve of Eratosthenes: making it quicker

I was thinking about doing problem 23 of Project Euler. It includes the difficulty where you have to factorize primes. I had already done that in problems I solved earlier, but it was only necessary ...
3
votes
1answer
146 views

Swap items of a linked list in pairs - revision 2

The first revision is available here and the code is available on GitHub. I modified the method reversePairs and added mSize to ...
3
votes
2answers
1k views

Premium palindromic primes

Challenge: Write a program which determines the largest prime palindrome less than 1000. The answer is 929, and my program correctly finds and prints this, but actually ended up being more complex ...
3
votes
0answers
33 views

JSON Test Harness: Part 4

Part 1: JSON Test Harness: Part 1 Part 2: JSON Test Harness: Part 2 Part 3: JSON Test Harness: Part 3 Time to review some test harness code I have written. https://github.com/Loki-Astari/...
2
votes
1answer
143 views

Simple HTML website with JavaScript navbar

The following code is a website with a nav-bar on it. It uses some simple JavaScript to make it work: index.html: ...
2
votes
0answers
19 views

JSON Test Harness: Part 3

Part 1: JSON Test Harness: Part 1 Part 2: JSON Test Harness: Part 2 Part 4: JSON Test Harness: Part 4 Time to review some test harness code I have written. https://github.com/Loki-Astari/...
2
votes
1answer
73 views

Swap items of a linked list in pairs - revision 3

Here is the source of the question. Revision 1. Revision 2. When I started the second round of code review, I wanted to make sure that I had included all the possible input types. However, I ...
2
votes
2answers
124 views

Digitizing paper label system with Python

I'm currently halfway through a Python project, but would like a review before I spend too much more time on this to avoid going too far down a rabbit hole. I had previously wanted to use HTML, CSS, ...
2
votes
1answer
590 views

Printing results in XML

I have been writing PHP programs in the MVC pattern for quite some time. But I am not sure if I am doing it right. For instance, I have this PHP file that prints results in XML, and I put this file ...
1
vote
1answer
4k views

Doing $_POST the right way

I am not sure if I am correctly handling $_POST data in MVC pattern: Dummy $_POST data ...
1
vote
0answers
35 views

Testing the process of assigning offers to a customer 2

I asked this question earlier: Testing the process of assigning offers to a customer. Following on from the answerers comprehensive response. I have attempted it again. Please see the test code ...
60
votes
4answers
55k views

EF Code First with Repository, UnitOfWork and DbContextFactory

I am about to >explode< :) due to amount of reading on this subject... My head hurts, and I need some honest opinions... There is a similar question/review that I noticed, but I believe my approach ...
203
votes
4answers
21k views

Calculate SHA1 hash from binary and verify with a provided hash

I applied for a job and they asked me to write code with the following requirements: Get a "toolbar offer" description from http..update.utorrent.com/installoffer.php?offer=conduit. Parse the ...
95
votes
16answers
181k views

Generate random numbers without repetitions

I want to generate a list of N different random numbers: ...
136
votes
17answers
16k views

Disproving Euler proposition by brute force in C

I wrote a little bit of code to brute force disprove the Euler proposition that states: $$a^4 + b^4 + c^4 = d^4$$ has no solution when \$a\$, \$b\$, \$c\$, \$d\$ are positive integers. I'm no ...
44
votes
2answers
96k views

Unit of Work and Repository with Entity Framework 6

Based on the reply of this question I have created the following code. I need to check whether it's good or not. Here is my entity class: ...
54
votes
11answers
12k views

Sales tax calculator, rejected for being not OOP

I applied for an Application Developer position. They require all their applicants to complete 1 of 3 programming assignments. I picked one for sales tax calculation. It was quite simple. Write ...
49
votes
2answers
62k views

Dynamic programming knapsack solution

I wrote a solution to the Knapsack problem in Python, using a bottom-up dynamic programming algorithm. It correctly computes the optimal value, given a list of items with values and weights, and a ...
21
votes
1answer
11k views

Strategy design pattern with various duck type classes

I've recently picked up the Head First Design Patterns book in an effort to become a more efficient and better Python programmer. Unfortunately, the code examples in this book are in Java. I'm not ...
38
votes
2answers
406k views

Snake game in C++

This is my version of the Snake game, written in C++. How could it be improved, and what general advice would be useful for future projects? ...
38
votes
5answers
24k views

Designing a coffee machine

I was recently rejected from what looked like a really promising string of interviews. I did very well in a questionnaire style review, and then they handed me this assignment (more or less): ...
35
votes
3answers
9k views

Ensuring user input is an integer in a range

I have isolated a little bit of code that was causing a small debate between myself and another user. I have taken some of the things that he said and meshed it with the code that was being reviewed ...
40
votes
4answers
5k views

Rock-Paper-Scissors-Lizard-Spock Challenge

"Scissors cuts paper, paper covers rock, rock crushes lizard, lizard poisons Spock, Spock smashes scissors, scissors decapitate lizard, lizard eats paper, paper ...
32
votes
7answers
6k views

Project Euler #7 10001st prime

I decided to start working on the Euler project exercises. I'm doing fine for now but the seventh problem is running quite slow and I can't think of anything to make it work faster. It takes around ...
16
votes
1answer
33k views

Efficiently filter a large (100gb+) csv file (v3)

I'm in the process of filtering some very(!) large files (100gb+): I can't download files with a lower granularity. This is a followup from this question. The problem is as follows: I need to filter ...
43
votes
4answers
168k views

Simple Example of an Iterable and an Iterator in Java

I was a TA for a first-year Java programming course this year. As a very simple example of iterables/iterators, I wrote the following code for the students. I am curious if any styling or other ...
24
votes
4answers
22k views

Measuring execution time in C++

I had time measuring pretty much figured out when I ended up using this structure. ...
51
votes
5answers
245k views

Removing elements on a List while iterating through it

I needed a way to remove elements on a List while iterating through it. Supposedly something like this (illegal code): ...
44
votes
1answer
6k views

Yet another C++ JSON parser

This is a framework for a JSON parser I put together last night. Any comments appreciated. JsonLexer.l: Breaks the input into lexemes JsonParser.y: Understands the language syntax JsonParser.h: ...
37
votes
10answers
7k views

Which FizzBuzz is better, and why?

I was in an interview and the guy asked me to do the typical FizzBuzz question of printing numbers 1-100, but for each factor of 3 print Fizz, each factor of 5 print Buzz, and each factor of both ...

15 30 50 per page