Cloning a Single File from a Git Repository

history edit

Git

  1. git init
  2. git remote add origin <remote-uri>
  3. git sparse-checkout set 1
  4. git sparse-checkout add <file-path>
  5. git fetch origin main 2
  6. git checkout main
  1. This is a simpler sparse initialisation, but includes more files by default. 

  2. This will, still, download the complete repo history. 

Windows SDK to OS Version

history edit

Windows, Windows SDK

  • Windows 11
    • 10.0.26100 24H2
    • 10.0.22621 22H2
    • 10.0.22000
  • Windows 10
    • 10.0.20348 2104
    • 10.0.19041 2004
    • 10.0.18362 1903
    • 10.0.17763 1809

NuGet Packages Location Settings Precedence

history edit

NuGet

  1. NUGET_PACKAGES User environment variable
  2. NUGET_PACKAGES System environment variable
  3. %APPDATA%\NuGet\NuGet.Config file config/globalPackagesFolder setting
  4. %ProgramFiles(x86)%\NuGet\Config file config/globalPackagesFolder setting
Read More

Using a Raspberry Pi as a Print Server

history edit

Raspberry Pi, Printing, CUPS

Setting up CUPS isn’t necessary with the current Raspberry Pi OS image. Working drivers for ARM are the main problem.

paint.net plugins - Windows Store version

history edit

paint.net

Plugins are supported for the Store release. You just have to install them in a different location. Go to your Documents folder, create a folder called “paint.net App Files” (no quotes though), and then create a folder for each plugin type: Effects, FileTypes, and Shapes. And then put your plugins into each folder just like you’re used to with the Classic release. This does mean that plugins are installed per-user, mind you. This method of installation is also supported by the Classic release, by the way.

Construct your Windows app's icon

history edit

Windows, Icons

Windows 11 scale factor 100% 125% 150% 200% 250% 300% 400%
Context menu, title bar, system tray 16px 20px 24px 32px 40px 48px 64px
Taskbar, search results, Start all apps list 24px 30px 36px 48px 60px 72px 96px
Start pins 32px 40px 48px 64px 80px 96px 256px

Note

Apps should have, at the bare minimum: 16x16, 24x24, 32x32, 48x48, and 256x256.

This covers the most common icon sizes, and by providing a 256px icon, ensures Windows should only ever scale your icon down, never up.

Git Global User

history edit

Git

  • User
    • Get: git config --global user.name
    • Set: git config --global user.name {display name}
    • Clear: git config --global user.name ""
  • Email
    • Get: git config --global user.email
    • Set: git config --global user.email {email address}
    • Clear: git config --global user.email ""

try-convert Tool

history edit

.NET Framework, .NET, MSBuild, Visual Studio

Tool to migrate .NET Framework projects to .NET “Core”.

Where did Microservices go

history edit

Microservices

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.”

How to disable Bing button in Microsoft Edge?

history edit

Edge, Bing

  1. Create Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Edge Key
  2. Create Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Edge\HubsSidebarEnabled DWORD
  3. Open edge://policy/ in Edge and click Reload Policies to check setting applied

Entity Framework

history edit

Entity, Framework

  1. EF doesn’t support unsigned types. Use long for uint.
  2. [DatabaseGenerated(DatabaseGeneratedOption.None)] attribute to turn off auto generated keys.
  3. 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.
  4. [Key] attribute to define primary key
  5. Use [Table("[Table]")] on class for table name

Using async keyword in windows runtime components

history edit

C#, UWP, Async

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.

Read More

Xamarin Dropbox

history edit

Xamarin, Dropbox

Xamarin UWP Debug

history edit

UWP, Xamarin

‘In the Core Project (.NET Standard Project) Properties > Compilation > Advanced > Select “PDB Only”’

ILMerge

history edit

MSBuild, .NET Framework

Doesn’t work with .NET Core dlls due to pdb format

WPF Localisation

history edit

WPF

Mark .NET application to run as Administrator

history edit

Visual Studio, .NET, Windows

Add an app.manifest file to the Project and use the System.Security.Principal namespace to check at runtime whether privileges have been provided.

Extract emails from Gmail with Python via IMAP

history edit

Python, IMAP, Gmail, Heathergraph

Emailing documents in Office 2016 using VBA

history edit

Office, Office 2016, 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.

Read More

External Posts In Jekyll

history edit

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.

Petzold Code

history edit

C#

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.

This PC

history edit

Windows 10, C#

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

history edit

Jekyll, Tags

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.

Simple Listbox Ordering using a CollectionViewSource

history edit

XAML

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.

Read More

TextBlock StringFormat Support in Windows Phone 8.1 Projects

history edit

Windows Phone 8.1, XAML, C#

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:

Read More

Post From My Phone

history edit

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.

Read More

Post from my iPad

history edit

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.

Read More