Two-way anova with interaction term: what is the point of a post-hoc test?

Question: I have a statistics interpretation question.  I've recently performed a two-way anova to identify an interaction term between my categorical independent variables (genotype + temperature) that influences my continuous dependent variable (speed). My hypothesis is that genotype+temperature strongly interact to reduce speed.
In my case, the interaction term is significant - ie., genotype and temperature significantly interact, and I can easily observe that speed is reduced in this case.
I am now directed by common practice to perform a post-hoc test, but I don't really understand why:
What post-hoc test is appropriate to help confirm the interaction between temp and genotype?  I am not interested in anything except the interaction, as I consider all of the other conditions to be controls.
That said, is such a post-hoc test necessary, given that the ANOVA itself is designed to (and succeeds) in revealing a significant interaction?  Is it necessary to determine the sign of the interaction?
Bonus points if you can point me to a nonparametric test for this, as my data is not gaussian (but my large N=100+ helps me be comfortable with using the data in the ANOVA itself).
Comment: How many levels do you have for each of your 2 IVs? In what sense are your data not Gaussian?
Comment: I have two levels for each IV; FWIW, this is a genetic manipulation driving a temperature sensitive manipulation.  So I have a temperature control (temp+ in the control genotype) and a genotype control (temp- in the test genotype).  In an ideal world, all three controls (--, +-, -+) should be equivalent; in practice, they are not.
Comment: If you only have 2 groups, there's no point in doing post-hoc tests to see which groups differ--there's only 1 possibility. Your 'low' group must differ from your 'high' group in order for the ANOVA to have been significant. In what way are your data not Gaussian?
Comment: When you have factors with more than two levels, a significant ANOVA result points to at least *some* non-zero differences on whatever thing you were testing, but don't say where those differences arose. *Post hoc* tests are to try to identify where the differences that contributed to the significance lie.
Comment: The data is right-tailed with a strong floor effect. It looks roughtly like a (rather) heavy-tailed exponential distribution.
Comment: Just to be clear, it's the interaction term I'm most interested in.  I think the responses by Glen_b and @gung are for analysis of main factors, not the interaction itself.  Am I reading you guys correctly?
Comment: I recognize that you're mostly interested in the interaction. Given that, & the fact that this is 2x2, I see no point in post-hoc contrasts. You found a significant interaction, which is what you wanted to know; you're done. Re: your dist, is this for Y ignoring group, or do you find this dist w/i each group? (Nb, only the latter matters--see: [what-if-residuals-are-normally-distributed-but-y-is-not](http://stats.stackexchange.com/questions/12262//33320#33320).) If you find this w/i the groups, you could try a transformation. Alternatively, your N may be large enough that it doesn't matter.
Answer: A relatively unknown but very useful nonparametric substitute for two-way ANOVA with replication (must be balanced ANOVA) is the Schierer-Ray-Hare test. It is an extension of the Kruskal-Wallis test. Do it this way:

Replace each data observation with its overall rank (lowest number is ranked 1 and tied observations are all given the average rank)
Run the two-way ANOVA as usual with the ranks instead of the actual data values.
Discard the MS, F, and p value terms in the ANOVA output.
Sum SS for SS factors, SS interaction, and SS error. Divide this sum by df total. The result is MS total.
The test statistic, H, for each factor and interaction equals its SS / MS total
The Excel formula for the p value for each is:  CHIDIST(H, df). The df is the usual df for each factor and interaction. The Excel output provides these df figures.

The Schierer-Ray-Hare test is a lot less powerful that regular two-way ANOVA. The p values are usually around twice as large on the SRH test as those generated by two-factor ANOVA.
Comment: I had never heard of SRH, @Mark Harmon, thanks for this & welcome to CV.
Comment: You got it bro! Actually the p Values from the SRH test might be 10X larger than p values from the ANOVA test.
Comment: You might also note that the Kruskal-Wallis test is a special case of ordinal logistic regression, which *can* handle multiple factors, continuous variables, interactions, etc. In my comments to the Q above, I note that regular ANOVA may be fine for this problem, however.
Comment: Well, the Kruskal-Wallis test can only tell if there is a significant difference between ranked data groups of only one factor. Logistic regression, whether binary, ordinal, or nominal, is a completely different animal than the nonparametric Kruskal-Wallis test. Regular (I guess you mean two-way with replication) ANOVA requires that all groups within each F test have similar variances and be normally distributed. The original question mentions that the data is not Gaussian so the parametric ANOVA test would not be the correct test. ANOVA is however somewhat robust against non-normality.
Comment: The Kruskal-Wallis test operates over ranks & ordinal logistic regression predicts the probability of a given ordinal category, which can be understood as a rank. The KW test can be shown to be a special case of OLR. As for ANOVA, what it requires is that the sampling distribution of the group means be normal. This is guaranteed if the w/i group distributions of the data are normal, however will occur w/ non-normal data w/ sufficient N via the central limit theorem. It is not clear if ANOVA is inappropriate in this case.


Unit root tests for panel data in R

Question: I have the plm package and would like to run unit root tests on some variables. I get the following error:
> purtest(data$tot.emp)
Error in data.frame(baldwin = c(59870, 61259, 60397, 58919, 57856, 57227,  :
  arguments imply differing number of rows: 14, 19, 11, 12, 1, 20, 18, 10, 13

I assume that I'm getting this error because my panel is unbalanced. Two questions:

Can you use panel unit root tests (Levin, Lin and Chu (2002), Im, Pesaran and Shin (2003), or others) for unbalanced panels?
If so, is it implemented in R?
Comment: I can't answer your question but FYI, Stata runs these tests even when the variable is unbalanced. However, Breitung's, Harris-Tzavalis and Hadri's LM tests seem to require balancedness.
Comment: An update. Take a look at the punitroots package. I think it may do what you want. http://road.unimol.it/bitstream/2192/163/3/ESDP11063.pdf
Comment: The issue of unbalanced panel data is addressed in version 2.2-2 of plm on CRAN. The tests of Hadri and of Levin/Lin/Chu are not applicable to unbalanced data, though.
Answer: At the current moment (version 1.2-10, 2012-05-05) it seems that the unbalanced case is not supported. Edit: The issue of unbalanced panel data is solved in version 2.2-2 of plm on CRAN (2020-02-21).
Rest of the answer is assuming version 1.2-10:
I've looked at the code, and the final data preparation line (no matter what is your initial argument) is the following:
 object <- as.data.frame(split(object, id))

If you pass unbalanced panel, this line will make it balanced by repeating the same values. If your unbalanced panel has time series with lengths which divide each other then even no error message is produced. Here is the example from purtest page:
 > data(Grunfeld)
 > purtest(inv ~ 1, data = Grunfeld, index = "firm", pmax = 4, test = "madwu")

Maddala-Wu Unit-Root Test (ex. var. : Individual Intercepts )

  data:  inv ~ 1
  chisq = 47.5818, df = 20, p-value = 0.0004868
  alternative hypothesis: stationarity

This panel is balanced:
 > unique(table(Grunfeld$firm))
  [1] 20

Disbalance it:
 > gr <- subset(Grunfeld, !(firm %in% c(3,4,5) & year <1945))

Two different time series length in the panel:
 > unique(table(gr$firm))
  [1] 20 10

No error message:
> purtest(inv ~ 1, data = gr, index = "firm", pmax = 4, test = "madwu")

    Maddala-Wu Unit-Root Test (ex. var. : Individual Intercepts )

data:  inv ~ 1
chisq = 86.2132, df = 20, p-value = 3.379e-10
alternative hypothesis: stationarity

Another disbalanced panel:
  > gr <- subset(Grunfeld, !(firm %in% c(3,4,5) & year <1940))
  > unique(table(gr$firm))
  [1] 20 15

And the error message:
 > purtest(inv ~ 1, data = gr, index = "firm", pmax = 4, test = "madwu")
  Erreur dans data.frame(`1` = c(317.6, 391.8, 410.6, 257.7, 330.8, 461.2,  :
  arguments imply differing number of rows: 20, 15

Comment: The issue of unbalanced panel data is addressed in version 2.2-2 of plm on CRAN. The tests of Hadri and of Levin/Lin/Chu are not applicable to unbalanced data, though.
Answer: Did you try to convert your data to pdata.frame? I have an unbalanced panel also, but purtest seems to work with unbalanced panel if the data is pdata.frame. But I might be wrong too:)
However in ?purtest authors write:
"object, x

Either a 'data.frame' or a matrix containing the time series,
a 'pseries' object, a formula, or the name of a column of a 'data.frame',
or a **'pdata.frame'**
on which the test has to be computed; a'purtest' object for the print
and summary methods,"

So I guess if one uses pdata.frame the purtest "understands" that panel is unbalanced.
Am I wrong???
Comment: I tried but this does not work for me.
Comment: The issue of unbalanced panel data is addressed in version 2.2-2 of plm on CRAN. The tests of Hadri and of Levin/Lin/Chu are not applicable to unbalanced data, though.
Answer: You can use for sure the IPS test on unbalanced data, as long as you test for the Wtbar or Ztbar statistic.
Fore example, the following R code can be used to test sattionarity in unbalanced heterogeneous panel data, with IPS test (plm package):
`purtest(data$tot.emp, test = c("ips"), ips.stat="Ztbar", exo="intercept",dfcor=TRUE, lags = c("AIC"), pmax = 10)`

Answer: Eviews 5 allows you to test the panel unit roots for the unbalanced data that is not possible with R and Stata. For example, even though Im–Pesaran–Shin and Fisher-type tests can be applied for unbalanced panel in Stata, it is not possible if we have some observations , with the gap i.e. we have data of country i for year 2002 and 2004 but not 2003 (assuming the lag to be greater than one). I think that Eviews drop all such observations while performing tests, for our example this is country i. However, if you manually drop all such observations, you can still perform the tests with R and Stata.

Unit root tests for panel data in R


What is the best Python GUI module to do a project with multiple screens in one window in?

Question: I'm not exactly sure to describe it so here is a basic storyboard of what I would like to do using Python: https://i.stack.imgur.com/dciMH.jpg
I'm quite new to GUI programming so I'm unsure which Python module is best for this. I've had a little look at Tkinter. How I would get the screen to change to the second image after the next button is pressed without opening a new window in Tkinter?
Secondly, what are some other GUI Python modules that you would recommend for this sort of project I'm doing?
Answer: Tkinter is a perfectly fine toolkit to lean on, as are other toolkits. The advantage tkinter has is that you probably already have it installed. Plus, it is very simple to use, and very powerful.
To answer your question on how to get the screen to change: tkinter uses geometry managers named pack and grid (and to a much lesser extent, place) to layout your widgets in a window. These geometry managers have the feature that they can be asked to remove a window, making it invisible.
You can, for instance, create each "page" as a Frame with other widgets inside. To switch pages, call pack_ forget or grid_forget to hide the current page, then pack or grid to show the new page. This is a very common and useful technique. grid_remove has an added feature in that it remembers the options that were used to originally display the window, makinging it a little easier to toggle it between being visible and hidden.
Comment: Thank you very much for explaining this to me! It was exactly what I was looking for as you have told me the methods to call.
Answer: http://www.wxpython.org/
I recommand wxpython.
if it's simple, do within wxpython.
Comment: @BryanOakley I am really sorry for that I state so simply. Actually, I might not have more experience than you at python. But, my thinking is that. AnonUser who ask this question is quite new on GUI programming. So, i recommand wxpython. cause it doesn't need to install and practice with new tools. I don't say whether tkinter is bad or not. I say wxpython is easier than tkinter for someone who is n't familiar with GUI programming.
Comment: I'm not downvoting because I dislike wxPython, I'm downvoting because of the statement "if it's simple, do within wxpython". That seems like bad advice to me. If it's simple, why not use the toolkit that is part of a standard python installation? Could you explain your reasoning?
Answer: I did that in pygtk by using a tabbed widget with hidden tabs.
You can design it in glade and later automate switching between tabs in your code.
Nowadays I would probably go with QT for a new project, though I haven't yet.


Return value on a submit handler

Question: Below is a hook from the LinkedIn Integration module.
Then I have a hook form alter in my module and it's all setup and ready to go to call a submit handler.
When the user goes to authorize LinkedIn, and come back, I want to fire some my code.
The question is I don't know what states or values are after it comes back. I tried this
function my_module_form_link($form,$form_state, $uid)
{
  dpm($form_state['values']);
}

but it did not return anything
function linkedin_user_enable_form($form, $form_state, $uid) {
  $form = array();
  $form['#user'] = $uid;
  $form['#action'] = url('linkedin/token/' . $uid);
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Go to LinkedIn'),
    '#suffix' => '
' . t('You will be taken to the LinkedIn website in order to complete the process.') . '
',
  );
  return $form;
}

Answer: Looking at the linkedin module source code,  there's some ways that can run code on the way back (but only when are logging-in, it seems).
When they are logging-in:

hook_linkedin_external_login: if they don't already have an account and will be asked to register.
hook_linkedin_tie_external_login: if they already have an account and will be logged-in using that account.

When they are associating a linkedin account:

I do not see any hooks or any stable way of running code in this case.

Here's an example on how to hook into hook_linkedin_external_login:
In your mymodule.module file:
function mymodule_linkedin_external_login($uid) {
  // do something
}

But you'll have to be careful since linkedin_auth_linkedin_external_login does a drupal_goto() so you'll have to have your module hook called first, so that your function doesn't get skipped. See how drupal decide execution order of same hook in different modules?
Comment: This isn't for login, it is for when they auth in their profile.
Comment: You mean when linking their linked-in account through their Drupal profile? In that case, that's my second section above, there's no obvious way to trigger code or hook onto something.
Comment: Take a look at linkedin.inc module_invoke_all('linkedin_external_login', $uid); that calls a function in linkedin_auth.module function linkedin_auth_linkedin_external_login($uid) can I do anything with that?
Comment: Yes this is the first hook I mention in my answer, I've added an example on how to use that hook.
Comment: I tried using using this, but when I login, I don't get a message. function module_linkedin_external_login($form,$form_state) {
    global $user;
    $account = user_load($user->uid);
    drupal_set_message(t('Hello - Login Worked'));
}  ALSO I set the weight to -1
Comment: Try using both hooks then, this one is for when you don't already have a Drupal account. The other is used when you already have an account in Drupal.

Return value on a submit handler


How to retrieve the values of multiple checkboxes from admin forms

Question: I have a form in a backend module making use of some dynamically created checkboxes, done thusly:
$allStores = Mage::app()->getStores();
foreach ($allStores as $stores) {
    $store = Mage::app()->getStore($stores);
    $values[] = array('value' => $store->getId(), 'label' => $store->getFrontendName());
}
$fieldset->addField('checkboxes', 'checkboxes', array(
    'label' => 'stuff',
    'name'  => 'boxes',
    'values'=> $values,
));

Now for this particular example I have two stores, with respective IDs 1 and 2. I would assume that this would return an array, or string value containing either 1, 2 or 1 and 2. If I select both boxes, it returns 2, if I select store ID 2, it returns 2, if I select store ID 1, it returns 1. If checkboxes are not what I'm wanting to use here, what do I need to use to obtain multiple values from one field? I assume that this should be capable of it, or it had might as well be radio buttons.
Answer: Check your html source
This is probably yours:
<input type="checkbox" name="boxes" value="1">1

<input type="checkbox" name="boxes" value="2">2

This is what it should be:
<input type="checkbox" name="boxes[]" value="1">1

<input type="checkbox" name="boxes[]" value="2">2

I don't know magento but a shot in the dark, I believe you might need to change your code to:
$fieldset->addField('checkboxes', 'checkboxes', array(
    'label' => 'stuff',
    'name'  => 'boxes[]',
    'values'=> $values,
));

Answer: the following line needs to be changed:
'name'  => 'boxes[]',


Using HDF5 from C# for realtime data

Question: I am able to store HDF5 data using the .net version of HDF5. The problem is, that data is in an array, after which I write it out to the HDF5 file.
Is there a way to continuously add data to HDF5 in realtime from C#? From what I see on the internet, this is handled by packet table, but I don't see that it is part of the dotnet port?
Comment: Did you find the answer to your question? I also want to use HDF5 with c# and I'm planning to access the file from multiple threads. Is this possible with c#?
Comment: Version 1.10.x of hdf5 will introduce SWMR (single write multiple read) see: https://www.hdfgroup.org/HDF5/release/obtain5110.html
The Hdf.Pinvoke library still uses the 1.8.x version so I don't think it's possible yet.
Answer: In hdf5 you can append datasets to an already existing dataset. It is a lot of work to implement it with the low-level methods of the Hdf.Pinvoke library. I have created a library that adds a layer around these methods to make it easier to read and write hdf5 files. HDF5DotNetTools. It's still an early version but you can append data to a file.
There's an example of appending data to existing data in the readme and also in the unit tests of the project.
Here's part of the code:
int fileId = Hdf5.CreateFile(filename);
// Create a dataset and append two more datasets to it.
// The dsets list are three 10 by 5 matrices
using (var chunkedDset = new ChunkedDataset<double>("/test", fileId, dsets.First()))
{
  foreach (var ds in dsets.Skip(1))
    chunkedDset.AppendDataset(ds);
}
Hdf5.CloseFile(fileId);

Answer: To continuously add data to HDF5 in real-time (and without knowing how many rows of data exist a priori) you need to work with an extendible dataset.
Assuming that you are not bound to a particular API, take a look at HDFql as it may greatly alleviate you from the low-level details of HDF5. Using HDFql in C# your use-case could be solved as follows (this is just an example - we assume that you have a function named acquire that populates variable values with a timestamp (UNIX Epoch Time) and an acquired value):
using System.Runtime.InteropServices;
using AS.HDFql;

// declare structures
[StructLayout(LayoutKind.Sequential, Pack = 0)]
struct Data
{
    public int timestamp;
    public float reading;
}

public class Example
{
    public static void Main(string []args)
    {
        // declare variables
        Data values;
        int number;

        // create an HDF5 file named 'data.h5' and use (i.e. open) it
        HDFql.Execute("CREATE AND USE FILE data.h5");

        // create a dataset named 'dset' of data type compound composed of two members named 'timestamp' (of data type int containing a UNIX Epoch Time)
        // and 'reading' (of data type float containing an acquired value). The dataset starts with 0 rows and can grow (i.e. be extended) in an unlimited fashion
        HDFql.Execute("CREATE DATASET dset AS COMPOUND(timestamp AS INT, reading AS FLOAT)(0 TO UNLIMITED)");

        // register variable 'values' for subsequent use (by HDFql)
        number = HDFql.VariableRegister(values);

        // call hypothetical function 'acquire' that populates variable 'values' with a timestamp and an acquired value
        while(acquire(values))
        {
            // alter (i.e. change) dimension of dataset 'dset' to +1 (i.e. add a new row at the end of 'dset')
            HDFql.Execute("ALTER DIMENSION dset TO +1");

            // insert (i.e. write) data from variable 'values' into the last row of dataset 'dset' (thanks to a point selection)
            HDFql.Execute("INSERT INTO dset[-1] VALUES FROM MEMORY " + number);
        }
    }
}

Please check HDFql reference manual to get additional information on how to work with extendible datasets using this library.

Using HDF5 from C# for realtime data


How to construct a cross-entropy loss for general regression targets?

Question: It's common short-hand in neural networks literature to refer to categorical cross-entropy loss as simply "cross-entropy." However, this terminology is ambiguous because different probability distributions have different cross-entropy loss functions.
So, in general, how does one move from an assumed probability distribution for the target variable to defining a cross-entropy loss for your network? What does the function require as inputs? (For example, the categorical cross-entropy function for one-hot targets requires a one-hot binary vector and a probability vector as inputs.)
A good answer will discuss the general principles involved, as well as worked examples for

categorical cross-entropy loss for one-hot targets
Gaussian-distributed target distribution and how how this reduces to usual MSE loss
A less common example such as a gamma distributed target, or a heavy-tailed target
Explain the relationship between minimizing cross entropy and maximizing log-likelihood.
Comment: This is quite straightforward. I partially explained it before. https://stats.stackexchange.com/questions/347431/do-neural-networks-learn-a-function-or-a-probability-density-function/347486#347486. It is simply Maximum Likelihood Estimation. I will make a more visual answer when I have time.
Comment: You might be interested in my answer answer to the provoking question: https://stats.stackexchange.com/a/378994/214971
Answer: Suppose that we are trying to infer the parametric distribution $p(y|\Theta(X))$, where $\Theta(X)$ is a vector output inverse link function with $[\theta_1,\theta_2,...,\theta_M]$.
We have a neural network at hand with some topology we decided. The number of outputs at the output layer matches the number of parameters we would like to infer (it may be less if we don't care about all the parameters, as we will see in the examples below).

In the hidden layers we may use whatever activation function we like. What's crucial are the output activation functions for each parameter as they have to be compatible with the support of the parameters.

Some example correspondence:

Linear activation: $\mu$, mean of Gaussian distribution
Logistic activation: $\mu$, mean of Bernoulli distribution
Softplus activation: $\sigma$, standard deviation of Gaussian distribution, shape parameters of Gamma distribution

Definition of cross entropy:
$$H(p,q) = -E_p[\log q(y)] = -\int p(y) \log q(y) dy$$
where $p$ is ideal truth, and $q$ is our model.
Empirical estimate:
$$H(p,q) \approx -\frac{1}{N}\sum_{i=1}^N \log q(y_i)$$
where $N$ is number of independent data points coming from $p$.
Version for conditional distribution:
$$H(p,q) \approx -\frac{1}{N}\sum_{i=1}^N \log q(y_i|\Theta(X_i))$$
Now suppose that the network output is $\Theta(W,X_i)$ for a given input vector $X_i$ and all network weights $W$, then the training procedure for expected cross entropy is:
$$W_{opt} = \arg \min_W -\frac{1}{N}\sum_{i=1}^N \log q(y_i|\Theta(W,X_i))$$
which is equivalent to Maximum Likelihood Estimation of the network parameters.
Some examples:

Regression: Gaussian distribution with heteroscedasticity

$$\mu = \theta_1 : \text{linear activation}$$
$$\sigma = \theta_2: \text{softplus activation*}$$
$$\text{loss} = -\frac{1}{N}\sum_{i=1}^N \log [\frac{1} {\theta_2(W,X_i)\sqrt{2\pi}}e^{-\frac{(y_i-\theta_1(W,X_i))^2}{2\theta_2(W,X_i)^2}}]$$
under homoscedasticity we don't need $\theta_2$ as it doesn't affect the optimization and the expression simplifies to (after we throw away irrelevant constants):
$$\text{loss} = \frac{1}{N}\sum_{i=1}^N (y_i-\theta_1(W,X_i))^2$$

Binary classification: Bernoulli distribution

$$\mu = \theta_1 : \text{logistic activation}$$
$$\text{loss} = -\frac{1}{N}\sum_{i=1}^N \log [\theta_1(W,X_i)^{y_i}(1-\theta_1(W,X_i))^{(1-y_i)}]$$
$$= -\frac{1}{N}\sum_{i=1}^N y_i\log [\theta_1(W,X_i)] + (1-y_i)\log [1-\theta_1(W,X_i)]$$
with $y_i \in \{0,1\}$.

Regression: Gamma response

$$\alpha \text{(shape)} = \theta_1 : \text{softplus activation*}$$
$$\beta \text{(rate)} = \theta_2: \text{softplus activation*}$$
$$\text{loss} = -\frac{1}{N}\sum_{i=1}^N \log [\frac{\theta_2(W,X_i)^{\theta_1(W,X_i)}}{\Gamma(\theta_1(W,X_i))} y_i^{\theta_1(W,X_i)-1}e^{-\theta_2(W,X_i)y_i}]$$

Multiclass classification: Categorical distribution

Some constraints cannot be handled directly by plain vanilla neural network toolboxes (but these days they seem to do very advanced tricks). This is one of those cases:
$$\mu_1 = \theta_1 : \text{logistic activation}$$
$$\mu_2 = \theta_2 : \text{logistic activation}$$
...
$$\mu_K = \theta_K : \text{logistic activation}$$
We have a constraint $\sum \theta_i = 1$. So we fix it before we plug them into the distribution:
$$\theta_i' = \frac{\theta_i}{\sum_{j=1}^K \theta_j}$$
$$\text{loss} = -\frac{1}{N}\sum_{i=1}^N \log [\Pi_{j=1}^K\theta_i'(W,X_i)^{y_{i,j}}]$$
Note that $y$ is a vector quantity in this case. Another approach is the Softmax.
*ReLU is unfortunately not a particularly good activation function for $(0,\infty)$ due to two reasons. First of all it has a dead derivative zone on the left quadrant which causes optimization algorithms to get trapped. Secondly at exactly 0 value, many distributions would go singular for the value of the parameter. For this reason it is usually common practice to add a small value $\epsilon$ to assist off-the shelf optimizers and for numerical stability.
As suggested by @Sycorax Softplus activation is a much better replacement as it doesn't have a dead derivative zone.

Summary:

Plug the network output to the parameters of the distribution and
take the -log then minimize the network weights.
This is equivalent to Maximum Likelihood Estimation of the
parameters.
Comment: What is the input to the network in this case?
Answer: I'm going to answer for targets whose distribution family is an exponential family.  This is typically justified as the minimum assumptive distribution.  Let us denote the observed distributions to be $X_1, X_2, \dots$, the predictive distributions produced by the model to be $Y_1, Y_2, \dots$.
Every exponential family admits two important parametrizations: natural and expectation.  Let the expectation parameters of the observed distributions be $\chi_i$, and the natural parameters of the predictive distributions be $\eta_i$.

How does one move from an assumed probability distribution for the target variable to defining a cross-entropy loss for your network?

The cross entropy of an exponential family is
$$H^\times(X; Y) = -\chi^\intercal \eta + g(\eta) - E_{x\sim X}\left(h(x)\right).
$$
where $h$ is the carrier measure and $g$ the log-normalizer of the exponential family.  We typically just want the gradient of the cross entropy with respect to the predictions, which is is just
$$\frac{dH^\times(X; Y)}{d\eta} = g'(\eta)-\chi.
$$
$g'(\eta)$ is just the expectation parameters of the prediction.

What does the function require as inputs?

We require the pair $(\eta_i, \chi_i)$.
Let's go through your examples:
Categorical cross-entropy loss for one-hot targets.  The one-hot vector (without the final element) are the expectation parameters.  The natural parameters are log-odds (See Nielsen and Nock for a good reference to conversions).  To optimize the cross entropy, you let the gradient be the difference of one-hot vectors.
Gaussian-distributed target distribution (with known variance).  The cross entropy is simply a paraboloid, and therefore corresponds to MSE.  Its gradient is linear, and is simply the difference of the observed and predicted means.
A less common example such as a gamma distributed target, or a heavy-tailed target.  Same thing: the optimization is done as a difference of expectation parameters.  For the gamma distribution, the expectation parameters are $(\frac{k}{\lambda}, \psi(k) - \log \lambda)$ where $k$ is the shape and $\lambda$ is the rate.
The relationship between minimizing cross entropy and maximizing log-likelihood is a good question.  Minimizing log-likelihood is the special case where the target is a sample $x$ (or delta distribution) rather than a distribution $X$.  I think for the optimization you do the same thing as above except you just use $\chi=x$.  The log-likelihood calculation is just the log-density of the predictive distribution evaluated at $x$.


TLS Error on OpenVPN

Question: Client: OpenVPN 2.3.4 64bit (Works fine connecting to my pfSense at home)
Server: OpenVPN 2.2.2 installed via yum
Followed this guide:
http://blog.solidshellsecurity.com/2013/01/15/openvpn-installation-configuration-setup-centos-5-6-32-64bit-openvz-xen-kvm/
SERVER Logs:
tail -f /var/log/openvpn.log

Tue Jul 22 15:22:20 2014 us=550107 MULTI: multi_create_instance called
Tue Jul 22 15:22:20 2014 us=550157 MEIP:7969 Re-using SSL/TLS context
Tue Jul 22 15:22:20 2014 us=550170 MEIP:7969 LZO compression initialized
Tue Jul 22 15:22:20 2014 us=550208 MEIP:7969 Control Channel MTU parms [ L:1574 D:138 EF:38 EB:0 ET:0 EL:0 ]
Tue Jul 22 15:22:20 2014 us=550216 MEIP:7969 Data Channel MTU parms [ L:1574 D:1450 EF:42 EB:135 ET:32 EL:0 AF:3/1 ]
Tue Jul 22 15:22:20 2014 us=550234 MEIP:7969 Local Options String: 'V4,dev-type tun,link-mtu 1574,tun-mtu 1532,proto UDPv4,comp-lzo,cipher BF-CBC,auth SHA1,keysize 128,key-method 2,tls-server'
Tue Jul 22 15:22:20 2014 us=550239 MEIP:7969 Expected Remote Options String: 'V4,dev-type tun,link-mtu 1574,tun-mtu 1532,proto UDPv4,comp-lzo,cipher BF-CBC,auth SHA1,keysize 128,key-method 2,tls-client'
Tue Jul 22 15:22:20 2014 us=550248 MEIP:7969 Local Options hash (VER=V4): '5b1533a2'
Tue Jul 22 15:22:20 2014 us=550255 MEIP:7969 Expected Remote Options hash (VER=V4): 'd3a7571a'
Tue Jul 22 15:22:20 2014 us=550271 MEIP:7969 TLS: Initial packet from MEIP:7969, sid=0dfede6a 99560dda
Tue Jul 22 15:23:20 2014 us=508541 MEIP:7969 TLS Error: TLS key negotiation failed to occur within 60 seconds (check your network connectivity)
Tue Jul 22 15:23:20 2014 us=508582 MEIP:7969 TLS Error: TLS handshake failed
Tue Jul 22 15:23:20 2014 us=508632 MEIP:7969 SIGUSR1[soft,tls-error] received, client-instance restarting
Tue Jul 22 15:23:22 2014 us=455521 MULTI: multi_create_instance called
Tue Jul 22 15:23:22 2014 us=455569 MEIP:24021 Re-using SSL/TLS context
Tue Jul 22 15:23:22 2014 us=455581 MEIP:24021 LZO compression initialized
Tue Jul 22 15:23:22 2014 us=455618 MEIP:24021 Control Channel MTU parms [ L:1574 D:138 EF:38 EB:0 ET:0 EL:0 ]
Tue Jul 22 15:23:22 2014 us=455626 MEIP:24021 Data Channel MTU parms [ L:1574 D:1450 EF:42 EB:135 ET:32 EL:0 AF:3/1 ]
Tue Jul 22 15:23:22 2014 us=455644 MEIP:24021 Local Options String: 'V4,dev-type tun,link-mtu 1574,tun-mtu 1532,proto UDPv4,comp-lzo,cipher BF-CBC,auth SHA1,keysize 128,key-method 2,tls-server'
Tue Jul 22 15:23:22 2014 us=455649 MEIP:24021 Expected Remote Options String: 'V4,dev-type tun,link-mtu 1574,tun-mtu 1532,proto UDPv4,comp-lzo,cipher BF-CBC,auth SHA1,keysize 128,key-method 2,tls-client'
Tue Jul 22 15:23:22 2014 us=455659 MEIP:24021 Local Options hash (VER=V4): '5b1533a2'
Tue Jul 22 15:23:22 2014 us=455666 MEIP:24021 Expected Remote Options hash (VER=V4): 'd3a7571a'
Tue Jul 22 15:23:22 2014 us=455681 MEIP:24021 TLS: Initial packet from MEIP:24021, sid=dd084ab8 21aa78a2
Tue Jul 22 15:24:22 2014 us=804481 MEIP:24021 TLS Error: TLS key negotiation failed to occur within 60 seconds (check your network connectivity)
Tue Jul 22 15:24:22 2014 us=804522 MEIP:24021 TLS Error: TLS handshake failed
Tue Jul 22 15:24:22 2014 us=804571 MEIP:24021 SIGUSR1[soft,tls-error] received, client-instance restarting

CLIENT LOG
Tue Jul 22 15:50:53 2014   pkcs11_protected_authentication = DISABLED
Tue Jul 22 15:50:53 2014   pkcs11_protected_authentication = DISABLED
Tue Jul 22 15:50:53 2014   pkcs11_protected_authentication = DISABLED
Tue Jul 22 15:50:53 2014   pkcs11_protected_authentication = DISABLED
Tue Jul 22 15:50:53 2014   pkcs11_private_mode = 00000000
Tue Jul 22 15:50:53 2014   pkcs11_private_mode = 00000000
Tue Jul 22 15:50:53 2014   pkcs11_private_mode = 00000000
Tue Jul 22 15:50:53 2014   pkcs11_private_mode = 00000000
Tue Jul 22 15:50:53 2014   pkcs11_private_mode = 00000000
Tue Jul 22 15:50:53 2014   pkcs11_private_mode = 00000000
Tue Jul 22 15:50:53 2014   pkcs11_private_mode = 00000000
Tue Jul 22 15:50:53 2014   pkcs11_private_mode = 00000000
Tue Jul 22 15:50:53 2014   pkcs11_private_mode = 00000000
Tue Jul 22 15:50:53 2014   pkcs11_private_mode = 00000000
Tue Jul 22 15:50:53 2014   pkcs11_private_mode = 00000000
Tue Jul 22 15:50:53 2014   pkcs11_private_mode = 00000000
Tue Jul 22 15:50:53 2014   pkcs11_private_mode = 00000000
Tue Jul 22 15:50:53 2014   pkcs11_private_mode = 00000000
Tue Jul 22 15:50:53 2014   pkcs11_private_mode = 00000000
Tue Jul 22 15:50:53 2014   pkcs11_private_mode = 00000000
Tue Jul 22 15:50:53 2014   pkcs11_cert_private = DISABLED
Tue Jul 22 15:50:53 2014   pkcs11_cert_private = DISABLED
Tue Jul 22 15:50:53 2014   pkcs11_cert_private = DISABLED
Tue Jul 22 15:50:53 2014   pkcs11_cert_private = DISABLED
Tue Jul 22 15:50:53 2014   pkcs11_cert_private = DISABLED
Tue Jul 22 15:50:53 2014   pkcs11_cert_private = DISABLED
Tue Jul 22 15:50:53 2014   pkcs11_cert_private = DISABLED
Tue Jul 22 15:50:53 2014   pkcs11_cert_private = DISABLED
Tue Jul 22 15:50:53 2014   pkcs11_cert_private = DISABLED
Tue Jul 22 15:50:53 2014   pkcs11_cert_private = DISABLED
Tue Jul 22 15:50:53 2014   pkcs11_cert_private = DISABLED
Tue Jul 22 15:50:53 2014   pkcs11_cert_private = DISABLED
Tue Jul 22 15:50:53 2014   pkcs11_cert_private = DISABLED
Tue Jul 22 15:50:53 2014   pkcs11_cert_private = DISABLED
Tue Jul 22 15:50:53 2014   pkcs11_cert_private = DISABLED
Tue Jul 22 15:50:53 2014   pkcs11_cert_private = DISABLED
Tue Jul 22 15:50:53 2014   pkcs11_pin_cache_period = -1
Tue Jul 22 15:50:53 2014   pkcs11_id = '[UNDEF]'
Tue Jul 22 15:50:53 2014   pkcs11_id_management = DISABLED
Tue Jul 22 15:50:53 2014   server_network = 0.0.0.0
Tue Jul 22 15:50:53 2014   server_netmask = 0.0.0.0
Tue Jul 22 15:50:53 2014   server_network_ipv6 = ::
Tue Jul 22 15:50:53 2014   server_netbits_ipv6 = 0
Tue Jul 22 15:50:53 2014   server_bridge_ip = 0.0.0.0
Tue Jul 22 15:50:53 2014   server_bridge_netmask = 0.0.0.0
Tue Jul 22 15:50:53 2014   server_bridge_pool_start = 0.0.0.0
Tue Jul 22 15:50:53 2014   server_bridge_pool_end = 0.0.0.0
Tue Jul 22 15:50:53 2014   ifconfig_pool_defined = DISABLED
Tue Jul 22 15:50:53 2014   ifconfig_pool_start = 0.0.0.0
Tue Jul 22 15:50:53 2014   ifconfig_pool_end = 0.0.0.0
Tue Jul 22 15:50:53 2014   ifconfig_pool_netmask = 0.0.0.0
Tue Jul 22 15:50:53 2014   ifconfig_pool_persist_filename = '[UNDEF]'
Tue Jul 22 15:50:53 2014   ifconfig_pool_persist_refresh_freq = 600
Tue Jul 22 15:50:53 2014   ifconfig_ipv6_pool_defined = DISABLED
Tue Jul 22 15:50:53 2014   ifconfig_ipv6_pool_base = ::
Tue Jul 22 15:50:53 2014   ifconfig_ipv6_pool_netbits = 0
Tue Jul 22 15:50:53 2014   n_bcast_buf = 256
Tue Jul 22 15:50:53 2014   tcp_queue_limit = 64
Tue Jul 22 15:50:53 2014   real_hash_size = 256
Tue Jul 22 15:50:53 2014   virtual_hash_size = 256
Tue Jul 22 15:50:53 2014   client_connect_script = '[UNDEF]'
Tue Jul 22 15:50:53 2014   learn_address_script = '[UNDEF]'
Tue Jul 22 15:50:53 2014   client_disconnect_script = '[UNDEF]'
Tue Jul 22 15:50:53 2014   client_config_dir = '[UNDEF]'
Tue Jul 22 15:50:53 2014   ccd_exclusive = DISABLED
Tue Jul 22 15:50:53 2014   tmp_dir = 'C:\Users\me\AppData\Local\Temp\'
Tue Jul 22 15:50:53 2014   push_ifconfig_defined = DISABLED
Tue Jul 22 15:50:53 2014   push_ifconfig_local = 0.0.0.0
Tue Jul 22 15:50:53 2014   push_ifconfig_remote_netmask = 0.0.0.0
Tue Jul 22 15:50:53 2014   push_ifconfig_ipv6_defined = DISABLED
Tue Jul 22 15:50:53 2014   push_ifconfig_ipv6_local = ::/0
Tue Jul 22 15:50:53 2014   push_ifconfig_ipv6_remote = ::
Tue Jul 22 15:50:53 2014   enable_c2c = DISABLED
Tue Jul 22 15:50:53 2014   duplicate_cn = DISABLED
Tue Jul 22 15:50:53 2014   cf_max = 0
Tue Jul 22 15:50:53 2014   cf_per = 0
Tue Jul 22 15:50:53 2014   max_clients = 1024
Tue Jul 22 15:50:53 2014   max_routes_per_client = 256
Tue Jul 22 15:50:53 2014   auth_user_pass_verify_script = '[UNDEF]'
Tue Jul 22 15:50:53 2014   auth_user_pass_verify_script_via_file = DISABLED
Tue Jul 22 15:50:53 2014   client = ENABLED
Tue Jul 22 15:50:53 2014   pull = ENABLED
Tue Jul 22 15:50:53 2014   auth_user_pass_file = 'stdin'
Tue Jul 22 15:50:53 2014   show_net_up = DISABLED
Tue Jul 22 15:50:53 2014   route_method = 0
Tue Jul 22 15:50:53 2014   ip_win32_defined = DISABLED
Tue Jul 22 15:50:53 2014   ip_win32_type = 3
Tue Jul 22 15:50:53 2014   dhcp_masq_offset = 0
Tue Jul 22 15:50:53 2014   dhcp_lease_time = 31536000
Tue Jul 22 15:50:53 2014   tap_sleep = 0
Tue Jul 22 15:50:53 2014   dhcp_options = DISABLED
Tue Jul 22 15:50:53 2014   dhcp_renew = DISABLED
Tue Jul 22 15:50:53 2014   dhcp_pre_release = DISABLED
Tue Jul 22 15:50:53 2014   dhcp_release = DISABLED
Tue Jul 22 15:50:53 2014   domain = '[UNDEF]'
Tue Jul 22 15:50:53 2014   netbios_scope = '[UNDEF]'
Tue Jul 22 15:50:53 2014   netbios_node_type = 0
Tue Jul 22 15:50:53 2014   disable_nbt = DISABLED
Tue Jul 22 15:50:53 2014 OpenVPN 2.3.4 x86_64-w64-mingw32 [SSL (OpenSSL)] [LZO] [PKCS11] [IPv6] built on Jun  5 2014
Tue Jul 22 15:50:53 2014 library versions: OpenSSL 1.0.1h 5 Jun 2014, LZO 2.05
Tue Jul 22 15:50:53 2014 MANAGEMENT: TCP Socket listening on [AF_INET]127.0.0.1:25341
Tue Jul 22 15:50:53 2014 Need hold release from management interface, waiting...
Tue Jul 22 15:50:53 2014 MANAGEMENT: Client connected from [AF_INET]127.0.0.1:25341
Tue Jul 22 15:50:54 2014 MANAGEMENT: CMD 'state on'
Tue Jul 22 15:50:54 2014 MANAGEMENT: CMD 'log all on'
Tue Jul 22 15:50:54 2014 MANAGEMENT: CMD 'hold off'
Tue Jul 22 15:50:54 2014 MANAGEMENT: CMD 'hold release'
Tue Jul 22 15:51:02 2014 MANAGEMENT: CMD 'username "Auth" "devvpn"'
Tue Jul 22 15:51:02 2014 MANAGEMENT: CMD 'password [...]'
Tue Jul 22 15:51:02 2014 WARNING: No server certificate verification method has been enabled.  See http://openvpn.net/howto.html#mitm for more info.
Tue Jul 22 15:51:02 2014 LZO compression initialized
Tue Jul 22 15:51:02 2014 Control Channel MTU parms [ L:1574 D:138 EF:38 EB:0 ET:0 EL:0 ]
Tue Jul 22 15:51:02 2014 Socket Buffers: R=[65536->65536] S=[65536->65536]
Tue Jul 22 15:51:02 2014 Data Channel MTU parms [ L:1574 D:1450 EF:42 EB:135 ET:32 EL:0 AF:3/1 ]
Tue Jul 22 15:51:02 2014 Local Options String: 'V4,dev-type tun,link-mtu 1574,tun-mtu 1532,proto UDPv4,comp-lzo,cipher BF-CBC,auth SHA1,keysize 128,key-method 2,tls-client'
Tue Jul 22 15:51:02 2014 Expected Remote Options String: 'V4,dev-type tun,link-mtu 1574,tun-mtu 1532,proto UDPv4,comp-lzo,cipher BF-CBC,auth SHA1,keysize 128,key-method 2,tls-server'
Tue Jul 22 15:51:02 2014 Local Options hash (VER=V4): 'd3a7571a'
Tue Jul 22 15:51:02 2014 Expected Remote Options hash (VER=V4): '5b1533a2'
Tue Jul 22 15:51:02 2014 UDPv4 link local: [undef]
Tue Jul 22 15:51:02 2014 UDPv4 link remote: [AF_INET]184.108.40.206:1194
Tue Jul 22 15:51:02 2014 MANAGEMENT: >STATE:1406058662,WAIT,,,
Tue Jul 22 15:52:02 2014 TLS Error: TLS key negotiation failed to occur within 60 seconds (check your network connectivity)
Tue Jul 22 15:52:02 2014 TLS Error: TLS handshake failed
Tue Jul 22 15:52:02 2014 TCP/UDP: Closing socket
Tue Jul 22 15:52:02 2014 SIGUSR1[soft,tls-error] received, process restarting
Tue Jul 22 15:52:02 2014 MANAGEMENT: >STATE:1406058722,RECONNECTING,tls-error,,
Tue Jul 22 15:52:02 2014 Restart pause, 2 second(s)
Tue Jul 22 15:52:04 2014 WARNING: No server certificate verification method has been enabled.  See http://openvpn.net/howto.html#mitm for more info.
Tue Jul 22 15:52:04 2014 Re-using SSL/TLS context
Tue Jul 22 15:52:04 2014 LZO compression initialized
Tue Jul 22 15:52:04 2014 Control Channel MTU parms [ L:1574 D:138 EF:38 EB:0 ET:0 EL:0 ]
Tue Jul 22 15:52:04 2014 Socket Buffers: R=[65536->65536] S=[65536->65536]
Tue Jul 22 15:52:04 2014 Data Channel MTU parms [ L:1574 D:1450 EF:42 EB:135 ET:32 EL:0 AF:3/1 ]
Tue Jul 22 15:52:04 2014 Local Options String: 'V4,dev-type tun,link-mtu 1574,tun-mtu 1532,proto UDPv4,comp-lzo,cipher BF-CBC,auth SHA1,keysize 128,key-method 2,tls-client'
Tue Jul 22 15:52:04 2014 Expected Remote Options String: 'V4,dev-type tun,link-mtu 1574,tun-mtu 1532,proto UDPv4,comp-lzo,cipher BF-CBC,auth SHA1,keysize 128,key-method 2,tls-server'
Tue Jul 22 15:52:04 2014 Local Options hash (VER=V4): 'd3a7571a'
Tue Jul 22 15:52:04 2014 Expected Remote Options hash (VER=V4): '5b1533a2'
Tue Jul 22 15:52:04 2014 UDPv4 link local: [undef]
Tue Jul 22 15:52:04 2014 UDPv4 link remote: [AF_INET]126.96.36.199:1194
Tue Jul 22 15:52:04 2014 MANAGEMENT: >STATE:1406058724,WAIT,,,

server.conf
port 1194 #- port
proto udp #- protocol
dev tun
tun-mtu 1500
tun-mtu-extra 32
mssfix 1450
reneg-sec 0
ca /etc/openvpn/easy-rsa/2.0/keys/ca.crt
cert /etc/openvpn/easy-rsa/2.0/keys/server.crt
key /etc/openvpn/easy-rsa/2.0/keys/server.key
dh /etc/openvpn/easy-rsa/2.0/keys/dh1024.pem
plugin /usr/share/openvpn/plugin/lib/openvpn-auth-pam.so /etc/pam.d/login #- Comment this line if you are using FreeRADIUS
#plugin /etc/openvpn/radiusplugin.so /etc/openvpn/radiusplugin.cnf #- Uncomment this line if you are using FreeRADIUS
client-cert-not-required
username-as-common-name
server 10.8.0.0 255.255.255.0
push "redirect-gateway def1"
push "dhcp-option DNS 220.127.116.11"
push "dhcp-option DNS 126.96.36.199"
keepalive 5 30
comp-lzo
persist-key
persist-tun
status 1194.log
verb 4
log-append /var/log/openvpn.log

client:
client
dev tun
proto udp
remote SERVERIP 1194 # - Your server IP and OpenVPN Port
resolv-retry infinite
nobind
tun-mtu 1500
tun-mtu-extra 32
mssfix 1450
persist-key
persist-tun
ca ca.crt
auth-user-pass
comp-lzo
reneg-sec 0
verb 3

I have also done service iptables stop to ensure that nothing was blocking.
Ideas?
Comment: OpenVPN has a [page specifically for this error](http://openvpn.net/index.php/open-source/faq/79-client/253-tls-error-tls-key-negotiation-failed-to-occur-within-60-seconds-check-your-network-connectivity.html). Did you check there first?
Comment: Look a the logs on your client!  If you don't have any, then enable the logs on your client.  The client almost always has a useful message when the server has this log entry.
Comment: Yes, I did check that. I know it is not a firewall issue.
Answer: The issue was that you have to point to the server's main IP. I missed that. I thought I had the main IP in the client config file. After setting it to the main I was able to connect.

TLS Error on OpenVPN


Munin quota usage

Question: I'm trying to get Munin to report quota usage but it's not working. On top of quota_usage_ it says:
# Usage: place in /etc/munin/node.d/quota-usage_<dev> (or link it there using
# ln -s), for example quota-usage_hda3. Use underscores instead of slashes, for
# example to monitor /dev/mapper/vol-foo, name this quota-usage_mapper_vol-foo

So I did just that but it doesn't seem to work.
munin-node.log says:
2011/11/25-11:05:08 [23728] Error output from quota_usage_:
2011/11/25-11:05:08 [23728]     Can't exec "/etc/munin/plugins/quota_usage_": No such file or directory at /usr/share/perl5/Munin/Node/Service.pm line 215, <STDIN> line 87.
2011/11/25-11:05:08 [23728]     # ERROR: Failed to exec.
2011/11/25-11:05:08 [23728] Service 'quota_usage_' exited with status 42/0.

Any ideas what I'm doing wrong? I'm running Debian 6 in case it matters. I have it symlinked as quota-usage_xvda (it's running on a Xen VPS) and repquota /dev/xvda runs just fine.
Update - got it working by putting it into /etc/munin/plugins/ and setting it to run as root (as Dom suggested) but I now get this in munin-graph.log:
2011/11/25 18:15:10 [RRD ERROR] Unable to graph /var/cache/munin/www/xxx/xxx/quota_usage_xvda-week.png : opening '/var/lib/munin/--g.rrd': No such file or directory

After some research it looks like that's a bug:
http://munin-monitoring.org/ticket/794
Editing as the diff shows fixes it but I only get 2 users reported in the graphs now instead of the roughly dozen I have. Oh well...
Answer: Try to run quota-usage_xvda. If it works, you have to add the root user in your munin-node.conf for this plugin. You can then check by munin-run quota-usage_xvda.
Check if your repquota is in /usr/sbin/ directory (as it is hard coded in the plugin).
Are you sure that the link is good ? The quota_usage_ should be outside of /etc/munin/plugins dir
Comment: The instructions in the plugin say to place it into /etc/munin/node.d/ which is what I did but it did not run from there. I put it into /etc/munin/plugins/ (where I had it originally when I had that error) but it looks like when I tried it first I forgot to set it to run as root so it didn't work. Setting it to run as root and from inside /etc/munin/plugins/ works now but it errors out on graphs now... Any idea why that could be? I put the error in the original question.

Munin quota usage


UIPanGestureRecognizer not working on iOS 13.0

Question: I am setting UIPanGestureRecognizer on my view and my code working on iOS version before 13.0 but in 13.0 it is not working and also I debugged my code it is running all fine but it is not translating anything.
Following is the way of setting UIPanGestureRecognizer on my view namely viewContentBG
        let recognizer = UIPanGestureRecognizer(target: self, action: #selector(self.handlePan(recognizer:)))
        recognizer.delegate = self
        viewContentBG.isUserInteractionEnabled = true
        viewContentBG.addGestureRecognizer( recognizer)

Now after setting delegate i am getting my recogniser called. but following code is not working on iOS 13, however it is working fine on all versions before 13.0
if recognizer.state == .changed {

            let velocity = recognizer.velocity(in: self.viewContentBG)

            translation = recognizer.translation(in: self.viewContentBG)

                 if( (velocity.x > 0 && self.viewContentBG.frame.origin.x < self.viewContentBG.frame.size.width / 3.0)){

                     let movedPoint = CGPoint(x: originalCenter.x+translation.x, y: originalCenter.y)

                     self.viewContentBG.center = movedPoint

                     self.btnLeftAction1.frame.origin.x = 0

                     self.btnLeftAction1.frame.size.width = 0

                     self.btnLeftAction2.frame.origin.x = 0

                     self.btnLeftAction2.frame.size.width = self.viewContentBG.frame.origin.x

                 }

From above code following lines are most important but it is not working on 13.0 and higher versions. the view (viewContentBg) gets
move a little from wrong directions some times and gets back to its
original position and sometimes it really does not move a little.

let movedPoint = CGPoint(x: originalCenter.x+translation.x, y: originalCenter.y)

                     self.viewContentBG.center = movedPoint

I can suspect there is some sort of new restriction in 13.0 and higher
versions of iOS for using  UIPanGestureRecognizer, but I really do not
know what is the main reason which is causing it not working
correctly. Please help me I am stuck in it. and its kinda main feature
of my app. :(
Answer: Answering to my own question, may be it will be useful for someone.
With so many new changes in iOS13 the way of handling Auto-layout is also changed a little bit. So after some research and debugging I found out that gesture is working and gets detected by the view but the view was making wrong movements (not as per my code says)
the Main problem was that I have a view constrained with the outer view. and I was applying pangesture into inner view. The inner view was the one I wanted to translate with user gesture.
so i set one property to true on my inner view and all gets working as expected. following is the property that I set to true.....
myView.translatesAutoresizingMaskIntoConstraints = true

So in iOS13 the auto-layout constraints are more phenomena


How to mask characters such as password in Textbox in Windows Phone 7

Question: Please let me know how to mask characters such as password in Textbox in Window Phone 7.
Like this:
UserName : okame100
Password : **************
Answer: You need a PasswordBox control: http://www.bondigeek.com/blog/2010/03/29/windows-phone-7-dev-series-textbox-input-scope/


Show that $1/2 \cdot (1-2x)^3 \log (1-2x) - (1-x)^3 \log(1-x) + x^3 \log x$ is positive for $x \in (0, 1/2)$

Question: Define $f(x) = 1/2 \cdot (1-2x)^3 \log (1-2x) - (1-x)^3 \log(1-x) + x^3 \log x.$
I want to show $f(x) > 0$ for all $x \in (0, 1/2)$, which I believe is true from plotting, but I'm not sure how to prove it analytically.
One simplifying attempt I've made is using the bounds $1-1/x \le \log(x) \le x - 1$, but unfortunately this yields a lower bound that is negative near $1/2$. Any ideas for proving this function is positive over $(0, 1/2)$?
Answer: Proof.
Using the identity for $u > 0$ (easy to prove)
$$\ln u = \int_0^1 \frac{u - 1}{1+(u-1)t}\,\mathrm{d} t,$$
we have
\begin{align*}
 \ln(1 - 2x) &= \int_0^1 \frac{-2x }{1 - 2xt}\,\mathrm{d} t, \\
 \ln(1 - x) &= \int_0^1 \frac{-x}{1 - xt}\,\mathrm{d} t, \\
 \ln x &= \int_0^1 \frac{x - 1}{1+(x-1)t}\,\mathrm{d} t.
\end{align*}
The desired inequality is written as
$$\int_0^1 \left(\frac12 (1 - 2x)^3\cdot \frac{-2x }{1 - 2xt} - (1 - x)^3\cdot \frac{-x}{1 - xt}
+ x^3\cdot \frac{x - 1}{1+(x-1)t}
 \right)\,\mathrm{d}t > 0.$$
It suffices to prove that, for all $t \in [0, 1]$,
$$\frac12 (1 - 2x)^3\cdot \frac{-2x }{1 - 2xt} - (1 - x)^3\cdot \frac{-x}{1 - xt}
+ x^3\cdot \frac{x - 1}{1+(x-1)t} > 0$$
or
$$\frac{x^2(1 - 2x)}{(1 - tx)(1 - 2tx)(tx - t + 1)}[(2x^3 - 4x^2 + x + 1)t^2 - (4 - 4x - x^2)t + 3 - 4x] > 0. $$
It suffices to prove that, for all $t \in [0, 1]$,
$$(2x^3 - 4x^2 + x + 1)t^2 - (4 - 4x - x^2)t + 3 - 4x > 0.$$
Since $4 - 4x - x^2 > 0$, using $t \le \frac{t^2 + 1}{2}$, it suffices to prove that, for all $t \in [0, 1]$,
$$(2x^3 - 4x^2 + x + 1)t^2 - (4 - 4x - x^2)\cdot \frac{t^2 + 1}{2} + 3 - 4x > 0$$
or
$$\frac12 x^2 - 2x + 1 - \left(-2x^3 + \frac72 x^2 - 3x + 1\right)t^2 > 0.$$
Since $-2x^3 + \frac72 x^2 - 3x + 1 > 0$, it suffices to prove that
$$\frac12 x^2 - 2x + 1 - \left(-2x^3 + \frac72 x^2 - 3x + 1\right) > 0$$
or
$$x(1 - x)(1 - 2x) > 0$$
which is true.
We are done.
Comment: for $x\in[0.2,0.5]$ we have : $$h\left(x\right)=\frac{\left(-(1-x)^{3}\log(1-x)\right)}{x^{3}}\leq \frac{f\left(x\right)}{f\left(\frac{1}{2}\right)}h\left(\frac{1}{2}\right)\leq g\left(x\right)=\frac{-\left(1/2\cdot(1-2x)^{3}\log(1-2x)+x^{3}\log x\right)}{x^{3}},f\left(x\right)=\left(\frac{1}{x}-1\right)^{2}$$ can we invoke symetry ?
Comment: Fantastic, thank you!
Comment: @KiranTomlinson You are welcome.
Comment: @ErikSatie Do you have a complete proof?
Comment: @RiverLi It goes as follow use VasileCirtoaje left/right convex theorem to show : $$(1-2x)^{3}\log(1-2x)+2x^{3}\log x\ge g\left(\frac{\left(1+2x-2x\right)}{\frac{1}{2}+1+\frac{1}{2}}\right) \ge g\left(x\right)=2(1-x)^{3}\log(1-x),x\in[0.2,0.5]$$ then use the classical bound for log for the remainder interval .Is it right ?
Comment: @ErikSatie I am not following. You should write detailed and complete proof.
Answer: Hint using this LCF theorem we have $x\in(0,1)$:
$$j\left(x\right)+j\left(1-x\right)\geq r\left(x\right)+r\left(1-x\right)\geq 2j\left(\frac{1}{2}\right)$$
Where :
$$j\left(x\right)=(1-x)^{3}\ln\left(1-x\right),r\left(x\right)=-(1-x)^{3}x\cdot2\ln\left(2\right)$$
Remains to show :
$$(1-x)^{3}\ln\left(1-x\right)\leq j\left(\frac{1}{2}\right)$$
Which is true for $x\in[1/8,1/2]$
Then you can use @ Kiran Tomlinson your own attempt .


Table: each cell links to url containing column and row data

Question: I want each cell in my table (excluding headers and has to be a number) to link to a URL which is formed using the position of the cell, i.e. the cell number and column number of it.
E.g. a cell will link to example.com/hello.html?column=1&row=3
Ideally this would be done with jQuery...unless there is a better way? I can't easily alter the PHP code that is generating the table, so I think it will have to be browser-side.
I've had a look at datatables and its api call fnGetPosition but am unsure how to convert this into a link which operates on every numerical cell that isn't the first row or column.
Answer: The answer, as far as jQuery is concerned, lies within .index()
Given the following html:

        Test
        Test
        Test
        Test

        Test
        Test
        Test
        Test

        Test
        Test
        Test
        Test

The jQuery would look like this:
$('tr td').each( function() {
    var colNum = $(this).index();
    var rowNum = $(this).parent().index();
    $(this).wrap('');
})

A working example here - http://jsfiddle.net/NDpCa/3/
Comment: That's great - thanks. Any way to only get the link showing on cells with a number on?


can anyone help me to understand this c++ code?

Question: I explain you the working of this program.
step 1: enter the no. of time you want to run the loop.
step 2: enter two strings s1 and s2.
output : it will give you a string s3 that does not contain any character from string s2.
problem: I am unable to understand the working of for loop, and why the value of hash is 257, and how is loops working.
The code is given below.
#include <iostream>
using namespace std;
#include<string.h>
int main()
{
    int t;
    cout<<"enter any no. to run the loop"<<endl;
    cin>>t;
    while(t--)
    {
        string s1,s2,s3;
        int i,j,l1,l2;
    cout<<"enter two strings s1 and s2"<<endl;
        cin>>s1>>s2;
        l1=s1.length( );
         l2=s2.length( );
         int hash[257];
         for(i=0;i<257;i++)
         {
             hash[i]=0;
         }
          for(i=0;i<l2;i++)
         {
             hash[s2[i]]++;
         }

          for(i=0;i<l1;i++)
         {
             if(hash[s1[i]]==0)
             s3=s3+s1[i];
         }
         cout<<s3<<endl;

    }
    return 0;
}

Comment: There are three `for` loops in your code, which one do you have trouble understanding?
Comment: As for the value `257`, it seems that the code assumes that `char` is `unsigned` (it's really implementation defined) and that the systems standard alphabet have 256 letters (which makes the choice of `257` a little odd since the characters will be numbered `0` to `255`).
Comment: And where did you get this code from? Didn't the origin contain any explanation about the code? And take this as a lesson to *always* document your code, and add comments about what it does and why it does what it does, what algorithms are used, etc.
Comment: sir i want to understand all three loops.
Answer: This program figures out which characters in the first string are not contained in the second string.
Example input for the program:
1
abcdefghijklmnopqrstuvwxyz
helloworld

Example output (thanks to @mch for correction)
abcfgijkmnpqstuvxyz

Edit: Note that this is of course case sensitive as characters a and A produce different integer values.
Here is some commentary on the program:
#include <iostream>
using namespace std;
#include <string.h>
int main() {
    // Do the whole program as many times as the user says
    int t;
    cout << "enter any no. to run the loop" << endl;
    cin >> t;
    while (t--) {
        string s1, s2, s3;
        int i, j, l1, l2;
        // read strings and get their respective lengths
        cout << "enter two strings s1 and s2" << endl;
        cin >> s1 >> s2;
        l1 = s1.length();
        l2 = s2.length();

        // Array with 257 elements
        int hash[257];
        // Initialize all elements of array with 0
        for (i = 0; i < 257; i++) {
            hash[i] = 0;
        }

        // Count occurrences of characters in second string
        // s2[i] is the character at position i in s2
        // Increase the value of hash for this character by 1
        for (i = 0; i < l2; i++) {
            hash[s2[i]]++;
        }

        // Iterate over s1 characters
        // If hash[i] == 0: character i is not contained in s2
        // s3 => string of letters in s1 that are not contained in s2
        for (i = 0; i < l1; i++) {
            if (hash[s1[i]] == 0)
                s3 = s3 + s1[i];
        }

        // output s3
        cout << s3 << endl;
    }
    return 0;
}

Comment: A side note: `cin>>s2` reads a word, not a line, so `s2` is `hello`, not `hello World`. This can be confirmed by looking at the output, it has `r` and `d` in it.
Comment: @mch, thanks for the hint, i didn't double check my output.
Answer: The code computes an histogram of occurrences of the letters in s1 and copies the letters of s2 that have zero occurrence.
It can crash for any char type not restricted to the range [0,256] (!)
Answer: There's a comment above explaining the for-loops.
int hash[257] could actually be int hash[256] . There are 256 different values that can fit in a char (8 bits).


Link from Wall to Application Tab that do not open a new window

Question: I know this is meant for programming questions, but I just can't seem to find any information on this anywhere, so here goes nothing:
I have a Facebook page to which I added a custom Application tab. Now I'd like to be able to post a link to that Application tab that doesn't open in a new window/browser tab.
Using an url shortener I was able to post the link, but when clicking the link the url is opened in a new window, which in my opinion is not necessary. I'd like to know if there is a way to not open a new window.
Thanks a lot in advance!
Answer: You cannot change the default behavior of the facebook wall. If is there where you want to post the link, you have nohing to do with it. Sorry.


An example of a power series that has a radius of convergence of 3

Question: The problem states "Give an example of a power series $\sum^{\infty}_{n=0}$a$_{n}$z$^{n}$ that has a radius of convergence of 3 and that represents an analytic function having no zeroes. I'm sorry if this is a little simplistic but I really can't think of anything and am having a hard time with this.
Comment: Take your favorite power series with radius of convergence 1 that represents an analytic function with no zeroes, and then replace $x$ with $\frac{x}{3}$.
Comment: @QTHalfTau that's what I was thinking which in the end yields R= 1/L
Comment: @QTHalfTau that simple huh? Thanks!
Comment: Yep! It's not too hard to show that this always works using the ratio test.
Answer: Take any series you are familiar with and has a finite radius of convergence $r$. Then rescale the argument to be $\dfrac{3z}r$. This multiplies all terms by $\dfrac{3^n}{r^3}$ and yields the desired radius.
Answer: Taking the center of the desired power series at origin, the domain of convergence must be $|z|<3$. Indeed, you need a power series of the form $f(z)=\sum_{n=0}^{\infty}$$a_n.z^n$ which converges uniformly if $|z/3|<1$. One such choice is $f(z)=\frac{1}{3-z}=\sum_{n=0}^{\infty}$$\frac{1}{3^{n+1}}.z^n$.


Did some ice-hockey players change their position during their career?

Question: Does it happen often that an ice-hockey player changes during their career the position? For example, somebody who plays for some years as a left or right wing then becomes a centre. Or that somebody starts playing as defenceman and then becomes forward. (It is very hard to imagine that some goaltender became a skater or vice-versa, so the above examples are more likely.)
Are there some famous player who has such change in their career? Did it happen at least for some players at NHL level (either during their NHL career or in their transition from junior/minor leagues to NHL)?
Answer: Sure, this happens from time to time.
The most recent case I know of is Dustin Byfuglien, who has switched back and forth between Defenseman and Forward during his career (sometimes within one season).  He began as a Defenseman, switched to Forward in 2008, won a cup with Chicago on offense; then was traded to Atlanta, went back to defenseman.  He then went back to Forward in 2014, and then in Dec. 2014 swapped back to Defenseman.
Additionally, many players switch in high school or college, particularly as they learn they are more suited to Defenseman.  When skating on teams where they are far and away the best skater, they're more likely to play a forward position (where they will presumably have more opportunities to score), but once in a position where they are playing other equivalently skilled players they may learn their body and game is actually suited to defense.  Phil Housley is a great example of this.
Finally, there have been a few great players who occasionally played defense due to team needs (for example, if several defenders were injured).  Sergei Federov is an example of this; while he played Center throughout his career, he occasionally was used on defense, both during the prime of his career and as he got older.
Answer: I live in Czech Republic. In our fourth league we had a striker who became a defender. I know that Frederik Andersen when he was 10, he was the centre forward.


Git/GitHub Total Number Of Lines Contributed For An Account

Question: I want to get the total number of lines of code that an account on GitHub has done. This is not for judging productivity or whatever (LOC is a poor choice for that), it's really just for our amusement.
Is it possible to get the total number of lines of code that an Account on GitHub (by email address or handle) has done?
Comment: The most direct solution would be to write a script that uses the GitHub API to locally clone all your repos and run [cloc](http://cloc.sourceforge.net/) on them.
Answer: You can use the GitHub API for that:

Use /user/:user/repos to get all repositories
Then use /repos/:owner/:repo/stats/contributors to get the contributors (and their additions / deletions) on those repositories
Comment: `/user/:user/repos` does not list repositories to which user has contributed but is not an owner or member of (but has made pull requests).


Finding all invertible matrices $A$ where $A = A^{-1}$ and $A^{-1} = A^T$

Question: Finding all invertible $A$, a $2\times 2$ matrix that satisfies $A = A^{-1}$ and $A^{-1} = A^T$. Hint: The identity $\cos^2t + \sin^2t = 1$ may be useful.
I have no idea how to start this. Any help would be much appreciated.
Comment: What does $A^{-1}1$ mean? Is it simply $A^{-1}$?
Comment: @julien Yes, it's A to the power of -1 (i.e. the inverse of A) but I didn't know how to type it properly.
Comment: Edited, you simply needed $\{$ and $\}$ around the $-1$.
Comment: Have you checked [Orthogonal Matrix](http://en.wikipedia.org/wiki/Orthogonal_matrix) ? and [Elementary Construction of Them](http://en.wikipedia.org/wiki/Orthogonal_matrix#Elementary_constructions) ?
Comment: See here this may be useful [link][1]

[1]:http://math.stackexchange.com/questions/300067/about-finding-2x2-matrices-that-are-their-own-inverses/300070#300070.
Answer: Hint:  We have:

$A^T=A$ so the matrix is symmetric. So if $A_{2\times 2}=\left( \begin{array}{ccc}
a & b  \\
c & d  \\
 \end{array} \right)$ then $c=b$
$A^{-1}=A,~~~ A_{2\times 2}$ and if $|A|=ad-bc\neq 0$  so one possibility is $c=0$.
If $c\neq 0$ , then $b\neq  0$ and we could have $ad-bc=ad-c^2=-1$ and ...


How to filter a node view on a paragraph field

Question: I have a content type "Lunch" containing a paragraph type field named "Ingredients". This is a multiple values field which store a prapgraph type named "Ingedients" => Taxonomy term + Quantity
LUNCH
|- Ingredient1 (Term1 reference + quantity1)
|- Ingredient2 (Term2 reference + quantity2)
I have created a view displaying the tiles of my 3 encoded lunches. Until here, everything is fine.
Now, I would like to add an exposed filter to get all lunches congtaining a specific ingredient. For this I have added a relationship on the ingredient field:
Paragraph referenced from field_ingredients

Doing this is fine, because now, I can add an exposed filter using this relationship
AND
Doing this is bad, because as soon as I have added this relationship the number of rows in my view has been multiplcated by the number of ingredients... even if I check distinct in the SQL parameters
Any hint to solve this issue?
EDIT TO ADD: I could solve this by removing the duplicates in hook_views_pre_render but is it really the best thing to do?
REAL SOLUTION BASED ON prkos ANSWER:
1-In the advance>Other section I have enabled the aggregation
2-I have added my Ingredient field in the field section (exclude from display)
=>This is the taxonomy reference field of my Paragraphs field named "Ingedients". In other words, I have a paragraph type with 2 fields  (Ingredient and quantity) and I selected "Ingredient". Do not select the paragraph itself.
3-In the aggregation parameter of this added field, I selected  ID of the entity
Comment: well you can remove them with "hook_views_pre_render" . but you are right thats not that great, have you "required" this relationship ?  can you go to "admin/structure/views/settings" and tick "Show SQL query" and "Show other queries run during render during live preview", then update the question with output thanks
Answer: Adding Relationships often causes duplicate rows in the results.
You can "remove" the duplicates using the Aggregation in Views (enable it under Advanced).
Then adjust the Aggregation settings for some Fields, specifically the Group column option. You may need to change it from Value to Entity ID or vice versa. The exact combination of settings depends on your particular case, I haven't tried it with Paragraphs.
When duplicates are introduced through Taxonomy reference field that is using a Relationship then all those Taxonomy fields need to have the Entity ID and not the Value.
If the field is a direct Entity Reference field and isn't using a Relatinship then again it needs to be Entity ID instead of, in this case, target_id.
Be careful with Sort criteria when using Aggregation, some of them can mess up the Aggregation. It's best to remove all Sort criteria while adjusting the Aggreation, then when you have it working add them and test that everything is still working as expected.
Some modules offer more advanced Aggregation settings, try looking into that if you need to, for example: Views Aggregator Plus,
Comment: This is exactly what I was looking for. I will add a small description on how I could achieve this with nyour help.


How to design database tables (or hibernate entities)

Question: How should i design my tables in following scenario?
I have a Parent entity which can have multiple child entities, this is straightforward. Now i have another entity external references which is related to both that means a parent can have multiple external references and children can also have their own multiple external references. How should i design the table for external references, shall i keep all in one table or create two separate tables one for parent level references and another for children level references.
First approach by keeping all references in same table:
Parent - Parent_Id, other fields...
Child - Child_Id, Parent_Id (Foreign key to parent), other fields...
External Reference - Ref_Id, Parent_Id, Child_Id, other fields

But child_id can be null for parent level external reference therefore cannot make it foreign key. I have to maintain that foreign key in my code instead of DB constraint.
Second approach by keeping references in separate table:
Parent - Parent_Id, other fields...
Child - Child_Id, Parent_Id (Foreign key to parent), other fields...
Parent External Reference - Ref_Id, Parent_Id, other fields
Child External Reference - Ref_Id, Child_Id, other fields

If a user needs both level of references then has to look into two tables.
what is the best way to achieve this so i can keep all references in one place and also build FK relationships between them.
Comment: Generally, there are enough differences in a parent external reference and a child external reference that they should be two separate tables.  However, your specific needs might be different.
Answer: Your dilemma is a textbook example of when you should use an association with a join table (we can call it a third approach :), but it should be the first really ).
That way you will not have the two tables for the one entity nor will you have the foreign key issue you've mentioned. Consider your two approaches in a case where more entities would be associated with the ExternalReference. Join table is the most future proof, and scalable approach in your situation


Integrating $\int\frac{\sqrt{\cos 2x}}{\sin x}\,\text{d}x$

Question: The integral is $$\int\frac{\sqrt{\cos 2x}}{\sin x}\,\text{d}x$$ I have tried solving this by taking the sine inside the radical as follows: $$\int\sqrt\frac{\cos 2x}{\sin^2 x}\,\text{d}x$$$$\int\sqrt\frac{\cos^2x-\sin^2x}{\sin^2 x}\,\text{d}x$$$$\int\sqrt{\cot^2x-1}\,\text{d}x$$ I don't know how to proceed from here, or whether this is even right.
Any suggestions?
Comment: Have you tried the [Weierstrass substitution](http://en.wikipedia.org/wiki/Tangent_half-angle_substitution) ?
Comment: This leads to the same answer as that by substituting $\cos x = t$, right? Or that's what I got.
Comment: See also: [Evaluation of $\int\frac{\sqrt{\cos 2x}}{\sin x}\,dx$](https://math.stackexchange.com/q/876175)
Answer: You can continue like this:
\begin{align*}
\int\sqrt{\cot^2(x)-1}\,dx&=\int\frac{\cot^2(x)-1}{\sqrt{\cot^2(x)-1}}\,dx\\
&=\int\frac{\csc^2(x)-2}{\sqrt{\cot^2(x)-1}}\,dx\\
&=\int\frac{\csc^2(x)}{\sqrt{\cot^2(x)-1}}\,dx-2\int\frac{1}{\sqrt{\cot^2(x)-1}}\,dx\\
\end{align*}
The first integral can be solved with substitution $u=\cot(x)$ and the second one with substitution $\cot(x)=\cosh(t)$ will be converted to the following one:
\begin{align*}
\int\frac{1}{\sqrt{\cot^2(x)-1}}\,dx&=-\int\frac{dt}{1+\cosh^2(t)}\\
&=-\int\frac{2}{2+e^t+e^{-t}}\,dt\\
&=-\int\frac{2e^t}{e^{2t}+2e^t+1}\,dt\\
&=-\int\frac{2e^t}{(e^t+1)^2}\,dt\\
&=\frac{2}{e^t+1}
\end{align*}
Can you continue?( I hope you can)
Comment: Perhaps you might want to tackle [this](http://math.stackexchange.com/questions/464769/how-to-prove-int-01-tan-1-left-frac-tanh-1x-tan-1x-pi-tanh-1) integral as well ?
Comment: Yes I can :) Thank you :)
Comment: Nice Solution Farshad Nahangi....
Answer: Suppose you express everything in terms of $\cos(x)$ and later make a change of variables such that $y = \cos(x)$. Remember that $\frac{dx}{\sin(x)}$ is also $\frac{-d(\cos(x)) }{1-\cos^2(x)}$. Does this help and can you continue from here ?
Comment: @freak_warrior. Thanks for editing. I am almost blind and, beside plain ASCII, everything is difficult to me. Cheers.
Comment: haha no problem
Comment: @ClaudeLeibovici : Your answer is right as well :) I just can accept only one answer. But I like your method :) Thank you
Answer: Substitute $t= \frac{\cos x}{\sqrt{\cos 2x}}$ to have $$dt= \frac{\sin x}{ {\cos^{3/2}2x}}dx,\>\>\>\>\>
(t^2-1)(2t^2-1)=\frac{\sin^2t}{\cos^2 2x}$$
and
\begin{align}
&\int\frac{\sqrt{\cos 2x}}{\sin x}\ dx\\
=&\int \frac{\cos^2 2x}{\sin^2x }\cdot\frac{\sin x}{{\cos^{3/2}2x}} dx
= \int\frac1{(t^2-1)(2t^2-1)}dt\\
=&\int \left(\frac1{t^2-1}-\frac{2}{2t^2-1} \right) dt
=-\coth^{-1}t+\sqrt2 \coth^{-1}\sqrt2t\\
=& - \coth^{-1} \frac{\cos x}{\sqrt{\cos 2x}} +\sqrt2 \coth^{-1}\frac{\sqrt2 \cos x}{\sqrt{\cos 2x}}
\end{align}
Similarly
\begin{align}
&\int\frac{\sqrt{\cos 2x}}{\cos x}\ dx
=\cot^{-1} \frac{\sin x}{\sqrt{\cos 2x}} -\sqrt2 \cot^{-1}\frac{\sqrt2 \sin x}{\sqrt{\cos 2x}}
\end{align}


Exchanging Order of Integration - Expected Value

Question: Suppose that Y is a continue random variable with density f(y) that is positive only if y$\ge$0. If F(Y) is the distribution function, show that $E(Y) = \int_0^\infty yf(y) dy = \int_0^\infty 1-F(y) dy$.
Hint: If y > 0, y = $\int_0^y dt, $ and $E(Y) = \int_0^\infty yf(y) dy = \int_0^\infty [\int_0^y dt]f(y) dy$. Exchange the order of integration to obtain the desired result.
My approach: So following the hint, I have the following:
$E(Y) = \int_0^\infty yf(y) dy = \int_0^\infty [\int_0^y dt]f(y) dy = \int_0^\infty \int_0^y f(y)dt dy$. How exactly do I exchange the order of integration here?
Comment: *Draw* the domain corresponding to the integration limits.
Answer: Integration by part gives
$\int_0^\infty (1-F(y))dy = \left.(1-F(y))y\right|_0^\infty-\int_0^\infty y d(1-F(y))=0-0+\int_0^\infty y F'(y)dy$
If the expectation exists then $(1-F(y))y \to 0$ as $y\to \infty$
Answer: Write it as $$\int_{0}^{\infty}\int_{0}^{\infty}\left[t\leq y\right]f\left(y\right)dtdy$$
where $\left[t\leq y\right]$ denotes the characteristic function
of set $\left[0,y\right]$ with argument $t$.
Then:
$$\int_{0}^{\infty}\int_{0}^{\infty}\left[t\leq y\right]f\left(y\right)dtdy=\int_{0}^{\infty}\int_{0}^{\infty}\left[t\leq y\right]f\left(y\right)dydt=\int_{0}^{\infty}\left(1-F\left(t\right)\right)dt$$
since $$\int_{0}^{\infty}\left[t\leq y\right]f\left(y\right)dy=\int_{t}^{\infty}f\left(y\right)dy=1-F\left(t\right)$$


Need help trying to diagnose Symmetrix SAN performance issues

Question: I am helping to benchmark hardware for a new SQL Server instance, and the volume presented to the OS for the data files is carved from a set of spindles on a Symmetrix SAN. The server has yet to have SQL Server installed, so the only activity on the box is our benchmarking.
Now, our storage engineers say that this volume and it's resources are dedicated to our new server (I don't have access to see the actual SAN config) however the performance benchmarks are troubling. For example, the numbers look good until suddenly, and randomly, we see in our IO benchmarking tool wait times of 100 seconds, and disk queue lengths of 255 in perfmon.
This SAN has an 8 GB cache, plus there are other applications besides ours that use the SAN.  I'm wondering if (even though the spindles for our volumes should be dedicated to us) the cache may be getting hammered during the performance testing, or perhaps the spindles our volumes are on aren't really dedicated to us.
We're not getting much traction from our storage engineers in helping us track down the problem, so if anybody has experience with diagnosing a problem like this and would like to share insights and troubleshooting methodologies, I'd appreciate it.
Comment: It being a Holiday weekend, answers are going to be slow. Also, we don't have much EMC depth.
Comment: @sysadmin1138 Not a problem.  I'm definitely not working the weekend on this issue :)  Thanks.
Answer: @arcain
What benchmark tools are you using?
A number of tools out there such as SQLIOSim and SQLIO, depending on how they are configured, can cause you're disk queue length to reach high levels, but that's ok since it's part of the test. The problem is the wait times you mentioned, to me, that's a dead give away of disk contention. With the exception of SAN fabric saturation cause by far too many VM's, my experience is that the disks (when not SSD's) are always the biggest bottle neck. That having been said, they should not typically result in wait states unless they are shared with another host that is actively utilizing them.
In these situations I suggest using SQLIO from MS (that is if this isn't what you're already using). Being that your Symmetrix has an 8GB cache, I would test with a 16GB or larger test file to push through the cache to ensure the variation isn't so much the cache but rather what the underlying disks are actually putting out.
You can use SQLIO to create the file for a battery of testing and then execute the following against it:
sqlio -kW -t2 -s120 -dE -o4 -fsequential -b64 -BH -LS Testfile.dat
The -d parameter refer's the the drive letter, in this case E:
This test performs a set of sequential writes over a 2 minute (-s120) period and you could wrap in up in a simple batch file with timestamps to help you track the time of day and pipe the results to a log file for review. Write the batch to execute the above or something similar repeatedly for a period of time and review the results. The larger the sample the better.
If the disks are actually dedicated, and since you're pushing through your cache, the resulting IO's, MB's and latency should be pretty close (1-5% variation). If it goes beyond that to more like 15% or higher then you probably have disk contention.
Another thing, be sure to note the date and times of your testing and against which drives you tested against. All SAN's have some sort of logging for profiling the following:

Fast writes - writes cached and then later flushed to disk
Delayed Fast Writes - a situation where your global cache for writes is
saturated and needs to flush some
prior writes to disk to make room for
the new incoming write requests
Read Hits - reads that were satisfied
by the global cache
Read Misses (Long and Short) - the
read was either partially satisfied
with the global cache (short) or not
at all and it had to pull everything
from disk (long)

You should be able to request this information to help gauge your Symmterix's performance since this is a SAN shared with other hosts.
Post back with some results if you can I will be more then happy to review them.
Comment: I'm using SQLIO 1.5.SG, but not those exact options. I changed them to what you recommended, and I'm seeing variance in runs between 20% and 40%. For example, here's are the cumulative data of two typical runs:
**RUN 1**
IOs/sec:   681.43,
MBs/sec:    42.58,
Min_Latency(ms): 1,
Avg_Latency(ms): 11,
Max_Latency(ms): 2977

**RUN 2**
IOs/sec:  1018.44,
MBs/sec:    63.65,
Min_Latency(ms): 1,
Avg_Latency(ms): 7,
Max_Latency(ms): 1795.

Thanks for the info; this gives me some good ammo to take to the storage admins.  I'll be sure to ask for the stats.
Comment: Just curious, but where did the "15% or higher [variance probably means] disk contention" metric come from? I mean, that makes total sense to me, but I've never seen it quantified. Is it just that the base performance should simply be much better than what I'm seeing?
Comment: When compared to each other, those results definitely show contention. Something else is hitting those drives resulting in the lower IO's per sec and an increase in latency. It's been my experience having worked on IBM and EMC Clarion SAN's that the disk are never limited by the fabric between the host and the disks but rather the bottleneck is always the disks, meaning that the other hardware involved usually doesn't impede the disk performance. When everything is setup correctly dedicated disk perform very consistently. The 15% isn't a hard rule but it comes from years of past experience.
Answer: The cache will be shared between you and the other servers which are on the array.  It is possible that the spindles are shared with something else.  Only your storage admin would know for sure.
It could also be that the shelf or the back end loop is at capacity (not likely, but possible).
If everything is cranking along, then things go to crap for a little bit, then go back to normal, it sounds like you a filling the cache on the array and you are starting to write directly to disk which is a problem since the disks are already running at 100%.  How many spindles are behind the LUN?  What sort of performance are you seeing when things are working correctly?
Comment: I'm not sure how many spindles are in the LUN since our SAN guys typically allocate 9 GB hypervolumes and then string those together into (if I remember correctly) 147 GB metavolumes, and then they chain those to make the LUN. If I could see the actual SAN config, I could tell you. Best case, they formed all the metas from hypers in a sane fashion. Worst case, the hypers are scattered from hell to breakfast. As for performance when things are working correctly, I can't say any of the storage I've used performs optimally. Trying to build a case to prove that things have to change.
Comment: If they are allocating the hypervolumes then stringing all those together you are probably sharing disks.  If not, there isn't really any reason I can think of to create the LUN in this way, other than the "we've always done it this way" reason.
Comment: I'm with you; it doesn't make any sense to me either, plus my group's getting "this is how we do it here, I don't see a problem" quite often. I mean, really? No issues at all? C'mon.
Comment: Without your storage team being willing to help out with the performance troubleshooting there isn't going to be much that you can do to resolve this.  I know this isn't the best news, but when teams don't play nice nothing gets done.


Apparent inconsistency arising from showing that $x_{(n)}$ is sufficient for $\theta$ where $X \sim \frac{1}{\theta}\mathbb{I}_{(0, \theta)}$

Question: The problem is to show that the largest order statistic $x_{(n)}$ is sufficient for $\theta$ where $X \sim \frac{1}{\theta}\mathbb{I}_{x \in (0, \theta)}$ is a uniform distribution.
I believe I have proved the result, but my argument cannot make sense, due to the consequences.  Here's my argument:

The likelihood of a random sample of size $n$ is, for $\theta >0$, $$L(\theta) = \bigg(\frac{1}{\theta} \bigg)\bigg(\frac{1}{\theta} \bigg) \cdots \bigg(\frac{1}{\theta} \bigg) = \frac{1}{\theta^n},$$ which factors into a product of a function of $\theta$ and $\hat\theta$, and a function of the sample $x_i$ for any statistic $\hat\theta$.  Therefore, by the Fisher-Neyman Factorization Theorem, any statistic is sufficient for $\theta$.  In particular, the largest order statistic $x_{(n)}$ is sufficient for $\theta$.

It seems to me like any statistic should be sufficient for $\theta$.  Of course, "any" statistic includes a constant, so my argument must be wrong.  I'm not sure why, though.  Can anyone enlighten me?
Thanks
Comment: The likelihood, when applied to the parameter $\theta$, is supposed to be a *number,* but on the right hand side of your equation you have written a *function* (namely, a multiple of $\mathbb{I}_{(0,\theta)}$). That can't possibly be correct, can it? Has there perhaps been a typographical omission?
Comment: OK, but why aren't you evaluating $\mathbb{I}_{(0,\theta)}(x_i)$ for each observation $x_i$? Why do the $x_i$ simply disappear?  I believe this is where your respondent Julius has been trying to direct your attention.
Comment: Hey, I'm a big fan of some of your posts!  Of course, you're right.  I edited $\mathbb{I}_{(0, \theta)}$ into the post after I posted it, thinking I needed some condition on $\theta$.  I should just write that $\theta > 0$.  Thanks!
Comment: Juluis' recent edit and your post has made the problem clear.  I was ignoring the domain of the pdf of the uniform distribution $X$!  Thank you for the help.
Answer: The problem is in the way you wrote the likelihood function. Suppose that we observe $x_{(n)}=2$, where $x_{(n)}$ is the $n$th ordered value of the sample $x_1,\dots,x_n$. Then what is $L(1)$? According to your formula it would be 1, but $\theta$ being 1 is not likely at all since we observe a draw from $U(0,\theta)$ that is higher than 1. Therefore, $L(1)=0$.
That is, for $\theta$ to be feasible, i.e. to have a positive likelihood, we cannot observe $x_{(n)}>\theta$ drawn from $U(0,\theta)$. In other words, by recalling that the density function of $U(0,\theta)$ actually is $f(x)=\frac1\theta 1_{(0,\theta)}(x)$, we get
$$L(\theta)=\frac1\theta1_{(0,\theta)}(x_1)\dots \frac1\theta1_{(0,\theta)}(x_n)=\frac{1}{\theta^n}1_{(0,\theta)}(\max\{x_1,\dots,x_2\})=\frac{1}{\theta^n}1_{(0,\theta)}(x_{(n)}),$$
in which case not any statistic is sufficient.
Comment: Ah, it seems like my likelihood definitely is wrong.  I don't see why yours is right, though.  Where does the $x_{(n)}$ term come from?
Comment: Let me update the answer.


Changing the timezone strings of date_lang.php

Question: CodeIgniter stores timezones for its date class in
system/language/english/date_lang.php
I would like to change the strings in this file so that
$lang['UM12']   = '(UTC -12:00) Baker/Howland Island';
$lang['UM11']   = '(UTC -11:00) Samoa Time Zone, Niue';

would instead be
$lang['-12:00'] = '(UTC -12:00) Baker/Howland Island';
$lang['-11:00'] = '(UTC -11:00) Samoa Time Zone, Niue';

Is this possible at all?
Any change I make to the UM__ portion of one line makes it show as a blank on the dropdown. The remaining (unchanged) lines appear OK.
I have also tried to clone this file to application/language/english/ with similar bad results.
Any insights on this?
Answer: It looks like this would require hacks to the date_helper.php file which I am not willing to do.
Instead, the date class in CI has the timezones() function which allows you to convert from, for example, UM5 to -5. In that case one can wrap this function around the U__ value coming from the view/dropdown -- and then save it to DB as -5 or some other INT.
Since I want to show the user their selected timezone on that same dropdown, I am forced to have DB fields for the U__ and INT timezone formats. As far as I know, there is no CI function to convert from -5 to UM5.
So, for the user, I pull the U__ format into the view to autopopulate the dropdown.
For timezone conversions and such, I use the INT format.


How to filter query based on page meta keys and/or title?

Question: I am using Beaver Builder with WordPress and am using Advanced Posts to display my custom post types. I have 6 teams and about 30 players that belong to each team. I want to display the team's roster on the team page but can't filter by team when selecting players to show.
I found this method: https://www.ultimatebeaver.com/docs/filter-query-parameters-advanced-posts/
But I am having trouble comparing the meta keys between players and teams and don't know where to begin.
This is what I have so far:
global $post;
$current_team = $post->post_name;

if ( $settings->id == 'team-roster' ) {
     $args['meta_key']       = 'team';
     $args['posts_per_page'] = '30';
     $args['meta_query']     =
            array(
                   'key'     => 'team',
                   'value' => '$current_team',
                   'compare' => '=',
            );
 }
 return $args;

I am trying to compare to the page slug, which is the same as the values stored in the meta_key.
I would like each team page to show the players on the team as well as use this same module on the players page to show the rest of the players. Open to other ideas as well if this isn't the right method.
Comment: Not sure I completely understand but you can have multiple queries using the `relation` parameter with `meta_query` but there are also other ways possibly to go about this. Can you post the code you have so far so we can see we the problem lies?
Answer: Ended up using categories to filter instead of the relationship meta_key field. Found out that the relationship field is stored as an array so it wasn't comparing correctly. Here's my solution:
global $post;
$current_team = $post->post_name;

if ( $settings->id == 'team-roster' ) {

     $args['posts_per_page'] = '50';
     $args['tax_query']     =
            array(
                array(
                   'taxonomy' => 'category',
                   'terms' => $current_team,
                   'field' => 'slug',
                )
            );
 }
 return $args;


Collatz $2x + 1$ conjecture?

Question: Do we know of any Collatz theorem involving similar functions.  For example what do we know about iterations of:
$$
f(x) = \begin{cases} \dfrac{x + 1}{2} \text{, if } x \text{ is odd}. \\ 2x + 1, \text{ if } x \text{ is even}.\end{cases}
$$
Since this one doesn't involve $3$ maybe it is easier to solve?  Why isn't this one the lowest hanging fruit rather than the $3x +1$ problem?

Examples:
$$
f(1) = 1 \\
f(2) = 5 \to 3 \to 2 \to \dots \\
f(4) = 9 \to 5 \dots \\
f(6) = 13 \to 7 \to 4 \to \dots
$$
So one of the finite number of conjectured cycles would be $5 \to 3 \to 2$.
Comment: I think this can be solved by analysing the binary expansion...?
Comment: You might want to check your definition here. The $-$ sign obviously oscillates (e.g. 4, 9, 4, 9, ...) and the $+$ sign just increases by 1 each time (e.g. 4, 9, 5, 11, ...).
Comment: Why $\pm$? If it's just minus, the two things are mutually inverse, and all numbers pair off. I guess you just want +?
Comment: Perhaps this answer of mine (image) is interesting: https://mathoverflow.net/a/200126/7710   It looks at the generalization of $3x+1$ to $mx+1$
Comment: @eyballfrog, it's $+$ yes.  It has finite cycles just like Collatz.  $4, 9, 5, 11, 6, 13, 7, 4$.
Answer: The Collatz conjecture is interesting because it is hard.  If you use the $-1$ version, every even $x$ goes to $2x+1$, which goes back to $x$, so we can just say every pair $(2k, 4k+1)$ is a cycle including $(0,1)$ and be done.
Even for the $+1$ version, every doubling is followed by a divide by $2$, which might be followed by another divide by $2$, so numbers can't grow much beyond twice the start.  There is a cycle $(2,5,3)$ which everything except $1$ seems to fall into.  We can prove this by considering what happens to numbers of the form $4k$ and $4k+2$.  A number of the form $4k$ goes to $8k+1$, which then goes to $4k+1$.  A number of the form $4k+1$ goes to $2k+1$ which then goes to $k+1$, so any large number gets divided by $2$ in a few steps.  We can expand this to show every number except $1$ goes to the $(2,5,3)$ cycle.
The multiplication by $3$ in the Collatz conjecture is just right to balance the up steps and the down steps if you consider the chances of odd numbers in a row.  If you increase the multiplier most numbers will go off to infinity.  If you decrease it, all numbers fall into a small cycle and we can prove that.  Chaos lives on the boundary between two or more well behaved regions.
Answer: If $x$ is even, then $f(x)=2x+1$ is odd. So $$f(f(x))=\frac{(2x+1)+1}{2}= x+1,$$ which is also odd. So
$$ f(f(f(x))) = \frac{(x+1)+1}{2} =\frac{x}{2}+1 \leq x.$$
Thus no matter wheter $x$ is even or odd at the beginning, the number will always become smaller after a couple of iterations. Thus there is no number $x$ for which the series tends to infinity.

Collatz $2x + 1$ conjecture?


Is logical operations are restricted to only Boolean functions?

Question: When the word logic is pop uped in any mathematics or computer science textbooks it usually means to denote the Boolean functions.
Is logical operations are restricted to only Boolean functions in these textbooks (say in most of the cases)?
Is logical operations is restricted to only two states?Iam asking this because Wikipedia says "Leibniz established that, by using the binary system, the principles of arithmetic and logic could be combined."So I tend to think logic means dealing only with two states?
Comment: Next to Boolean algebras (where "tertium non datur" is the motto) there are also Heyting algebras that are suitable for [intuitionistic logic](https://en.wikipedia.org/wiki/Intuitionistic_logic).
Answer: This is a bias in the field.  Even classical logic is not categorical.
This result had been shown in 1999 by Pavicic and Megill.  Eric Schechter's book on classical and non-classical propositional uses subsets of a three-set to interpret the nodes of the O6 ortholattice in what is called the hexagon intepretation of classical logic.  As shown by Schechter, the hexagon interpretation has the same inference rules and tautologies as two-valued logic.  The hexagon interpretation has one truth valuation and five falsity valuations.
In so far as logic concerns itself with proof, truth invariance across syntactic transformations makes a unique truth valuation the focus of the subject.  So, a semantic theory with five falsity valuations would not interfere with this emphasis.
In so far as logic concerns itself with reasoning, there are many possible variations which have been formulated and studied.  Schechter's book is one of only a few with this explicit pluralistic approach to logic in mathematics.  He also points out how mathematicians regularly apply principles of relevant logic, although this is not included in standard accounts of so-called mathematical logic.
If one moves to first-order accounts of logic, the principle of indiscernibility of
non-existents from negative free logic is ubiquitous in mathematics as a means to establish well-formedness -- it is essential to the understanding of partial functions in the theory of recursive functions.  But this goes unrecognized in received views.


Como posso desfazer esses 3 commits?

Question:
$ git status
Refresh index: 100% (16/16), done.
On branch master
Your branch is ahead of 'origin/master' by 3 commits.
  (use "git push" to publish your local commits)
Changes not staged for commit:
  (use "git add ..." to update what will be committed)
  (use "git checkout -- ..." to discard changes in working directory)
    modified:   Blender/web/Aquario-concreto.html
    modified:   Blender/web/Aquario.html
    modified:   Blender/web/Banheiros.html
    modified:   Blender/web/Jaula-arame.html
    modified:   Blender/web/Jaula-oncas.html
    modified:   Blender/web/Jaula-porta-metal-grade.html
    modified:   Blender/web/Portaria.html
    modified:   Blender/web/Refeitorio.html
    modified:   "Blender/web/Zool\303\263gico.html"
    modified:   Blender/web/casa-lembrancas.html
    modified:   Blender/web/jaula-flamingos.html
    modified:   Blender/web/jaula-leao.html
    modified:   Blender/web/jaula-passaro-guara.html

Untracked files:
  (use "git add ..." to include in what will be committed)
    Blender/web/Lago-cisnes.html
    Blender/web/jaula-aves-lado-aramado.html
    Blender/web/jaula-aves.html
    Blender/web/jaula-babuino.html
    Blender/web/jaula-camelo.html
    Blender/web/jaula-cangurus.html
    Blender/web/jaula-grupo passaros.html
    Blender/web/jaula-pinguins.html
    Blender/web/jaula-repteis.html
    Blender/web/jaula-suricates.html

no changes added to commit (use "git add" and/or "git commit -a")
Answer: Antes de dar o comando recomendo que faça um backup da pasta com o seu projeto. Toda a pasta incluindo arquivos do .git/
git reset --hard HEAD~3

Ou, para ser mais exato, você pode voltar para um determinado commit:
Dê um:
git log
Agora é só pegar o id do commit que você quer voltar para e dar o seguinte comando, substituindo o ID pelo id do seu commit
git reset --hard ID

Comment: Ok, muito obrigado pela ajuda. Estou tendo que subir os aquivos do TCC em commits separados pra não ultrapassar o tamanho máximo permitido pelo GIT (50MB por commit).
Comment: se deu certo, marca a resposta como aceita ou útil. Obrigado. Qualquer coisa tô a disposição.

Como posso desfazer esses 3 commits?


Tautology of $\mathcal{L}_X(J)=0$ and flow of $X$ consisting holomorphic transformation where $J$ is complex structure

Question: Let $(M,J)$ be a complex manifold with complex structure $J$. Suppose $X$ is a real vector field over $M$.
$\mathcal{L}_XJ=0$ iff flow of $X$ consists of holomorphic transformation of $M$
The following is a dumb question. The reference is http://moroianu.perso.math.cnrs.fr/tex/kg.pdf
pg 14 Lemma 2.7.
Q: Why this is tautological here? I do not see this is obvious. The flow is made of 1 parameter group along some other real vector field.
Comment: A late comment 2 years later. I'm also studying the same material. I don't understand what " flow of $X$ consists of holomorphic transformation of $M$" means since the note doesn't give a definition. Does that mean flow of $X$ is holomorphic function on $M$?
Comment: @Andrews It follows from accepted answer that the small deformation preserves complex structure. And the vector field is the corresponding derivative. Hence it had better be holomorphic on each component if you treat it as complex vector field.
Answer: This is a general fact about flows and tensors that is essentially a generalization of the fact that a differentiable function is constant if and only its derivative is zero. Whether or not you label it as tautological is a matter of taste, I suppose.
The Lie derivative of a tensor field is typically defined by $$\mathcal L_X T = \frac{d}{dt}\Big|_{t=0} \Phi_t^* T$$where $\Phi_t$ is the diffeomorphism given by flowing along $X$ for time $t$.

Proposition. $\mathcal L_X T = 0$ if and only if $\Phi_t^* T = T$ for all $t$.

Proof. The "if" direction is immediate from the definition above. To get the other direction, we need to "integrate" $\mathcal L_X T = 0.$ Differentiating the flow group law $\Phi_t \Phi_s = \Phi_{s+t}$ with respect to $s$ at $s=0,$ we find that the derivative of $\Phi^*_t T$ at a general time is simply $$\frac{d}{dt} \Phi_t^* T = \Phi_t^* \mathcal L_X T;$$ so $\mathcal L_X T = 0$ in fact implies that $\frac{d}{dt}\Phi_t^* T = 0$ for all times. Thus $\Phi_t^* T$ is constant in $t,$ so it is always equal to $\Phi_0^*T = T.$$\;\square$
Since holomorphic transformations are defined exactly as diffeomorphisms $\phi$ satisfying $\phi^* J = 0,$ this specializes to answer your question.
Comment: Excuse me,sir. I've a question. In the reference above holomorphic transformations are defined such as "its differential commutes with the complex structures at each point: f∗ ◦ J1 = J2 ◦ f∗". Why this is equivalent to f∗J=J (I think there is a typo when you wrote "ϕ∗J=0)"