Sunday, May 14, 2017

First Alert Smoke Detector Keeps Chirping/Beeping 5 Times Every 45 Seconds

Came home today and our First Alert model 9120B smoke detector/fire alarm was chirping 5 times every 45 seconds.  Changed the battery like Youtube said, but to no avail.
Turns out it was the carbon monoxide detector located near the smoke detector that had gone bad.  9120B smoke detectors chirp 3 times when their having issues, not 5 times.  Thanks to the First Alert hotline for figuring this out (1-800-323-9005 option 1).

Saturday, May 06, 2017

In C# .Net MVC, How to Pass Arguments to RenderPartial

"Mikey"
Sometimes you just need to pass a bit of extra information to a RenderPartial.  It's easy in Microsoft MVC.  Assuming you need to pass the "name" of a zoo animal for the picture tiles:



Html.RenderPartial("_ZooAnimalTile", Animal);

All you need to do is add an entry to the ViewDataDictionary like this:



Html.RenderPartial("_ZooAnimalTile", Animal, new ViewDataDictionary { { "name",  "Mikey"} });

Then in the "_ZooAnimalTile" partial, you can extract the name like this:



string name= this.ViewData.ContainsKey("name")  && ViewData["name"] != null ? this.ViewData["name"].ToString() : string.Empty;

 Enjoy.  (I know the picture of the meerkat is superfluous, but ... I like meerkats).

PS: We have to be paranoid and check for the presence of "name" (i.e., this.ViewData.ContainsKey("name")  && ViewData["name"] != null) since this partial may be called from different places now or in the future.

Thursday, May 04, 2017

In TFS How to Close a Zombie Pull Request From a Deleted Branch

I had an old pull request hanging around in TFS and could not delete it since it's branch had been delete months ago.  Through the GUI, you cannot delete the Pull Request.

Simple steps to delete:
1. Create a new git branch with the same name as the deleted one.
2. Make a small change in the code.
3. Push the branch to the origin
4. On the TFS website you can now "Close" the zombie Pull Request.