signals and slots
Can someone explain in simple terms the "signals and slots" pattern? ...
Can someone explain in simple terms the "signals and slots" pattern? ...
Is there a way to use these operators to input and output binary data? The reason I want to do this is that it makes the code readable. Ex: infile >> filedecrypter >> metadataparser >> audiodecoder >> effects >> soundplayer; ...
Why whenever I compile and run the following code in Visual Studio 2008: double value1 = 10.5; double value2 = 15.5; int whole_number = value1 + value2; Console::WriteLine(whole_number); I get an incorrect value of 26 while the answer is 25. However when I use static casts on the doubles, I get the right answer which is 25. How can ...
I'm a C/Python programmer in C++ land, really working with the STL for the first time. In Python, extending a list with another list uses the list's extend method: >>> v = [1, 2, 3] >>> v_prime = [4, 5, 6] >>> v.extend(v_prime) >>> print v [1, 2, 3, 4, 5, 6] In C++, I'm currently using this algorithmic approach for vector extension: ...
Java was initially slow before the JIT but today performance is pretty close to C++. I want to know if someone has done measurable performance comparisons between the two languages? Where does Java fall short when compared to C++? Java provides many productivity gains to developers so they can write applications much quicker because o...
I have a self-developed program which I want to use as the default opening tool for .jpg and .bmp files. How can I achieve the goal progrmmatically? Some said that I have to add some registry entries. But I don't konw exactly what I should do. Can anyone tell me the method? Thank you! ...
I have to call ping from c++ code.I'd like to easily read the output for further utilizations. I have come up with two solutions: use a fork and a pipe, redirect ping output to the pipe and then parse it find a library suited for the purpose to use a ping(ip_addresss) function directly I'd like the latter but i didn't find anything ...
I have a incoming stream of bytes (unsigned char) from either a file or network. I need this data placed in a class, and is looking for a NET-way of doing this. I bet some does this all the time, so I guess there is a better method to do this than using BitConverter. I realize I supplied too litle information. Let me try with an exam...
I have a project that has a makefile with broken dependencies. Is there any best known way to generate a list of dependencies for the project that I can use in the makefile, other than examining each source file by hand or with a hand written perl script? ...
After creating a instance of a class, can we invoke the constructor explicitly? For example class A{ A(int a) { } } A instance; instance.A(2); Can we do this? ...
Hi, I want to convert an STL String to lowercase. I am aware of the function tolower() however in the past I have had issues with this function and it is hardly ideal anyway as use with a string would require iterating through each character. Is there an alternative which works 100% of the time? ...
When I am single stepping through one thread of a multi threaded program, the debugger gets interrupted with: 0x(some hex ref) : tdb_event_death : ret dbx: thread has exited -- next aborted My guess is a thread somewhere in the program I am debugging has stopped, but it's not the one I'm debugging so I can't see why I have to res...
I have a function which searches an STL container then returns the iterator when it finds the position, however I am getting some funny error messages, can tell me what I am doing wrong? Function: std::vector< CClass >::iterator CClass::SearchFunction( const std::string& strField ) { ... return it; ... } Error: error C2664: 'st...
Consider the following use of template template parameters... #include <iostream> template <typename X> class A { X _t; public: A(X t) :_t(t) { } X GetValue() { return _t; } }; template <typename T, template <typename T> class C > class B { C<T> _c; public: B(T t) :_c(t) ...
Hi, i am searching for a smart solution for this problem: A cancer ct picture is stored inside a unsigned short array (1-dimensional). I have the location information of the cancer region inside the picture, but the coordinates (x,y) are in superpixel (128x128 unsigned short). My task is to highlight this region. I already solved th...
I've got an array of char*'s in a file. The co. I work for stores data in flat files.. Sometimes the data is sorted, but sometimes it's not. I'd like to sort the data in the files. Now I could write the code to do this, from scratch. Is there an easier way? Of course an inplace sort would be the best option. But I'll consider all o...
I am programming in C++ (Visual Studio 2008) and wish to do the following in both Windows XP and Windows Vista. Play audio files (wav, mp3, others if they come along for free...) and be able to control the left/right sound levels independently. Play tracks from audio CDs and be able to control the left/right sound levels independently....
When obtaining the DPI for the screen under Windows (by using ::GetDeviceCaps) will the horizontal value always be the same as the vertical? For example: HDC dc = ::GetDC(NULL); const int xDPI = ::GetDeviceCaps(dc, LOGPIXELSX); const int yDPI - ::GetDeviceCaps(dc, LOGPIXELSY); assert(xDPI == yDPI); ::ReleaseDC(NULL, dc); Are these va...
I heard a lot about makefile and how it simplifies the compilation process. I`m using VS2008, can somebody please advice me some online references or books when I can find how to deal with it? ...
I am thinking it is a best practice to declare them as static, as it makes them invisible outside of the module. What are your thoughts on this? ...