April 25
First. let VC2008E support ATL:
1. copy files from some VC standard or pro edition' installdir VC\include\atlmfc, if it so large, in ;ib\ copy only atl*.lib;
2. put this files in you VC2008e's VC\include\;
3. in VC IDE tools-.options->project and solutions->VC direcories, add include to include, lib to library and src to source;
then you can use ATL in VC9E, but cannot use wizard
Second insall WTL 8.0 to VC9E.
1. in WTL80\AppWiz edit the setup80x.js;
2. change the 8.0 to 9.0;
3. run this script.
then you can use WTL 8.0 now
August 08
I know there's something in the wake of your smile.
I get a notion from the look in your eyes, yea.
You've built a love but that love falls apart.
Your little piece of heaven turns too dark.
Listen to your heart when he's calling for you.
Listen to your heart there's nothing else you can do.
I don't know where you're going and I don't know why,
but listen to your heart before you tell him goodbye.
Sometimes you wonder if this fight is worthwhile.
The precious moments are all lost in the tide, yea.
They're swept away and nothing is what is seems,
the feeling of belonging to your dreams.
And there are voices that want to be heard.
So much to mention but you can't find the words.
The scent of magic, the beauty that's been when love was wilder than the wind.
August 06
今天看到一道題
In C or C++, write a function, with 3 input parameters,
A is a string
B is a string
C is a string
The function should,
1. Search for all instances of B in A,
2. Replace all found instances of B with C,
This should be a complete C or C++ function, NOT a C or C++ program.
在csdn上大家寫出了各種方式-@-可是... 都太復雜了 如
1 :
void replace(char *pInput, char *pOutput, char *pSrc, char *pDst)
{
char *pi, *po, *p;
int nSrcLen, nDstLen, nLen;
pi = pInput;
po = pOutput;
nSrcLen = strlen(pSrc);
nDstLen = strlen(pDst);
p = strstr(pi, pSrc);
if(p)
{
while(p)
{
nLen = (int)(p - pi);
memcpy(po, pi, nLen);
memcpy(po + nLen, pDst, nDstLen);
pi = p + nSrcLen;
po = po + nLen + nDstLen;
p = strstr(pi, pSrc);
}
strcpy(po, pi);
}
else
{
strcpy(po, pi);
}
}
2
Fun(char *A, char *B, char *C)
{
int lenA = strlen(A);
int lenB = strlen(B);
int lenC = strlen(C);
int Count = 0;
int j = 0;
int k = 0;
while ((j < lenA) && (i < lenB))
{
if ( A[j] == B[i] || (A[j] - '32' == B[i]) || (A[j] + '32' == B[i]))
{
j++;
i++;
Count++;
}
else
{
Count = 0;
i = 0;
j = j - i +1;
}
}
if (j >= lenB)
{
pos = i - lenB;
}
for (;pos < lenB&& Count--; pos++)
{
A[pos] = C[k++];
}
}
3
void find_rep(char *a, char *b, char *c)
{
int lena, lenb, lenc;
lena = strlen(a);
lenb = strlen(b);
lenc = strlen(c);
std::cout << "a:\t" << a <<endl
<< "b:\t" << b << endl
<< "c:\t" << c <<endl;
std::cout << "len:\t" << lena << "\t" << lenb << "\t" << lenc << endl;
int i, j, k, sanum;
int istore=0;
for(i=0; i<lena;)
{
sanum=0;
for(j=0; j<lenb&&i<lena;)
{
if(a[i]==b[j]||a[i]+32==b[j]||a[i]-32==b[j])
{
i++;
j++;
sanum++;
}
else
{
i=i-j+1;
j=0;
sanum=0;
}
}
if(sanum==lenb)
{
istore=i-sanum; //orin i
j=0;
for(istore, j; j<lenc; j++,istore++)
a[istore] = c[j];
j=i;//now i
i=i+lenc-lenb; //next i
for(k=i; k<lena+lenc-lenb; k, j++;)
a[k] = a[j];
a[k] = '\0';
lena = strlen(a);
}
}
std::cout << a << endl;
//system("pause");
}
4 最可愛的就是一個哥們了 他寫的代碼好奇怪 號稱用了STL可是....
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <iterator>
using namespace std;
class Comp
{
public:
bool operator()( const char& Elem1, const char& Elem2 )
{
return ToUpper(Elem1) == ToUpper(Elem2);
}
private:
char ToUpper( const char& ch )
{
return ch>='a' && ch<='z' ? ch-'a' + 'A' : ch;
}
};
string SearchAndReplace(const string& src, const string& searchment, const string& replacement )
{
vector<string::const_iterator> idxs;
string::const_iterator it = search( src.begin(), src.end(),
searchment.begin(), searchment.end(), Comp() ) ;
for( ;
it!= src.end();
it=search( it, src.end(),
searchment.begin(), searchment.end(), Comp() ) )
{
idxs.push_back( it );
it += searchment.size();
}
string result;
string::const_iteratorit_s = src.begin();
for ( vector<string::const_iterator>::iterator it = idxs.begin(); it != idxs.end(); ++it )
{
string::const_iterator it_e = *it;
copy( it_s, it_e, back_inserter( result ) );
copy( replacement.begin(), replacement.end(), back_inserter( result ) );
it_s = it_e + searchment.size();
}
if ( it_s != src.end() )
copy ( it_s, src.end(), back_inserter( result ) );
return result;
}
int main()
{
cout<< fun( "aaAbb", "ab", "kkk" ) ;
getchar();
}
當當當當
正確答案在這里
string function(string a, string b, string c)
{
int n = b.size();
int pos = 0;
while( (pos = a.find(b,pos)) != -1)
{
a.replace( pos, n, c );
}
}
August 03
# The readfpl accept a file's path while is fpl(foobar play list),
# and return a list which holds all the file'path
sub readfpl
{
my @files;
my @chunks;
my $index = 0;
open(INPUT, "< $_[0]")
or die "can't open";
@chunks = split(m{file://}, <INPUT>);
foreach(@chunks)
{
if($_ =~ m/.+\.(mp3|wma|m4a)/)
{
$files[$index] = $&;
$index ++;
}
}
print $files[0];
return @files;
}
my @files = readfpl($ARGV[0]);
my $string;
foreach(@files){
$string = $_;
# the next while get name from path
while( substr($string, 1) =~ m{\\.+\.(mp3|wna|m4a)}) {
$string = $ARGV[0].$&;
}
rename $_, string;
}
將這段代碼存為movefpl.pl然后在命令行打入 movefpl.pl 播放列表的全路徑 要存歌曲的新路徑
就可以了呢 呵呵
還能說些什么呢
你又開始說的我非常悲傷了
而你也沒有錯
只是我太沒用
沒有未來
沒有激情
讓你沒有信心
那么
我該怎么做呢
算了
我還記得那句話
你說要走 我不回頭
我
到游泳池里面哭去吧
在哪里
沒有人看得到我流淚