/// Frank Hagen: Professional Web Developer, C# User, Reformed Über-geek RSS 2.0
# Tuesday, October 14, 2008

VisualStudioLogo subversion_logo-200x173 There are a few articles online covering SVN and VS, but many are out of date and a bit more complicated than necessary with advances in both products.  For a current install (Oct 2008:  SVN 1.5.2 / VS2005), you only need 3 files:

Subversion is, of course, the Source Control server itself.  The MSI install contains everything needed to run on a Windows server.

TortoiseSVN is a plug-in for Explorer that gives a great deal of control to the source repository using the right-click context menu.  Check-ins, updates, merges, etc. can be done through this interface as well as full repository browsing and maintenance.

AnkhSVN is the most important tool for the .NET developer.  It integrates the controls needed for team development directly in the environment.  Much like the integration offered through VSS, but much better.

Installation of Subversion itself is very easy.  Just run the installer.  I installed into C:\SVN\ instead of the default "Program Files" directory, but I am lazy and hate spaces in filename on the command-line.
NOTE:  The installer only puts the files in place and sets the important environment variables.
Once installed, the following command is used to setup a repository:

svnadmin create "D:\SVN\Repository"
You can create as many repositories as needed, but one for now.  Before we activate the server, two config files need to be edited.  They were created with the repository above.  They are svnserve.conf and passwd in the conf sub-dir of the repository.  Uncomment the following:
~/conf/svnserve.conf
[general]
anon-access = read
auth-access = write
password-db = passwd

~/conf/passwd
[users]
harry = harryssecret
sally = sallyssecret

Now the installation can be tested. Execute the following command in a command window:

svnserve --daemon --root "D:\SVN\Repository"

To create a project, execute:

svn mkdir snv://localhost/newproject

Now would be a good time to install TortoiseSVN if it hasn't been yet.  Connect to the running server from within an explorer window by right-clicking and selecting TortoiseSVN > Repo-Browser.  Enter the name of the server to see the interface using the following URL:  svn://servername/  The project "newproject" should be viewable there.

And now the most difficult part of all:  Installing SVN as a service in windows.  The following command will accomplish this.  Syntax and proper spacing is critical.  (I was having problems until I realized the space after each '=' in the command.)  Here it is:

sc create SVN_CSTeam binpath= "c:\svn\bin\svnserve.exe --service --root D:\SVN\Repository" 
displayname= "Subversion Repository for CSharp.NET Team" depend= iisadmin

And that is why I do not use the default paths.  Spaces have to be delimited with quotes, which have to be escaped, and it just is not worth it.  All on one line of course.  Also note that the name after the "create" parameter can be anything desired and allows for multiple repositories on the same server, along with unique displayname.  I chose to use iisadmin as a depend, not because it necessarily is, but because it is sure to load other depends such as Tcpip and such.

The last step is to load AnkhSVN; a solution I leave to the reader.  It's not hard.  If you are familiar with source control at all, it is pretty obvious.


I'd like to thank the following sites for very useful information in helping me through the installation and the creating of this post:

Tuesday, October 14, 2008 4:42:27 PM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] -
.NET | Programming
# Wednesday, October 08, 2008

Here we go again.  As mentioned previously, I have finally purchased real hosting.  With my own domain name, I am finally fully managing my blog.  I am going to use DasBlog again, like in the old days of running it on my home server.  It's not as clean (yet) as WordPress, but it is much, much more configurable.

Let's see how long this run lasts.  Ironically, I am able to finally post almost all of my old content again.  The only posts missing are the really old ones from when I was crafting it with JavaScript and DHTML.  Maybe I will get those in one day too.

Wednesday, October 08, 2008 3:53:22 PM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] -
Blog
# Tuesday, September 02, 2008

Well, the new domain is finally up.  FWHagen.com if you want to see it, but there is nothing there yet.  I purchased the hosting account 2 weeks ago and have yet to have the domain name properly transferred to the provider. 

Many years ago, I decided I wanted to have FWHagen.com for myself, for professional development and personal/family use.  I took a chance on the upstart company GoDaddy when they started out because they were pretty cheap.  I was very pleased with their service, having dealt with Network Solutions for years before at work.  That is until this past week, when I tried to transfer it.  After waiting for several days, I discovered that the account was "locked" to prevent any accidental or unauthorized transfers.  If you have ever transferred a domain before, you know that is a bunch of crap.  I had to personally authorize the transfer, so why the lock?  Because of the subsequent failure to transfer, I have to wait 60 days to try again.  The waiting period is ICANN specified, and I really don't have any logical problems with that, except that GoDaddy now gets to hold it for another 2 months. 

I was able to forward the DNS records over, so it works for now.  And I have a long time left to get the domain settled, as well.  It is just very frustrating to deal with underhanded greed like that.  For the sum of $10/year. 

UPDATE [19:50]:  I was wrong about GoDaddy.com.  On my way home this evening, I got a call directly from them expressing concern about my problems.  Now, here's the thing, I only posted my concerns here.  They took the initiative to track me down and fix the problem.  Well, tracking me down in the sense that I posted my domain name and they called my contact info, which only they have.  Long story short:  I am so impressed with their commitment to personal service that I am cancelling the transfer and will simply use DNS forwarding for my new site, as it works perfectly well.  I will continue to use them as my registrar and will definitely use them in the future whenever I can.  BTW, the 60-day wait is ONLY for sucessful transfers.  It does not apply to failed due to locks or privacy safeguards.  And the $10/yr jab?  Only heightens my impression of them.  They surely spent more than that in time and effort on one measely IT guy's satisfaction.

Tuesday, September 02, 2008 7:55:13 PM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] -
Blog | Rant
# Thursday, August 21, 2008

I hate seeing a solitary "1" on the bottom of a paged datagrid because the dataset is too short to have more than one page.  You don't really want to turn off paging but suppress the "1" when it is not needed.

Use this code to do just that when binding the grid:

        if (dgEmployee.Items.Count < dgEmployee.PageSize)
            dgEmployee.PagerStyle.Visible = false;
Thursday, August 21, 2008 11:32:25 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] -
.NET

I've had it with Cox Cable.  I tried to put up a photo album (all HTML, because they have never allowed scripting) last night, and was informed that my personal webspace exceeded the size limit.  After some digging, I found that they impose a 10MB limit on personal sites.  Their technical support people really dropped the ball there too, cause I could have been sold an upgrade to allow for my home server to publish, but no, that would be too much to ask.  I swear:  the day FiOS is available in my area, I am switching.

So I finally broke down and selected a paid host.  All of my personal and professional hosting will be done from, well, a highly regarded and recommended vendor. 

I will be moving this site to it as well sometime in the future.  Wordpress is very nice, but they will nickel and dime you to death for any customizable features (which is why this site looks so bad) and domain assignments.  Yes, I own a domain and have for years.  It's time to finally put it to use.

Thursday, August 21, 2008 9:33:19 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] -
Blog
# Wednesday, July 23, 2008
Here's an extremely useful stub to get data from SQL-Server within a PowerShell script:
$TaskName = "20071029-AllRejectedDuring"
$SqlServer = "SQLDEV01";
$SqlCatalog = "MyData";

# Get the T-SQL Query from .SQL file
$SqlQuery = Get-Content (".\" + $TaskName + ".sql")

#Write-Host ($SqlQuery) -foregroundcolor "gray"

# Setup SQL Connection
$SqlConnection = New-Object System.Data.SqlClient.SqlConnection
$SqlConnection.ConnectionString = 
          "Server = $SqlServer; Database = $SqlCatalog; Integrated Security = True"

# Setup SQL Command
$SqlCmd = New-Object System.Data.SqlClient.SqlCommand
$SqlCmd.CommandText = $SqlQuery
$SqlCmd.Connection = $SqlConnection

# Setup .NET SQLAdapter to execute and fill .NET Dataset
$SqlAdapter = New-Object System.Data.SqlClient.SqlDataAdapter
$SqlAdapter.SelectCommand = $SqlCmd
$DataSet = New-Object System.Data.DataSet

#Execute and Get Row Count
$nRecs = $SqlAdapter.Fill($DataSet)

Write-Host ($nRecs.ToString() + " Records retrieved.") -foregroundcolor "Cyan"
$SqlConnection.Close();

if ($nRecs -gt 0)
{
  # Do Stuff
  $DataSet.Tables[0].Rows[0][0]  #Print first data element
}
The connection is using Integrated Security for simplicity, it wouldn't be difficult to switch to UID/PWD instead.  Also, I put the SQL in a .sql file (flat text) to make life easier; you could also put the statement in the string declaration, if it is a simple query.  PowerShell's Get-Content mechanism makes reading a file very easy.  Also, clean up after yourself, I won't include that here. UPDATE:  I have posted a full script to export to Excel or XML in a followup post.
Wednesday, July 23, 2008 10:55:30 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] -
PowerShell | SQL

Earlier, I wrote about getting data from MS-SQL with PowerShell, which is a very useful and powerful thing.  But just displaying data is very limited.  I have a need at work to create extract "reports" for business owners frequently into Excel.  So I have leverage this scripting technique to do the legwork for me.  After many iterations, I have completed the first version of a script that will take a SQL query in a text file and create an Excel file with the results.  All fully automated with time-stamping, archiving of the successful query, and the ability to export XML or CSV as well.

The script is unfortunately only listed as a page on this site because WordPress does not allow posting of non-media files.  You will have to copy the full content and paste it into a text file named QuerySQL.ps1.  One day, I will host this weblog on a real provider in order to have better control (I will accept donations!).  If many folks prefer, I will post it on my personal webspace with my ISP and provide links on request.  And maybe to CodeProject too.

Feel free to use it in anyway you wish.  Please learn from it if you can, or conversely, send me a note on how to improve it.  I would love to get the field-name bolding working among other things.

Wednesday, July 23, 2008 10:29:00 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] -
PowerShell | SQL
# Friday, July 18, 2008

Heralded by many to be one of the founding series of modern science fiction, this is the first book of the Lensmen series.  It has been made into games, TV shows, etc, none of which I am familiar with.  So, I thought I'd better get with it and do so.  I picked up an old dime-store copy and got reading.

Triplanetary seems to be a collection of early stories and a novella that sets the stage for the series to come.  The first few stories tell of the fall of Atlantis, the burning of Rome, WWI and WWII, etc.; important events in human history.  They expose an galactic plot between two superpowers at war with one another, although one doesn't know of the others existence, in which Earth and its inhabitants are unknowing pawns.  The final novella is about 3 Terrans captured by space pirates, escape, then by a vastly advance fish alien civilization, which, of course, are able to escape from again.  Fortunately, Terran military scientists are able to quickly reverse engineer the fish alien's vastly superior technology in only a few weeks (days?), and built a super-battleship capable of defeating the aliens very civilization.

Yes, this is early sci-fi.  Pulp fiction, et al.  And I probably would offend the leet geeks, but I thought this book was terrible.  Maybe this was a fan-service book to set the series, but I felt the characters were flat and trite; I didn't care what happened to them at all.  The swooning girl, the incredibly capable hero with a tender spot for our frail damsel, the military leaders with single-minded faith in our hero to the point of having no contingencies, all make for great plot indeed.  Maybe I have been led to expect too much, but Burroughs, Howard, Asimov, Clarke and the others have done so, and in surrounding time frames.  So, I won't find out if the rest of the series is any good.  I just don't care.  Indeed, I can't even be bothered to find cover art for this post.

Friday, July 18, 2008 10:49:02 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] -
Books
<%--
--%>
Statistics
Total Posts: 189
This Year: 2
This Month: 0
This Week: 0
Comments: 74
Locations of visitors to this page
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2012
Frank W Hagen
Sign In
All Content © 2012, Frank W Hagen
Custom DasBlog theme based on 'Business' by Christoph De Baene