What's the name of this kind of graph?

Question: I would like to create this type of visualization. It comes from a paper about political self-placement in the left-right continuum: Attitudes, Ideological Associations and the Left-Right Divide in Latin America (Weisehomeier, Doyle, 2012).

Does anybody know what these graphs are called and how to create them in R?
Comment: A dotplot, or [dotchart](https://stat.ethz.ch/R-manual/R-devel/library/graphics/html/dotchart.html).
Comment: It might be an effect plot, hard to tell from that specific example.
Comment: Thanks so much!
Answer: As a relief of my reply-as-a-comment, here's a more qualified answer. This kind of graphical output is usually called a dot plot or a dot chart, after Cleveland.1 One dimensional scatter plots are also called dotplots in some statistical packages. As @mdewey  mentioned, this can also be used to show the mean effect of a variable (with its standard error or confidence intervals) on a given outcome, but in this case each "point" are a different kind of aggregated statistic (i.e., the average of numerical values, rather than a frequency of count data).
It is a nice alternative to more classical bar charts, because of its inherent low data-ink ratio, valued by Edward Tufte.2 Moreover, this kind of graphical representation fits nicely into the design of trellis displays, by Becker and coll.,3 which among other things allow for facetting (i.e., conditioning in statistical language) and more (e.g., "shingle") --- Ross Ihaka has a nice presentation on this aspect in his Topic in Computational Data Analysis and Graphics course.
You will probably find many such illustrations on this site, but the main R packages that are generally used are the builtin dotchart function, its lattice counterpart, dotplot, or the ggplot2 package, where geom_point can safely replace geom_bar or geom_hbar (note that geom_dotplot is the equivalent of R's builtin stripchart, for one dimensional scatter plots). The UC Business Analytics R Programming Guide provides some nice illustrations using the latter approach as well.
References
1 Cleveland, W.S. and McGill, R. (1984).  Graphical Perception: Theory, Experimentation, and Application to the Development of Graphical Methods. Journal of the American Statistical Association, 79(387), 531–554.
2 Tufte, E. (2001). The Visual Display of Quantitative Information, (2nd ed.). Graphics Press.
3 Becker, R.A., Cleveland, W.S and Shyu, M.-J. (1996). The Visual Design and Control of Trellis Display. Journal of Computational and Graphical Statistics, 5(2), 123–155.

What's the name of this kind of graph?


Elliptic Curves - Identifying a Torsion Point, with some Rank thrown in

Question: I'm a totally amateur mathematician who discovered elliptic curves this past summer and am quite fascinated by them. I am trying to learn more about them, but I am hampered by having studied Abstract Algebra 35 years and not remembering such things as what a field or Galois Theory is. I'm trying to fill in gaps by YouTube videos, but it is slow-going now. I do know what a group is and in particular what an abelian group is, but that's about all I understand in some of the highly technical materials I've come across.
I have read about something called a Torsion Point. However, almost everything I find about them throws in all of these advanced math concepts such as fields. But instead of coming right out here and asking all of you for a plain English definition of a Torsion Point, please let me ask my own question and see if I have the right idea.
The elliptic curve in question is $y^2=x^3-3x+34$. (Correction of 18 to 34 in that equation - I copied the wrong one from my source document.) The points that are both rational and integers are $(-3,4)$, $(-3,-4)$, $(-1,6)$, $(-1,-6)$, $(2,6)$, $(2,-6)$, $(5,12)$, $(5,-12)$, $(15,58)$, $(15,-58)$, $(29,156)$, and $(29,-156)$. I found that if I started with $P:(5,12)$, the next points became $2P:(-1,6)$, $3P:(-3,-4)$, $4P:(2,-6)$, $5P:(29,-156)$, $6P:(15,58)$. At this point, the multiples of $P$ cease being integers and probably continue infinitely.
Here's my question: is the starting point $P:(5,12)$ the Torsion Point of this elliptic curve? I happened upon it as the first one of the sequence of integer points by trial and error, but would there be an easier way to find it? Also, would this elliptic curve be considered to have rank $= 1$, since it appears that all of the rational points turn up with just one starting point? I have seen some examples of elliptic curves with rank given, but again, sometimes the language of Abstract Algebra and other advanced math disciplines gets in the way of understanding how this is computed.
Thanks for any plain English help that anyone can give me on this.
Comment: Can you double-check your calculations? At $x = -3$, I get $y^2 = -27 + 9 + 18 = 0$, and so $(-3,0)$ is a point on the curve (which happens to be a torsion point!). I can add more later, including how to calculate the points on the internet.
Comment: I suggest the LMFDB website. A quick lookup shows that your curve is [LMFDB label 720.a2](https://www.lmfdb.org/EllipticCurve/Q/720/a/2) of rank $1$ with one generator point $P=(1,4)$ and one 2-torsion point $T=(-3,0)$. It lists the only integral points as $(-3,0),(-2,\pm 4),(1,\pm 4),(3,\pm 6), (21,\pm 96).$
Answer: If you understand what $nP$ means, then here is what torsion means: a point $P$ is torsion if some multiple $nP$ of it is equal to the identity (that is, the point at infinity). It is a highly nontrivial fact which was proven by Mazur that for elliptic curves over the rationals, to check that $P$ is not torsion it suffices to check that none of the multiples $2P, 3P, 4P, \dots 12P$ are the point at infinity. So if you compute these multiples for your point $P$ and none of them are the point at infinity then $P$ is not torsion.
An elliptic curve over $\mathbb{Q}$ has rank $1$ if all of its rational points can be generated by a single point $P$, which is not torsion, together with some other points which are torsion. I don't know whether that's true in your case because I don't know what all the rational points are. You say you've found all the integer points, but you need to be able to generate all the rational points too.
(As a historical note, "torsion" means "twist." It's not at all obvious what the above definition has to do with twisting; this is actually quite a long story and involves algebraic topology, specifically some groups that appear in that subject which sometimes have nontrivial torsion in a way that is related to "twists" in some topological space. It would take quite awhile to explain what this all means but in any case it's not a random word that comes out of nowhere, there are specific historical reasons for it.)
If you haven't found it yet then I can warmly recommend Silverman and Tate's Rational Points on Elliptic Curves, which was written to be accessible to undergraduates and I think does a good job at conveying the essential ideas without getting bogged down in technical details.
Comment: Thanks for your reply. I have heard about the Silverman and Tate book. I am going to see if any of the local college libraries around me have it as a "real" book. The trend these days is for college libraries to have some books as ebooks, which only students and staff can access. Through my public library, I have access to an ebook of "Elliptic Tales" by Ash and Gross, but I haven't had time to explore it yet. Do you know anything about it and if it may be able to answer some of my questions?
Comment: I don't know anything about that book, but I've read *Fearless Symmetry* by the same authors and liked it.
Answer: I guess your curve is $y^2 = x^3 - 3x + 34$. The set of integral points on this curve is exactly the one you describe. I found that using the Sage Cell Server to make a short computation. Here is a link to a particular cell I made. It lists the points $(x,y)$ instead as $[x:y:z]$ as:

[(-3 : 4 : 1),
(-1 : 6 : 1),
(2 : 6 : 1),
(5 : 12 : 1),
(15 : 58 : 1),
(29 : 156 : 1)]

The general way you find a curve $y^2 = x^3 + Ax + B$ on the Sage Cell Server is EllipticCurve([0,0,0,A,B]).
Let's talk about $P = (5,12)$. The answer is that $(5,12)$ is not a torsion a point. Here are the first few multiples of $P$:
\begin{align*}
P &=(5,12)\\
2P &= (-1,6),\\
3P &= (-3,-4),\\
4P &= (2,-6),\\
5P &= (29,-156),\\
6P &= (15,58),\\
7P &= (29/25,708/125),\\
8P &= (-55/16, 123/64),\\
9P &= (-11/81, -4276/729)
\end{align*}
and so on.
One definition of a torsion point is that the set $P$, $2P$, $3P$, ... eventually repeats. This condition recaptures the one that Qiaochu Yuan gave above, but it also provides a slightly different mode of thinking. To show $P$ is torsion, you just need to work you way back to $P$ by using $2P$, $3P$, and so on. All the points you travel through along the way will also be torsion points, by the way. Therefore, we use the indefinite article a torsion point rather than the definite the torsion point.
How do you prove a point $P$ is not torsion? Qiachou Yuan gave one possible response and you can happily use that. But you actually stumbled upon part of the calculation you can make as well, and I put it above on purpose. Once you reach the point $7P$ you find the fractional coordinates
$$
7P = (29/25, 708/125).
$$
At that point, you can definitely say $P$ is not torsion. In fact, there is a theorem called the Nagell-Lutz Theorem that implies that the torsion points $Q$ are among the ones with whole number entries, which is the same as asking that $Q$, $2Q$, $3Q$, and so on all have whole number entries. The theorem holds for any elliptic curve $y^2 = x^3 + Ax + B$ where $A$ and $B$ are integers.
One benefit of the Nagell-Lutz criterion is that it requires less sophisticated technology to explain. It is in the second chapter of the Silverman-Tate reference Qiachou Yuan provided. I taught this once to a seminar course, and I remember the language of group theory being completely suppressed.
Nagell-Lutz is also the kind of criterion that you can see intuitively. The key point is that while torsion points cycle back to themselves, the other points have denominators that grow and grow. That's what you see with the $25$, $16$, $81$ in $7P$, $8P$, and $9P$ above. To take this more extreme, the $x$-coordinate of $50P = (x,y)$ has denominator:
$$
29325506545286020892676923992167095134964591049812393987794767409
$$
and that is nothing compared to $1000P$!
Finally, I address your second question. For each curve you have the torsion points (the ones that cycle back to themselves) and then you have the non-torsion points. The rank of the curve measures how many non-torsion points there are. For your curve $y^2 = x^3 - 3x + 34$ in fact you did stumble upon it having rank one, in the sense that every point is generated by your point $P$. You can find the numerical values like that using the Sage Cell Server or the LMFDB (linked in a comment above).
I'll have to leave it there today. Thank you for the interesting question.
Comment: Yes, I copied the problem incorrectly from my source document. 18 was another problem I haven't done much work on yet. I have corrected it in my original post.
Comment: Thanks for your explanation. I have found in multiple places online an elliptic curve in which the points with integer values eventually repeat: $y^2=x^3+1$. P is (2, 3). I will explore the resources that you and others have recommended.


State of the art method(s) to find zero mean portions of a time series

Question: I have noisy time series which I need to segment into those portions with a zero mean and those portions without a zero mean. Finding the boundaries as accurately as possible is important (clearly where the boundary precisely lies is a bit subjective). I think a cusum variant could be adapted to do this but as cusum is primarily about finding single changes that leaves the whole segmentation strategy completely unaddressed.
I'm sure a bunch of research has been done on this problem but have not been able to find it.
P.S. The amount of data in these time series is quite large, i.e. up to hundreds of millions of samples, and an individual sample can be a vector with a couple of hundred components, so a method that can be computed reasonably quickly is a significant factor.
P.P.S There isn't a segmentation tag, hence the classification tag.
Answer: It seems that the main issue here is efficient change-point detection, as after that the mean of the segment can be found trivially with increasing accuracy in the number of samples. Once recent approach that might be interesting is Z. Harchaoui, F. Bach, and E. Moulines. Kernel change-point analysis, Advances in Neural Information Processing Systems (NIPS), 2008.
Answer: This may not be state of the art, but an intuitive method would be smoothing the data by placing weights on the observations close to each point in time.
So if you want to know whether sample R has a zero mean at time T:
<code>mu(R,T)=w1*Sample(R,T)+w2*Sample(R,T-1)+w3*Sample(R,T+1)....
</code>
Perhaps exponential weights can be a good choice, depending on the definition of where the boundry lies.
After taking care of some technical details like the definition at the start and end of each somple you can now simply test whether each mu is close enough to zero to find the points where the mean is zero.


Is my solution for this integral problem correct?

Question: Can anyone tell me if I made any errors in my solution and whether or not my answer is correct? Is there a better/quicker method to solving this?
If you can't see the writing very well (and therefore can't see my work and answer very well), then note the problem is read as "the integral from 0 to infinity of $\cos(bx)(x-\log(e^x-1)~dx$ where $b>0$"
\begin{align}
\require{cancel}
\int_0^\infty e^{-ax}\cos(bx)~dx&=\sum_{n=0}^\infty\frac{(-1)^n}{(2n)!}\int_0^\infty\cos(bx)(bx)^{2n}~dx\\&=\sum_{n=0}^\infty\frac{(-b^2)^n}{(2n)!}\int_0^\infty e^{-ax}x^{2n}~dx \quad\boxed{u=ax,~du=a~dx,~x=\frac ua} \\
&= \frac1a\sum_{n=0}^\infty\frac{(-b^2)^n}{(2n)!(a^2)^n}\int_0^\infty u^{2n}e^{-u}~du\\&= \frac1a\sum_{n=0}^\infty\left(\frac{-b^2}{a^2}\right)^n\frac{\cancel{(2n)!}}{\cancel{(2n)!}}\\&= \frac1a\sum_{n=0}^\infty\left(\frac{-b^2}{a^2}\right)^n=\frac1a\left[\frac1{1+\frac{b^2}{a^2}}\right]=\frac a{a^2+b^2}
\end{align}
\begin{align}
\require{cancel}
\int_0^\infty e^{-ax}\cos(bx)~dx=\frac a{a^2+b^2}\implies
\frac1{\cancel a}\left[\frac{\cancel a}{a^2+b^2}\right]&=\frac1a\int_0^\infty e^{-ax}\cos(bx)~dx\\&= \sum_{a=1}^\infty\frac1{a^2+b^2}=\sum_{a=1}^\infty\int_0^\infty\frac{e^{-ax}}a~dx
\end{align}
$$\implies \frac{\pi b\coth(\pi b)-1}{2b^2}=\int_0^\infty\cos(bx)\sum_{a=1}^\infty\frac{e^{-ax}}a~dx\implies \sum_{a=1}^\infty\frac{e^{-ax}}a=\frac{e^{-x}}{1-e^{-x}}=\frac1{e^x-1}$$
\begin{align}
\implies-\sum_{a=1}^\infty\frac{e^{-ax}}a=\int\frac1{e^x-1}~dx&\implies\sum_{a=1}^\infty\frac{e^{-ax}}a=-(\ln(e^x-1)-x)=x-\ln(e^x-1)\end{align}
$$\implies\small\sum_{a=1}^\infty\frac{e^{-ax}}a=\int_0^\infty\cos(bx)\sum_{a=1}^\infty\frac{e^{-ax}}a~dx=\int_0^\infty\cos(bx)(x-\ln(e^x-1))~dx=\frac{\pi b\coth(\pi b)-1}{2b^2}$$
Comment: [Here's a MathJax tutorial](http://meta.math.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference) :)
Comment: I apologize for any poorly written notation and/or poor etiquette. This is my first time on any website like this. So far pointguardo edited a few notational errors, than you!
Comment: I have edited the post to now use MathJax. Feel free to [edit] it if you see anything wrong, and please use MathJax in the future to the best of your ability. For lengthier posts, please use [the sandbox](https://math.meta.stackexchange.com/q/4666).
Comment: @SimplyBeautifulArt Didn't know about $\cancel{cancel}$ til today! Cool!
Comment: It seems that you've use the symbol $\implies$ to indicate your route, i.e. not necessarily implications. If you could organize your expressions, maybe it would be more digestible for us…? Also rigorously speaking the infinite sum and the integral signs are not interchangeable in general, but in your solution they seems to be reasonable.
Comment: Yes, @xbh is correct. The conditional symbol is definitely not meant to indicate implication. On paper I have some personal habits of guiding myself in my own way.
Answer: You want to double-check your correct conclusion that if $b>0$ then $$\int_0^\infty\cos bx \ln(1-e^{-x})dx=\frac{1-\pi b \coth \pi b}{2b^2}.$$Here's a slicker way: $$-\sum_{n\ge 1}\frac{1}{n}\Re \int_0^\infty\exp-(n-ib)xdx=-\sum_{n\ge 1}\frac{1}{n^2+b^2}.$$Finish with $$\coth \pi b=\frac{1}{\pi b}+\frac{2b}{\pi}\sum_n\frac{1}{n^2+b^2}.$$


Classes & Defines in Puppet

Question: Although I know the immediate solution to a problem I was facing yesterday (thanks to the folks over at IRC #puppet), I still don't understand how it solved the problem, or rather what's the fundamental difference between classes and defines in this particular scenario:
The original define, which was incorrect:
define srv($name,$enable="true",$ensure="running",$provider="runit",$hasstatus="true",$hasrestart="true"){

                exec {"sleep 5": path=>"/usr/bin:/usr/sbin:/bin:/sbin", before=>Service["$name"],}

                service{"$name":

                    enable=>$enable,
                    ensure=>$ensure,
                    provider=>$provider,
                    hasstatus=>$hasstatus,
                    hasrestart=>$hasrestart,
                }
                              }

err: Could not retrieve catalog from
  remote server: Error 400 on SERVER:
  Duplicate definition: Exec[sleep 5] is
  already defined in file
  /etc/puppet/modules/common/manifests/defines/srv.pp
  at line 4; cannot redefine at
  /etc/puppet/modules/common/manifests/defines/srv.pp:4
  on node testing.abc.def.com

The correct define:
define srv($enable="true",$ensure="running",$provider="runit",$hasstatus="true",$hasrestart="true"){

                exec {"sleep 5 for $name": command=>"sleep 5", path=>"/usr/bin:/usr/sbin:/bin:/sbin", before=>Service["$name"],}

                service{"$name":

                    enable=>$enable,
                    ensure=>$ensure,
                    provider=>$provider,
                    hasstatus=>$hasstatus,
                    hasrestart=>$hasrestart,
                }
                              }

So, why the error in the first case ? How am I duplicating a definition or in other words, if there was a single module using this define then would have the first define worked ? Maybe its the puppet terminology in the docs that has left me confused, but having written a ton of (working) modules and not understanding this sounds dangerous to me, hope I can get some clear answers.
Answer: Resources in Puppet have to be unique, i. e. have to have a unique name.
In the described case, you had the resource Exec["sleep 5"] in your definition and every time you call  srv (it's basically the same as including a parameterized class), the resource Exec["sleep 5"] will also be included and thus the parser finds two or more resources with the same name.
By appending the $name of the definition to the name of your Exec resource, you make it unique. Well, at least most likely unique since when you have another resource with the same name (Exec["sleep 5 for foo") somewhere else in your manifests, you'll run into this error again.

Classes & Defines in Puppet


R and EViews differences in AR(1) estimates

Question: The main problem is:  I cannot obtain similar parameter estimates with EViews and R.
For reasons I do not know myself, I need to estimate parameters for certain data using EViews. This is done by picking the NLS (nonlinear least squares) option and using the following formula: indep_var c dep_var ar(1)
EViews claims that they estimate linear AR(1) processes such as:
$$
Y_t = \alpha + \beta X_t + u_t
$$
where $u_t$ errors are defined as:
$$
u_t = \rho \cdot u_{t-1} + \varepsilon
$$
by using an equivalent equation (with some algebraic substitutions):
$$
Y_t = (1 - \rho) \alpha + \rho Y_{t - 1} + \beta X_t - \rho \beta X_{t - 1} + \varepsilon_t
$$
Furthermore, this thread over at the EViews forums suggests that their NLS estimations are generated by the Marquardt algorithm.
Now, the go-to R function to estimate AR(1) processes is arima. However, there are two problems:

the estimates are maximum likelihood estimates;
the intercept estimate is not actually the intercept estimate (according to R.H. Shumway & D.S. Stoffer).

Therefore, I turned to the nlsLM function from the minpack.lm package. This function uses the Marquardt algorithm to achieve nonlinear least squares estimates, which should yield the same results as the EViews implementation (or very similar ones, at least).
Now the code. I have a data frame (data) with an independent variable and a dependent variable such as the one generated by the following code:
data <- data.frame(independent = abs(rnorm(48)), dependent = abs(rnorm(48)))

To estimate parameters in the equation EViews claims to estimate (3rd one on this post), I use the following commands:
library(minpack.lm)
result <-
nlsLM(dependentB ~ ((1 - theta1) * theta2) + (theta1 * dependentA) +
                    (theta3 * independentB) - (theta1 * theta3 * independentA),
data = list(dependentB = data$dependent[2:48], dependentA = data$dependent[1:47],
   independentB = data$independent[2:48], independentA = data$independent[1:47]),
start = list(theta1 = -10, theta2 = -10, theta3 = -10)
)

Unfortunately, the estimates output by nlsLM are not close to the ones output by EViews. Do you have any idea of what might be causing this? Or maybe my code is wrong?
Finally, I would like to say that I personally am an R user - that is exactly why I'm trying to do this in R instead of EViews. I would also love to provide you the data I'm working with but it's impossible since it's confidential data.
Comment: Welcome to the site, @Fael. +1 for a clear question.  I took the liberty of tweaking the formatting slightly to make it cleaner. Please make sure it still says what you want.
Comment: You cam always scale/code the data and post it. a transformation of the form [(y-constant1)/constant2 ] will do the trick.
Comment: Wow, that was really nice of you. Thanks a lot, @gung !
Comment: BTW: Parameters of linear processes can be estimated through OLS.
Answer: Your NLLS has four ortoghonality conditions, one per variable plus the constant (analogue to normal equations in standard OLS) to solve for three parameters ($\rho, \beta, \alpha$ ). The Non-linear algorithms often have heterogenous configurations for tolerance parameters across softwares. MAy I suggest you drop $X_{t-1}$ from your equation in order to get exactly identified system and then test Eviews against R ? if both agree, it probably means one of them has troubles with the overidentification.


Como fazer um autorelacionamento M:N no Entity Framework?

Question: Boa tarde,
Preciso fazer um autorelacionamento e estou bem confusa como devo fazer isso.
Em meu sistema eu tenho diversas variáveis de processo, uma mesma variável de processo pode ser Pai de diversas outras variáveis, mas essa mesma variável também pode ser filha de outras variáveis.
Vi algumas maneiras de fazer autorelacionamento, mas nenhuma delas pareceu "certa" pro meu caso.
public class VariavelProcesso
{
 public int VariavelProcessoId { get; set; }

 public int? VariavelPaiId { get; set; }
 public virtual VariavelProcesso VariavelPai { get; set; }
 public string Nome { get; set; }
}

Comment: O título diz uma coisa e o texto diz outra.
Answer: Qual a versão do EntityFramework está utilizando? Utilizando .Net Framework ou já é .Net Core?
Considerando o uso do EF Core 2.x ou superior
public class VariavelProcesso
{
    public int VariavelProcessoId { get; set; }
    public int? ParentVariavelProcessoId { get; set; }
    public string Nome { get; set; }

    public virtual VariavelProcesso Pai { get; set; }
    public virtual HashSet<VariavelProcesso> Filho { get; set; }
}

//Fluente API

modelBuilder.Entity<VariavelProcesso>()
    .HasOne(x => x.Pai)
    .WithMany(x => x.Filho)
    .HasForeignKey(x => x.VariavelProcessoId);


Why the difference between double and electric bass fingering?

Question: Sheet music with tabs is provided for Charles Mingus' Haitian Fight Song. They differ from one another (obviously, or why provide two different tabs). My question, though, is, why? Note that I do not own a double/upright/acoustic bass and have never played one, so I'm clueless about why one fingering is preferred over another, depending on whether you're playing a "guitar" or a cello-on-steroids.
Here's what I'm talking about:
Comment: TAB is quite whimsical - depending who's writing it, for guitar, bass or string bass. Is the probable answer.
Comment: @ToddWilcox I've yet to see a electric bass that is as tall as a person, and I have yet to see a double bass that isn't.
Comment: I suspect part of the reasoning is that bends might sound better on electric bass than upright bass, so it gets more same-string tabs.
Comment: Is the scale length on a double bass longer than electric bass?
Comment: @DKNguyen  look harder :-) .  You can get 1/4 size acoustic basses for kids to start out on.
Comment: @Tim But the same cat (Luke from Become a Bassist) transcribed them both. He mentions in the video (from 9:03 — https://www.youtube.com/watch?v=5n219PwWTMc) that there's a difference, but doesn't explain why.
Comment: Maybe it's because the cat [went to law school instead of music school](https://www.youtube.com/watch?v=lGOofzZOyl8).
Comment: @DKNguyen Yeah not sure why I didn't just search. Double basses are about 10" (33%) longer scale length than bass guitars. I wouldn't be surprised if that's a factor.
Answer: I play both basses, am influenced by Mingus (among others) and have heard and played this bass line many times before so here is the skinny:
First, there is no reason to play this differently on electric than on upright. This is a generalization but electric players tend to play a bit more across the strings (hence the different fingering) and upright players tend to play a bit more on a single string. One of the reasons for this is upright players like to take advantage of the improved timbre you get with a longer string length on any note that can be played on different strings.
The thing about this line is the vibe you get from playing it predominantly on a single string, very much like "So What" by Miles Davis. If you play it both ways on electric you will notice a difference, I guarantee it.
Both of these TABS are wrong. Here is the way it is actually played on upright (and should be played on electric) My corrections to tabs and/or notations are in blue for clarity and fingering is in red, explained later:

First, it starts with a D 8th note pickup, which was omitted. The notes on 2+ are all G's not D's. D's are only played on the 4+ for the pickup and on bars 1,2,4 and 5. That makes it about an 80-90% G string line. It's a small thing but the Bb in bar 4 is actually played on the D string. If you listen closely you can hear the string crossing. It makes the fingering easier to play that Bb there. The first 4 bars are repeated, not all 8. Bars 7-8 have the right notes but were tabbed completely incorrectly and illogically (to an upright player). You can hear Mingus work his way down the G string then play the 2 open strings at the end of bar 7.
Another very important aspect to consider is the difference between upright and electric fingering (your title question). Because of the extra string length of an upright (about 42" to an electric's 34"), upright players only cover 3 notes with fingers 1,2 and 4. The ring finger only mirrors the pinky. Some electric players also do this but most play 1,2,3,4 which is not practical on upright unless you have VERY long fingers.
The fingering, in red is for upright. I encourage electric players to try this fingering to get the feeling of the line and also how upright players play. There is one exception in bar 7, upright players will sometimes use their 3rd finger in the upper register and for playing harmonics. It is a bit more comfortable ergonomically. Hope you enjoy!
Answer: Electric bass and upright bass are completely different instruments. They happen to have their strings tuned to the same notes, but that's roughly where the similarity ends.
An electric bass is basically just a slightly bigger guitar with fewer and thicker strings. It can be played almost like a classical guitar (though that's not necessarily the best way to approach it). In particular, perhaps even more than guitar, every position is equally well playable on electric bass. You don't tend to even think much in absolute terms, what string is this and that note on, rather you have certain patterns that relate to the position you're currently playing in. Open strings are seldom used. It is usually possible to select one position that works for a whole passage, because you have four fingers that can cover four of the five notes before the next string takes over, so unless a passage has a lot of chromaticism, it's generally the easiest to just stay in that position; often players prefer position like fifth† over the lowest positions as long as the lowest E-string notes aren't required, both because the fret spacing is narrower in higher positions (thus make the four-finger playing style yet a bit easier), and because using the thicker strings at shorter length tend to give a bit of a thicker, warmer sound than the open or low-position strings.On the other hand, shifting between positions is a bit of a hazard because the instrument is free to slip and dangle and also because of the very similarness between the positions, which means it's almost necessary to look at the fingerboard whenever changing position. No big deal, the fingerboard is marked for the purpose – though, anything you can do blind is better to do blind.
The last point is even actually much more important for double bass in classical music. In the orchestra, looking at your finger board is pretty much a no-no – your eyes are busy switching between the music and the conductor and/or section leader. And for bowed string instruments there's actually not much you could do by eye anyway – the view angle is wrong and there are no markings on the fingerboard. Not to mention, it is more important to get the position exactly right than on a fretted electric.
As a result, the playing technique of bowed strings relies much more heavily on some absolute "anchor" positions. (On cello these are mainly first† and fourth position; I think same for double bass.) Of course, that doesn't mean you can only play in those anchor positions, but it does mean you think about the other positions in a different way than e-bass does – each position has its own character, and is mostly thought of in terms how far of a shift it is from the nearest anchor position. And you normally wouldn't stay for a long time in e.g. third position, but rather switch briefly to e.g. fourth, or to an open string, or a harmonic – anything that re-calibrates your spatial awareness is good for intonation, as well as good to avoid a cramp from getting rutted down in that static position.
That's where the other important difference comes in: double bass is much, much more physically demanding than electric bass. Although someone with big hands may be in principle be able to employ the same "finger-per-fret" system as electric, this is hardly feasible in practice: the spread-out hand makes it difficult to put down enough pressure, and it's exacerbated by the fact that the scale length requires even wider spread than electric on the lowest positions. Therefore, few players ever do it this way. Instead, they put only two diatonic fingered notes in each string+position combination (or three chromatic ones), using ring finger and pinky as one unit. And that means that full scale runs require either open strings or position shifts in between. From an electric-bass perspective this is a nuisance, but again: the bowed strings anyway have other reasons why position shifts are a good idea, and because the instrument stands firmly on the ground and has physical features (in particular the neck joint) that makes the anchor positions easy to find without looking, this is actually a good thing.
So, what does all that mean for the Mingus example? Well, on electric bass the whole groove can be comfortably played in fifth position. There's no good reason to do it different. You could certainly do it more like the double bass original, but there are quite a few reasons not to:

The open G string on normal electric basses just doesn't sound as good as it does on double bass. If you pluck it like any other note, it'll be feeble and thin, if you pluck it extra-soft over the fingerboard it'll be dull. If you use EQ to compensate, you'll ruin the sound of the rest of the instrument. And why would you, since the 5th-fret D string works perfectly fine!
Electric bass requires careful damping of strings that aren't supposed to sound. Generally, the right hand damps the bass strings and the left hand damps the treble strings. By staying in fifth position the latter works almost automatically – a finger on the D-string can easily touch the G string to stop it from ringing, a finger that just leaves the D-string can still dampen its old note together with the RH finger that plucks the next note on the G string. Now – this wouldn't be much of a difficulty in first position w/ open strings either for this simple motif, but for faster melodic runs this can absolutely be a consideration. Even here, it's a good idea to make your hands' work as easy as possible so you can concentrate on nailing the tone / expression / groove. Even a little bit of sympathetic vibration on unwanted strings tends to make the sound muddy and unfocused.Although damping isn't irrelevant on double bass either, the RH naturally lies such that it securely stops the low strings, and some light disturbances on other strings also aren't as problematic simply because double bass needs much more force to make a string audibly sound.
While the groove is slow enough that it also wouldn't be difficult on electric to put lots of position changes in, there's another issue that would be annoying in this piece: position changes cause a bit of a squeaking sound, as the hand slides along the roundwound strings. Doesn't matter in a loud rock song, but in the intro here it would definitely annoy me.(Flatwound strings don't have this problem as much, but they also sound always rather dull on electric – it's not my taste. Double bass uses flatwounds too, but the combination of long scale, acoustic body and loudly audible interaction between the strings and fretless fingerboard makes them sound much brighter than on an electric.)

†Important note: bowed strings and guitars use different terminology for their positions. Bowed strings number them diatonically, i.e. fourth position is the position where the index finger plays the A-string on the fourth scale note (which is a perfect fifth up, i.e. an E... the term "fifth" being of course a misnomer as it's actually the interval of size four). Guitars number them chromatically, i.e. seventh position on electric bass corresponds to fourth position on double bass.
Comment: Comments are not for extended discussion; this conversation has been [moved to chat](https://chat.stackexchange.com/rooms/140677/discussion-on-answer-by-leftaroundabout-why-the-difference-between-double-and-el).
Answer: Just guessing here: Uprights tend to sound better/louder in the lower registers since there is "more string" involve in the same note, so there is more mechanical energy if you fret it as close to the head as possible. You also need to dig in pretty hard and which creates a strong transient in the beginning of the note.
Electric basses on the other hand tend to have a volume knob, so optimizing for loudness isn't much of an issue. You can play more gently and open strings tend to have a lot more sustain and can be overpowering or ring. Some player like to avoid open strings to be able to stop/dampen the note anytime with the fretting hand and it sounds a bit more uniform this way.
The E-bass fretting gives you always full control over the D-string so it can't ring.
Comment: this is a useful point.


Até que ponto não é aconselhável usar uma ORM?

Question: Estou trabalhando em um sistema muito grande utilizando .NET (ASP.NET MVC) a aplicação requer um nível crítico de desempenho. Até que ponto vale ou não a pena utilizar uma ORM? Existe alguma ferramenta que eu possa comparar em termos de desempenho os ORM'S e SQL puro?
Eu sei que existe uma diferença de desempenho entre SQL puro e ORM, não sei se é os Active Record's ou os ORM's em gerais são mais lentos em comparação com SQL puro, caso considere usar um ORM, qual deles provavelmente tem o melhor desempenho: EF ou NHibernate?
Sei que tudo também depende da estrutura do banco e das boas práticas, mas de modo geral para um sistema muito grande considero uma ORM? Já que o custo beneficio em relação à manutenção do sistema é muito mais alto do que não utilizando.
Comment: Essa pergunta poderia ser considerada "Principalmente baseada em opiniões" ?
Comment: Prefiro não usar. ORM torna muito fácil "esquecer" que existe um banco de dados relacional na jogada, e o código começa a pender para formas ineficientes de manipular o banco.
Answer: Eu sou a favor de uma abordagem mista

Utilize o ORM ao máximo para melhorar a legibilidade e a produtividade. No C# ou VB.Net é possível usar o LINQ, que é uma ferramenta extraordinária em termos de produtividade. Quanto mais simples melhor.
Quando for necessário aumentar a performance, ou quando o ORM não oferecer as ferramentas adequadas para o trabalho, estude mais a fundo o ORM escolhido e busque informações na internet, e só então, parta para o SQL.
Os ORM's geralmente permitem usar uma linguagem parecida com SQL, ou então permitem utilizar SQL com formatação específica, o que é um ponto intermediário.

Qual escolher?
Trabalho com ambos, o NHibernate possui mais recursos, é mais flexível, e possui muitas ferramentas e bibliotecas de extensão, entretanto o EntityFramework é mais simples e mais fácil para se utilizar, além das ferramentas se integrarem ao Visual Studio.

Para um projeto que nasce com BAIXA demanda
Escolher entre EntityFramework e NHibernate, neste caso pode se reduzir a uma questão de costume, ou seja, use aquele que é mais familiar.
Se tiver que aprender uma delas, eu escolheria o EntityFramework, ele usa tecnologias mais atuais, e está evoluindo rapidamente.
E se você já conhece ambos, iria de EntityFramework também, pois é mais simples de se trabalhar, além de ter integração com o Visual Studio, o que ajuda muito na produtividade.
Para um projeto que nasce com ALTA demanda
Para um projeto que já vá nascer com grande carga de dados/usuários/expectativa (imagine um sistema para uma empresa gerenciar milhares de funcionários), ai eu ainda recomendaria o NHibernate... é uma tecnologia que com certeza não vai te deixar a desejar nada.

Referências

NHibernate X Entity Framework
Entity Framework 5 and 6 vs NHibernate 3 – The State of Affairs inglês
Entity Framework 6 vs NHibernate 4 inglês
Comment: Concordo com o ponto de vista do @miguel-angelo. O ORM facilita e muito sua vida, como você mesmo disse, o sistema precisa de um nível crítico de desempenho, nesse caso é muito bom você utilizar o ORM para consultas mais "SIMPLES" (entenda simples como consultas que não necessitem de um extremo e poderoso envolvimento das tabelas, como desnormalização, joins com muitas condições e coisas similares). Sem contar que muitas vezes, através do ORM, você consegue  ter uma legibilidade melhor do código e tbm poderá evitar muitos erros de escrita de query por conseguir ver + facil os relacionamentos.
Answer: Sobre o Entity Framework
A implementação do DbSet<> faz o contexto de dados carregar o registro do banco apenas uma vez durante o ciclo de vida do Controller. Portanto, a diferença de desempenho entre o sistema escrito com SQL puro para o sistema em Entity Framework chega a ser desprezível se o banco de dados estiver normalizado corretamente (ou seja, com chaves primárias únicas e evitando relacionamentos desnecessários, como tabelas que são atualizadas de vez em nunca, podendo ser substituídas por Enums). Por ser muito simples, é o ideal para o início de desenvolvimento de um sistema. A desvantagem é a falta de suporte a outros bancos, como o Oracle, por exemplo.
Sobre o NHibernate
É uma solução mais antiga que o Entity Framework, advinda do Java quando o ORM começou. Possui mais opções de configuração e trabalha melhor com outros bancos de dados que não sejam SQL Server. Entretanto, a abordagem para Code First ainda é um tanto prolixa, o que o torna mais lento que o Entity Framework para iniciar um projeto em termos de produtividade, sendo mais recomendado para projetos grandes que já estejam implementados e trabalhem com grandes massas de dados, o que exige uma sintonia fina das configurações.
Até que ponto não é aconselhável usar uma ORM?
Esta parte é um tanto baseada em opiniões, mas inicialmente eu diria que não há restrições, visto que os frameworks ORM possibilitam a execução de SQL puro em etapas em que haja gargalos de desempenho. Sendo assim, nem a produtividade nem o desempenho são comprometidos.

UPDATE
A Oracle desenvolveu seu provedor de dados com o Entity Framework, finalmente. Com isto, está vencido o problema de conectividade entre Oracle e Entity Framework.
Um tutorial também foi elaborado pela equipe do Oracle para sanar eventuais dúvidas que possam surgir na integração.
Answer: Defensores do ORM dirão que isso não se aplica a todos os projetos: nem todos necessitam executar joins complexos; e que o ORM é uma solução 80/20, em que 80% dos usuários necessitam de apenas 20% das funcionalidades do SQL. Mas posso dizer que isso não tem sido verdade. Somente no início de um projeto se pode trabalhar sem a utilização de joins ou usando-os de maneira simplista. Depois, será preciso otimizar e consolidar consultas. Mesmo considerando que 80% dos usuários utilizem somente 20% das funcionalidades do SQL, 100% terão que violar a sua abstração para fazer o que precisa ser feito.
•   As vantagens da utilização de ORM desaparecem com o aumento da complexidade pois é necessário promover uma quebra da abstração forçando o desenvolvedor a lidar com SQL;
•   Objetos não são uma forma adequada de representação de queries relacionais;
•   Ao invés de se utilizar bases de dados relacionais e ORM como solução de todos os problemas, se seus dados são objetos por natureza utilize NoSQL;
•   Design OO não pode representar dados relacionais de forma eficiente, isto é uma limitação fundamental do design OO que ORM não pode lidar.
Resumindo: ORM e um tiro no pé no meu ponto de vista.
Answer: A pergunta é bem opinativa, na época era bem aceita, tem opiniões aqui e decidi pôr a minha que é diferente.
Porque usar
ORM é uma excelente ferramenta para dar alguma produtividade para criar CRUDs e acessos à dados quando se domina uma dessas ferramentas e precisa dessa produtividade. Ou seja, quando você faz códigos repetitivos que muda só o modelo de dados, mas no fundo o que está sendo feito é o de sempre e não muda muito, é uma mão na roda.
Também pode ser útil na mão de quem não sabe lidar bem com os mecanismos de persistência de dados. Não quer dizer que o ORM tornará tudo ótimo, mas há uma tendência da pessoa errar menos, principalmente em termos de segurança quando usa algo pronto.
Isso acaba implicando que sejam sempre códigos simples. Quando entra em sistemas complexos todo mundo sabe que tem que começar a contornar o ORM e fazer gambiarras para atender as demandas. E como o futuro sempre reserva incertezas, em algum momento você pode ter um monstro na mão e ele começa a ser pior do que se não tivesse usado.
Na verdade, nem acontece tanto assim, já que muitos sistemas não precisam de manutenção de tão simples que eles são.
Porque não usar
Algumas pessoas adotam para não ter que lidar com SQL. Esse é um dos piores motivos para adotar ORM, inclusive porque qualquer coisa mais sofisticada obrigará usar SQL e do jeito mais difícil, e mesmo quando não precisa usar o SQL não quer dizer que não precisa saber modelar e fazer consultas de forma adequada. A parte difícil é criar os modelos e consultas, não é o SQL.
Outro motivo terrível para adotar o ORM é para facilitar a troca do banco de dados no futuro.
Isso não faz sentido porque quase ninguém troca o DB, e se trocar, o erro foi tão grande que o ORM não vai te salvar. Mesmo que troque, o ORM não faz tudo ficar lindo e maravilhoso. O ORM nivela por baixo, ele não funciona bem em banco de dados algum, salvo os usos mais básicos.
O mais comum da pessoa querer trocar o banco de dados é porque o ORM está criando um gargalo porque ele não aproveita bem os recursos do DB adotado. Ou seja, se você usar os recursos de forma direta e adequada para aquele DB sem passar pelo ORM não teria o problema.
Claro, isso sempre considerando que a pessoa saiba o que está fazendo. Quando a pessoa não sabe, ORM ou não, muda muito pouco, ela vai errar e a sorte vai definir se ela terá um pequeno ou um grande problema. Por acaso a maioria dos casos em que as pessoas usam ORM não faz muita diferença.
O problema da ideia que está fazendo algo simples é que no futuro pode deixar de ser simples, as coisas evoluem, e aí será um problema lidar com o ORM. Então tenha certeza de que o ORM nunca será um problema. Não basta não ser um problema hoje.
Vou concordar com a resposta que diz que as vantagens do ORM desaparecem quando se torna complexo; e que modelo de objetos não são bons para fazer consultas em banco de dados relacionais.
Outro motivo para não usar é porque há brigas religiosas sobre qual ORM usar, a tal ponto que há quem diga que deva implementar uma camada para poder trocar o ORM se for necessário. Nem quero comentar sobre essa atrocidade.
De fato, não é fácil achar qual é o ORM adequado para seu caso. E isso é importante porque você se casa com ele, o que dará para fazer com facilidade depende do que ele oferece, não é tudo igual.
Na prática as pessoas aceitam os defeitos do ORM escolhido nos casos em que ele não se encaixa bem. Ou seja, a solução é péssima.
As pessoas só escolhem o ORM certo depois de escolher muitas vezes o errado. E nem todos conseguem fazer essa evolução, a maioria só aceita o que tem, como dito antes.
MicroORMs
Isso é outra coisa, inclusive as pessoas dizem que nem é ORM porque ele não implementa o padrão Repository ou pelo menos o Active Record.
Pra mim ORM é só o mapeamento de dados entre o banco de dados e a linguagem já que nem sempre tem tipos compatíveis. Algumas pessoas consideram que tem que mapear na forma de objeto. Seja o que for, o chamado MicroORM é algo necessário e útil, a não ser que a linguagem seja integrada com o banco de dados, o que é muito raro.
O ORM full é um "facilitador" para fazer o modelo relacional do banco de dados com o modelo de objeto da aplicação.
Há algo chamado impedance mismatch. Que também é classificado como o Vietnã da Computação.

Outras soluções
Algumas pessoas resolveram o problema acabando com o relacional e adotando NoSQL, assim poderia modelar como objeto no banco de dados. E aí eu não sei nem do que chamar isso, já que o nome apropriado já foi tomado pelo abuso do ORM. Não tem nada pior do que você modelar de forma ineficiente e que dificulta a programação e quase inviabiliza a consistência, só para não usar um ORM ou mudar sua aplicação para a forma que deveria.
É claro que existem casos que o NoSQL é útil, mas não para deixar de usar ORM. As pessoas que adotam o NoSQL admitem que o ORM é coisa ruim, mas resolvem tomar um veneno em vez de uma vacina.
Por que não adotar o modelo relacional na aplicação? Se tudo leva a isto, deveria ser óbvio que é a solução mais adequada. Ela é eficaz, não é difícil de usar, só não é tão bonitinha e não está na moda. Durante muito tempo as pessoas faziam assim e ninguém dizia que era um enorme problema. Um dia alguém apareceu com esse tal de ORM dizendo que era mais bonito fazer assim e as pessoas começaram adotar. Os problemas começaram aparecer depois, mas aí já tinha pegado moda.
Entity Framework x nHibernate
O EF é oficial da Microsoft, evolui muito bem. Dizem que é mais fácil e está ficando rápido, até onde dá.
O NHibernate é mais complexo e poderoso, e tem mais problemas por ser mais antigo. Há quem diga que depois de um tempo você se arrepende de usar algo mais simples, o complexo acaba te ajudando na parte mais difícil. Hoje ele é bem pouco popular e é adotado ou por legado ou moda, ou porque quem tem um conhecimento mais avançado e adota ORM com uma pouco mais de consciência.
Conclusão
Para coisas simples, para algo rápido, para situações em que não cause malefícios, o ORM pode ser usado, e muitos casos são assim.
Mas se quer um sistema mais bem feito, mais eficiente, que você tenha mais controle, que seja mais tranquilo para dar manutenção, onde quer algo de mais qualidade, o ORM não deveria ser usado.
Note que não estou dizendo que sempre que usar ORM não terá qualidade mínima, um prato de 5,00 pode ser nutritivo, gostoso e mata a fome. Um de 50,00 fará o mesmo de forma melhor. Tem hora para tudo.
Não existe caso único que deve ou não usar, depende da pessoa, depende do projeto e depende da demanda de qualidade.
Mesmo com algumas melhoras recentes, se quer eficiência e desempenho, não use ORM. Até para deixar próximo do ideal dá muito trabalho. Mas reforçando, sem conhecimento adequado, terá problemas para obter desempenho com ou sem ORM.
Coloquei no GitHub para referência futura.


Why is a derivative undefined at its discontinuities?

Question: This question deals with why the derivative of $f$ is not defined at discontinuities in $f$. I found the answers satisfactory.
My question deals with why the derivative is not defined at discontinuities in itself. Take the following piecewise function:
$$f(x) = \begin{cases} g_1(x) & x < 1 \\ g_2(x) & x \ge 1 \end{cases} =  \begin{cases} x^2 & x < 1 \\ x & x \ge 1 \end{cases}$$
This function is continuous, but its derivative is not. The function $g_2(x)$ has a derivative at $x = 1$, yet continuously gluing it with $g_1(x)$ apparently removes this tangent. Why is $f'(1)$ undefined instead of $f'(1) = 1$?
Comment: Simply because the limit $\lim_{x \to 1} \frac{f(x)-f(1)}{x-1}$ does not exist.
Comment: For the derivative to exist, one would have to get the same value for the derivative from the right (when $h$ is positive) and the derivative from the left (when $h$ is negative).  Here you get two different values.
Comment: @MartinR I think I get it now. The derivative at a point is defined as a limit as $x$ goes to that point, meaning the properties of having a discontinuity at a value and being undefined at a value are the same for a derivative, because the $\lim_{x \rightarrow a}(\lim_{x \rightarrow a} f(x) ) = \lim_{x \rightarrow a} f(x)$. Therefore, they are equivalent properties.
Answer: The derivative of f(x), at $x= x_0$ is defined as $\lim_{h\to 0}\frac{f(x_0+ h)- f(x_0)}{h}$.
Obviously, the denominator of that fraction is going to 0.  In order for the limit to exist, the numerator, $f(x_0+ h)- f(x_0)$ must also go to 0 which means that f must be continuous at $x= x_0$.
(f being continuous is a "necessary" but NOT "sufficient" condition for f having a derivative. f(x)= |x| is continuous at x= 0 but does not have a derivative there.)
Comment: It IS an anwer to the question asked! That was, why functions cannot be differentiable where they are not continuous.  I added the remark about continuity not being sufficient because  I happened to think about it.  I did not prove it because it was not asked!
Comment: Apologies, I misread your answer. If you make an edit to your answer, I will be able to replace my downvote with an upvote. Currently I am not allowed by the site.


Trying to stop CSS animation at full

Question: Goal: finished product as picture attached with only the bubbles rising inside the glass.
Hey, I am working on this CSS /JS code and I need the final version of filled glass only with bubbles and foam on top (ignoring all the delays and fillings in animations). I tried but somehow unsuccessful, any suggestions where to edit the code? thanks

$(document).ready(function() {
  $('.pour')
    .delay(2000)
    .animate({
      height: '360px'
      }, 1500)
    .delay(1600)
    .slideUp(500);

  $('#liquid')
    .delay(3400)
    .animate({
      height: '170px'
    }, 2500);

  $('.beer-foam')
    .delay(3400)
    .animate({
      bottom: '200px'
      }, 2500);
  });
body { background-color: #0065bd }

h2 {
  margin: 0 auto;
  width: 400px;
  font-size: 36px;
  text-align: center;
  font-family: 'Lato', Arial, sans-serif;
  color: whiteSmoke;
}

#container {
  height: 370px;
  margin: 0 auto;
  overflow: hidden;
  position: relative;
  top: -20px;
  width: 248px;
}

#container div { position: absolute; }

.pour {
  position: absolute;
  left: 45%;
  width: 20px;
  height: 0px;
  background-color: #0065bd;
  border-radius: 10px
}

#beaker {
  border: 10px solid #FFF;
  border-top: 0;
  border-radius: 0 0 30px 30px;
  height: 200px;
  left: 14px;
  bottom: 0;
  width: 200px;
}

#beaker:before,
#beaker:after {
  border: 00px solid #FFF;
  border-bottom: 0;
  border-radius: 30px 30px 0 0;
  content: '';
  height: 30px;
  position: absolute;
  top: -40px;
  width: 30px;
}

#beaker:before { left: -50px; }
#beaker:after { right: -50px; }

#liquid {
  background-color: #0065bd;
  border: 10px solid #0065bd;
  border-radius: 0 0 20px 20px;
  bottom: 0;
  height: 0px;
  overflow: hidden;
  width: 180px;
}

#liquid:after {
  background-color: rgba(255, 255, 255, 0.25);
  bottom: -10px;
  content: '';
  height: 200px;
  left: -40px;
  position: absolute;
  transform: rotate(30deg);
  -webkit-transform: rotate(15deg);
  width: 110px;
}

#liquid .bubble {
  -webkit-animation-name: bubble;
  -webkit-animation-iteration-count: infinite;
  -webkit-animation-timing-function: linear;
  background-color: rgba(255, 255, 255, 0.2);
  bottom: 0;
  border-radius: 10px;
  height: 20px;
  width: 20px;
}

@-webkit-keyframes bubble {
  0% { bottom: 0; }

   50% {
     background-color: rgba(255, 255, 255, 0.2);
      bottom: 80px;
   }

   100% {
     background-color: rgba(255, 255, 255, 0);
      bottom: 160px;
   }
}

.bubble1 {
  left: 10px;
  -webkit-animation-delay: 1000ms;
  -webkit-animation-duration: 1000ms;
}

.bubble2 {
  left: 50px;
  -webkit-animation-delay: 700ms;
  -webkit-animation-duration: 1100ms;
}

.bubble3 {
  left: 100px;
  -webkit-animation-delay: 1200ms;
  -webkit-animation-duration: 1300ms;
}

.bubble4 {
  left: 130px;
  -webkit-animation-delay: 1100ms;
  -webkit-animation-duration: 700ms;
}

.bubble5 {
  left: 170px;
  -webkit-animation-delay: 1300ms;
  -webkit-animation-duration: 800ms;
}

/* Foam */

.beer-foam {
  position: absolute;
  bottom: 10px;
}

.foam-1, .foam-2, .foam-3, .foam-4,
.foam-5, .foam-6, .foam-7 {
  float: left;
  position: absolute;
  z-index: 999;
  width: 50px;
  height: 50px;
  border-radius: 30px;
  background-color: #fefefe;
}
.foam-1 {
  top: -30px;
  left: -10px;
}
.foam-2 {
  top: -35px;
  left: 20px;
}
.foam-3 {
  top: -25px;
  left: 50px;
}
.foam-4 {
  top: -35px;
  left: 80px;
}
.foam-5 {
  top: -30px;
  left: 110px;
}
.foam-6 {
  top: -20px;
  left: 140px;
}
.foam-7 {
  top: -30px;
  left: 160px;
}

/* Drunk Text */

@-moz-keyframes drunk {
    0% {
    -moz-transform: rotate(0);
    -moz-transform-origin: top left;
    -moz-animation-timing-function: ease-in-out;
  }

    20%, 60% {
    -moz-transform: rotate(80deg);
    -moz-transform-origin: top left;
    -moz-animation-timing-function: ease-in-out;
  }

    40% {
    -moz-transform: rotate(60deg);
    -moz-transform-origin: top left;
    -moz-animation-timing-function: ease-in-out;
  }

    80% {
      -moz-transform: rotate(60deg) translateY(0); opacity: 1;
    -moz-transform-origin: top left;
    -moz-animation-timing-function: ease-in-out;
  }

    100% {
    -moz-transform: translateY(700px);
    opacity: 0;
  }
}

@keyframes drunk {
    0% {
    transform: rotate(0);
    transform-origin: top left;
    animation-timing-function: ease-in-out;
  }

    20%, 60% {
    transform: rotate(80deg);
    transform-origin: top left;
    animation-timing-function: ease-in-out;
  }

    40% {
    transform: rotate(60deg);
    transform-origin: top left;
    animation-timing-function: ease-in-out;
  }

    80% {
    transform: rotate(60deg) translateY(0);
    opacity: 1; transform-origin: top left;
    animation-timing-function: ease-in-out;
  }
    100% {
    transform: translateY(700px);
    opacity: 0;
  }
}

.drunk {
    -webkit-animation-name: drunk;
    -moz-animation-name: drunk;
    animation-name: drunk;
}

Please Wait! While you are entered in Game

Comment: inspect your code at the end of the animation to understand what CSS is applied and replicate it
Answer: Filling the glass instantly, but bubbles moving
To instantly fill the glass, you can remove the delay:

$(document).ready(function() {
        /*Look here*/

        $('.pour')
            .css({
                height: '360px'
            })
            .delay(0)
            .slideUp(500);

        $('#liquid')
            .css({
                height: '170px'
            });

        $('.beer-foam')
            .css({
                bottom: '200px'
            });

    });
body { background-color: #0065bd }

    h2 {
        margin: 0 auto;
        width: 400px;
        font-size: 36px;
        text-align: center;
        font-family: 'Lato', Arial, sans-serif;
        color: whiteSmoke;
    }

    #container {
        height: 370px;
        margin: 0 auto;
        overflow: hidden;
        position: relative;
        top: -20px;
        width: 248px;
    }

    #container div { position: absolute; }

    .pour {
        position: absolute;
        left: 45%;
        width: 20px;
        height: 0px;
        background-color: #0065bd;
        border-radius: 10px
    }

    #beaker {
        border: 10px solid #FFF;
        border-top: 0;
        border-radius: 0 0 30px 30px;
        height: 200px;
        left: 14px;
        bottom: 0;
        width: 200px;
    }

    #beaker:before,
    #beaker:after {
        border: 00px solid #FFF;
        border-bottom: 0;
        border-radius: 30px 30px 0 0;
        content: '';
        height: 30px;
        position: absolute;
        top: -40px;
        width: 30px;
    }

    #beaker:before { left: -50px; }
    #beaker:after { right: -50px; }

    #liquid {
        background-color: #0065bd;
        border: 10px solid #0065bd;
        border-radius: 0 0 20px 20px;
        bottom: 0;
        height: 0px;
        overflow: hidden;
        width: 180px;
    }

    #liquid:after {
        background-color: rgba(255, 255, 255, 0.25);
        bottom: -10px;
        content: '';
        height: 200px;
        left: -40px;
        position: absolute;
        transform: rotate(30deg);
        -webkit-transform: rotate(15deg);
        width: 110px;
    }

    #liquid .bubble {
        -webkit-animation-name: bubble;
        -webkit-animation-iteration-count: infinite;
        -webkit-animation-timing-function: linear;
        background-color: rgba(255, 255, 255, 0.2);
        bottom: 0;
        border-radius: 10px;
        height: 20px;
        width: 20px;
    }

    @-webkit-keyframes bubble {
        0% { bottom: 0; }

        50% {
            background-color: rgba(255, 255, 255, 0.2);
            bottom: 80px;
        }

        100% {
            background-color: rgba(255, 255, 255, 0);
            bottom: 160px;
        }
    }

    .bubble1 {
        left: 10px;
        -webkit-animation-delay: 1000ms;
        -webkit-animation-duration: 1000ms;
    }

    .bubble2 {
        left: 50px;
        -webkit-animation-delay: 700ms;
        -webkit-animation-duration: 1100ms;
    }

    .bubble3 {
        left: 100px;
        -webkit-animation-delay: 1200ms;
        -webkit-animation-duration: 1300ms;
    }

    .bubble4 {
        left: 130px;
        -webkit-animation-delay: 1100ms;
        -webkit-animation-duration: 700ms;
    }

    .bubble5 {
        left: 170px;
        -webkit-animation-delay: 1300ms;
        -webkit-animation-duration: 800ms;
    }

    /* Foam */

    .beer-foam {
        position: absolute;
        bottom: 10px;
    }

    .foam-1, .foam-2, .foam-3, .foam-4,
    .foam-5, .foam-6, .foam-7 {
        float: left;
        position: absolute;
        z-index: 999;
        width: 50px;
        height: 50px;
        border-radius: 30px;
        background-color: #fefefe;
    }
    .foam-1 {
        top: -30px;
        left: -10px;
    }
    .foam-2 {
        top: -35px;
        left: 20px;
    }
    .foam-3 {
        top: -25px;
        left: 50px;
    }
    .foam-4 {
        top: -35px;
        left: 80px;
    }
    .foam-5 {
        top: -30px;
        left: 110px;
    }
    .foam-6 {
        top: -20px;
        left: 140px;
    }
    .foam-7 {
        top: -30px;
        left: 160px;
    }

    /* Drunk Text */

    @-moz-keyframes drunk {
        0% {
            -moz-transform: rotate(0);
            -moz-transform-origin: top left;
            -moz-animation-timing-function: ease-in-out;
        }

        20%, 60% {
            -moz-transform: rotate(80deg);
            -moz-transform-origin: top left;
            -moz-animation-timing-function: ease-in-out;
        }

        40% {
            -moz-transform: rotate(60deg);
            -moz-transform-origin: top left;
            -moz-animation-timing-function: ease-in-out;
        }

        80% {
            -moz-transform: rotate(60deg) translateY(0); opacity: 1;
            -moz-transform-origin: top left;
            -moz-animation-timing-function: ease-in-out;
        }

        100% {
            -moz-transform: translateY(700px);
            opacity: 0;
        }
    }

    @keyframes drunk {
        0% {
            transform: rotate(0);
            transform-origin: top left;
            animation-timing-function: ease-in-out;
        }

        20%, 60% {
            transform: rotate(80deg);
            transform-origin: top left;
            animation-timing-function: ease-in-out;
        }

        40% {
            transform: rotate(60deg);
            transform-origin: top left;
            animation-timing-function: ease-in-out;
        }

        80% {
            transform: rotate(60deg) translateY(0);
            opacity: 1; transform-origin: top left;
            animation-timing-function: ease-in-out;
        }
        100% {
            tran

Please Wait! While you are entered in Game

Pausing the bubbles
To pause the bubbles, you can use the animation-play-state: paused; property. This particular way would pause your bubbles after 5.7 seconds:

$(document).ready(function() {
        /*Look here*/

        setTimeout( () => {
            $('.bubble').css("animation-play-state", "paused");
        }, 5700)

        $('.pour')
            .delay(2000)
            .animate({
                height: '360px'
            }, 1500)
            .delay(1600)
            .slideUp(500);

        $('#liquid')
            .delay(3400)
            .animate({
                height: '170px'
            }, 2500);

        $('.beer-foam')
            .delay(3400)
            .animate({
                bottom: '200px'
            }, 2500);

    });
body { background-color: #0065bd }

    h2 {
        margin: 0 auto;
        width: 400px;
        font-size: 36px;
        text-align: center;
        font-family: 'Lato', Arial, sans-serif;
        color: whiteSmoke;
    }

    #container {
        height: 370px;
        margin: 0 auto;
        overflow: hidden;
        position: relative;
        top: -20px;
        width: 248px;
    }

    #container div { position: absolute; }

    .pour {
        position: absolute;
        left: 45%;
        width: 20px;
        height: 0px;
        background-color: #0065bd;
        border-radius: 10px
    }

    #beaker {
        border: 10px solid #FFF;
        border-top: 0;
        border-radius: 0 0 30px 30px;
        height: 200px;
        left: 14px;
        bottom: 0;
        width: 200px;
    }

    #beaker:before,
    #beaker:after {
        border: 00px solid #FFF;
        border-bottom: 0;
        border-radius: 30px 30px 0 0;
        content: '';
        height: 30px;
        position: absolute;
        top: -40px;
        width: 30px;
    }

    #beaker:before { left: -50px; }
    #beaker:after { right: -50px; }

    #liquid {
        background-color: #0065bd;
        border: 10px solid #0065bd;
        border-radius: 0 0 20px 20px;
        bottom: 0;
        height: 0px;
        overflow: hidden;
        width: 180px;
    }

    #liquid:after {
        background-color: rgba(255, 255, 255, 0.25);
        bottom: -10px;
        content: '';
        height: 200px;
        left: -40px;
        position: absolute;
        transform: rotate(30deg);
        -webkit-transform: rotate(15deg);
        width: 110px;
    }

    #liquid .bubble {
        -webkit-animation-name: bubble;
        -webkit-animation-iteration-count: infinite;
        -webkit-animation-timing-function: linear;
        background-color: rgba(255, 255, 255, 0.2);
        bottom: 0;
        border-radius: 10px;
        height: 20px;
        width: 20px;
    }

    @-webkit-keyframes bubble {
        0% { bottom: 0; }

        50% {
            background-color: rgba(255, 255, 255, 0.2);
            bottom: 80px;
        }

        100% {
            background-color: rgba(255, 255, 255, 0);
            bottom: 160px;
        }
    }

    .bubble1 {
        left: 10px;
        -webkit-animation-delay: 1000ms;
        -webkit-animation-duration: 1000ms;
    }

    .bubble2 {
        left: 50px;
        -webkit-animation-delay: 700ms;
        -webkit-animation-duration: 1100ms;
    }

    .bubble3 {
        left: 100px;
        -webkit-animation-delay: 1200ms;
        -webkit-animation-duration: 1300ms;
    }

    .bubble4 {
        left: 130px;
        -webkit-animation-delay: 1100ms;
        -webkit-animation-duration: 700ms;
    }

    .bubble5 {
        left: 170px;
        -webkit-animation-delay: 1300ms;
        -webkit-animation-duration: 800ms;
    }

    /* Foam */

    .beer-foam {
        position: absolute;
        bottom: 10px;
    }

    .foam-1, .foam-2, .foam-3, .foam-4,
    .foam-5, .foam-6, .foam-7 {
        float: left;
        position: absolute;
        z-index: 999;
        width: 50px;
        height: 50px;
        border-radius: 30px;
        background-color: #fefefe;
    }
    .foam-1 {
        top: -30px;
        left: -10px;
    }
    .foam-2 {
        top: -35px;
        left: 20px;
    }
    .foam-3 {
        top: -25px;
        left: 50px;
    }
    .foam-4 {
        top: -35px;
        left: 80px;
    }
    .foam-5 {
        top: -30px;
        left: 110px;
    }
    .foam-6 {
        top: -20px;
        left: 140px;
    }
    .foam-7 {
        top: -30px;
        left: 160px;
    }

    /* Drunk Text */

    @-moz-keyframes drunk {
        0% {
            -moz-transform: rotate(0);
            -moz-transform-origin: top left;
            -moz-animation-timing-function: ease-in-out;
        }

        20%, 60% {
            -moz-transform: rotate(80deg);
            -moz-transform-origin: top left;
            -moz-animation-timing-function: ease-in-out;
        }

        40% {
            -moz-transform: rotate(60deg);
            -moz-transform-origin: top left;
            -moz-animation-timing-function: ease-in-out;
        }

        80% {
            -moz-transform: rotate(60deg) translateY(0); opacity: 1;
            -moz-transform-origin: top left;
            -moz-animation-timing-function: ease-in-out;
        }

        100% {
            -moz-transform: translateY(700px);
            opacity: 0;
        }
    }

    @keyframes drunk {
        0% {
            transform: rotate(0);
            transform-origin: top left;
            animation-timing-function: ease-in-out;
        }

        20%, 60% {
            transform: rotate(80deg);
            transform-origin: top left;
            animation-timing-function: ease-in-out;
        }

        40% {
            transform: rotate(60deg);
            transform-origin: top left;
            animation-timing-function: ease-in-out;
        }

        80% {
            transform: rotate(60deg) translateY(0);
            opacity: 1; transform-origin: top left;
            animation-timing-function: ease-in-out;
        }
        100% {
            tran

Please Wait! While you are entered in Game

If you setthe timeout to 5700, you'll end up with something like this, which is pretty close to your image.

Stopping the bubbles (previous solution)
You could also fiddle with the iteration count and visibility of your bubbles, to kill them after some time, maybe like so:
 #liquid .bubble {
        visibility: hidden;  /*Look here*/
        -webkit-animation-name: bubble;
        -webkit-animation-iteration-count: 3;   /*Look here*/
        -webkit-animation-timing-function: linear;
        background-color: rgba(255, 255, 255, 0.2);
        bottom: 0;
        border-radius: 10px;
        height: 20px;
        width: 20px;
    }

    @-webkit-keyframes bubble {
        0% { visibility: visible;  /*Look here*/
             bottom: 0; }

        50% {
            background-color: rgba(255, 255, 255, 0.2);
            bottom: 80px;
        }

        100% {
            background-color: rgba(255, 255, 255, 0);
            bottom: 160px;
        }
    }

The numbers depend on the exact effect you'll want, but this would be the way I'd do it. This particular set would send some bubbles and then end the bubbling.
Comment: can you please check the edited version of question, perhaps I was not clear earlier.
Comment: hahah. actually i need to display "only the glass (already filled on screen and small bubbles rising in it) as my picture attached above, hope this clears more.
Comment: @KamranShakeel Paused the bubbles for you, hope I understood it correctly this time haha
Comment: @KamranShakeel Okay, let's see, that'd be one instantly filled glass with bubbles moving or bubbles paused? Cause we can do that too :D
Comment: yes, you are partially right, we would have an ALREADY filled glass (displayed instantly as the code is executed  with rising bubbles :)
Comment: @KamranShakeel okay, let's see: the first heading in my answer gives you an already filled glass with rising bubbles :D If you want to pause the bubbles, add the timeout, now, or keep the bubbles rising... is there anything else I missed? At least this is good practivce, if nothing else :D

Trying to stop CSS animation at full


How to interpret Weka Logistic Regression output?

Question: Please help interpret results of logistic regression produced by weka.classifiers.functions.Logistic from the WEKA library.
I use numeric data from WEKA examples:
@relation weather

@attribute outlook {sunny, overcast, rainy}
@attribute temperature real
@attribute humidity real
@attribute windy {TRUE, FALSE}
@attribute play {yes, no}

@data
sunny,85,85,FALSE,no
sunny,80,90,TRUE,no
overcast,83,86,FALSE,yes
rainy,70,96,FALSE,yes
rainy,68,80,FALSE,yes
rainy,65,70,TRUE,no
overcast,64,65,TRUE,yes
sunny,72,95,FALSE,no
sunny,69,70,FALSE,yes
rainy,75,80,FALSE,yes
sunny,75,70,TRUE,yes
overcast,72,90,TRUE,yes
overcast,81,75,FALSE,yes
rainy,71,91,TRUE,no

To create the logistic regression model I use the following command:
java -cp WEKA_INS/weka.jar weka.classifiers.functions.Logistic -t WEKA_INS/data/weather.numeric.arff -T WEKA_INS/data/weather.numeric.arff -d ./weather.numeric.model.arff

Here are what the three arguments mean:
-t <name of training file> : Sets training file.
-T <name of test file> : Sets test file.
-d <name of output file> : Sets model output file.

Running the above command produced the following output:
Logistic Regression with ridge parameter of 1.0E-8
Coefficients...
              Class
Variable                    yes
===============================
outlook=sunny           -6.4257
outlook=overcast        13.5922
outlook=rainy           -5.6562
temperature             -0.0776
humidity                -0.1556
windy                    3.7317
Intercept                22.234

Odds Ratios...
              Class
Variable                    yes
===============================
outlook=sunny            0.0016
outlook=overcast    799848.4264
outlook=rainy            0.0035
temperature              0.9254
humidity                 0.8559
windy                   41.7508

Time taken to build model: 0.05 seconds
Time taken to test model on training data: 0 seconds

=== Error on training data ===
Correctly Classified Instances          11               78.5714 %
Incorrectly Classified Instances         3               21.4286 %
Kappa statistic                          0.5532
Mean absolute error                      0.2066
Root mean squared error                  0.3273
Relative absolute error                 44.4963 %
Root relative squared error             68.2597 %
Total Number of Instances               14

=== Confusion Matrix ===
 a b   <-- classified as
 7 2 | a = yes
 1 4 | b = no

Questions:

First section of the report:
// Coefficients...

              Class
Variable                    yes
===============================
outlook=sunny           -6.4257
outlook=overcast        13.5922
outlook=rainy           -5.6562
temperature             -0.0776
humidity                -0.1556
windy                    3.7317
Intercept                22.234

Do I understand right that Coefficients are in fact weights that are applied to each attribute before adding them together to produce the value of class attribute play equal to yes?

Second section of the report:
// Odds Ratios...

              Class
Variable                    yes
===============================
outlook=sunny            0.0016
outlook=overcast    799848.4264
outlook=rainy            0.0035
temperature              0.9254
humidity                 0.8559
windy                   41.7508

What is the meaning of "Odds Ratios"?
Do they all also relate to class attribute play equal to yes?
Why is the value outlook=overcast so much bigger than the value of outlook=sunny?

Confusion matrix
=== Confusion Matrix ===
 a b   <-- classified as
 7 2 | a = yes
 1 4 | b = no

What is the meaning of "Confusion Matrix"?

Thanks a lot for your help!
Comment: Cross-posted at http://stackoverflow.com/questions/19136213.
Answer: Let me explain what odds mean in general.
Odds are the ratio between the probability of success over the probability of failure, that is, $\displaystyle \frac{p_{i}}{1-p_{i}}$. Let's say $p_{i}$ for a given event is 0.6, then the odds for that event is $0.6/0.4=1.5$.
1-  As you said, since the logistic regression outputs probabilities based on the following equation:
$$\text{logit}(p_{i}) = \log{\frac{p_{i}}{1-p_{i}}} = \beta_{0} + \beta_{1}x_{1} + ... + \beta_{k}x_{k}$$
the coefficients refer to each $\beta_{i}$.
2- Odds ratios are simply the exponential of the weights you found before. For example, the first coefficient you have is outlook=sunny: -6.4257. If you calculate $\exp(-6.4257)$ you get 0.0016 that is the corresponding value in the odds ratio table.
The relation between the coefficient for outlook=sunny and its odds ratio is, in this case, the logarithm of the odds of outlook=sunny over the odds of outlook=¬sunny:
$$\displaystyle \log{\frac{Odds(outlook=sunny)}{Odds(outlook=¬sunny)}}$$
For instance, the odds of outlook=sunny is the probability of a sunny day in which you can play over the probability of having a sunny day in which you can't play. Similarly, you can calculate the odds for outlook=¬sunny. The log of this ratio is the value of the coefficient attached to the variable outlook=sunny in the logistic regression. However, in this particular example, since you have more than one variable as predictors, it's necessary to fix the value of the other variables. Now you can see why outlook=overcast has such a value. The odds for outlook=overcast are extremely favorable to the yes outcome, producing a high positive value.
A simpler example of this can be found here.
3.- The confusion matrix is very simple. In the first row, for example, it tells you the number of instances  classified in your training data as yes that you classified as yes (that is, 7) and the number that are classified as yes that you classified as no(2). The second row is equivalent for instances classified as no.
Comment: Any chance to get a p-value from the output?
Comment: The OP did the logistic regression in Weka and if I remember correctly, I didn't rerun his example. It shouldn't take you a lot of time to obtain the output in R or Python. I'm not sure why the output in Weka didn't include p-values.
Comment: Do you mean the p-value of the coefficients for the weather dataset?
Comment: Yeah, precisely. :-)
Comment: What lib/libs do you recommend for doing this in python? I am looking for something with high-performance.
Comment: Statsmodels includes logistic regression (Logit). I think scikit-learn provides regularized logistic regression. Depending on what you mean by high-performance, these options could be good enough. Give it a try.


ASP.NET Boilerplate Domain Layer appears to contain non-Domain classes

Question: I have recently done some analysis of ASP.Net Boilerplate (https://aspnetboilerplate.com). I have noticed that the domain layer (MyProject.Core) has folders for the following (these are created by default):
    Authorization
    Confirguration
    Editions
    Features
    Identity
    Localization
    MultiTenancy
    etc

Why would you put all of this in the Domain Layer of an application? From what I can see; I believe most of this code should be found in the Application Layer (which could also be the service layer).
Answer: Good question, if you just look at the folder names. But I suppose you haven't investigated the source code in the folders much.
First of all, I don't say it's the best solution architecture. We are constantly improving it and we may have faults. Notice that our approach is a mix of best practices & pragmatic approach. I will try to explain it briefly.
You are talking about this project: https://github.com/aspnetboilerplate/module-zero-core-template/tree/master/aspnet-core/src/AbpCompanyName.AbpProjectName.Core So, let's investigate the folders:
Localization
It does not include any localization logic (it's done in framework level, in ABP. Thus, it's in infrastructure layer). It just defines localization texts.
While normally it can be easily moved to web layer (no direct dependency in Core project), we put it in the Core layer since we think it may be needed in another application too. Think that you have a Windows Service has only Reference to the .Core project and want to use localization texts, say to send email to a user in his own language. Notice that Windows Service should not have a reference to Web layer normally. So, we have a pragmatic approach here. We could add localization to another dll project, but that would make the solution more complicated.
Authorization
Mainly includes User, Role.. entities and UserManager and RoleManager domain classes. Similar to localization, it does not include actual authorization logic. It also includes some other classes but they do not make much. We thought putting these here would help us if we have more application layers. As you know every application can have it's own application layer as a best practice.
Confirguration
AppConfigurations is here to share 'configuration reading' code between different apps (Migrator and Web app). Again, this could be inside another "Shared Utils" library. But we wanted to keep solution structure balanced, so it reflects major layer and structures yet is not so complicated for intermediate level developers.
Editions
Just includes EditionManager class which is a domain service for Edition management.
Features
Just includes FeatureValueStore which is a repository-like adapter class. See it's code, it's already empty.
MultiTenancy
Includes Tenant entity and TenantManager class which are already parts of domain layer. Again, nothing here includes infrastructure-related multi-tenancy features (like data filtering or determining current tenant).
... and so on...
So, do not just see names and have idea, please check the project deeper. Some code can be moved to upper layers or an utils library, but I think general structure is good to start a DDD architected application.
Answer: What you see it is called Module Zero, it aims to implements all fundamental concepts of ASP.NET Boilerplate framework such as tenant management (multi-tenancy), role management, user management, session, authorization (permission management), setting management, language management, audit logging and so on.
Module-Zero defines entities and implements domain logic (domain layer) because it is part of the configuration context of your system.
Comment: Thanks.  Can you provide an example of domain logic that it executes? +1 for the reference to Module Zero.


404's in Wordpress when trying to access scripts

Question: I'm not sure if this is the right place for this but I think this is a server / scrpting issue not specifically a Wordpress problem.  If you go to my site www.ThinkComputers.org and open firebug and Open the Net window you can see the 404 errors I am getting.
I can assure you those files are there, as I have doubled checked many times.
I think it has something to do with how those files are being called and possibly my permalink structure, which is /%postname%/
Any help would be appreciated, thanks!
Answer: It could be a rewrites problem. Can you post the WordPress relevant section of your .htaccess file?
Answer: I second Colin's hunch of an issue with the rewrites.  It is possible that either your .htaccess doesn't have the proper content or that your web server isn't allowing the use of mod_rewrite rules.
Check with your hosting company / server administrator that your virtual host has permission to use mod_wewrite and that the .htaccess looks something like this:
<code># BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
</code>
Answer: Please check if the scripts and the directory can be read and executed by the webserver·
I'm assuming you're using a lamp system.
check if the permissions for the directory and scripts are set to r-x for everyone.


Power BI Sum by Category and Month

Question: I have a Power BI/DAX question. I'm looking to summarize my data by getting monthly transaction sums (including the year as well, i.e. MM/YY) and filtering them by individual account numbers. Here is an example:

I want to take that and make it into this:

I converted the dates to the format I want with this code:
Transaction Month = MONTH(Table[Date]) & "/" & YEAR(Table[Date])
Then got the total monthly sum:
Total Monthly Sum = CALCULATE(sum(Table[Transaction Amount]),ALLEXCEPT(Table, Table[Transaction Month]))
Now I'm trying to figure out how to filter the total monthly sum by individual account numbers. Just as a note - I need this to be a calculated column as well because I'll want to identify accounts that surpass individual account monthly spending limits. Can anyone help me with this?
Thanks so much!
Answer: When working with calendar dates, it pays to have a calendar table linked to the transaction table. In the calendar table you will have each date, from the start date of your relevant time period to the end of the time period relevant to your data. The columns of the calendar table can then contain calculations on that date like month number, month name, year, year-month key, transaction month (as the first day of the month for the date in that row), etc.
Next, connect the two tables in the data model by dragging the transaction date to the calendar date column.
Now you can build charts and report tables that group data by month without writing any complicated DAX. Just pull the field "transaction month" from the calendar table and the Total Sum measure from the transaction table into the field well of the visual.
That's what Power BI is all about.
Comment: Highly recommend this video for creating a date table in dax https://youtu.be/gyvhM5eiT0U

Power BI Sum by Category and Month


JavaScript: Intercepting form submit and identifying which form made the submission

Question: I am trying to intercept form submits from webpages I dont control.
My current implementation is ...
// During onLoad, loop through all forms and for each form object
var prevonsubmit = formobj.onsubmit;
if (prevonsubmit) {
    formobj.onsubmit = function f() {
        if(prevonsubmit()) {
            interceptform();
            return true;
        }
        return false;
    };
} else {
    formobj.onsubmit = function ff() {
        interceptform();
        return true;
    };
}

The problem with this is, inside interceptform(), I am unable to identify which form actually made this submission. Is there a way I actually get the form object that is trying to submit? Keep in mind that some of the forms I see do not have a name or id specified and there is more than one form (in the same webpage) with same action.
Edit:
The purpose is capture the content in the input tags that belong to the form.
A made up example of what I see in a form:
<form action="https://duckduckgo.com/html/" method="GET">
    <input type="text" name="q"/>
</form>
<form action="https://duckduckgo.com/html/" method="GET">
    <input type="text" name="l"/>
</form>
<form action="https://duckduckgo.com/html/" method="GET">
    <input type="text" name="l"/>
    <input type="text" name="q"/>
</form>

Edit2:
Based on @ruakh answer, the solution I ended up using:
var prevonsubmit = formobj.onsubmit;
if (prevonsubmit)
    formobj.onsubmit = createOnSubmitFunctionWithOld(prevonsubmit, formobj);
else
    formobj.onsubmit = createOnSubmitFunction(formobj);

// Definition of the functions:
function createOnSubmitFunctionWithOld(prevonsubmit,formObj) {
    return function () {
        if (prevonsubmit()) {
            interceptform(formObj);
            return true;
        }
        return false;
    };
}
function createOnSubmitFunction(formObj) {
    return function () {
        interceptform(formObj);
        return true;
    };
}

Comment: What is the purpose of determining which form is submitted? And can you post and example of the forms on a page so we can see what youre dealing with?
Comment: @prodigitalson, the purpose is to capture text from the submission. I added the purpose and an example of forms I see to the question.
Answer: You can simply pass formobj as an argument to interceptform():
        interceptform(formobj);

But bear in mind that both with formobj and with prevonsubmit, you have to be careful to avoid capturing a variable you don't want to. For example, in JavaScript, this:
var functions = [];
for(var i = 0; i < 10; ++i)
    { functions[i] = function() { return i; }; }

creates ten functions that all return 10, because they all capture the same i variable that's been incremented up to 10 by the time the functions are ever called. In the above example, you could write something like:
function new_constant_function(return_value)
    { return function() { return return_value; }; }

// ...

var functions = [];
for(var i = 0; i < 10; ++i)
    { functions[i] = new_constant_function(i); }

to copy each value of i into a new local variable return_value whose value never changes; or, a bit more tersely, this:
var functions = [];
for(var i = 0; i < 10; ++i)
    { functions[i] = (function(_i){ return function(){ return _i; } })(i); }

You'll almost certainly need to do something similar in your case. (But without seeing a bit more of the context of your code, it's hard to say exactly what.)
Comment: Perfect! Exactly what I looking for. I tried the same, by passing as an argument, but some how did not realize there was a bug in my current code. The solution I ended up with, if anyones is interested is...

var prevonsubmit = formobj.onsubmit;
if (prevonsubmit)
    formobj.onsubmit =
else
    formobj.onsubmit =
Answer: Why not loop through document.forms and append a hidden field to each one, or assign an id to the form itself.
Answer: If you are loopoing over the forms from a function, then:
> var prevonsubmit = formobj.onsubmit;
> if (prevonsubmit) {
>      formobj.onsubmit = function f() {
>          if(prevonsubmit()) {

prevonsubmit has a closure to the outer variable, it will reference the last value of prevonsubmit, so they will all reference the same function. This may "work", but will fail if any of your forms has a current listener that is different to any other form.
>              interceptform();

You can simply pass this from the function to interceptform:
               interceptform(this);

and interceptform will be passed a reference to the element calling the function (presumably the form being submitted).
>              return true;
>          }
>          return false;

That will (probably) cancel submission of any form that doesn't have an existing listener. Is that what you want?
>      };
>  } else {
>      formobj.onsubmit = function ff() {

Named function expressions are known to be buggy in at least one widely used browser. If you don't need a name (and it doesn't seem to be used here for anything), dont' use one. Keep the function anonymous.
>          interceptform();
>          return true;
>      };
>  }

Comment: I just understood how JS Closure works, and added a wrapper to make it work. And about the returning false, yes that was the intention, my function should return a false, with out intercepting the form, if the original onSubmit returns a false. I renamed the named function expressions into anonymous ones. Thanks for the comments and response. It was really helpful.


What is considered a "normal" quantity of outliers

Question: I have a few questions. If you would be so kind to help.
so i am wondering, because this is pretty subjective (imo). What would you consider a "normal" percentage of outliers in your data set?
Lets say for example i have a data set of 10 million records and i perform a cluster analysis.
I am asking because i want to be sure that the cluster analysis i do actually does its' job. Would it be sensible to say that if you have an x amount of outliers or x percentage of them in your data, then my cluster analysis is not really accurate and i should either increase clusters count or change the method?
And if yes. How do you determine that?
Or at the very least examine the data again and rethink my strategy?
Regards,
Emil
Comment: There is no such a thing... In some cases *single* outlier may influence your results. Moreover, if you have more then "normal" amount of outliers you still have to deal with them somehow.
Comment: @Tim Well.. My understanding is that there can always be some kind of a surge in the data. For example a really lucky day where you could sell a lot, or a nice day at the financial market that net you 5-6 times over the normal amount you usually earn. I am not concerned with the results (as in gross revenue for example or something like that). But if there is a pattern - you have low amount of sales 3 weeks of the month and then the last week you generate 95% of the sales for your target, then there is probably some pattern that i'd have to investigate further. That is what i want to do :-)
Comment: @Tim I was just wondering if there was some way to standardize outliers and everything around them. Just an idea, though. I wasn't hoping for much, i just wanted to hear what other people with way more experience then me think. :-)
Comment: But then you are not describing outliers... Outliers are datapoints that do not fit your model and can make it produce biased results. In your comment you rather seem to be talking about **novelty detection**.
Comment: @Tim Well, now i learned something new. I should model with clean data (without outliers, i am relatively new, don't judge me :-D). I have to read a little bit more though.. I don't really notice a big difference between outliers and novelty observations..
Answer: It depends on your distribution and the model behind it, and also on your definition of an outlier.
If you expect a normal distribution of your data points, for example, then you can define an outlier as any point that is outside the $3 \sigma$ interval, which should encompass 99.7% of your data points. In this case, you'd expect that around 0.3% of your data points would be outliers. If it's significantly more, then you should probably look for an error in your data acquisition method.
(Side note, if your number of data points is small, you should consider using Student's t-distribution instead of a normal distribution.)
So you need an expected distribution, then you need to define an interval in which you expect a certain percentage of your data based on that distribution, and then you can define anything outside that interval as an outlier.
It's important to note, however, that being an "outlier" does not really mean anything. It always depends on the context.
Comment: Well i have a data base that contains volumes of sales grouped by date,time. The idea is to identify if the sales team doesn't take its' job seriously 3/4ths of the month and starts generating sales and production requests at the end of the month making it hard on the production guys. The company though has no definition of "unusualness" so i can't really use regressions to model this. But you are right. It depends on the distribution of the data and its' overall fundamentals. I will probably write a paper on this after i finish (hopefully). Thanks for the tips, guys!
Comment: I'm not sure where the outliers come into this yet, but in order for me to understand this, you would need to explain your cluster analysis more in detail. It sounds to me like you could simply make a histogram of the generated sales/requests, look at that, and then define some sort of interval. In any case, I answered your question didn't I?
Comment: I could do that (the histogram). This will be one of the things i will try actually. I think i will probably have to break down the data and analyse it a bit deeper to come to any conclusions. I will be using an R script to do the clustering which gives out the number and percentage of detected outliers. I will have to break down the code as well to understand exactly how it works so i can tweak it if needed. I am just thinking outloud in a forum, there are probably a lot of ways to do that, that i don't know.
Comment: Okay. If you think I've answered your original question sufficiently, I'd be grateful if you ticked my answer as "accepted".
Answer: First of all you need a definition of outlier. Outlier just means unusual datapoint, so what people find unusual varies from dataset to dataset and even from person to person. I would even go so far as to say that it would in most cases be better to base your definition of an outlier on the proportion of outliers that definition produces, rather than the other way around.
The general problem of finding a good number of clusters has also no easy answers. Depending on your dataset and distance measure, multiple numbers of clusters might be perfectly reasonable. So to get any more detailed answers, you are going to need to show us your data and tell us what you want to use the clusters for.


how to enable and disable previous and future date on react-native-community/datetimepicker in React Native

Question: I have implemented the date-picker in my app. i used the  react-native-community/datetimepicker package for date-picker. But i have to add the custom option/methods ,by using that i can enable and disable the dates and also want to disable the previous dates. I am unable to implement it. Also the date time is not updating continuously. So please suggest any solution.
Code:
import React, {useState} from 'react';
import {View, Button, Platform} from 'react-native';
import DateTimePicker from '@react-native-community/datetimepicker';

export const CustomDatePicker = () => {
  const [date, setDate] = useState(new Date());
  const [mode, setMode] = useState('date');
  const [show, setShow] = useState(false);

  const onChange = (event, selectedDate) => {
    const currentDate = selectedDate || date;
    setShow(Platform.OS === 'ios');
    setDate(currentDate);
  };

  const showMode = (currentMode) => {
    setShow(true);
    setMode(currentMode);
  };

  const showDatepicker = () => {
    showMode('date');
  };

  return (
    <View>
      <View>
        <Button onPress={showDatepicker} title="Show date picker!" />
      </View>

      {show && (
        <DateTimePicker
          testID="dateTimePicker"
          value={date}
          mode={mode}
          is24Hour={true}
          display="default"
          onChange={onChange}
        />
      )}
    </View>
  );
};

Answer: Refer react-native-community/datetimepicker documentation
For minDate which determines the eldest date you can pick: https://www.npmjs.com/package/@react-native-community/datetimepicker#minimumdate-optional
For maximumDate which determines the newest date you can pick: https://www.npmjs.com/package/@react-native-community/datetimepicker#minimumdate-optional
<DateTimePicker
      testID="dateTimePicker"
      value={date}
      mode={mode}
      is24Hour={true}
      display="default"
      onChange={onChange}
      minimumDate={new Date(2020, 0, 1)}
      maximumDate={new Date(2022, 10, 20)} />

Answer: import React, { Component, useState } from 'react';
import { View, Button } from 'react-native';
import DateTimePicker from '@react-native-community/datetimepicker';

const MyDatePicker = () => {

  const maxDate = new Date(); <-- get today date

  return (
    <View>

        <DateTimePicker
          testID="dateTimePicker"
          value={date}
          mode="date"
          is24Hour={true}
          display="default"
          maximumDate={maxDate} // set current date
        />

    </View>
  );
};

export default MyDatePicker;