How to start using .NET Background Services
Windows UI Library in the Windows App SDK (WinUI 3)
Windows Application Packaging
- StackOverflow: What is Windows Application Packaging Project for?
- Deployment overview
- Packaged, Unpackaged and Self-Contained WinUI 3 Apps with the Windows App Sdk
- MSIX: The Modern Way to Deploy Desktop Apps on Windows
- MSIX: Probably you don't know, but you are already using it
- Features that require package identity
- Integrate your desktop app with Windows using packaging extensions
Messenger
.NET Configuration
Where did Microservices go
JS for ZenStack(Prisma Catalyst For Full-stack Development):
“When I transitioned from the backend development world to the full-stack world in 2021, I found that all the buzz from the popular stack like Next.js, Prisma, and tRPC seems to be around monolithic, people were no longer talking about the microservices.”
Adding Context Menu Entries to Windows Explorer
Add registry entries for folder and background context menu items
Add/Remove Tabs Dynamically in WPF
Using the contents of a file to define an MSBuild property
All About Span: Exploring a New .NET Mainstay
Upgrading your .NET projects with Visual Studio
How to disable Bing button in Microsoft Edge?
- Create
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Edge
Key - Create
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Edge\HubsSidebarEnabled
DWORD - Open
edge://policy/
in Edge and clickReload Policies
to check setting applied
How to Sign PowerShell Script (And Effectively Run It)
CRLF vs. LF: Normalizing Line Endings in Git
Solving common problems with Kubernetes
File Handling in Xamarin.Forms
SVG Tutorial
Using paint.net from Microsoft Store in Visual Studio 'Open With' dialog
Program: explorer.exe
Arguments: paintdotnet:%1
Friendly Name: paint.net
How to Monitor UPS with Raspberry Pi
Managing Gists Locally
Or change the name of the target folder during the clone:-
My Naturewatch Camera - Download All
scp –r pi@mynaturewatchcamera:/home/pi/NaturewatchCameraServer/naturewatch_camera_server/static/data ~/Desktop/data
Commonly-supported Windows shortcuts for pasting without formatting
Paste plain text in MS Office ALT, H, V, T consecutively
Custom <kbd> style for Jekyll/Github Pages
ReaderWriterLockSlim Class
Async Programming - Brownfield Async Development
Xamarin Forms Custom Controls Tips And Tricks
Xamarin Forms Themes And Styles
Introducing .NET MAUI
String to Lines
Multiple Command Parameters
Jekyll
Windows Application Installation File Locations Reminder
- %PROGRAMFILES%
- %PROGRAMFILES(x86)%
- %APPDATA%
- %LOCALAPPDATA%
- %USERPROFILE%
- %PROGRAMDATA%
Chrome Extension - How to Scrape Data from a List of Pages
Interactive Unit Testing with .NET Core and VS Code
Using VS Code with a Legacy .NET Project
.NET Dependency Injection using Microsoft.Extensions.DependencyInjection
C# Async Tips & Tricks
Async Main and Single Threaded Apartment
Windows Portable Devices
Keeping PowerShell Up-to-date
Via Visual Studio Code
- Install ms-vscode.powershell extension.
- Integrated console will load and prompt to update if available.
- On MacOS, Homebrew may complain and require
brew upgrade --cask powershell
be run instead
Python 2.7 Unicode Support
Check for a Python 2.7 module
Parsing HTML in Python 2.7
Adding simple email address obfuscation for your blog like Cloudflare Scrape Shield
How to use Configuration API in .NET Core Console Application
Many-to-Many Relationships in EF Core 2.0
Xamarin Pop-up Form
LINQ Group by Month, Sum and Count
Bing Maps
Android App Data Files
WPF ItemsControl
UWP Tile Notification
UWP Background Tasks
PowerShell vCard split
Hex <--> int
Entity Framework
- EF doesn’t support unsigned types. Use long for uint.
[DatabaseGenerated(DatabaseGeneratedOption.None)]
attribute to turn off auto generated keys.DbContext.Table.RemoveRange(from c in DbContext.Table select c)
to clear table. Or((IObjectContextAdapter)DbContext).ObjectContext.ExecuteStoreCommand("TRUNCATE TABLE [Table]")
for quick and dirty.[Key]
attribute to define primary key- Use
[Table("[Table]")]
on class for table name
- https://msdn.microsoft.com/en-us/library/jj193542%28v=vs.113%29.aspx?f=255&MSPPError=-2147217396
- https://stackoverflow.com/a/20184709/146360
- https://msdn.microsoft.com/en-us/library/jj591583%28v=vs.113%29.aspx?f=255&MSPPError=-2147217396
- https://stackoverflow.com/a/21885745/146360
- https://msdn.microsoft.com/en-us/library/jj200620%28v=vs.113%29.aspx?f=255&MSPPError=-2147217396
- https://stackoverflow.com/questions/20203492/entitytype-has-no-key-defined-error
- https://social.msdn.microsoft.com/Forums/en-US/648f9f5f-b844-48cb-85c3-74c8f2ee87cc/entity-framework-code-first-stop-autoincrement-and-use-my-primary-key?forum=adodotnetentityframework
- https://stackoverflow.com/questions/26303631/how-to-use-unsigned-int-long-types-with-entity-framework
App Custom Maps
UWP Logging
- https://stackoverflow.com/questions/32886613/logger-for-windows-10-uwp-app
- https://github.com/serilog/serilog
- https://docs.microsoft.com/en-us/windows/uwp/monetize/log-custom-events-for-dev-center
- https://github.com/Fody/Anotar
- https://stackoverflow.com/questions/30543689/how-to-use-serilog-with-unity
Using async keyword in windows runtime components
Creating a background task for a UWP app requires a Windows Runtime Component as host
(for out-of-process background tasks). Among the limitations for creating Windows Runtime Components is the inability to expose Task and Task<TResult> as part of the signature of a public method.
- StackOverflow: Async Calls in UWP Background Application
- MSDN: Exposing .NET tasks as WinRT asynchronous operations
- Asynchronous programming with async and await (C#) - Return types and parameters
- Creating Windows Runtime Components in C# and Visual Basic - Asynchronous operations
Removing characters which are not allowed in Windows filenames
Regex illegalInFileName = new Regex(@"[\\/:*?""<>|]");
string myString = illegalInFileName.Replace(myString, "");
Removing characters which are not allowed in Windows filenames
SyndicationClient.RetrieveFeedAsync returning error
var client = new SyndicationClient();
client.SetRequestHeader("accept", "text/html, application/xhtml+xml, */*");
client.SetRequestHeader("user-agent", "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)");
UWP Localisation
XAML Styles
UWP File Access
- https://docs.microsoft.com/en-us/windows/uwp/files/fast-file-properties
- https://docs.microsoft.com/en-us/uwp/api/windows.storage.storagefile.properties
- https://docs.microsoft.com/en-us/windows/uwp/files/quickstart-managing-folders-in-the-music-pictures-and-videos-libraries
- https://docs.microsoft.com/en-us/uwp/api/windows.storage.search.queryoptions
- https://docs.microsoft.com/en-us/uwp/api/windows.storage.storagefolder
Xamarin Auth
Xamarin Android Context
StackOverflow: Bind two checboxes to a nullable bool property in MVVM
UWP Icons
UWP Device Enumeration
UWP Background Transfer API
Grid View Item Templates
Events with async/await
Xamarin Dropbox
- https://www.dropboxforum.com/t5/API-Support-Feedback/OAuth2-0-throws-invalid-grant-type-message-while-fetching-the/td-p/268801
- https://trevorhartsblog.com/2018/03/05/xamarin-android-dropbox-api-v2/
- https://www.dropboxforum.com/t5/API-Support-Feedback/How-do-I-set-the-Redirect-URI-port-number/td-p/243556
- https://stackoverflow.com/questions/41525569/xamarin-equivalent-to-webauthenticationbroker-getcurrentapplicationcallbackuri
- https://github.com/dropbox/dropbox-sdk-dotnet
Xamarin Azure
Xamarin UWP Debug
‘In the Core Project (.NET Standard Project) Properties > Compilation > Advanced > Select “PDB Only”’
Xamarin Navigation
ILMerge
Doesn’t work with .NET Core dlls due to pdb format
- https://peteris.rocks/blog/merging-net-assemblies-with-msbuild/
- https://github.com/Microsoft/ILMerge
- https://stackoverflow.com/questions/10137937/merge-dll-into-exe
- http://dotnettower.blogspot.co.uk/2014/12/visual-studio-post-build-event.html
- https://stackoverflow.com/questions/2556048/how-to-integrate-ilmerge-into-visual-studio-build-process-to-merge-assemblies
- https://github.com/Microsoft/ILMerge/issues/11
- https://stackoverflow.com/questions/3106855/build-with-ilmerge-error
Custom domains on GitHub Pages gain support for HTTPS | The GitHub Blog
Common UI Patterns in Xamarin Forms – Part 2 – Tabbed Pages
Creating a hamburger menu in Xamarin.Forms
Xamarin Forms Toolbar
Xamarin Custom Controls
Xamarin FontSize
Xamarin
Xamarin Icons
Wpf Togglebutton
Using WPF styles
WPF ProgressBar
Observable
ListView.ItemContainerStyle
StackOverflow: How to use binding in the ListBox’s Items to the ViewModel’s properties
Uwp Navigation
"Disabled" TextBlock
CollectionViewSource
CSS Truncate Text
StackOverflow: Superscript in CSS only?
StackOverflow: String format using UWP and x:Bind
CSS Tables
CSS List
CSS Layout
CSS Background
C# Rx Socket
LINQ Join
Wpf Could not load file or assembly System.Net.Sockets
Add to wpf project file
<PropertyGroup>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
</PropertyGroup>
WPF Page in Frame
<Frame>
<Frame.Content>
<Page/>
</Frame.Content>
</Frame>
WPF Localisation
- http://putridparrot.com/blog/localizing-a-wpf-application-using-locbaml/
- https://docs.microsoft.com/en-us/dotnet/framework/wpf/advanced/wpf-globalization-and-localization-overview
- https://wpf.2000things.com/2014/07/28/1123-localization-iv-download-and-build-the-locbaml-tool/
- https://docs.microsoft.com/en-us/dotnet/framework/wpf/advanced/how-to-localize-an-application
- https://wpf.2000things.com/2014/07/24/1121-localization-ii-assigning-uids-to-all-localizable-elements/
StackOverflow: C# String Format for hours and minutes from decimal
XAML Binding
UWP ComboBox
UWP Adaptive Layout
Async/Await
- StackOverflow: The application called an interface that was marshalled for a different thread - Windows Store App
- StackOverflow: The application called an interface that was marshalled for a different thread in window 8
- StackOverflow: using await inside setters
- StackOverflow: Passing an *Awaitable* Anonymous Function as a Parameter
- StackOverflow: Correct way to get the CoreDispatcher in a Windows Store app
XAML Relative Binding
UWP Pivot
Recommendations and best practices for implementing MVVM and XAML/.NET applications
UWP use StreamSocket instead of TcpClient
When accessing a remote port from a UWP app, using TcpClient, an ExtendedSocketException ‘An attempt was made to access a socket in a way forbidden by its access permissions’ is thrown.
LINQ Expression error handling
No straightforward way of adding exception handling to a LINQ expression using query syntax.
C# UDP
UWP CollectionViewSource Notes
- ListView/ObservableCollection Sorting/Filtering/Grouping Examples?
- StackOverflow: UWP ObservableCollection sorting and grouping
- ListViews and The Task Store in a Universal Windows App
- Filtering and Sorting a ListView in a UWP – Part 1 – The UX
- Filtering and Sorting a ListView in a UWP – Part 2 – The Code
UWP Multi-line TextBox
UWP AppBarButton Focus
Stretch UWP MasterDetailsView ListViewItems to full width
Mark .NET application to run as Administrator
Add an app.manifest file to the Project and use the System.Security.Principal
namespace to check at runtime whether privileges have been provided.
- StackOverflow: How do I force my .NET application to run as administrator?
- Designing UAC Applications for Windows Vista: Step 6
- StackOverflow: UAC need for console application
- StackOverflow: Difference between “highestAvailable” and “requireAdministrator” in manifest in terms of Elevation?
Populate a UWP ComboBox from an Enum
Or rather, dont.
- StackOverflow: ComboBox with localizable ComboBoxItems specified in XAML
- StackOverflow: Bind UWP ComboBox ItemsSource to Enum
- StackOverflow: UWP ComboBox not populating with bound value
- StackOverflow: How to bind an enum to a combobox control in WPF?
Creating a UWP Project with the Windows Template Studio
Soldering
Via @zekjur
Azure API Management - SOAP to REST
UI described in post is already out-of-date. Azure interface setup is fussy with no detailed error messages.
Chrome Extension: No StackOverflow Hot Network Questions
Simple chrome extension to hide distracting sidebar elements on StackOverflow.
Hide StackOverflow "Hot Network Questions" in Chrome
With the side effect of learning how to create simple Chrome extensions. This answer assumes you want to see them on other StackExchange sites.
Extract info from a web page using JavaScript
Xml Manipulation using PowerShell
Csv Manipulation using PowerShell
My Bash on Windows Dev Environment
Running the Pebble SDK on Windows
PowerShell Image Module
Accessing a Powershell Class Defined in a Module from Outside a Module
Introduction to PowerShell 5 Classes
Gist Tag for Jekyll
Requires a local (i.e. non-GitHub) build.
Edit Jpeg Metadata
List Jpeg Metadata
AsyncLazy<T>: Part 2
AsyncLazy<T>: Part 1
Interop with Other Asynchronous Patterns and Types
Lazy Initialization
Build a Lightweight Dev Rig for Running Windows Docker Containers
Making a new year
jot -w 2017/%02d 12 | xargs mkdir -p
How to check if a Git pull is needed
Automate Heathergraph Update from GitHub
For heathergraph, based on How to check if a Git pull is needed. Makes a bit of a mess of logging to console but does the job.
Heathergraph: Raspberry Pi Email Print Server
Python based text email print server for Raspberry Pi and Pipsta
Stanford Python
Python Logging HOWTO
How To Add a Reset Switch To Your Raspberry Pi
Building Visual Studio Code on a Raspberry Pi 3
Expand a t.co url using curl
curl -I <url>
Create a Simple Python Server on Raspberry Pi
Raspberry Pi Email Server
Extract emails from Gmail with Python via IMAP
- Very basic example of using Python and IMAP to iterate over emails in a gmail folder/label
- Google App Passwords
- Python Imaplib: Get new gmail mails without reconnect
- Python : How to parse the Body from a raw email, given that raw email does not have a 'Body' tag or anything
- How to check whether IMAP-IDLE works?
- Reliable IMAP synchronization with IDLE support
- Python — imaplib IMAP example with Gmail
Setup Ruby On Rails on Windows 10
Using the Raspberry Pi Camera module with Motion
Add bcm2835-v4l2
to /etc/modules
Build a Motion Capture Security System Using a Raspberry Pi
Installing Node v4 on Ubuntu on Windows from NodeSource
Troubleshooting VNC Server on the Raspberry Pi
Connecting the Raspberry Pi to an old (or not so) VGA monitor
Jekyll on Bash on Ubuntu on Windows
Resetting Ubuntu on Windows
After you inevitably break your Windows Subsystem for Linux you can ‘factory reset’ it (including the file system) by running the following from an elevated Windows command prompt.
sudo: unable to to resolve host error
On all my Ubuntu on Windows installs to date I’ve initially got a sudo: unable to resolve host [PCNAME]
error when running a command with sudo.
- Error message when I run sudo: unable to resolve host (none)
- What is difference between localhost address 127.0.0.1 and 127.0.1.1
- Error 0x80070490 after modifying /etc/hosts from Windows
Bash on Windows as Integrated Terminal in Visual Studio Code
Bash for the Code Throne
Monitoring the Windows Clipboard
From Windows Vista onwards Microsoft have provided API functions to monitor changes to the Clipboard.
- Fluxbytes: Monitor for clipboard changes using AddClipboardFormatListener
- Microsoft: Clipboard Functions
Dropbox Windows Folder Path
The Dropbox folder path is stored in info.json in the Dropbox Application Data and Local Application Data folders.
- Dropbox: How can I programmatically find the Dropbox folder paths?
- Stack Overflow: How do I programmatically locate my Dropbox folder using C#?
Emailing documents in Office 2016 using VBA
Historically the default ‘Email’ button in Word/Excel had some limitations that made it mostly unusable. It’s tendency not to save messages to ‘Sent Items’ being it’s worst fault, but also the default Subject and Body content weren’t great. To get around these limitations I’d been using a custom ‘Email Document’ button attached to an ‘EmailDocument’ macro. After upgrading to Office 2016 this stopped working.
Old School PC Fonts
Fonts for the Font god
External Posts In Jekyll
Not compatible with having next/previous post links but potential improvement coming from rss feed/twitter.
Used a variation on this to create redirects for post and project links.
Pebble Watchface: InR-DOS
Read MorePebble Watchface: Weather
Copy of pebble-examples/pebblekit-js-weather with additional functionality.
How to C in 2016
The first rule of C is don’t write C if you can avoid it.
Using Tags In A Jekyll Blog On Github Pages
Revisited creating a tags page for this blog. Pretty straightforward apart from having to correct all of the post tag formats.
Petzold Code
Code by Charles Petzold is an excellent read, “a unique exploration into bits, bytes, and the inner workings of computers”. I thought it would be interesting to write an application to generate the combination of Braille, Morse and Binary found on the cover for any text input. I assumed someone would have done this already as the book is now a good 15 years old. If they have I couldn’t find it.
Fixing Windows 10 File Explorer Quick access
My desktop pc stopped showing any contents for Quick access in File Explorer a couple of days ago. Reddit provides various suggestions.
This PC
When Windows 8.1 came out Computer
in the Windows Explorer Navigation Pane was renamed to This PC
and a load of User folder links were added to it.
Tags in Jekyll
Has to be pre-compiled for GitHub pages sadly. Four years old so maybe it’s supported now. This is a To-Do reminder really.
Outlook 2013 not sending emails since Windows 10 upgrade
The solution suggested on various forums is to run ‘sfc /scannow’ from an Administrator Command Prompt and then restart Outlook.
Simple Listbox Ordering using a CollectionViewSource
As with most xaml based apps there are any number of ways of ordering a list of items. A quick and straightforward way to do this entirely in xaml is to use a CollectionViewSource.
Embedding Gists in Jekyll Posts
Having had middling success including code in posts here I wondered whether it was possible to embed gists instead of relying on markdown and css.
Cloud Storage Windows Folder Paths
Read MoreUseful Visual Studio Solution and Project Posts
A couple of posts from Kirill Osenkov on Visual Studio Solution and Project configuration.
TextBlock StringFormat Support in Windows Phone 8.1 Projects
In trying to create a custom control for a Windows Phone 8.1 project I was having an odd problem where StringFormat didn’t seem to be supported by the TextBlock control Text property any more so the following “Unsupported” style raised an error against StringFormat=T:
The Post Title Is The File Name
And the Front Matter ‘title’ variable overrides it the same as the ‘date’ variable. Which makes sense if you think about it.
Removing Local Font Awesome Files
Jekyll Now didn’t include support for Font Awesome icons so I ha(a?)cked them in by copying the method used by Haacked.
Installing Jekyll On Raspberry Pi
Posted From The Post Link
Test post using the “Post” link at the top of the page.
Read.md Markdown Parser
Rough and ready parser for read.md using RegEx for read.md
Regex For Read.md
A regex to parse read.md
Post From My Phone
GitHub, not unreasonably, has a read-only mobile site. Writing this on the desktop site on my phone is fairly awful. Even ignoring my terrible memory wrt the header values.
Post from my iPad
Bit of a cheat as I’ve just done the phone post and so therefore can just about remember all the criteria for a valid post. Maybe try again later and see how that goes.
Markdown Cheatsheet
(Test of external URL posts).
Setting up a blog using Jekyll on GitHub
There are various ways of doing this. This one has been done by forking the Jekyll Now repository on GitHub.