## How to create a block for related products based on their taxonomy term?

I want to create a block for related products.. all the solutions I found are not working on drupal 8/9 with commerce 2 , for a content you can just specify a contextual filter for (has taxonomy term) but for products that’s not an available option .. is there anyway to accomplish this ?

Posted on

## BTC investors will keep their BTC for long term if the price isn't above 10K\$

A twitte’s poll/survey gathered atleast 26K BTC investor that agreed that he’ll keep the BTC in his wallet till BTC bypasses the 10K\$ no matter what will happen, around 4K said that they will sell after 1 year since they don’t know what will happen, around 13% said they will hold their BTC for more three years .

## trigonometry – Why the right term can take kronecker delta of even function and odd function of fourier transform?

I’ve been encountering the problem of the below equation.

$$int_{-T_{0}/2 }^{T_{0}/2 } cosleft(frac{2 pi m}{T_{0}} t right) cosleft(frac{2 pi n }{T_{0}} tright) ,dt = frac{T_{0} }{2} delta_{m,n}$$

$$m,n inmathbb{N}$$

Firstly I tried to transform the argument of integral of LHS.

$$cosleft(alpha + betaright) =cosleft(alpha right) cosleft( beta right) – sinleft(alpha right) sinleft(betaright)$$

$$sinleft(alpha right) sinleft(betaright) +cosleft(alpha +betaright) =cosleft(alpha right) cosleft(betaright)$$

Hence,

$$int_{-T_{0}/2 }^{T_{0}/2 } cosleft(frac{2 pi m}{T_{0}} t right) cosleft(frac{2 pi n }{T_{0}} tright) ,dt = frac{T_{0} }{2} delta_{m,n}$$

$$int_{-T_{0}/2 }^{T_{0}/2 } left{sinleft(frac{2 pi m }{T_{0} } tright) sinleft(frac{2 pi n }{T_{0} } tright) +cosleft(frac{2 pi m }{T_{0} } t+frac{2 pi n }{T_{0} } tright) right},dt = frac{T_{0} }{2} delta_{m,n}$$

$$int_{- T_{0}/2 }^{ T_{0} /2} sinleft(frac{2 pi m }{T_{0} } tright) sinleft(frac{2 pi n }{T_{0} } tright),dt +int_{- T_{0}/2 }^{ T_{0} /2} cosleft(frac{2 pi m }{T_{0} } t+frac{2 pi n }{T_{0} } tright) ,dt$$

$$~$$

I think the LHS must be always zero for any $$~ m,n ~$$ .

Firstly of the left integral, as odd function * odd function = even function holds, the argument of left integral is of course even function and from the range of the integration, the value of left integral is always zero I think.

Same with the right integration,the cosine function is even function so the value of the right integration also be zero.

I can guess that transformming the each arugment as $$~ n=m ~$$ ,the right term with kronecker delta can be attained however my above claim is also correct I think.

What have I been missing?

Posted on

## Cubic Spline Interpolation Without a Constant Term

Two main questions:

1. I am wondering if it is possible to construct a cubic spline that interpolates data WITHOUT a constant term "a". That is, the polynomial takes the form f(t) = bt + ct^2 + dt^3, where t is time.

2. Can this spline be used in global time. So rather than the traditional
b(t(i + 1)- t(i)) + c(t(i + 1)- t(i))^2 + d(t(i + 1) – t(i))^3, we can just use bt(i) + ct(i)^2 + dt(i)^3.

I have tried different manipulations of the spline conditions to try and compensate for getting rid of the constant term, but have never been successful. If anyone has any insight into this I would greatly appreciate it!

Thank you!

Grant

Posted on

## Determine a formula involving a binomial coefficient for the nth term of the sequence

The first few terms are
a] 1,4,10,20,35,56,84,120
b] 1,3,15,84,495,3003,18564,116280,735471,4686825

Posted on

## turing completeness – How do we define the term “computation” across models of computation?

How do we define the term computation / computable function generically across models of computation?

Beginning with the textbook definitions of: {Linz, Sipser and Kozen} for “computable function”.

A function f with domain f is said to be Turing-computable of just computable if there exists some Turing machine M = (Q, Σ, Γ, δ, q0, □, F)
such that q0w ⊢* Mqₘf(w), qₘ ∈ F, for all w ∈ D (Linz:1990:243)

Computable Functions
A Turing machine computes a function by starting with the input to the function on the tape and halting with the output of the function on the tape. (Sipser:1997:190)

Definition 5.12
A function f: Σ* → Σ* is a computable function if some Turing machine M, on every input w, halts with just f(w) on its tape. (Sipser:1997:190)

A partial function σ: Σ* → Σ* is said to be a computable function if σ(x) = M(x) for some Turing machine M. (Kozen:1997:347)

I need to have the term computation / computable function defined generically across models of computation so that I can know whether or not a specific C function is a computation / computable function. I have a C function that uses static local data and some reviewers say that this does not count as a computation / computable function.

Linz, Peter 1990. An Introduction to Formal Languages and Automata. Lexington/Toronto: D. C. Heath and Company.

Sipser, Michael 1997. Introduction to the Theory of Computation. Boston: PWS Publishing Company

Kozen, Dexter 1997. Automata and Computability. New York: Springer-Verlag.

Posted on

## wp query – get term id from term name

Try to use `get_term_by()`, where first argument is a field, in your case – name. Second is your value. I used `esc_attr()` to make it secure. Third one is taxonomy, as example I put here `category`.

``````if (\$_SERVER("REQUEST_METHOD") == "GET" && \$_GET('fname2') && \$_GET('fname')) {

\$nameb = get_term_by('name', esc_attr(\$_GET('fname2')), 'category');
\$namea = get_term_by('name', esc_attr(\$_GET('fname')), 'category');

}

//check if there is an objects
if( \$nameb instanceof WP_Term && \$nameb instanceof WP_Term ){
echo \$nameb->term_id;
echo \$namea->name;
}
``````

Reference with some examples – here

Returned object:

``````(object) array(
'term_id' => 49,
'name' => 'Term Name',
'slug' => 'term-name',
'term_group' => 0,
'term_taxonomy_id' => 49,
'taxonomy' => 'category',
'description' => '',
'parent' => 0,
'count' => 286,
'filter' => 'raw',
)
``````

Posted on Tags ,

## Cancelling a term by convolution

I am trying to cancel one term within a function by convolution.

``````y[n] = x[n] + 2*x[n-N]

y[n] * h[n] = x[n]
``````

how can I find h[n] such that convolution with h[n] cancels the second term of y[n] but leaves the first?

Thank you

Posted on

## tokens – How can I watermark images with a taxonomy term from the node they belong to?

I’m working on a site for a business who would like to watermark all their product photos with the brand name of the product (which is a taxonomy term reference field on the product content type).

Looking into this, I found a variety of modules that will watermark images in various ways, but most expect to just put a single image or text overlay on all images of a given style, which is not what I need here.

The one exception I found was Textimage, which works with the Image Effects module and, at least in theory, supports node tokens. But when I tried out those two modules, I was unable to get any token for the taxonomy field in question to work. I tried (node:field_brand) and (node:field_brand:entity:name) without success — it just put the text of the token instead of replacing it with the brand. Other tokens, like (node:title), did work, but not the one I wanted (even though it was in the list of available tokens).

I posted to the issues queue for Textimage, but it doesn’t seem like anyone’s monitoring it regularly, and I’m on a deadline.

Does anyone know either how I can get the node replacement to work in Textimage, or alternatively any other way of doing this? I’m not at all wedded to Textimage and Image Effects — they’re just the only modules thus far that claim to be able to do what I need to do.

Posted on

## blockchain – Bitcoin Energy Consumption and Carbon Footprint a good long term investment?

How can Bitcoin a good long term investment, given one transaction is equivalent to carbon footprint of 986,125 Million VISA transactions?

If they use the Lightning network which takes transactions Off the Blockchain, wouldn’t that defeat whole purpose of having ledger transaction?

Bitcoin Energy Consumption Index Posted on