TLP trouble with udev events. Ubuntu 19.04

My installation of TLP on Ubuntu 19.04 does not automatically change status when charging status changes.

    --- TLP 1.1 --------------------------------------------      +++ System Info     System         = HP Type1ProductConfigId HP Pavilion Gaming Laptop 15- cx0xxx     BIOS           = F.11     Release        = Ubuntu 19.04     Kernel         = 5.0.0-20-generic #21-Ubuntu SMP Mon Jun 24 09:32:09 UTC 2019 x86_64     /proc/cmdline  = BOOT_IMAGE=/boot/vmlinuz-5.0.0-20-generic root=UUID=60b2ea7a-4132-4a64-8f5c-2e6484bce09a ro quiet splash vt.handoff=1     Init system    = systemd v240     Boot mode      = UEFI      +++ TLP Status     State          = enabled     Last run       = 15:56:31,    795 sec(s) ago     Mode           = AC     Power source   = AC 

Changes to:

    --- TLP 1.1 --------------------------------------------      +++ System Info     System         = HP Type1ProductConfigId HP Pavilion Gaming Laptop 15-cx0xxx     BIOS           = F.11     Release        = Ubuntu 19.04     Kernel         = 5.0.0-20-generic #21-Ubuntu SMP Mon Jun 24 09:32:09 UTC 2019 x86_64     /proc/cmdline  = BOOT_IMAGE=/boot/vmlinuz-5.0.0-20-generic root=UUID=60b2ea7a-4132-4a64-8f5c-2e6484bce09a ro quiet splash vt.handoff=1     Init system    = systemd v240     Boot mode      = UEFI      +++ TLP Status     State          = enabled     Last run       = 15:56:31,    916 sec(s) ago     Mode           = AC     Power source   = battery 

When unplugging the power cable. Since TLP uses udev events (as far as I understand) the first step I did was to check if events are correctly recieved.

    sudo udevadm monitor     monitor will print the received events for:     UDEV - the event which udev sends out after rule processing     KERNEL - the kernel uevent 

I unplugged the cable a few times and saw the charging status on the laptop change but nothing being printed in the console running the above monitor.

Also note that I recently upgraded from Ubuntu 18.04 LTS to 19.04. It did however not work even before the upgrade.

Any ideas? I am at my wits end when it comes to this.

Using Observer Pattern to selectively act on events

I’m currently in the process of architecting a small RPG-style dungeon crawl (in Unity), and am a little stuck on how to update various objects when things change, while not updating unrelated objects. For this question, I will be using my current project as an example, but the question itself can be applied to any situation where multiple different kinds of Observers each watch a single Subject.

The design I’m currently leaning towards for object interactions in my game implements the Observer Design Pattern, where I have a single Subject (let’s call it GameEventManager), and each interactive object is an Observer of this Subject (this includes things like the player, enemies, interactive items on the ground, etc.).

When an event occurs (let’s say a User hits Spacebar to shoot an arrow at a selected enemy), the current plan I have for the action’s lifetime can be broken into steps:

  1. The Input system (not an Observer, but contains a reference to the Subject), sends an Event to the GameEventManager for broadcasting to the right place. I haven’t designed the Event class yet, to keep the problem simpler and in case I need to redesign things.
  2. The GameEventManager broadcasts the Event to the Player with the relevant information.
  3. The Player, realizing an Event came in saying to shoot an arrow, does some internal math (like subtracting from the total ammo it has, maybe performing some sort of animation visually), and emits a new Event to the GameEventManager telling it that the Player shot an arrow at “enemy2”.
  4. The GameEventManager broadcasts the Event to “enemy2”.
  5. “Enemy2” receives the Event, realizes that it got shot, and dies in some fashion.

So the question is, how does GameEventManager know where to pass around all these different types of events (i.e. the movement event should only go to the player, and the arrow should only go to “enemy2”). Also, once the event gets to its designated target(s), how do these Observers know what to do with the event (i.e. how does the player know to shoot an arrow, and not take damage?).

I’ve done some research on Observer examples, but most are either obscenely complex and abstract, or are just simple “Subject emits event to ALL observers, and ALL observers interact with EVERY event they get”, which is not what I want at all (an arrow shot at “enemy2” should not impact “enemy1” in any way).

Sorry if this is a little abstract, I like to have a plan before I start to actually build the code.

Also, as an aside, I am fully aware that in Unity I can have one GameObject directly interact with another, but the purpose of this entire project is to make everything as polymorphic and re-usable as possible, and most Unity tutorials simply don’t touch on extensibility at all.

Google calendar: events disappeared after I edited the calendar

I want to edit my working hours on Google calendar. After I finished editing, everything got updated.

Then I wanted to remove Saturdays, I was asked if I want to remove this event or all future events, I selected all future events, and suddenly all my events starting from next week got deleted.

I went to settings, selected my working hours, saw no change on the calendar, it’s still empty starting from next week. How to fix that?

How do transfer Google Calendar ‘all day’ events from one month to the other?

I put my tasks on my calendar as ‘all-day’ events (there is Google Tasks for Calendar but I don’t want to use it). However, since August ended with a Saturday, there is not a single day of September displayed on the month view of August, so I can’t drag-and-drop my events from August to September. I don’t want to click and go to the edit view of every single August event/task and change the date to September.

Is there a faster way?

Catching a custom DataGridViewCell’s events in a custom DataGridView

I have a pet VB.NET project that’s about 10 or so years old that I come back to mostly to test new practices on. Right now I’m trying to modify a DataGridView to contain a column that has three buttons on it: Add row above, Add row below, Remove row. I created a “simple” DataGridViewCell and DataGridViewColumn that contains these buttons (it’s actually not simple since the class is drawing each button manually) and I’m trying to raise events when a button is pressed. Based on the way I’m doing it I’m checking where the cursor is relative to the positions of the buttons. When the OnMouse event fires it determines which button has been pressed

Public Class DataGridViewInsertCodeCell     Inherits DataGridViewCell   Public Class InsertCodeEventArgs     Inherits EventArgs      Public ReadOnly Property CallingRow As UInt32      Sub New(row As UInt32)         CallingRow = row     End Sub  End Class  Public Event InsertAbove(ByRef sender As Object, ByRef e As InsertCodeEventArgs) Public Event InsertBelow(ByRef sender As Object, ByRef e As InsertCodeEventArgs) Public Event RemoveCode(ByRef sender As Object, ByRef e As InsertCodeEventArgs)  Protected Overrides Sub OnMouseUp(e As DataGridViewCellMouseEventArgs)     MyBase.OnMouseUp(e)     If e.Button <> MouseButtons.Left Then Exit Sub     If rInsertAbove.Contains(e.Location) And bInsertAbovePressed = PushButtonState.Pressed Then         RaiseEvent InsertAbove(Me, New InsertCodeEventArgs(e.RowIndex))     ElseIf rInsertBelow.Contains(e.Location) And bInsertBelowPressed = PushButtonState.Pressed Then         RaiseEvent InsertBelow(Me, New InsertCodeEventArgs(e.RowIndex))     ElseIf rRemoveCode.Contains(e.Location) And bRemoveCodePressed = PushButtonState.Pressed Then         RaiseEvent RemoveCode(Me, New InsertCodeEventArgs(e.RowIndex))     End If      '' Stuff involving button draw states goes here ''  End Sub 

This works fine if the event is caught outside the DataGridView I’ve created to handle it. I originally had it in my main form, but then I tried to move the handling into a custom datagridview that would just catch these events

Public Class AICodeEditor     Inherits DataGridView  Public Sub AICodeEditor_RowsAdded() Handles Me.RowsAdded     For Each row As DataGridViewRow In Me.Rows         For Each cell As DataGridViewCell In row.Cells             If cell.GetType = GetType(DataGridViewInsertCodeCell) Then                 AddHandler CType(cell, DataGridViewInsertCodeCell).InsertAbove, AddressOf AddCodeAbove                 AddHandler CType(cell, DataGridViewInsertCodeCell).InsertBelow, AddressOf AddCodeBelow                 AddHandler CType(cell, DataGridViewInsertCodeCell).RemoveCode, AddressOf OnRemoveCode             End If         Next     Next End Sub  Protected Overridable Sub OnRemoveCode(ByRef sender As Object, ByRef e As InsertCodeEventArgs)     Me.Rows.RemoveAt(e.CallingRow) End Sub  Private Sub AddCodeAbove(ByRef sender As Object, ByRef e As DataGridViewInsertCodeCell.InsertCodeEventArgs)     Rows.Insert(e.CallingRow, Me) End Sub  Private Sub AddCodeBelow(ByRef sender As Object, ByRef e As DataGridViewInsertCodeCell.InsertCodeEventArgs)     Rows.Insert(e.CallingRow + 1, Me) End Sub 

These are just the relevant code lines. Anyway, as lines are added, the cells get their handlers added, but when the events are raised they don’t seem to get caught anywhere. Why does the DGV not catch and handle these events? How can it handle them?

How can an event subscriber catch up with missed events?

At a conceptual level, what ways can a subscriber catch up with events it has potentially missed but needs to know about at a later time.

For example, a service is running and subscribes to events on an event bus. When the events arrive that it’s interested in, it updates its persisted data to keep up-to-date. However, the service stops for some reason and is re-started some time later. During this outage it’s missed some events that have been published.

How can the service catch up? Should the service be interested in catching up, or is there another way it can achieve eventual consistency?

How to filter rds events from ‘aws rds describe-events’?

If I run aws --profile dev rds describe-events,

I get output like these:

{     "Events": [         {             "SourceIdentifier": "dev-important-data",             "SourceType": "db-instance",             "Message": "CloudWatch Logs Export enabled for logs [audit, error, general, slowquery]",             "EventCategories": [],             "Date": "2019-06-27T05:26:02.469Z",             "SourceArn": "arn:aws:rds:us-east-1:141888792464:db:dev-important-data"         } } 

Is it possible to apply filter to the output such that I will only see events coming form a certain SourceIdentifier?

I tried

aws --profile dev rds describe-events --duration 1000 --filters "Name=SourceIdentifier,Values=dev-important-data" 

but i got the error:

Unrecognized filter name: SourceIdentifier 

Then I tried to use the value Events.SourceIdentifier, but still same kind of error: Unrecognized filter name: Events.SourceIdentifier

What is the right way to construct the filter?

How do I make events from an external calendar show on my main calendar?

I’m subscribed to an external calendar in Google Calendar, but it shows in a separate column. How do I “merge” it with my main calendar, so that events from it show in the same column as my events? This used to be the normal behaviour, but it seems to have changed recently.

For example I’m subscribed to Public Holidays in Quebec. It used to appear like this, with the event in question in brackets:

Firstname Lastname | -------------------+ [holiday]          | -------------------+ 09:00  Work        |        09:00-17:00 | 

Now it appears like this:

Firstname Lastname | Public Holidays in Quebec | -------------------+---------------------------+                    | [holiday]                 | -------------------+---------------------------+ 09:00  Work        |                           |        09:00-17:00 |                           | 

More details

I’m aware there’s a builtin “Holidays in Canada” calendar, but it’s also got a bunch of holidays in the rest of Canada that I don’t care about, like Feb 17 2020 has Family Day (regional holiday), Islander Day (Prince Edward Island), Louis Riel Day (Manitoba), and Nova Scotia Heritage Day (Nova Scotia). These are just clutter to me.

This applies to other cases too. For example I’m also subscribed to my work schedule and two calendars for an organization I volunteer with, and I want them to appear on my main calendar too.

I want the events from external calendars to show in a different color from my main.

Related: How can I add the British Columbia holidays to my Google Calendar?

I read Automatically create events in Google Calendar from external source, but the answers require using the Calendar API and setting up a scheduled job, which is more effort and complication than I’d like.

Automatically add a Facebook page’s events to Google Calendar

Is it possible to add a Facebook page’s events to Google Calendar, automatically when the page creates events in the future?

Facebook offers the “subscribed to this page’s events” functionality but it simply doesn’t work for me (the vast majority of events from the pages I have subscribed to don’t appear, very few do, randomly), and also it doesn’t add the events the Google Calendar.