Categories
Mastering Development

IAM tag policy with condition to prevent resource creation

My IAM user has the below two policies attached to it. I created the below IAM policy that prevents lambda from being created if it does not have the Project tag. { “Version”: “2012-10-17”, “Statement”: [ { “Sid”: “VisualEditor0”, “Effect”: “Deny”, “Action”: “lambda:*”, “Resource”: “*”, “Condition”: { “Null”: { “aws:RequestTag/Project”: “true” } } } ] […]

Categories
Mastering Development

listView images loaded with picasso getting refreshed when i scroll

I have created a listview that retrieves a json data from server that contains a URL to fetch image for each row as well, I am using picasso to set the images but when I scroll through the listview it refreshes the images and sometimes just doesn’t put them in proper position in first load. […]

Categories
Mastering Development System & Network

Restrict access of IAM user to delete Route53 hostedzone NS and SOA record sets

I have written IAM Policy to restrict IAM users to just use a single hosted zone for testing but how can I restrict IAM users to delete this hosted zone’s NS record and SOA record sets. PFB my IAM policy: { “Version”: “2012-10-17”, “Statement”: [ { “Sid”: “VisualEditor0”, “Effect”: “Allow”, “Action”: [ “route53:GetChange”, “route53:ListTrafficPolicyVersions”, “route53:GetHostedZone”, […]

Categories
Mastering Development

Custom Listview Adapter in Android implementation Problems

I want to display some objects that I have filled with data from a JSON file on a ListView. In my code, I create the Listview and then instanciate a custom list adapter, but it crashes as soon as my app opens the listview. Here is the code from the activity InsectsCatchable: import androidx.appcompat.app.AppCompatActivity; import […]

Categories
Mastering Development

AWS Lambda function pipeline fails on deploy stage: Action execution failed Role … is invalid or cannot be assumed

The AWS Lambda function pipeline I did just set up following the official AWS documentation (Building a Continuous Delivery Pipeline for a Lambda Application with AWS CodePipeline) fails for me on deploy stage (both source and build stages do succeed) with this message: Action execution failed Role arn:aws:iam::************:role/service-role/AWSCodePipelineServiceRole-eu-west-1-lambda-pipeline is invalid or cannot be assumed (Service: […]

Categories
CMS Development Magento

Getting error while override the class

Original Class <?php /** * @author Amasty Team * @copyright Copyright (c) 2019 Amasty (https://www.amasty.com) * @package Amasty_Shopby */ namespace Amasty\Shopby\Model\ResourceModel\Fulltext; use Amasty\Shopby\Helper\Category; use Amasty\Shopby\Helper\Group; use Magento\CatalogInventory\Helper\Stock; use Magento\Framework\DB\Select; use Magento\Framework\Search\Response\QueryResponse; use Magento\Framework\Search\Adapter\Mysql\TemporaryStorage; use Magento\Framework\Exception\StateException; use Magento\Framework\Phrase; /** * Fulltext Collection * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Collection extends \Magento\Catalog\Model\ResourceModel\Product\Collection { /** * @var QueryResponse */ private […]

Categories
Development

Filter in listview did not filter from the full list, but from already filtered list

I have an listview with filter. When I input some words in an edittext that I used as a filter for example “david”, it works well, items in the list are filtered and it will show all item that contains “david”. But when I delete some words, for example “dav”, the list is still filtered, […]

Categories
CMS Development Magento

Call to a member function addFieldToFilter() on null on custom model collection Magento 2.3.4

i’m creating a custom module to make a model by using mage2gen , i named this model critic: app/code/Vendor/Module/Model/Critic.php namespace Vendor\Module\Model; use Vendor\Module\Api\Data\CriticInterface; use Vendor\Module\Api\Data\CriticInterfaceFactory; use Magento\Framework\Api\DataObjectHelper; /** * Class Critic * * @package Vendor\Module\Model */ class Critic extends \Magento\Framework\Model\AbstractModel { protected $dataObjectHelper; protected $_eventPrefix = ‘vendor_module_critic’; protected $criticDataFactory; /** * @param \Magento\Framework\Model\Context $context * […]

Categories
Development

Getting error Get object access denied when reading from s3 bucket

i am trying to stream the guardduty logs from s3 to ElasticSearch.Guardduty puts the logs in the formate of .jsonl.gz Here is the code: from __future__ import print_function import boto3 import json import datetime import gzip import urllib import urllib3 import logging from pprint import pprint from requests_aws4auth import AWS4Auth import requests from io import […]

Categories
CMS Development Magento

In magento2,How to inject helper in collection

I have created a custom grid, in this grid collection I have to inject helper .while injecting helper in the collection it throws error like this Type Error occurred when creating object: My collection: namespace vendor\module\Model\ResourceModel\Post; use \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection; class Collection extends AbstractCollection { /** * Define model & resource model */ const YOUR_TABLE = ‘xxx’; […]