Tuesday, April 30, 2019

Don't hand to the JsonResult of the Microsoft.AspNetCore.Mvc namespace stringified JSON in C#.

When you parse the string in JS you may get a string for the object instead of an object. This for example is bad. Instead, do stuff like this:

  1. context.Result = new JsonResult(new { Message = context.Exception.Message });
     
  2. string message = "An error at the API occurred. The specific error message is
          being hidden from what the API exposes for security. If you have access to the
          logs you may see a better description free from obfuscation therein.";
    context.Result = new JsonResult(new { Message = message });

Crosstalk between ADFS and Azure?

ADFS may use SAML (Security Assertion Markup Language). ADFS is an on-premise solution. It's sister in the cloud is Azure AD. AD obviously stands for Active Directory. That is what both ADFS and Azure AD are all about. Power BI only works with Azure AD (which uses OAuth) and if you need Azure AD to crosstalk to ADFS where you normally authenticate for an application with adal.js, that can be a bit tricky. I took the photos of "the cloud" here on the sixth day of this year at the Uptown Diner.

catamorphisms

Mark Seemann suggests here that: "A catamorphism is a general abstraction that enables you to handle multiple values, for example in order to reduce them to a single value." An example he gives in C# is:

new[] { 42, 1337, 2112, 90125, 5040, 7, 1984 }.Sum();

 
 

...giving us: 100647

A fully qualified domain name or FQDN has the subdomain/hostname leading the domain name.

www.example.com is an example and example.com is NOT.

GHz and MHz stand for gigahertz and megahertz respectively.

Imagine a breakout like this only with hertz instead of bytes and this would measure processor power instead of amount of memory. Named for Heinrich Rudolf Hertz who proved that there are electromagnetic waves, hertz or Hz is a unit of measurement for frequency. While I'm at this, if you can't find "My Computer" at Windows 10, just start typing "my" at the search bar and you'll see "This PC" which is what you want. Right-clicking on it and picking "Properties" gives you a breakdown of specs for the computer and the gigahertz ranking for your processor lies therein.

Monday, April 29, 2019

recolor scrollbars in CSS?

You can maybe try something like this but this is imperfect in Chrome and doesn't work at all in IE.

#edit-middle {
   height: 500px;
   width: 250px;
   overflow-y: scroll;
   overflow-x: hidden;
}
#edit-middle::-webkit-scrollbar {
   background-color: #FFFFFF;
}
#edit-middle::-webkit-scrollbar-thumb {
   background-color: #f9f9f9;
}
#edit-middle::-webkit-scrollbar-button {
   background-color: #f9f9f9;
}

 
 

Here are some links on it:

After you watch a build finish in Azure DevOps, look at the releases to make sure the successful build rolled out to Octopus.

Where are builds and releases? Well, here is a bogus, would-be blog posting that I started to write today that explains that:

 
 

When I rename an Octopus Project where do I change the sister magic string in Azure DevOps?

At Overview, Boards, Repos, Pipelines, Test Plans, and Artifacts go to Pipelines. At Builds, Releases, Library, Task group, and Deployment groups (under Pipelines) pick Releases. Edit a release. Across the top where is says Pipeline, Task, Variables, Retention, Options, and History pick Tasks! Alright, so where do you make the change in Octopus then? At Overview, Process, Variables, Triggers, Channels, Release, and Settings pick Settings.

Saturday, April 27, 2019

Wednesday's JavaScript MN meetup was spearheaded by Jenessa White presenting on Gatsby.

Gatsby is a static site generator built on top of React. It uses GraphQL as its query language and Redux under the hood. Jenessa walked us through creating a blog with it. It requires Node and you have to use either yarn or npm also. Apparently the documentation is pretty good. Gatsby comes with a Prettier file .prettierrc for formatting code. gatsby-config.js allows you to define plugins and options that you'll have on your site. You may make a new page by making a new folder inside the "pages" folder and then putting an index.md file inside of the folder. .md is for markdown and the markup is all markdown (easy to read markup) which gets reshaped to HTML later via the Transformer plugin. The menu items array back in gatsby-config.js will hold the routes to the various pages. Jenessa White also mentioned that WordPress has a ReST API baked into it. I think she was also using Google Slides for her slideshow. There were a few lightning talks before the main presentation. Jason Hsu spoke on automating Docker deployments. He uses GitLab's tools to do so and I suppose GitLab is going to be something akin to Azure DevOps. Jason said Debian stretch is the latest stable version of Debian, but Debian buster will take its place in the next few months. Kevin Florenzano posed the question "What can I build in one hour?" and offered a web site hosted at DigitalOcean, some cheapo hosting, which had a bunch of Amazon affiliate (a.k.a. "Amazon Associates") links in a one page website hosted atop NGiNX. Mastodon is a social media platform where you may have your own server and the servers for the whole platform are sort of crowdsourced. Kevin has a blog at Mastodon. tinyfed.com allows you to follow others on Mastodon as a part of its magic and serverless.mn is a meetup group for serverless technologies coming in May. Erik Ostrom gave us a generic ramp up on Vue and I was surprised to learn that a Vue file will have the JavaScript, the template, and the CSS split across three files in Angular all in one file. Erik advertised that a new meetup, the Mpls Vue.js Meetup which is dedicated to Vue, was starting the very next night. I didn't think about it at the time, but this thing opened up against Avengers: Endgame. I wonder how it fared. I try to walk two miles every day (though the discipline has decayed) and while walking two miles inside of the Mall of America Thursday night I was floored by how unfull the mall was compared to any other Thursday. I guess everyone had somewhere else to be that night. It was like someone had snapped their fingers and half the people had disappeared. For that matter, I don't know why Joe Biden picked that day to announce that he was running for president. It seems foolish. I digress.

The GraphQL MN reboot offered Tamara Temple as a headliner on Tuesday night.

This is technically the second time this meetup group has met although the first time was well over a year ago and Zach Lendon and Scott Silvi who are the keepers now were not the keepers then. It's interesting that a new group is spun up while tying back to a one-off meeting of yore. I guess you can send notifications to all of the "members" that way. In theory, this thing will meet again and this will not be more flash-in-the-pan fluffiness and it is easy for me to believe that as GraphQL itself is not going anywhere. Its footprint in our lives should only grow. A programmer since 1977, and namedropping esoteric things like the Ada scripting language which I had never heard of (it's an extension from Pascal apparently), Tamara Temple uses GraphQL with React which seems to be where most of the adoption is thus far. Her environment is also on top of Ruby and she uses both the graphql-ruby gem inside of her Ruby on Rails application and also Webpacker, an independent API which lets you put all of your assets in a bundle and send them off/elsewhere. Some of the notes that follow come directly from Tamara, but others were just said by the crowd and I do not mean to suggest that any one person said any one particular thing as this tech talk would quickly evolve into a group discussion. Do note that I use the word evolve and not the word decay. There were maybe twenty of us in a side room at 612Brew (a bar/brewery in Minneapolis) and it was loose and chatty. It is important to note that GraphQL is just a specification, an idea. There has to be technology beyond the idea that actually implements it and instantiates it. You may use Apollo Server to serve up GraphQL and, in a React app, Apollo Client to catch what the server coughs up in your JavaScript. Apollo was made by the same team that cooked up Meteor which comprehensively has a frontend framework like Angular and a backend architecture in and of Node (see the parallel to Apollo?), and Apollo is open source software and seems to be winning its space. Axios, fetch, and Relay are rivals. The New York Times is apparently stuck on Relay to its detriment. That was a bit of random gossip dropped. There are many challenges with how to do GraphQL and accepted patterns have yet to be defined. Presently we are in an anything goes Wild West. Instead of making a dozen ReST calls for bits of data you can get one big graph but how do you traverse the graph in your JavaScript without writing a bunch of spaghetti code? You can version a ReST API (though as much is really an antipattern) but there is nothing like that in the GraphQL space so that begets a challenge when an initial graph has to be expanded to accommodate another consumer. How do you make it grow without growing pains? You may aggregate in other web service calls with GraphQL and as a graph grows fat and loops in more and more stuff there will naturally be a performance hit to be had. TypeShift is a library for generating TypeScript types for what GraphQL provides. A fragment is the data definition part of a subquery (the assignment half) and you may use a predefined fragment in multiple places in a query. (Queries for getting the right stuff back from a graph are often going to be complicated and unclean.) The term query implies a read and the term mutation implies a write in the nomenclature. It might be smart to whitelist queries so that not just anything may be queried opening the door for an extremely expensive query. You will need to hand in something for authentication when you use GraphQL in the name of security. Mark Soule was the opening act. He had a slideshow which posed a bunch of questions and in many ways set the tone to invite a group discussion ahead during Tamara's time. One of the things he mentioned, for example, is that you may have a nested tree of errors come back from calling GraphQL implementations all while the greater request ultimately returns a 200 response, so the pass/fail mindset of a ReST call does not apply in this new space. Some of what is above stems from Mark.

Friday, April 26, 2019

PowerApps apparently plays nicely with Power BI if you want to make a CRUD app in which Power BI is doing the reads.

You cannot really edit data from within Power BI but you can make datapoints kick open forms and controls in PowerApps off in a side pane. When this stuff writes to a database the charts in Power BI can refreshed off of the database data, etc.

Where are my keys in modern (2019) MSDN?

  1. go to https://msdn.microsoft.com/en-us/
  2. assuming you may get in as you, click on "Subscriber portal" at the upper right
  3. then click "Product Keys" at the top nav

Microsoft Developer Network is what MSDN stands for.

Theresa May is getting some scrutiny for wanting to use Huawei as a vendor to set up a 5G network for Britain's intelligence community.

Huawei has ties to China of course. I heard about this secondhand today.

Thursday, April 25, 2019

Tag for Status Change Alerts

If you right-click on someone in a list of contacts in Skype and pick this option, it will do what you think it does.

throwing exceptions out of Attributes in C# behaves rotten (my opinion)

I guess an Attribute is for metadata and not runtime concerns. I thought a good pattern might be to verify a role at a Controller action and throw an exception upon a role missing. However, my attempts to catch error messages in middleware here and here, do not catch exceptions thrown from attributes. Lame!

Clone a project in Octopus!

At the project's main page where it says Overview, Process, Variables, Triggers, Channels, Releases, and Settings along the left edge you will want to pick Settings. Then right-click on the three dots in a vertical line at the upper right and pick Clone.

Leading a variable with an at symbol in C# will allow you to use a reserved word as a variable name!

params is not a legitimate variable name but @params is!

You may have a Settings.settings file in your Properties folder in a C# project in a Visual Studio solution.

It is a dictionary. You may pull stuff out of it like so:

var foo = YourProjectNameHere.Properties.Settings.Default.Foo;

Easily craft complicated URL line variables in C# while encoding both colons to %3a and forward slashes to %2f as well.

var nameValueCollection = new NameValueCollection
{
   {"response_type", "code"},
   {"client_id", "1d097a7f-f773-464c-b24e-6b904a19861a"},
   {"resource", "https://analysis.windows.net/powerbi/api"},
   {"redirect_uri", "http://www.example.com/"}
};
var queryString = HttpUtility.ParseQueryString(string.Empty);
queryString.Add(nameValueCollection);
string whereTo = "https://login.windows.net/common/oauth2/authorize/";
whereTo = String.Format("{0}?{1}", whereTo, queryString);

Wednesday, April 24, 2019

semantic versioning with four numbers

The spec for this wants you to have three numbers and not four. In Visual Studio 2019 Preview if you make a new C# code library project and look at its properties the "Package" tab will have a spot to punch in an "Assembly version:" with four segments. Instead of MAJOR.MINOR.PATCH we have herein MAJOR.MINOR.PATCH.BUILD wherein the fourth digit really only exists to make the version number differentiate when you want to kick off a new build and nothing more. The PATCH should only be for downwards compatible bug fixes and the MINOR version should increment when you check in new code for story work.

Tuesday, April 23, 2019

modal thoughts sloppiness

An eight digit hexadecimal setting for background-color can be superior for the overlay for a modal compared to an opacity setting in CSS. You will want to fill the whole of the browser with a div to prevent a user from clicking through to the button below in a typical in-your-face modal implementation, but...

background-color: #00000044;

 
 

...may be superior in this regard for making a greyed-out (disabled) effect for everything beneath the modal as...

background-color: #000000;
opacity: 0.25;

 
 

...will, affect the immediate div the same way, but unfortunately also reduce the... oh wait... that (the eight digit approach) only works in Chrome and not in IE. I guess you have to have the second setting. Don't put the modal part of your modal inside of the giant div covering everything with the opacity cranked down as the modal itself will be washed out too. I really do not have a good strategy for disabling tabbing to controls behind the modal in an Angular 7 application. Sigh. My component looks like this:

import { Component, Input, Output, EventEmitter, ViewChild, ElementRef, OnChanges } from '@angular/core';
@Component({
   selector: 'error',
   templateUrl: './error.component.html',
   styleUrls: ['./error.component.scss']
})
export class ErrorComponent implements OnChanges {
   @Input() error: string;
   @Output() close = new EventEmitter<void>();
   @ViewChild('closeLink') link: ElementRef<HTMLElement>;
   
   public ngOnChanges() {
      if (this.error) {
         this.link.nativeElement.focus();
      }
   }
   
   public clear():boolean {
      this.close.emit();
      return false;
   }
}

 
 

The template:

<article id="outererrorwrapper" [ngClass]="{displaynone:!error}">
   <section id="middleerrorwrapper">
      <div id="innererrorwrapper">
         <div id="closecontrol"><a #closeLink href="#" (click)="clear()" (keydown)="clear()"
               tabindex="-1">x</a></div>
         <div id="genericheader">An Error has Occurred</div>
         {{error}}
      </div>
   </section>
</article>
<article id="greyedouteffect" [ngClass]="{displaynone:!error}"></article>

 
 

The Sass:

$black: #000000;
$grey: #CCCCCC;
$white: #FFFFFF;
@mixin uplift() {
   position: absolute;
   margin-top: -44px;
   font-size: 20px;
}
a {
   text-decoration: none;
   cursor: pointer;
   outline: none;
   &:link {
      color: $grey;
   }
   &:visited {
      color: $grey;
   }
   &:hover {
      color: $black;
   }
   &:focus {
      color: $grey;
   }
   &:active {
      color: $grey;
   }
}
#closecontrol {
   @include uplift();
   font-weight: bold;
   width: 20px;
   margin-left: 560px;
}
.displaynone {
   display: none;
}
#genericheader {
   @include uplift();
}
#greyedouteffect {
   padding-top: 4px;
   position:absolute;
   width: 100%;
   left: 0;
   top: 56px;
   font-family: proxima,Gotham,'Helvetica Neue',Helvetica,Arial,sans-serif;
   color: #000000;
   margin-top: -60px;
   z-index: 199;
   height: 100%;
   background-color: $black;
   opacity: 0.25;
}
#innererrorwrapper {
   margin-top: 50px;
   border-top: 1px solid $grey;
   margin-bottom: 20px;
   padding: 10px 10px 0 10px;
   font-size: 13px;
}
#middleerrorwrapper {
   margin: 60px calc(50% - 300px) 0 calc(50% - 300px);
   width: 600px;
   background-color: $white;
   border-radius: 15px;
   border: 1px solid $grey;
   position: absolute;
}
#outererrorwrapper {
   padding-top: 4px;
   position:absolute;
   width: 100%;
   left: 0;
   top: 56px;
   font-family: proxima,Gotham,'Helvetica Neue',Helvetica,Arial,sans-serif;
   color: #000000;
   margin-top: -60px;
   z-index: 200;
}

 
 

The Russian doll the component is inside of has this in it at its TypeScript:

public error: string;
public clear():void {
   this.error = "";
}

 
 

The bit of the Russian doll's template that calls out to my component is:

<error (close)="clear()" [error]="error"></error>

You may rename a .nupkg file to a .zip file to see what is inside of it.

kind of like the modern Microsoft Office extensions...

Cannot read property 'nativeElement' of undefined

In an Angular application don't try to use a ViewChild from a component's constructor or ngOnInit. Use ngAfterViewInit or ngOnChanges or one of the methods in the component. There is also a lot of pain to be had in nesting these controls inside of an *ngIf and a better thing to do is to use a CSS style to conditionally hide that which wraps a ViewChild.

Monday, April 22, 2019

angular2-powerbi and ngx-powerbi

These might be things to install into node_modules in an Angular application to get embedded Power BI afloat. I'm not certain yet as I am not successful yet.

error: failed to push some refs to 'https://www.example.com/'

In my case, I had a typo in the name of the branch I was trying to push to master. That caused this error!

 
 

Addendum 6/29/2019: This came up this morning too. In that scenario I was trying to push to master while working from home and I ended up having to go into the office to do so.

simple Sass YAGNI mixin

This LESS would look like so in Sass:

mixin seaMonster() {
   background-color: #000000;
   color: #00FF00;
}
#cthulhu {
   width: 1000px;
   height: 1000px;
   @include seaMonster();
}

 
 

This has a how-to cheatsheet on the mixins of Sass!

 
 

Addendum 5/13/2019: What was I thinking??? YAGNI should really be DRY. Also, there needs to be a leading at symbol at mixin at the beginning of what is above. It should look like:

@mixin seaMonster() {
   background-color: #000000;
   color: #00FF00;
}
#cthulhu {
   width: 1000px;
   height: 1000px;
   @include seaMonster();
}

A border-radius CSS style in pixels instead of a percentage is really the way to go if you are not applying it to a perfect square.

Otherwise the slope is deformed.

The MQ part of RabbitMQ is going to stand for message queue or messaging queue.

Maybe message queuing in the wackiest shape.

Sunday, April 21, 2019

I am going to try to get the NGRX store stuff working in an Angular 6 application in my spare time.

I am going to try to follow this. It recommends installing the store stuff like so:

npm install @ngrx/core @ngrx/store @ngrx/effects @ngrx/store-devtools @ngrx/router-store --save

Unchecked runtime.lastError: The message port closed before a response was received.

When this shows up in the console of Google Chrome Developer Tools it is not your fault. There is a plugin causing it. In my case it was Norton Safe Web.

I saw Riley Major speak on refactoring monolith stored procedures on Tuesday night at PASSMN.

Things like adding RAND() which give a random decimal or more likely something like DATEPART(hour, GETDATE()) which more usefully gives you the current hour when tossed in the mix make a sproc nondeterministic as if something is deterministic the same inputs should always yield that same outputs, predictably. The sort of external dependencies along the lines of sending emails from SQL or running CLR from SQL are also of this troublesome ilk. These issues will be mixed in with everything else and they need to be abstracted into isolation in a refactoring. These need to be pulled out to variables and mocked. The way this stuff can be "mocked" in test is by jamming settings for the variables into the sproc after their normal assignments temporarily. If this sounds hacky this is why people mostly don't test sprocs, but you don't really have a choice when refactoring a monolith stored procedure do you? You can't just make changes as you'll break something. Build a "ghost house" with variables to mock your black boxes. Look for anything that potentially changes (INSERT, UPDATE, DELETE) to know all tables that are affected and hoist DECLARE statements to the top as much as possible. Sometimes you won't be able to move the assignments up. Other things said? Dynamic SQL should be used sparingly. In this approach you are building a SQL statement inside SQL in a string and then using EXEC (@yourNameHere) to run the SQL you have made, in T-SQL at least. SELECT CONVERT(GETDATE(), SYSDATETIMEOFFSET()) should explicitly show the time zone offset. UDF stands for user defined functions and when these return tables you basically have a view with parameters. The PASS part of PASSMN stands for Professional Association for SQL Server and, less cryptically, the MN stands for Minnesota. This thing met at the Microsoft office in Edina. Before Riley Major spoke an Andrea Imhoff gave a smaller talk on being an analyst designing reports and in posing the question "How do you make the space for yourself to participate as a partner in analytical and reporting work?" got audience members to suggest that each business unit has its own reporting requirements and that there is no reporting template. Andrea is pictured below with Dan English who seemed to be the moderator for PASSMN.

Saturday, April 20, 2019

I saw Jason Rowe speak on RabbitMQ at the Twin Cities Code Camp one week ago today.

I should warn upfront that this was the last of the five talks I saw that day as my focus started to fade, that I don't know RabbitMQ to begin with, and that this was not a beginner's talk at all. In looking back at my notes the first thing I have written down is that Martin Fowler suggests having dumb pipes and smart endpoints. RabbitMQ has been around since 2008. AMQP or Advanced Message Queue Protocol is described in one of Jason's slides as a "network protocol to enable client apps to communicate with compatible messaging systems" and was designed by John O'Hara at JPMorgan. The slide shown here specifically is one of two by Jason Rowe where he had a tortoise versus the hare thing going on and while the rabbit here, yes, represents the fast side of RabbitMQ the turtle does not represent slowness. It represents the safety that comes from a performance hit to speed in a tradeoff. As a tortoise I have a shell and that makes me safe, get it? The scale here from hare to tortoise (left to right) contains: No guarantees, Notification on failure, Publisher confirms, Alternate exchanges, HA Queues, Transactions, HA Queues w/ Transactions, Persisted Messages ...and HA herein stands for high availability. Alright, the second slide like this has from hare to tortoise: Consuming with Acknowledgement and QoS > 1, Consuming with "No Ack Mode" enabled, Consume with Acknowledgements, Consuming and using Transactions, Getting Messages ...and QoS herein stands for quality of service. Durable means saved to disk. This means that a queue can be recovered if it stops instead of lost and, yep, herein is another performance squeeze if you want to go there. Don't worry so much about queues failing as, more likely, administrators will reboot queues when they sense they are sick. In the sidecar pattern we take in all of the stuff we can, queue it up, and write it when we can. Alternatively, in a lazy queue approach one writes records to disk real quick and then only brings them into memory when needed. What are some other terms to mention? HiPE or High performance Erlang will have RabbitMQ compile itself before startup making it snappier. EasyNetQ may wrap RabbitMQ and allow .NET to talk to it easily. Jason said that Bunny was the similar thing for Java's Spring Framework, but I kinda see the word Ruby instead of the word Java when I go Google for Bunny. CPT is a term I can't find at all in Googling which Jason suggested stood for contract-based test or consumer-based test. Azure Event Hub and Azure Service Bus are rivals to RabbitMQ I suppose. CloudAMQP is a good play place to figure out RabbitMQ. RabbitMQ does round robin out of the box, processing things in a circular order. RabbitMQ doesn't look at your messages at all and you could put a gigabyte of stuff in a message but it is not recommended. Some of Jason's C# code that I don't really understand:

public class BusFactory : IDisposable
{
   private static IBus busInstance;
   
   public IBus GetBus()
   {
      if (busInstance == null)
      {
         busInstance = RabbitHutch.CreateBus(Configuration.Host);
         busInstance.Advanced.MessageReturned += Advanced_MessageReturned;
      }
      return busInstance;
   }
   
   private void Advanced_MessageReturned(object sender,
         MessageReturnedEventArgs e)
   {

 
 

More yet follows.

var busFactory = new BusFactory();
using (var bus = busFactory.GetBus())
{
   var queueName = Configuration.HelloWorldQueueName;
   var exchangeName = Configuration.HelloWorldExchangeName;
   var routingKey = Configuration.HelloWorldRoutingKey;
   
   
// Declare exchange/queue and setup consumer for hello world message
   var queue = bus.Advanced.QueueDeclare(queueName);
   var exchange = bus.Advanced.ExchangeDeclare(exchangeName, "topic");
   bus.Advanced.Bind(exhange, queue, routingKey);
   
   
// Setup consumer and onMessage handler.
   bus.Advanced.Consume(queue, (body, properties, info) =>
   {
      var json = Encoding.UTF8.GetString(body);
      
// JSON would normally be deserialized via shared Nuget package.
      Console.WriteLine(json);
   });
   
   while (true)
   {
      Console.WriteLine($"Consumer running and commerical status = {bus.
...

the kind of meal only I would make

scrambled eggs, spaghetti, and hand torn chunks of pepperoni

Friday, April 19, 2019

I have some notes from a PowerShell powwow today.

  1. get-verb will give you a list of the verbs.
  2. TIOBE (The Importance of Being Earnest) is an index of what programming languages are most popular and PowerShell the scripting language is now being seen as a programming language and is ranking in position 45 out of 50, on the charts for the first time.
  3. get-command may be used for narrowing in on a command (IntelliSense) though you have to feed it something to get it started and you may also call a PowerShell module with this command to narrow in on a function in the module.
  4. Make is a build tool and rake, jake, psake, etc. sort of make inspired language-specific variants.
  5. import-module followed by a path to a module will import a module and a module is just a .ps1 file full of PowerShell functions that has been renamed to a .psm1 extension. Once you import a module you may call its functions as they are in memory there in the shell.
  6. .psd1 is for a PowerShell manifest and you may loop in numerous modules in a manifest.
  7. RootModule = "MyModule.psm1" in a manifest dictates the first module to load.
  8. PowerShell 7 will be based off of .NET Core 3.
  9. import-manifest followed by a path to a manifest will import a manifest.

iif in a sproc

Look, I can get all of the cats if I don't hand in a parameter or I can hand in a parameter and get a cat by its Id!

ALTER procedure GetCats
@MyHandIn int = null
as
SET NOCOUNT ON;
SELECT Id, Name, NumberOfLives FROM Cats
WHERE iif(@MyHandIn is NULL, Id, @MyHandIn) = Id

comments histories in stored procedures

I'm trying to remember how to craft these now that I am no longer at Paymetric. I recommend, putting sequential comments of who changed what when above the CREATE/ALTER/CREATE OR ALTER

Thursday, April 18, 2019

Five days ago I saw Chris Woodruff speak on .NET Core 2.2 APIs at the Twin Cities Code Camp.

Chris works for JetBrains on ReSharper, Rider, and DataGrip which like Rider is a cross-platform IDE only DataGrip is slanted for database stuff. There is the concept of compiled events in Entity Framework wherein LINQ statements are precompiled making them thirty to forty percent faster. Chinook is a database of music information. I think you may use it as a dummy database to make a project with instead of the Northwind database for example. .NET Core does not used the GAC due to being cross-platform. Stack Exchange, the owner of Stack Overflow, developed Dapper and Stack Overflow runs on top of Dapper. Chris used the term "Supervisor" to denote how Entity Models get mapped to what he called "View Models" (DTOs). One might use AutoMapper orchestrations for the "Supervisor" in an application I suppose. In Chris' implementation he had a giant class for it. This was to avoid circular references. If a person has albums and each album has a person... two separate mapping classes could cause heartache. Entity Framework Core 2.2 has DBContext pooling which will offer some performance improvements. Caching is important when designing architecture and there are three shapes to consider, response caching, in-memory caching, and distributed caching.

Cache-Control: public, max-age: 60

 
 

...is an example of response caching in an HTTP response header. You may have an attribute at a Controller for this sort of thing like such:

[ResponseCache(Duration = 60)]

 
 

Alternatively, you may explicitly not cache.

[ResponseCache(Location = ResponseCacheLocation.None, NoStore = true)]

 
 

An example of in-memory caching is having something like this in the middleware:

services.AddMemoryCache();

 
 

Chris projected the following example of using the cache:

public async Task<Genre> GetByIdAsync(int id, CancellationToken ct =
      default(CancellationToken))
{
   var cachedGenre = _cache.Get<Genre>(id);
   if (cachedGenre != null)
   {
      return cachedGenre;
   }
   else
   {
      var dbGenre = await _context.Genre.FindAsync(id);
      var cachedEntryOptions = new MemoryCacheEntryOptions().
            SetSlidingExpiration(TimeSpan.FromSeconds(604800));
      _cache.Set(dbGenre.GenreId, dbGenre, cacheEntryOptions);
      return dbGenre;
   }
}

 
 

Microsoft.Extensions.Caching.Memory is the namespace for this stuff. Distributed caching is really external caching so think of local Redis Cache, using SQL Server to cache, Azure Redis Caching, Amazon ElastiCache, Google Cloud Memcache, etc. Chris Woodruff has some Channel 9 appearances (training videos) you can find. For testing Chris recommends looping in both the Alba of Jeremy Miller and Microsoft.AspNetCore.TestHost. You may have a Theory instead of a Fact in an xUnit test as seen here:

Theory implies that the test is an integration test. I don't really see any other distinction. I don't see a distinction in other syntax. The talk by Chris Woodruff was one of a handful I saw at the Twin Cities Code Camp. This details the first talk I saw that day and kinda speaks to what the event was in the big picture some too.

 
 

Addendum 2/10/2020: The description of Theory instead of a Fact here is probably bad. See this instead.

Force IE to render as a particular version of IE in spite of compatible mode!

This has some notes on this:

<meta http-equiv="X-UA-Compatible" content="IE=edge" />

How does Python end up installed to begin with in order for Angular to use it to compile Sass to CSS?

It can end up installed with node/npm and it can end up installed with Visual Studio. If you manually install Python it may end up not where node expects it to be. Per this fix that with:

npm config set python "c:\Python\27\python.exe"

Sitecore Helix

...is a set of standards for good Sitecore architecture putting an emphasis on both decoupling dependencies and avoiding circular references. This is a distancing from "the old way of doing things" with Sitecore.

AppDynamics

...this company focuses on application performance in the APM space.

Wednesday, April 17, 2019

You may use stored procedures with Entity Framework in either the code first or the database first approaches.

In short, you may do what you do with Dapper in EF. I don't know why you wouldn't just use Dapper though. I guess the use case arises when you are mostly doing Entity Framework without stored procedures and then in some one-off wackiness you have to go there.

You need either the Pro or Premium version of Power BI to have embedded reports, but it's pretty easy to get that in the short term.

  1. Go to: powerbi.com
  2. Sign in.
  3. Click the gear at the upper right.
  4. Pick "Manage Personal Storage" from the menu that appears. (I'm serious.)
  5. Click "Try Pro for Free"
  6. Click "Start Trial"

This will either start a sixty day trial or extend it. Afterward, you may now add reports by clicking on "Workspaces" at the left nav, picking a particular workspace, and then clicking "Create" at the upper right.

Tuesday, April 16, 2019

I saw Keith Voels speak on async/await in C# at the Twin Cities Code Camp three days ago.

The third of five talks I saw here gave me Keith. I always assumed that you were breaking onto a new thread whenever you called a method that had the async keyword decorating it and you are, but it is important to understand that you are not necessarily staying on the same thread in the entire time during the independent act. What is more, you are not necessarily rejoining the main "God" thread either. The async/await paradigm's TAP (task-based asynchronous programming) manages boxing stuff up and putting it on a shelf so that another thread can pick it up seamlessly to you. Why change threads at all? Keith Voels showed off the performance from an app built with manually changing threads the old (hard) way versus the same app built with async/await and there were naturally places where, in the first app, one thread ended up doing a little more than the others running at the same time creating a noticeable bottleneck thus translating to a performance gap in contrast to the second application. Another thing I learned is that you really should await all async methods as if you don't the async process is vulnerable to being cleaned up by garbage collection. I am guilty of often creating void async methods and not awaiting their return. This I should not have done. ExecutionContext is the term for the async paradigm's modestly complicated, nuanced management of threads. The SynchronizationContext I believe captures the EC (ExecutionContext) at any given fork in the road and can be used to rejoin child threads to a consistent main thread. The need for a consistent UI thread arises in WinForms and WPF applications which freak out if the initial thread is lost. ConfigureAwait is the magic to determine whether or not we rejoin the main UI thread. .ConfigureAwait(false) must be explicitly used on all awaits to not circle back to the main UI thread. I guess this may hang off of everything that returns Task. It was deemed that it would just be too much overhead to ask WinForms and WPF developers to sprinkle .ConfigureAwait(true) everywhere. Use Task.Delay instead of Thread.Sleep in the new approach. You do not want to mix the old ways and the new in any shape as the ExecutionContext is not smart enough to compensate for you not being smart yourself. System.Threading.Task and System.Thread are not playmates. It is possible to send an async thread(s) a CancellationToken as a conditional flag to make it stop doing what it's doing and just wrap up and return right away.

"user owns data" vs "app owns data" in Power BI

Well, the first of these allows of different users to see different things in terms of permissions so it might be the way to go. There is a way to embed Power BI into the component templates of an Angular app (not an iFrame trick) and this is a thread I found on it. It requires some prep.

Cannot access file_stream column in FileTable 'YourNameHere', because FileTable doesn't support row versioning. Either set transaction level to something other than READ COMMITTED SNAPSHOT or SNAPSHOT, or use READCOMMITTEDLOCK table hint.

SELECT * FROM [FunStuff].[dbo].[YourNameHere]

 
 

...needs to become:

SELECT * FROM [FunStuff].[dbo].[YourNameHere] WITH (READCOMMITTEDLOCK)

 
 

...to get out of the error. There are a couple of things to note here. One of them is that the stuff after a with in a table hint. This has some more on the hints in T-SQL. Also note that I am writing to and reading from a File Table. In the Object Explorer in SSMS (Microsoft SQL Server Management Studio), under a database, under Tables, there is a folder for FileTables. A file table will have a corresponding file share with it and you may just look into the file share like any other folder in Windows and you may write files into there from code or even drag and drop files in there manually if it suits you. The the table representation of the table (yes, there is duality) in SQL will have a file_stream column to represent the file itself and a stream_id column for a unique ID. This is somewhat off topic, but while I am writing of SSMS, here are the database role memberships for a login:

  1. db_accessadmin
  2. db_backupoperator
  3. db_datareader
  4. db_datawriter
  5. db_ddladmin
  6. db_denydatareader
  7. db_denydatawriter
  8. db_owner
  9. db_securityadmin
  10. public

'((Microsoft.AspNetCore.Http.Internal.DefaultHttpRequest)request).Form' threw an exception of type 'System.IO.InvalidDataException'

And exception was: System.IO.InvalidDataException: 'Missing content-type boundary.' Alright, I was getting this in an Angular 7 application attempting to do this stuff and talk to a .NET Core 2.1 API. I had already modified what was by removing the .catch as described here, and I had to make two more modifications to get around this second problem:

  1. I removed this line:
    headers.append('Content-Type', 'multipart/form-data');
     
  2. I changed the action's method signature like so:
    public void SaveStuff(IFormFile uploadFile)
    {

     

I tried changing multipart/form-data to application/x-www-form-urlencoded before I got this working and instead got this error:

The function evaluation requires all threads to run.

OpenAxiom or Opensource axiom was once just axiom which was a for-profit thing, but now it is free.

You do mathematic calculations with it.

Monday, April 15, 2019

I saw David Pine speak on WebAssembly at the Twin Cities Code Camp Saturday.

This was the second of five talks I saw at this event. Both a Microsoft MVP (Most Valuable Professional) and a Google Developer Expert, David probably knows what he's talking about when he asserts its worth wondering if WebAssembly is "the new endgame" and I indeed found myself less dismissive of Blazor (the name comes from Browser + Razor) which will supposedly allow me to pen a SPA app with .NET Core's MVC and Razor markup only, free from any JavaScript! I've met enough C# people who hate JavaScript to assume Blazor would be a failed attempt to get those characters a viable terrarium uncontaminated with JS, however David Pine offered that the central argument for less JavaScript is that our development as developers is in a straightjacket if we are forced to author exclusively in JavaScript alone and not, for example, C, C++, C#, R, Go, and Rust, which may all be ported to a common format, Wasm (the W for Web and the asm for Assembly). You still have to have a little bit of JavaScript at the browser to reach out to a .wasm file and turn it on, so there really is no escape from JavaScript, but you may do your primary work and the vast majority of your work in a different language. (You probably don't want to have a hodgepodge of WebAssembly and JavaScript where you are crosstalking between the two as such will be performance expensive. Use JavaScript minimalistically as the door in and nothing more.) The world is wide and the web should reflect it. That is the central philosophy herein. To make it work the typical AST (abstract syntax tree) approach to walking keywords in code is used to compile the other languages down to WebAssembly, a binary instruction format. I think the Clang compiler may get used for the applicable languages. WebAssembly utilizes a stack-based virtual machine in a push/pop paradigm. Can I use? is a site here that has breakdowns of what is supported by what browser and if you search for WebAssembly it's looking pretty accessible for just about everything but old IE (Internet Explorer). In terms of what it is not, it is not some sort of instruction set like x86. It runs in the same sandbox as JavaScript itself and is not an outsider like the plugins for Google Chrome which do not. Emscripten is a toolchain (like a toolbelt only the tools are getting used sequentially in stages) that takes LLVM (Low Level Virtual Machine) bitcode in .wasm files and converts it to .wat (WebAssembly text) files which are human readable in a strictest sense though you won't really want to spend time reading the code it makes compared to your own code that compiled down there to begin with. I think WasmExplorer, WasmFiddle, and ijs.runtime (i for International) are tools to help you work and a Steve Sanderson one of the guys behind Blazor. The Uno Platform will let you make WebAssembly/XAML/UWP apps. The Mono runtime which implements the ECMA common language runtime is in the mix here too. Your .dll goes through Mono to the web as suggested here:

One thing that floored me in all of this is that the .dll nonetheless comes up to the browser as part of the deliverable instead of just being the kickoff point for compiling other stuff to ultimately exposition. This allows you to debug inside of your own .dll through the browser with Google Chrome Developer Tools. This also leads to the biggest problem, fat files sizes. The typical SPA application is three megabytes in size while a silly hello world app that David showed us was six. The powers that be are working on a way to treeshake the .dlls.

Why can't I loop in stuff at the constructor of a service without error in an Angular 7 application?

You need to use the @Injectable() decoration. Is that what is missing?

The number following SELECT TOP in T-SQL doesn't have to be wrapped in parenthesis.

Both of these are legit.

  • SELECT TOP 20 * FROM ThisThing
  • SELECT TOP (20) * FROM ThisThing

.catch of Angular 4 has become .catchError in Angular 7 but I don't yet understand how to use it.

In this, I just took it out to avoid this error:

Property 'catch' does not exist on type 'Observable<Response>'.

How do I keep Visual Studio 2019 Preview for breaking on one exception at one line of code in particular?

There isn't a good way to do this. The compromise is to make that exception a different type of exception than the others. This touches on the ApplicationException in the root System namespace and suggests it's a long abandoned archaic thing and for my purposes it seemed like a fine outlier. The first time Visual Studio 2019 Preview breaks at this exception, there will be a little dialog box that appears in Debugging that has an "Exception Settings" subregion that you may expand to find a "Break when this exception type is user-unhandled" checkbox to check and that should solve your problems. I noticed that when adal.js tries to authenticate at a new browser tab for the first spin up that there is at least one attempt always when the username is just null. I both want to throw an exception instead of letting code go forward and I want to not stop Visual Studio 2019 Preview every time that happens. What else can I do?

Saturday, April 13, 2019

I saw Kristen Kinney-Ohlmann speak on SQL at the Twin Cities Code Camp today.

A lot of this was a fairly straightforward talk on mostly T-SQL. She made it fun. She suggested a tool belt in which WHERE was the saw, joins where the screwdriver, GROUP BY the wrench, ORDER BY "the planner" (huh?), and UNION the clamp. I'm not sure I really get her analogy, but... OK. Microsoft apparently made T-SQL in collaboration with Sybase. IBM's Db2 was mentioned some and instead of putting say TOP 100 between SELECT and the star you apparently, after everything else, have to denote that you want to fetch one hundred records only at the end of the query. She spoke to some of the differences in different variations of SQL. Kristen Kinney-Ohlmann mentioned concatenation in T-SQL. As best as I can tell you do it like this:

SELECT CONCAT(First, ' ', Last) As Name
FROM Peeps

 
 

I think this trick has been around since the 2012 version and that before it came you had to just jam stuff together with plus signs. In T-SQL the word OUTER may optionally follow LEFT, RIGHT, and FULL in left, right, and full joins or you may just leave it off. A FULL JOIN gives you everything both a left and right join would give you! A regular JOIN or an INNER JOIN (they do the same thing in T-SQL) are also sometimes thought of as an equal join or an equijoin. The difference between UNION and UNION ALL is that UNION will filter out dupes. Moreover, CROSS APPLY was brought up. It is kinda like subselects and CTEs. This has some examples of its use I guess. Moreover still, try using COUNT(1) instead of COUNT(*) when getting a count in a GROUP BY as the former will just count up by ones while the later will crawl everything and not just the records in question. This was the first of five talks I saw. I'm sure I will offer write-ups on the other four too. The free event, not unlike the long lost Austin Code Camp of yore, was held at Normandale Community College in Bloomington, Minnesota. Below is a Mr. Jason Bock kicking off the event in the keynote. In a lunch outing with a coworker I learned that .scss stands for Sassy Cascading Stylesheet, Kubernetes allows containers to talk to each other, there is a Google Trends API to see what people are searching for and when, and Gravit is an Inkscapesque free vector graphics tool. I mention these here because it was part of this experience and I don't know where else to jam it in.

Friday, April 12, 2019

When there is a conflict for a pull request in Azure DevOps.

Alright, this workflow is a bit different than this one if you are just using a command line tool to do all the work before making the pull request with git command line commands. At the pull request there will be tabs for Overview, Files, Updates, Commits, and Conflicts and I recommend you leave Overview for Conflicts where you may fix your issues.

TypeError: Object doesn't support property or method 'includes'

This error shows up in Edge but not Chrome so I guess I should not use .includes eh? This...

private getBusinessUnitRecordsSuccess(records:Array<BusinessUnitRecordModel>){
   records.forEach(r => {
      if (this.user.BusinessUnitIds.includes(r.BusinessUnitID)){
         this.businessUnitRecords.push(r);
      }
   });
}

 
 

...should become:

private getBusinessUnitRecordsSuccess(records:Array<BusinessUnitRecordModel>){
   records.forEach(r => {
      this.user.BusinessUnitIds.forEach(i => {
         if (i === r.BusinessUnitID) {
            this.businessUnitRecords.push(r);
         }
      });
   });
}

Thursday, April 11, 2019

Keep it inside the array in Angular 7. The freaks are part of the family now.

Assuming router below is an instance of Router from '@angular/router' then:

this.router.navigate(['/upload', {id:id}]);

 
 

...and...

router.navigate(['/upload','authenticated', {id:id}]);

 
 

...are really the way to bolt on stuff at the end of the URL to visit and not:

this.router.navigate(['/upload'], {id:id});

 
 

...and...

router.navigate(['/upload','authenticated'], {id:id});

 
 

I see the later approach in Angular 4 examples all over my own blog, but this is no longer the way things work.

Every day I need attention.

I've been in the Twin Cities for quite a while now but am only recently learning of this acronym (Every day I need attention.) for Edina, the most affluent city in Minnesota. The people of Edina are referred to as "cake eaters" in a Marie Antoinette "Let them eat cake." bratty stereotyping. There was no expectation on me drive into work because of the snowstorm today but I did get out at lunchtime and stop by the Verizon shop at 50th and France to get my iPad to use my second phone number to speak to the internet. Verizon is on the East side of France Avenue so that means it is technically in Minneapolis and not Edina, but I drove through Edina to get there and driving back I stopped at this playground to snap some photos. How can I make this blog posting about tech? Did you know that if you have Verizon's service you may dial 611 for tech support?

Port 50603 is being used by another application.

This error kinda goes hand in hand with Unable to connect to web server 'IIS Express'. and you probably want to change the port at launchSettings.json at your Visual Studio 2019 Preview .NET Core 2.1 application and not at C:\Users\TJaeschk\Documents\IISExpress\config\applicationhost.config

Wednesday, April 10, 2019

Google Materials

a bunch of widget and helpers not unlike Angular Materials but not Angular-specific

some notes on Visual Studio 2017 Database Projects

At the project I am looking at now there is a _Publish folder with a series of .xml files for the series of environments to publish to. You may double-click on one of them in the Solution Explorer and get a "Publish Database" dialog box. Herein, you may make global variables for the environment such as the user in active directory who will interact with the database. "Advanced..." has a bunch of checkboxes. It might be wise to check "Block incremental deployment if data loss might occur" to prevent a Little Bobby Tables SNAFU. The _Scripts folder has a Script.PostDeployment.sql script which runs after everything else runs!

How do I promote a build in Octopus to other environments beyond the initial one?

  1. Pick "Projects" at the top nav.
  2. Search for your project.
  3. Drill into your project from the list of results.
  4. Click the baby blue "DEPLOY..." link to promote a release not yet promoted.

Tidal Enterprise Scheduler

It is something less Mickey Mouse than jobs in SQL Server. The "jobs" herein are called Tidal Zones. Redwood is a rival.

ERROR TypeError: jit_nodeValue_4(...) is not a function

This Angular error signifies a name collision between the function you are trying to call and a local reference. They can't have the same name bro.

I saw Brian Hackerson and Michaele Gardner speak on Agile self-care at Agile Twin Cities last night.

This was my first foray into this meetup.com group which meets at Improving's (yes, they are here too) Twin Cities office in Bloomington. There was an emphasis on a poll which suggested that 57.16% of individuals in the survey said "Yes" to "Are you currently suffering from job burnout?" which drives the desire to pen some self-care principles. The authors took the existing 12 Agile Principles and rewrote them with self-care in mind. The dozen new principles follow. One. Our highest priority is to be our best self and enable others to be their best selves. Two. Welcome change with curiosity, even late in development. Three. Deliver self-care frequently, by building daily habits. Four. The most effective way to be your better self is to be mindful and intentional. Five. Engage your trusted circle daily. Six. Build your life around a motivated self. Give yourself and others the environment and support they need and trust yourself and the process. Seven. Active self-care is the primary measure of progress. Eight. Self-care is sustainable when we prioritize 'being more' over 'doing more' so you can maintain an integrated balance. Nine. Continuous attention to scientific research enhances self-care agility. Ten. Simplicity-the art of maximizing the amount of work not done-is essential. Eleven. The best architectures, inspirations and insights emerge from self-organizing communities. Twelve. At regular intervals, reflect on how to become more effective, then tune and adjust behavior to be in alignment. ...what else was said that was interesting? Agile Karaoke conceptually has to do with being given a topic and a slide deck you've never seen (that someone else put together) and winging your way through a presentation. International Coach Federation or ICF is a nonprofit organization dedicated to coaching. Cy Wakeman suggests that you probably shouldn't vent your frustrations aloud at work. Brain Hackerson sited both a Dr. Michael Gervais who presses the importance of "being activated" and a Dr. Jeff Sutherland, one of the inventors of Scrum (Ken Schwaber is the other guy), who suggests that you should change work so that it isn't soul-sucking. Both of these suggestions are of course relevant to the burnout. Jeff has a book ("Scrum: The Art of Doing Twice the Work in Half the Time") which Brain vaguely referred to as "The Red Book" in his commentary. Michaele Gardner spoke to calming the Monkey Mind which is a generic term for thoughts aswirl too much and ambivalence, etc. She tries to just sing to music on her way into work instead of thinking about her day ahead.

Tuesday, April 9, 2019

To hide any tab in Microsoft Excel...

...just right-click on the tab and pick "Hide" while right-clicking on any one other tab while a tab is hidden will allow for "Unhide..." to be in the little menu that right-clicking brings us. Excel won't let you hide every tab. Why hide tabs at all? The hidden stuff can serve as a backing store for data if you are making a complicated application in Excel. I guess you may reach in there with calculations. There is a way to lock the hidden in a hidden state that I don't understand and I won't bother looking into, but as an Excel architect you may do this before you hand your Excel masterpiece on to others so that the others don't think too hard about what you've given them.

Is the contrast between #000000 and #FFFFFF too much?

A coworker suggested a few days back that it is kinda bad UX to have pure black copy on a pure white background as instead of the extreme contrast improving readability it is in fact so extreme that it hurts the eyes. I guess that makes sense. I don't yet know what good rules are for how much you dial down the contrast however. Obviously, if you dial down the contrast too much you are then causing a different problem. This made me think of Curt Hart telling me at Headspring that I really shouldn't justify text. The ragged right effect improves readability and you don't want to throw that away for aesthetic.

Monday, April 8, 2019

The primary key should probably be the first column in a database table by convention, not necessity.

You probably won't reorder columns as you add columns so putting the columns in alphabetically order is kinda like color coding the CAT5 cables you lay in laying cables. You will be able to tell that someone started out with bright-eyed ideology that didn't scale so well and that was hard to maintain.

Get rid of the stupid outline around the text in a link that appears when you tab to it.

This is more of this and this. The solution in CSS is:

outline: none;

Thycotic Secret Server

It's a password management tool.

Page 298 of "ASP.NET Core 2 and Angular 5" by Valerio De Sanctis suggests that the Shadow DOM, HTML Templates, custom elements, and HTML Imports are the four Web Components standards.

The first three are covered elsewhere on this blog. This suggests that "HTML Imports is intended to be the packaging mechanism for web components, but you can also use HTML Imports by itself." and offers as an example:

<link rel="import" href="myfile.html">

Saturday, April 6, 2019

I saw Jacqueline Quintanilla speak on CSS Grid at the Twin Cities .NET User Group on Wednesday night.

Serilog, a .NET means of logging which allows you to have a "sink" which writes event logs to perhaps Seq, a log server, was brought up before Ms. Quintanilla began to present, but otherwise this presentation had little to do with .NET in specific. It was really just a talk on modern CSS capabilities. To quote Jacqueline Quintanilla verbatim "The internet at its core is inherently flexible." and CSS Grid certainly makes the most of that. You don't have to explicitly have a twelve column wide grid system as is the case in rival approaches (think Bootstrap) and you may have elements explicitly overlapping other elements! In its simplest form you will have a div wrapping a set of other divs, or perhaps an article wrapping a set of sections, etc. The outermost actor's style starts out like so:

.wrapper {
   display: grid;
   grid-template-columns:

 
 

A series of n number of measurements will be the setting for grid-template-columns and 300px 2fr 1fr; for example would define a layout that has three columns for its three settings. The first of the columns, the leftmost, is a fixed three hundred pixels in width and the next two fractional units and the last/rightmost one fractional unit. Fractional units are newish, distributing space in what is leftover space. If you can imagine three hundred pixels less than one hundred percent then the middle column gets two third of that and the right column the remaining third. You may also have a grid-template-rows setting too, but you don't strictly have to. This will break the grid up into the predictable tables and cells you might expect, but there is another way to approach this without defining rows. You may break things up into other rectangular areas, but as of yet there is no support for an L-shape. In terms of, well, terminology, grid tracks are either rows or columns and grid lines are the invisible lines separating these. Grid cells are the individual cells that grid lines make when they cross over each other. gap: 20px; as a setting on the outermost actor is going to fatten the invisible lines to be twenty pixels across, spacing the grid elements away from them. You may give names to grid lines likes so:

.wrapper {
   display: grid;
   grid-template-columns: [start] 300px [main] 2fr [bob] 1fr [end];
   grid-template-rows: [nav] 150px [row2] 150px;
}

 
 

...and then turn around and use the names like this:

.one {
   grid-column: main/end;
   grid-row: row2;
}

 
 

I asked Jacqueline if this sort of positioning meant that divs nested in the div that gets .wrapper on it could in any particular order with perhaps the only way order might affect things being who overlays who in an overlaying effect and she affirmed my suspicion. Here is one of the before mentioned alternatives to explicitly defining rows:

.wrapper {
   display: grid;
   grid-template-columns: 200px 2fr 1fr;
   grid-template-areas:
      "nav nav nav"
      "aside main main"
      "aside info1 info2"
      "footer footer footer";
   gap: 20px;
}
.one {
   grid-area: nav;
   border: 1px solid #FF0000;
   color: #FF0000;
   padding: 10px;
}
.two {
   grid-area: main;
   border: 1px solid #00FF00;
   color: #00FF00;
   padding: 10px;
}
.three {
   grid-area: aside;
   border: 1px solid #0000FF;
   color: #0000FF;
   padding: 10px;
}
.four {
   grid-area: info1;
   border: 1px solid #FFFF00;
   color: #FFFF00;
   padding: 10px;
}
.five {
   grid-area: info2;
   border: 1px solid #00FFFF;
   color: #00FFFF;
   padding: 10px;
}
.six {
   grid-area: footer;
   border: 1px solid #FF00FF;
   color: #FF00FF;
   padding: 10px;
}

 
 

This ends up looking like this:

one/nav
two/main
three/aside
four/info1
five/info2
six/footer

 
 

If you don't want to make up your own funny names for grid lines you may just call them out numerically like so:

.grid-item {
   grid-column: 1/3;
   grid-rows: 2/3;
}

 
 

Negative numbers may be used too. The last item is -1 and the second to last -2 and so on. The number 0 means nothing in this context. We either starting counting rightwards or downwards from one or leftwards and upwards from negative one. Jacqueline namedropped the dense keyword, but I don't really understand how to use it. It is used with the grid-auto-flow property which could be set to row or could be set to column or could be set to row dense perhaps per my Googling. I think, as best as I can tell, this biases how things wrap if there are not columns specified. You may use minmax effects like so wherein the first setting is the minimum sizing and the second setting is the maximum amount of growth:

.wrapper {
   display: grid;
   grid-template-columns: 200px minmax(100px, 1fr) minmax(200px, 400px);
   grid-template-rows: 150px 150px;
}

 
 

justify-items is explained by this slide better than I could articulate it in words.

 
 

justify-content is similarly on exposition here. Both above and below stretch is the default.

 
 

More wackiness with justify-content below...

 
 

Firefox Grid Inspector was a recommended tool to use to troubleshoot (Firefox lives!) and Jen Simmons and Rachel Andrew are recommended blogging authors to follow in this space.

Friday, April 5, 2019

dumb boy voices

When girls do dumb boy voices, they generally do not do so at length, but instead it tends to be a snippet within a larger thing said. An example of the stereotypical usage might be: The other day I went to my boyfriend and said "Hey, can I get your help? I need your help right now." and he goes "Ugh, can it wait a minute?" and I'm like "Do you even hear me when I speak or do you just push back reactionarily?"

Some notes from some coaching on CSS and Sass today.

  1. Another difference between Sass and LESS beyond Sass having supposedly better mixins at a complexity level few ever visit is that LESS will lazy load imported files as it needs them while Sass will grab them all at once upfront. Before the LESS way sounds better to you, consider that it comes with more HTTP calls and could ultimately be "heavier" all around.
  2. Two things connected by a dot as suggested here basically means that both things are required for the effect.
  3. When styling say the table rows of a table in Sass you should likely have a nesting effect, but be wary of having a nesting effect too deep leading to Sass that is too indented to a point of unreadability. Nesting a style inside of a style in Sass will make CSS in which the nested style comes after the outer style suggesting that elements matching that criteria within the greater thing being styled should have that cascaded effect.
  4. Any subeffect (not the technical term) starting out with a colon like :first-child should be nested in Sass like so:
    .startingpoint button {
       padding: 0;
       margin: 0 0 10px 0;
       background-color: $genericbackground;
       border: none;
       font-size: 20px;
       cursor: pointer;
       outline: none;
       &:link {
          font-weight: normal;
          color: $black;
       }
       &:visited {
          font-weight: normal;
          color: $black;
       }
       &:hover {
          font-weight: bold;
          color: $green;
       }
       &:focus {
          font-weight: bold;
          color: $green;
       }
       &:active {
          font-weight: normal;
          color: $black;
       }
    }

Spongebob case

I NeEd hEaLtHcArE bEcAuSe I hAvE caNcEr aNd iM dYinG. is an example. If you look close this is not even alternating uppercase with lowercase, but instead its just a dumb mix of upper and lowercase beholden to no rules other than a desire to be noisy. Talk like this comes from the Mocking Spongebob memes.

Thursday, April 4, 2019

Record a video with Skype!

Click the "Share Content" icon that looks like an arrow pointing Northeasternly from the middle of a monitor and then pick "Share your Desktop..." from the menu that appears. At the icon of three dots in a horizontal row inside a circle there will be options for "Start Recording" and "Stop Recording" and "Manage Recordings" and the last of these should take you to a little list of your recordings. C:\Users\TJaeschk\Videos\Lync Recordings is the folder path to where mine in particular are kept. Yours will be a bit different. Duh.

In Azure DevOps, set the version number at package.json to be your build's version number.

Under "Builds" under "Pipelines" in Azure DevOps, click the "Edit" button at the upper right to see the steps in your build. Herein you may have a PowerShell script to set the version number. It could start like so:

$packageJsonPath = 'src/Trifecta/package.json'
function Format-Json([Parameter(Mandatory, ValueFromPipeline)][String] $json) {
   $indent = 0;
   ($json -Split '\n' |
      % {
         if ($_ -match '[\}\]]') {
            $indent--
         }
         $line = (' ' * $indent * 4) + $_.TrimStart().Replace(': ', ': ')
         if ($_ -match '[\{\[]') {
            $indent++
         }
         $line
   }) -Join "`n"
}
$package = ((Get-Content $packageJsonPath) -join "`n" | ConvertFrom-Json)

 
 

...and end like so:

$path = Resolve-Path $packageJsonPath
$content = ConvertTo-Json $package | Format-Json
$Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False
[System.IO.File]::WriteAllLines($path, $content, $Utf8NoBomEncoding)

 
 

...and have this in-between to set a property on package.json:

$package.version = $env:version

 
 

Note that the first blob of code above shows off how to make and call a function in PowerShell. Another thing I learned in this process is that to have a comment in PowerShell you lead a line with a pound sign/hash tag/number symbol. The code here is one of the few examples where I am shamelessly stealing from others. I am loathe to rename variable names and like in the name of a dress-up as I fear breaking something.

terminology from a set of presentations at work today

  1. There is a Linux-based security bundle of tools called the Security Onion.
  2. Zeek, originally named Bro, offers network analysis, while netsniff-ng specifically analyzes Linux networks for shortcomings.
  3. DNS Exfiltration is the art of making sinister DNS requests.
  4. Suricata is an intrusion detection system or IDS. It's logo has a meerkat standing up on its hindlegs to have a looksee. I think it is also an IPS (intrusion prevention system) offering controls and not just monitoring.
  5. The big four Vs or big data are volume (how much?), velocity (how do we stream stuff in?), variety (what are your sources?), and veracity (dealing with uncertainty and the complexity of sanity checks).
  6. Cloudera Data Science Workbench is a tool for data science.
  7. ODBC is Open Database Connectivity and is not JDBC or Java Database Connectivity.

Wednesday, April 3, 2019

use .includes in TypeScript

See if a match is in a collection!

private getBusinessUnitRecordsSuccess(records:Array){
   records.forEach(r => {
      if (this.user.BusinessUnitIds.includes(r.BusinessUnitID)){
         this.businessUnitRecords.push(r);
      }
   });
}

named ranges in Microsoft Excel

Draw a selection around a set of cells, right-click on it, and pick "Define Name..." from the menu that appears to make a named range. Alternatively, at the "Insert" ribbon pick "Table" with a selection selected and then type a name for the table at the upper left in the ribbon. The tables and the named ranges will hopefully provide a better way to grab ahold of Excel data when parsing Excel sheets in code. This will hopefully be more reliable and less brittle than grabbing cells by column and row number.

I keep seeing "Invalid Host/Origin Header" and "[WDS] Disconnected!" looping over and over in the Internet Explorer console when I run my Angular 7 application. What should I do?

Install this:

npm install webpack-dev-server --save-dev

Get rid of the funny border that appears around a button in Google Chrome upon a click with outline: none; in CSS.

That trick is the same as this trick.

Tuesday, April 2, 2019

more Apache Hadoop space, big data terminology

  1. Apache Parquet is a data storage format with columns.
  2. Apache Oozie (sounds like Uzi) is a job scheduler for Hadoop.
  3. Apache Sqoop (sounds like scoop) is a command line tool for moving data between relational, SQL database and Hadoop. The name comes from SQL-to-Hadoop.
  4. HDFS is the Hadoop Distributed File System sometimes just called Hadoop File System.

SPOF

single point of failure!

variables in CSS

There was a presentation on Angular Elements at my work today. It was alright. iFrames were suggested to be used some in clickjacking, etc. ...hence it would be best to include reusable stuff with Angular Elements instead of iFrames, etc. Anyhow, it was mentioned that while the CSS in Angular Elements is mostly sandboxed, a loophole in the sandboxing is CSS. These can be overpowered from the outside. So what are CSS variables? This has this example that would appear at the top of your stylesheet:

:root {
   --bgcolour: #ffffd0;
   --bqindents: 40px;
   --warningtextsize: 125%;
}

 
 

The example the link above has for using this stuff is:

table {
   background-color: var(--bgcolour);
}
blockquote {
   margin-left: var(--bqindents);
   margin-right: var(--bqindents);
}
p.warning {
   color: red;
   background-color: var(--bgcolour);
   font-size: var(--warningtextsize);
}

identity and access management a.k.a. IAM

SailPoint, the company, has an identity management system.

The FileTable of SQL Server is a way to store file blobs in a database.

That's very 1990s isn't it? You don't see that so much anymore do you? Mostly, people put files on a share somewhere and just keep a reference to the name of any one file in the database don't they? FileTable apparently has a way to make blobs in the database less painful. You may have at the "files" as if they were at a file share.

What are the counterparts to the (mouseenter) and (mouseleave) events in Angular 7 when it comes to tabbing there and back?

(focus) will work when tabbing in and (blur) and (focusout) when tabbing out, but both of those events will run in a loop as long as you sit on the control. (keydown.Tab) will run just once when leaving, but I do not know how to run an event just once upon entry.

Empty out the selection in a file type input in an Angular 7 application.

It's as easy as you think it is to zero this out. Assuming...

@ViewChild('uploadControl') uploadControl: ElementRef<HTMLInputElement>;

 
 

...then:

this.uploadControl.nativeElement.value = '';

I thought today of old models of how much more time (and thus money) it takes to deal with a bug the longer the bug is left undiscovered.

This came up at Paymetric. It's better for the developer to just catch a bug in his/her work than it is for the tester to find it in testing and have the developer fix it, and both of those scenarios are better than having the bug make it into production and have users find it. At Paymetric, I think once or twice they found a bug in some of the old cartridges (a cartridge was a process to integrate with one variety of payment gateway and each payment gateway supported had a cartridge) that were written a decade ago in C++ and had to deal with them. The scenario in which the magic black box stops working and someone has to reverse engineer that thing no one wants to think about has to be the worst scenario. Consider if you will this song by Databoy which takes the lyrics of both the Miley Cyrus song "We Can't Stop" and the Lana Del Rey song "Summertime Sadness" and jams them together into a new song called "We Can't Stop Summertime Sadness" ...if you heard this in 2126 would you be able to tell what parts made up the whole?

Monday, April 1, 2019

1024 is the maximum number of columns a table may have in SQL Server.

You may use a feature called "sparse column" to get this number up to 3000.

When setting the innerHTML property on a div to inject HTML into a component in an Angular 7 application, you will have to utilize the ::ng-deep trick to actually CSS style the injected HTML.

...assuming you want to perhaps nest the HTML for a table inside of a div like so:

this.yin.nativeElement.innerHTML = this.yang;

How do I get the Floating Selection to stop floating in GIMP?

At: Windows > Dockable Dialogs > Layers ...or by way of just pressing Ctrl-L, open the "Layers" dockable dialog. Therein right-click on the "Floating Selection" and pick "Anchor Layer" to flatten it down. Maybe you don't need to this, but it drives me crazy. In Googling against this stuff, I learned that the usual way to flatten layers is to right-click in any one layer and pick "Flatten Image" from the menu that appears. This trick will not work with the Floating Selection however and you have to take this other route.

Who remembers the old way to FTP through the URL line at Internet Explorer fifteen years ago?

This would open a file explorer window in Windows XP into the heart of the webserver wherever it was.

ftp://username:password@ipaddress/

 
 

While we are going back in time, here is how you have at a GET variable in PHP fifteen years ago:

WelcomeLabel.Text = Request.QueryString["FirstName"];

 
 

...a POST variable:

WelcomeLabel.Text = Request.Form["FirstName"];

 
 

...either way:

WelcomeLabel.Text = $_REQUEST["FirstName"];