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

Normal.dot Word 365 template with macros and settings

In Word version prior Word 365 all you needed to do in order to customize Normal.dot template (i.e. change macros, styles, keyboard shortcuts) was:

  • Start Word with an empty doc or double click Normal.dotm in %APPDATA%\Microsoft\Templates
  • Change anything you want
  • Hit F12 and save new template under New.dotm
  • Exit Word, delete Normal.dotm and rename New.dotmNormal.dotm

This thing is one of many simple and obvious things that Microsoft made really difficult in Word 365.

If you have such file (personal template) that you have been using for years (like I do) and if you try to open it in Word 365 to add some new modification and then you save it then you will find that everything you changed (now and earlier) will be lost. For some stupid reason known only to Microsoft freaks.

Here is how to have modified Normal.dotm with all your settings in Word 365.

Read More “Normal.dot Word 365 template with macros and settings”

Your eyes are tired? Night Eye to the rescue!

Windows 11 finally introduces nearly full, system-wide support for black / dark user interface. It’s Microsoft, so you can’t except 100% success (Properties-like, delete confirmation and other system dialogs are still terribly and painfully white), but still.

Then the question comes: what about websites? Everything is so (peacefully to your eyes) dark… until you open your web browser and navigate to a first website.

The answer is: Night Eye browser extension.

They offer you a three months long free test period, but believe me or not, you only need just a few days (or sometimes even a couple of hours) to fall in love so deeply that you simply can’t imagine life without it!

Read More “Your eyes are tired? Night Eye to the rescue!”

Extension incorrectly registered in Windows 11 and how to fix this [updated]

This document is now updated for Windows 11, version 22H2 installed on 28.09.2022.

I have installed IrfanView (for browsing images) and VLC VideoLAN (for watching video) — my “default pack” on freshly installed Windows 11 Pro. It turned out that many common file extensions (like .gif, .png, .jpg, .mp4, .mkv and .avi) are not registered with the corresponding applications. While all others (like .bmp, .mp3, .wav, etc.) are registered correctly.

Microsoft has messed things up even further with Windows 11 so the regular methods of manually registering these file extensions (that were working just perfectly in Windows 10) are not working anymore.

If you’re struggling with this or similar problem then you may find certain solutions in this blog post.

Read More “Extension incorrectly registered in Windows 11 and how to fix this [updated]”

Additional keyboard layout available in Windows

If, after installing Windows 10 or 11 and some languages, when you press Win+Space you see some additional keyboard language (the one that does not belongs to any installed language):

Then the solution is as simple as:

  1. Install that language (English (United Kingdom) in the above example)
  2. Go to language details and install the keyboard layout (Polish (Programmers) in here)
  3. Uninstall the whole just added language language pack

After that pressing Win+Space should reveal only languages and keyboard layouts that you have actually installed in your system.

Source: How to get rid of US language in Windows 11.

Remove garbage from Windows 11

Four years later (after this article) I am removing “uninstallable” garbage from Windows 11 this time. The “uninstallable” is a new word that denotes applications, programs and system elements that you cannot uninstall the regular way (i.e. using Add or Remove Programs component in Settings). But you can with a little bit help from Windows PowerShell and this article.

To not make this post too long, consider it as an update to the original text with only list of applications that can be uninstalled the mentioned way from Windows 11. If you have any additional questions or problems (i.e. how to bring back something incorrectly uninstalled) then, please, refer to the original post.

Read More “Remove garbage from Windows 11”

Export PuTTY settings or sessions out of Windows Registry

PuTTY stores all sessions in Windows Registry, not in a file, so if you want to export these and import on some other computer or account then follow these steps (source):

  1. Press Win+R to run Registry Editor in Windows
  2. Type or paste the following (and hit Enter to confirm):
regedit /E "C:\Trash\PuTTY Settings.reg" HKEY_CURRENT_USER\Software\SimonTatham

Adjust path after /E switch to match your expectations.

Execute the following (instead of above):

regedit /E "C:\Trash\PuTTY Sessions.reg" HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions

if you wish to export just sessions, not the entire configuration of PuTTY.

Double click exported .reg file in order to import sessions or settings on a new computer.

Source: How to Export and Import Putty Settings (by TechEarl -May 27, 2018)

Adding new application to Yii 2 Advanced Project Template

After writing the previous article I have realized that I solved the problem quite wrong. I added the example RESTful app controller to the frontend application in the multi-application Yii 2 Advanced Project Template environment.

I have also realized that the corresponding Yii 2 Guide is very, very poor and limited. It only tells you that you can have many applications (like backend, fronted and console) in the multi-application Yii 2 Advanced Project Template environment. But it leaves you completely guessing on how to actually add new application.

This quick article is my memo to remember steps that must be undertaken in order to achieve this.

Read More “Adding new application to Yii 2 Advanced Project Template”

The quickest way to add RestAPI to your Yii 2 app. Part 2

As explained in the previous article, the example given in Yii 2 Guide about turning regular MVC apps into RESTful one is of a low quality, as it mixes certain things (refer to the previous article for details).

This article deals with this problem and show how to enable REST in Yii 2 Advanced Project Template by adding REST UserController directly to frontend application in that template and thus allowing to server User model through RESTful approach.

Read More “The quickest way to add RestAPI to your Yii 2 app. Part 2”

Reducing PowerPoint presentation’s file size using brute-force method

Since Microsoft is Microsoft and the software produced by this company may surprise you in many ways, it may happen that the ideas given in the previous article turn out to be not enough. And file size of your PowerPoint presentation will still be too big.

In this case a more brutal method is needed.

Since every Microsoft Office document is in fact a .zip archive, we will try to reduce file size by direct modification or manipulation of the content of this file.

Read More “Reducing PowerPoint presentation’s file size using brute-force method”

The quickest way to add RestAPI to your Yii 2 app. Part 1

The example given in Yii 2 Guide is of a low quality, because it It requires User model based on database, not a file. And the guide mixes two things together:

  • Yii 2 Basic Template, which is used in this example, has User model, but based on itself (on a file — list of users is given as an array)
  • Yii 2 Advanced Template has User model based on database, but it uses a multi-application concept in the same time and adding REST support, like shown in this example, isn’t possible.

As an effect, people who just starts their journey with Yii 2 and REST are often confused and finds official example not working in their side.

This article deals with this problem and show how to enable REST in Yii 2 Basic Project Template by using some model (database-based) other than User model.

Read More “The quickest way to add RestAPI to your Yii 2 app. Part 1”

Convert IMG ↔ ISO and other disk image types

To not make our lives too easy, Microsoft decided to distribute offline installers for Windows 11 in well known .iso format while shipping Office 365 offline installation images as .img.

I don’t like the other format and I don’t have any software to work with it, so I needed to find a way for converting .img disk image format into .iso image.

Various methods and issues around this are discussed in this article.

Read More “Convert IMG ↔ ISO and other disk image types”

Reduce PowerPoint presentation’s file size in easy steps

In these days we want to have our PowerPoint presentations “rich and beautiful”. Cool fonts, soft backgrounds and a serie of animations or transitions that pisses-off everyone except presentation’s author are just not enough. We want to have many beautiful images do depict our presentations. Maybe we even want every slide to have different fully photographic background etc.

This is especially true given the fact that there are many services like pixabay.com which offers you hundreds of thousands of beautiful photos completely royalty-free.

However, there’s a well known problem with PowerPoint. If you add any filter or modification to the image placed on some slide, it will be internally saved as PNG format irrespective of the actual format that source image has!

For example, I had a tiny, 9-slides presentation, where each slide had a different full-page photo as a background. Because images were too bright (overlying slide’s text was hard to read), I applied a -40% brightness filter to each image. All my nine source images were saved as JPEGs and took only 1.50 MB on disk. But PowerPoint presentation using them had… 18,1 MB! Over ten times more. And I had to implement a serie of steps to prevent that.

Read More “Reduce PowerPoint presentation’s file size in easy steps”

Customize how Office starts or default Office templates

You can have customized document (Word), workbook and worksheet (Excel) or presentation (PowerPoint) opened up as default whenever you start corresponding Microsoft Office application.

In this article I’ll be talking a little bit about file name, content and location for each of three key Microsoft Office components. That is, what to store, where to store and how to name a file.

Read More “Customize how Office starts or default Office templates”

Duplicating current tab out of omnibar

Most of you probably know this for years, I have discovered this today:

  • Ctrl+Enter in browser’s omnibar — open currently entered URL in new window
  • Alt+Enter — open in new tab

Tested in Microsoft Edge. Probably works in Chrome and maybe in others.

Works for URL currently entered to the omnibar, not on current page’s URL. Meaning that you can hit F4 then change current page’s URL a little bit and then hit one of those above and get modified URL opened in either new window or tab.

Useful for quickly duplication current tab: F4 + Alt+Enter.

I know that there’s Ctrl+Alt+K, but it seems less natural to be remembered and doesn’t allow to duplicate current tab with modified URL, because it works on current page’s URL.

Prevent PowerPoint from auto-changing typing language

On freshly installed PowerPoint when you start typing any content in any slide, your language will be automatically changed to your keyboard language layout. If you have your presentation in any other language they you’ll start seeing (nearly) every word underlined as not correct, which is very annoying.

Both solutions that I found in the Internet (this one and this one) turned out to be wrong or not enough, so I had to come with my own.

Read More “Prevent PowerPoint from auto-changing typing language”

Configure virtual hosts for separated apps in Advanced Project Template

When developing web applications in PHP based on Yii 2’s Advanced Project Template you have a clear separation between two applications:

  • Backend — for service’s admins
  • Frontend — for regular users

There’s also a separate console application but it isn’t important from web applications perspective as it is not accessed remotely via URL, but rather locally in console.

In local development environment you can separate access to these two applications using various methods:

  • Two separate domains — i.e. frontend.localhost and backend.localhost
  • Two subdomains — i.e. app.localhost and admin.app.localhost
  • Separate port — i.e. app.localhost and app.localhost:8080

This article deals with all three scenarios, but using XAMPP/Apache for Windows only. You must adjust provided examples, if you’re running Apache on different operating system.

Read More “Configure virtual hosts for separated apps in Advanced Project Template”

Create a non-standard primary key in Yii 2 migration

If you need a typical primary key then use $this->primaryKey() in your migration file. You can also use something like $this->primaryKey(2), if you need a bigger (here int(2)) primary key.

But, what when you need a non-standard primary key, i.e. you want to turn following example SQL code:

CREATE TABLE `country` (
  `code` CHAR(2) NOT NULL PRIMARY KEY,
  `name` CHAR(52) NOT NULL,
  `population` INT(11) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

into Yii 2 migration?

Calling:

'code' => $this->primaryKey()->char(2)->notNull()

will fail with error:

Exception: Calling unknown method: yii\db\mysql\ColumnSchemaBuilder::char()

Now, what Qiang?

Read More “Create a non-standard primary key in Yii 2 migration”

Running Office 365 apps in Safe Mode

There’s a handy Safe Mode for all Office 365 offline apps (and probably for older version of Office as well) that you can use to start any Office app without any add-ins and many other things (like themes, animations, etc.) turned off or disabled. Very handy for diagnosing possible problems with some Office app.

To enable it, simply hold Ctrl key when launching any of Office app. When you see app’s button in the taskbar, release the Ctrl key, click that button and answer Yes in the dialog window that appears:

That would be pretty much all.

Block all traffic from Russia to coming your site

Whether you want to say “no!” to Putin’s war or you just want to block Russian hackers from attacking your website, the solution is as easy as:

  1. Connect to your website via FTP and download current version for .htaccess file from there
  2. Make a copy of this file, just in case…
  3. Go to Country IP Blocks website
  4. Search for Russian Federation and check the checkbox next to it
  5. Scroll the page all the way up and make sure that Apache .htaccess Deny is selected
  6. Click Create ACL button and copy all the content from ACL Results list that will appear
  7. Paste it at the end of your .htaccess file and save the file
  8. Upload it back to your website via FTP overwriting the existing file

Sure, this is not the ultimate solution. Use of proxy servers, Tor networks, botnets and other techniques for spoofing actual IP address will get them through your “so called firewall”. Also, IP address assigmnets changes often, so Country IP Blocks database might already be out-dated (if fact, it is). But, hey!, it’s always something. As good for the start as anything else. And surely better than doing nothing.

Read More “Block all traffic from Russia to coming your site”

Simple data validation or enum fields in Excel

Excel is still often used for simple time tracking or roadmap planning in small IT projects. It is good to know that with a simple steps you can create a basic data validation for certain fields in your sheets.

Kind of validation, as discussed here, focuses on forcing user to select or enter only values that are found in some reference list (dictionary). A classing enum / enumerator field well known in databases. If user provided an incorrect (out of scope) value then an error is displayed:

Unfortunately, due to nature of Microsoft Excel, this fails completely when data is pasted.

Read More “Simple data validation or enum fields in Excel”