66 votes
Accepted

Easier user input in C++

namespace std Others have said this already but it's important enough to be repeated: Don't put your own definitions into ...
  • 4,240
12 votes
Accepted

Efficiency of this constantly running time processor for an HTML5 video control bar

If you're worried about performance, this should raise a red flag: someJQueryObject = $("#some-id"); ... someJQueryObject.html(aPlainOldString); ...
  • 4,531
11 votes

Easier user input in C++

I've actually implemented the same functionality in the past, so here are my comments. Wrong behaviour? It depends on what you can consider wrong. Consider running your own example and inputting <...
  • 565
11 votes

Easier user input in C++

namespace std is reserved. Don't add stuff to it. Especially since there's no reason to in this case. Just put it in your own namespace. unnecessary string usage ...
  • 18.3k
10 votes
Accepted

English Draughts

A couple of things: <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> <StackPanel> ... Putting the ...
10 votes

GUI for a quiz tool or game

1. Instead of: def __init__(self, root): """Constructor""" self.root = root # root is a passed Tk object do: ...
  • 3,984
9 votes

Efficiency of this constantly running time processor for an HTML5 video control bar

When converting time values like this I find it much simpler, and more readable to work up from the smallest units. Consider the following: ...
  • 96.8k
8 votes
Accepted

IBDesignable UICheckbox

In playing around with this, I noticed a few things I didn't particularly like: This picture represents the first problem. Setting the background color fills in the entire rectangle, but should ...
  • 25.2k
8 votes

Lemonade stand menu program

Here's a few things I noted: Don't have using namespace std; in your code. It's almost universally considered a bad practice. The C++ standard states that you ...
  • 21.7k
8 votes

Implementing a customized helpful hints function which includes docstring but much shorter than Python help()

Disclaimer Now that the OP has clarified that they intend to use this as a teaching tool, my answer has lost relevance for their use-case. It can still be taken as general advice for most Python ...
  • 1,341
7 votes

CommandBars, Buttons and Commands: Cleanup is on the menu

This looks good! I've got a couple of comments to make in a vague, hand wavy way so I'll start off with a comment about the code as written: ...
  • 16.7k
7 votes

Digital root computation with benchmarking

I think your algorithmic part is exceedingly verbose. One of the nicenesses of Python is how it can lead to code that reads almost like English. And for this particular problem, even leaving ...
  • 6,532
7 votes
Accepted

Implementing a customized helpful hints function which includes docstring but much shorter than Python help()

I'm not sure whether you're reinventing the wheel, but you are using the wrong tools for the job. I've been through the phase where I think I'm doing something unique enough that I need to do ...
  • 1,203
6 votes
Accepted

CommandBars, Buttons and Commands: Cleanup is on the menu

I think you have the right idea, but your implementation can be improved. I'll give it a try, although I have no clue what rubberduck is, so I might be missing ...
  • 13k
6 votes

Efficiency of this constantly running time processor for an HTML5 video control bar

I (like many others) prefix my jQuery object variables with a $ to make $timeProgress and ...
  • 3,605
6 votes

Lemonade stand menu program

Correctness Issues main() issues void main() is not valid C++. main() must return ...
  • 1,318
5 votes

C++ line-editing micro-library

I don't have the time to do a completely thorough review at the moment, but here are some things that I noticed that may help you improve your code. Don't use ...
  • 64.6k
5 votes
Accepted

Populating Day/Month Selections in UserForm Controls

Why not doing it more directly like this: ...
5 votes
Accepted

Swing GUI in Java

Yes, that is proper use of composition over inheritance. Although some may say this is actually aggregation, due to the nature of Swing. Composotion is the act of one object owning another object. ...
  • 424
5 votes

Digital root computation with benchmarking

Regarding digits_generator You don't need to use a new variable. You could use nb directly. You may use the fact that non-0 ...
  • 28.7k
4 votes
Accepted

Toggle-item inside a Bootstrap dropdown-menu

It'd definitely be nice to get rid of the inlined style attributes. Since you've already ID'ed the sub-menu pretty extensively, it's pretty easy to add this to the ...
  • 32.9k
4 votes
Accepted

Implementation of Hangman in Java

All GUI modification must be done in the GUI thread. It refers to the creation of components, too. It means that your buildGUI method should be invoked on the EDT ...
  • 5,570
4 votes
Accepted

Heavily nested anonymous classes for Swing UIs

Anonymous constructors are very confusing for many people. They don't correspond well to people's expectations, and are not common knowledge. I would recommend against them on principle. Having said ...
  • 96.8k
4 votes
Accepted

CommandBars, Buttons and Commands: Take 2

I think the code is definitely much better! I wouldn't worry too much about registering the ICommands in your IoC. After all, you're not going to have hundreds of ...
  • 16.7k
4 votes
Accepted

TextField Validation for Teleport Feature in Game

Table organization ...
4 votes
Accepted

HMSegmentedControl react to tapping on currently selected segment

You can fork the control and do a tiny modification to the code to do what you need. In touchesEnded:withEvent:, you need to modify this line so it wouldn't check ...
  • 156
4 votes

Removing a subview with a subview from a UIView without memory leaks

...
  • 25.2k
4 votes

Removing a subview with a subview from a UIView without memory leaks

func setup() { view.text = self.text view.backgroundColor = self.backgroundColor view.font = UIFont(name: mongolFontName, size: 24) } So, we've got ...
  • 25.2k
4 votes
Accepted

Set a font for a UITextView if the font is nil or not equal to desired font

There's a much easier way of doing this. if self.view.font?.fontName != mongolFontName { view.font = UIFont(name: mongolFontName, size: defaultFontSize) } We ...
  • 25.2k
4 votes

Textbased User Interface for user and program taking turns

The very first thing that jumps out at me is the indirection of maintaining both a list of possible words and a seen list. Picking a better representation for your state will make bookkeeping easier. ...
  • 1,013

Only top scored, non community-wiki answers of a minimum length are eligible