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”

Fix small HDD surface errors using low-level format

Anyone out there still using a non-SSD disks or hard disks at all? :) While I do believe in cloud data storage, I am an old dinosaur that wishes to have some off-line copy of my most important data. For this reason, I am using (for past 12+ years) a NAS and a number of 4-5 TB disks (I have a lot of important data).

Two days ago one of my disks started to get wako with me being unable to copy certain files. My diagnosis was quick and only confirmed by designated software — surface error, years ago known as “bac blocks”.

Since the disk was one month after five years long warranty, I had to try to fix it myself. For this reason I used two free pieces of software — HDD Low Level Format Tool 4.40 and HD Tune 2.55 Free to confirm.

Read More “Fix small HDD surface errors using low-level format”

Get rid of “Pick up where you left off” from Word — three methods

Microsoft loves to “enrich” our lives with a wonderful (in their opinion) yet totally useless and pissing off (in our opinions) features. The “Pick up where you left off” is one of them.

This tiny little thing wouldn’t be so irritating and could be easily ignored, if it wouldn’t be for a single fact. It blocks keyboard shortcuts completely, until it hides itself (so for approx. 3-5 seconds)! Preventing you from pressing Ctrl+F to do an ultra-fast-searching-millisecond-after-opening-a-document (my beloved feature).

There’s a fairly easy solution to this problem (my own article) that requires you to do some dirty tricks in the Windows Registry. One and a half month after writing that article it turned out that a method described there simply isn’t working at all on one of my computers. So I came out with the following post.

Read More “Get rid of “Pick up where you left off” from Word — three methods”

Randomize background of a webpage

Suppose that you have a landing page (or just a cool background) and you have some many versions of it, and all so beautiful, that you can’t decide which one to show. Some kind of weird solution is to show them all in a random manner.

If you wish to achieve something similar to this then all you need is a really short piece of HTML, JavaScript and CSS. All can be put to a single file.

Since I like a clean and easy solution, this one use pure-JavaScript. No jQuery stuff etc. included.

Read More “Randomize background of a webpage”

Sending executable file through Gmail in Windows

For obvious security reasons, Google will do anything that is in their power to stop you from sending .exe, .apk and other executable files as email messages’ attachments. But, sometimes it is very needed to send such file (in a completely legitimate scenarios). And doing so in Gmail becomes a serious task.

This is, because simple encrypting (password-protecting) such files isn’t enough right now. Since password-protected files encrypts their content only and thus list of attached files is available. Gmail can scan such file and learn that you’re trying to send an executable file even without knowing the password.

Simple extension rename: .exe –> .nothing also doesn’t work today. Google is somehow able to check mime-type of files attached in encrypted archives and doesn’t rely on file extensions anymore.

Read More “Sending executable file through Gmail in Windows”

Start Office 365 apps with a document

Office 365 off-line apps brings new start-up behavior of showing a summary screen instead of starting with an empty document open. If you like the “old” behavior then there’s a very easy way to achieve this:

  1. Open Word / Excel / Power Point
  2. Go to OptionsGeneralStart up options
  3. Uncheck the Show the Start screen when this application starts item
  4. Click OK to confirm

Restart app to see the effect.

Full-screen vertically and horizontally centered text in CSS

This is as easily as adding one single div:

<div class="css-vh-center">
    Hello World <br />
    Hello World <br />
    Hello World <br />
</div>

and styling it properly:

.css-vh-center {
    position: fixed; /* or absolute */
    top: 50%;
    left: 50%;
    /* bring your own prefixes */
    transform: translate(-50%, -50%);
}

All the glory goes to this Stack Overflow answer.

Note that this is not using flex-box solution (see the above linked answer for details), so should work even in older pre-IE8 browsers.

Read More “Full-screen vertically and horizontally centered text in CSS”

Disable “Pick up where you left off” in Word

The “Pick up where you left off” is one of the worst features that Microsoft added to Word, because it prevents you from quickly opening and searching the document. With this feature enabled, now you have to wait approx. 3-5 seconds after you open any document and before you can hit Ctrl+F.

Disabling this feature is fairly easy, but — because this is Microsoft — again involves messing up with the Windows Registry, so you need administrator account in order to perform these steps.

Read More “Disable “Pick up where you left off” in Word”

Remove one-letter word (orphans) from the end of line

In English an orphan is:

A paragraph-opening line that appears by itself at the bottom of a page or column, thus separated from the rest of the text

Thus, in English typography it is understood in the context of the whole paragraph. Single line of a new paragraph, left alone on the preceding page (before page break) is not allowed.

Polish language is more strict by that and “explores” an alternative (less known) definition of “orphan”. In Polish typography this term is understood in the context of single line and regarded as a:

Single word (single letter in most cases) left along at the end of line (next to right paragraph).

And similarly this is prohibited in Polish typesetting.

In this article you can find a Word macro for removing such orphans from your text.

Read More “Remove one-letter word (orphans) from the end of line”

From Google Maps to Strava…

…or any other service, software or device that supports .gpx files. In one… two… six… steps! :)

  1. Plot any track in Google Maps
  2. If there are alternative routes found by Google, make sure that you’ve picked just one
  3. Copy entire URL and paste it into Maps to GPX service
  4. Download resulting .gpx file
  5. Create a new route in Strava
  6. Click Upload GPX button and upload downloaded .gpx file

And… you’re done.

Read More “From Google Maps to Strava…”

Update Origin when it claims a missing DLL

Because Electronic Arts hires a complete morons as developers of their Origin software, you will often find yourself in a situation where:

  • Automatic update of Origin for PC fails asking you to download offline installer
  • Running offline installer fails with missing DLLs error

Leaving you with virtually no options for updating Origin client.

“Virtually”, because by a complete accident I found a solution for EA stupidity.

Read More “Update Origin when it claims a missing DLL”