Automatic running of SQL script when a new database is created

I need to run some SQL scripts (which are basically SELECT queries) every time some new data enters the database.

When I say enters the database, I do not mean INSERT/UPDATE queries executed on an existing table(s), but rather every time a new database is created.

I am using PostgreSQL as my SQL DBMS.

I have tried many approaches but none of them suit my requirement –

  1. pgAgent/pg_cron – requires a time constraint to be specified. Can only be triggered periodically.
  2. SQL TRIGGER – can be applied only on a database (INSERT/UPDATE/DELETE trigger to check if a query has been executed on a database, i.e., assuming the database already exists)

I am yet to try the usage of a Procedural Language (PL/PgSQL, PL/PERL), but it would be nice if someone could point me in the right direction before I proceed.

TL;DR: I need to run a SQL script on a PostgreSQL installation every time a new database is created (on a given server).

Ubuntu Server 18.04 – automatic fallback to stable kernel after crash

I am administrating a remote server and I am trying to verify if is possible to have a scenario when if it crashes after an update it resets and goes back to boot via the previous stable kernel (basically it falls back to the previous stable kernel). Is this possible to do via Grub in Ubuntu 18.04?


I have checked around but I could not identify a clean solution to do this in Ubuntu Server 18.04.

We had a problem with an unstable kernel recently and it had to be solved locally; since the server is in a different country we would prefer to avoid this scenario.

Thank you.

I want a media index to create automatic cross references

In a very limited environment – no programming or workflows, nothing other than SP2013 OOB – I have a media index to PDF documents stored in folders. What is the best way to automate as much as possible cross-referencing related articles, please?

Ideally, they would be stored in a document set but for now, I have to use folders.

Multiple articles can be related.

My ‘related to’ field is a choice set up; I am using a multiple line text field with hyperlinks to the other articles. This is the part I would love to automate. Grateful for advice on this.

How to best deal with the automatic ratings from songs in iTunes?

I hate how my Smart Playlists show songs that are unrated in my Smart Playlists which are often 2 or 3 stars or greater.

This site won’t let me make suggestions on how to deal with this, or post a reply or add a comment…so I’m answering my own question.

My solution is to:

  1. Highlight the songs that are “unrated”
  2. Right-click and choose “Dislike”
  3. Edit your Smart Playlist
  4. Add an additional rule selecting “Love”
  5. Select “Is Not” and “Disliked”

I will be keeping all of my songs Disliked if Unrated. There’s a 1/2 rating option I seen but I prefer this way because these unrated songs are Disliked until I decide to rate them anyway.

Automatic cell coloring via conditional formatting

I am working on a sheet for a game I play and having some trouble with cell coloring.

I have one sheet, named “PlayerList” which maintains a list of player names, class and role. Players are frequently added/removed from this list. This sheet has the format of:

Column A  Column B  Column C  Name      Class     Role Player1   Mage      Damage Player2   Paladin   Heal Player3   Warrior   Tank 

Classes have specific colors associated with them (e.g. Mage = blue, Paladin = pink, Warrior = brown, etc)

I have a second sheet which references the PlayerList sheet, and creates a full list of names with QUERY via the formula:

=QUERY(PlayerList!A3:C5,"SELECT A WHERE C = 'Tank' OR C = 'Heal' OR C = 'Damage'")  generates:  Player1 Player2 Player3 

I would like to have each player’s cell automatically colored depending on their class in PlayerList (e.g. if Player3 is a Warrior, then his name cell is brown). My initial thought was to use multiple Conditional Formatting rules with custom formulas (one for each class color), however, I am not really sure what the formula should be. Is it possible to implement colors when using IF() in a custom formula rule? Or is there a better way to go about this?

The best I could come up with was to make multiple Conditional Formatting rules that check individual player names, however, this is not ideal as I then have to manually adjust the formatting rules every time a player is added/removed from PlayerList.

Here is an example sheet if it helps:

I have manually colored the names on the second sheet, but I would like them to be automated.

How can I disable automatic update for a single snap in Ubuntu?

The recommended way for a system wide installation of Intellij idea is to use snap. When I do that, snap updates the IDE installation which is a big problem for me because updating the development environment causes issues for me and as a developer I’d like strict control of my development environment.

If I disable snap, then I cannot even start the IDE. Google searches return nothing but meaningless long flame wars or complete suspension/disabling of snap.

Is there any way of simply telling snap not to update a piece of software while keeping all else up to date?. I’m using Ubuntu 18.04

mouse failure after automatic update

I have been using NetBeans 9.0 on this MacBook Pro for some time, and everything has always worked perfectly. But now, all of a sudden, the mouse – that still works with every other function on the computer – won’t work with NetBeans. Neither selecting nor setting the cursor to a location work, nor can I select/activate any NetBeans function button, although I can exit netbeans using the red exit button. It is possible to move around in the code window using the arrow keys, and keyboard input is accepted normally. Restarting Netbeans, and booting the computer, have no effect. There was no new driver for the mouse. The mouse is a razer, but since it still works normally with every other application, that doesn’t seem likely to explain it.

There was a recent MacOS update but the problem didn’t appear immediately after that.

I have searched the web, and the Stack-Exchange user forums, and the NetBeans support services, to no avail.

It it possible to avoid’s automatic online check-in and instead do it manually by yourself?

I have a WestJet Flight LGW-YYC that I booked using WestJet offers free seat selection with the online check-in on their homepage (see their FAQ at ” Can I still select my seat if I don’t want to pay the fee?”).

With the automatic online check-in that provides by default, I can not select the seat for free during check-in, instead I have to pay a 30€ fee.

Can I avoid the automatic check-in by, do the check-in manually by myself on the WestJet homepage, and in this way select my seat for free?