|
i think it's because you shouldn't do someone's homework, at least, not entierely. Moreover, you don't even use any of the formating html tags, so your message looks a little ugly...
by the way, it's just my feeling, i don't know the voter's reason though
|
|
|
|
|
I appreciate your comments and I have learned something from them. I have been beaten up physically (survived a t-bone auto accident) and mentally (depressed about becoming a senior). Sometimes, I question why I should even attempt to post replies here.
Thanks,
Geo
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
George L. Jackson wrote: Sometimes, I question why I should even attempt to post replies here
i wonder the same sometimes. but if you know your presence here is worth it, then don't care about the low rates, there will always some other ones to pull your messages up.
keep it up George. i've seen you to be a good member of the Managed C++ forum.
but try to follow the posting guidelines, especially when you post code samples (the <pre></pre> tag is dedicated for that). also, always think about the interrest of the OP. if a student is asking for a code, even though you can write it in a flashlight, would you do it, or try to convince him to listen at his teacher and try himself to do his homework ? one will never learn anything if no effort is supplied...
|
|
|
|
|
I get down on myself at times but I usually snap out of it! Any way, Rodney Dangerfield made a career on "no respect".
I did break the tutoring ethics by supplying code rather than supplying informative suggestions. For that, I slap my own hand. Ouch!
I will make an attempt to create beautiful example code. For, if it looks ugly, it may run ugly.
Thus, on this day of becoming a senior, I will bring forth an effort to be a better poster. I feel rejuvenated already!
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
This one is even better. This will work with more types.
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
using std::wcout;
using std::endl;
using std::vector;
using std::sort;
using std::less;
template <typename It, typename Pred>
class dereference_predicate : public std::binary_function<It, It, bool>
{
public:
dereference_predicate() {}
dereference_predicate(const Pred &pred) : pred(pred) {}
bool operator()(const It &a, const It &b) const
{
return pred(*a, *b);
}
private:
Pred pred;
};
typedef dereference_predicate<int*, less<int>> pint_less;
typedef vector<int*> pint_vctr;
typedef pint_vctr::iterator pint_iter;
int _tmain(int argc, _TCHAR* argv[])
{
int values[] =
{ 4, 2, 3, 5 };
size_t count = sizeof(values)/sizeof(values[0]);
pint_vctr values_vctr;
for (size_t i = 0; i < count; ++i)
{
values_vctr.push_back(values + i);
}
pint_iter begin = values_vctr.begin();
pint_iter end = values_vctr.end();
less<int> less_than;
pint_less dp(less_than);
sort(begin, end, dp);
for (pint_iter i = begin; i != end; ++i)
{
size_t index = *i - values;
wcout
<< L"values["
<< index
<< L"] = "
<< values[index]
<< endl;
}
return 0;
}
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
if i have understood your problem correctly, then here is the solution.
while sorting the first array, perform the swapping of the elements in the second array also.
means, the items in hte second array need not be sorted right?
but there will always be one to one mapping among both the arrays.
if my post didnot answer you,
then please explain your task a bit clearer.
|
|
|
|
|
I have two .NET 2.0 components:
Component A was purchased from a third-party with a license that they generated based on SNK file that we provided.
Component B we implemented that tries to use component A. It is signed with the same SNK file, and also exposes its interface via COM interoperability.
Now, if I try to use component B from a .NET application, then the license verification for component A fails until I sign my .NET application with the same SNK file, and then it’s fine.
The problem is that the same logic doesn’t work if I try to use component B from a C++ application via COM. My C++ application is unmanaged, written under VS2005SP1. In the project settings I tried to put my SNK file into Configuration Properties->Linker->Advanced->Key File, but to no avail. The way I see it, this option is only applicable to assemblies, which my C++ doesn’t even have.
Question: How do I sign my C++ application with the given SNK file in my case, so that license of component A works just as it does in my .NET application?
Free C++ libraries with source code on www.neatcpp.com: TWAIN, DirectShow, Interprocess Communications, etc...
|
|
|
|
|
Can anyone please let me know the way by which i can implement a custom PrintScreen program for capturing a movie scene ?
Print screen button doesnot capture the movie window contents.
|
|
|
|
|
My friend Google knows[^], he even refers you to CodeProject articles!
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
In a program I've been working on for a while now I've started to have a weird debugging problem. When I hit a breakpoint and start stepping into other methods the debugger will take me to the middle of other methods instead (looking at the call stack the way I've reached the breakpoints is also incorrect, i.e. button click events been called randomly instead of when the user clicks the button). Has anyone came across this before?
I've done the usual of doing a clean rebuild, shutting the machine down, swinging round on my chair whilst counting backwards from 100.....
I'm working within Studio 2003.
TIA
|
|
|
|
|
i hope u have tried deleting the files in debug folder(should not leave any file).Then recompile the program.remove all th breakpoints and do start from first...
|
|
|
|
|
It sounds like the .PDB file is out of sync.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Actually, the problem is probably a corrupted .ncb file.
Close the project, then delete the .ncb file and also delete any .aps or .clw file that may exist. Then reopen the project and you'll probably be OK.
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
Hi all, thanks for al of your replies. I tried all of them with no success and then finally found the answer on the MS Support site
http://support.microsoft.com/?id=328784[^]
This has fixed my problem and I think the problem crept into my program when I integrated some code that someone I work with wrote in a text editor (he switches between Linux and Windows) so this seems the likely culprit.
Thanks all again,
Andy
|
|
|
|
|
If there is? Can you give me quick overview?
cheers
Simon
|
|
|
|
|
|
|
John Schroedl wrote: Requres VS05sp1 to already be installed.
I'd add that you also need a Windows Live ID or a Passport account. So technically it's not been released to the public at large like SP1.
|
|
|
|
|
Chris Meech wrote: you also need a Windows Live ID or a Passport account
It's all part of Their plan...soon we will ALL have our Live(tm) ID implants
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I'll not bow to the oppressor.
|
|
|
|
|
In my MFC application i am reading remote directory of a unix system, using CFtpFileFind class it returns the file names along with times but the seconds field is always zero, here is the code
CFtpFindFile finder .......
..........
..........
CTime ct;
..........
..........
finder.GetLastWriteTime(ct);
int hour = ct.GetHour(); // fine
int min = ct.GetMinute(); // fine
int secs = ct.GetSecond(); // always zero on unix sys
//its not zero
Please help why its so, or there is some other method to read seconds.
Thanks in advance
|
|
|
|
|
I think you'll have to show some more code. It's not clear how you have actually 'found' any file since there has to be at least one call to FindNextFile. Also, I'd check the return value of GetLastWriteTime() just to be sure that it returns TRUE.
|
|
|
|
|
Did you check your unix system records file times with better than 1 minute resolution?
just log in and use some interactive commands such as "ll".
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Hello everyone,
I read MSDN document about reserve method of vector, but I can not find answers to the following 2 questions after reading it,
1. if we reserve 10,000 size, will the memory actually be occupied 10,000 size (like committed memory of Windows Virtual Memory management) or the memory will just be reserved for future use (like reserved memory of Windows Virtual Memory management);
2. Will reserve method of vector improve performance? If yes, could anyone share some experiences please?
If reserve method has any additional benefits beyond performance, please also let me know.
thanks in advance,
George
|
|
|
|
|
George_George wrote: 1. if we reserve 10,000 size, will the memory actually be occupied 10,000 size (like committed memory of Windows Virtual Memory management)
Yes.
George_George wrote: 2. Will reserve method of vector improve performance?
It may if you are adding elements at the end.
|
|
|
|