2,898 Posted Topics
Re: You might want to look into [sorting algorithms](http://en.wikipedia.org/wiki/Sorting_algorithm) (unless your teacher is fine with you using the standard [std::sort](http://www.cplusplus.com/reference/algorithm/sort/) function). You might want to start with [bubble-sort](http://en.wikipedia.org/wiki/Bubble_sort). | |
Re: Only an admin can win, by posting last and then closing the thread. ![]() | |
Re: Thanks for clearing this up. This sounded very fishy to me because as far as I know (but I could be wrong?) "secure" services like Gmail do not store plaintext passwords anywhere, but only the salted hashes corresponding to them (i.e., they can validate the password you entered, but they … | |
![]() | Re: It sounds to me like the device that you are trying to communicate with is using its own protocol (which nearly all hardware I have ever worked with does too). The manual about the device tells you how to implement an application with this protocol, but you have to implement … ![]() |
Re: There are a lot of tutorials out there on this topic. Here are a few: http://www.codeproject.com/Articles/598695/Cplusplus-threads-locks-and-condition-variables https://solarianprogrammer.com/2011/12/16/cpp-11-thread-tutorial/ http://www.bogotobogo.com/cplusplus/multithreaded4_cplusplus11.php Also, the standard C++11 threading library is almost entirely based on the [Boost.Thread](http://www.boost.org/doc/libs/1_56_0/doc/html/thread.html) library (the Boost libraries is sort of the anti-chamber for creating and testing to-be-standard libraries). So, you can also … | |
Re: Well, where to begin... First things' first, you should not use all upper-case letters when naming your functions or variables. This is not Fortran77 code, this is C/C++ code. It is conventional in C/C++ code to reserve all upper-case letters for MACROs (or defines), i.e., things created with `#define`, to … | |
Re: If you look at the [documentation for setHtml function](http://qt-project.org/doc/qt-4.8/qwebview.html#setHtml), you will see that it has a second parameter (defaulted in your case) to specify the base URL (or file path) from which to get any external objects (stylesheets or images) referenced in the html. Here is a quote of the … | |
Re: This whole question of "What do you have to hide?" is a subtle case of the "loaded question" fallacy (like "Do you still beat your wife?"). This fallacy is about loading the question with a premise such that whichever answer is given, the premise is implicitly accepted or acknowledged in … | |
Re: That code looks OK (by beginner's standards, of course). What is the problem you are having with it? What kind of an alternative are you looking for? Why? | |
Re: If you don't know ahead of time what size you need for the arrays, then you need to use a dynamic array type instead of `std::array` (which is only for static size arrays). The class you can use is `std::vector` (see [docs](http://www.cplusplus.com/reference/vector/vector/)). This would make your lines look like this: … | |
Re: > Would it hurt if I used dir over ls? No. dir is actually identical to ls in Linux. The only difference is the extra character to type. And of course, it carries the shame of having to admit that you still cling to the shackles of MS-DOS, your previous … | |
Re: > Vague much? It seems pretty clear to me. The post says: "I don't want an answer to my question, and so, I will post a few vague scribbles so that nobody knows what my question is." | |
Re: The AVL tree is one of these things that I would qualify as a fundamental data structure and balancing algorithms that are good to know and understand, but the data structure itself has very limited practical purpose. The thing is that if you need a self-balancing binary search tree, you … | |
Re: There are [several Linux distributions](http://en.wikipedia.org/wiki/Security-focused_operating_system#Linux) that focus on security of various kinds. I'm not sure exactly which would be the most appropriate for you. They take different focuses. Some aim at anonymity (e.g., via Tor or I2P, like in Tails Linux). Some aim at preserving the integrity of the system, … | |
Re: We don't do people's homework here. If you need help in solving this problem, you have to start by showing us what you have done so far and where exactly you hit a snag. In other words, you need to show that you've made efforts to solve it before anyone … | |
Re: VC6 and VS2010 are not binary compatible (neither are most versions of Microsoft's compilers, they just change it every time, even for revisions on the same version). This means that the binary layout of classes (e.g. how the objects look in memory) can be significantly different between those two versions. … | |
Re: You need to declare the `sortbyScore` function as a static member of your class.. i.e., like so: class Game { // ... static bool sortbyScore(const PlayerScore &ps1, const PlayerScore &ps2); }; bool Game::sortbyScore(const PlayerScore &ps1, const PlayerScore &ps2) { return ps1.score > ps2.score; } // call sort with: sort(scores.begin(), scores.end(), … | |
Re: Using VirtualBox is definitely a great option for you, given the needs you have expressed. There are plenty of easy to follow tutorials out there about how to go about creating one of those. For example, [this one](http://www.psychocats.net/ubuntu/virtualbox) seems easy enough to follow. For beginners, the preferred Linux distribution is … | |
Re: It means exactly what it says, that you need to put `typename` before `List<List_entry>::Error_code`, as so: template<class List_entry> typename List<List_entry>::Error_code List<List_entry>::put(const List_entry &x) { code.. } The reason for this is that `List<List_entry>::Error_code` is a dependent type. Simply put, because `List_entry` is a template argument, when the compiler first passes … | |
Re: The standard utility in Ubuntu for text-to-speech is called "[espeak](https://help.ubuntu.com/community/TextToSpeech)", which comes pre-installed with it (but I think you have to install the GUI front-end if you want to use it directly, but espeak is integrated already into other applications like text editors or pdf viewers). I have used Festival … | |
Re: If you use Qt, you could use [Phonon](http://qt-project.org/doc/qt-4.8/phonon-overview.html). SDL_mixer is definitely a good option too. You could also use [OpenAL](http://kcat.strangesoft.net/openal.html). | |
Re: You have to use a [template alias](http://en.cppreference.com/w/cpp/language/type_alias). As so: template <typename... Args> using Event = std::function<void(Args...)>; Event<int,int> test = [](int x, int y) { int a=x+y; std::string b = std::to_string(a); MessageBox(NULL, b.c_str(), "hello", MB_OK); }; The reason why your initial typedef worked is because it uses `void(...)` which represents a … | |
Re: I think you need to look at [QSizePolicy](http://qt-project.org/doc/qt-4.8/qsizepolicy.html) (accessed from [QWidget::sizePolicy()](http://qt-project.org/doc/qt-4.8/qwidget.html#sizePolicy-prop)). Basically, the size policy is what allows you to specify how widgets should grow automatically when their parent widget (with a layout) resizes, and things like their minimum / preferred size (e.g., to force to parent widget to adopt … | |
Re: A good and simple image loading / saving library is [FreeImage](http://freeimage.sourceforge.net/). For more complex tasks, you can use libraries like [ImageMagick](http://www.imagemagick.org/), or even [OpenCV](http://opencv.org/). There are also some limited amount of built-in support from OS API functions, like Win32 API for BMP images, but that is usually too limited to … | |
Re: In view of the latest head-butting between Linus Torvalds (head of Linux) and Kay Sievers (head of Systemd), this looks to be related. Apparently, systemd has had a long history of ignoring bugs and forcing others to work around their quirky or sub-standard software. The fact that it doesn't strictly … | |
Re: Just to clarify, in the listings the version of the MSVC compiler used by Visual Studio 2012 is MSVC 11, and there is also the November update version which added quite a few of the more useful features (variadic templates, init-lists, etc.). Visual Studio 2013 uses version 12. Overall, the … | |
Re: > 1)Trying to explain the force. I agree that some things are just better left unexplained. I think that fans love the Force as just this mystical force that gives some awesome powers. The fans think "If the Force existed, it would be awesome!", and the only explanations that are … | |
Re: The set of options that I usually prefer for rsync is `rsync -va --delete` (local transfer) or `rsync -vaz --delete` (over network, "z" compresses the data to minimize the bandwidth needed). But the thing that might have been the problem is that rsync can be a bit tricky in the … | |
Re: Probably the easiest answer is just to get [CodeBlocks](http://www.codeblocks.org/downloads/26). And also, do not use Turbo C++, it is way too outdated to be relevant or worth using. This is a very old IDE that uses a pre-standard C++ compiler. Do not use it. And if it was recommended to you … | |
Re: > what languages would be used to create something like adobe photoshop? Photoshop is entirely written in C++, as far as I know. They've released a lot of open-source code in the past, always in C++, and their developers have been active in the C++ community. > Actually it depends … | |
Re: If your compiler supports [C++11](http://en.wikipedia.org/wiki/C%2B%2B11) (the latest language standard), you can also initialize a vector with multiple values (called an [initializer-list](http://en.wikipedia.org/wiki/C%2B%2B11#Initializer_lists)), like so: std::vector<int> fu = {1,3,4,5,6}; | |
Re: Hopefully it's not a PhD in computer science or any kind of technical field... if so, she should do it herself. Otherwise, this should be posted to business exchange forum, or to rent-a-coder. | |
Re: I think this definitely makes sense from both the point of view of quality of results and moving the web towards more security. Most "serious" websites out there are already secure using https, so, it is definitely, in part, a valid indicator of quality for a website. And, of course, … | |
Re: > Why is Daniweb's mascot a dude Because, like in any healthy household, the woman is the queen and the man is the puppet. ![]() | |
Re: > Will this work? Yes. However, notice that there is a difference between that program and your original one. In the original program, if there is not enough memory (bad-alloc exception) to store all the numbers, the program will not read any number at all. In the second version, the … | |
Re: I see no reason why this wouldn't work. You picked the chipset that is recommended for the given processor and it supports the given mmc clock rate as well as the 64Gb capacity (total). As for Linux, the kernel has supported terabytes of RAM for a decade at least, and … | |
Re: > And why should I stop using goto Because the kind of mind-twisting troubles like the one you encountered now is the only thing that using goto gives you. The idea of the goto is to allow you to jump around to arbitrary places in the code, which might sound … | |
Re: Be careful with all this freeware / shareware / crapware programs like PowerISO. The Windows landscape is full of such non-sense software that you can get for free, but it usually comes with a bunch of other programs that piggy-back on its installation, such as a browser toolbars, default search-engines, … | |
Re: I assume that by "including C++ files", you mean something like this: #include "my_file.cpp" Then, as Schol-R-LEA said, it is not good practice to do so. In C/C++, you are supposed to do separate compilations of each source file and then link them together. You should get used to this … | |
Re: > as if i was playing a heavy duty game for sevral hours straight Did you by any chance happen to have discharged the battery completely while playing a heavy duty game? If so, I would bet your battery is toast. Reaching the minimum charge on a battery while drawing … | |
Re: No, it's not a waste of time. It's one of the most powerful and fundamental programming languages out there. Even if you don't end up programming in C++ in your particular job or field, it is not a waste of time to learn it. | |
Re: There is no way to generate a true random number from a computer program. Random number generators that most programming language libraries have are actually what is more precisely referred to as "pseudo-random number generators". They simply use some math functions that are very wild (in reality, these math functions … | |
Re: As far as I know, the term "bounded array" is not really standard terminology for anything in particular. I would assume, however, that it refers to a static array, something like this: `int arr[5];`. It is still used today, for sure. When you just want a small set of objects … | |
Re: Are you using some external library? Anything other than the standard libraries? If so, verify that the libraries you are linking to have been built with the same version of MinGW (or close to it) as the one you are using. This "dw2" version of this DLL is an obsolete … | |
Re: You might also check the file permissions. This is either a problem of file location or file permission, as far as I know, so just make sure both are correct. | |
Re: The 880M card has been added pretty recently (last May) to the officially supported list from the [Nvidia Linux driver version 331.67](http://www.nvidia.com/Download/driverResults.aspx/75018/en-us). This is pretty much the latest stable Nvidia driver (there are a couple of later Beta drivers). So, assuming you can install this driver, i.e., that you have … | |
Re: Thanks Moschops for that shout out. I was just going to point to that stack overflow answer. Choosing a good STL container for a given situation is a pretty subtle task, unless it's a trivial problem. I would generally recommend writing your code in a generic way to be able … | |
Hey guys, I just wanted to give a shout out for the McGill Robotics team. This is a team of undergraduate students from different engineering disciplines here at McGill. They are participating to the [RoboSub competition](http://www.auvsifoundation.org/foundation/competitions/robosub/) right now! They managed to build and code a fully operational, autonomous submarine robot … | |
Re: Like Hiroshe, I had never heard of a CPU being clocked above 5 or 6GHz, and even then, that requires liquid cooling, or even liquid nitrogen cooling. It would seem that the [world record](http://valid.canardpc.com/records.php) is 8.8GHz. Basically, the main reason why the CPU speed as been limited in the past … | |
Re: > When I dynamically allocate mem within a function, do I have to still manually release it? Yes. Everything that is allocated must be deallocated. If you allocate memory inside a function and don't release it before exiting the function, then that memory will be leaked (or in more precise … |
The End.