WordPress post using block editor displays error when adding the string “cmd.exe”

Today a member of our content team reported that when they attempted to save a post in block editor mode, they continually received an error.

Updating failed. The response is not a valid JSON response.

After some debugging steps we determined that the string “cmd.exe” was to blame. When that string was present the author always got the above error. But when the string was gone or had a space after the “.”, the post saved and displayed just fine. I recreated it in a brand new post, with only the string “cmd.exe” and confirmed that I got the same error.

enter image description here

When viewing the post in the “code editor” view, this is the contents:

<!-- wp:paragraph -->
<p>cmd.exe</p>
<!-- /wp:paragraph -->

We’re currently running WP 5.7.2 on WP Engine.

Does anyone know why this might be happening? I understand it’s probably a security issue, but this seems quite the ham-fisted approach.

python 3.x – Filtering string by given keywords

Im currently working on a filtering keywords. I have two lists which I called positive and negative.

Scenarios:

  1. if POSITIVE matches and NOT NEGATIVEmatches = True
  2. if POSITIVE matches and NEGATIVEmatches = False
  3. if NOT POSITIVE(Then no need to check NEGATIVE) = False.

I have done something like this:

import re
from typing import List

# In the future it will be a longer list of keywords
POSITIVE: List(str) = (
    "hello+world",
    "python",
    "no"
)

# In the future it will be a longer list of keywords
NEGATIVE: List(str) = (
    "java",
    "c#",
    "ruby+js"
)


def filter_keywords(string) -> bool:
    def check_all(sentence, words):
        return all(re.search(r'b{}b'.format(word), sentence) for word in words)

    if not any(check_all(string.lower(), word.split("+")) for word in POSITIVE) or 
            any(check_all(string.lower(), word.split("+")) for word in NEGATIVE):
        filtered = False
    else:
        filtered = True

    print(f"Your text: {string} is filtered as: {filtered}")
    return filtered


filter_keywords("Hello %#U&¤AU(1! World ¤!%!java")
filter_keywords("Hello %#U&¤AU(1! World ¤!%!")
filter_keywords("I love Python more than ruby and js")
filter_keywords("I love Python more than myself!")

Regarding the + in the list, that means that if hello and world is in the string then its a positive match

It does work of course, but I do believe I am doing too many “calculations” and I believe it could be shorted, I wonder if there is a possibility of it?

R how to turn all rows data in a dataframe to a single string?

I have a tibble df, and if I do the below, I get all rows data in below format.

df = tibble(A1=c("A03816","A03817"))
> df(("A1"))
(1) "A03816" "A03817"

But I want those 2 words in the same string like below, how can I do it?


(1) "A03816 A03817"

Connection string for my SQL Server connection from C on Linux

I am trying to connect to SQL Server using C program on Linux.

My connection string is this:

DRIVER = {ODBC Driver 17 for SQL Server}; Server = 192.168.0.25,52000;Database = db; UID = ud, PWD = pw;

When I want to perform a test connection, I get this error:

[unixODBC][Microsoft][ODBC Driver 17 for SQL Server]Login failed for
user ”

Something must be wrong with the connection string because it shows empty user ”, not ‘ud’ as in the string above.

So I tried to connect with:

isql -v test

My odbc.ini file is:

[test]
Driver = ODBC Driver 17 for SQL Server
Server = tcp:192.168.0.25,52000
UID = ud
PWD = pw
Database = db

Unfortunately the results were the same:

[unixODBC][Microsoft][ODBC Driver 17 for SQL Server]Login failed for
user ”

So I decided to connect with

isql -v test ud "pw"

And now I finally connected. What is wrong with my connection string/odbc.ini file? I read many tutorials and they seem to be ok. But somehow UID and PWD seems to be ommited.

web browser – A runtime sometimes converts string arguments (or string returns) from WTF-16 to UTF-16 between functions in a call stack. Is this a security concern?

For example, suppose we have this code (in TypeScript syntax):

function one(str: string): string {
  // do something with the string
  return str
}

function two() {
  let s = getSomeString() // returns some unknown string that may contain surrogates
  s = one(s)
  // ...
}

two()

Now suppose that when passing the string s into the one(s) call, the runtime (not the implementation of one or two will sometimes replace part of the string. In particular, this will happen when there are WTF-16 “isolated surrogates”, but the main idea here is that this is not common and most developers will not be aware that this happens… until it happens.

Now, suppose this never happened before, but the runtime recently added this format conversion between function calls (converting function arguments or their return values without the implementation of any function having a choice in the matter).

In such a runtime, could there be a security issue after the runtime has switched from never changing strings to now doing it sometimes? If so, what could happen?


In particular, the runtime I am thinking about is JavaScript interfacing with WebAssembly in the browser in the potential near future if the new “Interface Types” proposal passes a vote for string passing to have WTF-to-UTF sanitization.

What I could imagine, for example, is some third party library updating an implementation of one or more of their functions from JavaScript to WebAssembly, this in turn causing strings being passed from JS to WebAssembly (or vice versa) to be modified from their original form, causing unexpected errors, or in the worst case, a vulnerability.

Is there a potential problem here?

Drupal 9 – Why does a query string create a 404 Page not found?

Recently upgraded from Drupal 8 to Drupal 9 and noticed if the URL has a query string (like when linked on Facebook), Drupal throws a 404 page not found.

Example:

Working URL: https://cruise.blog/2021/07/how-drive-cruise-ship

404 URL: https://cruise.blog/2021/07/how-drive-cruise-ship&ct=ga&cd=EAEYACoTMzczMDU5MTUxNjcwNDQyMzUxNzIcN2RiZjYwOGY4MzE2NmM3OTpjby51azplbjpHQg&usg=AFQjCNEa2-Hx3zqnQ59AJFnde_ORtLTvgA

string manipulation – Creating new variable names, Symbol or ToExpression

One can create new variable names by Symbol :

In(1)  Table(Symbol("x"<>ToString(i)), {i,1,5})
Out(1)  {x1,x2,x3,x4,x5}

But it is also possible to use ToExpression (old firend) :

In(2)  Table(ToExpression("x"<>ToString(i)), {i,1,5})
Out(2)  {x1,x2,x3,x4,x5}

There is a difference : Symbol will produce an error for incorrect varialbe names while ToExpression will do something meaningful.

In(3)  Table(Symbol(ToString(i)<>"x"), {i,1,5})
Out(3)  (* some error message with non-helpful output)

In(4)  Table(ToExpression(ToString(i)<>"x"), {i,1,5})
Out(4)  {x,2x,3x,4x,5x}

Other than this, I see there is no difference. Is there a situation such that Symbol is more useful than ToExpression ?

oracle11g – PLSQL : Return Concatenated string of all attributes of a Object

--Declare Object
create or replace TYPE INP_OBJ AS OBJECT 
(    attribute_1    VARCHAR2(20 CHAR)
    ,attribute_2    VARCHAR2(20 CHAR)
);

--Create Package
CREATE OR REPLACE PACKAGE TEST AS 
  PROCEDURE PROC1 (l_inp_obj  IN  INP_OBJ) ;
END TEST;

--Create Package Body
create or replace PACKAGE BODY TEST AS
    PROCEDURE PROC1 (l_inp_obj IN INP_OBJ) IS
    BEGIN    
        dbms_output.put_line(l_inp_obj.attribute_1 || ' ~ '|| l_inp_obj.attribute_2);

-- have to write every element individually here 
    END PROC1;
END TEST;


-- Calling Procedure 
DECLARE
  L_INP_OBJ CUSTOMER_ACCOUNT_DBO.INP_OBJ;
BEGIN
    L_INP_OBJ := (INP_OBJ('VALUE OF ATTR 1'
                         ,'VALUE OF ATTR 2'));
  TEST.PROC1(L_INP_OBJ => L_INP_OBJ);
END;

for display I had to write every attribute of input object individually. Is there a better way to return concatenated string of all values of Input Object ?

java – Given a 2d matrix with chars find the target string

I am looking for a simpler implementation of the following question.

Could it get better?

I am expecting the new solution via DFS again. Thanks.

OA: Given a 2d matrix with chars and a target string.

Check if the matrix contains this target string

by only going right or down each time from the beginning point.

public class CharsIncludesString {

        static char()() matrix = { {'a', 'b', 'c', 'd'},
                                   {'f', 'o', 'u', 'r'} ,
                                   {'r', 'r', 'p', 'c'} ,
                                   {'e', 'f', 'c', 'b'} ,
                                   {'e', 'f', 'c', 'b'}  };


    static int ROW = matrix.length;
    static int COLUMN = matrix(0).length;

    public static void main(String() args) {

        CharsIncludesString charsIncludesString = new CharsIncludesString();

        String str = "orscb";

        System.out.println( charsIncludesString.checkStr(matrix, str) );

    }

    private boolean checkStr(char()() matrix, String str) {

        for(int i=0;i<matrix.length;i++){
            for(int j=0;j<matrix(i).length;j++){
                if(matrix(i)(j) == str.toCharArray()(0)){
                    return dfs(matrix, i, j, str.substring(1));
                }
            }
        }
        return false;
    }

    static class Cell
    {
        public int row;
        public int column;

        public Cell(int row, int column)
        {
            this.row = row;
            this.column = column;
        }
    }

    private boolean dfs(char()() matrix, int row, int column, String str) {

        if(str.length() == 1)
            return true;

        char() charArray = str.toCharArray();
        Boolean()() visited = new Boolean(ROW)(COLUMN);

        // Initialize a stack of pairs and
        // push the starting cell into it
        Stack<Cell> stack = new Stack<>();
        stack.push(new Cell(row, column));

        while (!stack.empty())
        {
            Cell curr = stack.pop();

            row = curr.row;
            column = curr.column;

            System.out.print(matrix(row)(column) + " ");

            // Push all the adjacent cells
            char c = charArray(0);
            if(matrix(row+1)(column) == c)
                dfs(matrix, row +1, column, str.substring(1));
            else if( matrix(row)(column+1) == c){
                dfs(matrix, row, column+1 , str.substring(1));
            }else {
                return false;
            }
        }
        return true;
    }

}

combinatorics – Can I use the Hungarian algorithm to arrange n cards to form a given string?

Suppose you’re given a string s that consists of lowercase alphabetic letters only. The length of the sentence is n. You are given n cards, which has lowercase alphabetic letters on the front and back. You want to arrange (shuffle and/or flip each card) the n cards in the order that produces the sentence. You can use 1 of 2 sides of a card, but obviously not both.

I am wondering if this problem can be converted to a Hungarian Algorithm problem? We essentially have a bipartite here. The left graph consists of n nodes represent each character in s. For each character in s, there is a subset of the n cards that can can be used to create that character.

Can this be turned into a problem that can be solved with the Hungarian algo?