algorithms – Find a list of actions that result in desired state

I have a problem that I need to solve, and I’m looking for which area of computer science (algorithms. etc) would be appropriate to solve this problem.

In the system we have a list of actions that a user has previously taken. The possible actions are:

  • User creates item of type A.
  • User creates item of type B.
  • User creates item of type C.

The date and time the action was taken is also recorded.

We have a function passesRules which takes the list of all actions the user has previously taken as input, and applies a set of rules and returns a boolean. The boolean is true if any of the rules are true, and false if none of the rules are true.

There are many possible rules, but in general they take the form of:

  • Has user created 5 items of type A in the last 10 days?
  • Has user created 2 items of type B in the last 3 days?
  • Has user created more than 6 items of type C in last 5 days, AND
    created 3 items of type A in the last 10 days?

What I want to do is to create a function predictActions which predicts the actions the user must take so that passesRules returns true.

Obviously with the rules described above there are multiple different sets of actions that could make passesRules return true. I would like predictActions to return an array where each element in the array is a list of actions the user could take to make passesRules return true.

predictActions should take the following parameters:

  • The list of actions the user has previously taken.
  • The list of rules.
  • The current date.

I’m not asking for a solution, but I don’t know what area of computer science to investigate further to model and solve this problem. Something from graph theory, or some type of constraint solver?

Thanks!

query – Problem using the “listagg” function to produce the desired result in Oracle PL-SQL

I’m working with listagg and I have a problem here. It does not give the desired result and I just do not know where the problem is .

The deposit_query might be like this :

sum (dep_balance) >1 and
sum (turnover)    >1 and
DEP_BRANCH_COD     = -1 and
DEPOSIT_GROUP_DESC = -1 and 
DEPOSIT_TYPE_DESC  = -1 and
CURRENCY_DESC      = -1

or it might be like this (without sum):

DEP_BRANCH_COD     = -1 and
DEPOSIT_GROUP_DESC = -1 and
DEPOSIT_TYPE_DESC  = -1 and
CURRENCY_DESC      = -1 

The desired result for first condition is :

DEP_BRANCH_COD     = -1 and 
DEPOSIT_GROUP_DESC = -1 and
DEPOSIT_TYPE_DESC  = -1 and
CURRENCY_DESC      = -1
group by customer_num
having sum (dep_balance) >1 and
       sum (turnover)    >1 and

and for second condition is :

DEP_BRANCH_COD     = -1 and 
DEPOSIT_GROUP_DESC = -1 and
DEPOSIT_TYPE_DESC  = -1 and
CURRENCY_DESC      = -1

What I’ve written so far is the query below and the problem is that the final result has theGroup by customer_num having in the second condition.

declare

   deposit_query varchar(1000) := 'DEP_BRANCH_COD     = -1, 
                                   DEPOSIT_GROUP_DESC = -1, 
                                   DEPOSIT_TYPE_DESC  = -1, 
                                   CURRENCY_DESC      = -1';
   actual_query varchar2(1000);

begin

   select listagg(case
                    when stm not like '%sum(%' then stm end,
                      ' AND ') within group(order by stm) 
                       || 
          listagg(case
                    when stm like '%sum(%' then stm end, 
                      ' AND ') within group(order by stm) || ' Group by customer_num HAVING ' 
  into actual_query
  from (select regexp_substr(deposit_query, '(^and)+', 1, level) STM
        from dual
      connect by regexp_substr(deposit_query, '(^and)+', 1, level) is not null);

dbms_output.put_line(actual_query);

end;

I was wondering if you could tell me how to modify my query to have the desired result.

thanks in advance

AES encryption (in Java) of different JSON strings always produce same encrypted string as result. Why?

I have a program written in Java which takes JSON string as argument, encrypts it using AES then encodes it using Base64.
JSON string is like:

{"a": "b"} or {"a": "n"} or {"a": "k"} 

I.e related object would have one property a. Value part is randomly generated.

Program outputs for above JSON inputs looks like

UBNvKoRoGqk0PTQQL5K4Sw==
bKwlToSND3HkceDExEDXSw==
u/yKJq1FdoifBM+AnadC3A==

i.e. they are unique.

Same goes for {"a":"gn"} — random string with length 2. Same for 3 and so on.

But starting from 7 program produces the same encoded string for different inputs. I mean following JSON strings taken as input:

{"a": "pzfovvs"}
{"a": "bqwuvck"}

produces same string as output:

Dwg0Xjkot8UBfn+vbcCfOS4KluXB6RCFQ932Y9ABtIg=

Same goes for length 8 and 9. Starting from 10 results became unique again.

What is the explanation of this strange phenomenon?

(I can post code if needed.)

What is the result of a bot attacking the wp-cron.php file?

I am trying to understand the wp-cron system better.

I have recently had instances of my server resources being used up, throwing 503 errors, and on investigation this always appeared to happen during a scheduled cron from a plugin or theme. Now, I know the native system in wordpress calls the wp-cron.php file every time a page loads (and I know that a better way to run crons is to get the server at timed intervals), but my question is this:

If a bot is attacking the wp-cron.php file accessing it over and over,
if it happens that a scheduled cron job is called into action, if that
cron job doesn’t execute by the time the bot accesses the wp-cron.php
file again, does this mean that the scheduled cron job is executed
again (and again and again) and therefore causing a spike in CPU and
RAM used?

Sorry if this is way off the mark, I just really want to understand why my site may have been getting these spikes in the past and why they always appeared to occur during a scheduled cron job.

appsec – What are the types of vulnerabilities that could result in exploits that do not require user interaction?

What are the existing types of vulnerabilities that could result in exploits that do not require user interaction (e.g. zero-click)? I’m trying to understand the type of zero-click attack type for us to plan proper mitigation in code.

issue with my film scanned result

I am new to film photography, i’ve got my 120mm film developed and scanned by a photo lab, and got this result,can someone tell me what all these flaws please? is it something with the film? or is it with the developing process?enter image description here

enter image description here

Lookslike there's a line

numerics – Numerical evaluation expression not returning result in requested precision

I have a long list of descriptive statistical quantities for a univariate list of data. The problem is that the set number of significant figures is ignored by the N(...,sigs) for two expressions that have dependencies (prior calculated values). I reduced the list of calculations down to only the non-working expressions and their dependencies.

Why are Es and Em not returned in requested precision of 3 significant figures? How can I fix this?

(* mathematica.stackexchange *)
{sigs = 3, sigsup = sigs + 1};
raw = {1, 2, 3, 4, 5}(* raw data *)
n = Length(raw)
σ2 = N(Variance(raw), sigs)
σ = N(Sqrt(σ2), sigs)
σmean = N(MeanDeviation(raw), sigs)
Es = N(.6745 σ, sigs)
Em = N(Es/Sqrt(n), sigs)

front end – Frontend/Backend Integration: Wait for a Google Cloud function to run and then return result

I am trying to create a tool that receives a user input on the front end, uses that input to run a Google Cloud function and then returns a link to the output, hosted on Google cloud as well.

How can you give updates that a process is being performed, and update the page when it is finished?

Is there a search engine with reverse search mechanism: processing multiple queries and retrieving a single result for each of them?

A regular search engine retrieves a number of results matching a single query. I need one that does the opposite: enables to input a number of queries and displays a single match to each of them. If there is no match, I need to know it too. An implementation of this approach exists, but its application is limited to the database embedding it (PubMed). Batch Citation Matcher enables a user to identify unique content in databases covering material also present in PubMed. A user can submit a text file and the engine transforms the content of the file separated in a required way into a number of queries, then displays a table with queries in one column and the information on whether the text of the queries was found in a database being compared to PubMed in another column. Is there an analogues application which can be applied to any website?

microsoft excel – Run randbetween function n times in a cell where n = the result of a randbetween funcion in another cell

How do I write a formula in excel to conduct the randbetween function n times in a cell where n is equal to the value of another cell?

For example, I have cell A2 calculating randbetween(1,10) and it returns a value of 6. How do I have cell B2 conduct randbetween (1,8) six times and show the values of each calculation so I have six numbers, each between 1 and 8?