sql – Trigger não dispara

Estou fazendo uma trigger que me informe cada vez que a tabela de país é alterada por um delete atráves update e insert porém a trigger não me retorna nenhum valor. (ela deve me informar o valor anterior e o atual)
A tabela país:

CREATE TABLE pais(
    codigo smallint NOT NULL,
    iso character varying(2) NOT NULL,
    iso3 character varying(3) NOT NULL,
    nome character varying(80)  NOT NULL,
    nomeformal character varying(80) NOT NULL,
    CONSTRAINT pais_pkey PRIMARY KEY (codigo)
); 

a tabela que contem os logs:

create table pais_log(
    operation char(1) not null, 
    stamp timestamp   not null, 
    userid  text not null, 
    codigo smallint primary key NOT NULL,
  iso character varying(2)  NOT NULL,
  iso3 character varying(3)  NOT NULL,
  nome character varying(80)  NOT NULL,
  nomeformal character varying(80) NOT NULL
); 

A função:

create or replace function proc_pais_log() returns trigger as $pais_log$
begin 
if (tg_op = 'delete') then 
insert into pais_log select 'D',  now(), user, old.*, new.*; 
return old, new; 
elsif (tg_op = 'insert') then 
insert into pais_log select 'I', now(), user, old.*, new.*; 
return old, new; 
elsif (tg_op = 'update') then 
insert into pais_log select "U", now(), user, old.*, new.*; 
return old, new; 
end if; 
return null; 
end; 

$pais_log$ language plpgsql; 

A trigger:

create trigger pais_log
after insert or delete or update on pais 
for each row execute procedure proc_pais_log(); 

What is the best way to trigger on object flow with a control flow in an UML activity diagram?

I want to have a control flow decide whether an object can pass through a point in a flow or not. From my understanding of control and object flows, this would not work in the way I have done it, since an object and control flow are being joined together into something undefined. What would the correct way to do this look like?

enter image description here

EDIT:

I’ve done some research and stumbled over this in the UML specification:

enter image description here

Figure 15.59 is an example of using a DataStoreNode. Records for hired employees are persisted in the Personnel
Database. If an employee has no assignment, then one is made using Assign Employee. Once a year, all employees have
their performance reviewed. The JoinNode blocks the flow of tokens to Review Employee except when the
AcceptEventAction (see sub clause 16.10) is triggered “Once a year”. When the AcceptEventAction generates its yearly
control token, this satisfies the join condition on the JoinNode and, as the outgoing edge from the Personnel Database
has “{weight=*}”, object tokens for all the persisted employee records can then flow to Review Employee.

Would this not be the exact same case of an undefined join as well?

postgresql – How to update data with a trigger function and a join

I have two relations :

CREATE TABLE relation_a (id_a int PRIMARY KEY, field_1 int);
CREATE TABLE relation_b (id_b int PRIMARY KEY,fk_a int REFERENCES relation_a(id_a), field_1 int);
INSERT INTO relation_a VALUES (1,100), (2,101), (3,102);
INSERT INTO relation_b VALUES (1,1), (2,2), (3,3)

I want to create a trigger which always set :

SET b.field_1 = a.field_1 FROM relation_a a, relation_b b WHERE b.fk_a = a.id_a

I tried something like this :

CREATE OR REPLACE FUNCTION function1() RETURNS trigger AS 
$$
BEGIN
    UPDATE relation_b as b
    SET field_1 = a.field_1
    FROM relation_a a
    WHERE a.id_a = new.fk_a;
END
$$
LANGUAGE PLPGSQL;

CREATE TRIGGER trigger1
   AFTER INSERT OR UPDATE 
   ON relation_b
   FOR EACH ROW EXECUTE PROCEDURE function1();

If i try to insert or update data in relation_b, i got a very long error message i can’t understand :error message

Can someone explain me the right way ? Thanks a lot

canon – Why won’t my camera fire the off-camera flashes even when the trigger button will?

I have a Canon 80D and I use 3 yongnuo triggers to trigger off-camera flashes.

But even though the trigger on the camera will flash when I press the trigger button, it will not flash when I press the shutter button. The main trigger is on TX and the flash triggers are on TRX. The main trigger is sitting on the camera’s hot-shoe correctly and is clean.

This is not the first time I’ve used these triggers but it is the first time something is wrong. ALL batters are fulling charged.

What am I doing wrong?

MYSQL BEFORE TRIGGER ISN’T WORKING

MAIN TABLE

CREATE TABLE sec_role_access_m (
ROLEACCESS_ID int(10) NOT NULL AUTO_INCREMENT,
ROLE_ID varchar(10) DEFAULT NULL,
MODULE_ID varchar(10) DEFAULT NULL,
FUNCTION_ID int(10) DEFAULT NULL,
REC_STATUS varchar(1) DEFAULT NULL COMMENT ‘A- ACTIVE, X-DELETED’,
MAKER_ID varchar(10) DEFAULT NULL,
MAKER_DATE datetime DEFAULT NULL,
AUTHOR_ID varchar(10) DEFAULT NULL,
AUTHOR_DATE datetime DEFAULT NULL,
PRIMARY KEY (ROLEACCESS_ID),
KEY INDX_ROLE_ID (ROLE_ID),
KEY INDX_SRAM_MODULE_ID (MODULE_ID),
KEY INDX_SRAM_FUNCTION_ID (FUNCTION_ID)
) ENGINE=InnoDB AUTO_INCREMENT=13972 DEFAULT CHARSET=utf8;

HISTORY TABLE

CREATE TABLE sec_role_access_hst (
ROLEACCESS_ID int(10) DEFAULT NULL,
ROLE_ID varchar(10) DEFAULT NULL,
MODULE_ID varchar(10) DEFAULT NULL,
FUNCTION_ID int(10) DEFAULT NULL,
REC_STATUS varchar(1) DEFAULT NULL,
MAKER_ID varchar(10) DEFAULT NULL,
MAKER_DATE datetime DEFAULT NULL,
AUTHOR_ID varchar(10) DEFAULT NULL,
AUTHOR_DATE datetime DEFAULT NULL,
Status varchar(10) DEFAULT NULL,
log_Timestamp datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

I have created history table with reference to main table to store main table data before update as a audit log.

TRIGGER

DELIMITER $$

CREATE TRIGGER UPDATE_role_access_M BEFORE UPDATE ON sec_role_access_m
FOR EACH ROW BEGIN
INSERT INTO
sec_role_access_hst (ROLEACCESS_ID,ROLE_ID,MODULE_ID,FUNCTION_ID,REC_STATUS,MAKER_ID,MAKER_DATE,AUTHOR_ID,AUTHOR_DATE,Status,log_Timestamp)
VALUES
(OLD.ROLEACCESS_ID,OLD.ROLE_ID,OLD.MODULE_ID,OLD.FUNCTION_ID,OLD.REC_STATUS,OLD.MAKER_ID,OLD.MAKER_DATE,OLD.AUTHOR_ID,OLD.AUTHOR_DATE,’UPDATE’,NOW());

END;

$$

DELIMITER ;

BUT this trigger isn’t working while update on main table the data isn’t getting saved on history table.

I need before update history log on my history table.

MAIN TABLE DATA AS BELOW FOR REFERENCE

4793 59 CPS 3000106 ADMIN 2016-08-31 15:10:39 ADMIN 2016-08-31 15:10:39
4794 59 CPS 3000111 ADMIN 2016-08-31 15:10:39 ADMIN 2016-08-31 15:10:39
4795 59 CPS 3000116 ADMIN 2016-08-31 15:10:39 ADMIN 2016-08-31 15:10:39
4796 59 CPS 3000952 ADMIN 2016-08-31 15:10:39 ADMIN 2016-08-31 15:10:39
5013 65 CPS 3000296 ADMIN 2016-11-11 15:56:42 ADMIN 2016-11-11 15:56:42
5014 65 CPS 3000901 ADMIN 2016-11-11 15:56:42 ADMIN 2016-11-11 15:56:42
5015 65 CPS 3000960 ADMIN 2016-11-11 15:56:42 ADMIN 2016-11-11 15:56:42
5016 65 CPS 3000952 ADMIN 2016-11-11 15:56:42 ADMIN 2016-11-11 15:56:42
5017 65 CPS 3000951 ADMIN 2016-11-11 15:56:42 ADMIN 2016-11-11 15:56:42
5215 73 SEC 1000141 ADMIN 2016-11-11 11:30:19 ADMIN 2016-11-11 11:30:19
5325 72 CPS 3000106 ADMIN 2016-11-11 13:23:52 ADMIN 2016-11-11 13:23:52
5326 72 CPS 3000111 ADMIN 2016-11-11 13:23:52 ADMIN 2016-11-11 13:23:52
5327 72 CPS 3000116 ADMIN 2016-11-11 13:23:52 ADMIN 2016-11-11 13:23:52
5328 72 CPS 3000960 ADMIN 2016-11-11 13:23:52 ADMIN 2016-11-11 13:23:52
5329 72 CPS 3000952 ADMIN 2016-11-11 13:23:52 ADMIN 2016-11-11 13:23:52
5330 67 CPS 3000296 ADMIN 2016-11-11 13:26:34 ADMIN 2016-11-11 13:26:34
5331 67 CPS 3000361 ADMIN 2016-11-11 13:26:34 ADMIN 2016-11-11 13:26:34
5332 67 CPS 3000901 ADMIN 2016-11-11 13:26:34 ADMIN 2016-11-11 13:26:34
5333 67 CPS 3000902 ADMIN 2016-11-11 13:26:34 ADMIN 2016-11-11 13:26:34
5334 67 CPS 3000960 ADMIN 2016-11-11 13:26:34 ADMIN 2016-11-11 13:26:34
5335 67 CPS 3000952 ADMIN 2016-11-11 13:26:34 ADMIN 2016-11-11 13:26:34
5336 67 CPS 3000951 ADMIN 2016-11-11 13:26:34 ADMIN 2016-11-11 13:26:34
6955 75 CPS 3000100 UHF0036 2018-10-22 16:29:50 UHF0036 2018-10-22 16:29:50
6956 75 CPS 3000106 UHF0036 2018-10-22 16:29:50 UHF0036 2018-10-22 16:29:50
6957 75 CPS 3000111 UHF0036 2018-10-22 16:29:50 UHF0036 2018-10-22 16:29:50

pnp powershell – Trigger re-index of part of a document library or files of a certain extension in Sharepoint Online

I have a gargantuan set of document libraries that each contain a folder with msg files. I set a few managed properties specifically for the folders with msg files in order to make a custom filter for these properties in a search center. The search and filters work, but only newly entered msg files are being picked up. The formerly entered msg file properties are not present in the new managed property indexes which were only recently mapped. I want to trigger a crawl of just these subfolders, which all have the same name and are nested inside larger document libraries. Is there a way to do this using PnP? I already tried using Request-PnPReindexList -Identity “list/sublist”. There was not an error, but it has been over 24 hours and the list has not been indexed.

I also tried reindexing one of the entire document libraries using the SP front end Library advanced settings > reindex library. It has been about three days and it has not been reindexed yet. My preference would be to set reindex for only the msg file subfolders so as not to overwhelm the system, which has many terabytes of documents divided into dozens of libraries. Thanks in advance for any advice you can provide.

architectural patterns – Message bus: should an event handler trigger other commands?

Given I have a message bus that can handle commands and events. A command handler can dispatch an event. But should an event handler be able to dispatch another command? Or should event handlers only be able to dispatch further events?

Example:

  1. PostReceivedEventHandler subscribes to PostReceivedEvent, invokes ValidatePostCommand
  2. ValidatePostCommandHandler handles ValidatePostCommand, dispatches PostValidatedSuccessfullyEvent

Is this legit? Or should the logic from the ValidatePostCommandHandler go into the PostReceivedEventHandler and this one should then dispatch the PostValidatedSuccessfullyEvent directly?

Because having just event handlers that have no real business logic in it but just dispatch other commands feels somehow wrong to me.

Start the enemy animation and then use Actionscript 3 to trigger another animation in Flash

I'm building a simple platform on Flash with Actionscript 3. There will be an enemy in the scene that I want to make it automatically repeat an animation until the character comes closer.
The character I made moves through buttons. The code I'm trying to write on the enemy level is:

var alert:Boolean = true;
var noticed:Boolean = false;
var enemy:Object = new Object  ;

enemy1.addEventListener(Event.ENTER_FRAME, fl_enemyMove);
enemy1.addEventListener(Event.ENTER_FRAME, fl_noticed);

function fl_enemyMove(event:Event)
{
    alert = true;
    switch (Event.ENTER_FRAME)
    {
        case (noticed = true) :
            {
                alert = false;
                enemy1.gotoAndPlay("chase");
                break;

            };
        default :
            enemy1.gotoAndPlay("alert");
            break;
    }
}

function fl_noticed(event:Event)
{
    var char;
    var charPos = (x,y);
    if (char1.x == MAXx/2)
    noticed = true;
}

And of course it doesn't matter. It doesn't even give me mistakes, so I'm a little confused.
I tried & # 39; MAXx / 2 & # 39; with an actual number, but the animation doesn't even start.
Any ideas?

notifications – Trigger sound by device’s vibration

I have a game which makes my device vibrate when a certain event happens. I also want my device to play a sound when that happens. Unfortunately, the developer doesn’t seem to be interested in implementing the feature of having an alarm sound too.

I had an idea to bypass this shortcoming but I couldn’t find any applications which triggered the playing of a short notification sound when my device vibrated. Do you know of any (alternate) solutions?