Tiny Icons on High DPI Systems

0
Filed under Uncategorized

I’ve been using a triple monitor setup with all three running at high DPI (4k) resolution for some time now, and I love it. I use 200% scaling, so text is reasonably sized, but at 4k resolution, it’s so much clearer and easier on the eyes.

For the most parts, apps “just work” at that scalemode. But every once in a while, I’ll run into one that doesn’t.

Take for example, ClipCache:

Notice how the toolbar icons are tiny! The app’s excellent and I use it all the time, but the developer, while still supporting it, isn’t all that responsive towards updates, unfortunately.

But, it turns out there are things to try that might just resolve these sorts of issues without resorting to code updates by the developers.

Find the EXE file for the app in question. In this case, it’s Clipc.exe.

Right click and choose Properties, then Compatibility:

Now click Change high DPI settings.

You may have to experiment with the settings here. In the case of ClipCache, I set the Program DPI to checked.

Then checked Override high DPI scaling behavior.

And finally, selected System (Enhanced).

I suspect other apps may require slightly different options.

In any case, restart ClipC and presto!

No more tiny toolbar!

Application Access – Part I

0
Filed under Uncategorized
Plastic Black Container With Many Tools Elevated View Of Plastic Black Container With Many Tools On Wooden Table toolbox stock pictures, royalty-free photos & images

I’ve been doing a lot of reflecting lately on how my typical workday progresses and one of my primary realizations is that I spend a lot of time switching between applications.

There’s all the typical development applications, Visual Studio, VSCode, Command line, GIT, Insomnia, Web browsers, file search, clipboard stuff, etc. There’s usually an instance or two of these running, and I often find myself ALT-TABing between them.

Then there’s various utilities that I use regularly but not necessarily constantly: putty, SSH, Fusion, Dbgview, etc. Find it, Open it, Use it, Close it, repeat.

And finally there’s all the other apps that hang out in the periphery: Word, Excel, Outlook, Zoom, Remote Desktop, VMs and so on.

Now, I’ve pinned a few of those to the taskbar, so they’re just a mouse click away. However, there’s only so much space down there. Sure, I could stack some in a folder, which would present as a menu, but then often used items would inevitably end up hidden behind one or more layers of menus.

Of course, there’s the Start menu. But after awhile, that becomes large enough to prevent any kind of speedy access. And then there’s the Start Panel, but again, it can begin to get unwieldy fairly quickly for me.

Plus, when customizing the Start menu, etc, there’s the issue of synchronizing changes between machines. Google Drive helps, but not really for the Start Menu or TaskBar.

As I hinted at above, part of my realization was that there’s three levels of application usage for me.

Utility Belt Apps

These are apps that I almost always have running. I need to switch between them quickly and seamlessly. Adam Savage, of Mythbusters and Tested fame, even has a term for it, which I completely forget and can’t seem to locate right now. Irony?

In any case, the idea is that you shouldn’t have to move any tool to get to any other tool. And I can’t think of a better way to describe Toolbelt level applications.

And for that kind of accessibility, you’re really talking about one thing; hotkeys.

Windows does have the ability to assign hotkeys to shortcuts, icons, etc. but the selection is pretty limited, and when you regularly work with applications like VSCode or Visual Studio, most of the typical hotkeys are already in use by those apps.

Further, if I have two or more instances of any particular Toolbelt app open, I need to quickly switch between those instances, not go Alt-Tabbing through every opened desktop window.

Toolbox Apps

These are those apps I use often but that don’t really deserve being added to my Path. For these, finding them is usually the most time-consuming part. They aren’t constantly in use, but none-the-less, I’d like them to be ready at hand. For instance, when you need to hunt down a library binding issue with a .Net application, I’m gonna reach for FusLogVw, but that app isn’t normally on the path, or easily locatable.

Junk Drawer Apps

Everything else, which I’m perfectly comfortable leaving in the Start Menu where they’re installed and digging them on when I need them. They’re not used enough to justify going on the Toolbelt or in the ToolBox.

How you break things down? Have I missed anything?

I’ll be posting more as I start to solve this problem.

Making CapsLock Relevant Again

0
Filed under Uncategorized

I’ve seen a few articles here and there about Capslock, but now I’d like to throw my own spin on the topic.

Capslock is probably the most useless key on modern keyboards. It’s an antiquated holdover from the days when typing was actually a quite physical activity.

But now, about the only time Capslock gets hit is by accident. It’s BAD FORM TO SHOUT THESE DAYS, after all.

So… what can we do about that?

Ctrl, Alt, Shift Oh My!

If you’re anything like me, you spend your days in a host of applications, all of which have various functions assigned to just about every conceivable combination of hotkey. There’s all the standards: Ctrl-V, Ctrl-C, Ctrl-X. There’s the Ctrl-Shift variants and the Ctrl-Alt variants. Then there’s the less common Alt-Shift variants.

And then there’s those sadistic Ctrl-Alt-Shift hotkeys that exist just to make sure if you didn’t already have carpal tunnel, you will soon enough.

But what if you could use that CapsLock key as another modifier key; a Ctrl2 if you will?

Suddenly, you have a whole smorgasbord of easy to type hotkeys available. Not to mention Shift-Ctrl2 and Alt-Ctrl2 options as well.

And sure, Ctrl2-Shift-Alt, Ctrl-Ctrl2, and, well you get the picture.

Macro Apps

Sure there are macro applications and hotkey applications out there. Plus, your favorite applications may already have customizable hotkeys built in.

But, they likely only support some combination of Ctrl, Shift and Alt for hotkeys, which doesn’t much help with repurposing that CapsLock key.

Remapping

The first step toward solving this problem is changing the CapsLock key to something , almost anything, else.

It turns out, that’s far easier than you might think. On Windows, you can actually remap virtually any key to any other key with nothing more than a registry entry and a reboot.

“Ugh!” you say. “Editing the registry!”. I get it.

Head on over to https://github.com/randyrants/sharpkeys, and install it right quick.

It’s a tiny little app that takes the guesswork and tedium out of editing the registry for this purpose.

Here’s the entry I used. This will make the CapsLock key act like an F19 key (yes, there’s actually far more function keys than just the F1-10, but most keyboards don’t have them).

Why F19? Meh. Seemed like a far enough out-of-the-way F key to not likely get mixed up with any application’s intentional use of a function key. Plus, it works easily with the technique I’ll go into below. But choose whatever you like. There’s F1-24, plus quite a few Unknown key codes as well that would probably work too.

Click the Write to Registry button and close, then reboot. And done.

When your PC comes back up, give it a try, press Capslock.

Nothing. Beautifully, blissfully, nothing! No capslock light coming on. No SHOUTING. Nothing.

But What IF I WANT TO SHOUT!

At this point, you’re probably asking yourself, “But what about Capslock?”

Grab a copy of AutoHotKey and create this script:

*F19::
    If (A_ThisHotkey == A_PriorHotkey &amp;&amp; A_TimeSincePriorHotkey < 300)
    {
        If GetKeyState("CapsLock", "T") 
            SetCapsLockState, off
        else
            SetCapsLockState, on
    }
    return

Save it to a file called CapsLock.ahk. And then run it with AutoHotKey.

Now then, just double tap the CapsLock key, and, presto, that CapsLock light will beam its soothing green rays right into your eyes once more.

Double tap again to turn it off.

Hot Keys! Hot Keys! Hot Keys!

Ok, so getting the ability to shout again is nice and all, but there’s gotta be more than that.

And, Oh, there is!

That AutoHotKey app you’ve already installed? You’ve only just scratched the surface of what it can do.

How about making CapsLock work like the Ctrl key? Create another AHK script like this:

F19::LCtrl

Or how about CapsLock-N starting Notepad instantly?

F19 &amp; n::Run Notepad

Or how about CapsLock-Insert appending selected text to what’s already on the clipboard

F19 &amp; Insert::
   clip := Clipboard
   SendInput, ^C
   ClipWait
   clip := clip . Clipboard
   clipboard := clip 
   return

The sky’s the limit. Get familiar with AutoHotkey and you’re likely to find a ton of uses for it.

And with CapsLock now available as a completely new (and completely open) modifier key, you won’t have to worry about conflicting with the hotkey definitions of any other application.

Remote Desktop

I spend almost all day connected to remote machines via remote desktop. A wonderful follow-on benefit of this technique is that, since you’ve remapped Capslock on the host machine, even when you’re connected to a remote machine, Capslock will still map to F19, so the remote machine won’t see any CapsLock keypresses either.

It will, however see F19 keypresses. So, you have the option of deploying and running your AutoHotkey scripts on the remote machine, and they will see the F19 keypress exactly like scripts on the host machine, to be used in any way you see fit.

Lastly

If you’re still following along and all this sounds great, keep in mind that the ScrollLock and those number pad keys can all be remapped in the same fashion. Depending on your typically workflow, that may or may not make sense for you, but the process is exactly the same.

Macros in VS 2022?

0
Filed under Uncategorized

I’ve lamented Visual Studio’s lack of built-in macro support for ages. I tried a few extensions a while back but they never quite measured up.
But I just stumbled across Text Macros for VS 2019-2022.

It’s perfect for a quick, one-off Record/playback macro, you can save macros, edit them (although that’s not ideal as the macros are saved in a rather obtuse XML format), and even assign them permanently to hotkeys.

It’s only good for text editing macros, so you can’t use it to “automate” Visual Studio itself, but I’ve yet to have a need to do that.

Fixing VSCode’s broken Ctrl-Right

0
Filed under Uncategorized

I’ve been using VSCode for quite some time now. Generally speaking, I’ve been super happy with it. It’s ultra configurable, fairly light weight, very fast, and just generally a pleasure to work with.

Except….

They completely got handling of Ctrl-Right wrong. Try it in Word, try it in Notepad++, in Visual Studio, you name it, they all work a certain way.

But VSCode, not so much.

Now, it’d be easy enough to get used to it, if all my editors decided to change the default way they handle Ctrl-Right. But, yeah, no.

I’ve dealt with it for a while now but this weekend, I finally decided to have a look.

It took some Google-foo, but eventually I came across this post by Spongman that very accurately describes the problem.

I won’t repeat that here, but here’s the keybindings for VSCode that fix the problem.

    {
        "key": "ctrl+shift+right",
        "command": "-cursorWordEndRightSelect",
        "when": "textInputFocus"
    },
    {
        "key": "ctrl+right",
        "command": "-cursorWordEndRight",
        "when": "textInputFocus"
    },
    {
        "key": "ctrl+right",
        "command": "-cursorWordAccessibilityRight",
        "when": "accessibilityModeEnabled && textInputFocus"
    },
    {
        "key": "ctrl+shift+right",
        "command": "-cursorWordAccessibilityRightSelect",
        "when": "accessibilityModeEnabled && textInputFocus"
    },
    {
        "key": "ctrl+right",
        "command": "cursorWordStartRight"
    },
    {
        "key": "ctrl+shift+right",
        "command": "cursorWordStartRightSelect"
    }

It’s a bit tricky to get them installed in VSCode, what with the new Settings UI, but, once they’re there, Mwah! Perfection!

0
Filed under .NET, SQL, Visual Studio

Command Line MSSQL

SQL on the command line!

There’s a number of tools out there for connecting to an MSSQL Database and running queries from the command line, but a colleague recently pointed out a new one I hadn’t seen before that actually works really really well, especially with Windows Terminal and Cmder.

First, make sure you’ve got Windows Terminal and Cmder installed. They are truly the bees knees when it comes to working in the command line under Windows!

Next, install mssql-cli. This app is actually a python script, so you’ll also need Python if you don’t already have it installed. Don’t fret, though. The link contains instructions on getting Python going, and once that’s done, installing mssql-cli is a single pip command:

python -m pip install mssql-cli

To test it, just open a command prompt and type:

mssql-cli

Now, that alone is nice, but if you’re like me, you have several test databases you connect to on a regular basis and entering credentials is troublesome at best.

Not to worry. There’s a batch file for that!

Now, it’s not the simplest in the world even though it is a single liner. So here goes:

wt -d c:\users\dhiggins\desktop cmd /k "c:\apps\cmdr\vendor\init.bat cd %CD% &amp;&amp; mssql-cli -U {dbloginusername} -P {password} -d {dbname} -S {dbservername}"

Let’s break that down:

  • wt – starts Windows Terminal
  • -d – followed by the folder you’d like to start terminal in. Not strictly required, but it’s a nice add. I just set it to my desktop
  • cmd – This is used to get Cmder started in a tab in Windows Terminal
  • /k – tells cmd to execute the following quoted command and stay loaded
  • “c:/apps/cmdr/vendor/init.bat – this get Cmder started and the shell all initialized. Note that the path to your installed copy of Cmdr may be different from the “apps/cmdr” that I have here.
  • cd %CD% – Gets Cmder switched to the folder that this bat file is located in
  • && mssql-cli – Actually starts mssql-cli! The whole point of this exercise.
  • -U {dbloginusername} – Provider the UserName you use to log into your db server here
  • -P {password} – provide the database user password here
  • -d {dbname} – provide the database name here
  • -S {dbservername}” – And finally provide the database server name here. I’m just connecting up to the locally installed instance of SQL Server.

Save that as a BAT file and dblclick it to launch directly into a Cmder tab inside Windows Terminal connected to the DB of your choice. Perfection!

One big benefit from using Cmder, at least from what I can tell, is that it automatically supports horizontal scrolling of query result sets.

Notice that those right pointing arrows!

Just use <left><right> arrow keys to scroll the grid left and right as you page through results.

If you don’t use Cmder as your shell, scrolling won’t work like that unless you install something else called PyPager. Which I didn’t do.

Visual Studio Bonus!

Now, all this is well and good, but as they say on late, late night TV: Wait! There’s more!

I spend a lot of time in Visual Studio, so any way to stay there tends to be a positive for me, and one of the most recent additions to VS is built-in Terminal support.

Works a treat and even works with Cmder, so you get all that great Cmder goodness right inside Visual Studio.

But, you can create as many “Terminal Configurations” as you want, so here’s a shot of a few that I have, including one running Cmder directly and another starting the MSSQL-CLI directly to a specific database.

Easy and quick direct access to a specific db, Right inside VS!

Rainmeter WebParser Problems

0
Filed under Uncategorized

A colleague recently pointed me to a fantastic little desktop customization app for windows, RainMeter.

He was using the lottaweather skin, so I pulled that as well, and I’ve found it quite nice to have a really clear forecast stuck right there on the desktop.

Beautiful Weather Skin

It’s tiny, quite capable, and is really easy to knock up a quick notification panel or whatnot based on a webservice, or so I thought.

At work, we’d recently been throwing ideas around about how to be reasonably notified of build failures and Pull Requests/Statuses.

Another colleague came across AnyStatus, which is quite nice in it’s own right, but I thought it’d be nice to have something in the same style as lottaweathers skin.

I’ll dig into the details of scraping azuredevops and jenkins later, but while putting things together, I ran into a vexing problem.

I had one measure that resolved the users azure guid “id” given their name and a different measure that requested all the Pull Requests where that userid was listed as a “reviewer”.

Pretty standard stuff for RainMeter, and the urls I was using worked just fine in PostMan, but not Rainmeter.

Actually, the UserID request worked, but not the Pull Request query.

Here’s the measure definitiion:

[MeasureMyReviews]
Measure=WebParser
Disabled=1
URL=https://azuredevops.blahblah.com/#organization#/#project#/_apis/git/repositories/#repository#/pullrequests?api-version=5.1&amp;searchCriteria.reviewerId=[MeasureUserID]
Header=Authorization:Basic #AzureDevOpsPATBase64#

After WAY too much head scratching, I discovered the problem was two-fold.

  1. My measure referenced the UserID measure like so: [MeasureUserID] but that syntax doesn’t work in this context. In a URL definition, it needs to be [&MeasureUserID] (note the &)
  2. WebParser measures happen asynchronously, but in this case, the “MeasureMyReviews” has to happen AFTER the MeasureUserID. Otherwise, the userid hasn’t been resolved and will just be blank.

The fix was to set Disabled=1 for the MeasureMyReviews measure, then enable it in the FinishAction of MeasureUserID, like so:

[MeasureUserID]
Measure=WebParser
URL=https://azuredevops.blahblah.com/#organization#/_apis/identities?api-version=5.1&amp;searchFilter=General&amp;filterValue=#username#
Header=Authorization:Basic #AzureDevOpsPATBase64#
RegExp=(?siU)"id":"(.*)"
StringIndex=1
DynamicVariables=1
FinishAction=[!SetOption MeasureMyReviews Disabled 0][!UpdateMeasure MeasureMyReviews]

Note the two bang commands in the “FinishAction”

Sony XBR Tv showing Red Lines

0
Filed under Uncategorized

I’ve had a 65″ Sony HD TV for a while now and have really enjoyed it. The picture is incredible, especially with HD content, works well as a Chromecast target, the menus are completely usable, etc.

Still, it’s not like the 80″ HD projector screen I’d used going back years. Of course, with a projector, even a bright one, I still had to have the room mostly dark to really be able to see the screen well, and watching a projector during the day in a room with two skylights just isn’t particularly doable.

Hence the Sony.

Anyway, a week or so ago I happened on the chance to pick up an 85″ Sony TV and jumped on it. Checked it out before bringing it home and everything looked good, so we loaded it up.

Got it home, hooked it up and I’m seeing faint red lines across the screen.

Worse, on some screens (usually menus or computer generating fades/gradients) I’m seeing a LOT of red lines.

But they aren’t consistent.

Here’s a few shots.

Notice the red bits around the Hulu logo
An example of shading gone wrong
Another shading example
Here’s one of the faint vertical dashed lines

Here’s the thing. Most content actually shows perfectly fine.

At some points, depending on the image on screen, the vertical dashed red lines are either completely gone or barely visible.

My guess is that during the move, we torqued the tv too much or jostled it in some way that loosened a connector.

I don’t believe the screen is damaged, because the location of the lines changes depending on the image being shown.

Anyone have any ideas?

TClock Redux Redux

0
Filed under Uncategorized

I work with a team that’s pretty geographically distributed, so it’s always nice to have a solid notion of what time it is where-ever the person I’m talking to (or about to talk to) might happen to be.

I stumbled upon TClock (and White-Tiger’s update TClock Redux) quite some time ago and it worked fantastically for what I needed.

Rockin’ that XP Style, oh, yeah!

Yeah, OK, it might be a tad dated, UI-wise, but it easily allows you to put several clocks for different timezones, with labels, right there in the tray. And you still have quick access to calendar, etc.

For me, I used a TClock configuration like this for ages.

Notice 3 timezones, with seconds that update only on the middle zone (I’m in Central), and an uptime clock, day name, and date just for good measure.

But recently, I started working with several folks scattered across India, and their timezones were fractional, something like GMT-7.5.

And TClock didn’t handle that.

I finally got some time several weeks back, so I forked White Tiger’s Redux branch, dusted off my C programming chops and went to work.

And I came up with TClock Redux Redux.

White Tiger might incorporate the pull request into their branch, but until that time, I’m posting the GITHUB project and release here.

Source is located here

An initial release, 64bit only, can be found on the releases page here

How to use it

Stop TClock if it’s running on your machine, download the release Clock64.exe and simply copy it over the existing Clock64.exe. Then restart TClock.

Outwardly, it’s exactly the same as TClock Redux, so please see White Tiger’s page for detailed configuration information.

For this version, the only thing that’s different is the handling of the “w” format specifier.

“w” means “calculate a time that’s an offset of x hours from the “current” timezone.

So, for instance, if I’m in Central US time, and I wanted to show East Coast time as, say, 12:30PM, I’d use “w+1:nntt”.

For Pune, India, however, they’re actually 12.5 hours ahead of Central time.

The original TClock Redux couldn’t handle that, but with this version, you can configure you clock format string with

“w+12.5:nntt”

and you’ll get the time in Pune, offset by 12.5 hours from the current time zone.

So now, my Taskbar can look like this:

I’ve added “day of the year” and “week of the year” just for fun.

LogShift Utility

0
Filed under Uncategorized

tldr; Console app to translate datetime stamps in a logfile into time offsets.
Get it here, with a precompiled release version here.

LOG file format - Free interface icons

I often find myself comparing log files to identify discrepancies or variations in execution timing. And a big problem with doing so is time stamps.

Most modern logging in .net apps happens through log4net, or nlog, or any of a variety of their clones.

In almost all cases, log files will be standard text files that look something like so:


2020-03-03 12:34:22 PM ERROR A problem has occurred…..
2020-03-03 12:34:25 PM INFO Informational message….

This works just fine under normal circumstances, but, when you’re trying to compare two log files that were captured at different times, but for the same sequence of actions, there’s a big problem.

Those timestamps will be different for every single line!

Couple that with comparing multi-megabyte log files, and locating real differences starts to look like finding that one whisperer in a herd of walkers.

In my case, what I really needed were time deltas instead of timestamps in the log files.

So instead of the above, we’d have something like:

...
00:00:00 ERROR A problem has occurred.....
00:00:03 INFO Informational message....
...

In other words, instead of literal datetime stamps on each log entry, I’d see a time delta from each entry to the next.

This solves two major issues:

  • Log entries written at approximately the same time would all have a delta of 0, so they won’t show up as differences in a file diff tool
  • When the time delta is non-zero, the difference is actually meaningful. It represents a differing amount of time elapsed between the two log entries. When comparing two different runs of the same code, this can really help identify specific places in code where performance has been impacted.

Google it!

So, of course, I head to Google to see if there’s anything out there already for this. I did turn up a couple of promising log viewers, but most were either commercial, or required capturing log files into a database for review, which was a bit of overkill in my case.

I just needed something to massage two log files into a more comparable format.

Enter LogShift

After coming up empty with Google, I decided to put a little utility together just for this purpose.

I’d heard that .net core 3.x allowed for “single file executables” but I’d never had a chance to try it out. Bingo! Perfect opportunity!

And so, LogShift was born.

Get it here, and a precompiled release version is here.

First off, a big thank you to Giacomo Stelluti Scala and his CommandLineParser nuget. If you have a need for a simple and powerful command line parser that makes your console app look every bit as flexible as GIT, check it out!

The Nitty Gritty Usage Details

Just download the LogShift.exe, throw it on your desktop, and drag just about any text-format log file onto it.

When the dust settles, there should be a file in the same folder as your original log file, but with an additional “.shifted” extension.

And if you look at that *.shifted file, you’ll find that most if not all date time stamps in it have been converted to “(DURATION)hh:mm:ss”

Type LogShift –help for a typical usage screen:

LogShift 1.0.0
(c) 2020 drVenture
-f, --file Log Filename to process. Can also omit the -f and just put the filename as the only argument.
-d, --durationtag (Default: (DURATION)) String used to preface duration values inserted into shifted log file
-s, --outputsuffix (Default: shifted) The Suffix to append to file name when writing the output file
-m, --monthfirst (Default: true) true if the month should be assumed to be before the day in date stamps
-y, --yearfirst (Default: true) true if the year should be assumed to be before the month and day in date stamps
--help Display this help screen.
--version Display version information.
value pos. 0 The Filename(s) to process. Specify either one or more filenames or use the -f option.

The options should be pretty straightforward.

One question I’ve gotten is “How does it recognize datetime stamps?”

Basically, the program scans each line for a REGEXE that will match most typical date time formats.

It will just work if the datetime stamps have a 4 digit year, esp if the year comes first, because that virtually guarantees that the month comes second and the day third.

If you happen to have log files with oddly formatted date time stamps, you can use the -yearfirst and -monthfirst options to indicate year comes before the day and month, and that the month comes before the day, respectively.

The time portion should automatically get recognized with just hh:mm or with hh:mm:ss. Additionally, fractional seconds will be recognized as hh:mm:ss:fff, with a separator of “:”, “.” or “,”.

Finally, AMPM will also automatically be recognized.

Note that the first recognized timestamp in the file is recorded and all subsequent timestamps are compared to it. Any date time values that are BEFORE the first detected date time stamp will be considered “data” and as such, will not be converted to a time difference.

This is so that any logging of actual date-oriented data values will likely not get translated, which is generally a good thing. Since most data values in the file will be in the past, this should just work. Of course, if your log file contains date data in the future, well… there’s always a pull request!

Multiple files at once

To process multiple files at once, just multi-select 2 or more log files in explorer and drag them onto LogShift.exe. Either that or run it from the command line with more that one filename… for instance:

LogShift a.txt b.txt c.txt

Wrapping up

And that’s about it for this little utility. I hope it helps someone out there as much as it’s helped me.

As usual, feel free to post with any questions or comments! I look forward to hearing from you!