November 27, 2008

How to convert SVN repository fs type form bdb to fsfs.

To convert bdb repository to fsfs, follow the steps below:

Step 1, stop you svn server to prevent commits.

This is a optional step, if you are sure that there will be no commits during converting.

Step 2, dump from the bdb repository and load to fsfs repository.

using the follow commands if your are using linux-like system.

svnadmin create --fs-type=fsfs fsfs-repo
svnadmin dump repo | svnadmin load fsfs-repo
mv repo backup-repo
mv fsfs-repo repo

November 21, 2008

Windows Batch File Programming Make You Mad!

If you are a programmer from C/C++ or other advanced programming language, you might found that the Windows batch file programming is extremely madding.

Here is a list of the perplexing part of the Windows batch file programming that may make you mad.

Comments

You will find that the Windows batch files starts a comment line by "rem". That is boring! A simple way to start a comment is "::".

:: This is a comment line
:: This is another comment.

Echo a empty line

To echo a empty line, you might think the follow would work.

echo
but it just report echo status. Actually you should use this.
echo.

The if...else...block

The right way to write a if...else...block is.
if exist "a.txt" (
    echo deleting...
    del a.txt
) else (
    echo already done!
)
Note, you must use "(" and ")" here.

How to check if a directory is exist

This code

if exist "path\to\dir" (
    echo Yes
) else (
    echo No
)
will print Yes when a directory or file named "dir" were exist at path "path\to". So you can use this to check a folder's existence. To do so append a "\NUL" at the of the path.
if exist "path\to\dir\NUL" (
    echo Yes
) else (
    echo No
)


The string substitute

To substitute a string, you should use
set VAR=%VAR:str1=str2%
This will replace all str1 in %VAR% with str2, and then assign the result to VAR.

The !VAR! doesn't work


The !VAR! (delayed environment variable expansion) usually don't work for you, because the "delayed environment variable expansion" feature is not enabled by default. You will find this is really boring. There is 2 way to enable the "delayed environment variable expansion", so far as I know.
  • using /V:ON switch to invoke the cmd.exe
  • add a DWORD registry key named DelayedExpansion under HKLM\Software\Microsoft\Command Processor (or HKCU), and set the key value to 1.
I prefer the former:
set TEST=any-string
if not "!TEST!"=="%TEST%" (
    %COMSPEC% /V:ON /C %~dpnx0 %*
    goto :eof
)

:: normal process code here...
The if statement is checking if the "delayed environment variable expansion" if work or not. If no, just call the %COMSPEC% (cmd.exe) with /V:ON and execute this batch itself with the same command line arguments.

The multipurpose for command

To be updated!



August 1, 2008

Google AJAX Search API

Google AJAX Search API - Xpolife

Loading

July 11, 2008

How to update multi-working-copy one time.

AlanTop talk about "How to update multi-working-copy one time." on his blog. I found that is not the most effective way. To update[1] multi-working-copy one time just:
  • If we use TortoiseSVN, just multi-select the top folders of these working copies[2] and the (right click) shell menu -> update (or other commands). That's it.
  • Or, if you use command line, the most powerful effective way.
svn up d:/project01 e:/path/project02 f:/dir/dir2/project03
  1. [1] For commands like commit will not work.
  2. [2] Of course this needs the top folders of working copies are in the same folder due to the windows shell limitation.

June 25, 2008

How to build zlib-1.2.3 with Visual Studio 2005.

To build zlib-1.2.3 with VS 2005 just do this.
"Prepend 'dword ptr' to the second argument of the 'movd' instructions on lines647, 649, 663 and 720 in srclib/zlib/contrib/masmx86/inffas32.asm"(original article)

April 1, 2008

Happy Fool's Day!

When I saw the message "Wikipedia and Blogspot unfreeze in China", I turn to my blogspot blog, It is really the truth. I hope blogspot and wikipedia will never be band again. Wikipedia, one of the world most great information web application, I love it very much. And blogspot, the best blog ware I'v never saw... Anyway, thank G.F.W. Happy Fool's Day!

March 6, 2008

Where do you think Google gets all that Gmail space?

Where do you think Google gets all that Gmail space?

  1. They've found a way to store email in a black hole.
  2. They've tapped into that infinite space behind the fridge and under the rug.
  3. Duh, it's just two iPod shuffles per account.
  4. They googled for it.
  5. They've got all the Gmail accounts hooked up to their Infinite Possibility Drive.
  6. Mmmmm, imagine a Beowulf cluster of planet drives!
Posted by Picasa
(from:The Joy of Tech™)