Tag Archives: Windows

How to Convert MP4 or MKV File to MP3 or M4A 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 to your Windows.
  • Unzip the files to a location.
  • Open Mp4ToMp3_64.exe.
  • Click on the Add files button to add MP4 or MKV files to the application.
  • If you want to extract the original audio (for example the M4A format) then select Try extract original audio stream option below the Audio section on the right panel.
  • Click the Convert button.
  • Copy the MP3 or M4A files to your phone.

This procedure can be used for extracting audio from M4B (Apple audiobook file format) file to M4A or MP3 file too.

 

How to Set File Permissions for WordPress on Windows IIS

Motivation:

  • You have a WordPress instance on Windows IIS.
  • You upload a file. Its thumbnail is not shown in Media Library.
  • You change the file permission. Its thumbnail now is shown correctly in Media Library.
  • You upload another file and have to change the file permission manually again.
  • How can we make WordPress automatically set the correct permission for new uploaded files?

Procedure:

  1. Ensure that the the Identity of Application pool that the website is running under is ApplicationPoolIdentity.
  2. Execute below commands as Administrator
icacls "C:\inetpub\wwwroot\domain.com" /grant "IUSR":(OI)(CI)F /T 
icacls "C:\inetpub\wwwroot\domain.com" /grant "IIS_IUSRS":(OI)(CI)F /T

3. Set up IIS.

  • Open IIS Manager.
  • Click on your website.
  • Click Authentication.
  • Click Anonymous Authentication (which should be the only one enabled).
  • Click Edit.
  • Select Application pool identity if it is not selected.
  • Click OK.

 

 

How to Copy, Move, Replicate, Augment or Delete Files and Folders using Commands in Windows

Motivation:

  • You have a web application the backup of which needs to be  created daily.
  • You have a web application the content of which needs to be replicated daily.
  • You have data folder the content of which needs to be augmented daily.

Commands:

  • Copying files and folders inside one folder to another:
robocopy E:\inetpub\wwwroot\website.domain.com E:\inetpub\wwwroot\backup.domain.com /e

/e Copies subdirectories. This option includes empty directories.

robocopy \\192.168.1.49\E\inetpub E:\inetpub /e
  • Moving entire folder to another location:
PS C:\> Move-Item -path \\192.168.1.15\e\inetpub\ -destination E:\ -force

PS C:\> PowerShell.

Moving new files and folders inside one folder to another:

robocopy E:\inetpub\wwwroot\website.domain.com E:\inetpub\wwwroot\archive.domain.com /move /e

/move Moves files and directories, and deletes them from the source after they are copied.
  • Copying (mirroring) entire data from one drive to another, including file and folder permissions:
robocopy E:\ G:\ /MIR /COPYALL /ZB /W:1 /R:2 /XO 

or

robocopy E:\ G:\ /TEE /LOG+:F:\robolog.txt /MIR /COPYALL /ZB /W:1 /R:2 /XO

E:\ - Source folder. This can be a UNC path.
G:\ - Destination folder. This can be a UNC path.

/TEE - Display the output of the command in the console window and write it to a log file.

/LOG+:F:\robolog.txt - Write the logs to F:\robolog.txt. The + sign means appending the content to the log file.

/MIR - Copy all files and subfolders, remove files and folders from the destination if they no longer exist on the source.

/COPYALL - Copy all of the NTFS permissions and attributes (security permissions, timestamps, owner info, etc.)

/ZB - Use restartable mode when copying files. If a file is in use, retry after a set amount of time (see /W:1 and /R:2). If access is denied then try to copy in backup mode.

/W:1 - Wait for 1 second between retries when copying files.

/R:2 - The number of retries on failed copies.

/XO - eXclude Older files/folders if the destination file or folder exists and has the same date.
If destination file exists and is the same date or newer than the source - don't bother to overwrite it.
  • Augmenting files and folders (making an incremental backup) from one drive to another, including file and folder permissions:
robocopy E:\ G:\ /E /COPYALL /ZB /W:1 /R:2 /XO /XX

or

robocopy E:\ G:\ /TEE /LOG+:F:\robolog2.txt /E /COPYALL /ZB /W:1 /R:2 /XO /XX

/E - Copy Subfolders, including Empty Subfolders.
/XX - eXclude "eXtra" files and dirs (present in destination but not source). This will prevent any deletions from the destination.
  • Granting Full control to a user or group:
icacls "E:\inetpub\wwwroot\website.domain.com\App_Data" /grant "IUSR":(OI)(CI)F /T

icacls "E:\inetpub\wwwroot\website.domain.com\App_Data" /grant "IIS_IUSRS":(OI)(CI)F /T

CI Container Inherit - This flag indicates that subordinate containers will inherit this ACE (access control entry).

OI Object Inherit - This flag indicates that subordinate files will inherit the ACE.

OI and CI only apply to new files and sub-folders).

F Full Control

/T Apply recursively to existing files and sub-folders.
  • Deleting and creating a folder:
rmdir "E:\inetpub\wwwroot\website.domain.com\Temp\" /S /Q 
mkdir "E:\inetpub\wwwroot\website.domain.com\Temp\
  • Recursively deleting all files in a folder and all files in its sub-folders:
cd C:\inetpub\wwwroot
del /s *.log
/s delete all the files in the sub-folders.

del /s /f /q *.*
/f force deletion of read-only files.
/q do not ask to confirm when deleting via wildcard.
  • Recursively deleting a folder, its files and its sub-folders:
rmdir .\force-app\main\default\objects /s /q
/s delete all the files in the sub-folders.
  • Enabling long paths and file names: For Windows 10, Version 1607, and Later: Open Group Policy (gpedit.msc) and go to Computer Configuration > Administrative Templates > System > Filesystem. Set “Enabling Win32 long paths” to “Enabled“. Restart the machine. Then use command below:
PS C:\> Move-Item -path \\?\UNC\192.168.101.157\e\NCM4Files\ -destination \\?\E:\ -force
  • Removing a drive letter from a volume
mountvol F: /D
/D remove the drive letter from the selected volume.

Anti-Virus vs. Anti-Malware

What is the difference between anti-virus software and an anti-malware software?

A virus is a piece of code that is capable of copying itself in order to do damage to your computer, including corrupting your system or destroying data.

Malware, on the other hand, is an umbrella term that stands for a variety of malicious software doing damage to your computer or stealing your information, including Trojans, spyware, worms, adware, ransomware, and yes, viruses.

So the logic follows: all viruses are malware. Not all malware are viruses.

Anti-virus software generally scans for infectious malware which includes viruses, worms, Trojans, rootkis and bots.

Anti-malware software generally tends to focus more on adware, spyware, unwanted toolbars, browser hijackers, potentially unwanted programs and potentially unsafe applications.

Therefore, you need both an anti-virus and an anti-malware solution for maximum protection.

Built-in Windows Defender provides both anti-virus and anti-malware protection, and IMO, is enough for non-tech-savvy users.

A comprehensive FREE anti-virus software is AVG.

A comprehensive FREE anti-malware software is Malwarebytes

An ads blocker for Edge browser is uBlock Origin

An ads blocker for Firefox browser is Adblock Plus

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.

What can I do after finishing learning operating systems?

You will be prepared with skills that help you prepare environments for your your programming journey.

You will be prepared with knowledge that helps you understand programming terminologies.

You may even be inspired to learn programming to solve problems.

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 to use operating systems?

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, or Linux, or Unix then you can read this Mark G. Sobell (2015). A Practical Guide to Ubuntu Linux. Prentice Hall book.

After that please read these Introduction to Computing Principles lecture notes.

After that please read this Abraham Silberschatz et al. (2018). Operating System Concepts. Wiley book.

Terminology Review:

  • Central Processing Unit (CPU).
  • Random-Access Memory (RAM).
  • Hard Disk Drive (HDD).
  • Solid-State Drive (SSD).
  • Programs.
  • Basic Input/Output System (BIOS)
  • Unified Extensible Firmware Interface (UEFI).
  • Boot Loader.
  • Operating System (OS).
  • Monolithic Structure.
  • Microkernels.
  • User Mode.
  • System Calls.
  • Kernel.
  • Kernel Mode.
  • Processes.
  • Threads.
  • Process Synchronization.
  • Memory Management Unit.
  • Logical Address.
  • Physical Address.
  • Paging.
  • File System.
  • Security and Protection.
  • Networks.
  • Virtual Memory.
  • Virtualization.
  • Virtual Machines.

Once you finish learning about operating systems please click Topic 2 – Introduction to Computer Networks to continue.