Thursday, August 13, 2020

Wednesday, July 22, 2020

stdoutLogFiles

Change stdoutLogFiles to get the desired result at Angular 5. Valerio De Sanctis mentions it on the 4th to last page of ASP.NET Core 2 and Angular 5 and it was a fine booklet.

Friday, July 10, 2020

Adobe ImageReady

This used to be given away free with Photoshop some years back, like twenty. It was a bitmap editor.

Wednesday, May 13, 2020

.GetService in Framework and Core

This is in the .NET Framework stuff. This cannot move. There is no HttpConfiguration in .NET Core.

private static void InitAuthorizationCache(HttpConfiguration config)
{
   var cacher = (ICacher)config.DependencyResolver.GetService(typeof(ICacher));
   var logger = (ILogger)config.DependencyResolver.GetService(typeof(ILogger));
   var authorizationCache = new AuthorizationCache(cacher, logger);
   authorizationCache.LoadCache();
}

 
 

Alright, in Startup.cs, of a .NET Core 3.1 application, we can jam what is above, in here:

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
   var cacher = (ICacher)app.ApplicationServices.GetService(typeof(ICacher));
   var logger = (ILogger)app.ApplicationServices.GetService(typeof(ILogger));
   var authorizationCache = new AuthorizationCache(cacher, logger);
   authorizationCache.LoadCache();

 
 

                                    

I will not show all of the method immediately above because it eventually has app.UseEndpoints in it, etc. Run the ILogger using using Serilog.

Tuesday, May 12, 2020

app.UseEndpoints

You probably need app.UseEndpoints even if you don't need everything inside. You could maybe leave it blank, and especially if each Controller has...

[ApiController]
[Route("api/[controller]")]

 
 

    

...decorating it. In that scenario have:

app.UseEndpoints(endpoints =>
{
});

Sunday, May 10, 2020

more random from Dungeons and Dragons

The gunk at QMap.pub uses QAnon which have only existed since 2017. Q notifications tell you, the listener, of new QAnon. Vivaldi allows for some interesting combos. It seems right-click, right is back and right-click, left is forward. Migraine headaches, outside of ANY sickness, fled into me last week. Yesterday was the first day without. I think in working from home and having May come there was just too much sunlight. Anyhow, I was offered some blue blocker sunglasses. What is NOT communicated (heavily) is that I just blocked off the window in my bedroom. The girl running the game says that war fog allows her to project one screen and have the rest of the players see the one screen redacted, on a different display.

Friday, May 8, 2020

a bit more on IMemoryCache

Remove an id:

_memoryCache.Remove((object) id);

 
 

Fish out a specific type:

var authItems = _memoryCache.Get<AuthorizationCacheItem>(foo);

get IMemoryCache to work with Autofac

In the setup...

builder.RegisterType<MemoryCache>().As<IMemoryCache>().SingleInstance();

 
 

At a Controller...

private readonly IMemoryCache _memoryCache;
public ServiceController(IMemoryCache memoryCache)
{
   _memoryCache = memoryCache;

 
 

In an action...

var cacheEntry = _memoryCache.GetOrCreate("foo", entry =>
{
   entry.Value = (object)"bar";
   return Task.FromResult((string) entry.Value);
});

 
 

Elsewhere, in a different action...

object cacheEntry = _memoryCache.Get("foo");

Secret Manager Tool

It is the stuff which manages secrets.json per ASP.NET Core 2 and Angular 5 by Valerio De Sanctis.

IMemoryCache Interface

...for .NET Core. It is a thing.

.NET Framework Caching

Assuming at the top of a Controller...

private readonly ICacher _cacher;

 
 

...then...

_cacher.AddtoCache("foo", "bar");

 
 

...then...

var meh = _cacher.GetValue("foo");

 
 

...then...

_cacher.FlushKeys();

 
 

...then...

var deleted = _cacher.DeleteKey(id);

 
 

...then...

var authItems = _cacher.GetValue(CacheItems.AuthorizationItems) as
      AuthorizationCacheItem;

What does the [EnumMember] attribute do in C#?

Meh. It allows that which is serializable to be deserialized as an enum.

using System.Runtime.Serialization;
namespace Ecs.Domain.Health.Web.Models
{
   [DataContract(Name = "mode", Namespace =
         Namespaces.PrtgModelsNamespace)]
   public enum PrtgModeType
   {
      [EnumMember]
      Absolute,
      [EnumMember]
      Difference
   }
}

Wednesday, May 6, 2020

Microsoft.Extensions.Configuration

More random extensions stuff... This may come into play when migrating from .NET Framework to .NET Core.

Tuesday, May 5, 2020

What uses a IComponentRegistryBuilder?

This is Autofac stuff. I found a library online that has ComponentRegistryBuilder implementing both IDisposable and IComponentRegistryBuilder. I'd stop now, but I wanted to mention that this was inside:

public event EventHandler<ComponentRegisteredEventArgs> Registered
{
   add
   {
      lock (_synchRoot)
      {
         Properties["x"] = GetRegistered() + value;
      }
   }
   
   remove
   {
      lock (_synchRoot)
      {
         Properties["x"] = GetRegistered() - value;
      }
   }
}

 
 

At the top of the file, _synchRoot is defined like so:

private readonly object _synchRoot = new object();

Saturday, May 2, 2020

zone/NgZone in Angular

This shows up on page 468 of ASP.NET Core 2 and Angular 5 by Valerio De Sanctis and is explained to be a thread encapsulation for JavaScript in Angular. Whenever something has to be tracked back Angular uses these unseen and you should really roll these out too. When talking in from the outside, use a zone.

Friday, May 1, 2020

System.StackOverflowException

we are doing too much

.Primatives

This requires that System.ServiceModel.Primatives be installed:

var serviceClient = client as ClientBase<FNCEWS40PortType>;

 
 

The thing that is wacky about this is that System.ServiceModel without Primatives may already be installed and System.ServiceModel.Primatives uses the same using statement without the .Primatives on the end.

Thursday, April 30, 2020

How do I get all URL line variables in .NET Core 3+ including those which start with a dollar sign?

List<string[]> queryStringChunks = new List<string[]>(){};
string queryString = Request.QueryString.ToString();
if (queryString != null && queryString.Length > 1)
{
   queryString = queryString.Substring(1, queryString.Length - 1);
   foreach (var chunk in queryString.Split('&'))
   {
      queryStringChunks.Add(chunk.Split('='));
   }
}

Wednesday, April 29, 2020

How may I pass the username and password to a GET with Postman?

At Headers, make two variables for Username and Password and have each just pass on a string. Back at Authorization, set up NTLM Authentication [Beta] and have the Username pass {{Username}} and the Password pass {{Password}} as well.

How do I grab the latest, most immediate user from .NET Core?

This guy has a pretty good cheat sheet. Inside ConfigureServices in Startup.cs put:

services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();

 
 

The rest of this code is Controller-flavored. Have a private field at a given Controller.

private readonly IHttpContextAccessor _httpContextAccessor;

 
 

At the constructor:

public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options,
      IHttpContextAccessor httpContextAccessor) : base(options)
{
   _httpContextAccessor = httpContextAccessor;

 
 

When you use it, loop in...

using System.Security.Claims;

 
 

...and then have:

var userId =
      _httpContextAccessor.HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value;

'base.Channel' threw an exception of type 'System.ServiceModel.CommunicationObjectFaultedException'

Something is sick with a .wsdl/SOAP web service, causing this error. MTOM is Message Transmission Optimization Mechanism. It sends binary data. In SOAP/XML, WS-* or WS-star will include WS-Policy, WS-Addressing, WS-Trust, WS-SecureConversation, WS-Transaction, etc. WS for web services, get it? Duplex channels describe the use of two frequency channels. A talks to B while B talks back to A on a seperate channel. The following in ConfigureServices in Startup.cs will allow IIS to always send credentials with web requests.

services.Configure<IISServerOptions>(options =>
{
   options.AutomaticAuthentication = false;
});

 
 

For Kestrel:

services.AddAuthentication(NegotiateDefaults.AuthenticationScheme).AddNegotiate();

HTTP.sys

It is another way to run a Visual Studio project. sys for system?

Tuesday, April 28, 2020

Don't expect Thread.CurrentPrincipal.Identity.Name or even Thread.CurrentPrincipal to work in .NET Core.

See: this

Use System.DirectoryServices.AccountManagement to verify the password of a user in .NET Core.

using (PrincipalContext pc = new PrincipalContext(ContextType.Domain))
{
   bool isValid = pc.ValidateCredentials(username, password);
   if (isValid)
   {

more on MOQ

Mock.Of is a way to prep a dependency to be jammed into a class (to line up with an interface) and Mock.Loose is a way to set the mocking approach to "not strict" so to speak. There is also a Mock.Get too!

Monday, April 27, 2020

System.DirectoryServices.AccountManagement beyond System.DirectoryServices.ActiveDirectory

using(var ServerContext = new PrincipalContext(ContextType.Domain))
{
   GroupPrincipal outerGroupPrincipal = new GroupPrincipal(ServerContext, alt);
   PrincipalSearcher principalSearcher = new PrincipalSearcher(outerGroupPrincipal);
   foreach (var found in principalSearcher.FindAll())
   {
      GroupPrincipal innerGroupPrincipal = found as GroupPrincipal;
      if (innerGroupPrincipal != null)
      {
         foreach (Principal p in innerGroupPrincipal.GetMembers())
         {
            var hello = "goodbye";
         }
      }
   }
}

Check to see if .FindOne just created a null object in Active Directory stuff in C#!

Following up on this...

SearchResult searchResult = directorySearcher.FindOne();
if (searchResult != null)
{

Novell

These guys had the old way to do active directory stuff.

app.UseAuthentication();

See: this This goes in Startup.cs and this is for always and not sometimes. SPN stands for Service Principal Name(s) in this circumstance. It is part of the .NET Core approach.

Where do I get Active Directory Authentication Library (a.k.a. ADAL) for Active Directory authentication?

At: https://github.com/AzureAD/azure-activedirectory-library-for-js

Why can't I debug in Visual Studio via Postman?

You can! If you set a breakpoint in Program.cs or Startup.cs, these breakpoints will only be hit when you first hit the application and not every single time.

Sunday, April 26, 2020

Friday, April 24, 2020

How do I make Program.cs use Kestrel in modern .NET Core 3+ times?

My code:

using System.Diagnostics.CodeAnalysis;
using Autofac.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
namespace Yin
{
   public class Program
   {
      [ExcludeFromCodeCoverage]
      public static void Main(string[] args)
      {
         CreateHostBuilder(args).Build().Run();
      }
      
      [ExcludeFromCodeCoverage]
      public static IHostBuilder CreateHostBuilder(string[] args) =>
            Host.CreateDefaultBuilder(args)
            .UseServiceProviderFactory(new AutofacServiceProviderFactory())
            .ConfigureWebHostDefaults(webBuilder =>
            {
               webBuilder.UseStartup<Startup>().UseKestrel();
            });
   }
}

 
 

A coworker's code:

namespace Yin
{
   using System;
   using System.Diagnostics.CodeAnalysis;
   using Yang;
   using Microsoft.AspNetCore;
   using Microsoft.AspNetCore.Hosting;
   using Serilog;
   
   [ExcludeFromCodeCoverage]
   public class Program
   {
      [ExcludeFromCodeCoverage]
      public static int Main(string[] args)
      {
         Logger.CreateLogger();
         
         try
         {
            Log.Information("{message}", "Starting web host: FnDocs.Web.Api");
            CreateWebHostBuilder(args).Build().Run();
            return 0;
         }
         catch (Exception ex)
         {
            Log.Error(ex, "Host terminated unexpectedly{ex}");
            return 1;
         }
      }
      
      [ExcludeFromCodeCoverage]
      public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
            WebHost.CreateDefaultBuilder(args)
            .UseStartup<Startup>()
            .UseKestrel()
            .UseSerilog();
   }
}

Request.Properties in .NET Framework becomes Request.RouteValues in .NET Core???

Request.Properties.Add("FileName", document.FileName);

 
 

...becomes...

Request.RouteValues.Add("FileName", document.FileName);

What's wrong with my port to .NET Core? The .dlls of supporting projects?

Could be. I ran into this in the last two days. It was pointed out to me that Framework projects cannot go into Kubernetes and, hence, I started porting all Framework projects to .NET Core. When I referenced the random, in-house projects back into my main application, I accidentally referenced some of the wrong versions, etc. Lame!

Thursday, April 23, 2020

List vs LinkedList

This suggests: "The difference is the internal data structure used to store the objects. An ArrayList will use a system array (like Object[]) and resize it when needed. On the other hand, a LinkedList will use an object that contains the data and a pointer to the next and previous objects in the list." ...and yes, ArrayList is List. Юлия Данилова (Yulia Danilova) suggests stuff like:

LinkedList<string> linked = new LinkedList<string>(){};
linked.AddLast("baz");
linked.AddLast("qux");
linked.AddFirst("foo");
LinkedListNode<string> node = linked.Find("foo");
linked.AddAfter(node, "bar");

Wednesday, April 22, 2020

Mug Life

For iPhone or Android, it will allow you to make an existing photo talk and freak out some. It is not free.

Tuesday, April 21, 2020

Constructor on type 'meh' not found.

This stems from using System.Activator.CreateInstance which can just pick the wrong constructor for a class. Tricky stuff! Remember if you want to call a type with three parameters at the constructor that you must pass four constructors to the CreateInstance and the CreateInstance will use the first as the type to create. Also, if there are many constructors, the constructor with the most variables wins!

Add a .wsdl/SOAP web service in .NET Core 3+ and Visual Studio 2019.

right-click on the project and pick: Add > Connected Service

magical mystery folder in Visual Studio 2019

In the .NET Framework stuff you may jam into the files a nonexistent folder like so by making this change to the .csproj file:

<ItemGroup>
   <Folder Include="Diagnostics\DocSolLogger\" />
</ItemGroup>

 
 

In .NET Core there should be only one ItemGroup and you should just put this inside of it:

<Folder Include="Diagnostics\DocSolLogger\" />

 
 

I get a red X on the folder in .NET Core.

Sunday, April 19, 2020

Friday, April 17, 2020

An extension method for HttpRequestMessage (Request in a Controller) in .NET Framework becomes an extension method for HttpRequest (Request in a Controller) in .NET Core.

internal static string GetComponentIdentifier(this HttpRequestMessage request)
{
   return request.GetHeader(HttpKeys.ComponentIdentifier);
}

 
 

What is above becomes:

internal static string GetComponentIdentifier(this HttpRequest request, StringValues x)
{
   Boolean isLegit = request.Headers.TryGetValue("ComponentIdentifier", out x);
   return x;
}

translating MVC Framework to MVC Core

Alright Request.RequestUri.AbsoluteUri.ToLower() becomes Request.Path.ToString() while Request.RequestUri.Host becomes Request.Host.Host additionally. The first bit fishes out the chunk of the route after the domain name and the second bit gets the domain name or localhost or whatever. The port is not included. Request.Host.Port digs out the port.

 
 

Addendum 4/24/2020: Request.Path.ToString() should really be Request.Path.ToString().ToLower() you know?

A lot of the new .NET Core 3.1.4 routing tricks do not hydrate a route at IRouteBuilder off of IApplicationBuilder.

app.UseEndpoints(endpoints =>
{
   endpoints.MapControllerRoute(

 
 

...won't work! Fish out the route like so:

using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Routing;
namespace Cms.Web.Services.Models
{
   public class DeRouting
   {
      IApplicationBuilder app;
      public DeRouting(IApplicationBuilder app)
      {
         this.app = app;
      }
      
      public IRouteBuilder GetRoutes()
      {
         IRouteBuilder routes = new RouteBuilder(app);
         routes.MapRoute("default", "{controller=Home}/{action=Index}/{id?}");
         return routes;
      }
   }
}

Thursday, April 16, 2020

Have more than one route in .NET Core 3.1.4.

You see how the first is the first criteria to fail against, right?

app.UseEndpoints(endpoints =>
{
   endpoints.MapControllerRoute(name: "default", pattern: "api/[controller]");
   endpoints.MapControllerRoute(name: "failover", pattern: "*", defaults: new { controller =
         "FalloverFailsafe", action = "Get" });
});

How do I set the time zone in a .NET Core 3.1.4 application?

In Startup.cs you have to use .UseMvc before .UseEndpoints like you were still in the 2.0 stuff like so in Configure:

app.UseMvc(m => m.SetTimeZoneInfo(TimeZoneInfo.Utc));
app.UseEndpoints(endpoints =>
{

 
 

Set the EnableEndpointRouting to false upstream in ConfigureServices to keep this from tanking the application outright.

services.AddMvc(options =>
{
   options.Filters.Add(new BubbleUpExceptions());
   options.EnableEndpointRouting = false;

PPP in Agile PPP stands for Principles, Patterns, and Practices.

meh

The ECS of Amazon ECS stands for Elastic Container Service.

It is a "fully managed container orchestration service" per this.

Microsoft.AspNetCore.OData installs sickly in .NET Core 3.1.4.

For me the problem was a mishmash between Microsoft.AspNetCore.OData and the earlier Microsoft.AspNet.OData. I uninstalled everything (both things) and then at the NuGet command line gave:

Install-Package Microsoft.AspNetCore.OData -Version 7.3.0

Wednesday, April 15, 2020

ASR is automatic speech recognition.

It is machine learning stuff.

JsonException: A possible object cycle was detected which is not supported. This can either be due to a cycle or if the object depth is larger than the maximum allowed depth of 32.

Import Microsoft.AspNetCore.Mvc.NewtonsoftJson into Startup.cs and then make a stitch like so:

services.AddMvc(options =>
{
   options.Filters.Add(new ValidateComponentIdentifier());
   options.Filters.Add(new BubbleUpExceptions());
}).AddNewtonsoftJson(options => options.SerializerSettings.ReferenceLoopHandling =
      Newtonsoft.Json.ReferenceLoopHandling.Ignore);

 
 

It is the last line above (well, the last two really) that is most important.

Find out what controller is being found with OnActionExecuting in .NET Core 3.1.4.

This follows up on this and explains why I need a Controller for every possible route. Without a Controller to find, this method does not get called.

using System;
using Microsoft.AspNetCore.Mvc.Filters;
namespace Cms.Web.Services.Filters
{
   public class ValidateComponentIdentifier : IActionFilter
   {
      public void OnActionExecuting(ActionExecutingContext context)
      {
         string name = (string)context.RouteData.Values["Controller"];
         if (name == "FalloverFailsafe")
         {
            throw new Exception("There is no endpoint with the name specified.");
         }
      }
      
      public void OnActionExecuted(ActionExecutedContext context)
      {
      }
   }
}

 
 

Loop this in as you might BubbleUpExceptions.

Make a .NET Core 3.1.4 Controller catch anything!

using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
namespace NotIt.Controllers
{
   [ApiController]
   [Route("/{a?}")]
   [Route("/{b?}/{c?}")]
   [Route("/{d?}/{e?}/{f?}")]
   [Route("/{g?}/{h?}/{i?}/{j?}")]
   [Route("/{k?}/{l?}/{m?}/{n?}/{o?}")]
   [Route("/{p?}/{q?}/{r?}/{s?}/{t?}/{u?}")]
   public class FalloverFailsafeController : ControllerBase
   {
      [HttpGet]
      public IEnumerable<string> Get()
      {
         IEnumerable<string> error = new string[] {"not", "it"};
         return error;
      }
   }
}

 
 

I changed the end of Configure in Startup.cs like so:

app.UseEndpoints(endpoints =>
{
   endpoints.MapControllerRoute(name: "fallover", pattern: "*", defaults: new { controller =
      "FalloverFailsafe", action="Get" });
});

Use (allow) specific http verbs in .NET Core 3.

In Configure in Startup.cs:

app.UseCors(builder => builder.AllowAnyOrigin().WithMethods("GET", "HEAD", "POST",
      "DEBUG", "PUT", "DELETE", "PATCH", "OPTIONS").AllowAnyHeader());

Debug Failsafe

It stops and starts remote debugging sessions. DEBUG is not a standard http verb. It is its own fallover animal that really just shows up in C# stuff.

Tuesday, April 14, 2020

How to switch a .NET Core project over to Windows Authentication after it was made without it.

Open launchSettings.json and set windowsAuthentication to true and anonymousAuthentication to false.

Force not https traffic to fall over to being https traffic in .NET Core.

In the Configure method in Startup.cs start off with:

if (env.IsDevelopment())
{
   app.UseDeveloperExceptionPage();
}
else
{
   app.UseHttpsRedirection();
}

 
 

In appsettings.json have a https_port property with a number in it!

It's an extension method for an exception in C# to drill back to the root of what is wrong.

using System;
namespace MyStuff.MoreStuff
{
   public static class ExceptionExtensions
   {
      public static Exception GetOriginalException(this Exception ex)
      {
         if (ex.InnerException == null)
         {
            return ex;
         }
         return ex.InnerException.GetOriginalException();
      }
   }
}

Don't wrap nested stuff to yank from appsettings.json in a not null safeguard like this.

IConfiguration configuration = new ConfigurationBuilder().AddJsonFile(
      "appsettings.json", optional: true, reloadOnChange: true).Build();
if (configuration["loggingConfiguration"] != null)
{

.UseMvc in .NET Core with specific routes

This has this example and a bit more.

app.UseMvc(routes =>
{
   routes.MapRoute(name: "default", template: "{controller=Home}/{action=Index}/{id?}");
});

 
 

Honestly, this is probably the .NET Core 2.0 way of doing things per this. In modern times (.NET 3.1.4) we have stuff like so instead:

app.UseEndpoints(endpoints =>
{
   endpoints.MapControllers();
});

Hydrate a Transient in .NET Core from something returned from a method.

Following up on this, it's more of the same breakout.

var logger = new SerilogFactory().CreateLogger();
services.AddTransient<ILogger>(x => logger);

Monday, April 13, 2020

Xunit.Gherkin.Quick is less forgiving than some BDD testing frameworks.

Two back to back Givens must be a Given followed by an And and not merely two Givens.

[TestCategory("Multivalue")]

This is old markup from Microsoft.VisualStudio.TestTools.UnitTesting which I hope I may just throw away. What did it do? Associate some tests together at the reporting maybe.

Friday, April 10, 2020

Assert.IsInstanceOfType becomes Assert.IsType in Xunit.

The two assignments are the other way around also, so foo and typeof(Foo) become typeof(Foo) and foo instead.

SuppressMessage attribute at a test class to NOT run a test???

Nay! ...to have it not show up in the metrics!

[SuppressMessage("Maintainability", "Missing XML Comments", Justification = "XML
      comments not needed for test")]

Did you know that you may unit test some internal items in another project in C#?

I am just stumbling upon this today. There are some wire-ups which work just fine in a unit test which revolt completely when I try to tease them out to other files. Yikes!

ctors means constructors

Also, look... you may copy and paste some characters that do stupid stuff. (unrelated)

Xunit fixtures

I am migrating stuff using .NET Framework Gherkin tests with Microsoft.VisualStudio.TestTools.UnitTesting and TechTalk.SpecFlow to .NET Core and Xunit and Xunit.Gherkin.Quick. [BeforeScenario] needed replacement with an Xunit fixture. This is basically a before-each-test trick. It looks like this:

using MyApp.MyStuff;
using System;
using Moq;
namespace MyApp.MyStuff.Tests
{
   public class MyFixture : IDisposable
   {
      public Mock<Foo> _commit { get; private set; }
      
      public MyFixture()
      {
         _commit = new Mock<Foo>();
      }
      
      public void Dispose()
      {
      }
   }
}

 
 

I do not know that IDisposable is required. I saw it online in an example there that did database stuff honestly. Anyhow, to use the fixture in my test, I now need to give my test a constructor that did not exist like so:

private Mock<Foo> _commit;
public MyTest(MyFixture fixture)
{
   _commit = fixture._commit;
}

 
 

Oh, [BeforeFeature] is also a part of the old stuff.

 
 

Addendum 4/13/2020: I could not get this to work today. Per this, perhaps I need to inherit from IClassFixture<MyFixture> instead of Feature

IReadOnlyList

In C# this is like List only restricted. You have to dig stuff out with the index exclusively.

Thursday, April 9, 2020

MultipartMemoryStreamProvider in .NET Core does not exist.

You can/may have System.Net.Http in .NET Core but, per this, MultipartMemoryStreamProvider for managing multipart data (files) must be replaced with IFormFile in modern times. HttpMessageContent is the same as is .ReadAsMultipartAsync() too.

HttpClientHandler in C#

HttpClientHandler handler = new HttpClientHandler();
handler.Credentials = new NetworkCredential();
HttpClient client = new HttpClient(handler);

 
 

Addendum 4/9/2020: handler.UseDefaultCredentials = true; would be a way to jam in default credentials.

Wednesday, April 8, 2020

@Inject(PLATFORM_ID) in Angular 5

Assuming this...

import { PLATFORM_ID } from "@angular/core";
import { isPlatformBrowser } from "@angular/common";

 
 

...then page 464 of "ASP.NET Core 2 and Angular 5" by Valerio De Sanctis suggests you could have:

constructor (@Inject(PLATFORM_ID) private x: any) {
   if (!isPlatformBrowser(x)) {

 
 

isPlatformBrowser just returns true of false.

DES stands for Data Encryption Standard.

Wikipedia says: "...Triple DES (3DES or TDES), officially the Triple Data Encryption Algorithm (TDEA or Triple DEA), is a symmetric-key block cipher..."

Xamarin.Mac

Stolen from online: "Xamarin.Mac exposes the complete macOS SDK for .NET developers to build native Mac applications using C#."

When making an appsettings.json for a .NET Core xunit test project in Visual Studio 2019...

In the properties pane set the "Copy to Output Directory" to "Copy if newer" to allow the file to be seen.

Tuesday, April 7, 2020

Xunit.Gherkin.Quick

Get it here or from NuGet for an xunit test project in .NET Core. Decorate classes with:

[FeatureFile("./Mandate.feature")]

 
 

Methods with...

[When(@"A mandate check of condition ""(.*)"" is performed")]

 
 

...and:

[Then(@"an argument exception shall be thrown")]

 
 

Mandate.feature is a .txt file with a bunch of scenarios in it.

 
 

Addendum 4/8/2020: What is more...

  1. The class that runs the tests should inheirt from Feature!
  2. The .feature files need the "Copy to Output Directory" setting set to "Copy if newer" at the Properties pane.
  3. [Given(@"a configured HEncoder")] is another decorator.
  4. [And(@"I chose (\d+) as second number")] after Given is legit too.
  5. Do NOT have Utf8Json and Gherkin installed. One of these two causes problems.
  6. If the testing class and the .feature are named the same thing and the .feature is in the root of the project, you do not need the FeatureFile attribute.

Utf8Json

It is a JSON serializer. Go get it from NuGet.

BoDi

It is a simple and embeddable IoC container. See: this

more dealing with strangeness pulled from dotPeek

keyedService.get_ServiceKey() becomes keyedService.ServiceKey while .op_Equality and .op_Inequality suggest == and != comparisons

base..ctor();

When you use JetBrains dotPeek to cast CLR to a C# class backwardsly, you may see this inside a constructor like so:

namespace Could.Be.Anything
{
   public sealed class LessAbstract : MoreAbstract
   {
      public LessAbstract()
      {
         base..ctor();
      }
   }
}

 
 

All that means is...

namespace Could.Be.Anything
{
   public sealed class LessAbstract : MoreAbstract
   {
      public LessAbstract() : base()
      {
      }
   }
}

.resx versus .resources

I found a thread at Stack Overflow which suggests the .resx is uncompiled and the .resources is compiled.

Monday, April 6, 2020

printfn

It's F# for: "print this!"

LemonStand was a Canadian e-commerce entity.

It closed down in 2019.

From Cookiecutter...

You may see this when attempting to add something at the Solution Explorer in Visual Studio 2019. It allows you to splash in code from templates.

Kubernetes Ingress

Stolen from a Googling: "In Kubernetes, an Ingress is an object that allows access to your Kubernetes services from outside the Kubernetes cluster. You configure access by creating a collection of rules that define which inbound connections reach which services. This lets you consolidate your routing rules into a single resource."

How to I fill in the ConfigurationModule for namespace Autofac.Extras.Configuration in .NET Core?

Following up on this, how do we port this?

namespace Autofac.Extras.Configuration
{
   public sealed class ConfigurationModule : Module
   {
      protected override void Load(ContainerBuilder builder);
   }
}

 
 

We could have something like so but it is a guess in the dark honestly.

using Autofac;
namespace Anything.You.Like.Here
{
   public sealed class ConfigurationModule : Module
   {
      protected override void Load(ContainerBuilder builder) { }
   }
}

 
 

Addendum 4/7/2020: After some thought and some use of dotPeek, I think we should instead have:

using Autofac.Core;
namespace Autofac.Extras.Configuration
{
   public sealed class ConfigurationModule : Module
   {
      protected void Load(ContainerBuilder builder)
      {
         RegistrationExtensions.RegisterInstance(builder, (IRegistrationSource)new
               ConfigurationRegistrationSource());
      }
   }
}

 
 

That part is pretty easy, but it opens the door to...

using Autofac.Builder;
using Autofac.Core;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Globalization;
using System.Linq;
using System.Reflection;
using Microsoft.Extensions.Configuration;
using ConfigurationSection = System.Configuration.ConfigurationSection;
namespace Autofac.Extras.Configuration
{
   internal class ConfigurationRegistrationSource : IRegistrationSource
   {
      public bool IsAdapterForIndividualComponents
      {
         get
         {
            return false;
         }
      }
      
      public IEnumerable<IComponentRegistration> RegistrationsFor(Service service,
            Func<Service, IEnumerable<IComponentRegistration>> registrationAccessor)
      {
         if (!(service is IServiceWithType iserviceWithType)) return
               Enumerable.Empty<IComponentRegistration>();
         Type type = (Type)iserviceWithType.ServiceType;
         if (!typeof(ConfigurationSection).IsAssignableFrom(type) &&
               !typeof(ConfigurationSectionGroup).IsAssignableFrom(type)) return
               Enumerable.Empty<IComponentRegistration>();
         KeyedService keyedService = service as KeyedService;
         string name = keyedService == null ? (string)null :
               Convert.ToString(keyedService.ServiceKey,
               (IFormatProvider)CultureInfo.InvariantCulture);
         if (string.IsNullOrEmpty(name)) return
               Enumerable.Empty<IComponentRegistration>();
         IList<string> stack = ConfigurationRegistrationSource.RecurseSectionNames(type,
               name);
         IRegistrationBuilder<object, SimpleActivatorData, SingleRegistrationStyle>
               iregistrationBuilder1 = RegistrationBuilder.ForDelegate((Type)type,
               (Func<IComponentContext, IEnumerable<Parameter>, object>)((c, p) =>
               ConfigurationRegistrationSource.SectionResolver(type, stack)));
         IRegistrationBuilder<object, SimpleActivatorData, SingleRegistrationStyle>
               iregistrationBuilder2;
         if (name != null)
            iregistrationBuilder2 = iregistrationBuilder1.Named(name, (Type)type);
         else
            iregistrationBuilder2 = iregistrationBuilder1.As((Type[])new Type[1] { type });
         return (IEnumerable<IComponentRegistration>)new IComponentRegistration[1] {
               RegistrationBuilder.CreateRegistration<object, SimpleActivatorData,
               SingleRegistrationStyle>(iregistrationBuilder2) };
      }
      
      private static object SectionResolver(Type type, IList<string> stack)
      {
         IConfiguration config = new ConfigurationBuilder().AddJsonFile("appsettings.json",
               optional: true, reloadOnChange: true).Build();
         return (object) config.GetSection(type.ToString());
      }
      
      private static IList<string> RecurseSectionNames(Type type, string name)
      {
         DefaultSectionGroupAttribute customAttribute =
               type.GetCustomAttribute<DefaultSectionGroupAttribute>(false);
         IList<string> stringList = customAttribute == null ? (IList<string>)new List<string>() :
               ConfigurationRegistrationSource.RecurseSectionNames(customAttribute
               .ParentType, customAttribute.ParentName);
         stringList.Add(name ?? ConfigurationRegistrationSource.GetDefaultName(type));
         return stringList;
      }
      
      private static string GetDefaultName(Type type)
      {
         DefaultNameAttribute customAttribute =
               type.GetCustomAttribute<DefaultNameAttribute>(false);
         if (customAttribute == null) throw new
               DependencyResolutionException("ConfigurationSection type " + (object)type +
               " does not have Default Name Attribute");
         return customAttribute.Name;
      }
   }
}

HPA in Rancher stands for Horizontal Pod Autoscaler.

This allows for autoscales up and down of the amount of services (containers???) running.

ECM could be enterprise content management.

Items managed have a little time line (two words for the past) of history.

Sunday, April 5, 2020

C# XML Documentation Comments

/// <summary>
/// This doubles <paramref name="number" /> and returns it.
/// </summary>
/// <param name="number">any integer</param>
/// <returns>double the inbound value</returns>
public int Double(int number)
{

 
 

Addendum 4/6/2020: If decorating a class instead of a method inside a class, you would maybe just have the summary.

 
 

Addendum 4/10/2020: You could have a <remarks> tag after summary at the top of the file. You may just want a summary at a constructor.

Friday, April 3, 2020

Cast a Guid to a string in C# while handing in a conditional magic argument.

Guid guid = Guid.NewGuid();
string go = guid.ToString();
string d = guid.ToString("D");
string n = guid.ToString("N");
string b = guid.ToString("B");
string p = guid.ToString("P");
string x = guid.ToString("X");

 
 

146aa746-e433-4540-b2cb-9dac7e4a34e4 is the assignment for lines two and three. Then 146aa746e4334540b2cb9dac7e4a34e4 and then {146aa746-e433-4540-b2cb-9dac7e4a34e4} followed by (146aa746-e433-4540-b2cb-9dac7e4a34e4) and finally {0x146aa746,0xe433,0x4540,{0xb2,0xcb,0x9d,0xac,0x7e,0x4a,0x34,0xe4}} is last. The second to last chapter of "ASP.NET Core 2 and Angular 5" by Valerio De Sanctis had this nuget of wisdom.

Here are some .NET Core attributes for a Controller.

[AllowAnonymous]
[ApiController]
[Route("api/[controller]")]

 
 

These sit right above the class declaration that inheirts from Controller. The first and the last speak for themselves. The middlemost suggests that all of the actions you will find inside will be tied to HTTP verbs.

A .NET Framework ApiController just becomes a Controller in .NET Core.

Request.GetQueryNameValuePairs() is instead in .NET Core Request.Query.ToDictionary(q => q.Key, q => q.Value) and along similar lines you could also have something like so:

public IList<KeyValuePair<string, string>> GetQueryString(HttpRequestMessage x)
{
   Dictionary<string, string> y = x.Properties.ToDictionary(q => q.Key,
         q => q.Value.ToString());
   return y.ToList();
}

 
 

Also: IHttpActionResult became IActionResult and there is no more HttpConfiguration.

EntityConnection and EntityException are not in .NET Core.

You may want to reimport System.Data.SqlClient to kick SqlConnection awake, but these other older means for interfacing with Entity Framework gunk in the .NET Framework machinery are gone. Both SqlConnection and EntityConnection inheirt from DbConnection while SqlConnection is also an ICloneable (supports cloning, which creates a new instance of a class with the same value as an existing instance).

When overridden in a derived class, returns the Exception that is the root cause of one or more subsequent exceptions.

This is the magic behind .GetBaseException() as shown here:

catch (MagicException ex)
{
   throw ex.GetBaseException();
}

Kubernetes containers will not run .NET Framework code.

If you are porting from .NET Framework to .NET Core everything must at least make it to .NET Standard to be acceptable in that environment.

PdbNavigator

It is JetBrains ReSharper gunk for figuring out what is what in libraries. See this for PDB.

DiagnosticListener

Per this: Provides an implementation of the abstract DiagnosticSource class that represents a named place to which a source sends its information (events).

How do I support the DefaultName attribute of Autofac.Extras.Configuration when porting code from .NET Framework to .NET Core?

I don't know yet. When I drill in their, decompiled with JetBrains decompiler, the attribute reads like so:

using System;
namespace Autofac.Extras.Configuration
{
   [AttributeUsage(AttributeTargets.Class)]
   public sealed class DefaultNameAttribute : Attribute
   {
      public DefaultNameAttribute(string name);
      public string Name { get; private set; }
   }
}

 
 

Does that mean I may just recreate it like this?

using System;
namespace Anything.You.Like.Here
{
   [AttributeUsage(AttributeTargets.Class)]
   public sealed class DefaultNameAttribute : Attribute
   {
      public DefaultNameAttribute(string name)
      {
         Name = name;
      }
      public string Name { get; private set; }
   }
}

 
 

Will the .NET Core version of Autofac honor this?

Thursday, April 2, 2020

.NET Portable

These are a set of assemblies to compile .NET Source Code to a PCL (portable class library) or really any other platform.

IMS

stands for IP Multimedia Subsystem or IP Multimedia Core Network Subsystem, a type of modem

To make a git branch at the server in Azure DevOps...

Go to "Branches" under "Repos" and click the "New branch" button up at the upper right. When you clone down master for the branch you should also be able to switch to one of the other branches as well.

Use a better ConfigurationBuilder instantiation for getting at appsettings.json variables in .NET Core 3.

Outside of a Controller or PageModel (WebMatrix), I had this trick, but here is a better way to go in modern times. It uses the Microsoft.Extensions.Configuration using declaration.

IConfiguration config = new ConfigurationBuilder().AddJsonFile("appsettings.json",
      optional: true, reloadOnChange: true).Build();
string thing = config["Repositories"];

 
 

Oh, it turns out that .AddJsonFile is an extension method from Microsoft.Extensions.Configuration.Json so you need that too. Castle.Core.Configuration may have an IConfiguration also. The name is kinda weak.

Wednesday, April 1, 2020

ConfigureServices returning an System.IServiceProvider isn't supported.

Alright, if you are getting this error, you tried to loop in Autofac as described here and it did not work because you are using version 3 of the .NET Framework (or better). The fix is to undo what you did in ConfigureServices and instead, in Program.cs, add the third line you see below to the mix:

public static IHostBuilder CreateHostBuilder(string[] args) =>
      Host.CreateDefaultBuilder(args)
         .UseServiceProviderFactory(new AutofacServiceProviderFactory())
         .ConfigureWebHostDefaults(webBuilder =>
         {
            webBuilder.UseStartup();
         });

 
 

Alright, now back at Startup.cs you need a new method called ConfigureContainer like so:

public void ConfigureContainer(ContainerBuilder builder)
{
   builder.RegisterType<Tom>().As<ITom>();
}

Use Autofac for IoC in .NET Core.

At: Tools > NuGet Package Manager > Manage NuGet Packages for Solution... ...search for "Autofac.Extensions.DependencyInjection" at the "Browse" tab. You will need the Autofac and Autofac.Extensions.DependencyInjection using declarations. Per this, the ConfigureServices method in Startup must change like so:

public IServiceProvider ConfigureServices(IServiceCollection services)
{
   services.AddControllers();
   var builder = new ContainerBuilder();
   builder.RegisterModule(new Foo());
   builder.RegisterModule(new Bar("bar"));
   builder.RegisterModule<Baz>();
   builder.RegisterType<Qux>().As<IQux>().WithParameter(new
         TypedParameter(typeof(IServiceFactory), new ServiceFactory(new[] { new
         FilenetProvider() })));
   builder.RegisterType<Yin>().As<IYin>();
   builder.RegisterType<Yang>().As<IYang>().SingleInstance();
   builder.Populate(services);
   var container = builder.Build();
   return new AutofacServiceProvider(container);
}

.AllowCredentials()

I think that using .AllowCredentials() like .AllowAnyMethod() at Startup in a .NET Core application is equal to setting .SupportsCredentials to true at a CorsPolicy in the .NET Framework stuff.

Use .WithHeaders instead of .AllowAnyHeader in CORS in .NET Core.

.WithHeaders("GET", "POST", "PUT", "DELETE", "OPTIONS")

Allow all subdomains for a domain name in CORS in a .NET Core orchestration.

Follow this example and replace www with an * to make the magic happen.

Open up CORS for very specific domains in .NET Core 3.1.

This had this example:

public void ConfigureServices(IServiceCollection services)
{
   services.AddCors(options =>
   {
      options.AddPolicy(MyAllowSpecificOrigins,
      builder =>
      {
         builder.WithOrigins("http://example.com",
               "http://www.contoso.com")
               .AllowAnyHeader()
               .AllowAnyMethod();
      });
   });
   services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
}

 
 

MyAllowSpecificOrigins above is just a string and...

app.UseCors(MyAllowSpecificOrigins);

 
 

...needs to go inside of:

public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{

Tuesday, March 31, 2020

In Autofac's IoC, modules organize code to be resolved at a later time.

meh

.AddTransient (in C# and .NET Core) while handing in a variable

Per this, you could have:

services.AddTransient(x => new Yin("yang"));

 
 

...instead of...

services.AddTransient<Yin>();

 
 

And...

services.AddTransient<IYin>(x => new Yin("yang"));

 
 

...instead of...

services.AddTransient<IYin, Yin>();

 
 

I do not yet know what is going on with IOperationSingletonInstance here. I could not figure it out.

In .NET Core's IoC you may use .AddScoped and .AddSingleton as you might .AddTransient.

Singleton is always the same and transient frequently changing. Scoped is the same per request per this which I take to mean session of web site browsing.

#pragma hack to disable missing code comment alert in C#

#pragma warning disable CS1591
public static void Go()
#pragma warning restore CS1591

In Global.asax.cs in a .NET Framework application, you may hand static methods into GlobalConfiguration.Configure as the single inbound property at the Application_Start method.

The static methods you call elsewhere in code will each take an HttpConfiguration as the single inbound property.

"ProGet supports Docker containers and third-party packages like NuGet, npm, PowerShell, and Chocolatey" per its web presence.

It is made by Inedo.

Monday, March 30, 2020

Migrate .wsdl Web.config stuff from a .NET Framework project to a .NET Core project's appsettings.json file.

This has a pretty good example. You basically make one big JSON blob.

Program does not contain a static 'Main' method suitable for an entry point

Take <OutputType>Exe</OutputType> out of the PropertyGroup tag in .csproj to make this error go away. The problem is that you made a console app when you meant to make a class library.

SSL certificate problem: unable to get local issuer certificate

Clone from git while ignoring SSL restraints to get around this hangup!

git -c http.sslVerify=false clone https://example.com/path/to/git

Migrate packages.config to the PackageReference format in migrating a project from .NET Framework to .NET Core.

This is the fourth of four preparatory steps listed here, with the first three being:

  1. Upgrade to version 4.7.2 of the Framework.
  2. Use the .NET Portability Analyzer.
  3. Use the .NET API Analyzer to find out where the errors what will throw an PlatformNotSupportedException are.

After these steps one actually ports the code. Per this (part way down), right-click on the References in a Visual Studio Framework project and pick "Migrate packages.config to PackageReference..." to make the magic happen. The little wizard you walk through makes a distinction between direct "Top-level" dependencies and lower, so to speak, "Transitive" dependencies.

 
 

Addendum 3/31/2020: It is probably best to right-click on packages.config instead of References.

Friday, March 27, 2020

.NET Portability Analyzer

This judges how well a port from .NET Framework to .NET Core might go. It is a .vsix plug-in. To make the plug-in go, right-click on a .NET Framework project in Visual Studio 2019 and pick "Analyze Project Portability" from the options.

Rancher is an open-source and multi-cluster Kubernetes orchestration platform.

See: this

Capterra DocManager

It is an add-in for VBA (Visual Basic for Applications) and it automates the document management process in Excel and that ilk.

GitExtensions

It is a UI Tool for managing git repositories. OpenSSH (the shell to work with OpenBSD) and PuTTY (name means nothing) are clients for Git Extensions. Atlassian Sourcetree is a similar tool.

Deal with AssemblyInfo.cs duplicate attributes when porting a C# class library from .NET Framework to .NET Core.

\obj\Debug\netcoreapp3.1\MyApp.AssemblyInfo.cs may be cranky complaining of dupes for AssemblyCompanyAttribute, AssemblyConfigurationAttribute, AssemblyFileVersionAttribute, AssemblyProductAttribute, AssemblyTitleAttribute, and AssemblyVersionAttribute. This suggests changing the .csproj file for the project having a blob like so...

<PropertyGroup>
   <TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

 
 

Change it up like so:

<PropertyGroup>
   <TargetFramework>netcoreapp3.1</TargetFramework>
   <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
   <GenerateAssemblyConfigurationAttribute>false
         </GenerateAssemblyConfigurationAttribute>
   <GenerateAssemblyFileVersionAttribute>false
         </GenerateAssemblyFileVersionAttribute>
   <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
   <GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
   <GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
</PropertyGroup>

 
 

Addendum 3/30/2020: \obj\Debug\netcoreapp3.1\MyApp.AssemblyInfo.cs may be cranky complaining of dupes for AssemblyCompanyAttribute, AssemblyConfigurationAttribute, AssemblyFileVersionAttribute, AssemblyProductAttribute, AssemblyTitleAttribute, and AssemblyVersionAttribute. above should read \obj\Debug\netcoreapp3.1\MyApp.AssemblyInfo.cs may be cranky complaining of dupes for AssemblyCompany, AssemblyConfiguration, AssemblyFileVersion, AssemblyProduct, AssemblyTitle, and AssemblyVersion.

The type name 'ConfigurationSection' could not be found in the namespace 'System.Configuration'. This type has been forwarded to assembly 'System.Configuration.ConfigurationManager, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' Consider adding a reference to that assembly.

Go to NuGet and find: System.Configuration.ConfigurationManager (ran into this trying to port a .NET Framework project to .NET Core) It is the same thing with System.ServiceModel.Primitives (gets around missing ICommunicationObject and CommunicationException in .NET Core) and System.Runtime.Caching

At a glance it seems pretty easy to reference the .dll for a .NET Framework creation in a .NET Core project.

I do not yet know what some of the deeper heartaches will be. Also, a little bird tells me the .NET Core name is to go away making room for .NET 5 instead.

Thursday, March 26, 2020

BAM stands for Backlog Assessment Method

It is an SPI (software process improvements) and it accesses the state of backlog items and if they are worth tackling.

At risk of repeating myself, make using declaration assignments like so in C#.

using ODataPath = Microsoft.AspNet.OData.Routing.ODataPath;

multipart/related versus multipart/form-data

form-data uploads simple MIME files while multipart/related is for more complicated stuff such as several associated images and some metadata notes on what is what or their ordering perhaps.

VDI is Citrix virtual desktop infrastructure.

Each virtual machine (VM) lives on a centralized server.

signature cards

When you create an account at a bank you complete a signature card so that the bank may compare your signature to your signature at future transactions.

CorsPolicy

...it is a C# convenience POCO.

cref means code reference

A comment in C# like this...

// <see cref="Foo" />

 
 

...allows Foo to be clickable through to the place in code where Foo lives (assuming you have Visual Studio 2019).

Authorizing as your Active Directory self when using Crunchbase Postman.

At the tabs which read Params, Authorization, Headers, Body, Pre-request Script, and Tests, go to Authorization and change the "Type" dropdown to "NTLM Authentication [Beta]" to get this afloat. You will have to enter your credentials once. You will have to change the dropdown all the time.

The "immutability" of documents put to IBM FileNet.

When documents are put into FileNet their permissions, as set at that moment, may never change. There is an independent metadata class with differing permissions for each file and these classes, these "POCO" objects if you will, may have permissions updated, but not the IBM FileNet documents themselves. To redo the permissions on a FileNet document, destroy and reupload the document anew. Some files may be nested under other files and a queried file will drag along all of its children unless a child is permissions-forbidden and in those scenarios it appears as if the parent just does not have the child without any warning whatsoever. If you use Word docs instead of PDF files you can have macros updating things like dates on the page and that means that Word docs are not so wonderful for these sorts of undertakings. (remediate that!) A sample PDF to use in testing is:

%PDF-1.5 %âãÏÓ
228 0 obj &lt;&lt;/Linearized 1/L 273205/O 230/E 264876/N 1/T 272865/H [ 582
      215]&gt;&gt; endobj

 
 

This simple PDF cannot be reopened. It is just a dummy "use me" document for testing.

Wednesday, March 25, 2020

Missing the "Team" menu in Visual Studio 2019?

Open the "Team Explorer" window pane and add a server.

No destination specified for Copy. Please supply either "DestinationFiles" or "DestinationFolder".

I beat this error by restarting Visual Studio 2019. It is some sort of TFS error.

The on/off settings for SSL Enabled and Windows Authentication at a Visual Studio 2019 project are found in the properties pane and not the stuff you get when you right-click on a project and pick "Properties" alternatively.

F4 should open that pane. Once the "SSL Enabled" stuff is afloat, it should offer you, on the next two lines, two different ports to use for with and without SSL. In Postman, click on the wrench at the upper right and then click "Settings" to turn on and off "SSL certificate verification" when attempting to hit the SSL endpoint.

SQL-92 is the third version of SQL after SQL-86 and SQL-89.

SQL-89 was some nibble around the edges improvements to SQL-86 while SQL-92 was a heavy overhaul.

SearchSQL in C#

SearchSQL sqlObject = new SearchSQL("SELECT DocumentTitle, Id FROM Document
      WHERE Creator = 'jsmith'");

 
 

Along these lines there is also:

SearchScope objStores = new SearchScope(osArray, MergeMode.INTERSECTION);

 
 

I do not yet understand too much of this.

Query IBM FileNet from the URL line!

  1. https://example.com/odata/v1/Area('Consumer Login')/content?filter=DocumentTitle eq 'TEST'&$top=100
  2. https://example.com/odata/v2/Repository('FILENET')/Area('Consumer Login')/content?filter=DocumentTitle eq 'TEST'&$top=100

Better testing in Visual Studio 2019 Enterprise than Visual Studio 2019 Professional?

Yes! Per this, it comes with Live Unit Testing, IntelliTest, Microsoft Fakes (Unit Test Isolation), and Code Coverage! Live Unit Testing is running impacted unit tests in the background! Microsoft Fakes replaces gunk with stubs of shims, and shims modify compiled code at compilation time. Code Coverage will tell you what percentage of the code is covered by tests.

KYC stands for Know Your Customer!

This the conversation with an individual opening a new back account? How often will you deposit? Cash or checks?

Monday, March 23, 2020

The 412 HTTP error is for precondition failed.

You handed in something bad (or at least lacking).

ITSM

It is service management for IT and by IT I mean information technology. It is something to manage, a tool to manage, the various lifecycle complexities of IT.

Gramm-Leach-Bliley Act (GLBA) explains how banks share/protect information.

Right to Financial Privacy Act (RFPA) explains how banks share/protect information with the U.S. government.

Defendpoint

This is something that sidesteps the need in Windowsland to right-click on something and run it "as Administrator" to give it a beefier physique.

 
 

Addendum 3/24/2020: This is made by Avecto which turned into BeyondTrust.

 
 

Addendum 3/25/2020: Right-click on an executable and pick "Run with Defendpoint" from the little menu that appears in Windows 10 to make this stuff do its thing.

 
 

Addendum 4/7/2020: Sometimes when you run IIS via Visual Studio run with Defendpoint it behaves better.

whaling

It is spear phishing for a BIG fish.

Entrust IdentityGuard Soft Token with Pulse Secure

...is another way to do the work from home thing.

Unhide the search bar at Windows 10.

Right-click in the taskbar and pick "Show search box" under "Cortana" to make it happen.

Saturday, March 21, 2020

An OpenIddict Authorization server and https://developers.facebook.com/ are things that power OAuthesque remote login for single sign on.

"Advanced Topics" which is the second to last chapter of "ASP.NET Core 2 and Angular 5" by Valerio De Sanctis mentions these.

RFC can mean Request for Comments.

RFI is Request for Information and RFP is Request for Proposal and, I guess, RFQ is Request for Quotation. RFC is Request for Comments along those lines and the Internet Engineering Task Force (or IETF) has a standard for as much. This came up in the second to last chapter of "ASP.NET Core 2 and Angular 5" by Valerio De Sanctis.

Friday, March 20, 2020

Airplane mode

This means your device will not send and receive signals. It is not just "off WiFi" but it is instead completely disconnected, not sending out or looking up whatsoever.

Wednesday, March 18, 2020

Tuesday, March 17, 2020

the Google Hangout game

  1. https://accounts.google.com/SignUp will let you make a Google account
  2. https://hangouts.google.com/ will let you make a hangout
  3. click the + at the upperright to add someone by gmail address

pseudoSXSW

I am between jobs (hopefully) and I was going to indulge a vacation I had planned. Before I ever drove out of Minnesota, I knew that SXSW had been cancelled due to COVID-19 and thus my chance to again see Kælan Mikla in America where they seem not to return to since becoming my favorite band was dashed, but my mother and sister and a friend of mine live in Austin, Texas so I went to Austin, Texas on vacation nonetheless. The entire time I was there things tightened up more and more. I attempted to go to four tech talks when in Rome, but only half of them panned out, specifically this one and this one. ADNUG became a webinar and another talk on Amazon SageMaker, an AWS cloud-based machine learning platform, was just outright cancelled. I ran into Sogeti cellmate Matt Hinze at an HEB (a grocery store named for a Howard E. Butt Sr. wherein the E stands for Edward) and made safe pleasantries with him. I arrived early and just stayed at my mother's house and then left before the Hampton hotel room reservation kicked in. I got the pleasant surprise of the Hampton agreeing to refund my nonrefundable room reservation given the extreme circumstances. Supposedly I am going to get my money back at some point this week just as I am supposedly going to start a new job on the 23rd of this month. We shall see, eh? In wandering around the convention center where I could have otherwise picked up my badge for SXSW, I took the photo here which now seems comic. The convention center was a ghost town. The mail from SXSW so far is baiting me to roll my reservation forward to the next year or maybe two years ahead, etc. I did not take my laptop with me to Austin and back and I am just now typing up some notes I took. Things I made dirty scribbles to remember for this blog include Figma, a collaborative design tool, and befunky.com, an online Photoshop of sorts. zebra.com is a performance monitoring tool. If you zoom in on your iPhone to take a picture, when you try to get that photo onto your PC and open it in Photoshop, Photoshop may squawk in denial at the image per my mother. Science fiction author Arthur C. Clarke's three laws are:

  1. When a distinguished but elderly scientist states that something is possible, he is almost certainly right. When he states that something is impossible, he is very probably wrong.
  2. The only way of discovering the limits of the possible is to venture a little way past them into the impossible.
  3. Any sufficiently advanced technology is indistinguishable from magic.

The third of the three is mentioned in this (Did you know there was a She-Ra reboot? I only know because I ate at Sonic on this trip. Sonic has the toys.), and it sounded a lot to me like Frank Pasquale's prediction that our own technology will become what might as well be magic. On my iPhone X, running 12.4.1 for the software version, when I go to unlock my phone there is a flashlight icon at the lower left. If you press it, it does nothing until you unlock your phone and then the flashlight comes on. I do not yet know of the right way to turn the flashlight back off, but if you just power your phone down and then back up that kills the flashlight. Emily Weiss is the founder/CEO (chief executive officer as opposed to COO or chief operations officer, CTO or chief technology officer, or CFO chief financial officer) of Glossier which does cosmetics. Mozy was bought out by Carbonite. KOA is the Kampground of America with the campground part spelled with a K. "Linux on IBM Z" might be the name that came to be for IBM's Linux. My mother mentioned that before she got the axe in 2002 that this was the thing that she was working on closest to the end of her 33 years at big blue. Z stands for zero downtime. My mother couldn't tell me what the name ended up being for the thing she got cut from so I am guessing a bit here. PoF stands for Plenty of Fish, a dating app. Enneagram is something like Myers–Briggs. There are nine different personality categories in a wheel and you are constantly moving from one to another in life although some go faster than I others I bet. DHL is named for Adrian Dalsey, Larry Hillblom, and Robert Lynn and is a logistics/shipping company out of Germany. It is a GmbH which stands for Gesellschaft mit beschränkter Haftung translating to "company with limited liability" per Wikipedia and being in form like an American LLC (limited liability company) or the British "Ltd." for just limited, I guess. DMCA stands for Digital Millennium Copyright Act and it allows some leniency for access to copyrighted works by forbidding some blockades. The .NET Foundation supports the building of open source software in .NET. OpenCart is an open source shopping cart of some sort. AutoML stands for automatic machine learning and has some helpful gunk for picking models for machine learning. Bolt On Technology is some tech for auto shops. Smartsheet is some better way to do spreadsheets.

Monday, March 16, 2020

On Friday the 13th I saw Jim Brisson lead a discussion on Lean.

The event was at Inventive in Austin, Texas and this was a SIG as a part of Agile Austin that happened over the lunch hour. More specifically, this was a Lean Coffee meeting which is an informal meeting with a flexible agenda in which the participants vote up what they want to talk about. Jim Brisson is the Agile coach at Dell, but he did not define the agenda. We the crowd did that. Lean is different from Agility. One is either Lean or Agile and one does Kanban with Lean or Scrum with Agile. I have long been appalled with the ScrumBut of Scrumban in which a team estimates points not to show a burn down chart and a hey-we-cannot-get-everything-in-guys mindset but instead to just try to fill a sprint with gunk to do short term. It was pointed out to me in this session that maybe this isn't so bad. This came up under the guise of the question "How do we talk a business into Lean?" and the pain point seemed to be that so many characters in the sea, project managers and the like, rely on time. The counterargument that Scrum isn't better because the estimates for size (time) are always flawed may be a reality that is often lost on such persons, so why not just do pseudoscrum for them? Maybe it is not the end of the world. The argument to be made, if you want to argue for Kanban, is to argue for continuous improvement. WIP stands for work in progress and work in progress limits differ from lead time (a.k.a. cycle time) which is a measure of how much raw time it took for any one card (we kept calling them Chiclets) to progress from left to right on the Kanban board. WIP limits represent how many balls you can juggle, i.e. how many cards may be on the Kanban board at one time. The WIP limit should be less than the number of developers and that should give you some wiggle room to adjust for surprises. In waterfall one has huge batches which arguably become sprints in the miniwaterfalls of Agile. In Lean throughput is the measurement of velocity. Little's Law, named for a John Little, defines WIP as throughput multiplied by lead time. VSM (value stream mapping) defines the hops on a Kanban board that a card must go through. The VSM process is really for the business people to see to get them involved. Anytime you apply words to you actions ("Lean") those listening tend to focus on the word and not the action so the visual of the board would help therein. It gets people out of working in knowledge silos on, well, development in silos. When you "expedite" in Lean it breaks all WIP limit boundaries. You should not expedite more than one thing at a time and you should use expedite to fight fires. An MVP (minimal viable product) is for seeing if an idea is good (think prototype) more than making an actual product. In a J Curve productivity goes down at first before it eventually swings back up. You dive into a J Curve in doing something new and if you are to dive into J Curve after J Curve the curves need to be spaced far enough apart for you to be up on the chart past the starting point before dipping down anew in a new curve.

I saw Max Ekesi speak on what he feels makes for good Agile as a part of the Agile Austin Featured Speaker Series on the tenth of March.

Maximilian Ekesi is pictured here with Kassandra K. Cardenas, the current chief product officer for Agile Austin of which the Agile Austin Featured Speaker Series is an offering. The event was hosted at Kasasa in Austin, Texas and Kasasa does some sort of banking-based tech. Max wants you to cook up an Agile process that is customized to your team, and, to that end, he walked us through what he described as his twenty year history, though it looked like nineteen years to me, and spoke to its pain points. He started at Dell in 2001 (did you know that dell.com was the first shopping cart site to do a million dollars of business in one day?) and then moved on to GM (General Motors) and finally landed at Whole Foods which is now owned by Amazon. He admitted that while he was at Dell and GM that he felt most energized about Agile when he would visit an Agile Austin talk and compare notes with other individuals excited about Agile. The problem as it turned out with both Dell and GM was the businesses themselves and he offered the Peter Drucker (a consultant) quote: "Culture eats strategy for breakfast." At either Dell or GM, I'm not sure which, Max was told to increase productivity by ten percent and he vented about the obsession over metrics which can always be skewed suit-to-purpose. I think he pushed back in that circumstance that he would first have to measure what was to find a baseline. "DRiVE" by Daniel H. Pink was put up on a pedestal as a pretty good book by Max and he argued that autonomy, mastery, and purpose are desired by knowledge workers per that book. Max feels that co-location is important and that a team should not be half split between say America and India. He also feels it is best to interact with the business owners and did not speak kindly of Michael Dell and his posse walling themselves off from development in their own little building in Round Rock where average Joe worker bee isn't allowed to go. At Whole Foods, the dev and the business sit on two adjacent floors of the same building! Max felt that teams should be end-to-end teams and not, for example, a few devs who have to argue for the testing team to allot them a resource for a spell. Instead, a team will just have devs, a tester, a project manager, and support and development DevOps characters rolled up into it. The teams are thought of as two pizza teams in that you may feed the teams with two pizzas and these two pizza teams are given autonomy to conduct their own affairs. One of the ways there is a break with autonomy however is that all teams have to follow a common cadence and there is a somewhat centralized roadmap. I suppose sprints fill a PI (program increment) and eventually it was decided that quarters of the year made for the best PI shapes. There are organizational meetings across all teams to announce intentions for a PI per team. Whole Foods is kind of chilled out, but presenters in the meetings I just mentioned have incentive to deliver as they presented and there are also financial rewards for teams that deliver. A few random things: Jeff Lomax was an attendee for this event and in spotting him I was able to put a last name with the name "Jeff" as suggested here. LeSS, with just the e in lowercase, stands for Large-Scale Scrum and is a framework for scaling Scrum up, big time. Max Ekesi is pictured here showing off a list of little splinters for different canned ways to approach Agile:

"Range: Why Generalists Triumph in a Specialized World" by David Epstein seems to be the book the Agile Austin book club is chewing through. Max stressed that there is not enough disruption in Austin, not like the wild madness of California tech. Chimp is an internal chat app that Amazon peddles to its own and Amazon also made its own cameras for its check-yourself-out stores.

Friday, March 6, 2020

South by Southwest has been cancelled due to the coronavirus!

no SXSW!

IBM ACE

It stands for IBM App Connect Enterprise and it used to be IIB or IBM Integration Bus. It's part of the WebSphere product family I guess. It's going to be the NServiceBus of the IBM suite of reality.

I saw Mike Benkovich speak on YAML pipelines in Azure DevOps at the Twin Cities .NET User Group last night.

From left to right in the photo here are Mike Benkovich followed by the three heads-of-state of the Twin Cities .NET User Group, Elsa Vezino, Jason "J" Erdahl, and William Austin. William told the crowd that he had learned that you could use Cosmos DB for free up to a certain point and Mike clarified that the cutoff was at 400 RUs (request units) of throughput. Consistent with the one other time I saw Mike speak, there seemed to be an upfront understanding that the audience was savvy with the ins and outs of Azure and he was covering territory really faster than I could follow along. What this talk boiled down to at its heart was the notion that a "Classic Pipeline" comprised of tasks is the old way of doing things and the future will be comprised of pipelines made up of YAML markup. You may still pick out tasks as you have and cast them into YAML markup. I got to see the YAML for the first time this evening. It kind of nests things under other things (headers I suppose) with indentation and the indented will sometimes have a leading hyphen. I do not pretend to understand it comprehensively. There are a few patterns to be had with the YAML rolling. "Containers" has to do with publishing to containers. "DocFX" entails using DocFX (FX for effects) to generate HTML documentation for a wiki from other markdown. "App Inflation" allows for inflating a team's permissions so that they may just publish to a file folder somewhere. "Golden Image Builder" is the fourth of the four which Mike did not get around to explaining to us. Once you take a "Classic Pipeline" into YAML, you never go back. It seems pipelines as code (PaC) is the future. There are all sorts of marketplace third party helpers such as Replace Tokens to make your magic more magical. Replace Tokens will replace otherwise not dynamic drab "markup" enclosed in hashtags at build and drop elsewhere time with whatever you want to match against what is enclosed. Mike spun up an IaC (infrastructure as code) project in Visual Studio and did some things with it before he really got around to the YAML part of the talk and herein I found what he was trying to convey the most murky. He was showing us the ARM stuff he showed us in the other talk I saw him give and he was breezing through its knobs and dials like it was nothing. When you deploy to a "Resource Group" it will make three files which are the app insights object, the website itself, and the plan. I do not know exactly what the app insights object and plan are. I asked in the talk and then couldn't understand. Ha ha. Did you know that @System.Environment.OSVersion in Razor will spit out your operating system version?

Thursday, March 5, 2020

Entity Adapter Pattern

Instead of just having a collection, one is given a collection with dictionaryesque qualities and a free reducer (think NgRx) for finding common things. This is a Google corp. creation.

It's almost time to restart

We couldn't restart to update your device at the scheduled time. It may have been off, had a low batter, or been in use. Restart now to stay up to date.

 
 

This suggests you need an update to Windows 10 when this pop up starts appearing and it points you at this, but not before mentioning that you may type winver at the start bar to be told what version of Windows you are running right now. I had Version 1809.

 
 

Addendum 3/6/2020: If you type "windows update settings" at the Windows 10 startbar and press enter you will get the Settings dialog box. Herein you may click "Advanced options" and perhaps turn off some of this noise.

Wednesday, March 4, 2020

GraphQL MN tonight featured a tracing-for-lag exposition.

Jason Coleman is pictured in the center of the picture here. He works at CaringBridge and he gave a talk that offered an exposition on what CaringBridge is, and, in short, it is a builder app for persons having tough medical experiences wherein they may blog of what they are going through and share it on with others. The network has a base of thirty million users. At Jason's left towards the right of the photo is Christopher Bartling who is the head-of-state of this group and who recommended the book "Production Ready GraphQL" by Marc-André Giroux. Mark Soule is pictured at Jason's right towards the left side of the photo. He works at a consultancy called the Nerdery (which hosted this talk) and they have had him deployed to CaringBridge for about a year now to work with/for Jason. He actually worked on a lag issue and showed off some deeper tooling to that end. In the photo here all three men are struggling to deal with the projector not projecting before the talks got rolling. Ping Identity and Amazon Cognito are ways to come up with tokens for user identities like Auth0. EKS is the Elastic Kubernetes Services for Amazon. Shopify has an example of some public-facing source code that has GraphQL magic in it. Zipkin and Jaeger are ways to have "open tracing" and thus to audit what is going on in a GraphQL orchestration to see where a pain point lies. This is better than just logging stuff to Splunk and trying to make sense of the time stamps. You are setting yourself up for a lot of work in the later approach. The opentracing way to go logs step by step at various steps in a chain of events to allow you to find the lag. There is an OpenTelemetry community around this stuff. JMeter is a Java-based load testing tool. autocannon is a rival that recommended in this space. In Google Chrome Developer Tools when you go to the "Performance" tab and record with the circular button at the upper left that says "Record" (when you mouse over it) and then stop recording you will see tabs for Summary, Bottom-Up, Call Tree, and Event Log. Bottom-Up shows which activities took the most time to aggregate and Call Tree shows which activities took the most time standalone. Apollo Federation is the new way to do stitching and stitching is the old way to aggregate. There are new keywords and terms with Apollo Federation. graphql-middleware allows queries to other things that already were to pass through GraphQL. Mark's Solution for improving performance ultimately was of more caching and more scaling (horizontal scaling with more instances). When he put his finger on the problem he found that the problem was not so much of the CaringBridge code but of the supporting actors, apollo-server-core and GraphQL itself. prettyJSONstringify is pretty heavy and there is no optional flag for turning it off at the time of this writing. There is just a lack of maturity in this space lending itself to some pain. Clinic.js is a neat diagnostics tool for this stuff. It has three modes: Doctor, Bubbleprof, and Flame. Bubbleprof draws circles to represent servers where time lag occurs and Doctor and Flame offer more traditional timeline layouts that are easier to understand. Flame reddens to accentuate the "burning" problems in its charting. It shows what is choking the event loop in Node and could be its own separate process, like prettyJSONstringify.

OIM is Oracle Identity Manager.

Wikipedia says it: "enables enterprises to manage the entire user life-cycle across all enterprise resources both within and beyond a firewall"

Tuesday, March 3, 2020

notes from recent job hunting adventures

  1. Zephyr has a suite of test management tools.
  2. FizzBuzz or fizz buzz is a very simple programing challenge.
  3. MobX is state management stuff for the React space.
  4. Libor (London Inter-bank Offered Rate) is an interbanking rates standard that has died.
  5. xPression is some real-time motion graphics hacky tool for overlaying text over people in news feeds.
  6. SRE stands for site reliability engineer.
  7. DevExtreme is the name of the DevExpress stuff in Angular.
  8. Tricentis offers Tosca support and maybe fraud.io for automated testing.