javascript – problema al modificar variable global

en esta ocasión vengo por un error bastante simple que me ocurrió, pero que me ha dejado pensativo.
Sucede que tengo una variable normal declarada de forma global, obviamente fuera de la función, y la misma al darle cick a un elemento de mi menú, debe aumentar en 1 su valor. esto la verdad ya lo había hecho antes y la verdad no suponía un problema, pero al repetirlo con esta variable, simplemente no quiere funcionar

function buscar(){
    //buscador de texto
    //let texto=document.getElementById("texto1").value;
    // Obtener solo elementos en contenedor original
    //let texto2=b.getElementsByClassName(texto);

    // Limpia el contenedor, no hay problema

 i2=i2+1; //ya intenté con i2++, i2=+1;
    // Limitas el for con la cantidad de elementos obtenidos
    //for(let num=0; num<texto2.length; num++){
        // Inserta una copia, en lugar del original

if(i2<0){"none"; //i2 se queda en 0 y sigue ejecutando esta parte

Ahora, apliqué eso mismo con el siguiente código y funciona:

function menu2 (){


     //b.setAttribute("style","margin-top:10px;"); //este si funciona

la verdad es algo muy básico pero es que no encuentro diferencia alguna entre ambos códigos; he modificado variables de esta forma antes y ya intentado devolviendo su valor, cambiando el nombre, los símbolos de (<>) por (==, =) y nada. Cabe destacar, todo lo demás, funciones… funciona perfectamente
Muchas gracias por todo

mysql – Undefined variable in PHP – After updating the data

I’m following a tutorial on youtube and I encountered a problem. Can’t fix the problem since it been displaying on the textbox “Undefined Variable” after submitting.


    if (isset($_POST('update'))){
        $updateId = $_POST('updateId');
        $updateUsername = $_POST('updateUsername');
        $updatePassword = $_POST('updatePassword');

        $queryUpdate = "UPDATE accounts SET username = '$updateUsername', password ='$updatePassword' WHERE id = '$updateId'";
        $sqlQuery = mysqli_query($connection, $queryUpdate);

        echo '<script>alert("Successfully Updated!")</script>';
        echo '<script>window.location.href ="/crud-tutorial/index.php"</script>';
    if (isset($_POST('edit'))){
        $editId = $_POST('editId');
        $editUsername = $_POST('editUsername');
        $editPassword = $_POST('editPassword');

<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>UPDATE USER</title>
    html, body{
        margin: 0;
        padding: 0;

        height: 100vh;

        display: grid;
        grid-template-rows: auto 1fr;
        justify-items: center;
        row-gap: 20px;


    .main .update-main{
        grid-row: 1/2;
        display: grid;
        grid-auto-rows: auto;
        row-gap: 5px;

    .main .update-main h3{
        text-align: center;

    <div class="main">
        <form action="/crud-tutorial/update.php" method="post" class="update-main">
            <h3>UPDATE USER</h3>
            <input type="text" name="updateUsername"  placeholder="Enter your username" value="<?php echo $editUsername?>" required>
            <input type="password" name="updatePassword" required placeholder="Enter your password" value="<?php echo $editPassword?>" required>
            <input type="submit" value="update" name="UPDATE">
            <input type="hidden" name="updateId" value="<?php echo $editId ?>">



My index
enter image description here

Update file
enter image description here
After updating data
enter image description here

The error

Notice: Undefined variable: editUsername in C:xampphtdocscrud-tutorialupdate.php on line 65

variable definitions – Proper way to construct a function that takes too long to plot and integrate

Consider the functions phi(t_) and psi(t_) defined in the code below. These are used as basis functions for interpolation purposes. Consider a “time” variable T, a total number of interpolation nodes n0 and a step h0. Consider the values at nodes given by variables a and b. The required interpolation is defined by the function q(t_) defined below as the sum of a times phi plus b times psi.

phi(t_) := Boole(-1 <= t <= 1) (1 - Abs(t))^2 (1 + 2 Abs(t));
psi(t_) := Boole(-1 <= t <= 1) t (1 - Abs(t))^2;
T = N@Pi
n0 = 500;
h0 = T/n0;
a = Table(Cos(i*h0), {i, 0, n0});
b = Table(Sin(i*h0), {i, 0, n0});
q(t_) = Sum(a((k + 1))*phi(t/h0 - k) + h0*b((k + 1))*psi(t/h0 - k), {k, 0, n0});

When constructing the interpolated function q(t_) in this kind of manner results in operations on q(t_) taking way too long. A simple plot for example

AbsoluteTiming(Plot(q(t), {t, 0, T}))

takes more than 4 seconds to compute in my machine. Integrating this function with

NIntegrate(q(t), {t, 0, Pi/2})

sends the message

NIntegrate`SymbolicPiecewiseSubdivision::maxpwc: The number of piecewise regions has exceeded the maximum value specified by the option MaxPiecewiseCases -> 100. The integration will continue with no piecewise subdivision.

I can get around the integration issue by reducing the number of interpolation nodes to no more than 200, however, this begs the question of whether or not I am doing this the right way. Is there a better way to construct the q(t_) function?

Note that I cannot define q(t_) in the “set delayed” way because my a and b coefficients are constantly changing to approach other functions, and I need to store every interpolated function separately.

probability theory – Could anyone give me an example of an increasing sequence of a random variable

Could anyone give me an example of an increasing sequence of a random variable converges in probability to a random variable but their expectation does not? Thanks.

I tried to formulate this example, but not sure it is increasing sequence.

X_n = n^2, quad & if $ 0le omegale frac{1}{n}

0, if $frac{1}{n}< omega le 1$


apache – Htaccess RewriteCond based on environment variable

I find apache very unfriendly.

Anyway. I have this:

RewriteRule (.*) - (QSA,

This doesn’t redirect, which is fine:

RewriteCond "www.%{ENV:DOMAIN_NAME}" "!"
RewriteRule ^ https://%{HTTP_HOST}?err=%{ENV:DOMAIN_NAME} (L,R=301)

This doesn’t redirect, which is fine:

RewriteCond "%{HTTP_HOST}" "!"
RewriteRule ^ https://%{HTTP_HOST}?err=%{ENV:DOMAIN_NAME} (L,R=301)

This does redirect:

RewriteCond "www.%{ENV:DOMAIN_NAME}" "!=%{HTTP_HOST}"
RewriteRule ^ https://%{HTTP_HOST}?err=%{ENV:DOMAIN_NAME} (L,R=301)

Is very frustrating. I’m stuck in checking two variables if they match…

pr.probability – Design a random variable which has the maximal correlation with another random variable

y is a Gaussian distributed random variable with zero mean and known covariance: y~N(0,Y).
Now we don’t have the exact value of y, but we can measure y with a sensor, which is corrupted by white Gaussian noise: z=y+v; v~N(0,V).
Now my question is: If I want to design a random variable x with zero mean and known covariance x~N(0,X) such that it has the maximal correlation with y, how can I do this?

Initial idea: We can use all the available information to obtain a minimum mean square estimation (MMSE) of y, say hat{y}, then design x by x=that{y}. t is used to ensure x has covariance X. But later I found this intuitive idea is not true. I wonder if someone can answer this question.

magento2 – Setting Up Custom URLs For Each Option/Swatch of a Variable Product

A client wanted to setup where he sells fabric and related stuff and wanted each variation on a different URL.

So example, he sells a shirt with the colors red, blue, and black. Upon landing on the product page, the URL would be: and upon clicking on a color, it would be (where the “red” after the base-t-shirt/ is the option SKU or whatever identifier)

I believe that this is not a native feature of Magento but is there any workaround?

how to remove everything except {Group} and {Desc} from string variable cardLabel and add a space be

how to remove everything except {Group} and {Desc} from string variable cardLabel and add a space between them in javascript?

I get cardLabel value from database and the value sometimes contain all 6 variables but can contain value with sometimes just 2 variables, sometimes with sometimes just 4 variables. Please note order for the variables can be different and can contain more variables in future.

cardLabel’s dynamic value examples:

cardLabel='{Group} {Desc} – {termMonth} Month – {termOdometer} KMs/Miles {DeductibleAmount} {DeductibleType}’;

cardLabel='{Desc} – {termMonth} Month – {termOdometer} KMs/Miles’;

cardLabel='{Desc} {Group} – {termMonth} Month’;

cardLabel='{Group} {Desc} – {termMonth} Month {DeductibleAmount}’;

I have tried the following code but it is not ideal because the database value can contain more variables in future:
cardLabel = cardLabel.replace(‘{termMonth}’,”).replace(‘{termOdometer}’,”).replace(‘{DeductibleAmount}’,”).replace(‘{DeductibleType}’,”).replace(‘-‘, ”);

The desire end result should be one of the following: cardLabel='{Group} {Desc}’; cardLabel='{Desc} {Group}’;


probability theory – Is the distribution of a random variable determined by its partial integrals?

Let $(Omega_i, mathcal{F}_i, mathbb{P}_i)$ be a probability space for $i in {1,2}$, and let $X_i:Omega_irightarrow(-infty, infty)$ be a $mathbb{P}_i$-integrable random variable, respectively. If $int_{{X_1 in A}} X_1 dmathbb{P}_1 = int_{{X_2 in A}} X_2 dmathbb{P}_2$ for every Borel set $A$, does it follow that $X_1 overset{d}{=} X_2$?

How to manipulate multiple solutions to equations while keeping variable names?

relatively new to Mathematica, but couldn’t find an answer online for how to do this more cleanly.

I am solving these equations in six variables that give me a number of solutions, which are given as a list of rules, e.g.,

solution = {{x1 -> 0, x2 -> 0, x3 -> 0, x4 -> 2, x5 -> 1, x6 -> 0}, 
 {x1 -> 0, x2 -> 0, x3 -> 1, x4 -> 1, x5 -> 0, x6 -> 1}, 
 {x1 -> 0, x2 -> 1, x3 -> 0, x4 -> 1, x5 -> 1, x6 -> 1}, 
 {x1 -> 0, x2 -> 1, x3 -> 1, x4 -> 0, x5 -> 0, x6 -> 2}}

My next step is I need to calculate $y_1,y_2,y_3,y_4,y_5,y_6$ for each of these solutions, which are some (unchanging) linear combination of these values. I am currently doing this by defining (above everything), e.g.,


etc, and then running

xypairs = Table({{x1, y1}, {x2, y2}, {x3, y3}, {x4, y4}, {x5, y5}, {x6, y6}} /. 
 solution((j)), {j, 1, Length(solution)})

which gives me a list of lists, where each sublist contains each of the xy pairs for that solution. However, I need to do a bunch of manipulation on these values afterwards, and as I try to write it as is, I get really messy stuff involving dozens of lines like:

 xypairs((t))((2))((2)) + xypairs((t))((4))((2)) - xypairs((t))((3))((2))

I feel there has to be a better way to do this. I want to first calculate the $y_i$ for each solution, and then somehow iterate through each of the solutions so that when I am iterating, I can access the $x_i$ and $y_i$ by some means that is simpler than using a triple index. In other words, if I were doing this in Python (where I am most comfortable), I would iterate through xypairs, and define variables for each of the x1,…,x6,y1,…,y6. This then allows me to manipulate xs and ys for the solution I am working with by using the variable name, instead of indexing. Please let me know what the best way to approach this is.

Thank you in advance!