How to disable PDF file thumbnails generated by PDF24

Got tired of Adobe's Acrobat Reader constantly nagging me about AI features

Tried out PDF24 and it seemed ok, except for one small problem; PDFs were showing up with thumbnails as if they were image files. I don't like that.

AI searches were rubbish and deleting registry folders didn't do it.


How to fix

  1. Download nirsoft ShellExView
  2. Open it up and search for "PDF24 PDF Thumbnail Handler"
  3. Right click
  4. Select "Disable selected item"
  5. Then open up Start > "Disk clean-up"
  6. Untick everything except for "Thumbnails" at the bottom
  7. Click "OK" and confirm
  8. Now refresh your desktop or folder and it should no longer show a preview

Windows / Nvidia: How to reduce GPU usage for Instant Replay when idling on desktop (without disabling it for games)

 

The other day I was glancing at Task Manager and noticed something annoying...

For some odd reason, the GPU was busy at around 40% capacity while I wasn't really doing much on the desktop.


After a bit of sleuthing, it turns out the "Instant replay" feature is constantly recording and encoding in the background, which is a pretty cool feature for gaming but a waste of power for my day to day usage.

While the easy option is to turn off Instant Replay altogether, I still want it on while I play games.

Fortunately there is an easy way to achieve that, but unfortunately its not obvious how.

1. Turn off Instant Replay (and watch your GPU usage drop to 0%)



2. Turn off desktop recording by going to

  • Settings (Cog)
  • Scroll down to Privacy control
  • Untick "Desktop Capture"



3. Back out and "Done" until you see the main UI

4. Turn Instant Replay back on and enjoy the 0% usage while idling on desktop





Remove URLs next to links when printing from browsers like Firefx

Sometimes you need get something done quick like printing a receipt off a webpage, but the browser just vomits URLs all over your print preview.

I've yet to figure out why this happens, but some sites will go the extra mile to make your life difficult.


What you see:



What you didn't expect:



Now to get rid of the extra URLs, paste the following into the browser Javascript console. Try pressing F12 to make it appear. If it doesn't, then how you get to that console depends on the browser and operating system you're using. A quick Google search should get you the answer.

el = document.createElement('style');

el.setAttribute('type', 'text/css');

el.textContent = `@media print {

    a[href]:after {

        content: none !important;

    }

}`;

document.head.append(el);


What you'll get:



Source

Typescript: Preventing generic string keyed objects from overlapping with Arrays

 This was a bit of a doozy and took me the better half of a day to find a semi decent fix for it.

Here's the unsuspecting use case and why it caused problems (try it out on Typescript playground)

  • SingleConfig and MultiConfig are different types. One is a single object value, the other is an array of that.
  • conditionalReturn() returns either one of those depending on the input.
  • onlyWorksWithSingleConfig() as the name states will only work with an instance of SingleConfig
  • Typescript doesn't seem to detect an issue when using onlyWorksWithSingleConfig() with the result from conditionalReturn()

Why? Because Javascript is a hot mess when Arrays are considered to be objects. It is possible that Typescript allows that behaviour because Javascript arrays are keyed by strings (not numbers) so it will fit the type interface specified by SingleConfig.

For instance, look at this output.


So now that we have a possible reason why this is allowed in Typescript, how can we prevent it?

Attempt 1 - use type guards

As documented here, I tried using them to enforce some sort of sanity. It did not work.

Attempt 2 - disallow [index: number] in SingleConfig

I found this on StackOverflow and thought it was an elegant solution to the problem, however quickly realised it broke a valid use case where this syntax would be marked as incorrect.


Attempt 3 - Disallow "random array prototype member" ✔

A smart fellow at work suggested being a bit more specific with the "never" clause.

Instead of trying to capture all the cases, why not filter out a specific case, like "length"? (Just to be safe, I used something a bit more weird like "lastIndexOf" to avoid potential issues)

And it worked! Just like that, Typescript is now correctly detecting the two separate types.


It even fixed up the type guard function isSingleType() !

Android: How to disable Chrome's useless share menu (aka the "Chrome Sharing Hub")

Note: this flag should also work on Chrome derived browsers such as Brave and Vivaldi.


It's frustrating when a company like Google tries to be all user-friendly up in your face by adding extra steps to what used to be a simple workflow.

Before:

  • Click share button
  • Choose app to share to
After:
  • Click share button
  • Scroll through horizontal list of apps (which has no visual clue to indicate that you can scroll)
  • Click on "More ..."
  • Find the app you want to share to

 I know it isn't that much but its a chore, so lets kill it.


This fucken thign right here.

Steps to disable

  • Open a new tab
  • Go to chrome://flags/#chrome-sharing-hub
  • Double check you're looking at "Chrome Sharing Hub"
  • Click on "default" for that setting
  • Change it to "disabled"
  • I also changed the setting for "Chrome Sharing Hub V1.5" but not sure if its needed

Source

Android: How to figure out which key store your app was signed with

It's been more than a few years since I've signed an APK for release and over time I've forgotten which key store I used to sign apps.

Fortunately, if you've got Java installed then you already have everything required to verify this information.

Step 1 - Acquire the APK(s)

Grab the APK file off Google Play Console (it's in "App Bundle Explorer" > "Downloads").

If its a publically published app then you could probably try grabbing it from a 3rd party APK host as well, but be wary that some dodgy ones may resign your APK.

Step 2 - Get the certificate fingerprints from your key store

Using command prompt, go to the "bin" folder in your Java install path. For me, it was at:
cd "C:\Program Files (x86)\Java\jre1.8.0_251\bin"

 Use "keytool" to read the key store information:

keytool -list -keystore "C:\Coding\Android\keystore"

It should print out a bunch of info, but the line you're interested in here is the bit after:

Certificate fingerprint (SHA1): ...

Take note of that information somewhere along with the key store filename.

Step 3 - Determining the APK certificate fingerprint

From the APK file, open it with an archive utility like 7-zip. If you can't figure out how, just rename it from "whatever.apk" to "whatever.zip".

Extract "META-INF\CERT.RSA".

Reusing your command prompt terminal from before, staying in the same path and run keytool again but with a different set of arguments:
keytool -printcert -file "C:\Users\twig\Desktop\whatever\META-INF\CERT.RSA"

Enter in the password if needed.

This will again spit out a bunch of information. The bit you're interested in is the SHA1 line under "Certificate fingerprints" 

Certificate fingerprints:

         MD5:  ...

         SHA1: ...

         SHA256: ...

Remember, a key store may contain multiple entries! This means there could be multiple certificate fingerprints.

By verifying the SHA1 fingerprints in the APK and the key store, you should now have enough information to figure out which key store entry was used to sign the APK.

Good luck!


Sources

Keeping your commit history while migrating from SVN to Git

I had to finally get off my arse and migrate my old SVN repos over to Git(hub) when CloudForge decided to close shop. It was very nice of them to host my junk for free all these years and also give us plenty of notice about turning off their services.

But alas, the migration path. I had always envisioned this to be painful and tedious. Luckily it was neither due to the wonderful work by the people who made git svn. In the past we weren't fortunate enough to have such tooling and just had to give things up when Google Code shut down and lost a whole lot of commit history when migrating.

Overview

  1. Export names of users
  2. Convert the SVN repo to a Git repo
  3. Push source to its new home

Steps to migrate

  • Install SVN, Git and Git SVN
sudo install subversion git git-svn
  • Check out your SVN repo
svn checkout <url>

  • "cd <project-path>"
  • Export names of users
svn log -q | awk -F '|' '/^r/ {sub("^ ", "", $2); sub(" $", "", $2); print $2" = "$2" <"$2">"}' | sort -u > users.txt ; cat users.txt

  • You'll see the SVN format will be something like "username = username <username>"
  • Change it to the format of "username = Full Name <email@address.com>"
  • Save the file and return to the command line
  • Now to use Git SVN to convert the repo to a Git one. Don't worry, it creates the new repo in a completely separate folder.
git svn clone --no-metadata --authors-file=users.txt $(svn info | grep "^URL:" | cut -d : -f 2-) git_migration ; cd git_migration

  • Now you have a perfectly good Git clone of your SVN repo ready to push to a new home

Extra info

A breakdown of what the "git svn clone" command does:

  • "git svn clone" runs git-svn on the current SVN repo and clones it to a new Git repo
  • "--no-metadata" excludes the SVN commit IDs from the new Git commits. Don't need it since its a one way trip
  • "--authors-file" is the file used to map commit author details
  • Next bit "$(svn info | grep | cut ...)" simply reads the SVN repo URL from the current project so we don't have to manually edit the command for each project
  • "git_migration" is the path we want to put the new Git repo
  • "cd git_migration" simply changes the path out from SVN repo to the new Git repo

Pushing to Git

  • Go to your favourite Git host (Github, GitLab, BitBucket, etc) and create a new repo for your project. If using an existing one, just don't push in the last step unless you know what you're doing)
  • Now is a good point to make sure you can access Git via SSH. I will not be covering it here.
  • Now add a new remote to your local Git repo
git remote add origin <url>
  • Assuming you created a completely empty repo, you can simply just "git push origin master" and call it a day.

In case of a non-empty new Git repo...

If your new Git repo has existing commits, you can do one of two things.
  1. Note; triple check you want to do this before doing this!
    Force push your master branch to override the existing content by using "git push origin master --force". There is no easy way to undo this unless someone else has a checkout of it.
  2. Use git rebase to shift the new commits from "origin/master" onto the end of your master branch, and THEN force push to preserve the new files.

Merging SVN and Git repo commit histories

In my case, some projects started off in SVN and I made a clean cut switch-over to Git. Now that it's all in Git, it was only right to combine the two separate commit histories into one.

In this scenario, perform the steps below BEFORE pushing to Git. We'll need to juggle some stuff around first.

Now depending on which repository is older, you may need to manually replace some stuff below as you go.

  • So following on from the "git remote add origin <url>" command above...
  • "git fetch origin" to pull in information about the target repo
  • Create a new branch called "combined" using the given source branch
    • "git checkout -b combined origin/master" if your SVN repo is older
    • Otherwise "git checkout -b combined git-svn"
  • Work on the "combined" branch as it's safe to stuff things up since we still have the original branch in case anything goes wrong.
  • Now we need to use git rebase from the "combined" branch onto the older source. Think of it as appending the newer source onto the end of the older source.
    • "git rebase --committer-date-is-author-date git-svn" if SVN repo is older
    • Otherwise "git rebase --committer-date-is-author-date origin/master"
  • Rebase will replay a series of commits to combine the history, resulting in new commit IDs for the replayed commits. You may need to resolve some conflicts at the start to iron out some small discrepancies.
    • "git rebase --continue" to keep going
    • "git rebase --abort" to give up
  • Once finished, check the log for your "combined" branch using either "git log" or tig
    • Confirm that your "combined" branch is working as expected before performing the next step!
    • Check that the commit messages are ok from the rebase point
    • Check that the commit dates are correct and haven't been rewritten to the current date.
    • Check that usernames are correct.
  • If ALL is well, then you're ready to delete your local master branch and rewrite it using the new "combined" branch.
  • Proceed with caution; I will not be held responsible for mishaps if you are following this blindly.
    • git branch -D master
    • git checkout -b master
    • git push origin master --force
  • Your master branch has now been rewritten to include the old SVN commits.
  • Know that if anyone branched off your repo prior to this point, they will need to rebase their changes off the new "origin/master" branch in order to merge their changes in.

Sources

How to turn off Google's single sign-in popup ads

I hate it when sites have popups telling me to click things. It's enough of a pain that GDPR has mandatory banners on almost every site, but Google's overly clingly popup is something that has got to piss off.

I opened up 3 sites today looking to buy something in particular and all 3 sites showed me the same fucking popup to sign in with my Google account. No thanks, you're just wasting screen space on my phone.

In my frustration, I looked up a way to disable the ads and found that there was an option for it in the account settings!


How to get Android Studio Emulator working properly with Ryzen on Windows - actual instructions that don't suck

I recently built a new Ryzen computer and felt like getting back into Android development for some personal apps. Got Android Studio up and running without any major issues, but the emulator wouldn't run without HAXM (which doesn't work on AMD processors).


Intel HAXM is required to run this AVD. HAXM is not installed.
Install Intel HAXM for better emulation performance.
So one of the first results we all see when searching Google for "Android Studio Ryzen" is a blog post on Google's official Android developers blog titled Android Emulator - AMD Processor & Hyper-V Support, posted in July 2018.

For Windows, the instructions looked simple enough.

  1. ✔️Have an AMD Ryzen processor
  2. ✔️Android Studio v3.2 beta or higher
  3. ✔️Android Emulator v27.3.8 or higher
  4. ✔️x86 based Android Virtual Device image
  5. ✔️Windows 10 April 2018 or higher
  6. ✔️Windows Hypervisor Platform enabled
  7. ???
  8. ❌Profit

Yes yes all done, but why am I still getting the HAXM error message? I checked for any other blog posts with the AMD tag but in the past 2 years nothing else has been posted for Ryzen.

They also point you to a troubleshooting page which pretty much gave the same instructions as the blog post.

So what the hell am I doing wrong? Nothing. The docs are wrong.

Image result for principal skinner kids are wrong

There is one crucial step missing from most results on the first page of Google when it comes to this issue and I even had trouble finding it on Stack Overflow and Reddit.

By chance, I thought "if Intel needs HAXM drivers, maybe AMD does too". So I took a look in the SDK manager and there it was sitting quietly in the second tab.


  • Open up Android Studio
  • From the top menu, click on Tools > SDK Manager
  • Expand the tree from Appearance & Behaviour > System Settings > Android SDK
  • Click on SDK Tools
  • Tick "Android Emulator Hypervisor Driver for AMD Processors (installer)"
  • Click OK or Apply and let it install
  • Once its finished, open up your Android SDK folder and navigate to "sdk_path\extras\google\Android_Emulator_Hypervisor_Driver"
  • Right click "silent_install.bat" and run with Administrator rights

Now you should be able to run AVDs at a decent speed.

I wish Google would take the time to update their own docs regarding this. It's literally one or two extra lines.

Source

VirtualBox: Cloning a physical drive (HDD or SSD) to VDI on Windows

Open up Partition Manager on Windows to find your "disk number"


Open up a Command Prompt and type:

VBoxManage.exe convertfromraw \\.\PhysicalDrive2 C:\output.vdi --format VDI

Replacing "2" with the drive index you want to clone and changing the output location to whereever you want.

That should be it!

Update:

VBoxManage creates a full clone, meaning the image will take up as much space as the physical drive. If you want an image based on just the content, use Disk2vhd from Microsoft

Sources

Fix slow link clicks in Microsoft Office (Word, Excel, Powerpoint, etc)

When working with a spreadsheet with roughly 90 rows of links, I got frustrated with a 1-3 second delay when clicking on each link.

The cause

For those who don't have Internet Explorer as their default browser (who in their right mind would?), Office has implemented a workaround which does a request internally to check the response before opening the link.

This internal request also handles other cases like checking if the link points to another spreadsheet file or an external word doc file on a network drive.

The behaviour is noticeable in Office 2003, 2007, 2010, 2013, 2016 and probably 2019 onwards.

Fortunately there is an easy fix which forces link clicks to be handled by the system instead of Office.

The catch

If this all sounds too good to be true, then it is.

The fix changes a setting which sets ForceShellExecute=1, which means all links will be treated as if it was clicked from within the shell (aka Windows Explorer).

Because of that, Office no longer has any way to intercept the clicks and this breaks multi-document linkage. See this page to see if any of the scenarios affect your daily workflow before running the fix.

The fix

To stop the internal request from being made (and causing delays), go to this Office troubleshooting page and download the "Easy fix".

Run it and follow the instructions.

That should be all you need to do.

Sources:


 
Copyright © Twig's Tech Tips
Theme by BloggerThemes & TopWPThemes Sponsored by iBlogtoBlog