Programming

TypeScript Mixins Part Three

Posted on

Don’t worry, the mechanism for creating TypeScript mixins hasn’t changed, but I just wanted to demonstrate that the technique described in TypeScript Mixins Part Two is valid for use with static properties. Reusing the original example, let’s see what happens if we add static properties to our Flies and Climbs mixins. Not only does this […]

Programming

Who Deleted Rows from SQL Server

Posted on

Want to know who deleted rows from your SQL database? The script below joins up delete transactions with users in order to find out who just deleted something. Because this comes from the transaction log, you’ll only find stuff that is still available in there. This means it will be affected by retention/recovery modes. If […]

Programming

SQL Server: Filter and Sort Records from sp_who2

Posted on

Sometimes you need to filter and sort the records you get from sp_who2. You can’t do this directly, but you can use a temporary table to do it. — Create an intermediate table to put all the results CREATE TABLE #spootoo ( SPID INT, Status VARCHAR(1000) NULL, Login SYSNAME NULL, HostName SYSNAME NULL, BlkBy SYSNAME […]

Programming

SQL Availability Groups: Find the Primary Server

Posted on

Here is a quick SQL script that will get back information on SQL availability groups, including the role of each server. This can help you find the primary server in an availability group. IF SERVERPROPERTY (‘IsHadrEnabled’) = 1 BEGIN SELECT AvailabilityGroup.name AS AvailabilityGroupName, ReplicaClusterStates.replica_server_name as ServerName, ReplicaStates.role_desc as ReplicaRole, Listeners.dns_name as DnsName FROM sys.availability_groups_cluster AS […]

Programming

SQL Server: Quickly Find Row Counts and Table Size

Posted on

I have a script I use to find table sizes in SQL server. Sometimes, though, I need to find the rough table size of a massive table without the need for absolute precision. SQL server has a procedure for finding out the number of rows, space, and index size of a table; and it can […]

Programming

SQL Bulk Update in Batches

Posted on

When you perform a SQL bulk update, you can just press go and wait. Most humans, though, get an increasing feeling of impending doom when the clock ticks up towards several hours with no visible progress. If you are running a transaction and have other things competing for the table, you’ll start hearing about slow […]

Programming

SAML Front Channel and Back Channel Examples

Posted on

SAML is a mechanism authenticating users and authorising them for a service in cases where the identify provider is external to the service. There are three parties involved: User (or User Agent, such as a web browser) – UA Service Provider – SP Identity Provider – IdP The user agent interacts with both the Service […]