sql server – How to get the query responsible for deadlock from the deadlock graph?

I am looking at a deadlock graph. Hover over 1st process shows me a sql doing a SELECT on TableA.

SELECT COL1, COL2 FROM TableA

Hover over 2nd process shows me a sql doing update on TableB.

(@P1 text) UPDATE TableB SET COL1=10, COL2=@P1 WHERE COL3=100

The 2 rectangles in the middle show me the resource (page lock) is on TableB.

Why is the 1st process showing TableA SQL and pointing to rectangle containing resource TableB?

magento2 – What event is responsible for the bulk product save in the admin in Magento 2?

Magento V2.4.1

We have created one attribute named “Test” with 2 values “test1” and “test2”. We are required to automatically select the value “test2” when the product’s quantity is less than 0 “test1” when the product’s quantity is greater than 0 when we save the product in the admin. For that, we took the “catalog_product_save_after” event and created an observer. everything is working as excepted. when we save the product in the admin and if the quantity is greater than 0 then the “test1” will be automatically selected in that product and if the quantity is less than 0 then the “test2” will be automatically selected in that product.

Now we have nearly 2500 products in our store and we want to set either of the mentioned values for the “Test” attribute in all products. So we have tried to use “catalog_product_attribute_update_before” and created an observer for that event. now in the admin when we have selected multiple products(2 products) and clicked on “Update attribute” from the Mass action menu and then we have updated one other attribute and clicked on save. the other attribute which we have tried to update for multiple products is updated successfully but it seems the “Test” attribute didn’t update as it should be.

I think the observer for the event “catalog_product_attribute_update_before” didn’t get triggered at all.

I think the method update attributes in MagentoCatalogModelProductAction is responsible for update attributes via the product mass action. So I tried to create the aroundplugin for the mentioned method but that didn’t work as well. Unfortunately, I can’t share the code of the aroundplugin method.

  1. Using Event Observer:

app/code/Test/Module/etc/adminhtml/events.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="catalog_product_attribute_update_before">
        <observer name="change_inventory_mass_actions" instance="TestModuleObserverAttributeUpdateObserver" />
    </event>
</config>

app/code/Test/Module/Observer/AttributeUpdateObserver.php

<?php

namespace TestModuleObserver;

use MagentoFrameworkEventObserverInterface;

class AttributeUpdateObserver implements ObserverInterface
{  
    /**
     * @var LoggerInterface
     */
    private $loggerInterface;

    public function __construct(
        PsrLogLoggerInterface $loggerInterface
    ) {
        $this->logger = $loggerInterface;
    }

    public function execute(MagentoFrameworkEventObserver $observer)
    {
        $logger = new ZendLogLogger();
        $testLog = new ZendLogWriterStream(BP.'/var/log/attr_observer.log');
        $logger->addWriter($testLog);
        $logger->info("Mass action event is called");
        try {
            $productIds = $observer->getProductIds();
            $attributes = $observer->getAttributesData();   
        } catch (Execption $e) {
            $this->logger->info('Error : '.$e->getMessage());
        }
    }   
}

How can I create an observer that will trigger on Mass action save? or Is there any other way instead of an event observer?

7 – Downloading xlsm is disabled for anonymous user: What function is responsible for this access control?

We have a D7.8 site with Panopoly 7.x-1.81. No access control modules.

A standard filefield is used for uploads and functions perfectly for the usual set of mime types.

We recently extended the list of allowable extensions in the field definition to include .xlsm

Our xlsm files are code-signed and certified by a Microsoft-approved cert provider.

We can upload the xlsm files no problem, and logged-in users can see the download link.

**However, anonymous users do not see the download link.

We are not sure what function could be deciding to block display of this filetype.**

Can anyone suggest possible avenues for investigation?

magento2 – Magento 2 : responsible code for coupon apply

Open the vendor/magento/module-sales-rule/Model/Validator.php class, Then check the following method:

public function process(AbstractItem $item)

Now open: vendor/magento/module-sales-rule/Model/RulesApplier.php
and check:

public function applyRules($item, $rules, $skipValidation, $couponCode)

and

protected function applyRule($item, $rule, $address, $couponCode)

(Update)

The following location you have all discount type:

vendor/magento/module-sales-rule/Model/Rule/Action/Discount

Open vendor/magento/module-sales-rule/Model/Rule/Action/Discount/ToFixed.php and check the following method:

public function calculate($rule, $item, $qty)

(Update (2021-07-17))

Try to add following code after $this->applyRule( in vendor/magento/module-sales-rule/Model/RulesApplier.php:: public function applyRules($item, $rules, $skipValidation, $couponCode)

if ($item->getDiscountAmount() <= 0 ) {
    continue;
}

Don’t write the core, you can create a patch or overwrite that class. It’s a bad class which means lots of private property and method of that class.

Which projects and services are responsible for most of the Bitcoin transactions?

In the Lightning Conference 2019, Jameson Lopp mentioned that Exchanges are responsible for most of the bitcoin transactions. It is discussed in a tweet thread.

Exchanges

Bitcoin is not used much in darknet markets now because people realized privacy isn’t the priority for many users and Bitcoin developers. Still, we can look at the relevant charts and see that most of the source and destination associated with DNMs are exchanges or mixing services.

origin-dnm

destination-dnm

There is volume and few other charts for LN, Bisq, Coinjoin implementations etc on https://bitcoinkpis.com/ however its difficult to know percentage of transactions and fees from this data.

❕NEWS – Ponzi scheme promoters being held responsible | Proxies-free

When it comes to ponzi schemes it can be especially hard to hold those that are responsible as they cannot be traced for various reasons such as the use of a vpn when they are creating the website. However, that does not mean that no one can be held responsible. According to a news article, five people are being held to account for the ponzi scheme that was BitConnect where people were scammed of 2 billion dollars. These five people are being held to account for simply promoting the website. Therefore it is important to know the legitimacy of a site before you promote it to avoid legal action being taken against you such as this.

domain driven design – Should the Use Case be responsible for transforming its primitive parameters into typed data for the Entity to use?

I’m building a Use Case for creating blog posts, this Use Case has its own “DTO”, which is basically a parameter object with only primitive data, as follows:

Use Case’s DTO (Parameter Object):

export class CreatePostInput {
  public id: string;
  public slug: string;
  public title: string;
  public authorId: string;
  public platform: string;
  public tags: string();
  public images: string();
  public content: string;
  public createdAt: string;
}

inside my Use Case, I have to create an entity that is built with most of the data of the Use Case’s DTO, the “problem” is that most of the entity’s properties are typed with Value Object’s, for example:

Post Entity

export class Post {
    private id: PostId;
    private slug: Slug;
    private title: Title;
    private authorId: AuthorId;
    private platform: Platform;
    private tags: Tag();
    private images: Image();
    private content: string;
    private createdAt: Date;
}

Use Case:

export class CreatePost {

  public async create(CreatePostInput: CreatePostInput): Promise<CreatePostOutput> {

    if (CreatePostInput.images.length > 0) {
      // do something...
    }

    // some more logic using typed data

    const PostEntity = new Post(CreatePostInput);
    // ...
    // return CreatePostOutput
  }

}
  1. Should the Use Case be responsible for creating the entity’s Value Objects or transforming its primitive data into something else? if so, is there a problem with instantiating the Value Objects inside the Use Case?

  2. If I happen to have more entities and more Value Objects in this use case, how should i organize all this creation? builder pattern?

single responsibility – Should a Car object be responsible for checking if it is able to run on certain Road objects?

I have 2 kinds of objects in my system, Car and Road.

A Car can be of various types and have properties like tire, tire size, engine, etc.

A Road can be of multiple types and have properties like terrain type, slippery, etc.

Some type of cars cannot ride on certain roads, based on the road properties and car limitations/constraints, like a common car cannot walk on beach sand because it would get stuck with smaller tires and weaker engine, but a “monster truck” could, because it has bigger tires and a better engine.

with that in mind, who should have the responsibility of checking whether a car can ride on a specific road?

i think that a Car should throw exceptions if it cannot ride, but i don’t think a Car should know in which road is going to ride.

  • should the road check the car’s properties and tell if it’s able to
    run on the road?
    i think this options falls to a procedural approach of getters/setters.

  • how would this scenario “scale” if a had multiple properties on a Car
    that could affect the capability of riding on a road?

how can i approach this?

base code:

export interface Car {
  engine: string;
  tire: string;
  tireSize: string;

  ride(): void // ride only if Road is compatible
}

export interface Road {
  terrain: string;
  isSlippery: boolean;
  cars: Car();

  startRace(): void
  
}

Which Google service is responsible for emergency notifications?

I have an app that blocks notifications. I want to let emergency warnings through (like tornado warnings).

The services that have google in their name are:

  • “Files by Google” – com.google.android.apps.nbu.files
  • “Goggles” – com.google.android.apps.unveil
  • “Hangouts” – com.google.android.talk
  • “Home” – com.google.android.apps.chromecast.app
  • “Maps” – com.google.android.apps.maps
  • “News & Weather” com.google.andoird.apps.genie.geniewidget – Maybe this is it?
  • “Personal Safety” com.google.android.apps.safetyhub
  • “Google” – com.google.android.googlequicksearchbox
  • “Google Go” – com.google.android.apps.searchlite
  • “Google News” – com.google.android.apps.magazines
  • “Google Play” – com.google.android.apps.walletnfcrel
  • “Google Play Games” – com.google.android.play.games
  • “Google Play Music” – com.google.android.music
  • “Google Play Store” – come.android.vending
  • “Google TV” – com.google.android.videos

I’m using a pixel xl 2.

Also, how do I test if I have the settings correct? Is there a way to fake an emergency broadcast to myself?

default applications – Which “app” is responsible for “open with”

Which (app / piece of software) that is responsible for this function?

The dialogue box that asks for which app to use.
    – complete action using:
    – choose an app:
    – open with:

Is it a package?
Can I disable it?

I know there is “open by default” and “app preferences”
Where you can set the default app to open automatically for some files, links, etc.

But sometimes the dialogue doesn’t show up for certain actions. Like trying to upload a file on a specific browser doesn’t prompt the dialogue but instead goes automatically to camera. Which is super weird.

Would appreciate any thread of info.