Showing posts from September, 2008

Configaration Manager Missing in Visual Studio

Configaration Manager is what we use to set the build mode(debug or release),some times you might not see the option either in the task bar or in the context menu of the solution.If that is the case you can get that option back by checking on Tools --> Options --> Projects and Solutions --> Show Advanced Build Configarations.

Subversion SVN Backup - HotCopy Not a folder copy

Subversion hotcopy is tricky, because you have to empty the contents of the destination folder before you run the svnadmin hotcopy command.

To do this I create a console app and run it before the svnadmin command runs.App is really simple and has the following code in it.

''share of the destination folder
Dim folder As String = "\\svnbackupserver\svnreposbackup"
Dim rootFiles() As String = System.IO.Directory.GetFiles(folder)
For Each file In rootFiles
System.IO.File.SetAttributes(file, FileAttributes.Normal)
Dim dr() As String = System.IO.Directory.GetDirectories(folder)
For Each item In dr
Dim str() As String = System.IO.Directory.GetFiles(item)
For Each item1 In str
System.IO.File.SetAttributes(item1, FileAttributes.Normal)
System.IO.Directory.Delete(item, True)
Catch ex As Exception
End Try
End Sub


Subversion Apache Authorization File

Once authentication is done the next step is authorization,which is used to maitain permissions by creating groups or adding individual users to the projects or folders.

#Note: Active Domain accounts require "DomainName\username"
#Note: all usernames are case sensitive and should be created/entered in lowercase

admin = DomainName\svnadmin
managers = DomainName\manager1,DomainName\manager2
inhouse_developers = DomainName\developer1,DomainName\developer2
interns = DomainName\intern1
contracters= contracter1,contracter2,contracter3

# These are the permissions allowed for each PROJECT
# Note "/" assigns permission to the entire repository
# "/Test" assigns permission to only "/Test" project
#inhouse_developers has access to entire repository
#contractors has only access to Test Project
#admin has access to entire repository

@admin = rw
@managers = r
@inhouse_developers= rw

@inhouse_developers= rw
@contracters = rw

Subversion Apache - Using network shared folder for a repository

One of the nicest things Subversion has to offer along with apache is its capability of storing the repository on a netwok share.You should use the following line in the apaches httpd.conf files location block.

SVNPath "//SnvServer/SVNREPO/"


Subversion Apache Windows Authentication and Custom Authentication

Man I cannot tell how much flexibility Subversion with Apache has to offer.One thing we wanted to do is authenticate user against Active Directory if the user has a login otherwise use a encrypted file.

Here is how the configaration of the apache httpd.conf file looks like to acheive the above.


DAV svn
SVNPath E:\SvnRepos
AuthName "Enter username and password"

#Authorization File that has user groups and permissions
AuthzSVNAccessFile "C:\Program Files\Apache Group\Apache2\conf\svn-auth.conf"
AuthType SSPI
SSPIAuthoritative On
SSPIDomain mydomain
SSPIOfferBasic on
SSPIOmitDomain On

# Htpasswd Logins.
AuthType Basic
AuthAuthoritative Off

#passwd file that is generated from htpasswd tool
AuthUserFile "C:\Program Files\Apache Group\Apache2\conf\passwd"
require valid-user

Everything above is self explanatory and the above statements should be in the Location block.

use XML and OPENXML to perform Data Manipulation : Table Variable as a parameter to stored procedure

There might be times where you want to perform operations on multiple rows with a single call to the database using a stored procedure.But the problem is SQL Server has no table parameter that can take a collection of rows.To solve this problem u can pass all the rows in a string variable, parse the string into columns and rows and perform the operation you want.Sometimes you might endup sending the delimeter in the data that can cause the parsing to break.A cleaner solution is to pass the xml string and use open xml to transform string data into rows.

Following function is used to build the required xml string for the strored procedure.

Private Shared Function BuildCustomerXMLString(ByVal cc As CustomerCollection) As String

Dim ms As New MemoryStreamDim sr As StreamReader

Dim XMLString As String

Dim writer As New XmlTextWriter(ms, System.Text.Encoding.Unicode)

writer.Formatting = Formatting.Indented


For Each lcc As Customers In cc