e depending on the number of results. While writing to html file the entries are not correct.
Suppose i have 50 rows in a html file. I am appening  49 rows at runtime in the template file and replacing values $id0, $age0, $time0.....$id49, $age49, $time49 in html file . For me first 10 rows are writing properly. From 11th row, the values are writing wrong. I am getting correct ones in the logs as well.
for(int i = 0; i < c; i++) {
  htmlString = htmlString.replace("$id"+i, cycle.get("id"+i).toString().trim());
  htmlString = htmlString.replace("$time"+i, cycle.get("time"+i).toString().trim());
  htmlString = htmlString.replace("$name"+i, cycle.get("name"+i).toString().trim())
}

The entry comes in html as

id  Name   age   time
  9   abc     8     8.08
  10  xyz    12     9.19
  11  xyz1   121    9.191
  12  xyz12  122    9.192

the values for id 11, 12 are wrong. It shows 10th id's values appended with 1,2 etc.

A:

I was able to resolve by adding an extra character after the $id1 like $id1:. 
Example:
id1=abc
id2=xyz
without the extra code $id11 was giving as abc1



Q:

Solving $\int\frac{\csc^2(x)dx}{\sqrt{K-\cot^2(x)}}$ where $K$ is a constant

I'm solving a minimization problem, reeding some notes of my teacher, and as some point she wrote 

Then we have $$\tag{1}\int d\varphi = \int \frac{\csc^2(x)dx}{\sqrt{K-\cot^2(x)}}$$ from that we get $$\tag{2}\cot(x) = K\sin(C-\varphi)$$.

And I'm trying to get the relation $(2)$ from $(1)$.

These are my attempts if is of some help: If we make the substitution $\sin(\alpha) = -\cot(x)$ we get that
$$\int \frac{\csc^2(x)dx}{\sqrt{K-\cot^2(x)}} = \int\frac{\cos(\alpha)d\alpha}{\sqrt{K-\sin^2(\alpha)}} = \frac{1}{K}\int\frac{\cos(\beta)d\beta}{\sqrt{1-\sin^2(\beta)}} 
$$
and then I get something that it is very different from $(2)$

A:

Well, we have:
$$\mathscr{I}_{\space\text{n}}:=\int\frac{\csc^2\left(x\right)}{\sqrt{\text{n}-\cot^2\left(x\right)}}\space\text{d}x\tag1$$
Substitute:
$$\text{u}:=\frac{\cot\left(x\right)}{\sqrt{\text{n}}}\tag2$$
So, we get:
$$\mathscr{