Verificação de campo de password com JS

Fiz um filtro para verificar se o campo de senha continha no mínimo 6 caracteres, porém, agora preciso retornar uma mensagem de erro caso não possua.

Já tentei utilizar map, pois a aplicação já continha um erro genérico, mas preciso de um para esse tipo específico de erro

  event.preventDefault();   const invalidFields = getInvalidFields(, {     validations: {       'password-register': {         passwordPolicy: element => element.value.length >= 6,         message: 'A senha deve ter ao menos 6 caracteres.',       },     },   });    if (invalidFields.length) {     showErrorMessage(invalidFields);     return;   }  
  Array.from(form.elements)     .filter(element => element instanceof HTMLInputElement)     .filter(input => (       !input.value       || (validations[input.dataset.validation]         && !validations[input.dataset.validation].passwordPolicy(input))     )) );  export const showErrorMessage = invalidFields => (   invalidFields.forEach((input) => {     input.parentElement.lastElementChild.innerHTML = 'Campo obrigatório';     input.passwordPolicy.innerHTML = 'Errrooooooooow'; //não funciona     input.parentElement.classList.add('is-invalid');   }) ); 

Getting error on attributeResource save

I’m trying to add an attribute called orchestra_id to Order and OrderAddress. I’ve made a plugin who have been already activated. So I’ve create an Setup\UpgradeData model. This is what it look like:

<?php  namespace Maru3l\SyncOrchestra\Setup;  use Magento\Sales\Model\Order; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\ModuleDataSetupInterface;  class UpgradeData implements \Magento\Framework\Setup\UpgradeDataInterface {     private $  eavSetupFactory;      private $  eavConfig;      private $  attributeResource;      public function __construct(         \Magento\Eav\Setup\EavSetupFactory $  eavSetupFactory,         \Magento\Eav\Model\Config $  eavConfig,         \Magento\Customer\Model\ResourceModel\Attribute $  attributeResource     ) {         $  this->eavSetupFactory = $  eavSetupFactory;         $  this->eavConfig = $  eavConfig;         $  this->attributeResource = $  attributeResource;     }      public function upgrade(ModuleDataSetupInterface $  setup, ModuleContextInterface $  context)     {         $  setup->startSetup();          $  eavSetup = $  this->eavSetupFactory->create(['setup' => $  setup]);          $  this->installAddressOrchestraIdAttribute($  eavSetup);          $  this->installOrderOrchestraIdAttribute($  eavSetup);          $  setup->endSetup();     }      private function installAddressOrchestraIdAttribute($  eavSetup) {         $  eavSetup->addAttribute('customer_address', 'orchestra_id', [             'label'         =>  'Orchestra ID',             'input'         =>  'text',             'visible'       =>  true,             'position'      =>  100,             'unique'        =>  true,             'required'      =>  false,             'system'        =>  false         ]);          $  attribute = $  this->eavConfig->getAttribute('customer_address', 'orchestra_id');         $  attribute->setData('used_in_forms', ['adminhtml_customer_address', 'customer_address_edit']);         $  this->attributeResource->save($  attribute);     }      private function installOrderOrchestraIdAttribute($  eavSetup) {         $  eavSetup->addAttribute(Order::ENTITY, 'orchestra_id', [             'label'         =>  'Orchestra ID',             'input'         =>  'text',             'visible'       =>  true,             'position'      =>  100,             'unique'        =>  true,             'required'      =>  false,             'system'        =>  false         ]);          $  attribute = $  this->eavConfig->getAttribute(Order::ENTITY, 'orchestra_id');         $  attribute->setData('used_in_forms', ['adminhtml_order']);         $  this->attributeResource->save($  attribute);     } } 

I’ve literally copy/past the exemple in but it is not working.

I’m always getting this issue during the php bin/magento setup:upgrade and I don’t see the collomn appared in the database :

PHP Fatal error:  Uncaught Error: Call to a member function getId() on null in /var/www/vhosts/ Stack trace: #0 /var/www/vhosts/ Magento\Eav\Model\ResourceModel\Attribute->_afterSave(Object(Magento\Eav\Model\Entity\Attribute)) #1 /var/www/vhosts/ Magento\Framework\Model\ResourceModel\Db\AbstractDb->processAfterSaves(Object(Magento\Eav\Model\Entity\Attribute)) #2 /var/www/vhosts/ Magento\Framework\Model\ResourceModel\Db\AbstractDb->save(Object(Magento\Eav\Model\Entity\Attribute)) #3 /var/www/vhosts/ Magento\Customer\Model\ResourceModel\Att in /var/www/vhosts/ on line 117 {"messages":{"error":[{"code":500,"message":"Fatal Error: 'Uncaught Error: Call to a member function getId() on null in \/var\/www\/vhosts\/\/httpdocs\/vendor\/magento\/module-eav\/Model\/ResourceModel\/Attribute.php:117\nStack trace:\n#0 \/var\/www\/vhosts\/\/httpdocs\/vendor\/magento\/framework\/Model\/ResourceModel\/Db\/AbstractDb.php(832): Magento\Eav\Model\ResourceModel\Attribute->_afterSave(Object(Magento\Eav\Model\Entity\Attribute))\n#1 \/var\/www\/vhosts\/\/httpdocs\/vendor\/magento\/framework\/Model\/ResourceModel\/Db\/AbstractDb.php(419): Magento\Framework\Model\ResourceModel\Db\AbstractDb->processAfterSaves(Object(Magento\Eav\Model\Entity\Attribute))\n#2 \/var\/www\/vhosts\/\/httpdocs\/generated\/code\/Magento\/Customer\/Model\/ResourceModel\/Attribute\/Interceptor.php(258): Magento\Framework\Model\ResourceModel\Db\AbstractDb->save(Object(Magento\Eav\Model\Entity\Attribute))\n#3 \/var\/www\/vhosts\/\/httpdocs\/app\/code\/Maru3l\/SyncOrchestra\/Setup\/UpgradeData.php(68): Magento\Customer\Model\ResourceModel\Att' in '\/var\/www\/vhosts\/\/httpdocs\/vendor\/magento\/module-eav\/Model\/ResourceModel\/Attribute.php' on line 117","trace":"Trace is not available."}]}} 

I’ve also create the etc\extension_attributes.xml:

<?xml version="1.0"?> <config xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">     <module name="Maru3l_SyncOrchestra" setup_version="0.0.18">         <sequence>             <module name="Magento_Cusomer"/>             <module name="Magento_InventoryApi"/>             <module name="Magento_Sales"/>         </sequence>     </module> </config> 

Two-level concepts

I find myself lately implementing the same concept twice, once at a low level and once at a higher level. Let me see if I can explain it…

For example, given the notion of a database, I have one interface (say IDatabase) with methods like

void AddCompany(Company company); 

which is what I consider “low level”.

However, there are cases where I need to group a few of these calls (say I’m adding both a company and a user). I don’t want to pollute the low level interface / implementation with this method, especially since this method basically only groups a few IDatabase calls, so I create a new interface. My problem is: what do I call this new interface? IHighLevelDataAccess just sounds weird.

I have the same problem with, say, remote access. One interface / implementation for the raw calls (one method maps to one web call) and another one for more complex logic (but mostly still doing remote calls).

Is there a naming convention that is expected / recommended in such cases? A design pattern that eludes me?

iPhone activation

I would like to ensure that my understand of activation is correct:

Activation is the first step of an electronic lock on the phone that prevents others from making use of the iPhone: it binds the phone to an Apple ID account to enable remote erase. A new phone’s activation is performed at startup by entering (or creating) Apple ID credentials. Only after the credentials are validated: the phone will present the home menu screen. In summary:

New Phone ==activation process==> access to GUI

A second form of activation: ‘Find my iPhone Activation Lock` feature must be turned on as prescribed by Apple to “lock” the phone to an Apple ID and prevent usage after loss / theft.

Neither form of activation implies SIM unlock and the phone may be tied to a particular service. Any explanation or correction to my understanding is appreciated. Thank you

How do I find the odds in a dice pool contest?

Im designing a system where overall success is determined using a dice pool where you count the number of max-value faces among dice rolled and compare this number to some difficulty number. In this system you roll d6s for attributes, and d4s for skill level. helpfully can find the chances of any given number of successes (number of max-value die shown) with:

output [count 6 in Xd6] + [count 4 in Yd4]

So far, so good.

What Im trying to figure out is how do I find the odds that one person will beat (equal or greater number of successes) another person in a contest between two of these rolls with different X and Y values for each person.

Is this doable on

Thank you

SPFx React webpart is not displaying all XML items from RSS News Feed

I am currently building an RSS News Feed in SPFx using React as a framework and using an XML link (Swedish news if curious).

I can display all items, in this case title and author, in the console but in the webpart it only displays one item (the latest one).

I want to show all items in the webpart as well, that is a main purpose for an RSS Feed.

Here is how the webpart and console look like now (in Chrome): enter image description here

Here is the code: RssApp.tsx: (I am using a for loop to iterate over all items but it doesn’t seem to work on the SPFx)

import * as React from 'react'; import styles from '../RssApp.module.scss'; import { IRssAppProps } from './IRssAppProps'; import {IRssAppState} from './IRssAppState'  export default class RssApp extends React.Component<IRssAppProps, IRssAppState> {   constructor(props: IRssAppProps){     super(props);     this.state = {         title: '',         description: '',         author: ''     }   }    showSomeXML(){        var xhttp = new XMLHttpRequest();        xhttp.onreadystatechange = () => {         if(xhttp.readyState == 4 && xhttp.status == 200){            /**For loop iterating over items (i.e. all news article items) */           for(let i = 0; i < xhttp.responseXML.getElementsByTagName('item').length; i++){              /***Showing in the console */              console.log("Title: " + xhttp.responseXML.getElementsByTagName('item')[i].children[3].innerHTML);              console.log("Author: " + xhttp.responseXML.getElementsByTagName('item')[i].children[2].innerHTML);                  /**Set State to innerHTML from the xml file */                 this.setState(                 {                     title: xhttp.responseXML.getElementsByTagName('item')[i].children[3].innerHTML,                   author: xhttp.responseXML.getElementsByTagName('item')[i].children[2].innerHTML                 })            }           console.log("News items: " + xhttp.responseXML.getElementsByTagName('item').length);           console.log(xhttp.responseXML.getElementsByTagName('item')[1].children);         }       };"GET", '', true);       xhttp.send();   }    componentDidMount(){     {this.showSomeXML()}   }    public render(): React.ReactElement<IRssAppProps> {     return (                <div className={ styles.title }>{this.state.title}                   <div>{this.state.description}</div>                   <div>{}</div>               </div>     );   } }  

Here are the states defined IRssAppState.ts:

export interface IRssAppState{      title: string;     description: string;     author: string; } 

Very strange since I do have a for loop iterating over all items and I do setState within the for loop.

Would appreciate all help I can get with this issue. Thanks in advance.

Do I need a Transit Visa to Japan? [duplicate]

This question already has an answer here:

  • Filipino transferring between Narita and Haneda, do I need a transit visa? 3 answers

I am leaving on the 25th of June from Manila to Haneda, and my connecting flight going to the US is Narita with 6 hours layover. Help please.

  1. Do I need to secure a transit visa or will shore pass suffice?
  2. Do I need to get my luggage from Haneda and bring it with me to Narita for my connecting flight to the US?

Deserializar JSON JS

Tengo un JSONque es de la siguiente forma:

introducir la descripción de la imagen aquí

He tratado de deserializarlo de muchas formas pero siempre es undefined, he intentado

 for (var i = 0; i < ArregloDatos.length; i++) {             console.log(ArregloDatos[i][0]);             console.log(ArregloDatos[i].d.nombre);             console.log(ArregloDatos[i]["nombre"]);         } 

Cual es la forma correcta de poder mostrar nombre o apellido, etc?

why bacula job is running so low?

I am trying to figure out why bacula backup for a windows client with 1 Gbps bandwidth is so slow. I tried iperf3 between the bacula server and bacula client and the speed is high.

please see a screenshot from the Resource Monitor while iperf3 and bacula both are running.

Resource Monitor