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` (
  `name` CHAR(52) NOT NULL,
  `population` INT(11) NOT NULL DEFAULT '0'

into Yii 2 migration?


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