how to design button three when in the same page?

An app can display multiple buttons in a layout at the same time, so a high-emphasis button can be accompanied by medium- and low-emphasis buttons that perform less important actions. When using multiple buttons, ensure that the available status of one button does not correspond to the deactivated status of another.

To answer your question, I would say:

Enter image description here

refactoring – Refactor of the method that has the order of the similar looking blocks of code towards (or towards) the design pattern (the design pattern).

I need some help to understand whether the following code can be revised to something less complicated, less repetitive and more in the direction of a suitable pattern.

What I find uncomfortable in the code is the flow of repetitive tasks with the same pattern as:

// Get the result from some operation (API call / or any other operation);
// Check if the result is somehow valid;
// If it is not valid, set the response object accordingly and return early;
// If it is valid, continue with the next step with the overall same logic but different details.

Does the code seem to be able to be revised into (or towards) a design pattern that can be used here?

I would be pleased to receive feedback.

Here is the code:

 * Check if the given email exists in the SendGrid recipients global list
 * and its custom field 'status' has the value 'subscribed'.
 * @param  string  $email The email to check.
 * @return object  (object)('isfound'=>false, 'issubscribed'=>false);
public function getSubscriberStatus(string $email): object
    $result = (object) ('isfound' => null, 'issubscribed' => null);

     * Find the email in the SendGrid global list.
    $endpoint = "contactdb/recipients/search?email=$email";
    $found = $this->callSendGrid('GET', $endpoint);
    if ($found->status !== 200) {
        Log::error(sprintf('(SENDGRID) Error while searching the email: %s in the SendGrid list, status: %s, message: %s', $email, $found->status, $found->message));
        $result->isfound = false;
        $result->issubscribed = false;
        return $result;

    if (!($found->data->recipient_count > 0)) {
        $result->isfound = false;
        $result->issubscribed = false;
        return $result;

     * Find the recipient with email exactly matching the required one.
    $recipient = collect($found->data->recipients)->first(function ($item) use ($email) {
        return $item->email === $email;

     * No exactly matching emails.
    if (!$recipient) {
        $result->isfound = false;
        $result->issubscribed = false;
        return $result;

    $result->isfound = true;

     * Get the status field of the recipient's 'custom_fields' array.
    $status = collect($recipient->custom_fields)->first(function ($item) {
        return $item->name === 'status';

    if ($status->value !== 'subscribed') {
        $result->issubscribed = false;
        return $result;

    $result->issubscribed = true;
    return $result;

Domain driven design – event sourcing and synchronization between writing and reading models

I am creating this project based on event sourcing and CQRS.
My read and write model is on different databases (and computers) and is connected via an event bus (in particular I use MassTransit with rabbitmq for the transport).

When an event is generated, it is stored in my write model and published in the queue in which the read model receives it and updates the database accordingly

What I am still not quite clear about is how I can keep the two models in sync in the event of errors or problems

For example, the database on the read side may fail or the message queue itself may fail and the write side may no longer be able to publish events

My first approach is that since each aggregate (I use DDD) has a version number, I can use it to keep track of how many events I have processed per aggregate instance.

For example, if on the reading page my object with ID 8734 has version number 4 and a new event arrives for this object, but the metadata says that we are now in version 6, it is determined when reading that an event has been missed and this can use the message queue to ask for the missing
(This method actually solves the problem of processing events in order)

The disadvantage is that the system does not recognize that one event has NOT been processed until the next one arrives.
(If event 6 is not generated for object 8734, I will never notice that event 5 is missing.)

A second option is: I can create a background processor that "queries" the database and asks for new events. However, this prevents the idea of ​​pub / sub-messaging and forces the reader model to process events one after the other, even if they are different events aggreagates where parallel processing would be allowed (and delayed the possible consistency)

Finally, from the read side, I was able to ensure that I would continue to post an event until I received confirmation that the read model (or all read models) processed it correctly, but this shifted responsibility on the write side of the application and does so i don't know if it is a good strategy or if it will bite me back later

How do I deal with these situations?

Website design – content overflowing in the text area – standard scroll bar or dynamic increase in height?

It depends on what kind of data you expect.

Extending fields is ideal for compact forms where the user may not always need multiple lines, but you want to provide the option of long entries. They are generally used for message entry in chat user interfaces, where comments usually consist of short, one-line instructions, but can also consist of entire paragraphs if required.

Text areas, on the other hand, are better used if the required input is usually longer. The additional space indicates to the user that he can provide more information and prompts for longer answers. Scrollable text areas are more familiar to web users and should therefore be preferred, unless you want to save space in your design or to prevent long entries without character restrictions.

Use aspect ratios for responsive design breakpoints

It seems very problematic to me. Adjusting the width of a device is much more useful than adjusting it for the aspect ratio. In most cases, you don't want the same layout on a 4-inch (diagonal) device as on a 10-inch device, even if they have the same aspect ratio.

Another problematic problem is that it is too difficult to control vertical size when dealing with text on the web. It's easy to specify latitude metrics like 40em, but you have very little control over the height of a block of text because you don't know what the font size is (unless you force a certain font size, which is very bad practice – You shouldn't allow sighted people like me to use the preferred font size set in the browser settings, just the nature of horizontal text: you can specify the width but not the height.

But don't let experiment stop you. As Benny said, "Explore, experiment, implement, and test."

mysql – Doubts about database design (newbie)

There is no "better" between these two designs. They are just different. So it depends on what you want to save in your database. If each field you save belongs to only one object, the first design is a better choice. However, if you want to save fields and objects that can each refer to another, the second design is better. Let me give you two short examples.

If the object is a city with the following name and postcode:

ID          NAME    
90201       Bell
90202       Bell Gardens

And objects are people and where they live:

1   90201       Name_Person_1
2   90201       Name_Person_2
3   90202       Name_Person_3

You could save where everyone lives without the redundant name information in the second table. However, each row in the field table must correspond to exactly one entry in the object table.

The second design is to be used when there is a relationship between an object and a field and a field can belong to several objects and an object to several fields. This can be the case for a relation used for classes. A student can be enrolled in many classes and there are many students in each class. So your object table would be student and your field table would be class. Then you would save the relationship between the two in the ObjectField table.

ID          NAME    
123         Joe
124         Jill

ID          NAME    
1           Math
2           History

Student_ID  Class_ID
1           1
2           1
1           2

In the student class table, redundant information is stored in the field table in your first draft. On the other hand, the second design would require more space due to a third table, which is not necessary in the example of the postal code. So it really matters.

One last thing. In your first draft, it is sufficient if only ID is a primary key in the field table. A combined primary key from ID and OBJECT_ID is not required.

Is there a design pattern for dropdown lists in iOS?

Although Apple recommended pickers for dropdowns (and surprisingly still recommends), they don't even use them anymore. Spoiler:

Enter image description here

Enter image description here

In both cases, the "logic" would dictate the use of a dropdown + picker. Apple has chosen a much better solution for its own apps.

Nevertheless, an entire screen on which you can choose between "Female" and "Male" (forgive the binary example) seems exaggerated. Personally, I think the best option is to design a drop-down element that opens an action sheet when you type:

Enter image description here

The reason for this is that an action sheet is better than an order picker because:

1) Action sheets do not require scrolling to read and / or select options that are not highlighted.

2) Action sheets darken the background and ensure clarity affordability that clicking outside of the action sheet does not activate other items (while a picker is unsure of where to type to close the picker without accidentally tapping anything else);

3) Action sheets have "Cancel" buttons;

4) Action sheets are 44 points high, have borders between the buttons and can list more options with more space on the screen.

Action sheets are also better than the full-screen mode listed earlier, as they don't guide the user to another screen, making the flow more fluid. and They are better than a tailor-made alternative because they are native and therefore "future-proof". Brad Frost would probably correct me and say that they are actually "future-friendly".

By the way, Luke Wroblewski wrote an excellent article on why dropdowns should be the last resort user interface, and these 4 great videos detail when and why one element works better than the other (and with research to back it up):

• Luke Wroblewski Part 1 – Conversions @ Google 2014

• Luke Wroblewski Part 2 – Conversions @ Google 2014

• Luke Wroblewski – Basics of Mobile Design Part 1 – Conversions @ Google 2015

• Luke Wroblewski – Basics of Mobile Design Part 2 – Conversions @ Google 2015

Put on your headphones and dive in. The videos are worth it.

API Design – Rest API is a better alternative to getting long-running asynchronous tasks

I created a flask restplus API that accepts the xlsx file as input and returns an XML file. This would be consumed internally by our various APIs

The current flow:

  1. Users POSITION an XLSX file by calling / uploading the endpoint.

  2. API accepts the file, saves it, and returns a file ID.

  3. The user sends another request to / run by providing the file ID for processing

  4. API places the request in the rabbitMQ queue and returns 202 with a location URL to query the status.

  5. Celery worker accepts the request and begins processing. It takes a while for the process to complete.

  6. In the meantime, the user can query the status

  7. Once the process is complete, API 303 sends a URL to another location to download the file.

  8. The user presses the new URL to download the file.

However, our team of architects is not in favor of giving the client a query mechanism and asking us to choose a different approach. It may be a callback URL.
You have a say: "It is not good programming practice to wait with sleep to see if the task is complete."

I would like to know if there is another approach for the customer without querying the status. Callback is the one I know, but it doesn't exist yet.

design – is it convenient to pass function pointers to a separate class to avoid additional includes?

In my program I added the header for an external library (GLFW) to my main class. Anything I need to use this library for can be handled in my main class, except for two sneaky little methods that I need in a separate class.

#include "graphics/Display.hpp"

int main()
    glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);

    GLFWwindow* window = glfwCreateWindow(800, 600, "Adventum", nullptr, nullptr);

    uint32_t extCount;
    const char** extensions = glfwGetRequiredInstanceExtensions(&extCount);

    Display* display;

    auto terminate = (&)(){glfwSetWindowShouldClose(window, true);};
    auto surfaceCreation = (&)(VkSurfaceKHR* surface){return (glfwCreateWindowSurface(display->instance, window, nullptr, surface));};

    display->create(extensions, extCount);

    while (!glfwWindowShouldClose(window))



This is my main Function. The two functions that I need are glfwSetWindowShouldClose and glfwCreateWindowSurface both of which require a reference to variables in main and would be an additional hurdle if the header were included in both classes. As you can see, I solved this problem by creating two Lambda functions (terminate and surfaceCreation) that contain the external function call.

My question is, is this a thorn in the side of experienced developers? Is it rough and unnecessary work? (I'm trying to figure out how to ask that without being "opinion-based.")