start
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| start [2017/01/01 07:05] – external edit 127.0.0.1 | start [2024/08/24 01:22] (current) – [Running with Rubix] stephen | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Stephen' | + | ====== Stephen' |
| Welcome to Stephen' | Welcome to Stephen' | ||
| Line 6: | Line 6: | ||
| This is a collection of random stuff I want to record for future reference. Probably not much use to anyone else. | This is a collection of random stuff I want to record for future reference. Probably not much use to anyone else. | ||
| + | |||
| + | ===== .NET Logging Levels ===== | ||
| + | |||
| + | Trace = 0, Debug = 1, Information = 2, Warning = 3, Error = 4, Critical = 5, and None = 6. | ||
| + | |||
| + | ===== Running with Rubix ===== | ||
| + | |||
| + | Rubix and I did approximately 1,547 runs and covered 16,347kms together. First run was 2015-08-24, last was around 2024-07-24. | ||
| + | |||
| + | ===== Restart Garmin Forerunner 235 ===== | ||
| + | |||
| + | Hold down the ☀️ button for ages. Watch will power off. Press it again to power on. Settings etc. are not lost. | ||
| + | |||
| + | ===== Set Environment Variable in Unit Test ===== | ||
| + | |||
| + | Create a '' | ||
| + | |||
| + | <code xml> | ||
| + | <?xml version=" | ||
| + | <!-- File name extension must be .runsettings --> | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | <!-- List of environment variables we want to set--> | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | Getting Visual Studio to use the file is a bit tricky. Try Test -> Configure Test Settings. You may need the ' | ||
| + | |||
| + | To test, debug and stop at a breakpoint. Run '' | ||
| + | |||
| + | ===== Direct Object Creation with Ninject ===== | ||
| + | |||
| + | This will only work inside an ASP.NET project. | ||
| + | |||
| + | <code c#> | ||
| + | using System.Web.Mvc; | ||
| + | |||
| + | private ILog _log; | ||
| + | private ILog Log => _log ?? (_log = (ILog)DependencyResolver.Current.GetService(typeof(ILog))); | ||
| + | </ | ||
| + | |||
| + | ===== Azure Virtual Machine Windows Activation Problems ===== | ||
| + | |||
| + | Running this worked on my Azure Dev VM: | ||
| + | |||
| + | <code powershell> | ||
| + | ForEach-Object { Invoke-Expression " | ||
| + | </ | ||
| + | |||
| + | More details at [[https:// | ||
| + | |||
| + | ===== Log all TypeScript functions ===== | ||
| + | |||
| + | Search: ''< | ||
| + | |||
| + | Replace: ''< | ||
| + | |||
| + | ===== Stupid Roslyn Error ===== | ||
| + | |||
| + | < | ||
| + | Could not find a part of the path ' | ||
| + | </ | ||
| + | |||
| + | Run this in the Package Manager Console: | ||
| + | < | ||
| + | Update-Package Microsoft.CodeDom.Providers.DotNetCompilerPlatform -r | ||
| + | </ | ||
| + | |||
| + | ===== Use PowerShellGet behind a corporate proxy ===== | ||
| + | |||
| + | <code powershell> | ||
| + | notepad $PROFILE | ||
| + | </ | ||
| + | |||
| + | Add this to the top: | ||
| + | <code powershell> | ||
| + | [system.net.webrequest]:: | ||
| + | |||
| + | # To use your current Windows account to log on to the proxy: | ||
| + | [system.net.webrequest]:: | ||
| + | |||
| + | # To use a different Windows account: | ||
| + | $Username=" | ||
| + | $Password=" | ||
| + | [system.net.webrequest]:: | ||
| + | |||
| + | [system.net.webrequest]:: | ||
| + | </ | ||
| + | |||
| + | Restart your PowerShell session. Fix up the repository source: | ||
| + | <code powershell> | ||
| + | Register-PSRepository -Default | ||
| + | </ | ||
| + | |||
| + | Check you have a repository: | ||
| + | <code powershell> | ||
| + | Get-PSRepository | ||
| + | </ | ||
| + | |||
| + | Should get '' | ||
| + | |||
| + | |||
| + | ===== Add the IIS Development certificate to the Trusted Root Certificates ===== | ||
| + | |||
| + | - Open MMC. | ||
| + | - Add the Certificates snap-in for ' | ||
| + | - Console Root > Certificates (Local Computer) > Personal > Certificates. | ||
| + | - localhost (IIS Express Development Certificate) > Right click > Copy. | ||
| + | - Console Root > Certificates (Local Computer) > Trusted Root Certification Authorities > Certificates. | ||
| + | - Actions (right panel) > More Actions > Paste | ||
| + | |||
| + | ===== Kill Chrome instances from automated testing ===== | ||
| + | |||
| + | <code powershell> | ||
| + | (Get-WmiObject Win32_Process -Filter "name = ' | ||
| + | </ | ||
| + | |||
| + | And if you want to get rid of the Chrome driver as well (which is always a good idea): | ||
| + | |||
| + | <code powershell> | ||
| + | (Get-WmiObject Win32_Process -Filter "name = ' | ||
| + | </ | ||
| + | |||
| + | ===== Faking DateTime.Now() ===== | ||
| + | |||
| + | <code c#> | ||
| + | using (ShimsContext.Create()) | ||
| + | { | ||
| + | System.Fakes.ShimDateTime.NowGet = () => new DateTime(2019, | ||
| + | ... | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ===== Chrome Dev Tools - Show only bad network requests ===== | ||
| + | |||
| + | Copy and paste the below into the filter. | ||
| + | |||
| + | '' | ||
| + | |||
| + | ===== Unit testing - test a method on a property is executed ===== | ||
| + | |||
| + | Requires the [[https:// | ||
| + | |||
| + | <code c#> | ||
| + | [TestMethod] | ||
| + | public void MealViewModel_Banana_EatMethodIsCalled_DrinkIsNot() | ||
| + | { | ||
| + | IUtensil spoon = new Spoon(); | ||
| + | var mockBanana = new Mock< | ||
| + | var test = new MealViewModel(); | ||
| + | testMeal.Banana = mockBanana.Object; | ||
| + | |||
| + | // Calling Eat() on the meal should also call Eat() on the banana. | ||
| + | testMeal.Eat(spoon); | ||
| + | |||
| + | mockBanana.Verify(banana => banana.Eat | ||
| + | mockBanana.Verify(banana => banana.Drink(It.IsAny< | ||
| + | // Not sure if an interface will work here -------^^^^^^^^ | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ===== Visual Studio can't open CSHTML files ===== | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | Fix it thusly: | ||
| + | |||
| + | - Close Visual Studio. | ||
| + | - Delete everything in '' | ||
| + | - Open Visual Studio. | ||
| + | |||
| + | ===== Append randomness to start of a filename ===== | ||
| + | |||
| + | <code powershell> | ||
| + | Get-ChildItem *.mp3 | ForEach-Object{Rename-Item $_ -NewName " | ||
| + | </ | ||
| ===== Why did Windows wake from sleep? ===== | ===== Why did Windows wake from sleep? ===== | ||
| Line 319: | Line 499: | ||
| <code powershell> | <code powershell> | ||
| - | Get-Item *.jpg | ForEach-Object { convert $_ " | + | Get-Item *.jpg | ForEach-Object { magick |
| </ | </ | ||
| Line 325: | Line 505: | ||
| <code powershell> | <code powershell> | ||
| - | Get-ChildItem ' | + | Get-ChildItem ' |
| </ | </ | ||
| Line 331: | Line 511: | ||
| <code powershell> | <code powershell> | ||
| - | Get-ChildItem | Foreach { convert $_.FullName -quality 98 " | + | Get-ChildItem | Foreach { magick |
| </ | </ | ||
start.1483254319.txt.gz · Last modified: 2017/05/08 21:14 (external edit)
