All posts by admin

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.

How to Enable Processor Resource Controls in Hyper-V

Context:

You got a warning message below when configuring Number of virtual processors in Hyper-V.

Hyper-V is not configured to enable processor resource controls.
Problem:

How do you enable processor resource controls in Hyper-V?

Solution:

1. What is the difference between core and logical processor?

  • A socket is a slot contains one or more mechanical components providing mechanical and electrical connections between a microprocessor and a printed circuit board (PCB). This allows for placing and replacing the central processing unit (CPU) without soldering.
  • A core is a physical processor unit (hardware component) inside your processor.
  • Logical processor or logical core is the processor as seen by the operating system. Logical processor does not exist physically.
Logical Processor = (# of Core) * (# of Thread in each Core) = 4 * 2 = 8

Example:

2. What is SMT?

Simultaneous multithreading, or SMT, is a technique utilized in modern processor designs that allows the processor’s resources to be shared by separate, independent execution threads.

Processors supporting SMT are available from both Intel and AMD. Intel refers to their SMT offerings as Intel Hyper Threading Technology, or Intel HT.

3. How does Hyper-V virtualize processors?

  • Hyper-V creates and manages virtual machine partitions, across which compute resources are allocated and shared, under control of the hypervisor. Partitions provide strong isolation boundaries between all guest virtual machines, and between guest VMs and the root partition.
  • The root partition is itself a virtual machine partition, although it has unique properties and much greater privileges than guest virtual machines. The root partition provides the management services that control all guest virtual machines, provides virtual device support for guests, and manages all device I/O for guest virtual machines. Microsoft strongly recommends not running any application workloads in the root partition.
  • Each virtual processor (VP) of the root partition is mapped 1:1 to an underlying logical processor (LP). A host VP always runs on the same underlying LP – there is no migration of the root partition’s VPs.
  • By default, the LPs on which host VPs run can also run guest VPs.
  • A guest VP may be scheduled by the hypervisor to run on any available logical processor. While the hypervisor scheduler takes care to consider temporal cache locality, NUMA topology, and many other factors when scheduling a guest VP, ultimately the VP could be scheduled on any host LP.

4. What are Hyper-V hypervisor scheduler types?

Starting with Windows Server 2016, the Hyper-V hypervisor supports several modes of scheduler logic, which determine how the hypervisor schedules virtual processors on the underlying logical processors. These scheduler types are:

  • The classic scheduler provides a fair share, preemptive round- robin scheduling model for guest virtual processors.
  • The core scheduler offers a strong security boundary for guest workload isolation, and reduced performance variability for workloads inside of VMs that are running on an SMT-enabled virtualization host.
  • The root scheduler cedes control of work scheduling to the root partition. The NT scheduler in the root partition’s OS instance manages all aspects of scheduling work to system LPs.

5. Determine your Hyper-V Hypervisor Scheduler Type

Execute the command below.

Get-WinEvent -FilterHashTable @{ProviderName="Microsoft-Windows-Hyper-V-Hypervisor"; ID=2} -MaxEvents 1

  • 1 = Classic scheduler, SMT disabled
  • 2 = Classic scheduler
  • 3 = Core scheduler
  • 4 = Root scheduler

6. Enable processor resource controls in Hyper-V by setting Scheduler Type to Core or Classic.

  • Open a Command Prompt as Administrator and execute the command below.
C:\Windows\System32\bcdedit.exe /set hypervisorschedulertype Core

  • Restart the computer.
Sources:

https://en.wikipedia.org/wiki/CPU_socket

https://www.quora.com/What-is-the-difference-between-core-and-logical-processor

https://docs.microsoft.com/en-us/windows-server/virtualization/hyper-v/manage/manage-hyper-v-scheduler-types

 

How to Convert MP4 or MKV File to MP3 File

Motivation:

You have downloaded some MP4 or MKV video files.

You want to extract audio parts so that you could copy them to your iPhone to listen to them while turning off the display of your phone.

Procedure:

  • Download this portable application for your Windows.
  • Use it to convert the MP4 or MKV files to MP3 files. You can also extract the original audio (for example M4A format) if needed.
  • Copy the MP3 files to your phone.

How to Install a Clean iOS

Motivation:

You want to sell or give away your iPhone. You want to ensure that the new owner will not access any of your data.

You may also need to give your iPhone to a technician to fix the broken display of your iPhone. You want to ensure that the technician cannot access any of your data.

You may also have so many buggy applications on your iPhone and want to increase stability and performance of your iOS.

Procedure:

  • Import your Photos to a MacBook.
  • Create a backup of data. It is best to let your iPhone synchronize everything with iCloud, including Photos and Contacts.
  • Turn off Find My iPhone.
  • Plug your iPhone to a MacBook.
  • Open Finder. Click on your iPhone on the left panel.
  • Click Restore iPhone… button.
  • Click Backup button.
  • Click Restore and Update button. Click Next button. Click Agree button.
  • Follow the instructions to install a clean iOS to your iPhone.

Post Installation Configuration:

  • Setup your iPhone.
  • Activate your iPhone.
  • Setup Face ID.
  • Restore your Apps & Data from iCloud backup.
  • Synchronize music to your iPhone.
  • Go to Settings > Generals > Software Update > Automatic Updates. Turn off Automatic Updates.
  • Go to Settings > Generals > Display & Brightness > Text Size. Drag the slider to the right to increase text size.
  • Go to Settings > Messages. Enable iMessage.

How to Completely Remove a Book from Your Kindle Device

Motivation:

You have a book in your Kindle application (in your iPhone). You want to completely remove it.

Solution:

1. Press and hold the book title and remove the book from your device (e.g. your iPhone).

2. Login your Amazon account.

3. Search for the Manage Your Content and Devices link.

4. Go to Manage Your Content and Devices.

5. Select Books or Docs beside the Show label.

6. Select the book and click Delete button.

7. On your device (e.g. your iPhone) scroll down to refresh your Kindle books.

How to Trim MP4 Files Without Re-Encoding

Motivation:

You have MP4 files with unwanted portions. You want to trim these portions.

Solution:

  1. Download XMedia Recode.
  2. Under the Format tab set
    Profile = Custom
    Format = MP4
    File Extension = mp4
  3. Click the Video tab and select Copy Mode.
  4. Click the Audio tab and select Copy Mode.
  5. Click the Filters/Preview tab and set Start Time and to (End Time).
  6. Click Add to queue button on the tool bar.
  7. Click Encode on the tool bar.

 

How to Put Your Books into Kindle or Apple Books

Motivation:

You have a book with .epub or .mobi format in your MacBook or PC.
You want to put it into your iPhone or iPAD so that you can read it on the go.

Solution:

1. Put the books into iCloud Drive.
2. Install Kindle or Apple Books on your iPhone or iPAD.
3. Login your Kindle account.
4. Open the Files app to go to iCloud Drive.
5. Open the book.
6. Tap the Share icon in the lower left hand corner.
7. Select Kindle or Open in iBooks.

How to install a fresh Windows 10 booted from UEFI secure boot using a bootable USB

 Problem:

Most of Windows machines are delivered with a limited Windows version and unnecessary preinstalled software.

You want to format the hard drive and install a fresh Windows that can be booted from UEFI secure boot to improve machine performance and stability.

You have a 8Gb USB stick and an ISO file of Windows 10, version 2004.

Solution:

Step 1: Backup your machine and create an USB recovery by entering “Create a recovery drive” text to the search box on the task bar and follow the instructions.

Step 2: Create a bootable USB with Windows installation files.

Right click Windows logo, click Command Prompt (Admin).
Enter diskpart.exe, press Enter.
DISKPART> list disk
DISKPART> select disk 1 -- the USB disk should be selected, the number may be different in your machine.
DISKPART> clean
DISKPART> create partition primary size=1024
DISKPART> select partition 1
DISKPART> active
DISKPART> format quick fs=fat32
DISKPART> assign
DISKPART> create partition primary
DISKPART> select partition 2
DISKPART> format quick fs=ntfs
DISKPART> assign
DISKPART> exit
Double click on the ISO file of Windows 10, version 2004 to create a virtual drive.
xcopy f:\sources\boot.wim d:\sources\ /s /e 

where f: the virtual drive and d: the USB fat32 partition.
We copy only the f:\sources\boot.wim file to d:\sources\.
robocopy f:\ d:\ /IS /S /XD sources 

where f: the virtual drive and d: the USB fat32 partition.
We copy everything from f:\ to d:\ except the sources folder.
xcopy f:* e:\ /s /e 

where f: the virtual drive and e: the USB ntfs partition.

Step 3: Install Windows.

  1. Plug the USB to a machine.
  2. For a Dell laptop, power on the machine, press F12 until a one-time boot up menu appears.
  3. For a Sony VAIO laptop, power off the machine, then press the Assist button to enter VAIOCare.
  4. Select the option to boot the machine from the USB (you may need to enable Boot from USB in BIOS).
  5. Follow the instructions to install Windows (set Windows partition size to 717415Mb for DellPrecision if you want to have 700Gb C drive or 262789Mb for DellXPS if you want to have a 255Gb C drive).
  6. You can delete all the partitions, including MRP (Microsoft Reserved Partition – this is just a reserved partition for Windows later use if needed), ESP (EFI System Partition – this is where UEFI firmware files are stored to boot Windows), WINRETOOLS (Windows Recovery Environment (WinRE) Tools – this is where files for repairing or recovering Windows are stored), and PBR image (this is where original the manufacture Windows installation file  are stored) because you already created an USB recovery in the Step 1.

Step 4: Configure Windows for Developer’s needs.

  1. Change Computer Name, turn off System Restore, enable Remote Desktop.
  2. Add Wireless LAN Service feature for Windows Server 2019.
  3. Install Dell Wireless 1820A 1830 WiFi Driver
  4. Change Time Zone.
  5. Install Chipset Device, Graphics, Ethernet, Bluetooth, Memory Card Reader, Dynamic Platform and Thermal Framework driver for Windows Server 2019.
  6. Activate Windows.
  7. Turn on Network discovery and file sharing by clicking on Network icon on the left side of Explorer, turn off BitLocker (manage-bde -status, manage-bde -off C:).
  8. Configure auto logon (netplwiz), disable hibernation (powercfg.exe /h off), configure Power options (Hard disk >> Turn of hard disk after: 0, Wireless Adapter Settings >> Power Saving Mode: Maximum Performance, Sleep >> Sleep after: 0).
  9. Turn the following Windows features on: .NET 3.5, ASP.NET 4.8, Internet Information Services, Telnet Client.
  10. Install Hyper-V, create an external Virtual Switch for Internet access, set Scheduler Type to Core.
  11. Apply Windows updates to the machine.
  12. Configure secure protocols using IIS Crypto GUI (Select Best Practices, disable TLS 1.0, TLS 1.1, MD5, SHA).
  13. Install Total Commander, Remote Desktop Connection Manager, PuTTY 0.7.3, WinSCP 5.17, Zoom.
  14. Install Firefox, MPC-HC.1.7.13.
  15. Install MS Office 2007 SP3 (Display >> Scale and layout: 125% for DellPrecision, 175% for DellXPS), MS Project 2016, MS Visio 2016, MS SQL Server 2008 R2, Visual Studio 2015, Adobe Acrobat Pro DC v15.8, Adobe Photoshop CC 2015, TortoiseSVN 1.13.1
  16. Install Python 3.6.8, TensorFlow, Keras
  17. Create VPN Connection.

Go to Control Panel >> Network and Sharing Center >> Change adapter settings >> Right click >> VPN Connection’s Properties >> Select Networking tab:
1. Disable Internet Protocol Version 6 (TCP/IPv6).
2. Select Internet Protocol Version 4 (TCP/IPv4) >> Properties >> Advanced… >> select IP Settings tab: Uncheck Use default gateway on remote network option.