JavaScript: TypeError: xyz is not a function after updating WordPress

After updating WordPress from 4.9.13 to 5.3.2, some scripts on the website stop working strangely … (example for clndr.js).

All scripts are added through wp_register_script Y wp_add_inline_script WordPress functions.

At the bottom of There are three scripts as always:




Relevant part of calendar.js

function create_calendar()
{
    var calendar = $('#Calendar').clndr({
        // clndr options
    });

    return calendar;
}

All scripts must be executed in the correct order, but they do not work and in the browser console I have this error:
TypeError: $(...).clndr is not a function

Also, change the call to create_calendar In this way:

window.addEventListener("load", function(){
    var calendar = create_calendar();
});

just change the order of errors in the console.

If I understand everything correctly, this should work …
Any ideas? Or hints how to debug this?

calculation – Source of the formula for the divergence of the vector function in spherical coordinates

I want to calculate the divergence of the vector function. $ F (r, theta, phi) = (r ^ 2, rsin phi, 0) $. I assumed that to do this I could calculate the divergence in spherical coordinates, which would be: $ nabla F (r, theta, phi) = 2r $.

However, my textbook shows the result in Cartesian coordinates such as: $$ nabla F = frac {1} {r ^ 2sin theta} ( frac { delta} { delta r} (r ^ 2sin theta F_r) + frac { delta} { delta theta } (r sin phi F_ theta) +
frac { delta} { delta phi} (rF_ phi)) $$

I've also seen that it applies here, but they don't really give any context about the origin of this formula and it doesn't appear in any of my textbooks.

Can anyone explain / point out a good derivation of this formula? Also, why don't we take the divergent in the same coordinate system as the vector function?

optimization – Optimize the table in the large online table DDL function

I am running optimize table in MySQL table size 340 GB in size and storage engine is InnoDB.

mysql> show variables like '%tmp%';
+----------------------------+------------------+
| Variable_name              | Value            |
+----------------------------+------------------+
| default_tmp_storage_engine | InnoDB           |
| innodb_tmpdir              |                  |
| max_tmp_tables             | 32               |
| slave_load_tmpdir          | /dbtmp/mysql_tmp |
| tmp_table_size             | 33554432         |
| tmpdir                     | /dbtmp/mysql_tmp |

The tmpdir directory is filling space.

/dev/mapper/vgdbtmp-lvdbtmp
                      296G  231G   51G  83% /dbtmp

What will be the alternative solution to optimize the table without creating a copy of the table.

MySQL Version 5.6

mysql> select version();
+------------+
| version()  |
+------------+
| 5.6.46-log |
+------------+
1 row in set (0.01 sec)

I have read the MySQL link below.

MySQL 5.6.17: Improved Online Optimize Table For INNODB and PARTITIONED INNODB Tables

https://dev.mysql.com/doc/refman/5.6/en/optimize-table.html

Prior to Mysql 5.6.17, OPTIMIZE TABLE does not use online DDL. Consequently, concurrent DML (INSERT, UPDATE, DELETE) is not permitted on a table while OPTIMIZE TABLE is running, and secondary indexes are not created as efficiently.

But here nobody is firing DDL / DML / select in the table at the moment.

It must run online without creating a copy of the table, right?

Discrete math: how do I know if this function is both One-to-One and "Onto?"

I'm sure the question I have is probably quite simple, but I'm not 100% sure about it.

In class, we had this function:

F: R X (R {0}) -> R, f (x, y) = $ frac {x} {y} $

As I understand it, the function is not one to one because a situation could occur in which it has different values ​​that result in the same response (that is, $ frac {10} {1} $= 10, $ frac {100} {10} $= 10), but I'm not so sure when it comes to finding if it's "in".

As I understand it, all values ​​should be possible if they are plotted (think of a parabola g (x) =$ x ^ 2 $-2 where G is R-> R; not all values ​​below -2 are used, so it is not "over" or one to one), but I am not so sure of this.

Am I thinking about this the right way?

Customization: adjust the youtube url in the shortcode function using str replace

Therefore, I want to use a YouTube insert plug-in instead of the default WordPress insert.

I disable the default insertion of youtube and add a str replacement to remove the url from youtube simply by leaving the video id. And I need to wrap that in a shortcode.

Basically, how do I add a final short code bracket in the function?

This is what I have so far 🙂

remove_filter (& # 39; the_content & # 39 ;, array ($ GLOBALS (& # 39; wp_embed & # 39;), & # 39; autoembed & # 39;), 8);

replace_content function ($ content)
{
$ content = str_replace (& # 39; https: //www.youtube.com/watch? v = & # 39 ;, & # 39; (youtube & # 39 ;, $ content);
return $ content;
}
add_filter (& # 39; the_content & # 39 ;, & # 39; replace_content & # 39;);

Does the partition function verify if there is a list of values, if it does not iterate through the list and add a new partition value to the partition function?

I have an azure sql db with a partitioned table with a partition function in varchar datatype.

In an Etl process I will get a list of partition values ​​as a parameter that I will need:

  • check the partition function if the partition values ​​exist, if not, repeat the list of values ​​and add to the partition function.

  • For the list of partition values ​​provided as a parameter, repeat the $ partition function to get the partitions in a new variable as a comma-separated list

  • truncate the partitioned table with the command: truncate parttable with partitions (@newvariable)

Please notify

online sharepoint: the click of the SPFx JQuery dialog button does not find a public function

I am new to the development of TypeScript and SPFx.

I have a jquery UI dialog box and a public function in the same class that makes some MSGRAPH calls after clicking the button.

The button click returns with error:

this.addAlert is not a function

I think the problem is that the dialogue code is executed outside the context of the web part and therefore does not know the function available in the context of the web part.

How can I use the click of the button to execute within the context of the web part?

Here is the dialogue code.

    public render(): void {

    this.domElement.innerHTML = AlertTemplate.templateHtml;
    const dialogOptions: JQueryUI.DialogOptions = {
      width: "50%",
      height: "auto",
      buttons: {
        "Subscribe": function (e) {
          this.addAlert("Yes");
          jQuery(this).dialog("close");
        },
        "No Thanks": function (e) {
          console.log("moo");
          this.addAlert("No");
          jQuery(this).dialog("close");
        },
        "Ask me later": function (e) {
          this.addAlert("Ask Me Later");
          jQuery(this).dialog("close");
        }
      }
    };

    jQuery('.dialog', this.domElement).dialog(dialogOptions);
    jQuery(".ui-dialog-titlebar").hide();
  }

addAlert function

public addAlert(status: string): void {
var url = "/sites/" + this.context.pageContext.site.id + "/lists";
var listId = "";
var email = this.getCurrentUserEmail();
var recordExists = false;
let item: SubscriptionListItem;
this.context.msGraphClientFactory
  .getClient()
  .then((client: MSGraphClient): void => {
    client
      .api(url)
      .top(1)
      .filter("equals=(displayName, 'Subscriptions'")
      .version("v1.0")
      .get((err, res) => {
        if (err) {
          console.error(err);
          return;
        }
        console.log(res);
        listId = res.id;
      });
  });

reference request – Generalization of the ordinary generation function (relevant for the branching / percolation process)

Leave $ p $ be a probability distribution in non-negative integers. The ordinary generating function associated with this distribution, $$ G_p (x) = sum_ {k = 0} ^ infty p (k) x ^ k, $$ It can be interpreted as follows. Leave $ K $ be drawn according to $ p $ and then leave $ S sim text {Binomial} (K, x) $. Then $ G_p (x) $ is the probability that $ S = K $.

We can generalize this definition: Let $ K $ be drawn according to $ p $ and then leave $ S sim text {Binomial} (K, x) $. Then $ G_ {p, a} (x) $ is the probability that $ S geq K-a $. It can be written explicitly as $$
{G} _ {p, a} (x) = sum_ {k = 0} ^ infty p (k) sum_ {m = 0} ^ {a} binom {k} {m} (1-x ) m x km.
$$

This element naturally appears in certain filtration problems (generalizing the role of $ G_ {p, 0} $ in the study of the probabilities of extinction of a branching process based on $ p $)

Does this family of functions have a name or other applications?

algorithms: convert a function with a single parameter into a function with multiple parameters

I have been solving some questions about algorithms recently and a pattern that I have observed in some problems is the following:

Given a string or list, perform an aggregation operation on each of its elements. Here in each of these elements we apply some recurrence to solve it.

An example of one of these problems is below.


Issue: Dice n integers return the total number of binary search trees that can be formed using the n integers

To solve this problem, I define a recurrence relationship as follows:

f(n) = 1 // if n = 0
f(n) = ∑ f(i) * f(n-i-1) where 0 <= i <= n-1

This works and I get the correct answer, however, I want to modify the function a bit.

Instead of expressing the function in terms of f(n) I want to express it in terms of f(n, i) So you can delete the summary. However, I can't do it correctly.


Code

My code to solve the problem by defining recurrence in terms of f (n) is as follows: (I am aware that DP can optimize it, but that is not what I am trying to do here)

public int f(int n) {
    if(n == 0)
        return 1;

    int result = 0;
    for(int i = 0; i< n; i++)
        result += f(i) * f(n-i-1);
    return result;
}

I want to remove that for the loop and instead express the function in terms of f(n,i) instead of f(n).


Question

  1. How to convert the recurrence shown above f(n) to f(n,i) and delete the summary?
    • Here & # 39; n & # 39; is the size of the list of elements e & # 39; i & # 39; It is the ith element of the list that we choose to be the root of the tree.

Cryptography: is there necessarily an infinite number of inputs for any given output in a hash encryption function?

This could be a very easy question. Consider the cryptographic hash functions with the usual properties, weak and strong collision resistance and preimage resistance.

For any given output, there are obviously multiple entries. But is that necessarily an infinite number of pre-images, for any given hash value?

How would you give a formal proof that there is no hash h () encryption function such that there is a given value v = h (m *) for which the possible set of inputs m * is finite? Would this necessarily break the resistance to collision?