Day: September 25, 2021

Hide title in blog body when displayed in blog list in WordPress

Hide title in blog body when displayed in blog list in WordPress

In order to have a complete document in each blog, blog title is saved in blog body as well.

Blog appears in blog list with title in blog body.

screen

Blog appears in blog list without title (hidden) in blog body.

screen

To hide the blog title in blog list, which is in <h1> or # form, using following code.

.wpbstarter-blog-list .entry-content h1 {
  display: none;
}

Another way to hide it, this can have more control.

.wpbstarter-blog-list .entry-content h1 {
  font-size: 0;
  width: 1px;
  height: 1px;
  display: inline-block;
  overflow: hidden;
  position: absolute!important;
  border: 0!important;
  padding: 0!important;
  margin: 0!important;
  clip: rect(1px,1px,1px,1px);
}

How to use Markdown for writing technical documentation

Source: How to use Markdown for writing technical documentation

How to use Markdown for writing technical documentation

Adobe technical documentation articles are written in a lightweight markup language called Markdown, which is both easy to read and easy to learn.

As we are storing Adobe Docs content in GitHub, it can use a version of Markdown called GitHub Flavored Markdown (GFM), which provides additional functionality for common formatting needs. Additionally, Adobe extended Markdown in a few ways to support certain help-related features such as notes, tips, and embedded videos.

Markdown basics

Headings

To create a heading, use a hash mark (#) at the beginning of a line:

# This is level 1 (article title)
## This is level 2
### This is level 3
#### This is level 4
##### This is level 5

Basic text

A paragraph requires no special syntax in Markdown.

To format text as bold, you enclose it in two asterisks. To format text as italic, you enclose it in a single asterisk:

   This text is **bold**.
   This text is *italic*.
   This text is both ***bold and italic***.

To ignore Markdown formatting characters, use \ before the character:

This is not \*italicized\* type.

Numbered lists and bullet lists

To create numbered lists, begin a line with 1. or 1), but don't use both formats within the same list. You don't need to specify the numbers. GitHub does that for you.

1. This is step 1.
1. This is the next step.
1. This is yet another step, the third.

Displayed:

  1. This is step 1.
  2. This is the next step.
  3. This is yet another step, the third.

To create bullet lists, begin a line with * or - or +, but don't mix the formats within the same list. (Do not mix bullet formats, such as * and +, within the same document.)

* First item in an unordered list.
* Another item.
* Here we go again.

Displayed:

  • First item in an unordered list.
  • Another item.
  • Here we go again.

You can also embed lists within lists and add content between list items.

1. Set up your table and code blocks.
1. Perform this step.

   ![screen](https://experienceleague.adobe.com/docs/contributor/assets/adobe_standard_logo.png)
1. Make sure that your table looks like this: 

   | Hello | World |
   |---|---|
   | How | are you? |  
1. This is the fourth step.

   >[!NOTE]
   >
   >This is note text.

1. Do another step.

Displayed:

  1. Set up your table and code blocks.

  2. Perform this step.

    screen

  3. Make sure that your table looks like this:

    Hello World
    How are you?
  4. This is the fourth step.

    [!NOTE]

    This is note text.

  5. Do another step.

Tables

Tables are not part of the core Markdown specification, but Adobe supports them to an extent. Markdown doesn't support multiple lines lists in cells. Best practice is to avoid using multiple lines in tables. You can create tables by using the pipe (|) character to delineate columns and rows. Hyphens create each column's header, while pipes separate each column. Include a blank line before your table so it's rendered correctly.

| Header | Another header | Yet another header |
|--- |--- |--- |
| row 1 | column 2 | column 3 |
| row 2 | row 2 column 2 | row 2 column 3 |

Displayed:

Header Another header Yet another header
row 1 column 2 column 3
row 2 row 2 column 2 row 2 column 3

Simple tables work adequately in Markdown. However, tables that include multiple paragraphs or lists within a cell are difficult to work with. For such content, we recommend using a different format, such as headings & text.

For more information on creating tables, see:

Links

The Markdown syntax for an inline link consists of the [link text] portion, which is the text that will be hyperlinked, followed by the (file-name.md) portion, which is the URL or file name that's being linked to:

[link text](file-name.md)

[Adobe](https://www.adobe.com)

Displayed:

Adobe

For links to articles (cross-references) within the repository, use relative links. You can use all relative link operands, such as ./ (current directory), ../ (back one directory), and ../../ (back two directories).

See [Overview example article](../../overview.md)

For more information on linking, see the Links article of this guide for linking syntax.

Images

![Adobe Logo](https://experienceleague.adobe.com/docs/contributor/assets/adobe_standard_logo.png "Hover text")

Displayed:

Adobe Logo

NOTE: For images that should not be localized, create a separate do-not-localize folder in the assets folder. Typically, images without text or images containing only sample content would be placed there. This removes any "noise" from the assets folder and reduces the amount of questions.

Code blocks

Markdown supports the placement of code blocks both inline in a sentence and as a separate "fenced" block between sentences. For details, see Markdown's native support for code blocks

Use back ticks ( ` ) to create inline code styles within a paragraph. To create a specific multi-line code block, add three back ticks (```) before and after the code block (called a "fenced code block" in Markdown and just a "code block" component in AEM). For fenced code blocks, add the code language after the first set of back ticks so that Markdown correctly highlights code syntax. Example: ```javascript

Examples:

This is `inline code` within a paragraph of text.

Displayed:

This is inline code within a paragraph of text.

This is a fenced code block:

function test() {
 console.log("notice the blank line before this function?");

Custom Markdown extensions

Adobe articles use standard Markdown for most article formatting, such as paragraphs, links, lists, and headings. For richer formatting, articles can use extended Markdown features such as:

  • Note blocks
  • Embedded videos
  • Do not localize
  • Component properties, such as assigning a different heading ID to a heading

Use the Markdown block quote ( > ) at the beginning of every line to tie together an extended component, such as a note. If you need to use subcomponents within components, add an extra level of block quotes (> >) for that subcomponent section. For example, a NOTE within a DONOTLOCALIZE section should begin with > >.

Some common Markdown elements such as headings and code blocks include extended properties. If you need to change default properties, add the parameters in french braces /{ /} after the component. Extended properties are described in context.

Note blocks

You can choose from these types of note blocks to draw attention to specific content:

  • [!NOTE]
  • [!TIP]
  • [!IMPORTANT]
  • [!CAUTION]
  • [!WARNING]
  • [!ADMINISTRATION]
  • [!AVAILABILITY]
  • [!PREREQUISITES]

In general, note blocks should be used sparingly because they can be disruptive. Although they also support code blocks, images, lists, and links, try to keep your note blocks simple and straightforward.

>[!NOTE]
>
>This is a standard NOTE block.

Displayed:

[!NOTE]

This is a standard NOTE block.

>[!TIP]
>
>This is a standard tip.

Displayed:

[!TIP]

This is a standard tip.

Videos

Embedded videos won't natively render in Markdown, but you can use this Markdown extension.

>[!VIDEO](https://video.tv.adobe.com/v/29770/?quality=12)

Displayed:

!VIDEO

More Like This

The "More Like This" component in AEM appears at the end of an article. It displays related links. When the article is rendered, it can be formatted the same as level-2 headings (##) without being added to the mini-TOC.

>[!MORELIKETHIS]
>* [Article 1](https://helpx.adobe.com/support/analytics.html)
>* [Article 2](https://helpx.adobe.com/support/audience-manager.html)

Displayed:

[!MORELIKETHIS]

UICONTROL and DNL

All of our Markdown help content is localized using machine translation initially. If the help has never been localized, then we keep the machine translation. However, if the help content has been localized in the past, then the machine translated content will act as a placeholder while the content is in the process of human translation.

[!UICONTROL]

During machine translation, items tagged with [!UICONTROL] are checked against a localization database for the appropriate translation. In the case that the UI is not localized, this tag will allow the system to leave the UI reference in English for that particular language (ie. Analytics references in Italian).

Example:

  1. Go to the [!UICONTROL Run Process] screen.
  2. Choose [!UICONTROL File > Print > Print All] to print all the files on your server.
  3. The [!UICONTROL Processing Rules] dialog box appears.

Source:

1. Go to the **[!UICONTROL Run Process]** screen.
1. Choose **[!UICONTROL File > Print > Print All]** to print all the files on your server.
1. The [!UICONTROL Processing Rules] dialog box appears.

NOTE: Of the three tagging options, this is the most crucial to deliver high quality and is mandatory.

[!DNL]

As a rule, we use a "Do not translate" list to tell the machine translation engines what to keep in English. The most prevalent items would be the long solution names like "Adobe Analytics", "Adobe Campaign", and "Adobe Target". However, there may be cases where we need to force the engine to use English because the term in question may be used in a specific or general way. This most obvious case would be short names for the solutions like "Analytics", "Campaign", "Target" etc. It would be difficult for a machine to understand that these are solution names and not general terms. The tag may also be used for third-party names/features which always remain in English or for shorter sections of text like a phrase or sentence which must remain in English.

Example:

  • With [!DNL Target], you can create A/B tests to find the optimal
  • Adobe Analytics is a powerful solution to collect analytics on your site. [!DNL Analytics] can also help you with reporting to easily digest that data.

Source:

* With [!DNL Target], you can create A/B tests to find the optimal 
* Adobe Analytics is a powerful solution to collect analytics on your site. [!DNL Analytics] can also help you with reporting to easily digest that data.

Gotchas and troubleshooting

Alt text

Alt text that contains underscores won't be rendered properly. For example, instead of using this:

![Settings_Step_2](/assets/settings_step_2.png)

OUr best practice is to use hyphens (-) instead of underscores (_) in filenames.

![Settings-Step-2](/assets/settings-step-2.png)

Apostrophes and quotation marks

If you copy text into a Markdown editor, the text might contain "smart" (curly) apostrophes or quotation marks. These need to be encoded or changed to basic apostrophes or quotation marks. Otherwise, you end up with odd characters like this when the file is published: It’s

Here are the encodings for the "smart" versions of these punctuation marks:

  • Left (opening) quotation mark:
  • Right (closing) quotation mark:
  • Right (closing) single quotation mark or apostrophe:
  • Left (opening) single quotation mark (rarely used):

Angle brackets

If you use angle brackets in text (not code) in your file--for example, to denote a placeholder--you need to manually encode the angle brackets. Otherwise, Markdown thinks that they're intended to be an HTML tag.

For example, encode <script name> as <script name>

Ampersands in titles

Ampersands (&) aren't allowed in titles. Use "and" instead, or use the & encoding.

See also

Markdown resources

CSS Selectors

CSS Selectors

To select DOM elements in CSS using selector.

Tag Selector

a {
  color: black;
}

h1 {
  font-size 24px;
}

Single selector

Selector Description
article Selects the element with the article tag
.post Selects all elements with the post class
#nav Selects the elements with the nav Id
div.row Selects all elements with the div tag and the row class
[hidden="true"] Selects all elements with the hidden attribute with a value of true

Note: Wildcard selector can be used to select all DOM elements.

Combine selector

Selector Description
div li DOM descendant combinator. All li tags that are a child of div tags
div.row * Selects all elements that are descendant (or child) of the elements with div tag and row class
div > li Difference combinator. Select direct descendants
div + li the adjacent combinator. It selects the element that is immediately preceded by the former element. In this case, only the first li after each div.
div, li Selects all li elements and all div elements.
div - li The sibling combinator. Selects li element following a div element.

Pseudo-selectors

Position of an element

Selector Description
:first-child Target the first element immediately inside (or child of) another element
:last-child Target the last element immediately inside (or child of) another element
:nth-child() Target the nth element immediately inside (or child of) another element. Admits integers, even, odd, or formulas
div:not(.name) Selects all div elements that are not of the .name class
::after Allows inserting content onto a page from CSS, instead of HTML. While the end result is not actually in the DOM, it appears on the page as if it is. This content loads after HTML elements.
::before Allows inserting content onto a page from CSS, instead of HTML. While the end result is not actually in the DOM, it appears on the page as if it is. This content loads before HTML elements.

State of an element

Selector Description
:hover selects an element that is being hovered by a mouse pointer
:focus selects an element receiving focus from the keyboard or programattially
:active selects an element being clicked by a mouse pointer
:link selects all links that have not been clicked yet
:visited selects a link that has already been clicked

Example

The :nth-child can use pattern, such as odd, even, An+B

a:nth-child(3n) {
  /* Css goes here */
}

KVM setup in Fedora

KVM setup in Fedora

Commands

virsh list --all
virsh start <vm>
virsh start <vm> --console
virsh stop <vm>

KVM vs XEN

KVM isn't kernel specific, XEN required special kernel, so XEN could have kernel upgrade issue.

Bridge Network

When creating bridging network, if grub is used to create network interface, then Network Manager should not be used to create same interface. If Network Manager used, same network interface will be appear in ifconfig -a command output twice, One is created by NetworkManager, another is created by grub. If bridge network interface created on top of grub created interface, the IP address will be still assigned to grub created interface.

In order to avoid above issue, following line in /etc/default/grub to create network interface with bridging network interface br0.

GRUB_CMDLINE_LINUX=" ... ip=192.168.1.9::192.168.1.254:255.255.255.0::br0:off nameserver=192.168.1.250 ifname=enp0s10:00:26:4a:18:82:c6 bridge=br0:enp0s10"

After br0 created, KVM manager can select bridging network for vm creation.

Update grub using following command

grub2-mkconfig -o /boot/grub2/grub.cfg

Download driver

Both Windows disk controller driver and ethernet driver can be downloaded from Fedora Website, https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/virtio-win-0.1.139-1/virtio-win-0.1.139.iso, and add additional CD-ROM to point to this iso.

Create VM

Using Virtual Machine Manager

Create VM requires add storage, if the storage file doesn't exist, need to select the storage location, and also input the size of disk which located above the location selection box.

Using command line

To create Ubuntu VM from local image,

virt-install \
--name ubuntu2104 \
--ram 3072 \
--vcpus 2 \
--disk path=/kvm/ubuntu2104.qcow2,size=20 \
--os-variant ubuntu20.04 \
--os-type linux \
--network bridge=br0 \
--graphics none \
--console pty,target_type=serial \
--cdrom /kvm/ubuntu-21.04-live-server-amd64.iso \
--boot kernel=casper/vmlinuz,initrd=casper/initrd,kernel_args="console=ttyS0"

To create Fedora VM from remote server

virt-install \
--name fed34 \
--ram 2048 \
--vcpus 2 \
--disk path=/kvm/fed34.img,size=20 \
--os-variant fedora34 \
--os-type linux \
--network bridge=virbr0 \
--graphics none \
--console pty,target_type=serial \
--location 'https://mirror.arizona.edu/fedora/linux/releases/34/Server/x86_64/os/' \
--extra-args 'console=ttyS0,115200n8 serial'

Create Windows 10 VM

virt-install \
   --ram=4096 \
   --name=windows10 \
   --os-type=win10 \
   --network network=default \
   --disk path=/kvm/kvm-windows10.img,size=100 \
   --cdrom=/kvm/virtio-win-0.1.139.iso \
   --graphics spice

Cons

  • Cannot select type of CPU or Passthru mode
  • Cannot select type of disk controller type to use virtual device driver.

References

10 Easy Steps To Install Windows 10 on Linux KVM – KVM Windows

Play music with DAC in MacOS

Play music with DAC in MacOS

Use music players in MacOS and output to DAC directly.

Colibri

Website: https://colibri-lossless.com/

Setup

  • Go to Preferences -> Output screen
  • Change Output Device
  • Change DSD mode to DoP if DAC supports DSD.
  • Change PCM mode from to the highest DSD format DAC can play
  • Enable Exclusive / Hog mode if don't expect OS sounds appear
  • Enable Audio Signal Bypass if want to disable OS sound functions
  • Auto-raise system volume to 100% for this device if the DAC has no problem such as reseting voice level. For example, Creative portable DAC can suddent raise to very high level when turning on.
  • Changing device requires Remember... setting to be off

Note: If using Exclusive mode, need to change system default sound device to other device in order to use the device selected for music playing.

Cons

  • Free
  • Can play many format
  • Changing options require player restart
  • Can not specify DAC unsupported formats to be software decoded

VLC

Setup

Forgot how to change them.

  • Go to **Preferences"
  • Click on Show All at bottom left corner
  • ...

Cons

  • Cannot play DFF format
  • Not easy to find out options
  • Mainly for video playing

JRiver Media Center

This is a library style player, but user interface isn't user friendly as iTune, and library isn't manging not well at all.

Pros

  • Not free and yearly upgrade
    • Master (for Windows, Mac, and Linux) License Upgrade $34.98
    • Single OS Upgrade $22.98

Cons

  • Support Windows, Mac, and Linux

Boot from small USB drive with iscsi root filesystem

Boot from small USB drive with iscsi root filesystem

Boot from small size USB drive only holding boot partitions, rest of filesystems are on iscsi drives. Tested in EFI boot in Fedora 34.

Requirement

  • /boot partition can be 256M, can be very small, but better bigger
Filesystem                         Size  Used Avail Use% Mounted on
/dev/sdb2                          428M  190M  212M  48% /boot
  • /boot/efi is an almost static very small filesystem, can be very small
Filesystem                         Size  Used Avail Use% Mounted on
/dev/sdb1                          512M   31M  482M   6% /boot/efi

grub configuration

Define iscsi login info

GRUB_CMDLINE_LINUX="netroot=iscsi:<user>:<password>@<ip>::3260::<iqn> rd.iscsi.initiator=<client iqn> rhgb quiet ...

Define network interface with static ip 192.168.1.2, gateway 192.168.1.254, nameserver 192.168.1.1, interface enp0s10.

ip=192.168.1.2::192.168.1.254:255.255.255.0::enp0s10:off nameserver=192.168.1.1

Define network with bridge interface br0 on network interface enp0s10

ip=192.168.1.2::192.168.1.254:255.255.255.0::br0:off nameserver=192.168.1.1 ifname=enp0s10:xx:xx:xx:xx:xx:xx bridge=br0:enp0s10"

Update grub using following command

grub2-mkconfig -o /boot/grub2/grub.cfg

Shell command to remove `(1)` from filename

Shell command to remove (1) from filename

To compare massive number of files with (1) in file name, with the original files without (1), such as ABCD(1).txt and ABCD.txt, following commands can be used. Beware, they are not steps but commands.

Use bash substring

  • Find out all *(1)* files and check whether have original file in same folder.
find . -name "*\(1\)*" | while read line
do
    if test -e "${line/(1)/}"; then
        echo "$line"
    fi
done

Then can clean up them one by one.

  • Move them to another directory

  • Rename them to be the same as original file in same folder

find . -name "*\(1\)*" | while read line
do
    if test ! -e "${line/(1)/}"; then
        mv "$line" "${line/(1)/}"
    fi
done
  • Compare them with original files in same folder

Note: This method only work with the original filename has no (1) string.

Use sed

Following sample script can be used for same task.

#!/bin/bash

find . -name "*" -type f | while read line
do
        dname="`dirname -- \"$line\"`"
        bname="`basename -- \"$line\"`"
        # pattern='s/\(([0-9])\)\./\1/'         # remove "." if match "(1).", \1 == ([0-9])
        # pattern='s/(\([0-9]\))\./\1/'         # remove "(", ")" and "." if match "(1).", \1 == [0-9]
        # pattern='s/([0-9]).//'                # remove "(1)"+any_char
        # pattern='s/[0-9]\.//'                 # remove "(1)."
        # pattern='s/([0-9])\././'              # remove "(1)"
        pattern='s/\s*([0-9])\././'           # remove any_space+"(1)"
        # pattern='s/\s*\././'                  # remove any_space before "."
        # pattern='s/^\./11./'                  # add "11" in front if start with "."
        # pattern='s/^01\./10./'                        # replace starting "01." to "10."
        # pattern='s/^0\([2-9]\)\./1\1./'               # replace starting "01." to "10."
        nname="`echo \"$bname\" | sed -e "$pattern"`"
        # echo "$bname"; echo "$nname"

        if [ "$nname" != "$bname" -a ! -e "$nname" ] ; then
                pushd "$dname"
                echo "$bname"; echo "$nname"
                mv "$bname" "$nname"
                popd
        fi
done

Use vim

  • Use following command to get the list of file name
find . -name "*(1).*" -exec echo mv ~{}~ ~{}~ \; > list
  • Use vim to edit the file
vi list
  • Use lookahead to replace the last (1)
%s/.*\zs(1)//
  • Replace ~ to ", then save it
%s/\~/"/g
  • Run the script
sh list

References

How to change last occurrence of the string in the line?
Regex lookahead and lookbehind

TODO: Network boot for MacBook Pro

Network boot for MacBook Pro

Status

Tried iPXE, but failed after boot into kernel file.

Successfully load boot files

Able to boot by given filenames using similar method as below in iPXE configuration file tftp/boot.ipxe.

initrd ubuntu/12.10-desktop-${cpu_name}/casper/initrd.lz
chain ubuntu/12.10-desktop-${cpu_name}/casper/vmlinuz root=/dev/nfs boot=casper netboot=nfs nfsroot=192.168.1.17:/volume1/tftp/ubuntu/12.10-desktop-${cpu_name} quiet splash
boot

The error shows some sort of issue related to invalid function. Internet users mentioned that it was caused by converting EFI boot to MBR boot in iPXE but firmware doesn't support it.

Able to boot into EFI disk

Looks like MacbookPro supports EFI disk boot only

Issues

Secure boot

Secure boot verifies the signature of boot software whether trusted by firmware. This issue had been fixed after copy workable boot partition from other bootable images, such as ubuntu, fedora, or windows boot image, include /boot and /boot/efi.

Read kernel

Got issue with this stag, kernel read, but execution error with invalid function, didn't have time to troubleshoot.

Future

Grub boot

For network root partition boot, which has /bootlocally, root partition / on iSCSI disk, the grub should be configured as upgrade acceptable, including following requirements.

  • Kernel image should be a standard image to avoid manual kernel rebuilt process
  • Kernel image should include iSCSI driver
  • Kernel image should be able to configure fix IP Address, to avoid unstable iSCSI connection and unauthorized access
  • Kernel image should be able to configure bridge interface or macvlan interface, to support virtualization
  • Kernel image should be less network interface name dependent, to avoid network interface name changed

Network boot

For iPXE boot, iPXE firmware can be loaded by PXE boot process or a local disk, following requirements should be considered.

  • The kernel specification and detection are not part of iPXE configuration.
  • iPXE only detects iSCSI disk, and grub treats it as local disk, then boot from this local disk (iSCSI disk)
  • iPXE iSCSI disk should be able to be recognized by grub as local disk
  • Grub should not reset the network interface or renew IP address
  • MAC address should be the same in iPXE and Grub
  • OS should lock down the network interface, should not allow any services (Network Manager, etc) manage the interface.
  • OS should lock down iSCSI disk
  • Some requirements in Grub boot

References

Fix: System Found Unauthorized Changes on the Firmware, Operating System or UEFI Drivers

TODO: Synology SSD Cache Issues

Synology SSD Cache Issues

Synology SSD Cache have two issues as below

  • Unable to use one disk/array to support mulitiple volume.

    • No answer from Internet and some people mentioned that it is a new request.
    • Possible solution is to create partition/volume on SSD Storage Pool, then use volume as cache device.
    • Synology uses LVM cache, haven't checked whether native linux can do or not.
  • Utilization of cache is very low, about 5GB on fequently used volume, such as volume1.

    • Improved in DSM 7 which supports Pin all Btrfs metadata option. But haven't validated the utilization.