I like github for windows. Seriously, they did a great job with it - kudos, Phil. I like that it has an updateable bash shell ala msysgit. I also like to use git-flow but alas, this isn’t included with the release. Here is how I got it installed on my system anyway:

First, I cloned the gitflow repository (using github for windows) then opened the shell there. The readme says there is a cmd script in the contrib folder called msysgit-install.cmd so I tried to use this but the script told me it couldn’t find getopt:

boo.

Fortunately, I have the other install of msysgit on my machine so I copied getopt.exe from C:\Program Files\Git\bin to that fancy path in the image above, along with some supporting dlls

After doing this, running msysgit-install.cmd copied over the necessary files, and I was able to cd to a repository with only master and develop branches and run git flow init.

Next step: a feature request to the github for windows team to ask for maybe including at least getopt if not git-flow in the next release?

posted @ Monday, July 02, 2012 7:16 PM | Feedback (0) | Filed Under [ git ]

this is outlined on github by psampaio:

I managed to get git flow working with msysGit, but needed some hacks on my setup. First, I copied all the git* files to libexec\git-core. Then replaced shFlags like snaewe mentioned, but <install_dir> for me was also libexec\git-core.

Git flow complained about getopt. I got it from cygwin (package utils_linux*) and copied the getopt.exe to the bin folder. Also had to copy 4 more files from cygwin to the bin folder (cyggcc_s-1.dll, cygiconv-2.dll, cygintl-8.dll and cygwin1.dll).

Like I said in the beginning, this is a hacky solution but it did work for me.

I simply followed what they said and have gotten this working on a few windows 7 machines. I even took it a step further and created a couple of zip files of the dlls and scripts required: bin.zip and git-core.zip

To install these for mSysGit:

  1. copy bin.zip to C:\Program Files\Git
  2. unzip bin.zip
  3. copy git-core.zip to C:\Program Files\Git\libexec
  4. unzip git-core.zip

 

[it’s important that they are unzipped from the correct place, but you knew that :)]

and that’s all there is to it. you should now be able to go to a git repository on windows with mSysGit, type git flow init, and be presented with the git flow setup prompts.

enjoy!

This was pretty straightforward but I didn't find it written up anywhere on the web so here goes. What follows is how I addressed testing IPrincipal in ASP.NET MVC using xunit.net

Let's start with the test:

  1 [Fact]
  2 public void changes_password() {
  3   //arrange
  4   var controller = ObjectFactory.GetInstance<AccountController>();		
  5   controller.ControllerContext = new TestControllerContext();
  6 
  7   //act
  8   var result = controller.ChangePassword("password", "p455w0rd", "p455w0rd");
  9 
 10   //assert
 11   var viewResult = Assert.IsType<RedirectToRouteResult>(result);
 12 }

notice line 5. why are we setting a custom ControllerContext here? ControllerContext tells the current controller about things like HttpContext, which will be unavailable during tests (whoops!) This is needed because somewhere in the Action code, I am making a call into User.Identity.Name, which is supplied by HttpContext at runtime. Again, since this isn't available during testing, I have to tell the controller how to find the fake httpcontext used then.

For this project, I'm using simple hand-rolled stubs. Here is the code for TestControllerContext:

  1 	public class TestControllerContext : ControllerContext {
  2 		public override System.Web.HttpContextBase HttpContext {
  3 			get {
  4 				return new TestHttpContext();
  5 			}
  6 			set {
  7 				base.HttpContext = value;
  8 			}
  9 		}
 10 	}

instead of returning the runtime HttpContext (which doesn't exist, remember) I'm supplying another hand-rolled stub. Here is that code:

  1 	public class TestHttpContext : HttpContextBase {
  2 		public override System.Security.Principal.IPrincipal User {
  3 			get {
  4 				return new TestPrincipal();
  5 			}
  6 			set {
  7 				base.User = value;
  8 			}
  9 		}
 10 	}

again, same principal :) because I'm concerned about calling into User for the Identity.Name property, I return another stub that implements IPrincipal. Here is that code:

  1 	public class TestPrincipal : IPrincipal{
  2 		public IIdentity Identity {
  3 			get { return new GenericIdentity("you@me.com"); }
  4 		}
  5 
  6 		public bool IsInRole(string role) {
  7 			throw new NotImplementedException();
  8 		}
  9 	}

now, when the controller code that was calling User.Identity.Name is tested, it will return the name you@me.com. Line 11 of the test code above asserts the test passes because if an error occurred, I would redisplay the form with errors shown using the View() method. A redirect says that the change password op worked:

  1 if (MembershipService.ChangePassword(User.Identity.Name, currentPassword, newPassword)) 
  2   return RedirectToAction("ChangePasswordSuccess");

hth.

Here is a clone of the TextMate theme "Sunburst" for Visual Studio 2010: http://bluefenix.net/etc/blue_fenix_sunburst_lite.zip

I just guessed on the colors since I had to translate from mac colors to windows, but the result is pretty effective for me. enjoy!

update: I changed the colors to use the actual rgb values from textmate.

    <system.data>
        <DbProviderFactories>
            <remove invariant="System.Data.SQLite"/>
            <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".Net Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite"/>
        </DbProviderFactories>
    </system.data>

this happened to me using subsonic on an x64 machine. adding the x64 binary to /bin and adding the above to my web.config got me sorted.

http://www.lostechies.com/blogs/joshuaflanagan/archive/2010/01/28/how-to-resolve-a-binary-file-conflict-with-git.aspx

Thank you for that!

Although the message at the end of git status says use git checkout -- <file>, that's not it.

"If you prefer to resolve the conflict using their copy, you need to get the version of the file from the branch you were trying to merge in:

git checkout otherbranch somefile.dll"

sweet.

posted @ Friday, March 05, 2010 9:09 PM | Feedback (0) | Filed Under [ git ]

I have an xunit test project that is using hand-rolled stubs as concrete implementations of interfaces. StructureMap is the DI container I'm using. I was looking at the names of my stubs, and they followed the convention of TestXYZ as the concrete implementation of IXYZ.

To use StructureMap from xunit tests, I created a base class for any fact class that wanted to use ObjectFactory. In the base class ctor, I call the bootstrapper's ConfigureStructureMap method.

At first I just had a bunch of x.ForRequestedType<IXYZ>().TheDefaultIsConcreteType<TestXYZ>(); because I had only a handful of stubs and I didn't quite grasp how to scan like the default scanner, only adding "Test" to the beginning of the class name.

Then I found the secret sauce over here, via a method called FindPluginType.

Here is my bootstrapper code for my xunit test project:

  1 public class TestScanner : ITypeScanner{
  2 		public void Process(Type type, PluginGraph graph) {
  3 			if(type.Name.StartsWith("Test")){
  4 				var pluginType = FindPluginType(type);
  5 
  6 				if(pluginType == null)
  7 					return;
  8 
  9 				graph.AddType(pluginType, type);
 10 			}				
 11 		}
 12 
 13 		static Type FindPluginType(Type concreteType) {
 14 			var interfaceName = "I" + concreteType.Name.Replace("Test", "");
 15 
 16 			return concreteType
 17 				.GetInterfaces()
 18 				.Where(t => string.Equals(t.Name, interfaceName, StringComparison.Ordinal))
 19 				.FirstOrDefault();
 20 		}
 21 	}
 22 
 23 	public static class Bootstrapper {
 24 		public static void ConfigureStructureMap() {
 25 			ObjectFactory.Initialize(x =>
 26 			{
 27 				x.Scan(s =>
 28 				{
 29 					s.TheCallingAssembly();
 30 					s.WithDefaultConventions();
 31 					s.With<TestScanner>();
 32 				});
 33 			});
 34 		}
 35 	}
What results is essentially the DefaultConventionScanner, only it's looking for TestXYZ as the concrete implementation of IXYZ.

Killer.

Check this: "AutoMapper - ASP.NET MVC" on Deran Schilling, Learner.

I've been catching up on Deran's posts about his wife's portfolio site. I'm quite enjoying the explanation of his thought process while building out the application. That is all.

Basically this is what happened:

The MSDN subscriptions version of Windows Server 2008 installs by default using KMS (Key Management Service).
The key MSDN gave is a MAK (Multiple Activation Key).
So the install does not use the key, it tries to talk to KMS.
We don't have KMS here so it fails.

Doing the following activates it using the MAK key:

1) Open a cmd shell as Administrator.
2) Type the following (but use your key instead of all the X's)

slmgr -ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX

3) The prompt will return right away, but there is a licensing task that it started (if you look in Task Manager you can find a task SLsvc using up cpu, I assume this is where the licensing is going on).
4) After a while a dialog will pop up saying that it has been activated.

Good Luck

above was lifted from a forum post. buried in there is the command line to bypass KMS and use the proper MAK instead. It worked!

In the process of figuring this out, MSFT had me download a video explaining how to setup a KMS, one of the requirements is that you need 5 servers to contact KMS before it will work. That's fucking retarded. If I'm paying for a product, I expect that I'm paying for ease of use. Making your paying customers bend over backwards to use the product you are selling is unsustainable, bad business. You can do better than that, Microsoft.