amazon s3 – How to use input transformer for ECS Fargate launch type with Terraform CloudWatch event trigger

I’m using terraform to create a CloudWatch Event Trigger with a ECS Fargate launch type which the event source is S3. When I use the input_transformer field to pass in the bucket and key into the ECS task, my event rule results in a failed invocation.

This is the aws_cloudwatch_event_rule:

resource "aws_cloudwatch_event_rule" "event_rule" {
  name          = "dev-gnss-source-put-rule-tf"
  description   = "Capture S3 events on uploads bucket"
  event_pattern = <<PATTERN
{
  "source": [
    "aws.s3"
  ],
  "detail-type": [
    "AWS API Call via CloudTrail"
  ],
  "detail": {
    "eventSource": [
      "s3.amazonaws.com"
    ],
    "eventName": [
      "PutObject"
    ],
    "requestParameters": {
      "bucketName": [
        "example-bucket-name"
      ]
    }
  }
}
PATTERN
}

This is the aws_cloudwatch_event_target:

resource "aws_cloudwatch_event_target" "event_target" {
  target_id = "dev-gnss-upload-event-target-tf"
  arn       = "example-cluster-arn"
  rule      = aws_cloudwatch_event_rule.event_rule.name
  role_arn  = aws_iam_role.uploads_events.arn
  ecs_target {
    launch_type = "FARGATE"
    task_count  = 1 # Launch one container / event
    task_definition_arn = "example-task-definition-arn"
    network_configuration {
      subnets         = ["example-subnet"]
      security_groups = []
    }
  }

  input_transformer {
    input_paths = {
      s3_bucket = "$.detail.requestParameters.bucketName"
      s3_key    = "$.detail.requestParameters.key"
    }

    input_template = <<TEMPLATE
{
  "containerOverrides": [
    {
      "name": "myproject-task",
      "environment": [
        { "name": "S3_BUCKET", "value": <s3_bucket> },
        { "name": "S3_KEY", "value": <s3_key> }
      ]
    }
  ]
}
TEMPLATE
  }
}

If I remove the input_transformer section, it will work fine, but I need to pass in the s3 bucket and key to process the particular file.

My rationale for doing this is to remove the need for an intermediary Lambda and was guided by this Medium post: https://medium.com/@bowbaq/trigger-an-ecs-job-when-an-s3-upload-completes-3559c44c37d1

Any advice is appreciated.

magento2 – How to make checkbox Check/Uncheck onchange trigger event to subscribe/unsubscribe customer from newsletter magento 2 on customer/account?

Basically I have a checkbox on customer/account page adding via code below.
appdesignfrontendCompanyporto_base_childMagento_Customertemplatesaccountdashboardinfo.phtml

<div class="col-12 col-sm-12">
            <div class="flex-card myaccount-block proofing-block">
                <div class="col-lg-3 float-left">
                <img src="" alt="Automatic Proofing Approval Options" />
                </div>
                <div class="col-lg-6 float-left">
                    <strong class="box-title">
                        <span><?= $block->escapeHtml(__('Automatic Proofing Approval Options')) ?></span>
                    </strong>
                    <div class="box-content">
                        <p><?= $block->escapeHtml(__('
                        By default, once your file is preflighted OK, you will have 1 hour to approve or make changes to your file. If no action is taken within this hour, your order will automatically go into production.')) ?>
                        </p>
                        <a href="#" id="proof-learnmore">Learn More..</a>
                    </div>
                </div>
                <div class="col-lg-3 float-left">
                    <span class="yesno-label">Yes</span>
                    <div class="box-actions">
                            <label class="proof-switch">
                            <input type="checkbox">
                            <span class="slider round"></span></label>
                    </div>
                    <span class="yesno-label">No</span>
                </div>
            </div>
        </div>

How can I create a functionality so whenever user check/uncheck this checkbox it will call an observer/controller which will pass the value(customer_email) to magento backend and change the newsletter subscription status? I hope I am on the right track of understanding cause this is what I am planning to implement. I am still not sure whether I will need a block or not. Please anyone guide me through this it would be really helpful for me to continue my learning and understand magento 2. Thank you and cheers. Though I am trying my best to implement this and update here if something relevant
enter image description here

dnd 5e – Can Dispel Magic be used to stop a readied spell from taking effect before the trigger occurs?

Yes, you absolutely can.

For this specific situation, it absolutely works. The description of the dispel magic spell says (emphasis mine):

Choose any creature, object, or magical effect within range. Any spell of 3rd level or lower on the target ends. For each spell of 4th level or higher on the target, make an ability check using your spellcasting ability. The DC equals 10 + the spell’s level. On a successful check, the spell ends.

So you can choose the creature who has cast the spell, CHECK.

It is a actual spell we are trying to dispel, CHECK.

The rules for Readying a spell state (emphasis mine):

When you ready a spell, you cast it as normal but hold its energy, which you release with your reaction when the trigger occurs. To be readied, a spell must have a casting time of 1 action, and holding onto the spell’s magic requires concentration (explained in chapter 10). If your concentration is broken, the spell dissipates without taking effect.

A spell has been cast, CHECK.

There is magic energy an it is vulnerable to dissipation/dispel by numerous means. CHECK.

The spell has been cast, so it is a done deal, the energy has been activated (slot used) and you are holding the spell energy within the caster. There is no way around this very specific fact, by specific over general RAW, the spell has been cast before readying it. There is an active spell, it is vulnerable to being dispelled/dissipated and losing the already cast spell (and the activated spell slot) by other means, those being loss of concentration or holding on for too long, and reaching your next turn.
The readied spell completely qualifies for the dispel magic spell.

This has nothing to do with readying a dispel magic spell and using it, this is the other way around, do not confuse the different situations.

The Sage Advice Compendium ruling, already quoted about that different situation, is completely correct, in that you cannot dispel a spell not already cast. However, in this instance the target has specifically cast the spell and the magic energy is active.

To quote the most pertinent part of the ruling:

The main reason is that dispel magic removes a spell that is already on a target, whether that target is a creature, an object, or some other phenomenon. Dispel magic can’t pre-dispel something. If a spell isn’t already present on a target, dispel magic does nothing to that target.

The target is the spellcaster, and there is a cast and active spell present on them in the form of the active spell they have readied. By Sage Advice’s own added conditions, the readied spell completely conforms and is vulnerable to the dispel magic spell.

sql server – SQL Trigger fails retrieve new record in second query

Any advice on this will be appreciated
This script created a table with new records.

My script is failing to assign the “Inserted” ID to the query but manually assigning a value works
(a) Tried Cast both side of the Where Clause to int
(b) Moved this section within the second BEGIN -END section

@MAIL_BODY = @MAIL_BODY +
    '<tr>' +
    '<td>' + @OrderID + '</td>' +
    '<td>' + @Description + '</td>' +
    '<td>' + @DiscountedPrice + '</td>' +
    '</tr>' FROM (dbo).(OrderItem) it INNER JOIN (dbo).(Product) pt on pt.ProductID=it.ProductID WHERE it.OrderID = @OrderID``

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER TRIGGER (dbo).(EMAILFINAL) 
   ON  (dbo).(Order)
AFTER INSERT
AS 

BEGIN
DECLARE @OrderID VARCHAR(3),
@inpToEmail VARCHAR(MAX),
@Description VARCHAR(MAX),
@DiscountedPrice VARCHAR(MAX),
@MAIL_BODY VARCHAR(MAX)

SELECT @OrderID = i.OrderID FROM inserted i;
IF (@OrderID IS NOT NULL)

SELECT @inpToEmail=dr.DistributorEmail from (dbo).(Distributor) dr
inner join (dbo).(User) Ur on ur.DistributorID=dr.DistributorID
inner join (dbo).(Order) odr on odr.UserID=Ur.UserID
where odr.OrderID= + @OrderID;

PRINT @inpToEmail

SET @MAIL_BODY = '<table border="1" align="left" cellpadding="2" cellspacing="0" style="color:black;font-family: Helvetica, Arial, sans-serif;text-align:left;">' +
    '<tr>
    <th>OrderID</th>
    <th>Feature</th>
    <th>Cost($)</th>
    </tr>'

SELECT
    @MAIL_BODY = @MAIL_BODY +
        '<tr>' +
        '<td>' + CAST((OrderID) AS VARCHAR(11)) + '</td>' +
        '<td>' + CAST((ProductName) AS VARCHAR(50)) + '</td>' +
        '<td>' + CAST((DiscountedPrice)  AS VARCHAR(11)) + '</td>' +
        '</tr>'
  FROM (dbo).(Order_Product)
  where Orderid = @OrderID

BEGIN
    SET NOCOUNT ON;

declare 
@HtmlHeader nvarchar(500),
@body nvarchar(max),
@inpEmailProfiler VARCHAR(50) ='Notifications',
@inpBodyFormat VARCHAR(5) ='HTML',
@inpSubjectLine NVARCHAR(MAX)='Quotation'

SELECT  

@MAIL_BODY = @MAIL_BODY +
        '<tr>' +
        '<td>' + @OrderID + '</td>' +
        '<td>' + @Description + '</td>' +
        '<td>' + @DiscountedPrice + '</td>' +
        '</tr>'
 FROM (dbo).(OrderItem) it
INNER JOIN (dbo).(Product) pt on pt.ProductID=it.ProductID
WHERE it.OrderID = @OrderID

SELECT @MAIL_BODY = @MAIL_BODY + '</table>' + 
'<br/>' + '<br/>' + '<br/>' + '<br/>' + 'Kind regards,' +
 '<br/>' + 'Kvikna ehf.'

EXEC msdb.dbo.sp_send_dbmail
@profile_name = @inpEmailProfiler,
@recipients = @inpToEmail,
@body_format='HTML',
@body = @MAIL_BODY,
@subject = @inpSubjectLine;  

END
END

dnd 5e – Would a zealot barbarian’s divine fury trigger during an opportunity attack?

The Path of the Zealot barbarian (Xanathar’s Guide to Everything, p. 11) gets the Divine Fury feature at level 3, which states:

At 3rd level, while you’re raging, the first creature you hit on each of your turns with a weapon attack takes extra damage equal to 1d6 + half your barbarian level. The extra damage is necrotic or radiant; you choose the type of damage when you gain this feature.

Does it work like the Rogue’s Sneak attack, in that it can trigger on opportunity attacks, since it’s a different turn? Or does the “on each of your turns” bit make it not work.

Create ORACLE TRIGGER which (INSERT OR UPDATE) in TABLE1 whenever a new INSERT is done in TABLE2

i’m trying to create a TRIGGER for my Oracle database.
I Have 2 tables in it(table1 , table2)
Table 1 has 3 columns (id, name, value). id can be non unique here
Table 2 has 2 columns ( id, concat) id is unique here

What i want to do, is, every time a new row is inserted in Table 1., the trigger must Update the concat value of Table 2 which is a concate of name and values of all row where table1.id = table2.id

At the moment i think about this trigger, but i dont want to break anything in my db, so any advice would be great before testing 🙂


CREATE TRIGGER creation
AFTER INSERT  ON table1 ac
FOR EACH ROW
BEGIN 
UPDATE table2
SET concat= CONCAT(' ',CONCAT(ac.NAME, CONCAT('=',ac.VALUE)))
WHERE 
table1.id = table2.id 
END

Thx a lot

event handlers – Build and package app to trigger automated email upon added list item

I am a sharepoint beginner and am looking to create something that will trigger an automated email upon adding a list item to an existing sharepoint list. What should I be creating to help with this (solution/addin/app)? and how should i go about doing so? I am developing with another laptop to build and transfer to another laptop with sharepoint access to deploy. Would it be done through uploading of webpart? if not how would i upload it?

Restraints:
Has to be within sharepoint (sharepoint hosted?)
Unable to install software in sharepoint access computer
I am only a site owner.

sharepoint list – Microsoft flow to trigger email when condition is met

Looking at the screenshot , when two fields are updating to ‘Yes’ in one go , both the conditions are resulting to true at the same time and the update action used after Send email action might conflicts due to which , when flow is running again after first email and before the second email , it is sending another email.

Try to use Switch condition instead of simple Condition you have used , where you write third condition in addition to above 2 conditions.

The condition will be –

Mail to be sent to Maths == ‘Yes’ and Mail to be sent to Science ==
‘Yes’ and IsmailsentMaths == ‘No’ and IsmailsentSci == ‘No’

By this, the flow will perform action for this third condition only and will not go to the two individual conditions for Maths and Science at the same time.

Refer this for how to use Switch in Flow.

architecture – How can an Entity trigger changes to the world in C++?

I’m writing a simple physics based game in C++ using SFML. I want to trigger a scene change when my playerCharacter collides with a door. Since C++ does not have any native Event Sender/Listener system, I’m not sure how I should organize my architecture such that entities can trigger events within the world, or within other entities they are not colliding with directly. These are the only ways I can think of;

  1. Entities all have a reference back to the scene/world. This is what I’m doing currently but I keep hearing it’s horrible design.

  2. Have the scene/world call methods on the entities to check if they are making changes. This seems like a terrible solution, I would have to check for any possible change.

  3. I integrate a premade C++ Event system. I’m happy to do this, I just want to first make sure there isn’t a more simple approach I’m missing.

  4. Interfaces between classes. I keep hearing this a solution, but I don’t know how ti really solves anything. If my Entity and Scene objects both have references to the interface, and have to base functionality around that- isn’t that just as bad?

  5. Messaging system. This actually seems like a good approach, but I’m not sure if it’s intended to be a comprehensive solution. Here it is in detail:
    How to implement the interaction between engine parts?

Please let me know if you have any solutions for this specific issue, or perhaps some sort of class diagram that circumvents this issue completely. I’ve been looking a while and haven’t found a solution for this issue. How do the major engines do it?

postgresql – Trigger TG_OP Status CASE

Im new and was using this forum since one mounth. Its very usefull. Sorry for my english.

I have a problem. Made a Trigger with function. Im using TG_OP State. I need to do CASE under CASE, IF working... but case is beher how to use it ? i dont whant to paste all code becouse it`s over 200 lines 🙂

  CREATE OR REPLACE FUNCTION public.raport_pge()
    RETURNS trigger AS
    $BODY$ 
    DECLARE
    BEGIN
    CASE TG_OP
     WHEN 'INSERT' THEN UPDATE st....
     WHEN 'UPDATE' THEN
    //-> HERE I NEED TO DO CASE IT` S NOT WORKING HERE IT`s importent for me watch one value (x) if sb, change it must do many things.
     CASE
       WHEN OLD.x ='0' AND NEW.x ='0' THEN   UPDATE.....; UPDATE ;
       ELSE UPDATE...; UPDATE ; UPDATE; 
    
    END
    
     WHEN 'DELETE' THEN 
        UPDATE .... ; 
        IF .... THEN 
            UPDATE...; 
            UPDATE;
     END IF;
       END CASE;
    RETURN NULL;
END;
$BODY$
  LANGUAGE plpgsql