Replace element within a list of lists with MemberQ condition

I’m trying to replace the second element within a list of ordered pairs depending on whether that ordered pair exists within another set.

shortlist = Flatten[Table[{i, j}, {i, 0, 3}, {j, 1, 2}], 1] sublist = {{0, 2}, {1, 1}, {2, 1}} 

I want to do something like this

shortlist //. x_ /; !MemberQ[sublist, x] -> {x[[1]], 0} 

where the result is

{{0,0},{0,2},{1,1},{1,0},{2,1},{3,0},{3,0}} 

where the ‘x’ components of the list remained the same, but those that were not members of the sublist had their ‘y’ components changed to zero.

Elementor + W3C Validator: “Attribute alt not allowed on element div at this point” for all photo gallery items [closed]

I am trying to validate my Elementor-built website using W3C Validator (https://validator.w3.org/nu) but when it comes for a page containing a photo gallery (Elementor Gallery Pro widget), I get the error:

Error: Attribute alt not allowed on element div at this point.

Obviously, Elementor applies the alt attribute to the div containing the image rather than the image itself, so this error is produced.

Any ideas how to fix it?

Thanks in advance!

How do you ‘do something’ to every element in a list except that one index? (C# Beginners Level Question) [closed]

I created a list of 40 buttons, each of these buttons have an ‘int counter’ that counts up incrementally to 5 whenever pressed.

If I hit button 1, the other button’s counter will reset and become 0, but the button I hit can now increase to 2, 3, 4, 5.

How would you loop the list in a way that doesn’t also reset the button being pressed?

Button itself is a class, and I have a ButtonManager that contains List< Button > Buttons

Circular draggable UI element in Unity canvas

I am trying to implement my own runtime color picker that’s easy to use for touch interfaces. I want the hue slider to be a ring, along these lines, except the whole ring texture would rotate when dragged.

I have scavenged enough code to get a raw image object rotating when dragged in a UI canvas in the manner I’m looking for:

    private float baseAngle;     private Vector2 pos;          public void OnBeginDrag(PointerEventData eventData)     {         pos = transform.position;         pos = eventData.pressPosition - pos;         baseAngle = Mathf.Atan2(pos.y, pos.x) * Mathf.Rad2Deg;         baseAngle -= Mathf.Atan2(transform.right.y, transform.right.x) * Mathf.Rad2Deg;     }      public void OnDrag(PointerEventData eventData)     {         pos = transform.position;         pos = eventData.position - pos;         float ang = Mathf.Atan2(pos.y, pos.x) * Mathf.Rad2Deg - baseAngle;         transform.rotation = Quaternion.AngleAxis(ang, Vector3.forward);     } 

Since it doesn’t use colliders, how can I limit the draggable region to a circle within the square bounds of the texture? Even better, also limit it to a ring rather than a whole circle. Will I have to implement my own check based on some pure math or is there a built in way?

thanks!

add another html tag after li element in wp_nav_menu

I have a nav menu in footer. I just want to display it side by a <p> tag, I mean something like this

<ul> <li> <p>copyright C 2021</p> </li> <li> contact </li> <li> blog </li> </ul> 

this is my menu function

if ( function_exists( 'register_nav_menus' ) ) {     register_nav_menus(         array(           'top_nav_menu' => 'My Footer Menu'         )     ); 

and I’m calling it in footer

<?php if ( has_nav_menu( 'top_nav_menu' ) ) { ?>             <?php wp_nav_menu( array(                 'menu' => 'Footer Navigation Menu',                  'theme_location' => 'top_nav_menu',                  'menu_class' => 'footer-links'                 ));              ?>             <?php } else {?>             <ul class="sf-menu">                 <?php wp_list_pages( array('title_li' => '','sort_column' => 'menu_order')); ?>             </ul>             <?php } ?> 

How can I insert an extra <li> element just before its first <li> and add a <p> tag between that later added <li> element?

What element would Genasi children of mixed element parentage have?

Two of the players in my campaign are Genasi, who are expecting a child. I’m doing research into Genasi’s for this new side plot. Although I’m not sure what element(s) they would have.

One parent is a water genasi, while the other is an air genasi. So would the child have both air and water, only one, or some combination of both?

I’ve researched but I haven’t been able to find a solid answer, most I’m getting is linked back to para and quasi-genasi, but that doesn’t answer the question either.

Any information would be useful and very helpful.

I’m running a 5th Edition campaign, that uses older lore as well as current lore.

insert an HTML element if there is a submenu only

I am trying to insert an HTML element "an arrow or a checkbox" to make use of the "checkbox technique" so I can use it to expand the submenu "only if submenu is there" when checked. my question is: how to insert this HTML element if there is a "sub-menu" class only or only when the list < li> has a class "menu-item-has-children" then insert this HTML element.

I have tried to hook on 2 filters: nav_menu_css_class and wp_nav_menu_items but didn’t succeed.

I have also tried to add this element when calling the menu:

wp_nav_menu(array(  'theme_location' => 'main-menu',  'depth'          => 0,  'menu_class'     => 'topNav-List',  'menu_id'        => 'topNL',  'after'          => ' <label for="dropDown" class="btn-dropdown"></label>                        <input class="dropdown-open" type="checkbox" id="dropDown"/>                        <label for="dropDown" class="dropdown-overlay"></label>' )); 

but it will add this checkbox to all list items, which I don’t want at all.

Difference between shader input element classification between D3D12 and Vulkan

I’m confused about the difference between the shader input element classifications in D3D12 and Vulkan. For example, in Vulkan I could have the following declarations:

struct vertex {     glm::vec3 pos;     glm::vec3 col; };  VkVertexInputBindingDescription input_binding_description {     .binding = 0,     .stride = sizeof(vertex),     .inputRate = VK_VERTEX_INPUT_RATE_VERTEX };  std::array<VkVertexInputAttributeDescription, 2> input_attribute_descriptions {     VkVertexInputAttributeDescription{         .location = 0,         .format = VK_FORMAT_R32G32B32_SFLOAT,         .offset = offsetof(vertex, pos)     },         VkVertexInputAttributeDescription{         .location = 1,         .format = VK_FORMAT_R32G32B32_SFLOAT,         .offset = offsetof(vertex, col)     } }; 

Here the input rate is specified per vertex and not per attribute. On the other hand, in D3D12, we would have

struct Vertex {     XMFLOAT3 pos;     XMFLOAT3 col; };  std::array<D3D12_INPUT_ELEMENT_DESC, 2> input_element_descs = {     { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0,     D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 },     { "COLOR", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12,     D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 } }; 

And as you can see, the input rate is specified per attribute. Why is that? Is there a difference between the meaning of the input classification in D3d12 and Vulkan that I’m missing? I’m not familiar with D3D12, but at first glance, it doesn’t make sense to me to have different input classifications for the attributes of a vertex.