Thursday, March 20, 2008

Nightly care and feeding of your Visual SourceSafe database is a must.  If you are working with a project or multiple projects of any size, this is an important task.  The challenge is that Microsoft makes it a little difficult to find the right tools to help you keep your database tuned.

The process I created and describe below has worked for me for years.  It is a bit of overkill, but has produced a stable database night after night, and has continued to work through 3 VSS version updates.

The process is a 3 step batch file:

  1. Run a base Analyze to identify any bad data, backup
  2. Rerun using -F switch (fix), backup
  3. Rerun using -C switch (compress), backup

Steps 2 and 3 are a bit redundant as they both use the fix (-f) switch.  You may chose not to use that switch both times.

Batch file code:

   1: cd c:\
   2: cd program files\microsoft visual sourcesafe
   3:  
   4: REM *** Set the base variables for directory names
   5: for /F "tokens=2,3,4 delims=/ " %%i in ('date/t') do set d=%%k%%i%%j
   6: for /F "tokens=1,2,3 delims=:. " %%i in ('time/t') do set t=%%i%%j%%k
   7: set B=e:\Backups\VSS\Analyze
   8: set C=%B%\Current
   9: set S=%B%/%d%-%t%
  10: set A=C:/public/VSS/data
  11:  
  12: ANALYZE -V4 -I- -B"%C%" "%A%"
  13: for /F "tokens=2,3,4 delims=/ " %%i in ('date/t') do set d=%%k%%i%%j
  14: for /F "tokens=1,2,3 delims=:. " %%i in ('time/t') do set t=%%i%%j%%k
  15: REN %C% %d%-%t%A
  16: MKDIR %C%
  17: ANALYZE -F -I- -V4 -B"%C%" "%A%"
  18: for /F "tokens=2,3,4 delims=/ " %%i in ('date/t') do set d=%%k%%i%%j
  19: for /F "tokens=1,2,3 delims=:. " %%i in ('time/t') do set t=%%i%%j%%k
  20: REN %C% %d%-%t%B
  21: MKDIR %C%
  22: ANALYZE -F -I- -C -V4 -B"%C%" "%A%"
  23: for /F "tokens=2,3,4 delims=/ " %%i in ('date/t') do set d=%%k%%i%%j
  24: for /F "tokens=1,2,3 delims=:. " %%i in ('time/t') do set t=%%i%%j%%k
  25: REN %C% %d%-%t%C
  26: MKDIR %C%
  27:  

The batch file has some DOS trickery to tease out the current date and time.  This allows me to rename (REN) the "\vss\Analyze\Current" directory to the time the step completed.

The result is a the following file structure in my e:\ drive:
e:\Backups\vss\Analyze\[yyyy][mm][dd]-[hh][mm][am/pm][a/b/c]
e.g.
e:\Backups\vss\Analyze\20080319-0144AMC

This structure allows me to run the backup a weekend evening and if the database goes haywire, I can get any one of the last "good" databases for recovery, even if one of the last good backups was in the middle of this batch script.  It also allows me to delete "old" backups as I see fit.  Of other note, a log file (analyze.log) is placed in the root of each backup directory, in case you want to see exactly what went down during the process.

For the record, my VSS database contains over 55k files, occupies 1.35GB on the hard drive, and this process takes ~2.5 hours to run.  If you run this during the work week (or your dev team has no life), you need to log in to the VSS database and lock it using the Administration tool, then log out.  The FIX (-F) switch will not work if any users are actively logged in to the database.  Sadly, there is no command line to lock the database.

Technorati Tags: ,
posted on Thursday, March 20, 2008 9:17:10 AM (US Mountain Standard Time, UTC-07:00)  #    Comments [0]
 Wednesday, March 19, 2008

soupnaziI installed Vista SP1 last night and the install was unremarkable, which is a good thing.  I did not have any issues with any of my development tasks today, and the OS seemed to simply get out of my way.  That's exactly what it should do.  Now that I know SP1 is baked in without issue my next task will be to perform an annual spring cleaning and rebuild this machine.  However...

As has been discussed ad nauseam, many bits of functionality were discussed long ago when Microsoft was hatching Vista.  Some came to fruition, some were abandoned early, and some just disappeared into the ether.  One item that seemed to live into the release of Vista was the idea of "offline updating" or slipstreaming Service Packs into existing disk images (a.k.a. ISOs).  The idea is that when a service pack comes along, you simply unpack it, and copy all of the files into the UPDATE folder in the ISO.  Boom.  Done.  Err... not so fast.  Seems that Microsoft had "ran into some unexpected issues with the servicing stack" for SP1 so no soup for you, system admins; well, unless you consider getting a new ISO from Microsoft a solution.

___________________________________________________________________

I'll admit that the following may not be an SP1 related note, but I only noticed it post install.

At some point along the line, Microsoft changed their warning windows to a layout that looks suspiciously like another application that strikes fear in my heart.  I can't be the only person to notice this?

nav10_install1 remotedesktop

posted on Wednesday, March 19, 2008 9:05:47 PM (US Mountain Standard Time, UTC-07:00)  #    Comments [0]
 Monday, March 17, 2008

linqpadscreen Scott Cate blogged about LINQPad today, and I must note what a great idea this tool is.  In effect, LINQPad is SQL Query Analyzer (a.k.a. SQL Server Management Studio [SSMS]) for LINQ queries.

This tool is to accompany O'Reilly's C# 3.0 in a Nutshell written by Joseph and Ben Albahari.  Not only is it a wonderful tool to debug your LINQ queries, but it comes loaded with 200 examples from the book which is great for beginning in LINQ.

The product is free, so if you are a .NET developer, download LINQPad today.  Do not pass go.

As an interesting experiment, Joseph Albarahi suggests replacing your shortcut to SQL Management Studio with a shortcut to LINQPad.  According to Joseph, "at the end of [a] week, you will actually think in LINQ, rather than thinking in SQL and translating to LINQ."  IMHO, you won't be able to completely do without SSMS as LINQPad doesn't offer table management tools, but LINQPad certainly could sit right next to SSMS.

posted on Monday, March 17, 2008 1:52:32 PM (US Mountain Standard Time, UTC-07:00)  #    Comments [0]
 Thursday, March 06, 2008

I had a love/hate relationship with physics.  In college, my classes were too big (for me) but the theories were so intriguing that the classes kept me coming back for more.  Of particular interest were my Statics (not to be confused with Statistics) and Dynamics classes.

If I had these games tools available to me when I was in school, some of the subject matter may have been slightly easier to grasp.

Phun

Crayon Physics

Technorati Tags: ,,,
posted on Thursday, March 06, 2008 11:28:17 AM (US Mountain Standard Time, UTC-07:00)  #    Comments [0]
 Wednesday, March 05, 2008

Bravo to Microsoft for streaming their keynotes and their session presentations on their website at http://visitmix.com/2008/.  I would love for Apple to also stream their presentations.  Currently I rely on blogs such as Engadget or Gizmodo to distill those presentations for me.  This is a disservice to both me and Apple.  

I was intensely geeked out by streming the live video of Scott Guthrie's keynote on my phone while at lunch today.  The experience was amazingly and surprisingly good. 

posted on Wednesday, March 05, 2008 1:20:40 PM (US Mountain Standard Time, UTC-07:00)  #    Comments [0]