entity – entity validator fails integer because it is not an integer

I have a custom entity with an integer field with the following baseFieldDefinition:

    $fields('permission_level') = BaseFieldDefinition::create('integer')
    ->setLabel(t("Permission Level"))
    ->setDescription(t("Sets amount of permissions owner has"))
     ->addConstraint('Range', ('min' => 0))
    ->setDisplayOptions('form', (
      'type' => 'number'

because of the ->addConstraint('Range', ('min' => 0))Drupal always returns an error when I try to create an entity about it drupal generate:entity:content Boilerplate form or JSON: API mail requests generated.

I used Xdebug to limit the problem to the scope of the restriction.
It passes a FieldListItem object instead of an integer to this health rule validator, which causes the operation to fail because it is not an integer. The strange thing is that the integer I is entered inside the FieldListItem object.

Why is Drupal passing a FieldListItem instead of an integer?

Node Binance Coin Validator – Bitcoin Stack Exchange

I'm a bit curious about the binance cryptocurrency system from a technical point of view. From this source, Validator nodes take responsibility for managing Binance Chain / DEX data and validating all transactions. These validator nodes are trusted members of the Binance community. My question is: Does not it violate one of the main purposes of the DEX system (ie Does a trusted party need it to confirm a transaction)? On the other hand, bitcoin is protected by its inherent mathematical property, and you do not have to trust anyone to ensure its safety.

Do I miss something here?

(I'm a bit confused if I posted this question in the right StackExchange community.)

Why can not a validator in Shard "A" in Shard "B" verify the accuracy of historical transactions?

This question is about splitting blockchains. A method for scaling transaction throughput.

In this article about the fragmentary block chains (link to the article) we read:

The core idea in Blockchains is that most of the participants
Operation or use of the network can not validate blocks in all
Shards. As such, whenever a participant needs to interact with a
special shard them in general can not download and validate the
entire history of the shard.

What is the reason an examiner in Shard A has this? can not download and validate the correctness of the entire history of the shard B?

In my view, this validator can download all historical transactions in any Shard (just like a non-split blockchain) and then check the history of all transactions by tracking every transaction.

What is the problem? (In general, all shards use the same consensus algorithms and all have the same block structure.)

To update: To answer the commentary, here are some examples of the broken-glass block chains:

(1) https://www.comp.nus.edu.sg/~prateeks/papers/Elastico.pdf

(2) https://infoscience.epfl.ch/record/255586/files/OmniLedger.pdf

(3) Ethereum sharding faq. "(2017). Https://github.com/ethereum/wiki/wiki/Sharding-FAQ

(4) https://docs.zilliqa.com/whitepaper.pdf

(5) https://eprint.iacr.org/2018/460.pdf

(6) https://icoguru.io/uploads/icos/harmonypaper.pdf

python – password validator that simplifies the use of zxcvbn with Django

This is a translatable password validator for Django, based on zxcvbn-python and available with pip, zxcvbn is a password strength estimator inspired by password crackers. It allows to prevent users from having to select a password with a capital letter, a special character, and a number, but still needs to check the password strength and make input to help the user select a password.

The project is available here on Github, and the package is here on Pypi.

I check the code with that Pre-Commit Frame, with black. I sort. flake8 and pylint as a git hook. I test it tox and cover locally, and I judge Travis and Codacy on-line. The translation is done with Django Rosetta, I tried to create a clear readme file with examples to explain what the package does in detail. There are also tests that cover the entire code base.

I would be very interested in comments on the entire project, the code, tests, documentation, tooling, setup, design, on-board complexity, and basically anything about the project, which could improve it.

However, this makes many things to check, so the main part of the code is the following:

import settings from the django.conf
import from django.core.exceptions Improperly configured, ValidationError
from django.utils.translation import ugettext_lazy as _
from zxcvbn import zxcvbn

from django_zxcvbn_password_validator.settings import DEFAULT_MINIMAL_STRENGH
from django_zxcvbn_password_validator.translate_zxcvbn_text import (

Class ZxcvbnPasswordValidator:
def __init __ (self, min_length = 1, zxcvbn_implementation = zxcvbn):
self.min_length = min_length
self.zxcvbn_implementation = zxcvbn_implementation
self.password_minimal_strengh = getattr (
self .__ check_password_minimal_strengh ()

def __check_password_minimal_strengh (self):
error_msg = "ZxcvbnPasswordValidator needs an integer between 0 and 4"
error_msg + = "for PASSWORD_MINIMAL_STRENGH in Preferences."
if int (self.password_minimal_strengh)! = self.password_minimal_strengh:
error_msg + = f "(none {self.password_minimal_strengh .__ class __.__ name__})"
raise ImproperlyConfigured (error_msg)
if self.password_minimal_strengh < 0 or self.password_minimal_strengh > 4:
error_msg + = f "({self.password_minimal_strengh} is not in [0,4]) "
raise ImproperlyConfigured (error_msg)

def validate (self, password, user = None):
def add_list_of_advices (headers, comments, hints):
if isinstance (advice, str):
comments.append (f "{header}: {translate_zxcvbn_text (advices)}")
For advice:
comments.append (f "{header}: {translate_zxcvbn_text (advice)}")
Return comments

user_imputs = []
        if user:
for the value in user .__ dict __. values ​​():
user_imputs.append (value)
results = self.zxcvbn_implementation (password, user_inputs = user_imputs)
password_strengh = results["score"]
        if password_strengh <self.password_minimal_strengh:
crack_time = results["crack_times_display"]
            offline_time = crack_time["offline_slow_hashing_1e4_per_second"]
            Warnings = results["feedback"]["warning"]
            Advice = results["feedback"]["suggestions"]
            Comments = []
            comments.append (
"{} {}" Format (
_ ("Your password is to guess:"),
_ ("An offline attacker needs% (time) to guess this.")
% {"time": translate_zxcvbn_time_estimate (offline_time)},
if warnings:
comments = add_list_of_advices (_ ("Warning"), Comments, Warnings)
if advice:
comments = add_list_of_advices (_ ("Advice"), comments, advice)
increase ValidationError (Comments)

def get_help_text (self):
Expectations = _ ("We expect")
if self.password_minimal_strengh == 0:
Expectations + = "{}". Format (
_ ("nothing: you can use any password.")
Return expectations
Expectations + = "{}". Format (_ ("a password that can not be guessed"))
Hardness = {
1: _ ("from your family or friends."),
2: _ ("by attackers online."),
3: _ ("without access to our database."),
4: _ ("without a dedicated team and access to our database."),
Expectations + = "{}". Format (hardness.get (self.password_minimal_strengh))
return "{} {} {} {}". format (
_ ("There is no special rule for a good password"),
_ ("If your password is too easy to guess"),
_ ("We'll tell you how to make a better one."),

The translation is done here:

import logging

from django.utils.translation import ugettext_lazy as _

LOGGER = logging.getLogger (__ file__)

def translate_zxcvbn_text (text):
"This PR would make it cleaner, but it will be very slow
To be integrated into python-zxcvbn, we'd like this to work now:
https://github.com/dropbox/zxcvbn/pull/124 "" "
i18n = {
"Use a few words, avoid frequent expressions": _ (
"Use a few words, avoid frequent expressions"
"No symbols, numbers or capital letters required": _ (
"No need for symbols, numbers or capital letters"
"Add one or two more words. Occasional words are better.": _ (
"Add one or two more words. Occasional words are better."
"Even rows of keys are easy to guess": _ (
"Even rows of keys are easy to guess"
"Short keyboard patterns are easy to guess": _ (
"Short keyboard patterns are easy to guess"
"Use a longer keyboard pattern with more turns": _ (
"Use a longer keyboard pattern with more turns"
Repeats like "aaa" are easy to guess & # 39 ;: (
& # 39; repeats like "aaa" are easy to guess & # 39;
Repeats like "abcabcabc" are only slightly harder to guess than "abc" & # 39 ;: (
Repetitions like "abcabcabc" are only slightly harder to guess than "abc" & # 39;
"Avoid repeated words and signs": _ ("Avoid repeated words and signs"),
& # 39; sequences like "abc" or "6543" are easy to guess & # 39 ;: (
# Sequences like "abc" or "6543" are easy to guess & # 39;
"Avoid sequences": _ ("avoid sequences"),
"The last years are easy to guess": _ ("The last years are easy to guess"),
"Avoid the last years": _ ("Avoid the last years"),
"Avoid years associated with you": _ (
"Avoid years associated with you"
"Appointments are often easy to guess": _ ("Appointments are often easy to guess"),
"Avoid data and years associated with you": _ (
"Avoid dates and years associated with you"
"This is a top 10 password": _ ("This is a top 10 password"),
"This is a top 100 password": _ ("This is a top 100 password"),
"This is a very common password": _ ("This is a very common password"),
"This is similar to a frequently used password": _ (
"This is similar to a commonly used password."
"A word in itself is easy to guess": _ ("A word in itself is easy to guess"),
"First and last names are easy to guess": (
"First and last names are easy to guess"
"General first and last names are easy to guess": _ (
"General first and last names are easy to guess"
"Capitalization does not help much": _ (
"Capitalization does not help much"
"Capitalization is almost as easy to guess as lowercase": _ (
"Capitalization is almost as easy to guess as lowercase"
"Reversed words are not much harder to guess": (
"Reversed words are not much harder to guess"
"Predictable substitutions like & # 39; @ instead of & # 39; a & # 39; do not help much":
"Foreseeable substitutions like & # 39; @ instead of & # 39; a & # 39; do not help much."
translated_text = i18n.get (text)
If the translated text is "none":
# zxcvbn is inconsistent, sometimes there is a point, sometimes not
translated_text = i18n.get (text[:-1])
If the translated text is "none":
LOGGER warning (
Msgstr "No translation for '% s' or'% s', update command generatei18ndict. ',
Return text
return translated_text

def translate_zxcvbn_time_estimate (text):
def replace_dict (text, times):
for original, translated in times.items ():
text = text.replace (original, str (translated))
Return text

if text == "less than a second":
return _ ("less than a second")
text = text.replace ("centuries", str (_ ("centuries"))
plural_times = {
"Seconds": _ ("seconds"),
"minutes": _ ("minutes"),
"Hours": _ ("hours"),
"Days": _ ("days"),
"Months": _ ("months"),
"Years": _ ("years"),
times = {
"second": _ ("second"),
"minute": _ ("minute"),
"Hour": _ ("hour"),
"Day day"),
"Month": _ ("month"),
"Year": _ ("year"),
# Several first to avoid replacing "hours" with _ ("hour") + s
# Adding a & # 39; s & # 39; does not mean plural in every language
text = replace_dict (text, plural_times)
text = replace_dict (text, times)
Return text

This part of the code is largely generated by the following administrative command (executed in case) zxcvbn Add a string or remove a string to make it easier to create a new translation):

# - * - Coding: utf-8 - * -

import BaseCommand from django.core.management.base

class command (BaseCommand):

help = "Produces what the i18n requires for the translate_zxcvbn_text function."

def handle (self, * args, ** options):
existings_messages = [
            "Use a few words, avoid common phrases",
            "No need for symbols, digits, or uppercase letters",
            "Add another word or two. Uncommon words are better.",
            "Straight rows of keys are easy to guess",
            "Short keyboard patterns are easy to guess",
            "Use a longer keyboard pattern with more turns",
            'Repeats like "aaa" are easy to guess',
            'Repeats like "abcabcabc" are only slightly harder to guess than "abc"',
            "Avoid repeated words and characters",
            'Sequences like "abc" or "6543" are easy to guess',
            "Avoid sequences",
            "Recent years are easy to guess",
            "Avoid recent years",
            "Avoid years that are associated with you",
            "Dates are often easy to guess",
            "Avoid dates and years that are associated with you",
            "This is a top-10 common password",
            "This is a top-100 common password",
            "This is a very common password",
            "This is similar to a commonly used password",
            "A word by itself is easy to guess",
            "Names and surnames by themselves are easy to guess",
            "Common names and surnames are easy to guess",
            "Capitalization doesn't help very much",
            "All-uppercase is almost as easy to guess as all-lowercase",
            "Reversed words aren't much harder to guess",
            "Predictable substitutions like '@' instead of 'a' don't help very much",
        msg = "i18n = {"
for message in existings_messages:
message = message.replace ("& # 39;", "\ & # 39;")
msg + = f "& # 39; {message} & # 39 ;: _ (& 39; {message} & # 39;),"
msg + = "}"
msg + = "Please copy and paste into the translate_zxcvbn_text function."
msg + = "then use & # 39; python manage.py makemessages & # 39 ;."
print (msg)

This is all code, everything else is testing, documentation or packaging.

Thank you in advance for any hints or advice!

.htaccess – Specify cache validator and browser caching with Apache

I'm trying to improve the speed of my sites and use GTMetrix for some analysis.
I get two recommendations that I can not sort.

Leverage browser caching for the following cacheable resources:

https://cellfina.co.uk/favicon.ico (expiration not specified)

(Procedure not specified)
(Procedure not specified)
(Procedure not specified)
(Procedure not specified)
(Procedure not specified)
(Procedure not specified)
(Procedure not specified)
(Procedure not specified)
(Procedure not specified)
(Procedure not specified)
https://www.googletagmanager.com/gtm.js?id=GTM-PS6VCD5 (15 minutes)
(20 minutes)
https://www.google-analytics.com/analytics.js (2 hours)


The following resources are missing a cache validator. Resources that
Do not specify a cache validator that can not be updated efficiently.
Specify a Last Modified or ETag header for which cache verification should be enabled
the following resources:


Within the .Access File that I have

ExpiresActive On
ExpiresByType text / css "Access 1 month"
ExpiresByType text / html "Access 1 month"
ExpiresByType image / gif "Access 1 year"
ExpiresByType image / png "Access 1 year"
ExpiresByType image / jpg "Access 1 year"
ExpiresByType image / jpeg "Access 1 year"
ExpiresByType image / x-icon "Access 1 year"
ExpiresByType application / pdf "Access 1 month"
ExpiresByType application / Javascript "Access 1 month"
ExpiresByType text / x-javascript "Access 1 month"
ExpiresByType application / x-shockwave-flash "Access 1 month"
ExpiresDefault "Access 1 month"

what I would expect to deal with both js and favicon Files.

Why is not it and how do I handle the API calls?

W3C RSS Validator: Invalid URL

I'm trying to review my RSS feed at https://validator.w3.org/.
I get mistakes

This feed is not checked.
Line 2, column 3719: URL must be a full URL: http://www.uktech.news/wp-content/uploads/2019/01/shutterstock_731742925.jpg

This URL is valid and complies with RFC 3986.
I can not figure out what's wrong with this URL.
If I remove ".news" from this URL my RSS will be checked.
What's wrong with the ".news" domain?

angled – Can the property & # 39; hasError & # 39; Do not read from undefined when trying to place the validator

I'm trying to put a validator in a field, but I get the following:

ERROR TypeError: The property & # 39; hasError & # 39; from undefined can not be read

I tried something like this:

My role building this form group:

this.variacaoForm = this.fb.group ({

Variations: this.fb.array ([this.createFormGroup()])


createFormGroup (Product ?: any, index ?: number): FormGroup {
Return return.f.f.group ({
sku: new FormControl (& # 39; & # 39 ;, [Validators.required

Here I try to use hasError to show a mandatory field message:


Required field

seo – Can I use element in HTML5? The W3C validator fails

When I go to the W3C Validator service, I try to find out if he is using a Element with this example:



The error I get back says:

Error: The element icon is not allowed as a child of the element body in this element
Context. (Suppress further errors from this subtree.)

From line 8, column 2; to line 8, column 7

Content Model for Entity Body: Flow Content.

The part where it says "not allowed as a child" suggested to me that the Element as such can actually exist, but is meant for something else and therefore structurally does not fit in there. But when I go to the MDN HTML element reference, there is none Item listed.

However, using it works (I can use it to display a fontawesome icon) and seeing how HTML5 suggests we can create our own elements (and Angularjs advocates the use of arbitrary element names for statements), it would be really bad in there the practice?

Would it be bad for SEO? Would the readers complain? Would Parsers complain? Would not it be future proof?