typed – Send form and transform model to match the backend

I have a different model in frontend and backend. When I submit the form in the interface, I need to transform that object to match the background model. Is there a better way than this?

submit(confirmed: boolean) {
    this.transformCreditCardModel(confirmed);
    this.dialogRef.close({
      success: confirmed,
      productAdjustment: confirmed === true ? this.exposuresForm.value : null
    });
  }

  private transformCreditCardModel(confirmed: boolean) {
    const product = this.exposuresForm.value;
    if (confirmed && product.hasOwnProperty(ExposuresFieldNamesEnum.creditCardProductIdentification)) {
      const prefix = product.creditCardProductIdentification.accountPrefix;
      const number = product.creditCardProductIdentification.accountNumber;
      delete product.creditCardProductIdentification.accountNumber;
      delete product.creditCardProductIdentification.accountPrefix;
      product.creditCardProductIdentification.cardNumber = prefix + this.CREDIT_CARD_MASK + number;
    }
  }

I don't like the part where I ask if the object contains any property, if so, and then I create a new one and delete the previous one. Is there a better way to do this?

smtp: ssmtp error when trying to send emails

I am trying to send emails from the command line because I need to create a shell script later to send an email.

This is my configuration:

#
# Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
 root=service@domain.org

# The place where the mail goes. The actual machine name is required no
# MX records are consulted. Commonly mailhosts are named mail.domain.com
mailhub=smtp.office365.com:587
AuthUser=service@domain.org
AuthPass=Welcome@1
UseTLS=YES
UseSTARTTLS=YES

# Where will the mail seem to come from?
rewriteDomain=domain.org

# The full hostname
hostname=VMDevTG.domain.com.mx

# Are users allowed to set their own From: address?
# YES - Allow the user to specify their own From: address
# NO - Use the system generated From: address
FromLineOverride=YES

When I run:

ssmtp service@domain.org

and add the email

To:myemail@domain.com
From:service@domain.org
Subject:This is an sSMTP from LINUX!
I am testing sSMTP.

I got the following error:

ssmtp: 554 5.2.0 STOREDRV.Submission.Exception:SendAsDeniedException.MapiExceptionSendAsDenied; Failed to process message due to a permanent exception with message Cannot submit message. 0.35250:0A00AC80, 1.36674:0A000000, 1.61250:00000000, 1.45378:02000000, 1.44866:BC1C0000, 1.36674:0E000000, 1.61250:00000000, 1.45378:C11C0000, 1.44866:E6010000, 16.55847:490E0000, 17.43559:0000000004020000000000000100000000000000, 20.52176:140F6D880000101043050000, 20.50032:140F6D887017000000000000, 0.35180:48050000, 255.23226:0A00B180, 255.27962:0A000000, 255.27962:0E000000, 255.31418:0A00B280, 0.35250:0A000000, 1.36674:32000000, 1.61250:00000000, 1.45378:02000000, 1.44866:01000000, 16.55847:69000000, 17.43559:00000000E8020000000000000800000000000000, 20.52176:140F6D880000101061050000, 20.50032:140F6D887017000003000136, 0.35180:66050000, 255.23226:0A00B780, 255.27962:32000000, 255.17082:DC040000, 0.27745:0A00B880, 4.21921:DC040000, 255.27962:FA000000, 255.1494:0A00B980, 0.38698:0F010480, 0.37692:02000000, 0.37948:0F010480, 5.33852:00000000534D545000324300, 7.36354:010000000000010932324238, 4.56248:DC040000, 7.40748:010000000000010B36343638, 7.57132:000000000000000000000000, 1.63016:32000000, 4.39640:DC040000, 8.45434:ABB7F36F91A190499DCB54E2757EC97A00000000, 5.10786:0000000031352E32302E323135372E3030303A4D57485052323230314D42313432323A33636362643762342D643664342D343939352D623731302D6638633438356465626537380000000000, 255.1750:03000236, 255.31418:A2050000, 0.22753:0A00C280, 255.21817:DC040000, 4.60547:DC040000, 0.21966:0A00C380, 4.30158:DC040000 [Hostname=MWHPR2201MB1422.namprd22.prod.outlook.com]

Applications: any way to send battery statistics to a computer?

I am working for a company that has several Samsung Galaxy tablets in the field, we want a way to determine when their batteries are running out before they stop working completely. Ideally, we could send the data to our main office and analyze it there. It should be possible; We would only need an application that automatically sends the estimated duration of the upload to an email or something. Does anybody have any suggestions?

wallet recovery: the btc exchange CEX.10 cannot send my Bitcoins

Battery exchange network

The Stack Exchange network consists of 175 question and answer communities, including Stack Overflow, the largest and most reliable online community for developers to learn, share their knowledge and develop their careers.

Visit Stack Exchange

network: why does this user's Chrome browser send an ICMP type 3 package before accessing the web server?

Battery exchange network

The Stack Exchange network consists of 175 question and answer communities, including Stack Overflow, the largest and most reliable online community for developers to learn, share their knowledge and develop their careers.

Visit Stack Exchange

magento2: Magento 2 add-on to send emails when the customer group is changed

I created an add-on to send emails when the store owner changes the customer group in the backend. I still need to add the group (discount) in the email. The problem is that when I access a customer and change their group, they send me about 16 emails, the function that sends the email is afterSetGroupId(); so I don't understand why he sends me so many emails.

Here is my code:
SendDiscount.php plugin

public function afterSetGroupId(MagentoCustomerApiDataCustomerInterface $customer, $result)
    {
        //$groupId = $customer->getGroupId();
        //$this->sendYourCustomEmail($customer);


        /* Receiver Detail the person who is going to receive the info that user logged in*/
        $receiverInfo = (
            'name' => 'Admin',
            'email' => 'myemail@hotmail.com'
        );

        $store = $this->storeManager->getStore();

       $templateParams = ('store' => $store, 'administrator_name' => $receiverInfo('name'));

        $transport = $this->transportBuilder->setTemplateIdentifier(
            'phpcuong_transactional_email_customer_group'
        )->setTemplateOptions(
            ('area' => 'frontend', 'store' => $store->getId())
        )->addTo(
            $receiverInfo('email'), $receiverInfo('name')
        )->setTemplateVars(
            $templateParams
        )->setFrom(
            'general'
        )->getTransport();

        try {
            // Send an email
            $transport->sendMessage();
        } catch (Exception $e) {
            // Write a log message whenever get errors
            $this->logger->critical($e->getMessage());
        }


    }

This is my di.xml located in etc / adminhtml


    
        
    

php – Send form to email

THIS AND MY HTML CODE, I WOULD LIKE TO FILE THIS FORM IN MY EMAIL, I CAN'T MAKE THE CODE IN PHP!

Number of sofas

External keyboard: use a PC or laptop to send keystrokes to write on Android

The first user and I wanted to ask if there is a way to use my computer keyboard to type on my phone while it is plugged into the PC to charge. I was wondering if anyone here has a configuration like this.

The end result should be: I can connect my phone through a base or some other USB cable and switch between the windows of my PC to write on the Android device, or find an OTG device capable of charging and connecting a keyboard at the same time . This would not be ideal due to limited desk space.

You could connect a separate keyboard with an OTG cable, but this would prevent you from charging it while using it.

You could also use AutoHotkey or something similar to send keystrokes to the Android device via USB, but I'm not sure how this would affect loading or transferring files via USB. It could probably be done, but I don't know where to start.

Ideally, this would be the option you would use.

I have a very limited knowledge of Java and Kotlin, but if I had to, I could try to make a keyboard application and a simple program for Windows to switch between typing on the PC and on my phone. But I don't know if I can send that kind of data via USB and still move files to it.

I'm sorry if I didn't explain you correctly.

Mitch

Lightning Network: what are the advantages and disadvantages of preferring to send the last or oldest commitment?

Roasbeef mentioned on IRC that the Lightning specification allows a customer to assume that the last jointly signed commitment has been received by the counterpart or not. (as far as I understand that linked discussion. If I was wrong, edit the question)

For an implementation, what are the consequences of preferring to send the oldest joint signature or send the most recent joint signature? (both not revoked)