views – how to display multiple values ​​of the reference entity

I have the content "a" that uses the reference of the user
so a user basically has more of a "one" content
Now I have the view that shows the user and adds the relation of the field used in the content "a".

so I add a field to display the title of the content "a" that has a link with the user

I can show it, but if a user has more "a" content, it creates a new line instead of the same line, so I have a duplicate / redundant user line and I do not Do not want it.

How can I get there?

c # – How to avoid many objects in constructors when multiple classes are performed by a class

I have a process that must do 8 steps, in a particular order. One of the steps is to send an email, another on a remote FTP server, another querying a database, and so on.
Now, to be able to test these 8 steps individually, each one is a method in a separate class. Until here everything is fine.

Now the problem I'm having is that the mother class & # 39; who calls the steps now gets in his 8 classes builder, which is clearly a code smell here. You could tell me: hey, just create a class with the first 4 steps and another with the other 4. The parent will simply receive two classes in his constructor. In my mind, this also seems to me wrong: I have the impression of adding complexity and not really solving the problem.

Is there a design template or other technique to use when multiple classes need to be called by a class?

php – How can I add capabilities to multiple roles?

I have this variable:

$wpll_accesslist = self::$options('wpll_settings')('wpll_accesslist');

and his output is:

Array
(
    (Author) => 1
    (Contributor) => 1
    (Shop_Manager) => 1
    (Customer) => 1
)

These Author, Collaborator, Shop_Manager, Customer are roles. Now, I want to add a new feature called wpll_caps to these roles.

What I do for that:

foreach($wpll_accesslist as $key => $value) {
    // get the the role object
    $role_object = get_role( strtolower($key) );
    // add wpll_caps capability to this role object
    $role_object->add_cap( 'wpll_caps' );
}

but it does not work. Am I missing something?

webforms – Structure of Post / Sample Method for Multiple / Unlimited Items such as Custom Composite

I'm using the Drupal8 REST web form for my current project. There is an example for the post method, but there is no explanation or sample code for how we can publish multiple / unlimited fields, as if we were using a custom composite.

I have tried many ways but it keeps giving me this error.

{"error":{"multiple_sector][items][0][date":"Date field is required.","multiple_sector][items][0][from":"From field is required.","multiple_sector][items][0][to":"To field is required.","multiple_sector][items][0][no_of_passengers":"Number of Passengers field is required."

My JSON

name: "Name User",
email: "email@gmail.com",
phone: "0006757431",
multiple_sector: [
      {
        date: "11/07/2019",
        from: "city",
        to: "city",
        no_of_passengers: 2,
      },
      {
        date: "11/07/2019",
        from: "city",
        to: "city",
        no_of_passengers: 1,
      }
    ]

php – Why, when I explode to turn a string into an array, it splits into multiple arrays and not one?

$horas = $arrayDatas(1).' às '.$arrayDatas(3)."https://pt.stackoverflow.com/";
				
$nova = explode("https://pt.stackoverflow.com/",$novo);

print_r($nova);


//saida: Array ( (0) => 14:00:00 às 14:59:59 ) Array ( (0) => 14:00:00 às 14:59:59 ) Array ( (0) => 14:00:00 às 14:59:59 ) Array ( (0) => 14:00:00 às 14:59:59 ) Array ( (0) => 14:00:00 às 14:59:59 ) Array ( (0) => 14:00:00 às 14:59:59 ) Array ( (0) => 14:00:00 às 14:59:59 ) Array ( (0) => 14:00:00 às 14:59:59 ) Array ( (0) => 14:00:00 às 14:59:59 ) Array ( (0) => 14:00:00 às 14:59:59 )

How to define multiple terms as the default value in the development node

I use the module >>> https://www.drupal.org/project/devel to generate content (nodes) as a test and in the CType, I have a vocabulary with some terms but when I generate them. 1000 nodes, are assigned only to the first term. Is it possible or is there a possibility to assign all these terms randomly to these nodes or to define a default term? Any solution?

Best regards

How to define multiple terms as the default value in node / add?

I use the module >>> https://www.drupal.org/project/devel to generate content (nodes) as a test and in the CType, I have a vocabulary with some terms but when I generate them. 1000 nodes, are assigned only to the first term. Is it possible or is there a possibility to assign all these terms randomly to these nodes or to define a default term? Any solution?

Best regards

forms – Where to place the send button in a long screen with multiple entries

I redid a web configuration interface for a hardware element. Think of a configuration interface of a standard router. You install this hardware on your network and access the configuration via your browser. The user interface is normally accessible from a PC and should also be available for mobile devices, but the computer is our focus.

I need to implement a configuration form with a submit button. The old design was done in hardware design and had this layout:
enter the description of the image here

Form1, Form2 are slightly different configuration forms, which have a similar subject (currently active SubMenu1). Think about "IP Address", "Router Name", "DHCP Configuration" etc. it was a router. All have the same Submit button in the upper right corner that applies only the modified entries. For example, if there is an entry for a password, this one will only be applied if it has been changed; otherwise, the old password will remain even if the password has been changed. entrance was empty. The send button, although located on a menu bar, is floating (when the menu bar is not there) and always stays on the screen exactly in the same place when you scroll .

I redo a user interface in the same way, preserving the appearance more or less, but changing the forms to group them into cards:

enter the description of the image here

But I hesitate to use the same location for the Submit button because I think it poses serious problems from the point of view of UI / UX.

  1. The location is extremely strange and unintuitive. The button is located in the menu that is common to all views and appears / disappears simply depending on the view. Users do not expect it to be there
  2. The button, although located in the menu, is not associated and floats when the menu is not.
  3. It is not obvious that if you do not change the password and leave it blank, the password is not changed. My first thought is that it sends a blank password to the system. However, I'm not 100% sure that it's a problem, just find it weird.

The problem is that I do not know where to put the submit button here. My first hypothesis is to float it and place it in the lower right corner. I do not know how to solve the password problem though.

Is this a good suggestion? If not, what should I do? And is it a good idea to leave the password box as it is, or should it be changed?

dnd 5th – Can the Resilient Sphere Contain Multiple Creatures?

As a DM, I want to know if more than one creature can fit inside The resilient sphere of Otiluke, Rules as written.

Here is the scenario:

A group of four medium-sized creatures walks through the old sewers of a city. Suddenly, the sound of gallons of water gushing sounds in the tunnel. The part has only a few moments to react before the room overflows with water. Reflecting quickly, the group meets and the assistant launches Resilient Sphere on them to protect them from the water.

Rules as written, it would not work. The spell indicates that:

"The sphere is weightless and just big enough to hold the creature or object within. "

This quote, as well as the continued use of a singular rather than plural language, strongly imply that it is only intended to affect one creature at a time.

Using the rule of freshness, I allow it, as the description of the spell says:

"A sphere of shimmering force (which) contains a creature or object of large size or smaller in range".

This means that if the four medium-sized creatures have entered a large box and have been thrown. Resilient Sphere on the box, it would have worked. This is because even if the creatures are in the box, the spell is cast on the box, not on the creatures. (This is a strange technique but it's completely in the rules, so I allow this to be done without the box.)

It would seem silly to refuse that the contents of a container be affected by the spell when the container itself is affected. This sets a precedent: if you cast the spell on a chest, all its contents would fall, the spell being able to contain only one object, the chest. Throwing it on a bottle would make the liquid flow, because you only cast the spell on the container. Casting the spell on a cage could release a creature within it, because the spell was cast on the cage and not on the creature.

So, in this spirit, can multiple creatures be contained in Resilient Sphere in the rules?


Here are some rhetorical questions that can fuel reflection:

If the spell were cast on a swarm, what would happen? Would all the medium swarms be affected or would only one small beast of this swarm be affected?

What if the spell was cast just as a creature entered another creature's space? Or when a creature struggled or mounted another creature?

If the spell was cast on an ocher jelly that cracked while she was inside the Resilient Spherewould the spell end because it can only contain a singular creature?

Could the spell be cast on a large box in which a huge creature is stuck inside, because creatures can sneak into a space of a size smaller than them? Or would the spell fail because it can only affect creatures or objects of large or smaller size?

Disclaimer for potential VTC users. These rhetorical questions are not part of my question and do not need an answer. They are simply intended to ensure that potential respondents consider multiple possibilities before giving their response. These do not make my question broader because I do not try to answer it, so any answer that focuses solely on the answers to these rhetorical questions should be flagged as "not an answer".

mysql – How to get First in and Last with multiple records?

I have these records and that is the presence of every employee. I would like to have their presence, what I tried, it is Query who gets their presence, but if she has multiple recordings, she will have the last participation.
Verify_States means 0 = Time in and 1 = Time out

That's the query I've tried:

select * from 
(select A.*, 

LEAD(A.Verify_State,1) OVER (PARTITION BY A.user_id 
ORDER BY A.user_id, A.verify_date) as Nxt_row_State, 

LEAD(A.verify_date,1) OVER (PARTITION BY A.user_id 
ORDER BY A.user_id, A.verify_date) as TO_Date 
from tbl_excel_attendance as A ) as tbl_DTR_Mapped 
where tbl_DTR_Mapped.verify_state = 0 and tbl_DTR_Mapped.Nxt_row_State = 1

EDIT: I've also tried this query

    Select * from (
SELECT DISTINCT
       user_id,
       verify_state,
       DATE(verify_date) the_date,
       MIN(verify_date) OVER (PARTITION BY user_id, DATE(verify_date)) min_datetime,
       LEAD(Verify_State,1) OVER (PARTITION BY user_id 
ORDER BY user_id, verify_date) as Nxt_row_State, 
       MAX(verify_date) OVER (PARTITION BY user_id, DATE(verify_date)) max_datetime
FROM tbl_excel_attendance) as q
where q.verify_state = 0 and q.nxt_row_state = 1
ORDER BY q.user_id, q.the_date;

Example of SQL violin

Desired output:

id  user_id      verify_date    verify_state  Nxt_row_State    TO_Date
6      16    2019-11-06 07:00:00    0            1       2019-11-06 19:45:00
3      16    2019-11-07 07:35:00    0            1       2019-11-07 18:05:00
13     19    2019-11-05 06:57:00    0            1       2019-11-05 18:28:00
10     19    2019-11-07 06:42:00    0            1       2019-11-07 18:04:00
20     40    2019-11-06 20:39:00    0            1       2019-11-07 06:39:00

Which verify_date has arrived and TO_Date has expired