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);

object oriented – Using friend functions to decouple / ensure encapsolation

For my project I have a configuration class which will hold all of the global configurations for the project. This class if subject to change constantly (adding more config parameters) and I did not want to expose all of its variable variables. Since the variable classes are different from each other, the functions are different from each other. I would like to look at the latter.

// configuration.h

class A;
class B;

class Configuration {
    static const int a_config_x;
    static const int a_config_y;
    static const int a_config_z;
    static const int b_config_x;
    static const int b_config_y;
    static const int b_config_z;
    friend void load(Configuration&, A&);
    friend void load(Configuration&, B&);
    static Configuration& get_instance() {
        static Configuration inst;
        return inst;

// configuration.cpp
#include "configuration.h"
const int Configuration::a_config_x = 0;
const int Configuration::a_config_y = 1;
const int Configuration::a_config_z = 2;
const int Configuration::b_config_x = 3;
const int Configuration::b_config_y = 4;
const int Configuration::b_config_z = 5;

What you take in a configuration class and for each type that wishes to have its data members set

// load_function.h
class A;
class B;
class Configuration;
void load(A& a);
void load(B& b);
void load(Configuration& c, A& a);
void load(Configuration& c, B& b);


// load_function.cpp
#include "load_functions.h"
#include "configuration.h"
#include "class_a_b.h"

void load(A& a) {
    load(Configuration::get_instance(), a);

void load(B& b) {
    load(Configuration::get_instance(), b);

void load(Configuration& c, A& a) {
    a.x = c.a_config_x;
    a.y = c.a_config_y;
    a.z = c.a_config_z;

void load(Configuration& c, B& b) {
    b.x = c.b_config_x;
    b.y = c.b_config_y;
    b.z = c.b_config_z;

Essentially I did not want to attend classes A and B with having to know how to interact with the configuration class and vice versa. I am hoping to get some constructive criticism about these design choices.
What are the best approaches to something like this? Is this applicable case to use friend functions? Should I simply move the implementation into class A, B … ect?

Google Sheets – How can I ensure that an equation does not answer if more than one cell is empty?

So I have half the equation –


So it looks like this:

What I want to do is just ask for an increase or decrease in the answer if both 90 and 180 days contain text. There is currently a drop when 90 days are filled, but 180 are not. There should be no answer unless 90 and 180 are BOTH filled out. So, how can I nest another Isnotblank in it? Because it already prevents it from responding if the line is empty for 90 days, but not EVEN for 180. Does that make sense?

Here's a picture:

Enter image description here

Help please!

Defense – Ensure that all network services on a device use strong TLS cipher suites

(This is hypothetical, but based on a real problem I had)


I'm developing an (embedded) device that contains some exposed network services. I am responsible for security and do not develop these services. Therefore, I do not know how they are structured.

I'm doing some testing (sending targeted client hello messages to the device services with certain cipher suites) and find that some of these services are accepting weak TLS ciphersuites.


I now have the job of fixing this issue, preferably by fixing the problem back in the stack as much as possible (for example, I would prefer not having to look at the code / configuration of each application and would like it instead at the fix system level).


  1. I know that OpenSSL is the only crypto library / crypto program used on the system.

Now some questions:

  1. What options do I have to prevent network services from allowing weak TLS encryptions? (eg, change OpenSSL itself, change OpenSSL configuration files, change operating system configuration, etc.)

  2. Which options are reasonably "safe"? e.g. I assume I could change the OpenSSL code and remove, recompile, and integrate any mention of these cipher suites. This would prevent applications from sending the suites (even if they ask for it). However, this seems to be a dangerous solution and difficult to sustain in the long term.

  3. Is that even possible or do I have to look at every service?

What is the best way to ensure that a mistake like Trump never recurs?

Maybe you are promoting values ​​rather than party political skills, leaving only two bad choices …

If you spend more than a decade happily dealing with hatred, division, and discord, painting like John McCain and Mitt Romney as old racists only moderates for the rich in the environment you've helped shape?

amazon web services – To ensure that the application is installed on a particular ec2 instance each time a new instance is created

If you provide a Spot ec2 instance, it can be stopped at any time and a new instance can be created. How can I ensure that the new instance contains all the configuration and application I have installed? Do I need to use other aws services to ensure this?

Data – How to ensure that the services are used by a customer

In this case, the date of origin of the records from the database can be a hint
The newer the entry, the higher the probability that it is current. There may also be an entry indicating the frequency of use of the services, or whether they have generally been used by someone.

Often, people sign up without being consumers at the same time. It is worthwhile to determine the value of this factor

Sending e-mails can also be a possibility in addition to offering premium payments

You have thought about qualitative research?

You will get an initial insight and an analysis of the topics, which you can then confirm quantitatively

postgresql – Ensure uniqueness of values ​​in bigint arrays created after merging two bigint arrays

What is the most efficient way to get the uniqueness of the values ​​in bigint Array created by merging 2 others bigint Arrays?
For example, this operation select ARRAY[1,2] || ARRAY[2, 3] should give as a result 1,2,3, I checked the extension intarray and see, it does not work with bigint,