Oct 27, 2008
Oct 26, 2008
Top Technology Trends for 2009
These are Top Technology Trends for 2009
- Virtualization
- Cloud computing
- Servers
- Web-oriented architectures
- Enterprise mashups
- Specialized systems
- Social software and social networking
- Unified communications
- Business intelligence
- Green IT
What do you think? :-)
Oct 23, 2008
How to Disable Steal Lock in Subversion
In Subversion, you can easily steal the lock that other user lock it. By using hook script, you can disallow user to do so. Just edit the pre-lock script as following
pre-lock.bat
The following is the content of pre-lock.bat which will work on Windows environment. Just copy the content and put it under the hook folder of your Subversion repository
@ECHO OFF
:: Set all parameters. Even though most are not used, in case you want to add
:: changes that allow, for example, editing of the author or addition of log messages.
set repository=%1
set rev_path=%2
set userName=%3
:: If a lock exists and is owned by a different person, don't allow it
:: to be stolen (e.g., with 'svn lock --force ...').
FOR /F "delims=: tokens=1*" %%a IN ('svnlook lock "%repository%" "%rev_path%"') DO if %%a==Owner (set LOCK_OWNER=%%b)
:: If we get no result from svnlook, there's no lock, allow the lock to
:: happen:
if "%LOCK_OWNER%"=="" (
exit /b 0
)
:: If the person locking matches the lock's owner, allow the lock to
:: happen:
if "%LOCK_OWNER%" = " %username%" (
exit /b 0
)
:: Otherwise, we've got an owner mismatch, so return failure:
echo "Error: %rev_path% already locked by %LOCK_OWNER%." >&2
exit /b 1
pre-lock.bat
The following is the content of pre-lock.bat which will work on Windows environment. Just copy the content and put it under the hook folder of your Subversion repository
@ECHO OFF
:: Set all parameters. Even though most are not used, in case you want to add
:: changes that allow, for example, editing of the author or addition of log messages.
set repository=%1
set rev_path=%2
set userName=%3
:: If a lock exists and is owned by a different person, don't allow it
:: to be stolen (e.g., with 'svn lock --force ...').
FOR /F "delims=: tokens=1*" %%a IN ('svnlook lock "%repository%" "%rev_path%"') DO if %%a==Owner (set LOCK_OWNER=%%b)
:: If we get no result from svnlook, there's no lock, allow the lock to
:: happen:
if "%LOCK_OWNER%"=="" (
exit /b 0
)
:: If the person locking matches the lock's owner, allow the lock to
:: happen:
if "%LOCK_OWNER%" = " %username%" (
exit /b 0
)
:: Otherwise, we've got an owner mismatch, so return failure:
echo "Error: %rev_path% already locked by %LOCK_OWNER%." >&2
exit /b 1
Enable Edit Log Message in Subversion
In Subversion, when you commit the changeset, you're not allow to edit the log message but the SVN admin with svn-admin command.
To enable it to user, you (the SVN admin) must enable the pre-prop-change hook
pre-prop-change.bat (Windows)
Here is the content of pre-prop-change hook, just save it to pre-prop-change.bat and copy it into SVN hook folder. The content is Windows batch file and just for Windows environment
The script will enable the owner of the revision and the owner of SVN to change the log message.
The owner of SVN is get from SVN auth file (authz-svn.conf) and should be configure in the form @svn_owner = userA, userB...
You need to edit the PATH to authz-svn.conf file
@ECHO OFF
:: Set all parameters. Even though most are not used, in case you want to add
:: changes that allow, for example, editing of the author or addition of log messages.
set repository=%1
set revision=%2
set userName=%3
set propertyName=%4
set action=%5
:: Only allow the log message to be changed, but not author, etc.
if /I not "%propertyName%" == "svn:log" goto ERROR_PROPNAME
:: Only allow modification of a log message, not addition or deletion.
if /I not "%action%" == "M" goto ERROR_ACTION
:: Make sure that the new svn:log message is not empty.
set bIsEmpty=true
for /f "tokens=*" %%g in ('find /V ""') do (
set bIsEmpty=false
)
if "%bIsEmpty%" == "true" goto ERROR_EMPTY
FOR /F "tokens=*" %%a IN ('svnlook author "%repository%" -r %revision%') DO set REV_USER=%%a
FOR /F "delims== tokens=1*" %%a IN (%repository%\..\Permission\authz-svn.conf) DO if "%%a"=="svn_owner " ( set SVN_OWNER=%%b )
set bIsOK=false
FOR %%a IN (%SVN_OWNER%) DO if "%%a"=="%userName%" ( set bIsOK=true )
if "%bIsOK%"=="false" (
goto ERROR_AUTHOR
)
goto :eof
:ERROR_AUTHOR
echo You must be the author of the log message or owner of the repository %SVN_OWNER% %userName%. >&2
goto ERROR_EXIT
:ERROR_EMPTY
echo Empty svn:log messages are not allowed. >&2
goto ERROR_EXIT
:ERROR_PROPNAME
echo Only changes to svn:log messages are allowed. >&2
goto ERROR_EXIT
:ERROR_ACTION
echo Only modifications to svn:log revision properties are allowed. >&2
goto ERROR_EXIT
:ERROR_EXIT
exit /b 1
pre-prop-change (Linux)
The following is the script in Linux, it just allow the owner of the revision to change the log.
#!/bin/sh
REPOS="$1"
REV="$2"
USER="$3"
PROPNAME="$4"
ACTION="$5"
if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" ];
then
REV_USER=`svnlook author "$REPOS" -r $REV`
if [ "$REV_USER" = "$USER" ];
then
exit 0;
else
echo "You must be the owner of the revision to be able to change the svn:log property" >&2
exit 1
fi
fi
echo "Changing revision properties other than svn:log is prohibited" >&2
exit 1
To enable it to user, you (the SVN admin) must enable the pre-prop-change hook
pre-prop-change.bat (Windows)
Here is the content of pre-prop-change hook, just save it to pre-prop-change.bat and copy it into SVN hook folder. The content is Windows batch file and just for Windows environment
The script will enable the owner of the revision and the owner of SVN to change the log message.
The owner of SVN is get from SVN auth file (authz-svn.conf) and should be configure in the form @svn_owner = userA, userB...
You need to edit the PATH to authz-svn.conf file
@ECHO OFF
:: Set all parameters. Even though most are not used, in case you want to add
:: changes that allow, for example, editing of the author or addition of log messages.
set repository=%1
set revision=%2
set userName=%3
set propertyName=%4
set action=%5
:: Only allow the log message to be changed, but not author, etc.
if /I not "%propertyName%" == "svn:log" goto ERROR_PROPNAME
:: Only allow modification of a log message, not addition or deletion.
if /I not "%action%" == "M" goto ERROR_ACTION
:: Make sure that the new svn:log message is not empty.
set bIsEmpty=true
for /f "tokens=*" %%g in ('find /V ""') do (
set bIsEmpty=false
)
if "%bIsEmpty%" == "true" goto ERROR_EMPTY
FOR /F "tokens=*" %%a IN ('svnlook author "%repository%" -r %revision%') DO set REV_USER=%%a
FOR /F "delims== tokens=1*" %%a IN (%repository%\..\Permission\authz-svn.conf) DO if "%%a"=="svn_owner " ( set SVN_OWNER=%%b )
set bIsOK=false
FOR %%a IN (%SVN_OWNER%) DO if "%%a"=="%userName%" ( set bIsOK=true )
if "%bIsOK%"=="false" (
goto ERROR_AUTHOR
)
goto :eof
:ERROR_AUTHOR
echo You must be the author of the log message or owner of the repository %SVN_OWNER% %userName%. >&2
goto ERROR_EXIT
:ERROR_EMPTY
echo Empty svn:log messages are not allowed. >&2
goto ERROR_EXIT
:ERROR_PROPNAME
echo Only changes to svn:log messages are allowed. >&2
goto ERROR_EXIT
:ERROR_ACTION
echo Only modifications to svn:log revision properties are allowed. >&2
goto ERROR_EXIT
:ERROR_EXIT
exit /b 1
pre-prop-change (Linux)
The following is the script in Linux, it just allow the owner of the revision to change the log.
#!/bin/sh
REPOS="$1"
REV="$2"
USER="$3"
PROPNAME="$4"
ACTION="$5"
if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" ];
then
REV_USER=`svnlook author "$REPOS" -r $REV`
if [ "$REV_USER" = "$USER" ];
then
exit 0;
else
echo "You must be the owner of the revision to be able to change the svn:log property" >&2
exit 1
fi
fi
echo "Changing revision properties other than svn:log is prohibited" >&2
exit 1
Oct 16, 2008
StyleCop command line
StyleCop command line
Here is a version of StyleCop in command line mode - http://www.nichesoftware.co.nz/content/stylecop-cmd. You need to have VS 2008 in order to compile, or you can install .NET 3.5 and compile using MSbuild command
set PATH=%PATH%;C:\WINDOWS\Microsoft.NET\Framework\v3.5
cd C:\StyleCopCmd-1.1.27.5997\src\StyleCop
msbuild StyleCop.csproj
Here is a version of StyleCop in command line mode - http://www.nichesoftware.co.nz/content/stylecop-cmd. You need to have VS 2008 in order to compile, or you can install .NET 3.5 and compile using MSbuild command
set PATH=%PATH%;C:\WINDOWS\Microsoft.NET\Framework\v3.5
cd C:\StyleCopCmd-1.1.27.5997\src\StyleCop
msbuild StyleCop.csproj
Oct 15, 2008
How to copy music from PC to iPhone without using iTunes
How to copy music from PC to iPhone without using iTunes
Hehe, you will need to use the SharePod at http://www.getsharepod.com/ and everything will be solved ;-)
Hehe, you will need to use the SharePod at http://www.getsharepod.com/ and everything will be solved ;-)
Oct 13, 2008
Some funny VNese translation in Google
Some funny translation in google

Dịch thế này thì... bó tay.

Miễn bàn.

Google Translate chọn từ rất "đắt".

Đời rất... tí.

Với Google, ngoại tình là "tư tưởng ngoại".

Google không hiểu "tình" là gì?

Enjoy the afternoon cũng giống như cách dịch "like is afternoon".

Google không dịch từ "ruồi", còn "mật" tương đương với "chính sách".

...

Tôi too khờ!!!

Dịch thế này thì... bó tay.

Miễn bàn.

Google Translate chọn từ rất "đắt".

Đời rất... tí.

Với Google, ngoại tình là "tư tưởng ngoại".

Google không hiểu "tình" là gì?

Enjoy the afternoon cũng giống như cách dịch "like is afternoon".

Google không dịch từ "ruồi", còn "mật" tương đương với "chính sách".

...

Tôi too khờ!!!

Subscribe to:
Posts (Atom)