|
i stepped through each line with less data points, am sure it has to do with the amount of data
am processing but i don't know else to go about memory allocation.....
|
|
|
|
|
Oh that might be the problem. Why not use same dataset in both cases?
Also when you let the program run and it show the error dialog if you click on retry then it will take you to the line at which crash occurs. If you look at the stack trace then you might be able to find the offending code line.
-Saurabh
|
|
|
|
|
i used the smaller set to make sure my algorithm was right. when the unhandled exception msg box appears, i click on OK and takes me
some kind of assembly code: 7C812AFB pop esi.......i really don't know how to debug this
|
|
|
|
|
In just a manner of minutes, you could have narrowed the problem down to just:
void main( void )
{
vector<_variant_t*> Filtered_Average(9995);
for(unsigned int k = 0; k < Filtered_Average.size(); ++k)
Filtered_Average[k] = new _variant_t();
for(k = 0; k < Filtered_Average.size(); ++k)
{
_variant_t *m = Filtered_Average[k];
delete [] m;
}
} Hint: two extra characters are causing you grief.
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
At first look, I thought you had 'deleted' the hint.
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
|
|
|
|
|
expression ?
do you mean exception ?
if you're getting an unhandled exception, the easiest way to find out what it is is to.. handle it.
try
{
... do something
}
catch (CException *e)
{
e->ReportError();
}
|
|
|
|
|
I have just realised that the exception occurs in the block of code:
it comes up after running for sometime...
pRange = pSheet->GetRange( _bstr_t("A3"), _bstr_t("CQ9990") );<br />
<br />
for ( int iRow = 1;iRow <= N; iRow++)<br />
{<br />
for (int iColumn = 1; iColumn < N2; ++iColumn )<br />
{ <br />
_variant_t vItem = pRange->Item[(long) iRow ][ (long) iColumn];<br />
_bstr_t bstrText( vItem );<br />
raw_data[iRow][iColumn] = vItem;<br />
<br />
}<br />
}
|
|
|
|
|
Hi all,
i have two CUIntArray,i want to merge it and generate new CUIntArray,
but want no comman values are inserted in new array.
help me for this.
|
|
|
|
|
Le@rner wrote: but want no comman values are inserted in new array
And... what do you want ?
(could you write some formula, like: C[i] = A[i] | B[i] ?)
virtual void BeHappy() = 0;
|
|
|
|
|
i want if A[i]={a,c,e,d}
and B[i]={a,c,f,g}
than result is C[i]={a,c,d,e,f,g}
|
|
|
|
|
If the array are sorted (like the sample posted) then your task is almost trivial.
[added]
OK, I see array A is actually NOT ordered.
What is your requirement about?
[/added]
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
modified on Friday, April 9, 2010 8:30 AM
|
|
|
|
|
A (maybe needed to be optimized) version :
void ProcessMerging(CUIntArray* pcaResult,
const CUIntArray& caFirst,
const CUIntArray& caSecond)
{
if (pcaResult) {
pcaResult->RemoveAll();
int iFirstSize(caFirst.GetSize()),
iSecondSize(caSecond.GetSize()),
iMaxSize(max(iFirstSize, iSecondSize));
for (int i = 0; i < iMaxSize; i++) {
bool bFirstPresented(i < iFirstSize),
bSecondPresented(i < iSecondSize);
if (bFirstPresented) {
pcaResult->Add(caFirst[i]);
if (bSecondPresented &&
caFirst[i] != caSecond[i]) {
pcaResult->Add(caSecond[i]);
}
} else {
pcaResult->Add(caSecond[i]);
}
}
}
}
virtual void BeHappy() = 0;
modified on Friday, April 9, 2010 7:27 AM
|
|
|
|
|
I guess it doesn't work even for sorted arrays (I suppose you should use two different indices).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Right, now it is a "per-index merging" only...
virtual void BeHappy() = 0;
|
|
|
|
|
The following function works (at least I suppose it does...) with increasing-ordered arrays (without duplicate items):
void MergeArrays(CUIntArray & l, CUIntArray & r, CUIntArray & o)
{
int il = 0, ir = 0;
int lcount, rcount;
lcount = l.GetCount();
rcount = r.GetCount();
o.RemoveAll();
for (;;)
{
if ( il == lcount)
{
if ( ir == rcount) return;
o.Add(r[ir]);
ir++;
}
else
{
if ( ir == rcount)
{
o.Add(l[il]);
il++;
}
else
{
if (l[il] < r[ir])
{
o.Add(l[il]);
il++;
}
else if (l[il] > r[ir])
{
o.Add(r[ir]);
ir++;
}
else
{
o.Add(l[il]);
il++; ir++;
}
}
}
}
}
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
modified on Friday, April 9, 2010 9:14 AM
|
|
|
|
|
Are the arrays increasing ordered ? :
l{0,0,3}
r{0,1,4}
virtual void BeHappy() = 0;
|
|
|
|
|
Yes, they have duplicates though.
If you see my latest precondition...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
It would exclude the duplicates :
void AddTail(CUintArray* pcArray, UINT uiNew)
{
if (pcArray) {
int iCount(pcArray->GetCount());
if (!iCount ||
pcArray[iCount -1] != uiNew) {
pcArray->Add(uiNew);
}
}
}
virtual void BeHappy() = 0;
|
|
|
|
|
I prefer the precondition, since it makes the merge function acting on homogeneus arguments.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CUIntArray does not provide a 'Merge ' method hence you have to write your own.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
One possibility would be to merge them together, and then use std::unique() with erase() . Without actually trying it, however, I can't say for sure.
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Good idea, unfortunately the OP chose an MFC class.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Which is why I used the word possibility. It would require him to get the contents of the CUIntArray moved to an STL container first.
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Yes, it is a nice idea. My 'unfortunately' was in fact a subtle suggestion (too subtle, I guess) to discard the MFC class.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Another class from the same header :
void ProcessMerging(CMap<UINT,UINT,UINT,UINT>* pcResult,
const CUIntArray& caFirst,
const CUIntArray& caSecond)
{
if (pcResult) {
pcResult->RemoveAll();
int iFirstSize(caFirst.GetCount()),
iSecondSize(caSecond.GetCont()),
i(0);
for (i = 0; i < iFirstSize; i++) {
pcResult->SetAt(caFirst[i], 0);
}
for (i = 0; i < iSecondSize; i++) {
pcResult->SetAt(caSecond[i], 0);
}
}
}
virtual void BeHappy() = 0;
|
|
|
|