Click here to Skip to main content
15,912,329 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionSecure IPC Pin
Chintoo72327-Oct-05 5:59
Chintoo72327-Oct-05 5:59 
AnswerRe: Secure IPC Pin
ThatsAlok27-Oct-05 22:25
ThatsAlok27-Oct-05 22:25 
QuestionWhat's this? Pin
Le Sourcier27-Oct-05 5:41
Le Sourcier27-Oct-05 5:41 
Question Hash string function that keeps compare properties Pin
Kochise27-Oct-05 5:27
Kochise27-Oct-05 5:27 
AnswerRe: Hash string function that keeps compare properties Pin
Chris Losinger27-Oct-05 7:30
professionalChris Losinger27-Oct-05 7:30 
GeneralRe: Hash string function that keeps compare properties Pin
Kochise27-Oct-05 21:17
Kochise27-Oct-05 21:17 
GeneralRe: Hash string function that keeps compare properties Pin
Chris Losinger28-Oct-05 1:17
professionalChris Losinger28-Oct-05 1:17 
GeneralRe: Hash string function that keeps compare properties Pin
Kochise28-Oct-05 3:06
Kochise28-Oct-05 3:06 
I already tried this way, but I have many strings that starts with the same characters. So I'm trying to create a kinda dictionary of the whole strings, and find the good one the most quickly possible through the use of integer. I could have used tries as well, I think I'm going to test this.

The following code match "TEST" and "TEST TEST" as being the same string, even if I stuff things of 16 characters. Maybe I'm wrong...

void CStringTree::_EncodeString
( sMSP&       o_rsStringPointer
, const char* i_panStringBuffer
, int         i_nStringSize // = -1
)
{
  double        l_nShifter = 79228162514264337593543950336.0; // 64^16
  int           l_nLoop = 16;
  int           l_nSize;
  unsigned char l_nChar;
  if
  (
       (i_nStringSize < 0)
    || (i_nStringSize > 16)
  )
  {
    l_nSize = 16;
  }
  else
  {
    l_nSize = i_nStringSize;
  }

  o_rsStringPointer.nHashRaw    = 0.0;
  o_rsStringPointer.nHashCase   = 0.0;
  o_rsStringPointer.nHashNoCase = 0.0;

  while(l_nLoop > 0)
  {
    l_nChar = *i_panStringBuffer;

    if
    (
         (l_nSize == 0)
      || (l_nChar == 0)
    )
    { // Stuffing
      o_rsStringPointer.nHashRaw    += ' ' * l_nShifter;
      o_rsStringPointer.nHashCase   += ' ' * l_nShifter;
      o_rsStringPointer.nHashNoCase += ' ' * l_nShifter;
    }
    else
    {
      o_rsStringPointer.nHashRaw    +=             l_nChar  * l_nShifter;
      o_rsStringPointer.nHashCase   += g_panNormal[l_nChar] * l_nShifter;
      o_rsStringPointer.nHashNoCase += g_panNoCase[l_nChar] * l_nShifter;

      i_panStringBuffer += 1;
    }

    l_nShifter /= 64;
    l_nLoop    -= 1;
    l_nSize    -= 1;
  }
}


Kochise

In Code we trust !

-- modified at 9:06 Friday 28th October, 2005
QuestionHow to pass a parm to iexplorer? Pin
mcgahanfl27-Oct-05 5:24
mcgahanfl27-Oct-05 5:24 
AnswerRe: How to pass a parm to iexplorer? Pin
BlackT27-Oct-05 5:29
BlackT27-Oct-05 5:29 
QuestionText Rotation - VC 6.0 Pin
BlackT27-Oct-05 4:17
BlackT27-Oct-05 4:17 
AnswerRe: Text Rotation - VC 6.0 Pin
Mircea Puiu27-Oct-05 7:23
Mircea Puiu27-Oct-05 7:23 
Questionquestion with the MFC documentation Pin
ewighell27-Oct-05 3:39
ewighell27-Oct-05 3:39 
AnswerRe: question with the MFC documentation Pin
Maximilien27-Oct-05 3:52
Maximilien27-Oct-05 3:52 
AnswerRe: question with the MFC documentation Pin
Chris Losinger27-Oct-05 3:55
professionalChris Losinger27-Oct-05 3:55 
AnswerRe: question with the MFC documentation Pin
toxcct27-Oct-05 3:58
toxcct27-Oct-05 3:58 
QuestionRe: question with the MFC documentation Pin
David Crow27-Oct-05 4:49
David Crow27-Oct-05 4:49 
AnswerRe: question with the MFC documentation Pin
ewighell27-Oct-05 5:02
ewighell27-Oct-05 5:02 
AnswerRe: question with the MFC documentation Pin
ewighell27-Oct-05 5:05
ewighell27-Oct-05 5:05 
QuestionHow to kill a thread ??? Pin
vikas amin27-Oct-05 2:21
vikas amin27-Oct-05 2:21 
AnswerRe: How to kill a thread ??? Pin
David Crow27-Oct-05 2:32
David Crow27-Oct-05 2:32 
AnswerRe: How to kill a thread ??? Pin
ThatsAlok27-Oct-05 22:40
ThatsAlok27-Oct-05 22:40 
QuestionWritePrinter API seems Good but Behave Difficult Pin
AsimUmair27-Oct-05 1:27
AsimUmair27-Oct-05 1:27 
QuestionRe: WritePrinter API seems Good but Behave Difficult Pin
David Crow27-Oct-05 2:38
David Crow27-Oct-05 2:38 
AnswerRe: WritePrinter API seems Good but Behave Difficult Pin
AsimUmair28-Oct-05 0:04
AsimUmair28-Oct-05 0:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.