database design – Can I show a relation – "In this table or in this one" in the ER diagram?

I create a database for processing leave requests at a university institute. Since there is a hierarchy in such institutes and I have to keep track of the people who occupied these positions, for example, "Dean", I set up an "archived_cross_cutting_faculty" table in addition of "current_cross_cutting_faculty", where cross_cutting_faculty means "the type". is dean or something else besides being a faculty.
To have a list of retired professors, I have table_drawn_faculty in addition to the table of professors.

Now, the faculty listed in archived_cross_cutting may be a retired faculty, so perhaps in the retired_faculty table. Or maybe he's present at the professors table, ie he's currently a teacher but he's not a dean for the moment .

Can this relation be shown in the ER diagram? Which one in archived_cross_cutting_faculty is in either the faculty table or the retired_faculty table? How? 'Or' What?

Website Design – How to create a CTA for someone who has only a phone number and an address?

I'm creating a website for a mechanical engineer. All it has is a phone number and an email.

I guess a "Contact Us" button would be the most common. But I wonder if there is a better way?

Maybe have a form to fill out and send?

Any suggestion or pointer would be greatly appreciated!

Object Oriented – Implementing Elevator Design in C ++

I have written the C ++ code that performs the function of elevator, such as transporting people from one floor to another. It's a fun project and I've written to test my C ++ skills. Please review this code and suggest improvements. Also suggest some other features that I should add.

#include 
#include 
#include 
#include 

class Elevator
{
    enum Direction{ UP, DOWN };
    Direction direction;

    std::vector requests = {};
    int min_floor; //Undergroud floor will be shown using negative value
    int max_floor;
    int current_floor = 0; //ground floor
    std::size_t current_capacity = 0;
    std::size_t max_capacity;

 public:
    Elevator() = default;
    Elevator(int min_floor, int max_floor, std::size_t max_capacity) :
            min_floor(min_floor),
            max_floor(max_floor),
            max_capacity(max_capacity)
            {}
    ~Elevator() {};

    void start_elevator();

 private:
    void set_initial_request();
    void set_request();
    bool is_valid_request(int floor) const;
    void set_direction();

    int get_min_floor() const
    {
        return min_floor;
    }

    int get_max_floor() const
    {
        return max_floor;
    }

    int get_current_floor() const
    {
        return current_floor;
    }

    void set_current_floor(int floor)
    {
        current_floor = floor;
    }

    std::size_t get_max_capacity() const
    {
        return max_capacity;
    }

    std::size_t get_current_capacity() const
    {
        return current_capacity;
    }

    void set_current_capacity(std::size_t cap)
    {
        current_capacity = cap;
    }
 }; 

    void Elevator::set_initial_request() 
    {
        std::size_t num_of_reqs;
        int dest_floor;

        std::cout << "nEnter number of requests n";//<< get_current_floor() << "n";
        std::cin >> num_of_reqs;

        std::cout << "nEnter destination floor number.n";
        std::cin >> dest_floor;
        requests.emplace_back(dest_floor);
        set_current_capacity(1 + get_current_capacity());
        set_direction();

        for (std::size_t i = 1; i < num_of_reqs; ++i)
        {
            std::cin >> dest_floor;
            if (is_valid_request(dest_floor))
            {
                requests.emplace_back(dest_floor);
                set_current_capacity(1 + get_current_capacity());
            }

            if (get_current_capacity() == get_max_capacity())
            {
                std::cout << "No more entry. Elevator is full!!n";
                break;
            }
        }
    }

    void Elevator::set_request()
    {
        std::size_t num_of_reqs;
        int dest_floor;

        std::cout << "nEnter number of requests n";
        std::cin >> num_of_reqs;

        std::cout << "nEnter destination floor number.n";
        for (std::size_t i = 0; i < num_of_reqs; ++i)
        {
            std::cin >> dest_floor;
            if (is_valid_request(dest_floor))
            {
                requests.emplace_back(dest_floor);
                set_current_capacity(1 + get_current_capacity());
            }

            if (get_current_capacity() == get_max_capacity())
            {
                std::cout << "No more entry. Elevator is full!!n";
                break;
            }
        }
    }

    bool Elevator::is_valid_request(int floor) const
    {
        if (get_current_capacity() >= get_max_capacity())
        {
            std::cout << "Elevator is Full!!n";
            return false;
        }
        else if (direction == UP && floor < get_current_floor())
        {
            std::cout << "Elevator is going UP.n";
            return false;
        }
        else if (direction == DOWN && floor > get_current_floor())
        {
            std::cout << "Elevator is going DOWN.n";
            return false;
        }
        else if (floor > get_max_floor() || floor < get_min_floor())
        {
            std::cout << "This floor does not existn";
            return false;
        }
        else
        {
            return true;
        }
    }

    void Elevator::set_direction()
    {
        if (requests(0) > get_current_floor())
        {
            direction = UP;
        }
        else if (requests(0) < get_current_floor())
        {
            direction = DOWN;
        }
    }

    void Elevator::start_elevator()
    {
        int curr_floor = get_current_floor();
        std::size_t curr_capacity = get_current_capacity();

        std::cout << "nThe current floor is " << curr_floor << " and number of person in elevator are " << curr_capacity <<"n";

        //Entering requests for first time
        set_initial_request(); 
        std::sort(requests.begin(), requests.end());

        while (!requests.empty())
        {
            if (direction == UP)
            {
                set_current_floor(requests(0));
            }
            else if (direction == DOWN)
            {
                set_current_floor(requests(requests.size() - 1));
            }
            curr_floor = get_current_floor();
            curr_capacity = get_current_capacity();

            auto curr_floor_req = std::find(requests.begin(), requests.end(), get_current_floor());
            while (curr_floor_req != requests.end())
            {
                requests.erase(curr_floor_req); //removing current floor's requests
                curr_capacity--;
                curr_floor_req = std::find(requests.begin(), requests.end(), get_current_floor());
            }

            set_current_capacity(curr_capacity);

            std::string dir;
            if (direction == UP)
            {
                dir = "UP";
            }
            else
            {       
                dir = "DOWN";
            }

            //Entering requests for current floor
            std::cout << "n=======================================================n";
            std::cout << "The current floor is " << curr_floor << " and number of person in elevator are " << curr_capacity <<"n";
            std::cout << "nDirection of elevator is " << dir << " and Total capacity of the elevator is " << get_max_capacity() << "n";
            std::cout << "nMinimum floor number is " << get_min_floor() << " and Maximum floor number is " << get_max_floor() << "n";
            std::cout << "n=======================================================n";

            if (curr_floor == get_max_floor())
            {
                direction = DOWN;
            }
            else if (curr_floor == get_min_floor())
            {
                direction = UP;
            }

            if (current_capacity == 0) //Elevator is empty
            {
                set_initial_request();
                std::sort(requests.begin(), requests.end());
            }
            else
            {
                set_request();
                std::sort(requests.begin(), requests.end());
            }
        }
    }

int main()
{
    int min_floor_num, max_floor_num;
    std::size_t max_capacity;

    std::cout << "Enter minimum floor number, maximum floor number in the buildingn";
    std::cin >> min_floor_num >> max_floor_num;

    std::cout << "Enter maximum capacity for the elevatorn";
    std::cin >> max_capacity;

    Elevator elevator(min_floor_num, max_floor_num, max_capacity);
    elevator.start_elevator();  
}

When people enter an elevator on any floor, the user must know how many people are entering and the entrance is indicated. num_of_reqs. How to write code such as we do not need a variable num_of_reqs.

Delete / Change background of up to 2 images-professional work for $ 2

Delete / Change the background of up to 2 images-Professional work

I am a graphic designer who provides you with high quality photo retouching as well as removal of the background. I work up to total customer satisfaction! You will get a quality result in each one of them.

MY SERVICES:

  • Delete the background of the image
  • Transparent Photo Background / White / Custome.
  • Change the background color only
  • photo editing product
  • Resizing the image.
  • Ultra fast delivery in 3 hours
  • 100% satisfaction guarantee

What I need from you:
Do not hesitate to ask questions! Ready to receive the personalized offer. At any time for any need, I'm here for 24 hours.

* Satisfaction guaranteed at 100% or money back. *

Thank you

.

Camera Design – Neutral Density Filters (ND)?

Just a guess, but I do not think ND filters are as widely used as you suppose. A very large portion of the users of a specific camera will NEVER need an ND filter and therefore will not be interested in paying the extra cost associated with the inclusion of the filter in the camera .

To be logical, an integrated ND filter should also be variable, otherwise it would not be able to replace all potentially required densities. ND filters have many densities and fixed density filters are much easier to manufacture than variable density filters. Variable density filters are usually made by combining several polarizing filters. Their construction is delicate (their reading is expensive) and they may have optical disadvantages compared to fixed density filters.

Interaction Design – What is the best way to display multiple data points in a single line in a list view?

enter the description of the image here

Hey!
I'm designing a list that should contain multiple data points in a single line and in a single category, and I wonder if there are any UI models best suited to that need.

I've seen lists with lines with a long block of text (like a paragraph), but it still represents a discrete block of data, whereas what I'm designing will represent many different data points (for example, Protocol 1, Protocol 2, etc.)

The user must essentially identify quickly and efficiently the protocols associated with the corresponding rules. I've thought of an expanding array interaction, as well as a modal one, but both seem a lot like clicks.

Thoughts? Thanks for having a look, eager to hear your comments!

Design a native C ++ video buffer to display on an Android application and share with other modules in native mode and in Java

I am currently working on designing a video buffer in C ++ that will be used by many consumers, both in the native library space (C ++) and on the Java side at the same time. 39, JNI help. My idea is:

have a buffer manager that will receive the frames directly from the hardware and allocate each frame only once on the heap with the help of a shared pointer if it is at least aware of the ########################################################################## 39, a consumer for this frame. when a consumer wants to receive a video frame, he calls the link method and specifies the size of the desired buffer because not all of them process the data at the same rate. It is therefore best to have a dedicated buffer for each customer / consumer. after binding, the buffer manager returns a DataBufferStream object that will be used by the consumer to read / extract video images. the DataBufferStram class is nothing more than a circular buffer of a certain type and size. Using JNI im schedule to pass a pointer to the buffer or copy the data into an array of bytes

I would like to have some comments from people here to see if there is anything I can improve. Is there a better solution that you can recommend

    class BufferManager {

    public:
       std::shared_ptr> bind(const unsigned int bufferSize,const int 
       requestorID);
       void unbind(const int requestorID);
       std::shared_ptr getInstance();

    private:
       std::map>> mDataBufferMap;
       std::mutex mMutex;
    };

    std::shared_ptr> BufferManager::bind(const unsigned int 
    bufferSize,const int requestorID) {
    std::lock_guard lockGuard(mMutex);
    auto it = mDataBufferMap.find(requestorID);
    if(it == mDataBufferMap.end()){
        mDataBufferMap(requestorID) = std::make_shared>(bufferSize);
    }
     return mDataBufferMap(requestorID);
   }

   void BufferManager::unbind(const int requestorID) {
        std::lock_guard lock(mMutex);
        mDataBufferMap.erase(requestorID);
   }

`

    #include "../include/boost/circular_buffer.hpp"
    #include 
    #include 
    #include 
    #include 

    typedef boost::shared_array SHARED_ARRAY;

    template 
    class DataBufferStream {

    private:
        boost::circular_buffer mCircularBuffer;
        std::mutex mMutex;
        std::condition_variable mConditionalVariable;
        unsigned int mIndex;
    public:
        DataBufferStream(const unsigned int bufferSize);
        DataBufferStream(DataBufferStream& other);
        DataBufferStream() = delete;
        virtual ~DataBufferStream();
        void pushData(T data);
        T fetchData();
        T readData(unsigned int duration);
        T operator()(const unsigned int index);
        T operator*();
        void operator++();
        void operator--();
        DataBufferStream &operator=(DataBufferStream& other);
        void clear();
        unsigned int size();
     };

`
#include "DataBuffer.h"

template 
DataBufferStream::DataBufferStream(const unsigned int bufferSize):
mCircularBuffer(bufferSize),
mMutex(),
mConditionalVariable(),
mIndex(0)
{
}

template 
T DataBufferStream::fetchData() {
std::lock_guard lock (mMutex);
if(mCircularBuffer.size()>0) {
    auto ptr = mCircularBuffer.front();
    mCircularBuffer.pop_front();
    return ptr;
}
return nullptr;
}

  template 
  void DataBufferStream::pushData(T data) {
       std::lock_guard lock (mMutex);
       mCircularBuffer.push_back(data);
       mConditionalVariable.notify_all();
  }

    template
    T DataBufferStream::operator()(const unsigned int index) {
           std::lock_guard lock (mMutex);
           return mCircularBuffer.size()>index ? mCircularBuffer(index) : nullptr;
    }

  template
  DataBufferStream::~DataBufferStream() {

  }

  template
  T DataBufferStream::operator*() {
        std::lock_guard lock(mMutex);
        return mCircularBuffer.size() > mIndex ? mCircularBuffer(mIndex) : nullptr;
  }

   template
   void DataBufferStream::operator++() {
        std::lock_guard lock(mMutex);
        mIndex = mCircularBuffer.size() < mIndex+1 ? 0 : mIndex++;
   }

   template
   void DataBufferStream::operator--() {
        std::lock_guard lock(mMutex);
        mIndex = mIndex > 0 ? mIndex-- : 0;
   }

    template
    void DataBufferStream::clear() {
         std::lock_guard lock(mMutex);
         mCircularBuffer.clear();
         mIndex = mCircularBuffer.size();
    }

    template
    DataBufferStream::DataBufferStream(DataBufferStream &other):
         mMutex(),
         mConditionalVariable(){
         std::lock_guard lock(other.mMutex);
         this->mCircularBuffer = other.mCircularBuffer;
         this->mIndex = other.mIndex;
    }

    template
    DataBufferStream &DataBufferStream::operator=(DataBufferStream &other) {
          if(this!=&other){
                std::unique_lock myLock (mMutex,std::defer_lock);
                std::unique_lock otherLock(other.mMutex,std::defer_lock);
                std::lock(myLock,otherLock);
                mCircularBuffer = other.mCircularBuffer;
                mIndex = other.mIndex;
          }
        return *this;
     }

    template
    unsigned int DataBufferStream::size() {
           std::lock_guard lock(mMutex);
           return mCircularBuffer.size();
    }

    template
    T DataBufferStream::readData(unsigned int duration) {
        auto data = fetchData();
        std::unique_lock lock(mMutex);
        if((data == nullptr) && 
               (mConditionalVariable.wait_for(lock,std::chrono::milliseconds(duration)) == 
               std::cv_status::no_timeout)){
               if(mCircularBuffer.size()>0) {
                  auto data = mCircularBuffer.front();
                  mCircularBuffer.pop_front();
              }
        }
     return data;
    }

    template class DataBufferStream;

domain driven design – Get the right class at the base of an argument – Pattern

I have a little doubt about getting a class at the base of an object passed to a function.
In my case, I can have two different types of objects: classA, classB that have the same interface.
I have to pass one of these objects to a service and get its repository.
I thought of something like this:

classA implements MyInterface {
...
}
classB implements MyInterface {
...
}

class MyService () 
{
   private $strategy;

   public function __construct(Strategy $strategy)
   {
      $this->strategy = $strategy;
   }

   public function execute(MyInterface $object)
   {
      $repository = $this->strategy->getRepository($object);
   }
}

class Strategy
{
    private $repoA;
    provate $repoB;

    public function __construct(ClassARepository $repoA, ClassBRepository $repoB)
    {
        $this->repoA = $repoA;
        $this->repoB = $repoB;
    }

    public function getRepository(MyInterface $object)
    {
        if ($object::class === 'classA') {
           return $this->repoA;
        }

        if ($object::class === 'classB') {
           return $this->repoB;
        }

        throw new DomainException('Invalid Class');
    }
}

So I created a service that, with an if condition, decides which repository to render. Is it correct? Or is there a cleanest and correct code?
Thank you