This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Sure, here is the code for a Windows Service with the Microsoft.Extensions.Hosting.BackgroundService: | |
*/ | |
using Microsoft.Extensions.Hosting; | |
using Microsoft.Extensions.Logging; | |
using Microsoft.Extensions.Configuration; | |
using Microsoft.EntityFrameworkCore; | |
namespace MyService | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Q: explain the meaning of default in | |
private DispatcherTimer timer = default!; | |
/* | |
Bard:: | |
Sure. The default keyword in the code private DispatcherTimer timer = default!; means that the timer variable will be initialized with the default value for a DispatcherTimer object. In this case, the default value is a DispatcherTimer object that is not running and has a Interval of 0 milliseconds. | |
The default! syntax is a new feature in C# 10 that allows you to explicitly specify that the default value should be used. This is useful for preventing the compiler from inferring the wrong type for the variable. In this case, the compiler could have inferred that the timer variable is a Nullable<DispatcherTimer> object, but the default! syntax prevents this from happening. | |
Here is a breakdown of the code: | |
• private - This keyword specifies that the timer variable is private. This means that it can only be accessed by other members of the class in which it is declared. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I am annoyed as fck there is no point-and-click UI to do this; | |
Hence these notes as a reminder; | |
FIRST INSTALL via NuGet in YOUR project (NB: you may have multiple projects in the solution!) | |
a) 'Microsoft.EntityFrameworkCore.Tools'; choose same Framework version that your project will target; | |
b) 'Microsoft.EntityFrameworkCore.SqlServer'; choose the PROVIDER you want to use in the Scaffold-DbContext command. | |
++++++++ | |
0) Open the (Nuget) package manager console: Tools /NuGet PM / PM Console | |
1) **EXAMPLE**: (all on one line) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Show sample code for MyDbInitializer() | |
=> | |
Sure, here is a sample code for MyDbInitializer(): | |
*/ | |
public class MyDbInitializer : DbInitializer | |
{ | |
public override void Seed(DbContext context) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* how to use the CHECK constraint to enforce the data type and length of the AgentCode column in the Agent table: */ | |
CREATE TABLE [dbo].[Agent]( | |
[AgentID] [int] IDENTITY(1,1) NOT NULL, | |
[AgentCode] [char](8) NULL, | |
[Invalid] [bit] NULL, | |
[ExtSysAgentGuid] [uniqueidentifier] NULL, | |
[BusinessName] [nvarchar](200) NULL, | |
... | |
CONSTRAINT [CHECK_AgentCode] CHECK ([AgentCode] IS NULL OR [AgentCode] LIKE '____-____') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List ALL branches | |
>git branch | |
LIST branches by wildcard | |
>git branch --list "122160*" | |
====================== | |
CLONE A SINGLE BRANCH | |
====================== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"name": "Apple", | |
"color": "Red", | |
"taste": "Sweet" | |
}, | |
{ | |
"name": "Banana", | |
"color": "Yellow", | |
"taste": "Sweet" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dialog = new FolderBrowserDialog(); | |
dialog.ShowDialog(); | |
folderpathTB.Text = dialog.SelectedPath; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this is a giant JSON object you have received back from the Instagram API | |
// Use it for good, solely on the front end, to create a photo gallery widget! | |
const instagramResponse = { | |
"meta": { | |
"code": 200 | |
}, | |
"data": [ | |
{ | |
"attribution": null, |