how to reset

The jQuery solution that @dhaval-marthak posted in the comments obviously works, but if you look at the actual jQuery call it’s pretty easy to see what jQuery is doing, just setting the value attribute to an empty string. So in “pure” JavaScript it would be: document.getElementById(“uploadCaptureInputFile”).value = “”;

Resolution of std::chrono::high_resolution_clock doesn’t correspond to measurements

I’m going to guess you are using Visual Studio 2012. If not, disregard this answer. Visual Studio 2012 typedef‘s high_resolution_clock to system_clock. Sadly, this means it has crappy precision (around 1 ms). I wrote a better high-resolution clock which uses QueryPerformanceCounter for use in Visual Studio 2012… HighResClock.h: struct HighResClock { typedef long long rep; typedef std::nano period; typedef std::chrono::duration<rep, … Read more

Set content files to “copy local : always” in a nuget package

Instead of using a PowerShell script another approach is to use an MSBuild targets or props file with the same name as the package id: <Project xmlns=”http://schemas.microsoft.com/developer/msbuild/2003″> <ItemGroup> <None Include=”$(MSBuildThisFileDirectory)importantfile.xml”> <Link>importantfile.xml</Link> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </None> </ItemGroup> </Project> In the nuspec file then, instead of adding the required files to the Content directory, add them to the Build … Read more

Error: allowDefinition=’MachineToApplication’ beyond application level

I’ve just encountered this “delight”. It seems to present itself just after I’ve published a web application in release mode. The only way to consistently get round the issue that I’ve found is to follow this checklist: Clean solution whilst your solution is configured in Release mode. Clean solution whilst your solution is configured in … Read more

How to add Web API to an existing ASP.NET MVC 4 Web Application project?

The steps I needed to perform were: Add reference to System.Web.Http.WebHost. Add App_Start\WebApiConfig.cs (see code snippet below). Import namespace System.Web.Http in Global.asax.cs. Call WebApiConfig.Register(GlobalConfiguration.Configuration) in MvcApplication.Application_Start() (in file Global.asax.cs), before registering the default Web Application route as that would otherwise take precedence. Add a controller deriving from System.Web.Http.ApiController. I could then learn enough from the … Read more