Categories
CMS Magento Mastering Development

Magento 2: Create product using rest API image upload not working

I have creating product using rest API but image upload not working. API: baseurl/rest/V1/products Method: POST Body: { "product": { "sku": "info", "name": "Info", "attribute_set_id": 4, "price": 1000, "status": 1, "custom_attributes": [ { "attribute_code": "category_ids", "value": ["41","42","43"] }, { "attribute_code": "description", "value": "Lorem Ipsum is simply dummy text of the printing and typesetting industry." }, […]

Categories
Mastering Development

Fast way to remove array of specific row values from 2D numpy array

I have a 2D array like this: a = np.array([[25, 83, 18, 71], [75, 7, 0, 85], [25, 83, 18, 71], [25, 83, 18, 71], [75, 48, 8, 43], [ 7, 47, 96, 94], [ 7, 47, 96, 94], [56, 75, 50, 0], [19, 49, 92, 57], [52, 93, 58, 9]]) and I want to […]

Categories
CMS Mastering Development Wordpress

WP_Query for a taxonomy value OR a custom post type meta field

I have a custom post type ‘csl_playlist_manager’, and one of its meta-fields is ‘available_to_all’. I also have a custom hierarchical taxonomy, ‘csl_source’, which identifies the owner of each playlist. I need a query that allows me to find all suitable playlists for a particular source, where "suitable" means the playlist is either available_to_all OR a […]

Categories
Mastering Development

Decrement a value from an existing array if a condition has met using a method – OOP

I am trying to create a method for a LIBRARY exercise, however, I have some issues with the method RentBook(). Basically, I use to a method to add a book that I want to rent, when using my code it decrements -1 all stocks instead of the one is chosen. code: public String rentBook(Book book) […]

Categories
Mastering Development

t test x not enough ‘x’ observations using R with package rstatix

I have the following dataset: structure(list(AgeGroup = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, […]

Categories
Mastering Development

Mockito JUnit Runner NullPointer Exception Error

I am trying to use Mockito to run the Tests and using the annotations for automatically injecting the Mocks. But still, I am getting an error of JUnit Vintage Initialization Error and NullPointerException Below are the code files pom.xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.3.4.RELEASE</version> <relativePath/> <!– lookup […]

Categories
Mastering Development

Object.keys(myObject) returns an arbitrary list of numbers, not expected value

This is a bit of a head-scratcher – and has been a source of pain for the past 3 hours. Here’s my code. const payloadBody = JSON.parse(gatewayEvent.body); console.log(payloadBody); console.log(gatewayEvent.body); console.log(payloadBody.paymentMethodId); console.log(payloadBody[‘paymentMethodId’]); console.log(Object.keys(payloadBody)); If I look at the CloudWatch logs for this (I am executing in Lambda), the line console.log(payloadBody) logs: { "customerId": "cus_REDACTED", "paymentMethodId": "pm_REDACTED", […]

Categories
Mastering Development

How to remove over flow error from a container with fixed width and height

I have a container with a fixed with and height, but when I added widgets into it, the container overflows. How do I curb this: this is my code snippet: class InfoCard extends StatelessWidget { @override Widget build(BuildContext context) { return Container( width: 150, height: 300, decoration: BoxDecoration( border: Border.all(color: Color.fromARGB(255, 43, 135, 65)), borderRadius: […]

Categories
Cryptocurrency Ethereum Mastering Development

ethers.js wrong signature

From the same private key in ethers.js and secp256k1 I get the same eth address. But if I sign a message I get a different (wrong) signature in ethers.js. What is wrong with my code? import { createKeyPair, sign } from ‘@erebos/secp256k1’ import { pubKeyToAddress } from ‘@erebos/keccak256’ import { ethers, Wallet } from ‘ethers’; […]

Categories
Mastering Development

Need help python

import numpy as np z = np.array([170, 160, 175, 180, 195]) a = np.array([[1, 0, 0, 0, 0], [1, 1, 0, 0, 0], [1, 1, 0, 0, 0], [1, 1, 1, 0, 0], [0, 1, 1, 0, 0], [0, 0, 1, 1, 0], [0, 0, 1, 1, 0], [0, 0, 0, 1, 0], [0, 0, […]