Joseph Michael Pesch
VP Programming

NgCore - Angular App with Dot Net Core

by 8. September 2019 12:57

Before getting started, I recommend looking at using for Command Editor.  


  1. Angular installed globally: 
    npm install -g @angular/cli
  2. Visual Studio Code or Visual Studio Community (or other full version)
  3. Node.js v. 8.10.0 or higher ( to check current version, run command: 
    node -v

Steps to create project:

  1. Create folder for the project, in my case "NgCore"
  2. Run the following command from within the project folder:  
    ng new NgCoreApp
  3. Run the following command from withing the "NgCoreApp" folder: 
    ng build
  4. Run the app from the "dist" folder (created by the "ng build")


Angular | ASP.Net Core

by 8. September 2019 12:54



by 6. September 2019 06:20


MacBook SSD Upgrade

by 28. August 2019 11:36


Mac OS

HTML Textbox Auto Complete

by 15. August 2019 19:44



Postman Collection Runner Save Response Body to Environment Variable

by 9. August 2019 08:14

First, create an environment variable called responseData, with the value [].

Then, add the following code under 'Tests' in Builder. Postman environment variables are intended to be used as string, so we will parse the object then push the JSON responses from the API into the object array.

var jsonData = JSON.parse(responseBody); var old = pm.environment.get("responseData"); old = JSON.parse(old); // filter jsonData if needed

old.push(jsonData); old = JSON.stringify(old); pm.environment.set("responseData", old); console.log(pm.environment.get("responseData")); Now you can retrieve a nested JSON object with all the response data included by viewing the environment variables value (see example below).

Warning: you must reset the responseData value as [] after every use of Collection Runner in order to avoid keeping data from previous runs.



by 21. May 2019 12:40


Python Async without Await

by 19. May 2019 16:26

import asyncio
import time
async def px(x):
    print(x + ': ' + str(time.time()))
async def main():
    x = px('x')
    y = px('y')



Google GSuite Drive File Stream

by 19. May 2019 10:12


Local Cache Location:

  • Win: %USERPROFILE%\AppData\Local\Google\DriveFS
  • Mac: ~/Library/Application Support/Google/DriveFS



Swift IOS UITableViewCell Button

by 5. January 2019 12:40

There are two steps to add a working button to a table view cell. The first step is to add a button like this:

cell.accessoryType = .detailDisclosureButton

The second step is to take action when the button is tapped by creating the accessoryButtonTappedForRowWith method:

override func tableView(_ tableView: UITableView, accessoryButtonTappedForRowWith indexPath: IndexPath) {


XCode | iOS | Swift

xCode Support for IOS Device

by 24. November 2018 06:47

Trying to run xCode against connected iPhone and receive error message below:

Could not locate device support files. This iPhone 6s Plus is running iOS 12.0.1 (16A404), which may not be supported by this version of Xcode.


Download latest xCode from (as .xip file), extract the .app file (

Right click on latest xCode .app and select "Show Package Contents" and navigate to:


Select the required version(s) and copy to:


Look into this path as well: /Users/xxx/Library/Developer/Xcode/iOS DeviceSupport



xCode Facebook Login Integration Using CocoaPods

by 18. November 2018 09:26

Terminal window, navigated to root folder where xCode project exists and run the following commands:

  • $ sudo gem install cocoapods
  • $ pod init

This will create a file named Podfile in your project's root directory. Open the Podfile with a text editor and add the following:

  • pod 'FBSDKLoginKit'

Back in the Terminal window, run the following command:

  • $ pod install 

Register app with Facebook (follow steps in this link:

Configure the information property list file (info.plist) with an XML snippet that contains data about your app. Right-click info.plist, and choose Open As Source Code. Copy and paste the following XML snippet into the body of your file ( ...)


To use any of the Facebook dialogs (e.g., Login, Share, App Invites, etc.) that can perform an app switch to Facebook apps, your application's info.plist also needs to include:


Go to the Project Navigator in Xcode and select your project to see project settings. Select Other Linker Flags for editing. Add the flag -ObjC to Other Linker Flags for all build targets. NOTE: Use the find feature to easily locate the Other Linker Flags in the settins area.

If you still have the xCode project open close it. Open the new Workspace that should have been created in the same root folder as the project (e.g. MyApp.xcodeproj should now have a MyApp.xcworkspace partner).

Update the applications AppDelegate method to include the FBSDKLoginKit import reference and methods with FBSDKApplicationDelegate and FBSDKAppEvents (sample shown below).

import UIKit
import FBSDKLoginKit

class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.

        // FaceBook
        return FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)
    func applicationWillResignActive(_ application: UIApplication) {
        // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
        // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.

        // FaceBook
    func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
        return FBSDKApplicationDelegate.sharedInstance().application(application, open: url, sourceApplication: sourceApplication, annotation: annotation)

    func applicationDidEnterBackground(_ application: UIApplication) {
        // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
        // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.

    func applicationWillEnterForeground(_ application: UIApplication) {
        // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.

    func applicationDidBecomeActive(_ application: UIApplication) {
        // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.

    func applicationWillTerminate(_ application: UIApplication) {
        // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.


Build Project for Running to make sure everything compiles correctly.



Facebook | XCode

Hosted Site Issues with Roslyn - This program is blocked by group policy. For more information, contact your system administrator

by 9. September 2018 12:24
NOTE: Had to remove package: Microsoft.CodeDom.Providers.DotNetCompilerPlatform
      Due to hosting limitation, throwing this error:
      This program is blocked by group policy. For more information, contact your system administrator
      Cannot execute a program. The command being executed was 
              /shared /keepalive:"10" /noconfig  
              /fullpaths @"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\bd40b76f\3452b533\33n50imf.cmdline"
NOTE: See nuget url for package details:
NOTE: Some of the new C# 6.0 language features if used in Views (MVC project) will not compile. 
      Many of my views use the ? null checking operator for accessing Model properties.  
      All of these views now return errors on my Godaddy hosted MVC 5 application.
      This error occurs because Views (by default) are compiled at runtime using the .NET pipeline (not pre-compiled).
      To resolve this issue, simply uncheck the "Allow precompiled site to be updatable" option in your publish profile settings.  
      This should pre-compile your views and allow your C# 6.0 (Latest version of Roslyn Compiler) to run like a champ.



Angular 2 Compile Warning "Critical dependency: the request of a dependency is an expression"

by 28. February 2018 15:11

When compiling Angular 2 application I received compile warning "Critical dependency: the request of a dependency is an expression" when using the require() method with a variable vs. literal string value (see examples below).


This throws compile warning:

let path = 'path_to_item';

let item = require(path);


This does not throw compile warning:

let item = require('path_to_item');




Angular Component StyleUrls Not Working

by 16. February 2018 15:08

Issue with component level styles not working, import "ViewEncapsulation: from @angular/core and add encapsulation: ViewEncapsoulation.None to the @Component decorator as shown below.

import { Component, OnInit, ViewEncapsulation } from '@angular/core';


    selector: 'app-demo',

    templateUrl: './demo.component.html',

    styleUrls: ['./demo.component.css'],

    encapsulation: ViewEncapsulation.None



Angular | JavaScript | TypeScript

JavaScript/TypeScript JSON Navigate by Dotted String Path

by 16. February 2018 15:00

Navigate a JSON object by a dotted string path (e.g. "somePath.subPath.anotherSubPath").

console.log('somePath.subPath.anotherSubPath'.split('.').reduce((o, i) => o[i], jsonObject));


Angular | JavaScript | TypeScript

JavaScript/TypeScript Dotted String to Upper/Lower First Letter

by 16. February 2018 14:56

Take a dotted string (e.g. "someThing.someThingElse.another") and convert first letter of each dotted component to upper or lower case.

    dottedToUpper(str) {
        str = str.replace(/\./g, ' ');
        str = str.replace(/\w\S*/g, function (txt) {
            return txt.charAt(0).toUpperCase() + txt.substr(1);
        return str.replace(/ /g, '.');
    dottedToLower(str) {
        str = str.replace(/\./g, ' ');
        str = str.replace(/\w\S*/g, function (txt) {
            return txt.charAt(0).toLowerCase() + txt.substr(1);
        return str.replace(/ /g, '.');


Angular | JavaScript | TypeScript

C# Name Tuple Items

by 1. February 2018 14:29

To name tuple items in C#, first install the NuGet package: Install-Package System.ValueTuple

Syntax: (string ItemName, DateTime ItemName, etc.) vs. Tuple<string, DateTime>


ASP.Net | C#

Debug Windows Service Running as Interactive Console Application

by 1. February 2018 08:40

Before running in Visual Studio change the project output type from Windows Application to Console Application.  Below is sample Program.cs code to run interactively in Visual Studio.

using System;
using System.Reflection;
using System.ServiceProcess;
using System.Threading;

namespace DemoWindowsService
    static class Program
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main()
            ServiceBase[] servicesToRun;
            servicesToRun = new ServiceBase[]
                new DemoService()
            if (Environment.UserInteractive) RunInteractive(servicesToRun);
            else ServiceBase.Run(servicesToRun);

        static void RunInteractive(ServiceBase[] servicesToRun)
            Console.WriteLine("Services running in interactive mode.");

            MethodInfo onStartMethod = typeof(ServiceBase).GetMethod("OnStart",
                BindingFlags.Instance | BindingFlags.NonPublic);
            foreach (ServiceBase service in servicesToRun)
                Console.Write("Starting {0}...", service.ServiceName);
                onStartMethod.Invoke(service, new object[] { new string[] { } });

                "Press any key to stop the services and end the process...");

            MethodInfo onStopMethod = typeof(ServiceBase).GetMethod("OnStop",
                BindingFlags.Instance | BindingFlags.NonPublic);
            foreach (ServiceBase service in servicesToRun)
                Console.Write("Stopping {0}...", service.ServiceName);
                onStopMethod.Invoke(service, null);

            Console.WriteLine("All services stopped.");
            // Keep the console alive for a few seconds to allow the user to see the message.


ASP.Net | C# | Windows Service

Mac OS Mount Windows or NAS File Share Path Using SMB/CIFS

by 11. November 2017 10:58

To mount a Windows or NAS file share path you can use either SMB or CIFS.  If you have issues using SMB try using CIFS as some versions of Mac OS have issues with SMB but work fine with CIFS.  Open the Finder window and press CMD+K to open the "Connect to Server" window.  Enter the file share path as either smb://... or cifs://...