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 https://devdocs.magento.com/guides/v2.2/extension-dev-guide/attributes.html 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/store-api.silverwax.ca/httpdocs/vendor/magento/module-eav/Model/ResourceModel/Attribute.php:117 Stack trace: #0 /var/www/vhosts/store-api.silverwax.ca/httpdocs/vendor/magento/framework/Model/ResourceModel/Db/AbstractDb.php(832): Magento\Eav\Model\ResourceModel\Attribute->_afterSave(Object(Magento\Eav\Model\Entity\Attribute)) #1 /var/www/vhosts/store-api.silverwax.ca/httpdocs/vendor/magento/framework/Model/ResourceModel/Db/AbstractDb.php(419): Magento\Framework\Model\ResourceModel\Db\AbstractDb->processAfterSaves(Object(Magento\Eav\Model\Entity\Attribute)) #2 /var/www/vhosts/store-api.silverwax.ca/httpdocs/generated/code/Magento/Customer/Model/ResourceModel/Attribute/Interceptor.php(258): Magento\Framework\Model\ResourceModel\Db\AbstractDb->save(Object(Magento\Eav\Model\Entity\Attribute)) #3 /var/www/vhosts/store-api.silverwax.ca/httpdocs/app/code/Maru3l/SyncOrchestra/Setup/UpgradeData.php(68): Magento\Customer\Model\ResourceModel\Att in /var/www/vhosts/store-api.silverwax.ca/httpdocs/vendor/magento/module-eav/Model/ResourceModel/Attribute.php on line 117 {"messages":{"error":[{"code":500,"message":"Fatal Error: 'Uncaught Error: Call to a member function getId() on null in \/var\/www\/vhosts\/store-api.silverwax.ca\/httpdocs\/vendor\/magento\/module-eav\/Model\/ResourceModel\/Attribute.php:117\nStack trace:\n#0 \/var\/www\/vhosts\/store-api.silverwax.ca\/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\/store-api.silverwax.ca\/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\/store-api.silverwax.ca\/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\/store-api.silverwax.ca\/httpdocs\/app\/code\/Maru3l\/SyncOrchestra\/Setup\/UpgradeData.php(68): Magento\Customer\Model\ResourceModel\Att' in '\/var\/www\/vhosts\/store-api.silverwax.ca\/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="http://www.w3.org/2001/XMLSchema-instance" 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> 

Getting apt warnings when updating Ubuntu

I’m getting this error when running sudo apt update. I’m sure it’s something simple and have tried to check my sources.list and sources.list.d but can’t seem to make heads or tails of it. Thanks!

463 packages can be upgraded. Run 'apt list --upgradable' to see them. W: Skipping acquire of configured file 'main/binary-i386/Packages' as repository 'http://ppa.launchpad.net/gencfsm/ppa/ubuntu bionic InRelease' doesn't have the component 'main' (component misspelt in sources.list?) W: Skipping acquire of configured file 'main/binary-amd64/Packages' as repository 'http://ppa.launchpad.net/gencfsm/ppa/ubuntu bionic InRelease' doesn't have the component 'main' (component misspelt in sources.list?) W: Skipping acquire of configured file 'main/i18n/Translation-en_US' as repository 'http://ppa.launchpad.net/gencfsm/ppa/ubuntu bionic InRelease' doesn't have the component 'main' (component misspelt in sources.list?) W: Skipping acquire of configured file 'main/i18n/Translation-en' as repository 'http://ppa.launchpad.net/gencfsm/ppa/ubuntu bionic InRelease' doesn't have the component 'main' (component misspelt in sources.list?) W: Skipping acquire of configured file 'main/dep11/Components-amd64.yml' as repository 'http://ppa.launchpad.net/gencfsm/ppa/ubuntu bionic InRelease' doesn't have the component 'main' (component misspelt in sources.list?) W: Skipping acquire of configured file 'main/dep11/icons-48x48.tar' as repository 'http://ppa.launchpad.net/gencfsm/ppa/ubuntu bionic InRelease' doesn't have the component 'main' (component misspelt in sources.list?) W: Skipping acquire of configured file 'main/dep11/icons-64x64.tar' as repository 'http://ppa.launchpad.net/gencfsm/ppa/ubuntu bionic InRelease' doesn't have the component 'main' (component misspelt in sources.list?) W: Skipping acquire of configured file 'main/cnf/Commands-amd64' as repository 'http://ppa.launchpad.net/gencfsm/ppa/ubuntu bionic InRelease' doesn't have the component 'main' (component misspelt in sources.list?) W: Skipping acquire of configured file 'main/binary-i386/Packages' as repository 'http://ppa.launchpad.net/git-core/ppa/ubuntu bionic InRelease' doesn't have the component 'main' (component misspelt in sources.list?) W: Skipping acquire of configured file 'main/binary-amd64/Packages' as repository 'http://ppa.launchpad.net/git-core/ppa/ubuntu bionic InRelease' doesn't have the component 'main' (component misspelt in sources.list?) W: Skipping acquire of configured file 'main/i18n/Translation-en' as repository 'http://ppa.launchpad.net/git-core/ppa/ubuntu bionic InRelease' doesn't have the component 'main' (component misspelt in sources.list?) W: Skipping acquire of configured file 'main/i18n/Translation-en_US' as repository 'http://ppa.launchpad.net/git-core/ppa/ubuntu bionic InRelease' doesn't have the component 'main' (component misspelt in sources.list?) W: Skipping acquire of configured file 'main/dep11/Components-amd64.yml' as repository 'http://ppa.launchpad.net/git-core/ppa/ubuntu bionic InRelease' doesn't have the component 'main' (component misspelt in sources.list?) W: Skipping acquire of configured file 'main/dep11/icons-48x48.tar' as repository 'http://ppa.launchpad.net/git-core/ppa/ubuntu bionic InRelease' doesn't have the component 'main' (component misspelt in sources.list?) W: Skipping acquire of configured file 'main/dep11/icons-64x64.tar' as repository 'http://ppa.launchpad.net/git-core/ppa/ubuntu bionic InRelease' doesn't have the component 'main' (component misspelt in sources.list?) W: Skipping acquire of configured file 'main/cnf/Commands-amd64' as repository 'http://ppa.launchpad.net/git-core/ppa/ubuntu bionic InRelease' doesn't have the component 'main' (component misspelt in sources.list?) 

If I don’t travel on a UK visit visa and it expires, will it hurt my chances of getting a visa in the future?

I’m from Pakistan and I applied for a UK visitor visa for a company trip that got cancelled. However, my visa application was successful and I now have a valid 6-month visit visa to the United Kingdom. Now I hear from a bunch of people that if you don’t travel on a visitor visa to the UK and it expires, your chances of ever getting a visa to the UK again are almost nonexistent. I obviously cannot find any such thing on any official source. Can anybody here share what they know on whether that’s actually the case or not?

Thanks!

I need to alter Paragraphs field, but only text_format field type getting alter, Other field not getting alter

I need to alter Paragraphs field, but only text_format field type getting alter, Other field not getting alter in drupal 8

function mymodoule_field_widget_entity_reference_paragraphs_form_alter(&$  element, &$  form_state, $  context) {   if ($  element['#paragraph_type'] == 'text_and_counter_block') {     //echo '<pre>'; var_dump($  context);     //print_r($  element['paragraph__field_background_style']); exit();     $  element['subform']['field_two_column_title']['widget'][0]['#title'] = 'Altered title';     $  element['subform']['field_two_column_style']['widget'][0]['#title'] = 'Altered title';    } } 

Getting always the same Hash with Node.js and Multer

I’ve tried to change multer/storage/disk.js file so I can storage a hash everytime I upload a file, but the fact is that I’m always getting the same hash even uploading different files.

This is what I’ve done.

DiskStorage.prototype._handleFile = function _handleFile (req, file, cb) {    var that = this   var hash = crypto.createHash('sha256')    that.getDestination(req, file, function (err, destination) {     if (err) return cb(err)      that.getFilename(req, file, function (err, filename) {       if (err) return cb(err)        var finalPath = path.join(destination, filename)       var outStream = fs.createWriteStream(finalPath)        file.stream.pipe(outStream)       outStream.on('error', cb)       outStream.on('data', function (chunk) {         hash.update(chunk)       })        outStream.on('finish', function () {         cb(null, {           destination: destination,           filename: filename,           path: finalPath,           size: outStream.bytesWritten,           hash: hash.digest('hex')          })       })     })   }) } 

It’ s like this section isn’t doing anything

outStream.on('data', function (chunk) {         hash.update(chunk)       }) 

Getting weird characters (Chinese) when reading csv files with LibrOffice

I remember one of my colleagues sent me a csv file to check it.
I opened it using LibrOffice, it was too big so I had problems and could not open it (but I could open it using google docs on google drive).
After that, whenever I open a csv file, I get this:
enter image description here

I don’t know where the Chinese characters came from! But I can’t get rid of them.

when any csv file is opened, I get this:
enter image description here

And I am asked to download additional fonts. when I agree, I find no fonts to download.
I also tried to uninstall LibreOffice and install it again:

sudo apt-get purge fonts-opensymbol libreoffice libreoffice-\* openoffice.org-dtd-officedocument1.0 python\*-uno uno-libs3-\* ure ure-dbg sudo apt-get -s purge fonts-opensymbol libreoffice libreoffice-\* openoffice.org-dtd-officedocument1.0 python\*-uno uno-libs3-\* ure ure-dbg sudo apt-get remove --purge libreoffice* sudo apt-get clean sudo apt-get autoremove sudo add-apt-repository ppa:libreoffice/ppa sudo apt-get update sudo apt-get install libreoffice 

But it didn’t work!
Any suggestions please?

My Program is getting No responce at client.DetectDocumentText(image) GoogleVisionAPI

I am Trying to read a simple image but the Program is getting no response it just show the black console window. I waited for 10 mins and have followed all the steps.

I have debug the code it is getting the key file. but getting stuck at the response part.

using System; using Google.Cloud.Vision.V1;  namespace GoogleOCRConsole {     internal class Program     {         public static void Main(string[] args)         {             var image = Image.FromFile("D:/Chirag/Projects/GoogleOCRConsole/GoogleOCRConsole/GoogleOCRConsole/handwriting.png");             var client = ImageAnnotatorClient.Create();             var response = client.DetectDocumentText(image);             foreach (var page in response.Pages)             {                 foreach (var block in page.Blocks)                 {                     foreach (var paragraph in block.Paragraphs)                     {                         Console.WriteLine(string.Join("\n", paragraph.Words));                     }                 }             }         }     } } 

I am totally new to this Google API. I am using the google image for this https://cloud.google.com/vision/docs/images/detect_handwriting_OCR-detect-handwriting_SMALL.png

How to solve this ?