2010年12月2日 星期四

how to write a function return char*


A way to do it is if you really want to return the char *, you could do this:


char* newpwd(char *ptr)
{
char *buf = new char[33];

MD5Data(ptr,strlen(ptr),buf);
printf("%s",buf);
return buf;
}


This will allocate the string on the heap, which lives after the function returns. You'll just have to make sure you do a "delete [] buf;" when you're done with the data, or you will have a memory leak. I'm not sure which way is preferable, but I think this should work.

2010年11月18日 星期四

My Address in English


Foxconn
Allen Lo
CIANJHEN DIST
5F. ,No. 12, FUSING 4TH ROAD
80661 KAOHSIUNG CITY
TAIWAN

2010年10月6日 星期三

Server Backup



1.Mount XP windows share
mount -t cifs -o username="Username",password="Password" //IP/share /mnt/smb
umount /mnt/smb

2.備份Subversion 的repository 並將備份檔傳到要還原的機器上。

*1. svnadmin dump /path/to/project/ >/tmp/project.dump

*2. scp -rp /tmp/project.dump user@192.168.1.1:/tmp/

3.還原Subversion

*1. mkdir -p /path/to

*2. svnadmin create /path/to/project

*3. svnadmin load /path/to/project < /tmp/project.dump

*4. chmod own.own /path/to/project -R

4.備份Mysql

bacup:
mysqldump DATABASE_NAME > SQL_FILE_NAME

restore:
mysql DATABASE_NAME