|
It works now.
Stingray should be compiled as MFC Dll Stingray dll and project settings should indicate that these libraries should be used.
Something like _SFLDLL, _OVDLL.... in preprocessor definition should be put
|
|
|
|
|
|
I use
vector<string> to save a huge file
Each item maybe a word or a sentence
but
vector<string> cost too many memory
eg:
20M file cost 200M+ memory
How can I reduce memory using???
Thanks
Techie York
|
|
|
|
|
How about holding the file in a buffer then storing pointers to word beginning & end in the vector:
char* fileBuffer = new char[fileSize];
typedef std::pair<const const=""> Word;
std::vector<word> words;
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
|
bcoide
Thank you for your share
but I deal with different language
Full Text Search
The vector saves the result of segment
so use string is convinient
but vector's memory grows so fast and huge
a 20M file's result can cost 200M memory
that a waste!!
thank you
maybe I need another idea!
|
|
|
|
|
It's like this
vec[0] = "you";
vec[1] = "friend";
vec[2] = "你好";
vec[3] = "朋友";
I use
vector<string> to hold word and build index to search
If I save pointer
The speed of building index maybe not so fast
because I deal with Chinese and English together
I have to consider the speed
but the cost of memory is so big
I wanna find a way on balance
Thank you so much
|
|
|
|
|
If you had
wchar_t fileBuffer[] = "youfriend你好朋友";
You could have:
typedef std::pair<wchar_t*,> Word;
std::vector<word> words;
words.push_back(std::make_pair(fileBuffer, fileBuffer+3);
words.push_back(std::make_pair(fileBuffer+3, fileBuffer+9);
words.push_back(std::make_pair(fileBuffer+9, fileBuffer+11);
words.push_back(std::make_pair(fileBuffer+11, fileBuffer+13); ?
That could be less overhead than std::string, possibly.
Alternatively, you could use something like a trie[^] to hold all the words?
What's the intent, anyway - why are you building this list of words?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I am doing a program about Full Text Search
English is easy to segment
but Chinese is complicated
First I should separate text that to make Chinese and English text to two vector
Second do segment to each text and building index for search
I have to consider about speed ,the size of index file and Search speed
some difficulty I've already solved
I wanna do it well
Thank you so much
|
|
|
|
|
Have a feeling that it is caused by the automatic growth of strings / vector.
You can use swap to trim the vector to minimum size. Guess the same thing should be possible with strings.
vector<string>(trim).swap(trim);
Herb Sutter: The Incredible Shrinking vector
It is even better to resize the strings / vectors to their expected size from the start.
|
|
|
|
|
Yes
That's the problem
I'll try later
Thank you so much for your advise
|
|
|
|
|
Suppose that we've defined (for example) OnAppAbout() function in CMyAppView to be called when the user clicks the About item from Help menu. Now if we define it in both CMainFrame and CMyAppDoc as well, which of them is called when the user clicks the menu item?
|
|
|
|
|
Why don't you try it & see? It's not like you can break anything...it's just software.
This article[^] by Paul DiLascia (RIP) could also help.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I wonder if is there a way to change the size and position of a CView derived window within a SDI application? If not why?
|
|
|
|
|
Isn't the view size going to be tied to the main frame size in an SDI app?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
|
OK - first hit for "SDI resize view" on Google is this CodeProject article[^] - does that help?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi,,
I need this info.
I am interacting with MSMQ using VC++.
I am able to send messages. But i am not able to send really really large messages, really close to 4 MB but not more than that.
I guess the issue here is not with MSMQ, but to convert CString to wchar_t*.
I am using this code,
int length = data.GetLength(); // data is CString
USES_CONVERSION;
wchar_t *pwcharMessageBody = T2W(data.GetBuffer()); //stack overflow,This line fails for large string
data.ReleaseBuffer();
This is working for most cases. But not working for very large string size.
Any help will be great.
Thanks,
Saleem
|
|
|
|
|
Use MultiByteToWideChar with a large buffer.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
If you want to stick with the handy ATL conversion mechanisms, and you're using Visual Studio 2003, 2005 or 2008, check out this page[^] and use a CT2W object - you should just be able to add a C to your current T2W usage.
The Cx2y objects default to using an internal buffer for 64 byte strings, but allocate a buffer with malloc for larger strings, which is probably just what you want.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thanks,,,but there seems to be a problem.
Code compiles fine.
But the wchar_t* is blank.
this is my code....
wchar_t *pwcharMessageBody = CT2W(data);
tried this too..
wchar_t *pwcharMessageBody = CT2W(data.GetBuffer());
No luck.
Any help will be great.
Saleem
|
|
|
|
|
Ah - that's because the CT2W object goes out of scope.
Try this:
CT2W pwcharMessageBody(data);>/pre>
A CT2W has a string conversion operator, it's just that now that the lifetime of pwcharMessageBody defines the conversion buffer lifetime.
<div class="ForumSig">Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p</div>
|
|
|
|
|
Actually it is a limit in MSMQ, so there is no problem in converting large char-arrays.
Sending MSMQ Messages larger than 4 Mb. causes exception
You either have to chop the message up in smaller pieces, or maybe perform compression before sending to MSMQ (Requires the opposite part is able to decompress the message again).
|
|
|
|
|
Hi there.
While using a component, I ma getting above mentioned error message.
Just FYI, I have included .lib file under Linker/Inputs/Additional Dep... section. Also, have copied .dll file amd have also added .h file under the project.
Any pointers/suggestions will be highly appretiated.
Thanks
Pankaj
|
|
|
|
|
I guess the error message in the subject line is not complete.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|