Wednesday, September 10, 2008
Migrating Visual Studio.NET project from VisualSourceSafe to ClearCase while retaining history
To export the project's / solution's information along with history we need to use the clearexport_ssafe command in the DOS prompt. This article explains about the same, but still it doesn't have any sample to explain. The below given sample batch file explains it better.
This is the batch file commands, which I used when migrating one of my .net project from VSS to ClearCase.
SET PATH=%PATH%;C:\Program Files\Microsoft Visual SourceSafe;(The loaction of the SS.exe in the machine)
SET SSDIR=\\NetwrokVSSDatabaseLocation\VSS DatabaseName (eg., \\TestLocation\TestDatabaseName)
SET SSUSER= VSS User Name (This user should be created in VSS database with blank password)
SS CP $/VSSProjectLocation (eg., $/TestProject)
clearexport_ssafe -r
Running the above batch file, will generate a file in the same folder with the name "cvt_data". This is the file having the complete VSS project data with history.
Then while importing the data back to ClearCase, the command used is
clearimport -pcase "cvt_data file location"
This command should be executed in DOS prompt in the location of VOB where you need to move your data. Consider your project's VOB is mapped to Z: directory in your machine and your project's VOB name is TestVOB. Then you chould first change the directory to "Z:\TestVOB\FolderName". Then execute the above command with the correct CVT_Data file location.
In the above command the switch -pcase is used to tell import utility to preserve the case of the files while importing. If this attribute is missed, by default clearimport will import the files with all lowercase letters.
If you are not the VOB owner, then running the above command will give you a "Permission Denied" error. To avoid this run the command with the switch -nsetevent, like shown below
clearimport -nsetevent -pcase "cvt_data file location"
This will import the files exported using the "clearexport_ssafe" command. Now your VOB would be having the complete VSS project's data along with history.
References:
http://www-01.ibm.com/support/docview.wss?rs=0&uid=swg21222507
http://publib.boulder.ibm.com/infocenter/cchelp/v7r0m0/index.jsp?topic=/com.ibm.rational.clearcase.books.cc_admin.doc/import-export.htm
http://www.astrainfotech.com/rsdc-2006-dilip.pdf
Tuesday, July 29, 2008
Label Chart Widget for blogger - Using Google Charts API
If you are not familiar with Google Chart API, then check it here.
Then the script for the Widget is as follows.
<b:widget id='LabelChart' locked='false' title='Label Chart' type='Label'>
<b:includable id='main'>
<b:if cond='data:title'>
<h2><data:title/></h2>
</b:if>
<div class='widget-content'>
<div id='LabelChartDiv'/>
<script type='text/javascript'>
var LabelArray = new Object;
var i=0;
<b:loop values='data:labels' var='label'>
var LabelName = "<data:label.name/>";
LabelArray[LabelName] = <data:label.count/>;
i++
</b:loop>
var LabelChartDivObj = document.getElementById('LabelChartDiv');
var ChartLocation = 'http://chart.apis.google.com/chart?chs=230x75&chd=t:';
var j=0;
for (LabelCount in LabelArray)
{
j++;
if(j<i)
{
ChartLocation = ChartLocation + LabelArray[LabelCount] + ',';
}
else
{
ChartLocation = ChartLocation + LabelArray[LabelCount];
}
}
ChartLocation = ChartLocation + '&cht=p&chl=';
j=0;
for (LabelCount1 in LabelArray)
{
j++;
if(j<i)
{
ChartLocation = ChartLocation + escape(LabelCount1) + '['+ LabelArray[LabelCount1] + ']|';
}
else
{
ChartLocation = ChartLocation + escape(LabelCount1) + '['+ LabelArray[LabelCount1] + ']';
}
}
LabelChartDivObj.innerHTML = '<img src=' + ChartLocation + '>';
</script>
</div>
</b:includable>
</b:widget>
To add the above widget script, you need to go to your blogger 'Dashboard'. Then go for 'Layout' and 'Edit HTML' as shown in the below image.
Then go for 'Edit Template' section and check the '
Now copy the above script and paste it in your template code near your normal label widget. You can find this by searching the below script.
<b:widget id="'Label1'" locked="'false'" title="'Labels'" type="'Label'">
Note: ID of the widget will not be same, it can be different.
The Label widget will be having some standard code and will be end with </b:widget>.
Now you paste the above copied code below this end line and save your template.
Thats all. You have made a colorful chart displaying your label counts.
Caution: Before editing your template, always take a copy of your old template. If some thing goes wrong while editing you can always revert back.
Monday, July 28, 2008
ASP .NET AJAX Timer control : Processing client script on Tick event
This control has good set of features associated with it. But still i feel there is no option to process the client scripts on the Timer's Tick event.
The below given script explains a workaround to the above issue.
Tuesday, April 8, 2008
Using CTE and Row_Number() to get the duplicate data in SQL Server 2005
With TestData as
(
Select
EmployeeId,
Row_Number() Over( Partition By EmployeeName Order By EmployeeName) AS Rowid
From
Employees
)
Select EmployeeId from TestData Where RowId > 1
If we need to get the duplicate records by two columns, those two columns should be in the Partition By column, and in the order by column.
Using CTE to write recursive query in SQL Server 2005
CTE (Common Table Expression) is newly introduced in SQL Server 2005. The below given link elaborates the CTE and its advantages.
http://www.4guysfromrolla.com/webtech/071906-1.shtml
http://searchwindevelopment.techtarget.com/tip/0,289483,sid8_gci1278207,00.html
Basically the requirement was, when an employee logs in he needs the list of employees reporting directly under him as well as the employees who are reporting under them.
The database structure was like:
- Employee table containing the employee details like Employee Id, Name, etc.,
- Supervisor table containing the mapping of employee and their supervisor
I tried out with the CTE to build a recursive function which will get the first level reporting employees and then their reporting employee. The script was given below
Declare@UserId Int
Set @UserId = 36332
-- This is the recursive function..
WITH EmployeeHierarchy (EmployeeID, EmployeeName, HierarchyLevel) AS
(
-- Base case
Select
E.EmployeeId,
E.Name As EmployeeName,
1 As HierarchyLevel
From
Employees E
Where
E.EmployeeId = @UserId
UNION ALL
-- Recursive step
select
E.EmployeeId,
E.Name As EmployeeName,
eh.HierarchyLevel + 1 AS HierarchyLevel
FROM
Supervisors ES
INNER Join Employees E On E.EmployeeId = ES.EmployeeId INNER JOIN EmployeeHierarchy eh ON ES.Supervisor1 = eh.EmployeeID
)
-- This is the final select
Select
E.EmployeeId,
E.EmployeeNumber As EmployeeNumber,
E.EmployeeName
From
EmployeeHierarchy E
Where
E.EmployeeId <> @UserId