Servers on the same network aren't communicating

Question: A number of servers are connected to WAN via a switch. Each server has it's own static public IP assigned by the ISP. Gateway on the server is the same. No firewalls.
The following is an example of ping command from one of the server, pinging another server that sits next to it:
<code>PING 18.104.22.168 (22.214.171.124) 56(84) bytes of data.
^C
--- 18.104.22.168 ping statistics ---
217 packets transmitted, 0 received, 100% packet loss, time 215884ms
</code>
How can communication between the servers be achieved?
Comment: It is likely that the server firewalls are set to block ICMP. That doesn't mean the servers cannot communicate, only that you can't use ICMP (ping) between them.
Comment: Can not SSH, send UDP or establish any sort of communication.
Comment: Do you have the right subnet mask configured on both servers? And are these two physical servers?
Comment: Only two things can be wrong as already suggested. Either you've got a firewall turned on at one or both servers, or you have the subnet mask programmed in wrong. You should double check with your ISP what the proper network settings are supposed to be.
Comment: After trying to reach server B from server A, can you see server B's MAC address on the ARP table of server A?  The switch may be configured to avoid any routing, and may even block ARP traffic whatsoever.
Answer: Check the local ARP table. If you've got the destination server's MAC address in it all is well. It's just the firewall that filtering your requests and eating up the pings.
Answer: It is possible that the "WAN Switch" is configured in "Secure Mode", which is Cisco speak for not allowing communication between the ports (only to the upstream port where your WAN router(s) are).
In that case it might be intentional (for security-, traffic minimization- or accounting reasons) or by accident (missing network route) that the servers can't speak to each other.
You would have to talk to the owner of the WAN Switch or setup a second network between the servers with your own equipment.
Not seeing any of the resolved MAC addresses in the neighbour cache of a server besides the gateway is a good indication for that, as suggested by some comments.


Domain of $f(x,y) = \ln((16-x^2-y^2)(x^2+y^2-4))$

Question: $f(x,y) = \ln((16-x^2-y^2)(x^2+y^2-4))$
I'm stuck in this one because this can be rewritten as:
$$f(x,y) = \ln(16-x^2-y^2) + \ln(x^2+y^2-4)$$
Yet, the domain of the given function is $\{(16-x^2-y^2>0)\land(x^2+y^2-4>0)\} \lor \{(16-x^2-y^2<0)\land (x^2+y^2-4<0)\}$. But the domain of the rewritten on is only $\{(16-x^2-y^2>0)\land(x^2+y^2-4>0)\}$. Which one is the correct one and why does this happen?
Answer: Note that $\{(x,y):16-x^2+y^2<0\}\cap\{(x,y):x^2+y^2-4<0\}=\emptyset$, and hence the two domains are the same in different expressions!
Comment: Domain is the ring set by 2 circles: $\{(x,y):x^2+y^2=4^2\}\cap\{(x,y):x^2+y^2=2^2\}\; exсluding \;the\; bounds$
Answer: When does $log(xy) = log(x) + log(y)$ hold?
Only when $x$ and $y$ are both greater than zero! Does that solve your doubt?
Answer: In real analysis $\ln(ab)=ln(a)+ln(b)$ is true iff $a>0$ and $b>0$, because in other case the logarithms don't make sense.
Answer: Two things:

You used $\ln(ab)=\ln a+\ln b$, but this is correct only as long as both $\ln a$ and $\ln b$ are defined. For example $\ln\bigl((-1)\cdot(-1)\bigr)=0$, but the summands in $\ln(-1)+\ln(-1)$ are not defined. Therefore, you need to consider not only the case $a>0\land b>0$, but also $a<0\land b<0$.
Accidentally, it did not matter here, because $16-x^2-y^2$ and $x^2+y^2-4$ cannot be negative at the same time (note that their sum is $12$, hence positive).


Extending reals with logarithm of zero: properties and reference request

Question: If we take logarithmic function, we can see that its real part at zero approaches negative infinity with the same rate and sign from any direction on the complex plane, while the Cauchy main value of the imaginary part averaged over any circle around zero is zero.
This may hint us that in any algebras that include germs or growth rates of functions at a point, logarithm of zero quite consistently represents a reasonable negatively-infinite constant.
This extension of real numbers would be analytic as opposed to algebraic (one can oppose such extension on algebraic grounds, because logarithm of zero necessarily breaks some algebraic properties of logarithm, but they do not hold on the complex plane anyway).
Let us denote it as $\lambda=\ln 0$ and sum up some of its properties.

The Maclaurin series of the function $\ln (x+1)$ at $x=-1$ is the Harmonic series with negative sign, thus, we can represent $\lambda=-\sum_{k=1}^\infty \frac1k$. Since the Harmonic series has the regularized value of $\gamma$ (Euler-Mascheroni constant), the regularized value (finite part) of $\lambda$ is $-\gamma$.

If we define $\ln x=\int_1^x \frac1t dt$, which is the generalization of logarithmic function, we can represent $\lambda$ as divergent integral: $\lambda=-\int_0^1 \frac1t dt$.

Since $\lim_{n\to\infty}\left(\sum_{k=1}^n \frac1k-\int_1^n \frac1tdt\right)=\gamma$, we can also represent $\lambda=-\int_1^\infty \frac1t dt-\gamma$. It also will tell us that $\int_0^\infty \frac1tdt=-2\lambda-\gamma$.

We can find other integral representations of this constant: $\int_0^\infty \frac{1-e^{-t}}{t} dt$, $\int_0^\infty \frac{dt}{t + t^2}$, and others.

Since $\int_0^\infty\frac{\ln t+\frac{\gamma }{2}}{t}=-\int_0^\infty\frac{\ln t+\frac{\gamma }{2}}{t}$, it is equal to zero. So, $\int_0^\infty \frac{\ln t}{t} \, dt=-\frac\gamma2\int_0^\infty \frac1tdt=\gamma\lambda+\gamma^2/2$

If we generalize the notions of periods and $EL$-numbers to our extended set, then $\lambda$ would be both, because it can be represented as $\int_0^1 \frac{-1}t dt$ (integral of an algebraic function over algebraic domain) and $\ln 0$ respectively. On the other hand, $\lambda+\gamma=\int_1^\infty \frac{-1}t dt$ would belong to neither.

Since we can take logarithm of zero, we also can take logarithms of zero divisors in split-complex numbers: $\ln \left(\frac{a j}{2}+\frac{a}{2}\right)=\frac{j}{2} (\ln a-\lambda)+\frac{1}{2} (\ln a+\lambda)$

In dual numbers the value of $\varepsilon^\varepsilon$ is usually undefined. But due to the general formula $f(\varepsilon)=f(0)+\varepsilon f'(0)$ and the fact that $(x^x)'=x^x (\ln x+1)$, we can derive $\varepsilon^\varepsilon=1+\varepsilon(1+\lambda)$, which shows a surprising role played by this constant in dual numbers.

That said, I wonder:

What are some other notable properties of this constant, where can it occur?

Are there works in which extension of reals with logarithm of zero is seriously considered?
Answer: I wrote a paper in 2001 that addressed to some extent your second question:  https://arxiv.org/abs/math/0112050
Unknown to me at the time is the fact that Albert A. Bennett derived some of the same results in 1915:  Bennett, Albert A. "Note on an Operation of the Thrid Grade." The Annals of Mathematics 17.2 (1915): 74-75.
Comment: Can you please point what place in the paper is relevant, it looks like a paper on hyperoperations (like tetration, etc).
Comment: The last paragraph in Section 2 addresses the extension of the hyperoperations into the negative real direction.  E.g., it is posited that ln(0) be identified with negative infinity and therefore the logarithms of all negative reals would have to be further still to the left of that, i.e., well into negative but transfinite numbers.  The TBD in Table 1 (inverse of join) was slated to be cleared up in the section on complex numbers, but I'm not convinced this was satisfactorily done.  The TBD should at any rate be ln(-exp(x)) for the inverse of the join operation.
Answer: Don't know whether this really matches your query, but casually I've tried to make some sense with this $\log(0)$ thing, via the $\log(1+x)$ series for the argument $x \to -1$. This occured as problem in the inversion of the Carleman-matrix for the function $e^x$ which involves the attempt to do a forbidden matrix-inverse of infinite size.
Let's define the Carleman matrix $B$ such that, with a vector $V(x)=[1,x,x^2,x^3,...]$ we get
$$ V(x) \cdot B = V(e^x) \tag 1$$
The infinite-sized matrix $B$ has the top-left edge
<code>  1       1      1        1         1           1        1           1
  0       1      2        3         4           5        6           7
  0     1/2      2      9/2         8        25/2       18        49/2
  0     1/6    4/3      9/2      32/3       125/6       36       343/6
  0    1/24    2/3     27/8      32/3      625/24       54     2401/24
  0   1/120   4/15    81/40    128/15      625/24    324/5   16807/120
  0   1/720   4/45    81/80    256/45    3125/144    324/5  117649/720
  0  1/5040  8/315  243/560  1024/315  15625/1008  1944/35  117649/720
</code>
and the definition $$B[r,c]=c^r / r! \tag 2$$.
This matrix is not invertible/reciprocable when infinite size is assumed.
However, a partial procedure for the inversion can be done, and in some situations one can then evaluate a matrix-formula step-by-step with the same result, as if we really had $C=B^{-1}$ - which would be the Carlemanmatrix for $\log(x)$ developed around $0$ (not around $1$ which gives the well known Mercator-powerseries).
The way to go is the separation of $B$ in two triangular matrix-factors to which I assigned named $fS2F$ (indicating factorial scaling of the matrix $S_2$ of Stirlingnumbers $2$'nd kind) and the upper triangular Pascalmatrix $P$ such that
$$  B = fS2F \cdot P \tag 3
$$
Here we find, that $fS2F$ is the Carlemanmatrix for the function $x \to e^x-1$ and $P$ is the Carlemanmatrix for the function $x \to x+1$ . This means, we can formulate this in the above style of formal powerseries:
$$ \begin{array} {}  V(x) \cdot fS2F & = V(e^x-1)   \\
    V(e^x-1) \cdot P &= V(e^x) \\
   &= (V(x) \cdot fS2F) \cdot P  \\
   & = V(x) \cdot (fS2F \cdot P) \\
   & = V(x) \cdot B
\end{array} \tag 4$$
This matrix-decomposition and the functional relation between the Stirlingnumbers 2'nd kind and the $e^x-1$ function is in principle all well known, without involving the name of "Carlemanmatrix" I found this for instance in Abramowitz/Stegun as well as in L. Comtet and elsewhere. It is as well easily found by application of the $LR$ (or "$LU$")-matrix-decomposition.
Now, the two matrices $fS2F$ and $P$ are triangular, with $1$ in the diagonals and can thus be inverted even in the case of infinite size which gives the two triangular matrices $ fS1F = fS2F^{-1}$ and $Q=P^{-1}$.
This matrices are consequently the Carlemanmatrices for $x\to\log(1+x)$ and $x\to x-1$ and the inverse of $B$ could be done if the matrixproduct
$$    Q \color{red}{ \overset{\text{no!}}{\cdot}} fS1F  \tag 5
$$
could be evaluated, but which cannot be done due to singularities in the dotproducts of rows in $Q$ and columns in $fS1F$ .
Interestingly, but no surprise, we can apply the associativity of matrix-multiplication
$$ \begin{array}{}
   \quad V(x) \cdot (Q  \color{red}{ \overset{\text{no!}}{\cdot}} fS1F) \\
   \quad (V(x) \cdot Q)  \color{red}{ \overset{\text{?}}{\cdot}} fS1F \\
=V(x-1) \cdot fS1F \qquad \qquad \text{for } x \ne 0\\
= V(\log(1+(x-1)) \end{array} \tag 6
$$
Formally the dotproduct of the first row in $Q$ and second column in $fS1F$ gives the harmonic series $ 1\cdot 0 - 1/1 -1/2-1/3 - \cdots $ . Similar divergent expressions occur with the dotproducts of the following rows in $Q$ which would give then the derivatives of that $\log(1+(x-1)$-construction. Looking at the next columns in $fS1F$ give similar expressions; if $x \ne 0$ we had simply $\log(x)^c$ where $c$ is the index of the column in $fS1F$.

I didn't find a smooth solution for insertion of "regularized" values into an attempted Carlemanmatrix $C$ (and do something meaningful with it), and stopped with that exercising. But perhaps this problem is simply one further possible place for application of your shown concept.
Comment: Many people have a misconception about what the regularized value is. It is not something that you insert instead of the divergent expression, and can expect reasonable results. It is rather like real part of a complex number. Unfortunately, people sometimes call "regularized value" totally different things (like shown here: https://mathoverflow.net/questions/426129/whats-the-true-regularized-value-of-product-of-all-natural-numbers). Each divergency has regularized valu (analog of real part or trace) and "hypermodulus" (analog of modulus or determinant).
Comment: In this post, the logarithm of zero, $\lambda$ is shown to satisfy the (extended) definitions of periods and EL-numbers, but its regularized value, the Euler-Masceroni constant, is seemingly neither. One should not expect anything useful if they insert $\gamma$ instead of logarithm of zero. The hypermodulus of $\lambda$ does not seem to have a good closed form.
Comment: @Anixx, ok, well, so I better delete this stuff ...
Comment: My comments are not against this post. I do not see anything wrong with it.


Writing a client to connect to websocket in spring boot

Question: I'm trying to make a websocketed based server/client application using spring boot.
The server accepts a socket connection then when it recieves a text message from the client it will process it, then return some data. The server has a websocket handler that will correctly process a request.
<code>public class DataWebSocketHandler extends TextWebSocketHandler {

private static Logger logger = LoggerFactory.getLogger(DataWebSocketHandler.class);

private final DataService dataService;

@Autowired
public DataWebSocketHandler(DataService dataService) {
    this.dataService = dataService;
}

@Override
public void afterConnectionEstablished(WebSocketSession session) {
    logger.debug("Opened new session in instance " + this);
}

@Override
public void handleTextMessage(WebSocketSession session, TextMessage message)
        throws Exception {
    byte[] payload = this.dataService.getDataBytes(message.getPayload());
    session.sendMessage(new BinaryMessage(payload));
}

@Override
public void handleTransportError(WebSocketSession session, Throwable exception)
        throws Exception {
    session.close(CloseStatus.SERVER_ERROR);
}

}
</code>
and registered
<code>@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
    registry.addHandler(dataWebSocketHandler(), "/data").withSockJS();
}
</code>
My problem is, is that I have no idea how to write a client that can connect to the server(assuming I wrote the server correctly) and by extensions how to send the message and how to receive that data on the client side.
I've failed to find an example of this, but there are plenty where a websocket is written that broadcasts to all clients subscribed to a socket, which I don't want.
The server uses the embeded tomcat server.
Answer: I believe this is what you're looking for
https://github.com/spring-projects/spring-boot/tree/main/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-jetty/src/test/java/smoketest/websocket/jetty/echo
this is a similar server side code..
https://github.com/spring-projects/spring-boot/blob/main/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-jetty/src/test/java/smoketest/websocket/jetty/SampleWebSocketsApplicationTests.java
And here is the client side.. using org.springframework.web.socket.client.standard.StandardWebSocketClient ad some othe configuration.
I believe you can figure out the rest ;)
Cheers
Comment: Link only answers are not the best.
Comment: Apparently, they moved those samples :(
Comment: Links do not work.


If an implementation supports extra nonstandard features, then is such implementation conforming?

Question: Follow-up question for: Do unsupported standard features affect conformance?.
Question: if an implementation supports extra features which are not described in the C standard, nor in any "extension document", then is such implementation conforming?
A simple example: #pragma STDC FP_CONTRACT requires on-off-switch, which is one of ON OFF DEFAULT. However, one implementation in addition to ON OFF DEFAULT does support RESTORE. Hence, such implementation allows writing nonstandard code. Does it mean that such implementation is nonconforming?
Extra question: the C standard tells "what implementation shall/should do". However, does the C standard (or any standard in general) tell "what implementation shall/should not do"? For example, if an implementation does support my_printf (in addition to printf), then is such implementation conforming?
Comment: Extra features only cause the implementation to be non-conforming if they affect the behavior of strictly conforming programs. From C17 4/6: "A conforming implementation may have extensions (including additional library functions), provided they do not alter the behavior of any strictly conforming program."
Comment: "conforming implementation" means that it shall correctly translate conforming programs, and diagnose conditions which require diagnosis. It does not restrict the implementation from anything else . (Including from proceeding after a diagnostic).
Comment: https://port70.net/~nsz/c/c11/n1570.html#4 What research did you do?
Comment: Please create an answer.
Comment: @M.M If a conforming implementation successfully translates strictly conforming programs AND programs which use nonstandard / "nonextention" features (ex.: `#pragma STDC FP_CONTRACT RESTORE`), then is such implementation still conforming?
Comment: @M.M Answering to myself: the _programs which use nonstandard / "nonextention" features_ are not strictly conforming programs. However, _4. Conformance_ does not say that "a conforming (hosted) implementation shall reject any non-strictly conforming program", because non-strictly conforming program is may be the one that _uses only those features of the language and library_, but _produces output dependent on UB_. I conclude that it is not defined of what a conforming (hosted) implementation shall do with non-strictly conforming program. Is it correct?
Answer: The Standard defines three concepts of conformance.  In order of meaningfulness, they are a "Strictly Conforming C Program", a "Conforming C Implementation", and a "Conforming C Program".
A Strictly Conforming C Implementation is one whose behavior is fully specified by the Standard.  This excludes all non-trivial programs for freestanding implementations, since the Standard doesn't define any form of I/O for them.  It also excludes many programs that would be portable if the Standard sought to avoid characterizing as UB any actions whose behavior might conceivably be difficult to define on some implementations, or whose behavior might expose the effects of useful optimization.
A Conforming C Implementation is one which in theory could in theory meaningfully process all Strictly Conforming Programs, but may behave arbitrarily when given any program--strictly conforming or not--that would exceed an implementation's translation limits.  That latter caveat creates a loophole big enough to drive a truck through.
While the Standard requires that an implementation be able to accommodate e.g. 127 nested blocks, 511 block-scope identifiers within a block, 1023 members in a struct or union, and 63 characters in an internal identifier's name, it doesn't require that an implementation be able to accommodate 127 nested blocks, each with 511 identifiers that each identify a structure with 1023 members, each with a name that's 63 characters long.  Such a requirement would make the language impossible to support on any translation environment with less than four gigs of storage.  To avoid making the language impossible to implement, the Standard refrains from requiring that implementations support arbitrary combinations of translation limits.  Instead, all that is necessary for conformance is that there exist some program--possibly a contrived and useless one--which nominally exercises each of the limits, at least individually.  The authors acknowledge, in the published Rationale, that such a requirement is absurdly weak:

The Standard requires that an implementation be able to translate and execute some program that meets each of the stated limits. This criterion was felt to give a useful latitude to the implementor in meeting these limits. While a deficient implementation could probably contrive a program that meets this requirement, yet still succeed in being useless, the C89 Committee felt that such ingenuity would probably require more work than making something useful

I think they overestimated the "ingenuity" required, but I think the key point is that whether or not the Standard would regard as conforming an implementation that would e.g. allow a program to have one identifier that was 63 characters long and limited all other user identifiers to too characters, nobody who wanted to sell a compiler would impose such a limitation.  Thus, while the Standard's definition of "Conforming C Implementation" isn't actually meaningful, it nonetheless establishes some baseline expectations for non-garbage-quality implementations.
As for the concept of "Conforming C Program", that term is defined to include any program that is accepted by at least one Conforming C Implementation somewhere in the universe.  This is obviously too broad to be meaningful; I think the point was that the Committee wanted to avoid categorizing any useful programs as non-conforming.  Again from the Rationale (italics original):

A strictly conforming program is another term for a maximally portable program. The goal is to give the programmer a fighting chance to make powerful C programs that are also highly portable, without seeming to demean perfectly useful C programs that happen not to be portable, thus the adverb strictly.

C implementations are expressly granted latitude to add extensions to the language, either syntactically or by defining behaviors in situations where the Standard imposes no requirements (typically processing constructs "in a documented fashion characteristic of the environment"), and Conforming (but not Strictly Conforming) C Programs may exploit such extensions.  Although implementations are nominally required to produce a diagnostic in response to some such constructs, such a requirement would be satisfied by an implementation that unconditionally outputs: "Warning--this implementation doesn't bother producing diagnostics the author thinks are silly (other than this one)" and programmers would be free to ignore any diagnostics they think are silly.
It's important to recognize that many practical and useful C programs exploited useful constructs that were widely supported but not universally supportable.  Had the Committee sought to characterize as deficient implementations for platforms that could't support such constructs, it would have been rejected by the makers of those platforms.  Had it characterized as non-conforming programs that relied upon such constructs, it would have been soundly rejected by the programming community.  Thus, as a compromise, it defined a category of "strict conformance" for programs that was sufficiently narrow that failure to meet it could seldom be viewed as a defect, and otherwise relied people wishing to sell compilers to recognize and satisfy the needs of programmers who would be using them--a philosophy that worked well when compiler writers' primary customers were programmers.
Comment: Many thanks for the detailed answer. I could not understand why in C11 `conforming program` is defined through `conforming implementation` and `conforming implementation` is defined through `strictly conforming program`. This implies that A is defined though B, and B is defined through particular case of A. which is a recursive definition. Does the standard allow a recursive definitions?
Comment: I think that these terms should (shall!) be defined in the following (progressive) way: _conforming program -- a program that uses only those features of the language and library specified in this Standard_, _strictly conforming program -- a conforming program that does not produce output dependent on any unspecified, undefined, or implementation-defined behavior, and does not exceed any minimum implementation limit_, _conforming implementation -- implementation that accepts any conforming program_. Can you comment on that?
Comment: @pmor: The reason C is useful is that it served not just as a language, but as a recipe for forming useful dialects suitable for low-level programming on a variety of platforms.  I think it would be useful to have a standard for such dialects, which defines language constructs in terms of primitive actions, but then provides means by which programmers can invite optimizations which might affect program output or behavior in specified ways, for use in cases where the original and altered behaviors would both be acceptable.  For example, one could specify that even on a platform where...
Comment: ...integer arithmetic uses quiet two's-complement wrapping semantics on overflow, one could specify that a compiler may at its leisure behave as though calculations were performed with wider types than specified, thus allowing e.g. `x*30/15` to be replaced with `x*2` even though that would change program behavior in case of overflow.  When the Standard indicates that an implementation may process constructs that invoke UB "in a documented fashion characteristic of the environment", that wasn't an idle possibility--what made the language useful was that implementations intended for low-level...
Comment: ...programming would behave in ways that weren't anticipated by the Standard, but were characteristic of the environment.  The problem is that some people on the Committee refused to have the Standard say anything that might be perceived as encouraging people to write non-portable programs, while others refused to have the Standard imply that there was anything wrong with non-portable programs.  The only way to reconcile those is to no have the Standard say anything about non-portable programs, which unfortunately severely limits its usefulness.


Rule of inference proof

Question: "Either I go to library or if I wait for my mom then I have to go to the party."
"I will go to the party if I meet my friends"
"If I go to the library then I will finish my homework."
"I did not finish my homework."
Use the rule of inference to prove the theorem:
"If I wait for my mom then I will meet my friends"
Note:

The first rule is $p \lor (q \rightarrow r)$
The second premise..I don't know how to convert..can anyone help?
Answer: Hint
You have to corrcetlly formalize the different statements :

$p$ is "I go to library"
$q$ is "I wait for my mom"
$r$ is "I go to the party"
$s$ is "I meet my friends"
$t$ is "I finish my homework".

Now we have to correctly express the premises of the argument :
1) $p \lor (q \to r)$
2) $s \to r$
3) $p \to t$
4) $\lnot t$.
Finally, the sought conclusion :
5) $q \to s$.

Rule of inference proof


Are there issues to taking the intersection of two datasets for running a regression?

Question: I have two datasets $D_1$ and $D_2$, of size $m$ and $n$. Suppose that $D_1$ contains the heights of people and $D_2$ contains the weight of people. Each dataset is indexed by a unique identifier and it is the case that not all the individuals in $D_1$ are in $D_2$.
In order to run a regression, I then find the intersection of individuals who are in both $D_1$ and $D_2$, creating subset $D'_{1}$ and $D'_{2}$. If I then run a linear regression where
$$
D'_{1} = \beta_0 + \beta_1D'_{2}+\epsilon
$$
are there any issues I might run into? Intuitively it seems like I am artificially selecting the individuals who will be in the regression. However, if I can assume that the event two individuals are in both datasets is random, would it be valid?
Answer: The primary issue you need to consider here is the sampling scheme that led you to have partial data on each variable.  In particular, you need to consider whether the "missingness" in the data is "at random" or if it is statistically related in some way to the variables at issue.  I recommend you look up some statistical literature on informative sampling and the concept of variables that are "missing at random".


Standardized beta weights for a multilevel regression

Question: How can one obtain standardized (fixed effect) regression weights from a multilevel regression?
And, as an "add-on": What is the easiest way to obtain these standardized weights from a mer-object (from the lmer function of the lme4package in R)?
Comment: You may be interested in this paper by Andrew Gelman and Iain Pardoe (2007) [Average Predictive Comparisons for Models with Nonlinearity, Interactions, and Variance Components](http://dx.doi.org/10.1111/j.1467-9531.2007.00181.x).
Comment: Specifically mer or you are asking for any linear model coefficients?
Comment: Actually I'm more interested on how to do it generally (I would standardize all variables beforehand, as in regular linear models, but I'm not sure if that approach is valid in MLMs). Above, I would like to see how it is done with lme4 objects. I rephrased the question accordingly!
Answer: Simply scale your explanatory variables to having mean of zero and variance of one before you put them in the model.  Then the coefficients will all be comparable.  The mixed effects nature of the model doesn't impact on this issue.
The best way to do it, and least likely to go wrong, is to use scale() before you fit the model.
Comment: Thanks, that's what I wanted to know: rescaling to the grand mean (ignoring the group structure ...).
Answer: For standard linear models regressed with lm() you can either scale() your predictors data or just use this simple formula:
lm.results = lm(mydata$Y ~ mydata$x1)

sd.y = sd(mydata$Y)
sd.x1 = sd(mydata$x1)
x1.Beta = coef(lm.results)["mydata$x1"] * (sd.x1 / sd.y)

Answer: For a quick way to get at the standardized beta coefficients directly from any lm (or glm) model in R, try using lm.beta(model) from the QuantPsyc package. For example:
library("MASS")
glmModel = glm(dependentResponseVar ~ predictor1 + predictor2, data=myData)
summary(glmModel)

library(QuantPsyc)
lm.beta(glmModel)

Comment: In [this e-mail](https://stat.ethz.ch/pipermail/r-sig-mixed-models/2010q4/004969.html) Ben Bolker translated this function to "lmer-land".
Comment: But the linked code that Ben provides isn't actually functional as written in that email, it doesn't look like. It includes words/pseudocode....

Edit: The answer to this question will provide the working code: http://stats.stackexchange.com/questions/123366/lmer-standardized-regression-coefficients
Answer: Assuming you have set the output of your lmer model to lmer.results, fixef(lmer.results) will return the overall fixed effects coefficients.
Comment: They won't be "standardized" though, will they?  I read the question as wanting to know the size of fixed effects if the explanatory variables were all on the same scale.
Comment: As Peter already commented: the focus of the question was about the 'standardized' coefficients ...
Comment: I don't know that it is possible to get the standardised coefficients from a `mer` object - they don't appear in the summary, so I assume the `lme4` methods don't create them. `fixef()` will return all fixed effect information available from a `mer` object.


Removing address bar or Hiding its content from Windows Explorer - Windows Server 2008 R2

Question: I'm currently trying to find a GPO or a registry edit that could either remove the address bar from Windows Explorer or prevent the bar from displaying the full UNC path. The current environment has full restrictions on the C:\ drive as well as network shares. However, the only "security breach" I could find is that users have full access to other user's Roaming Profiles. That is, if they are smart enough to use Environment variables to browse to their profile folders, and therefore displaying the Full UNC path of the share. If worse comes to worse I could always enable the below GPO entry, but enabling it just creates massive Admin headaches, since the policy strips down inherit permissions even when the Add the Administrator security Group to roaming user profiles is enable
User Config>Policies>Windows Settings>Folder Redirection>Documents>Options
Grant user exclusive rights to Documents

I have also tried making the following registry modification with no luck.
[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Toolbar\Explorer]
"ITBar7Layout"=hex:11,00,00,00,4c,00,00,00,00,00,00,00,34,00,00,00,19,00,00,00,\
  40,00,00,00,01,00,00,00,20,07,00,00,a0,0f,00,00,05,00,00,00,62,05,00,00,26,\
  00,00,00,02,00,00,00,21,07,00,00,a0,0f,00,00,04,00,00,00,29,05,00,00,a0,0f,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00

[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Toolbar\ShellBrowser]
"ITBar7Layout"=hex:11,00,00,00,4c,00,00,00,00,00,00,00,34,00,00,00,19,00,00,00,\
  40,00,00,00,01,00,00,00,20,07,00,00,a0,0f,00,00,05,00,00,00,62,05,00,00,26,\
  00,00,00,02,00,00,00,21,07,00,00,a0,0f,00,00,04,00,00,00,29,05,00,00,a0,0f,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00

Any other suggestion in what to do will be greatly appreciated.
-Thanks
Comment: Security through obscurity is *bad*...you should figure out *why* the users can read each other's roaming folders instead of hiding it.
Comment: @NathanC he already knows "why" the users can see (not read) each other's profiles, and he knows the solution to fix that, so that's not the issue.  The issue, is that it does create a headache, I agree with you RHQ, but it is there for a reason, and that reason is to stop the exact thing you are trying to prevent.
Comment: @joeqwerty I agree that Hiding something rather than securing it is not a proper solution. Hiding the path not only helps keep the admin/management to a minimum but also prevents users of knowing the share name and thus not able to properly browse to it and see each others folder's content and the user's name (since username is First.Last)
Comment: Hiding something rather than securing it properly isn't a proper solution. Why don't you secure your roaming profiles share so that this isn't an issue rather than trying to obfuscate the problem?
Comment: That would be like placing your door knob behind a curtain to obscure it and deter brake-ins, rather than, you know, locking the door.
Comment: @NathanC the reason to why users can read each others roaming profile is because for roaming profiles and folder redirection to work. The Authenticated user needs to be able to write to the network share for the user to properly create its profile folder at log in
Answer: Since you already know that you should be using...
User Config>Policies>Windows Settings>Folder Redirection>Documents>Options > Grant user exclusive rights to Documents

... then your only options are do it right, thus POTENTIALLY creating some admin/management headache, or continue to try to find ways to hide the UNC path.  There aren't any, I'll just let you in on that now, but you may continue to try.
The other issue that you failed to think of in trying to hide UNCs is that users can also do a File > Save As which brings up UNC paths as well.  I'm sure there are more ways than just the two mentioned here as well but that just came to me, and I know you can't hide them there; they were designed to be seen.
I really am sorry if this comes off as brash, but you already know the answer to your question I'm afraid.
Comment: I think when it comes in preventing users from accessing each other files I will, sadly, need to apply the above GPO. However, finding a way to fully hide the UNC path will also prevent users from finding other username's full Name, not a privacy concern since everyone knows each other. I guess I could create a different share location for users that require "contract" work. That way they don't have access to the "day to day" users' profile share home directory. - Thanks
Comment: That isn't a bad idea.  Another thing you can do is limit the location of where users are able to save when they do a Save As.  The admin headache created from doing this can at times be irritating but if you only run into a time or two when you have to take ownership then restore files for a user then that's not bad.  The woes of a sysadmin right?
Answer: @RHQ - Your comment to NathanC regarding permissions is incorrect. I've used roaming profiles for 10 years and have never given the Authenticated Users group access to the roaming profile share. This is how the permissions should be configured: http://technet.microsoft.com/en-us/library/cc737633(v=ws.10).aspx
Here are two screenshots of my environment. The first is a screenshot showing the effective permissions my user group has on the root folder. The second is a screenshot of my roaming profile folder. You'll see that neither my user group (Customers) or the Authenticated Users group has any  permissions on my roaming profile folder. Only my user account, System and Administrator have permissions.
Comment: @BradBouchard I will try to modify my questions to prevent any type of confusion (Sorry) and thanks
Comment: I see that the link you provide is for Windows Server 2003 and NOT Windows Server 2008 R2. I did tried to setup the environment as similar as it is described in the link provided, as I saw it before, but ran into permission Errors. Maybe I missed something. I will go though the documentation again and retest the environment and will let you know. Thanks
Comment: The problem is, @RHQ has a "mixed" question.  He references Roaming Profiles at the beginning, but then switches to Folder Redirection if you look at the GPO setting he talks about applying.  This makes it confusing to know which method he prefers/uses.  Also, using the above mentioned setting on the GPO for Folder Redirection works just fine, very good actually, but does create a problem here and there when you have to try to take ownership of a whole user's folder to fix certain things.  Either way the question needs a little clarity so that answers apply to what he is dealing with.
Comment: @joeqwerty - First of all there is not need to give any type of attitude, as I am here asking for help from people like you that might have more experience in the field than me. Secondly, I DID NOT "down voted your answer" as I'm not here to be an arrogant guy. Please show a bit of respect and maturity, specially when you are accusing people of "down voting you answer". If you honestly don't have any useful to say please just avoid saying anything.  PS - You need 125 reputation to down vote and answer and I only have 23
Comment: No worries... but what I'd actually do is create a new question dealing with Roaming Profiles/Folder Redirection as this question dealt with UNC paths and hiding them.
Comment: @RHQ - I'll say what I please, thank you very much. My method of `helping` is to give you an answer that resolves the core issue, not hide it. The permissions outlined in the article are valid for any Windows OS that uses the NTFS file system, not just Windows Server 2003. What's going to happen when your users stumble on some other method of circumventing your solution? How are you going to address that? Are you going to continue to find ways of `hiding` things rather than fixing them? In addition, Brad's answer is effective only for new folders. It will have no effect on existing folders.
Comment: @joeqwerty I appreciate your help and the efforts in showing screenshots of your environment. But, like I said before, I agree  with you that `hiding` something is not a proper solution. Instead, proper methods should be implemented to actually solve the  **core** issue instead of `hiding` it. I might have to re-look at my environment and see what I did wrong or what I missed. that is why I said before... "that I was going to look at your solution, the link provide and **retest** my environment to see what I missed or did wrong". -Thanks
Comment: Understood. No offense intended and my apologies for going off the rails a bit. Additionally, as I stated in my previous comment, Brad's solution will work for new folders but will not change the permissions on existing folders so you're still going to have to deal with that.
Comment: @joeqwerty Thanks for your input. I think I might have to re-look at my actual implementation and solve according. Once again, I appreciate your help, so thanks.


Problema com setState em React Native: "Can't call 'setState' on a component that is not yet mounted."

Question: tudo bem?
Eu sou iniciante em React Native e nesse app que eu estou fazendo eu não consigo chamar o 'setState' no método que eu criei. O nome do método que eu criei se chama includingMed() e eu chamo ele aqui

constructor() {
    super()
    this.state = {
      isVisible: false,
      newMed: [],
      medName: "",
      medInitHour: null,
      medTimes: null
    }
  }

  addMed = () => {
    if(!this.state.medName.trim() || !this.state.medTimes){
      Alert.alert('Dados inválidos!','Verifique se todos os campos estão preenchidos.');
      return
    }

    try {
      this.setState({
        newMed: this.state.newMed.push({
          medName: this.state.medName,
          medInitHour: this.state.medInitHour,
          medTimes: this.state.medTimes
        }),
        medInitHour: null,
        medTimes: null,
        medName: ""
      });
      var include = new MedList();
      include.includingMed(this.state.newMed);

      this.setState({newMed: []});

      ToastAndroid.show('Medicamento Adicionado!', ToastAndroid.SHORT);
    }catch (ex){
      ToastAndroid.show('Falha ao adicionar. Erro: '+ex, ToastAndroid.SHORT);
    }
  }

E aqui embaixo é toda a programação dele que é onde o setState() falha ao ser executado e me retorna aquela mensagem:

includingMed = newMed => {
    const meds = [...this.state.meds];
    meds.push({
      id: Math.random(),
      medName: newMed.medName,
      medInitHour: newMed.medInit,
      medTimes: newMed.medTimes
    });

    this.setState({ meds });
  }

Por gentileza, eu agradeceria muito se alguém puder me ajudar nesse app, é a minha primeira vez kkk
Obrigado, abraço!!
Comment: Olá Pablo, coloque o código completo do seu arquivo, para facilitar na análise do erro!
Answer: Tente utilizar assim:  this.setState(this.state);
Answer:

import React from 'react';
import { ExpoConfigView } from '@expo/samples';
//import Meds from '../components/Meds'
import {
  FlatList,
  View,
  Text,
  StyleSheet
} from 'react-native';
import Meds from '../components/Meds';
import 'regenerator-runtime/runtime';

export default class MedList extends React.Component {
  static navigationOptions = {
    title: 'Remédios',
  };

  state = {
    meds: [
      { id: Math.random(), medName: 'Diclofenaco', medInitHour: 0, medTimes: 3 },
      { id: Math.random(), medName: 'Aspirina', medInitHour: 0, medTimes: 4 },
      { id: Math.random(), medName: 'Cimegripe', medInitHour: 0, medTimes: 2 },
      { id: Math.random(), medName: 'Diclofenaco', medInitHour: 0, medTimes: 3 },
      { id: Math.random(), medName: 'Aspirina', medInitHour: 0, medTimes: 4 },
      { id: Math.random(), medName: 'Cimegripe', medInitHour: 0, medTimes: 2 },
      { id: Math.random(), medName: 'Diclofenaco', medInitHour: 0, medTimes: 3 },
      { id: Math.random(), medName: 'Aspirina', medInitHour: 0, medTimes: 4 },
      { id: Math.random(), medName: 'Cimegripe', medInitHour: 0, medTimes: 2 },
      { id: Math.random(), medName: 'Diclofenaco', medInitHour: 0, medTimes: 3 },
      { id: Math.random(), medName: 'Aspirina', medInitHour: 0, medTimes: 4 },
      { id: Math.random(), medName: 'Cimegripe', medInitHour: 0, medTimes: 2 }
    ]
  }

  includingMed = newMed => {
    const meds = [...this.state.meds];
    meds.push({
      id: Math.random(),
      medName: newMed.medName,
      medInitHour: newMed.medInit,
      medTimes: newMed.medTimes
    });

    this.setState({ meds });
  }

  render() {
    /* Go ahead and delete ExpoConfigView and replace it with your
     * content, we just wanted to give you a quick view of your config */
    //return <ExpoConfigView />;

    return (
      <View style={styles.container}>
        <View>
          <Text>Ainda vou colocar alguma coisa aqui</Text>
        </View>
        <View style={styles.list}>
          <FlatList data={this.state.meds}
            keyExtractor={item => `${item.id}`}
            renderItem={({ item }) => <Meds {...item} />}>
          </FlatList>
        </View>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  item: {
    backgroundColor: '#aaa',
    padding: 30,
    margin: 10,
    width: '75%',
    color: '#fff'
  },
  container: {
    backgroundColor: 'rgba(113, 165, 237, 0.4)'
  },
  list: {
    marginBottom: 40
  }
});

É nesse arquivo onde estou tendo problemas com o setState()


$\frac{3}{2}\int_a^b \frac{1}{\sqrt[3]{1-\cos4x}}dx>\cot2a \, +\, \cot2b$

Question: Prove that if $0<a<b<\frac{\pi}{2}$ then;
$$\frac{3}{2}\int_a^b \frac{1}{\sqrt[3]{1-\cos4x}}dx>\cot2a \, +\, \cot2b$$

This is pretty much all I could do on this integral;
$$I=\frac{3}{2}\int_a^b \frac{1}{\sqrt[3]{1-\cos4x}}dx$$
$$I=\frac{3}{2^{\frac{7}{3}}}\int_{2a}^{2b} \frac{1}{\sqrt[3]{\sin^2(x)}}dx$$
This integral clearly involved something beyond what I've learnt so far as none of my elementary substitutions simplified, so here's the closed form, but on some exploration, I managed to find Handbook of Elliptical Integrals on page $243$, section $521.03$, a similar integral. However, it was not making sense on how to interlink those two. I am interested in hints/explanation on how to proceed further.
EDIT(1):
As visible in the comments, the inequality is incorrect and the suggested inequality to prove is;
$$\frac{3}{2}\int_a^b \frac{1}{\sqrt[3]{1-\cos4x}}dx<\cot2a \, -\, \cot2b$$
Comment: Actually one can show that $\frac{3}{2}\int_a^b \frac{1}{\sqrt[3]{1-\cos4x}}dx <\cot2a - \cot2b$.
Comment: It is good that you added a reference, but the inequality is definitely wrong. With $a = \pi/8 - \epsilon$, $b = \pi/8+\epsilon$ and $\epsilon \to 0$ the LHS converges to zero and the RHS converges to $2$.
Comment: Is that the correct formula? For $a$ close to $b$ the integral on the left is arbitrarily small, and the right-hand side is not.
Comment: @MartinR, that formula is correct, i did check the source again, however youre also right, see [this](https://www.wolframalpha.com/input?i2d=true&i=cot%5C%2840%29Divide%5Bpi%2C2%5D%5C%2841%29%2Bcot%5C%2840%29Divide%5Bpi%2C3%5D%5C%2841%29) and [this](https://www.wolframalpha.com/input?i2d=true&i=Integrate%5BDivide%5B1%2CCbrt%5B1-cos4x%5D%5D%2C%7Bx%2CDivide%5Bpi%2C6%5D%2CDivide%5Bpi%2C4%5D%7D%5D), here's the source on W21 https://www.mat.uniroma2.it/~perfetti/lavori/Wildt-2017.pdf
Comment: My guess is that the right-hand side should be $\cot (2a) - \cot(2b)$.
Comment: Are you interested in a proof of the revised inequality?
Answer: $$
I = \frac{3}{2}\int_a^b \frac{dx}{({1-\cos(4x))}^\frac{1}{3}} = \frac{3}{2^{\frac{7}{3}}}\int_{2a}^{2b} \frac{dx}{(\sin^2 x)^{\frac{1}{3}}}
$$
$$
\cot (2a)-\cot(2b) = \int_{2a}^{2b}\frac{dx}{\sin^2x}
$$
$$
\forall x\in D, \frac{1}{\sin^2x} > \frac{1}{(\sin^2 x)^{\frac{1}{3}}} \Rightarrow \forall x\in D, \frac{1}{\sin^2x} >\frac{1}{(\sin^2 x)^{\frac{1}{3}}}>\frac{3}{2^{\frac{7}{3}}} \frac{1}{(\sin^2 x)^{\frac{1}{3}}}
$$
$$
\Rightarrow \int_{2a}^{2b}\frac{dx}{\sin^2x} >  \frac{3}{2^{\frac{7}{3}}}\int_{2a}^{2b} \frac{dx}{(\sin^2 x)^{\frac{1}{3}}}
$$
$$
\Rightarrow \cot (2a)-\cot(2b) > \frac{3}{2}\int_a^b \frac{dx}{({1-\cos(4x))}^\frac{1}{3}}
$$
with $2a, 2b \in D$ where $D$ is an interval in which both functions are continuous and defined.


How to get arguments of method to make completion with Roslyn?

Question: I try to make code completion with Roslyn and AvalonEdit.
For example, user have code:
public void Completion(int i,int j) { }

And he types:
 Completion(

So, i want to get arguments of method (int i, int j) and make code completion.
I write simple code, wich works with '.' and may be this code will work for '(' letter?
 public List<ICompletionData> GetCompletionData(String code,int offset,CompletionType completionType)
    {
        var syntaxTree = SyntaxFactory.ParseSyntaxTree(code);
        var compilation = CSharpCompilation.Create("foo")
            .AddReferences(Mscorlib)
            .AddSyntaxTrees(syntaxTree);
        var semanticModel = compilation.GetSemanticModel(syntaxTree);
        var textSpan = GetTextSpan(offset,1);// '.' or '(' coordinates
        ITypeSymbol lhsType = null;
        if (completionType == CompletionType.DotCompletion)
        {
            var memberAccessNode = (MemberAccessExpressionSyntax)syntaxTree.GetRoot()
           .DescendantNodes(textSpan).Last();
            lhsType = semanticModel.GetTypeInfo(memberAccessNode.Expression).Type;
        }
        else if(completionType==CompletionType.ArgumentListCompletion)
        {
            var arr = syntaxTree.GetRoot().DescendantNodes(textSpan).Last();
            var argumentListMode = (ArgumentListSyntax)syntaxTree.GetRoot().DescendantNodes(textSpan).Last();
            var directive = argumentListMode.GetFirstDirective();
            var arrgs=argumentListMode.Arguments;
            //lhsType = semanticModel.GetTypeInfo(directive).Type;
            //how to get lhsType?
        }

        if (lhsType == null)
            return new List<ICompletionData>();
        List<ICompletionData> completionDataColl = new List<ICompletionData>();

        // and here i make completion data
        foreach (var symbol in lhsType.GetMembers())
        {
            if (!symbol.CanBeReferencedByName
                || symbol.DeclaredAccessibility != Accessibility.Public
                || symbol.IsStatic)
                continue;
        }
   }

The problem is, that i can not get ITypeSymbol lhsType. It is null.
How to get lhsType?
Or, maybe i should use another way?
Answer: I don't know the code completion (I couldn't find this class called CompletionType) itself, but here is a way based on Roslyn only: semantic model and the method invocation, which I believe you have available (make the method call string a InvocationExpressionSyntax)
To obtain the arguments of a method you can get its SymbolInfo from the semantic model. Then you get its symbol. A symbol contains the list of parameters(arguments).
You can call SemanticModel.GetSymbolInfo()
The result will provide you a symbol or candidate symbols (if it is an overloaded method).
A method symbol will provide the list of parameters, which is the arguments of that method.


In python, "request.args.get" returns what type of variable?

Question: Please bear with me as I am a beginner in python. I'm using a framework to change values of my drone's parameters. One of the command I would like to use is vehicle.parameters['INJECT_TO_GPS']=100. When I use
vehicle.parameters['GPS_TO_INJECT']=100

It works well and changes it to 100. Now I want to include this in a function (I'm using flask to get the value of a from a web page), so If I use:
def change_value():
    a = request.args.get('a', 0)
    vehicle.parameters['INJECT_TO_GPS']=a

It does not work, printing me:

error: required argument is not a float

I also tried:
vehicle.parameters['INJECT_TO_GPS']=float(a)

But in this, it complains that it has to be a string...
What is wrong with it ? thanks a lot in advance
Comment: `type(a)` will give you the actual type of `a`. You can insert a `print(type(a))` as first line of `change_value()` and check the output
Comment: Please add the full error traceback to your question!
Comment: `vehicle.parameters` seems to refer to [this](http://python.dronekit.io/automodule.html#dronekit.Vehicle.parameters), which suggests that `parameters` is more then just a dict. [`GPS_INJECT_TO`](http://ardupilot.org/plane/docs/parameters.html#gps-inject-to-destination-for-gps-inject-data-mavlink-packets) seems to take float, `INJECT_TO_GPS` isn't defined anywhere. `request.args` won't contain anything but `str` arguments, but that actually doesn't seem relevant to your problem at all. So if anything, it should probably be `vehicle.parameters['GPS_TO_INJECT']=float(a)`
Comment: Add a `print(a); print(type(a))` after the second line of your `change_value()` function and you'll get the answer.
Answer: To know the type You can use inbuilt function type or isinstance to test that it belongs to that class:
    print(type(a))
    print(isinstance(a , class_or_type_you_want_check))


Should I trust the significant results of a glm or the post hoc analyses with no significance across the variables?

Question: GLM analyses are new to me so please excuse my ignorance in advance. I want to see if the number of road crossings differ across years for a specific taxa. I am working in RStudio and have found my glm to identify years as an influential factor, yet when I run a post hoc anaylsis there is no significant difference among any of the year combinations. I identified my family for the glm as a quasipoisson. My glm code reads as:
yrrxglm <- glm(yrrxdata$RX~as.factor(yrrxdata$YEAR)-1*yrrxdata$ID, family=quasipoisson)

RX is the number of crossings
Year is the factor I want to identify as having an impact or not on the crossings
ID is the ID number for the individuals (as some have more crossings than others)

My results for this model are:
glm(formula = yrrxdata$RX ~ as.factor(yrrxdata$YEAR) - 1 * yrrxdata$ID,
    family = quasipoisson)

Deviance Residuals:
   Min      1Q  Median      3Q     Max
-5.957  -3.393  -1.449   1.260  11.466

Coefficients:
                             Estimate Std. Error t value Pr(>|t|)
as.factor(yrrxdata$YEAR)2009   1.9924     0.6080   3.277  0.00129 **
as.factor(yrrxdata$YEAR)2010   2.5802     0.2482  10.394  < 2e-16 ***
as.factor(yrrxdata$YEAR)2011   2.2824     0.3327   6.861 1.49e-10 ***
as.factor(yrrxdata$YEAR)2012   1.1527     0.9253   1.246  0.21472
as.factor(yrrxdata$YEAR)2013   2.5246     0.1876  13.454  < 2e-16 ***
as.factor(yrrxdata$YEAR)2014   2.8761     0.1460  19.697  < 2e-16 ***
as.factor(yrrxdata$YEAR)2015   2.6525     0.1760  15.070  < 2e-16 ***
as.factor(yrrxdata$YEAR)2016   0.0000     4.0333   0.000  1.00000
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for quasipoisson family taken to be 16.26731)

    Null deviance: 9912.4  on 165  degrees of freedom
Residual deviance: 2273.2  on 157  degrees of freedom
AIC: NA

Number of Fisher Scoring iterations: 5

I then ran a post hoc test to see which years were significantly different from one another and received these results:
     Simultaneous Tests for General Linear Hypotheses

Multiple Comparisons of Means: Tukey Contrasts

Fit: glm(formula = yrrxdata$RX ~ as.factor(yrrxdata$YEAR) - 1 * yrrxdata$PUFF_ADDER,
    family = quasipoisson)

Linear Hypotheses:
                 Estimate Std. Error z value Pr(>|z|)
2010 - 2009 == 0  0.58779    0.65676   0.895    0.980
2011 - 2009 == 0  0.28995    0.69309   0.418    1.000
2012 - 2009 == 0 -0.83975    1.10720  -0.758    0.993
2013 - 2009 == 0  0.53222    0.63633   0.836    0.987
2014 - 2009 == 0  0.88363    0.62533   1.413    0.807
2015 - 2009 == 0  0.66005    0.63300   1.043    0.954
2016 - 2009 == 0 -1.99243    4.07885  -0.488    1.000
2011 - 2010 == 0 -0.29783    0.41507  -0.718    0.995
2012 - 2010 == 0 -1.42754    0.95801  -1.490    0.761
2013 - 2010 == 0 -0.05557    0.31117  -0.179    1.000
2014 - 2010 == 0  0.29584    0.28799   1.027    0.958
2015 - 2010 == 0  0.07226    0.30430   0.237    1.000
2016 - 2010 == 0 -2.58022    4.04091  -0.639    0.997
2012 - 2011 == 0 -1.12970    0.98328  -1.149    0.925
2013 - 2011 == 0  0.24226    0.38193   0.634    0.998
2014 - 2011 == 0  0.59368    0.36329   1.634    0.666
2015 - 2011 == 0  0.37010    0.37636   0.983    0.967
2016 - 2011 == 0 -2.28238    4.04697  -0.564    0.999
2013 - 2012 == 0  1.37197    0.94413   1.453    0.783
2014 - 2012 == 0  1.72338    0.93675   1.840    0.519
2015 - 2012 == 0  1.49980    0.94189   1.592    0.694
2016 - 2012 == 0 -1.15268    4.13805  -0.279    1.000
2014 - 2013 == 0  0.35141    0.23776   1.478    0.768
2015 - 2013 == 0  0.12783    0.25728   0.497    0.999
2016 - 2013 == 0 -2.52465    4.03764  -0.625    0.998
2015 - 2014 == 0 -0.22358    0.22869  -0.978    0.968
2016 - 2014 == 0 -2.87606    4.03592  -0.713    0.995
2016 - 2015 == 0 -2.65248    4.03711  -0.657    0.997
(Adjusted p values reported -- single-step method)

Warning message:
In RET$pfunction("adjusted", ...) : Completion with error > abseps

Yet no differences are shown across years in the post hoc. When I run this test for other variables such as sex or season or road type the post hoc corresponds to the glm. How is it that I can contrasting results? Or am I interpreting the outputs incorrectly?
I have now run a Fisher's LSD test and am viewing another 'contradictory' result:
> lsd <- LSD.test(yrrxglm, "as.factor(YEAR)", console=TRUE)

Study: yrrxglm ~ "as.factor(YEAR)"

LSD t Test for RX.M

Mean Square Error:  2.188433

as.factor(YEAR),  means and individual ( 95 %) CI

         RX.M       std  r       LCL      UCL  Min      Max
2009 2.290000 0.6308724  5 0.9824162 3.597584 1.50  3.00000
2010 3.178155 2.1253993 20 2.5243629 3.831947 1.00 10.25000
2011 3.716667 2.4730291 15 2.9617328 4.471601 1.25  8.50000
2012 2.583333 1.9083151  6 1.3896781 3.776989 1.00  6.00000
2013 4.152020 3.6338607 33 3.6430439 4.660997 1.00 16.00000
2014 4.599847 3.3134289 39 4.1316573 5.068037 1.00 12.33333
2015 4.199720 3.7452463 34 3.6982844 4.701155 1.00 15.20000

Alpha: 0.05 ; DF Error: 145
Critical Value of t: 1.97646

Groups according to probability of means differences and alpha level( 0.05 )

Treatments with the same letter are not significantly different.

         RX.M groups
2014 4.599847      a
2015 4.199720      a
2013 4.152020      a
2011 3.716667     ab
2010 3.178155      b
2012 2.583333      b
2009 2.290000      b

The Fisher's LSD test is saying that 2011 is different to other years. But the graph doesn't seem to show any year as different.
Answer: Note the term 'simultaneous tests'  in the glht output. This means that the p values are adjusted for multiplicity (in this case, a family of 28 hypothesis tests). Such an adjustment is done to control the probability of making a type I error anywhere among those 28 tests. That makes them a lot more conservative.


How can I click a link in a webpage in Rselenium?

Question: I know this should be simple, I'm just not sure why this is not working! Please help. I have the following code:
RSelenium::startServer()
require(RSelenium)
remDr <- remoteDriver(remoteServerAddr = "localhost"
                  , port = 4444
                  , browserName = "safari"
)
remDr$open()
remDr$navigate("http://www.cs.ucr.edu/~mshok002/")

Next, I need to click on the link "Teaching" at the top of the page and I'm stuck here. The html code is here at the following I'm just not sure how to find it using remDr$findElement. How can I search for both the link "Teaching" and html code "Teaching.html"?
Teaching

Thanks much
Answer: I figured out how to do it so I'm posting my answer which may be helpful for others. I came up with two approaches:
First:
remDr$navigate("Teaching.html")

Second:
webElem <- remDr$findElement(using = 'css selector',"Teaching")
webElem$clickElement()

Answer: Another way you can do is -- go to the page using rselenium
right click the link and select unique selector and then use clickElement()


Simple expression for Partition function, $P(n)$, for $n\le20$

Question:
I know there are various forms to express the function $P(n)$, the number of partitions for an integer $n$, e.g. see some of the formulas referenced on Wolfram.

But say I only care about the first ~$10-20$ numbers ($P(n)$ for $n \lt$ ~$20$).
E.g. from OEIS:, the sequence (up to $n=20$):
$$1, 1, 2, 3, 5, 7, 11, 15, 22, 30, 42, 56, 77, 101, 135, 176, 231, 297, 385, 490$$

But is there a "relatively simple" exact closed form expression for the first $10-20$ values of $n$? Relatively simple meaning e.g. an expression for $P(n)$, $n \le$ ~$10-20$, that someone could calculate reasonably quickly on a basic calculator (products and sums okay, but e.g. no Bessel functions or something). Also, no approximate solutions, only exact solutions.
Comment: I dont think that, out of approximations, exist some closed form for the first results of $P(n)$. The more simple or closed form to this is just a table of values.
Comment: True, I was hoping for something a little better than a lookup table, but agree that there might not be anything too simple, even for only a few terms...
Comment: Well, I guess I could do something like an Nth degree polynomial defined at N integers to exactly fit N points... But that is potentially more complicated then a lookup table if I ended up having to use N terms...
Comment: @sambajetson I am making some calculations, it is possible but probably my solution is not so nice. I will be back.
Comment: BTW, your list has $20$ numbers in it, but the OEIS entry starts at $p(0)=1$, so your list is missing $p(20)=627$.  (See http://oeis.org/A000041/b000041.txt for an enumerated list.)
Answer: The partition numbers $P(n)$ for $1\le n\le21$ can be calculated quickly and easily using the recurrence
$$P(n)=P(n-1)+P(n-2)-P(n-5)-P(n-7)+P(n-12)+P(n-15)$$
with boundary conditions $P(0)=1$ and $P(n)=0$ for $n\lt0.$
This is a truncated form of formula (20) on that Wolfram page you linked to. The sequence $1,\ 2,\ 5,\ 7,\ 12,\ 15$ is easily remembered as $1,\ 2,\ 2+3,\ 3+4,\ 3+4+5,\ 4+5+6.$
Comment: this is nicer than mine for sure! very good one.
Answer: Yes, it is possible to calculate a closed form, but it is not so nice. Anyway the calculation is relative simple, and once it is calculated you just need to apply the formula, so here it is (the explanation of the theory below is much larger than the code required to use it):

Let us define the constant $P = 1.366611510803...$ as a Mills-like constant such that the partition function $P(n)=f(P,n)$ for $n=[1..20]$. The constant $P$ is obtained by the encapsulation of the elements of the partition function elements $P(n)$ into integers $E_n$ of $[N,(N+1)^2]$ intervals. As a result, the function $f(P,n)$ is a representing function of the first elements of the partition function for $n=[1..20]$, so $P(n)=f(P,n), n \in [1..20]$.

This constant is such that:

$P(n)=f(P,n)=\lfloor E^{2^n} \rfloor -(\lfloor E^{2^{n-1}} \rfloor)^2+\frac{\lvert n-(\frac{1}{2}) \rvert}{(\frac{1}{2})-n}$
for $n=[1..20]$ provides $P(n)$ in the same growing order.

I am using a method of my own (I asked about it some weeks ago but unfortunately still was not answered).
The constant has a lot of decimal places, but if you are using PARI/GP you can calculate it and use it and it will provide the exact values of $P(n)$ for $n=[1,20]$.
This is the manual method to generate the constant $P$ (it is much better described in my original question applied to other encapsulation problem):

$E_1=P(1)=1$ encapsulating the next value $P(2)=1$ into $E_1^2+P(2)+1=1+1+1=3$.
$E_2=3^2=9$ encapsulating the next value $P(3)=2$ into $E_2^2+P(3)+1=9+2+1=12$.
$E_3=12^2=144$ encapsulating the next value $P(4)=3$ into $E_3^2+P(4)+1=144+3+1=148$.

... up to:

$E_{20}=E_{19}^2$ encapsulating the next value $P(20)=490$ into $E_{20}^2+P(20)+1$.

Then using same theory as Mills' constant, our constant is $P=E_{20}^{(\frac{1}{2^{20}})} = 1.366611510803...$.
You will require a good amount of decimal places to have enough precision to use it and obtain the values, but it works and can be used for calculations.
For instance in PARI/GP first you calculate up to $E_{20}$, then calculate the constant $P$ with $E_{20}$, and then you can apply the formula to obtain the exact values of $P(1)..P(20)$ from that moment (so for instance you can store the value of the constant $P$ in a library and build a function to use it):
<code>\p200000;
P1=1
E1=1
P2=1
E2=E1^2+P2+1
P3=2
E3=E3^2+P3+1
P4=3
E4=E4^2+P4+1
P5=5
E5=E5^2+P5+1
P6=7
E6=E6^2+P6+1
P7=11
E7=E1^7+P7+1
P8=15
E8=E8^2+P8+1
P9=22
E9=E9^2+P9+1
P10=30
E10=E10^2+P10+1
P11=42
E11=E11^2+P11+1
P12=56
E12=E12^2+P12+1
P13=77
E13=E13^2+P13+1
P14=101
E14=E14^2+P14+1
P15=135
E15=E15^2+P15+1
P16=176
E16=E16^2+P16+1
P17=231
E17=E17^2+P17+1
P18=297
E18=E18^2+P18+1
P19=385
E19=E19^2+P19+1
P20=490
E20=E20^2+P20+1
P=E20^(1/(2^E20))
</code>
And then you can use $P$ as follows:
<code>P20=floor(P^(2^20))-(floor(P^(2^19)))^2-1
P19=floor(P^(2^19))-(floor(P^(2^18)))^2-1
P18=floor(P^(2^18))-(floor(P^(2^17)))^2-1
P17=floor(P^(2^17))-(floor(P^(2^16)))^2-1
P16=floor(P^(2^16))-(floor(P^(2^15)))^2-1
P15=floor(P^(2^15))-(floor(P^(2^14)))^2-1
P14=floor(P^(2^14))-(floor(P^(2^13)))^2-1
P13=floor(P^(2^13))-(floor(P^(2^12)))^2-1
P12=floor(P^(2^12))-(floor(P^(2^11)))^2-1
P11=floor(P^(2^11))-(floor(P^(2^10)))^2-1
P10=floor(P^(2^10))-(floor(P^(2^9)))^2-1
P09=floor(P^(2^9))-(floor(P^(2^8)))^2-1
P08=floor(P^(2^8))-(floor(P^(2^7)))^2-1
P07=floor(P^(2^7))-(floor(P^(2^6)))^2-1
P06=floor(P^(2^6))-(floor(P^(2^5)))^2-1
P05=floor(P^(2^5))-(floor(P^(2^4)))^2-1
P04=floor(P^(2^4))-(floor(P^(2^3)))^2-1
P03=floor(P^(2^3))-(floor(P^(2^2)))^2-1
P02=floor(P^(2^2))-(floor(P^(2^1)))^2-1
P01=floor(P^(2^1))-(floor(P^(2^0)))^2+1
</code>
Be aware that $f(P,1)$ ($P01$ in the code) is an special case and that is the reason of the correction term $+\frac{\lvert n-(\frac{1}{2}) \rvert}{(\frac{1}{2})-n}$.


Seat reservations for (recurring) events on given days

Question: I would like to let my users reserve seats (or a whole table) for events, and pay for the reservation via PayPal.
Different performances/shows would be advertised, users could choose which tables or seats they would like to reserve. A theater OR bar, restaurant, etc. would have "fix" seats and tables, so they would not change (or just rarely); events can be repetitive/recurring (e.g. concerts) - in some cases, locations can remain the same too, so only the date changes (e.g. a concert played in Example Bar 3 times a month); but one event can be played in other locations too.
I tried on Drupal.org first, but I got no answer; any help would be appreciated.
If there's no way to "bind" it to Ubercart, I'd solve it in another way (PayPal IPN), but I have to do it ASAP.
P.S.: I've already tried MERCI, Simple Reservation, Hotel Booking System for Ubercart and Reservation modules (the latter seemed OK from the picture), but unfortunately I couldn't figure out how to do something similar to  what I need - BUT THIS MEANS NOTHING, maybe I just overlooked some opportunities!!!
If you say I can solve it with one of these modules, please help! Even if you have a totally different suggestion! Thanks!

UPDATE:
In the meantime I found this very interesting article: Ubercart Event Registration
Let me quote from it:

at the moment, the de facto Ubercart method for doing online event
  registration is with a module called UC Node Checkout. It's perfect
  for a one-and-done event registration site, but for a site that is
  hosting several events simultaneously and on an ongoing basis, it's
  awkward. This is due to the fact that it maps a content type to a
  product SKU - so for each event you'd need to create a new content
  type. Not really very good long-term, particularly when the site
  administrator is not overly familiar with Drupal or Ubercart.
So, an alternative solution was devised using the Webforms module. The
  webform stores the registrant's organization's information - and also
  asks the registrant how many tickets to the event they want, which is
  the use case the client specified. The webform, after processing the
  form, adds the event 'tickets' to the cart. This is done with the
  'Webform advanced settings' field in the webform configuration, under
  'Additional Processing'.

Good to know. This means the article I found earlier doesn't describe what I need.
Another quote from uc_event_registration's readme:

UC Node Checkout
This is the approach that has been used alot for Drupal conferences
  and demo'd at drupalcons.  The huge problem here is twofold:  First,
  registrations are nodes.  That means we have to build views to create
  registration lists and that seems like unnecessary overhead when
  Webform is so much lighter weight.  Second, and most importantly, you
  need a new content type for EVERY event.  No thanks.  On sites that
  are doing dozens of events per year, this would mean, eventually, a
  huge amount of content types.  That's bad.

Here's another one related to Webforms: Drupal Webforms With Dynamic Select Boxes Tutorial
This seems very promising, maybe this could be the way one could solve what Andy suggested.
I'm still interested in suggestions for practical solutions - maybe this way!
Comment: There's now an awful lot on this page counting comments and answers and I can't quite process it all! How are you doing? Do you still have questions?
Comment: Finally I decided to write my own module, because it seems like unfortunately I will not be able to do this whole thing with the existing modules. Which complicates the situation is that I realized when reserving a seat, I don't have to pay for just one person (with a PayPal account), I'd rather have to let it be payed for the location's owner (or a person who should get the money for tickets). I don't know how I will do that (e.g. on an ebay, every user has their own PayPal-account). :\ I hope I can publish a finished version that I made - maybe this could be shared with the community.
Answer: I don't think you are going to find a solution that does 100% of what you need, I expect there will need to be custom development here.
Sounds like a custom content type (CCK) + ubercart + paypal (with ubercart) will be the most flexible solution. Perhaps read through the reservation module to see how it limits the available supply of tickets (i.e. sold out).
I would also suggest to remove the graphical part of the event registation, as this looks like it could be tricky, and instead focus on the core functionality of the app, i.e. the registration and payment workflow.
Every problem can be solved in drupal, but some of them are unique, and have their own solution.
If you need this solved ASAP, looks like you may need contractors, or some late nights ;) If you want to attract more quality answers, consider placing a bounty on this
Comment: I've already placed a bounty on it... hope someone will have time to give me a really detailed help...
Comment: @wiifm: +1, thanks for your quick answer!! Yes, I already know I have to do some custom development, but to be more specific, what kind of custom content type do you think of (within CCK)? I will have to create a relatively simple admin surface too, where I thought I could place some text areas where the user could set the total amount of tables in the place, and narrowing this one by one how many seats there are around the tables. I can think of some possible solutions in my head with my own codes, but I would have to "marry" them to Drupal, which is not a simple task I think...
Comment: (to place a bounty on it, I have to wait one more day. I know even a hundred points of mine wouldn't lead to a half-complete solution, but how nice this would be... :P But maybe I will try.) Oh, and what is not an easy job, I have to maintain a stock not to let users be able to reserve seats that already have been reserved...and let them pay via PayPal.
Answer: I agree with other answers in that you wouldn't get 100% of the way there without some custom development.
My first thought on solving this is don't worry too much about the interface, just get the data entities right. I think your products really only need two new fields at its most basic (venue, which could be a node reference and date (or another node reference to an event content type and reuse events)). Use stock to be the number of tickets available at a venue for an event and product kit could be a table which is just made up of the individual seats and would therefore manage stock and could also have discounts associated with it.
As far as interface goes you could create a calendar view of "seats" and "tables" (tables are just product kit).
EDIT: To distill the gist of the comment thread on this I'm going to summarise here.
What we seem to have got to is the following:

A particular event at a particular venue is a product class/content
type. These content types all have one CCK field, the event date.
When you create a new instance of this product class you specify the
date and add ONE attribute to it, that is the table number. The
values of this attribute correspond to the number of tables to the
event.

The workflow this describes is that a customer chooses to add an event to the cart, and as part of this process they have to choose a seat number and a number of seats that they want.
This allows a couple of things:

You can actually price tables differently,
You can manage stock at a per table level.

This is because an attribute, straight out of the box, has its own SKU and therefore its own stock levels and own pricing. If you think of what attributes are for this makes sense. If you have red and blue shirts you need to know how much of each you have, i.e. stock levels. If large shirts cost more than small shirts then you have to know how to price them.
Keep in mind this only describes the workflow and the backend. Webforms as described in other answers can still be used to control the interface, as could a custom built form. This is just to manage the data entities. You still have to create events manually but I think in this case the small number of content types is a good thing, and a process could be put together pretty quickly to automate some of this (look at Node Import for this, it can with some other contrib modules handle attributes as well if you wanted to customise the values)
Some notes:
An interface that works in this instance is a simple view of your new content types (split them by venue if you want as each content type is venue specific) with a link to the actual product. Then you can select a date and a number of tables. If you want to book seats at different tables then you will need to add another product to the cart.
The module UC Attribute Stock isn't really relevant here I think. As far as I can tell it just combines multiple attributes into one selection. That is given the example above of red and blue colours and small and large sizing, rather than have two dropdowns that the customer has to select from you have one drop down with four selections.
The webform solutions are not precluded from anything above. They are providing the interface, and may make sense if there is other, NON PRODUCT, data that you want to collect from your registration. Keep in mind though that you may be able to collect this from the checkout pane a bit more easily and in line with current shopping workfow. I think writing a form though, especially if you want it to have some smarter widgets on the front of it will be easier and lighter in the long run than shoe horning webform into what you want to do. For the basic workflow I don't think you even need it.
Comment: +1: thanks for your answer! Yes, I thought something similar would be great: locations could be node references; tickets as stock units would be good too. But what if an event (like a concert) is repetitive, but it's like a tour, played on many locations? Do I always have to edit the node references and date fields? And you mentioned tables are product kits - but what if a visitor just wants to reserve 2 seats from a table for 8 people? Unfortunately I have to take care about the admin interface too as the user can only handle the simplest interface (and has no idea about Drupal). Thanks!!
Comment: Hmm. OK, I was suggesting product kit to offer pricing variations for "bulk" seating purchases. But it actually sounds like your actual product is a table, where the stock level is the number of seats at the table. You could mitigate your backend work by making a product class that is  a table for an event at a venue, the only variable then is the date.
Comment: yes, the number of tables per locations is "static" as it doesn't change all the time, it has to be "bound" to a location. So you suggest "making a product class that is a table for an event at a venue" - but what if there are 100 tables at a venue? Should I create 100 nodes from the "Table" content type in this case? :\ Will I bind these with node references to a venue? And if there are e.g. 30 locations with 100 tables each, does it mean I should create 30*100 = 3000 nodes ("tables"), and attach these tables to my "Event" node type via node references? I still don't know the good solution.:(
Comment: I reckon you could make the product class have a static link to the venue, that is you have a product class that is a table at a venue. It does mean lots of nodes. The other option may be have something that represents a table at a venue and an attribute that allows them to select a table, i.e. a drop down with the table number.
Comment: OK, but what happens if an event is repetitive? In this case I had to repeat creating the "Table" content and link to a venue all the time. E.g. there would be a concert 3 times a month in the same location, but the number of tables and seats would always remain the same; and I would like to advertise them a month earlier than the events' date. How would I do it then? Oh, and what about the dates of the events? Should I always attach a new "date" reference field to an event? And then attach the event to a venue, etc.? Sorry for asking so much, but I'm still lost in the task.Thx 4 your answers!
Comment: The main problem with a date is that it must be a CCK field, it can't be an attribute like a table can. Multiple nodes aren't an issue, if you can create them manually now, then it isn't a big deal to write something that just creates new nodes for you. So if there's a concert 3 times a month at a venue, then you would have 3x products, with table as an attribute and each with a date reference field. The end goal I think is that if you can get the workflow going, even if there is a lot done manually, you can automate that later. If you can't get the workflow going then you have a problem.
Comment: So you say "with table as an attribute", but there can be many-many tables (say e.g. 100) - e.g. 100 tables would mean 100 attributes? OK, let's say I do this - but in this case should I create a product class in Ubercart for one venue (e.g. Example Bar would be a content type this way), attach e.g. 100 attributes (if there are 100 tables at the venue), and repeat creating this product content type each time a new event occurs? But it's still a question how can I "bind" a stock to table attributes (stock is needed to know how much free seats remained). What do you think?
Comment: No no, one attribute with a select list of numbers 1 - 100 or however many tables are available at the event. You can even have stock based on the attribute (the number of seats at the table)
Comment: I found **UC Attribute Stock** (http://drupal.org/project/ubercart_attribute_stock), but it's unfortunately for Drupal 7, but I would need sg. similar for Drupal 6 - how can I maintain a stock of attributes then? So, just to clarify, you mean: there's a product class, which is an event - required attributes would be tied to it; an attribute would be ONE table. One table attribute can have e.g. a select list of 1-5, if it has 5 free seats available. The second would have e.g. 3, because there are 3 free seats available. And etc. till say 100... Did I understand your answer correctly?
Comment: I don't think you need that module as you can do everything you need with one attribute (table number) with stock maintained for each table. All that module does, looking at it quickly, is combine two attributes into one selection.
Comment: Maybe I still misunderstand you, so please be a little more specific. :) You say "everything you need with one attribute (table number)" - OK, and how can I handle how many seats there are around one given table? I don't know exactly what you mean - there's a possibility that one table is one attribute, and all the unique seats are the attribute's options... But it's a bit hard to maintain. Maybe you suggest something else, but this way don't keep it to yourself :))
Comment: OK, this comment is getting a little bit long, so have updated original question.
Comment: "When you create a new instance of this product class you specify the date and add ONE attribute to it, that is the table number. The values of this attribute correspond to the number of tables to the event." - yes, this would be really simple if I didn't have to provide users the opportunity to select WHICH tables they would like to reserve, and how many seats of the GIVEN TABLE they would like. But as far as I understand you, you consider the problem simpler than it is. I think tables should be like "groups" which have their own stock levels.
Comment: A venue can have e.g. 50 tables. The user would see an interface where he/she could reserve for example the T34 tablw with 4 seats and the T35 table with 10 seats. These would be "static" and "fixed", the location's tables wouldn't be reordered very often.
Comment: But you can have stock at the attribute level, which is why I'm suggesting it. T34 would have a stock level of 4, and T35 would have a stock level of 10. You can even call them "Table One" or whatever you want. You can then get seats (in Ubercart as it stands) on different products by selecting two products with different attributes.
Comment: OK, let's be a bit more specific. If I want to add attributes to a product, first I have to create selectable attributes like this: http://i.imgur.com/Gmtr8.png . Here I could add further ones. An attribute should have options like this: http://i.imgur.com/enaH9.png . I created a test product class, which is not shippable and the default price is 10€s. When I go to "Attributes", I have to first add them: http://i.imgur.com/y7S5P.png, after that: http://i.imgur.com/7kyMJ.png . OK, the product looks like this: http://i.imgur.com/yvGHt.png . (have to continue in next comment, sorry)
Comment: In Adjustments, I can change SKUs not to be the same as in the beginning: http://i.imgur.com/pbr2V.png . After that, I can set stock levels: http://i.imgur.com/CgKXT.png . OK, seems to be ready... but on the product's view, everything remained the same as the first linked image with attributes. The user can't even see how much of the products with given attributes remained. How then? Do you think an option (like here the "1st option of 1st attribute", 2nd.., etc.) should be a table's name? You say "the small number of content types is a good thing" - but this would mean as many as locations.
Comment: One more thing: these attributes are "global", available from all products. Should I create unique attributes for all the locations (with as many OPTIONS as many tables there are)? I would be really grateful if you could illustrate these examples as I did. :) Btw. I think this is a really uncomfortable process, and I don't know how to automate it for a user who has nothing to do with Drupal. :\
Comment: (just one more comment to this: thank you very much for your patience and your kind answers, it's good that people can count on people like you and the others who answered here on Drupal Stack Exchange!)
Comment: Attributes would only need to be defined once. I would lean towards having a separate set of "table" attributes for each venue.
Answer: A slightly different approach to the others. You could use Ubercart Event Registration for the individual registration forms, and the custom coding could just be a custom webform widget (see webform_hooks.php and the files in the components directory for more details). This would be responsible for showing only available places, and reserving the selected place on submission. If you saw a reason, you could integrate the component with one of the reservation modules you mention above. I don't think this is much less work than the alternatives, but it's a slightly different model in that it uses webform. (And I agree entirely with Malks that you want to first decide about how it's going to be handled internally.)
More details:
I think there's a number of ways you can do it, depending on for example whether you want to integrate with an existing module, whether you want to use nodes (can be great for quickly making reports with Views), etc. Here's a very brief description of how you might do it with an entirely bespoke implementation.
Assumptions: a single reservation consists of a date, and any positive number of seat IDs.

Create a module that provides a webform component for the reservation.
The module should also create a DB table for storing reservation details.
To begin with forget about a fancy widget, just make it simple (eg. have a textfield for the date, and another for the seat IDs - they can be entered as a comma separated list at first).
On validation, the webform component checks with the DB table that the values are valid (ie not already reserved).
On submission, the webform component again checks if the reservation is available, and if so makes the reservation. You want to be careful here that two users submitting a request at the same time can't make the same reservation (eg. use a lock in your submit handler).
Go back to your widget and make it fancy, eg. have a nice JS date picker that only shows dates with remaining reservations, maybe with some semi-graphical tables that show available seats and let you select them neatly. But underneath it's all basically doing the same thing.

I've not tried something quite like this, so just an idea!
This is still a very simple system, and as it stands it's not very easy to get the data out. You might want to make some bespoke admin screens or you could views enable your db table.
You don't want to use this approach unless you want the idea of one node per form, with submissions being stored in the webform submitted data table. You really want to be sure that this fits your needs before taking this path imho.
Comment: +1: it seems to be a very good approach too, thank you! But if you don't mind, let me ask to clarify I understood you correctly: the form for showing available places and letting them be selected would be a "separate" webform, which on submission would update the available places and decrement them; and this "event registration" webform is one that can be bound to Ubercart. Is it correct? And how could this webform be built up? And yes, all of you are right that I have to find out first HOW I would do this whole thing... that's why it's very good you all help me think about it. Thx in advance!
Comment: hmm, I still haven't figure out how to solve it with webforms - e.g. how to maintain a stock of seats. (So one table would have a stock of the available seats.) Could you push me a little bit further with your approach?
Comment: @Sk8erPeter Updated anwer
Comment: thanks for the updated answer! I also have to "categorize" seats to tables. So the best would be to have tables e.g. like this: T1 - 4 seats, T2 - 6 seats, ..., Tn - 3 seats, etc. I understand the theory of what you say, I can imagine something similar, but I still don't know the adequate Drupal-way solutions *in practice*. E.g. you didn't mention the problem of recurring events - what should I do with date fields? Should I pass a new date field to a content type every time a new event is coming? What about the same event - new location problem? Date+location would be tied together. Thx again!
Comment: I updated my question, please see the new infos under the line! I think "you're tha man" :D, because you suggested webforms from the beginning - I think this seems to be the best approach so far! Do you have experience with similar solutions, anything related to webforms+products?
Comment: @Sk8erPeter I do have experience of webform products (I'm the maintainer of uc_event_registration), but not of anything as complex as what you're attempting! I'm afraid today's my last day of work this year so v. busy, and off to the Netherlands for the weekend tomorrow morning, so won't be able to look at your update before next week.
Comment: wow, it sounds good that you're the maintainer of this great module! I think using UC Node Checkout with a node that is bound to a custom reservation Webform is very similar to an approach of using uc_event_registration with the same custom reservation Webform. So I "just" have to find out HOW to create this customized webform, and attach it to the "Paid Event" product: I have to learn webform-developing... but I'm much further than at the beginning. If you have hints good links related to similar custom webform creations, please share them, I would appreciate it. :) Have a good trip!
Answer: I think you should make table as a product.
We've this relationship:
event1 -> date1 -> city1 -> restraunt1 -> table1
So 1 refers to 1-many relationship.
Have Venue table with information about each venue and tables and other attributes
Have City table with city + venue details
Have OrderBooking table with this:
event1,date1,city1,venu-id,product-id
Customer will browse from event to restraunt and will see available seats(products). Write a module to display the (availability) details along with links to create a product. As soon as one clicks a link in the venue, arrange for a pop up which will ask for table specific details and direct to product form and auto populate the product with those details in a custom cck field. Now when tries to buy the product then you should write a module to check availability and after payment have this product related to the OrderBooking table.
You'll need to use UC Node Checkout module as described here for collecting registration data.
I've taken a simplistic view.
Comment: It isn't. It is easy to configure and is very useful. I've done for my site, try adding this product in the cart: http://www.utilitiesindia.com/send-letter-online-india . This will allow you to associate any type of Node(in your case, receive any custom registration data, before selecting a table) with a checked out product. Great thing is that it works seamlessly and integrates well with product checkout workflow. Also I'm not aware of any improvements in this module in last 10 months. So checkout.
Comment: +1: thanks. I also thought much about the theory of the whole process, I've already drawn a diagram of table relationships, but I'm interested in **practical** todos. By the way your link is the same as the one I also posted on drupal.org: http://drupal.org/node/1365664 , but collecting user data is maybe the easiest part of the whole thing. I'm curious about the easiest practical solution of the problem - maybe the modules I linked are suitable for the task, I just didn't find out how to do it. And I still don't know to make an event recurrent (passing newer date field, etc.??). Thanks!
Comment: I updated my answer with a link to an article which states UC Node Checkout is a little bit overkill for tasks like this. What's your opinion about it?
Comment: Although I'm not an expert in Ubercart, I think that custom solution will be simple, flexible and easy to maintain. Ubercart does not provide the functionality you're looking for. Using "techniques" to use Ubercart functions in different( like using Tables as attributes) way will mess up the logic and workflow.
Comment: +1 for your comment, thanks for the example! It gave me an idea: maybe this way I could create an Event product type with a "Location" node reference (description and address of the venue) and a date field; change the "Add to cart" submit button's text to "Buy tickets"; and after the user submits the form, I could attach another node with UC Node Checkout, where I would display a custom reservation Webform node. With this form, the user could select which table and how many seats he/she would like to reserve. With this number I would have to decrement the available seats for the given table.
Comment: (sorry, too much characters, I have to continue here:) The reservation tables would be my own db-tables - with table ids + available free seats + happening ids + location ids tied together. I just have to find out how to create a customized webform like this... On the admin interface, admin would create a Location content type, type in how many tables there are -> after this, I would have to generate so much fields, and let the admin set how many seats there are around a table - it would default to 1, admin could change it. After that, he types address. Do you think this concept is OK?
Comment: Do you have any diagram -- this'd immensly help all of us to understand your perspective. You can make one your raw design along with pros, cons and clarifications you need. This should be very useful for your site design.
Comment: I surely will post the diagram, I just have to think about it again if the plans are viable. Until that, I updated my question again with another quote of uc_event_registration module's readme which states it's a bad thing to have a new content type for every new events, which I would need for UC Node Checkout. I think there's some truth in it. Or I don't need new content types for it? I already can't see the wood for the trees. I'll notify you as soon as I managed to make a draft of my plans!
Comment: Without fully understanding what's going on I want to suggestion something. Remove Location from your design as it is very trivial issue and will not affect current site design. Secondly use Ubercart only for the functionality it provides. Don't create too many products if they are all similar like Tables or Events. Make buyable items like Ticket a product. Don't think about UC Node Checkout either. First make it in natural way, then let us think what Drupal functionality/modules are available to do them in easier way. If there are, it's good otherwise you develop it.
Comment: OK, Location doesn't affect "site design", but I have to attach the Location to an event to let the users know where an event will occur. And yepp, I thought about creating a Ticket product class in Ubercart (which creates "Ticket" content type), which users can buy, but they also would have to select for which event they would like to buy a ticket (to an event, there would be a date field attached - when it happens) - and which seats/tables they would like to reserve. Creating a Ticket product doesn't mean a problem...my only obstacle to being ready is to solve the **reservation** problem.
Answer: I did something similar for a tour agency. I used the Hotel Booking module for Ubercart, each event is a "room" which you can set a limit for occupancy and charge differently depending on the day. On the admin side, you have calendars you can select what days are available on a recurring basis. I believe you can have different kinds of [events] as well.
The only issue was it was new in Drupal 7 and had a few bugs, but it may have improved by now.
Answer: You can check the following module: Booking Time Slots.
As the name says, it provides Time Slots Booking functionality. It integrates with Views and Calendar.
Check the sample screenshot in Drupal 7.x:

For more, check Comparison of Booking System modules.