Author: usenkanov

How to delete a project from TRAC

1.
Delete the repository from
C:\Repositories\XXX

2.
Delete the project from VisualSVN

3.
Stop VisualSVN

4.
Delete the project folder from
C:\Trac\XXX
(If you don’t stop the VisualSVN server you will not be able to delete the project )

5. Start the VisualSVN server

How to create a new repository and trac

1. Create repository “MyProject” in VisualSVN Server Manager.
2. Create folder C:\Trac\XXX
3. “C:\Program Files\VisualSVN Server\trac\trac-admin.bat” C:\Trac\XXX initenv
– any project name (ex: My XXX Project)
– Enter
– Enter
– C:\Repositories\XXX

In this case Trac is saved in C:\Trac\XXX
repository is saved within C:\Repositories\XXX

THAT’S IT!

Visual SVN + Trac

http://visualsvn.com/server/trac/

Installing Trac with VisualSVN Server

* Download VisualSVN Server 1.5.2.

* Install it using default settings.

* Create repository “MyProject” in VisualSVN Server Manager.

* Download VisualSVN-Server-Trac-1.5.2-14459.zip (~10MB).

* Unzip it to C:\Program Files\VisualSVN Server\

* Create folder C:\Trac

* Execute following command:

“C:\Program Files\VisualSVN Server\trac\trac-admin.bat” C:\Trac\MyProject initenv

* Use default settings. Provide C:\Repositories\MyProject as repository path.

* Add following line at the top of file C:\Program Files\VisualSVN Server\httpd-wrapper.bat (after the ECHO command) :

set PYTHONHOME=%~dp0\Trac\python

* Add the following text to file C:\Program Files\VisualSVN Server\conf\httpd-custom.conf if you use Subversion authentication:

LoadModule python_module “trac/python/mod_python_so.pyd”

LoadModule authz_user_module bin/mod_authz_user.so

<Location /trac>

SetHandler mod_python

PythonInterpreter main_interpreter

PythonHandler trac.web.modpython_frontend

PythonOption TracEnvParentDir C:\Trac

PythonOption TracUriRoot /trac

AuthName “Trac”

AuthType Basic

AuthBasicProvider file

AuthUserFile “C:/Repositories/htpasswd”

Require valid-user

</Location>

or this text if you use Windows authentication:

LoadModule python_module “trac/python/mod_python_so.pyd”

LoadModule authz_user_module bin/mod_authz_user.so

<Location /trac>

SetHandler mod_python

PythonInterpreter main_interpreter

PythonHandler trac.web.modpython_frontend

PythonOption TracEnvParentDir C:\Trac

PythonOption TracUriRoot /trac

 

AuthName “Trac”

AuthType Basic

AuthBasicProvider visualsvn

Require valid-user

</Location>

* Restart VisualSVN Server.

* Open http://localhost/trac/ in browser and enter user name and password.

How to work with DataView construct

Represents a VIEW of the table.
Columns cannot be deleted.

To delete column, delete column from the DataTable from which DataView is originated.
Then create DataView again.

Ex:

SqlConnection conn = new SqlConnection(strConn);
DataSet ds_orig = new DataSet();
DataSet ds_copy = new DataSet();
DataTable dt;
DataView dv;

SqlDataAdapter da = new SqlDataAdapter("SELECT Title,FirstName,LastName FROM
Employees",conn);
da.Fill(ds_orig);
ds_copy = ds_orig.Copy();
dt = ds_copy.Tables[0];
dt.Columns.Remove("Title");
dv = new DataView(dt);

dataGrid1.DataSource = ds_orig;
dataGrid2.DataSource = dv;

The best data structures to manipulate data manually = DataTable + DataRow + DataView

Here is a simple class that populates GridView control.
This is the best method for doing MANUAL data manipulations.
Code is in C# and VB.NET formats

C#
<%@ Import Namespace="System.Data" %>
<html>
<script language="C#" runat="server">

 string SortField;

 ICollection CreateDataSource() {
 DataTable dt = new DataTable();
 DataRow dr;

 dt.Columns.Add(new DataColumn("IntegerValue", typeof(Int32)));
 dt.Columns.Add(new DataColumn("StringValue", typeof(string)));
 dt.Columns.Add(new DataColumn("DateTimeValue", typeof(DateTime)));
 dt.Columns.Add(new DataColumn("BoolValue", typeof(bool)));
 dt.Columns.Add(new DataColumn("CurrencyValue", typeof(double)));

 for (int i = 0; i < 9; i++) {
 dr = dt.NewRow();

 dr[0] = 9-i;
 dr[1] = "Item " + i.ToString();
 dr[2] = DateTime.Now;
 dr[3] = (i % 2 != 0) ? true : false;
 dr[4] = 1.23 * (i+1);

 dt.Rows.Add(dr);
 }

 DataView dv = new DataView(dt);
 dv.Sort = SortField;
 return dv;
 }

 void Page_Load(Object sender, EventArgs e) {
 if (!IsPostBack) {
 if (SortField == "") {
 SortField = "IntegerValue";
 }    
 BindGrid();
 }    
 }

 void MyDataGrid_Sort(Object sender, DataGridSortCommandEventArgs e) {
 SortField = (string)e.SortExpression;
 BindGrid();
 }

 void BindGrid() {
 MyDataGrid.DataSource = CreateDataSource();
 MyDataGrid.DataBind();
 }

</script>

<body>

 <h3><font face="Verdana">Basic Sorting in DataGrid</font></h3>

 <form runat=server>

 <ASP:DataGrid id="MyDataGrid" runat="server"
 AllowSorting="true"
 OnSortCommand="MyDataGrid_Sort"
 BorderColor="black"
 BorderWidth="1"
 CellPadding="3"
 Font-Name="Verdana"
 Font-Size="8pt"
 HeaderStyle-BackColor="#ccccff"
 HeaderStyle-ForeColor="black"
 />

</form>

</body>
</html>

VB.NET
<%@ Import Namespace="System.Data" %>

<html>
<script language="VB" runat="server">

 Dim SortField As String

 Function CreateDataSource() As ICollection

 Dim dt As DataTable
 Dim dr As DataRow
 Dim i As Integer

 'create a DataTable
 dt = New DataTable
 dt.Columns.Add(New DataColumn("IntegerValue", GetType(Integer)))
 dt.Columns.Add(New DataColumn("StringValue", GetType(String)))
 dt.Columns.Add(New DataColumn("DateTimeValue", GetType(DateTime)))
 dt.Columns.Add(New DataColumn("BoolValue", GetType(Boolean)))
 dt.Columns.Add(new DataColumn("CurrencyValue", GetType(Double)))

 'Make some rows and put some sample data in
 For i = 1 To 9
 dr = dt.NewRow()
 dr(0) = 9-i
 dr(1) = "Item " & i.ToString()
 dr(2) = DateTime.Now.ToShortTimeString
 If (i Mod 2 <> 0) Then
 dr(3) = True
 Else
 dr(3) = False
 End If
 dr(4) = 1.23 * (i + 1)
 'add the row to the datatable
 dt.Rows.Add(dr)
 Next

 'return a DataView to the DataTable
 Dim dv as DataView = New DataView(dt)
 dv.Sort = SortField
 CreateDataSource = dv
 End Function        

 Sub Page_Load(sender As Object, e As EventArgs)
 If Not IsPostBack Then
 If SortField = "" Then
 SortField = "IntegerValue"
 End If   
 BindGrid
 End If
 End Sub

 Sub MyDataGrid_Sort(sender As Object, e As DataGridSortCommandEventArgs)
 SortField = e.SortExpression
 BindGrid
 End Sub

 Sub BindGrid()
 MyDataGrid.DataSource = CreateDataSource()
 MyDataGrid.DataBind
 End Sub

</script>

<body>

 <h3><font face="Verdana">Basic Sorting in DataGrid</font></h3>

 <form runat=server>

 <ASP:DataGrid id="MyDataGrid" runat="server"
 AllowSorting="true"
 OnSortCommand="MyDataGrid_Sort"
 BorderColor="black"
 BorderWidth="1"
 CellPadding="3"
 Font-Name="Verdana"
 Font-Size="8pt"
 HeaderStyle-BackColor="#ccccff"
 HeaderStyle-ForeColor="black"
 />

</form>

</body>
</html>