## How to get consistent vertical spacing between elements in InDesign?

In InDesign, how can I have the same vertical spacing between certain elements throughout the document?

I have several pages with heading + table beneth. Some pages have several heading + tables and then I want to have X amount of space until the next headline + table. The space should be the same on all pages, so I don’t want to just distribute evenly.

I could just use a box that takes up my space, and move that around…but I’m sure there is a smarter solution?

## How to wait presence of elements in page factory

I’m using page factory and need to explicitly wait until particulate elements load. Please advise how to do that. up to now I have following..

``````public class HomePage {
final WebDriver driver;
WebDriverWait wait;

List Navi_Elements ;
``````

and my constructor looks like

``````public  HomePage(WebDriver driver){
this.driver = driver;
wait = new WebDriverWait(driver,45);
``````

now I’m trying to do in my method (in home page class) is…. something like…

``````    public void clickNavigator(String sMyNode){
try{ wait.until(ExpectedConditions.presenceOfAllElements(Navi_Elements));
............
}}
``````

But in ExpectedConditions class there is no method to check presence which accepts Element/s

But according to This question it can be done

can not use “visibilityOfAllElements” since there is no visibility attribute in element

I’m using selenium 3.11

## Let p be an odd prime and let \$S\$ be the set of all remainders modulo \$2p\$. How many elements \$a\$ in \$S\$…

Let $$p$$ be an odd prime and let $$S = {0,1,2,Â·Â·Â· ,2p-1}$$ be the set of all remainders modulo $$2p$$. How many elements a in $$S$$ satisfy $$a^2 = 1 mod (2p)$$?

## Check if list contains 3 elements with predefined sum

I have 2 solutions about puzzle I mentioned in title:

solution 1( O(n^3) ):

``````public static boolean sumOfThree_1(List list, int sum) {
for (int i = 0; i < list.size() - 2; i++) {
for (int k = i + 1; k < list.size() - 1; k++) {
for (int m = k + 1; m < list.size(); m++)
if ((list.get(i) + list.get(k) + list.get(m)) == sum) {
return true;
}
}
}
return false;
}
``````

solution 2( O(n^2) ):

``````public static boolean sumOfThree_2(List list, int sum) {
for (int i = 0; i < list.size() - 2; i++) {
int expectedSumOfTwo = sum - list.get(i);
if (sumOfTwo_2(list.subList(1, list.size()), expectedSumOfTwo)) {
return true;
}
}
return false;
}

public static boolean sumOfTwo_2(List list, int sum) {
Set set = new HashSet<>();
for (int element : list) {
if (set.contains(sum - element)) {
return true;
}
}
return false;
}
``````

Better solutions?

## Persistent elements of offline players interacting with online players

For a long time I was thinking about a quite abstract game design problem, to which I didn’t see a good solution yet. In abstract: How can a player have owned bases, units and infrastructure in a persistent multiplayer world, which can be interacted or attacked by other players, all the while the owning player may be offline and unable to give his input?

As a concrete example:

Assume you have a very large 2D world, in which you can build bases and have units guarding them. The bases can be visited or used by other players as automated trading stations, in which you represent the vendors. But the bases should also be able to be contested by hostile players – be it plundering or outright destruction.

How can I solve the issue that the owner of the base may be offline during an attack? Or that a player attacks at times where people are usually not online (sleeping, working, school)? Or that a player may actively go or stay offline in order to exploit potential protection mechanisms? How can I avoid forcing players to go online for a certain time at certain time ranges in order to maintain such protection?

Ideas (which are not satisfactory though):

1. Bases cannot be attacked in normal ways. People can send “troops” with a delay hopefully long enough to ensure the other player can give his optional input. The outcome of these battles is an automatically calculated result. Such sieges may go over multiple days.
2. Bases can only be attacked while their owners are online – or have been offline for too long. The explanation why those cannot be attacked is severely lacking though – given that trading should still be possible.
3. When a player intends to attack, both players somehow have to make an appointment in order for both to be online and to start the battle. This is a bad solution for obvious reasons.
4. Bases are inactive and invulnerable while their owners are offline or setting it inactive, and trading/other activities continue only temporarily based on the previous online/active time. This raises issues with visible bases and ongoing infrastructure, as they’d essentially need to be hidden or hideable, and other players may get bothered by it becoming inaccessible.

What other methodology does exist or could be employed in order to tackle this online-offline issue with persistent elements? I am also open for mathematical or systematic solutions. Be reminded that other players should be able to assist either side as well, and that their online/offline times would require some consideration as well.

## Must there be INFINITE negative elements on a succession which is NOT bounded below?

We have that $${a_n}_{nin N}$$ is a succession of real numbers that is NOT bounded below.

(1) Must all the elements of $$a_n$$ be negative?

(2) If there are positive elements, those must be finite?

(3) Must there be INFINITE negative elements?

To answer 1 and 2 I find a succession that is not bounded below, that has infinite positive elements:

$${a_n}_{nin N}={-1,2,-3,4,-5,6,…}$$
$$a_n=n(-1)^n$$

Which is not bounded (below), and has infinite positive and negative elements.

Now, the third question I’m not sure how to prove that there MUST be infinite negative elements on a succession which is not bounded below.

What I thought of until now:

$${a_n}_{nin N}$$ Is not bounded below, then, by definition:

$$nexists min R , forall nin N : a_n geq m$$

This means that there will always be an item on the succession that is smaller than a previous item:

$$forall nin N , exists kin N : a_{n+k}leq a_n$$

And as $$N$$ is not bounded, the items smaller than the previous one are infinite?

## How can I iterate over dynamically added form elements?

I got AJAX working with the AppendCommand, so that every time the Add button is clicked, a new “section” is added to the form.

How do I iterate over all these elements in the validation and submission handlers? I tried googling far and wide, and haven’t found anything for a few hours.