Pages

Thursday, 2 June 2016

Git Bisect


  1. Realize you have a defect in master.
  2. Find a changeset in the past where you know the defect didn't exist (make a note of it)
  3. checkout most recent changeset (i.e. master)
  4. git bisect start
  5. git bisect good [changeset]
  6. git bisect bad master
    1. This will set the checkout changeset to a bad state and checkout 
  7. Test your code
  8. If you find the bug
    1. git bisect bad
  9. If the bug doesn't exist
    1. git bisect good
  10. If you get to a changeset that prevents you from testing
    1. git bisect skip 
  11. When you get to the end, you should see something like:
00000e22334373dcddad1ggw48e3da8bfdce243b is the first bad commit
commit 00000e22334373dcddad1ggw48e3da8bfdce243b 

To exit from git bisect: git bisect reset
To go to that bad commit: git checkout 00000e22334373dcddad1ggw48e3da8bfdce243b 

Tuesday, 23 June 2015

Creating NuGet Packages with Octopack


  1. Create a blank Visual Studio Project
  2. Create a folder in the solution that contains the dll's that you want to be part of your package.
  3. For each of the included dll's, right click > 'Properties' > set the 'Copy to Output Directory' value to 'Copy Always'.
  4. In Package Manager Console type:
    1. Install-Package OctoPack
  5. Right Click on the project in Solution Explorer > 'Unload Project'
  6. Edit the project file.
  7. Find the 'Release'  configuration PropertyGroup
  8. Add the node:
    1. <RunOctoPack>true</RunOctoPack>
  9. Reload the project and compile in 'Release' mode
  10. The *.nupkg file should now be in the 'Release' folder.

Thursday, 26 August 2010

Dynamically Altering a DropDownList in JavaScript

Using JavaScript to dynamically alter can sometimes be tricky. In 99% of cases *1* will not be an option. This hugely compromises security.
In the web.config
*2* maybe an option, but we need to know the ListItems before we put them into the DropDownList; this is not always possible
protected override void Render(System.Web.UI.HtmlTextWriter writer)
{
  base.Render(writer);
  Page.ClientScript.RegisterForEventValidation( cboLookup.ID);
}
*3*, I think is the simplest way, but it does stray from the .Net way of doing things; ah well! Instead of using
<asp:DropDownList runat="server" blah blah blah />
use
<select id="ddl1" runat="server" enableviewstate="true"></select>
You may find that you cannot access the 'selectedindex' is not accessible in your 'button_Click' event (or whatever). In order to get your selected value, simply use:
Request.Form[ddl1.UniqueID]

Tuesday, 24 August 2010

Sunday, 25 April 2010

Multiple controls with the same ID '***' were found

I have come across this issue a few times. I have experienced two causes:

  1. You have two or more controls on the page. - Sorry for stating the obvious.
    • This could mean that you have two user controls that each contain a control with the same ID. 
  2. The Page_Load event is getting called twice.
    • If you have migrated to a newer version of .Net, you may have experienced that Visual Studio has very kindly added a second call to the event handler - so look for this and get rid!
    • Set the AutoEventWireup to false.
      • (msdn) the ASP.NET page framework also supports an automatic way to associate page events and methods. If the AutoEventWireup attribute of the Page directive is set to true (or if it is missing, since by default it is true), the page framework calls page events automatically, specifically the Page_Init and Page_Load methods. In that case, no explicit Handles clause or delegate is needed.