Understanding Git

I’ve been meaning to write this post for a while.  Lately, the places I’ve worked at have been pushing to go from Team Foundation Version Control (TFVC) or an SVN based derivative to Git.  To me, they both were the same.  They both handle branching.  They both do all the same stuff.  I just couldn’t put my finger on the difference between the two.

Over the past 8 months, I worked in a shop that converted from TFVC to Git.  And, for some reason, working with the source control did feel different.  I went from a big proponent of TFVC to actually liking Git better.  And I *still* couldn’t figure out the difference.

It finally hit me.  I was explaining the differences to someone at my new job, and I got a flash of insight that may have been obvious to everyone else…

Here’s what I finally understood:

TFVC or any SVN/PVCS/etc… based source control systems build their branches on history.  When you branch, you start with the base, then build on top of that to get your files.  TFVC is always looking backwards.

Git works off of changes.  While branches start off of a specific base, you are able to apply Git changes to literally ANYTHING.  It is very easy to apply a change to a completely different branch, as Git doesn’t worry about the base.  It just cares about the change.  Git allows you to look forward.

When I worked with Git, if I wanted to apply my changes, it was stupidly simple to create a new branch off of the master, and just apply my changes from my commits, and boom, my commits were up to date.  Trying to do something like that on TFVC was insane because the comparisons started with the point where the branch occurred, and then had to be reconciled.  Doable, but no where near as efficient.

After that, I now really enjoy Git for feature branching.  It’s still a bit of a nightmare to keep track of everything, but the tools for that are getting better and better.

Visual Studio 2015 was released this week. And, there’s some goodies Visual Studio Online

For all of the developers and DevOps people out there, Visual Studio 2015 was released this week.  I’ve been working with it for a week on the latest build of Win10 (WinX, build 10240), and I must say, I’m impressed.  One of the MOST impressive things has been the ‘backwards compatibility’.  My company uses Visual Studio 2013, and I was able to open my project in 2015 with no issues and then go back to 2013 with no problems, either.  If I start using some of the new VB.NET features, I might have some issues, but I think I’ll be able to get everyone to switch to 2015 pretty quickly 🙂

Several important things have changed with TFS 2015 / Visual Studio Online build process.

One of the first things that I found in the changes to TFS is that there is a new option about what to do with the artifacts of the build (the source / deployable items).  Previously, these would just go into some shared drop folder.  It looks like now, these artifacts can be pushed back to the source control server.  That makes the need for a shared drop location unnecessary.  Also, it allows the artifacts to be downloaded directly from the internal or hosted TFS website.  This is both a good and bad thing, as it’s great for not needing to have a shared location anymore for drops, but it does add time to the build to upload it to the server.  Plus, that also means that, if you use VSO, your files are going up to Microsoft.  Fortunately, sending to the build server is only an option, and the old style of dropping the files in a share is still around.

One more thing that I did want to point out is that Team Foundation Server and Visual Studio Online’s build engine has been updated AGAIN.  When I first saw the change, I was like ‘WTF… in 4 version (2010, 2012, 2013, and 2015), they’ve completely redone the build system 3 times!?!’  I think the XML build process, al-la Ant was a pain in the rear.  The move to XAML looked to be going in the right direction, but the build scripts were very complicated.  When I saw the ‘new’ build system, my first thought was… ugh, really?  Not interested.

Then I took a better look, and tried it…

After playing with it for a bit, I like the way that the new build engine incorporates the visual style of the XAML builds and the succinct style of the XML builds.  There is a nice visual aspect to the builds, but there is enough customization that a good balance has been reached.  Plus, it is very easy to extend the new system.

There are a couple of concepts to be aware of when using the new system.  The old build system had some options turned on by default that would generate the structures correctly in the build.  Those options are not on by default in the new system.  The following article helped me with part of the configuration: http://www.deliveron.com/blog/building-websites-team-foundation-build-2015/  The import part of of the article is what the settings are for the MSBuild arguments:

/p:OutDir=$(build.stagingDirectory) /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true

That coupled with the setting that I found for keeping the structure https://dscheidt.wordpress.com/2014/06/01/solving-a-problem-with-tfs-and-building-regular-applications-using-tfsbuild/

/p:GenerateProjectSpecificOutputFolder=true

Using that together in the MSBuild settings will build the projects in the same structure that the directory is in.

One last thing that has changed with the build system… If the new build system is used, the TFS build agent doesn’t need to be installed through the big setup.exe that prior to 2015 was needed.  Now, on the web site, there is a link to download the agent by itself.  After that, one just has to run the Powershell script to configure the agent.

All-in-all, Visual Studio and Team Foundation 2015 look like an excellent release!

Starting a little series… Knockout.js and ASP.NET Web Forms

With my new job, I’m back to programming.  Which means, more programming articles 🙂  So, if programming in .NET isn’t your thing, you can skip these 🙂

A couple of months ago, at my old job, I was speaking with a programmer who was interested in using Knockout.js, but couldn’t because the project that he was working on was an ASP.NET WebForms project.  At the time, all I’d seen of Knockout.js was referred to using the ASP.NET MVC type projects, so I agreed with him that it was a shame, and moved on.  Boy, do I wish I’d been a little more informed at that time.

It turns out that one can use Knockout.js and ASP.NET WebForms JUST FINE TOGETHER!  It does take thinking a bit different about what the ASP.NET WebForms do, and it is sort of bastardizing the whole WebForms concept, but it can be done, and it’s fairly easy 🙂  By using this style of code, the WebForms become more like MVC pages rather than the usual “onPostBack” code.

The first step to understanding how Knockout.js and WebForms can work together is to learn that .aspx pages can expose WebMethods.  This fact is important, because web methods can send and receive JSON data.  Using JSON (and BSON), one can pass the data from a class to a website via the web service call and a web service call can receive JSON data and turn it back into a class.  There are lots of good articles on using WebMethods in WebForms (example: http://encosia.com/using-jquery-to-directly-call-aspnet-ajax-page-methods/).  The example that I’ve recently found shows how to tie the Knockout.js data binding to the WebMethods.  http://www.codeproject.com/Articles/692793/Introduction-to-Knockout-js-and-CRUD-Operations-in.

One of the reasons I say that I’m starting a series is because I want to point out the little ‘gotchas’ that pop up when doing some of this coding.  I’m still in the learning (and stealing of ideas) stage, and I want to document what I’m seeing 🙂  All of the things I’m writing at the moment are coming from issues that my new team is running into.

The first gotcha that we ran into was when creating a default Microsoft web forms project.  The latest default project has a ton of great stuff set up, but some things that have been preset get in the way.  Problem number one is AutoRedirectMode in the AppStart/RouteConfig.cs or AppStart/RouteConfig.vb file.  The default setting is RedirectMode.Permanent.  This needs to be changed to RedirectMode.Off to get the web method calls to work.  (See this article:  http://stackoverflow.com/questions/23667083/i-cannot-get-my-webmethod-to-work-in-asp-net.  Note that the answer is in the comments, not the answers)

There are more challenges that we had to work through, so more article are one their way!

Wow, 10 years, where does the time go?

Wow, this blog has been (mostly) active over 10 years.  My writing has been pretty quiet since September.  Not because of lack of activity, but for the complete opposite reason!  Too much going on!  One of the major things that has happened is that I left my job with my previous company, and have started working with a much smaller company.  I’ve moved from DevOps back into Development, and have actually been working with Visual Basic.NET, Windows Presentation Framework, and Javascript / jQuery / Knockout.js.  I have written more code in the last two months than I have in the last 3-4 years, and I’m VERY happy about that!  I am now also mentoring a couple of developers, and doing a LOT of learning myself.

On the music front, they ‘year-and-a-bit more’ of gear continued.  I swear I thought that I was done recently.  Time has a way of changing that, though!  I’ve picked up a LOT of sound gigs lately, and they are paying much better than the late night bar gigs.  To continue doing them, though, I’ve had to make a couple of updates, which I’ll be reviewing soon.  Plus, my taste in guitars has changed a bit recently, too.  I’ve got to say, Fender and Gibson have stepped up their game in the last couple of years, and I think that is directly correlated to the fact that PRS guitars sound and build quality is amazing.

It been an interesting ride, and it is going to get more interesting!

Solving a problem with TFS and building regular applications using TFSBuild

I’ve had a problem that has been driving me crazier than usual…  I’ve been trying to get the TFS Build process to create the ‘drop’ directories based upon the projects, rather than this huge glob directory of every file from every project.  Surprisingly, the default output of projects inside of TFS Build is to drop every file into one directory, EXCEPT for web sites.  What I’ve run into is needing to have applications and utility programs that are part of the solution and need to be deployed to be in their own directories when the build completes.  After spending a week of rather exotic solutions, including modifying the TFS Build definitions, writing all sorts of scripts, and looking at every package under the sun to solve the issue, I finally came across the CORRECT solution… tacking a property on to the MSBuild directive called GenerateProjectSpecificOutputFolder.  Setting that to true outputs to the per project directory structure.  This is EXACTLY what I’ve been looking for!  Thank you, Jason Stangroome for this WONDERFUL find!!!

Override the TFS Team Build OutDir property in .NET 4.5

 

Update… If you use the ReleaseTfvcTemplate.12.xaml from Release Management 2013 Update 2 client directory, the tokenization steps are missing.  Here is a link to a template that has the correct tokenization step, plus has the tokenization as a flag.  Cool stuff…

http://blogs.msdn.com/b/visualstudioalm/archive/2013/12/09/how-to-modify-the-build-process-template-to-use-the-option-trigger-release-from-build.aspx

For all the devs out there, check out Team Foundation Service from Microsoft

This isn’t an ad, just something that I feel devs should check out.

Microsoft Team Foundation Service

This is a good source control and task management system for a 5 person team. The price can’t be beat, at least not right now.  (Free)  I was able to take a very small team and in the space of a couple of hours, get them set up on TFS and start getting their existing projects moved over.  They have 2 1/2 developers working off shared drives for lots of projects.  No source control, build system, or deployment system just gives me the heebie-jeebies…  Fortunately, they were using Visual Studio 2010, so moving their projects was fairly straight forward.  The only real downside is that everyone needs a Microsoft Live ID, but since they are free, it’s not a big deal.

Problem solved with my Motorola SBG6580 Gateway / Router

Finally!!!  I’ve had a terrible time with the Motorola SBG6580 Router / Gateway and Comcast cable service.  I’ve been thinking that the issue has been Comcast, but it has turned out to be something WAY simpler…  I was getting a lot of hiccups / pauses with the router.  All that needs to be changed is on the Firewall, disable the IP Flood detection.  I just wonder if the high speed cable is ‘flooding’ the router?  I don’t know, but after turning the setting off, no more pauses!

A walk down memory lane…

Steve Patrick wrote up a nice little Monday morning blog about the Commodore 64.  Ah, that brings back LOTS of memories.  My C64 was my ONLY computer for close to 5 years.  My parents, too, believed that game systems rot the brain (and I can’t disagree too much 🙂 ).  Fortunately, the computer at the time was FAR more understandable than what we have now.  Heck, the user’s manual included a schematic of the computer’s logic board.  Try THAT nowadays!  I remember learning the PEEKs and POKEs for the ROM table, and could usually figure out most of the programs that were typed in.  It was a wonderful machine to learn on.  Plus, the games were cool.  I remember spending a summer playing Elite against my step sister, and building tracks with my friends with Racing Destruction Set.  The first ever D&D games were amazing on the C64, and mapping out the dungeons in the Bard’s Tales was really cool.  For productivity, there were two word processors that I cut my teeth on, one being the free one from Compute! (or Compute’s Gazette!) and then one which I can’t remember the name, but it did some AMAZING stuff.  I made a good deal of money typing up papers, printing certificates, and generally doing computer stuff all the time. 

What a great machine, and what great memories…