wordpress sub-category ( lowercase letters + non-latin characters ) = 404

If the sub-category’s slug is a combination of lowercase letters and Korean, page 404 appears.

1 : NGINX settings

location / {     try_files $  uri $  uri/ /index.php?$  args; } 

2 : WordPress – Permerlink settings

  • Custom: /%category%/%postname%/
  • Category Base:.

3 : WordPress – Yoast

  • Taxonomies > Category URLs ( Remove )

4 : Tested content

4-1 : In case of parent category ✅

  • mywebsite.com/한글 = 200
  • mywebsite.com/a한글 = 200
  • mywebsite.com/한글B = 200

4-2 : In case of post ✅

  • mywebsite.com/한글/post글 = 200 ( lowercase + non-latin )

4-3 : In case of child category ⚠️

  • mywebsite.com/한글/한글 = 200
  • mywebsite.com/한글/a한글 = 404 ❌
  • mywebsite.com/한글/한글b = 404 ❌
  • mywebsite.com/한글/C한글 = 200
  • mywebsite.com/한글/한글D = 200
  • mywebsite.com%2F%ED%95%9C%EA%B8%80%2Fa%ED%95%9C%EA%B8%80 = 200 ⭕️ ( /한글/a한글 : url encoded )
  • mywebsite.com/한글/A한글 = 200 ⭕️ ( /한글/a한글 : uppercase )

5 : Reference question

Arabic Characters in URL returns 404 Error

I think it might be related to @user139986 ‘s answer.

I don’t know how to handle this problem .. 😭

Writing a list of names, with a limited amount of “active” letters at a time. Algorithm to sort the names to reduce the amount of swapping letters?

While making name-tags for a dinner seating, I stumbled upon a problem which I can’t find any algorithm to solve, and I’m not sure where to begin.

The goal is to write the name of each dinner guest on a card, completing one name at a time. The names are written with old-fashioned rubber stamps, so only 6 letters can be "active" at any given time. When a new letter is required, one of the active letters has to be swapped out for the new letter.

The problem is to sort the names in such an order, that I need to do the least amount of letter-swapping.

Example
I want to write the names:

  • Jack
  • Julie
  • Chuck

I can do this with 3 letter-swaps
Initial letters: J A C K H U
Write: Jack, Chuck

{swap A, C, K with L, I, E}

New active letters: J L I E H U
Write: Julie

Now I want to find an algorithm that, given a list of names and a limit of active characters, provide the order of names and which letters to swap at each name, to reduce the total amount of letter-swaps.

Any ideas or pointers are welcome.

Minimum number of given operations in order to group letters in a string


Description

Suppose we have a string containing letters ‘A’,’B’,’C’,’D’, and the characters are placed in a stack.We also have an empty stack.Ultimately,we want all letters grouped in the 2nd stack,using only 3 operations:

  • push("p"): Removes an items from the bottom of the 1st stack and place it to the top of the 2nd
  • complement("c"): Replace every all letters of the 1st stack with they "complements".The pairs are A – B and C – D
  • reverse("r"): Reverse the content of the 2nd stack.The top becomes bottom and bottom->top.

Example of moves

| Move | First Stack | Second Stack | +------+-------------+--------------+ |      | DBACA       |              | +------+-------------+--------------+ | p    | DBAC        | A            | +------+-------------+--------------+ | p    | DBA         | CA           | +------+-------------+--------------+ | r    | DBA         | AC           | +------+-------------+--------------+ | p    | DB          | AAC          | +------+-------------+--------------+ | c    | CA          | AAC          | +------+-------------+--------------+ | p    | C           | AAAC         | +------+-------------+--------------+ | r    | C           | CAAA         | +------+-------------+--------------+ | p    |             | CCAAA        | +------+-------------+--------------+ 

Note that the example above finds a solution,but not the minimum solution.The correct answer would be "ppr ppp"

Correct examples

Spaces in the sequence have no meaning and are added for readability purposes.

+------------------------+-------------------------------------+ | First Stack (input)    | Moves (output)                      | +------------------------+-------------------------------------+ | DD                     | pp                                  | +------------------------+-------------------------------------+ | BADA                   | ppr pp                              | +------------------------+-------------------------------------+ | DADA                   | ppc pp                              | +------------------------+-------------------------------------+ | DBACA                  | pprppp                              | +------------------------+-------------------------------------+ | BDA CACA               | ppr prp rppp                        | +------------------------+-------------------------------------+ | CAC DCDC               | pcp cpc pcp cpp                     | +------------------------+-------------------------------------+ | ADA DBD BCB DBCB       | ppr pcr pcr prp rpr prp rpr prp rp  | +------------------------+-------------------------------------+ | DAB BCC DCC BDC ACD CC | ppc pcp cpp rpp rpp cpc ppr ppc prp | +------------------------+-------------------------------------+ 

Brute force approach

We could just use brute force approach,calculating all possible moves until the first stack is empty.This could be done using BFS or A* algorithms.

For example,we could initialize an empty queue,start from a parent node and create 3 new nodes for every possible move.Then add these nodes to the queue.Every time remove a node from the queue and apply the operations.Save the sequence of moves while nodes are created.If the last move was a "c",then skip "c" operation for this node.The same is true about "r" operation (no repetitive c’s or r’s).If stack1 = empty for a node,then finish the program and return the sequence of moves.

Questions

Is there a better way to solve this problem? Can we apply some heuristics as improvement in the brute force approach? Thank you in advance.

Longest Even Length Palindromic Substring (with unique adjacent characters except for the center 2 letters)

You are given a string S containing lowercase English characters. You need to find the length of the largest subsequence of S that satisfies the following pattern: X1,X2,X3…Xn,Xn,…X3,X2,X1 where Xi is some character of S. The only constraint is that no adjacent character should be the same except Xn, that is Xi != X(i+1) for all 1<=i< n.

Input: The string: S

Output: The integer: 2n

Constraint: 1<=|S|<=10^3

Sample input 1: “acdbdea”

Sample output 1: 4

Explanation: “adda” is the longest subsequence following the given pattern.

Sample input 2: “abbacdeedc”

Sample output 2: 6

Explanation: “cdeedc” is the longest subsequence following the given pattern.

Sample input 3: “taker”

Sample output 3: 0

Explanation: No subsequence follows the given pattern.


This question was asked in a coding interview and I didn’t know how to solve it. I understood how to find longest palindromic sub sequence but don’t know how to implement the unique adjacent character part. Please help. pseudo code is fine

How can i find the binary tree search given strings with 3 letters and out of which some are repeated?

The question: A list with 12 elements is given as the following: (Ari, Tau, Gem, Cnc, Leo, Vir, Lib, Sco, Sgr, Cap, Aqr, Psc). Find a sequence of the elements such that using that sequence to insert the elements to generate a binary search tree according to the alphabetical order of the elements, the resultant binary search tree will also be a complete binary tree. Draw the resultant binary search.

I’m quite new to data structure and I have been struggling with making binary tree search with strings. I am given strings such as Ari, Tau, Gem, Cnc, Leo, Vir, Lib, Sco, Sgr, Cap, Aqr, Psc. To make the binary tree do I number the letters like since there are two a’s I’ll ignore that and go to the next letter so I’ll go to ‘r’ and ‘q’, which means ‘r’ would be 18 and ‘q’ would be 17. For Tau it would be 20 since there are two c’s I’ll ignore the c and pick ‘n’ from Cnc and ‘a’ from Cap.

Could someone help me clear the concept please?

Veracrypt encrypted file – how to expand the Volume and what are Drive Letters?

can you help me understand some questions about Veracrypt:

  1. If you have created an encrypted file but the volume which you selected for it needs expansion, is it from security standpoint fine to just use the available option “expand volume” to adjust the file’s volume? Or is it for some reason better to create a totally new encrypted file with your desired larger volume?

  2. What is the meaning of all the different Drive Letters (A-Z)? Do you have to mount a file from a specific drive letter, or can you mount from any letter?

Thanks

Regular expression for language that does not accept x string (3 letters, |x|=3)

The language I am interested in is $ L=\{w∈\{a,b,c\}^*| w$ contains “$ bac$ ” but not “$ cab$ $ \}$ . I am thinking that the result will have the form $ L=X_1X_2X_3$ , where $ X_1=\{w∈\{a,b,c\}^*| w$ does not contain “$ ca$ ” at the end nor “$ cab$ ” anywhere$ \}$ , $ X_2=$ $ bac$ ” and $ X_3=\{w∈\{a,b,c\}^*| w$ does not contain “$ ab$ ” at the start nor “$ cab$ ” anywhere$ \}$ . What I find difficult to express is that “$ cab$ ” does not appear anywhere in $ X_1, X_3$ (the situation for “ca” and “ab” is simple because they consist only of 2 letters, we can split $ X_1, X_3$ so that the “cab” problem remains). I have tried creating a NFA for this purpose but the automata needs to have quite a few loops (thus it is hard to find the regular expression). My question is whether there is a clever way to find the representation of non-existance of “cab”, other than counting all the possibilities in the NFA that accepts such strings. If there is no such way, how can I find the regular expression of L from the start?

List all entries in the current directory whose names contain only uppercase letters

In one of my lab questions I was asked to list all entries(both files and folders) in the current directory whose names contain only uppercase letters using piping and grep command. Folders must have a forward slash displayed. Initially, my solution looked like this:

ls -p | grep -e "^[[:upper:]]*\/?$  " 

I thought that I can protect the ‘/’ sign with the backward slash(as in echo \* vs echo *). However, it doesn’t work as intended. One of my friends suggested the following solution:

ls -p | grep -e '^[[:upper:]]*/\?$  ' 

I have no idea why the backward slash is used like this. What is even more weird,for me, that it actually produces the right result. I was wondering if someone could explain where the mistake in my solution is and why the second version actually works.