|
I think there's really no simple answer to this and will depend a lot on your application, the complexity of it and how it will be used.
1. It depends, in a complex application... this may take a long time. Do you have any time constraints? I've never really done a ton in Qt, but I've heard some of our employees who have used it complain about it. In case you've never used it, try with a small application to gauge how painful the move will be.
2. Again, this depends a lot on what your applications do. The plug-in idea is good for certain things, such as ease of expandability, but can cause short-term headaches and support issues (it's easier to break). I can probably go on and on with positives and negatives of each approach but really it just depends on what you need:
- Be able to communicate with apps built in different languages/frameworks (COM)?
- Easily expandable (plug-ins/libraries)?
- Save time in development (time is money after all, multiple exes option)?
- Expect core functions not to change much (library)?
- Expect core functions to be able to be used in multiple projects (library)?
- Do the applications need to do everything they do simultaneously? If not, does it make sense to keep different functionality in some logical grouping (like MS Office, does it make sense to have Excel and Outlook be one program? not likely)?
|
|
|
|
|
Those are good tips for me to consider, Thanks a lot!
Do you have any reference or clues for me to learn more about application suite development?
|
|
|
|
|
Not really... I'm a developer/engineer for a suite of tools, there's multiple exe's, shared libraries (dlls and libs), COM interfaces (for some tools), so there's really no magic method for building suites. It really is requirement driven, so approach it as such. What does your customer want/require?
|
|
|
|
|
hello guys... I am trying to change the text color of an item in a CListCtrl in which I am successful, thanx to some online tutorials. But now I am trying to change text color based on the value of a static boolean variable. Here is what I am trying
void CMainDlg::OnStatusList_CutomDraw(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMCUSTOMDRAW pNMCD = reinterpret_cast<LPNMCUSTOMDRAW>(pNMHDR);
NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>( pNMHDR );
*pResult = CDRF_DODEFAULT;
if ( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )
*pResult = CDRF_NOTIFYITEMDRAW;
else if ( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage )
{
COLORREF crText;
if(IsItemNumEven)
crText = RGB(255,0,0);
else
crText = RGB(0,255,0);
pLVCD->clrText = crText;
}
*pResult = CDRF_DODEFAULT;
}
This piece of code generates no error but it does not change the color either. If I remove the condition on IsItemNumEven , then it works fine. Just for general info, can I do something like this
AddToList("Item Index is Even");
MyListControl.SendMessage();
Thanks for any pointers.
This world is going to explode due to international politics, SOON.
|
|
|
|
|
Why don't you use the debugger to see the runtime value of IsItemNumEven ?
Veni, vidi, vici.
|
|
|
|
|
I would certainly do that if I am able to hit the break point in this function. It never goes there and I have no clue why.
This world is going to explode due to international politics, SOON.
|
|
|
|
|
It should reach that point, you stated it works if you remove the flag, right?
Veni, vidi, vici.
|
|
|
|
|
Overloaded_Name wrote: if(IsItemNumEven)
Why don't you look at pLVCD->nmcd.dwItemSpec instead?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
i want the user give me number.and i will setup queue with this number of zero.(case e) i get error to copile and i dont know why.
#include <iostream>
#include <list>
#include <deque>
using namespace std;
char option()
{
char c;
cout<<"A push valu\n"; cout<<"B pop valu\n"; cout<<"C the first valu in list\n"; cout<<"D is empty\n"; cout<<"E build queue\n";
cout<<"F print list\n"; cout<<"G print queue\n";
cout<<"H exit\n";
cout<<"selecte:";
scanf("%c",&c);
return c;
}
void main()
{
typedef deque<int> j;
list<int> v;
list<int>::iterator i;
int x;
char c;
do
{
c=option();
switch(c)
{
case 'a':
cout <<"enter number:";
cin >> x ;
v.push_back(x);
cout << endl;
flushall();
break;
case 'b':
if(v.empty())
cout<<"the list empty\n"<<endl;
else
{
v.pop_back();
cout <<"pop form back done\n"<<endl;
}
flushall();
break;
case 'c':
if(v.empty())
cout<<"the list empty\n"<<endl;
else
{
i=v.begin();
cout<<*i<<endl;
}
printf("\n");
flushall();
break;
case 'd':
if(v.empty())
cout<<"the list empty\n"<<endl;
else cout <<"there is somting in the list\n"<<endl;
printf("\n");
flushall();
break;
case 'e':
int numbers;
cout<<"how many number you want in queue:";
cin >> numbers;
j a(numbers,0);
printf("\n");
flushall();
break;
case 'f':
for (i=v.begin(); i != v.end(); ++i)
cout << *i << " ";
cout <<"\n"<< endl;
flushall();
break;
case 'g':
printf("\n");
flushall();
break;
case 'h':
cout <<"bye\n"<< endl;
exit(1);
default :
cout <<"no such option\n"<< endl;
flushall();
break;
}
}while(c!='h');
}
|
|
|
|
|
You need to explicitly scope variables created inside a case statement.
So case 'e' must look like this (with braces) -
case 'e':
{
int numbers;
cout<<"how many number you want in queue:";
cin >> numbers;
j a(numbers,0);
printf("\n");
flushall();
}
break;
|
|
|
|
|
That would be correct, but probably useless.
Veni, vidi, vici.
|
|
|
|
|
thanks very helpful but now i have problem to print (case g)
#include <iostream>
#include <list>
#include <deque>
using namespace std;
char option()
{
char c;
cout<<"A push valu\n"; cout<<"B pop valu\n"; cout<<"C the first valu in list\n"; cout<<"D is empty\n"; cout<<"E build queue\n"; cout<<"F print list\n"; cout<<"G print queue\n";
cout<<"H exit\n";
cout<<"selecte:";
scanf("%c",&c);
return c;
}
void main()
{
typedef deque<int> j;
deque<int>::iterator p;
list<int> v;
list<int>::iterator i;
int x;
char c;
do
{
c=option();
switch(c)
{
case 'a':
cout <<"enter number:";
cin >> x ;
v.push_back(x);
cout << endl;
flushall();
break;
case 'b':
if(v.empty())
cout<<"the list empty\n"<<endl;
else
{
v.pop_back();
cout <<"pop form back done\n"<<endl;
}
flushall();
break;
case 'c':
if(v.empty())
cout<<"the list empty\n"<<endl;
else
{
i=v.begin();
cout<<*i<<endl;
}
printf("\n");
flushall();
break;
case 'd':
if(v.empty())
cout<<"the list empty\n"<<endl;
else cout <<"there is somting in the list\n"<<endl;
printf("\n");
flushall();
break;
case 'e':
{
int numbers;
cout<<"how many number you want in queue:";
cin >> numbers;
j a(numbers,0);
printf("\n");
flushall();
}
break;
case 'f':
for (i=v.begin(); i != v.end(); ++i)
cout << *i << " ";
cout <<"\n"<< endl;
flushall();
break;
case 'g':
for (p=a.begin(); p != a.end(); ++p)
cout << *p << " ";
cout <<"\n"<< endl;
flushall();
break;
case 'h':
cout <<"bye\n"<< endl;
exit(1);
default :
cout <<"no such option\n"<< endl;
flushall();
break;
}
}while(c!='h');
}
|
|
|
|
|
You should really give better descriptions of the errors.
However, in this case, the problem is that a variable has limited scope and case 'g' cannot see it (already destroyed).
You better declare a (using default constructor) before entering the switch block and then populate it in case 'e' .
Veni, vidi, vici.
|
|
|
|
|
You must include stdio (use #include <cstdio> ) in order to use scanf , printf , etc.
Veni, vidi, vici.
|
|
|
|
|
Woa there Tex! Three are the things that jump out at me reading your code:
- switch statement from hell. At least call a function per case statement rather than piling all your code in one place
- mixing cstdio with iostream . Don't do it unless you're an expert. If you are an expert think twice about why you need to mix them.
- don't bother using exit(n); in main . return n; has the same effect.
The error you're getting is going to be something like "initialization of variable is skipped by switch statment." What that means is if someone enters 'f', 'g', 'h' the constructor for a won't be called. The flow of control goes galloping past, jumping over the initialisation of a. In your case this isn't a problem as a isn't used elsewhere. To get around this either stick everything that's currently in a case statement in a function OR use an additional level of scope around your case statement. I'd go for functions personally as scoped cases can get a bit ugly:
case 'e':
{
int numbers;
cout<<"how many number you want in queue:";
cin >> numbers;
j a(numbers,0);
printf("\n"); flushall();
break;
}
break;
Anyway, hope that helps. If not shout and we'll see what we can do to improve our answers.
Edit: Realised that I'd said the wrong set of case statements avoided calling the constructor. Hopefully corrected that now!
modified 29-May-12 6:37am.
|
|
|
|
|
tanks for the comments and sorry about my english
i fix the problem by putting the print function in the same case, my Q is why with the tamplate list i have larg scope and with deque i have to be in the same case ?
|
|
|
|
|
a1_shay wrote: ...and i dont know why.
Neither do we. What is the compiler error you're seeing?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Hi All,
Could anyone tell me how to integrate cxxTest with VS IDE? i am very new for the cxxTest so if you provide the procedure with all steps then it would be appreciable.
i followed the steps given in the link below but its not working. i might be doing some mistake. please help me.
http://morison.biz/technotes/articles/23[^]
I am waiting for ur valuable reply.
Thanks in advance
|
|
|
|
|
Have you got Python[^] installed? Aside from getting a copy of Python the notes looks fairly complete.
|
|
|
|
|
thanks for the reply.
yes i have installed Python 2.7 in my system. Even though not getting runner.cpp file.
|
|
|
|
|
hello guys... I am trying to write a simple library (in C++, for learning purpose) which is platform independent and can run on at least Windows and Linux (Ubuntu/Fedora).
Now I am using VS 2010. Can anyone guide me that how can I use this library on Linux and using which IDE?
Now if this approach has issues, can you guide that which IDE should I use (Eclipse may be?) on windows which will also work on Linux. Thanks for any pointers.
This world is going to explode due to international politics, SOON.
|
|
|
|
|
Gday mate,
I used Eclipse years ago for developing Flex apps and was unimpressed. I picked it up again earlier this year when I played with android development but alas, again I was disappointed by the less than stellar performance. Damn you Java!
I'd be inclined to used Code::Blocks, it's compiled to native code, its available Win / Linux / Mac, 32 & 64 bit, will happily work with about a dozen or more compilers.
Also, without knowing the nature of the library it's impossible to know if this is a consideration or not, however - Code::Blocks has built-in support for using WxWidgets, which vastly eases the development of GUIs that are immediately portable.
It's also quite a small download - ~70MB for the IDE and GCC combined. Certainly worth a look imho.
|
|
|
|
|
Writing a platform independent library is fairly easy - don't use any features of the OS' you're targeting and don't make any assumptions about data sizes, object layout and anything else that the standard says is undefined.
If you're happy developing on Windows then don't bother with an IDE for Linux. Do all your development on Windows, checking at least once a day that everything builds using gcc. When I do cross platform development I use VC++2010 and gcc from mingw to make sure it builds. I've yet to write code I intended to be portable that didn't run on Linux that compiled on gcc from mingw.
For controlling the build I'd suggest one of three things:
- If your library is really small stick the g++ command line in a shell script and run that. Really small is a couple of source files.
- If your library is a bit bigger then write a makefile. mingw comes with two versions of make, both of which have (for simple projects) the same behaviour on Linux. I'd use this for libraries up to about 20 source files that you only want to build and run on a couple of platforms
- If your library is effing huge (10s of source files) and you want it to build and run on just about every Unixy platform on the planet use GNU autotools[^]. This is a set of (rather complicated) but very flexible tools that by writing a couple of simple files lets you build, test and run your code on loads of different platforms. I've used them to run code code I wrote on VC++ for windows on Linux, FreeBSD (both 32 and 64 bit) and Solaris.
Whatever you use I'd suggest eventually looking at the autotools if you ever want to do any cross platform stuff. They're pretty ubiquitous in the GNU world - whenever you ./config a package on Linux you're using them.
Oh, one thing I forgot to mention up top... If you need stuff usually supplied by the OS have a dig around for a library that already does it. Three libraries I use a lot are boost [^](it's a test bed for new libraries that might be standardised one day and has sorts of useful stuff - I've used it for date/time, filesystem support, threads, interprocess comms, shared and unique pointers before were in the standard), OpenSSL [^](all your crypto needs admittedly with the most bent interface you've ever seen) and libcurl [^](everything for HTTP/FTP/GOPHER client development).
|
|
|
|
|
Is there such a thing as a program that watches to make sure another program is running OK, and if it crashes, restarts it?
What is the preferred mechanism by which such a thing would be implemented?
(Not asking for code, just some ideas)
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
This is usually done by having a Windows service that watches over your program.
There are several such programs available - Search for Application Watchdog[^]
Windows from Vista onward also supports Application Recovery and Restart[^] that you can use to have Windows restart your application in case of an unhandled exception.
|
|
|
|