Restarting Windows does NOT restart Bluetooth!

A memo to future self or a not to other people not aware about this simple fact.

If you Bluetooth connection or devices start getting wako in Windows 11, restarting the whole system in many scenarios won’t change anything. While turning Bluetooth off and on again can do the magic.

I had a situation where after getting Windows 11 24H2 update all my Bluetooth devices were gone (empty list) and not connecting and using “Add device” to pair them again resulted in not finding any new device.

Restarting Windows brought no change. Restarting Bluetooth adapter solved everything.

Pack contents of subfolders to a separate .zip file in Windows

I had a collection of e-books and video courses, each of them having _code_ folder containing sometimes even 30-40 subfolders and each of these subfolders containing sometimes even hundreds of thousands of files. I wanted to batch-pack contents of each folder into a separate .zip file.

The “contents” is a key here. I did not want to end up with a bunch of .zip files having one folder in its root.

Read More “Pack contents of subfolders to a separate .zip file in Windows”

HTML code in GitHub’s README.md file

When creating README.md file for your GitHub’s repository you can of course use Markdown with all it’s nifty styling. This includes as set of HTML tags that you can embed into any Markdown document.

GitHub extends this set with some extra tags, because it uses GitHub Flavored Markdown Spec, not the core Markdown implementation (a bit limited). But, it also limits it quite a lot, for security reasons.

One of the most missing feature is an ability to use in-line styling. So far, I thought that using CSS styles is simply impossible (or to be precise: you can use them, but GitHub quite aggressively strips them off when rendering Markdown content).

However, it turns out that with using a really sneaky approach, you can embed into your README.md file in your GitHub repo not only a full set of CSS styles, but also iframes, scripts and a whole lot of magic! :)

Read More “HTML code in GitHub’s README.md file”

Get rid of .github folder from project tree in PhpStorm

In 2024 it is as simple as two steps and a couple of clicks:

(click the image above, if animation seems frozen)

These two steps are:

  • Right-click .github and select: Mark directory asExcluded
  • Click three-dot button and uncheck AppearanceExcluded Files

The Excluded Files list is per-project setting, so you must repeat these steps for each of your projects.

This is, of course, purely visual fix, to hide a folder. If you want to ignore it, you must use the usual way of adding it to .gitignore folder.

New PDF viewer in Edge doesn’t support OCR at all

Microsoft has rolled out a new update to Edge. It includes something called “New PDF Viewer”:

Sadly, the new experimental version of PDF reader doesn’t support OCR at all.

You can open any of your existing or newly created PDFs. If it contains any text layer, you won’t be able to notice it. Neither trying to select any piece of document with mouse or pressing Ctrl+A have any result.

Read More “New PDF viewer in Edge doesn’t support OCR at all”

Nearly completely free PHP hosting forever with InfinityFree

Looking for some free hosting for my very simple test project, I have stepped into InfinityFree offer.

They’re probably the best in the entire universe, because they bring you a fabulous offer (nearly free forever, absolutely no ads or obligations, no credit card or this kind if stuff, no caps). But… please, read the below carefully, before actually opening a champagne bottle…

Read More “Nearly completely free PHP hosting forever with InfinityFree”

Various .gif optimization methods vs. file size

I have captured my cool spinner as a .gif animation. It has 241 frames, last 8 seconds and has 3.59 MB (3 768 320 bytes) size.

Quite huge, to be honest, so I decided to play a little bit with fabulous ezgif.com’s Animated GIF optimizer and compressor tool to see, if I can get down a little bit with it.

BTW: Consider taking a headache pills before pressing the button below! :) You’re going to see a really huge number of spinning gear wheels in this article. Believe me or not, you can get really, really wako out of watching them… spinning around… spinning around… spinning… around… around… arrrr! :)

Read More “Various .gif optimization methods vs. file size”

Translating software to Hindi language

If you consider translating your software, cloud service or game into Hingi language, you have two options:

The first option incurs some more costs due to the needs of hiring special translator and sometimes due to the need of adjusting currently used font to support all 48 Devanagari alphabet‘s characters.

I did some short research, both public and private, to see, if supporting natural Hindi language supports additional expenses from our app’s budget. And I want to share with my findings.

Read More “Translating software to Hindi language”

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

localStorage vs Firefox

For security (?) reasons (or because Mozilla developers are mentally retarded), for locally served files, Firefox is storing localStorage data per file, not per device (as it would do for domains and as other browsers does).

Sharing settings or any other data across two or more pages? Either throw Firefox to trash bin or forget it!

The solution is to detect, if you are working with mentally retarded browser and switch from localStorage to sessionStorage for it. But then, again, sessionStorage gets purged after browser or tab is closed. You will at least be able to transfer some settings (like if user want to have bigger font size or dark theme) between your locally severed pages, but the whole thing will ruin after they restart their browser.

Read More “localStorage vs Firefox”

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”

Convert HEIC images into JPG or PNG [updated]

In the original version this article was discussing how to load HEIC files in IrfanView under Windows 11. In order to convert them to a bit more natural, a bit less Apple formats like .png.

Previously I was doing such conversion on my PC using CopyTrans HEIC Codec. At the beginning of 2024 however, CopyTrans’ management hit their heads really hard and figured out that it will be so cool to start distributing their software in the way that it leaves an unbelievable mess on user’s computer (including creating icons and shortcuts everywhere, adding dozens of right-click menu items and even creating some fake disk available in This PC window).

Seeing this, I did the only thing I could do. I have flushed CopyTrans crap in the toilet and started using fabulous Convertio — HEIC Converter. Now, I am doing all the HEIC → JPEG conversion in the cloud.

Hit the button below, if you however wish to do such conversion the old-skull way, on your PC, with having fun of installing all the crap that CopyTrans HEIC Codec brings together with it.

Read More “Convert HEIC images into JPG or PNG [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”