Friday, June 24, 2011

command prompt tips

Windows7: whoami to display current user
net local group administrators to display a list of admins

check to see who logged in: qwinsta

ls -l to list files with details

tab to view a list of files or folders availabe

:: delete any aliases to x:


subst /d X:
:: make alias for QDART dir to x:

subst X: C:\work\


echo Build started at


time /T



:: delete any aliases to x:

subst /d X:



:: make alias for QDART dir to x:

subst X: %0\..\..\..\..



::set P4 port

set P4PORT=qctp404:1666



:: Some debugging

p4 set > X:\P4_SET.TXT

set > X:\DOS_SET.TXT



cd X:\HTE\QDART\QSPR3



set P4CLIENT=CRM_%BLD_ENV_BUILD_ID%%BLD_ENV_VER_NUM_COMPRESSED%

:: Some debugging after setting p4client

p4 set > X:\P4_SET1.TXT

set > X:\DOS_SET1.TXT

::HIVE projects

::Call Hive build to build Hive dlls

CALL QSPR3_HiveBuild_Ext_Release.cmd

::move the just built hive files to where the mergemodule code is expecting

mkdir QSPR\QSPRMergeModule\HiveRelease

copy /y qspr\kernels\hivecomkernel\bin\qspr_release\*.dll QSPR\QSPRMergeModule\HiveRelease

::also copy the MS files

copy /y QSPR\QSPRMergeModule\MicrosoftFiles\*.dll QSPR\QSPRMergeModule\HiveRelease



::CTS Projects

CALL QSPR3_CTSBuild_Ext_Release.cmd

::move the just built CTS files to the mergemodule code is expecting

mkdir QSPR\QSPRMergeModule\CTSRelease

copy /y qspr\kernels\CTSCOMKernel\Bin\CTSRelease\*.dll QSPR\QSPRMergeModule\CTSRelease



:: check out the msm



p4 sync -f //depot/HTE/QDART/MergeModules/QSPR3_MergeModule.msm

p4 edit -c default //depot/HTE/QDART/MergeModules/QSPR3_MergeModule.msm



::unlock interop files to build the QSPR Application

attrib -R "QSPR\Output\Bin\*.dll"



set path="C:\Program Files (x86)\Microsoft Visual Studio 8\Common7\IDE\";"C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\";%path%



devenv.exe "QSPR\QSPR_External.sln" /rebuild "Release" /project "QSPRMergeModule" /out QSPR3.1BuildLog.txt



::lock interop files back for Perforce to update

attrib +R "QSPR\Output\Bin\*.dll"



:: check the status of the build

set errCode=%ERRORLEVEL%



if not %errCode%==0 goto FAIL



::copy the merge module to QDART/mergemodules

copy /y QSPR\QSPRMergeModule\Release\QSPR3_MergeModule.msm ..\MergeModules

:: check in the merge module

p4 submit -d %BLD_ENV_BUILD_ID%_%BLD_ENV_VER_NUM_DOTTED% //depot/HTE/QDART/MergeModules/QSPR3_MergeModule.msm



:: check the status of the check-in

set errCode=%ERRORLEVEL%



if not %errCode%==0 goto FAIL



:: create the BuildProducts.txt file

echo .\HTE\QDART\QSPR3\QSPR\QSPRMergeModule\HiveRelease\HIVECOMKernel.dll > x:\BuildProducts.txt

echo .\HTE\QDART\QSPR3\QSPR\QSPRMergeModule\HiveRelease\HIVEEH.dll >> x:\BuildProducts.txt

echo .\HTE\QDART\QSPR3\QSPR\QSPRMergeModule\HiveRelease\HIVEK.dll >> x:\BuildProducts.txt

echo .\HTE\QDART\QSPR3\QSPR\QSPRMergeModule\HiveRelease\HIVEUIF.dll >> x:\BuildProducts.txt

echo .\HTE\QDART\QSPR3\QSPR\QSPRMergeModule\CTSRelease\COMKernel.dll >> x:\BuildProducts.txt

echo .\HTE\QDART\QSPR3\QSPR\QSPRMergeModule\CTSRelease\CTKernel.dll >> x:\BuildProducts.txt

echo .\HTE\QDART\QSPR3\QSPR\QSPRMergeModule\CTSRelease\Ctser.dll >> x:\BuildProducts.txt

echo .\HTE\QDART\QSPR3\QSPR\QSPRMergeModule\CTSRelease\Ctsui.dll >> x:\BuildProducts.txt

echo .\HTE\QDART\QSPR3\QSPR\QSPRMergeModule\Release\QSPR3_MergeModule.msm >> x:\BuildProducts.txt



:: Everything went well if you get here

subst /d X:

EXIT /B 0



:: something failed if you get here

:FAIL

p4 revert //depot/HTE/QDART/MergeModules/QSPR3_MergeModule.msm

subst /d X:

EXIT /B %errCode%



echo Build ended at

time /T

Thursday, June 16, 2011

Using queue in c#

Queue myCollection = new Queue();


lock(myCollection.SyncRoot)

{

foreach (object item in myCollection)

{

// Insert your code here.

}

}