Thursday, August 17, 2017

The LinqToExcel NuGet package!

This will allow you to query Excel sheets in C#! You will map records to a POCO of your creation. The getsetters will be decorated with attributes like so:

[ExcelColumn("Whatever")]

 
 

...and these map off columns to your type.

declare keyword in TypeScript

I don't really understand namespaces or declare yet. If you have a namespace like Foo, you may use declare like so:

declare var Foo;

 
 

...and the reason to do this is if Foo is a regular JavaScript file (not TypeScript) looped in in the global namespace that you wish to make "ambient" everywhere.

Wednesday, August 16, 2017

At times it may be wise to make a dummy Task in C# that doesn't do any asynchronous work at all as part of workflow satisfaction for conditional logic.

public static List<Anxiety> GetAnxieties(string phobia)
{
   Task<IEnumerable<Anxiety>> phobosAnxieties;
   if (phobia == null)
   {
      phobosAnxieties = Task.Run(() =>
      {
         Anxiety[] emptyArray = new Anxiety[] {};
         IEnumerable<Anxiety> emptyIEnumerable = emptyArray;
         return emptyIEnumerable;
      });
   }
   else
   {
      phobosAnxieties = Task.Run(() =>
         PhobosService.Call(phobia)
      );
   }
   List<Anxiety> anxieties = DeimosRepository.GetBaseDreads();
   foreach (var phobosAnxiety in phobosAnxieties.Result)
   {
      anxieties.Add(phobosAnxiety);
   }
   return anxieties;
}

Tuesday, August 15, 2017

What are the big differences between Angular 2 and Angular 4?

Per this:

  1. under the hood optimizations
  2. better animations
  3. the else for *ngIf
  4. the email keyword that sits by the required keyword at input tags

 
 

That is hardly anything compared to the jump from Angular 1 to Angular 2, huh? The new versions after 2 will not be rewrites like 2 was itself. Anything you could do in 2 will work in 4. In version 5, some of the stupid stuff in 2 will be forbidden, but we are not there yet. The Angular team will warn you of what it will drop in a given version the version beforehand so we know now that 4 is here that the template tag will go away in 5. The Angular team would like to think of Angular 1 as AngularJS and Angular 2 and beyond as just Angular but realistically these names do not work well when Googling for information on either. Why is there no Angular 3? Well, the routing was already on version 3 and the team wanted all of the major packages to start fresh on the same version.

Monday, August 14, 2017

How may I get a breakdown of my last few commits in SourceTree 1.9.13.7?

Search like this but search for Authors and search for yourself. The individual commits up top may be clicked on and at Search down below you will see the files changed. Click on each file to see a dif.

Sunday, August 13, 2017

Two-thirds of the way through a series of online trainings on Angular 4, I offer more stolen notes.

  1. {{ whatever | uppercase }} and {{ whatever | date }} are both examples of built-in pipes.
  2. {{ whatever | date:'fullDate' | uppercase }} shows off both a shortcut for the date pipe (you may hand in a specific format too) and also chaining pipes.
  3. Go to https://angular.io/api and search for "Pipe" to get a list of the built-in pipes.
  4. let x = whatever.substr(0, 13); is a trick for capturing a substring.
  5. *ngFor="let foo of foos | disturb" is of course an example of using a pipe against an array. Such a pipe will take in an array, mess with it, and then hand out an array.
  6. Setting pure to false in our disturb pipe like so:
    @Pipe({
       name: 'disturb',
       pure: false
    })

    ...will allow for the pipe to recalculate the array everytime the array is updated which comes with a performance hit. This is not the default behavior.
  7. Guess what is at: https://firebase.google.com ??? That's correct. Firebase is there. Walk through a little wizard to set up a project and then afterwards at Database > Rules set read and write to true and publish. At Database > Data you will see the URL for your project. Hit it with data.json appended to the end after the last slash (appName.json for the Firebase application name in lieu of data) when doing a GET in the Angular 4 stuff.
  8. .map(
       (stuff: Response) => {
          const midstreamStuff = response.json();
          for (const midstreamDatum of midstreamStuff) {
             midstreamDatum.numericThing = midstreamDatum.numericThing + 13;
          }
          return midstreamStuff;
       }
    );
    is an example of transforming a collection with .map
  9. When asynchronously handling an Observable in a failure scenario...
    .catch(
       (failure: Response) => {
          return Observable.throw(failure);
       }
    );

    ...this might be chained to the end of a .map. Another shape this might take is:
    .catch(
       (failure: Response) => {
          return Observable.throw('Yikes guys!');
       }
    );

Saturday, August 12, 2017