## seo – Prevent search engines from indexing specific elements on a site

A website I’m working on has a team section. Every team member has a dedicated site. On the site’s bottom of each team member three other team members are displayed randomly. What happens here is that search engines index all four images. When I enter the name a specific team member into a search engine I get all four images as results. I want to show only the main image on top. So, how can I prevent search engines from indexing the thee images at the bottom?

Posted on

## linear algebra – How come that I approximate a matrix by a product of less order matrices and I have more elements in the end?

I’m sure I’m missing something here but it’s honestly giving me a headache.

First of all, by the Singular Value Decomposition theorem I can decompose any $$m times n$$ matrix into:
$$A = sum_{i=1}^ksigma_i u_i v_i^T = USigma V^T$$
where $$k$$ is the rank of $$A$$, and $$Sigma$$ is a diagonal matrix whose entries are the singular values of $$A$$ in descending order.

Now, I can take $$tilde{k} to have the following representation:
$$A_{tilde{k}}= sum_{i=1}^{tilde{k}}sigma_i u_i v_i^T$$
which of course has less elements (as I’m cutting off sums from the first equation). This is called the “best $$tilde{k}$$ rank approximation”.

All in all, I end up approximating $$A$$ by another matrix with less elements.

Now let’s put this in practice: I have a $$784times 784$$ matrix. Suppose its rank is $$784$$ aswell. Then of course the matrix has $$784*784 = 616656$$ elements. Now let’s make a rank $$700$$ approximation. I’ve seen that the SVD approximation I just explained reduces the parameters to $$tilde{k}(m+n)$$, so that would make $$700*(784+784) = 1,097,600$$ parameters.

How can I end up with more parameters if the $$A_{tilde{k}}$$ approximation literally cut off sums from the representation of $$A$$? I get that for very small values of $$tilde{k}$$ it will have less parameters, but how come that it does have more parameters with $$tilde{k}=700$$ if it’s cutting 84 sums from the representation?? It should be impossible right?

Posted on

## table – Choosing the elements from Matrix or any ideas for help

again me. I am finding a function that can help me choose the elements from the matrix as below:

``````   F:=(F0,F1,F2,F3..Fk)
``````

As I know Table function, it only works with the matrix such as:

``````   F:= {{F0},{F1}....{Fk}}, Table(F(i+1,1),{i,1,k+1})
``````

## algorithms – How to sort an array \$A[1..n]\$ where all but \$lfloor sqrt n rfloor\$ elements are in range \$sqrt n\$ to \$nsqrt n\$, at \$Theta(n)\$ time?

Without the unknown $$lfloor sqrt n rfloor$$ elements this question wouldn’t be hard.

After a long time trying to solve the question, the best partial idea I have is to use Radix sort for the $$n-sqrt n$$ elements which are in the given range. Then I would need to sort the $$lfloor sqrt n rfloor$$ elements in a decent time.

Any help would be much appreciated.

Posted on

## forms – How to handle blocking UI elements while waiting for server response

Lately I’ve been using React + Formik to create great user experiences.
I’ve a question about blocking the UI when the XHR is still processing.

Imagine a register form with only a sign up button. As soon as the button is clicked I disable the button, it show a loader and sets the cursor to default. All good so far.

In that same view of the webpage there is also a link to “Already have an account? Sign In!” (and a fiew other hrefs). The “Sign In!” part is an URL, which is still clickable. What do I do in this situation? Should I block the “Sign In” link from being clicked?

Because when the user clicks “Sign In!” when no response has been received yet from the backend it either returns 200 registering was successful and redirects. Or it returns a validation error in which case the component is unmounted and React gives errors.

Posted on

## loops – In C++ how does “sizeof(array)/sizeof(array)” give the number of elements in an array? Why isn’t it affected by the length of each element?

I’m playing around with C++ and was looking at how to loop through an array of unknown length. The following code was suggested and works perfectly from the little testing I’ve done:

``````std::string words(5) = {"Lorem ipsum dolor sit amet orci aliquam.", "Hi", "Welcome", "World", "LoopyDoopyDoo"};
for (int i = 0; i < sizeof(words)/sizeof(words(0)); i++){
DO STUFF
}
``````

From what I’ve read the sizeof() operator returns the size of a variable in bytes.

What I don’t understand is how this isn’t affected by the number of characters in each element of the array. I printed out the sizeof() value to check and the array size is always evaluated at 160 bytes and element 0 as 32 no matter how many characters are present. I thought that it might be allocating 32 bytes but not using them all so I stored some text that should use 40 bytes, but still no change. Am I missing something here? Is text stored differently in C++?

Any help in understanding how this actually works would be appreciated, thanks!

Posted on

## c++ – Finding all pairs of elements in an array that sum to a target value using multiple pointers (follow up)

The previous question was not clear enough so I will try to clarify it more in this follow-up question.
I tried the multiple pointers technique to solve the problem that find pair of values that sums up to a target value.

We are assuming that:

• the array is already sorted.
• we are working with a static array of size 16 (testing purpose only).
• we are not working with actual pointers; because we don’t need them in this case (I think), I named the question on the algorithm’s
name only.
``````    #include <iostream>
#include <vector>
using namespace std;

struct result
{
int num1;
int num2;
result() {}

result(int num1, int num2)
: num1{ num1 }, num2{ num2 } {}
};

vector<result> mult_pt(int arr(), int target)
{
int p1 = 0;
int p2 = 15;
bool flag = false;
vector<result> res;
while (p1 <= p2)
{
if (arr(p1) + arr(p2) == target)
{

for (int k = 0; k < res.size() - 1; k++)
{
if (res.size() == 0)
res.push_back(result(arr(p1), arr(p2)));
else if (res(k).num1 != arr(p1) && res(k).num2 != arr(p2))
{
flag = false;
}
else flag = true;
}
if(flag) res.push_back(result(arr(p1), arr(p2)));
p1++;
}
else if (arr(p1) + arr(p2) < target)
{
p1++;
continue;
}
else if (arr(p1) + arr(p2) > target)
{
p2--;
for (int i = p1; i >=0; i--)
{
if (arr(i) + arr(p2) == target)
{
res.push_back(result(arr(p1), arr(p2)));
}
else if (arr(i) + arr(p2) > target)
{
continue;
}
else break;
}
}
}
return res;
}

int main ()
{
int array(16) = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
vector <result> res = mult_pt(array, 19);
for (int j = 0; j < res.size(); j++)
{
cout << "( " << res(j).num1 << " , " << res(j).num2 << " )" << endl;
}
return 0;
}

``````

The output should be like:

``````( 4 , 15 )
( 5 , 14 )
( 6 , 13 )
( 7 , 12 )
( 8 , 11 )
( 9 , 10 )
( 10 , 9 )
``````

You can check the previous post here.

Posted on

## plotting – Smooth ListLinePlot with missing elements in list

Consider the following list:

``````{{1,1},{2,2},{3,3},{4,4}}
``````

Plotting with `ListLinePlot` gives a smooth linear curve.

How can the list be plotted smoothly if it were

``````{{1,1},{2,2},{},{4,4}}
``````

In matlab there is an option to replace any missing elements with `NaN` and the plot command ignores these entries.

Here `ListLinePlot({{1, 1}, {2, 2}, {NaN, NaN}, {3, 3}}, PlotRange -> All)` cut the plot before (or after) the `NaN` values.

How can the missing entries be ignored while keeping the list as it is (i.e, not removing `{}`)

Posted on

## Primitive elements in Hopf algebras over the integers

Let $$H$$ be a Hopf algebra over $$mathbb Z$$, and assume that $$H$$ is cocommutative, graded, generated in degree $$1$$, and connected (its degree-$$0$$ part is $$mathbb Z$$).

Are there nice, natural conditions that will enforce that $$H$$ is a universal enveloping algebra of a Lie algebra over $$mathbb Z$$?

For example, if $$H$$ is $$mathbb Z$$-free, then the Milnor-Moore theorem implies $$Hotimesmathbb Q=U(P)$$ for $$P’$$ the space of primitives in $$Hotimesmathbb Q$$, and presumably $$P’=Potimesmathbb Q$$ for $$P$$ the $$mathbb Z$$-module of primitives in $$H$$.

I’m sure this works in a much more general setting, but I failed to locate relevant papers or books on Hopf algebras over non-fields.

Note that this question is related to the MO question
Integral Milnor-Moore theorem, though it seems orthogonal.

Posted on

## Mobile Usability Error – clickable elements too close together

I don’t quite understand how the mobile usability works but it is detecting the problem on the `wp-includes` path when using WordPress. What can do to stop it? Posted on