blockchain – i'm trying to call a smart solidity contract method via an angular app. but i can't call the method. this is the error i get in the console

I am trying to call a smart contract strength method via an angular app. but i can't call the method. can someone please help me. this is the error i get in the console

TypeError: this.contract.methods.hello is not a function
at CertificateContractService. (certificate-contract.service.ts:32)
at Generator.next ()
at fulfilled (tslib.es6.js:70)
at ZoneDelegate.invoke (zone-evergreen.js:359)
at Object.onInvoke (core.js:39699)
at ZoneDelegate.invoke (zone-evergreen.js:358)
at Zone.run (zone-evergreen.js:124)
at zone-evergreen.js:855
at ZoneDelegate.invokeTask (zone-evergreen.js:391)
at Object.onInvokeTask (core.js:39680)

Smart contract


contract CertificateList {

    function hello() external pure returns (string memory )  {
        return "Hello";
    }

}

Angular service

import Web3 from 'web3';
import {WEB3} from './WEB3';

declare let require: any;
declare let window: any;


@Injectable({
  providedIn: 'root'
})
export class CertificateContractService {
  private abi: any;
  private address = '0xb0fFD3498B219ad2A62Eb98fEDE591265b3C3B67';
  private contract;
  private accounts: string();

  constructor(@Inject(WEB3) private web3: Web3) {
    this.init().then(res => {
    }).catch(err => {
      console.error(err);
    });
  }

  private async init() {
    this.abi = require('../assets/abi/CertificateList.json');
    // await this.web3.currentProvider.enable();
    this.accounts = await this.web3.eth.getAccounts();

    this.contract = new this.web3.eth.Contract(this.abi, this.address, {gas: 1000000, gasPrice: '10000000000000'});

    this.contract.methods.hello().send()
      .then(receipt => {
        console.log(receipt);
      }).catch(err => {
      console.error(err);
    });
  }
}

Provider

import { InjectionToken } from '@angular/core';
import Web3 from 'web3';

export const WEB3 = new InjectionToken('web3', {
  providedIn: 'root',
  factory: () => {
    try {
      window('ethereum').autoRefreshOnNetworkChange = false;
      const provider = ('ethereum' in window) ? window('ethereum') : Web3('givenProvider');
      return new Web3(provider);
    } catch (err) {
      throw new Error('Non-Ethereum browser detected. You should consider trying Mist or MetaMask!');
    }
  }
});

php – How to get data from a table and distribute it in a method?

I want to create a recording method as follows:

On the product page:

require_once('metodos/metodosClass.php');
$metodos = new metodosClass();
....
// Cadastrar produtos
$tabela = 'produtos';
$camposTB = array('Nome,Descricao,Valor,ValorDesconto');
$valores = array_filter($_POST);
echo $metodos->cadastrarProdutos($tabela,$campoTB,$valores);

But how could I get the values ​​of the variables $ fieldsTB and $ values and distribute within the method Register Products ()?

public function cadastrarProdutos($tabela, array $camposTB, array $valores)
{
   mysqli_query($this->conexao,"INSERT INTO ".$tabela." ("{INCLUIR OS VALORES DA VARIÁVEL $camposTB}") VALUES("{INCLUIR OS VALORES DA VARIÁVEL $valores}")");

magento2.3.3 – Magento 2.3.3: How to replace the Collect method in Magento Catalog Ui DataProvider Product Listing Collector Image

I have created a recently viewed product widget in the sidebar of the backend category page. I have a single store with multiple currency configurations when I see that the product is perfectly added to the list.

My problem is that when I change the currency, the image is deleted. Again, I need to see this product to sort out this problem. So I need to bypass the file below to fix the problem.

I need to replace the file below

Magento Catalog Ui DataProvider Product Listing Collector Image

I tried to use Preference but unfortunately it does not work.

$ this-> imageCodes returns an empty array. The value of this is defined in

module-catalog / etc / di.xml.

around the line 992

Could someone suggest a way around this class.

So far, what I have done is

app / code / Vendor / Module / etc / di.xml


Then, app / code / Vendor / Module / Plugin / Ui / DataProvider / Product / Listing / Collector / Image.php

design->getDesignTheme();
        print_r($this->imageCodes);die;
        foreach ($this->imageCodes as $imageCode) {
            /** @var ImageInterface $image */
            $image = $this->imageRenderInfoFactory->create();
            /** @var MagentoCatalogHelperImage $helper */
            $helper = $this->state
                ->emulateAreaCode(
                    'frontend',
                    ($this, "emulateImageCreating"),
                    ($product, $imageCode, (int) $productRender->getStoreId(), $image)
                );

            try {
                $resizedInfo = $helper->getResizedImageInfo();
            } catch (NotLoadInfoImageException $exception) {
                $resizedInfo = ($helper->getWidth(), $helper->getHeight());
            }

            $image->setCode($imageCode);
            $image->setHeight($helper->getHeight());
            $image->setWidth($helper->getWidth());
            $image->setLabel($helper->getLabel());
            $image->setResizedHeight($resizedInfo(1));
            $image->setResizedWidth($resizedInfo(0));

            $images() = $image;
        }

        $this->design->setDesignTheme($currentTheme);
        $productRender->setImages($images);
    }

    /**
     * Callback for emulating image creation
     *
     * Callback in which we emulate initialize default design theme, depends on current store, be settings store id
     * from render info
     *
     * @param ProductInterface $product
     * @param string $imageCode
     * @param int $storeId
     * @param ImageInterface $image
     * @return MagentoCatalogHelperImage
     */
    public function emulateImageCreating(ProductInterface $product, $imageCode, $storeId, ImageInterface $image)
    {
        $this->storeManager->setCurrentStore($storeId);
        $this->designLoader->load();

        $imageHelper = $this->imageFactory->create();
        $imageHelper->init($product, $imageCode);
        $image->setUrl($imageHelper->getUrl());
        return $imageHelper;
    }
}

Help kindly !!!

[VIP] Earn $ 2,000 in 2020 with the private Pinterest method

[IMG]

Sales page: https://buysellmethods.com/pinty-2000-monthly-in-year-2020-with-private-pinterest-method

Download link:
https://www.lub.me/p/th6.html

statistics – Limit difference – Delta vs. method Slutsky

Let $ (X, Y) $ be normal bivariate distributed and
$$
S_X ^ 2 = sum_i (X_i – bar {X}) ^ 2 \
S_Y ^ 2 = sum_i (Y_i – bar {Y}) ^ 2.
$$

Now i want to derive the limit of
$$
T_n: = left ( sqrt {n} left ( frac { bar {X}} {S_X} – frac { mu_X} { sigma_X} right), sqrt {n} left ( frac { bar {Y}} {S_Y} – frac { mu_X} { sigma_Y} right) right).
$$

then
$$
lim_ {n to infty} T_n = N (0, Sigma).
$$

The multivariate delta method would tell me that
$$
Sigma =
begin {pmatrix}
1 + frac { mu_X ^ 2} {2 sigma_X ^ 2} & rho + frac { rho ^ 2 mu_X mu_Y} {2 sigma_Y sigma_X} \
rho + frac { rho ^ 2 mu_X mu_Y} {2 sigma_Y sigma_X} & 1 + frac { mu_Y ^ 2} {2 sigma_Y ^ 2}
end {pmatrix}
$$

while I would expect Slutsky's theorem
$$
Sigma =
begin {pmatrix}
1 & rho \
rho & 1
end {pmatrix}.
$$

Where is the error in my thinking?

design – How to avoid changing dozens of classes and interfaces when adding an argument to a method used in dozens of classes and interfaces?

On several occasions, I have been faced with the following design problem that I don't know how to solve. Imagine, for example, an application that at some point receives a JSON object from an API. Before you can use this object, the application must perform several transformations: for example, a transformation can convert dates from one format to another, and another transformation can add additional data from the cache ( as an entity describing a user, based on a unique user ID from the original object).

In order to be able to choose the transformations to be applied at runtime, the transformations are defined in specific classes, such as DateFormatTransform and ExtraDataFromCacheTransform.

Basically, the code that performs the transformation would be like this:

foreach (var transform in this.GetRelevantTransforms())
{
    entity = transform.Apply(entity);
}

this.GetRelevantTransforms would return an instance of DateFormatTransform, ExtraDataFromCacheTransform and other classes. Each of these classes implements an interface containing the method:

SampleEntity Apply(SampleEntity x)

Later, additional needs may arise, requiring to change the signature Apply. For example, you may need transformations to know the current user, because depending on the user, some transformations can be performed differently:

SampleEntity Apply(SampleEntity x, User currentUser)

The problem is that in the meantime, I can have a few dozen transformations, and such a basic modification would require browsing through these dozens of files, changing both the interface (like IDateFormatTransform) and class (as DateFormatTransform).

I guess having to change around fifty files just to add a single argument is not a sign of a clean code base.

What are the alternatives?

Should I use a DTO, such as TransformArguments, which would always be the only parameter of Apply method? Or are there other techniques?

Or is my approach with a set of transformations flawed from the beginning, and if so, how can I fix it?

[Unique HQ Method] Earn $ 1,000 / month with 10-15 minutes of work LEGIT – No Investment – PROOF OF GAIN | NewProxyLists

Anyone who wants to make it BIG online but have little or no start up cash, this little method is for you as it requires a ZERO INVESTMENT.

I can say that this unique method will work for anyone who tries, even noobs or lazy guys like me.

It does not need any piece of identity, no verification, no investment and you can start making money from the day 1 or 2 himself

Win the proof

[IMG]

Method:

Hidden content:

You must answer before you can see the hidden data contained here.

shipping – Magento2: payment method for a page

By default, guest payment in Magento is enabled and visitors can place an order without registering on the website. Some websites require a mandatory login to place orders, and this default feature must be disabled to prohibit the payment of guests.

cking

How to return a query from one method to another in PHP Laravel?

I need to pass a query that is in a method to another method that receives it, you probably think about it:

public function query($document)
{
    $query = Tabla::select('*')->where('codemp', '=', $document)->first();
    return $query
}

public function recibe()
{
    $consulta = $this->query();
    dd($consulta);
}

The above is an example, this is not my query, the query that I have is very extensive and it is not worth showing it for the solution I need. Well, the detail here is that as the previous query does not work because the method first () laravel transforms the request into an object, and the return try to return a string because it hosts an error saying that an object can not be returned, and then try to convert the request to a JSON and return it to the other method as json but as json, i can not browse it for function which is already set to send data to a PDF.

In conclusion, what I need is to return this request with first () to browse later each extracted field as:

$query->id;

I appreciate help in advance …

c # – How to refactor a typical DataAccess layer method with the ADO.NET model in SqlReader mappings

Here is an example of a method that I intend to refactor:

 public CustomReturn < List < ParkingSlipDetails >> GetAllParkingSlips(int offset, int fetch)
{
    SqlConnection sqlConnection = null;
    try
    {
        List < ParkingSlipDetails > ParkingSlipDetailsList = new List < ParkingSlipDetails > ();
        sqlConnection = (SqlConnection) sqlHelper.CreateConnection(); //sqlHelper is a nugget and not in my control
        sqlConnection.Open();
        SqlCommand cmd = new SqlCommand(Constants.GetAllParkingSlips, sqlConnection);
        cmd.CommandType = System.Data.CommandType.StoredProcedure;
        cmd.Parameters.Add("@CreatedBy", SqlDbType.NVarChar).Value = gepservice.GetUserContext().UserId;
        cmd.Parameters.Add("@OffsetRows", SqlDbType.NVarChar).Value = offset;
        cmd.Parameters.Add("@FetchRows", SqlDbType.NVarChar).Value = fetch;
        var refCountdr = (RefCountingDataReader) sqlHelper.ExecuteReader(cmd);
        var sqlDr = (SqlDataReader) refCountdr.InnerReader;
        if (sqlDr != null)
        {
            while (sqlDr.Read())
            {
                ParkingSlipDetails ParkingSlipDetails = new ParkingSlipDetails();
                ParkingSlipDetails.Id = Convert.ToInt32(sqlDr(FileUploadConstants.Id));
                ParkingSlipDetails.FileName = Convert.ToString(sqlDr(FileUploadConstants.FileName));
                ParkingSlipDetails.FileUri = Convert.ToString(sqlDr(FileUploadConstants.FileURI));
                ParkingSlipDetails.PONumber = Convert.ToString(sqlDr(FileUploadConstants.DocumentNumber));
                ParkingSlipDetails.UploadDate = Convert.IsDBNull(sqlDr(FileUploadConstants.UploadDate)) ? DateTime.UtcNow: Convert.ToDateTime(sqlDr(FileUploadConstants.UploadDate));
                ParkingSlipDetails.FileStatus = (Status)(Convert.ToInt16(sqlDr(FileUploadConstants.FileStatus)));
                ParkingSlipDetails.ReceiptNumber = Convert.ToString(sqlDr(FileUploadConstants.RecieptNumber).ToString());
                ParkingSlipDetails.TotalRows = Convert.ToInt32(sqlDr(FileUploadConstants.TotalRows));
                ParkingSlipDetails.CreatedBy = gepservice.GetUserContext().UserId;
                ParkingSlipDetailsList.Add(ParkingSlipDetails);
            }
        }
        return new CustomReturn < List < ParkingSlipDetails >> (ParkingSlipDetailsList);
    }
    catch(Exception ex)
    {
        LogError("ManageParkingSlipDataAccess", "GetAllParkingSlips", "Error", ex);
        return null
    }
    finally
    {
        if (sqlConnection != null)
        sqlConnection.Close();
    }
}

I think there is plenty of room for refactoring here as there are many places where I would repeat:

sqlConnection = (SqlConnection)sqlHelper.CreateConnection(); 
sqlConnection.Open();

and

var refCountdr = (RefCountingDataReader) sqlHelper.ExecuteReader(cmd);

var sqlDr = (SqlDataReader) refCountdr.InnerReader;
if (sqlDr != null) {
  while (sqlDr.Read())    
  {

  }
}