microservices – Events for entity state changes

When an entity is changed, I want to raise an event to notify potential consumers about the state changes. My question is, should I have

  • an xxxChanged event for each attribute, or
  • a single EntityChanged event that identifies which attributes changed?

Having more specific events seems better to me, as consumers can subscribe to only the relevant changes. The problem I run into is when I have consumers that care when any of a set of attributes change. I could have it consume AttributeAChanged and AttributeBChanged, but if both A and B change I really only need the consumer to run once.

I’m not sure if this is a problem with how I’m thinking about the events, or if I need a way on the consumer side to potentially consolidate triggers.

xte – xbindkeys and xev as hold events

I currently use

"xte 'keydown Alt_L' 'key a' 'keyup Alt_L'"
        m:0x0 + c:192 + Release 

as an event to unmute zoom via a foot pedal. I was wondering if there is a way to configure it in a way that it sends alt+a once at the begin and at the end of pressing the button? Currently it only seems to work if I specify that the event is triggered after the release. The way xte handles events seems to be the reason for that.

Google Appscript – CalenderApp, create events from a spreadsheet and write relevant ids back to the spreadsheet

I have a function to create events for field based workers. Eventually I will add this to an onEdit trigger and give the user (centrally based admin worker) some functionality to edit/delete events after they have been created. To do the latter, I believe I will need to be able to isolate the event ID.

Whilst I can write events to a calendar and retrieve the event ID and index of the event just created. I am having difficulty in writing that information back to the spreadsheet (this would be used for edit/delete later in my program).

ws.getRange(4,13,indexes.length,1).setValues(eventIds); allows me to write ids to the spreadsheet but they are not writing to the correct row where the event was created.

How can I use the index stored in const indexes = (); to tell the function the correct row to write the id to. Or is there a better way to achieve this?

Any help would be amazing, I am still very much in the learning stage with Google Appscript. I have tried to research the problem to no avail and I was hoping that the wisdom of others might be able to show me where I am going wrong.

function createEvents(){

const ss = SpreadsheetApp.getActiveSpreadsheet();
const ws = ss.getSheetByName("Sheet Name");
const lr = Math.max.apply(0, ws.getRange('b:b').getValues().map(function (v, i) { if (v != '') { return i } else { return 0 } })) + 1;
const lc = ws.getLastColumn();
const cal = CalendarApp.getCalendarById("myCalId");

const allData = ws.getRange(4,2,lr-3,lc).getValues();
const eventIds = ();
const indexes = ();


const startDate = new Date(r(4));
const sDateHrs = startDate.setHours(8,0);
const endaDate = new Date(r(6));
const eDateHrs = endaDate.setHours(18,0);

if(r(10) === true && r(7) === 'In Progress'){

  var event = cal.createEvent(r(0), new Date(sDateHrs), new Date(eDateHrs), {location: r(1), description: r(3) });  
  var eventId = event.getId();

  eventIds.push((eventId));//pushing event ids to an array to call on later
  indexes.push((idx));//pushing the index of each id to use when writing the ids back to the spreadsheet

  ws.getRange(4,13,indexes.length,1).setValues(eventIds); //places event ids into spreadsheet but not in the correct rows. I want the ids to be written to rows corresponding to the indexes array

  return event;}});


c# – Exposing an event source as an interface, but where the source may expose events individually or as a collection

I am using a publish-subscribe event broker, and am constructing libraries to help people interact with this broker consistently.

One of the things I would like to design is some kind of IEventSource interface that each potential publisher could implement. The broker libraries would then natively understand the IEventSource interface, meaning the application developers would not need to code up all of the plumbing to get events from their system into the broker as publishers.

In trying to think about what this interface should look like, I am running into one fundamental problem: Some event sources will want to publish events in batches (for example, events coming from something like a database with change data capture, or events coming from files full of records). Other systems can natively raise events in a serial fashion as they happen, and would be publishing them one at a time.

So, what does my IEventSource look like? Does it expose the available events as a collection? Some kind of stream? As individual events via a GetEvent() method?

I could of course decide that the available events are always exposed as a collection, and if a particular publisher is publishing one at a time, they simply have a collection with a single member. But this seems inelegant and inefficient.

One important consideration is that the IEventSource will need to have some way of being told that the available events have been successfully received, because the goal is to guarantee successful transmission to the broker, with no events being lost. To use the cdc-enabled-database example again, we might get a batch of 500 events from the source, we then start publishing to the broker, and encounter some kind of issue on the 301st event. Ideally we wouldn’t want to retransmit all 500 messages, just pick up again at 301 and send the last 200. So we’d want to tell the source “you can go ahead and discard the first 300 now”. So in addition to some way to get events from the source (individually or in batches) I would want some way to “acknowledge” the receipt of events back to the source – again, individually or in batches.

I could, of course, simply have an IEventBatchSource and an ISingleEventSource, and build two different implementations using those two different interfaces all the way through the plumbing. But for obvious reasons I’d prefer not to write all of the plumbing twice.

unity – How to trigger OnMouseX events on Kinematic Rigidbody2D object with a different collider than one used for collisions?

I have a use-case where I have an object with a Collider2D and a Kinematic RigidBody2D in order to do Kinematic movement.

However, I also want to be able to select/hover that object with a OnMouseDown/OnMouseEnter/etc, using a larger collider than I would use for the kinematic movement.

My current attempt at a solution is to have Physics-related scripts/rigidbody2d/collider2d as the top level game object, and to have a child object, with a larger collider2D which will respond to OnMouseX events.

enter image description here

enter image description here enter image description here

In order to ignore OnMouseX events on the parent, I’m putting it into its own user_ignore_raycasts layer (I need it as its own layer for the layer collision matrix). I’m also putting the child in its own user_use_raycasts layer.

I’m passing that into a script that sets MainCamera’s event mask:
enter image description here

using UnityEngine;
public class CameraEventMasker : MonoBehaviour
    private LayerMask cameraEventMask;
    // Start is called before the first frame update
    void Awake()
        GetComponent<Camera>().eventMask = cameraEventMask;

What I notice is that OnMouseX events on the child will work IF the RigidBody2D on the parent is deleted…however, if the RigidBody2D is there, I won’t receive any events. Anyone know why this is the case, and if there are other workarounds or solutions?

finder – Automator “New File” workflow in Mojave returning “Not authorised to send Apple events to System Events.”

I have copied a workflow to create a new file from within the finder, saved in ~/Library/Services/. It runs fine from Automator and appears in the Finder > Services menu, but there’s no “services” menu when clicking in a blank area within a folder.

I’d expect to right-click on a blank space in a folder (or the desktop) and use the contextual menu and activate it.

The main issue is that the script runs fine from within Automator, but not from the Finder:

The action “Run AppleScript” encountered an error: “Not authorised to send Apple events to System Events.”

Has anyone else had this issues with a working script?

C# Events in Unity to separate GameObject features into Components

Broadly speaking, this is a question about how to separate my game object’s code into distinct feature components that can be added and removed as needed.

More specifically, I am trying to achieve this using C# events in Unity. But I am open to other solutions.

Scenario: We have enemies that have health. When their health reaches zero, they die. Some enemies (think asteroids) may spawn a number of child enemies (think smaller astroid pieces) when they die. Others however, just die.

I want to have two scripts:

  • EnemyHealth: Tracks the enemy’s health and kills the enemy when its health reaches zero.
  • EnemyChildrenSpawner: Spawns child enemies after the enemy’s death

This way, all enemies will have the EnemyHealth script, and some enemies will have the EnemyChildrenSpawner script in addition.

My idea is to have the EnemyHealth script raise an event when the enemy dies, and have EnemyChildrenSpawner subscribe to said event to spawn the children.

What would be the best way of achieving this?

Here’s my attempt. It works. Just not sure if this is good practice, especially using the GetComponent in the second script?


public class EnemyHealth : MonoBehaviour
    // The event to invoke when this enemy died
    public event EventHandler OnDied;

    // Gets called when this enemy's health reached zero
    private void Die()
        // Invoke the died event
        OnDied?.Invoke(this, EventArgs.Empty);

        // Destroy this enemy


public class EnemyChildrenSpawner : MonoBehaviour
    private void OnEnable()
        GetComponent<EnemyHealth>().OnDied += SpawnChildren;

    private void OnDisable()
        GetComponent<EnemyHealth>().OnDied -= SpawnChildren;

    private void SpawnChildren(object sender, EventArgs e)
        // Spawn children


posts – Hide Past Events from Displaying – AIT Themes Events & Events Pro Plugin

I am using AIT Themes City Guide and trying to configure the Events list to make sense. The theme plugin does not age out old events. I assumed this would be the bare minimum a plugin claiming to be an Event manager would offer. However, it seems I have to make this happen myself. Before you suggest it, the theme developer is not likely to be helpful. Despite having a full license, they have no plans to add this simple feature.

So, I would like to code this myself and the code would have universal benefits. Essentially, events in this theme are “formatted posts”. So, writing code to hide past events could be as simple as the code I found on this page:

How can I hide posts that are over 2 years old

Here is the code suggested:

add_action( 'pre_get_posts', 'filter_old_posts' );
function filter_old_posts($query){
    if( !is_admin() && $query->is_main_query()){
         add_filter('posts_where', $callback = function( $where = ''){
             $where .= " AND post_date > '" . date('Y-m-d', strtotime('-2 years')) . "'"; 
             return $where;
         add_filter('getarchives_where', $callback );

How can I modify the above to filter out posts older than the current date? How can I filter out just a single category?

Thank you!!

gmail – Change default calendar for automatically generated google calendar events

I’m a big fan of the Google calendar feature where a calendar event automatically gets generated from certain emails.
I would however like to have some more control of this process, akin to how I can set up filters that sort my email into separate folders or does other actions.

To be precise, now in corona-times, I get quite a lot of invites to various zoom/teams/etc.. meetings that are job related. I would like that these events show up in my work calendar and not in my private “default” calendar – while preferably leaving other events still in the “default” calendar.

Can this be done, and how?