Skip to content

Instantly share code, notes, and snippets.

@k-maru
k-maru / format.cs
Last active April 16, 2024 00:47
T-SQL Format C# Code
class Program {
static void Main(string[] args) {
var query = "select A.ID, A.NAME from (select ID, NAME from BAR) A where A.ID = '1'";
var parser = new TSql120Parser(false);
IList<ParseError> errors;
var parsedQuery = parser.Parse(new StringReader(query), out errors);
if (errors.Count > 0) {
foreach (var err in errors) {
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(err.Message);
@patpawlowski
patpawlowski / RTF2TXTfn.sql
Last active February 14, 2024 16:00
VERY simple SQL RTF to TXT converter primarily to convert Act notes to plain text
/*
Written by: patpawlowski
Created On: Oct 26, 2015 at 4:51:52 PM
Description: This is a rough attempt to create a funciton to strip the markup from
the Act TBL_NOTE.NOTETEXT field. It appears to work for what I need
but could probably use some work with the escaped characters.
It's not particularly fast but it is faster than other solutions I've come
across. It takes about 4 seconds to parse 2700 records.
@SteveSandersonMS
SteveSandersonMS / blazor-error-handling.md
Last active April 10, 2024 13:26
Error handling in Server-Side Blazor

Error handling in Server-Side Blazor

Developers building Blazor applications should be aware of how the framework deals with exceptions, and what steps to take in order to maximize reliability and to detect and diagnose errors.

To recap, server-side Blazor is a stateful framework. For as long as users are interacting with your application, they maintain a connection to the server known as a circuit. The circuit holds all the active component instances, plus many other aspects of state such as the components' most recent render output and the current set of event-handling delegates that could be triggered by client-side events. If a user opens your application in multiple browser tabs, then they have multiple independent circuits.

As a high-level principle, Blazor treats most unhandled exceptions as fatal to that circuit. If a circuit is terminated due to an unhandled exception, the user can only continue by reloading the page to create a new circuit and starting again, although other circuits (e.g., th

using System;
using System.Collections.Generic;
using System.IO;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;
namespace RayCastTalkDemo
{
class Program
{