|
CPallini wrote: As it stands, your post is a bit meaningless.
actually, it's not. skew = "when you scanned that document, by how much was the paper rotated?"
|
|
|
|
|
You're guessing the image was a scanned document.
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.
|
|
|
|
|
the typical case is a scanned document. but image skew is a common term, and correcting image skew is a common problem.
|
|
|
|
|
I guess it's too late to answer, but here is a link:
http://www.codeproject.com/KB/graphics/deskewimg.aspx?artkw=deskew image
|
|
|
|
|
you'll need to find an image processing toolkit that can do a Hough Transform.
i don't know of any free ones, but i do know where you can find an inexpensive non-free one...
|
|
|
|
|
Hello,
How to initialize an unsigned char* ?
Prithaa
|
|
|
|
|
You mean something like that?
unsigned char* pTemp = NULL;
|
|
|
|
|
Hello,
I have to use unsigned char* in the following
int retcode = SQLConnect(hdbc1,"MyDSN", SQL_NTS,"sa",
SQL_NTS,"MyPassWord", SQL_NTS);
where the 2nd parameter is an unsigned char*
Now I want something like this
unsigned char* MyDSN = "MyDSN";
but the above definition gives error
so how should I initialize unsigned char*?
Prithaa
|
|
|
|
|
There is an exemple in the documentation[^] (your first reflex should be to open MSDN and read some information there).
If you look at the example, a cast is enough:
int retcode = SQLConnect(hdbc1,(SQLCHAR*)"MyDSN", SQL_NTS,(SQLCHAR*)"sa", <br />
SQL_NTS,(SQLCHAR*)"MyPassWord", SQL_NTS);<br />
|
|
|
|
|
Cedric Moonen wrote: There is an exemple in the documentation[^]
Isn't that hidden?
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->ßRÅhmmÃ<-·´¯`·.
|
|
|
|
|
class A<br />
{<br />
int i;<br />
<br />
public :<br />
A()<br />
{<br />
i = 0;<br />
}<br />
~A()<br />
{<br />
i = 0;<br />
}<br />
};<br />
main()<br />
{<br />
A *obj = new A[0];<br />
if( obj != NULL )<br />
{<br />
delete[] obj;<br />
obj = NULL;<br />
}<br />
}<br />
Above code work well. But when I add virtual keyword to destructor of class then my program crashes.
class A<br />
{<br />
int i;<br />
<br />
public :<br />
A()<br />
{<br />
i = 0;<br />
}<br />
virtual ~A()<br />
{<br />
i = 0;<br />
}<br />
};<br />
main()<br />
{<br />
A *obj = new A[0];<br />
if( obj != NULL )<br />
{<br />
delete[] obj;
obj = NULL;<br />
}<br />
}
Why this crash occurs? If am I doing anything wrong? Or Is there any solution to avoid the crash?
Please help me.
|
|
|
|
|
I can't guess why do you need 0 instances of A , anyway your code executes fine both with and without virtual destructor, on my system (I'm using Visual Studio 2005).
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.
|
|
|
|
|
|
To add to the other replies:
you are allocating an array of zero elements. While this should not crash (but does in VC6 debug builds) it's also not very useful.
Either allocate a single element, using
A * obj = new A;
or allocate an aray of length len :
A * obj = new A[len];
note that in the first case you need to use delete<7code>, in the second, use <code>delete []
|
|
|
|
|
Hi all,
I have few functions which that the arguments are used by reference. Just like this,
<br />
void CDBRecorder::GetFixData(const CRfMessage &Msg, _RecordsetPtr &pRecSet)<br />
{<br />
unsigned __int32 des_list;<br />
unsigned __int32 mem_ID; <br />
unsigned char dm_con; <br />
unsigned char ser_ID; <br />
unsigned short act; <br />
<br />
des_list = Msg.GetDestinationList();<br />
pRecSet->Fields->GetItem("Destination List")->PutValue(des_list);<br />
<br />
mem_ID = Msg.GetSenderID();<br />
pRecSet->Fields->GetItem("Member ID")->PutValue(mem_ID);<br />
<br />
ser_ID = Msg.GetServiceID();<br />
pRecSet->Fields->GetItem("Service ID")->PutValue(ser_ID);<br />
<br />
act = Msg.GetActivityID();<br />
pRecSet->Fields->GetItem("Activity ID")->PutValue(act);<br />
}<br />
<br />
void CDBRecorder::GetMess(const CRfMessage &Msg, _RecordsetPtr &pRecSet)<br />
{<br />
long mLength;
BYTE * mBuffer = NULL;
<br />
mLength = Msg.GetDataLength();<br />
mBuffer = Msg.GetDataBuffer();<br />
<br />
_variant_t vtData;<br />
long nRetLength = 0;<br />
<br />
_variant_t vAppendChunck = BinaryToVariant((BYTE*)mBuffer, mLength, nRetLength);<br />
pRecSet->Fields->GetItem("Bio_Data")->AppendChunk(vAppendChunck);<br />
<br />
vtData.vt = VT_I2;<br />
vtData.iVal = (int)nRetLength;<br />
pRecSet->Fields->GetItem("Bio_Size")->PutValue(vtData);<br />
}<br />
I want to call these two functions inside another function. How can I do that. Where I'm stuck is that about main/parent functions' arguments. How should I use those arguments.
I appreciate your help all the time...
Eranga
|
|
|
|
|
First thing... After the time you are in Forum, you should know about PRE tags for code snippets, it is easier to read (and keep tabulations format).
About your question... One possibility is to call the parent function giving the parameters that are going to be used in the secondary functions. I mean:
void CalledFunction1 (XXX parA, XXX parB)
{
}
;
void CalledFunction2 (XXX parY, xxx parZ)
{
}
;
void ParentFunct (XXX par1, XXX par2, XXX par3, ... , XXX parN)
{
;
;
CalledFunction1 (par2, parN);
;
;
CalledFunction2 (par1, par3);
;
}
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
That mean I can use all the parameters in parent function, in the processing part(i mean inside the function) I can use those parameters properly.
Thanks..
I appreciate your help all the time...
Eranga
|
|
|
|
|
Eranga Thennakoon wrote: I want to call these two functions inside another function. How can I do that.
If the methods are static , just use:
CDBRecorder::GetMess(...); Otherwise, you'll first need a CDBRecorder object:
CDBRecorder r;
r.GetMess(...); Eranga Thennakoon wrote: Where I'm stuck is that about main/parent functions' arguments. How should I use those arguments.
All you need to do is pass a CRfMessage and _RecordsetPtr object.
"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
|
|
|
|
|
DavidCrow wrote: Otherwise, you'll first need a CDBRecorder object:
CDBRecorder r;
r.GetMess(...);
This seems to me fine. But I have a question here. Say I want to use those function on a separate class. So I need to create an object on that class. How should I do that. I mean that should I include my header in the second class or........
I appreciate your help all the time...
Eranga
|
|
|
|
|
I would not create objects everywhere you need something, it may delay your application. I speak from a bad experience: I was making my thesis as my tutor said, bringing everywhere the objects, working with them and updating and it was damm slow. After I end my studies, I totally remade the program working with a centralized document/data module and passing references/pointers, and speed went about 7-8 times faster.
For some times is ok, but if you are planning to do it with lots of objects or with very big objects... I would make it not creating new objects, but telling where the object is to be edited.
BTW, to the intial question, If you are working with references as input parameter in a function you can give a pointer to that parameter as well.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
Actually I feel this bad thing. Working with large number of object, alway a mess up with coding. Anyway thanks for your advice.
I appreciate your help all the time...
Eranga
|
|
|
|
|
If you are working with MFC I recommend you to use the functionality of Doc/View. If not... make your own class "DataStore".
To use the Doc/View from abstract classes derived from CObject you can use the trick I made. Declare a CMyDoc* m_pDoc in the stdafx.cpp. Then in your main view use the OnInitialUpdate () to make:
extern CMyDoc* m_pDoc;
m_pDoc = GetDocument ();
ASSERT (m_pDoc);
and you already have a pointer to go to your document / datastore everywhere in your application. Don't matter if is a view, a dialog or an abstract class.
And about the big objects, take a look into the commentars that I wrote in my article[^], I explain about the data hierarchie I used. Althought it can seem a chaos, with references and pointers was not so difficult and, as I already said, the differrence in speed is quite notable.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
I have a sample project. I need to study this project and I am not able to view the resources of this project. I have the file *.rc of this project too. please tell me how can I view all the resources used by this project ?
keyto_me@yahoo.com
|
|
|
|
|
When you open your project with Visual studio you can use of Resource View for see objects.
|
|
|
|
|
On the Right pane(Explorer), Right Click on the Project workspace name and Select 'Add Files to the Project' option. Then in the dialog, select the required .rc file. By doing so the resource files should get displayed in the tab.
Priya Sundar
|
|
|
|