The greatness of Base64.Guru

A note to future self. All the best base64-related tools in one place. Base64.Guru rocks!

Also some guides on using Base64 in: JavascriptPHP, embeding data-uri into a HTML document etc.

directional sign on a sidewalk

Force Edge to do not redirect HTTP → HTTPS

A quick note on all steps needed for making sure that Edge won’t do any HTTP to HTTPS redirect:

  1. Set Automatic HTTPS (edge://flags/#edge-automatic-https) to Disabled.
  2. Disable HTTP Strict Transport Security (source):
    • Go to Net InternalsDomain Security Policy (edge://net-internals/#hsts).
    • Enter domain name into Domain field in Delete domain security policies and hit Enter (source).
    • Enter domain name into Domain field in Query HSTS/PKP domain and hit Enter to validate (source).
  3. Press Ctrl+Shift+Del, and delete all cache and browsing history (source).
  4. Add your domain in Insecure content (edge://settings/content/insecureContent) → Allow list (source).
  5. Restart Microsoft Edge.

If after above your domain or page is still being redirected to https:// after you specifically type http:// in your URL then there’s 99% chance that the redirect is server-side and there is nothing more that you can do prevent it on the client side. Sorry!

green and black industrial machine

The magic of using Print Management

I have spent my entire life with Windows (starting with Windows 3.1) and I have never ever found before how cool application we have there. It seems that Print Management in Windows can solve problems that were unsolvable before or can make solving some other problems much easier.

Cannot remove pesky “OneNote (Desktop)” driver that keeps returning? Your network printer has stopped printing suddenly? Well, go ahead and give it a try…

Read More “The magic of using Print Management”
close up view of system hacking in a monitor

The fastest way for deleting Windows.old folder

Since this is a special system folder, removing it via regular won’t work.

There are many approaches to this task, including disk cleanup tools and system settings. I found the fastest one to run either command line or terminal and executing:

takeown /F C:\Windows.old\* /R /A /D Y
icacls C:\Windows.old\*.* /T /grant administrators:F
Remove-Item -Path "C:\Windows.old" -Recurse -Force

Must be run as an administrator of course.

Get rid of “Set as desktop background” item from image’s context menu

Want to get rid of “Set as Desktop Wallpaper” item?

Then follow these simple steps:

  1. Hit Win+R, type regedit and hit Enter
  2. Hit F3, type setdesktopwallpaper and hit Enter
  3. Continue pressing sequence of Delete → Enter → F3 until there will be no setdesktopwallpaper entries

In fairly new (two weeks old) Windows 11 24H2 it took 12 iterations, so twelve image file types had this annoying entry in their context menu.

Copy contents of an Android phone with a broken screen

I have just accidentally put a heavy glass of New Year’s Eve wine on my phone’s screen. Well… shit happens!

Crushed screen or no Internet access won’t prevent you from getting files from your broken Android device. Provided that you have all the “tools” and have prepared yourself for the situation like that in the past.

You need to have:

  • An USB-C cable
  • Broken Android device with Developer Options enabled
  • Windows PC with Android Debug Bridge tools installed (should work on other OSes as well)

If you don’t have any of these, especially if you haven’t enabled Developer Options in the past then — sorry to say this — but you are screwed. Without Developer Options enabled, for security reasons, no one and nothing can access your phone. You can even pay hundreds of dollars for a “Professional Repair Service” and they will most likely fail as well.

In this case you have two options — paying for replacing a broken screen and continue using your phone normally or saying “bye-bye” to your phone and data, purchasing a new one and starting from scratch. Sorry!

But, provided that worst case scenario isn’t happening your case, read-on to see how can you copy data.

Read More “Copy contents of an Android phone with a broken screen”
a close up shot of a portable bluetooth speakers

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.

blue denim pants

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”
eyeglasses in front of laptop computer

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.

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.

white painted papers

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

New PDF Viewer

Enables the new experimental version of PDF reader. — Mac, Windows

#edge-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”

The magic of JSON on-line tools

Found some great tools of JSONCompare, JSON Editor, JSON Studio and JSON Viewer. Here is a note to future self, in case I’d have to use them in any project.

  • JSONCompare:
  • JSON Editor Online:
    • Edit JSON files in fully WYSIWYG mode with a lot of useful tools
    • Whole JSON or selected part can be edited as: plain text, tree or table
    • Save JSON data to cloud (1 MB limit) or to file, send as URL, export to CSV where possible
    • For 3 USD per month you get add-free and for 6 USD per month you can save private JSONs to the cloud
  • JSON Studio:
    • Is slow and has some bugs, but also has some fabulous features
    • Can minify and format (beautify) JSON with one click (Others button)
    • Tracks history of your edits which can save your ass in some situations
    • Can render JSON as a graphic tree (click Zoom+ or Zoom- if nothing seems rendered)
    • Can render JSON as an expandable table / grid (for nested objects has a bug and shows only first column)
    • Can generate a class diagram of DB structure (with relations!) to store your JSON in database
    • Can convert between JSON, YAML and CSV both ways (nested objects can’t be exported to CSV)
    • Also can compare two JSONs and look for possible differencies
  • JSON Viewer can only validate correctness of a JSON and beautify it

Well… that would all folks! :)

engineer holding laptop

Completely free (?) PHP hosting

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 “Completely free (?) PHP hosting”
black and silver film camera on brown wooden surface

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”
content indian guy showing paper with hindi inscription

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”
person using macbook air

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

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

Source: Super User.

boy in white t shirt sitting on chair in front of computer

Shorthand notation for Yii commands

Developing PHP applications in Yii 2 makes you use Yii command-line commands quite often (for example for data migrations etc).

Since I am a Windows maniac, I have to type php yii before each command each and every time. A bit tiring. 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.

Read More “Shorthand notation for Yii commands”

Replace “new” Paint with Classic Paint

Deleting or moving selection in Paint reveals emptiness… that is alpha channel instead of (as for past 30+ years) background color.

This is one of many stupid things introduced in “new” Paint that comes to you along with 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 “Replace “new” Paint with Classic Paint”

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.