All Questions

Filter by
Sorted by
Tagged with
22
votes
1answer
320 views

Follow-up to tool for posting CodeReview questions

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

Down the rabbit hole with MVP

Following-up on this post where I implemented a Repository Pattern in vba to abstract ADODB and enable testing my Excel app without hitting a database backend; curious about how far vba would let me ...
22
votes
2answers
556 views

Code-Q2A - copy code blocks from questions to answers

I came up with an idea for a userscript to simplify writing answers on Stack Exchange while writing a previous answer. This userscript adds "Review"-links on the top of each code segment. When ...
22
votes
4answers
3k views

Determining if an answer can be generated

How can I improve my code below for the following question? While it works, I am not satisfied with how it looks; I was hoping I can somehow keep it recursive, and have the ans filled up inside the ...
14
votes
2answers
4k views

Evaluating arithmetic expressions

I have written some simple code for evaluating expressions. However, I am not sure how well I am following conventions (this is my first time trying to). Specs for problem: All binary operators (+, -...
12
votes
4answers
3k views

Algorithm for Run Length Encoding - String Compression

I attempted a problem from the Cracking the Coding Interview book. The following input: aabcccaaa should give the following output: ...
12
votes
2answers
2k 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 ...
10
votes
2answers
640 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 ...
8
votes
1answer
2k views

Polymorphic (owned) reference wrapper for class hierarchies

Rationale: I often have the requirement to own object instances, while preserving polymorphic behavior (i.e. own the object and hold it by pointer, or reference). This is usually expressed as a ...
6
votes
3answers
75k views

Python Tic Tac Toe Game

I made this as a personal challenge. It seems to work fine as I can't find any bugs and am happy with how it runs, but I am interested in what I should do to make the code more professional. I think ...
5
votes
1answer
6k views

MVC structured REST API in PHP

This approach might be wrong or right, if you have something to add please correct me since i want to learn! The past few weeks I'v been trying to build a MVC structure REST API in PHP.And this is my ...
25
votes
6answers
2k 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 ...
14
votes
3answers
2k views

N-Queens - Brute force - bit by bit

A discussion in The 2nd Monitor made me realize I had never 'solved' the N-Queens problem. Additionally, as I read up on it, I realized that the 64-squares in a chess board would work well if ...
10
votes
3answers
632 views

More imitation of Enumerable in VBA

I was inspired by Me How's question to see how far I could push an imitation of .Net's Enumerable Class. The new functions can obviously handle Collections, but can also handle any collection-type ...
6
votes
3answers
76k views

Calculate all possible combinations of given characters

I was asked in my textbook Lectures on Discrete Mathematics for Computer Science to construct a program that would take an alphabet ({a,b,c} or any combination of ...
5
votes
2answers
119 views

Parsing cells containing Line Feed Characters

Link to sanitized xls on dropbox if test data is needed Essentially the reports I work with aren't bad - The issue is the way it exports to excel - With the problem being that these cells are ...
31
votes
3answers
887 views

Advanced and Detailed Minesweeper Probabilities

In an earlier question, I showed my code for calculating the mine probability for each and every field in a Minesweeper board. But it doesn't stop there. In that very same Minesweeper Analyze project, ...
24
votes
2answers
4k views

Go on, mock my IDE

Because of the coupling with the VBIDE API (the extensibility library for the VBA IDE), unit testing the rubberduck refactorings, inspections and quick-fixes has been pretty much impossible, at least ...
20
votes
4answers
2k views

Finding the sub-array with the maximum sum - my approach

This is the code I ended up with that implements the approach I described in a recent answer to another question about the same problem The basic idea here is to not loop through more things than ...
13
votes
3answers
5k views

Match Simple Sentence or Partial Sentence

Description Match a Simple Sentence or a partial sentence Suitable for matching People Names (to some extent) Product Titles (to some extent) Correct use of apostrophe (to some extent) Input/Result ...
13
votes
1answer
995 views

Cheapest hotel finder

Please help me make this code more object oriented. I also want to use a few more classes and separate the input processing code to another class. Question: A hotel chain operating in Goa wishes ...
12
votes
3answers
3k views

Linked list in C++

Could someone review my linked list code? Specificially, is the design to separate Node and actions to create linked list appropriate? ...
12
votes
1answer
298 views

Yet Another Java CLI Calculator

In the spirit of April 2015 Community Challenge, I have created two Java-based calculators with the following codebase layout: An interface Calculeightor for ...
10
votes
1answer
318 views

Sequence-based enumeration of permutations in lexicographic order

This is follow-up on On Knuth's "Algorithm L" to generate permutations in lexicographic order, where I presented the following method to enumerate all permutations of array elements in ...
10
votes
2answers
568 views

Yet Another Java GUI Calculator

In the spirit of April 2015 Community Challenge, I have created two Java-based calculators with the following codebase layout: An interface Calculeightor for ...
10
votes
1answer
205 views

Linq-to-Sage Implementation

Following-up on my last question where I wrapped the Sage API with a familiar IRepository interface, I decided to push the abstraction a step further, and... ...
10
votes
2answers
1k 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 ...
9
votes
4answers
726 views

FileWriter supporting writing to multiple files

I got bored with opening and closing files whenever I need to write to one, so I wrote a FileWriter class that's used like this: ...
9
votes
2answers
2k views

Typelist with extractor

The purpose of the code is to store arbitrary number of types. The type can be extracted from it using Extract template, which uses template recursion to get the needed type. There will be compilation ...
7
votes
4answers
3k views

'do { statement; } while(0)' against 'statement' when writing C macro? [closed]

Which one of the following is preferrable and why when writing C macro? Type 1 #define I2C_START() I2C_WAIT_IDLE(); SSP1CON2bits.SEN = 1 Type 2 ...
7
votes
2answers
9k views

Simple string joiner in modern C++

(See the next iteration.) I have this small template function for convenient dumping a sequence into a string such that there is a delimeter between two consecutive elements, and no such after the ...
7
votes
2answers
2k views

Project Euler - Problem 54: testing poker hands

This was a very fun and thought provoking problem, and I'm quite proud of the way I was able to pull it off. I broke it down into 2 parts, testing and comparing. Testing each group of cards for ...
7
votes
3answers
11k views

Optimizing Manhattan-distance method for N-by-N puzzles

By N-by-N puzzles I mean f.e. a 3x3 sliding puzzle with one blank space (so a 8-puzzle) or a 4x4 sliding puzzle (so a 15-puzzle). When I try to solve certain puzzles some take no time but others take ...
6
votes
1answer
390 views

Non-standardised data across multiple worksheets: Aggregation, Validation, Filtering

Every piece of business that gets written (E.G. an adviser's client puts an additional £10k payment into a pension plan) goes in a spreadsheet called the SubSheet. It's split into 8 worksheets for ...
6
votes
1answer
175 views

Snake console game in C++

I reviewed this question to a snake game console implementation: My first C++ game (snake console game) I enjoyed refactoring this code and presenting a solution using more C++ features/classes. I ...
5
votes
2answers
187 views

C++ string Formatter Again Part-1

Previously asked here. The code is now available on GitHub. Since the previous review I have added unit tests. Since it is big it will come in a couple of parts. Part 1 | Part 2 | Part 3 | Part 4 ...
5
votes
1answer
185 views

Termios/Xterm line editor for APL interpreter

As an interesting sub-part of an interpreter -- just the Read part of the REPL -- I present my raw-mode line-oriented editor that I intend to use for my APL interpreter. (The Eval part has been posted ...
5
votes
2answers
7k views

Printing longest sequence of zeroes

I am doing a coding exercise in codility and I came across this question: A binary gap within a positive integer N is any maximal sequence of consecutive zeros that is surrounded by ones at both ...
5
votes
2answers
824 views

Matrix of articles and authors from large JSON dataset

Given the following JSON data containing 4 articles by 4 different authors: ...
5
votes
2answers
2k views

C++ Socket Part-2

In my ongoing attempts to become a better blog writer I have some written some more code that needs reviewing. Full Source. First Article. This is a simple C++ wrapper for Sockets. Here the bit I ...
5
votes
1answer
9k views

PHP dynamic insert - mysql. Is there a better way than this?

I have a dynamic form that users can add extra fields too. The group of fields are added and the input name stays the same but gets a incremental number attached to it. So for my insert php file I ...
4
votes
1answer
626 views

Messenger supporting notifications and requests

I've written a lightweight (I think) class that acts as a messenger service between classes for both notifications (fire and forget updates to other classes) and requests (a notification sent out that ...
2
votes
1answer
804 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? ...
2
votes
1answer
230 views

Countable and uncountable sets in .NET (clean version)

Sorry, it used to be some retired garbage in Countable and uncountable sets. Now and here it is clean. P.S. I would not like to say that this stuff is about to replace functional programming :) No, ...
2
votes
3answers
454 views

LeetCode 49: Group Anagrams

I'm exceeding the time limit for a 10,000 word test case provided on LeetCode: Given an array of strings, group anagrams together. For example, given: ...
1
vote
0answers
166 views

My included in every script file - follow-up -1

In this particular question, I need the reviewers help to judge my understanding to MVC and OOP as it was my biggest problem in my original question a month ago. I included in the question the contact ...
24
votes
3answers
2k views

Simple object-oriented calculator

After studying several ways of doing OOP in JavaScript I think I finally came up with one that seems OK to me. Is it okay? Do you see some problems I can face by using OOP in JavaScript like this? ...
22
votes
4answers
2k 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++. ...
13
votes
7answers
2k 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 ...
12
votes
3answers
2k views

The Beauty and the Strings

This originally appeared in Facebook's hacker cup 2013. Solving it was fun, though I find myself looping through similar data quite often. Challenge: Print the maximum beauty of strings. ...

15 30 50 per page