plotting – How to compile the following code in short span?

The following code compiles soon for small values of n (n=2) but when n=10 in such cases it takes much time. For n=10 case even after 7 hours i did not get output. So could anyone please help me to solve this issue.

Thank you

a = 1;
(Alpha) = 3/4;
n = 10;
h = a/n;
Subscript(t, 0) = 0;
Subscript(f, 1)(t_) := (Exp(t)*Sin(t)) + (Exp(t)*Cos(t));
Subscript(f, 2)(r_) := -(Exp(r)*Sin(r)) + (Exp(r)*Cos(r));
x(Subscript(t, 0)) = 0;
y(Subscript(t, 0)) = 1;
Subscript(t, 0) = 0;
Subscript(d, 1) = 0;
Subscript(d, 2) = 1;
Subscript(g, 1)(c_, d_) := (Exp(c)*Sin(c)) + (Exp(d)*Cos(d));
Subscript(g, 2)(q_, w_) := -(Exp(q)*Sin(q)) + (Exp(w)*Cos(w));
For(j = 1, j <= n, j++, Subscript(t, j) = (j*h);
 Subscript(e, 1) = 
  x(Subscript(t, j - 1)) + 
   h^((Alpha))/
    Gamma((Alpha) + 1) Subscript(f, 1)(Subscript(t, j - 1));
 Subscript(v, 1) = 
  y(Subscript(t, j - 1)) + 
   h^((Alpha))/
    Gamma((Alpha) + 1) Subscript(f, 2)(Subscript(t, j - 1));
 
 x(Subscript(t, j)) = 
  h^((Alpha))/
    Gamma((Alpha) + 
      2) ((j - 1)^((Alpha) + 1) - (j - (Alpha) - 
         1) j^((Alpha))) Subscript(f, 1)(Subscript(t, 0)) + 
   Subscript(d, 1) + 
   h^((Alpha))/
    Gamma((Alpha) + 
      2) Sum(((j - k + 1)^((Alpha) + 
           1) - (2*(j - k)^((Alpha) + 1)) + ((j - k - 1)^((Alpha) + 
            1))) Subscript(f, 1)(Subscript(t, k)), {k, 1, j - 1}) + 
   h^((Alpha))/
    Gamma((Alpha) + 2) Subscript(g, 1)(Subscript(e, 1), Subscript(v, 
     1));
 y(Subscript(t, j)) = 
  h^((Alpha))/
    Gamma((Alpha) + 
      2) ((j - 1)^((Alpha) + 1) - (j - (Alpha) - 
         1) j^((Alpha))) Subscript(f, 2)(Subscript(t, 0)) + 
   Subscript(d, 2) + 
   h^((Alpha))/
    Gamma((Alpha) + 
      2) Sum(((j - k + 1)^((Alpha) + 
           1) - (2*(j - k)^((Alpha) + 1)) + ((j - k - 1)^((Alpha) + 
            1))) Subscript(f, 2)(Subscript(t, k)), {k, 1, j - 1}) + 
   h^((Alpha))/
    Gamma((Alpha) + 2) Subscript(g, 2)(Subscript(e, 1), Subscript(v, 
     1))
 )
ListPlot(Table({Subscript(t, j), x(Subscript(t, j))}, {j, n}))
```

microservices – Where to place an in-memory cache to handle repetitive bursts of database queries from several downstream sources, all within a few milliseconds span

I’m working on a Java service that runs on Google Cloud Platform and utilizes a MySQL database via Cloud SQL. The database stores simple relationships between users, accounts they belong to, and groupings of accounts. Being an “accounts” service, naturally there are many downstreams. And downstream service A may for example hit several other upstream services B, C, D, which in turn might call other services E and F, but because so much is tied to accounts (checking permissions, getting user preferences, sending emails), every service from A to F end up hitting my service with identical, repetitive calls. So in other words, a single call to some endpoint might result in 10 queries to get a user’s accounts, even though obviously that information doesn’t change over a few milliseconds.

So where is it it appropriate to place a cache?

  1. Should downstream service owners be responsible for implementing a cache? I don’t think so, because why should they know about my service’s data, like what can be cached and for how long.

  2. Should I put an in-memory cache in my service, like Google’s Common CacheLoader, in front of my DAO? But, does this really provide anything over MySQL’s caching? (Admittedly I don’t know anything about how databases cache, but I’m sure that they do.)

  3. Should I put an in-memory cache in the Java client? We use gRPC so we have generated clients that all those services A, B, C, D, E, F use already. Putting a cache in the client means they can skip making outgoing calls but only if the service has made this call before and the data can have a long-enough TTL to be useful, e.g. an account’s group is permanent. So, yea, that’s not helping at all with the “bursts,” not to mention the caches living in different zone instances. (I haven’t customized a generated gRPC client yet, but I assume there’s a way.)

I’m leaning toward #2 but my understanding of databases is weak, and I don’t know how to collect the data I need to justify the effort. I feel like what I need to know is: How often do “bursts” of identical queries occur, how are these bursts processed by MySQL (esp. given caching), and what’s the bottom-line effect on downstream performance as a result, if any at all?

I feel experience may answer this question better than finding those metrics myself.

Asking myself, “Why do I want to do this, given no evidence of any bottleneck?” Well, (1) it just seems wrong that there’s so many duplicate queries, (2) it adds a lot of noise in our logs, and (3) I don’t want to wait until we scale to find out that it’s a deep issue.

performance tuning – Efficient way to check if vector is in span?

I want to search a list of polynomials for linear dependencies of form,
$$ap_1+bp_2+cp_3=0$$
where $a,b,c$ are rationals (or integers).

By looking at the coefficients one can reduce this problem to checking if a set of vectors ${v_3, … , v_n}$ is in the span of ${v_1, v_2}$ where $n$ is the maximum degree among $p_1, p_2, p_3$.

The list of polynomials is large, so I need to solve either of the two problems above in an efficient way. What’s a fast way to do this?

html5 – Posicionar icone do Material dentro de tag span

.btn-redirect {
    display: block;
    text-align: left;
    font-size: 16px;
    color: #000;
    line-height: 50px;
    border-left: 3px solid #7455D4;
    margin-bottom: 10px;
    background-color: #f5f5f5;
    box-shadow: 0 1px 1px 0 rgba(0,0,0,.14), 0 1px 0 -3px rgba(0,0,0,.12), 0 0 2px 0 rgba(0,0,0,.2);
    transition: box-shadow .25s;
    border-radius: 3px;
    padding: 16px;
}
    
.icons {
    position: absolute;
}

.icons span.material-icons {
    color: #5622AC;
    position: absolute;
    z-index: 100;
    /* right: 0; Icone desaparece ao aplicar isso.*/
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
      rel="stylesheet">
      
            <div class="col s12 m3 l3">
                <div class="icons"><span id="individual" class="material-icons">error_outline</span></div>
                <a id="btn-individual" class="btn-redirect waves-effect waves-light" target="_blank">
                    DF Individual
                </a>
            </div>

<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>

real analysis – Does the linear span of norming extreme points contain all extreme points?

Let $X$ be a Banach space, $X^*$ be its continuous dual space, and $B(X^*)$ be its closed unit ball, i.e., $B(X^*) = {x^*in X^*: |x^*|leq 1}$.

We say that $x^*$ is an extreme point of $B(X^*)$ if $x^*in B(X^*)$ and for any $x^* = frac{1}{2}(x_1^* + x_2^*)$ for some $x_1^*,x_2^*in B(X)$, we have $x^* =x_1^*=x_2^*$.

We say that $x^*$ is a norming extreme point of $B(X)$ if $x^*$ is an extreme point of $B(X)$ that satisfies $x^*(x) = |x|$ for some $xin Xsetminus {0}$.

Question: If $x^*$ is an extreme point of $B(X)$, then is it true that
$$x^* = a_1x_1^* + cdots +a_n x_n^*$$
for some $ngeq 1$, $a_1,…,a_nin mathbb{R}$ and $x_1^*,…,x_n^*$ are norming extreme points of $B(X^*)$?

formatting – Is there an easy way to remove the data-preserver-spaces span from blocks?

I converted a page from Classic to Guttenberg and now all the blocks have this span in them:

<p><span data-preserver-spaces="true">...</span></p>

This means that all the blocks appear on a grey background, which makes it harder to edit, see links, etc.

I know how to edit the HTML and remove the <span> tag like so:

<p>...</p>

but over 100 blocks, that’s definitely tedious. Is there a way to do that automatically? (like a “clear all formatting” like I’ve see in other editors?)

Here is an example of the effect I’m talking about:

enter image description here

Note that it also happens when text is Italic or Bold or some other such format (which I think is also annoying).

Adding span tags to post titles using regex

My basic titles are something like

Part One: Part Two

And I’m trying to end up with something like this using the colon as what I find in the regex:

<span class="one-class">Part One:</span><br><span class="two-class">Part Two</span>

This is the original in entry-header.php and I want to continue to have that html:

if ( is_singular() ) {
            the_title( '<h1 class="entry-title">', '</h1>' );
        }
    

The following works as long as there is a colon in the title. If there is no colon, then none of the html gets added.

if ( is_singular() ) {
                        $string = get_the_title();
            $pattern = '~(.+): (.+)~i';
            $replacement = '<h1 class="entry-title"><span class="title-cite-pali">$1:</span><br><span class="title-english">$2</span></h1>';
            echo preg_replace($pattern, $replacement, $string);
        }
    

But I think what I really want is the following, but it doesn’t work. The output is as if my added code is not there.

if ( is_singular() ) {
            $string = the_title( '<h1 class="entry-title test">', '</h1>' );
            $pattern = '~(.+): (.+)~i';
            $replacement = '<span class="title-cite-pali">$1:</span><br><span class="title-english">$2</span>';
            echo preg_replace($pattern, $replacement, $string);
            
        }
    

I think if I could get the above code working, it is preferable since if there was no colon at least the h1 tags would be added.

algorithms – How to compute the number of occurrences of a cron schedule over a time span?

For example, given a cron schedule such as: 0 * 1 7 6 and a time span, like the next year, can you directly compute the number of times the schedule will fire? It can be brute forced pretty trivially but I’d like to use this to sort a list so I’d rather not just brute force it. It’s pretty easy to compute the trivial cron patterns:

fn('* * * * *', 1 day) -> 60 * 24
fn('0,30 * * * *', 1 day) -> 2 * 24

It’s easy up until the calendar gets involved with different length months and then you have to worry about days or the week coinciding with days of the month.