c++

How to write graphical programs

Hi, I have learned C++ and Qt4. I wrote one graphical program with 3000 rows and I found out that there is really complicated to keep code simple, transparent and well-structured. I like design patterns etc. because they are really effective and helps to keep code simpler and more transparent. Now I am going to write another "bigger" ap...

precompiled .libs for boost on 64 bit VC++ 2010

Are there precompiled .libs for boost on 64 bit VC++ 2010? ...

Windows Mobile Hopper Test Tool, FocusApp

Hi recently I finished my WM6 Pro.6.1 application and happily learned that to put it into marketplace, it has to pass some tests. -Application Verifier -Microsoft Hopper Test Tool for Windows Mobile 6.0, 6.1, and 6.5 I use VS 2008 and windows mobile 6.1 and I couldnt run none of these tests, Hopeer tool has a FocusApp c++ application w...

stdcall and cdecl

There are two types of calling conventions - stdcall and cdecl. I have few questions on them. a) When a cdecl function is called by the caller, how does a caller know if it should free up the stack ? At the call site, does the caller know if the function being called is a cdecl or a stdcall function ? How does it work ? How does the ca...

Date/Time parsing in C++ (Any format string to Epoch)

I am writing a C++ app that has to parse a date/time string and give out epoch time. But the format of the date/time string can be more than one (actually say 25 formats) like "EEE, dd MMM yyyy HH:mm:ss '('ZZZ')'", "EEE, dd MMM yyyy HH:mm:ss '\"'ZZZ'\"'", "EEE, dd MMM yyyy hh:mm:ss z", "EEE, dd MMM yyyy HH:mm Z", "E...

loop QHash by insert order

Is it possible to loop a QHash by the insert order? The method below seem to loop the hash by some other factor: QHashIterator<QString, QString> i(hash); while (i.hasNext()) { i.next(); qDebug() << i.key() << ": " << i.value(); } EDIT: I figured it was impossible with QHash but what should I use instead? ...

STL vector usage problem -- Function returning non-zero Iterator.

I was trying to use the vector STL, where iam facing a weird response from the following sample program : #include <iostream> #include <algorithm> #include <vector> using namespace std; vector<int>::iterator fun(); vector<int> myvector; bool IsOdd (int i) { return ((i%2)==1); } int main() { vector<int>::iterator it; it...

Mechanize/SeleniumRC Alternatives in C/C++

Are there any C/C++ alternatives to Selenium RC or WWW::Mechanize/Python Mechanize? I guess an option would be to embed Firefox, but I just require something that will allow me to automate testing of websites while honoring state. ...

How do I inherit from and extend QCalendarWidget using C++

At present the QCalendarWidget only supports SingleSelection or NoSelection. I'd like to be able to write a widget that inherits from QCalendarWidget in Qt 4.6.2 and adds the ability for the user to select any day in a week and have that custom week selected. e.g. Click on Thu 5 August 2010 and all days from Saturday 31 July to Friday ...

How to map an ftp share folder to a local drive using C++ ?

hi, How to map an ftp share folder to a local drive using C++ ? Any code snippet... ...

Hints to speed up mobile debugging with Visual Studio 2008 C++

I'm debugging a C++ MFC Windows mobile 6 application using Visual Studio 2008 across a USB ActiveSync link. It works ok, but it is very slow. e.g. Adding a new watch for an integer vairable takes ~20 secs. Task manager shows devenv.exe as using 50% CPU at this time, e.g. all cycles on one core, so the problem appears to be CPU bound r...

Python modules for visualization of C++ code

I'm looking for python modules that can help with grepping C++ code. I have a large code base that I would like to do some analysis on. Ultimately I would like to come up with a graphical map of the software. There is lots of message passing going on amongst apps so I would like to be able to capture that information and present it vi...

Do very long methods always need refactoring?

I face a situation where we have many very long methods, 1000 lines or more. To give you some more detail, we have a list of incoming high level commands, and each generates results in a longer (sometime huge) list of lower level commands. There's a factory creating an instance of a class for each incoming command. Each class has a proc...

Windows: File rename and directory iteration clash

I'm using boost::filesystem to rename a file like this: boost::filesystem::rename(tmpFileName, targetFile); tmpFileName / targetFile are of type boost::filsystem::path. While doing this, I iterate over the directory using this code in another thread: directory_iterator end_itr; for (directory_iterator itr(dirInfoPath); itr != end_i...

Displaying mesh using DirectX 9

#include <windows.h> #include <d3d9.h> #include <D3DX9Mesh.h> #define THROW_ERROR_AND_EXIT(x) { \ MessageBox(0,x,0,0); \ return -1; \ } LRESULT CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) { // Handle close event switch( msg ) { case WM_DESTROY: PostQuitMessage( 0 ); ...

which is the best way to generate choices out of a given set of numbers?

for example if it is given to make all the choices between 1 to 5 and the answer goes like this.. 1,2,3,4,5, 1-2,1-3,1-4,1-5,2-3,2-4,2-5,3-4,3-5,4-5, 1-2-3,1-2-4,1-2-5,1-3-4, ....., 1-2-3-4-5. can anyone suggest a fast algorithm? ...

Registry and file system change identification

Is there a Coding way in C++ to find out the changes happened in Registry and file system. I need to find the changes happened to file system and registry after a software installion. There is filesystemwatcher in c# to identify filesystem changes. However, I need that to implement in C++ for both registry and files. ...

unable to pass Template function as a callback parameter

Please refer the code below: typedef void (*TimerCallback)(int RequestID_in, void* AdditionalParameter_in); class MyTimer { public: MyTimer(){} bool schedule( int Interval_in, TimerCallback TimerCallback_in, void* AdditionalParameter_in) { //some logic return true; } }; names...

C++ Class design - easily init / build objects

Using C++ I built a Class that has many setter functions, as well as various functions that may be called in a row during runtime. So I end up with code that looks like: A* a = new A(); a->setA(); a->setB(); a->setC(); ... a->doA(); a->doB(); Not, that this is bad, but I don't like typing "a->" over and over again. So I rewrote my ...

Define a specific case for a templated function (C++)

So in my .h file I have template <class T> void getValue(T *val, int element, int index); and then in my .cc file I have a function: template <class T> void RParser::getValue(T *val, int element, int index) { I also have it explicitly instantiated: template void RParser::getValue<char>(char *val, int element, std::string subr...