Windows 10 Notes

Note: I’ve trimmed down this post for a couple of reasons:

  • I’ve migrated to Fedora as my main OS.
  • Microsoft seems to change and move options around between major updates of Windows 10, so anything I post could become outdated and misleading.

I’ve left what I think might be helpful below.

 

Local Account Mode

Here is an article on configuring local account mode if your installation is currently stuck with Microsoft Account authentication.

 

Uninstalling Groove Music

Windows 10 will not allow a straightforward uninstall of Groove Music. Doing this seems to require Windows PowerShell commands, or a power user utility like CCleaner.

 

Working with long filenames and/or paths

Windows sometimes has trouble with paths that are too long. The internet tells me that I should be able to make a registry edit to support long filenames, but this didn’t work for me. I followed this person’s solution and downloaded a 3rd party program to rename a file so that I could actually interact with it.

When I installed the Windows 10 Creators Update, some scripts that I had been using were no longer able to handle long paths. Others have noticed this as well. I was not able to find a solution to this other than not using long paths, and my overall patience with Windows 10 had run out at this point.

 

Other posts related to Windows 10

Windows 10: On lock screen, 2nd monitor does not recover from power-saving mode

Windows 10, NVidia GeForce GTX 750: OpenGL Programs Stutter Severely

 

(e 25/Mar/2017, 26/Mar/2017: Privacy: keyboard telemetry)
(e 6/Apr/2017: Long filename isssues: wording)
(e 16/Jul/2017: Creators Update notes)
(e 29/Jul/2017: File association grab)
(e 13/Aug/2017: Post trimmed down)

XMPlay

xmplay_small

XMPlay is a free and lightweight media player for Windows, with support for a wealth of custom audio formats and Winamp-compatible plugins.

One of XMPlay’s best interface features is configurable global-focus shortcut keys. You can configure volume up/down, skip/rewind, and next/previous shortcuts which work while your focus is on another program, even when in Full Screen mode. I like to use it for playing and controlling podcasts while doing something else.

xmplay_global_shortcuts

One thing XMPlay doesn’t seem to handle intuitively is numbered files without leading zeroes. For example, loading a set of 12 songs labelled:
song_1.mp3
song_2.mp3
song_3.mp3

song_10.mp3
song_11.mp3
song_12.mp3

The order will be:
song_1.mp3
song_10.mp3
song_11.mp3
song_12.mp3
song_2.mp3
song_3.mp3

And so on. But if the files are tagged appropriately, you can sort them by metadata such as track number by right-clicking on the question mark button in the playlist window.

xmplay_sorting

MIDI Soundfont support

XMPlay’s native MIDI plugin can be configured with soundfonts to sound nicer than the standard Windows MIDI playback. A pretty decent soundfont (Chorium) is provided on the plugin’s download page.

Other soundfonts:

¥Weeds¥ General MIDI Soundfont by Rich Nagel. A nice alternative to Chorium.

Regression FM – Makes everything sound like a Sega Genesis game. I can’t find the author’s website anymore, but the Regression FM Youtube channel has a download link for the soundfont under the ‘About’ page.

OPL3-FM 128M by Zandro Reveille – FM synth timbres by The Fat Man, sampled from an ISA Sound Blaster 16. Can be found on the author’s website or on Github.

Vintage Dreams by Ian Wilson – Vintage synthesizer theme, can be found on this webpage.

(e 11/Nov/2016: Images, sorting by metadata)
(e 13/Nov/2016: OPL3-FM 128M)

 

VirtualBox Administration Notes

(Note: This post probably won’t be touched again due to my switching to KVM.)

This is a placeholder for some notes about command-line installation and administration of VirtualBox, Oracle’s free virtualization suite. Most tasks can be handled from the VirtualBox GUI, but to work on a terminal-only server, you will need to interact with the VboxManage command line interface.

The VirtualBox end-user documentation is excellent, and most of these notes are taken directly from it unless otherwise noted.

Unfortunately, I don’t have a headless server set up right now. I’ll just leave the most basic start/stop commands here, and will add more to this post when I have the environment back up and running.

Quick Command Cheat-Sheet

Check what’s registered/running

Show all VMs
VBoxManage list vms

Show running VMs
VBoxManage list runningvms

 

Start/Stop

Start up a VM
VBoxManage startvm “your_vm” &

Start up a headless VM (no GUI)
VBoxHeadless -startvm “your_vm” &

Hibernate a VM
VBoxManage controlvm “your_vm” savestate

ACPI power down signal
VBoxManage controlvm “your_vm” acpipowerbutton

Poweroff a VM (pull the plug)
VBoxManage controlvm “your_vm” poweroff

 

Cleaning House

Unregister and Delete a VM
VBoxManage unregistervm “your_vm” –delete

 

Notepad++

Notepad++ is a free and open-source text editor for Windows, and a great substitute for the standard text editor that ships with Windows. It’s packed with features, and supports 3rd party plugins — the following are some notes about features I find come in handy.

I have limited experience with keyboard-driven editors like Vim and Emacs. These may cover the same functionality, and more — I don’t really have the experience to say. In any case, I think NP++ strikes a nice balance between features and accessibility in a Windows environment.

 

Block Editing

To highlight 2D blocks of characters, hold SHIFT + ALT and move the cursor with the arrow keys. Alternatively, hold ALT, and then click and drag the mouse cursor. You can copy and paste blocks, and insert and delete characters along multiple lines. Two use cases are 1) to insert new columns or ASCII separators into tables, or comment out a multi-line block of code, and 2) to block-copy and paste boxes and other shapes in ASCII diagrams.

npp_block_edit1 npp_block_edit

 

Find (in files)

Notepad++ allows for searching within the current document, among all currently opened docs, and within a directory path. There are three search modes: one that uses normal / literal words and phrases, one with an extended parsing mode that includes escaped characters, and one with Regular Expressions. For in-depth log analysis, you are better off using the proper command line tools,  but Notepad++ can still be useful for quick searches. My experience is that it has trouble with stability when opening and searching 100+ megabyte files.

The search results are shown in a horizontal pane. Double-click a result line to open the document at that line number. These results can also be copied and pasted into a new document and be searched through.

npp_search1 npp_search2

 

Configure Notepad++ to use spaces instead of tab characters for Python only

Select Settings -> Preferences and choose Tab Settings.

Select from the list box, select ‘[Default]‘ :

  • Uncheck ‘Replace by space

From the list box, select ‘python‘ :

  • Uncheck ‘Use default value
  • Set tab size to your preference (I use 4)
  • Check ‘replace by space

Close the settings box. This change takes effect immediately, but does not apply retroactively. To convert tabs to spaces in an existing py source file, you can select Edit -> Blank Operations -> TAB to Space.

 

Enable the Documents sidebar

(If you do not see the options below, try upgrading to the latest version of Notepad++. I have this set up in v6.9.2 as of 13/Aug/2016.)

The file list can be enabled here (Settings -> Preferences -> General -> Document List Panel: Check Show. Optionally disable extension column for a cleaner look.) :

npp_file_list

 

Save document state on exit

This can be configured within Settings -> Preferences -> Backup.

  • Check Remember current session for next launch.
  • Check Enable session snapshot and periodic backup.

Unsaved files will be saved to the below directory when you exit NPP. They will be restored when you start the program again.

npp_remember_session_on_close

Some caveats with this feature:

  • If Notepad++ crashes, the files may remain there without being cleaned up. They could also be corrupted and lost if it can’t recover gracefully (let’s say you did a Find in Files search and Notepad++ croaked in the process).
  • Be careful not to leave sensitive notes in unsaved files when you close Notepad++, because they will be saved straight to disk with no encryption.

(edit 10/30/16: wording)

AutoHotKey

AutoHotKey is a free and open-source macro utility for Windows. It can help greatly with automating repetitive, one-off tasks, especially with GUI programs that don’t have built-in CLI automation or batch scripting. Your mileage may vary, as not all programs will accept the virtual input events that AHK generates. That said, it’s quite nice when everything works.

 

Quick scripting notes

; comments begin with a semicolon
^!q::
    ; Trigger label example for key input
    ; ^ = CTRL
    ; ! = ALT
    ; q = the 'Q' key

    ; Let's send some keyboard input with some delays.
    Send,Let's cut and paste.
    Sleep, 250
    Send,{Shift Down}{Home}{Shift Up}
    Sleep, 250
    Send,{Control Down}x{Control Up}
    Sleep, 250
    Send,{Enter}{Enter}{Enter}
    Sleep, 250
    Send,{Control Down}v{Control Up}
    Sleep, 250
    Send,{Enter}{Enter}Tada!

    ; Finish a block with 'Return'
Return

 

Transfer “Untitled” Notepad text to Notepad++

My old job required me to take notes often, and quickly, during troubleshooting sessions. Here is a script I used at the end of the day to transfer the contents of all untitled Notepad instances to Notepad++, a program that can be configured to autosave everything upon closing.

Maybe this was a bad habit, and I should have just typed stuff into NP++ directly, but I found it easier while on calls / remote sessions to just hit Win+R, type notepad, and start typing away. I set NP++ as the default program for txt files, so I could tell at a glance that if something was written in Notepad, then it was fresh information from that day.

I wasn’t able to make this script perfect (it’s time-sensitive: it will screw up if your system is lagging due to slow disk access, for example), and I have neither AuthoHotKey nor Notepad++ at my current job, so this is provided as-is with no warranty.

; copy all notepad files called "Untitled" to new files in notepad++ which
; will autosave upon closure. Based on AHK help file examples.
; v1.3 2016/19/Feb

^+!s::
    ; Go no further if Notepad++ is not running.
    IfWinNotExist ahk_class Notepad++
    {
        MsgBox, Notepad++ process not found.
        Return
    }
    npp_is_running := 1

    ; Confirm run
    MsgBox, 4, , Copy contents of all "Untitled - Notepad" instances to Notepad++? This will overwrite your clipboard state. Do not execute if a remote desktop session is running.
    IfMsgBox, NO, Return

    ; Get a list of all windows
    WinGet, id, list,,, Program Manager
 
    ; Iterate through windows
    Loop, %id%
    {
 
        ; If Notepad++ crashed or something, stop.
        IfWinNotExist ahk_class Notepad++
        {
            npp_is_running := 0
            Break
        }

        ; Right now this will jump focus to every window.
        ; WIP: There must be a way to skip over programs that aren't "Untitled - Notepad".
        this_id := id%A_Index%
        WinActivate, ahk_id %this_id%
        WinGetClass, this_class, ahk_id %this_id%
        WinGetTitle, this_title, ahk_id %this_id%
 
        ; Work on this window if it's "Untitled - Notepad"
        if (this_title="Untitled - Notepad")
        {
            ; Sleep ten seconds.
            ; Adjust appropriately to match the performance of your PC.
            ; (Mine would be crawling by the end of the day.)
            Sleep, 10000
 
            ; Select all
            Send, {Ctrl Down}a{Ctrl Up}
 
            ; Cut
            Send, {Ctrl Down}x{Ctrl Up}
 
            ; Close window
            Send, {Alt Down}{F4}{Alt Up}
 
            ; Switch to Notepad++
            WinActivate, ahk_class Notepad++
            WinWaitActive, ahk_class Notepad++
 
            ; Sleep half a second 
            ; Increase if your PC is sloooowwwww
            Sleep, 500

            ; New Notepad++ tab
            Send, {Ctrl Down}n{Ctrl Up}
 
            ; Paste
            Send, {Ctrl Down}v{Ctrl Up}
         }
    }
 
    if npp_is_running = 0
    {
        MsgBox, Notepad++ process not found.
        Return
    }
 
    ; Switch focus to Notepad++ upon completion
    WinActivate, ahk_class Notepad++
    WinWaitActive, ahk_class Notepad++
Return

 

(e: 15/Sept/2016: Formatting)
(e: 27/Nov/2016: Notepad to Notepad++ transfer script)