Reload page without cache in Microsoft Edge

Pressing Ctrl+Shift+R for Hard Refresh (instead of Ctrl+R for Normal Refresh) may not always invalidate cache of the page that you are currently viewing.

If you want to truly reload page from server (bypassing local copy stored in cache) then you must:

  • Press Ctrl+Shift+I to open Dev Tools for a moment
  • Right-click Refresh button in the toolbar
  • Click Empty cache and hard refresh option in context menu

An example:

Since Edge is based on Chromium, the very same trick will work in Chrome as well.

Source: Super User.

Shorthand notation for Yii commands in Git Bash and Windows Terminal

Developing PHP applications in Yii 2 makes you use Yii command-line commands quite often (for example for migrations). Since I am a Windows maniac that uses XAMPP, I have to type:

php yii

before each command each and every time.

A bit tiring so I wanted to make this a little bit easy. For example, to be able to type:

y migrate

instead of:

php yii migrate

Getting there was quite easy for Windows scripts and using Windows Terminal. Things has got a little bit complicated when trying to achieve the same in PhpStorm. Which uses GitBash instead of Windows Terminal.

Read More “Shorthand notation for Yii commands in Git Bash and Windows Terminal”

Deleting or moving selection in Paint reveals emptiness…

…that is alpha channel instead of (as for past 30+ years) background color.

This is introduced in September 2023 software update and naturally cannot be turned off by means of changing anything in configuration. It is always one Microsoft way.

The easiest and fastest way of getting rid of this, is to get “old” Paint back.

Read More “Deleting or moving selection in Paint reveals emptiness…”

Customize delete confirmation in GridView

As nearly everything in Yii 2, you are starting from scratch with out-of-the-box solution for displaying models in grids (using yii\grid\GridView). Usually last among columns ($columns) of such grid there is an button column (yii\grid\ActionColumn) that serves basic operations for corresponding row or item. One of such column’s buttons there’s a delete button.

Everything is ready for you, to be used without much effort, but only as long as you are building an English-only application, as translating or customizing delete confirmation in such scenario isn’t a super-easy task. One of a great approaches is given in here: How to create a custom delete button?.

But, it works just great, if you want to customize just a single delete button of a one or maybe two grid view. What about, if you have a grid view for each and every of your data model?

Read More “Customize delete confirmation in GridView”

One of two model’s attributes must be provided

Suppose that we have any Yii 2 model with to and from attributes. And we want to make sure that either of them is provided. So we need a logical OR relation between these two attributes.

A slightly modified Stack Overflow example will do the trick:

['from', 'required', 'when' => function($model) {
    return !is_numeric($model->to);
}, 'message' => Yii::t('models', 'Either "to" or "from" must be provided.')],

Using a closure (an anonymous function) is all the “magic” here. We use it as a value $when of property of yii\validators\Validator (actually yii\validators\RequiredValidator in this case).

To basically tell Yii 2 that it must validate whether from does not have null or empty value if, and only if to does not have null or empty value as well.

Adding tags to git repository

This is just a quick memo to remember how to add tags to repositories.

For exiting commit:

  • List all commits: git log --pretty=oneline
  • Pick the one you wish to tag (first seven letters of the has are enough), i.e.: 32c274c
  • Add a tag: git tag -a 0.1.0 32c274c -m "First version before general refactor"

For latest commit: git tag -a 1.4.5 -m "My version 1.4.5".

Tags are always added to local repository and never pushed to remote by default. You have to explicitly tell git to do so. For example, by executing git push --tags.

More info in Git Basics – Tagging and Managing releases in a repository.

Read More “Adding tags to git repository”

Load HEIC files in IrfanView under Windows 11 [updated]

The corresponding part in IrfanView FAQ is incorrect in most parts under Windows 11 (maybe it works under Windows 10). The HEVC Video Extensions (1st point) and HEIC Codec (2nd point) are blocked by either Microsoft Store app or Windows itself to protect PC. The HEIF Image Extensions (1st point again) are already installed under Windows 11, but having it doesn’t allow IrfanView to open HEIC files.

The only solution that actually worked is CopyTrans HEIC Codec (3rd point). After Installing it in Windows 11 the .heic files system association is reset. You have to select again that you want IrfanView to open this type of files. After doing this — bang! — you can finally browse HEIC files in IrfanView.

Read More “Load HEIC files in IrfanView under Windows 11 [updated]”

Bring back ALL the original Windows 11 apps

Many users starts their journey with Windows from uninstalling all the crap that ships with the system. Sometimes you may go a bit too far with that process and remove something that you actually need or an app that (when missing) causes Windows to act strangely.

In such case you can run Windows PowerShell as an administrator and execute the following command:

Get-AppXPackage -AllUsers | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}

Keep in mind that it will reinstall all the apps that your Windows originally came with! In my case it was 115 apps added (I didn’t even realized before that I removed that much crap out of my Windows 11).

Setting git user globally or for given repository

This is just a quick note to future self about operations on git user and emails address.

1. Read current setting for given repository:

cd template-repository
git config user.name
git config user.email

2. Read global settings (affects all new repositories on given PC):

git config --global user.name
git config --global user.email

3. Change current setting for given repository:

cd template-repository
git config user.name "johnny.bravo"
git config user.email "johnny.bravo@cartoonnetwork.com"

4. Change global settings (affects all new repositories on given PC):

git config --global user.name "johnny.bravo"
git config --global user.email "johnny.bravo@cartoonnetwork.com"

You may also want to read about setting your commit email address, setting your username in Git or blocking command line pushes that expose your personal email address in GitHub Help guide.

If you wish to check or change your GitHub user in PhpStorm then Ctrl+Alt+SGitHubEnter.

Reviewing your current email settings in GitHub can also sound like a good idea.

Rename Bluetooth devices in Windows 11 22H2

Starting with 22H2 edition of Windows 11 it seems impossible to rename Bluetooth devices. Folks at Microsoft was cleaver enough to figure out that you don’t need such functionality. Nice.

Pity that I really need it, because I have two exactly the same headphones (one at home and one at office) that does not support auto-connect and must be manually connected. I never know which one I am connecting, because both are named “Edifier W600BT” in my system.

The only solution that I figured out is to use tiny software called BtDeviceRenamer (here is a direct link to downloadable .exe file). Please, be aware that since it directly interface with devices, it can (and probably will be) detected by Windows or your anti-virus software as a possible threat.

EDIT: Nope, even this one fails. Windows 11 enforces its own name upon next login or after just a couple of minutes. Thank you, Microsoft, for knowing better what we need or want.

Fix for up-side down duplex scanning in WIA

When scanning using WIA (Windows Image Acquisition) through certain apps (NAPS2 — Not Another PDF Scanner 2 in my case) and on certain scanners (Canon MX920 in my case), you may run into situation where all odd pages are scanned up-side down. Even though they’re all fed correctly to the ADF:

This is certainly not your software problem and most likely not WIA’s one, but probably comes from the fact how your scanner driver “talks” through WIA to your scanning software.

Fortunately, fix is very simple.

Read More “Fix for up-side down duplex scanning in WIA”

Use deliveredto: Gmail filter to capture non-typical SPAM

For past 3-4 months I started experiencing a very weird (?) kind of spam:

  • Always landing in Gmail’s Spam folder
  • That I couldn’t filter out using typical methods

Because:

  • Somehow sender (and sender’s domain) was always white-listed and legit
  • Sender was always different (auto-generated)
  • Recipient was also always different and always not my mailbox(es)

In fact, the only common thing about these messages was that always landed in my Spam box in three copies, ultimately (no matter what the recipient was) delivered to my personal and company mailbox.

The word “delivered to” told me what solution I should consider.

Read More “Use deliveredto: Gmail filter to capture non-typical SPAM”

KeePass’ auto-type feature vs. browser’s password manager

I personally adore KeePass! But… mainly not for being my private Fort Knox and my single source of all passwords. As I can have the same with every browser’s password manager. What is an absolutely fabulous feature of KeePass, is its powerful auto-type mechanism.

Not only, this is easier and more convenient, but — the most important — it is by far, much, much more safe (see details later into this article)!

Now, the biggest problem is that I also have and I am also using password manager in my browser (similarly beloved Microsoft Edge; screw you Google!). And when I press Ctrl+U to open corresponding URL in a browser, I have login field already prefilled. Usually with an incorrect login, as I have a lot of account saved for every web service in my password manager.

Fortunately, there’s a solution even for this.

Read More “KeePass’ auto-type feature vs. browser’s password manager”

Quick changes in repository name

This is just a quick memo to future self on what should be done locally, if I rename some GitHub repo:

git pull
git push
git prune
git remote prune origin
git status

Or even faster:

git pull && git push && git prune && git remote prune origin && git status

I am changing a lot of my repos’ names to figure out some static scheme. This is a “toolset” for that process.

How to check GitHub user’s registration date…

…and other basic account information for any GitHub user?

There are at least two ways of getting this information:

  • the “clickable” way and
  • public API call

The documentation for API call tells about required token, when calling it from cURL or JavaScript.

But my tests has proven that simply pasting this URL to browsers’ address bar doesn’t require any token and works even if you are not logged in to any GitHub account.

Read More “How to check GitHub user’s registration date…”

PayPal exchange rates

It is very surprising that it is so hard to find actual PayPal exchange rates.

If you search the net for this query, you’ll find a bunch of useless results. With the one pointing you directly to PayPal page titled “Where can I find PayPal’s currency calculator and exchange rates?“. It tells you to go to Wallet and click Currency Calculator. This is completely pointless page, not updated for many years (shame, PayPal!). Currency calculator is gone and no longer available in the Wallet for years.

Finally, I have found a webpage that can do the actual currency conversion using PayPal exchange rates!

Read More “PayPal exchange rates”

Use SonarQube to debug PHP code

Installing and using SonarQube Community Edition to debug your PHP code its fairly easy. But in involves a number of steps, spread among few docs, so I decided to write myself this little memo to compile one single step-by-step flow for this.

I assume that I’ll be using SonarQube to check quality of my PHP project (though SonarQube supports dozens of languages). This project is stored locally and directly accessible (this article does not cover dealing with repositories or embedding SonarQube into your release pipelines).

I am using XAMPP to host my PHP projects locally, but that part doesn’t play any significant role here.

Read More “Use SonarQube to debug PHP code”

Show errors in PhpStorm with one click

I am more a tech writer than a programmer. In every app or service that I use (except PhpStorm) I am get used to the fact that I have to click only one time in order to see some error or problem proposed solutions. This works like that in Word and in dozens of other places.

Being get used to this for past 10+ years, it drives me crazy that in PhpStorm this operations always requires two clicks be default. I.e. you have:

  • Right-click underlined word to open context menu
  • Click Show Context Actions item in that menu

There is no way to change it AFAIK, but I found a nice way to make using of this feature a bit easier.

Read More “Show errors in PhpStorm with one click”

Help! My computer goes to sleep 1 minute after I lock it!

Imagine yourself situation, in which you strictly told Windows 11 that you don’t want it to go to sleep under no circumstances, no matter what happens, as long as it is wall-connected and not battery-powered:

And suddenly you realize that 60 seconds after you lock your Windows with Win+L, it goes to sleep anyway.

What now, Bill? Stand back…

Read More “Help! My computer goes to sleep 1 minute after I lock it!”