Tsql, Rename table

EXEC sp_rename 'schemaName.oldTableName', 'newTableName';

References:

https://docs.microsoft.com/en-us/sql/relational-databases/tables/rename-tables-database-engine

Shared by joubin on Wed Sep 23 2020

Software Test Fixture

A test fixture sets up the system under test (SUT) for the software testing process by initializing it (configuration and/or data) satisfying any preconditions the system may have.

Example: initialize a database with known parameters before running a test.

This allows for tests to be repeatable, which is one of the key features of an effective test framework.

In a non-software context, such as circuit boards, a test fixture is a setup or another device designed to hold the device under test (DUT) in place and allow it to be tested.

References:

https://en.wikipedia.org/wiki/Test_fixture

Shared by joubin on Wed Sep 21 2016

OData, Functions vs. Actions

Actions are operations exposed by an OData service that MAY have side effects when invoked. Actions MAY return data but MUST NOT be further composed with additional path segments.

Functions are operations exposed by an OData service that MUST return data and MUST have no observable side effects.

References:

https://stackoverflow.com/questions/38089753/odata-v4-what-are-functions-and-actions-in-simple-terms

Shared by joubin on Wed Aug 12 2020

TSQL - Find duplicates in a column

SELECT   {col_name},
         COUNT({col_name}) AS dupe_cnt
FROM     {table_name}
GROUP BY {col_name}
HAVING   COUNT({col_name}) > 1
ORDER BY COUNT({col_name}) DESC

Replace:

  1. {col_name} with the column name being examined
  2. {table_name} with the respective table name

Shared by joubin on Tue Jun 23 2020

COL_LENGTH

Returns the table's column length in bytes:

COL_LENGTH ( 'table' , 'column' )

References:

https://docs.microsoft.com/en-us/sql/t-sql/functions/col-length-transact-sql

Shared by joubin on Wed Apr 29 2020

Using MSI for debugging in Visual Studio

To debug against Azure (e.g. getting access to Key Vault etc.) configure Visual Studio to use the account with which it uses to send credentials to Azure.

This configuration is under: Options => Azure Service Authentication => Account Selection

References:

https://docs.microsoft.com/en-us/azure/azure-app-configuration/howto-integrate-azure-managed-service-identity?tabs=core2x

https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/overview

Shared by joubin on Fri Apr 17 2020

Azure Data Factory Trigger files

The trigger files are stored in a location similar to:

/common/workflows/datafactory/trigger/*.json

Each trigger has the following information:

  • the schedule/condition defintion
  • a collection of pipelines references

References:

https://docs.microsoft.com/en-us/azure/data-factory/concepts-pipeline-execution-triggers#schedule-trigger-definition

Shared by joubin on Fri Apr 03 2020

Roslyn & RyuJIT

Roslyn

  • The .NET Platform Compiler i.e. compiles your C# (etc) code into IL
  • Has a public API e.g. could be included in your app to compile other code on-the-fly

RyuJIT

  • Compiles the Roslyn generated IL into native code (only x64)
  • No public API available

Shared by joubin on Thu Apr 02 2020

tracert, Windows

The TRACERT diagnostic utility determines the route to a destination by sending Internet Control Message Protocol (ICMP) echo packets to the destination.

References:

https://support.microsoft.com/en-ca/help/314868/how-to-use-tracert-to-troubleshoot-tcp-ip-problems-in-windows

Shared by joubin on Tue Mar 31 2020

.NET Portability Analyzer

The .NET Portability Analyzer is an open source tool that is utitlized to analyze assemblies, files or directory of files for compatibility across .NET implementations.

This tool reports on the compatibility of the current app across .NET implementations.

It comes as:

  1. Visual Studio Extension - analyzes individual assemblies/projects or the solution
  2. A console app (ApiPort) - analyzes assemblies/files/directories

References:





Shared by joubin on Fri Sep 06 2019

Debugging modes, VS Code

In VS Code, there are two core debugging modes, Launch and Attach.

  1. Starting in the browser
    • When you open DevTools in a browser, you are attaching DevTools to the open browser tab.
  2. Starting in the code editor
    • The editor launches your process, and it automatically attaches its debugger to the newly launched process.

References:

Shared by joubin on Fri Aug 09 2019

Launch Configuration, VS Code

A configuration file allows you to configure and save debugging setup details.

VS Code keeps debugging configuration information in a launch.json file located in a .vscode folder in your workspace (project root folder)

References:

Shared by joubin on Fri Aug 09 2019

Angular Framework app version

1. ng --version (or ng v)

2. Open Developer Tools in the browser. Under the 'Elements' tab, look for html/body/app-root[ng-version]

3. To render the Angular version on a page, import VERSION from @angular/cli.

const version = VERSION.full;







Shared by joubin on Wed Jul 31 2019

Prune/Cleanup the local references to remote branch

Dry-run: The command git remote prune origin --dry-run lists branches that can be deleted/pruned on your local.

To remove the local remove '--dry-run'.

References:

Shared by joubin on Mon Jun 03 2019

OData - Querying Data

$filter: The expression specified with $filter is evaluated for each resource in the collection, and only items where the expression evaluates to true are included in the response.

serviceRoot/People?$filter=FirstName eq 'Scott'

$orderby: The $orderby system query option allows clients to request resources in either ascending order using asc or descending order using desc.

serviceRoot/People('scottketchum')/Trips?$orderby=EndsAt desc

$count: The $count system query option allows clients to request a count of the matching resources included with the resources in the response.

serviceRoot/People/$count

$select: The $select system query option allows the clients to requests a limited set of properties for each entity

serviceRoot/Airports?$select=Name, IcaoCode

$top & $skip: The $top system query option requests the number of items in the queried collection to be included in the result. The $skip query option requests the number of items in the queried collection that are to be skipped and not included in the result.

serviceRoot/People?$top=2

$expand: The $expand system query option specifies the related resources to be included in line with retrieved resources.

serviceRoot/People('keithpinckney')?$expand=Friends

Supporting multiple filters:

Use the and/or operators to apply multiple filters.

References:

http://www.odata.org/getting-started/basic-tutorial

Shared by joubin on Fri Jun 23 2017

Theory attribute, xUnit

Marks a test method as being a data theory.

Data theories are tests which are fed various bits of data from a data source, mapping to parameters on the test method.

If the data source contains multiple rows, then the test method is executed multiple times (once with each data row). Data is provided by attributes which derive from Xunit.Sdk.DataAttribute:

  • Xunit.InlineDataAttribute
  • Xunit.MemberDataAttribute

References:

https://github.com/xunit/xunit

Shared by joubin on Thu May 16 2019

Content-Disposition, Http Header

The Content-Disposition response-header field has been proposed as a means for the origin server to suggest a default filename if the user requests that the content is saved to a file.

Example:

Content-Disposition: attachment; filename="fname.csv"

Note: In the context of a CORS request, use the Access-Control-Expose-Headers Http header to expose Content-Disposition as a header value.

References:

https://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html

Shared by joubin on Thu May 16 2019

CORS related headers

All CORS related headers are prefixed with "Access-Control-".

Access-Control-Allow-Origin
Access-Control-Allow-Credentials
Access-Control-Expose-Headers

References:

https://www.html5rocks.com/en/tutorials/cors/

Shared by joubin on Thu May 16 2019

Azure Security Center

Azure Security Center (ASC) is a monitoring service that provides threat protection across all of your services both in Azure, and on-premises.

ASC is part of the Center for Internet Security (CIS) recommendations.

References:

https://docs.microsoft.com/en-us/learn/modules/top-5-security-items-to-consider/2-azure-security-center

Shared by joubin on Mon May 13 2019

Center for Internet Security

The Center for Internet Security (CIS) is a nonprofit organization, formed in October, 2000.

Its mission is to "identify, develop, validate, promote, and sustain best practice solutions for cyber defense and build and lead communities to enable an environment of trust in cyberspace".

The organization is headquartered in East Greenbush, New York, with members including large corporations, government agencies, and academic institutions.

References:

https://en.wikipedia.org/wiki/Center_for_Internet_Security

Shared by joubin on Mon May 13 2019