Shane Bartholomeusz

Geek and lover of all things tech related

Page 2 of 12

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

How To: Deep Clone a JavaScript Object

Overview

JavaScript is becoming ever increasingly more popular as time goes by. While JavaScript has many advantages, it also has many interesting quirks or nuances that can catch out new beginners.

In this post I’ll show you how to deep clone a JavaScript object.

Problem

Okay … before we go any further … lets take a step back and understand the problem at hand.

Objects in JavaScript are passed by reference, meaning that any object returned by a function will point to the same memory reference as the original object. Therefore if the caller of the function modifies the returned object, they will actually be changing the original source object.

Javascript Icon
Continue reading

Visual Studio: Close Current Tab Keyboard Shortcut

Overview

It’s common today to use the CTRL+W in various applications including most web browsers. If you’ve used Visual Studio you’ve probably noticed that this keyboard shortcut does not work when trying to close the currently opened tab.

In this article, I’ll show you how you can easily configure Visual Studio to close the currently opened tab.

Visual Studio Icon
Continue reading
« Older posts Newer posts »

© 2024 Shane Bartholomeusz

Theme by Anders NorenUp ↑