Method to identify the point in which the slope of a predicted probability becomes significant

Question: I'm running a logistic regression in which I'm predicted a binary response from a continuous predictor... I'm interested in determining the exact point in which the predicted probability (exponentiated y-hat / (1 + exponentiated y-hat) becomes significantly different than the average y-hat (or average predicted probability of the discrete event...
I was thinking of some sort of Johnson Neyman technique, but am unsure how to begin this exercise...
Would like to do this in R at the end of the day, but not required for an answer.
Comment: This isn't really clear. If there is an effect of X in the linear predictor, then there is a difference between any 2 points along X. Whether such a difference would be 'significant' only depends on how far apart they are & on N, but any 'non-significant' difference would just be a type II error.
Comment: "I'm interested in determining the exact point in which the predicted probability" are you saying that you are seeking, by way of sequential analysis, the necessary sample size to show that, according to the mean model, you may obtain confidence intervals for any one mean value of $Y$ at a given $X$ for which $E[Y|X]$ is significantly different from $\bar{Y}$ as a general test of hetereogeneity?
Comment: Hmmm, that might be one way to do that... I'm saying i'd like to determine at what value of x does the predicted probability of y become statistically different than the mean predicted probability of y...not necessarily a sample size issue, however.
Comment: So really, at what point does the slope for my given effect become statistically different than 0... That might be another way to think about it.
Comment: @gh0strider18 this might be a little highfalutin but if you consider your data to be sampled in arrays of row indpendent data, it's never exactly clear what order the data come in. The number you are describing could be 5, if it is only necessary to restrict to a subset of 5 observations to attain a statistically significant logit slope. Alternately, it could be 100 *in the same sample* depending upon which observations, exactly, you add.
Comment: @gh0strider18 I think it may be useful for you to become familiarized with resampling based statistics, particularly the bootstrap, jackknife, and k-fold cross validation as different ways of addressing the issue of error estimation for parameters and combinations or subsets of the sample and their impact on inference.
Comment: why would a Mann-Kendall-like resampling not give you a CI?  You can then compare CI with actual to look for outliers.
Answer: A logit model is a linearization of a nonlinear relationship between the X's and the dichotomous outcome. The slope is therefore constant everywhere in X.
As far as the predicted probabilities, the average predicted probability is just the proportion of 1's in your data. So you want to identify for what value of X does an observation have a higher probability of being 1 than the overall proportion. You can do that a number of ways - one way would be to estimate the predicted probabilities for each level of X (keeping other variables in your model at their means), sort them and see at which point is it higher than the overall. (You can find this out by looking at the coefficients and doing some arithmetic, but this may be easier if you have trouble with converting log-odds to p).
You can also estimate a confidence interval around the marginal effect (i.e. average probability) at each level. I haven't done this in R though it probably isn't that complicated - in Stata, you run your logit and then do margins. For example, I simulated some data where the overall sample probability is 0.391, and one standard normal predictor x, where the true logit coefficient was 2. In Stata, here is my output:
    logit y x

Logistic regression                               Number of obs   =       1000
                                                  LR chi2(1)      =     504.19
                                                  Prob > chi2     =     0.0000
Log likelihood = -417.09877                       Pseudo R2       =     0.3767

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           x |   2.192613   .1399275    15.67   0.000      1.91836    2.466866
       _cons |  -.8138537   .0933571    -8.72   0.000    -.9968302   -.6308772

margins

             |            Delta-method
             |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
       _cons |       .391   .0116073    33.69   0.000     .3682501    .4137499
------------------------------------------------------------------------------

margins, at(x==0.2)

------------------------------------------------------------------------------
             |            Delta-method
             |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
       _cons |   .4072535    .020886    19.50   0.000     .3663176    .4481893
------------------------------------------------------------------------------

Look at the confidence intervals for the two margins commands and you will see that they overlap, so even though at x=0.2 you see a predicted probability higher than the average, it isn't statistically significant.
EDIT: Per whuber's comments below, this approach doesn't account for the sampling variation of the mean from the data. It will tell you a difference from a particular value, which may happen in this instance to be the mean of your sample. But it may not address your specific question.
Comment: Your attempt at a null hypothesis does not appear valid for two reasons: (1) it refers to the data rather than the actual state of affairs and (2) it refers to a value $x$ that is supposed to be determined from the data themselves! Now *if* $x$ were specified in advance, a hypothesis of the form "the predicted value at $x$ differs from the mean" would work--but it doesn't seem possible to couch the question in this form. It might be more fruitful to think of the question as requesting some form of *interval estimate* (which will cover values of $X$).
Comment: In the situation you cite, if I understand it correctly, there is a null hypothesis that can be tested: $H_0$ is that the underlying values reflected by the scores are equal and $H_A$ is that they are unequal. The difference here is that the OP describes a kind of *search* for a threshold. It asks for an *estimate* of some sort to be constructed from the data. It is common for people to misuse statistical language, so one of the first things we want to do here on CV is try to understand and usefully frame the underlying question in a mutually comprehensible language, and only then answer it.
Comment: There are some delicate issues here. After all, the mean of the data is itself a random variable, as are the fitted coefficients and any "predicted probability," and these of course are all based on the same random dataset. It is not apparent that your proposal handles these complications correctly. In fact, it's not evident what the question even means, since "significantly different" implies a *hypothesis test.* What is the null hypothesis you are testing and what is its alternative?
Comment: I took OP's question to mean how to find the value of X where the predicted probability would be a statistically significant from the average predicted probability in the dataset. I understood the hypothesis test to whether the predicted probability at X=x is statistically different from the mean. However, I agree with you that the average is a sample average, so must be treated as a statistic not a parameter. How would you propose adjusting my approach to account for the sampling variability?
Comment: That makes sense, and perhaps that's what the OP was trying to get at - maybe he/she didn't really mean statistical significance per se. On a related note, I will say that in psychometrics I have seen statisticians compare two scores to determine if, based on the sample of items used, they are statistically different. Would you say in that case again it is an incorrect use of the terms? If so, what would you recommend instead? It seems to me the OP is doing something similar.


R: How to fit a GLMM in nlme

Question: I want to compare lme4 and nlme packages for my data. But I'm confused by how to use syntax in nlme. I'm working with Mixed-Effects Models in S and S-Plus (Pinheiro, Bates 2000) and the current Version of the documentation Package 'nlme' (04/07/2018)
I tried to use groupedData() as well as nlsList() and SSlogis(), to fit my model.
For lme4 I can fit my models wihtout any trouble. Can you tell me, how to fit these models from lme4 in nlme?
My data has easy structure:
$y$ is a binary outcome in $\{0,1\}$, $x$ is continuous, $group$ is categorical grouping factor ($N$ different groups)
model1 <- glmer(y ~     (1 | group),       data = data , family = binomial(link="logit"))
model2 <- glmer(y ~ 1 + (x | group),       data = data , family = binomial(link="logit"))
model3 <- glmer(y ~     (x | group) group, data = data , family = binomial(link="logit"))
model4 <- glmer(y ~ x + (1 | group),       data = data , family = binomial(link="logit"))

Comment: Your model2 seems nonsensical to me - you need to have x listed both in the fixed effects and random effects portion of that model.
Comment: When I lined up the code to make the structure easier to see, I notice there's an orphan `group` in model3. Can you clarify what that's supposed to be.  (Also a word of warning: this Q seems borderline off topic to me.)
Answer: I don't think nlme can be used to fit a mixed effects logistic regression model. However, you have plenty of other options available for this task via packages such as the ones listed below, whose use is illustrated for your model 4.
GLMMadaptive
install.packages("GLMMadaptive")

library(GLMMadaptive)

model4 <- mixed_model(fixed = y ~ x, random = ~ 1 | group,
               data = data,
               family = binomial(link="logit"))

See https://cran.r-project.org/web/packages/GLMMadaptive/vignettes/GLMMadaptive_basics.html.
glmmTMB
install.packages("glmmTMB")

library(glmmTMB)

model4 <- glmmTMB(y ~ x + (1 | group),
                data = data,
                family = binomial(link = "logit"))

See https://cran.r-project.org/web/packages/sjPlot/vignettes/tab_mixed.html.
MASS
install.packages("MASS")

library(MASS)

model4 <- glmmPQL(fixed =  y ~ x,
                random = ~ 1 | group,
                data = data,
                family = binomial(link="logit"))

See https://quantdev.ssri.psu.edu/sites/qdev/files/ILD_Ch04_2017_GeneralizedMLM.html.
brms
install.packages("brms")

library(brms)

model4 <- brm(y ~ x + (1|group),
              data = data,
              family=binomial(link="logit"))

See https://bayesat.github.io/lund2018/slides/andrey_anikin_slides.pdf and What would be a Bayesian equivalent of this mixed-effects logistic regression model, for example.
The brms package fits mixed effects models using a Bayesian framework; the other packages suggested here fit mixed effects models using a frequentist framework.
Answer: I was looking for a way to do what you're trying to accomplish and came across a couple of things. First was this question that was asked elsewhere on the website with this answer. The second was this paper, which did exactly what you were asking about. What they did was perform a logit transformation on the response variable, which could then be fitted into the lme function.
Full disclosure:
1. According to the answer I linked above, the method I'm about to share is apparently not recommended (though the comment by Aaron on the answer indicates that this is a very common way of doing it?)
2. There are very different results with the outputs I'm about to provide
Okay, onwards and outwards...
1. Create some simulated data
RNGkind('Mersenne-Twister')
set.seed(42)

x1 <- rnorm(1000)
x2 <- rnorm(1000)
x3 <- factor(rep(c('a', 'b', 'c'), length.out = 1000))
#x3 won't cause a lot of random noise, it's just for illustrative purposes.

beta0 <- 0.6
beta1 <- 0.9
beta2 <- 0.7
z <- beta0 + beta1*x1 + beta2*x2
pr <- 1/(1+exp(-z))
y <- rbinom(1000, 1, pr)
table(y) #Just check since I'm kiasu

2. Logit-transform the response variable and prepare our data frame
#####This is the part that isn't recommended#####
library(car)
logit.y <- logit(y)

df <- data.frame(y, logit.y, x1, x2, x3)

3. Run some models
library(nlme)
library(lme4)
library(glmmTMB)

test.lme <- lme(logit.y ~ x1 + x2, random = ~1|x3, data = df, method = 'ML') #We set this to maximum-likelihood as the default is REML (restricted maximum likelihood)
test.glmer <- glmer(y ~ x1 + x2 + (1|x3), data = df, family = binomial)
test.glmmTMB <- glmmTMB(y ~ x1 + x2 + (1|x3), data = df, family = binomial)

4. Look at the summaries
summary(test.lme)$tTable
                Value Std.Error  DF   t-value      p-value
(Intercept) 0.8431364 0.1020533 995  8.261726 4.546389e-16
x1          1.2517987 0.1018175 995 12.294535 1.920042e-32
x2          0.9074567 0.1035171 995  8.766248 7.863229e-18

summary(test.glmer)$coefficients
             Estimate Std. Error   z value     Pr(>|z|)
(Intercept) 0.5834385 0.07423036  7.859836 3.846378e-15
x1          0.9044080 0.08409916 10.754067 5.670490e-27
x2          0.6545513 0.07965376  8.217456 2.078662e-16

summary(test.glmmTMB)$coefficients$cond
             Estimate Std. Error   z value     Pr(>|z|)
(Intercept) 0.5834385 0.07423036  7.859836 3.846380e-15
x1          0.9044079 0.08409911 10.754072 5.670193e-27
x2          0.6545512 0.07965371  8.217460 2.078583e-16

The results from test.glmer and test.glmmTMB are quite similar, but the test.lme results (i.e. the one where we logit-transformed the response variable) is just a little bit different.
Also note that the nlme output uses a t-test, while glmer and glmmTMB use a z-test. More on the z-test used to test individual parameters can be found here.
5. Compare back-transformed estimates
logit.lme <- summary(test.lme)$tTable[,1]
logit.glmer <- summary(test.glmer)$coefficients[,1]
logit.glmmTMB <- summary(test.glmmTMB)$coefficients$cond[,1]

prob.lme <- exp(logit.lme)/(1+exp(logit.lme))
prob.glmer <- exp(logit.glmer)/(1+exp(logit.glmer))
prob.glmmTMB <- exp(logit.glmmTMB)/(1+exp(logit.glmmTMB))
prob.brms <- apply(as.data.frame(test.brms$fit), 2, mean)[1:3] #Example model not provided
names(prob.brms) <- names(prob.glmmTMB)

round(t(cbind(original = c('(Intercept)' = beta0, x1 = beta1, x2 = beta2),
              lme = prob.lme, glmer = prob.glmer, glmmTMB = prob.glmmTMB, brms = prob.brms)), 2)
         (Intercept)   x1   x2
original        0.60 0.90 0.70
lme             0.70 0.78 0.71
glmer           0.64 0.71 0.66
glmmTMB         0.64 0.71 0.66
brms            0.60 0.91 0.66

#Not incredible all round except for the brms method (which uses
#Bayesian anyway!), but nearly there. The point is that the results
#from the glmer, glmmTMB, and brms methods are more similiar to each
#other than the result from the lme method.

6. Let's look at some visualizations.
#Make some predicted data
#x1 axis
predicted.df.x1 <- data.frame(x1 = seq(min(df$x1), max(df$x1), length.out = 1000),
                              x2 = mean(df$x2))
predicted.df.x1 <- as.data.frame(do.call(rbind, replicate(3, predicted.df.x1, simplify = F)))
predicted.df.x1$x3 <- rep(c('a', 'b', 'c'), each = 1000)

predict.lme.x1 <- logit.lme[1] + predicted.df.x1$x1*logit.lme[2] + predicted.df.x1$x2*logit.lme[3]
#Recall that we logit transformed our data, so we need to 'manually' get our predicted variables

predict.lme.x1 <- exp(predict.lme.x1)/(1+exp(predict.lme.x1))
predict.glmer.x1 <- predict(test.glmer, predicted.df.x1, type = 'response')
predict.glmmTMB.x1 <- predict(test.glmmTMB, predicted.df.x1, type = 'response')

#x2 axis
predicted.df.x2 <- data.frame(x2 = seq(min(df$x2), max(df$x2), length.out = 1000),
                              x1 = mean(df$x1))
predicted.df.x2 <- as.data.frame(do.call(rbind, replicate(3, predicted.df.x2, simplify = F)))
predicted.df.x2$x3 <- rep(c('a', 'b', 'c'), each = 1000)

predict.lme.x2 <- logit.lme[1] + predicted.df.x2$x1*logit.lme[2] + predicted.df.x2$x2*logit.lme[3]
predict.lme.x2 <- exp(predict.lme.x2)/(1+exp(predict.lme.x2))
predict.glmer.x2 <- predict(test.glmer, predicted.df.x2, type = 'response')
predict.glmmTMB.x2 <- predict(test.glmmTMB, predicted.df.x2, type = 'response')

#Plot it
par(mfrow = c(2,3))
plot(df$x1, (exp(predict(test.lme))/(1+exp(predict(test.lme)))), pch = 16, cex = 0.4, col = 'red', xlab = 'x1', ylab = 'Predicted Prob.', main = 'Logit-transormed')
lines(predicted.df.x1$x1[1:1000], predict.lme.x1[1:1000], col = 'black', lwd = 2)

plot(df$x1, predict(test.glmer, type = 'response'), pch = 16, cex = 0.4, col = 'blue', xlab = 'x1', ylab = 'Predicted Prob.', main = 'glmer Function')
lines(predicted.df.x1$x1[1:1000], predict.glmer.x1[1:1000], col = 'black', lwd = 2)

plot(df$x1, predict(test.glmmTMB, type = 'response'), pch = 16, cex = 0.4, col = 'darkgreen', xlab = 'x1', ylab = 'Predicted Prob.', main = 'glmerTMB function')
lines(predicted.df.x1$x1[1:1000], predict.glmmTMB.x1[1:1000], col = 'black', lwd = 2)

plot(df$x2, (exp(predict(test.lme))/(1+exp(predict(test.lme)))), pch = 16, cex = 0.4, col = 'red', xlab = 'x2', ylab = 'Predicted Prob.', main = 'Logit-transormed')
lines(predicted.df.x2$x2[1:1000], predict.lme.x2[1:1000], col = 'black', lwd = 2)

plot(df$x2, predict(test.glmer, type = 'response'), pch = 16, cex = 0.4, col = 'blue', xlab = 'x2', ylab = 'Predicted Prob.', main = 'glmer Function')
lines(predicted.df.x2$x2[1:1000], predict.glmer.x2[1:1000], col = 'black', lwd = 2)

plot(df$x2, predict(test.glmmTMB, type = 'response'), pch = 16, cex = 0.4, col = 'darkgreen', xlab = 'x2', ylab = 'Predicted Prob.', main = 'glmerTMB function')
lines(predicted.df.x2$x2[1:1000], predict.glmmTMB.x2[1:1000], col = 'black', lwd = 2)

So the result we get from the logit-transformed response variable with the linear nlme is slightly different from outputs provided using the glmer and glmmTMB when specifying the binomial family. It also doesn't take too much to see that there is a difference between the methods when looking at the visuals.
Now the question is why is it different. I'm sure there is an answer, I just don't know what it is.
Some other things:

I'm not entirely sure if my syntax/calculations are correct in getting the logit-transformed response variable, so if someone is able to check and verify if I did it correctly, then maybe we'd be getting warmer.
I'm not going to profess to being an expert, I just happened to (vaguely) know how to code it, albeit with the help of the answer I highlighted earlier in this post. Would someone be able to shed some light on the differences?
The only reason I'd imagine anyone would want to use the lme method is to fit an autoregressive correlation structure of some kind to account for temporal/spatial autocorrelation, much like was done in the paper I mentioned earlier. Ben Bolker does provide a succinct brain dump (unlike this answer) on which packages can be used for fitting mixed models with temporally autocorrelative data, though I haven't tried any of them myself (I'm afraid I'm too intimidated to even try, lets I break R again).
Comment: @IsabellaGhement I haven't got enough reputation to make a comment on your post, but would you be able to look through this answer and share your thoughts? I've seen your answers to a lot of questions on your website and I think you're better prepared to provide comment.
Comment: Maybe @BenBolker could share his insights, too, as he's provided a lot of really good insight into questions pertaining to GLMMs in general. Some of the links I provided were to his [GLMM FAQ page](https://bbolker.github.io/mixedmodels-misc/glmmFAQ.html) anyway.
Comment: thank your for that detailed answer! I'll certainly make use of that!
Comment: @Lalochezia: Somehow I missed that you tagged me to your nice answer.  Better to join the party late than never, as they say.  Applying the logit-transform to your response variable and then analyzing it with lme() means that you are modelling the **expected value of the logit transformed response variable** given the predictors and random effects.  On the other side, with glmer() or other alternatives, you are modelling the **logit transformed expected value of the response variable** given the predictors and random effects. These two are entirely different quantities.
Comment: The logit transformation is a non-linear transformation, so the **expected value of the logit transformed response variable** given all else in the model is NOT the same as the **logit transformed expected value of the response**.  What we really want to model is the latter, because we can use the inverse logit transformation to our advantage to learn more about the **expected value of the response variable** as a function of predictors and random effects.  With the former, interpretability is a big concern.
Comment: Because the two approaches model entirely different things, it is not surprising that their results are different.  In practice, the approach which produces the most interpretable results should be favoured.

R: How to fit a GLMM in nlme


A modular equation of 11th degree of Dedekind's $\eta$ function.

Question: Regarding the Post
Additional values of Dedekind's $\eta$ function in radical form
I wrote the equation that has as root the value $\frac{\eta(11i)} {\eta(i)}$ that is missing.
Can someone help me solve (in radical form) the following equation, whose solution is the value of Dedekind's modular $\frac{\eta(11i)} {\eta(i)}$ function?
$$x^{24}-\frac{90}{11^{5}} x^{12}+\frac{480}{11^{7}}x^{8}+\frac{288}{11^{9}} x^{4}-\frac{1}{11^{11}}=0$$
where
$$x=\frac{\eta(11\ i)}{\eta(i)}.$$
This equation comes from the work of L. Kiepert and specializes for the value reported in the title of the application. My intent is to find the solution in closed form.
Comment: Seems clear to me.
Comment: See the similar questions for [13th degree](https://math.stackexchange.com/q/3205373),
[17th degree](https://math.stackexchange.com/q/3205410),
[19th degree](https://math.stackexchange.com/q/3205515),
[23rd degree](https://math.stackexchange.com/q/3205555).
Comment: I use the program "Derive" and the values is x = 0.073085799269177192524967047801357734832236759435876091870009595338428953696284190325787697249450777, the program PARI indeed x=0.073085799269177192524967047801357734832.
Comment: I think this approximation value is acceptable!
Answer: Using Mathematica I found a solution. Let
$\ p := 11,\ $ $s := \sqrt{p},\ $ $x := \eta(p\ i)/\eta(i),\  $
$x_0 := (p\,x^2)^2,\ $ $f(x) := x^3 -4sx^2 + (88-12s)x + (33-10s).\ $
Then $\ f(x_0) = 0.\ $ Solve for $\ x_0\ $ using
$\ c_1 := 22-9s,\ $ $c_2 := 21365-6324s,\ $ $c_3 := -3861+1490s,\ $
$r_2 := 9s\sqrt{3c_2},\ $ $r_3 := \sqrt[3]{(c_3-r_2)/2}.\ $
Then $\ x_0 = (4s+4c_1/r_3-r_3)/3 \approx 0.003452370313107857. $
Comment: @OscarLanzi They are two different numbers. One is $x$ root of degree 24 polynomial. The other is $x_0 = (p\,x^2)^2$ root of a cubic. I voted to close by mistake.
Comment: So I'm looking at $121x^4$.  Seems to work.
Comment: Thank you! I posted $\eta(11i)$ https://math.stackexchange.com/q/3101157/additional-values-of-dedekinds-eta-function-in-radical-form.


best way to switch html content by javascript

Question: Could you please advice me How I can switch html content by javascript?
for example:
if($sid == 0)
 {one html code}
else
 {another html code 2}

LESS, jQuery, CSS3, etc - which way is better?
Comment: You haven't specified criteria for goodness, or what you mean by switching html content, and the pseudocode makes little sense (looks like HTML would be embedded directly in JavaScript – can't do that).
Answer: You should use jQuery load and pass the HTML content back, for example:
if($sid == 0) {
  $('#result').load('ajax/test.html', function() {
     alert('Load was performed. (sid equals 0');
  });
} else {
  $('#result').load('ajax/othercontent.html', function() {
     alert('Load was performed. (sid is not equal to 0');
  });
}

http://api.jquery.com/load/
Answer: jQuery is designed to do what you've asked (and much more obviously) in a non-browser specific fashion.

...

...

Answer: I'm not sure what
if($sid == 0)

is supose to be, but if you want to change the html content you can use
$("#id").html("your html");


Print current logged in user without link

Question: I'd like to print out the name of the user that is currently logged in, but not have it be a link.
Currently I have:
<?php print l($user_name, 'user/' . $user->uid);?>

But this prints out a link to their user profile. Any way to make their name just text and not a link?
Answer: l() is the function that creates a link, so...
<?php print $user_name; ?>


How far along the crease can a non-striker stand?

Question: In cricket, how far along the crease is a non-striker allowed to stand to the right or left?
Could they stand at the boundary and still be in their ground, or is there a limit to the "width" of the crease?
Answer: It is impossible to stand outside the crease to the left or right, as the crease is of unlimited length; quoting from Law 7.3 The popping crease:

The popping crease [...] shall be considered to be unlimited in length.

Other than taking a position which would obstruct the fielding side, there is no restriction in the Laws as to where the non-striker may stand.
Answer: The non striker can stay and can start only in pitch zone, he can not start standing in infield or outfield.
Comment: Are you able to provide a quote from the Laws of Cricket to support this answer?


Find $r$ of G.P with arithmetic progression members

Question: $a1$$ \quad $$a3$$ \quad $$a13$$ \quad$  of arithmetic progression make G.P, find $r$ of G.P
I tried this: $$ a1 = a \qquad a3 = a + 2d \qquad a13 = a + 12d $$
$$ r = \frac{a+2d}{a} $$
then putting this into $Sn$ but it's not working out.
Answer: Because you didn't do it completely.
Since you have $$r =\frac{a + 2d}{a} \quad(a \neq 0) $$ then you get:
$$\frac{a + 2d}{a} * (a + 2d) = a + 12d. $$
By simple simplification, you'll get $$d = 2a$$.
Then you get $$a1 = a \quad a3 = 5a \quad a13 = 25a $$ as your desire. Where $$r = 5 $$


Simple Form custom component does not add attribute to input

Question: I want a component that adds 2 things. Firstly, a feedback for the user to see how many characters has left(later updated via JS). Secondly, an attribute(field limit) to the input for the JS to use.
I've followed this, and pretty much just coping/pasting from one of their built-in components. Feedback is displayed correctly but :maxlength is not present at the input.
module SimpleForm
  module Components
    module CharCounter
      def char_counter(wrapper_options = nil)
        if options[:char_counter].present?
          input_html_options[:maxlength] = limit
          "#{limit - object.read_attribute(attribute_name).length }".html_safe
        end
      end

      def has_char_counter?
        char_counter.present?
      end
    end
  end
end

wrapper.rb
...
b.optional :char_counter, wrap_with: { tag: 'p', class: 'help-block text-right' }
...

html output

    Name *

  <input class="string required form-control" type="text" value="" name="activity[name]" id="activity_name">

    73

Thank you!
Answer: So after a few days of dig through SimpleForm code I realize that
the elements order is quite important
wrapper.rb
b.optional :char_counter, wrap_with: { tag: 'p', class: 'help-block text-right' }

must be before
b.use :input


How to set fields value in Views PHP module?

Question: How to define the fields value in Views PHP module?
Answer: First you need to load the node
$node = node_load($data->nid);

then you can either access
$value=$node->field_name['und'][0]['value'];

or assign
$node->field_time['und'][0]['value'] = $value

values to the node items. You may need to print out the content of the $node object to see the actual field_name
$node_r = print_r($node, true);
watchdog('NODE PRINT OUT', "$node_r");

then view it in the recent log mesages
admin/reports/dblog

Ensure the DBlog (Database logging) core module is enabled
Comment: Don't forget `node_save($node);`
Comment: Thanks, but can the $row->php value be defined in such way?( So it can be called in another field or filter )


adjust vector to be orthgonal

Question: I have vector $A$ and $B$, how do I find a vector $C$ that is orthogonal to $A$ and magnitude of $( B - C )$ is minimized?
Answer: The space of vectors orthogonal to $A$ represents a plane $\Pi$.  You want a vector $C$ on the plane so that it is closest to $B$, this means you want an orthogonal projection of $B$ onto $\Pi$.  This can be calculated by simply removing the $A$ component of $B$ as follows: $$C = B - \frac{B . A}{A . A} A$$

adjust vector to be orthgonal


setInterval() does not work on style.marginLeft

Question: I want the box I have created to move 20px every .5 seconds but it happens only once with setInterval()

Comment: You're setting the `marginLeft` value over and over to the same value.  You have to increment the value you set it to over time if you want the box to move.
Answer: the push function needs to be modified

Answer: You need to add 20 extra pixel every iteration

            setInterval(function(){
                push();
            },500);
            function push(){
                var box = document.getElementById('box');
                box.style.marginLeft= parseInt(box.style.marginLeft||0) + 20 + "px";
            }

 #box{
                background-color: green;
                width: 200px;
                height: 200px;
            }


I am trying to render an array inside an object in React. I have a departments.json file that I have imported into my app.jsx as Data

Question: I am in React. I have a departments.json file that I am pulling my data from:
import Data from "./departments.json"
My information is an array of objects and within each object, I have a key with an array of multiple values. It is these values that I am trying to render as separate divs.
I have used .map to render, but it displays all of the values in one div for each object grouped together. I am really needing these values in their own div. So multiple divs are grouped per object. This is the output:

Component:
import Data from "./departments.json";
import Info from "./students.json";

function App() {

  console.log(Info)
  console.log(Data)

  return (

        {Info.map(function(student, index){
          return (

              {[`${student.familyName}, ${student.givenName}`]}
              DOB: {student.dob}
              Admitted: {student.admitDate}
              Anticipated Graduation: {student.anticipatedGraduationDate}
              Mentor: {[student.mentor.familyName, student.mentor.givenName]}

          )
        })}

        {Data.map(function(department, index){
          return (

{department.subjects}

          )
        })}

  );
}

export default App;

The JSON file:
[{
        "name": "Architecture and History of Art",
        "subjects": [
            "Painting",
            "Sculpture",
            "Architecture",
            "Drawing, printing, photography, collage and film",
            "The art and architecture of antiquity",
            "Art, religion and society",
            "Art, society and politics"
        ]
    },
    {
        "name": "Physical Education",
        "subjects": [
            "Anatomy and physiology",
            "Social, cultural and ethical influences",
            "Skill acquisition and psychology",
            "Health, fitness and training"
        ]
    },
    {
        "name": "Physics",
        "subjects": [
            "Physical quantities and units",
            "Measurement techniques",
            "Dynamics",
            "Forces, density and pressure",
            "Work, energy and power",
            "Deformation of solids",
            "Waves",
            "Superposition",
            "Electric fields",
            "Current of electricity",
            "D.C. circuits",
            "Particle and nuclear physics"
        ]
    },
    {
        "name": "Εlectrical & Electronics Engineering",
        "subjects": [
            "Circuit Theory & Networks",
            "Electrical & Electronic Measurement",
            "Data Structure & Algorithms",
            "Materials Science",
            "Mathematics",
            "Numerical Methods & Programming",
            "Computer Organization & Architecture",
            "Technical Report writing"
        ]
    },
    {
        "name": "Computer Science",
        "subjects": [
            "Information representation",
            "Communication and Internet technologies",
            "Hardware",
            "Processor fundamentals",
            "System software",
            "Security, privacy and data integrity",
            "Ethics and ownership",
            "Database and data modelling",
            "Algorithm design and problem-solving",
            "Data representation",
            "Programming",
            "Software development",
            "Monitoring and control systems"
        ]
    }
]

Answer: Maybe I didn't understand correctly what you need, but try this:

    {Info.map((student) => (

            {[`${student.familyName}, ${student.givenName}`]}

            DOB: {student.dob}

            Admitted: {student.admitDate}

            Anticipated Graduation:{' '}

              {student.anticipatedGraduationDate}

            Mentor:{' '}

              {[student.mentor.familyName, student.mentor.givenName]}

    ))}

    {Data.map((department) => (

          {department.subjects.map((subject) =>
{subject}
)}

    ))}

Comment: WOW! Thank you so much. worked great! I had just fallen too deep in the rabbit hole and was overthinking things. I appreciate your help!
Comment: Oh man, so to render these into their respective objects, Would I then just nest this map into the department name map?
Comment: I'm happy to help, Yep


Need to test that max number of files user can ftp on server using jmeter.

Question: The application users will place some amount of file on server and then after a fixed interval of time a job will pick those files from server, read the data and put that data in db.
I need to do a load test on it that. basically need to determine that if users put lots of file (say 10000 files and size become 10-15 gb) then our application will able to the job or not.
I am thinking to test it using jmeter. please suggest what approach should i follow and is there any other elegant way instead of jmeter to do it.
Thanks.
Answer: According to FTP protocol specification you can transfer only one file at a time using one connection so theoretically you can end up with a batch file assuming usage of ftp client utility which is included into major operating systems.
If you need to stress your FTP server you can simulate multiple file uploads with multiple virtual users using JMeter's FTP Request sampler, the configuration is trivial, all you need is to provide host, port, credentials, source and destination file. See Load Testing FTP and SFTP Servers Using JMeter for details.
Comment: Thanks.I want to determine the performance of the task done by the 'job' mentioned in ques. I have a utility which create lots of required files and then place them on the server. NOW the **job** which runs after every 5 mins pick file >> decrypt them >> read data >> place it in DB. I want to test if I place lots of files on server and this job runs then then will this job runs as expected or not. **I am thinking to ask dev people to log the time duration for which this job run and how many files it processed. I don't know if this is good and complete solution or not. please suggest**
Comment: Hi, Please someone help me on this


How to add title attribute at CKEditor images

Question: Is there a way to add the title attibute to CKEditor images? I'm using v4.1.2 and CKEditor is removing it automatically each time it's added from the HTML source view. I haven't found anything about this!
Comment: That's advanced content filtering that removes it from source. Adjust your ACF config to allow it :) Other than that, no idea at all.
Comment: can i know how u did this i really can't understand i want to add download="" attribute in  how u did this
Answer: You got to define config.extraAllowedContent = 'img[title]' if you want title attribute to be accepted into editor contents (see: official guide).
Comment: Thanks for your answer! I've already used `config.extraAllowedContent` to add some tags and attributes before this, but I was wondering if it's possible to add it from the `Image` dialog, but it seems not possible...
Comment: You got to add an extra field to Image dialog with `allowedContent` to do this. It's not that hard at all: see my previous answer http://stackoverflow.com/questions/18133800/how-do-i-customize-a-ckeditor-4-2-builtin-plugin-like-links/18142374#18142374
Answer: I have ultimate solution for this issue..
1) Open this file: ckeditor\plugins\image2\plugin.js
At the line number 343 (in my case) add below code
title: this.data.alt
just below "alt: this.data.alt," and enjoy..


MariaDB SSL configuration - using Let's Encrypt certificate


How to data entry for a matched case control study

Question: Please tell me how to enter my samples in excel can I first enter cases then controls in same sheet?
What about match ID and group indicator?
Answer: There is no real wrong way to enter data, as you can always manipulate your data and rearrange it in statistical software like R. That said, to avoid errors from confusion and headaches from remembering what's what, here is what I suggest:
A convenient way is by starting with a row that represents the column names. Every next row then represents a single observation of all recorded variables. For example, using the variables you mentioned:
matchID | group | status  | ...
1       | A     | case    | ...
2       | A     | control | ...
3       | A     | case    | ...
...     | ...   | ...     | ...
1000    | B     | control | ...

The order in which you enter the observations is not so important.
If you have repeated measures of the same individuals or experimental units, you can still use this format by simply creating new rows where matchID repeats:
matchID | group | status  | time | ...
1       | A     | case    | 1    | ...
2       | A     | control | 1    | ...
3       | A     | case    | 1    | ...
...     | ...   | ...     | ...  | ...
1000    | B     | control | 1    | ...
1       | A     | case    | 2    | ...
2       | A     | control | 2    | ...
3       | A     | case    | 2    | ...
...     | ...   | ...     | ...  | ...
1000    | B     | control | 2    | ...

Make sure to use informative variable names, so that both you and others can understand what represents what, even if some time passes between data collection and analysis. Try to avoid using special characters (!@#$%^&*()[]{}/\:;'",.<>) and spaces, because these may have meaning in the statistical software you end up using.
Abbreviations like temp for temperature, and conc for concentration are fine, but make sure the abbreviations are still recognizable without a glossary.
If you must use more than a single word or abbreviation to describe your variable in an unambiguous way, there are two naming conventions that I would consider good:

Capitalize each word (or each word after the first), like MatchID or matchID;
Underscores as spaces, like match_ID.

Of course, try to keep your column names short. If every patient has but a single identifier, you can drop match altogether and just name the first variable ID, or patient.

Finally, since you mention using Excel specifically, avoid the following:

Graphs in the middle of a page with raw data;
Coloring;
Multiple data sets arranged side-by-side.

Whether it be yourself or someone else, the moment you want to use your data in a different program than Excel, these features most likely will not transfer well. If you like using these features, you can instead:

Create a graph on a different tab;
Work with coloring in a copy of your raw data (in another tab or file);
Create separate files or at least tabs for separate data frames.


Facets blocks populated with incorrect field data and strange behavior

Question: I'm building a product catalog with faceted search. I'm using Search API, Search API Database Search, and Display Suite.
I've created a search server as well as an index which indexes four fields that I'm interested in filtering by (artist, country, printing, subject).
My problem is that the facets set on the individual fields have erroneous data in them (data pulled in from other fields, splitting the names of artists, etc). Then when you click the facets, the contents of the facet change by removing or changing fields from the list of options in the individual facet block. Interestingly, in the artist facet clicking on an erroneous field (e.g. a brand in the print type facet) produces no results (yes is available as an option).
Part of this maybe my data quality in the db, I do have Artists' names as two words in a single field.
So, I'm curious why the facet options change when clicked, but much more so as to why my facets are messed up.
Thanks in advance.
Answer: When preparing the data for the Search Page, make sure that the fields you index are indexed as strings and not full text. This is what caused the problem.


Another interesting integral $\int{\frac{x^m}{x^{2m}-1}dx}$

Question: After An interesting integral $\int{\dfrac{x^m}{x^{2m}+1}dx}$, I want to generalize a similar integral below
$$\int{\frac{x^m}{x^{2m}-1}dx}$$
for all values of $m\in\mathbb{N}$. Below are my steps:
$$\int{\frac{x^m}{x^{2m}-1}dx}=\int{\frac{x^m}{(x^m-1)(x^m+1)}dx}=\frac{1}{2}\left(\int{\frac{1}{x^m-1}dx}+\int{\frac{1}{x^m+1}dx}\right)$$
I don't know what my next step should be.
How should I solve this integral?
Comment: You could also write $1/(x^m\pm1)$ as partial fractions using roots of unity.
Comment: Hi, are you familiar with the Beta function? You can transform the integral $\int\frac{1}{x^n+1}$ into such a form.
Answer: Fractionalize  partially the integrand
$$\frac{x^n}{x^{2n}-1}=\sum_{k=1}^{2n}\frac{c_k}{x-x_k}$$
with $x_k= e^{i a_k},\>a_k=\frac{k\pi}{n}$ and apply the L'Hoptital's rule to obtain the coefficients
$$c_k = \lim_{x\to x_k}\frac{x^n(x-x_k)}{x^{2n}-1}=\frac{(-1)^kx_k}{2n}$$
Then
\begin{align}
&\int \frac{x^n}{x^{2n}-1}dx =\frac1{2n}\sum_{k=1}^{2n}\int \frac{(-1)^kx_k}{x-x_k} dx
= \frac1{2n}\sum_{k=1}^{2n} (-1)^kx_k\ln(x-x_k)\\
= &\frac1{2n} \sum_{k=1}^{2n}(-1)^k (\cos a_k +i \sin a_k)
\ln(x-\cos a_k -i\sin a_k)\\
= &\frac1{2n} \sum_{k=1}^{2n} (-1)^k\left(\cos a_k \ln\sqrt{x^2-2x\cos a_k+1}+\sin a_k \tan^{-1}\frac{\sin a_k}{x-\cos a_k} \right)
\end{align}


Did I solve this particle problem correctly?

Question: So, I'm supposed to find the equation for the velocity of the particle and the equation for the position of the particle.
I was given the acceleration, which is $-21\, \frac{\rm ft}{\rm s^2}$.
I was also given the initial velocity and distance, which are $4\, \frac {\rm ft}{\rm s}$ and $14\, {\rm ft}$.
So, what I did was this:
I integrate $a(t)$ to get $v(t) = -21t + C$, substituted $4$ for $t$ $(0=-21(4)+C)$ to get $C = 84$.
So, for velocity I got $v(t) = -21t + 84$.
Then, I had to solve for $s(t)$, so I integrated to get
$$
s(t) = \frac{-21t^2}{2} + 84t + C.
$$
I substituted $14$ for $t$ $(0 = \frac{-21(14)^2}{2} + 84(14) + C)$ to get $C = 882$.
So, for the position equation I got
$$
s(t) = \frac{-21t^2}{2} + 84t + 882.
$$
Did I do this correctly?
Comment: Correct method for the most part, but you plugged in your initial conditions backwards: an initial velocity of $4$ feet per second means $v(0) = 4,$ not $v(4) = 0.$
Answer: The acceleration of the particle is
$$
a(t) = {d^2 x \over dt^2} = - 21 \ {\mbox{ft} \over s^2}
$$
Integrating, we get
$$
v(t) = {dx \over dt} = - 21 t + c_1
$$
where $c_1 is an integration constant.
Given that initial velocity is $4$ ft / sec.
Hence,
$$
v(0) = 4 \ \implies \ c_1 = 4
$$
Hence,
$$
v(t) = {dx \over dt} = - 21 t + 4 \ \ \ {\mbox{ft} \over s}
$$
Integrating again, we get the position of the article as
$$
x(t) = - {21 t^2 \over 2} + 4 t + c_2
$$
where $c_2$ is an integration constant.
Given that initial position is 14 ft.
Thus,
$$
x(0) = 14 \ \implies \ c_2 = 14
$$
Hence, the position of the particle is
$$
\boxed{x(t) = - {21 t^2 \over 2} + 4 t + 14}
$$


What is the generalized terminology for continuous changes?

Question: In some musical dimensions, termini and notation for continuous changes are common:

Melodic (pitch):
glissando, portamento, doit, fall
Dynamic (volume):
crescendo, diminuendo (alias decrescendo)
Agogic (tempo):
accelerando, rallentando (alias ritardando)

1st question:
Do more of these terms for specific continuous changes exist?
They are useful by specificity. Once the termini are learned as vocabulary, they can easily be read and understood, without wasting much thought on them.
Yet, specificity also limits usefulness. New terms would need to be defined and learned for each dimension, where smooth changes are possible.
E.g. a smooth transition in articulation from staccato to legato; or contiuous variations in timbre (e.g. by shifting the point of attack on stringed instruments).
In this situation, inflation of terminology seems undesirable. Especially since these new terms would be used rarely anyway. Instead, a generalized indication would be helpful.
2nd question:
Is there an established generalized indication for continuous change?
almost self-answer:
But this generalization is constructed – I do not know wheter it is established as notation –
and potentially etymologically incorrect (Music-Italian pidgin).
The lengthy formulations poco a poco più *, poco a poco meno *, with the placeholder *, might be the correct Italian musical terms.
The severe shortcoming of these terms is the needless freedom of choice, which renders them unpractical.
poco a poco più forte and poco a poco meno piano would both mean increasing volume.
A flip of the direction (più–meno) alongside a negation of the argument (forte–piano) leaves the statement invariant.
Therefore these terms burden the readers by requiring too much thought when converting the words into meaning.
Moreover "poco a poco" is a relatively large protion of the text to only convey the information of continuous change. And it is not easy to abbreviate.
A clear, positive definiton is necessary; preferrably one which allows for abbreviation.
Would graduale * have same notion of continuity? Is it correct as a prefix, or should it be postfix, * graduale? Is the abbreviation grad. conflicting with other established terms?
cresc. = poco a poco più forte = grad. f ?
rall. = poco a poco meno rapido = graduale lento ?
I do not seek to replace crescendo etc. with a generalized construction.
I am searching for a way to consistently construct pendants of crescendo etc. in dimensions, where the respective terms have not been coined so far.
I only chose dynamics as an example here to demonstrate,
how the generalization would work in other dimensions.
Of course a consistent generalization must work as well in all dimensions eventually.
Comment: Outside of the Italian terms, "gradually" will work in sheet music for popular music.
Comment: I guess I've realized the central point of contention: the assumption that "consistency" equals clarity. I'd argue it doesn't necessarily (without resorting to Emerson's rather insulting vehemence about hobgoblins); when we're dealing with musical practices that are less than standardized, it's best to use custom indications.
Comment: One wonderful thing about the musical world: it's anything but standardized (even _within_ the strictures of Western common-practice), and attempts to dictate what's "officially right" have been either woefully unsuccessful or woefully successful. Conventions vary by period and nationality (the whole "_poco meno_" thing makes French impressionist tempo changes fun to figure out). Personally, I feel like Occam's Razor is better than any attempt to codify a "right answer" to an organic problem: Whatever makes your intention clearest is best. I like "Gradually change from _staccato_ to _legato_."
Answer: I'm under the impression that you're looking for consistent, absolute and specific indications of possible ranges.
Well, that is mostly pointless in the common sense of music: while mostly based on math and logic, we all know that music is way beyond all of that.
Remember that music is not what is written on a score, but what is played by performers (just like a play, a movie or a tv show are directed and performed: what's written is just a guide, the interpretation is what makes it actually "music").
Notations like pp or Allegro are not absolute, and even more specific notations such as tempo markings are not to be considered as strict indications that must be followed (take, for instance, the matter of Beethoven's tempo markings). It's music, it's art, not a basic mathematical computation.
Two quavers make a crotchet, not a specific absolute duration in time, as much as ff doesn't indicate a specific decibel amount.

A clear, positive definiton is necessary

But, is it? Even assuming a grad f writing, "how loud" would that f be? And how should it be gradual? Linear? Variable? Logarithmic? Sinusoidal? Cubic? Quadratic? Exponential?
Remember that notation is, as said above, just an abstraction of what becomes interpretation (and perception).

"Therefore these terms burden the readers by requiring too much thought when converting the words into meaning"

I'd say that it's almost pointless. Written music and notation are not [mostly] intended for sight reading performance, since performance is mostly based on careful studying on what's going to be played (or, at least, the knowledge of the notation and style performance). The fact that people could sight read and play on live performance is not important: that's not what written music is about. In fact, there are methods and notation systems specifically developed for live performance that, coincidentally, require former knowledge of standardized symbols and communication.
That said, things like "poco a poco meno piano" should not be considered as proper, nor acceptable standard. Things like these are just wrong, as they are usually based on (wrongly) assumed transliterations that actually make no sense.
I can recall a piece I played some time ago, taken from one of the many transcriptions we got for a famous Strauss waltz:

Yeah, that's obviously a percussion part...
Well, this "more less" doesn't make any sense (in italian, and at all), as much as "poco a poco meno piano" would.
Written notation should ease reading, in a way that players can focus on how to play, not understanding how/what they should play.
The problem with "poco a poco meno piano" is that it introduces a double negative, which creates confusion in music as it creates in language: does "meno piano" indicate "softer than piano" or "louder than piano"?
Coming back to your question, yes, there are common conventions for gradual changes, and they also include "gradually" as much as "poco a poco", but also include variations like "sempre più" or "sempre meno".
Generalized but specific indications for those cases are not useful, nor required. Even if we "decide" a convention for continuous change, the effort of deciding it wouldn't provide any benefit.
In fact, conventions actually exist, as you already pointed out, as it's any writing notation that leads to a more specific notation: a "poco a poco", "gradually", "sempre più/meno" or hairpin that leads to a specific dynamic (or tempo) notation. We don't need a specialized terminology, we just need composers and copyists to properly indicate their intentions.
If you're looking for a standardized terminology for such changes, I doubt there's one.
It's just a progression.
Comment: @rfbw I'd suggest that, especially for novel or rare techniques, textual indications are clearest. Until it becomes commonplace, we hardly need symbols for "gradually shift from _sul tasto_ to _sul ponticello_ and back," or "slowly detune the G string in rising and falling _glissandi_ until slack." The only reason we use a visual, "coded" notation system at all for pitch and tempo is that these are the most frequently manipulated musical constructs.
Comment: I did not mention absolute indications, nor micromanagement (your paragraphs 1 through 7).
Are you implying, with the last three paragraphs, that notation should be invented anew when similar progressions of new qualities (not pitch, volume, tempo) are to be notated?
Answer: In company with my two comments, I'd suggest there is one typographical convention that can clearly convey an ongoing, progressive change: a series of dashes or underscores. This can help clarify intentions: Imagine, printing "cresc." in measure 5 and "dim." in measure 10. Should we continue growing louder and louder through those 5 measures, or does the crescendo run out of steam at some point? What if the dim. is 20 bars later? (True, you could just use elongated pictorial "hairpins" in this case, but the premise holds for markings with no pictograms, like acceleration and deceleration.) So I'd suggest making your intention as clear as possible, probably with text, preferably in the vernacular aside from universally recognized canonic terms ("Transition from pizz. to snap pizz."), followed by dashes indicating the duration of the change.
Comment: Certainly a helpful guide to the eye! But spanners/dashes/dots are not always 'progressive'. In "8va . . . . . ." it only marks the scope. I still need to write that there is progressive change troughout the scope. Would just be cool to make the text short and universal.
Comment: Verbal instruction follow by dash to indicate duration seems clear to me.
Answer: There isn't such a generalized term in music.
If you don't want to use one of the common expression or instruction phrases just write what you want in English. For example: "dampen the string gradually."
Personally, I would not be too specific unless it really, really mattered. For example: "gradually dampen string over whole note until barely audible." That's very specific, but possibly too wordy. It's a judgement call.
It might help to add an example of the instruction you want to handle. It isn't clear why a general, all encompassing term is needed. Plain language instructions will be understood regardless if you mix synonymous terms like "gradual" with "little by little", etc.


How to get permalink of custom post type that filter by category in Wordpress?

Question: I have a custom post type like 'articles' and use built-in categories like 'rock, pop, jazz, etc' to categorised this articles. I have a permalink for 'articles' archive also have permalink to and category archive page like jazz archive page.
But also I want to permalink to articles that filter by specified categories. my archive page also handle this conditions but I can't get permalink for this page!
When I type this address to browser 'index.php?post-type=articles&category-name=jazz' this url redirect to /category/jazz/?post-type=articles but I want this is apear in this format /articles/category/jazz
Comment: You probably have to use the [WP_Rewrite](http://codex.wordpress.org/Class_Reference/WP_Rewrite) class. There should be lots of tutorials on the web. I'd love to give a go at your case but can't right now
Answer: In order to achieve that you first need to register your category with the custom post type and then you can assign categories and have the desired result. Use register_taxonomy_for_object_type(); in order to assign category taxonomy to your custom post type. You can get an example here :  http://codex.wordpress.org/Function_Reference/register_taxonomy_for_object_type
Comment: My Category is built-in wordpress category and in Post Type Registration I assign this type to posy type, In admin panel I see category box, My problem only in url!


Which sequences of $\pm 1$ can appear as the image of a Hilbert symbol

Question: In his book A Course in Arithmetic, Serre adresses the question of which sequences $\pm 1$ can appear as the image of a Hilbert symbol. By this I mean the following: Let $V$ denote the set of places of $\mathbb{Q}$ and let $(a,b)_v$ denote the Hilbert symbol of two numbers $a,b \in \mathbb{Q}^{\times}$ at a place $v \in V$:
Theorem. Let $(a_i)_{i \in I}$ be a finite family of elements in $\mathbb{Q}^{\times}$ and let $(\varepsilon_{i,v})_{i\in I, v \in V}$ be a family of numbers equal to $\pm 1$. In order that there exists $x \in \mathbb{Q}^{\times}$ such that $(a_i,x)_v = \varepsilon_{i,v}$ for all $i \in I$ and all $v \in V$, it is necessary and sufficient that the following conditions be satisfied:

Almost all the $\varepsilon_{i,v}$ are equal to $1$.
For all $i \in I$ we have $\prod_{v \in V} \varepsilon_{i,v}=1$ (i.e. the sequence always satisfies Hilbert reciprocity).
For all $v \in V$ there exists $x_v \in \mathbb{Q}_{\nu}^{\times}$ such that $(a_i,x_v)_v = \varepsilon_{i,v}$ for all $i \in I$.

The above is theorem 4 from section 2.2 of chapter 3 of ibid.
I have two questions concerning this:

Though I have searched quite extensively, I have not been able to find another resource where the question of which binary sequences can appear as the image of a Hilbert symbol is treated. Is anyone aware of any other place where a similar theorem is proved?
We know that property (2.) above (Hilbert reciprocity) applies to any number field (in fact to any global field). Is there a theorem analogous to the above that applies to all number fields / global fields?

Many thanks.
Answer: While I can't answer your questions off the top of my head right now, I can reformulate the theorem from Serre in a more conceptual way.  It is about whether a finite set of quaternion algebras over $\mathbf Q$ have a certain property.
For every field $K$ we have the concept of a quaternion algebra over $K$ (a $4$-dimensional central simple algebra with center $K$). One example is the matrix ing ${\rm M}_2(K)$ and every quaternion algebra over $K$ not isomorphic to that is a division ring. When $K$ does not have characteristic $2$ we can construct examples of quaternion algebras $(a,b)_K$ over $K$ for each $a, b \in K^\times$ in "the usual way". Unlike most fields (such as $\mathbf Q$ or other global fields), over each local field $\mathbf Q_v$ there are exactly two quaternion algebras up to isomorphism, such as ${\rm M}_2(\mathbf R) = (1,1)_\mathbf R$ and $\mathbf H = (-1,-1)_\mathbf R$ over $\mathbf R = \mathbf Q_{\infty}$. For $a, b \in \mathbf Q^\times$ and a place $v$, the Hilbert symbol $(a,b)_v$ being $1$ or $-1$ is equivalent to the quaternion algebra $(a,b)_{\mathbf Q_v}$ over $\mathbf Q_v$ being trivial (that is, being isomorphic to ${\rm M}_2(\mathbf Q_v)$) or nontrivial. A quaternion algebra over $K$ has order $1$ or $2$ in the Brauer group ${\rm Br}(K)$, although the converse is not true for general fields: a tensor product of two quaternion algebras over $K$ might not be equivalent to a quaternion algebra over $K$ in ${\rm Br}(K)$. When $K$ is a global field or a local field, however, ${\rm Br}(K)[2]$ is represented by quaternion algebras over $K$.
From class field theory there is a fundamental exact sequence of Brauer groups.
$$
0 \to {\rm Br}(\mathbf Q) \to \bigoplus_v {\rm Br}(\mathbf Q_v) \to \mathbf Q/\mathbf Z \to 0,
$$
where the map out of ${\rm Br}(\mathbf Q)$ is $[A] \mapsto ([\mathbf Q_v \otimes_{\mathbf Q} A])_v$ and the map out of the direct sum is addition of components where we use the standard isomorphism ${\rm Br}(\mathbf Q_v) \to \mathbf Q/\mathbf Z$ for finite $v$ and ${\rm Br}(\mathbf Q_v) \to (1/2)\mathbf Z/\mathbf Z$ for $v = \infty$.  For quaternion algebras we only need to think about the subgroup of elements killed by $2$:
$$
0 \to {\rm Br}(\mathbf Q)[2] \to \bigoplus_v {\rm Br}(\mathbf Q_v)[2] \to (1/2)\mathbf Z/\mathbf Z \to 0.
$$
With this background in mind, let's describe the data of all the signs $\varepsilon_{i,v}$ in terms of quaternion algebras over $\mathbf Q$.
Properties (1) and (2) in the theorem from Serre's book are about the signs $\varepsilon_{i,v}$, not about the numbers $a_i$ -- the $a_i$ only show up in property (3).
Claim: for each $i$, properties (1) and (2) are equivalent to the data of a quaternion algebra over $\mathbf Q$.
To prove that claim, interpret the sign $\varepsilon_{i,v} \in \{\pm 1\}$ additively as an element of the group $(1/2)\mathbf Z/\mathbf Z \cong {\rm Br}(\mathbf Q_v)[2]$ (groups of order $2$ are isomorphic in only one way).
By the second exact sequence with Brauer groups above, properties (1) and (2) are equivalent to saying that for each $i \in I$, the signs $\varepsilon_{i,\infty}, \varepsilon_{i,2}, \varepsilon_{i,3},\ldots,\varepsilon_{i,v}, \ldots$ correspond to a quaternion algebra $Q_i$ over $\mathbf Q$: property (1) says
the sequence $(\varepsilon_{i,v})_v$ running over all $v$ belongs to $\bigoplus_v {\rm Br}(\mathbf Q_v)[2]$ and property (2) says this sequence is in the kernel of the map to $(1/2)\mathbf Z/\mathbf Z$. That kernel is the image of ${\rm Br}(\mathbf Q)[2]$
by exactness at the direct sum, so there is some quaternion algebra $Q_i$ over $\mathbf Q$ such that the quaternion algebra $\mathbf Q_v \otimes_\mathbf Q Q_i$ over $\mathbf Q_v$ is trivial or nontrivial according to $\varepsilon_{i,v}$ being $1$ or $-1$.
We can in fact say something stronger because the sequence is exact at ${\rm Br}(\mathbf Q)[2]$: $Q_i$ is unique up to isomorphism. In other words, for each $i \in I$ we can replace the signs $\varepsilon_{i,v}$ for all $v$ and properties (1) and (2) for that $i$ by a single (unique up to isomorphism) quaternion algebra $Q_i$ over $\mathbf Q$.   So the theorem in Serre's book can be reformulated as being about a finite set of quaternion algebras $Q_i$ over $\mathbf Q$ and finite set of nonzero rational numbers $a_i$.
In the theorem from Serre's book, the condition $(a_i,x)_v = \varepsilon_{i,v}$ about a Hilbert symbol is equivalent to saying $(a_i,x)_{\mathbf Q_v} \cong \mathbf Q_v \otimes_{\mathbf Q} Q_i$ as quaternion algebras over $\mathbf Q_v$, so the rational quaternion algebras $(a_i,x)_\mathbf Q$ and $Q$ are "locally isomorphic everywhere". Two quaternion algebras $Q$ and $Q'$ over $\mathbf Q$ are isomorphic if and only if $\mathbf Q_v \otimes_\mathbf Q Q$ and $\mathbf Q_v \otimes_\mathbf Q Q'$ are isomorphic quaternion algebras over $\mathbf Q_v$ for all $v$. Therefore saying $(a_i,x)_v = \varepsilon_{i,v}$ for all $v$ is equivalent to saying
$(a_i,x)_\mathbf Q$ and $Q_i$ are isomorphic quaterion algebras over $\mathbf Q$.
Now I can present a reformulation of the theorem from Serre's book. I am going to write the abstract finite index set $I$ as $\{1,\ldots,n\}$ for concreteness.
$\mathbf{Theorem}$. For a finite set of quaternion algebras $Q_1, \ldots, Q_n$ over $\mathbf Q$ and a finite set of nonzero rational numbers $a_1, \ldots, a_n$, in order that there exists an $x \in \mathbf Q^\times$ such that $Q_i \cong (a_i,x)_\mathbf Q$ for $i = 1, \ldots, n$, it is necessary and sufficient that for each place $v$ of $\mathbf Q$ there is an $x_v \in \mathbf Q_v^\times$ such that $\mathbf Q_v \otimes_\mathbf Q Q_i \cong (a_i,x_v)_{\mathbf Q_v}$ for $i = 1, \ldots, n$.
It is very important that the numbers $a_1, \ldots, a_n$ are part of the initial data. If you are given finitely many quaternion algebras $Q_1, \ldots, Q_n$ over $\mathbf Q$ then there are nonzero rational numbers $a_1, \ldots, a_n, x$ such that $Q_i \cong (a_i,x)_\mathbf Q$ for all $i$. This property, where the $a_i$'s are part of the conclusion, is called "strong linkage" for quaternion algebras over $\mathbf Q$ or we say that every finite set of quaternion algebras over $\mathbf Q$ has a "common slot" (the number $x$ appearing in all of those isomorphisms is the "common slot" and we aren't insisting on control over the other slots $a_1, \ldots, a_n$). All global fields have strong linkage (for global fields of characteristic $2$ a different construction of concrete quaternion algebras is needed to give the term "slot" a meaning).  In the theorem of Serre's book, the desired condition is not just a "common slot" $x$ but we want to have control over the other slot too by insisting $Q_i$ have first slot $a_i$. This distinction between whether  the numbers $a_i$ appear in the hypothesis of the theorem (as in Serre) or in the conclusion (the field $\mathbf Q$ has "strong linkage" for its quaternion algebras) is reminiscent of the difference between continuity and uniform continuity of a function $[a,b] \to \mathbf R$ being the ordering of the logical quantifiers.
Hilbert symbols make sense over all global fields (they are a bit more subtle for characteristic $2$ global fields in terms of concrete formulas), so it is straightforward to extend the theorem from Serre's book in terms of Hilbert symbols or in terms of quaternion algebras to all all global fields, and surely that extension to all global fields is still true.  Off the top of my head I do not have a reference for you.


Flutter text form field validation

Question: Hello I am creating a mobile number verification screen. In this I want to validate the Indian mobile number. But my code is not validating and I am not able to understand where the problem is. If the text form field is validated, then the api is called and if the text form field is not validated then the text form field is highlighted with alert. Please help me in resolving this issue.
Form(
        key: _formKeymobile,
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            Text(
              S.of(context).verify,
              style: TextStyle(
                  fontSize: 30.0.sp,
                  fontFamily: 'DancingScript',
                  color: Colors.purple),
            ),
            SizedBox(
              height: 20,
            ),
            TextFormField(
              style: TextStyle(color: Colors.blue, fontSize: 20.0.sp),
              controller: _mobilenumber,
              validator: (value) {
                const pattern =
                    r'(^(?:(?:\+|0{0,2})91(\s*[\ -]\s*)?|[0]?)?[6789]\d{9}|(\d[ -]?){10}\d$)';
                final regExp = RegExp(pattern);
                if (value!.isEmpty) {
                  return S.of(context).EnterSomeText;
                } else if (value.length != 10) {
                } else if (!regExp.hasMatch(value)) {
                  return S.of(context).Mobilenumbermust10digits;
                  return S.of(context).MobileNumbermustbedigits;
                }
              },
              maxLength: 11,
              keyboardType: TextInputType.phone,
              decoration: InputDecoration(
                  hintText: S.of(context).mobile,
                  border: OutlineInputBorder()),
            ),
            SizedBox(
              height: 8.0,
            ),
            Row(
              children: [
                Checkbox(
                  checkColor: Colors.white,
                  value: isChecked,
                  onChanged: (bool? value) {
                    setState(() {
                      isChecked = value!;
                    });
                    // print(isChecked);
                  },
                ),
                SizedBox(
                  width: MediaQuery.of(context).size.width * 0.60,
                  child: Column(
                    children: [
                      Text(S.of(context).tcone),
                      InkWell(
                          onTap: () {
                            openWebsite(

                                context);
                          },
                          child: Text(
                            S.of(context).tctwo,
                            style: TextStyle(color: Colors.blue),
                          )),
                      Text("and"),
                      InkWell(
                          onTap: () {
                            openWebsite(

                                context);
                          },
                          child: Text(
                            S.of(context).tcthree,
                            style: TextStyle(color: Colors.blue),
                          )),
                    ],
                  ),
                )
              ],
            ),
            ElevatedButton(
              onPressed: () async {
                if (isChecked == true) {
                  if (_formKeymobile.currentState!.validate() &&
                      isChecked == true) {
                    String? deviceId = await _getId();
                    if (deviceId != null) {
                      print("api called");
                    } else {
                      EasyLoading.showError("Unable to get device id");
                    }
                  }
                } else {
                  EasyLoading.showError("Please click the box");
                }
              },
              style: ButtonStyle(
                  backgroundColor:
                      MaterialStateProperty.all(Colors.purple)),
              child: Text(S.of(context).otp),
            ),
            SizedBox(
              height: 8.0,
            ),
            ElevatedButton(
              onPressed: () async {
                if (_formKeymobile.currentState!.validate() &&
                    isChecked == true) {
                  print("form validated");
                }
              },
              style: ButtonStyle(
                  backgroundColor: MaterialStateProperty.all(Colors.green)),
              child: Text("Already have OTP"),
            ),
          ],
        )

Answer: try this:
validator: (value) {
                const pattern =
                    r'(^(?:(?:\+|0{0,2})91(\s*[\ -]\s*)?|[0]?)?[6789]\d{9}|(\d[ -]?){10}\d$)';
                final regExp = RegExp(pattern);
                if (value == null || value!.isEmpty) {
                  return S.of(context).EnterSomeText;
                } else if (value.length != 10) {
                } else if (!regExp.hasMatch(value)) {
                  return S.of(context).Mobilenumbermust10digits;
                  return S.of(context).MobileNumbermustbedigits;
                }
              },

and also change this:
onPressed: () async {
                if (_formKeymobile.currentState!.validate() &&
                      isChecked == true) {
                    String? deviceId = await _getId();
                    if (deviceId != null) {
                      print("api called");
                    } else {
                      EasyLoading.showError("Unable to get device id");
                    }
                  } else {
                  EasyLoading.showError("Please click the box");
                }
              },

Comment: glad to hear that, If it was useful to you please approve and up vote it so other people find it easier.

Flutter text form field validation


Multiple Videos using Youtube API

Question: I was wondering that if I have a list of hyperlinks that each one is linked to a Youtube video and I have Youtube player API on the page
var tag = document.createElement('script');
  tag.src = "https://www.youtube.com/iframe_api";
  var firstScriptTag = document.getElementsByTagName('script')[0];
  firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
  var player;
  function onYouTubeIframeAPIReady() {
    player = new YT.Player('player', {
      height: '390',
      width: '640',
      videoId: 'M7lc1UVf-VE',
      events: {
        'onReady': onPlayerReady,
        'onStateChange': onPlayerStateChange
      }
    });
  }

the question is how to make videoId take variables?
so if I have 10 links every time I click on a link the player display that video?
thanks
Answer: You do this with the YouTube IFrame Data API: https://developers.google.com/youtube/iframe_api_reference
You can use loadVideoById() or cueVideoById();
player.loadVideoById({
     videoId: videoId,
     startSeconds: startSeconds,
     endSeconds: endSeconds
   });

Multiple Videos using Youtube API


If $ \cos(\theta) = - \frac{2}{3} $ and $ 450^{\circ} < \theta < 540^{\circ} $, find...

Question: If $ \cos(\theta) = - \frac{2}{3} $ and $ 450^{\circ} < \theta < 540^{\circ} $, find:

The exact value of $ \cos \! \left( \frac{1}{2} \theta \right) $.
The exact value of $ \tan(2 \theta) $.

What I've tried:

I took the square root of $ \sqrt{\frac{1}{2} \left( 1 - \frac{2}{3} \right)} $, which equals the square root of $ \frac{1}{6} $.
I considered the formula $ \sin(x) = \sqrt{1 - {\cos^{2}}(x)} $ and took the square root of $ 1 - \frac{4}{9} $, but I don't know where to go from there.

Thanks in advance!
Comment: Hint: Try fixing ranges for $\theta/2$ and $2\theta$ to determine if their cosine or tangent is positive or negative.
Answer: You were given that $\cos\theta = -\dfrac{2}{3}$, with $450^\circ < \theta < 540^\circ$.
Recall that
$$\cos\left(\frac{\theta}{2}\right) = \pm\sqrt{\frac{1 + \cos\theta}{2}}$$
where the sign is determined by the measure of angle $\frac{\theta}{2}$.  Since $450^\circ < \theta < 540^\circ$, we may conclude that $225^\circ < \frac{\theta}{2} < 270^\circ$, so $\frac{\theta}{2}$ is a third-quadrant angle.  Hence, its cosine is negative.  Thus,
\begin{align*}
\cos\left(\frac{\theta}{2}\right) & = -\sqrt{\frac{1 + \cos\theta}{2}}\\
& = -\sqrt{\frac{1 - \frac{2}{3}}{2}}\\
& = -\sqrt{\frac{\frac{1}{3}}{2}}\\
& = -\sqrt{\frac{1}{6}}
\end{align*}
so you found the correct magnitude but did not take into account into the sign of $\cos(\frac{\theta}{2})$.
To determine $\tan(2\theta)$, we can use the formula
$$\tan(2\theta) = \frac{\sin(2\theta)}{\cos(2\theta)}$$
together with the double angle formulas
\begin{align*}
\sin(2\theta) & = 2\sin\theta\cos\theta\\
\cos(2\theta) & = \cos^2\theta - \sin^2\theta\\
              & = 2\cos^2\theta - 1\\
              & = 1 - 2\sin^2\theta
\end{align*}
Since $450^\circ < \theta < 540^\circ$, $\theta$ is a second-quadrant angle, so $\sin\theta > 0$.  Hence,
\begin{align*}
\sin\theta & = \sqrt{1 - \cos^2\theta}\\
           & = \sqrt{1 - \left(-\frac{2}{3}\right)^2}\\
           & = \sqrt{1 - \frac{4}{9}}\\
           & = \sqrt{\frac{5}{9}}\\
           & = \frac{\sqrt{5}}{3}
\end{align*}
Therefore,
\begin{align*}
\tan(2\theta) & = \frac{\sin(2\theta)}{\cos(2\theta)}\\
              & = \frac{2\sin\theta\cos\theta}{\cos^2\theta - \sin^2\theta}\\
              & = \frac{2\left(\frac{\sqrt{5}}{3}\right)\left(-\frac{2}{3}\right)}{\left(-\frac{2}{3}\right)^2 - \left(\frac{\sqrt{5}}{3}\right)^2}\\
              & = \frac{\frac{-4\sqrt{5}}{9}}{\frac{4}{9} - \frac{5}{9}}\\
              & = \frac{-4\sqrt{5}}{4 - 5}\\
              & = 4\sqrt{5}
\end{align*}


What does the OPMOD mean in the procfiles output in AIX?

Question: I ran the following command on AIX in order to figure out the files opened by process 200866 on AIX 6.1.
procfiles -nc 200866

and got the following sample outputs:
  Current rlimit: 2000 file descriptors
---------------------------------------------------------------------------------------------------------------
 FD    TYPE MODE       DEV/RDEV     UID       GID        OPMOD                                          NAME
---------------------------------------------------------------------------------------------------------------
 10     -   rw-r--r--  10, 4        root      system     R|NH|DY

Can anyone help me understand the meaning of the NH and DY in the OPMOD column?  I googled a lot, but didn't find any relevant pages. Thanks!
Answer: They're simply an abbreviation of the file open mode flags that you see more completely without the -c flag.
I can't find documentation for the abbreviations, but the flag names are detailed in the open() docs. In your specific example, that would be a file open read-only (R), with O_NSHARE (NH) and O_DELAY (DY).
Here's a few with the C snippet that "produced" them.
open("./1", O_RDONLY|O_DELAY);
open("./2", O_RDONLY|O_NDELAY);
open("./3", O_WRONLY);
open("./4", O_RDWR|O_APPEND);
open("./5", O_RDONLY|O_NSHARE);
open("./6", O_RDONLY|O_RSHARE);
open("./7", O_RDWR|O_CIO);

22282268 : ./a.out
 Current rlimit: 32000 file descriptors
---------------------------------------------------------------------------
 FD    TYPE MODE       DEV/RDEV     UID       GID        OPMOD     NAME
---------------------------------------------------------------------------
 0      c   ---------  10, 4(20, 1) xxxxxxxx  xxxxxxxx   R-W|NC    //dev/pts/1
 1      c   ---------  10, 4(20, 1) xxxxxxxx  xxxxxxxx   R-W|NC    //dev/pts/1
 2      c   ---------  10, 4(20, 1) xxxxxxxx  xxxxxxxx   R-W|NC    //dev/pts/1
 3      -   r--r--r--  10, 8        xxxxxxxx  xxxxxxxx   R|DY      /home/xxxxxxxx/1
 4      -   r--r--r--  10, 8        xxxxxxxx  xxxxxxxx   R|NDY     /home/xxxxxxxx/2
 5      -   -w-------  10, 8        xxxxxxxx  xxxxxxxx   W         /home/xxxxxxxx/3
 6      -   rw-r--r--  10, 8        xxxxxxxx  xxxxxxxx   R-W|A     /home/xxxxxxxx/4
 7      -   r--r--r--  10, 8        xxxxxxxx  xxxxxxxx   R|NH      /home/xxxxxxxx/5
 8      -   r--r--r--  10, 8        xxxxxxxx  xxxxxxxx   R|RH      /home/xxxxxxxx/6
 9      -   rw-r--r--  10, 8        xxxxxxxx  xxxxxxxx   R-W|C     /home/xxxxxxxx/7

$ procfiles -n 22282268
22282268 : ./a.out
 Current rlimit: 32000 file descriptors
   0: S_IFCHR mode:00 dev:10,4 ino:28770 uid:29912237 gid:29912237 rdev:20,1
      O_RDWR | O_NOCTTY  name://dev/pts/1
   1: S_IFCHR mode:00 dev:10,4 ino:28770 uid:29912237 gid:29912237 rdev:20,1
      O_RDWR | O_NOCTTY  name://dev/pts/1
   2: S_IFCHR mode:00 dev:10,4 ino:28770 uid:29912237 gid:29912237 rdev:20,1
      O_RDWR | O_NOCTTY  name://dev/pts/1
   3: S_IFREG mode:0444 dev:10,8 ino:62 uid:29912237 gid:29912237 rdev:0,0
      O_RDONLY | O_DELAY size:0  name:/home/xxxxxxxx/1
   4: S_IFREG mode:0444 dev:10,8 ino:63 uid:29912237 gid:29912237 rdev:0,0
      O_RDONLY | O_NDELAY size:0  name:/home/xxxxxxxx/2
   5: S_IFREG mode:0200 dev:10,8 ino:67 uid:29912237 gid:29912237 rdev:0,0
      O_WRONLY size:0  name:/home/xxxxxxxx/3
   6: S_IFREG mode:0644 dev:10,8 ino:68 uid:29912237 gid:29912237 rdev:0,0
      O_RDWR | O_APPEND size:0  name:/home/xxxxxxxx/4
   7: S_IFREG mode:0444 dev:10,8 ino:69 uid:29912237 gid:29912237 rdev:0,0
      O_RDONLY | O_NSHARE size:0  name:/home/xxxxxxxx/5
   8: S_IFREG mode:0444 dev:10,8 ino:70 uid:29912237 gid:29912237 rdev:0,0
      O_RDONLY | O_RSHARE size:0  name:/home/xxxxxxxx/6
   9: S_IFREG mode:0644 dev:10,8 ino:71 uid:29912237 gid:29912237 rdev:0,0
      O_RDWR | O_CIO size:0  name:/home/xxxxxxxx/7


user data migration from xp to windows 7

Question: Do you know any tool/software s to migrate the data from an windows xp user profile to a windows 7 user profile? Besides, the "documents" part, the software that we would like to cover is Outlook, Internet Explorer, firefox and thunderbird?
Preferably, GPL software of course.
BR
christian
PS : Please, I'm looking for a software not how to do it I can figure that out mostly. I just would like to avoid scripting the actions that others should have already done... (I hope ;-)).
Answer: The Files and Settings Transfer Wizard is not supported on Windows 7, but you can installed the Windows 7 equivalent on the XP machine (Windows Easy Transfer), run that to create a .MIG file on an external hard drive, and then run Windows Easy Transfer again on the Windows 7 machine, point it at the file, select which accounts you want to import (and create new local accounts to match, if required), and away you go.
I've used it to migrate 2 users to new Win7 laptops in the last week, and so far, so painless!
Can also be used over a network, or via a special cable (USB-A to USB-A, I think), but the external hard drive solution worked well for me.
Answer: Microsoft offers something as a part of Windows, on XP it's called Files and Settings Transfer wizard, not sure about the name on Win7 though and can't check right now.
This tool is for few users, but there is also the User State Migration Tool 4.0, which is part of the Windows 7 AIK (Automated Installation Kit).


x86, i386, i686, amd64, i5, i7, archtecture, processor confusion

Question: I noticed those items x86, i386, i686, amd64, i5, i7, archtecture, processor from the web, from my own notebook, from book readings.
But I am really confused by those terminologies. I try my best to elaborate my confusion, though you might understand it. The main obstacle ahead is I cannot organize my mind on the mainline behind those terms.

Is there any difference between term architecture and processor?
x86 and i5 are architecture or processor?
What is the relation between OS bit (32-bit windows or 64-bit windows) and x86 bit (32-bit processor, not sure yet)?
The architecture (or processor) mentioned above are all designed by Intel? Is it just a open standard that manufacturers (AMD & Intel) follows?

I have searched the Internet, especially the wikipedia, but the more I read the article there, the more I confused.
Answer: The term architecture covers a lot more than just the processor. There is a lot of other hardware components that are crucial to an OS kernel. The first example that comes to my mind is the interrupt controller, which is separate from the processor, but depending on actual model may be put inside the same chip as the processor.
This entire collection of hardware components, is called the architecture. If you include some core software components as well, you have what is commonly called a platform.
Also the term architecture is a bit more abstract than processor, you'll sometimes architecture referring to the design and processor referring to the physical piece of hardware.
x86 is a family of processors. In that family i386 was the first to have paging and 32 bit support. Lots of software has been written requiring those, so often you'll see software with that processor as their minimum requirement. For standard PCs, the i386 was obsolete decades ago, but it lived longer on some embedded systems.
By the time i686 name was coined, there were enough different processors in the family, that this term doesn't refer to a specific processor. But there is a set of important features, that must be present in order for the i686 term to apply. i686 was state of the art about a decade ago. Today some systems have dropped support for processors without all the features covered by the i686 term.
AMD64 is the name of a 64 bit architecture designed by AMD to succeed x86. At the time AMD64 managed to be more successful than the 64 bit architecture marketed by Intel. This was due to AMD64 CPUs being cheaper, backward compatible, and consuming less power. Eventually Intel realized that they had to start making AMD compatible CPUs to remain competitive. They would however not market them as such, which is a major reason why some synonyms for AMD64 has come into existence.
The term x86 covers all the 8, 16, and 32 bit CPUs in the family, and depending on who you ask also the 64 bit CPUs.
i5 and i7 are sub-families of CPUs manufactured by Intel.
Comment: @TeroKilkanen Wikiepedia mentions the following names: x86-64, x64, x86_64, AMD64, IA-32e, EM64T. All of them are referring to the same architecture. Picking among them is driven by marketing or personal preference, except from cases where you have to follow somebody else's convention due to software compatibility reasons. Of the various terms my personal preference is AMD64, because I think AMD deserves credit for their effort in striking just the right balance between preserving backward compatibility and getting rid of legacy cruft.
Comment: One minor addition, `x64` is the generic term user in Linux that describes AMD64 and Intel's respective 64-bit modes.


Download file from provided URL in Android Studio

Question: I am new. I am trying to write a code in Android Studio - a program to download file using provided URL link. Please help! Thanks!!!
Comment: What is your question?
Comment: please provide a detailed, specified question for your problem. E.g how to download file on android from an provided url?
Answer: To start with , you can look into AsyncTask. Refer this link
Do check the following :

user has an internet connection available
Make sure you have the right permissions (INTERNET and WRITE_EXTERNAL_STORAGE); also ACCESS_NETWORK_STATE if you want to check internet availability.
Make sure the directory were you are going to download files exist and has write permissions.
Use AsyncTask to download file.

For downloading file refer this thread.Its pretty detailed.
Hope this helps
Comment: Thanks! Really appreciate your help! Will look into these info. Regards!


linking error from compiling a cython code calling extern library

Question: i have compiled a C module called edlib for edit distance, then i included it in my project,
setup.py
structureS.pyx
cedlib.pxd
cedlib
|_____include
      |______edlib.h
|_____lib
      |______edlib.lib

but after running python setup build_ext --inplace i have linking error , here is the code ,
#file:setup.py
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
ext_modules = [
    Extension(
        "structureS",
        ["structureS.pyx"],
        extra_compile_args=['/openmp'],
        extra_link_args=['/openmp'],
        include_dirs = ['edlib/include'],
        #libraries = ['edlib'],
        library_dirs = ['edlib/lib'],
        # sources = ['edlib/src/edlibe.cpp']

    )
]
setup(
    name='structureS',
    ext_modules=cythonize(ext_modules),
)

the pxd file was given by the author of the module in this link cedlib.pxd
#structureS.pyx
from cedlib cimport EdlibAlignResult, edlibAlign, edlibDefaultAlignConfig,edlibFreeAlignResult

cdef char* query = "ACCTCTG"
cdef char* target = "ACTCTGAAA"
cdef EdlibAlignResult result = edlibAlign(query, 7, target, 9, edlibDefaultAlignConfig())
if (result.status == 0): #EDLIB_STATUS_OK
    printf("%d", result.editDistance)

edlibFreeAlignResult(result)

here is the error message:

structureS.obj : error LNK2001: symbole externe non résolu edlibFreeAlignResult
structureS.obj : error LNK2001: symbole externe non résolu edlibAlign
structureS.obj : error LNK2001: symbole externe non résolu
  edlibDefaultAlignConfig

note: my project is compiled for 64bit platform , and the module is given configured for 32bit platform, i have tried to compile the module for 64bit with visual studio 2017 without success ,
Comment: why you commented `libraries = ['edlib'],` line?
Comment: because before i have copied the header file and the library file to the compiler folder so i have used  `libraries = ['edlib']` , but with the linking errors , i have copied the files to a folder named edlib as shown in the question above , and i commented the line you mentioned , i think its the same in both cases, so the problem isn't from that
Answer: i solved it, by compiling directly the C module source with the cython source , here is the solution
#file:setup.py

from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
ext_modules = [
    Extension("structureS",
         ["structureS.pyx", "edlib/src/edlib.cpp"],
         include_dirs=["edlib/include"],
         depends=["edlib/include/edlib.h"],
        extra_compile_args=['/openmp'],
        extra_link_args=['/openmp'],
    )
]
setup(
    name='structureS',
    ext_modules=cythonize(ext_modules),
)


adobe edge animation not rendering in iOS 6

Question: I've created a very simple animation in Adobe Edge Animate that animates a box moving from the bottom right to the top left.
I've imported this file (html + all other files) into my Xcode (v4.5.2) project but get a blank white screen in the simulator. I know my project is fine because if I copy a static html page into the project it renders correctly.
Any ideas?
Answer: since the difference between your project and the test page is that your project links to javascript files while the test page did not, maybe you should run a test with a page that calls a simple javascript library.
Answer: There are a few threads on adobe forum about some problems with projects opened on ios 6 devices. Maby this also concerns your project.
http://forums.adobe.com/message/4767681
Try to call this method and add some js code to your webview's document:
[webView stringByEvaluatingJavaScriptFromString:@"window.requestAnimationFrame = window.setTimeout;"];


Integral representation of Bessel function $K_v(y) = \frac{1}{2} \int_{0}^{\infty} t^{v-1} \text{exp}(-\frac{1}{2}y(t+t^{-1}))\text{d}t$.

Question: How does one find the following representation of the bessel function $K_v(y)$:
$$K_v(y) = \frac{1}{2} \int_{0}^{\infty} t^{v-1} \exp \left(-\frac{1}{2}y\left(t+t^{-1}\right) \right)\,\mathrm{d}t.$$
I have seen many different integral presentations in different sources but couldn't find a proof for this one.
Comment: @Startwearingpurple Well none of the books I'm reading gives this one as the definition. Im mostly using the book by Lebedev which defines $K_v(y)$ using $I_v(z)$ which is given as a series. But I've seen proofs for some of the integral representations but not for this one.
Comment: where does this beauty come from?
Comment: @tired If I remember right I think I first found this in a book by Y. Motohashi.
Comment: For me this is the definition of $K_{\nu}$. What is your preferred definition?
Comment: I don't think expressing $K_v$ in terms of $I_{\pm v}$ is the right way of looking at this function. It is useful as the solution of Bessel equation having nice canonical behavior at infinity (irregular singular point) instead of zero (regular one). The integral representation comes from the fact that Bessel equation appears when one separates the variables in 2D Helmholtz equation: namely, it expresses the corresponding solution as a superposition of plane waves.
Comment: @Startwearingpurple Well that is true. Maybe I should take this one as the definition since I don't need any other properties of $K_v(y)$.
Answer:
I have seen many different integral presentations in different sources

Hint: In that case, let $t=e^u,$ maybe it will jog your memory$\ldots$ ;-$)$
Comment: That actually might work.. there is one step however where I'm stuck at: I can proof for example that $K_v(y)=\int_{0}^{\infty} e^{-y(\text{cosh}(t))} \text{cosh}(vt) \text{d}t$. After letting $z=e^{t}$ I get $\frac{1}{2} \int_{-\infty}^{\infty} e^{-\frac{y}{2} (z+z^{-1}) }(z^{v-1}+z^{-v-1})\text{d}z$. Then I tried to separate the integral to parts from $(-\infty, 0]$ and $[0, \infty)$ but couldn't get to the form I'm looking for (it's close though). Any tips for that?


VBA Loop through table columns names and combine data in a new sheet

Question: I have 2 tables on separate tabs that have a number of columns with the same names.  I'd like to combine the data for these 2 tables into a new table on a 3rd tab.
I've tried experiment with a number of ways to do this like just hard coding the column location (like A,B,C..) and manually coding in the 20 or so columns that I need to copy and paste over.  However, I'd rather run through a loop of an array of the column titles I need to copy, grab the data and append to the 3rd table. That way if the locations move it keeps working and I only have to worry about the column titles. I'm not that advanced on using arrays or working with named tables in VBA so I was hoping someone could help me out.
Example:
Dim arr1 As Variant
Dim vItm As Variant
Dim tbl1 As ListObject
Dim tbl2 As ListObject
Dim tbl3 As ListObject

arr1 = Array("Header1", "Header2", "Header3")
Set tbl1 = Worksheets("Sheet1").ListObjects("Table1")
Set tbl2 = Worksheets("Sheet2").ListObjects("Table2")
Set tbl3 = Worksheets("Sheet3").ListObjects("Table3")

For Each vItm In arr1

    Set c = tbl2.ListColumns(vItm).DataBodyRange

    If Not c Is Nothing Then
        col = c.Column

          With tbl2.DataBodyRange
            tRows = .Rows.Count
            tCols = .Columns.Count
            Set CopyRng = .Range(.Cells(0, col), .Cells(tRows - 1, col))

          End With

          Set Dest = tbl1.HeaderRowRange.Find(vItm, LookIn:=xlValues, LookAt:=xlWhole, _
            MatchCase:=False, SearchFormat:=False)

          MsgBox Dest.Address

    Else
        MsgBox "Header not found"
        Exit Sub
    End If
Next vItm

For each column title in the array look in Table1 and copy all data below and paste in the corresponding column title in Table3.  Do this with all array items. Then for each column title in the array look in Table2 and copy all data below and paste in the corresponding column title in Table3 below the data that came from Table1.
Appreciate any help here.  Thanks!
Comment: You can use Find() to locate each of the column headers, so I would start with that, try writing some code, then post back when/if you run into a specific problem.  Right now your question is a little too broad - the approach you describe is reasonable, so try making a start.
Comment: @TimWilliams I updated the code in my original post to give an update of where I got to on this.  Right now I'm up to the point where I think I've got the correct data being copied on each loop and the correct destination column in the table I'll be consolidating data. I'm kind of stuck now cause it not clear how I should offset the destination cell to append the data below the last active row in the destination table. And then I would still need to loop through the 3rd table and do the same.
Answer: I think I've resolved most of my issues references the correct tables and data to copy and move over. I will post the finished code in my original question. However now I am having issues with some variables not updating correctly. Like this bit of code at the end of my sub. I reuse copyrng, lastrow, and lastcol from previous section.  When I debug, the lastrow and lastcol show the correct number but the copy range is only selecting column O (#15) down to the last row.  Any idea what is causing this or how to reset the variables?
With tbl3.DataBodyRange
CopyRng = .Range(Cells(1, 16), .Cells(lastRow, lastCol))

    With CopyRng
        .Copy
        Debug.Print .Address
        Debug.Print lastCol
    End With

End With
Comment: the first `Cells` is missing a dot in front of it