Epsilon Induction implies Axiom Of Foundation (Or Regularity)

Question: I know that, given the other Zermelo-Fraenkel Axioms, Epsilon Induction is equivalent to the Axiom Of Foundation.
I've proven that Axiom Of Foundation implies Epsilon Induction, but i can't prove the other implication. Any suggest?
Answer: This is similar to Brian's answer but with fewer negations.  Prove, by $\in$-induction on $x$ that "Every set $u$ that contains $x$ (as an element) has an $\in$-minimal member, i.e., there is $y\in u$ with $y\cap u=\varnothing$." The point is that, if $x$ itself isn't a minimal member of $u$, then there is some $x'\in x\cap u$, and you can apply the induction hypothesis to $x'$.
Comment: This is a nice proof really, its very DIRECT. The induction HYPOTHESIS is: $$\forall x \, ([\forall y \in x : \forall z (y \in z \to z \text{ has a minimal})] \to \\\forall u (x \in u \to u \text{ has a minimal})) $$, then the CONCLUSION is: *every nonempty set has a minimal* (which is axiom of Regularity). Proving the induction hypothesis is easy: either $x$ is a minimal of $u$ (i.e.; $x \cap u =\varnothing$), or there is $x' \in x \cap u$, then we apply $x'$ instead of $y$ and $u$ instead of $z$ in the the *antecedent* of the induction hypothesis and we get $u \text { has a minimal}$
Answer: The contrapositive of $\in$-induction says that if $\varphi(x)$ fails for some set $x$, then there is a set $x$ such that $\varphi(y)$ holds for each $y\in x$, but $\varphi(x)$ fails. Now let $a$ be any set, and let $\varphi_a(x)$ be the formula $x\notin a$. Use the contrapositive to show that either $a=0$, or there is an $x\in a$ such that $x\cap a=0$.
Comment: using the same symbol at different quantification is economic but confusing. It would be clearer if we use different symbols, so to rephrase: .... if $\varphi(k)$ fails for some set $k$, then there is a set $x$ such that $\varphi(y)$ holds for each $y \in x$, but $\varphi(x)$ fails.
Comment: @Zuhair: I don't find that one bit clearer; it just introduces a completely unnecessary symbol. What might actually be slightly clearer for some readers is this: The contrapositive of $\in$-induction says that if $\varphi(x) fails for some $x$, then in particular it fails for some set $x$ such that $\varphi(y)$ holds for each $y\in x$.
Comment: What is clear and what is not, is very subjective. But, it is generally easier to use separate symbols when you have different quantification scopes, otherwise one would confuse quantifications. For a beginner it is easier. This becomes obvious when one works out the last sentence of yours. The proof is otherwise very nice.
Comment: @Zuhair: Of course it's subjective. The fact remains that what you find obvious, I find invisible. Some 40 years of teaching experience make me think that the change that you suggest is unlikely to make the argument more accessible to students in general, so I see no good reason here to change the name of the variable (or for that matter to worry about quantification) — *except* when experimenting with alternative explanations when helping an individual student who for some reason is having trouble.
Comment: The error comes from quick reading actually. Otherwise there would be no problem if one writes matters down and take care not to confuse quantification scopes. Upon quick reading of your last sentence (which begins from "Now let $a$...") one may confuse matters for $x$ being a parameter running over the whole contrapositive, and so misread matters to $\forall x (x  \in a \implies \forall y \in x (y \not \in a))$, and so hastily conclude that either $a=\emptyset$ or that for *every* $x \in a$ we have $x \cap a=\emptyset$. I think the very beginner might fall a prey to that as well? Anyhow
Answer: Define $Unending \ chain$: $$ Unending \ chain (c) \iff \forall m \in c \ [\exists n \in m \ (n \in c)]$$
Define $WF(x)$ $$WF(x) \iff \neg \exists c \ (Unending \ chain (c) \wedge x \in c)$$
Now take any arbitrary set $a$, if every member of $a$ is not a member of some Unending chain (i.e. all are well founded), then clearly $a$ would be well founded!  since if otherwise we'll have an Unending chain $c$ with $a \in c$, but by then there will exist an element $n$ of $a$ such that $n \in c$, but $c$ is an Unending chain, and the existence of such an element $n$ clearly contradicts the condition that all elements of $a$ are not elements of unending chains.
So the antecedent of Epsilon induction is fulfilled for the property $WF$, so all sets fulfill $WF$. Which is Regularity! that is "every Unending chain is empty", i.e. every set is well founded.
Comment: I find this to be clearer.
Comment: It is indeed clearer, so I managed to verify it: https://github.com/georgydunaev/zfc/blob/master/3_Regularity.v
Comment: Other than posting what is essentially Andreas Blass' answer, *from nearly five years ago*, only with a contradiction instead of a simple direct proof, is there a point to this answer?


Winning pitcher when tied

Question: I have read the rules and threads but I am still unclear about this situation
The home team starting pitcher leaves the game after 6 innings leading 3-2. The relief pitcher comes in at the 7th. The visiting team ties the game. At the bottom of the 9th, the home team scores and wins.
Who is the winning pitcher? I say the relief pitcher and my son says the  starting pitcher, since the visitors never went ahead.
What is the correct answer and why?
Comment: Note it's the pitcher that records the last out of the 9th in this case, which is not necessarily the same pitcher who came in to start the 7th, that gets the win.
Answer: You are correct (at least for MLB). Quoting from the MLB rulebook, Rule 9.17 "Winning and Losing Pitcher":

Rule 9.17(a) Comment: Whenever the score is tied, the game
becomes a new contest insofar as the winning pitcher is concerned.

For other leagues, you would have to refer to the rulebook for that league but just about everybody copies MLB anyway.

Winning pitcher when tied


Package with React 17 use in react 16

Question: Is there a way to use a package that is build with React 17.0.2 to use in React 16.3.1?
Our Project is quite old (React version 16.3.1) and we like to use the react-battery-gauge in our project. Is that possible or is the only way to upgrade our project?
Comment: Why don't you upgrade your React version? It has minor breaking changes that will likely not effect you https://legacy.reactjs.org/blog/2020/08/10/react-v17-rc.html And even going to React 18 is not a big change
Answer: Using a package built for React 17.0.2 in a React 16.3.1 project is generally not recommended and can lead to compatibility issues. React versions often introduce changes, and packages may rely on features or APIs that are not available in earlier versions.

Package with React 17 use in react 16


How small a quantity should be added to x to avoid taking the log of zero?

Question: I have analysed my data as they are. Now I want to look at my analyses after taking the log of all variables. Many variables contain many zeros. Therefore I add a small quantity to avoid taking the log of zero.
So far I've added 10^-10, without any rationale really, just because I felt like adding a very small quantity would be advisable to minimize the effect of my arbitrarily chosen quantity. But some variables contain mostly zeros, and therefore when logged mostly -23.02. The range of the ranges of my variables is 1.33-8819.21, and the frequency of zeroes also varies dramatically. Therefore my personal choice of "small quantity" affects the variables very differently.
It is clear now that 10^-10 is a completely unacceptable choice, as most of the variance in all the variables then comes from this arbitrary "small quantity".
I wonder what would be a more correct way of doing this.
Maybe it's better to derive the quantity from each variables individual distribution? Are there any guidelines about how big this "small quantity" should be?
My analyses are mostly simple cox models with each variable and age/sex as IVs. The variables are the concentrations of various blood lipids, with often considerable coefficients of variation.
Edit: Adding the smallest non-zero value of the variable seems practical for my data. But maybe there is a general solution?
Edit 2: As the zeros merely indicate concentrations below the detection limit, maybe setting them to (detection limit)/2 would be appropriate?
Comment: Do you have this issue with the response variable or just the explanatory variables? If only the latter, then depending on sample size considerations one option may be to add *additional* dummy variables indicating the concentration of of a given analyte was below the detection threshold. This soaks up degrees of freedom, but has the advantage of not imposing an arbitrary ad hoc choice on the data. It also may uncover nonlinearities or discontinuities near the detection threshold that might otherwise go accounted for.
Comment: If you add $1$ to your variables, the variables that were zeroes on the orginal scale will be zeroes on the log scale.
Comment: Why are you taking $\log$ of the observations/variables?
Comment: An alternative would be to take, say, the cube root of the data - doesn't get you all the way to the log, but preserves zeroes w/o rescaling.
Comment: I have to agree with Procrastinator.  My first thought was that the log transformation is inappropriate for data that contain several zero values.  @miura I think the idea that has the greatest appeal is using half of the detection limit as that is a sensible estimate of the true value.  But even if you do that you have given no spread to numbers that are really variable but cluster at zero because of truncation.
Comment: @Procrastinator Log scale is natural for concentrations because of the exponential relation between equilibrium constant and Gibbs energy; in fact in "continuous" chemistry 0 concentration is somewhat unreal.
Comment: @miura Note also that in a [regression/cox](http://www.medicine.ox.ac.uk/bandolier/painres/download/whatis/cox_model.pdf) model there is no assumption on the distribution of the explanatory variables.
Comment: This Q is also possibly relevant to this discussion: [How should I transform non-negative data including zeros](http://stats.stackexchange.com/questions/1444/).
Comment: The distribution of the variables varies a lot. Some variables look as if they were log-normally distributed. We don't want to overlook associations of the magnitude order of variables due to only looking at associations of their levels.
Comment: @ MånsT: Yes, but then, when the range of a variable is approximately 1, as it is for some, I am adding the range to it. That kind of feels like a substantial intervention (?)
Comment: @ Procrastinator: Thanks, I was only partially aware of that. We are transforming here primarily not to fit model assumptions but to increase sensitivity. @ MånsT: This is what I mean: http://dl.dropbox.com/u/2880299/logcomp.png
Comment: Add the smallest real value that your machine/language platform recognises.
Comment: We see a lot of elaborate suggestions in the answers but I still think that staying away from the log transformation is really the best advice. Maybe try jbowman's suggestion. I think LOQ and LOD are essentially the same.  The first stands for limit of quantization and the second limit of detection.  Athough they may technically be different they both refer to the inability to measure a value between 0 and the limit and can be treated statistically the same way.
Comment: @jbowman and Michael Chernick: Cube root sounds good, although in this particular case the decision is not mine.
Comment: @cardinal: The DV in my cox model is survival (event/time) data, and not altering the data seems very attractive. But I'm not clear on how a dummy variable would work (if the dummy indicates "value below LoD", the analyte would be set to missing? could the model cope with that? also I am expected to report one p value per analyte)
Answer: Chemical concentration data often have zeros, but these do not represent zero values: they are codes that variously (and confusingly) represent both nondetects (the measurement indicated, with a high degree of likelihood, that the analyte was not present) and "unquantified" values (the measurement detected the analyte but could not produce a reliable numeric value).  Let's just vaguely call these "NDs" here.
Typically, there is a limit associated with an ND variously known as a "detection limit," "quantitation limit," or (much more honestly) a "reporting limit," because the laboratory chooses not to provide a numerical value (often for legal reasons).  About all we really know of an ND is that the true value is likely less than the associated limit: it's almost (but not quite) a form of left censoring.  (Well, that's not really true either: it's a convenient fiction.  These limits are determined via calibrations which, in most cases, have poor to terrible statistical properties.  They may be grossly over- or under-estimated.  This is important to know when you're looking at a set of concentration data which appear to have a lognormal right tail which is cut off (say) at $1.33$, plus a "spike" at $0$ representing all the NDs.  That would strongly suggest the reporting limit is just a little less than $1.33$, but the lab data might try to tell you it is $0.5$ or $0.1$ or something like that.)
Extensive research has been done over the last 30 years or so concerning how best to summarize and evaluate such datasets.  Dennis Helsel published a book on this, Nondetects and Data Analysis (Wiley, 2005), teaches a course, and released an R package based on some of the techniques he favors.  His website is comprehensive.
This field is fraught with error and misconception.  Helsel is frank about this: on the first page of chapter 1 of his book he writes,

...the most commonly used method in environmental studies today, substitution of one-half the detection limit, is NOT a reasonable method for interpreting censored data.

So, what to do?  Options include ignoring this good advice, applying some of the methods in Helsel's book, and using some alternative methods.  That's right, the book is not comprehensive and valid alternatives do exist.  Adding a constant to all values in the dataset ("starting" them) is one.  But consider:

Adding $1$ is not a good place to start, because this recipe depends on the units of measurement.  Adding $1$ microgram per deciliter will not have the same result as adding $1$ millimole per liter.
After starting all the values, you will still have a spike at the smallest value, representing that collection of NDs.  Your hope is that this spike is consistent with the quantified data in the sense that its total mass is approximately equal to the mass of a lognormal distribution between $0$ and the start value.
An excellent tool for determining the start value is a lognormal probability plot: apart from the NDs, the data should be approximately linear.
The collection of NDs can also be described with a so-called "delta lognormal" distribution.  This is a mixture of a point mass and a lognormal.

As is evident in the following histograms of simulated values, the censored and delta distributions are not the same.  The delta approach is most useful for explanatory variables in regression: you can create a "dummy" variable to indicate the NDs, take logarithms of the detected values (or otherwise transform them as needed), and not worry about the replacement values for the NDs.

In these histograms, approximately 20% of the lowest values have been replaced by zeros.  For comparability, they are all based on the same 1000 simulated underlying lognormal values (upper left).  The delta distribution was created by replacing 200 of the values by zeros at random.  The censored distribution was created by replacing the 200 smallest values by zeros.  The "realistic" distribution conforms to my experience, which is that the reporting limits actually vary in practice (even when that is not indicated by the laboratory!): I made them vary randomly (by just a little bit, rarely more than 30 in either direction) and replaced all simulated values less than their reporting limits by zeros.
To show the utility of the probability plot and to explain its interpretation, the next figure displays normal probability plots related to the logarithms of the preceding data.

The upper left shows all the data (before any censoring or replacement).  It's a good fit to the ideal diagonal line (we expect some deviations in the extreme tails).  This is what we are aiming to achieve in all the subsequent plots (but, due to the NDs, we will inevitably fall short of this ideal.) The upper right is a probability plot for the censored dataset, using a start value of 1.  It's a terrible fit, because all the NDs (plotted at 0, because $\log(1+0)=0$) are plotted much too low.  The lower left is a probability plot for the censored dataset with a start value of 120, which is close to a typical reporting limit.  The fit in the bottom left is now decent--we only hope that all these values come somewhere near to, but to the right of, the fitted line--but the curvature in the upper tail shows that adding 120 is starting to alter the shape of the distribution.  The bottom right shows what happens to the delta-lognormal data: there's a good fit to the upper tail, but some pronounced curvature near the reporting limit (at the middle of the plot).
Finally, let's explore some of the more realistic scenarios:

The upper left shows the censored dataset with the zeros set to one-half the reporting limit.  It's a pretty good fit.  On the upper right is the more realistic dataset (with randomly varying reporting limits).  A start value of 1 does not help, but--on the lower left--for a start value of 120 (near the upper range of the reporting limits) the fit is quite good.  Interestingly, the curvature near the middle as the points rise up from the NDs to the quantified values is reminiscent of the delta lognormal distribution (even though these data were not generated from such a mixture).  On the lower right is the probability plot you get when the realistic data have their NDs replaced by one-half the (typical) reporting limit.  This is the best fit, even though it shows some delta-lognormal-like behavior in the middle.
What you ought to do, then, is to use probability plots to explore the distributions as various constants are used in place of the NDs.  Start the search with one-half the nominal, average, reporting limit, then vary it up and down from there.  Choose a plot that looks like the bottom right: roughly a diagonal straight line for the quantified values, a quick drop-off to a low plateau, and a plateau of values that (just barely) meets the extension of the diagonal.  However, following Helsel's advice (which is strongly supported in the literature), for actual statistical summaries, avoid any method that replaces the NDs by any constant.  For regression, consider adding in a dummy variable to indicate the NDs.  For some graphical displays, the constant replacement of NDs by the value found with the probability plot exercise will work well.  For other graphical displays it may be important to depict the actual reporting limits, so replace the NDs by their reporting limits instead.  You need to be flexible!
Comment: Extremely nice answer! I completely agree. And I'm familiar with the feeling when you look at the data and realize that before it has been transformed "as usual" there was a perfectly useful data set...
Comment: There's an entire field, "chemometrics," devoted to this and related subjects, and entire books have been written (and continue to be written) dealing solely with what a "limit of detection" is. I have encountered more than 20 distinct definitions! The issue of re-expressing a variable (such as taking its logarithm) is also a key one in data analysis and data exploration; large parts of many books (especially books on exploratory data analysis) focus on that issue.
Comment: @user2390246 It doesn't matter.  See https://stats.stackexchange.com/a/4833/919.
Comment: **varying limits**: several different approaches to calculated  both LOD (limit of detection -> for qualitative answers) and LOQ (limit of quantitiation, which is for quantitative measurements) exist. I guess one lab will usually not change the method how these are calculated (for the same anaytical method). However, these values are recalculated every time the calculation is done. If the method needs calibration every working day, then every day you'll have a (slightly) different limit.
Comment: **limits and legal reasons for not providing low numbers:** legal reasons would not forbid giving (additional) more verbose information like raw signal, corresponding concentration and confidence interval / judgment of the measurement (e.g. "below LOQ"). Also, you may ask the analysis lab for the calibration curve. I'd expect that you have to pay for that as it is extra work, but I'd expect this to be possible. The cheaper compromise may be that they give you all teh raw data and leave the data analysis to you. It may help if they know you're statistician/chemometrician/analytical chemist/...
Comment: In my job we often encounter zeros because the data are rounded. In such a case these are grouped data, see http://stats.stackexchange.com/questions/26950/statistics-for-rounded-data
Comment: "For regression, consider adding in a dummy variable to indicate the NDs" - would you be able to expand on how this would work (or perhaps provide a reference)? Am I right in thinking that the NDs would still need to take some kind of value in the continuous variable, or else the model would not be able to run? Aren't we still left with the question of how to determine that value?
Comment: @whuber Sorry, I mean for the continuous variable. There will be two predictors, the dummy (1 or 0) and the continuous (containing both NDs and other values). How to define the NDs in the continuous variable?
Comment: Just to seek a tiny bit of clarification, in your last paragraph are you suggesting a single dummy across all analytes for the presence of an ND or one such dummy per analyte? I suspect the latter, similar to my (buried) remark to the OP.
Comment: @cardinal (sorry, this answer had to be written hastily): the analysis has to be performed separately for each analyte, because they typically have dramatically different RLs and of course have different empirical distributions. On occasion a bit of multivariate analysis can help when multiple analytes are measured in a common test (as in a GC-MS scan), but in practice that can be limited to some contingency tables (counting quantified vs. ND values).
Comment: Well this answer had to be read hastily as well (as you can tell from my query). Thanks for the clarification. In multivariate studies one might be concerned with ND interactions; often typical sample sizes inhibit much exploration of that.
Comment: Very interesting. I wouldn't have expected that the problem is this exacting.
Comment: +1, really nice, as I would expect since this is your field. For reference, [here](http://www.amazon.com/Nondetects-Data-Analysis-Statistics-Environmental/dp/0471671738) is a link to the book you reference.
Comment: @user2390246 It doesn't matter what value you use.  $1$ is traditional because it is easily interpreted.  Thus, the dummy value is $1$ for all observations with an ND and $0$ otherwise.
Answer:
As the zeros merely indicate concentrations below the detection limit, maybe setting them to (detection limit)/2 would be appropriate

I was just typing that the thing that comes to my mind where log does (frequently) make sense and 0 may occur are concentrations when you did the 2nd edit. As you say, for measured concentrations the 0 just means "I couldn't measure that low concentrations".
Side note: do you mean LOQ instead of LOD?
Whether setting the 0 to $\frac{1}{2}$LOQ is a good idea or not depends:

from the point of view that $\frac{1}{2}\mathrm{LOQ}$ is your "guess" expressing that c is anywhere between 0 and LOQ, it does make sense.
But consider the corresponding calibration function:

On the left, the calibration function yields c = 0 below the LOQ. On the right, $\frac{1}{2}\mathrm{LOQ}$ is used instead of 0.
However, if the original measured value is available, that may provide a better guess. After all, LOQ usually just means that the relative error is 10%. Below that the measurement still carries information, but the relative error becomes huge.

(blue: LOD, red: LOQ)
An alternative would be to exclude these measurements. That can be reasonable, too
e.g. think of a calibration curve. In practice you often observe a sigmoid shape: for low c, signal ≈ constant, intermediate linear behaviour, then detector saturation.

In that situation you may want to restrict yourself to statements about concentrations that are clearly in the linear range as both below and above other processes heavily influence the result.
Make sure you explain that the data was selected that way and why.

edit: What is sensible or acceptable, depends of course on the problem. Hopefully, we're talking here about a small part of the data that does not influence the analyis.
Maybe a quick and dirty check is: run your data analysis with and without excluding the data (or whatever treatment you propose) and see whether anything changes substantially.
If you see changes, then of course you're in trouble. However, from the analytical chemistry point of view, I'd say your trouble does not primarily lie in which method you use to deal with the data, but the underlying problem is that the analytical method (or its working range) was not appropriate for the problem at hand. There is of course a zone where the better statistical approach can save your day, but in the end the approximation "garbage in, garbage out" usually holds also for the more fancy methods.
Quotations for the topic:

A statistician once told me:

The problem with you (chemists/spectroscopists) is that your problems are either so hard that they cannot be solved or so easy that there is no fun in solving them.

Fisher about the statistical post-mortem of experiments
Comment: I love the quote at the bottom (+1).
Answer: @miura
I came across this article by Bill Gould on the Stata blog (I think he actually founded Stata) which I think could provide help with your analysis. Near the end of the article he cautions against the use of arbitrary numbers that are close to zero, such as 0.01, 0.0001, 0.0000001, and 0 since in logs they are -4.61, -9.21, -16.12, and $-\infty$. In this situation they are not arbitrary at all. He advises the use of a Poisson regression since it recognizes that the above number are actually close together.
Answer: To clarify how to deal with the log of zero in regression models, we have written a pedagogical paper explaining the best solution and the common mistakes people make in practice. We also came out with a new solution to tackle this issue.
You can find the paper by clicking here:  https://ssrn.com/abstract=3444996
First, we think that ones should wonder why using a log transformation. In regression models, a log-log relationship leads to the identification of an elasticity. Indeed, if $\log(y) = \beta \log(x) + \varepsilon$, then $\beta$ corresponds to the elasticity of $y$ to $x$. The log can also linearize a theoretical model. It can also be used to reduce heteroskedasticity. However, in practice, it often occurs that the variable taken in log contains non-positive values.
A solution that is often proposed consists in adding a positive constant c to all observations $Y$ so that $Y + c > 0$. However, contrary to linear regressions, log-linear
regressions are not robust to linear transformation of the dependent variable. This
is due to the non-linear nature of the log function. Log transformation expands low
values and squeezes high values. Therefore, adding a constant will distort the (linear)
relationship between zeros and other observations in the data. The magnitude of the
bias generated by the constant actually depends on the range of observations in the
data. For that reason, adding the smallest possible constant is not necessarily the best
worst solution.
In our article, we actually provide an example where adding very small constants is actually providing the highest bias. We provide derive an expression of the bias.
Actually, Poisson Pseudo Maximum Likelihood (PPML) can be considered as a good solution to this issue. One has to consider the following process:
$y_i = a_i \exp(\alpha + x_i' \beta)$ with $E(a_i | x_i) = 1$
This process is motivated by several features. First, it provides the same interpretation
to $\beta$ as a semi-log model. Second, this data generating process provides a logical
rationalization of zero values in the dependent variable. This situation can arise when
the multiplicative error term, $a_i$ , is equal to zero. Third, estimating this model with PPML does not encounter the computational difficulty when $y_i = 0$. Under the assumption that $E(a_i|x_i) = 1$, we have $E( y_i - \exp(\alpha + x_i' \beta) | x_i) = 0$. We want to minimize the quadratic error of this moment, leading to the following first-order conditions:
$\sum_{i=1}^N ( y_i - \exp(\alpha + x_i' \beta) )x_i' = 0$
These conditions are defined even when $y_i = 0$. These first-order conditions are numerically equivalent to those of a Poisson model, so it can be estimated with any standard statistical software.
Finally, we propose a new solution that is also easy to implement and that provides unbiased estimator of $\beta$. One simply need to estimate:
$\log( y_i + \exp (\alpha + x_i' \beta)) =  x_i' \beta + \eta_i $
We show that this estimator is unbiased and that it can simply be estimated with GMM with any standard statistical software. For instance, it can be estimated by executing just one line of code with Stata.
We hope that this article can help and we'd love to get feedback from you.
Christophe Bellégo and Louis-Daniel Pape,
CREST - Ecole Polytechnique - ENSAE
Answer: You can set the zeros of the $i^{th}$ variable to the ${\rm mean}(x_i) - n\times{\rm stddev}(x_i)$ where $n$ is large enough to distinguish these cases from the rest (e.g., 6 or 10).
Note that any such artificial setup will affect your analyses so you should be careful with your interpretation and in some cases discard these cases to avoid artifacts.
Using the detection limit is also a reasonable idea.


Pull-up toolbar using only HTML and CSS in Android browser

Question: I have a toolbar at the bottom of my mobile webapp. I'd like to be able to drag this toolbar up and down, revealing content underneath it. I'd like to be able to do this simply by using HTML/CSS, and not having to use touch/scroll events or mobile touch/scroll libraries.
I am trying to do this by overlaying a scrolling element on top of the main webapp with the toolbar and its content at the bottom. I've given this element a lower z-index than the main content so that it doesn't block the user from interacting with the main content, and given the toolbar and its content a higher z-index so that it can be seen and pulled/scrolled up.
I have created a jsFiddle that has the correct behaviour in both desktop and Android versions of Chrome. I can drag up the toolbar with my finger or by scrolling with my cursor on top of it:

Unfortunately, the toolbar does not appear in the Android browser (tested on 4.1 and 4.2).

However when I press where the toolbar should be and drag up, it doesn't scroll the page until I have moved my finger far enough to have scrolled the toolbar all the way up, if it were visible. This is how scrolling the toolbar works in Chrome, and indicates that the toolbar is scrolling properly in the Android browser. It just isn't visible.

Toolbar

Toolbar content

#main-content {
    position:relative;
    width:100%;
    height:300px;
    background-color:green;
    z-index:1;
}
#scroller {
    position:absolute;
    top:0;
    width:100%;
    height:300px;
    overflow:auto;
}
#wrapper {
    position:relative;
    width:100%;
    height:500px;
}
#toolbar-and-content {
    position:absolute;
    bottom:0;
    width:100%;
    height:250px;
    z-index:2;
}
#toolbar {
    width:100%;
    height:49px;
    border-bottom:1px solid black;
    background-color:red;
}
#toolbar-content {
    width:100%;
    height:200px;
    background-color:orange;
}

I figure it doesn't work on the Android browser because it is deciding to ignore the toolbar's higher z-index, since it's in an element with a lower z-index.
Either way, does anyone know how I might be able to change this so that it would work on the Android browser, and/or are there other layout schemes I can use to achieve what I desire through only HTML/CSS?
Answer: I tested your example in Emulator, try add:
z-index: 2;

to your #scroller:
#scroller {
    position:absolute;
    top:0;
    width:100%;
    height:300px;
    overflow:auto;
    z-index: 2; // NEW
}

Worked fine for me
Why do you need z-index on #main-content? If you could just skip it than it would work even without additional z-index on #scroller.


Exposed Form not showing even in preview of view

Question: I am using a simple view, and exposed filter to let user chose post by content-type. Exposed Form however not appearing, not even in views preview. I am using Bartik as front-end theme and seven as admin theme.
<code>$view = new view();
$view->name = 'admin_dashboard';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'Admin Dashboard';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'Admin Dashboard';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '20';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['pager']['options']['id'] = '0';
$handler->display->display_options['pager']['options']['quantity'] = '9';
$handler->display->display_options['style_plugin'] = 'table';
$handler->display->display_options['style_options']['default_row_class'] = FALSE;
$handler->display->display_options['style_options']['row_class_special'] = FALSE;
$handler->display->display_options['style_options']['columns'] = array(
  'title' => 'title',
  'type' => 'type',
);
$handler->display->display_options['style_options']['default'] = '-1';
$handler->display->display_options['style_options']['info'] = array(
  'title' => array(
    'sortable' => 0,
    'default_sort_order' => 'asc',
    'align' => '',
    'separator' => '',
    'empty_column' => 0,
  ),
  'type' => array(
    'sortable' => 0,
    'default_sort_order' => 'asc',
    'align' => '',
    'separator' => '',
    'empty_column' => 0,
  ),
);
$handler->display->display_options['style_options']['override'] = FALSE;
/* Field: Content: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
/* Field: Content: Type */
$handler->display->display_options['fields']['type']['id'] = 'type';
$handler->display->display_options['fields']['type']['table'] = 'node';
$handler->display->display_options['fields']['type']['field'] = 'type';
/* Sort criterion: Content: Post date */
$handler->display->display_options['sorts']['created']['id'] = 'created';
$handler->display->display_options['sorts']['created']['table'] = 'node';
$handler->display->display_options['sorts']['created']['field'] = 'created';
$handler->display->display_options['sorts']['created']['order'] = 'DESC';
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 1;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;

/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['path'] = 'cpanel';
</code>
Comment: Apparently, I had commented out the $title and exposed filter output from views main template file from the module. Problem is fixed now.
Answer: Quote from your own comment:

I had commented out the $title and exposed filter output from views main template file from the module. Problem is fixed now.

So it looks like that is the answer to your question ...


Get submitted values of webform in hook_alter function

Question: how can i get the submitted field values of webform in hook_alter function.
One more question is how can i call to submit function from hook_alter function.
Answer: hook_alter_form() is only invoked during form array build time, not when the form is submitted, so it's not possible (as is trying to submit a form that isn't rendered to the browser yet). If you want to handle the submitted form values for your own custom processing, add a submit handler to the form array.
function MYMODULE_form_alter(&$form, &$form_state, $form_id) {
   if ($form_id == 'webform_client_form_ID') {
    $form['#submit'][] = 'MYMODULE_webform_client_form_ID_submit';
  }
}

function MYMODULE_webform_client_form_ID_submit($form, &$form_state) {
  // @TODO: process $form_state['values'] as needed.
}


Clustering & Time Series

Question: I have a multivariate dataset that changes over time. I have extracted (and normalised) some features and used k-means to generate clusters over the entire span of the dataset.
Now I want to see whether the clusters change significantly over time. So, working backwards, and thus reducing the dataset by x-months, can I see a significant reduction on certain clusters?
This, I think, could fall within the realm of time series clustering. I was hoping to avoid complicating the approach, since the clusters are currently meaningful and the approach is relatively simple.
Could anyone please advise me on how to go about this?
My intuition is to reduce the dataset by x-months and then cluster (using k-means) the data for comparison.  However, I may be breaking the rules here, and oversimplifying a complicated problem.
Comment: [Clustering time series is meaningless](http://www.cs.ucr.edu/~eamonn/meaningless.pdf).
Comment: Consider something more modern than k-means from the 60s. If you want to do time series clustering, read up on time series clustering methods!
Comment: I am reading up on it, and have applied different approaches to the clustering, including PCA (for dimensionality reduction) and aglomerative hierarchical clustering. But I was seeking some advice for the community, it's a broad topic of research and is only a small part of an application I am developing.
Comment: I've read this paper yet it was written in 2005. So I was wondering has there been any advances or is that the final word on things....over and out, if you will :-p
Comment: The initial problem is how to define a reasonable distance metric for time series, and for that there are many approaches. Discussion here: http://stats.stackexchange.com/questions/185912/alternate-distance-metrics-for-two-time-series
Comment: Also that initial paper seems to be rather about subsequences, I'm not confident that the result generalises.
Comment: That initial paper was just about subsequences, but also was only about single variable time series.  I wouldn't assume that it applies completely to multivariate time series, although similar issues could arise, such as low frequencies generating many trivial matches pulling centroids away from meaningful information. The stated problem is somewhat different anyway.  What if in reality new clusters only appear halfway through the time period.  The system has already been defined as time-varying - why assume that all clusters can be tracked over the whole period?
Comment: You can convert your timeseries data to functional data and cluster that. There is lots of literature about this. https://link.springer.com/article/10.1007/s11634-013-0158-y
Answer: Update in 2023
If you are used to python, there is a scikit-learn clone for time series called sktime, which has appropriate methods for this problem:
https://sktime-backup.readthedocs.io/en/v0.15.1/api_reference/clustering.html
In general we should mention that TSC problems are well known and it is indeed possible. To see how it works I would visit this repo, which also links a paper from 2022. Especially kmedois in Time Series seems to work well with distance based clustering in Time Series problems.
https://github.com/sktime/distance-based-time-series-clustering
For those, who are lazy, and do not want to visit the github repo, here is the paper: https://arxiv.org/pdf/2205.15181.pdf
Comment: also have a look at bertopic, if you deal with text as features. You can essentially build clusters and given the timestamps of the items you will obtain trends for each topic
Answer: Time-series clustering requires sample size remaining the same but the features changes over time, otherwise it makes little sense. In the question though, inferring from the description sample size increases over time. In that case, to see significant reduction on certain clusters, one should use a fixed sample-size. Then choose fixed sample from the initial time period, and see how their cluster sizes and memberships are changing over time.
Symbolically, let's say you have 3 datasets (feature matrices) over time:
$$X_{t_{0}} \supset X_{t_{1}} \supset X_{t_{2}}$$
and corresponding clusterings $C_{0}, C_{1}, C_{2}$, where $C$ is essentially instances and cluster membership tables. To judge how clustering changes, take samples at $t_{0}$, such that $X_{0} \supset X_{t_{0}}$. Tracking how $X_{0}$'s membership and cluster sizes on different clusterings $C_{0}, C_{1}, C_{2}$ changes. This would give a good idea if there are "reductions" (significant changes) over different clustering, given that $X_{0}$ is representative over-time.

Clustering & Time Series


How to block fields from being available when pressing the tab key

Question: I have transformed some fields on my data entry form using code so that the user needs to update them by clicking them with the mouse.  Unfortunately, I do not understand how to remove them from the tab order field so that the user with the tab key toggles only through the fields which are not updated by mouse point and clicking.
Answer: You can adjust the Tab Stop property of the various controls. For details see
Remove a control from the tab order
Comment: you saved me again Gord. Cheers


Bind to DependencyProperty on Custom Class

Question: I'm having issues binding to a custom class.  The dependencyproperty does not seem to get the correct value from my viewmodel.  Here is my custom class:
    public class DataResource : DependencyObject
        {

            public static readonly DependencyProperty ContentProperty =
                DependencyProperty.Register("Content",
                    typeof(object),
                    typeof(DataResource));

            public object Content
            {
                get { return (object)GetValue(ContentProperty); }
                set { SetValue(ContentProperty, value); }
            }

        }

And in my UserControl resources, I have:
    <UserControl.Resources>
        <local:DataResource x:Key="dataResource" Content="{Binding Test}"></data:DataResource>
    </UserControl.Resources>

"Test" in my ViewModel is a property that I can bind a Label to with no issues.  Am I doing something wrong here in this implementation?
Update: This works if I inherit from Freezable instead of DependencyObject. I'm not quite sure why, hopefully somone can explain this.
Answer: There is no context in the Resources, the DataResource would need to be placed somewhere in the UserControl so it can inherit the DataContext so that the binding (which is relative to the DataContext unless a source is defined) is complete.
(A problem with that is that DependencyObject don't even have a "real" DataContext as that property belongs to FrameworkElement, if you are lucky there is an artificial context though)
Comment: If I change my DataResource class to extend from FrameworkElement, do I not have a context still?  I can use a CollectionViewSource within my resources and the binding works fine since my UserControl already has the DataContext set.
Comment: Maybe that works via [inheritance context](http://blogs.msdn.com/b/nickkramer/archive/2006/08/18/705116.aspx), i am not sure though. But changing the type to `FrameworkElement` is certainly *not* the right step to take in any way, in you really cannot bind to the current DataContext you should consider using another source, like `ElementName` or `Source` and specify a path relative to that source.
Answer: You can also use the FrameworkElement.SetBinding method on the Dependency Property in your code behind. Then you don't need to set the data context for the entire page (since DataContext and DP's don't mix well).
Here is the MSDN on that:
http://msdn.microsoft.com/en-us/library/ms598273.aspx
Sample:
MyData myDataObject = new MyData(DateTime.Now);
Binding myBinding = new Binding("MyDataProperty");
myBinding.Source = myDataObject;
myText.SetBinding(TextBlock.TextProperty, myBinding);

Comment: This method is used to circumvent XAML binding. I end up doing this a lot in Silverlight because of binding conflicts or DP's that don't properly trigger onchanged on user controls. It's worth a shot, but must be in the code behind.
Answer: Since content seems to be of type object -which leads me to believe that will be used to host a class- , the problem might actually be the
depth of "listening". If a property of Test changes (a.k.a. change of a string) you will be notified. If a property of Test is an object that doesn't inherit from DependencyObject and a property of it gets changed, you will not get notified. The last scenario goes on recursively.
According to Microsoft Documentation :

[...]
Detailed change notification: Unlike other DependencyObject objects, a Freezable object provides change notifications when sub-property values change.
[...]


Confusion of significance of predictor variable in model

Question: I have full model summary:
lm(formula = Swir2ref ~ x1 + y1 + x2 + y2)

Residuals:
       Min         1Q     Median         3Q        Max
-0.0219319 -0.0061738 -0.0000579  0.0060872  0.0197778

Coefficients:
             Estimate Std. Error t value Pr(>|t|)

(Intercept)  0.637722   0.029059  21.946  < 2e-16 ***

x1           0.040600   0.004534   8.954 5.24e-13 ***

y1          -0.012630   0.032577  -0.388  0.69950

x2          -4.438403   1.642197  -2.703  0.00874 **

y2          -1.502393   0.724077  -2.075  0.04190 *
---

Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.009531 on 66 degrees of freedom
Multiple R-squared:  0.579, Adjusted R-squared:  0.5535
F-statistic: 22.69 on 4 and 66 DF,  p-value: 8.043e-12

I have summary of interaction model:
    lm(formula = Swir2ref ~ x1 + y1 + x2 + y2 + x1 * y1)

Residuals:
       Min         1Q     Median         3Q        Max
-0.0199133 -0.0059021 -0.0008173  0.0061518  0.0204091

Coefficients:
            Estimate Std. Error t value Pr(>|t|)
(Intercept)  0.72335    0.05054  14.313  < 2e-16 ***
x1           0.19106    0.07361   2.596  0.01166 *
y1          -0.25164    0.12098  -2.080  0.04146 *
x2          -4.52826    1.60445  -2.822  0.00632 **
y2          -1.47253    0.70732  -2.082  0.04130 *
x1:y1       -0.41058    0.20050  -2.048  0.04462 *
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.009309 on 65 degrees of freedom
Multiple R-squared:  0.6045,    Adjusted R-squared:  0.5741
F-statistic: 19.87 on 5 and 65 DF,  p-value: 5.767e-12

My question is in the full model there is y2 is insignificant, but for the interaction model it is significant. What would be the reason? Help will be appreciated. Thank you!
Comment: Do you mean `y1`?  Because `y2` looks to be significant in both models...
Comment: yes, I am sorry. It should be y1.
Comment: This is not a programming question. If you need help with the interpretation of statistical models, you should be asking such questions over at [stats.se], not Stack Overflow.
Answer: I started typing a response, but @Glen_b said it really well...
https://stats.stackexchange.com/questions/160026/why-does-an-insignificant-regressor-become-significant-if-i-add-some-significant
There are two main reasons this can happen.
Adding a significant regressor - whether related to dummies or not - reduces the mean square residual. By reducing estimate of error variance, other regressors may become more significant even if the parameter estimate hardly changes, by reducing the denominator of their t-statistic (equivalently, their partial F). This one needn't involve any dependence between regressors at all.
Adding a regressor can also change the numerator of the t-statistic, by changing the parameter estimate, due to dependence between regressors, which can move coefficients either toward or away from zero; it will also alter the denominator (so it's not as simple as just considering the numerator). Sometimes the overall effect can be to make a previously insignificant regressor significant.


How to map uid in users table data to the entityid in feild table to retrieve data of the users in drupal7

Question: I would like to retrieve data related to users with the uid in users table.
But the uid is not mapped in the feild_data tables which has entity_id and entity_type.
How are these two ids mapped in drupal database 7
Comment: what is the role of the uid reference for entity in question?
Answer: For the field_data_* tables, when the entity_type is node, the entity_id & revision_id are the foreign keys into the node table. You can use this to JOIN into the users table.
  //@TODO: Replace field_data_* with the field table in question
  $fields = db_select('field_data_*', 'f');
  $fields->join('node', 'n', "n.nid = f.entity_id AND n.vid = f.revision_id AND f.entity_type = 'node'");
  $fields->join('users', 'u', "u.uid = n.uid");
  $new = $fields
    ->fields('f')
    ->fields('u',array('uid'))
    ->execute()->fetchAll();


Is there a way to set a "new" parameter, internally to a template or other page?

Question: Let's say I have some page which can take two parameters, x and y. I often find myself doing things in that page like in this silly little example:
{{#if: {{{x|{{{y|}}}}}} | '''{{{x|{{{y|}}}}}}'''. I repeat, {{{x|{{{y|}}}}}}.}}

In many cases, I would greatly prefer to simplify the reuse of {{{x|{{{y|}}}}}}, for clarity, for ease of typing, and for making it more difficult to miss or to screw up. So, I'd like to do something like the following hypothetical syntax:
{{#set:z|{{{x|{{{y|}}}}}}}}
{{#if: {{{z|}}} | '''{{{z}}}'''. I repeat, {{{z}}}.}}

That is, make a new parameter, z, which was not passed to the page, but nonetheless can be used in the page. Is there a way to do something like this?
Answer: There is the extension Variables, but it assumes a certain order of parsing, which will not be the case when pages are parsed with Parsoid.
To guarantee the right order of parsing you can use Lua.
But the simplest way will be to create a new template, taking only one parameter and to call it from the original one.
Template1:
{{template2| z = {{{x|{{{y|}}}}}} }}

Template2:
{{#if: {{{z}}} | '''{{{z}}}'''. I repeat, {{{z}}}.}}


Selenium python script can't run after an update to chrome browser

Question: The problem occurs in my python script run on an ubuntu server (no GUI). A chrome browser version 112 was installed on this server, and other requirements (chromedriver, python, etc.) were all met and a python3 script worked fine. Its function is calling webdriver, manipulating chrome to do some automated work.
But after an update to chrome browser a few days ago, the script don't work now, and I got an error like this:
DevToolsActivePort file doesn't exist

I tried to add '--no-sandbox' and many other options (in ChromeOption), but they never work.
Does anybody know how to fix this problem?
Answer: Answering my question. The key problem comes from an option: --user-data-dir. Maybe the problem also related to --headless mode.
I'm using these two chrome-options, like this:
options = Options()
options.add_argument('--headless=new')
options.add_argument('--user-data-dir=chrome-userdata')

Another post mentioned that such error message may comes from running chrome in headful mode (no --headless option), but on an OS without GUI. So I try removing --headless=new first. Then I run this script again, it start a chrome window on my remote computer (I'm using ubuntu desktop and enable an X11 option, so that this works for me).
By running this, new data and configuration are written in user-data-dir. So next time I recover the commented --headless=new option, It works as it used to be.
Hope my experience may help you.


Error -4058 Npm install

Question: Boa tarde,
ultimamente, quando tento instalar uma dependência via npm install, as vezes acontece isso, já[![inserir a descrição da imagem aqui resolvi uma vez excluindo a node_modules e dando um npm install, porem não está mais resolvendo. Alguém sabe pq isso ocorre e como resolver?
Answer: Olá!
No Stackoverflow.com tem uma solução para sua resposta:
https://stackoverflow.com/questions/49620780/cant-install-any-npm-package-error-4058
Consiste em deletar seu package-lock.json e tentar reinstalar o pacote.

Detalhe importante é certificar-se de não ter nenhum outro processo Node rodando, mais detalhes estão aqui também: https://github.com/npm/npm/issues/17444
Comment: Muito Obrigado :D
Comment: Por nada @A.Otavio disponha!

Error -4058 Npm install


Como dar o "espaçamento" na área onde se escreve o texto

Question: Olá, gostaria de alterar o posicionamento do | ao selecionar o textbox, tenho um esboço e o que estou tentando fazer não fica ajustado igual a 2° imagem. Há alguma propriedade que faça isso? Agradecido, To batendo a cabeça faz tempo nisso ..
Assim é como o " | " está, praticamente colado com o TextBox

Assim como quero que o  " | " fique assim ao selecionar o textbox e alinhado com o placeholder
Obs: Eu já alterei o placeholder da seguinte maneira:
::-webkit-input-placeholder {
    color: #bbbbbb;
    padding-left: 15px;
}

Answer: Tira o padding da pseudo-classe do placeholder e coloca direto no input. Uma vez que vc coloca o padding no input ele já posiciona o marcador no lugar correto e tb "empurra" o placeholder pro lugar correto.

::-webkit-input-placeholder {
  color: #bbbbbb;
}

input[type="text"] {
  padding-left: 15px;
}
<input type="text" placeholder="meu placeholder">
Comment: @Dreidel sim e mais facil do que parecia né rss, se vc acha que a resposta resolveu o problema vc pode considerar marca-la nesse ícon ✔ abaixo das setinhas ao lado da resposta, Se no futuro aparecer outra resposte que vc julque mais adequada vc pode mudar a aceitação para a outra resposta se achar justificável
Comment: @samuelrvg valeu a força
Comment: Deu certo! Só tive que alterar o width do textbox pra ficar parelho com o botão, mas mesmo assim muito obrigado, até engraçado o quanto é simples pra resolver esse problema :P
Comment: @Dreidel se a resposta ajudou, marca como solução para ajudar outras pessoas.


Blues harmony: readings to learn more

Question: Reading from similar posts in this site I understood that the standard harmony tools can't explain the typical blues sound made by dominant 7
-chords progressions. But it's clear that these progressions sound good.
Would you be so kind to indicate some complete reading on the web where deepen this topic or, of course, give some exhaustive explanation here below?
Thanks
Comment: I don't know what the standard harmony tools are, but I can explain it. By holding a dominant chord you keep the listener in suspension, waiting for release indefinitely. By toying around between minor and major tonalities you exploit the sensation of having to re-consider the harmony. The same itch is scratched when you do modulations. Practice: play the blues. I always thought one reason why the blues is so popular is because it doesn't need theory?
Comment: Looking for "complete reading" is like asking for a recommendation which might get this closed.  Why not google Blues progression explained on Google, or Amazon.  There may be a book out there.
Comment: @piiperiReinstateMonica - blues doesn't necessarily need theory - in fact, it flies in the face of theory.  Some people do need it. But it's usually of little use. Listen and play.
Comment: There's not much more to say about blues harmony than the typical 12 bar chord progression that you may surely know. (Except of the development of the extended   blues with jazz chords - and of course not by the standard classical theory!). But  there's much  more to learn about the melodic patterns, figures and motifs. Theory tries to explain the practice, so it's possible to find some explanations, with other words: describing what you hear and what others are playing.
Comment: I'm voting to close this question because finding offsite resources is off-topic.
Comment: Yes sure, I'm sorry. I have now edited the question. I took for granted that an answer below would also be fine.
Answer:
...the standard harmony tools can't explain the typical blues sound made by dominant 7 -chords progressions

That isn't really true.
By "classical" music Common Practice conventions the seventh of dominant seventh chords is considered a dissonance that must be resolved. The resolution is usually a step down to the third of a tonic chord.
Blues harmony doesn't treat seventh by that "classical" convention. Although when I7 moves to IV7 the "flat" seventh of I does move to the third of IV in the "classical" manner. It just isn't an obligatory resolution like in the "classical" style.
Another difference is about cross relationships which is the simultaneous sounding of two chromatic variations of a tone. In "classical" style cross relationship sometimes happen, like a simultaneous lowered and raised sixth degree in minor. Blues differs from classical in that it uses cross relationships on the thirds of chords. For example, a blues in C might use an E♭ in a high range above a C7 dominant seventh chord. So, while the particular cross relationship on a chord's third is not used in "classical" style the general concept of cross relationships does exist.
Both of the points above - the handling of chord sevenths and cross relationships on a chords third - have an important point in common: the chord roots do not change and those root's place within the tonality do not change.
When a blues progression uses I7 IV7 V7 the roots are simply I IV V and despite the non-classical treatment of the seventh those chords to have the identities of tonic, subdominant, and dominant. When the chords take a minor third - like a minor third above I7 - the chord is still a I a tonic. If the minor forms are used for various minor flavored blues - i iv v - those chords are still tonic, subdominant, dominant.
From a "classical" perspective using I IV V is not only totally conventional, it is the surest way to create clearly tonal music.
Some may point out that the V IV I "turnaround" part of blues progressions contains a V IV retrogression, something supposedly at odds with "classical" functional harmony. The first response to that is the very common turnaround ending V IV I V leading back to I to repeat the whole progression. That of course gives us the V | I. The other response is the "retrogression" V IV hardly matters. The progression is entirely primary triads, there is no question about the tonal center.
I don't mean to say "classical" and blues harmony are the same. They aren't. But you can use music theory to talk about it and describe the musical aspects.
For a particular resource you might consider Gunther Schuller's Early Jazz: its roots and musical developement. The first chapter is an overview of rhythm, form, harmony, melody, timbre, and improvisation. Don't be put off by the word jazz in the title. The summary talks about blues and traces origins back to African music. The quote from the harmony overview may interest you:

It would be more precise to say that, while European and African harmony are based on two totally different conceptions, there are coincidental, superficial similarities which made the transition (in terms of harmonic practice) from Africa to the Southern United States virutally unbroken.

That isn't a "complete" resource. But it should give you a taste of the kind of material there is to be found.
There is a Google Books preview for volume 2 from Schuller. I'm not sure what the difference is with volume 2. It looks like my volume 1, 1968 edition text.
FWIW, this kind of material is music theory and musicology. Stuff that tries to explain why and trace historical origins. It isn't performance methods. Some of the comments on your question seem to mix up the notion of theoretical questions about the blues with learning how to play blues. If you want theory on the blues you can find it. Just don't mix that up with playing blues.

Blues harmony: readings to learn more


Grunt build breaks SVG images

Question: So I have redeveloped my portfolio website using Yeoman with the Yeoman webapp generator. It's built using Twitter Bootstrap and Sass. Everything works fine except when I use the "grunt build" command to compress my website.  When my website is recreated in the "dist" folder I noticed that most of the xml embedded SVG icons on my html pages are broken. I did a comparison with my website in the "app" folder and the SVG code is different. How do I stop grunt from compressing the SVG or how would I change it so that it does not break the SVG icons?
My Gruntfile.js
    // Generated on 2014-10-14 using
// generator-webapp 0.5.0
'use strict';

// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// If you want to recursively match all subfolders, use:
// 'test/spec/**/*.js'

module.exports = function (grunt) {

  // Time how long tasks take. Can help when optimizing build times
  require('time-grunt')(grunt);

  // Load grunt tasks automatically
  require('load-grunt-tasks')(grunt);

  // Configurable paths
  var config = {
    app: 'app',
    dist: 'dist'
  };

  // Define the configuration for all the tasks
  grunt.initConfig({

    // Project settings
    config: config,

    // Watches files for changes and runs tasks based on the changed files
    watch: {
      bower: {
        files: ['bower.json'],
        tasks: ['wiredep']
      },
      js: {
        files: ['<%= config.app %>/scripts/{,*/}*.js'],
        tasks: ['jshint'],
        options: {
          livereload: true
        }
      },
      jstest: {
        files: ['test/spec/{,*/}*.js'],
        tasks: ['test:watch']
      },
      gruntfile: {
        files: ['Gruntfile.js']
      },
      sass: {
        files: ['<%= config.app %>/styles/{,*/}*.{scss,sass}'],
        tasks: ['sass:server', 'autoprefixer']
      },
      styles: {
        files: ['<%= config.app %>/styles/{,*/}*.css'],
        tasks: ['newer:copy:styles', 'autoprefixer']
      },
      livereload: {
        options: {
          livereload: '<%= connect.options.livereload %>'
        },
        files: [
          '<%= config.app %>/{,*/}*.html',
          '.tmp/styles/{,*/}*.css',
          '<%= config.app %>/images/{,*/}*'
        ]
      }
    },

    // The actual grunt server settings
    connect: {
      options: {
        port: 9000,
        open: true,
        livereload: 35729,
        // Change this to '0.0.0.0' to access the server from outside
        hostname: 'localhost'
      },
      livereload: {
        options: {
          middleware: function(connect) {
            return [
              connect.static('.tmp'),
              connect().use('/bower_components', connect.static('./bower_components')),
              connect.static(config.app)
            ];
          }
        }
      },
      test: {
        options: {
          open: false,
          port: 9001,
          middleware: function(connect) {
            return [
              connect.static('.tmp'),
              connect.static('test'),
              connect().use('/bower_components', connect.static('./bower_components')),
              connect.static(config.app)
            ];
          }
        }
      },
      dist: {
        options: {
          base: '<%= config.dist %>',
          livereload: false
        }
      }
    },

    // Empties folders to start fresh
    clean: {
      dist: {
        files: [{
          dot: true,
          src: [
            '.tmp',
            '<%= config.dist %>/*',
            '!<%= config.dist %>/.git*'
          ]
        }]
      },
      server: '.tmp'
    },

    // Make sure code styles are up to par and there are no obvious mistakes
    jshint: {
      options: {
        jshintrc: '.jshintrc',
        reporter: require('jshint-stylish')
      },
      all: [
        'Gruntfile.js',
        '<%= config.app %>/scripts/{,*/}*.js',
        '!<%= config.app %>/scripts/vendor/*',
        'test/spec/{,*/}*.js'
      ]
    },

    // Mocha testing framework configuration options
    mocha: {
      all: {
        options: {
          run: true,
          urls: ['http://<%= connect.test.options.hostname %>:<%= connect.test.options.port %>/index.html']
        }
      }
    },

    // Compiles Sass to CSS and generates necessary files if requested
    sass: {
      options: {
        sourcemap: true,
        loadPath: 'bower_components'
      },
      dist: {
        files: [{
          expand: true,
          cwd: '<%= config.app %>/styles',
          src: ['*.{scss,sass}'],
          dest: '.tmp/styles',
          ext: '.css'
        }]
      },
      server: {
        files: [{
          expand: true,
          cwd: '<%= config.app %>/styles',
          src: ['*.{scss,sass}'],
          dest: '.tmp/styles',
          ext: '.css'
        }]
      }
    },

    // Add vendor prefixed styles
    autoprefixer: {
      options: {
        browsers: ['> 1%', 'last 2 versions', 'Firefox ESR', 'Opera 12.1']
      },
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/styles/',
          src: '{,*/}*.css',
          dest: '.tmp/styles/'
        }]
      }
    },

    // Automatically inject Bower components into the HTML file
    wiredep: {
      app: {
        ignorePath: /^\/|\.\.\//,
        src: ['<%= config.app %>/index.html'],
        exclude: ['bower_components/bootstrap-sass-official/assets/javascripts/bootstrap.js']
      },
      sass: {
        src: ['<%= config.app %>/styles/{,*/}*.{scss,sass}'],
        ignorePath: /(\.\.\/){1,2}bower_components\//
      }
    },

    // Renames files for browser caching purposes
    rev: {
      dist: {
        files: {
          src: [
            '<%= config.dist %>/scripts/{,*/}*.js',
            '<%= config.dist %>/styles/{,*/}*.css',
            '<%= config.dist %>/images/{,*/}*.*',
            '<%= config.dist %>/styles/fonts/{,*/}*.*',
            '<%= config.dist %>/*.{ico,png}'
          ]
        }
      }
    },

    // Reads HTML for usemin blocks to enable smart builds that automatically
    // concat, minify and revision files. Creates configurations in memory so
    // additional tasks can operate on them
    useminPrepare: {
      options: {
        dest: '<%= config.dist %>'
      },
      html: '<%= config.app %>/index.html'
    },

    // Performs rewrites based on rev and the useminPrepare configuration
    usemin: {
      options: {
        assetsDirs: ['<%= config.dist %>', '<%= config.dist %>/images']
      },
      html: ['<%= config.dist %>/{,*/}*.html'],
      css: ['<%= config.dist %>/styles/{,*/}*.css']
    },

    // The following *-min tasks produce minified files in the dist folder
    imagemin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= config.app %>/images',
          src: '{,*/}*.{gif,jpeg,jpg,png}',
          dest: '<%= config.dist %>/images'
        }]
      }
    },

    svgmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= config.app %>/images',
          src: '{,*/}*.svg',
          dest: '<%= config.dist %>/images'
        }]
      }
    },

    htmlmin: {
      dist: {
        options: {
          collapseBooleanAttributes: true,
          collapseWhitespace: true,
          conservativeCollapse: true,
          removeAttributeQuotes: true,
          removeCommentsFromCDATA: true,
          removeEmptyAttributes: true,
          removeOptionalTags: true,
          removeRedundantAttributes: true,
          useShortDoctype: true
        },
        files: [{
          expand: true,
          cwd: '<%= config.dist %>',
          src: '{,*/}*.html',
          dest: '<%= config.dist %>'
        }]
      }
    },

    // By default, your `index.html`'s  will take care
    // of minification. These next options are pre-configured if you do not
    // wish to use the Usemin blocks.
    // cssmin: {
    //   dist: {
    //     files: {
    //       '<%= config.dist %>/styles/main.css': [
    //         '.tmp/styles/{,*/}*.css',
    //         '<%= config.app %>/styles/{,*/}*.css'
    //       ]
    //     }
    //   }
    // },
    // uglify: {
    //   dist: {
    //     files: {
    //       '<%= config.dist %>/scripts/scripts.js': [
    //         '<%= config.dist %>/scripts/scripts.js'
    //       ]
    //     }
    //   }
    // },
    // concat: {
    //   dist: {}
    // },

    // Copies remaining files to places other tasks can use
    copy: {
      dist: {
        files: [{
          expand: true,
          dot: true,
          cwd: '<%= config.app %>',
          dest: '<%= config.dist %>',
          src: [
            '*.{ico,png,txt}',
            'images/{,*/}*.webp',
            '{,*/}*.html',
            'styles/fonts/{,*/}*.*'
          ]
        }, {
          src: 'node_modules/apache-server-configs/dist/.htaccess',
          dest: '<%= config.dist %>/.htaccess'
        }, {
          expand: true,
          dot: true,
          cwd: '.',
          src: 'bower_components/bootstrap-sass-official/assets/fonts/bootstrap/*',
          dest: '<%= config.dist %>'
        }]
      },
      styles: {
        expand: true,
        dot: true,
        cwd: '<%= config.app %>/styles',
        dest: '.tmp/styles/',
        src: '{,*/}*.css'
      }
    },

    // Run some tasks in parallel to speed up build process
    concurrent: {
      server: [
        'sass:server',
        'copy:styles'
      ],
      test: [
        'copy:styles'
      ],
      dist: [
        'sass',
        'copy:styles',
        'imagemin',
        'svgmin'
      ]
    }
  });

  grunt.registerTask('serve', 'start the server and preview your app, --allow-remote for remote access', function (target) {
    if (grunt.option('allow-remote')) {
      grunt.config.set('connect.options.hostname', '0.0.0.0');
    }
    if (target === 'dist') {
      return grunt.task.run(['build', 'connect:dist:keepalive']);
    }

    grunt.task.run([
      'clean:server',
      'wiredep',
      'concurrent:server',
      'autoprefixer',
      'connect:livereload',
      'watch'
    ]);
  });

  grunt.registerTask('server', function (target) {
    grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
    grunt.task.run([target ? ('serve:' + target) : 'serve']);
  });

  grunt.registerTask('test', function (target) {
    if (target !== 'watch') {
      grunt.task.run([
        'clean:server',
        'concurrent:test',
        'autoprefixer'
      ]);
    }

    grunt.task.run([
      'connect:test',
      'mocha'
    ]);
  });

  grunt.registerTask('build', [
    'clean:dist',
    'wiredep',
    'useminPrepare',
    'concurrent:dist',
    'autoprefixer',
    'concat',
    'cssmin',
    'uglify',
    'copy:dist',
    'rev',
    'usemin',
    'htmlmin'
  ]);

  grunt.registerTask('default', [
    'newer:jshint',
    'test',
    'build'
  ]);
};

Answer: There are a few issues with svgmin, for example one with removeUnknownsAndDefaults and one with collapseGroups. I disabled aforementioned plugin in my grunt task and my svg files are ok now, but it depends on your svg files and exactly what plugin is breaking them. Try the following config and check if it fixes your problem:
svgmin: {
  options: {
    plugins: [{
      collapseGroups: false
    }, {
      removeUnknownsAndDefaults: false
    }]
  },
  dist: {
    files: [{
      expand: true,
      cwd: '<%= path.app %>/images',
      src: '{,*/}*.svg',
      dest: '<%= path.dist %>/images'
    }]
  }
}

If it doesn't and you don't want to spend time and find the svgmin plugin which causes the issues, simply remove svgmin task from concurrent:dist task but don't forget to add 'images/{,*/}*.{svg}' to copy:dist task inside src array so they get copied to dist/ folder.
Comment: This worked for me. I used the second approach of just commenting out and copying the files over as I was pressed for time. Only I had to remove the brackets from svg in 'images/{,*/}*.{svg}' as it won't copy over the svg files with them there.
Comment: Thanks for this! Adding those two options has solved my issue with SVG artifacts.
Answer: Without knowing what format it changed the SVGs to I can't say for certain, but one thing the minifier doesn't handle well are elements that end with />, it nests paths that should be siblings under the  tag.
One workaround is to change the path so it has a closing tag and content in it, like so:
<svg xmlns="http://www.w3.org/2000/svg">
  <path d="M-115,-58L-201,479L-101,43Z" fill="#f2f7ff" stroke="#f2f7ff">.</path>
  <path d="M-115,-58L-101,43L156,-172Z" fill="#faf8fb" stroke="#faf8fb">.</path>
  <path d="M156,-172L-101,43L245,63Z" fill="#f1f1f8" stroke="#f1f1f8">.</path>
</svg>

This way the minifier preserves the closing tag and the hierarchy.
Answer: To stop the SVG compression remove the svgmin task call from your concurrent:dist task (line 358 in your file).
As for not breaking the icons, you would need to go check the underlying plugins page @ https://github.com/svg/svgo and check that your svg is compatible with svgo.
Comment: It doesn't help because no SVG is deployed anymore.
Comment: I removed the svgmin task call and the SVG icons are still broken. This leads me to believe that it's not svgo breaking the SVG icons. Maybe it's another part of the grunt compression process. I compared the broken SVG's with the working ones and the closing paths have moved which might explain why they are broken. When I declare the SVG's as images instead of embedding them they seem to work.
Comment: The answer does not work because now the SVGs are not present anymore in the dist folder after grunt build.

Grunt build breaks SVG images


Probability mass function of 1st event of a Poisson process knowing a time a between 1st and 2nd event

Question: Say events X1, X2, X3, ... occur in succession according to a Poisson of paramter $\lambda$.
This implies that $Pr(x<X_{1})=Pr(x-x_{1}<X_{2}-X_{1}~~|~~ x_{1}=X_{1})=Pr(x-x_{2}<X_{3}-X_{2}~~|~~x_{2}=X_{2})=...=X_{1})=1-e^{-\lambda.x}$.
I want to know the probability distribution of $X_{1}$ conditional to knowing a certain time $a$ located between $X_{1}$ and $X_{2}$: $Pr(x<X_{1}~~|~~X_{1}<a<X_{2})$. Could you help me ?
my efforts:
I have (incorrectly) called $\mathrm{pmf}_{1~|~X_{1}<a<X_{2}}$ a (sort of) density distribution of $x_{1}=X_{1}$ within $[0,a]$ conditional to $a<X_{2}$.
I calculate it this way:
$\mathrm{pmf}_{1~|~X_{1}<a<X_{2}}=\left[ \int_{x_{2}=a}^{+\infty}\mathrm{pmf}_{1}(x_{2}-x_{1}).d(x_{2}-x_{1})\right].\mathrm{pmf}_{1}(x_{1})$,
where $\mathrm{pmf}_{1}(x)=\lambda.e^{-\lambda.x}$ is the probability mass function of the exponential law of the 1st event of a poisson process.
This yields: $\mathrm{pmf}_{1~|~X_{1}<a<X_{2}}=\lambda.a.e^{-\lambda.a}$.
This is independent from $x$, and therefore tells me (I guess) that ( conditional to $X_{1}<a<X_{2}$ ) $X_{1}$ is uniformally distributed within $[0,a]$ (whilst it is obviously not the case in general and I think neither if conditional only to $X_{1}<a$). However the integral from $0$ to $a$ of $\mathrm{pmf}_{1~|~X_{1}<a<X_{2}}$ does not yield 1. Which makes sense since it actually generates:
$P(X_{1}<a<X_{2})=\int_{x_{1}=0}^{a}\mathrm{pmf}_{1~|~X_{1}<a<X_{2}}.dx_{1}=\lambda.a.e^{-\lambda.a}$.
What is the "real" and correct formulation for the pmf or cdf for $X_{1}~~|~~X_{1}<a<X_{2}$ ?
Answer: For any Lebesgue measurable subset $A\subseteq[0,\infty)$ with finite Lebesgue measure let: $$N_A:=|\{n\mid X_n\in A\}|$$ Then $N_A$ has Poisson distribution with parameter $\lambda\cdot\mu(A)$ where $\mu$ denotes the Lebesgue measure.
(I used $\mu$ for Lebesgue measure because $\lambda$ is in use allready)
Also if $A\cap B=\varnothing$ then $N_A$ and $N_B$ are independent.

By definition:
$$\mathsf{P}\left(x<X_{1}\mid X_{1}<a<X_{2}\right)\mathsf{P}\left(X_{1}<a<X_{2}\right)=\mathsf{P}\left(x<X_{1}<a<X_{2}\right)\tag1$$
Here:
$$\begin{aligned}\mathsf{P}\left(X_{1}<a<X_{2}\right) & =\mathsf{P}\left(N_{\left[0,a\right)}=1\right)\\
 & =\lambda ae^{-\lambda a}
\end{aligned}
$$
and:
$$\begin{aligned}\mathsf{P}\left(x<X_{1}<a<X_{2}\right) & =\mathsf{P}\left(N_{\left(0,x\right)}=0\wedge N_{\left[x,a\right)}=1\right)\\
 & =\mathsf{P}\left(N_{\left(0,x\right)}=0\right)\mathsf{P}\left(N_{\left[x,a\right)}=1\right)\\
 & =e^{-\lambda x}\lambda\left(a-x\right)e^{-\lambda\left(a-x\right)}\\
 & =\lambda\left(a-x\right)e^{-\lambda a}
\end{aligned}
$$
Then $\left(1\right)$ leads to:$$\mathsf{P}\left(x<X_{1}\mid X_{1}<a<X_{2}\right)=\frac{a-x}{a}=1-\frac{x}{a}$$This for $x\in[0,a)$ and we conclude that under condition $X_1<a<X_2$ rv $X_1$ has uniform distribution on $[0,a)$.
Comment: I am confused with your intermediary result: $P(X_{1}<a<X{2})=1-e^{-\lambda.a}$. If for instance $a=0$, the Probability of a being in the second segment (i.e. between $X_{1}$ and $X_{2}$) has to be zero (it is in the first segment, i.e. between $0$ and $X_{1}$, with Probability 1).
Comment: Dear @drhab, I think it is actually $P(X_{1}<a<X{2})=\lambda.a.e^{-\lambda.a}$ (see calculation in my post). This can be confirmed by considering it is the probability of one unique event happening for a poisson process of parameter $\lambda.a$ (and between 0 and a, the mean number of events is indeed  $\lambda.a$).
Comment: You are correct. I (twice) made the (stupid, I don't understand myself) mistake $P(X=1)=1-P(X=0)$. I will repair.
Comment: It has been repaired now and confirms uniform distribution.


Will my iOS chat app get rejected from the app store due to NodeJs Server?

Question: Not sure if this is the right place to ask, sorry if its not, i would to know where the right place is.
I created a chat app that uses firebase and a nodejs server hosted on heroku
The messages are stored in firebase and are not encrypted.
The nodejs server is not very secure, i have passport authentication, but data is not encrypted or secure.
What is apple's policy on servers and not encrypted content. i tried looking around and couldnt find any useful content.
I just need to be pointed in the right direction.
Comment: Try to check the documentations and App Store Review Guidelines out but I don't think that this should be a problem.
Answer: You need to ensure that the data stored on your device locally is protected and encrypted following the Apple guidelines. Your app needs to communicate with your servers over HTTPS layer as per the requirements of apple policy.
There is no policy for security on your backend servers. However it's always a good practice to keep your data stored securely and encrypted at server level. Passport authentication is good to make sure that your app will server data to the authenticated users only.
You can make your web-services (nodejs server) secured using various security options (oAuth, basic authentication, custom authentication, etc.)
Apple will not reject if your server is not secured.


subgraphs in a graph

Question: I have a main graph and another small graph, suppose that the small graph could be repeated in the main graph as a subgraph with a degree of similarity(not necessarily the same small graph)
 What's a good algorithm (or Java library) to find them all?
Comment: Related: http://stackoverflow.com/questions/51574/good-java-graph-algorithm-library
Comment: How do you define the similarity?
Answer: I think you are trying to solve the Subgraph Isomorphism Problem which is known to be NP-complete. That means, there is likely no fast algorithm to do what you need. Your requirement of similarity (and not only isomorphism) only adds another complexity.
The Wikipedia page talks about Ulmann's algorithm that solves this problem in polynomial time (fast) for certain classes of graphs, you might give it a try.

subgraphs in a graph


Printing final output from list of lists

Question: Initially, i have a list of lists containing, for example
L = [[01,02],[03,04],[05,06]]

and for each of the individual list within the list of list, my program does some calculation from the elements within the list and had the values output in a single list.
OutputList = [2.1,2.2,2.3]

the value 2.1 corresponds to [01,02], 2.2 corresponds to [03,04] and finally 2.3 corresponds to [05,06]
i want to print out the outputList and also the individual list corresponding to the value in the output list something like as below.
2.1 : [01,02]
2.2 : [03,04]
2.3 : [05,06]

I would like to know how i would be able to get the output as such. I know i should utilise for loops to perform something like:
for val in OutputList:
    for lst in L:
        OutputList[val] == L[lst] ##??

Comment: Possible duplicate of [How can I iterate through two lists in parallel in Python?](http://stackoverflow.com/questions/1663807/how-can-i-iterate-through-two-lists-in-parallel-in-python)
Answer: You can use enumerate to iterate list values with index
for ind, val in enumerate(outputList):
    print('{} : {}'.format(val, L[ind])

Answer: You can zip two lists together like zip(outputList,L) and it will create tuples like (2.1,[01,02]) , you can just print the list as below:
zipped =zip(outputList,L)
for item in :
     print ("{} : {}".format(zipped[0],zipped[1]))


error c2036 : unknown size if structure

Question: I have 2 class(A & C) defined in a file allocate.h and class B defined in work.h.
I included allocate.h inside work.h file
My code looks like :
Class A{
}

Class C
{
public:
    struct xyz{
        A ob;
    };
}

include"allocate.h"
Class C;
Class B{
  void test(){
      xyz obj; // `Error : error c2036 : xyz unknown size`
  }
}

Can someone tell me how can i communicate the size of xyz structure in function test?
Comment: I think you're missing some semicolons `;`. Did you hand copy this?
Comment: Please post the _exact_ code you are using. This code is clearly not even close to correct C++ - preprocessor includes must start with `#`, class definitions must end with `;`, and class definitions use the `class` keyword not `Class`, for starters. If you do not copy and paste _exactly_ what you are trying to compile, you may inadvertently fix the bug, or introduce new ones in the process. Also, please make it clear exactly what code is in what file.
Answer: class in C++ (which is case-sensitive) is all lower-case and the declarations end in semicolons. Please paste real code into your questions!
In this instance, xyz is declared within the scope of class C, so you'll need to specify the scope when you use it.
class B{
    void test(){
        C::xyz obj;
    }
};

Comment: i was sure i am missing some basic thing. sorry for writting class in Caps, i did it deliberatley to make it more understandable.
Comment: The most understandable example you can post is an [SSCCE](http://sscce.org/).  Here is what I would have posted: http://ideone.com/vx5Re

error c2036 : unknown size if structure


PHP mail() not working with Postfix on Ubuntu

Question: I recently purchased a VPS plan.  I installed Ubuntu 9.10, PHP5 and Postfix. I can't get the PHP mail() function to work.  In my PHP script, the mail() function returns true, which suggests it is working.  But no one is receiving my website's emails.
Installation of postfix appeared to have went fine when I called a sudo apt-get install postfix.  Calling a /etc/init.d/postfix start gave me "Starting Postfix Mail Transport Agent postfix ".  Calling a /etc/init.d/postfix reload gave me the error "fatal: the Postfix mail system is not running".
Prior to installing postfix, I was using sendmail which worked with the PHP mail() function.
How do I debug and fix this problem?
Additional Notes
I looked in /var/log/mail.log and found the follow error everytime i call php's mail()
Feb  3 11:27:41 mywebsitedomain postfix/postdrop[23793]: warning: unable to look up public/pickup: No such file or directory

Answer: Oh, I fixed the problem by following the information in this forum:
http://ubuntuforums.org/showthread.php?t=666018
Basically, I looked in my /var/log/mail.log error file and found the error message "unable to look up public/pickup: no such file or directory".
I then issued the command
sudo mkfifo /var/spool/postfix/public/pickup

I made sure sendmail wasn't still running by doing a ps -aux and killing it
root@cpu:/var/log# ps aux | grep mail
root      2363  0.0  0.5   9228  1888 ?        Ss   Jan28   0:20 sendmail: MTA: accepting connections
root     23914  0.0  0.2   3040   792 pts/0    S+   11:33   0:00 grep mail
root@cpu:/var/log# kill 2363

I restarted postfix
sudo /etc/init.d/postfix restart

And now the PHP mail function works.


Can we connect 2 VPN gateways with 2 vnets with the same ip range in Azure?

Question: Let's suppose that in two differents subcription we have 1 vnet with the same ip range, and both sites also have one subnet with the same ip range. Does VPN gateway still working ? For example in this case:
Subscription 1:
Vnet range : 10.1.0.0/16
Subnet range : 10.1.0.0/24
Subscription 2:
Vnet range : 10.1.0.0/16
Subnet range : 10.1.0.0/24
Answer: Both Azure networks use the same internal IP addresses, Vnet and Subnet ranges overlap, it is not possible to build a tunnel between these two Subnets as in both Subnets you may have PCs with same IP addresses assigned by DHCP.
VPN Gateway in Subscription 1 won't be able to determine where to send traffic, to PC in Subscription 1 or PC in Subscription 2.
However there is an option to configure a VPN tunnel between two Subnets with an advanced configuration using NAT and 3rd party VPN devices like Juniper, Cisco, etc.
For bidirectional VPN traffic between two end entities with overlapping addresses, the security devices at both ends of the tunnel must apply Source Network Address Translation (NAT-src) and Destination Network Address Translation (NAT-dst) to the VPN traffic passing between them.
https://www.juniper.net/documentation/en_US/release-independent/nce/topics/concept/lan2lan-vpn-jseries-srx-series-overview.html


New design bug on Firefox

Question: Just to report a styling issue regarding the new design.
On Firefox only, the badges are not properly aligned with the badges count.

Compared to Google Chrome where it's properly aligned

In case @Marius' comment is missed:

Same thing happens on Chrome on Android phones when requesting the
  "desktop view"
Comment: Don't know if it's relevant, but the same thing happens on chrome on android phones when requesting the "desktop view".
Answer: This issue has been corrected. This issue arose because I was using background-position-x and background-position-y, which I've come to learn are not ready for implementation (according to the W3C). Still all major browsers except Firefox and Opera Mini seem to accept the properties.

Sigh.
Anyway this has been corrected and badge icons are now correctly positioned in Firefox.

New design bug on Firefox


Insertion and Deletion in list

Question: I am currently writing a small program to insert or delete a row in a list of string read from an input text file.
This is my code
#include <vector>
#include <string>
#include <sstream>
#include <iostream>
#include <fstream>
#include <list>

using namespace std;
int main()
{
    list <string> buffer;
    string fileName = "input.txt";
    ifstream file(fileName);
    if (file.is_open())
    {
        string line;
        while (getline(file, line))
        {
            //store each line in the buffer
            buffer.push_back(line);
        }
    }
    list<string>::const_iterator it;
    it = buffer.begin();
    int position = 1;
    for (int n = 0; n < position; ++n)
    {
        ++it;
    }
    string input("This is a new line");
    buffer.insert(it, 1, input);
    //I can then use erase function to delete a line

    system("pause");
    return 0;
}

The buffer list has
This is line 1
This is line 2
This is line 3
This is line 4

I want to know if there are other ways (maybe more efficient) to insert or delete a line in the buffer. Thank you!
Comment: Please post the actual code - what you have posted cannot possibly compile.
Comment: @NeilButterworth I updated my code :)
Answer: There are several versions of list<>::insert().  One of them inserts a single element, so you can replace this:
buffer.insert(it, 1, input);

with:
buffer.insert(it, input);

You can also use list<>::emplace() to create the string in place :
buffer.emplace(it, "This is a new line");

You can simplify this:
list<string>::const_iterator it;
it = buffer.begin();
int position = 1;
for (int n = 0; n < position; ++n)
{
    ++it;
}

to:
auto it = buffer.begin();
advance(it, 1);

Comment: In fact, I cannot use `buffer.insert(it, input);` because my program won't compile. Thank you for your answer!
Comment: @Coded-BloodJunior, it's in C++11 (with `const_iterator`).  The same goes for `list<>::emplace()`.  Maybe your compiler has options to use C++11 or later ?

Insertion and Deletion in list


Non-orientable submanifolds

Question: Let $M$ be a $n$-manifold and let $S \subset M$ be a non-orientable $n$-dimensional submanifold possibly with boundary. Under what conditions can I conclude that $M$ is also non-orientable? Is compactness sufficient?
In particular consider the case where $M$ is a surface and $S$ is a Mobius strip.
Comment: $M$ is always non orientable if $S$ is non orientable.
Comment: @Blake:  if you want to add/modify hypotheses, you should edit your post. In addition, since $\mathbb R^N$ can be seen as a submanifold of $S^N$,  assuming the compactness of $M$ doesn't change anything.
Comment: Oh, right... thank you. Alright what about the case where $M$ is a $m$ dimensional manifold with $m > n$. In particular what if $M$ is an $n+1$ dimensional manifold?
Comment: In general you can deduce nothing because [Whitney's embedding theorem](https://en.wikipedia.org/wiki/Whitney_embedding_theorem) states that every manifold, orientable or not, can be embedded iinto some $\mathbb R^N$, which is of course orientable.
Comment: Which is why I thought compactness might allow one to deduce something, since it specifically rules out that case.
Comment: Perhaps something along the lines of what you're looking for: codimension 1 submanifolds of $S^n$ are orientable. In general, you want to think about Steifel-Whitney classes of normal bundles. (A submanifold of an orientable manifold is orientable iff its normal bundle is orientable. In particular, if it's codim 1, iff its normal bundle is trivial.)
Answer: No conditions needed.
Proof. Suppose that that $M$ is orientable, hence there is non-vanishing $n$-form $\omega$ defined on $M.$ As a result $\omega|_S$ is non-vanishing $n$-form on $S.$ Thus $S$ is orientable. Contradition. So $M$ must be non-orientable.

Other approach.
Here and here you have alternative approach to non-orientability. Namely.

Theorem $\star$. Let $N$ be a smooth manifold. $N$ is non-orientable, if and only if there are two charts $(U_a,\phi_a),(U_b,\phi_b),$ such that $U_a,U_b$ are connected, $U_a\cap U_b\neq\emptyset$ and transformation function $\phi_{ab}$ neither preserves nor reverses the orientation.

We just need to use this theorem $\star$ twice.
Proof. Since $S$ is non-orientable, we get by $\star$ that there are two charts $(U_a,\phi_a),(U_b,\phi_b)$ of $S$ such as in $\star$. $S$ is open, hence $(U_a,\phi_a),(U_b,\phi_b)$ are charts of $M$ as well. Again by $\star$ we get that $M$ is non-orientable.

Remark. This equivalent condition is very convinient in proving that something is non-orientable. Generally you would have to prove that something (non-vanishing form, oriented atlas,...) doesn't exist. Here you just need to indicate two charts with some properties.
Answer: Another approach: you can read non-orientability on loops, via the first Stiefel-Whitney class: $M$ is orientable if and only if $w_1(TM)=0$.
If $$\iota : S\hookrightarrow M$$
is your inclusion map, then $$w_1(TS)=\iota^\star(w_1(TM))$$
so that if $M$ is orientable, then so is $S$.
Concretely, a manifold is non-orientable if and only if there is an embedded loop along which the orientation is reversed $(\star)$. The first Stiefel-Whitney class takes the non-trivial value $1\in \Bbb Z/2\Bbb Z$ on such a loop.
$(\star)$ equivalently, a loop that cannot be lifted into a loop in the $2$-fold orientation covering.

Non-orientable submanifolds


Using Razor inside Javascript (not MVC)

Question: I'd like to know if in my case I can use razor inside javascript!

This is just a basic code from Google that will show a pie chart with static values and I would like to add some variables to the numbers in the chart so that they can change based on data on my page.
data.addRows([
      ['Mushrooms', 3],
      ['Onions', 1],
      ['Olives', 1],
      ['Zucchini', 1],
      ['Pepperoni', 2]
    ]);

Basically this is the part that matters in that case, I would like to swap the numbers in this code to razor variables like for example @number or something, is this possible?
While searching around for some answers I found that adding  in the javascript code would make it allow razor but I couldnt make it work, when I did that the chart didnt even show up, just by adding <text>, not even any razor code.
Or if you have experience with Google Charts API and know how to do this in a better way overall!
Comment: As a guide, *never* use injected values into JavaScript code, except for the most trivial info. It bypasses all the advantages of separate JS files (bundling, caching, TypeScript etc). Instead just inject values into the DOM (e.g. `data-` attributes) or worst case just inject a few global vars for your scripts to pickup.
Comment: Know anywhere specifically where I can read and learn about this? @goneCoding
Comment: Just imparting experience. Learned the hard way over the years of lot of things you shouldn't do as they make maintenance harder :)
Answer: Yes you can use razor inside of the

also, you can render any .net object using
@{
var jsonSerializerSettings = new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() };
<text>

</text>
}

Comment: oh, why didn't I just try it haha? Well, Thanks anyway!

Using Razor inside Javascript (not MVC)


If we are not allowed to put zero at the starting of binomial expansion, then why are we able to put it later, when it is solved?

Question: The binomial expansion of $(x+y)^n$ involves $x^0$ and $y^0$ hence $x,y$ can't be zero. But I have observed that every binomial expansion when in general form works even for the zero values. For example, $(x+y)^2=$$x^2+y^2+2xy$ (general form) for $y=0$ and $x=5$ gives us $25=25$ which is correct, but if we try to put $y=0$ at the starting then we won't be able to use the binomial theorem, as it is.
This works also for complex expansion (like this expansion, and the test is positive). But why is this happening? If we can not put a value at the starting then why are we able to put it later, when it is expanded?
Comment: Related: https://math.stackexchange.com/questions/11150/zero-to-the-zero-power-is-00-1, https://math.stackexchange.com/questions/235081/numbers-to-the-power-of-zero
Answer: Oftentimes, when writing polynomial expressions in general, e.g.
$$p(x) = \sum_{k=0}^n a_k x^k$$
or even the multivariate case like with the binomial theorem,
$$p(x,y) = \sum_{i,j=0}^n a_{i,j} x^i y^j$$
(wherein the binomial theorem can be viewed simply as giving a very simple bivariate polynomial in some sense), we often just use the notational convention that $0^0 = 1$.
Note that this is not mathematicians making the claim that $0^0$, a truly indeterminant expression, is equal to $1$. We are just making that assumption for the sake of notation. For instance, if we weren't allowed to do that, we would have to write
$$p(x) = a_0 + \sum_{k=1}^n a_k x^k$$
which is slightly more cumbersome, and it can get worse than merely just that one extra term. It's just all in the interest of keeping our notation relatively compact.
Hence, if you want to write the binomial theorem without that convention in mind, you have to write
$$(x+y)^n = x^n + y^n + \sum_{k=1}^{n-1} \binom n k x^k y^{n-k}$$