- Thinking in C++ I&II
- C++ Primer
- Effective C++
- More Effective C++
- Effective STL
- C++ TR1
- Algorithms
- Data Structure
- ...
Showing posts with label programming. Show all posts
Showing posts with label programming. Show all posts
Monday, December 24, 2007
Technical Books List
Saturday, November 10, 2007
Friday, November 9, 2007
string in C++ vs char* in C
The convertion between int, char, char*, string in C/C++.
char* -> int: atoi
int -> char*: itoa, sprintf
char* -> string: string.assign()
string -> char*: string.c_str()
Note: atoi takes only one parameter; itoa takes multiple parameters.
char* -> int: atoi
int -> char*: itoa, sprintf
char* -> string: string.assign()
string -> char*: string.c_str()
Note: atoi takes only one parameter; itoa takes multiple parameters.
Thursday, November 8, 2007
Tokenize a string
Usually people use strtok to tokenize a string. There is a char* delims in this function. However the effect may not as you expected. E.g., assume delims="and", "ya and you and wa" is tokenized as "y you w" instead of "ya you wa".
Here is the solution, thanks to the anonymous coders. I found this via Google.
Here is the solution, thanks to the anonymous coders. I found this via Google.
Fulltext Search in MySQL
There are some points I encountered during my experiements:
1. how to change ft_min_word_len for windows platform: add one line ft_min_word_len = 2 in my.ini file in MySQL installment directory
2. After we changed the ft_min_word_len variable, we have to rebuild the fulltext index by ALTER TABLE person ADD FULLTEXT(name)
1. how to change ft_min_word_len for windows platform: add one line ft_min_word_len = 2 in my.ini file in MySQL installment directory
2. After we changed the ft_min_word_len variable, we have to rebuild the fulltext index by ALTER TABLE person ADD FULLTEXT(name)
Thursday, October 25, 2007
Some points...
1. No recommendation when coding in VS Studio 2005? try to check whether you left some important punctuation, such as ") ] } ; " etc
2. try to use FileWriteTuple(ofstream& ofs, string line) instead of FileWriteTuple(ofstream ofs, string line), just some feeling, no reason.
3. getline(infile, line, '\n') function will also count the line if the last line of the file has an enter return.
4. for checking whether an element exist in a set or not, there is a function named set::count handle it. No need to write your own function.
2. try to use FileWriteTuple(ofstream& ofs, string line) instead of FileWriteTuple(ofstream ofs, string line), just some feeling, no reason.
3. getline(infile, line, '\n') function will also count the line if the last line of the file has an enter return.
4. for checking whether an element exist in a set or not, there is a function named set::count handle it. No need to write your own function.
Subscribe to:
Posts (Atom)