Finding rows that are missing specific value in a set

The database that I am using is MySQL. I have an options table that roughly looks like this

id          int(10) PRIMARY annex_id    int(10) title       varchar(255) sort_order  INT(10) NOT NULL 

Every annex (annex_id) has bunch of options enumerated by sort_order column which varies from 1 to N and are controlled by humans.

Due to software bug from a couple of months a lot of annexes do not have an option with sort_order == 1 but rather start from 2 or 3.

What I want to do is get all the annex_id‘s which contain options that do not have sort_order == 1. I’ll show an exemplary table because I feel like I’m explaining it wrong (which could be the reason I can’t come up with a query for it and I’ve been at it for hours).

ID Annex ID Title Sort Order
12 567 Title #1 1
13 567 Title #2 2
14 567 Title #3 3
15 890 Another title #1 2
16 890 Another title #2 3

From the given table I pretty much want craft a query that would get annex id 890 because it doesn’t have a row with sort order == 1.

The table has hundreds of thousands of rows and going at it by hand is insane. I’ve been dealing with databases for years and either I’m overthinking it or idk what but I can’t come up with an efficient query to do this job.

Is it even possible to have a query like this?

Finding all the Combinations – N Rectangles inside the Square

I am a beginner in Computational Geometry (Combinatorics) using Wolfram Mathematica and I need help from experts in the field.

How can I compute all the possible combinations: 6 Rectangles inside the Square (10×10) using Wolfram Mathematica?

Considering that the RESTRICTIONS of the problem are:

1) No Rectangle Can Overlap  2) The 6 rectangles may be vertical or horizontal 

See the image examples of possible and accepted solutions: Image-Accepted-Solutions-Examples

OUTPUT – Vector 100 elements by line (TEXT FILE):


0,1,1,0,0, . . . , 0,0,6,6,6 (Note: Image Example 01)
1,1,1,0,0, . . . , 0,0,0,4,4 (Note: Image Example 02)
0,0,5,5,0, . . . , 0,0,1,1,1 (Note: Image Example 03)
0,0,0,2,2, . . . , 0,0,0,0,0 (Note: Image Example 04)
0,0,0,0,2, . . . , 0,0,0,0,0 (Note: Image Example 05)
6,6,6,0,0, . . . , 0,4,4,4,0 (Note: Image Example 06)
Continue Combination…


Note: Please, do not put mathematical formulas. I would like the source code in Wolfram Mathematica that processes the input data (execute combinatorics task respecting the restrictions) and writes the direct output for text file to each iteration due to combinatorial explosion problems (Memory Overflow). Being that the detailed text output it is the example above: "OUTPUT – Vector 100 elements by line"

PostgreSQL Function – Finding the difference between 2 times

I want to create a simple function in Postgres to find the difference between 2 TIME – not TIMESTAMP. As show below, it accepts 4 parameters: hour, minute, second and expire (hour). In this example I have commented out seconds, just working on minutes.

CREATE OR REPLACE FUNCTION time_diff(hr INT, min INT, sec INT, exp_hr INT) RETURNS INT LANGUAGE plpgsql AS $  $   DECLARE     cur_time    TIME;     expire_time TIME;      diff_interval INTERVAL;     diff INT = 0; BEGIN     cur_time    = CONCAT(hr,  ':',  min, ':', sec) AS TIME; -- cast hour, minutes and seconds to TIME     expire_time = CONCAT(exp_hr, ':00:00') AS TIME;         -- cast expire hour to TIME      -- MINUS operator for TIME returns interval 'HH:MI:SS;     diff_interval = expire_time - cur_time;      diff = DATE_PART('hour', diff_interval);      diff = diff * 60 + DATE_PART('minute', diff_interval);      --diff = diff * 60 + DATE_PART('second', diff_interval);      RETURN diff; END; $  $  ; 

Example: 01:15:00 – 02:00:00 should give me 45 minutes, so I do the following and I get the correct answer.

select * from time_diff(1, 15, 0, 2); 

However, if I do this: 23:15:00 – 01:00:00 – the should give me 105 minutes (60 + 45).

select * from time_diff(23, 15, 0, 1); 

But the result I am getting is -1335. I am trying to work out where I have gone wrong here.

Also I am invoking DATE_PART functions, this seems to be a quite an expensive process in terms of CPU usage. Is there a better way of optimising this function. With the first example I am getting results in 0.007s on 2018 i7 Mac mini. Although I do think this function is quick, but could it be better?

Thanks

Adsense Reporting – Finding Earning not Attributed to an Ad Unit

I’ve been a publisher using Adsense since 2006.

Up until sometime in 2020, I was pretty good with having all ad placements allocated to (or "tied to") Ad Units.

Recently though, as much as half of my actual earnings don’t show up in the Ad Units report. e.g. If my overall earnings on a given day was $ 60, only $ 30 of that shows up in the Ad Units report.

Clearly I must have an ad (or multiple ads) running that don’t have an Ad Unit?

How would I go about troubleshooting that?

It’s all on the same site/domain so hopefully it won’t be too hard to track down.

finding FWHM of a dataset with unknown mathematical equation

I have a dataset. I have plotted using "Listloglinearplot". Now I need to find the FWHM (full width half maxima) of the same, However I dont know which mathematical eqution describes best to fit my dataset to find out FWHM. I have the following data and plot:

dataset={{0., 0.0518175}, {1., 0.0306299}, {1.9, 0.610295}, {2.,    1.32653}, {2.2, 4.01183}, {2.5, 6.37931}, {3., 6.50091}, {5.,    6.54052}, {6., 6.57276}, {8.2, 6.59119}, {15., 6.56125}, {20.,    6.5267}, {30., 6.4484}, {45., 6.2987}, {60., 6.11953}, {75.,    5.84962}, {90., 5.43738}, {100., 4.96757}, {105., 4.54382}, {120.,    3.42917}, {135., 2.23092}, {150., 1.55222}, {165., 0.679385}, {180.,    0.444479}} dataplot =   ListLogLinearPlot[dataset,    PlotStyle -> {Dashing[{.0071, 0.005, 0.005}], Blue},    PlotMarkers -> {\[FilledCircle], 15}, Frame -> True,    FrameStyle -> Directive[Black, Thickness[0.002]],    FrameLabel -> {Style["x", Black, FontFamily -> "Times New Roman",       FontSize -> 26],      Style["y", Black, FontFamily -> "Times", FontSize -> 26]},    PlotRange -> {{0, 190}, {1, 7.2}}, FrameTicks -> Automatic,    ImageSize -> 650,    BaseStyle -> {FontFamily -> "Times", FontSize -> 10}] 

Can anyone please help me with the mathematical equation?

Thank you.

Is Wisdom (survival) skill used for both tracking and finding tracks?

It is mentioned that to follow tracks you need to find them. It is also mentioned it can take up to an hour outdoor to find tracks you have lost (all under tracking, which is Wisdom (Survival).

The way I read it would be to use Survival no matter the situation (for both finding and following) but I read some people would use perception or investigation to find the tracks. When looking at the table for Sylvan random encounter in DMG p.87, in one entry it uses Wisdom (Survival) to both find and follow the tracks.

Also, I see a problem using other skills to find the tracks for a Ranger character because Ranger favored enemy feature states you have advantage on Wisdom (Survival) to track your favored enemy. Then it would be very strange for the Ranger not being able to find tracks he could easily follow due to his advantage on a check. And what if the Ranger for some reason is not proficient in perception would never be able to find tracks so not able to follow any?

So, the question is easy but I fear the answer is not as I was not able to find a straight answer to it.

I want to make sure that any character who want to become a good tracker (either through ranger or rogue sub-class) can do so. I feel that having to be good at 2 or 3 skills to accomplish one thing (i.e.tracking) is not the common usage of skills in 5e.

thanks for helping out.