magento2 – Magento 2 – Aftert importing products with CSV number of products imported is wrong

I have imported products via CSV file upload using Magento 2 import. In total I have imported 50401 products.
I have a problem, the number of imported products is not equal to the number of found records I see in the CATALOG -> PRODUCTS section.

The following images explain better the problem:

CATEGORIES section in Magento backend

Select count products from database

PRODUCTS section in Magento backend

As you can see the number of products in the PRODUCTS section is 50551, more than the imported products. If I clean the cache or perform an index update, this number changes but it is never equal to the real number of products loaded.

Does anyone have any idea what happened? Thanks to all!

google sheets – How to add a date to a cell next to an cell with an imported value

In column A I have a value added each day from the tab/cell TOTAL/A1 by this script:

function dailyLog() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sourceSheet = ss.getSheetByName('TOTAL');
  var logSheet = ss.getSheetByName('TOTAL DIAGRAM');
  var lastRow = logSheet.getLastRow();
  // logSheet.getRange(lastRow + 1, 1).setValue(new Date());  // insert timestamp on the row below
  var range = sourceSheet.getDataRange();
  range.copyTo(logSheet.getRange(lastRow + 1, 1), {contentsOnly: true});
}

What I want is to have the date when it was added and I try to achieve that with the script:

function onEdit(e) {
  if (e.range.getSheet().getSheetName() == 'TOTAL CHAR' && e.range.getColumn() == 1) {
    e.range.offset(0,1).setValue(e.value.length>0 ? new Date() : '');
  }
}

But it is only adding a date when I manually put a value in a cell. If the script is adding a value there is no date added.

Can this be done in any other way, or can Script 1 add the date to a cell to the right if the added value, as it is today it is added below?

sharepoint online – Columns imported to new list from Excel do not appear in default form

I imported an Excel spreadsheet into a Sharepoint list. Only two of the columns actually appeared in the default edit form. The “Edit Columns” option doesn’t give me the ability to enable any other columns. If I add a column, it shows up in the form. Edit in Grid View also seems to work.

Is there a way to add these other Excel columns to the form without using PowerApps?

We are on Sharepoint Online, no idea what version.

I tried the “customize form” option with PowerApps, and it seemed to work, but when I went back to SP to test the form, it wanted me to start a trial subscription. I’m assuming that PowerApps isn’t something we have as an enterprise.

Posting only to verified imported Project Accounts ā€” šŸ‘‰ GSA SEO and Marketing Forum šŸ‘ˆ

Hi Sven,

Please, I have some verified accounts that have been steady for several months.

My problem is about using the import account feature of SER.

I might need some clearance here first.

1. Does SER import all the created accounts in a project or does it only import the ones with VERIFIED links?

2. If it imports all accounts, how does one ensure that it only imports accounts with verified links.

Since, I already have these accounts created, how do I FORCE SER to re-login into these accounts imported from the verified links of other projects.

I don’t want to use no new list or make SER to search for links to post to. I only want it to post these verified account links.

I would really appreciate your guidance in this respect.

c++ – Objects lose their individual positions and rotations when imported from FBX using Assimp

I am a newbie trying to learn DX11.

I successfully put my obj model into the program by using assimp.

Unfortunately, I cannot load the same model in fbx format correctly (both of them were exported from my 3DS Max 2014).

OBJ:

Screenshot of 3D model
FBX:

Screenshot of 3D model - all parts overlapping near the origin

It seems like that all the meshes in the file have been moved to (0, 0, 0) instead of their correct offset positions, and the rotations of these objects are also incorrect.

Here is the code I use:

bool Model::LoadModel(const std::string& filePath)
{
    Assimp::Importer importer;

    const aiScene* pScene = importer.ReadFile(filePath, aiProcess_Triangulate | aiProcess_JoinIdenticalVertices | aiProcess_ConvertToLeftHanded);
    //aiProcess_CalcTangentSpace | aiProcess_JoinIdenticalVertices |iProcess_SortByPType | aiProcess_Triangulate | aiProcess_ConvertToLeftHanded);
    if (pScene == nullptr)
        return false;

    ProcessNode(pScene->mRootNode, pScene);
    return true;
}

void Model::ProcessNode(aiNode* node, const aiScene* scene)
{
    for (UINT i = 0; i < node->mNumMeshes; i++) {
        aiMesh* mesh = scene->mMeshes(node->mMeshes(i));
        meshes.push_back(this->ProcessMesh(mesh, scene));
    }
    for (UINT i = 0; i < node->mNumChildren; i++) {
        ProcessNode(node->mChildren(i), scene);
    }
}

Mesh Model::ProcessMesh(aiMesh* mesh, const aiScene* scene)
{
    //Data to fill
    std::vector<Vertex>vertices;
    std::vector<DWORD>indices;

    for (UINT i = 0; i < mesh->mNumVertices; i++) {
        Vertex vertex;
        vertex.pos.x = mesh->mVertices(i).x;
        vertex.pos.y = mesh->mVertices(i).y;
        vertex.pos.z = mesh->mVertices(i).z;

        if (mesh->mTextureCoords(0)) {
            vertex.texCoord.x = (float)mesh->mTextureCoords(0)(i).x;
            vertex.texCoord.y = (float)mesh->mTextureCoords(0)(i).y;
        }
        vertices.push_back(vertex);
    }

    for (UINT i = 0; i < mesh->mNumFaces; i++) {
        aiFace face = mesh->mFaces(i);

        for (UINT j = 0; j < face.mNumIndices; j++)
            indices.push_back(face.mIndices(j));
    }

    return Mesh(device, deviceContext, vertices, indices);
}

magento2.4 – Can’t see (imported) configurable products in catalog or search

I may need help…
If I manually create a configurable product I see it fine in the frontend.

However when I import products from stock with my homemade script, they don’t show up.
On my backend all seems fine and the product is just right, even associated products are correctly addressed.
The associated simple products are fine too, when I set them to be visible they are ok and I can see them in the catalog and work fine.

My (LONG VERSION) import script (don’t judge me for bad programming pratice pls):

use MagentoFrameworkAppBootstrap;

error_reporting(E_ALL);
ini_set("display_errors", 1);

require __DIR__ . '/../app/bootstrap.php';
if (! isset($_POST))
    exit();

$params = $_SERVER;
$bootstrap = Bootstrap::create(BP, $params);
$objectManager = $bootstrap->getObjectManager();
$state = $objectManager->get('MagentoFrameworkAppState');
$state->setAreaCode('frontend');

$context = $objectManager->get('MagentoFrameworkAppHelperContext');
$attributeRepository = $objectManager->get('MagentoCatalogApiProductAttributeRepositoryInterface');
$tableFactory = $objectManager->get('MagentoEavModelEntityAttributeSourceTableFactory');
$attributeOptionManagement = $objectManager->get('MagentoEavApiAttributeOptionManagementInterface');
$optionLabelFactory = $objectManager->get('MagentoEavApiDataAttributeOptionLabelInterfaceFactory');
$optionFactory = $objectManager->get('MagentoEavApiDataAttributeOptionInterfaceFactory');
$registry = $objectManager->get('MagentoFrameworkRegistry');
$registry->register('isSecureArea', true);

$productRepository = $objectManager->get('MagentoCatalogApiProductRepositoryInterface');
$associatedIdMap = new stdClass();
$nameSkuMap = new stdClass();
$attributGustoMap = new stdClass();
$attributeValues;


function getAttribute($attributeCode)

{
    global $attributeRepository;
    return $attributeRepository->get($attributeCode);
}

function createOrGetId($attributeCode, $label)
{
    if (strlen($label) < 1) {
        throw new MagentoFrameworkExceptionLocalizedException(__('Label for %1 must not be empty.', $attributeCode));
    }
    global $attributGustoMap;
    global $optionLabelFactory;
    global $optionFactory;
    global $attributeOptionManagement;
    // Does it already exist?
    $optionId = getOptionId($attributeCode, $label);

    if (! $optionId) {
        // If no, add it.
        $optionLabel = $optionLabelFactory->create();
        $optionLabel->setStoreId(0);
        $optionLabel->setLabel($label);

        $option = $optionFactory->create();
        $option->setLabel($label);
        $option->setStoreLabels((
            $optionLabel
        ));
        $option->setSortOrder(0);
        $option->setIsDefault(false);

        $attrId = getAttribute($attributeCode)->getAttributeId();

        $attributeOptionManagement->add(MagentoCatalogModelProduct::ENTITY, '157', $option);

        // Get the inserted ID. Should be returned from the installer, but it isn't.
        $optionId = getOptionId($attributeCode, $label, true);
        $attributGustoMap->$label = $optionId;
    }

    return $optionId;
}

function getOptionId($attributeCode, $label, $force = false)
{
    global $attributGustoMap, $attributeValues;

    if (property_exists($attributGustoMap, $label)) {
        return $attributGustoMap->$label;
    }
    $attribute = getAttribute($attributeCode);

    global $tableFactory;

    // Build option array if necessary
    if ($force === true || ! isset($attributeValues($attribute->getAttributeId()))) {

        $attributeValues($attribute->getAttributeId()) = ();

        // We have to generate a new sourceModel instance each time through to prevent it from
        // referencing its _options cache. No other way to get it to pick up newly-added values.

        $sourceModel = $tableFactory->create();
        $sourceModel->setAttribute($attribute);

        foreach ($sourceModel->getAllOptions() as $option) {
            $attributeValues($attribute->getAttributeId())($option('label')) = $option('value');
        }
    }

    // Return option ID if exists
    if (isset($attributeValues($attribute->getAttributeId())($label))) {
        return $attributeValues($attribute->getAttributeId())($label);
    }

    // Return false if does not exist
    return false;
}

$name = $_FILES('file')('name');
$temp_name = $_FILES('file')('tmp_name');
if (isset($name) and ! empty($name)) {
    $location = './';
    if (move_uploaded_file($temp_name, $location . $name)) {
        $xml = simplexml_load_file($name, null, LIBXML_PARSEHUGE | LIBXML_NOWARNING);

        $deletedProductList = $xml->DeletedProducts->Product;
        $updateProductsList = $xml->UpdatedProducts->Product;
        $product;

        if (is_object($updateProductsList)) {
            for ($i = 0; $i < count($updateProductsList); $i ++) {
                $desc = $updateProductsList($i)->Description;
                $code = (string) $updateProductsList($i)->Code;
                $price = (float) $updateProductsList($i)->GrossPrice1;
                $brand = (string) $updateProductsList($i)->ProducerName;
                $qty = (int) $updateProductsList($i)->AvailableQty;
                try {
                    $product = $productRepository->get($code);
                } catch (Exception $e) {
                    $product = $objectManager->create('MagentoCatalogModelProduct');
                }
                $product->setSku($code);
                $product->setPrice($price);
                $product->setStockData(array(
                    'use_config_manage_stock' => 0, // 'Use config settings' checkbox
                    'manage_stock' => 1, // manage stock
                    'is_in_stock' => 1, // Stock Availability
                    'qty' => $qty // qty
                ));
                $notes = (string) $updateProductsList($i)->Notes;
                $scadenza = false;
                if (str_contains($notes, "--scadenza:")) {

                    $scadenza = explode("--scadenza:", $notes)(1);
                    $scadenza = trim($scadenza);
                    $scadenzaArray = explode("/", $scadenza);
                    if (count($scadenzaArray) == 3) {

                        $scadenza = $scadenzaArray(1) . '/' . $scadenzaArray(0) . '/' . $scadenzaArray(2);
                        $product->setCustomAttribute('scadenza', $scadenza);
                    }
                }
                
                //BRANDO MIO
                $existsbrand = GetBrandIdFromName($brand);
                if(!$existsbrand) {
                    $brid = createBrand($brand);
                } else {
                    $brid = $existsbrand;
                }
                
                if($hasbrand = HasBrand($product->getId())) {
                    $newbr = UpdateProdBrand($product->getId(), $brid);
                }
                else {
                    $newbr = NewProdBrand($product->getId(), $brid);
                }
                /////////

                if (! str_contains($desc, '--')) {
                    // simple
                    $product->setName($desc);
                    upsertProduct($product, 'simple');
                } else {
                    $prodName = explode('--', $desc)(0);
                    if (str_contains($desc, 'BASE')) {
                        // configurable
                        $product->setName($prodName);
                        $product = upsertProduct($product, 'configurable');
                        $nameSkuMap->$prodName = $code;
                    } else if (str_contains($desc, 'gusto:')) {
                        // associated
                        $product->setName($prodName);
                        $gustoAttrCode = $product->getResource()
                                         ->getAttribute("gusto")
                                         ->getAttributeCode();
                        $gustoId = createOrGetId($gustoAttrCode, trim(strtolower(explode('--gusto:', $desc)(1))));
                        $product->setGusto($gustoId);

                        $product = upsertProduct($product, 'simple', 1); 
                        $productId = $product->getId();
                        if (property_exists($associatedIdMap, $prodName)) {
                            $associatedIdArray = $associatedIdMap->$prodName;
                            array_push($associatedIdArray, $productId);
                        } else {
                            $associatedIdArray = array(
                                $productId
                            );
                        }
                        $associatedIdMap->$prodName = $associatedIdArray;
                    } else {
                        echo "unknown product type - " . $code . "n";
                        // unknown
                    }
                }
                

            }
        }
        foreach ($associatedIdMap as $productName => $prodAssocIds) {
            if (property_exists($nameSkuMap, $productName)) {
                updateAssociatedIds($nameSkuMap->$productName, $prodAssocIds);
            } else {
                echo "no base product - " . $productName . "n";
            }
        }
        if (is_object($deletedProductList)) {
            for ($i = 0; $i < count($deletedProductList); $i ++) {
                $code = $deletedProductList($i)->Code;
                try {
                    $product = $productRepository->get($code);
                    $productRepository->delete($product);
                } catch (Exception $e) {
                    echo "Cannot Delete - sku not exists - " . $code . "n";
                }
            }
        }
        echo "OK";
    } else {
        echo 'not uploaded';
    }
} else {
    echo 'You should select a file to upload !!';
}

////////////////////////////
function updateAssociatedIds($code, $productIds)
{
    global $productRepository;
    $product = $productRepository->get($code);
    $product_resource = $product->getResource();
    $gusto_attribute = $product_resource->getAttribute('gusto');
    $gusto_attribute_id = $gusto_attribute->getId();
    $configurable_attributes = array(
        'gusto'
    );
    $product->getTypeInstance()->setUsedProductAttributeIds(array(
        $gusto_attribute_id
    ), $product);

    $configurable_attributes_data = $product->getTypeInstance()->getConfigurableAttributesAsArray($product);
    $product->setCanSaveConfigurableAttributes(true);
    $product->setConfigurableAttributesData($configurable_attributes_data);

    $product->setAssociatedProductIds($productIds);

    $product->save();
}

////////////////////////////
function upsertProduct($product, $type, $visibility = 4)
{
    $product->setTypeId($type)
        ->setStatus(1)
        ->
    // 1 = enabled, 2 = disabled
    setAttributeSetId(4)
        ->
    // 4 = default
    setTaxClassId(2)
        ->
    // 0 = None, 2 = Default product tax class
    setCategoryIds(array(
        2
    ))
        ->
    // 2 = Default category
    setWebsiteIds(array(
        1
    ))
        ->
    // 1 = Default Website ID
    setStoreId(0)
        ->setUrlKey($product->getSku())
        ->
    // 0 = Default store ID
    setVisibility($visibility); // 4 = Catalog & Search

    $product->save();

    return $product;
}

//////////////////
function GetBrandIdFromName($brname) {
    $servername = "SERVER";
    $username = "USER";
    $password = "PW";
    $conn = new mysqli($servername, $username, $password);
    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    }
    
    $stmt = $conn->prepare("SELECT brand_id FROM magento.tm_brand WHERE name = ?");
    $param = "$brname";
    $stmt->bind_param("s", $param);
    $stmt->execute();
    $stmt->store_result();
    $stmt->bind_result($brid);
    $rez = null;
    while($stmt->fetch()){
        $rez = $brid;
    }
    $stmt->close();
    $conn->close();
    
    return $rez;
}

//////////////////
function createBrand($brname) {
    $urlkey = str_replace(" ", "-", $brname);
    $urlkey = str_replace(""", "", $urlkey);
    $urlkey = str_replace("'", "", $urlkey);
    $urlkey = strtolower($urlkey);
    
    $servername = "SERVER";
    $username = "USER";
    $password = "PW";
    $conn = new mysqli($servername, $username, $password);
    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    }
    
    $stmt = $conn->prepare("INSERT INTO magento.tm_brand (name, status, url_key, title, website_id) VALUES (?, 1, ?, ?, 1)");
    $stmt->bind_param("sss", $brname, $urlkey, $brname);
    $stmt->execute();
    $rinsid = $stmt->insert_id;
    $stmt->close();
    $conn->close();
    
    return $rinsid;
}


//////////////////
function HasBrand($prid) {
    $servername = "SERVER";
    $username = "USER";
    $password = "PW";
    $conn = new mysqli($servername, $username, $password);
    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    }
    
    $stmt = $conn->prepare("SELECT value FROM magento.catalog_product_entity_int  where attribute_id = 150 AND entity_id = ?");
    $stmt->bind_param("i", $prid);
    $stmt->execute();
    $stmt->store_result();
    $stmt->bind_result($bid);
    $rez = null;
    while($stmt->fetch()){
        $rez = $bid;
    }
    $stmt->close();
    $conn->close();
    
    return $rez;
}

//////////////////////////
function UpdateProdBrand($prid, $brid) {
    $servername = "SERVER";
    $username = "USER";
    $password = "PW";
    $conn = new mysqli($servername, $username, $password);
    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    }
    
    $stmt = $conn->prepare("UPDATE magento.catalog_product_entity_int SET value = ? WHERE entity_id = ?; ");
    $stmt->bind_param("ii", $brid, $prid);
    $stmt->execute();
    $rr = $stmt->affected_rows;
    $stmt->close();
    $conn->close();
    
    return $rr;
}

////////////////////////////
function NewProdBrand($prid, $brid) {
    $servername = "SERVER";
    $username = "USER";
    $password = "PW";
    $conn = new mysqli($servername, $username, $password);
    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    }
    
    $stmt = $conn->prepare("INSERT INTO magento.catalog_product_entity_int (attribute_id, store_id, entity_id, value) VALUES (150, 0, ?, ?); ");
    $stmt->bind_param("ii", $prid, $brid);
    $stmt->execute();
    $rr = $stmt->affected_rows;
    $stmt->close();
    $conn->close();
    
    return $rr;
}

java – Android studio Application Stops responding when image is imported manually from Gallery or Camera app

So my application is an Image to text and text-to-speech app. The idea is to scan text from any source and it is read out to the user. The basic functionality of the app is working, when I click on “Capture Image” on the main screen, it opens the camera, takes a pic, and extracts text. But I also added another function where the user can manually add pictures from his gallery by clicking on the gallery icon.

So the problem is when I select the gallery and choose my own image, it won’t add to the main image view canvas, instead, it crashes the application. There is no error in the code, but it just won’t run.

Here are 20-second clips I have attached on Google Drive to show you the precise problem for a better understanding for you all. Iā€™m very close! APP LOGCAT ERROR MESSAGE IN THE BOTTOM

https://drive.google.com/drive/folders/18oCeFkVEvi1xPv_O4DEI3EZz0TtVyZ36?usp=sharing

Kindly please let me know what the problem is, as Android studio does not give any warnings or errors when the project is run. By crashing I meant, it gives the message “app not responding” error message.

MainActivity.Java

package com.example.textrecognition;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;

import android.Manifest;
import android.content.ContentValues;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.os.PersistableBundle;
import android.provider.MediaStore;
import android.speech.tts.TextToSpeech;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import java.lang.Object;
import java.util.Locale;


import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.ml.vision.FirebaseVision;
import com.google.firebase.ml.vision.common.FirebaseVisionImage;
import com.google.firebase.ml.vision.text.FirebaseVisionText;
import com.google.firebase.ml.vision.text.FirebaseVisionTextRecognizer;
import com.theartofdev.edmodo.cropper.CropImage;
import com.theartofdev.edmodo.cropper.CropImageView;

public class MainActivity extends AppCompatActivity implements TextToSpeech.OnInitListener {
    ImageView imageView;
    TextView textView;
    private TextToSpeech engine;


    //Action Bar Menu
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        //Inflate Menu 
        getMenuInflater().inflate(R.menu.menu_main, menu);
        return true;

    }

    //Handle Action Bar clicks
    @Override
    public boolean onOptionsItemSelected(@NonNull MenuItem item) {
        int id = item.getItemId();
        if (id == R.id.addImage) {
            showImageImportDialog();
        }
        if (id == R.id.settings) {
            Toast.makeText(this, "Settings", Toast.LENGTH_SHORT).show();
        }
        return super.onOptionsItemSelected(item);
    }

    private void showImageImportDialog() {
        //Options or Items displayed in dialog once it is clicked

        String() items = {"Camera", "Gallery"};
        AlertDialog.Builder dialog = new AlertDialog.Builder(this);

        //Set TITLE
        dialog.setTitle("Select Image");

        dialog.setItems(items, new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                if (which == 0) {
                    //Camera Option Clicked
                    if (!checkCameraPermission()) {
                        ///Camera permission is not allowed, thats why we request it here
                        requestCameraPermission();
                    } else {
                        //Permission allowed, take picture
                        pickCamera();
                    }
                }

                if (which == 1) {
                    //Gallery Option Clicked
                    if (!checkStoragePermission()) {
                        //Storage Permissions Granted
                        requestStoragePermission();
                    } else {
                        //Permission allowed, take picture
                        pickGallery();
                    }
                }
            }
        });
        dialog.create().show(); //SHOW DIALOG
    }

    private void pickGallery() {
        //Intent to Pick image from gallery
        Intent intent = new Intent(Intent.ACTION_PICK);
        //Set intent type to image
        intent.setType("image/*");
        startActivityForResult(intent, IMAGE_PICK_GALLERY_CODE);

        int GET_FROM_GALLERY = 3;
        startActivityForResult(new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI), GET_FROM_GALLERY);
    }

    private void pickCamera() {
        //Takes Image from Camera and saves it in storage for HIGH QUALITY
        ContentValues values = new ContentValues();
        values.put(MediaStore.Images.Media.TITLE, "NewPic"); //TITLE OF THE PIC

        values.put(MediaStore.Images.Media.DESCRIPTION, "Images to text"); //Description
        image_uri = getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);

        Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, image_uri);
        startActivityForResult(cameraIntent, IMAGE_PICK_CAMERA_CODE);

    }

    private void requestStoragePermission() {
        ActivityCompat.requestPermissions(this, storagePermission, STORAGE_REQUEST_CODE);
    }

    private boolean checkStoragePermission() {
        boolean result = ContextCompat.checkSelfPermission(this,
                Manifest.permission.WRITE_EXTERNAL_STORAGE) == (PackageManager.PERMISSION_GRANTED);
        return result;
    }

    private void requestCameraPermission() {
        ActivityCompat.requestPermissions(this, cameraPermission, CAMERA_REQUEST_CODE);
    }

    private boolean checkCameraPermission() {

        boolean result = ContextCompat.checkSelfPermission(this,
                Manifest.permission.CAMERA) == (PackageManager.PERMISSION_GRANTED);

        boolean result1 = ContextCompat.checkSelfPermission(this,
                Manifest.permission.WRITE_EXTERNAL_STORAGE) == (PackageManager.PERMISSION_GRANTED);
        return result && result1;

    }
    //Also add gallery permission.


    EditText mResultEt;
    ImageView mPreviewIv;

    ///******So why are these specific codes used bro*******RESEARCH******
    private static final int CAMERA_REQUEST_CODE = 200;
    private static final int STORAGE_REQUEST_CODE = 400;
    private static final int IMAGE_PICK_GALLERY_CODE = 1000;
    private static final int IMAGE_PICK_CAMERA_CODE = 1001;


    String cameraPermission();

    String storagePermission();
    Uri image_uri;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        engine = new TextToSpeech(this, this);

//        mResultEt = findViewById(R.id.textId);
        mPreviewIv = findViewById(R.id.imageId);

        //camera permission
        cameraPermission = new String(){Manifest.permission.CAMERA,
                Manifest.permission.WRITE_EXTERNAL_STORAGE};

        //Storage Permission
        storagePermission = new String(){Manifest.permission.WRITE_EXTERNAL_STORAGE};


        //Find Image view
        imageView = findViewById(R.id.imageId);
        //Find text view
        textView = findViewById(R.id.textId);

        //check app level permission is granted for camera
        if (checkSelfPermission(Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
            //Grants Permission and Prompts User
            requestPermissions(new String(){Manifest.permission.CAMERA}, 101);

        }
    }

    //    TextToSpeech tts;
    public void doProcess(View view) {

        //Open Camera in Phone. Intent object is created to open camera once the capture image button is clicked
        Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

        //Activity result specifically used to continue using the app post taking pic
        startActivityForResult(intent, 101);

    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data)
    { if(resultCode == RESULT_OK) {
        super.onActivityResult(requestCode, resultCode, data);

//        if(requestCode == IMAGE_PICK_CAMERA_CODE) {
//            //Crops Image
//            CropImage.activity(data.getData()).setGuidelines(CropImageView.Guidelines.ON)
//                    .start(this);
//        }
//        if(requestCode == IMAGE_PICK_GALLERY_CODE) {
//            //Image received from gallery now cropped
//            CropImage.activity(image_uri)
//                    .setGuidelines(CropImageView.Guidelines.ON) //Enabled image guidelines
//                    .start(this);
//        }
//    }
//    if(requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) {
//        CropImage.ActivityResult result = CropImage.getActivityResult(data);
    }
//    else if(resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) {
//        Exception error = mResultEt.getError();
//    }
//        mResultEt.setText(getSupportActionBar().toString());





        Bundle bundle = data.getExtras();

        //From bundle extract image
        Bitmap bitmap = (Bitmap) bundle.get("data");

        //Set Image In ImageView
        imageView.setImageBitmap(bitmap);

        //Now we process image to extract text using Google ML Kit//

        //Create a firebase vision object
        FirebaseVisionImage firebaseVisionImage = FirebaseVisionImage.fromBitmap(bitmap);
        //2ndStep Get an Instance of FirebaseVision
        FirebaseVision firebaseVision = FirebaseVision.getInstance();

        //3rd Create an instance of firebasevision text recognizer
        FirebaseVisionTextRecognizer firebaseVisionTextRecognizer = firebaseVision.getOnDeviceTextRecognizer();

        //4Th Step Create a task to process the image
        Task<FirebaseVisionText> task = firebaseVisionTextRecognizer.processImage(firebaseVisionImage);

        //5th Step, if task is successful


        task.addOnSuccessListener(new OnSuccessListener<FirebaseVisionText>() {
            @Override
            public void onSuccess(FirebaseVisionText firebaseVisionText) {
                String s = firebaseVisionText.getText();
                textView.setText(s);

                //Conversion of text to speech
                String rawText = String.valueOf(textView.getText());

                speakText(rawText);
                ;               /* tts = new TextToSpeech(getApplicationContext(), new TextToSpeech.OnInitListener() {
                    @Override
                    public void onInit(int i) {
                        if (i == TextToSpeech.SUCCESS) {
                            //SELECTING LANGUAGE
                            int lang = tts.setLanguage(Locale.ENGLISH);

                        }
                    }
                });*/


            }


        });

        //6th. If task is failed
        task.addOnFailureListener(new OnFailureListener() {
            @Override
            public void onFailure(@NonNull Exception e) {
                Toast.makeText(getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show();
            }
        });

    }

    public void speakText(String textContents) {

        //String textContents = text.getText().toString();
        engine.speak(textContents, TextToSpeech.QUEUE_FLUSH, null, null);

    }

    @Override
    protected void onPostCreate(@Nullable Bundle savedInstanceState) {
        super.onPostCreate(savedInstanceState);
    }

    @Override
    public void onInit(int i) {


        if (i == TextToSpeech.SUCCESS) {
            //Setting speech Language
            engine.setLanguage(Locale.ENGLISH);
            engine.setPitch(1);
        }
    }

    ///Handle Permission Result
    @Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String() permissions, @NonNull int() grantResults) {
        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
        switch (requestCode) {
            case CAMERA_REQUEST_CODE:

                if (grantResults.length > 0) {
                    boolean cameraAccepted = grantResults(0) ==
                            PackageManager.PERMISSION_GRANTED;
                    //Changed from 0 to 1
                    boolean writeStorageAccepted = grantResults(1) ==
                            PackageManager.PERMISSION_GRANTED;

                    if (cameraAccepted && writeStorageAccepted) {
                        pickCamera();
                    } else {
                        Toast.makeText(this, "permission denied", Toast.LENGTH_SHORT).show();

                    }
                }
                break;

            case STORAGE_REQUEST_CODE: {
                boolean writeStorageAccepted = grantResults(0) ==
                        PackageManager.PERMISSION_GRANTED;
                if (writeStorageAccepted) {
                    pickGallery();
                } else {
                    Toast.makeText(this, "permission denied", Toast.LENGTH_SHORT).show();

                }
            }
            break;

        }


    }


}

Activity_MainXML

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".MainActivity">

    <!-- Added scroll view, made sure scroll view has only one child in it. Very time consuming -->
    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:ignore="UselessParent">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            tools:ignore="UselessLeaf" >
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Image Preview:"
                android:verticalScrollbarPosition="defaultPosition"
                android:textColor="@color/design_default_color_primary_dark"
                android:textSize="22sp"
                tools:ignore="HardcodedText">

            </TextView>


            <ImageView

                android:id="@+id/imageId"
                android:layout_width="353dp"
                android:layout_height="368dp"
                android:layout_margin="26dp" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="63dp"
                android:onClick="doProcess"
                android:text="Capture Image" />

            <TextView
                android:id="@+id/textId"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Result:"
                android:textColor="@color/design_default_color_primary_dark"
                android:textSize="22sp" />


        </LinearLayout>
    </ScrollView>

</LinearLayout>

AndroidManifest XML


<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.textrecognition">

    <!-- User Permissions to give access to camera -->
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>


    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="Dream Eye Text Recognizer"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.TextRecognition">
        <activity android:name=".SplashScreen">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity
            android:name=".ui.login.LoginActivity"
            android:label="@string/title_activity_login" />

        <meta-data
            android:name="com.google.firebase.ml.vision.DEPENDENCIES"
            android:value="ocr" />

        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

        <!-- Crop image Activity  -->
        <activity android:name="com.theartofdev.edmodo.cropper.CropImageActivity"
            android:theme="@style/Base.Theme.AppCompat"/> <!-- or AppTheme optional (needed if default theme has no action bar) -->

    </application>

</manifest>

*Build Gradle.App

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {

        classpath "com.android.tools.build:gradle:4.1.1"
        classpath 'com.google.gms:google-services:4.3.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

LOGCAT REPORT WHEN APP CRASHES

2021-07-17 17:01:38.730 18758-18758/com.example.textrecognition E/AndroidRuntime: FATAL EXCEPTION: main
   Process: com.example.textrecognition, PID: 18758
   java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=3, result=-1, data=Intent { dat=content://media/external/images/media/306689 flg=0x1 (has extras) }} to activity {com.example.textrecognition/com.example.textrecognition.MainActivity}: java.lang.NullPointerException: null reference
       at android.app.ActivityThread.deliverResults(ActivityThread.java:4610)
       at android.app.ActivityThread.handleSendResult(ActivityThread.java:4652)
       at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:49)
       at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1948)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:214)
       at android.app.ActivityThread.main(ActivityThread.java:7050)
       at java.lang.reflect.Method.invoke(Native Method)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)
    Caused by: java.lang.NullPointerException: null reference
       at com.google.android.gms.common.internal.Preconditions.checkNotNull(Unknown Source:2)
       at com.google.firebase.ml.vision.common.FirebaseVisionImage.<init>(com.google.firebase:firebase-ml-vision@@24.0.1:40)
       at com.google.firebase.ml.vision.common.FirebaseVisionImage.fromBitmap(com.google.firebase:firebase-ml-vision@@24.0.1:3)
       at com.example.textrecognition.MainActivity.onActivityResult(MainActivity.java:259)
       at android.app.Activity.dispatchActivityResult(Activity.java:7762)
       at android.app.ActivityThread.deliverResults(ActivityThread.java:4603)
       at android.app.ActivityThread.handleSendResult(ActivityThread.java:4652) 
       at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:49) 
       at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) 
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) 
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1948) 
       at android.os.Handler.dispatchMessage(Handler.java:106) 
       at android.os.Looper.loop(Looper.java:214) 
       at android.app.ActivityThread.main(ActivityThread.java:7050) 
       at java.lang.reflect.Method.invoke(Native Method) 
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)

google sheets – Compare imported range with existing range, and filling corresponded data to the fields

Please help!
Google Sheets, query. Not sure how to import data to corresponding cells.
query(IMPORTDATA(“https://www.iftach.org/taxmatrix/charts/4Q2020.csv”), “Select Col4 where Col1 = ‘”&A4:A&”‘”))
Where range A4:A is a list of the states

This one works fine
query(IMPORTDATA(“https://www.iftach.org/taxmatrix/charts/3Q2020.csv”), “Select Col4 where Col1 is not null and Col1<>’44013′”) (it’s just give me some extra line with text 44013). but it just imports data. I need to import this data, but checking first A4:A.

If you can help me, I would be really happy.

custom attributes – Additional Data is not being imported into produces (full imports and focus additional data imports)

FIRSTLY I should note that all product data is importing correctly except the additional_attributes column.

I’ve been struggling for the past few hours with getting additional data imported into my products. I have succeeded in importing products into Magento however none of my custom additional data is being imported. I’ve looked on this forum and other places for guidance and tried a multitude of solutions including importing data with only the product sku and additional data however this hasn’t been successful.

The additional attributes work as intended, values can be inputted in the additional attributes under the product and the persist after a reload and are stored in the database. However when attempting to load the min from a CSV it is unsuccessful.

I’ve tried to export and import an existing product (deleting the exported product before importing) without making a single change to the CSV file but this is still failing to import the additional data.

Would appreciate any potential solutions or guidance to fix this issue as I have a CSV of over 1000 products that need to be imported and I don’t want to have to fill out the custom data for every single product.

Example data:

sku,additional_attributes
TN9BIXJY,JMP_CROWN_NUMBER=MB394

Upon reviewing both System.log and Debug.log there is no signs of any errors occurring during the import.