2,898 Posted Topics
Re: Well, you can proceed by elimination. I'm gonna try to explain without giving it all away. Hint 1: In an undirected graph, every edge that is counted on the degree of one node must also be counted in the degree of the other node to which it leads. For example, … | |
Re: Agreed, those american beers are just sparkly water with a bit of yellow colorant. I'm not a big fan of Heineken either. Here (QC), we have some local beers that are pretty good, mostly Beligium-style beers. I'm also a big fan of German and Danish beers. | |
Re: When doing cross-platform work, there isn't really a need to constantly use both or move between two platforms all the time for doing the actual coding, only for compiling and resolving issues. You code on one platform (whichever you prefer), and frequently check that it compiles on your other target … | |
Re: You should learn about [passing by reference](http://www.learncpp.com/cpp-tutorial/73-passing-arguments-by-reference/). As in: static DATAEDITING_API bool Contains(const std::string& target, const std::string& source); static DATAEDITING_API bool Contains(const std::string& target, const std::vector<std::string>& source); static DATAEDITING_API bool Contains(const std::string& target, const std::string& source, bool sensitive); static DATAEDITING_API bool Contains(const std::string& target, const std::vector<std::string>& source, bool sensitive); And: … | |
Re: One of the better options would be to do this: class Shoe { public: //Constructors Shoe(); Shoe(string Name_, double ShoeSize_, int Number_); //Destructor ~Shoe(); //Getters string getName() const; double getShoeSize() const; int getNumber() const; //Setters void setName(const string& Name_); void setShoeSize(const double ShoeSize_); void setNumber(const int Number_); //Variables string Name; … | |
Re: The word a$$ either means anus or donkey, so pick whichever you like: "anus-kicking computer" or "donkey-kicking computer". ;) I would also vote against censorship, if it was a democratic decision. | |
Re: > So who do you think is going to win? The team that scores more points than the other by the end of the game. -- Captain Obvious | |
Re: Exactly a year ago, I bought an Acer laptop with an i7 processor, 8Gb ram, and 1Tb HDD. It was a bargain at the time, and it works great, just a little less powerful than my desktop computer at home (from 2.5 years ago). It's slick, has a full full-size … | |
Re: [Here](http://www.yolinux.com/TUTORIALS/LibraryArchives-StaticAndDynamic.html) is a pretty complete tutorial for Linux. For Mac, it is a Unix-like system like Linux, and so, the tutorial is equally valid for Mac. > (I think it's different in you can't create/import .dll's instead it's .lib). You have wrong, here is how it is: Windows: `.dll` : … | |
Re: > More and more I find that I can no longer assume that the developers and IT specialists I work with have any clue how to do their job. The worst is when the only skill that people develop during a programming course is their skills at finding code on … | |
Re: > On writing to cout, terminate your lines with << endl;, otherwise you won't get your output displayed on the screen before you are asking for the input. That's wrong. `cin` and `cout` are tied together under-the-hood such that asking for input from `cin` automatically triggers a flushing of the … | |
Re: I guess we also have to specify that the formula is not computed with integer arithmetic. Otherwise, for any integer greater than 1, the division would yield 0, and thus, there would be "billyuns and billyuns" of possibilities too (`2^160` for 32bit unsigned integers). ;) | |
Re: What AD suggests is the preferred thing, i.e., passing the libraries and include-paths manually to the command-line, or configure you projects to add your library and include-paths to them. However, you shouldn't put them "anywhere you want", either put them in your home folder or somewhere that isn't a system … | |
Re: > By any chance is Dani developing a way to permenantly close "dead" threads, to prevent spam? No, or at least, it would be extremely surprising. She has made it abondantly clear (mostly in moderator-only discussions) that people contributing to old threads is not only in agreement with the rules … | |
Re: > So I ask: has anybody ever succeeded in building/loading/using SUCCESSFULLY g++ 4.8 on a Ubuntu computer? Yes. I keep a rolling version of GCC on my computer at all times, i.e., GCC compiled from source obtained from the latest development branch of GCC's svn repository. And most of my … | |
Re: "It's not you.. it's me.." "Don't take it personally, but I think you're a <insert insult> ." | |
Re: Or, using `std::stringstream`: std::string toString(unsigned int i) { std::stringstream ss; ss << std::setfill('0') << std::setw(6) << i; return ss.str(); }; | |
Re: Do you have a question? As for the code, there are several problems with it: - The header `#include <iostream.h>` has been deprecated for a long time, it is a pre-standard syntax that some compilers still support today, but it is not standard. The standard libraries do not have a … | |
Re: if ( atoi( argv[1] ) % atoi( argv[2] ) == .33333 ) You misunderstood what the remainder is. The remainder is an integer value, not a fractional value. In other words, `7 % 3` gives `1` because 3 fits two times into 7 and then there is 1 left, that's … | |
Re: > Why is there no way in C++ to ensure the safety in this case? Why? Because C++ has an overarching principle of no overhead for what you don't use. In order to be able to do the run-time check that `dynamic_cast` does, the compiler has to add a hidden … | |
Re: I remember, early on when learning C++, to be a bit frustrated at limitations of C-style struct initialization and how awkwardly it mixed with C++ classes. But I also remembered letting go of that quite quickly and never really missing it. Now that the rules have been updated to more … | |
Re: That's a neat code snippet! Wouldn't it be nicer if the `selection` string was set to the given menu item (by name or ordinal) such that you would need to rely on the alternative match-strings for the switch case? In your test case, the alternatives are always an upper- or … | |
Re: [This post](http://www.daniweb.com/software-development/cpp/threads/70096/c-books/12#post1857402) is particularly enlightening ;) | |
Re: > What Comes First... The Chicken Or The Egg? Eggs for breakfast. Chicken for dinner. I rest my case. | |
Re: > Before i was using Borland Delphi, but i would like to switch to something else like VS. If you are familiar with Borland Delphi, it might be easiest to use Borland C++Builder. The problem is that it is not available for free (beyond a 30 day trial). It is … | |
Re: > Wouldn't everyone be allergic to dust because there is always dust everywhere? Well, I'm not sure that more exposition necessarily means more chance of being allergic to it, otherwise we'd all be allergic to milk by the time we're 5 years old. I'm allergic to house dust too. Whenever … | |
Re: > I would find Inverted matrix A ... (A)-1 Like you would in any other language that don't have built-in methods to do so. There are many algorithms for this purpose, each with different properties (efficiency, stability, amplification of round-off errors, etc.) and for different kinds of matrices (general, normal, … | |
Re: That is a common situation and there are two common solutions to it. But first, it is important to mention to semantics of this. When you give a non-const reference to a constructor, there is a conventional understanding that the reference must remain valid for as long as the object … | |
Re: I have dealt with Dell crapware before, especially their incredibly stupidly written restoring program. Before, I had a dual boot system with the Windows bootloader as the primary bootloader (chain-loading grub from the Linux partition), and the Dell crapware did some kind of automatic restore point thing that also involved … | |
Re: You should make the timeFunction function template take a templated parameter as the functor (callable type). Simply put, you could do this: template <typename F, typename T> clock_t timeFuction(F f, T v) { auto start = clock(); f(v); return clock() - start; } Or, more in the style of C++11, … | |
Re: That's a really interesting original definition. No wonder it got twisted into meaning a cheap and miserable man. Nobody likes to be told that they are hypocrites, they prefer to say that the guy who points it out is a miserable fool. | |
Re: Hi Glen, and welcome to Daniweb! I am Canadian, and my last name is also Persson. What are the odds, eh? I'm from Quebec, i.e., french-canadian, so I'm used to getting that name messed up all the time, either mistaken for "Pearson" (common english-canadian last name) or for "personne" which … | |
![]() | Re: I don't know much about online degrees, but I am a robotics engineer, so I might weight in a bit here. First, you have to watch out when looking up online degrees because there are a lot of fake colleges or university, for-profit colleges and so on. Also, potential employers … |
Re: > how intelligent are you in dealing with those whose first language isn't English? I have a bit of experience with that (both here and in real life), and English isn't my first language. I was lucky enough to be raised bilingual (French and Swedish), and later learned English (and … | |
Re: There are casting operators for shared_ptr called [`static_pointer_cast` and `dynamic_pointer_cast`](http://en.cppreference.com/w/cpp/memory/shared_ptr/pointer_cast). In other words, if you have this code for raw pointers: base* pb; derived* pd = static_cast< derived* >(pb); derived* pd = dynamic_cast< derived* >(pb); then, the equivalent with shared_ptr is the following: shared_ptr< base > pb; shared_ptr< derived > … | |
Re: You can use `yum` as follows from a terminal: $ sudo yum install some_package Or, you can launch the software center from the main menu and search for the package you want. and, of course, you need internet access. | |
Re: I second that. Definitely, put that work experience on your CV. Not only does it show that you have not been sitting on behind for five years, it also shows a number of qualities like being hard working, being able to show up on time every day (at least, if … | |
Re: The reason is because you **should not** re-seed the random number generator each time. Just seed it with `srand((unsigned)time(0));` once in the entire application, i.e., at the start of the main() function. That will fix the problem. BTW, to print a fixed number of digits with leading zeros, you can … | |
Re: As far as I know, this cannot be done. From a practical point of view, compilers would be required to track in what namespace a particular function a function pointer point to was defined, and I don't think any compiler really does that because there is no real purpose for … | |
Re: Make sure to get the most up-to-date version. CodeBlocks just came out with version 12.11 (late november 2012) which includes the compiler GCC version 4.7.1 (the MinGW TDM-GCC distribution) which should work for Windows 8 (at least, according to the website). Other than that, you'd have to try the Clang … | |
Re: Easiest/Safest option: Reinstall Linux on the entire system, overwriting WinXP partitions. If you can fairly easily take a backup of all your files (e.g., take a backup of `/home` folder) and put those files on a separate partition (non-windows, non-linux) or on a separate hard-drive (external HDD or pen-drive), then … | |
Re: To clarify, Scott Meyer's explanation is as follows: > Because the default version of operator new is a *general-purpose* allocator, it must be prepared to allocate blocks of any size. Similarly, the default version of operator delete must be prepared to deallocate blocks of whatever size operator new allocated. For … | |
Re: Well, on my computer, the `vimrc` file is in the `/etc/vim/` directory, and if I do the `ls -l vim*` command, I get the same result. Try this: $ cat /etc/vim/vimrc N.B.: To find a file, it is easier to use commands like these: /etc$ locate vimrc /etc/vim/vimrc /etc/vim/vimrc.tiny /etc$ … | |
Re: > Can C++11's Mutexes be used for Inter-Process Communication? In other words, can it be used for shared memory and signalling an event? Yes. But the more important question is: Should mutexes be used for that? **No**. To use a mutex (or pair of mutexes) for this purpose, one could … | |
Re: > Visual Studio 2012 (November update). > > Way ahead of GCC (the other major contender) in C++11 conformance - Microsoft has implemented almost everything in the standard. > > clang 3.2 with its libc++ is on par with VS 2012; and it is somewhat more mature and stable in … | |
Re: Technically, yes, you could make the derived class copy-assignable. The intent of the "non-copyable" idiom is to make the class non-copyable for *users* of the class. As an author of a derived class, you can still make it copyable by making a public copy-constructor and a copy-assignment operator. But you … | |
Re: [Here](http://www.linuxjournal.com/content/using-windows-xp-virtualbox-linux) is a good step-by-step tutorial (for Windows XP, but I'm sure you can figure out how to do other versions too). > for the user it should look alike windows but actually performing his applications on linux platform There are actually many versions of Linux that do look or … | |
Re: [Here](http://www.psychocats.net/ubuntu/virtualbox) is a step-by-step tutorial to install Linux (Ubuntu in the tutorial) inside a VirtualBox on Windows. |
The End.