Skip to content

Instantly share code, notes, and snippets.

View Tomamais's full-sized avatar

Tomás Tomamais

View GitHub Profile
<#
.SYNOPSIS
Reads a tab-separated .NET Core log file, displays it in a custom Windows Forms DataGridView,
and provides a refresh button. Rows are color-coded based on the LogLevel.
.NOTES
This script requires a Windows OS environment to load the System.Windows.Forms and System.Drawing assemblies.
#>
param(
[Parameter(Mandatory=$true)]
<#
.SYNOPSIS
Reads, parses, and displays a tab-separated log file in a filterable grid view,
ordered by the most recent log entries.
#>
param(
[Parameter(Mandatory=$true)]
[string]$LogFilePath
)
-- Enable OLE Automation Procedures if not already enabled.
-- This is a server-wide setting and has security implications.
-- EXEC sp_configure 'Ole Automation Procedures', 1;
-- RECONFIGURE;
-- GO
-- Declare variables for the HTTP request
DECLARE @url VARCHAR(255) = 'http://www.dneonline.com/calculator.asmx'; -- Example SOAP service URL
DECLARE @soapAction VARCHAR(255) = 'http://tempuri.org/Add'; -- The SOAPAction header for the method
DECLARE @xmlPayload NVARCHAR(MAX); -- The XML payload for the SOAP request
using System;
using Oracle.ManagedDataAccess.Client;
using OfficeOpenXml;
using System.IO;
namespace OracleConnectionExample
{
class Program
{
static void Main(string[] args)
Sub ConnectToOracle()
Dim conn As Object
Dim cmd As Object
Dim rs As Object
Dim connString As String
Dim sqlQuery As String
Dim paramValue As String
' Set connection string
connString = "Provider=MSDAORA;Data Source=YourOracleDB;User ID=YourUsername;Password=YourPassword;"
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
class DatabaseSyncApp
{
static string sourceConnectionString = "your_source_connection_string";
static string destinationConnectionString = "your_destination_connection_string";
Function FuzzyPercent(ByVal String1 As String, _
ByVal String2 As String, _
Optional Algorithm As Integer = 3, _
Optional Normalised As Boolean = False) As Single
'*************************************
'** Return a % match on two strings **
'*************************************
Dim intLen1 As Integer, intLen2 As Integer
Dim intCurLen As Integer
Dim intTo As Integer
CREATE FUNCTION dbo.FuzzyPercent
(
@String1 NVARCHAR(MAX),
@String2 NVARCHAR(MAX),
@Algorithm INT = 3,
@Normalised BIT = 0
)
RETURNS FLOAT
AS
BEGIN
CREATE FUNCTION dbo.CompareString
(
@keyString NVARCHAR(MAX),
@ansString NVARCHAR(MAX),
@Normalised BIT = 0
)
RETURNS NVARCHAR(MAX)
AS
BEGIN
-- Tested on SQL Server 2019
DECLARE @inputString NVARCHAR(100) = '1,3,2,4,2';
SELECT STUFF((
SELECT ',' + CAST(value AS NVARCHAR(MAX))
FROM STRING_SPLIT(@inputString, ',')
ORDER BY CAST(value AS INT)
FOR XML PATH('')
), 1, 1, '') AS SortedString;