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 ...
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
...
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 <...
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:
...
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 ...
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 ...
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 ...
5
votes
Accepted
Populating Day/Month Selections in UserForm Controls
Why not doing it more directly like this:
...
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 ...
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. ...
5
votes
Accepted
JavaScript discrete slider web component
It looks like you've put a lot of work into this and it appears to function well. There are only a few suggestions - see below.
I agree with the comment by user3342816 that the flipped sliders seem ...
4
votes
English Draughts
I've spotted...
private string PlayerToString(Types.Player player) =>
player.IsWhite ? nameof(Types.Player.White) : nameof(Types.Player.Black);
I find the ...
4
votes
Single page site with navigation bar
You should add
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
to your <...
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.
...
4
votes
Accepted
Table View Controller class in Swift
There are quite a few issues here:
In switch statement, you don’t need/want break statements. Unlike C languages, Swift ...
4
votes
GUI for a quiz tool or game
If talking about code readability, I'd recommend you to read PEP-8 at first, for example:
def one():
pass
def two():
pass
This is how you don't want your ...
3
votes
Accepted
TextBoxes for various number types
class TextBoxNum
Abbreviation should be avoided when naming a class: Num -> Numeric
The ...
3
votes
Accepted
Textbased User Interface for user and program taking turns
The main issue with this code is that basically everything “lives” in IO. One of the advantages of Haskell over other programming languages is the ability to ...
3
votes
Managing drag in React on-off component
Maybe it would be better to handle onMouseUp={this.onDragEnd}? Also instead of const componentDefaults you can use ...
3
votes
Accepted
UserForm to handle Date Inputs (Day,Month,Year)
This is going to make for either a poor UI or a change in behavior later. Better to just change its behavior now.
...
3
votes
Accepted
Giveth me thy easier user input in C++ - follow up
Redefinition of default arguments
First of all, you cannot redefine default arguments. From [dcl.fct.default], slightly abridging the example:
A default argument shall not be redefined by a later ...
3
votes
3
votes
Accepted
Digital root computation with benchmarking
Here are a few things:
Instead of
if ans[0] == 'n':
again = False
print 'Bye !'
break
elif ans[0] == 'y':
again = True
break
...
return again
...
3
votes
Easier user input in C++
Is there a need for include guards?
Yes, but #pragma once is redundant and also not portable.
Is it okay to patch easy_input into std without problems? Is this ...
3
votes
Accepted
Disable execution of parts of the code based on user's choice C++
I see two things:
option acquisition (a lot of control flow and ad-hoc checks to detect the user input)
operational program flow (the decisions based on it). Here I'd suggest Null Object pattern
...
3
votes
Poké-permalinks
I'd appreciate any feedback on improving perceived responsiveness for the feature this UserScript adds to the webpage.
Since you are trying to synchronize the display of the image and the current URL ...
3
votes
Accepted
Simple view for CRUD with miglayout
Quickfire opinions:
Swing is deprecated. If you have the choice: do not use swing!
Empty lines are a useful thing.
It's pretty conventional to use empty lines between members and around the import ...
3
votes
Accepted
Python coin flipper with GUI
You are abusing the heads & tails lists into making simple counters.
...
3
votes
Implementing a customized helpful hints function which includes docstring but much shorter than Python help()
It is difficult to add anything to the existing great and detailed answers, but, to follow up your comment that .__doc__ might be to difficult to remember for ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
user-interface × 141javascript × 39
python × 24
java × 18
html × 16
css × 16
jquery × 13
c# × 11
swift × 11
ios × 11
swing × 9
tkinter × 8
gui × 8
c++ × 7
vba × 7
console × 7
react.js × 7
performance × 6
python-3.x × 6
game × 6
event-handling × 6
object-oriented × 5
excel × 5
io × 5
layout × 5