2,898 Posted Topics
Re: It would help a lot if you pointed out which specific programming languages are involved (and platforms). Generally speaking, it will depend on a few different aspects. First of all, if your current code is built in a very monolithic way (i.e., one solid block, with no "removable" parts), then … | |
Re: The problem is probably with the interaction of non-const references and the function binding library, they don't always play nice together (although they should, IMO). Try using a [reference-wrapper](http://en.cppreference.com/w/cpp/utility/functional/ref). Something like this: threads.push_back(thread (run_es_pval, start, end, rankedSize, std::ref(datasetNames), std::ref(datasets), std::ref(dicoArray), es_threshold)); | |
Re: > Is there a country I should add to the list for future surveys? You probably could just use different continents or sub-continents instead. With about a dozen sub-continents (North America, Latin America, Western Europe, Eastern Europe, Northern Africa, Southern Africa, South Asia, Middle East, East Asia, South-east Asia, and … | |
Re: Just to add a remark, the more typical (hassle-free and safe) implementation of a singleton class is as follows: // in header: class Singleton { private: Singleton() { // ... } Singleton(const Singleton&); // no implementation. non-copyable Singleton& operator=(const Singleton&); // no implementation. non-copyable public: static Singleton& getInstance(); // get … | |
Re: 1. Make sure that libpng and zlib are installed on your computer. 2. Make sure that `FindPNG.cmake` module is installed on your computer (should be by the default cmake install). To find it, make a file search for the file name "FindPNG.cmake", and you should find it in CMake's "Modules" … | |
Re: The simple fix is to take the `template <class T>` and put it just before the class template declaration. Also, you need to specify the type (for T) when creating an object, but you don't need it when calling its functions. As so: template <class T> class calc { public: … | |
Re: As deceptikon said, mixing `new/delete` and `new[]/delete[]` is undefined behavior because there is no requirement for the implementation (compiler + standard libraries) to use the same underlying mechanism for both variants. That's why it is undefined behavior, which just means that there is nothing in the C++ standard that defines … | |
Re: First, these are environment variables. So, if you need to set them, set them like you do with [any other environment variable](http://en.wikipedia.org/wiki/Environment_variable). Second, why do you want to modify those variables? These are not things that you normally have to temper with, i.e., these are usually set correctly at installation … | |
Re: I think your question is just too broad and too narrow at the same time. I say too broad because one could interpret it as just "I want to learn about software engineering". And I say too narrow because you make references to the specific problem of linking, using and … | |
Re: In the function you just posted, you forgot to handle the misalignment at the end of the pixel rows. This should work: void JNIData::FlipBytes(void*& Result) { unsigned long Chunk = (Bpp > 24 ? width * 4 : width * 3 + width % 4); unsigned char* Destination = static_cast<unsigned … | |
Re: These are a lot of questions. I was actually planning on writing a tutorial explaining all this stuff. I'm a bit busy right now, so, in the mean time, I'll briefly answer your questions. > 1- Preprocessor copies the contents of included header files into the source code file. Yes, … | |
Re: I like it. Not sure if it'll become my go-to place, time will tell. I actually kinda like the "Recommended" page more, for the fact that it lists all the threads of my favorite forums in one listing. Can you manually mark some forums as "favorite"? Some forums are not … | |
Re: The same as its English meaning: a lump of anything. As far as I know, the word has no special meaning in C++, and I would know if there was. It just means a piece of memory or code or anything. Do you have a specific context in which you … | |
Re: Why does the database function needs to be passed anything? From the looks of the function, all it does it use the "f" variable as a local variable, and it doesn't use its passed-value for anything. Just make it a local variable and make the database function a function without … | |
Re: If your matrix is 96x48, then you cannot invert it. You have to solve the [linear least-square problem](http://en.wikipedia.org/wiki/Linear_least_squares_(mathematics)), which leads to computing the [left Moore-Penrose pseudoinverse](http://en.wikipedia.org/wiki/Moore%E2%80%93Penrose_pseudoinverse). This can be calculated in a number of different ways, the more generic of which is the [QR-decomposition](http://en.wikipedia.org/wiki/QR_decomposition), or the [Singular Value Decomposition](http://en.wikipedia.org/wiki/Singular_value_decomposition) which … | |
Re: Being a big C++ advocate, it would be hard for me not to recommend it. I would certainly say that using Qt (with QtCreator) in C++, doing that project that you envision will be a walk in the park, if you are at least somewhat comfortable already in C++. The … | |
Re: Usually, fixing the indentation will reveal such problems: //ticket purchase while loop while (ticType == 1 || ticType == 2 || ticType == 3) {//while the ticket type equals 1, 2 or 3 if (ticType == 1) {//if purchase toddler ticket cout << "You have selected to purchase a Toddler … | |
Re: I don't know much specifically about a word processor, but I would certainly expect all of them to be using some form of a MVC pattern (Model-View-Control). I would also expect that all the word processor use some form of a markup language to represent the actual text along with … | |
Re: Did you try installing the newer version of the same lib. That is, try `$ sudo apt-get install libdb5.1++-dev` | |
Re: To help with the problem of getting votes on less visited forums, I would suggest that, at least, all snippets should have a link posted on this thread, and ask that moderators try to take the time to check out each submission, even if it is in a foreign programming … | |
Re: What about using a function templates like these ones: template <typename T> T read_value(char*& ptr) { T result = *(reinterpret_cast<T*>(ptr)); ptr += sizeof(T); return result; }; template <typename T> void write_value(char*& ptr, const T& val) { *(reinterpret_cast<T*>(ptr)) = val; ptr += sizeof(T); }; And then do this: char* Data = … | |
Re: A queue is a very basic concept which requires only a few functions. The idea behind a queue is just to be able to add elements to the back (`push`), remove elements from the front (`pop`) and inspect the elements on either end. This is an abstract and functional concept … | |
Re: Writing a custom allocator is just about obeying the interface specified by the C++ standard. It's not really that hard at all. Of course in order to be able to use a custom allocator, you need to specify it in the instantiation of your STL containers, and if it is … | |
Re: > "In recognition of this intent, a single-argument constructor in C++ is called a copy constructor." That statement is false. Here is the standard definition, from Section 12.8/2: > A non-template constructor for class X is a copy constructor if its first parameter is of type `X&`, `const X&`, `volatile … | |
Re: @markwiering: Just a hint, if you want to quote a previous poster, you can copy the words into your post, then highlight it and click on the "Quote" button in the editor. Or, you can just add a `> ` before the quoted text (which is what the "Quote" button … | |
Re: > does gcc have graphics library Not by default. GCC only includes the standard libraries (C/C++ standard libraries). For everything else, you need external libraries. The nice thing with Linux is that you can very easily install those external libraries and start using them right away, with little trouble. In … | |
Re: Your user password is not the same as the root password, at least, not by default. The install will give your user account administrative rights (like doing `sudo` commands, and installing software), but it doesn't make your user account the "root" account. The root account is issued a randomly generated … | |
Re: For the most part no, there is no penalty. The x64 instruction set is an extension to the x86 (32bit). This means that all the x86 instructions are still supported and executed natively by the CPU, i.e., there is no "virtual machine" or other emulation layer. There is no reason … | |
Re: "Antitrust" wasn't too bad either. But "Hackers" is the classic. | |
Re: I can already picture it: After a hard day's work on a new warp drive for the ferry ship to Europa (Jupiter's moon), I drive my personal flying machine back home at super-sonic speed. Before I know it, I'm sitting in my entirely automated home, and I decide I feel … | |
![]() | Re: Congrats Dani! That's quite a landmark! You can now boast about how Daniweb has **more than a million members**! I think the facebook login made a huge difference. I remember observing the number of member some months ago thinking that it was kind of stalled in the 980k or so. … |
Re: Another simpler solution that doesn't involve a live CD and all this fiddling with the system files is to simply [boot into single-user mode](http://linuxgazette.net/107/tomar.html). I had this happen to be a couple of times, grabbing a dusty old Linux box that noone had the password for, booting into single-user mode … | |
Re: First, let's get the obvious out of the way. I must assume that although the data member is const, it does not have the same value for all objects of that class. Because if that were the case, the trivial solution is to use a `static const` data member. So, … | |
Re: My preferred method is to use [stringstream](http://www.cplusplus.com/reference/iostream/stringstream/). As in: #include <iostream> #include <sstream> using namespace std; int main() { stringstream ss1("42"); int value; ss1 >> value; // convert string to int cout << value << endl; stringstream ss2; ss2 << value; // convert int to string cout << ss2.str() << … | |
Re: > Where to build the binaries: C:/CodeBlocks/MinGW/bin // this could be a really dumb move as I'm not sure where these binaries should go? You should not do that, definitely not. Usually, when working with cmake, you want to create at least three folders: src, build and bin, for the … | |
Re: Välkomna! Jag är altid glad at se an annan svensk pâ Daniweb! As a C++ advocate, I'd hope you'd give it another try. In any case, have fun! And I hope you enjoy our community! | |
Re: I would say neither. The two words you've chosen are really bad to describe what addiction is (drug or otherwise). A disease usually implies either a virus or an infection, i.e., some kind of foreign organism (pathogene) spreading in your body. Addiction is nothing like that at all. And the … | |
Re: > i need certain details of robotics Then you should ask about what you want to know. | |
Re: It depends. There are generally three kinds of libraries in C++: shared libraries, static libraries and header-only libraries. In the classic plain C++ world (e.g., basic OOP code, no template), the library will be made up of header files that declare classes and functions, and corresponding source files that implement … | |
Re: > Is this just wrong or are they being cautious about mixing C and C++? No, it is correct. When you are using a compiler like GCC (within MinGW distribution), this is actually the *GNU Compiler Collection* which includes both a C compiler and a C++ compiler (at least, but … | |
Re: Sure. Use an archive manager application. For KDE, the standard one is Ark. For Gnome, the standard one is File Roller. Both open-source and installable from repositories, and they will certainly allow you to preview text files. I know that Ark is well integrated with other KDE programs to allow … | |
Re: Your best bet is to use [Poppler](http://en.wikipedia.org/wiki/Poppler_(software)) because PDF is a complex format with no easy way to extract text from, you need to rely on a library made to load PDFs, like Poppler. There is a utility called `pdftotext` which does exactly what you want. You can use it … | |
Re: > The fact that it's human nature to want, means that any full implementation of these systems will fail. That's very true. I see that argument as a warrant of caution for those who might dream of a total socialist overhaul of society. Most of what we can point to … | |
Re: The problem is that you never initialize the value of "finalvalue", neither in the main() function nor in the sin/exp functions. You should simply add `finalvalue = 0.0;` at the beginning of each function (sin and exponential), and that should solve your problem. The rest looks fine to me. | |
Re: > can the same source code run in different operating systems ? how? The same source code can be *compiled* for different operatings systems (and overall platform). There are about 4 kinds of "source code": the standard library, the operating system's API, third-party libraries, and your own code. The [standard … | |
Re: > Give 5 type checks ... > My issue was that I did not know what other types of checks There is a huge difference between saying "type checks" and "types of checks". The answer vijayan121 gave was specifically referring to "type checks", in other words, a set of conditions … | |
Re: Playing to the stereotypes: What's the best brand of vodka? | |
Re: If you don't have the root password, but you have `sudo` privileges on your user account (i.e., you can run commands under `sudo` by entering your user password), then you can simply run this to become root in the terminal: $ sudo su And then, you can change the root … | |
Re: > Looking at another interest of mine, being Robotics at the moment at University which kind of combines all of my main interests... If you're interested in robotics, you'll have to make a choice about which way to go about it. Because it is a multi-disciplinary field (which is what … |
The End.