April 22, 2009

SVN Ruby bindings on Windows

Dan has write a post about how to use the SVN Ruby bindings on Windows. Here is how:
  1. Download the ruby bindings (svn-win32-1.y.z_rb.zip) from the svn site
  2. From the zip - copy ruby\lib\svn into c:\ruby\lib\ruby\site_ruby\1.8\svn
  3. From the zip – copy ruby\ext\svn\ext into c:\ruby\lib\ruby\site_ruby\1.8\svn\ext
  4. copy libeay32.dll and ssleay32.dll from your subversion 1.5 directory into c:\ruby\bin
  5. run irb and test with: require ‘svn/core’

April 3, 2009

10 skills developers will need in the next five years

If you’re a developer looking to get ahead in your field (or in some cases, to simply stay employed), this is not a good time to be complacent. Justin James lists the skills you’ll want to work on now to maximize your future job prospects.
  1. One of the “Big Three” (.NET, Java, PHP)
  2. Rich Internet Applications (RIAs)
  3. Web development
  4. Web services
  5. Soft skills
  6. One dynamic and/or functional programming language
  7. Agile methodologies
  8. Domain knowledge
  9. Development “hygiene”
  10. Mobile development
Here is the Chinese translation for the original article.

March 31, 2009

Clean IE history in command line

RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255

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!