Category Archives: Windows

Microsoft Windows Operating Systems

Windows 10 Shortcuts

Keyboard shortcut Action
Ctrl + A Select all content.
Ctrl + C (or Ctrl + Insert) Copy selected items to clipboard.
Ctrl + X Cut selected items to clipboard.
Ctrl + V (or Shift + Insert) Paste content from clipboard.
Ctrl + Z Undo an action, including undelete files (limited).
Ctrl + Y Redo an action.
Ctrl + Shift + N Create new folder on desktop or File Explorer.
Alt + F4 Close active window. (If no active window present, then shutdown box appears.)
Ctrl + D (Del) Delete selected item to the Recycle Bin.
Shift + Delete Delete selected item permanently skipping Recycle Bin.
F2 Rename selected item.
ESC Close current task.
Alt + Tab Switch between open apps.
PrtScn Take screenshot and stores it in clipboard.
Windows key + I Open Settings app.
Windows key + E Open File Explorer.
Windows key + A Open Action center.
Windows key + D Display and hide the desktop.
Windows key + L Lock device.
Windows key + V Open Clipboard bin.
Windows key + Period (.) or semicolon (;) Open emoji panel.
Windows key + PrtScn Capture full screenshot in the “Screenshots” folder.
Windows key + Shift + S Capture part of the screen with Snip & Sketch.
Windows key + Left arrow key Snap app or window left.
Windows key + Right arrow key Snap app or window right.

Fix Windows 10 Update Failures, e.g. Error 0x800f081f

Run Command Prompt or PowerShell  as administrator and enter the following commands to repair Windows system files. Once complete reboot and try running the update again.

DISM /Online /Cleanup-image /RestoreHealth

SFC /Scannow

DISM (Deployment Image Servicing and Management) manages both Windows Online and Offline Images and repairs system files

  • /Online switch instructs DISM to target the running Operating System instead of an offline Windows image (.wim) file or virtual hard disk (.vhd or .vhdx)
  • /Cleanup-Image switch performs cleanup and recovery operations on the running Operating System
  • /Restorehealth switch scans the running Operating System for corrupt files and attempts to fix them

SFC (System File Checker)

  • /Scannow will scan all protected system files, and replace corrupted files with a cached copy that is located in a compressed folder at %WinDir%\System32\dllcache

The above procedure also fixes Windows Defrag not running properly due to corrupt system files.

Change Windows 10 Users Folder Name

  1. Run ‘command prompt’ as administrator” and enter following
  2. net user Administrator /active:yes
  3. Sign out
  4. Log in with “Administrator” account. If newly activated wait up until Windows sets up the account
  5. From Start Menu right-click on Start Menu icon and select ‘Computer Management’
  6. If “Local users and groups” not listed run steps below to install Local User and Group Management (lusrmgr.exe) Console for Windows 10 Home
  7. Click on “Local users and groups”
  8. Click ‘Users’. Right-click on the Windows user name you want to rename and rename to the new name
  9. Close ‘Computer Management’ or lusrmgr program
  10. Open File explorer and go to ‘users’ folder. Right-click on the user folder and choose ‘rename’ and rename it to the new name
  11. Run ‘regedit’
  12. Select HKEY_LOCAL_MACHINE\ SOFTWARE\ Microsoft\ Windows NT\ CurrentVersion\ ProfileList
  13. Find the new named profile and double click on ‘ProfileImagePath’ and rename it to the new name
  14. Close ‘regedit’
  15. Signout and log in with new named account
  16. Open ‘File Explorer’
  17. Go to the ‘users’ folder to see ‘users’ folder has the new named user home folder
  18. Disable the Administrator account (note this does not delete the account)
    1. Run ‘command prompt’ as administrator” and enter following
    2. ‘net user Administrator /active:no ‘
    3. Close ‘command prompt’

Install Local User and Group Management (lusrmgr.exe) Console for Windows 10 Home

Download and install lusrmgr.exe program from Itectics and launch to get access to Windows Local User and Group management console. Continue from step 7 above.

Disclaimer: operations above run at the users own risk with no guarantees or responsibilities

Add .wps and .xlr Works associations to Office 2010 Starter Edition

Do the following (with Admin account) to associate .wps (Works document) and .xlr (Works spreadsheet) file types to Word and Excel.

  1. Create Restore point to roll-back in case you make a mistake editing the Registry
  2. Run Regedit
  3. Locate HKEY_CLASSES_ROOT \ .doc
  4. Right-click .doc key and select Export and save to Desktop file as, e.g. docassoc.reg. The contents should look like the sample below.
  5. Repeat steps 3-4 for .xls
  6. Exit regedit
  7. In file File Explorer Copy & Paste docassoc.reg renaming the target file to wpsassoc.reg
  8. Similarly create xlrassoc.reg using xlsassoc.reg as source
  9. Edit wpsassoc.reg and replace .doc with .wps and save
  10. Edit xlrassoc.reg and replace .xls with .xlr and save
  11. Double-click wpsassoc.reg and xlrassoc.reg to add the new keys to the Registry under HKEY_CLASSES_ROOT
  12. That’s it  – double-clicking .wps or .xlr files in File Explorer  will now open them in Word or Excel automatically. Also the file icons will change to recognisable Word and Excel files
docassoc.reg

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.doc]
@="Word.Document.8"
"Content Type"="application/msword"
"SoftGridSource"="{90140011-0066-0409-0000-0000000FF1CE}"

[HKEY_CLASSES_ROOT\.doc\OpenWithProgIDs]
"Word.Document.8"=hex(0):

[HKEY_CLASSES_ROOT\.doc\PersistentHandler]
@="{98de59a0-d175-11cd-a7bd-00006b827d94}"

wpsassoc.reg

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.wps]
@="Word.Document.8"
"Content Type"="application/msword"
"SoftGridSource"="{90140011-0066-0409-0000-0000000FF1CE}"

[HKEY_CLASSES_ROOT\.wps\OpenWithProgIDs]
"Word.Document.8"=hex(0):

[HKEY_CLASSES_ROOT\.wps\PersistentHandler]
@="{98de59a0-d175-11cd-a7bd-00006b827d94}"


xlsassoc.reg 

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.xls]
@="Excel.Sheet.8"
"Content Type"="application/vnd.ms-excel"
"SoftGridSource"="{90140011-0066-0409-0000-0000000FF1CE}"

[HKEY_CLASSES_ROOT\.xls\OpenWithProgIDs]
"Excel.Sheet.8"=hex(0):

[HKEY_CLASSES_ROOT\.xls\PersistentHandler]
@="{98de59a0-d175-11cd-a7bd-00006b827d94}"


xlrassoc.reg 

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.xlr]
@="Excel.Sheet.8"
"Content Type"="application/vnd.ms-excel"
"SoftGridSource"="{90140011-0066-0409-0000-0000000FF1CE}"

[HKEY_CLASSES_ROOT\.xlr\OpenWithProgIDs]
"Excel.Sheet.8"=hex(0):

[HKEY_CLASSES_ROOT\.xlr\PersistentHandler]
@="{98de59a0-d175-11cd-a7bd-00006b827d94}"

Notes:

  • In order to edit .wps or .xlr files in Office 2010 Starter Edition you have to first add the Works file converter. Later versions have this built in.

Disclaimer: The above procedure is carried out at your own risk and offer no guarantees

Windows 10 F8 Safe Mode Boot

Follow steps below to enable F8 safe mode boot (applies to Windows 10 and 8.1):

  1. Boot PC using Windows 10 (8.1) iso USB flash drive or DVD
  2. Click Next to skip the first screen
  3. Press Shift + F10 To open advanced Command prompt window

Type the following command to enable F8 Safe Mode boot key:

bcdedit /set {default} bootmenupolicy legacy

Type Exit and press Enter to quit the Command Prompt. Remove your usb flash drive or DVD and turn your computer off. When you start your PC, you can now press F8 to get the Advanced Boot Options menu

 

 

 

Command Prompt

Some less well known Windows 7, 8.1, 10 Terminal (cmd) commands

Command Description
powercfg /batteryreport Detailed battery diagnostics >  html
netsh wlan show wlanreport WLAN data last 3 days > html
Alt+Enter Full screen mode
F7 List previous commands
doskey /history > c:\cmd.txt Save command history to \cmd.txt to view last saved history session
msinfo32 System Summary  >  BIOS version amongst others
findstr /s dinosaur *.txt Search inside your files with findstr add /s to search subfolders
sfc /scannow
Fixes corrupted system files by replacing them with fresh ones from the local  Windows recovery image
dism /online/cleanup-image /checkhealth
Check the health of the recovery image. If you see a message saying corruption has occurred run command below
dism /online /cleanup-image /restorehealth
Fix recovery image. Only run if you have Checkhealth errors
powershell
Switch to Powershell in same window
start powershell  Start Powershell in a new window
 Get-AppXPackage -AllUsers | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register “$($_.InstallLocation)\AppXManifest.xml”} Powershell command to reinstall Microsoft Store core Windows 10 apps
cipher /e c:\Vault
Replace “c:Vault” with the Folder or file to encrypt. To unencrypt right-click folder or file, select Properties; Advanced and untick “Encrypt contents to secure data” option.
shutdown /r /o
Boot to Windows 10 advanced options
netsh wlan show profile
netsh wlan show profile WiFi-name key=clear
Recover forgotten WiFi password. Replace WiFi-name with the one shown in list of network names (1st command). Scroll through results to see password shown against WiFi-name
 robocopy c:\users\username\Documents d:\backup\Documents /mir /copyall /dcopy:T /r:0 /w:0 /log:c:\users\username\log.txt /tee
Copy folders fast – mirror the source to the destination copying all files and folders, including empty ones +  all file attributes including NTFS permissions and copy timestamps and retry 0 times and wait 0 secs between retries and logfile and  log output to console and logfile

 

Gulp Sass suddenly rejecting double quotes

A slip-up of adding an extra ” to a string definition highlights an anomaly in Sass which causes it to flag every line of scss  code (including comments) with double quotes as an error including the real error lost in the jungle of errors. See example below with ” added to the end of $fontfamily (not easy to spot) and an excerpt of the Sass compiler error message pointing to valid line of code amongst many more misleading messages.

$fontfamily: "Comic Sans MS",Arial,Helvetica,sans-serif!important";
Error in plugin "sass"
Message:
src/scss/style.scss
Error: Invalid CSS after '...nd-image: url("': expected expression (e.g. 1px, bold), was "../images/Computer_"
on line 430 of src/scss/style.scss
>> // background-image: url("../images/Computer_Doctor_1800x1149.png");

All this confusion leaves you scratching your head trying to figure out what’s suddenly gone wrong leading you down false trails, e.g. thinking Sass has been updated to a buggy version or should I replace all double with single quotes or whatever.

Once you’ve tracked down the real error line and removed that extra ” all the other error messages miraculously disappear – phew!

I hope this  revelation saves you many hours of lost productivity.

 

Ubuntu 18.04 Install WordPress in Home partition

­Install LAMP

For the purposes of this exercise the Apache document root will be moved to /home/mike/www/ and MySQL data directory moved to /home/mysql and a virtual host created called pcdocgo.co.uk

Use Tasksel to install LAMP services

$ sudo apt install tasksel

Install latest Apache, MySQL and PHP servers

$ sudo tasksel install lamp-server

Configure Apache

Add user to Apache www-data group

$ sudo useradd -G www-data mike

Prepare new document root

$ mkdir /home/mike/www
$ sudo rsync -av /var/www/html /home/mike/www

Note: rsync – be sure there is no trailing slash on the source directory. When there’s a trailing slash, rsync will dump the contents of the directory into the destination directory instead of transferring it into a containing directory of the same name as the source, e.g. html.

Add Virtual Host

$ cd /etc/apache2/sites-available
$ sudo cp 000-default.conf pcdocgo.co.uk.conf
$ sudo nano /etc/apaches2/sites-available/pcdocgo.co.uk.conf

Replace

DocumentRoot /var/www/html

with

DocumentRoot /home/mike/www
<Directory /home/mike/www/wordpress/>
 Options Indexes FollowSymLinks
 AllowOverride All
 Require all granted
</Directory>

Save file.

Note: Directory directives explanation

  1. Options
    • Indexes – if a URL which maps to a directory is requested and there is no DirectoryIndex (e.g., index.html) in that directory, then mod_autoindex will returns a formatted listing of the directory WordPress .htaccess code redirects this to index.php
    • FollowSymLinks – the server will follow symbolic links in this directory, e.g. Permalinks
  2. AllowOverride All – allow the use of .htaccess to override Apache global settings for this directory
  3. Require all granted – access to directory is allowed unconditionally to avoid permission errors

Use a2ensite to enable site – creates software symbolic link in /etc/apache2/sites-enabled

$ sudo a2ensite pcdocgo.co.uk.conf

Disable the Apache default site (/var/www/html)

$ sudo a2dissite 000-default.conf

Enable Apache2 mod_rewrite module to allow modification of URLs

$ sudo a2enmod rewrite

Create .htaccess file and add WordPress rewrite code support

Now that Apache is configured to allow rewrites through .htaccess files, we need to create it in the site root folder.

Create empty .htaccess file

$ touch /home/mike/www/wordpress/.htaccess

Add web server (www-data) group ownership:

$ sudo chown :www-data /home/mike/www/wordpress/.htaccess

$ nano /home/mike/www/.htaccess

Add the following code:

# BEGIN WordPress

RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]

# END WordPress

Note: WordPress adds/updates the above .htaccess code when Permalink Settings > Post aliases are changed. e.g, name.

Once modified save and exit.

Note: If WordPress were installed directly in the document root directory the rewrite codes would be:

# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

For increased security set .htaccess permission to read only.

$ chmod 644 /home/mike/www/.htaccess

644 is normally required and recommended for .htaccess.

Test Apache2 configuration changes

$ sudo apachectl -S

To suppress AH00558 error
AH00558: apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1. Set the ‘ServerName’ directive globally to suppress this message

Add Servername directive to Apache2 global configuration file

$ sudo nano /etc/apache2/apache2.conf

Add

ServerName 127.0.0.1

Save and exit and test again

$ sudo apachectl configtest

Reports “Syntax OK” when no errors found

Restart Apache2 to effect changes

$ sudo systemctl restart apache2

Configure MySQL

Move MySQL data directory to /home/mike/mysql

Check current root is /var/lib/mysql/

$ mysql -u root -p
mysql> select @@datadir;

Output

+-----------------+
| @@datadir |
+-----------------+
| /var/lib/mysql/ |
+-----------------+
1 row in set (0.00 sec)

mysql> exit;

Stop MySQL

$ sudo systemctl stop mysql

Copy data directory to /home/mysql

$ sudo rsynch -av /var/lib/mysql /home

Backup original mysql folder by renaming it

$ sudo mv /var/lib/mysql /var/lib/mysql.bak

Point mysql data directory to new home folder location

Edit the MySQL configuration file

$ sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf

Find “datadir” and change the path form /var/lib/mysql to /home/mysql

Edit AppArmor alias file to let MySQL write to the new directory by creating an alias between the default directory and the new location.

$ sudo nano /etc/apparmor.d/tunables/alias

Add the following alias rule to the end of the alias file

$ alias /var/lib/mysql/ -> /home/mysql/,

Restart AppArmor

$ sudo systemctl restart apparmor

Restart MySQL

$ sudo systemctl restart mysql

Verify status

$ sudo systemctl status mysql

Create WordPress Database and Admin User

$ mysql -u root -p
mysql> CREATE DATABASE pcdocgo_db;
mysql> CREATE USER mike@localhost IDENTIFIED BY 'password';
mysql> GRANT ALL PRIVILEGES ON pcdocgo_db.* TO mike@localhost;
mysql> FLUSH PRIVILEGES;
mysql> EXIT;

Install WordPress

Download latest WordPress and extract to ~/wordpress

$ cd ~
$ wget http://wordpress.org/latest.tar.gz
$ tar xzvf latest.tar.gz

Configure WordPress

$ cd ~/wordpress
$ cp wp-config-sample.php wp-config.php

Download WordPress Secure Keys and add to wp-config.php

$ curl -s https://api.wordpress.org/secret-key/1.1/salt/

Copy output to Paste buffer

$ nano wp-config.php

Overwrite dummy values section below with Paste buffer

. . .
#define('AUTH_KEY', 'put your unique phrase here');
#define('SECURE_AUTH_KEY', 'put your unique phrase here');
#define('LOGGED_IN_KEY', 'put your unique phrase here');
#define('NONCE_KEY', 'put your unique phrase here');
#define('AUTH_SALT', 'put your unique phrase here');
#define('SECURE_AUTH_SALT', 'put your unique phrase here');
#define('LOGGED_IN_SALT', 'put your unique phrase here');
#define('NONCE_SALT', 'put your unique phrase here');
. . .

Replace DB_NAME, DB_USER, and DB_PASSWORD values with database, user and password values:

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'pcdocgo');

/** MySQL database username */
define('DB_USER', 'mike');

/** MySQL database password */
define('DB_PASSWORD', 'password');

Once complete, save and close wp-config.php

Prepare  WordPress directory

Copy content

$ sudo rsync -avP ~/wordpress /home/mike/www

Configure Permissions

$ cd /home/mike/www

Assign ownership values

$ sudo chown -R mike:www-data *

Create Uploads directory

$ mkdir /home/mike/www/wp-content/uploads

Allow Apache to write to this directory

$ sudo chown -R :www-data /var/www/html/wp-content/uploads

Complete WordPress Installation via Web Interface

In web browser, navigate to localhost

http://localhost

For new installs you will see the WordPress initial configuration page, where you will create an administrator account. Fill out the information for the site and the administrative account information. When finished, click on the Install WordPress button. WordPress will confirm the installation, and then ask you to log in with the account just created

Change the Permalink Settings to Post name

Adjust the permalink settings through the WordPress administration interface. On the left-hand side, under the Settings menu, select Permalinks and click the Post name radio button. Click “Save Changes” to generate the .htaccess rewrite rules.

References:

https://linuxconfig.org/how-to-install-lamp-ubuntu-18-04-bionic-beaver-linux-apache-mysql-php

www.ubuntugeek.com/how-to-change-the-mysql-data-default-directory.html

https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-on-ubuntu-14-04

https://dzone.com/articles/install-wordpress-on-ubuntu-1804

NPM Rebuild

Delete node_modules folder and execute npm install

Virtualbox after 5.2.22 GA Install and Restart Windows Guest can’t Sign In

After installing  Virtualbox 5.2.22 Guest Additions and restart you can’t sign in. The Keyboard input is not recognised. Don’t try to restart from power button on login page as you end up going round in circles. Instead elect to Shutdown and then Start.

After this everything seems to be OK although I did not notice it took several minutes to shutdown the first time after successfully logging in. After this it shut down in the normal time frame.

.