How can I add attributes to all characters in a folder and set them to a default value?

I recently decided to consolidate my macros that refer to a character’s gender by pronoun into a single one using attributes on the character sheet (ie subjective, objective, possessiveA, and possessiveP) and am looking for a way to loop through each character in a folder and add those attributes to each of them and set them to a default of {it, it, its, and its} respectively. Is there any way I can do that? I do have api access if it’s required to do it.

Reprinting tags with all attributes

I’m reworking a WordPress plugin that I’ve made which specifies image dimensions that are missing width and/or height attributes.

As you can see in my current version on GitHub, I manually list all of the attributes for the <img> tag (L38). However, if a user were to add custom attribute, it would get omitted since it’s not listed in my $ attributes variable:

# Before <img src="" class="img" custom-attr="value"> # After <img src="" class="img" width="100" height="30"> 

Creating a simple test file, I was able to update the regex to store all attributes that are found in the <img> tags. Yes, I’m aware of the recommendation to use DOMDocument, but it has caused more issues with WordPress in the past.

preg_match_all( '/(?:<img|(?<!^)\G)\h*([-\w]+)="([^"]+)"(?=.*?\/>)/', $  content, $  images ); 

In order to not fill up this post with too much code, I have the current working test file on my GitHub Gist here. You can also see the regex test here to verify.

Using var_dump( $ images );, this gives me the following output from my sample images (I added ... at the end of each array to save space):

    0 =>        array (size=19)         0 => string '<img src=""' (length=63)         1 => string ' alt="JPG"' (length=10)         2 => string '<img src=""' (length=52)         ...     1 =>        array (size=19)         0 => string 'src' (length=3)         1 => string 'alt' (length=3)         2 => string 'src' (length=3)         ...     2 =>        array (size=19)         0 => string '' (length=52)         1 => string 'JPG' (length=3)         2 => string '' (length=41)         ... 

My goal is to recreate the image tags with all of their attributes and values after the dimensions are calculated. From my tests, I’ve tried the following, but it hasn’t given me the results I’m expecting:

foreach ( $  images[1] as $  attributes[1] => $  value ) {     echo( '< img ' . $  value . '="' . 'value' . '" ><br>' ); } 

Can there exist Tables with no Non-Prime Attributes? If so, are they always normalised to 3NF?

Can there exist a table with no non-prime attributes?

Here is an example of a table which I believe has no non-prime attributes:

I came to this conclusion because the list of attributes in the relation is [id, tag_desc_id, name] and the list of candidate keys is [{id}, {tag_desc_id, name}]. There are no attributes in the list of attributes that are in none of the candidate keys. Thus, there are no non-prime attributes.

Is my reasoning correct?

If so, is it normalised to 3NF?

The criteria for 3NF is:

  • 2NF

  • Every non-prime attribute of R is non-transitively dependent on every key of R

There are no non-prime attributes, thus 3NF is satisfied

The criteria for 2NF is:

  • 1NF

  • Every non-prime attribute is (…)

Again, there are no non-prime attributes.

Is this true generally?

For any table, assuming the table has a primary key id as above (and so 1NF is satisfied), and the table has no non-prime attributes, is it always the case that the table is normalised to the third normal form (3NF)?

OpenLDAP encrypt database or by attributes

I run an OpenLDAP server on which there is some data I wanted to encrypt. I cannot use a userPassword like attributes as this is hash. In my case I need to crypt/decrypt it with a secret key.

But if I do so, i’ll not be able anymore to perform ldapsearch request with these attributes in my filter (as they are encrypted…)

So, is there a natif way to be it on a attribute basis ? Or maybe there is a way to encrypt the whole data.mdb file to avoid someone who stole it to read it on it’s own instance.

Thank you

Wrong ReadSecurity and WriteSecurity (Item-level permissions) attributes in PnPProvisioningTemplate

I’m creating a provisioning template for a SharePoint 2016 list using Get-PnPProvisioningTemplate -Out export.xml -Handlers All -PersistBrandingFiles.

Some lists define different Item-level Permissions. Item-level permissions restricted to user

However, the exported file doesn’t include those permissions, defining 0 for both ReadSecurity and WriteSecurity: <pnp:ListInstance ... ReadSecurity="0" WriteSecurity="0" ...>.

Is there any way to include the correct Item-level permissions in exported templates?

Related product by attributes

I looking for solutution to display related product by attributes.

I’ve use function from but it’s works only for one attribute. I want to modificate this function to show product from 2 attribute.

Mandatory and non mandatory attributes for products

I am trying to come up with a simple way of implementing the following design, but I always end up with something overly complicated.

I am trying to design a database where companies can store products. Each product belongs to exactly one category, and depending on the category, they share some common attributes that I want to be mandatory. They can also have different attributes that are up to the company to define.

As of now, and based on this question I asked last year, my idea is to have the following:

  • Company table to store everything related to the company (one company can have several products)
  • Product table to store everything related to the product (one product can be in one category, and can have several features)
  • Category table just to save the name of the category
  • Attribute table attributes that can be defined by the company for that product
  • Product Feature table joint table

With these tables, companies will be able to add their products to a category and add as many attributes as they want.

Now, dependant on the category, I want to make mandatory to define a set of attributes. For example, if we are talking about groceries, and a category would be ‘Fruits’, I might want the company to always provide the following attributes: color, country of origin. If instead of fruits, the category is ‘Cereals’ I might want to be always provided with the following: allergens, expire date

I have thought of two different solutions, which are:

  • Create a new table for each category that needs these mandatory attributes. This, of course, will be a problem as if a new mandatory attribute is added to an existing category, all previous ones will have no value. Also, every time I add a new category I should define a new table for the attributes.
  • The other option I have thought of is to simply manage this in the frontend of the application. Once a company adds a product belonging to one of those categories, prompt them to input the mandatory attributes and simply save them as a ‘normal’ attribute.

I am more inclined towards using the second solution. Using the first one I could end up with a ddbb with dozens of tables, but I would like some input to see if anyone can come up with a better solution.

magento 2 ; only want custom product attributes to show on custom product

I created a custom virtual product that is based on a date attribute. i.e product is available on certain days a month.

However, the only attributes I want for it are name, sku, quantity, date.

I built a custom date feature but this date is now showing up on all other type of products.

question 1:

how can i ensure that the custom attributes only show on my custom virtual product.


How can I remove all other attributes/form values like content, design etc

this is what i did to create the custom date attribute:


public function install(ModuleDataSetupInterface $  setup, ModuleContextInterface $  context)     {         $  eavSetup = $  this->eavSetupFactory->create(['setup' => $  setup]);          $  eavSetup->addAttribute(                 \Magento\Catalog\Model\Product::ENTITY,         'dome_dates',         [             'group' => 'Custom Attribute',             'label' => 'Dome Date',             'type' => 'datetime',             'input' => 'date',             'class' => 'validate-date',             'required' => false,             'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE,             'visible' => true,             'required' => false,             'user_defined' => true,             'default' => '',             'searchable' => true,             'filterable' => true,             'filterable_in_search' => true,             'visible_in_advanced_search' => true,             'comparable' => false,             'visible_on_front' => false,             'used_in_product_listing' => true,             'unique' => false         ]     );      } 

and in my Di:

 <virtualType name="Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\Pool">         <arguments>             <argument name="modifiers" xsi:type="array">                 <item name="dome_dates" xsi:type="array">                     <item name="class" xsi:type="string">Test\Example\Ui\DataProvider\Product\Form\Modifier\Datetime</item>                     <item name="sortOrder" xsi:type="number">100</item>                 </item>             </argument>         </arguments>     </virtualType>