2,898 Posted Topics

Member Avatar for game4tress

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 …

Member Avatar for mike_2000_17
0
216
Member Avatar for sbrohee

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));

Member Avatar for sbrohee
0
2K
Member Avatar for zachattack05

> 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 …

Member Avatar for zachattack05
0
477
Member Avatar for phorce

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 …

Member Avatar for L7Sqr
0
228
Member Avatar for daino

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" …

Member Avatar for daino
0
9K
Member Avatar for vishalonne

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: …

Member Avatar for mike_2000_17
0
213
Member Avatar for triumphost

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 …

Member Avatar for mitrmkar
0
178
Member Avatar for daino

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 …

Member Avatar for daino
0
11K
Member Avatar for daino

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 …

Member Avatar for daino
0
253
Member Avatar for triumphost

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 …

Member Avatar for mike_2000_17
0
227
Member Avatar for AmrMohammed

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, …

Member Avatar for mike_2000_17
0
260
Member Avatar for Dani

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 …

Member Avatar for JorgeM
3
179
Member Avatar for kunal.madhak

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 …

Member Avatar for mike_2000_17
0
44
Member Avatar for rayden150

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 …

Member Avatar for anilnepal1111
0
1K
Member Avatar for amadkhalil

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 …

Member Avatar for mike_2000_17
0
1K
Member Avatar for BigPaw

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 …

Member Avatar for BigPaw
0
505
Member Avatar for andigirlsc

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 …

Member Avatar for mike_2000_17
0
273
Member Avatar for bguild

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 …

Member Avatar for mike_2000_17
0
1K
Member Avatar for lewashby

Did you try installing the newer version of the same lib. That is, try `$ sudo apt-get install libdb5.1++-dev`

Member Avatar for mike_2000_17
0
91
Member Avatar for Dani

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 …

Member Avatar for L7Sqr
3
1K
Member Avatar for triumphost

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 = …

Member Avatar for triumphost
0
155
Member Avatar for shanna62

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 …

Member Avatar for shanna62
0
140
Member Avatar for triumphost

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 …

Member Avatar for mike_2000_17
0
756
Member Avatar for challarao

> "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 …

Member Avatar for mike_2000_17
0
1K
Member Avatar for gtsreddy

@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 …

Member Avatar for vijayan121
0
718
Member Avatar for Thembelani

> 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 …

Member Avatar for mike_2000_17
0
1K
Member Avatar for Darshan5

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 …

Member Avatar for mike_2000_17
0
152
Member Avatar for silvercats

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 …

Member Avatar for mike_2000_17
0
112
Member Avatar for np complete
Member Avatar for np complete

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 …

Member Avatar for np complete
0
94
Member Avatar for iamthwee

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. …

Member Avatar for Ezzaral
0
325
Member Avatar for firdousahmad

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 …

Member Avatar for mike_2000_17
0
137
Member Avatar for nicolejoyfax
Member Avatar for Jsplinter

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, …

Member Avatar for mike_2000_17
0
280
Member Avatar for Albino

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() << …

Member Avatar for Lucaci Andrew
0
188
Member Avatar for daino

> 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 …

Member Avatar for daino
0
891
Member Avatar for jeha0

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!

Member Avatar for jeha0
0
230
Member Avatar for syedamuhibzahra

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 …

Member Avatar for stultuske
0
263
Member Avatar for vjnaveen

> i need certain details of robotics Then you should ask about what you want to know.

Member Avatar for mike_2000_17
0
131
Member Avatar for Dudearoo

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 …

Member Avatar for Dudearoo
0
123
Member Avatar for daino

> 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 …

Member Avatar for daino
0
1K
Member Avatar for lewashby

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 …

Member Avatar for mike_2000_17
0
118
Member Avatar for dinhunzvi

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 …

Member Avatar for mike_2000_17
0
213
Member Avatar for predator78

> 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 …

Member Avatar for mike_2000_17
2
734
Member Avatar for klharding2

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.

Member Avatar for klharding2
0
144
Member Avatar for silvercats

> 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 …

Member Avatar for Ancient Dragon
0
278
Member Avatar for bryangino20

> 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 …

Member Avatar for mike_2000_17
0
502
Member Avatar for Xantipius
Member Avatar for acfchinnababu

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 …

Member Avatar for mike_2000_17
0
245
Member Avatar for Octet

> 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 …

Member Avatar for roillinpr
0
193

The End.