Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View joe-oli's full-sized avatar
💭
what the flock? no status to report, i am not a facebook junkie.

joe-oli

💭
what the flock? no status to report, i am not a facebook junkie.
View GitHub Profile
@joe-oli
joe-oli / Extract-Exceptions.txt
Created February 2, 2024 17:31
Extract All exception messages
catch (Exception ex)
{
tbOutput.Text = GetExceptionMessages(ex);
}
...
private string GetExceptionMessages(Exception ex)
{
var message = ex.Message;
@joe-oli
joe-oli / Hourglass-WPF.cs
Last active February 1, 2024 09:08
Hourglass in WPF
private void Button_Click(object sender, RoutedEventArgs e)
{
// Change the cursor to an hourglass
Mouse.OverrideCursor = Cursors.Wait;
try
{
// Perform the long-running operation here
// ...
@joe-oli
joe-oli / Basic-XAML
Created January 18, 2024 03:36
Basic WPF Xaml
<Window x:Class="WpfApp.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<StackPanel>
<Expander Header="Expander 1">
<UniformGrid Rows="2" Columns="2">
<Button Content="Button 1"/>
<Button Content="Button 2"/>
<Button Content="Button 3"/>
@joe-oli
joe-oli / Git-Clone.sh
Created January 3, 2024 16:33
Git Clone Single Branch Only
# change to the folder where you want to create newBranchName
git clone --single-branch --branch features/upgrade ^
C:\Projects\DevOps\MyRepoName newBranchName
# C:\Projects\DevOps\MyRepoName is the repo where the branch you want to clone resides in;
# newBranchName is relative to current folder;
@joe-oli
joe-oli / Random-ABN-digits.txt
Last active December 13, 2023 01:11
Random ABN digits (passes check-digits validation), not necessarily valid in ABR.
Random 11-digit numbers that pass the ABN algorithm:
NOT EXISTS
------------------------
18 123 456 789
EXISTS (REAL ABN's)
------------------------
46657833902
25091850654
@joe-oli
joe-oli / OpenIdConnect_Providers.txt
Created November 21, 2023 05:48
Some well-known OIDC providers
1. **Google**: Google provides OpenID Connect authentication services that can be used to authenticate users with Google accounts. You can find more information about it [here](https://developers.google.com/identity/protocols/oauth2/openid-connect).
2. **Microsoft**: Microsoft provides OpenID Connect authentication services that can be used to authenticate users with Microsoft accounts. You can find more information about it [here](https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-protocols-oidc).
OpenID Connect (OIDC) on the Microsoft identity platform.
https://learn.microsoft.com/en-us/entra/identity-platform/v2-protocols-oidc.
Set up an OpenID Connect provider | Microsoft Learn.
https://learn.microsoft.com/en-us/power-pages/security/authentication/openid-provider.
3. **Okta**: Okta is a cloud-based identity management platform that provides OpenID Connect authentication services. You can find more information about it [here](https://developer.okta.com/docs/guides/implement-openid-conn
@joe-oli
joe-oli / Azure_Bacpac_Restore.txt
Created October 19, 2023 21:50
Azure SQL databases - to Backup / Restore use SqlPackage
>SqlPackage /Action:Import /SourceFile:"C:\TEMP\MyDB.bacpac" ^
/TargetDatabaseName:MyRestoredDB ^
/TargetServerName:(localdb)\MSSQLLocalDB
Additional notes:
https://techcommunity.microsoft.com/t5/azure-sql-blog/connection-security-improvements-in-sqlpackage-161/ba-p/3672758
https://techcommunity.microsoft.com/t5/azure-database-support-blog/using-sqlpackage-to-import-or-export-sql-server-and-azure-sql-db/ba-p/368861
https://learn.microsoft.com/en-us/sql/tools/sqlpackage/sqlpackage-download?view=sql-server-ver16
@joe-oli
joe-oli / read-write-text-files.cs
Created August 17, 2023 02:38
Read / Write Text files
//Good for small files
using System;
using System.IO;
public class Example
{
public static void Main()
{
string fileName = @"C:\some\path\file.txt";
// Sure, here is the C# code to extract records from a text file as a unit, into an appropriate memory data structure which contains Title, and Description:
using System;
using System.IO;
class Record
{
public string Title { get; set; }
public string Description { get; set; }
}
<!--
Write a WPF program in C#, the main window should be divided into two columns;
The first column contains 7 checkboxes stacked vertically.
the second column has a button named btnImport (labelled 'Import'), and a textbox named tbOutput below the button to write any output messages from the import process.
Bard:: ==>
Sure, here is the WPF program in C# that you requested:
using System;
using System.Windows;