Kuba hasn't forgotten Monica
  • Member for 9 years, 7 months
  • Last seen more than a week ago
QNetworkReply network reply timeout helper
7 votes

Here are my thoughts: It's a simple class that allocates quite a few times on the heap. You could minimize the number of implicit allocations it does. The QTimer::singleShot creates a temporary ...

View answer
An attempt of replacing CRITICAL_SECTION with std::mutex and std::lock_guard
Accepted answer
5 votes

The design that you claim "works" comes with a caveat: it works extremely poorly. You might not have noticed it when logging is set to a low level or when only one or two threads do the ...

View answer
Implementing an autocomplete system
Accepted answer
3 votes

I'll only look at the memory vs. speed trade-off. Suppose that M is the key size we want to look up, and N is the number of words in the dictionary. If we start with a sorted dictionary, then the ...

View answer
Music collection with lyric songs and instrumental pieces
3 votes

Polymorphic classes must include a virtual destructor. Otherwise they are not truly polymorphic: you cannot delete such an instance using the pointer to the base class. A class hierarchy should (...

View answer
Reading all bytes from a file
2 votes

I would wrap the native memory-mapped file functionality instead. It’s available on all major platforms. In all cases it will be more efficient than any “read the whole file” code would be. If you ...

View answer
Python password generator class
2 votes

Classes shouldn't be used when you have no intention of ever creating objects of that type. Classes are not namespaces. In Python, modules are namespaces. Thus all of the code belongs in a module. The ...

View answer
Digitizing paper label system with Python
2 votes

The label images should be stored as .png files, not .jpeg. Use .png when you have non-photographic graphics, such as line drawings and text. Use .jpeg for photographic images. Taking the snapshot of ...

View answer
Properly setting up interactive elements such as QSpinBoxes or QComboBoxes, e.g. according to project specific data
Accepted answer
1 votes

In Qt, all objects can have names, so use QObject::objectName for that. The accessibleName is used for the accessibility interfaces (i.e. screen readers and such). In Qt Designer, all objects have ...

View answer
Implementing a unique_ptr - PPP Stroustrup exercise
0 votes

The default constructor is missing. The move constructor and move assignment operator are missing (they are not copying!). Otherwise, it looks good. Although a matter of style, I find that it helps ...

View answer
Initializing an array of string constants, and another constant array of the equivalent lengths
0 votes

You already have a working solution but you say "it would be easier on the system to have 2 separate arrays". I have no idea what you mean by that, and in any case this is false since memory ...

View answer
LeetCode: Spiral Matrix II C#
0 votes

Ignoring everything else, you're iterating the array in a very cache-inefficient manner, and that will ultimately limit the performance. You need to iterate in column-major order, i.e. iterate down a ...

View answer