wpdb – Retrieves all custom field values ​​of a specific category and stores them in an array

I want to retrieve all custom field values ​​from posts in a specific category and save them in an array. I'm trying to populate a drop-down list with all values, but I can only show the values ​​of all categories. This is wrong because I have posts from other categories and do not want to display all the values, only those that are relevant to the category. Here is my code:

Wi-Fi – Forcing Certain App Not to Use a Specific Wi-Fi Network?

The wireless guest at work blocks Facebook Messenger, but the app does not seem to be smart enough to detect it and try to use my mobile phone signal instead of Wi-Fi. So it is completely inoperable until I disconnect from the network.

Everything else works in this network. My cell phone signal is spotty, so I do not just want to use the guest's Wi-Fi, but only with Messenger.

Is there a way to prevent a particular app from trying to use a particular Wi-Fi network? Aside from that, is there any way to prevent an app from ever using Wi-Fi, where I could easily switch this when I'm at work?

I am using Android 10 on a Pixel 2 XL.

java – Encryption algorithm that encrypts and decrypts plain text and files from a specific directory

I have created an encryption and decryption algorithm that encrypts plain text using a particular encryption and decrypts it back to the original. That works perfect.

This was my code for a test and the examiner told me that the class structure is reversed as it is done right. In addition, it is sloppy in some places.

I want to know WHAT (or WHEN) about the structure of the classes is wrong. Does it look sloppy? Can someone help me identify any sites that lack Java coding best practices?

Can someone please read and tell me what's wrong with that and how I can improve the class structure?

I have a MyBuilder Class that creates an instance of MyAlgorithm,
MyAlgorithm has the methods to encrypt and decrypt text and adds another class called EncryptionAndDecryption where the actual logic of the algorithm is located.

Here is the code:

public class MyAlgorithm extends EncryptionAndDecryption {

    public enum Action {

    protected MyAlgorithm(final String cipherCharSet) {

    public String encryptText(final String cipher, final String plainText) {
        return encryptOrDecryptText(cipher, plainText, Action.ENCRYPT);

    public String decryptText(String cipher, String encryptedText) {
        return encryptOrDecryptText(cipher, encryptedText, Action.DECRYPT);

    public boolean encryptDirectory(String cipher, String baseDirectory) {
        Path root = Paths.get(baseDirectory);
        try {
            // Lazily traverse to all files from the given baseDirectory.
                    .forEach(file -> encryptOrDecryptFile(cipher, file, baseDirectory, Action.ENCRYPT));
            return true;
        } catch (IOException e) {
            System.err.println("The provided baseDirectory cannot be found or is not readable: <" + baseDirectory + ">");
            return false;

    public boolean decryptDirectory(String cipher, String baseDirectory) {
        Path source = Paths.get(baseDirectory);
        try {
                    .forEach(file -> encryptOrDecryptFile(cipher, file, baseDirectory, Action.DECRYPT));
            return true;
        } catch (IOException e) {
            System.err.println("The provided baseDirectory cannot be found or is not readable: <" + baseDirectory + ">");
            // e.printStackTrace();
            return false;

public class EncryptionAndDecryption {

    private final String CIPHER_CHAR_SET;
    private final String ENCRYPTED_DIR_SUFFIX = ".encrypted";
    private final String DECRYPTED_DIR_SUFFIX = ".decrypted";

    protected EncryptionAndDecryption(final String cipherCharSet) {
        this.CIPHER_CHAR_SET = cipherCharSet;

    protected final String encryptOrDecryptText(final String cipher, final String inputText, final MyAlgorithm.Action action) {

        final int cipherSize = cipher.length();
        final int inputSize = inputText.length();
        StringBuilder targetBuilder = new StringBuilder();

        int cipherIndex = 0;
        for (int i = 0; i < inputSize; i++) {

            final int cipherTextPos = getIndexForChar(inputText.charAt(i));

            if(cipherTextPos < 0) {


            } else {

                cipherIndex = cipherIndex == cipherSize ? 0 : cipherIndex;

                // current cipher character
                final char cipherChar = cipher.charAt(cipherIndex);
                // current rotated cipher set.
                final String ROTATED_CIPHER_SET = rotate(String.valueOf(cipherChar));

                if( action == MyAlgorithm.Action.ENCRYPT ) {
                } else {
                    int index = ROTATED_CIPHER_SET.indexOf(inputText.charAt(i));

        return targetBuilder.toString();

    protected final void encryptOrDecryptFile(final String cipher, final Path filePath, final String baseDirectory, final MyAlgorithm.Action action) {

        String sourceFilePath = filePath.toFile().getAbsolutePath();
        String pathAfterBaseDir = sourceFilePath.substring(baseDirectory.length()-1);
        String targetFileName = (action == MyAlgorithm.Action.ENCRYPT) ? baseDirectory + ENCRYPTED_DIR_SUFFIX + pathAfterBaseDir
                : baseDirectory + DECRYPTED_DIR_SUFFIX + pathAfterBaseDir;
        Path targetFile = Paths.get(targetFileName);

        try {
            // create target directory and target file.
        } catch (FileAlreadyExistsException e) {
        } catch (IOException e) {

        BufferedInputStream in = null;
        BufferedOutputStream out = null;
        try {

            in = new BufferedInputStream(new FileInputStream(sourceFilePath));
            out = new BufferedOutputStream(new FileOutputStream((targetFileName)));

            byte() bytes = new byte(4096*4096); // reading 16KB at once
            int dataLength;

            while ((dataLength = in.read(bytes)) != -1) {
                for (int i = 0; i < dataLength ; i++) { // writing character by character, to prevent writing extra bytes.
                    String character = String.valueOf((char)bytes(i));
                    out.write(encryptOrDecryptText(cipher, character, action).getBytes());
        } catch (IOException e) {
        } finally {
            if(in != null && out != null) {
                try {
                } catch (IOException e) {

    private String rotate(String onCharacter) {

        int beginIndex = CIPHER_CHAR_SET.indexOf(onCharacter);
        int endIndex = CIPHER_CHAR_SET.length();

        if(beginIndex == 0) {
            return CIPHER_CHAR_SET;
        } else {
            return CIPHER_CHAR_SET.substring(beginIndex, endIndex) + CIPHER_CHAR_SET.substring(0, beginIndex);

    private int getIndexForChar(char character) {
        try {
            return CIPHER_CHAR_SET.indexOf(character);
        } catch (StringIndexOutOfBoundsException e) {
            return character;

public class MyBuilder {

    private String CIPHER_CHAR_SET;

    private MyBuilder() {}

    public static MyBuilder builder() {
        return new MyBuilder();

    public MyBuilder withCipherSet(String cipherSet) {
        this.CIPHER_CHAR_SET = cipherSet;
        return this;

    public MyAlgorithm build() {
        return new MyAlgorithm(CIPHER_CHAR_SET);

public class MyEncryptionApp {

    public static final String CIPHER_CHAR_SET = "abcdefghijklmnopqrstuvwxyz";

    public static void main(String args()) {
        if (args.length != 3) {
            System.out.println("Exact 3 parameters required - (action) (key) (target)");

        String action, key, target;
        action = args(0);
        key = args(1);
        target = args(2);

        MyAlgorithm myAlgorithm = MyBuilder.builder()

        if ("encrypt".equalsIgnoreCase(action)) {
            System.out.println(myAlgorithm.encryptText(key, target));

        } else if ("decrypt".equalsIgnoreCase(action)) {
            System.out.println(myAlgorithm.decryptText(key, target));

        } else if ("encryptDir".equalsIgnoreCase(action)) {

            if(myAlgorithm.encryptDirectory(key, target)) {
                System.out.println("Directory encryption Successful");

        } else if ("decryptDir".equalsIgnoreCase(action)) {

            if(myAlgorithm.decryptDirectory(key, target)) {
                System.out.println("Directory decryption Successful");

        } else {
            System.out.println("action (" + action + ") not implemented");


mojave – always opens a specific folder in a specific view

I went to the folder / Users / username and right click the Desktop folder -> selected show view options -> ticked Always open in icon view, browse in icon view

Now I have the popup closed and manually changed the view of Desktop folder to list view and closed the folder and opened a new Finder window again. I expected the desktop folder to open in icon view, but it still opens in list view

what am I doing wrong here?

wordpress.org – There is no Facebook instant article error with a specific style name

In instant articles, there is the error "Undefined style: One of your articles uses the non-existent style" nepaljapan. "For more information about creating and setting a style, see the Design Guide in the Instant Articles documentation." we have nepaljapan style and in the instant article for the wp plugin setting page we also put this name in the field of style, but there is also the above error

Unit – How to ensure that at least one item in a collection has a specific value?

Just use a Boolean value to see if you've ever assigned a value of up. If not, enter a value of "up" anywhere in your collection.

private void AssignRandomDirection()
    // No need for this to be a list, since you never add/remove elements.
    var directions = new Vector2()

    boolHasAssignedUp = false;

    var agents =  FindObjectsOfType();

    foreach (var agent in agents)
        var random = Random.Range(0, directions.Length);
        hasAssignedUp |= (random == 0);
        agent.direction = directions(random);

    if(hasAssignedUp == false)
        agents(Random.Range(0, agents.Length)).direction = directions(0);

Google Sheets: Sum up data in a pivot table, but exclude certain data if it's a specific value in a particular column

I have some data in a Google Drive table where I want to run a pivot table. There are 3 columns Element, Cost, Omit as in the screenshot below

Screenshot of the table columns

I want to group the cost by elements, but exclude all rows with the value "omit" in the "omit" column.

I've started to set up the pivot table to group costs by cost, which works well, but I can not figure out how to exclude the "omitted" elements in the pivot table summary.

To help, I have created a common Google spreadsheet here File > make a copy if you want to use it. Link to the Google Drive table: https://docs.google.com/spreadsheets/d/1gvsg8shqWJnK_zRxQUFcWDwJxE1ym6lSE35fSAqpx8s/edit#gid=0