Shane Bartholomeusz

Geek and lover of all things tech related

How To: Handle Line Endings with Git

Overview

Git is an incredibly powerful version control system with a myriad of features and capabilities, including the ability to work across various OS platforms, including Windows and Unix.

I recently started working on a project along with several other developers using various operating system platforms. We came across an issue relating to the handling of LF / CRLF line ending characters between the various operating system platforms.

In this article we’ll take a look at how to deal with line ending characters in git.

GitHub Icon
Continue reading

Solved: Dotnet EF CLI ‘Could not execute’ Error

dotnet logo

Problem

The ‘dotnet ef’ CLI command enables developers to work with Entity Framework Core (EF Core) database operations from the standard dotnet command line.

Recently I came across the below error whilst trying to run the ‘dotnet ef’ CLI commands:

$ dotnet ef
Could not execute because the specified command or file was not found.
Possible reasons for this include:
  * You misspelled a built-in dotnet command.
  * You intended to execute a .NET program, but dotnet-ef does not exist.
  * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.

If you have also encountered this error whilst using the Entity Framework commands via the dotnet CLI, then you’re in luck because I’ll be sharing the fix in this article.

Continue reading

Solved: Cognitive Services – Operation returned an invalid status code ‘Unauthorized’

Problem

The Azure Cognitive Services SDK is a set of pre-built services that enable developers to easily and quickly integrate AI capabilities into their applications. It provides a wide range of cognitive services including computer vision, language understanding, speech, and search APIs.

Recently whilst using the Azure Cognitive Services SDK recently, I encountered the below error while trying to consume the Cognitive Services Computer Vision API using the Dotnet SDK.

If you’ve also encountered the same error then you are in luck, because in this post I’ll share the solution that worked for me.

Operation returned an invalid status code ‘Unauthorized’

Continue reading

Quick Tip: VS Code Restore Previous File Version

Overview

Have you ever found yourself in a situation where you’ve modified a local code file and needed to revert back to a previously saved local version that was not committed to your Git repo?

If you’re a user of Visual Studio Code you’re in luck because I’ll show you how to do just that …

VS Code Icon
Continue reading

How To: Disable Win 11 “Show more options” context menu

Overview

Moving from Windows 10 to Windows 11 was largely a painless experience for me however like any new major Windows release it has its share of interesting quirks however there was one particular quirk that I’ll show you how to fix in this post.

Windows 11 by default will show a slimmed-down Windows Explorer context menu, with an option to expand the menu to “Show more options”. While at first, I did welcome the change, over time it became a bit of an annoyance and a real productivity killer because it meant I had to perform an extra click for no tangible benefit.

In this post, I’ll show you how to disable the “Show more options” feature of Windows 11.

Windows 11 Context Menu Screenshot
Continue reading

How To: Generate Swagger REST API Client

Overview

As the web continues to grow and evolve, API’s are where all the magic happens that powers this innovation. REST API’s have become increasingly more favoured by developers for their ease of use over other alternatives (XML I’m looking at you).

Unfortunately, REST API’s can sometimes become a bit unwieldy in terms of documenting them, and consuming them. It is for this reason that Swagger was born! Swagger will autogenerate documentation for your REST API in the form of an Open API specification (swagger.json) document (formerly Swagger Specification). This makes it much easier for developers to understand and consume an API.

Third-party developers can then use the swagger.json specification file to either manually create an API client or auto-generate one for the preferred language of choice.

In this post, I’ll show you how to autogenerate a C# REST API client from a swagger.json in a few easy steps.

Swagger Logo
Continue reading

Solved: Google Drive Stuck Uploading Files

Problem

Recently I came across an unusual issue where Google Drive was continually getting stuck uploading files on my Android Samsung Galaxy S20 smartphone device.

In this article, I’ll share the solution that worked for me, plus other possible solutions.

Google Drive Stuck Screenshot
Continue reading

Solved: Angular – Invalid version: “15.2-15.3”

Problem

Whilst working on a new Angular project I recently came across an unusual error when trying to build a new project generated through the Angular CLI.

In this post, I’ll explain how I resolved this issue.

> ng build

√ Browser application bundle generation complete.
An unhandled exception occurred: Transform failed with 1 error:
error: Invalid version: “15.2-15.3”
See “XXXXXX\angular-errors.log” for further details.

Angular logo
Continue reading

Power Automate: Remove End of Line Characters

Problem

Parsing text can be somewhat tricky with Microsoft Power Automate or Azure Logic Apps. Recently I needed to strip out end-of-line characters (CR/LF) from a text string.

This task actually proved to be a bit more challenging than I had expected… However in this post I’ll share the solution that I found and ultimately ended up using.

Power Automate Logo
Continue reading

Solved: Why Async/Await does not work with .forEach

The Problem

Javascript offers a number of different ways to iterate over an array. Recently while using the array.forEach syntax, I came across some interesting behaviour when using them with the async/await syntax.

To demonstrate. Lets take the following Javascript code which simply prints some messages to the console every 2 seconds.

Javascript Icon
function waitForTwoSecs(i) {
  return new Promise(resolve => {
    setTimeout(() => {
      console.log(`loop iteration ${i}`); 
      resolve('resolved');
    }, 2000);
  });
}

async function mainProgram() {
  const loopIterations = [1, 2, 3];
  console.log('mainProgram Start');

  loopIterations.forEach(async iteration =>  {
    const result = await waitForTwoSecs(iteration);
  });

  console.log('mainProgram finished'); 
}

mainProgram();
Continue reading
« Older posts

© 2023 Shane Bartholomeusz

Theme by Anders NorenUp ↑