How to use std::embed in C++?

The std::embed offers a standardized solution for C++ to include bytes of data into the target binary of the program. For an example of bytes of data, we can demonstrate it in the segment of code: byte data[] = { 0x01, 0x02, 0x03, ... }; auto result = process_my_data(data); The problem here is that it's hard to maintain it when the data is large one. Many projects may use a standalone script to convert such a data array from a binary data file at the build stage. The std::embed eliminates such a complexity for us, for example: #include <embed> std::span<byte> data = std::embed("my-data-file.bin"); auto result = process_my_data(data); For more information, please see the published proposal: Published Proposal P1040r6: std::embed

How to create Windows 10 USB setup disk from ISO using Linux?

The Windows ISO setup image downloaded from Microsoft can actually be directly extracted to a USB stick of FAT32 partition. Almost all PC today can boot this USB drive. But the new Windows 10 setup ISO image contains special a source file named  install.wim , which is larger than 4GB. So you have to split setup sources into two partitions. The first one is UEFI of FAT32 format, the second must be a NTFS partition larger than 6.5GB. That says you have to find a USB drive have at least 7~8GB. To create this Windows 10 setup USB drive, please login your Linux distro. Both Fedora and Ubuntu should work for this article. The creation steps: Open Disks Utility from your Fedora desktop and plug a empty USB drive (ensure at least 8GB). Create a FAT32 partition using the Disks Utility named UEFI of 1GB size. Create a second partition of NTFS format occupies the rest USB drive space, here we say 7GB. Download the Windows 10 ISO image from Microsoft official download page. Mount the Windows 10

How to copy a btrfs subvolume to another volume (partition/disk)?

The btrfs utility has two commands to write and read a subvolume to a general file, which can be a stdout/stdin too. They are ' send ' and ' receive '. Note that ' send ' and ' receive ' are designed for backup purposes. The received subvolume copy will be initially readonly. You have to normalize the copied subvolume with snapshot. Reference command sequence for copying subvolumes: 1. Create a readonly snapshot copy of the subvolume to be copied: btrfs subvolume snapshot /mnt/vol_0/sub /mnt/vol_0/sub.snapshot btrfs subvolume snapshot -r /mnt/vol_0/sub.snapshot /mnt/vol_0/sub.readonly 1. Copy the subvolume to another volume: btrfs subvolume send /mnt/vol_0/sub.readonly | btrfs receive /mnt/vol_1/ 2. Normalize the readonly subvolume copy with snapshot: btrfs subvolume snapshot /mnt/vol_1/sub.readonly /mnt/vol_1/sub 3. (Optional) Now the copied subvolume is available at /mnt/vol

How to hide (aka. remove) "Powered by Blogger".

Goto "Theme" page, find your custom theme's "CUSTOMIZE" button, click the small triangle button right to it, select "Edit HTML", search where .Attribution .blogger occured, paste the following CSS code after that } line. .Attribution .blogger { display:none } Click save button, done.

How to use this site?

This site will publish bits of knowledge for HOWTO s, specially computer technologies and crypto.