|
Also StretchBlt[^], which has the advantage of definitely being available of any WInCE build, but the disadvantage of using a lousy resampling algorithm.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I have to use skip list to store ~109000 words from a text file.
Here's the code (I'm using Visual C++ 2008):
Struct of the node:
struct SkipNode
{
SkipNode ** forward;
CString mots;
CString longe;
CString pos;
};
Make a new node:
SkipNode* make_node(int level, CString mots, CString pos, CString longe)
{
SkipNode *sn;
sn=new SkipNode;
sn->forward = (SkipNode**)calloc(level + 1, sizeof(SkipNode *));
sn->mots = mots;
sn->pos = pos;
sn->longe = longe;
sn->level=level;
return sn;
}
Insert a node:
void insert(SkipList* ss, CString value, CString pos, CString longe)
{
int i;
SkipNode* x = ss->head;
SkipNode* update[MAX_LEVEL + 1];
memset(update, 0, MAX_LEVEL + 1);
for(i = ss->level; i >= 0; i--)
{
while(x->forward[i] != NULL && x->forward[i]->mots < value)
{
x = x->forward[i];
}
update[i] = x;
}
x = x->forward[0];
if((x!=NULL)&&(x->mots!=value)||(x==NULL))
{
int lvl = random_level();
if (lvl > ss->level)
{
for(i = ss->level + 1; i <= lvl; i++)
{
update[i] = ss->head;
}
ss->level = lvl;
}
x = make_node(lvl, value, pos, longe);
for(i = 0; i <= lvl; i++)
{
x->forward[i] = update[i]->forward[i];
update[i]->forward[i] = x;
}
}
}
My MAX_LEVEL = 17 (log109000).
I read that skip list takes less time to insert a node than some other data structure (O(log n)). So I wonder why I need ~3 minutes to make the skip list above. And when I stop debugging, the program is still running!? I've just started studying programming, please help me!
|
|
|
|
|
Risa Harada wrote: O(log n)
What that defines is how the insertion time grows with n. It does not say that the skip list insertion time is less than the time taken to insert an item into other data structures.
Risa Harada wrote: void insert(SkipList* ss, CString value, CString pos, CString longe)
Risa Harada wrote: SkipNode* make_node(int level, CString mots, CString pos, CString longe)
Pass things like CStrings BY REFERENCE. In this case, by const reference:
void insert(SkipList* ss, const CString & value, const CString & pos, const CString & longe)
SkipNode* make_node(int level, const CString & mots, const CString & pos, const CString & longe)
Other data structures probably have better characteristics for this
- vectors are nice because they've been optimised - it's generally reckoned that if you're going to be reading from and searching in your data structure a lot, you're best off using a vector, sorting it and using std::lower_bound to search.
- std::map or std::set has probably been better optimised
- A trie[^] or alternatively a ternary search tree[^] is generally reckoned to be good for storing words
HTH
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thank you so much I'll try it out. My professor asked me to use skip list to make a dictionary, so I don't have any other choice.
|
|
|
|
|
Hi,
I am getting a string from the server , and doing following operation to get the BYTE format of that
string key;
This variable contains the value, which I received from server.
BYTE key1[24] = {0};
DWORD dwBase64Size;
CryptStringToBinary(key,0,CRYPT_STRING_BASE64,0,&dwBase64Size,0,0);
if (dwBase64Size>24)
return "";
CryptStringToBinary(key,0,CRYPT_STRING_BASE64,key1,&dwBase64Size,0,0);
This function is working fine for WINXP, but fails on Win2K, as it does not allow the dll to get registered.
In the same way the prolem is with CryptBinaryToString also.
can you suggest a alternate of this code, which works on WIN2K.
Thanks
Vineet Kumar Singhal
Sr.Software Engineer
Mumbai
Tough Time Never last, but Tough People do.
|
|
|
|
|
Why don't you try to build 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]
|
|
|
|
|
Hi,
I was playing with edit control,
after entering a number
Accidentally i pressed CTRL + SHIFT keys.
This sent the text to right align..
How to over come this.. 
|
|
|
|
|
Goto Edit box Properties select styles. you can see a combo box. change it per your needs.
|
|
|
|
|
Keeping the property to align left.
On debugging if we press ctrl+shift together,
the text will shift to right align.
|
|
|
|
|
are you asking a question?
If its a question, then i don't think if you press SHIFT + CTRL during debug the text will shift to right align
|
|
|
|
|
It will shift..
try ur self
|
|
|
|
|
Dear,
Below are the steps i followed to create the problem.
1. Created the simple dialog based app. And placed the editbox control in dialog.
2. style align property of the editbox is set as left.
3. Run the app in debug mode.
4. enter some text in edit box.
5. press ctrl + shift keys as u mentioned . The text remains at the same place ie left . ie no shift .
Hope u have tried it in VC 6.0 and if there is any change in our approach kindly reply back.
|
|
|
|
|
your approach is correct
if u have set the property to left align then.
while debugging you need to press right side ctrl+shift(near to arrow keys)
this will surely shifts the cursor to right side.
once it is in right side if u press left side ctrl+shift
it comes to left..
Plz try again and reply
|
|
|
|
|
hallo, how can i blind out Effects, color, Script, underline , struck through in CFontDialog?
i used this code but it did not work:
CFontDiaolg m_cfdlg;
m_cfdlg.m_nFlags |= ~CF_EFFECTS; // did not help
m_cfdlg.m_cf.Flags |= CF_NOSCRIPTSEL;// only disabled but not blind out
|
|
|
|
|
It should be
m_cfdlg.m_nFlags &= ~CF_EFFECTS;
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
thanks for the answer but it did not work.
|
|
|
|
|
The fact that it did not work could be related to the flag not being the right one.
The example shows the following.
Assume the m_nFlags variable currently contains the value 0x99999999.
Further assume the CF_EFFECTS field is the value 1.
To remove CF_EFFECTS from the m_nFlags variable,
Do a bitwise NOT of the CF_EFFECTS.
~CF_EFFECTS will give the value 0xFFFFFFFE.
AND ing m_nFlags and ~CF_EFFECTS will now give you 0x99999998, which is then re-assigned back to m_nFlags.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Thanks alot ist worke, but i still have another problem with the script element:
m_cfdlg.m_cf.Flags |= CF_NOSCRIPTSEL; // Disabled but not blind out the script element
m_cfdlg.m_cf .Flags &= ~CF_SHOWHELP; // Disabled the Help Button, but the Question mark in the Dialog still showed.
|
|
|
|
|
I am building legacy application in VS2008 solution. I have the followng lines in my code
template <class MapType, class DestinationType = MapType::referent_type>
class MapCopy
{
public :
typedef DestinationType destination_type;
typedef typename MapType::value_type source_type;
static HRESULT copy(destination_type* pTo ,source_type *pFrom)
{
}
on building this project i am getting the following error
error C2664: copy' : cannot convert parameter 2 from 'const std::pair<_Ty1,_Ty2> *' to 'std::pair<_Ty1,_Ty2> *' C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\atlmfc\include\atlcom.h
How to getrid of this error?
Regards
|
|
|
|
|
subramanyeswari wrote: How to getrid of this error?
Check this page for details on Compiler Error C2664[^]
Possible solutions specified in MSDN
1. Recheck the prototype for the given function and correct the argument noted in the error message.
2. Supply an explicit conversion if necessary.
|
|
|
|
|
Could it be as simple as adding the "const" declaration to the second type?
|
|
|
|
|
In my multilingual application, there are some texts on the button in image form. How can I convert those texts in different languages?
I have created resource DLLs for all static strings.
Please help me with this problem.
Thank You
|
|
|
|
|
Purish Dwivedi wrote: Please help me with this problem.
Here is a good article[^] from Codeproject.
|
|
|
|
|
Thanks for the reply Madhu,
But there is nothing about the text incorporated in images?
I don't know how to convert those images or text in those images?
Can u help me to sort out this problem?
|
|
|
|
|
Purish Dwivedi wrote: I don't know how to convert those images or text in those images?
If you have the texts which can be shown as per the language changes, why do you load the bitmaps ? Is that an overhead and a performance degrader ?
Sorry! I was too late to know that you where here for a bit long time with the same multilingual application[^] ...
Let me clarify the problem; You have a background bitmap and you want to draw the strings[^] over it ?
Why can't you try a transparent static control[^] to hold this texts ?
Best of luck with the Multilingual application development.
|
|
|
|