Thursday, August 31, 2017

August Queso

  1. tbt stands for "Truth Be Told" but may be used in a "so now you know" way OR this could also be throwback Thursday
  2. [routerLink]="['/app','whatever','13']" would be a template-side example of handing an id on in a route (the 13) in Angular 4
  3. tape backups were an old way to backup hard drives
  4. Ctrl-Shift-R is for find and replace in WebStorm 2017.1.2
  5. Viewpoint doesn't have primary keys at its database tables. Sometimes you'll see KeyID as a bigint column type, but these are not consistently present. KeyID is used like a unique identifier when it does show up.
  6. PWAs are the new RIAs. Progressive Web Apps made in the likes of Angular 2 are utilizing JavaScript for an experience beyond HTML ABCs. This was the same promise of Flash and Sliverlight wasn't it?
  7. OKRS stands for Objects and Key Results. Gtmhub is a tool for OKRS.
  8. Nvidia GeForce GTX 1080 and Nvidia GeForce GTX 980 are examples of graphics cards for PCs.
  9. CompuServe was an ISP.
  10. Google Home and Amazon Echo are voice controlled devices. You can do things like ask them to play music for you and you can break into them and program your own stuff. Tie them into Philips Hue Smart Lighting and get them to dim the lights in your home, etc.
  11. In vinyl LP the LP stands for long playing. CD stands for Compact Disc. LaserDisc or LD is the forerunner of the CD and later the CD-ROM, ROM being read-only memory and the format allowing for people to burn digital data files onto CDs. RAM stands for random-access memory while we are at this. I strayed from vinyl, huh? We all do.
  12. https://www.youtube.com/watch?v=-lhZ6w1fkww is an example of a YouTube Radio station.
  13. PTO is paid time off.
  14. UAV (unmanned aerial vehicle) is, I think, the technical term for a drone. This better name kinda speaks to what drones are.
  15. Supercell is the mobile gaming company that does Clash of Clans. Zygna is the mobile gaming company with the founder (Mark Pincus) who asked Barack Obama to pardon Edward Snowden to his face.
  16. inFlow is some form of inventory software
  17. NSB could stand for NServiceBus.
  18. Disney is to pull itself off of Netflix and start its own streaming service.
  19. uBlock Origin and Privacy Badger deal with popups at Google Chrome.
  20. Libby, by OverDrive lets you hear audio books and if you have an account at your local library it is now possible that the library will let you access all of its eBooks across Libby.
  21. Newegg sells stuff online, computer gunk and the like.
  22. https://www.ng-book.com/2/ has "ng-book 2" which is an online book that will teach you to use Angular 4. I believe this thing just exists digitally and is always kept alive and growing by way of updates. I think "living book" might be the term for this sort of thing.
  23. BaconReader is a client for Reddit for your phone.
  24. Pornhub apparently both revolutionized and destroyed the pornographic industry by offering a torrent approach.
  25. When you have so many changes in SourceTree that the app hangs when you try to remove them all, instead stash the changes and delete the stash afterwards.
  26. Type "Git Bash" at start in Windows 10 to open a shell for SourceTree manipulations.
  27. Firmware is software in read-only memory that cannot be tossed away or altered. It is software to make the hardware it sits in work.
  28. .trim() in JavaScript gets rid of leading whitespace and not just trailing whitespace.
  29. The only time I have gotten to do any work that tangentially relates to IBM was at Network Logistic, Inc. IBM reached out to NLI to have some audio clips cleaned up for a presentation and I did the work. I believe Cool Edit Pro was the software I used. I think this tool became Adobe Audition.
  30. https://www.hackthissite.org/ has little games to play to learn hacking.
  31. versiony is an npm packet for versioning Angular2 apps.
  32. Alpha channels on TIF/TIFF (Tagged Image File Format) images with the .tif extension allowed one to save a piece of metadata with the file that could then be resurfaced to make a selection or do something else in Photoshop. Typically I would use this trick to save a shape for a selection in Photoshop. I cannot remember why. If you need workspace notes, if you will, in the midst of a file and you cannot just save a .psd for whatever reason then things get tricky and you have to resort to hacks like this. .png files (Portable Network Graphic) have comparable gunk going on with them allowing you to have layers in Fireworks, etc.
  33. Only spending within the first tenth of your credit card limit on your credit card is supposedly healthier for maintaining credit than going over that.
  34. I am hearing that Best Buy has ridiculously good warranties to such an extreme that you may buy a laptop, pay five hundred dollars for a warranty for two years, break your own laptop at the twenty-three month mark, and then just go back to Best Buy and get either a new laptop or your money back. If you run into a manager who gives you grief, just go to another store or come back later. You most likely will just get a kid to help you and not a real adult and the kid won't care. The reason this loophole is open for the moment is just because most people don't know to exploit it. It gets better. Whenever you get a replacement for a warranty, you also reset the warranty so you have another two years. You can keep it alive forever, and a missing cord may be all the excuse you need to get that guy right out of high school to go "yeah, yeah, yeah, whatever" and push through your warranty abuse to fulfillment.
  35. Rebates as a concept are a funny sort of discount. Basically you will make a purchase and be given a coupon to get some of your money back later. The parties giving the rebates hope you'll just forget about it or lose your receipt or something.
  36. http://beta.speedtest.net/ is a tool for gauging network speed.
  37. Populated could be a term used instead of hydrated.
  38. QuickBooks is accounting software.
  39. Microsoft BizSpark is a program to vaguely help out startups in the software space. I assume that being a part of this is akin to what it meant to be a Microsoft Gold Partner ten years ago.
  40. toastr is a toaster (https://github.com/CodeSeven/toastr)
  41. LibreVR / Revive is a tool that lets you run Oculus Rift games on the HTC Vive.
  42. The PalmPilot was a handheld device from the late 1990s. You tapped the screen with a stylus.
  43. Xtras for Macromedia Director looped in additional, third-party goodies for functionality.
  44. ApiController is not a first class citizen in .NET Core's MVC (a generally available fundamental feature, a cornerstone) as a Controller can be either what a Controller or an ApiController could be in MVC5 or a mix of the two, but it is a common pattern to make Controllers inherit from an ApiController with some common concerns in it. This introduction of a middleman inheritance trick is like the BaseController thing that we have all used in the prior five versions of MVC.
  45. A footgun is a feature that results in you shooting yourself in the foot when you bolt it on to something that wasn't sick yet to begin with.

Wednesday, August 30, 2017

OData

An OData service in the OAuth paradigm looks like a go to point for a collection of POCOs, not unlike a repository in the stereotypical C# Onion Architecture application. This is yet more factory pattern variant mechanics, right? You protect an OData service with OAuth! This has some stuff on it.

I saw Matt Gaunt give a talk on Web Push at SFHTML5!

SFHTML5 is a San Francisco meetup.com users group to do with, yes, you guessed it, HTML5. On August 25th, I went to an SFHTML5 event at Google's offices in San Francisco and saw a Matt Gaunt speak on push notifications which are those little rectangular boxes that popup telling you that something new has happened at your Facebook account. (not just Facebook/other apps too) They appear even when you don't have Facebook open at your browser because they are using service workers running at the browser itself. When I shake my Windows-10-running Dell XPS laptop awake I even see these before Google Chrome is ever opened which is kinda nosebleed inspiring. I once went to a talk on using JavaScript to interface with an API for the "Metro" stuff of Windows 8 and this same sort of thing must exist for Windows 10 and service workers cross-talking with it must make the impossible possible herein. The talk didn't dive into that though. It was in many ways more elementary and yet with that came a geek out on how authentication works in this paradigm. There is a GitHub Org (an organization: boundaries and rules around group-owned repositories) called web-push-libs which, amongst other things, has web-push-csharp, and Matt heavily encourages you to use this stuff in lieu of writing something yourself that identity, called PushSubscription in this space, and public and private keys get tangled up in. Web Push is a node library for this stuff. At the very end of this talk came thoughts on bad UX and that honestly might make a for a good place to start talking about this stuff as the bad way to go probably seems normal by now. When you first visit a web site in Google Chrome and are prompted with "news.vice.com wants to: Show notifications" and buttons for "Block" and "Allow" are there this is the notification permission opt in step. This terse messaging and immediate coercion is bad. Elsewhere on a site there should be a better explanation for what you might opt into and this should be aesthetically presented and not be the first thing one sees. Also the site should have a way to turn push notifications off and this too is normally lacking in bad (all too normal) UX which forces users to go digging in Google Chrome's settings for the turning off service workers. By the way, "Service Workers" beneath "Application" is where to see the service workers running at Google Chrome listed at Google Chrome Developer Tools. Another example of bad UX is having a notification that tells you that Facebook is telling you that you have a message and then giving a link off to Facebook which redundantly tells you "facebook" at the URL. Try to maximize your use of limited real estate and not give vague clickbaitesque messages. Alright, now having talked through how things materialize for average Joe, the behind the scenes magic for the developers is such that a web site will send a push notification to a cell phone by way of sending a PushSubscription to a Web Push Protocol which then talks to a Push Service which talks to the cell phone. Upstream of this we obviously need to request permission to make toaster toast spring up and this is done with Notification.requestPermission() in the applicable API. After getting permission but before the web-site-to-web-push-protocol-to-push-service-to-cell-phone game may be played there is a step in the middle in which a Service Worker must be registered. A service worker is basically a JS file that tells a browser there is an intrinsic link between a web site and the JavaScript in the file. When the browser receives a notification it has to ask itself "Does this web site have this service worker?" and if the answer is yes we're in for some charming little messages. TTL Headers in notifications can spec a time to live. (TTL, get it?) If you want to tell someone about an immediate sale that just lasts twenty-four hours but they have their cell phone off for three days while they are pretending to hate capitalism and modernity during some soul searching (if people have souls) you don't want to inform them off the golden opportunity they missed when they rejoin neonowness. That would just be mean. Mozilla Firefox was recommended for troubleshooting and debugging (it's back!) as it actually uses Web Push whereas Google Chrome is using FCM (Firebase Cloud Messaging) which is much more opaque in its error messages in this sphere of things. I enjoyed going to Google and chitchatting with others before this event started. I learned that an "ecstatic" web site uses AOT and maybe a CDN and I learned that Google's Progressive Web Apps are reliable, never show the downasaur, and utilize good practices for distributed computing. I also met a guy who rather bafflingly feels most comfortable just working with JavaScript and not the modern frameworks or even jQuery and when I asked him how painful it is to use XHRs he explained to me that you don't have to do that anymore and that you may just use .fetch for AJAX instead in all the modern browsers. This was naturally news to me because I don't even want to think about tackling AJAX without jQuery or Angular/Observable. I kinda haven't wanted to think about push notifications either, truth be told, but here they are and they're not going away. This was a good introduction. Thanks Matt!

 
 

Addendum 9/7/2017: I may be wrong about what I say above about the Metro stuff. I found a Stack Overflow thread that suggests that if even one of your Google Chrome extensions has the "background" permission that the notifications can make it through to you even if you do not have Google Chrome open. There must be, in these cases, something else running in the background all the time (and in your list of apps to spin up upon startup on the other side of a reboot) that has the service worker needed registered and doing its thing.

Flywheel

San Francisco is a cab town! I was there for a long weekend (made much longer by Hurricane Harvey) and there were cabs everywhere. In chatting up cab drivers I got the impression that Uber has reduced business to 60% of what it was but things are still cab friendly. Flywheel is a cab company in the region that has a mobile app for ordering a cab, tracking the cab, and you can just pay through your app account instead of swiping a card in the cab or giving the driver cash.

I took a Flywheel cab across the Golden Gate Bridge and back on Saturday, the 26th of August, so that I could cross that off my bucket list. (I mean the Golden Gate Bridge and not riding in a taxicab.) The driver complained of Uber and of skyrocketing prices in SF ($3,000/month for an apartment) so maybe things aren't that rosy after all.

Right about now Hurricane Harvey has me longing for some escapism.

On August 24th (of 2017) which was my 43rd birthday, I went to San Francisco for a long weekend getaway (made longer when Hurricane Harvey trapped me there) and in looking for something to do I found the "I wanted to do that... just not alone" meetup.com meet up group and attended an event of theirs at The Myriad, a peculiar bar/arcade (pinball machines not Donkey Kong) with many little independent vendors inside, called "Virtual Reality for Cinema, Entertainment and Travel" which was good but disorganized. Like the last VR talk I went to and honestly the one before that too there wasn't anything of a talk to be had. This was just another opportunity to goof off with an HTC Vive. I played a game called "To The Top" which involved climbing walls when it was my turn. It was outstanding in its realism. In falling, in game, with only my eyes being affected, I nonetheless felt a falling sensation in my emersion. Amazing! Before the gameplay got going I was able to chitchat with one of the coordinators, a Jorge Garcia of Exit Reality, and in speaking with him and others (Angie who ran the Exit Reality booth and one of the staff of The Myriad who was surprisingly versed in VR matters) I learned some things I had not known. Exit Reality's immediate business model is based on an assumption that the barrier to entry in the Vive arena, including two sensors on poles to define the active play space, is a little too much for most and getting in the way of adoption and so they have little booths with operators (helpers) that get set up at Exit Reality's clients for a renters fee and the clients then let the public use the booths for free as bait to attend their locales. IMAX is an example of one of the businesses that Exit Reality is in bed with. You can play with Exit Reality booths at both of the IMAX movie theaters in New York. You can also visit The Myriad for this. They have a consistent Exit Reality booth, operator and all, to allow you to become addicted to Vive. We all have to get hooked if this gimmick is to be for the masses and not just a fringe thing and there are some challenges with that. Supposedly a full-fledged, more-than-a-demo game is coming out within the year, a version of Fallout 4 called Fallout 4 VR. Perhaps this is the bellwether to be, make or break, for if this all will be embraced and game companies will find the platform worth indulging based on game sales. It's bad if Fallout 4 VR fails. Another interesting thing that might come to be are tracking devices that an individual might just wear on his person that emit electromagnetic signals and do away with the need for the two sensors on poles. In the Samsung Gear VR approach, the view for the headset is the screen of a smartphone. When I asked how a phone can possibly line up with someone's eyes given that different people have different distances between their eyes it was explained to me that the phones that are Gear-friendly give a consistent display and that the headset itself then augments that display and allows for some tweaking and adjustment of how you see it. New versions of various phone platforms should, to stay current, be Gear-friendly, and this thus has the potential to create an industry standard for screen size across all platforms. If that really happens, it means that VR is not just a craze.

Sunday, August 20, 2017

loop in Firebase at Angular 4

import * as firebase from 'firebase';

...is the way to loop in the Firebase SDK to do stupid stuff with it. You dot off the firebase "keyword" you just created with this import to have at the Firebase goodies.

Make sure an array is empty instead of just not there when hydrating objects with Observables.

whatever() {
   this.http.get('http://www.example.com')
      .map(
         (response: Response) => {
            const cats: Cat[] = response.json();
            for (let cat of cats) {
               if(!cat['kittens']) {
                  cat['kittens'] = [];
               }
            }
            return cats;
         }
      }
      .subscribe(
         (cats: Cat[]) => {
            this.myService.setCats(cats);
         }
      }
   }
}

Saturday, August 19, 2017

What is the difference in the different versions of MVC?

I was with a consultancy that was very much in love with ASP.NET MVC and started using it in Visual Studio 2005 when it was still in beta. I have thus, technically, been versed in MVC from the beginning. Rather frustratingly however, most of the places I went to work after that consultancy had me doing web forms and not MVC so in the end I really know more about web forms. We are on the cusp of another big change now with Angular 2 and I again seem to be getting on board at the right time. Hopefully I can stay hip deep in the new stuff and not get sucked back into, scoff, MVC. My web forms experience turned out to be a blessing in disguise as Angular 2 is honestly more like web forms than MVC. So what were the differences in the various versions of this once cool thing which started out as Microsoft's attempt to mimic Ruby's routing and most recently has become Microsoft's attempt to mimic Node's lightweightness?

  1. The token goofy web form you had to have to wire things up in the beta is now gone.
  2. MS AJAX no longer comes with everything else by default. You now have to explicitly add it in and no one does because everyone is now using jQuery instead.
  3. Razor!
  4. Mobile-specific views! You may have a separate view for mobile phones as opposed to laptops and MVC will be smart enough to fall over to the right view conditionally when it summons a view.
  5. Dependencies at controller signatures may be auto-populated by StructureMap!
  6. .NET Core!

This is a really stupid breakdown, right? There is a lot more to it than that, huh? What I give here is just the strongest impression I have of the changes.

I saw Peter Seale speak on Virtual Reality on Thursday night.

North Houston .Net Users Group was the venue but Mr. Seale was upfront about admitting that the Houston VR meetup group going on at the same time was probably a better forum for the subject matter of the evening. Indeed, Peter Seale basically just had the crowd play with the HTC Vive headset for an hour and a half, so what was .NET specific about that after all? In attempt to tie the "talk" into .NET he said that Unity Engine and the Unreal Engine were the ways to go to build your own stuff. They both support C#. Unity is actually of C# and Unreal of C++ with good C# support. No matter how good your skills may be with C# however there will be a steep learning curve. Before I get into what Virtual Reality is, let me mention what it is not: Augmented Reality. When you are overlaying gunk onto existing real world visuals, such as is the case with what Pokémon Go does to what your phone's camera sees or what Google Glass does to what your eyes see, that in Augmented Reality. Microsoft's HoloLens is another example. Maybe you get rendered 3D objects with it, but you are not, in that case, immersed in a 3D environment. You are in Virtual Reality however. You, therein, go into an exclusively faked (as far as the eye can see) space at, ninety frames per second, with the perspective adjusting based upon where you turn and move. Peter thought the Vive's resolution was 1440 pixels by 900 pixels per eye. You may have a headset on independent of the Vive to fool your ears as well as your eyes and you hold controllers in each hand to do things you might do with your hands. (The Oculus approach has things you strap to your wrists instead of controllers.) Things like motion trackers for the feet and backpacks to hold something broadcasting a wireless signal so that there isn't a cord to trip on are coming in this space but not really a reality in virtual reality yet. The Vive controllers very often appear in Virtual Reality as 3D representations of Vive controllers and when it was my turn to use the Vive they certainly did when I was inside of Tilt Brush, a painting (with neon lights) app. This was great. I couldn't see my own hands in there so I needed something to relate to. However, in games such as "The Lab - Longbow" in contrast controllers are often represented as weapons or other game-flavored things. In the image here, a volunteer is pulling back a longbow with the controller out of sight in his right hand while holding the bow at the controller in his left hand. We see what he seeing at the right. He is aiming at what looks like an AOL Yellow Running Man that is black instead of yellow as that is a villain that would ultimately make its way up to him to "kill" him I suspect.

The picture above also shows two devices set atop sticks which define the cattycorner corners of the top of a cube of space which is the active area to move about in. If you approach the edges of the box you will see a green grid laid against the boundary. Looking down at the cube from above at a 2D perspective of the cube, the cube may be as small as three feet by three feet and as big as twelve feet by twelve feet.

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

Friday, August 11, 2017

Is there a better way?

Maybe it is not the trendiest tool, but I just endorse Visual Studio for figuring out RegEx patterns. I will make a ceremonial silly solution and then bolt a unit test project onto it and write some unit tests around a regular expression pattern. What follows proves out a pattern that validates an eight digit string with no spaces wherein a dot divides the first six and the last two digits and the first six digits may also be alphanumeric. A coworker asked me for this today. I know there are other tools for this. This is what I do though.

using System.Text.RegularExpressions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace UnitTestProject
{
   [TestClass]
   public class RegExTests
   {
      private const string myPattern = @"^[0-9A-Za-z][0-9A-Za-z][0-9A-Za-z][0-9A-Za-z]
            [0-9A-Za-z][0-9A-Za-z]\.[0-9][0-9]$";
      
      [TestMethod]
      public void Test1()
      {
         string toMatch = "123456.89";
         bool isMatch = (Regex.IsMatch(toMatch, myPattern));
         Assert.AreEqual(isMatch, true);
      }
      
      [TestMethod]
      public void Test2()
      {
         string toMatch = "abcdef.89";
         bool isMatch = (Regex.IsMatch(toMatch, myPattern));
         Assert.AreEqual(isMatch, true);
      }
      
      [TestMethod]
      public void Test3()
      {
         string toMatch = "123456.8x";
         bool isMatch = (Regex.IsMatch(toMatch, myPattern));
         Assert.AreEqual(isMatch, false);
      }
      
      [TestMethod]
      public void Test4()
      {
         string toMatch = "123456.8";
         bool isMatch = (Regex.IsMatch(toMatch, myPattern));
         Assert.AreEqual(isMatch, false);
      }
      
      [TestMethod]
      public void Test5()
      {
         string toMatch = "12345.89";
         bool isMatch = (Regex.IsMatch(toMatch, myPattern));
         Assert.AreEqual(isMatch, false);
      }
      
      [TestMethod]
      public void Test6()
      {
         string toMatch = "1234 6.89";
         bool isMatch = (Regex.IsMatch(toMatch, myPattern));
         Assert.AreEqual(isMatch, false);
      }
   }
}

when you accidental close the floating vertical toolbar in GIMP

In the GNU Image Manipulation Program (GIMP) menu across the top of the app (File, Edit, Select, etc.), go to:

Windows > Recently Closed Docks > Toolbox-Tool Options

I am enjoying GIMP after all. The eyedropper tool (technically: Color Picker Tool) for selecting a color turned out to be pretty easy to use today. At least this isn't Windows Vista wherein you could delete the recycling bin. Remember that?

Hmmmm. How much do earplugs cost at Waterloo Records?

Answer: They are 99 cents.

Thursday, August 10, 2017

KendoUI controls specifically for Angular 4! (and some Bootstrap 4)

At work today, four of use took a pause to watch a live webinar by a Carl Bergenhem of Telerik which is the company that owns KendoUI. He set up, in forty minutes time, a quicky Angular 4 app that showed off a grid of records from a KendoUI control. The grids look like this:

<kendo-grid [data]="gridData">
   <kendo-grid-column field="ProductID"
         title="ID">
   </kendo-grid-column>
   <kendo-grid-column field="UnitPrice"
         title="Price">
   </kendo-grid-column>
</kendo-grid>

 
 

It's not really too hard to squint one's eyes and see that kendo-grid must be the selector for a component and data an input for it and everything inside of the kendo-grid tags some templating. He also had time to show off button controls for Kendo which look like so:

<button kendoButton>Default</button>

 
 

Yawn. Everyone bored? Alright the more interesting part of the talk came upfront when Carl was laying out the HTML for application which used Bootstrap 4. I am still very new to Bootstrap and as I ramp up on Angular 4 I honestly do not find myself growing nearly as fast at Bootstrap, but, naturally, it is important too. In...

<div class="row my-3">

 
 

...the m in my-3 is for margin, the y suggests the y-axis should be affected, and the 3 in turn is for the size, in this case the default size in setting. There seems to be a good cheat sheet on it at https://v4-alpha.getbootstrap.com/utilities/spacing/ and I'm sure there are others out there too. Carl set up a series of menu items in a collapsible navigation at the top and the top nav in turn affected a set of "cards" below. The new concept of cards replaces panels, thumbnails, and wells in Bootstrap 4's paradigm.

dynamic versus Reflection in modern day C#

public void UpdateWhatever(object dto)
{
   WhateverDto whateverDto;
   try
   {
      whateverDto = (WhateverDto)dto;
   }
   catch (Exception exception)
   {
      whateverDto = new WhateverDto();
      dynamic dynamicDto = (dynamic)dto;
      whateverDto.Name = dynamicDto.Name;
      whateverDto.Age = dynamicDto.Age;
      whateverDto.Race = dynamicDto.Race;

...and so on. If we cannot cast off an object we can just map off an object with dynamic so why care about Reflection anymore at all? The dynamic trick is only going to work in times of confidence. If we are unsure of what lies at the thing to inspect then we need to inspect yet. That is when Reflection realistically comes in.

I have the Doink-It!

I am not a baby!

Wednesday, August 9, 2017

This error suggests your .edmx is sick and that you should update it.

Unable to update the EntitySet 'Whatever' because it has a DefiningQuery and no <InsertFunction> element exists in the <ModificationFunctionMapping> element to support the current operation.

Tuesday, August 8, 2017

explicitly public

In Angular 4, there seems to be a trend away from making variables explicitly public in components in favor of just leaving the accessibility modifier off of public variables that are in components yet outside of component methods as these will nonetheless be public. You do have to use the public keyword (or the private keyword) when declaring a variable at the signature of a constructor if you want the variable to be accessible beyond the constructor itself.

Monday, August 7, 2017

Profiler versus LINQPad

I am newly working in an environment where there is an ORM once more. A coworker asked me about how to see the SQL and that led me to try to get my head around SQL Profiler for the first time in a dog's age. This has some of the how to. Basically, you will type "SQL Server Profiler 17" at the start bar in Windows 10 and then pick "New Trace..." and afterwards you will either be told "In order to run a trace against SQL Server you must be a member of sysadmin fixed server role or have the ALTER TRACE permission." or you will be able to spy on the SQL being generated at the server with success. Now having said all that, I am also learning today that one more amazing thing that one may do with LINQPad is spy upon Entity Framework SQL traffic with it. I do not yet have my head around that.

How do I search SourceTree across numerous commits to know which JIRA ticket a change merged into the dev branch was made in?

Across the bottom where there are tabs for File Status, Log / History, and Search pick Search. At the upper right where there is a dropdown for Commit Messages, File Changes, or Authors pick File Changes. In the large long search bar immediately left of the dropdown, search for a magic string which should only appear in your particular commit.

Sunday, August 6, 2017

just a few more notes on Angular 4 reactive forms stolen out of an online training

  1. *ngIf="v.get('emailAddress').valid" is an example of using the get operator in reactive forms (the form is v in this case) to fish out field details.
  2. *ngIf="v.get('mySubGroup.emailAddress').valid" shows off the same thing while drilling into a group.
  3. You make your own custom validator that uses a method. To do so, eplace Validators.required at your FormControl with something vaguely like [Validators.required, this.myGimmick.bind(this)] while the myGimmick method elsewhere in your component (with, yes, bonus, this scoped correctly) should have a signature like this:
    myGimmick(formControl: formControl): {[key:string]:boolean} {
    Herein, {[key:string]:boolean} is like a KeyValuePair of <string,boolean> in C# while formControl.value will give you the value you want to operate on in your method. Your method may do whatever you like. You may pull the value out of a different control with the .get operator for a cross-comparison of two dates for example if birthday should come before death date or something like that. Do what you want. It's on you. When you are ready to pass a validation, either return nothing or return null. When you want to fail a validation return something like so:
    return {'arbitraryName':true};
  4. *ngIf="v.get('birthday').errors['arbitraryName']" is the way to check if there is an error and that is kinda frustrating and clunky. You need a separate break out for *ngIf="v.get('birthday').errors['required']" too which sucks.
  5. asyncGimmick(formControl: formControl): Promise<any> | Observable<any> {
       const promise = new Promise<any>((resolve, reject) => {
          setTimeout(() => {
             if (formControl.value === this.doomsDay) {
                resolve({'asyncName':true});
             } else {
                resolve(null);
             }
          }, 1500);
       });
       return promise;
    }

    ...is an example of an asynchronous validation. It gets wired up a bit differently at FormControls like so:
    'birthDay': new FormControl(null, [Validators.required, this.myGimmick.bind(this)],
          this.asyncGimmick.bind(this))

    ...and while this will decorate a control with ng-valid and ng-invalid CSS classes there will be a window during which an ng-pending class is present instead.
  6. this.v.valueChanges.subscribe{
       (value) => console.log(value)
    );
    is an example of reacting whenever a change occurs. This also exists at the individual control level and at the individual control level and form level both there is also a statusChanges too.
  7. this.v.patchValue and this.v.setValue are legit in the reactive forms stuff and there is also a v.reset() as well. These are just like their template-driven forms counterparts.
  8. <a *ngFor="let foo of foos; let i = index" (click)="onWhatever(i)"> is an example of passing the current line item's identity to the TypeScript side of things when doing the FormArray thing.

Saturday, August 5, 2017

more template-driven Angular 4 form notes from a series of online trainings

  1. Wrap two controls in div and put something like...
    ngModelGroup="myThing" #myThing="mgModelGroup"
    ...inline in the tag to group controls allowing for one to do stuff like:
    *ngIf="!myThing.valid && myThing.touched"
  2. For radio buttons, just have one button inside of an *ngFor driven from an array of options. Put ngModel inside the radio button's tag.
  3. this.myForm.setValue({}) is going to set everything on a form with a default value. You do not use it as shown here with an empty object, but instead the object needs to be representative of the shape of the form with objects nested in groups nested in subobjects, etc. this.myForm.form.patchValue({}) in contrast only sets values for the fields specified and not everything.
  4. let x = this.myForm.value.emailAddress; is an example of fishing stuff back out of a form.
  5. this.myForm.reset(); is going to clear out the values and also reset states like valid and touched to their defaults.

Don't know much about middleware? Maybe you don't have to.

I have been to a few .NET Core talks now that exposition middleware, how it works at its most minimum and then progressively how you build rungs on your ladder until you have functioning MVC endpoints to interface with in much the same way René Descartes starts with the "I think therefore I am" cogito and then works his way up to the Catholic Church's worldview in building on top of his own building blocks. Or, then again, maybe it's nothing like that and I'm just giving a goofy analogy. Anyhow... who cares? You really won't have to think about this all that much. When you make a new project in Visual Studio 2017 and pick "ASP.NET Core Web Application (.NET Core)" you will then get three options in a second step:

  1. Empty
  2. Web API
  3. Web Application

I guess you could pick the Empty option and then build up your stuff, but why would you? If you pick Web API you'll start out with a functioning app with a Controller and you may always just click on the Controllers folder and pick: Add > Controller...

Just as a Catholic is unlikely to go about his day thinking of the distinction between Descartes' divide been the phenomenal (what we may know for sure, example: cogito) and the noumenal (what is unprovable) with regards to whether or not there is a God or whether or not belief requires faith... or was that Immanuel Kant who came up with this distinction? I digress. You mostly don't need to think about the middleware. The one exception is that you need to be able to turn on CORS as suggested here.

Friday, August 4, 2017

How do I check what the current route is in an Angular 4 app to conditionally hide and show stuff at an ever-present header or sidebar component?

At your component you will have to have this import:

import { ActivatedRoute } from '@angular/router';

 
 

Loop the import in at the constructor's signature like so:

public whereAmi: ActivatedRoute

 
 

Use it like this:

isToDisplayCompanyDropdown():boolean{
   if(this.whereAmi.snapshot.firstChild.url[0].path == 'generic-gunk'){
      return false;
   }
   return true;
}

 
 

As you might imagine you could use isToDisplayCompanyDropdown() in the template in an *ngIf inline in an ng-container wrapping a dropdown list of companies.

setTimeout is of super lazy, bad JavaScript coding.

If you cannot use a callback/promise set an interval or timer that loops against a low number of ticks like five hundred (a half of a second) and then cleans itself up once it affirms that the thing it was waiting on has happened. Do not just wait a long time and then assume the thing you were waiting on has happened like this:

doSomethingAsynchronous();
setTimeout(function(){ goOnToTheNextThing(); }, 3000);

Wednesday, August 2, 2017

In Angular 4, how to a force a form to a dirty state?

If f is a FormGroup then...

this.f.dirty = true;

 
 

...will not work for setting the FormGroup's dirty flag manually. This will cause compilation errors in TypeScript as dirty is a private field. The way to do this act the right way is like so:

this.f.markAsDirty();

Tuesday, August 1, 2017

If you're an SAP professional and you're not a poser, you have to be able to work with version 4 and it goes back to 1989.

I am paraphrasing this quote which was given to me by an SAP professional who can work with the stuff from 1989, and I do not know if this statement is true. I thought of it today as I saw the 1989 set movie "Atomic Blonde" for the second time last night (which everyone should run out and see in the theaters this week before it's gone) and, a little after midnight, technically inside of today, when the credits rolled, they were faked as if to look like a dump from a file on a computer from that 1989 era. This code was put on the screen before the credits started up.

The film is a spy movie with a lot more great music than you'd expect from a spy movie set in Berlin during the fall of the wall which had stood for twenty-eight years. Now another twenty-eight years have passed and I guess it is time for some nostalgia. The first thing I did at work today was set up a new account in a new (to me) Microsoft Office 365 environment and in diving out of 1989 and back into more modern modernity I felt no nostalgia for twenty-eight years ago.

I once did an interview at Dovetail back when their entire business model was support for an old CMS called Clarify which existed before the world wide web and was made to just run on a PC somewhere and I guess be interfaced with via DOS. Luckily I did not get this gig. Yeesh. When I think about what it would be like to have to work with even Access or Cold Fusion or Flash again it's not a pleasant thought. Give me the modern times. It does give me a moment of Virginia Slims (You've come a long way, baby.) perspective. So much as changed. Does anyone even remember Virginia Slims? ...or smoke anymore?

 
 

Addendum 8/2/2017: I guess the code I do not recognize from 1989 is fake code. Who has commands ending in underscores butting up against magic strings without a space between? Awesome! While I am thinking about it, a playlist from the movie is given here.