Archive for the ‘Visual SourceSafe’ Category

Learn Faster

October 3rd, 2008 by Sameer | 1 Comment | Filed in Uncategorized, Visual SourceSafe, Work Related

Change of atmosphere is actually a much faster way to learn, as I recently found out due to a job change.  A lot of time spent in the same environment working with the same people and learning stagnates.  If you really want to learn something different, be bold, take a risk, and change jobs.  Another factor is type of company – changing company types can increase learning speed by working in a different environment.  Technical skills are not the only skills that matter, so keep that in mind.  By looking at how different companies work together and achieve goals is a learning experience in itself.  I was concerned that moving from a team with many talented developers to moving to a team of one developer (me) my learning would stagnate.  However, this is not the case.  I feel like I’ve learned so much in the last few days just by being in a different environment.  Take risks!  Be bold!

Factors to note

- Background of those you are working with
- People who you are working with (non technical)
- Location of new job/environment
- Number of work hours
- SMALL or LARGE COMPANY
- Technology used (is it old, is it new… )

You can find a lot of these things out by asking in the interview.  There are implications for each one of the factors above.  For example, large companies are more resistant to change.  They are usually late followers in adopting new technologies.  However, some people feel that in large companies they have job security…  So it all depends.

I think Justin of CodeThinked (a nice .NET blog that I subscribe to) sums it up pretty well why he changed jobs.

Keep in mind we humans are fussy beings.  We don’t like change (most of us, anyway).  You might find a lot of things uncomfortable in your new position.. It will take a while to adjust to the new area, new coworkers, new boss, and so on.   But hey, life is about taking risks, right?  Can’t be complacent all the time.

Moving from SourceSafe to Subversion

April 24th, 2008 by Sameer | No Comments | Filed in Visual SourceSafe
This is an overview of some of the changes you will encounter when going from SourceSafe to Subversion.
Subversion is modeled on CVS, whereas SourceSafe is modeled on…. well… nothing (just a joke).
 
In SourceSafe, you work in a shared code base or line (known as a “Project” in SourceSafe) which you “share” into another line.
 
So you have a line that you work on, and then when you want to start adding new features or you want to change the functionality in certain pages, you share the entire line (aka “Projects”, represented by a small green folder icon SourceSafe Project Icon). 

If our first project was called Development1.0, you can share this into a new project called Development1.1

At this point in time, they are identical twins. In fact, they both point to the same item, sort of like how a pointer would work, they both reference the same data. If you change one of the files in Development1.0, it will instantly be updated in Development1.1.  This means at this point there is no real point for creating this shared copy as they are the same.
However, if you add a new page to either Development1.0 or Development1.1, it will not appear in the other Project, it will only be in the one you put it in.

Now, if you want to “branch” some of these files, so that you can make changes to them in Development1.1, you would select them and click on “Branch files” (icon is 2 arrows coming from a file SourceSafe Branch)
This will effectively split them, so they are distinct independent copies.  All changes to either of the files will be maintained independently of the other file.

However, since all the other files are still shared, you might need to also branch any dependent files. This is good in some ways, because of the shared workspace others will see your changes and integration will be sooner then later, however it can also cause your work to break other people’s pages.  What that means is if your page is dependent on some shared library or business object that is going to be modified, this can get quite messy!

As well, you might want to maintain a link going forward, but not going backward.  So you might want this file in Development1.1 to be shared to Development1.2 and Development1.3 but not shared to Development1.0
 
Keep in mind that nomatter what tool you use, the more parallel development you try to perform, the more messy and difficult your job is going to be.  AVOID HAVING TOO MUCH PARALLEL DEVELOPMENT – TRY TO CLOSE OLD BRANCHES AS SOON AS POSSIBLE.  This will save you much headache and tons of time wasted in managing lines and branches :)
 
The first recommendation when working with SourceSafe is to implement a continuous integration server, namely CruiseControl.NET, which at the very least will automatically build at regular intervals and apply labels each time, so that it is possible to revert to a previous version. This is super important, especially if you release your code to customers, because you might want to be able to get a piece of old code and find out why it is behaving thus.
 
If you do not label after every build or set of checkins, it is nearly impossible to get back to a previous version unless you are doing a very silly job of copying and maintaining a folder with all the old builds in it. 
With labels, you can roll back individual files, but that individual file might have depended on an older version of say a business object, and thus you will have to roll back several files manually which is very difficult.
 
So CruiseControl is just a fancy batch file. It’s not too hard to set up at all, it might take you a few days, but once it’s done, its well worth it!
 
As well, names are different. For example, with Subversion you say “Commit” instead of “Check-in”.  This takes a bit of getting used to.

Also, with Subversion, by default, there is no concept of “check out”. That is quite scary for some people.   Anything you want to edit, you got it! Especially if you never turned off exclusive checkouts in SourceSafe, then you are used to the idea that if you are working on this file, nobody else can work on it. If you turn off this feature in SourceSafe, then you can have multiple checkouts, and the first person who checks in their code, wins. The rest have to manually merge the files, or depend on SourceSafe’s not so great merging tool.
 
With Subversion, unless there is a conflict (aka two people edited the same line of code), you will find that it will automatically merge the changes in a smart way, which is very helpful. In fact it saves you a lot of time. And you don’t even have to worry about checking out files. Although keep in mind that you should try to check in your stuff as soon as possible otherwise you might find it has changed dramatically and you will have to merge any conflicts that happened manually. (This is because a machine has no way of knowing which change was “Right”, you may have to remove your change, or the other person’s change, or keep both, in the case of conflicts!)
 
TortoiseSVN is the best way to get started with Subversion, it’s user friendly and requires no database (uses your file system to store data) and very little set up.

It’s not just enough to switch to Subversion, you need to know some of the SCM best practices otherwise you will still fail. 
 
It is very possible to continue working “sourcesafe style” in Subversion without realizing it and suffering the same problems.

Get A Build Process Now!

October 31st, 2007 by Sameer | No Comments | Filed in Software Engineering, Visual SourceSafe
This article will tell you how to get a build process. It uses CruiseControl.NET to automate the build.  You can use any other tool you like including a .BAT file, but CruiseControl will do just fine.  It’s very easy to set up, it uses an XML configuration file and does most of the difficult job like connecting to your source control, applying labels, and getting your files to build for you.
1. Install CruiseControl.NET
This software is just great. Its totally free. Really it is a sophisticated batch file (.BAT file). It allows you to set up a build process fairly easily.  It allows you to execute arbitrary processes and check the return codes and then report the results to your developers (or managers, or what not).
 
For example, you set it up to monitor your source control system (say SourceSafe or even a local folder in your file system) every 30 minutes, and then perform a build on it if there is changes. 
It will report who made the last set of changes, what they did (check in, check out, delete, etc) by grabbing that information from your source control and also display the comment from the user that checked it in.  It also labels it in the source control as UNVERIFIED (build process failed), or by incrementing the build number (again, this is configurable).
 
2. Install CCTray (its a little icon that sits in your tray and interfaces to the cruise control server to notify you when the build(s) are broken)
If the build does not compile (according to the procedure you set it up to run such as MsBuild, or Visual Studio, or executing some process) it will turn red and the team will all know that the build is broken and must be fixed. One person can volunteer to fix this build.  Included with CruiseControl.  Or you can just use the web dashboard instead:
 Screenshot from CruiseControl Dashboard
 
3. Perform more advanced setup on it.
You can configure it to do just about anything. Our CruiseControl does a nightly build, runs NDOC (Alpha version, discontinued, you can use SandCastle instead if you like) to get the latest documentation, and also we have a separate project that runs some database unit tests against 5 or 6 QA databases. The NDoc step is a bit tricky if you are running a “Web Site Project” because by default the “Web Site Project” does not create XML documentation files when compiled and requires modifications to your Web.Config. Getting NUnit to run requires some advanced setup, because NUnit requires you to have a copy of the Web.Config in the local folder where the tests are run. You can also run a bunch of fun stuff like Simian (Similarity Analysis, Duplicate Line counter), Fitnesses (another testing framework), NCover (Unit test coverage), etc..  It can also send out emails on each successful build if you like (technically it can do cartwheels if you have an exe file that you can make it call to do the cartwheels :) )
 
4. Involve QA and the rest of the team to start using the build numbers and relying on CruiseControl to verify the site compiles. Also you can start to add more unit tests to your code and strengthening the quality of your product, and then using NCover to verify how much of your site is tested. Not to mention you can also stick FxCop in there! FxCop will analyse your code according to Microsoft Best Standards and create a report for you on bad code that is not according to their naming conventions, or bad code that is not using SQL Parameters (and could have SQL Injection vulnerabilities)

More to come soon. In summary – CruiseControl makes a world of difference. Get it now.

As Jeff Atwood wrote, "The F5 key is not a build process"

SourceSafe Branch Recursively

September 24th, 2007 by Sameer | 4 Comments | Filed in Visual SourceSafe

Did you know there is no way to branch sourcesafe projects recursively?  Or so you thought!

Here is a work around:

From Visual SourceSafe Explorer, go to View -> Search -> WildCard Search

SourceSafe Wildcard Search

Then search for Wildcard: *
(a single asterisk) with "Search in current project and all subprojects" selected.

Then it will give you a list of ALL of your files in that project.  Simply highlight them all and click on the Branch button.

The only caveat is that you need to make sure the files are not checked out in that project in order to branch them.

And again,.. I would recommend you ditch SourceSafe and go for something better, like Perforce, Subversion, or Vault

 

Visual Source Safe Pinning Feature

June 12th, 2007 by Sameer | 4 Comments | Filed in Visual SourceSafe

 We have run into the situation before where we are developing code, but we don’t want other developers to get that code yet because it is not completely developed yet.  However, we still want to take advantage of Source Control and put it in the repository so we have incremental changes and we can rollback incase we do something dumb.  Our first solution to this was to use a “ready” label and then instead of getting latest version, we would do a “Get label ready”, and then the ‘ready’ label was updated when the code was more stable.  However, this didn’t work very well, and maybe it would have made more sense to use many different ‘ready’ labels, such as ready1, ready2, ready3, etc.. so that if we ever needed to revert to an older one, we could do that. 

 

However, there is a better way to accomplish this with sourcesafe, its called “Pinning”

I created a test.txt and here is the contents: blah blah version 1

Version 1 test.txt–

blah blah version 1

Version 2 test.txt–

blah blah version 2

Version 3 test.txt–

blah blah version 3 BROKENNNN!!!

 

SourceSafe Pinning Feature Screenshot

Now when you do a get latest version on the file or containing folder, it will give you version 2 (blah blah version 2), not version 3 – BROKENNNN!!!

Here are some more References:

Update (June 29, 2007) – If you pin a file, you CANNOT check it out and continue to work on it.  As usual, SourceSafe takes the cake!  Pinning could have been the perfect way to indicate "this version is stable, so get that one, while i continue to work on it", but it ended up being otherwise :(

Here is a blurb from that page:

Use of Pins in Version Control

Visual SourceSafe defines a pin as a marker that designates a specific version of a file as the version that is part of a project. The pin is represented by a pushpin icon, and is added through the Pin command in the History of <name> dialog box. For more information, see How to: Pin a Version.

You can pin any file, but you should do this only when you are not planning to change the marked file. Pinning is most useful when applied to shared files.

 

Note

Note   When you pin a shared file, you cannot make changes to it until you unpin it using the Unpin command from the History of <name> dialog box.

If you share a pinned version of a file, the projects sharing the file cannot change it. However, if you share an unpinned file, and then pin it in one project, other projects can still change and update the file.

Let’s examine an example of using pins for version control. One developer has prepared a spell checker program. The first time the version of the program is stable, the developer uses pins to mark particular versions of the program code files. He then notifies a developer of a grammar checker program that uses the spell checker code that a good version is available. The second developer can share and branch the code and use the pinned file versions as the basis for his spell checking components of the grammar checker program. He only obtains the last known good code files for the spell checker, unless the first programmer unpins his file versions at some point.

SourceSafe Merges Changes, Not Branches!

June 6th, 2007 by Sameer | No Comments | Filed in Visual SourceSafe
If you’ve ever had two or more source-safe projects with shared files, you might be shocked to learn that Visual SourceSafe 2005 breaks one of the holy grails of good design: user expectations. Again. (For the first incarnation of this evil act, see SourceSafe Shares Deleted Files)
 
You would expect that, if you merge a branched file from one project, it gets shared. I mean, you merged  it, right? What was once double maintenance should become a single, unified soul. But alas, Visual SouceSafe 2005 merges changes, not branches!
 
To test this out, try the following:
  • Create a new project (call it "Test-A")
  • Add some files (some HTML or text files work best)
  • Create a new project (call it "Test-B")
  • Browse into Test-A, and select and drag some files into Test-B to share them
  • Branch one of the shared files
  • Edit the branched file in Test-B and add a line with "B: " at the prefix
  • Edit the branched file in Test-A and add a line with "A: " at the prefix
  • Select the branched file in Test-A, browse to the Versions menu, and click Merge Branches …
  • Select the Test-B branch to merge to
  • Resolve any conflicts
  • Check in the file
  • The file is still branched!
 
The only consolation you may have, is that you can delete one version and manually re-share the file (for example, by dragging and dropping the merged version into the other project folder) in order to get a real merge. But, if you have a large project with hundreds of files, set aside a few days just for merging. (Or save yourself the tedious and error-prone work by switching to Subversion, Perforce, or some other real source-control solution.)
 
So consider yourself warned!
By Ashiq Alibhai

SourceSafe Shares Deleted Files!

June 6th, 2007 by Sameer | No Comments | Filed in Visual SourceSafe

If you’ve ever had two or more source-safe projects with shared files, you might be shocked to learn that Visual SourceSafe 2005 breaks one of the holy grails of good design: user expectations.

 
You would expect that, if you delete a shared file from one project, it gets branched. I mean, you deleted it, right? You said goodbye, kaputsky, sayounara! But alas, Visual SouceSafe 2005 shares deleted files!
 
To test this out, try the following:
  • Create a new project (call it "Test-A")
  • Add some files (some HTML or text files work best)
  • Create a new project (call it "Test-B")
  • Browse into Test-A, and select and drag some files into Test-B to share them
  • Delete one of the shared files (non-permanently)
  • Browse to Test-B
  • The file is still shared!
 
Shocking! What’s worse, the deleted file continues to be updated if the other version is updated! Try it for yourself:
  • Browse to Test-B
  • Check-out, edit, and check-in one of the files you deleted
  • Browse to Test-A
  • Recover the deleted file (right-click on the project and select Project Properties, go to the Deleted Items tab, and click Recover)
  • View the file
  • The file has the same changes as its twin in Test-B!
 
The only consolation you may have, is that if you destroy permanently when you delete a shared file, it becomes branched–albeit with a hideous, ugly warning pop-up.
 
So consider yourself warned!
By Ashiq Alibhai

Visual SourceSafe 2005 Tip (VS2005) – Keywords

May 29th, 2007 by Sameer | No Comments | Filed in .NET articles, Visual SourceSafe

Using Visual SourceSafe, we can put some text at the top of our source file and it will automatically be updated by SourceSafe when you check in the file.  See below for an example.

// Last updated by:
// $Author: Sameera $
// $Date: 4/13/07 11:16a $

This will allow you to quickly see who was the last person who checked in the file.