How to create and store a plot for each iteration of a Do loop

I have created the following code below. Its purpose is for me to divide the plot into grids and for each grid I reterive the center point’s co-ordinates.

dp = DensityPlot[(E^-(x^2 + y^2)^2)^2 + ((E^-(x^2 + y^2)^2) (x^2 +           y^2) Cos[2 Pi])^2, {x, -3, 3}, {y, -3, 3},     PlotTheme -> "Minimal", PlotRange -> All, PlotPoints -> 50,     ColorFunction -> "Rainbow"]; ClearAll[centers2] centers2[region_ : Disk[{0, 0}, 1]][{nc_, nr_}, {xrange_, yrange_}] :=   Select[RegionMember[region]]@centers[{nc, nr}, {xrange, yrange}] {xrange, yrange} = {{-3, 3}, {-3, 3}};  {nc, nr} = {10, 10};   Show[dp, Graphics[{White, PointSize[Medium], Circle[],     Point@centers2[][{nc, nr}, {xrange, yrange}]}]] means[n_] := MovingAverage[Subdivide[##, n] & @@ #, 2]; &;       cp = centers2[][{nc, nr}, {xrange, yrange}]  

Next I have made a Do loop that will perform calcualtions to get a variable called angle. This code is given below.

Do[point = Part[cp, i]; x = Part[point, 1]; y = Part[point, 2];   ex = (E^-(x^2 + y^2)^2)^2;   ey = ((E^-(x^2 + y^2)^2) (x^2 + y^2) Cos[2 Pi])^2;  s1 = ex^2 - ey^2;  s2 = 2 ex ey Cos[0];  inside = 2 s2/s1;  angle = ArcTan[inside], {i, Length[cp]}] 

Now what I would like to have a command inside the Do loop that I can use to plot an ellipse based on the variable angle (this will be used to give the angle that the semi major axis makes with the x axis) for very iteration of the Do loop. There is a constant semi and minor axis. The point the ellipse will have to be centered at is the point that is currently being used in the Do loop.

I am not sure how to do this inside the loop for all the iterations, however I have a found a method to plot an ellipse given as

ellipsoid[center_, {majorradius_, minorradius_}, angle_] :=   GeometricTransformation[   Ellipsoid[center, {majorradius, minorradius}],    RotationTransform[angle, center]] ad = Pi/3; sd = Graphics[{EdgeForm[{Thick}], Opacity[.75], Transparent,     ellipsoid[{0, 0}, {0.2, 0.1}, ad], Opacity[1], Red, Point[{0, 0}],}] Plot[3, sd, {x, -10, -10}] 

I also would like to store these plots as I would like to then combine all of these ellipse plots onto the densityplot I have made in the beginning

All help is much appreciated

Connect two remote oracle databases as a schemas on each other

This Question is about Oracle Database.

I have two remote databases DB_1 and DB_2, and I have two schemas on each database: Schema DB_1 and Schema DB_2 on database DB_1, and Schema DB_1 and Schema DB_2 on database DB_2. I want to reach database DB_2 Schema DB_2 from database DB_1 Schema DB_1. For example: when I try this query in DB_1 from schema DB_1:

SELECT * FROM DB_2.example_table

I got an error because there is not table "example_table" in DB_2 Schema on the DB_1 database. But, when I try the same query on DB_2 Schema DB_2, I got the correct result (some data).

So, I need to tune my databases in some way so I can SELECT * FROM DB_2.example_TABLE from DB_1 Database.

But, there is another problem, I don’t have permission to CREATE LINK. However, when I query SELECT * FROM ALL_LINKS; on my production database DB_1 schema DB_1 – there are no links at all. So, I need to figure out which way my production Databases was linked (unfortunately my colleagues don’t know either). On my production database DB_1 schema DB_1 I can fetch data with the query:

SELECT * FROM DB_2.example_table

And the data I got is the same if I try to query the same on DB_2 production database DB_2 schema.

But there are no public\private Links on DB1/DB2 production databases at all. Is there another way to create a "connect" between my databases? (I queried SELECT * FROM ALL_LINKS from DB_1 schema DB_1, is this possible so I can fetch some other data if I try the query on DB_1 schema DB_2?)

Thanks in anticipation!

Retrieve total of products ordered for each customer from WooCommerce “wc_order_product_lookup” table

I want to retrieve the sum of all products ever ordered by customer using the "customer id". enter image description here

And I want to display it in a table on a new wordpress page, kinda like this. Basically SELECT SUM(product_qty) FROM wc_order_product_lookup for each customer and show it in a table, like the one designed in paint. Thank you to anyone that will take the time to reply to this. enter image description here

How to take backup of a notebook and export it automatically every each 5 minutes?


Question

I want to let Mathematica automatically make a backup of an active notebook and export it to somewhere else (something like Wolfram Cloud or Google Drive) frequently.

"frequently" means whatever it is convenient, like "every 5 minutes", "every time the user manually saves it by Ctrl + S", and so on.

Is there any way to do it? I use Mathematica version 12.0 on Windows 10.

Any information would be appreciated.

Background

I’ve experienced losing the edit on my notebook before by an inevitable accident. I mistakenly evaluated the cell which included infinite loop and I had to force stopping Mathematica from task manager, because it froze. The next time I launched Mathematica and opened the notebook, even my edit I did save by Ctrl + S before the infinite loop started was somehow lost. I want to avoid that by frequent backup and I want to confirm it by automating it.

How to get count of an object, through 3 different tables in postgres with ID’s stored in each table

I’m currently using Postgres 9.6.16.

I am currently using 3 different tables to store a hypothetical users details.

The first table, called contact, this contains:

ID, Preferred_Contact_Method 

The second table, called orders, This contains:

ID, UserID, Contact_ID (the id of a row, in the contact table that relates to this order) 

The Third Table, Called order_details

ID, Orders_ID (the id in the orders table that relates to this order details) 

The tables contain other data as well, but for minimal reproduction, these are the columns that are relevant to this question.

I am trying to return some data so that i can generate a graph, in this hypothetical store, There’s only three ways we can contact a user: Email, SMS, or Physical Mail.

The graph is supposed to be 3 numbers, how many mails, emails, and SMS we’ve sent to the user; since in this hypothetical store whenever you purchase something you get notified of the successful shipment, these methods are 1:1 to the order_details, so if there’s 10 order_detail rows for the same user, then we sent 10 tracking numbers, and since there can be multiple order_details (each item has a different row in order_details) in an order, we can get the count by counting the total rows of order details belonging to a single user/contact, then attributing to what kind of contact method that user preferred at the time of making that order.

To represent this better: If a new user makes a new order, and orders 1 apple, 1 banana, and 1 orange. For the apple, the user set preferred tracking number delivery as SMS, for the banana, they set it to EMAIL, for the orange, they thought it would be funny to set the tracking number delivery via MAIL. Now, i want to generate a graph to this users preferred delivery method. So i’d like to query all those rows and obtain:

SMS, 1 EMAIL, 1 MAIL, 1 

Here’s a SQL Fiddle link with the schema and test data: http://sqlfiddle.com/#!17/eb8c0

the response with the above dataset should look like this:

method | count SMS,     4 EMAIL,   4 MAIL,    4 

Do the Fire Elemental’s Fire Form trait’s and Touch attack’s ongoing fire damage stack with each other?

Inspired by the following:

  • Does the Fire Elementa's Touch attack's ongoing damage stack with itself?

I realized that my own answer to that question hinges on the idea of features having the same name, but the Fire Elemental actually has two different features that cause extremely similar effects.

Notably it has the Fire Form trait and the Touch attack which state:

[…] In addition, the elemental can enter a hostile creature’s space and stop there. The first time it enters a creature’s space on a turn, that creature takes 5 (1d10) fire damage and catches fire; until someone takes an action to douse the fire, the creature takes 5 (1d10) fire damage at the start of each of its turns.

[…] If the target is a creature or a flammable object, it ignites. Until a creature takes an action to douse the fire, the target takes 5 (1d10) fire damage at the start of each of its turns.

Do these two ongoing effects stack with each other?

Automatically set x=0, after each input/output ? ($AfterEachInputOutput)

Is it possible to do something that I want, after each input/output automatically and silently?
I am looking for a feature like $ AfterEachInputOutput in the following code :

Example : to set variable x to 0 after each output

In[1] $  AfterEachInputOutput=(x=0;) ---> x=0 automatically and silently (not important because this is a starting step) In[2] x=2;x+2 Out[2] 4 ---> x=0 automatically and silently In[3] If[x=0,100,-100] Out[3] 100 ---> x=0 automatically and silently In[4] x=1;y=1; ---> x=0 automatically and silently In[5] x+10 Out[5] 10 ---> x=0 automatically and silently 

I have tried

$  Post=(x=0;) 

or

$  Preprint=(x=0;) 

But it didn’t work well.