Category Archives: Operating Systems

Topic 1 – Operating Systems

Why do I need to learn about operating systems?

Because you will develop your software using an operating system or for an operating system.

How many operating systems should I know?

As many as possible. We recommend that you learn how to work with Windows first. Then you learn about basic concepts of an operating system.

How do I learn about operating systems under a user’s view?

Please read this Andy Rathbone (2015). Windows 10 For Dummies. Wiley book.

How about other operating systems such as macOS, Linux or Unix?

If you have a Mac then you can read this Pogue David (2019). macOS Mojave: The Missing Manual. O'Reilly Media book.

If you have a PC with Ubuntu Linux or Unix then you can read this Mark G. Sobell (2015). A Practical Guide to Ubuntu Linux. Prentice Hall book.
After reading these books please read this Abraham Silberschatz et al. (2013). Operating System Concepts. Wiley book to grasp basic concepts of an operating system.

Once you finish reading these books please click Topic 2 - Introduction to Programming to continue.

How to Allow a Remote Desktop User to Access CD/DVD

Problem:

You log in a computer remotely as an administrator.
However you cannot read or write any removable storage devices such as CD/DVD or USB flash memory drives.

Solution:
  1. Type gpedit.msc in the Search box, press Enter.
  2. Go to Local Computer Policy > Computer Configuration > Administrative Templates > System > Removable Storage Access.
  3. Double-click All Removable Storage: Allow direct access in remote sessions.
  4. Click Enabled.
  5. Click OK.

 

How to Backup and Restore an EC2 Instance

Motivation:

Any changes related to an operating system or an application in an EC2 instance may break its connection. You may try to stop, start, or reboot the instance many times but the problem may still persist. In this case, you may need to restore the instance to a previous stable version.

Viruses, malwares or accidental deletion of data may also require a restore of an instance to a previous stable version.

In order to restore an EC2 instance to a previous version you first need to create its backups either manually or automatically.

Manually backup an EC2 instance:
  1. Click Volumes on the left menu.
  2. Click a volume, click Actions, click Create Snapshot.
Manually restore an EC2 instance:
  1. Click Snapshots on the left menu, click a snapshot of an instance.
  2. Click Actions, click Create Volume.
  3. Let all default settings intact, click Create Volume.
  4. Repeat the first 3 steps for all the snapshots of the instance.
  5. Stop the instance.
  6. Click the instance, click Storage, scroll down and click on the link of /dev/sda1 device.
  7. Click Actions, click Detach Volume (or Force Detach Volume if the Detach Volume function does not work).
  8. Click Volumes on the left menu.
  9. Click on the volume created from the snapshot.
  10. Click Actions, click Attach Volume.
  11. Select the instance, set Device = /dev/sda1, click Attach.

12. Detach and attach the remaining volume to the instance.
13. Start the instance.

Automate backup process for an EC2 instance:
  1. Go to AWS Backup service.
  2. Click Backup plans on the left menu.
  3. Click the Create Backup plan button, select a template (e.g. Daily-35day-Retention), enter a backup plan name (e.g. HuyBien_Backup_Plan).

4. Click Backup plans on the left menu, click on a backup plan name.
5. Scroll down to the Resource assignments section, click the Assign resources button.
6. Enter a resource assignment name (e.g. HuyBien_Instances or HuyBien_Volumes), the scroll down to the Assign resources section.
7. Select Resource ID for Assign by.

8. Select appropriate resources. When you select an EC2 instance, AWS Backup will create backup for all EBS volumes attached to the instance, and then will attach them to an AMI that stores all parameters from the original EC2 instance.
9. Click the Assign resources button.
10. Wait for 1 day, then click on the Backup vaults link on the left menu, click a Backup vault name, scroll down to the Backup section to check for backups of the resources created by the backup plan execution.

Configure backup process time:
  1. Go to https://www.thetimezoneconverter.com/, and convert your time to UTC, for example 1:00 AM Saint Petersburg = 10:00 PM UTC.
  2. Go to AWS Backup, click Backup plans, click on a plan name.
  3. Scroll down to Backup rules, select a rule, click the Edit button.
  4. Scroll down to Backup window, click Customize backup window and enter your times.

 

How to Install Ubuntu and Windows as a Dual Boot

Motivation:

You are want to install Ubuntu 18.04 and Windows 10 as dual boot for completing some machine learning tasks.

Prerequisites:

You need to have a 8Gb USB stick.

Solution:

Step 1: Go to BIOS, select the UEFI option in Boot List Option, disable the Enable Legacy option ROMS option, disable Secure Boot.

Step 2: Install Windows 10 and create a free partition for Ubuntu.

Step 3: Download the Ubuntu desktop 18.04 image.

Note: The Ubuntu server 18.04 image may NOT contain driver for your wireless adapter network card.

Download and use Rufus to create a bootable USB with Ubuntu.

Step 4: Install Ubuntu. Select Something else in Installation type screen. Select the free partition. Click the + sign.

Create an EFI partition and set its size to be 552MB if it does not exist.

Create a Swap partition. Set its size to be twice as your RAM size.

Create a Root partition. Set its size to be all the remaining free space to optimize your space.

 

 

 

 

How to Move Outlook Data to a New Computer

Motivation:

You need to move Outlook data and settings from an old computer to a new computer.

Solution:

1. On the destination (new) computer:

    • Type Control Panel in Search box.
    • Click on Control Panel.
    • Select Large icons for View by.
    • Click Mail (32-bit).
    • Click Add. Set Profile Name = Outlook.
    • Follow the instructions to setup an account.

2. On the source (old) computer:

    • Open Outlook.
    • On the File menu, click Data File Management.
    • Click the data file that you want to compact, and then click Settings.
    • Click Compact Now.
    • Close Outlook.

3. Copy and overwrite all the contents of %USERPROFILE%\Local Settings\Application Data\Microsoft\Outlook to the destination computer. Create the Outlook folder if it does not exist.

4. Copy and overwrite all the contents of %USERPROFILE%\Application Data\Microsoft\Outlook to the destination computer. Create the Outlook folder if it does not exist.

5. Open Outlook in the destination computer.

Note: If you are using POP3 protocol then all the messages will be re-downloaded again once. If this is true for you then

    • Let Outlook finish downloading the messages, then
    • Click on Unread Mail folder below the Search Folders,
    • Select all the messages,
    • Press Shift, right click and click Delete to permanently delete them all.

 

How to Remove Caches and Temporary Files in Windows

Motivation:

You may want to remove caches to update an application status or fix some issues.
You may need to remove temporary files to get some more free disk space.

Solution:

Try clearing files and folders in the directories below.

  • %USERPROFILE%\AppData\Local\Temp
  • C:\Windows\Temp
  • C:\Users\All Users\Package Cache
  • C:\Windows\SoftwareDistribution\Download
  • C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files

Sometimes you may get permission error when deleting files or folders. If this is true then try the following command before deleting these files and folders.

takeown /f C:\Users\All Users\Package Cache /r /d y
icacls C:\Users\All Users\Package Cache /grant administrators:F /t

How to Hide Your IP Location using VPN in Windows 10

Motivation:

You have VPN credentials and want to hide your IP location for a specific purpose.

Solution:

  • Setup a VPN connection using your VPN credentials.
  • Type and click View network connections in Search box to open the Network Connections window.
  • Right-click the VPN connection and select Properties in the menu.
  • Select the Networking tab.
  • Click the Internet Protocol Version 4 (TCP/IPv4) row, then click the Properties button.
  • Click the Advanced… button.
  • Select Use default gateway on remote network option.

How to Fix “The parameter is incorrect” Issue When Disabling the Sync Host OneSyncSvc Service

Problem:

The Sync Host OneSyncSvc service was not started correctly and caused error in the Server Manager.

You wanted to disable this service. However you got the “The parameter is incorrect” error message when disabling it.

Solution:
  1. Click on the Search icon, type regedit, press Enter.
  2. Locate the key below
Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\OneSyncSvc

3.  Change the Start value from 2 to 4 (Disabled).

4. Restart the server.

 

How to Fix the “We can’t sign into your account” Issue in Windows

Problem:

You remotely connect o a computer using a Windows Domain account and get the error message below.

We can't sign into your account
Solution:
  1. Login the computer as a Local Administrator.
  2. Open C:\Users and delete the folder of the Windows Domain account.
  3. Click Search icon, enter regedit, and press Enter.
  4. Navigate to the path below.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList

4. Look for the Profile of the Windows Domain account by reviewing the ProfileImagePath value.

5. Delete the Profile key of the Windows Domain account.

6. Restart the machine.

How to Manually Install PHP 7.4 for Windows Server 2019

Motivation:

To understand how PHP works with IIS in order to be able to update PHP to any version to address compatibility or security issues.

Using a tool to install PHP for IIS, for example Microsoft Web Platform Installer 5.0 https://www.microsoft.com/web/downloads/platform.aspx, restricts us from using only versions supported by the tool.

Solution:

  • Install CGI for IIS.
  • Download VC15 x86 Non Thread Safe package here or under PHP 7.4 section from http://windows.php.net/download/
  • Extract the ZIP file to the C:\Program Files (x86)\php-7.4.9-nts-Win32-vc15-x86 folder.
  • Rename the php-.ini-development file to php.ini.
  • Open the php.ini file and add the following line at the end of the file.
extension=php_wincache.dll
  • Uncomment the following lines
fastcgi.impersonate = 1;

cgi.fix_pathinfo=1;
cgi.force_redirect = 1 (and change the value to 0, i.e. cgi.force_redirect = 0)

extension_dir = "C:\Program Files (x86)\php-7.4.9-nts-Win32-vc15-x86\ext"

extension=php_curl.dll
extension=php_fileinfo.dll
extension=php_mbstring.dll
extension=php_exif.dll
extension=php_mysqli.dll
extension=php_pdo_mysql.dll
extension=php_openssl.dll

error_log = "C:\Program Files (x86)\php-7.4.9-nts-Win32-vc15-x86\php_errors.log"

error_log = syslog
  • A sample php.ini file can be download here.
  • Add C:\Program Files (x86)\php-7.4.9-nts-Win32-vc15-x86 to System Path.
  • Download x86 package of WinCache 2.0 for PHP 7.4 here or from https://sourceforge.net/projects/wincache/.
  • Extract and copy the php_wincache.dll file to C:\Program Files (x86)\php-7.4.9-nts-Win32-vc15-x86\ext
    folder.
  • Open IIS, click on Server name, double click on Handler Mappings, click on Add Module Mapping, and enter below information
Request path = *.php
Module = FastCgiModule
Executable = "C:\Program Files (x86)\php-7.4.9-nts-Win32-vc15-x86\php-cgi.exe"
Name = PHP 7.4
Request Restrictions = File or folder

Open a Command Prompt, execute below command and ensure that NO WARNINGS APPEAR.

php -version
  • Create phpinfo.php file with below content in the website folder and test the result.
<?php
phpinfo();
?>

 

How to Run Docker on a Windows 10 Hyper-V Virtual Machine

Motivation:

You want to have an environment with Docker for development and testing  without interfering your stable machine.

Procedure:

1. Download this PowerShell script. The main interesting command in this script is the command below that enables Nested Virtualization for a virtual machine.

Set-VMProcessor -VMName $vmName -ExposeVirtualizationExtensions $true

2. Open PowerShell as Administrator and execute 2 commands below.

Set-ExecutionPolicy -ExecutionPolicy "Unrestricted"
.\Enable-NestedVm.ps1 "Windows 10 Dev"

"Windows 10 Dev" is the virtual machine name without quotes.

3. Install Docker. Restart the virtual machine.

4. Install any additional software if needed, restart the virtual machine again.

5. Open a Command Prompt and test Docker installation.

docker pull hello-world && docker run hello-world

Rerun the command if you get an issue in the first run.