Monday, September 30, 2019

"strictNullChecks": true

In tsconfig.json this setting allows for the TypeScript compiler in an Angular application to sanity check assignments to interfaces such that nonnullable fields must have goods. "ASP.NET Core 2 and Angular 5" by Valerio De Sanctis mentions this on page 343.

detectChanges without the tick

In a Jasmine/Karma test of a component at an Angular 7 application you may want to do this:

tick();
fixture.detectChanges();

 
 

This comes into play when you want the component to do something asynchronously which you will fake out with some mocking so there won't really be much of a time delay but nonetheless it is all still happening asynchronously. So when would you just do this alone?

fixture.detectChanges();

 
 

The time for that is when you are still triggering an act that effects the DOM, perhaps by setting a flag that will unhide something in an *ngIf or such, and you need to react to the updated DOM.

You cannot just copy a report in Power BI.

Changing a link to the database to make a dev version of a prod report just screws up the report apparently. Supposedly there is some wacky workaround for this, but the paradigm does not by default lend itself towards making dev, test, and prod versions of the same report from one report so that there is not the one-off wackiness of changes in a particular report or some cumbersome process of making the same change three times in three reports. There just seems to be an assumption in this space that you'd only do reporting off of production data. My team lead has suggested that it is really hard to do analytics with the sparse datasets in dev and test typically, so on some level this makes sense.

Beware of checking to see if an enum is truthy in TypeScript.

The zero is going to be a legitimate value right? It represents the first thing in the enum, enum being short for enumeration or enumerated type and the count upwards being zero-based.

porcelain in git

As best as I can tell this gives you less verbose messages from any git command that would return a message. This suggests that porcelain is of the toilet which is of plumbing which can colloquially mean the deep mechanics of something in attempting to explain the name. If...

git status

 
 

...gives us:

On branch 33157-clean-up
Changes not staged for commit:
   (use "git add <file>..." to update what will be committed)
   (use "git checkout -- <file>..." to discard changes in working directory)
   
      
modified:  Trifecta.Core.Test/Trifecta.Core.Test.csproj
      modified:  Trifecta.Core/Trifecta.Core.csproj
      modified:  Trifecta.Infrastructure/Trifecta.Infrastructure.csproj
      modified:  Trifecta.RestApi/Trifecta.RestApi.csproj

   
no changes added to commit (use "git add" and/or "git commit -a

 
 

...then this...

git status --porcelain

 
 

...gives:

 M src/Trifecta/Trifecta.Core.Test/Trifecta.Core.Test.csproj
 M src/Trifecta/Trifecta.Core/Trifecta.Core.csproj
 M src/Trifecta/Trifecta.Infrastructure/Trifecta.Infrastructure.csproj
 M src/Trifecta/Trifecta.RestApi/Trifecta.RestApi.csproj

 
 

...in contrast! Also if...

git status

 
 

...gives us:

On branch 33157-clean-up
nothing to commit, working tree clean

 
 

...then...

git status --porcelain

 
 

...gives us absolutely nothing in the name of keeping things to the point!

An IDoc file might be a faster, better way to get data into SAP than an EDI file.

IDoc stands for intermediate document and its file format is SAP-specific.

Cisco ISE

The ISE in PowerShell ISE stands for Integrated Scripting Environment but the ISE in Cisco ISE is Identity Services Engine. Both are pronouced "ice" in spite of the differences. You know, I haven't had a drink since 2006 so one thing that is missing from this blog is any sort of beer recommendations, but when I did drink Smirnoff Ice I enjoyed. I guess I digress. Cisco ISE is a product that doles out who may access what in the sphere of access to a LAN. I learned of this last night in looking at LinkedIn. Someone was mentioning how he was attempting to pass a Cisco security exam and had to be versed in ISE.

multithreading

By definition, this is the ability of a processor to break things up onto separate threads.

Sunday, September 29, 2019

If you own a Macintosh, can you upgrade it?

What if you just want more RAM? Is that doable? While I was at college with Joel Shakespear back in the 1990s he once asserted that one of his arguments against having a Mac instead of a PC is that you can't upgrade a Mac. Was he right? I don't know now and I didn't know then as I really don't use Apple's wares beyond my cellphone. I found this article from 2016 online which suggested there would be no more Macs that you may upgrade going forward, but I also found this article from this year which suggests instead: "It depends." It does NOT sound like there is great support upgradability in the game plans.

Saturday, September 28, 2019

Wednesday night's JavaScript MN talk had Andy Taton presenting on Svelte.

In near conflict with the description of Svelte I first heard here wherein it was described as a way to use web components agnostic of Angular or React or Vue, Andy showed us how to build an app like that of Angular or React or Vue with Svelte's canned markup and conventions. Why go there? Well again, we are keeping things light. When you loop in react and react-dom for a React app you are already up to a 160K footprint while the Svelte base footprint is 1.5K in contrast. Andy went through a little history of reactivity in JavaScript. We started out traversing the DOM with things like jQuery and we eventually moved to explicitly making stand-out-by-themselves touchable treats of the things we wanted to adjust such as is with the ElementRef/ViewChild trick in modern Angular. Svelte is built from text files and the three deliverables are plain old JavaScript (stuff inside of a script tag at the top of a .svelte file which is really just a text file), CSS (stuff inside of a styles tag below the script tag), and HTML (bottom of the .svelte file below the styles tag's closeout). Modeled on JSX, Svelte has HTMLx for its markup which uses single curly braces around variables. There is a REPL (read-eval-print loop) live coding sandbox play place for experimenting (perhaps here) and Andy live coded for the majority of the talk. Rick Harris is a big name in Svelte. He has some YouTube trainings you can find and Svelte itself is not fronted by a particular company the way Facebook pushes React or Google owns Angular. Hey, Microsoft Word isn't complaining of a misspelling as I type the word svelte. I guess it is a real word. The dictionary.com definition is: slender, especially gracefully slender in figure; lithe ...anyways, there is not yet any TypeScript support in this space, and there is also no sophisticated routing logic for multipage routing. There is an understanding that things should just be kept simple and we will serve up a page not a SPA. Stuff in a src folder compiles into a public folder, etc., Svelte uses Sapper for SSR (server side rendering), and the four command line commands used to get the app up (note a Pokémon theme) and running were:

  1. npx degit sveltejs/template jsmn-pokemon
  2. cd my-svelte-project
  3. npm install
  4. npm run dev
  5.  
     

There is a main.js file at the front of the app where you are going to lead into your first .svelte file like so:

import App from './App.svelte';

 
 

If you had an H1 tag like so...

<h1>{name}</h1>

 
 

You could both hydrate and change out the name with something like so:

<script>
   let name = "JSMN";
   function changeTitle() {
      name = "Pokémon";
   }
</script>

 
 

The button for making the switch could start out like this:

<button on:click={changeTitle}>

 
 

Use on:input instead of on:click inside of an input tag to react to typing. You will catch an event at a function with this approach to things and that could look like so:

function chooseFavorite(event) {
   favorite=event.target.value;
}

 
 

The markup for if/else logic looks like this:

  1. {#if favorite}
  2. {:else if bored}
  3. {:else}
  4. {#/if}

 
 

on:submit|preventDefault={submit} is yet more crazy I wrote down in my notes (probably shows using a filter not unlike the Angular convention for pipes, eh?) and furthermore <Entry defaultPokemon="Totodile" /> in the markup would be an example of calling out to a component within a component. You will have export let defaultPokemon; inside of the component's JavaScript itself to manage the variable and herein the export keyword is not what you are used to. Svelte is doing its own wacky thing with the export keyword in this context. If you want to share data across two parallel at-the-same-level-in-the-hierarchical-tree components you probably want to use the store the Svelte has. As an example, Andy made pokemon-store.js and put this inside of it:

import {writable} from 'svelte/stores';
const searchForPokemon = writable("");
export default searchForPokemon;

 
 

Alright, that has the export keyword back to doing something sane! The way to put something into the store is with searchForPokemon.set(favorite); and you may fish stuff back out of the store like this:

import searchForPokemon from "../pokemon-store.js";
let pokemonToSearchFor;
searchForPokemon.subscribe(value => {
   pokemonToSearchFor = value;
});

 
 

Brandon Johnson and Brian Mitchell moderated this event while the other half of their team, Anna Baker and Tamara Temple, were away, and before the Andy Taton talk there was a lightning talk by a Daniel Kretsch on AWS Amplify which lets you roll a canned let's-get-started app of Angular, Ionic, React, React Native, or Vue in such a way that external dependencies are fed by trappings of Amazon Web Services a.k.a. AWS. Amazon DynamoDB, a NoSQL database, is the default database. (And, by the way it is very painful to swap out the defaults or get this stuff off of Amazon's platform.) AWS AppSync API, and API architecture is used for... API architecture and there is GraphQL in the mix too. Amazon Cognito governs how users are kept and authentication challenges. Amazon S3, wherein the three Ss stand for Simple Storage Service, hosted at Amazon CloudFront spits up static content. Repositories tied in could be of GitHub, Bitbucket, GitLab, or AWS CodeCommit which is another rival to the other three. Authentication, ChatBot, PhotoPicker, and Album are canned components for Amplify which do what their names suggest.

Friday, September 27, 2019

Twenty-five dollars is the threshold wherein you have to provide a signature for a credit card payment in America and below that you do not have to do so.

I learned this factoid tonight. In Googling against it I found that this has been a trend since 2010 and that most payment gateways will be on board with this loosing of the emphasis on a signature which is a really old way of gauging who someone is. This isn't universally true so there may be convenience stores that always require you to sign I suppose and I think the cut over can also be a fifty dollars instead of twenty-five. When you order a meal for yourself at a restaurant and get less than twenty-five dollars of stuff and they bring you something to sign anyways, in those cases they are probably doing so in the hopes that you'll tip and not because they have to. I did have a waitress once chase me down because I forgot to sign the slip, but in that case it could have all been about validation for the tip. I dunno.

CSS transitions play nicely with promises returning in Angular applications.

The transition will kick in once you call this method signaling a change in H1 tag text and drawing the user's eye.

findNameOfLatestFile(templateVersionMode:TemplateVersionModel) {
   this.titleTag.nativeElement.innerHTML = templateVersionMode.FileName;
   this.titleTag.nativeElement.classList.add("transition");
}

 
 

Going forward, whenever you call whatever might return the promise a second time, you should have just upstream of that act:

if (this.titleTag.nativeElement.classList.length == 1) {
   this.titleTag.nativeElement.classList.remove("transition");
}

Why can't I seem to stub a contract in a Jasmine/Karma unit test in my Angular application?

I keep getting errors like:

TypeError: this.myContract.GetHotDogs is not a function

 
 

What is going wrong? Help me! Alright, in the providers for the test make sure you are using useClass instead of useValue as that makes a world of difference.

terminal server

Per Wikipedia: "A terminal server enables organizations to connect devices with an RS-232, RS-422 or RS-485 serial interface to a local area network." RS-232, RS-422 and RS-485 are various multi-pin connections for physical cables as best as I can tell and the RS part stands for recommended standard.

filtered indexes

This is a thing at SQL Server. If you are rocking the isDeleted column, why index the 75% of the rows that are deleted when you are never going to use the index to query against them? This sort of exclusion from a filter is doable.

gwmi win32_bios | fl SerialNumber

As a PowerShell command this gives you the serial number of your laptop!

Windows-L

...locks your laptop.

Thursday, September 26, 2019

Software Composition Analysis

This is an audit of your open source software to:

  1. make sure you are not looping in open source software you don't use
  2. make sure you do not need to update a version of a particular piece of open source software to ensure that there is not a security vulnerability

Version 77+ of Google Chrome does not play nicely with Telerik HTML5 Report Viewer's printing capabilities.

This is a control to show a report/graph on the web and... now they are all sick.

Iron PDF is a C# PDF library.

Cast HTML to PDFs and concatenate some PDFs into one big PDF, etc.

Cargo Cult

My team lead explained this term to me today. Supposedly as white people conquered various remote locales (Hey, it's what we do and it is what God and the crown want, right?) we would set up shop amid people who had not seen outsiders, bring in goods on cargo aircraft, do our thing, and eventually leave. When the outside world eventually reached back to the isolated world again it found that the isolated were building effigies of planes out of bamboo and what not as that was associated with prosperity and good times without the context to know of how poorly a fake plane serves the role of mirroring a real plane bringing in cargo to the island or wherever it was. I once saw David Cassidy on TV venting of how he wished he could talk the writers of Partridge Family into doing something different while he was on the show and the pushback was always "You don't change a winning play." which explains the cargo cult mindset in software too. It is a pit of attempting to do what others deem wise and not Kaizen, in contrast, for example. There is a certain individual who would drop this term all the time in Twitter attacks on a certain company and I won't mention either entity by name but now I know what he meant. His attacks seem unfair. That company was constantly trying new things.

The clipboard no longer lives forever in iOS.

As of making this change I noticed that I cannot just paste what I used to paste after my phone logs me out for inactivity and I punch my way back in with my keycode.

Wednesday, September 25, 2019

Check to see if something is a reference in JavaScript.

Stack Overflow has this example of checking to see if two variables have the same reference:

var thesame = obj1===obj2;

I remember Bryan Harclerode piping up about this a couple times when I was at the @hand corporation. I didn't know what he was talking about at the time. I just stared at him with a blank look on my face. I guess he just meant comparing pointers. I thought of this today. The conversations from five years back the context was dot, dot, dotting out to things.

 
 

Addendum 9/26/2019: The last sentance should really read: "In the conversations from five years back the context was dot, dot, dotting out to things."

I learned today that you cannot change the 17 columns in a FileTables table at SQL Server.

If you want to version the files, you have to make your own table for that and join to the FileTable using stream_id as the primary key in the FileTable. The 17 columns are:

  1. stream_id (uniqueidentifier, not null)
  2. file_stream (varbinary(max), null)
  3. name (nvarchar(255), not null)
  4. path_locator (PK, hierarchyid, not null)
  5. parent_path_locator (FK, Computed, hierarchyid, null)
  6. file_type (Computed, nvarchar(255), null)
  7. cached_file_size (datetimeoffset(7), not null)
  8. creation_time (datetimeoffset(7), not null)
  9. last_write_time (datetimeoffset(7), null)
  10. last_access_time (bit, not null)
  11. is_directory (bit, not null)
  12. is_offline (bit, not null)
  13. is_hidden (bit, not null)
  14. is_readonly (bit, not null)
  15. is_archive (bit, not null)
  16. is_system (bit, not null)
  17. is_temporary (bit, not null)

Why is the "Set auto-complete button" suddenly disabled in Azure DevOps.

Just try refreshing your browser to kick it awake. You are using the old URL for Azure DevOps. They switched out to a new one a couple of months ago and if you are still on the old one a lot of the auto-refresh stuff within the UI will be janky.

CONCAT_WS and STRING_AGG are new ways to CONCAT with SQL Server 2017!

The _WS stands for "with separator" and something like this...

DECLARE @counter INT
SET @counter = 0
WHILE @counter <= 5
BEGIN
   PRINT CONCAT_WS(@counter, 'x', 'y', 'z')
   SET @counter = @counter + 1
END

 
 

...gives us something like this:

x0y0z
x1y1z
x2y2z
x3y3z
x4y4z
x5y5z

 
 

Do you see how the separator was put into the strings? A bit more elaborately the _AGG does "aggregation" from a query. Observe:

DECLARE @container TABLE
(
   contents nvarchar(15) not null
)
DECLARE @counter INT
SET @counter = 0
WHILE @counter <= 5
BEGIN
   INSERT INTO @container(contents) VALUES (CONCAT_WS(@counter, 'x', 'y', 'z'))
   SET @counter = @counter + 1
END
DECLARE @conversion nvarchar(1) = CAST(@counter AS varchar(1))
SELECT STRING_AGG(contents, @conversion) FROM @container

 
 

We get:

x0y0z6x1y1z6x2y2z6x3y3z6x4y4z6x5y5z

Tuesday, September 24, 2019

Scrumban

Alright, this is a real thing. It is a halfway between Scrum and Kanban. When you are doing Scrum for all the wrong reasons (as described here) just because Scrum was first you may transition to Lean with this. Scrumban is a real word... now/anymore.

Monday, September 23, 2019

min and max numeric ranges of reactive forms validators

Following up on Validators.required and Validators.pattern(/^whatever$/) of bullet 14 here, you could also have Validators.min(-5) and Validators.max(-5) per page 341 of "ASP.NET Core 2 and Angular 5" by Valerio De Sanctis.

With iOS 13 you will be able to pair your iPhone with your Xbox or Playstation.

You may have some wacky gaming experience across the two!

When you make a tiny change or even any change to a Power BI report and republish it, it is going to get a different URL.

This makes the keeping of paths to Power BI reports embedded in your Angular application or nested in iFrames hard to maintain. Maybe these have to be in Octopus variables and then shoved to the environment.ts variable set from the continuous integration acrobatics. Of course, the problem with this is: What if there are a dozen reports? ...multiplied times three or four environments???

 
 

Addendum 9/24/2019: Our pointman for Power BI says that there is a workaround for retaining URLs, it just isn't the default behavior.

508 compliance

In HTML this loops in labels, the ARIA stuff, alt text, etc. Section 508 is an amendment to the United States Workforce Rehabilitation Act of 1973. This is a trapping of American law.

Sunday, September 22, 2019

Adobe GoLive

This was Adobe's rival to Macromedia's Dreamweaver and then Adobe just bought Macromedia and Dreamweaver lived and GoLive... well, it died, somewhat inconsistent with its name I guess.

Saturday, September 21, 2019

finally!

Following up on this, this suggests that the new stuff of ES2018 is, yes, a spread operator, asynchronous iteration (which is what it sounds like), and, among other things a .finally to go with the .then and the .catch of a promise. This suggests in ES2019 we get Array.flat() for flattening a multidimensional array to a single dimension and both String.trimStart() and String.trimEnd() too which do what you think.

I saw Kaelan Mikla play at Part Wolf during the first hour of this morning.

Kaelan Mikla should perhaps be referred to as Kælan Mikla with the a and the e jammed together as that is how all of their press materials portray them. For that matter, perhaps I should think of myself as Tom Jæschke instead of Tom Jaeschke or would that be Tom Jäschke with an umlaut over the a maybe? I dunno. The æ character named æsc or ash tends not to be... Oh, enough! I should probably talk about their music, huh? They were basically good. This is saying a great deal in coming from me in considering that I don't see a great many examples of girl acts which are good at punk and yes this was punk music... to some extent. Laufey Soffía (left) who is lead vocals kind of screamsings. Does that work at length? Can you get away with screaming when you are always screaming? Well, it is hit and miss. There were some songs where she killed it and you cannot imagine her swapped out with someone else. This is a trio of three women and the other two girls sing backup somewhat and less distinctly. I learned about this encountering an advertisement on Facebook and it turned out to be all of ten dollars to go so why wouldn't I go? It was worth ten dollars for sure. The initial intrigue came in having it suggested (in that ad) that this band was both punk and a Depeche Mode style synth band with the synthesizer going and all that. The bassist, Margrét Rósa Dóru-Harrýsdóttir (right), introduced the second song from the set as seen below with "How about a little more bass and a little more computer?" and we got just that! I liked this better than the opening in which Laufey burned some incense and danced in a trance during a slow warm up as if to say: hey, we're are a bunch of witches... things are spooky, or something. The band is from Iceland and all of the lyrics were in Icelandic and the three seemed more than happy to play up an outsider-looking-in stereotype about Iceland. That's what not Iceland wants from Iceland. I can't help but wonder if fans chat them up about Iceland all the time while they are really sick of it and happy to escape their podunk birthplace. Sticking with ambience and kitsch, the visuals projected on the back screen showed cold countryside, etc. The film footage was consistently in black and white because brrr we are freezing or something. Ha! Sometimes just the top half of the face of Sólveig Matthildur Kristjánsdóttir (center) across the eyes was lit up by the projection in a band of bright white light. This wasn't accidental. I found this trick the best of the visuals and it helped Sólveig stand out while in the back a bit. Sólveig at the synthesizer was the real talent amongst the three. The synth outweighed the punk. It is synth with some screaming. The synth half is where the sophistication lies. Observe:

Friday, September 20, 2019

ViewSonic

It's the monitors with the parrots on them.

It's possible to get a PE license to become a licensed professional engineer. The PE stands for professional engineer.

It looks like there are state-to-state requirements and state-to-state governing boards the United States. There is a National Society of Professional Engineers. You have to have four years of college. I saw Jimmy Bogard tweet of this a moment ago. What was the license architects got? AIA? The American Institute of Architects?

virtual pet

This is very 1990s and you don't hear about it anymore. These were really simple bits of artificial intelligence that you could mess with and they would react to you.

Thursday, September 19, 2019

Shift-Alt-Click-Drag in Visual Studio 2019.

It allows you to make a vertical selection across numerous lines of code as you may with Alt-Click-Drag in this trick in Visual Studio or moreover with Ctrl-Alt-Click-Drag in SSMS as suggested here. When you type it will replace the highlighted area on all lines with the new stuff.

Wednesday, September 18, 2019

Unit test a Task in C# while using a Func instead of a second method somewhere.

This is probably cleaner than this:

CoOrds coOrds = new CoOrds() { x = 13, y = 42, z = 69 };
IEnumerable<CoOrds> bagOfCoOrds = new CoOrds[] {coOrds};
Func<IEnumerable<CoOrds>> func = () => bagOfCoOrds;
Task<IEnumerable<CoOrds>> task = new Task<IEnumerable<CoOrds>>(func);
Mock<ICoOrdsRepository> coOrdsRepository = new Mock<ICoOrdsRepository>();
coOrdsRepository.Setup(b => b.GetCoOrds(It.IsAny<List<int>>())).Returns(task);

 
 

No wait! Don't do this! In XUnit testing the task never returns. It just hangs up forever. Instead use .FromResult like so:

CoOrds coOrds = new CoOrds() { x = 13, y = 42, z = 69 };
IEnumerable<CoOrds> bagOfCoOrds = new CoOrds[] {coOrds};
Task<IEnumerable<CoOrds>> task = Task.FromResult(bagOfCoOrds);
Mock<ICoOrdsRepository> coOrdsRepository = new Mock<ICoOrdsRepository>();
coOrdsRepository.Setup(b => b.GetCoOrds(It.IsAny<List<int>>())).Returns(task);

How do I stop a hung up XUnit test in Visual Studio 2019.

Open the "Test Explorer" at Test > Windows > Test Explorer and then click "Cancel" at the upper left of the pane that appears.

looks like 7.3 is the latest version of C# for the 4.7.2 Framework

Wikipedia has this cheatsheet that I stumbled onto today:

It touches on the confusing history of the split between .NET Framework 3.0 and .NET Framework 3.5 (the later introduced LINQ and Lambda stuff) even though there was no C# 3.5 and C# 3.0 straddles them both. The LINQ and Lambda stuff used compiler tricks to compile to the same CLI code the 3.0 framework did. I guess the LINQ and Lambda stuff just got looped in via some new libraries. I have heard the big difference between 1.0 and 1.1 was the using statements.

Take out the fakeAsync from a Jasmine/Karma test when applicable.

it('title setting behaves as expected', fakeAsync(()=> {
   let notice:Notice = new Notice("Success!");
   notice.message = "The grumpy cat has died.";
   expect(notice.title).toBe("Success!");
   expect(notice.message).toBe("The grumpy cat has died.");
}));

 
 

...could just become...

it('title setting behaves as expected', ()=> {
   let notice:Notice = new Notice("Success!");
   notice.message = "The grumpy cat has died.";
   expect(notice.title).toBe("Success!");
   expect(notice.message).toBe("The grumpy cat has died.");
});

NullInjectorError: No provider for Store!

Alright, how do I mock the store in an Jasmine/Karma test of an Angular controller so that I do not see this error? Stealing one-for-one from here, you will want to put this just inside the describe:

let storeMock;

 
 

You will want to put this just inside the foreach:

storeMock = {
   dispatch: jasmine.createSpy("dispatch"),
   pipe: jasmine.createSpy("pipe").and.returnValue(from([{
      requestTimeout: 5000,
   }]))
};

 
 

I ended up adding select: function(input:any):Observable<User> { to storeMock for my own uses/needs to accommodate a selector predictably. You'll need a provider the likes of { provide: Store, useValue: storeMock } in the providers third and finally to get all of this to work. The imports up top must include:

import { from } from 'rxjs';
import { Store } from '@ngrx/store';

the generic test the Angular-CLI makes for a component

import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
import { BunkComponent } from './bunk.component';
 
describe('BunkComponent', () => {
   let component: BunkComponent;
   let fixture: ComponentFixture<BunkComponent>;
   
   beforeEach(async(() => {
      TestBed.configureTestingModule({
         declarations: [ BunkComponent ]
      })
      .compileComponents();
   }));
   
   beforeEach(() => {
      fixture = TestBed.createComponent(BunkComponent);
      component = fixture.componentInstance;
      fixture.detectChanges();
   });
   
   it('should create', () => {
      expect(component).toBeTruthy();
   });
});

SQL Server evaluation period has expired.

Alright, this was behind SQL Server not running and understandably so. It took some doing to unearth what the error was. In Windows 10, I typed "services" at the start menu and in the services tried to manually start the SQL Server Agent (which really should have been running on startup) only to be told...

Error 1068: The dependency service or group failed to start.

 
 

...and...

Windows could not start the SQL Server Agent (MSSQLSERVER) service on Local Computer.

 
 

If you right-click on any one of the services and pick "Properties" and then navigate to the "Dependencies" tab of the dialog box which "Properties" unearths. You will be told what other services that service depends on. It turns out that SQL Server Agent depends on SQL Server. When I tried to manually start that I got:

Windows could not start the SQL Server (MSSQLSERVER) on Local Computer. For more information, review the System Event Log. If this is a non-Microsoft service, contact the service vendor, and refer to service-specific error code 17051.

 
 

Alright, this suggested that I look for errors in the Event Viewer so I typed "event viewer" at the Windows 10 start bar. This brought up the Event Viewer. It opens with "Overview and Summary" showing and where it says Error, Warning, Information, and Audit Success in the "Summary of Administrative Events" pane I right-clicked on "Error" and the picked "View All Instances of This Event" to see the errors. I eventually found the error herein. I should have installed SQL Server Express from here to begin with instead I guess.

race conditions breaking the build by way of Jasmine/Karma unit tests?

It's a thing. Everything can pass locally and then the Octopus build can break seemingly inexplicably. When this happens there is some asynchronous horror wreaking havoc in a unit test. Beautiful. In my case when I defined a useValue for a mock right there inside of my test all was well, but when I tried to pull in a stub object for an IoC contract in an Angular application the stub could not be found when testing inside ngOnInit against a component, or perhaps it was being found but Jasmine acted like the method I was calling was not a function.

Tuesday, September 17, 2019

You do NOT have to unsubscribe from QueryList changes subscriptions in an Angular 7 application.

Here I suggest there are only two use cases for subscribe where you do not have to unsubscribe (routing params and the async pipe). I was wrong.

Monday, September 16, 2019

More than one module matches. Use skip-import option to skip importing the component into the closest module.

This error rears its head when you are using the Angular-CLI, and, yes, there is more than one module where a component could be wired up while you are trying to new up a component via the command line command. Why don't you spec what you want like so:

ng generate component bunk --module=../app.module.ts

a friend's interview question

A friend was texting me yesterday about an interview she had in which she was asked how she would get an Angular 7 component working in an Angular 2 application. Unless I am missing something, I imagine there is no guarantee that one wouldn't have to do some rewriting to get out actor afloat. Things like the email keyword to validate email addresses and the else case for an *ngIf (both showed up with Angular 4) cannot work in Angular 2 and that's just scratching the surface to say nothing of Angular Materials (showed up with Angular 6). I supposed you could put the component where you wanted it, run the application, and then try to deal with the red being barfed up to the console by way of progressive little stitches of rewriting.

Sunday, September 15, 2019

Toshiba Satellite

It's a laptop... from Toshiba! I heard about it for the first time yesterday.

Friday, September 13, 2019

How do I get around the inability to monkey with a local reference hidden by *ngIf in and Angular 7 application?

Assuming the ElementRef's nativeElement is conditionally hidden upfront when the view for the template is initialized, the only way to get at it is with a subscription via ViewChildren instead of ViewChild. Otherwise it just reads as undefined after all. To approach things the right way you'll need these imports in your Angular component:

import { ElementRef, ViewChildren, QueryList } from '@angular/core';
import { Subscription } from 'rxjs';

 
 

For this example, shall we pretend #powerBI decorates an iframe html tag in the template making what is known as a local reference? We will need two variables in our component class, but outside of any of its methods, like so:

@ViewChildren('powerBI') powBI: QueryList<ElementRef<HTMLElement>>;
public viewChildrenSubscription: Subscription;

 
 

Here is the magic you have been waiting for:

public showIFrame():void {
   this.isToShowIFrame = true;
   if (this.viewChildrenSubscription) this.viewChildrenSubscription.unsubscribe();
   this.viewChildrenSubscription = this.powBI.changes.subscribe(bi => { bi.forEach(i => {
         i.nativeElement.setAttribute("src", "http://www.tomjaeschke.com");
      });
   });
}

subscription spool safeguard to avoid memory mismanagement and exponentially ballooning trips to the API

Following up on this, if a spooled piece of data needs another piece of data which will also put something on the spool, you don't want to put the second item on the spool over and over again, right? You would end up with something akin to an n+1 problem only in the API space. If the act to putting to the spool sits inside of another subscription, naturally there is that danger. You probably want a safeguard like so:

if (this.subscriptions.length == 1) {

 
 

If things get really crazy (complex) I guess checking a number won't be enough. You will have to have boolean flags for if subscriptions are yet set.

Report Sections in Power BI reports

These are the individual tabs within a report in the cloud approach. They do not seem to have a counterpart in the on prem solution. At a URL they manifest like so:

https://app.powerbi.com/groups/888592d5-7c0e-4cc5-82a1-a14fe4a33d00/reports/9822b28a-1b00-4eae-be6a-e8f9fd3746e7/ReportSectionea606d0e97f674a56af56

 
 

Pass in &pageName=ReportSectionea606d0e97f674a56af56 as a parameter to the other shape of URLs for iFrame support with the ctid and what not.

I upgraded my iPhone X to iOS 12.4.1 last night.

I noticed that when I close an app and I swipe up from the bottom of the screen to see what is open, the apps that are opened have to be closed by swiping them up instead of tapping an X within a circle at the upper left corner of an app which was the convention before. Supposedly the Animoji animal faces that talk with your voice and follow a recording of your face have been expanded into the Memoji thing wherein you may customize your own human-looking face to look like you.

Google Earth

It is the satellite imaging stuff that ties into Google Maps.

Thursday, September 12, 2019

You may want to use boolean instead of Boolean in TypeScript.

This suggests that Number, String, Boolean, Symbol, and Object are boxed types in TypeScript. I got in the bad habit of using Boolean instead of boolean, so I guess I am now straightened out. I guess there is a pointer to a Boolean as opposed to it just being a bit on the stack. Kinda lame.

Lean like Scrum

Let's say you are doing Lean and pulling in work to do, that you'd work on anyways no matter what, and you have a Jira ticket, or pick-your-poison, for tracking. Well, what if you estimated points on top of this anyways and just pretended that you were doing Scrum instead of Lean even though there is no burndown chart? I see this all the time.

Wednesday, September 11, 2019

mapping sprocs into Entity Framework types antipattern

The big problem with this is that if two stored procedures feed the Foo type in C# and a developer changes one of the stored procedures to loop in a few more columns from the tables it queries and then adds those extra items as getsetters on Foo, the calls to the other, second stored procedure will break when the extra getsetters cannot be hydrated. In the app we are working on the team lead is a DBA and he argued in favor of a strict stored procedure approach not using Entity Framework whatsoever. In time another big personality argued for Entity Framework and we worked out a compromise that was somewhere horribly in-between. The pain point I mention rears its head all of the time. What is the fix? Make a new POCO for each sproc?

Human factors are ergonomics concerns.

In the West we use the Z pattern in reading, left-to-right then progressively downward, but that is not how people read in China. These considerations go into good UX in the digitized realm.

mat-card-subtitle, mat-card-content, and mat-card-actions should be used semantically as child tags within a mat-card tag.

This is more to do with the cards layout of Angular Material. You can tell what these three subcontainers wrap without me telling you, right?

Tuesday, September 10, 2019

polyadic method signatures and the Gimmal interview

Shawn Cosby who did my 2018 Gimmal interview asked a lot of elementary basic questions that I am not used to getting asked like "What does a compiler do?" and "What are objects?" Well, rather than having your language be interpreted at runtime and blow up in exception when something is wrong at runtime, some mistakes may be caught upstream by having the runtime language be a language you compile to from another language wherein you write your actual code. If the compiler cannot make a translation from A to B then an error will be thrown at compilation time. There is evidence to suggest that the father upstream you catch an error the less expensive it is in terms of time and heartache to deal with it. (compile time is better than runtime, runtime is better than manual developer passthrough, manual developer passthrough is better than the testing team catching it, the testing team catching it is better than dealing with it in production) Objects are logical collections of primitive types (string, DateTime, Boolean, int, char) or pointers to them into a new type with property names for the various properties (primitives). One of the reasons to have objects in the name of maintainability is to hand objects in at method signatures in lieu of a bunch of individual primitive types. This keeps you from having to constantly change method signatures everywhere use would otherwise use an object that will eventually be updated. Uncle Bob's Clean Code suggests that in the name of utilizing this concept that you should not have polyadic method signatures with four things coming into a signature ideally. That should smell like not using objects. In the Gimmal interview seven was suggested to be a better cap than three and I cannot recall the source for that which was sited. A tuple in C# only grows up to seven items come to think of it. Anyways, I am not in love with these method size restrictions. I think objects are healthy, but not superobjects composed of many objects. Do not break with the Single Responsibility Principle. I once made an application wherein I put all of the interfaces for external dependencies in an external dependencies God object and handed it around to everything and it was a mistake. It reduced the readability of code (we read code more than we write code, remember) and it made it harder to make method signatures distinct in an overloading pattern.

getting started with the Angular Material cards

A few things surprised me upfront. At your module for your component you will need to loop in MatCardModule as an import from '@angular/material' to have the cards as described here and here. Also, the *ngFor for looping through a collection need not be on the card's <mat-card> tag which wraps the guts of the card while ultimately closing out with </mat-card> but instead it may be on a div wrapping the <mat-card> tag without screwing up the flexbox style layout of the cards floating side by side. Don't ask me how.

 
 

Addendum 9/11/2019: I was wrong about the flex magic. It turns out that I had a div wrapping the element where I had *ngFor with display:flex; and flex-flow:wrap; on it. You have to have something like this. It won't just work by itself. While I am talking, you may just directly style mat-card in CSS as you might div, section, or article.

Monday, September 9, 2019

random Microsoft stuff

Preview versions of Windows are run with the Windows Insider service. DistributedCOM is a distributed version of COM (Component Object Model) like it sounds. It calls independent COM apps. At the MSSQL space the Microsoft Distributed Transaction Coordinator allows for transactions across multiple databases. Avoid it. Don't do transactions across two databases.

AppDynamics can let you time how long database calls take.

It will also let you send someone an email if a call to a service is taking too long.

Ctrl-Shift-E should open the Explorer in Visual Studio Code 1.37.1.

If you pick View > Explorer from the top nav that will work too and there is an icon at the upper left of a sheet of paper with the upper right corner bent back overlaying another sheet of paper that also facilitates this as well. The icon is a toggle that will take the Explorer back away again while the hotkey and the menu item just seem to only open the Explorer should it be closed.

Adobe Sign

This is Adobe's e-signature (e for electronic) apparatus.

Microsoft Authenticator app

It's another app for your phone. You use it to scan a QR code so that you may access Azure DevOps (now with new security!). There are pins that last for a few seconds associated with a scan of a QR code and that reminded me of this.

Sunday, September 8, 2019

What became of internet radio?

I guess it is still a thing. When I was at Headspring, Blake Caraway once told me that he had his own internet radio station, Mullet Radio, but that he had to abandon it due to some change in U.S. law and its regulations. I can't recall what the story was.

UwU is a cute smiling anime face.

You convey cute happiness with it. OuO and O_O and similar little faces. Do you see it?

Saturday, September 7, 2019

When testing a service that does not implement a contract in an Angular app you still replace and fake the service.

In the providers for the test have something like so:

{provide: MyService, useClass: MyFakeService}

 
 

MyFakeService in this example can just be an any type object. At the constructor of the component wired up by TestBed the external dependency of the service will be wired up with MyFakeService in spite of any specific type for the service denoted right there at the constructor inline and when methods are called on the service by the test they had better have dance partners at MyFakeService. However, MyFakeService does not need to implement MyService for this trick to work or anything like that. For further reading:

On Wednesday night I attended "The Greensboro Sci-Fi/Fantasy Group" meetup moderated by a Jason Bowles.

Jason Bowles is pictured here, and the event itself was at the cafe inside of a Barnes & Noble Booksellers in Greensboro, North Carolina. This was a freeform discussion about many things and it did get into tech a little bit with a discourse on telephones. Two of the attendees got smartphones for the first time in 2010 and they spoke to the pain of their first smartphones. A girl got a BlackBerry Curve which was the first BlackBerry with a touchscreen and hated it while a guy got a Samsung Intercept which had a little keyboard that slid out and he hated it too. He stuck with Samsung long enough to have a Samsung Epic next and eventually ended up with the Samsung Galaxy S4 Android device (S for Super Smart and 4 for the version). I had not heard of any of these devices save for the Galaxy of course. The same guy suggested that there was a time in the 1980s wherein you could not buy a phone and instead you were just renting a phone from Ma Bell, the Bell Telephone Company. I don't recall this myself, but then, again, I was a child and not someone buying telephones. A different guy said that he knew of a farmhouse in the area that had an old hand crank phone with which one could only call out to an operator and then tell the operator where one wanted to really route a call to. Some books were discussed. Jason is going through the "The Song of the Shattered Sands" series by Bradley Beaulieu, mentioning "The Twelve Kings in Sharakhai" specifically. He said that it was fantasy set in Ancient Persia but as best as I can tell in reading about it online Ancient Persia would just be the inspiration for a fantasy setting in the series. The Samsung phone guy was buying a copy of "Hope Never Dies" by Andrew Shaffer in which Joe Biden and Obama are wrapped up in some sort of murder mystery. The Samsung phone guy was from Joe Biden's Delaware and asserted that Andrew Shaffer had some Delaware credentials as well. Hurricane Dorian loomed ready to give North Carolina a bit of rain and Jason had us try to site examples of hurricanes in literature. The BlackBerry girl had read something in which a hurricane devastated someplace somewhere in the U.S. taking a power grid offline and then, in the aftermath, the Chinese army was everywhere and people thought that they had invaded when really the Chinese army was just helping America rebuild. BlackBerry Girl couldn't recall the name of this work and I can't unearth it in Googling either so it will stay a mystery. "New York 2140" by Kim Stanley Robinson is a book about a permanently flooded by global warming New York City in the year 2140. Jason found the cover art intriguing and dug up a copy of the book from within the bookstore to show to us. I noticed the term peri-apocalyptic on the back cover and, as opposed to the post-apocalyptic Mad Max stuff, the peri implies during the apocalypse. The cover art was pretty "fun" with canals between skyscrapers where roads used to be. I am intrigued by living in the peri-apocalypse. There were some new skyscrapers in that New York depiction too, replacing the twin towers. Hot air balloons dotted the sky.

Balazs Hideghety at Ceremity/UPS didn't want to use the Core First version of Entity Framework with .NET Core.

I always assumed that he didn't know what he was talking about, (He disliked and didn't use interfaces in C# and thought that microservices and domain-driven design were synonymous.) but since then I have run into others echoing the notion that the first rollout of Code First Entity Framework for .NET Core was pretty bad. I can't tell you what was so terrible offhand, but apparently as of .NET Core 2.2 it is solid and shipshape.

I saw Eric Harding present at Triangle F# on Tuesday night.

North Carolina's Tech Triangle is founded around three nearby universities in Raleigh, Durham, and Chapel Hill and really the identity has expanded to a triangle of tech sphere jobs based around those three North Carolina cities. I visited all three on 9/3/2019, catching lunch at a brick and mortar Korean bar that evolved out of some food trucks called Namu in Durham, dinner at a Laotian restaurant called Bida Manda in Raleigh, and a tech event at the Chapel Hill public library on F#. Eric Harding hosted the event, a monthly meetup.com meetup of a group called "Triangle F#" (we just discussed what the triangle part of the name means) and while he kind of projected from his laptop (well, we could see his laptop display on a TV in the room) and spoke some it might be a stretch to say that he was the speaker or that there was a particular topic. Instead, this just seemed to be a free-for-all of thoughts from a handful of F# enthusiasts in the room. A lot of what I experienced builds atop this talk with mentions of Fable-Elmish and MVU. A host of other wacky things came up. Racket is a language based on the Scheme dialect (support for both functional and procedural programming) of Lisp. Eliza is an old chatbot. C came out in 1972 and machine learning (ML) in 1973. In "choose" in the gang of four patterns, you walk a chain of responsibilities trying to see if you match at each link of the chain and continuing if you do not. Blah, blah, blah. In MVU a view function is a pure function which takes in an immutable model and produces a model tree (a view) while an update function takes in your existing message and a model and gives you an updated model. A dispatch takes in an event. Eric showed off fable.io/repl on the TV, which is an online play place for F#. It uses, by default, I think, FiraCode (pronounced a bit like "fear of code") as a font which does wacky things like turn |> into a rightward pointing triangle (there is a triangle again) kind of like the play button of tapeplayer controls and -> into a rightward pointing arrow. So what do these two things do? Foo(Bar(Baz(qux))) in C# could be qux |> Baz |> Bar |> Foo in F# and the rightward pointing arrow is kind of like a lambda operator suggesting use what's at the left of the arrow as a variable name for immediate scope to be used in the machinery at the right of the arrow. Fake is the F# Make/Jake/Rake/Psake build tool. F# embraces immutability by default using immutable types and this means we have structural equality wherein you can just compare two different, independently created objects and still have the objects be equal if all of their properties are the same. That's not how it works with reference types in C# wherein you would be comparing two different pointers in a similar scenario and the two objects could never be equal. In C# you end up comparing perhaps the unique id of a database-driven object, be it integer or GUID, to its counterpart on a sister object to gauge if the sisters are really the same girl. The Fable, F# to JavaScript, porting is the way to go for the UI. The only variations for the UI are: What JavaScript framework do you poop code out to? It doesn't have to be React which is kinda the default. It can be Vue. Eric had not seen an Angular rollout but he didn't see why that would not be possible. In an App.fs file is where you would normally assign what version of JavaScript to spit out with something like .withReactBatched for example. There is no markup in the F# UI. You just have a function to represent a button for example. Here is what was shown off for making an HTML table:

Sencha Ext JS of course famously took this approach too and it wasn't really a good thing. One nice thing I will say about this is that when you think of what Blazor is attempting in the C# space, well, F# is really already there isn't it? If you want to explicitly compile to WebAssembly Bolero kinda leverages Blazor in the F# space. The reason to go there is if you want to loop in extras via NuGet packages as opposed to npm packages (which is what Elmish demands). Fabulous for F# spits out Xamarin XAML instead of JavaScript. OpenGL (Open Graphics Library) and GLSL (GL shading language) are things you may interop with from F#. You make 3D graphics with this stuff. A sequence in F# is like IEnumerable in C#. A discriminated union in F# is kind of like a union in TypeScript allowing for multiple possibilities with a pipe symbol wherein type Msq = | ChangeValue of string | Reverse might be an example. The SAFE stack uses Saturn, Azure, Fable, and Elmish. So what's Saturn? It is an abstraction on top of ASP.NET that allows you to write server-side stuff in a functional F# way that is somewhat akin to Ruby on Rails. It has canned routing for example. If you want to come off the rails, Giraffe is the do-what-you-will alternative. The convention of giving every class its own file in C# does not carry over to F#. Instead many things are often nested in one big file and scope builds top to bottom in a way it does not in C#. If you see a type in use and you wonder what it is you can probably just look upwards in the file to find it. Don Syme and Tomas Petricek are some of the big names in F#. F# tries to balance correctness with performance while F* (pronounced F star) has a heavier emphasis, as a similar programming language, on the correctness. Mozilla is porting F* to C in building their Everest project which attempts to allow builds that are verified as HTTPS-friendly (the S in HTTPS stands for Secure) top to bottom of web gunk. The immutability of F# plays nice with parallelism and allows for gains even as Moore's law breaks down. Also CPUs increasing have more than one die with their cores (actor managing a thread, doing work) not necessarily on the same die (chunk of silicon) and a packet cannot be shared across two dies like it might be across two threads. Herein again, the parallelism of immutability is a nice to have. let! (pronounced: let bang) is like the await keyword in C#. A packet.lock file allows for some of the Yarnesque-version-locking-flavored stuff. Type providers in F# allow for some code generation that lives at database tables. Of the two eateries, it was Namu I went back to again.

Visual Studio Code will allow you to open a folder into a Docker container and work therein.

Cool stuff.

the iPhone charger that plugs into the cigarette lighter in the rental car

The day after Labor Day of 2019 I visited the "Asheville Mall" which is, yes, a mall in Asheville, North Carolina. At the Verizon store I bought the "Dashport" car charger by "Ventev" and it's legit. I endorse this product. I had thought I could go on a road trip without this and then I got the unpleasant surprise of finding that my phone was about to die because for some reason it had not charged overnight.