asp.net mvc – Validation error while tracking the Vidly curriculum using the network core

I am following Mosh for his Vidly app and have noticed some differences because I do this in MVC Net Core 2.0. So far I have managed to find solutions, but this is confusing for me.

The respective model class can be found at https://github.com/mosh-hamedani/vidly-mvc-5/blob/9c3403d2ca1578ad22bfb1116149107d55510b50/Vidly/Models/Min18YearsIfAMember.cs

Here is my version:

public class Min18YearsIfAMember : ValidationAttribute
{
    protected override ValidationResult IsValid(object value, ValidationContext validationContext)
    {
        var customer = (Customer)ValidationContext.ObjectInstance;

        if (customer.MembershipTypeId == 0 || customer.MembershipTypeId == 1)
            return ValidationResult.Success;

        if (customer.Birthdate == null)
            return new ValidationResult("Birthdate is Required");

        var age = DateTime.Today.Year - customer.Birthdate.Value.Year;

        return (age >= 18 
            ? ValidationResult.Success : new ValidationResult("Customer should be at least 18 Years "));
    }
}



public class Customer
{
    public int Id { get; set; }

    (Required(ErrorMessage = "Please Enter Customer's Name"))
    (StringLength(255))
    public string Name { get; set; }

    public bool IsSubscribedToNewsLetter { get; set; }

    public MembershipType MembershipType { get; set; }

    (Display(Name = "Membership Type"))
    public byte MembershipTypeId { get; set; }

    (Display(Name = "Date of Birth"))
    (Min18YearsIfAMember)
    public Nullable Birthdate { get; set; }
}

When I refer to "(Customer) ValidationContext.ObjectInstance" the following error message appears: For the non-static field, the method or the property & # 39; ValidationContext.ObjectInstance & # 39; an object reference is required.

Why are two different fully synchronized Bitcoin Core nodes different in blockchain size?

The size_on_disk is printed during execution getblockchaininfo is 1.2 GB smaller than other nodes that report / block at the same time.

txindex = 1

What could it be ??
I asked other colleagues on Twitter to check if someone else was experiencing the same thing and everyone has more data in their general ledger than me. (https://twitter.com/bitdov/status/1231915231368163328)

Here is all the information printed on my node with getblockchaininfo:

{
  "chain": "main",
  "blocks": 618824,
  "headers": 618824,
  "bestblockhash": "0000000000000000000a1fb0ec42e380215bb58698a1321d2953ee5d1b7b                                                                                                                                                  685d",
  "difficulty": 15546745765529.37,
  "mediantime": 1582569829,
  "verificationprogress": 0.9999950821417113,
  "initialblockdownload": false,
  "chainwork": "00000000000000000000000000000000000000000cfea65b1b3c9262e87778b8                                                                                                                                                  ",
  "size_on_disk": 299006763199,
  "pruned": false,
  "softforks": {
    "bip34": {
      "type": "buried",
      "active": true,
      "height": 227931
    },
    "bip66": {
      "type": "buried",
      "active": true,
      "height": 363725
    },
    "bip65": {
      "type": "buried",
      "active": true,
      "height": 388381
    },
    "csv": {
      "type": "buried",
      "active": true,
      "height": 419328
    },
    "segwit": {
      "type": "buried",
      "active": true,
      "height": 481824
    }
  },
  "warnings": ""
}

Bitcoin Core – How do I create BTC Raw transactions with 0 BTC Wallet and send them on the blockchain network?

https://www.youtube.com/watch?v=2NFMMNXyHNE

I was watching a YouTube video from someone who created multiple raw BTC transactions with 0 BTC Wallet and sent it on the blockchain network with a valid transaction hash that was visible and was unconfirmed for 7 to 72 hours before being disappeared from the blockchain network.

How can I replicate this with Bitcoin Core? My Bitcoin Core full node is up to date.

THANK YOU IN ADVANCE

Bitcoin Core – Bitcoind not found

I installed Bitcoin Core 0.17.1 version Windows 10 in my laptop.

I can see the following folders: bin (bitcoin-cli.exe, bitcon-qt.exe, bitcoin-tx.exe, test_bitcoin.exe), include (bitcoinconsensus.h), lib (libbitcoinconsensus-0.dll), share ( Man).

I can't find daemon bitcoind.
My Bitcoin server is already running and is being synchronized in the test network, but I cannot connect via rpc because I cannot find bitcoind.

Any help?

api – problems with the .Net core relationship

I am studying the .NET Core API and have relationship problems where I get the error when I try to list all "calibrations" of the "devices".

JsonException: A possible object cycle was detected which is not supported. This can either be due to a cycle or if the object depth is larger than the maximum allowed depth of 32.

System.Text.Json.ThrowHelper.ThrowInvalidOperationException_SerializerCycleDetected(int maxDepth)

It's certainly something I'm doing wrong, but the documentation didn't help me.

I hope the result is to get all calibrations (calibrated and valid) for each device.

public class Equipamento
    {
        public int Id { get; set; }
        public string Nome { get; set; }
        public int TipoEquipamentoId { get; set; }
        public TipoEquipamento TipoEquipamento { get; set; }
        public decimal Valor { get; set; }
        public string NotaFiscal { get; set; }
        public DateTime Entrada { get; set; }
        public List Calibracao { get; set; }
    }

public class Calibracao
    {
        public int Id { get; set; }
        public int EquipamentoId { get; set; }
        public Equipamento Equipamento { get; set; }
        public DateTime Calibrado { get; set; }
        public DateTime Validade { get; set; }
    }

public class TesteContext : DbContext
    {
        public TesteContext(DbContextOptions options)
            : base(options)
        {
        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity()
                .HasOne(p => p.Equipamento)
                .WithMany(b => b.Calibracao);
        }

        public DbSet Equipamentos { get; set; }
        public DbSet TiposEquipamento { get; set; }
        public DbSet Calibracoes { get; set; }
    }

// GET: api/Equipamento
        (HttpGet)
        public async Task>> GetEquipamentos()
        {
            return await _context.Equipamentos
                .Include(t => t.TipoEquipamento)
                .Include(c => c.Calibracao)
                .ToListAsync();
        }

If I remove: ".Include (c => c.Calibration)"From the controller I get the JSON with" calibration "zero. Can someone help me?

Insert picture description here

8 – Can a content entity type have a bundle that is config entity type as in the Drupal Core Contact form?

What is bundle_entity_type to the @ContentEntityType of id = contact_message Where contact_message is @ConfigEntityType?
Can a Configure entity type to be a bunch of ContentEntity type ?

core / modules / contact / src / Entity / Message.php

/**
 * Defines the contact message entity.
 *
 * @ContentEntityType(
 *   id = "contact_message",
 *   label = @Translation("Contact message"),
 *   label_collection = @Translation("Contact messages"),
 *   label_singular = @Translation("contact message"),
 *   label_plural = @Translation("contact messages"),
 *   label_count = @PluralTranslation(
 *     singular = "@count contact message",
 *     plural = "@count contact messages",
 *   ),
 *   bundle_label = @Translation("Contact form"),
 *   handlers = {
 *     "access" = "DrupalcontactContactMessageAccessControlHandler",
 *     "storage" = "DrupalCoreEntityContentEntityNullStorage",
 *     "view_builder" = "DrupalcontactMessageViewBuilder",
 *     "form" = {
 *       "default" = "DrupalcontactMessageForm"
 *     }
 *   },
 *   admin_permission = "administer contact forms",
 *   entity_keys = {
 *     "bundle" = "contact_form",
 *     "uuid" = "uuid",
 *     "langcode" = "langcode"
 *   },
 *   bundle_entity_type = "contact_form",
 *   field_ui_base_route = "entity.contact_form.edit_form",
 * )
 */
class Message extends ContentEntityBase implements MessageInterface {

core / modules / contact / src / Entity / ContactForm.php
what says bundle_of ==> contact_message

/**
 * Defines the contact form entity.
 *
 * @ConfigEntityType(
 *   id = "contact_form",
 *   label = @Translation("Contact form"),
 *   label_collection = @Translation("Contact forms"),
 *   label_singular = @Translation("contact form"),
 *   label_plural = @Translation("contact forms"),
 *   label_count = @PluralTranslation(
 *     singular = "@count contact form",
 *     plural = "@count contact forms",
 *   ),
 *   handlers = {
 *     "access" = "DrupalcontactContactFormAccessControlHandler",
 *     "list_builder" = "DrupalcontactContactFormListBuilder",
 *     "form" = {
 *       "add" = "DrupalcontactContactFormEditForm",
 *       "edit" = "DrupalcontactContactFormEditForm",
 *       "delete" = "DrupalCoreEntityEntityDeleteForm"
 *     }
 *   },
 *   config_prefix = "form",
 *   admin_permission = "administer contact forms",
 *   bundle_of = "contact_message",
 *   entity_keys = {
 *     "id" = "id",
 *     "label" = "label"
 *   },
 *   links = {
 *     "delete-form" = "/admin/structure/contact/manage/{contact_form}/delete",
 *     "edit-form" = "/admin/structure/contact/manage/{contact_form}",
 *     "collection" = "/admin/structure/contact",
 *     "canonical" = "/contact/{contact_form}",
 *   },
 *   config_export = {
 *     "id",
 *     "label",
 *     "recipients",
 *     "reply",
 *     "weight",
 *     "message",
 *     "redirect",
 *   }
 * )
 */
class ContactForm extends ConfigEntityBundleBase implements ContactFormInterface {

Bitcoin core – when should I use -reindex-chainstate and when should -reindex?

-reindex::

  • clears the chain state (the UTXO set)
  • clears the block index (the database with information about which block is on which disk)
  • rebuilds the block index (by going through all the blk * .dat files and finding things that look like blocks)
  • Rebuilds the chain status (recheck all blocks) based on the blocks now included in the index

-reindex-chainstate::

  • wipes the chain condition
  • Rebuilds the chain state using the blocks in the index you previously had

The latter should definitely be faster since the block index does not have to be recreated first. You may be confused by the progress bar during re-indexing: This progress is only used to rebuild the index. The chain state is restored after the reconstruction is complete.

You should use -reindex Only if you were running in cleanup mode or if you suspect that the blocks on the hard drive are actually damaged. Otherwise, use if you only suspect chain condition damage (which is far more likely) -reindex-chainstate,

Bitcoin Core – Open a wallet with Bitcoind

I'm running bitcoind after running bitcoin-qt before. I created (and encrypted) a wallet with bitcoin-qt and now I want to open it with bitcoind. The folder that contains the wallet.dat file is in the data directory, but when I do one of the following:

bitcoin-cli listwallets
bitcoin-cli getwalletinfo

My wallet is not shown. I have tried:

bitcoind -wallet="directory with wallet.data file"

and still no luck, it was just trying to round out Bitcoind and says it is already running (not sure why, I'm running Bitcoind -daemon).

Any idea how I can import this wallet?

bitcoin core – How does bitcoind choose its data directory?

Sorry, no question, I'm new to everything Linux related. I have managed to properly set up the Bitcoin core on my Raspberry Pi 4, and I have an external hard drive that I want to use as a data directory for around 250 GB blocks (this is not my main memory from which I boot).

The problem is, I have absolutely no idea how the Bitcoind program decides on its data directory. I have run 3 or 4 times and I have 3 or 4 different data directories, none of which are on the hard drive. How do I tell where to save the data? Where do I put the bitcoin.conf file because it doesn't seem to be found? I pre-installed most of the blockchain from my Windows PC on my hard drive, so I would ideally use the same directory. However, if this is not possible, I would at least want it on my hard drive. I followed several instructions and so far nothing has worked for me. I appreciate your time for all the answers!

C # – How do I define a field in the CodeFirst Entity Framework .Net Core as unique?

How can I define this in the field? e-mail Can’t repeat email addresses?

My class:

namespace BusinessWebApi.Models
{
    (Table("UserApi"))
    public class UserApi
    {
        (Key)
        (DatabaseGenerated(DatabaseGeneratedOption.Identity))
        (Column(Order = 1, TypeName = "INT"))
        public int Id { get; set; }

        (Column(Order = 2, TypeName = "VARCHAR"))
        (StringLength(50))
        public string Email { get; set; }

        (Column(Order = 3, TypeName = "VARCHAR"))
        (StringLength(200))
        public string Password { get; set; }

        (Column(Order = 4, TypeName = "DATETIME"))
        public DateTime CreateDate { get; set; }

    }
}