All posts by admin

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 1909.

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 1909 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 copied 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 copied 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 (Windows partition size: 717445Mb for DellPrecision, 262789Mb for DellXPS).
  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 need.

  1. Change Computer Name and Time Zone, activate Windows, turn off System Restore, enable Remote Desktop, turn on Network discovery and file sharing by clicking on Network icon on the left side of Explorer, install Dell Wireless 1820A 1830 WiFi Driver, turn off BitLocker (manage-bde -status, manage-bde -off C:).
  2. Configure auto logon (netplwiz), disable hibernation (powercfg.exe /h off), configure Power options (Hard disk, Sleep).
  3. Turn the following Windows features on: .NET 3.5, ASP.NET 4.8, Internet Information Services, Telnet Client.
  4. Install Hyper-V, create an external Virtual Switch for Internet access.
  5. Configure secure protocols using IIS Crypto GUI.
  6. Install Total Commander, Remote Desktop Connection Manager, PuTTY 0.7.3, WinSCP 5.17, Zoom.
  7. Install Firefox, MPC-HC.1.7.13.
  8. 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
  9. Install Python 3.6.8, TensorFlow, Keras
  10. 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.

 

How to Fully Uninstall Cocoapods from macOS

Problem:

You run pod update but you get command not found error.

You want to fully uninstall the Cocoapods from macOS, and then to reinstall it to remove the error.

Solution:

Execute below commands:

for i in $( gem list --local --no-version | grep cocoapods );
do 
    sudo gem uninstall $i; 
done
rm -rf ~/.cocoapods

If you have a Cocoapods icon on the Launchpad then

    • Click on the  Cocoapods icon on the Launchpad,
    • Right click the Cocoapods icon in the Dock,
    • Point your mouse to Options, then click Show in Finder,
    • Right click the Cocoapods icon and select Move to Trash.

Execute below command to reinstall Cocoapods

sudo gem install cocoapods

 

How to fix “An internal error has occurred” issue of Remote Desktop Connection

Problem:

You get “An internal error has occurred” error message when trying to connect to a remote machine using Remote Desktop Connection.

Solution:

1. Type Local Security Policy to the Windows Search box.

2. Click Open link.

3. Expand Local Policies > Security Options on the left panel.

4.  Double click on System cryptography: Use FIPS compliant algorithms for encryption, hashing, and signing row on the right panel.

5. Select Enabled, click Apply and click OK.

How to increase your Wi-Fi connection speed

Problem:

You have a slow Wi-Fi connection speed.

You want to increase your Wi-Fi connection speed.

Solution:

Execute below command on Windows:

netsh wlan show interface
  • If your Signal is less than 20% then try to increase your Wi-Fi signal strength by moving your device closer to your Wi-Fi router.
  • If you cannot change your device and Wi-Fi router location then try connecting your Wi-Fi router to another Wi-Fi router (Wi-Fi extender) that acts as a new access point using LAN cable.
  • If you cannot use a LAN cable then try connecting your router to a Wi-Fi repeater that is closer to your device.
  • If your Radio type is 802.11n then try to upgrade both your device and router to support 802.11ac.
  • Try to upgrade your Wi-Fi router to support 5 GHz band.
  • Try to upgrade your Wi-Fi router to support MU-MIMO (which stands for Multi-User, Muliple Input, Multiple Output).
  • Compare Receive rate (Mbps) and Transmit rate (Mbps) before and after making a change.
  • Use Speedtest to compare your Wi-Fi connection speed before and after making a change.

How to add multiple IPs to an Amazon EC2 virtual machine

Motivation:

You have a Server 2008 R2 machine on Amazon EC2.

You want to secure multiple domains using different  SSL/TLS certificates.

Server 2008 R2 does not support Server Name Indication (SNI). Therefore you need to add multiple IPs to Server 2008 R2 machine to use different SSL/TLS certificates.

Solution:
  1. Create an EC2 virtual machine.
  2. Click on Network Interfaces tab.
  3. Click Create Network Interface button or select an existing network interface and select Actions > Attach.
  4. Select an existing network interface and select and click Manage IP Addresses to create private IPs for the network interface.
  5. Click Elastic IPs tab and allocate elastic IPs for your need.
  6. Select an elastic IP and click on Actions > Associate Address to associate a private IP of the network interface with an elastic IP.
  7. Login Windows.
  8. View the network configuration using below command, note the Default Gateway and DNS Servers information.
ipconfig /all

9. Open Control Panel\All Control Panel Items\Network and Sharing Center.

10. Click Change adapter settings link, click a Local Area Network Connection Network.

11. Manually enter one IP address, Default Gateway and DNS Servers information.

12. Click Advance… button to open Advanced TCP/IP Settings screen, and add the private IPs in the 4th step to the machine.

13. Restart the machine.

If you get any issue then try limit the number of private IPs of a network interface to 4 (including the default private IP).

How to move a WordPress instance from one server to another Linux server

Motivation:

You want to move a WordPress instance from one server to another to consolidate your websites to reduce cost.

Solution:

Install and use below Duplicator plugin to achieve your goal.

https://wordpress.org/plugins/duplicator/

User guide: https://snapcreek.com/duplicator/docs/quick-start/

If everything goes well for you then congratulation!

Otherwise, please review below possible problems and corresponding solutions.


Problem 1:

You don’t have a website on the new server.

Solution 1:

1. Create a new virtual host in the /etc/httpd/conf/httpd.conf

<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
DocumentRoot "/var/www/www.example.com"
</VirtualHost>

2. Set 775 permission for /var/www/www.example.com

3. Restart httpd service

sudo systemctl restart httpd

Problem 2:

You are using Amazon Linux 2 server.

You are logged in as ec2-user.

You use WinSCP to upload files and edit configuration files.

You cannot modify /etc/httpd/conf/httpd.conf and /etc/php.ini.

Solution 2:

1 View permission settings for the file

ls -ld /etc/httpd/conf/httpd.conf

The result indicates that the file owner is root user and root group, not ec2-user.

2. View groups of a user

groups ec2-user

The result indicates that the ec2-user does not belong to root group.

3. Add a user to root group

sudo usermod -a -G root ec2-user

4. Grant Read-Write permission against a file to root group

sudo chmod g+rwx /etc/httpd/conf/httpd.conf
sudo chmod g+rwx /etc/php.ini

5. Logout and login to the server again.


Problem 3:

You are using Amazon Linux 2 server. The ZipArchive feature is missing.

Solution 3:

1. Execute below commands:

sudo amazon-linux-extras install php7.2
sudo yum install php-pear php-devel gcc libzip-devel zlib-devel
sudo pecl install zip-1.13.5 # we must specify a slightly older version due due to compatibility

2. Add “extension=zip.so” to /etc/php.ini

3. Restart the server

sudo reboot

Problem 4:

You don’t have a WordPress database on the new Linux server.

Solution 4:

Execute below MySQL commands:

CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
CREATE DATABASE `wp_database`;
GRANT ALL PRIVILEGES ON `wp_database`.* TO "username"@"localhost";
FLUSH PRIVILEGES;

Problem 5:

An database error occurs while restoring a website.

Solution 5:

1. Execute below commands to remove the website:

sudo chown -R ec2-user:apache /var/www/example.com
sudo chmod 2775 /var/www/example.com && find /var/www/example.com -type d -exec sudo chmod 2775 {} \;
find /var/www/example.com -type f -exec sudo chmod 0664 {} \;
rm -r /var/www/example.com

2. Upload the Duplicator files again, and restore the website again.


Problem 6:

No write access against /var/www/example.com is available for Duplicator.

Solution 6:

1. Execute below commands:

sudo chown -R ec2-user:apache /var/www/example.com
sudo chmod 2775 /var/www/example.com && find /var/www/example.com -type d -exec sudo chmod 2775 {} \;
find /var/www/example.com -type f -exec sudo chmod 0664 {} \;

2. Run http://example.com/installer.php again.

How to connect and upload files to a remote machine using OpenVPN and SSH on macOS

Motivation:

You have a server inside a network. You are granted OpenVPN and SSH access to the server. You have a MacBook. You want to upload files to the server. You want to execute a process on the server (e.g. training a machine learning model).

Procedure:

  • Request a certificate and an Open VPN configuration file (an .ovpn file) from your network administrator.
  • Install Tunnelblick https://tunnelblick.net
  • Drag the Open VPN configuration file to the Tunnelblick Configurations tab.
  • Click the Connect button.
  • On macOS, open Terminal and execute below command
ssh root@172.29.64.144 -p 7081

where 172.29.64.144 is the machine IP and 7081 is the SSH port