How to Emulate Steve Gaines and Ed King's playing styles

Question: Another question that's been puzzling me for a while.
I love Steve Gaines playing but I find it impossible to improvise in his style, especially the style he plays in I Know A Little.
I also love the style of Ed King, who, at least to me, is similar to Steve Gaines.  The solo he does on Sweet Home Alabama is part of what drove me to play guitar...
What are some of the things about those 2 guys that differ from most Rock Guitarists?  Is it the country influence?  Is it the mixolydian touch?
Thanks for any insight.
Edit:
In response to one of AbstractDissonance's comments, here's a spot where Ed King is improvising over the opening of I Know A Little.  Listen to the section from 14 to 30 seconds.  I can play that stuff if I really work on it.  I'd like to be able to improvise in that style with as little bumbling as possible. :)
Here's a nice backing track for the song.
Answer: It's everything! Your not those guys so don't expect to be able to emulate them without a lot of work(Depending on how far away you are from them).
Now, if you don't mind things like "Hey, that was an awesome solo! It reminded me of Steve Gaines" said to you every night you perform then...
Learn all his solos inside and out. Analyze what he is doing(try to figure out why he did what he did). "Steal" his ideas by playing them with slight modifications/variations to make them your own(not the whole solo but fragments of it).
It's all about practice though. Just sit down and play with those guys over and over and over. Eventually you'll start to hear things that they do such as how they bend and release, vibrato, slide, etc...
What makes guitarists different is the how they choice the notes in the solo and how they phrase them. Since you are starting by copying the notes you have to learn how to phrase it like them.
It is analogous to trying to copy an accent. You can learn the "words" relatively easy but what is hard is the accent which is the "phrasing". No matter how many "words" you know, you won't sound authentic until you get the accent down. Once you get the accent down you can then learn the words as you like. The "accent" tends to be the hardest for most people.
There is also a stylistic aspect you should have. If your going to play country you gotta have a fiddle in the band! Oops, I mean, you gonna play in Texas... damn, I mean you gotta have some experience with it.
So go practice their solo's over and over and over then start trying to incorporate their ideas into yours. Make sure you can do a lot more than just their solo's though. You need to be able to solo over a country progression too(you can copy the songs to start), etc...
Just go for it dude! It's really simple but just hard work! It will take you months, if not years to get it down pat.
BTW, just so you know, what I mean by analyzing is to look at the solo's and try and figure out what they did over chord X. What notes did they use over that chord, with respect to it, and how? Did they bend from the 2nd to the 3rd or the 3rd to the 4th? All guitarists have key things they do that make them who they are.
Update:
Ok, here is a clip of me trying to imitate the sound and phrasing of a guy I liked -
http://www.mediafire.com/?vvq7qs1cnqo1vmn

I wrote up a long description of what the differences were and such but instead of posting it now I'll ask you what you hear. That clip was my "tone quest" a few years ago when trying to understand why what I played sounded dead and why what he played sounded so good. I was given all kinds of answers through the years mostly from people that didn't have a clue and hence gave the most "obvious" answer(to anyone that didn't have a clue).
When I hear the two licks back to back I hear a huge difference. I can hear a difference in phrasing but IMO it's surprisingly close(of course I spend a lot of time trying to play just like him). But I now know the real difference that's going on and why(it's quite obvious now but wasn't back when I was trying to understand it).
Now, the differences may not be a big deal to most people but to me, when trying to sound just like him mine version is obviously off(it sounds lifeless to me). Maybe it's just in my imagination but there is objective differences. Phrasing has little to do with it.
Anyways, you can see both visually and aurally the differences... can you tell me what they are? In any case this is more of an example of how I worked on my quest to emulate the tone of someone else(not necessarily the style).
If you post some clips of an "A/B" comparison then we can discuss the differences and someone might know exactly what the problem is(similarly someone might know exactly the problem with my clip... although I think I already know the answer I could be wrong).
Comment: AD: I've been working on Ed and Steve since I was 15 years old, off and on. That's roughly 35 years! :)  It's something I thought I'd get other opinions about as I do not do a good job with their stuff.  Another guy that's in that category is Roy Nichols, who played for Merle Haggard for a **long** time.  I can't even get close to him despite being a fairly capable player.
Comment: It may just not be your style then. If you've actually spend that much time really working on it and haven't figured it out then chances are no one will be able to help you. Of course you might actually be a lot closer than you think. Maybe record your favorite lick and give us the song/position and then it might be easier to have some idea what the difference is.
Comment: @AbstractDissonance: Is that Andy Timmons in the clip?  Very nice tone in both cases.  The only difference I hear in the clips is how the notes are picked.  Otherwise, there's not much difference.
Comment: Of course it's Andy. The difference is not so much in the picking but how the amp responds to the picking. Different amp, different response. In Andy's case he has set the right point to get a nice breakup and the Amp response very nicely. It has proper EQ. In my case the amp is not breaking up nicely(at least in the same way) and there is not a presence to it. I also rush the first few notes a bit. Sure there are some minor differences but as far as the tone is concerned it is almost all amp/eq/effects. I know this now because I have played on a decent amp and was able to get that sound.
Comment: @AbstractDissonance: Of course its Andy?  I guessed, from hearing one song from him and the fact that Andy was in the filename...  It's not obvious to everyone.  I'd like to know what song it is and from what album if you're willing to spill the beans.  That is what I think of as killer tone.  I have an early Ibanez that was eventually turned into ATs signature.  RG550EX I think...  The tone that comes from it is nowhere near that good. :)
Answer: I would have made this a comment, but since I rate that yet...
I would back up what AD has said on the subject, except to say that it is a mistake to think that any expert-level player really makes conscious decisions about bends and slide etc. I expect that when composing a song or take after take of a track for recording purposes, there is some thought going into the piece perhaps even down to the note level, but in general, for experts in just about any endeavor or domain, there is a point where the skills are handed off to an almost autonomic process.
As an artist and a musician working in the art field for many years, I believe that the essence of style is in the things which the author has little personal awareness of.
Comment: +1 for putting into words what I had a hard time with.  I'd like to be able to play in the style of the 3 guys mentioned without thinking about it.  I haven't achieved even close to that goal yet.  Ah well...
Comment: I didn't say that the original players had to think about it did I? Just like you don't think about your accent. But unless your a natural at it, which you aren't cause you wouldn't be asking the question/having the problem, you are going to have to work at it and think about it. Eventually it will be subconscious but not until you learn it. There is no easy solution. It's going to be hard work and maybe that is the real issue?
Comment: For example, Suppose you wanted to learn to dance like MJ. Suppose you spent 5 years "trying" and are not much closer than when you started. Obviously your going about it the wrong way? If your method is through "osmosis" then that isn't working. But suppose every day for 10 hours a day you study his moves exactly and attempt to recreate them perfectly. Don't you think after 5 years you would have made some progress? If you really enjoy what you are doing then don't you think eventually you'll be able to dance like him without thinking about it?
Comment: It might not be as good as MJ but you'll be able to fool most people. In any case if you can't do it already chances are you won't be able to by using the same "method". Most of us generally take the easy method. You have 3 choices: 1. Gives up on trying to sound like them and try to sound like yourself. 2. Find a different approach to sounding like them. 3. Continue on the same path and hope one day it will pay off.
Comment: Can you play almost every famous solo note for note of these guy's? If not and since you don't already sound like them then maybe it's something to try? It's hard work of course but if you were going to learn it through osmosis don't you think it would have happened by now?
Comment: @AD 1st comment: No, you didn't say it explicitly, but only by way of saying that they make choices. Everything else you say is correct in my mind. The OP want to know why he doesn't improvise "in the style of that guy," but I think the real answer is that he isn't that guy. Even twins raised in nearly the exact same environment have differences in style, but that's a whole other discussion!
Comment: As I said though, maybe you do sound like them a little and you just don't realize it or maybe you play things in your own style and that's the reason? The only real way we are going to be able to help is to be able to hear and discuss what the differences are. Posting a few short clips between you and them would help a great deal. Check out my update to see how I've done it in the past trying to recreate sounds.
Comment: also: Never stop studying the styles you enjoy.


In order topology, are "continuous bijection is increasing or decreasing" and "space is connected" equivalent?

Question: Let $\langle X, \prec \rangle$ be a linear order, and $\langle X, \tau \rangle$ be the induced order topology.
Are the following two statements equivalent?

Every continuous (in the sense of the topology) bijection is either increasing or decreasing (in the sense of the ordering).
The space $X$ is connected (in the sense of the topology).
Comment: Your above comment should be included in your question, and you should be more specific as to whether you want your proof (if you have one) to be verified or whether you can't prove the other implication and want some direction.
Comment: @HennoBrandsma.   Given a linear order S, how do I construct a decreasing bijection from S to S?
Comment: Indeed, if $x f(x)\}$, and this generates a partition of the whole space into two disjoint open subsets.
Comment: 2 $\implies$ 1 I think it is true. otherwise it violate the injectivity right? am I correct?
Comment: How can we think the converse?
Comment: "Every continuous...bijection..." from $\langle X,\tau \rangle$ or to $\langle X,\tau \rangle$?
Comment: For the reverse, if $X$ is not connected, we can write it as $X = A \cup B$ with $A,B$ order convex and non-empty, $A \prec B$ and either $\max(A) < \min(B)$ (a jump), or $A$ has no maximum, and $B$ has no minimum (a gap). We can define a bijection by a increasing map on $A$ and decreasing on $B$, say.
Answer: They are not equivalent, even if you require $X$ to have more than two points.  For instance, suppose $X$ is a linear order such that every point of $X$ has a distinct uncountable cofinality from below and cofinality $\omega$ from above.  (Such a linear order can be constructed by inductively adding new points to give the requisite cofinalities from below in an induction of length $\omega$; see my first example in this answer.)
Such an $X$ cannot be Dedekind-complete (otherwise it would have points with cofinality $\omega$ from below), so it is disconnected in the order topology.  However, I claim the only continuous injection $X\to X$ is the identity map.  Indeed, suppose $f:X\to X$ is a continuous injection and $f(x)=y\neq x$ for some $x\in X$.  Let $\kappa$ be the cofinality of $x$ from below and let $\lambda$ be the cofinality of $y$ from below.  Let $(x_\alpha)_{\alpha<\kappa}$ be a strictly increasing sequence approaching $x$ from below and let $(y_\beta)_{\beta<\lambda}$ be a strictly increasing sequence approaching $y$ from below.  Also let $(y^n)_{n<\omega}$ be a strictly decreasing sequence approaching $y$ from above.
By our choice of $X$, $\kappa\neq \lambda$.  First, suppose $\kappa>\lambda$.  By continuity of $f$, for each $\beta<\lambda$ there exists $\gamma_\beta<\kappa$ such that $x_\alpha>y_\beta$ for all $\alpha>\gamma_\beta$.  Also, for each $n<\omega$, there exists $\gamma^n<\kappa$ such that $x_\alpha<y^n$ for all $\alpha>\gamma^n$.  Let $\gamma$ be the supremum of all the $\gamma_\beta$s and $\gamma^n$s.  Since $\kappa$ is regular and $\kappa>\lambda$, $\gamma<\kappa$.  But then for $\alpha>\gamma$, we have $f(x_\alpha)=y$, since $y$ is the only element of $X$ which is greater than every $y_\beta$ and less than every $y^n$.  This contradicts injectivity of $f$.
Now suppose $\kappa<\lambda$.  Replacing $(x_\alpha)$ with a cofinal subsequence, we may assume either $f(x_\alpha)<y$ for all $\alpha$ or $f(x_\alpha)>y$ for all $\alpha$.  In the case $f(x_\alpha)>y$, we can use the same argument as the previous paragraph (using just the $\gamma^n$s) to reach a contradiction.  In the case $f(x_\alpha)<y$, note that for every $\alpha$ there exists $\beta_\alpha<\lambda$ such that $f(x_\alpha)<y_{\beta_\alpha}$.  Since $\kappa<\lambda$, the supremum $\beta$ of all these $\beta_\alpha$s is less than $\lambda$.  But then $f(x_\alpha)<y_\beta$ for all $\alpha$.  This means $(f(x_\alpha))$ does not converge to $y$, contradicting continuity of $f$.

If you have difficulty understanding the example above, here's the gist of it.  You can have a linear order $X$ which is disconnected but highly asymmetrical, so that every point of $X$ "looks different" topologically.  This asymmetry makes $X$ very "rigid", so there are no nontrivial continuous bijections $X\to X$ at all, so rather vacuously they are all increasing or decreasing.
Answer: I don't think $(1)\implies (2)$ in general. The following is a counterexample.
Let $X=\{0,1\}$ and $\tau:=\{\emptyset,\{0\},\{1\}, X\}$ (i.e., $\tau$ is the subspace topology that $X$ inherits as a subspace of $\mathbb{R}$ equipped with usual (order) topology). Then observe that every continuous bijection from $\langle X,\tau\rangle$ to $\langle X,\tau\rangle$ is order preserving (or order reversing). However the space $\langle X,\tau\rangle$ is not connected because $\{1\}$ is a non-trivial clopen set in the topological space.
Comment: Do you have a counter-example with more than two points?
Comment: @KennyLau: I don't (at least right now).


Linear programming with quadratic constraints

Question: I have a given set of variables:
$x_1,y_1,x_2,y_2,x_3,y_3$
The objective function is to minimize the sum of these with quadratic equality constraints:
$y_1(x_1+x_2+x_3)$=0
$y_2(x_2+x_3)$=0
$y_3(x_3)$=0
There are other inequality constraints which are linear so I wont mention them hear. I want to know how these equality constraints can be converted into linear constraints. If they cant be converted what other method can I use such that I can guarantee optimality of the solution.
All variables are real variables between 0 and 1.
Answer: Each of your quadratic constraints is a product of linear expressions equal to zero, and you can think of these as disjunctions:
\begin{align}
y1 = 0 &\lor x1+x2+x3 =0\\
y2 = 0 &\lor x2+x3=0\\
y3 = 0 &\lor x3=0
\end{align}
Now introduce binary variables $z1,z2,z3$ (one for each disjunction) and the following linear constraints:
\begin{align}
y1 &\le z1 \\
x1+x2+x3 &\le 3(1-z1)\\
y2 &\le z2\\
x2+x3 &\le 2(1-z2)\\
y3 &\le z3\\
x3 &\le 1-z3
\end{align}
These constraints, together with the variable bounds, enforce the following implications:
\begin{align}
z1=0&\implies y1 =0 \\
z1=1&\implies  x1+x2+x3 =0\\
z2=0&\implies  y2 =0\\
z2=1&\implies  x2+x3 =0\\
z3=0&\implies  y3 =0\\
z3=1&\implies x3 =0
\end{align}
Answer: This would be too long for a comment, I think. I am not sure, whether there is some kind of standard method for doing what you want, but I guess you could possibly convert your problem into a list of linear programs:

$y_1 = 0$, $y_2 = 0$, $y_3 = 0$
$x_1+x_2+x_3 = 0$, $y_2 = 0$, $y_3 = 0$
$y_1 = 0$, $x_2 + x_3 = 0$, $y_3 = 0$
$y_1 = 0$, $y_2 = 0$, $x_3 = 0$
$x_1+x_2+x_3 = 0$, $x_2 + x_3 = 0$, $y_3 = 0$
$x_1+x_2+x_3 = 0$, $y_2 = 0$, $x_3 = 0$
$y_1 = 0$, $x_2 + x_3 = 0$, $x_3 = 0$
$x_1+x_2+x_3 = 0$, $x_2 + x_3 = 0$, $x_3 = 0$

and the pick the minimum of all the solutions.
Comment: This would not be a feasible option since the problem is likely to scale up to 100+ variables so the number of constraints will also grow and solving multiple lps in that case would not make sense.What i have given above is just a scaled down version of the problem.
Answer: Yes, you can convert them into equivalent linear equations.
For every equation you have of the form:
$$y_i(x_1+\ldots+x_n) = 0$$
introduce a brand new variable $z_k$. Replace your quadratic equation with the following equations:
$$z_k \in\{0,1\}\\ y_i \leq z_k\\ (x_1+\ldots+x_n) \leq n(1-z_k)$$
Together, these three equations are equivalent to your original equation, so if your objective is optimized with respect to these constraints, you will have a solution to your original problem. The only issue might be if you can't smoothly optimize over boolean variables like $z_k$.
Why are they equivalent? Note that all of your variables are in $[0,1]$.  The equation variables $z_k$ are binary-valued: 0 or 1. When $z_k=0$, it forces $y_i=0$ and puts no constraint at all on $(x_1+\ldots+x_n)\leq n$, because the sum of $n$ $[0,1]$ variables is already less than or equal to $n$.  In contrast, when $z_k=1$, it puts no constraint on $y_i\leq 1$, but forces $x_1=x_2=\ldots=x_n=0$ because it forces the sum of $n$ variables in $[0,1]$ to be less than or equal to zero.
Comment: Your $i$ and $k$ should be the same (you don't need both), and then it matches the formulation I gave.


can vmalloc pages be swapping pages?

Question: basically vmalloc pages cannot be swap out, so it's not in the LRU list. is it possible to add a vmalloc page to the LRU list? so that kernel can stats the usage on that page and swap out it if it's not frequently used?
Thanks
Comment: Pretty sure only locked pages are barred from swapping.  `vmalloc` just allocates contiguous pages of virtual memory.
Comment: To Brian, vmalloc allocates pages(may/probably NOT physical contiguous) and map them in vmalloc area as contiguous virtual address.
Answer: vmalloc() gives service to the kernel core, and some paths in the kernel which access the vmalloc()-ed memory can not sleep nor can't take any lock nor can't be preempted. If a accessing vmalloc()-ed page is swaped out, these paths will have to compete some locks and try to swap it in, they may also need to be preempted or sleep, so these paths enter a bug situation which can't be fix.
So the answer is "NO".
Comment: Could you explain that in more detail?
Comment: I found this duplicate question: https://stackoverflow.com/questions/4535379/do-kernel-pages-get-swapped-out with multiple answers.

Also, looking in kernel 5.8 sources (on x86), I see that `handle_page_fault` calls `do_kern_addr_fault` for kernel memory, which doesn't have any handling of swap, while `do_user_addr_fault` does.

can vmalloc pages be swapping pages?


For which $z$ is $\sum\limits_{n=1}^{\infty}(1-\cos\frac{1}{n})z^n$ convergent?

Question: I'm trying to figure out for which complex $z$ the series
$$\sum\limits_{n=1}^{\infty}(1-\cos\frac{1}{n})z^n$$
is convergent. I tried finding $\limsup\limits_{n\to\infty}(1-\cos\frac{1}{n})$ by the root test and quotient test, using Taylor expansion, but got nowhere. I would appreciate any help.
Comment: $1-\cos(1/n)\sim1/2n^2$.
Answer: $\frac {1-\cos \theta} {\theta^{2}} \to \frac 1  2$ as $ \theta \to 0$ (by either the series expansion or L'hopital's Rule). Hence the given series convrges iff $\sum (1/n^{2})z^n$ converges. By ratio test this is so iff $|z|\leq 1$.
[For $|z|=1$ you can use Comparison Test].
Comment: @SimonSMN If $\frac {b_n} {a_n}$ converges to a  non-zero limit then  $\sum b_n$ converges absolutely iff $\sum a_n$ does. This can be proved easily  using Comparison Test.
Comment: "Hence the given series convrges iff $\sum(1/n^2)z^n$ converges." What theorem do you use to draw that conclusion?


jQuery Parallax Image Not Smooth When Scrolling With Mousewheel

Question: I have a site with a header image that I'm trying to use the parallax effect with.
I'm using the following JS to accomplish this:
<code>    $(window).scroll(function() {
       var scrolledY = $(window).scrollTop();
       $('#container').css('background-position', 'left ' +  ((scrolledY)) + 'px');
});
</code>
I used an example from this fiddle:
http://jsfiddle.net/QN9cH/1/
This works great when scrolling down the page by clicking and dragging the scrollbar, however when I scroll with my mousewheel the image jumps around a lot and it's not smooth at all.
I've done a lot of research and have tried solutions such as the one here:
Javascript - Smooth parallax scrolling with mouse wheel
However, I'm not able to get this working with my implementation. I've tried several jquery libraries for smooth scrolling and haven't been able to get those to work properly either.
Is there a way I can make scrolling with the mouse wheel act the same as if I were scrolling manually by clicking and dragging the scroll bar?
Comment: There are many jquery smooth scrolling plugins out there that do the job, e.g. https://github.com/nathco/jQuery.scrollSpeed , https://github.com/fatlinesofcode/jquery.smoothwheel, https://github.com/simov/simplr-smoothscroll (check out their demoes)
Answer: This is not an answer (yet) but I've noticed that a large number of windows machines come with scroll wheels that "click", line-by-line, down the page.
I'm not sure if this is the issue you are facing but all of those beautiful parallax effects that work really well with expensive mice and those super-smooth Apple trackpads and mice, but then suddenly shudder and look awful on stock windows mice.


Flutter: WebView não atualiza a pagina

Question: Quando recebo uma mensagem de validação na pagina, não está renderizando na tela, eu preciso realizar um "refrash" manualmente para funcionar.
Antes:

Depois:

Meu WebViewController:
WebViewController controller = WebViewController()
..setJavaScriptMode(JavaScriptMode.unrestricted)
..setBackgroundColor(const Color(0x00000000))
..setNavigationDelegate(
  NavigationDelegate(
    onProgress: (int progress) {},
    onPageStarted: (String url) {},
    onPageFinished: (String url) {},
    onWebResourceError: (WebResourceError error) {},
    onNavigationRequest: (NavigationRequest request) {
      if (request.url.startsWith('http://www.teste.com.br/login')) {
        return NavigationDecision.prevent;
      }
      return NavigationDecision.navigate;
    },
  ),
)
..loadRequest(Uri.parse('http://www.teste.com.br/login'));

Answer: Descobri que o fato da minha página não atualizar foi a utilização do return NavigationDecision.prevent.
Utilizando somente o return NavigationDecision.navigate, todas as validações estão sendo renderizadas na tela.
ficou assim:
WebViewController controller = WebViewController()
..setJavaScriptMode(JavaScriptMode.unrestricted)
..setBackgroundColor(const Color(0x00000000))
..setNavigationDelegate(
  NavigationDelegate(
    onProgress: (int progress) {},
    onPageStarted: (String url) {},
    onPageFinished: (String url) {},
    onWebResourceError: (WebResourceError error) {},
    onNavigationRequest: (NavigationRequest request) {
      return NavigationDecision.navigate;
    },
  ),
)
..loadRequest(Uri.parse('http://www.teste.com.br/login'));

Flutter: WebView não atualiza a pagina


Given $f_n(x) = \left(\frac{x}{x+1}\right)^n \sin(x), x > 0$, is it uniformly convergent, pointwise equicontinuous, uniformly equicontinuous?

Question: I have this question I have been cracking for hours I need help. Preface: not a homework question, just trying to gain some intuition on this equicontinuous property.

Given $f_n(x) = (\frac{x}{x+1})^n \sin(x), x > 0$, is it
1) uniformly convergent,
2) pointwise equicontinuous,
3) uniformly equicontinuous
over $(0,\infty)$? What about $(0,1)$?

1) $f_n(x) = (\frac{x}{x+1})^n \sin(x)= (1-\frac{1}{x+1})^n \sin(x)$
The pointwise limit of this question is $f(x) = 0$, since $\left|(1-\frac{1}{x+1})\right|<1, \forall x > 0$
Try to show $\forall \epsilon > 0, \exists N > 0$ such that $|f_n(x) - f(x)| < \epsilon, \forall n > N$
Then $|f_n(x) - f(x)| = |f_n(x) - 0| = |f_n(x)| = \left|\left(\frac{x}{x+1}\right)^n \sin(x)\right| \leq \left|\frac{x}{x+1}\right|^n$
^ Here how do I wrap this up?
2) A sequence $f_n$ is pointwise equicontinuous if $\forall x \in (0,\infty)$, $\forall \epsilon  > 0, \exists \delta > 0$ s.t. $\forall y \in (0,\infty)$ $\forall n \in \mathbb{N}, |x-y| < \delta \implies |f_n(x) - f_n(y)| < \epsilon$
Let $\epsilon >0$ be given, then $|f_n(x) - f_n(y)| = \left|\left(\frac{x}{x+1}\right)^n \sin(x) - \left(\frac{y}{y+1}\right)^n \sin(y)\right| \leq \left|\left(\frac{x}{x+1}\right)^n- \left(\frac{y}{y+1}\right)^n\right|$
^ Stuck, how to proceed?
3) A sequence $f_n$ is uniformly equicontinuous if $\forall \epsilon  > 0, \exists \delta > 0$ s.t. $\forall n \in \mathbb{N}$, $\forall x,y \in (0,\infty)$, $|x-y| < \delta \implies |f_n(x) - f_n(y)| < \epsilon$
Not even sure how to start for this one. What is the difference between pointwise and uniform equicontinuous?
Thanks a bunch!!
(I hope the problem wasn't too difficult)
Answer: Right, in 1) we have pointwise convergence to $0.$ But note that $f_n\to 0$ uniformly on $(0,\infty)$ iff
$$\tag 1 \sup_{(0,\infty)}|f_n| \to 0.$$
But for each $n$ the $\sup$ in $(1)$ is $1.$ (To see this, fix $n$ and consider $f_n(\pi/2+ 2\pi m)$ as $m\to \infty.$)
3) $(f_n)$ is uniformly equicontinuous on $(0,\infty).$ Proof: Let $b_n(x) = (1-1/(x+1))^n.$ Then
$$|b_n(x)\sin x - b_n(y)\sin y| \le |b_n(x)\sin x - b_n(x)\sin y| +   |b_n(x)\sin y - b_n(y)\sin y|$$ $$  \le |\sin x - \sin y| +   |b_n(x) - b_n(y)|.$$
Now $\sin x$ is uniformly continuous on $\mathbb R.$ Thus it suffices to show $b_n(x)$ is uniformly equicontinuous on $(0,\infty).$ To do this, it suffices to show that $b_n'$ is a uniformly bounded sequence on $(0,\infty).$ (This will show that $(b_n)$ is uniformly Lipshitz, which gives uniform equicontinuity in spades.)
To show $b_n'$ is uniformly bounded, I found the unique solution of $b_n''(x) = 0$ is $x=(n-1)/2.$ We are then left contemplating
$$b_n'((n-1)/2) = n[1-1/((n-1)/2 + 1)]^{n-1}[(n-1)/2+1]^{-2}.$$
Verify that this sequence of numbers $\to 0$ and we're done. (So not only is $b_n'$ uniformly bounded, $b_n'\to 0$ uniformly on $(0,\infty).$)
Comment: Can you comment on the parts about equicontinuity? Or is it that failure of uniform convergence implies non equicontinuity?
Comment: No, we can have equicontinuity even when uniform convergence fails. By the way you made a mistake in the last inequality of 2). I believe uniform equicontinuity holds on $[0,\infty)$, I"ll try to write something later.


Merging view displays into same view

Question: I've got a view with 5 complex view displays (4 pages and 1 feed).
I've also got another view with 7 even more complex view displays which where automatically generated from the calendar module.
Is it possible to merge those 2 view displays into the same view? Or alternativelly execute Add view from template within an existing view. So the 7 calendar view displays ends up appended in the view which already contains my 5 custom view displays.
What I've tried so far:

Add view from template in a new view and replicate/recreate by hand my custom 5 displays
export the 2 views with features and try to merge the code so I can "features revert" to a single view

Is there a better way?
Answer: Your 2nd approach may be more trouble than it's worth, unless this is a learning exercise. As far as other options go, can't think of any, you may have to just recreate your displays.
Answer: This seems to work:
Simply cut/paste the display code from the views export of the first view and past it in to the 2nd view.
Make sure to change the display machine name if it overlaps with any of the display machine names in the 2nd view (example page_1).
Import this new, combined view.

Merging view displays into same view


Is differentiation as a map discontinuous?

Question: I came across the statement below:
Let $C([0,1])$ be the space of all continuous functions over the interval $[0,1]$ equipped with the Supremum norm. Assume $A$ is a map on the space of all differentiable functions whose derivative is continuous into $C([0,1])$. Also, $A$ is differentiation in the sense that it maps a functions to its derivative. The map $A$ (differentiation) is discontinuous.
It's written that the last sentence is well-known but I can't make any sense of it. How can I arrive at such a conclusion? Actually, I am looking for an explicit counterexample.
Any help would be highly appreciated.
Comment: What it means is that $A$ is an unbounded linear operator from $C^1([a,b])$ to $C([a,b])$ (both spaces having the supremum norm).
Answer: For a counterexample, take the sequence
$$\frac {\sin nx} n$$
These are all continuously differentiable, but the sequence converges to $0$ and the sequence of derivatives doesn't converge at all. The derivative of the limit is not equal to the limit of the derivatives, so it is not continuous.
Answer: It depends on your understanding of $C^1([0,1])$, the space of all differentiable functions whose derivative is continuous. It is a linear subspace of $C([0,1])$, where $C([0,1])$ is is equipped with the supremum norm $\lVert f \rVert = \sup_{x \in [0,1]} \lvert f(x) \rvert$. If you give $C^1([0,1])$ the norm inherited from $C([0,1])$, i.e. the supremum norm, then $A$ is not continuous (see Matt Samuel's answer). But you can also give $C^1([0,1])$ the norm
$$\lVert f \rVert^{(1)} = \lVert f \rVert + \lVert f' \rVert .$$
Then $A : (C^1([0,1]), \lVert - \rVert^{(1)}) \to (C([0,1]), \lVert - \rVert)$ is trivially continuous.
Edited:
$(C^1([0,1]), \lVert - \rVert^{(1)})$ is a Banach space. See Prove that $C^1([a,b])$ with the $C^1$- norm is a Banach Space. In contrast, $(C^1([0,1]), \lVert - \rVert)$ is not. You can generalize this to the sets $C^k([0,1])$ of $k$-times continuously differentiable functions. They are Banach spaces if equipped with
$$\lVert f \rVert^{(k)} = \lVert f \rVert + \lVert f' \rVert + \ldots + \lVert f^{(k)} \rVert$$
and
$$A : (C^{(k)}([0,1]), \lVert - \rVert^{(k)}) \to (C^{(k-1)}([0,1]), \lVert - \rVert^{[k-1)}), A(f) = f' ,$$
is continuous.
Comment: This (along with @MattSamuel's answer) is such a great pair -- it addresses the question, but also shows that there's something more to look at even though the basic answer is relatively straightforward. Best thing I've read so far today (although it is only 9 AM).
Comment: It might be worth mentioning the name Sobolev space/Sobolev norm for readers interested in the general setting this is a special case of.
Comment: I got it, thank you.


Handlng duplicate interface

Question: I am new to objective-c and I want to have two interface
I am trying to reduce peer-dependency in my code so I moved .m files and am creating single .h files
I did this
@interface XyzHelper : NSObject <RCTBridgeModule>

+ (bool)isFlaggedAsRequested:(NSString * _Nonnull)handlerId;

+ (void)flagAsRequested:(NSString * _Nonnull)handlerId;

@end

@interface XyzHelper : RCTEventEmitter <RCTBridgeModule, AVAudioPlayerDelegate>

but it says Duplicate interface definition which makes sense
Any idea how I can fix it?
What I am doing?
I am creating a libraries which use

https://github.com/react-native-webrtc/react-native-incall-manager

and

https://github.com/zoontek/react-native-permissions

I don't want user to npm install both repo (and other repo's I might have) instead a single repo npm install xyz
react-native-permissions uses
 @interface XyzHelper : RCTEventEmitter <RCTBridgeModule, AVAudioPlayerDelegate>
and
in-call manager have this
@interface XyzHelper : NSObject <RCTBridgeModule>

+ (bool)isFlaggedAsRequested:(NSString * _Nonnull)handlerId;

+ (void)flagAsRequested:(NSString * _Nonnull)handlerId;

@end

@interface XyzHelper : RCTEventEmitter <RCTBridgeModule, AVAudioPlayerDelegate>

what did I tried?
I tried creating a common interface
@interface XyzHelper : RCTEventEmitter <RCTBridgeModule, AVAudioPlayerDelegate>
+ (bool)isFlaggedAsRequested:(NSString * _Nonnull)handlerId;
+ (void)flagAsRequested:(NSString * _Nonnull)handlerId;
@end

but this gives duplicate symbol for a architecture x86_64
Comment: What exactly are you trying to achieve? How do you want to use `XyzHelper`?
Comment: So you want to have the same class name, but with different implementations?
Answer: @interface XyzHelper is declared twice. Of course this is a Duplicate interface definition. Instead you could extend your XyzHelper class. In Objective-C often refered to as so called category. Given a class like the following..
NS_ASSUME_NONNULL_BEGIN
@interface XyzHelper : RCTEventEmitter <RCTBridgeModule>
+ (bool)isFlaggedAsRequested:(NSString *)handlerId;
+ (void)flagAsRequested:(NSString *)handlerId;
@end
NS_ASSUME_NONNULL_END

The extension could look like the following example. It does not only extend XyzHelper, it also declares it conforms to an extra protocol.
@interface XyzHelper (SomeAudioPlayerExtension) <AVAudioPlayerDelegate>

@end

But keep in mind when doing so you have to check if your class object conforms to a particular protocol when you want to call extra protocol methods from within the former class implementation. Why? Because the extension suggests you conform to protocol while the needed methods are maybe not available, in example the extension implementation could not be loaded or you just forgot to implement them (missing symbols). Or it was just not linked. It is anyway safer to check for conformity at least once before calling any protocol method.
Typically the file names should express they contain extended code by naming them after the classname plus extensionname. So: XyzHelper+SomeAudioPlayerExtension.h and XyzHelper+SomeAudioPlayerExtension.m

Handlng duplicate interface


What does the distribution of bootstrapped values in this Cullen and Frey Graph tell me?

Question: I am trying to find a suitable distribution to describe my data, and as one of the first few steps I created a Cullen and Frey Graph using the descdist command from the fitdistrplus package in GNU R:
library("fitdistrplus")
descdist(df$data, boot=1000)

The data describes the curvature on a point of a surface, with the different observations coming from equivalent points on different objects. Here is the plot for some point on the objects:

For most of the points on the surface, the plot looks very similar to the one shows above (note the bootstrapped points in yellow). However, for certain points it looks quite different, like this:

I would like to know how to interpret this pattern of the bootstrapped points. What does it tell me?
Visual inspection of the atypical points suggests they are in the area where the curvature is almost zero, in case that helps.
Here is my data (output of dput(df$data)) for the upper plot:
c(-0.00076386, 0.045336, 0.014051, -0.041787, 0.023339, 0.014239,
0.0092057, 0.0084301, 0.020943, 0.01019, -0.0028119, -0.016991,
-0.00098921, -0.033097, 0.0016237, 0.0012549, 0.0019851, 0.016966,
-0.00068282, 0.0061208, 0.0029958, 0.018494, 0.00025555, -3.0299e-05,
-0.00091132, 0.014321, 0.0073784, 0.01479, 0.023929, -0.0063367,
0.0025699, 0.015087, 0.0014208, 0.001467, -0.00020386, 0.0037273,
-0.014093, 0.0011921, -0.014109, 0.022459, 0.0078118, -0.00022082,
0.0010377, 0.001418, 0.0010154, 0.0028933, 0.0019557, 0.0057984,
-0.0008368, 0.0026886, -0.0050151, -0.0012167, 0.0030177, 0.010013,
0.022312, -0.001848, -0.012818, -0.00043589, 0.0053455, 0.0032089,
0.0032384, 0.011193, 0.017151, -0.0066761, -0.0025546, 0.01298,
-0.0042231, 0.0024245, 0.0015398, 0.013608, 0.0039484, 0.00081566,
0.01092, 0.011098, 0.0075705, 0.0038331, 0.014112, 6.1992e-05,
0.003862, 0.0085052, 0.010609, -0.00041915, -0.0046417, -0.00064619,
-0.032221, 0.0043921, 0.0028192, -0.00086485, -0.0062318, -0.011283,
0.027339, 0.0033532, 0.011519, 0.0073512, -0.0017631, 0.0023497,
0.0051281, 0.0046738, 0.0057097, -0.0011277, 0.11261, -0.0027572,
0.0050015, 0.0089537, 2.4617e-07, 0.0025699, -0.0086815, -0.0050313,
-0.033569, -0.0158, 0.0045544, 0.016692, 0.00051091, -0.013249,
0.0030051, 0.0026081, 0.004686, 0.00019892, -0.0039485, -0.0079521,
0.0012888, 0.012825, -0.0047024, -0.009024, 0.0023051, -0.0046861,
0.0039009, -0.0024666, -0.00042277, -0.0023346, -0.0011262, 0.0013752,
-1.813e-05, -0.011235, 0.00092171, 0.0025105, 0.0029965, 0.010461,
0.0051702, -0.0021151, -0.015144, 0.00026214, 0.032263, 0.0077962,
0.012388, -0.0034825, -0.014544, -0.0013833, -0.00096014, -0.0069078,
-3.981e-05, 0.00030865, -0.014931, -1.7708e-05, -0.0061038, 0.0012174,
-0.0024902, -0.0014924, 1.0677e-05, 0.00043018, 0.0050422, 0.021948,
0.0097848, 0.0016898, -0.025803, 0.010538, 0.020389, 0.0071247,
0.0089641, -0.0063912, 0.0029227, -0.023798, -0.005529, -0.01055,
-0.00035134, -0.00039021, -0.010132, 0.0026251, 1.1334e-05, 0.0049617,
-0.00043359, 0.015602, 0.0031481, 0.0011061, 0.033732, 0.03997,
0.0037297, 0.025704, -0.0081762, 0.003853, 0.01115, 0.0033351,
0.0035474, 0.0050837, 0.0055254, -0.012532, 0.0032077, 0.0012311,
0.028543, -0.0077595, -0.017084, 0.0022539, 0.016777, -0.0045712,
0.050084, 0.0015685, -0.011741, 0.0010876, 0.0106, -0.0033016,
5.8685e-05, 0.007614, -0.012613, 0.010031, 0.0058827, 0.019654,
0.0011954, 0.00053537, -0.0059612, 0.057128, 0.0035003, -0.0047389,
0.010864, -0.0020918, 0.0034695, 0.0071228, -0.0094212, 0.01368,
0.0031702, -0.003895, 0.0009593, -0.010492, 0.001612, 0.0032088,
-0.0077312, 0.016688, 0.00012541, -0.0067579, -0.0054365, 0.0021638,
0.0095235, 0.17428, 0.0084727, 0.010209, -0.020409, 0.022679,
0.0095846, -0.00041361, 0.0059134, 0.0043463, -4.8011e-05, 0.0003717,
-0.017807, -0.0085258, 0.013516, -0.011611, -0.0012556, 0.0057282,
-0.00029204, 0.0040735, 0.0079601, 0.0029876, 0.14456, -3.5497e-05,
-0.0016229, -0.00142, 0.0024437, -0.0019965, 0.0047731, -0.0069031,
-0.0024837, -0.0063217, -0.0037023, -0.0011777, 0.014164, 0.032929,
0.0012199, -0.006876, -0.0033327, -0.0049642, 0.00033994, -0.019737,
-0.0006757, -0.010813, 0.0039238, -0.0033379, -0.01205, -0.014741,
0.0008597, 0.00086404, 0.020482, -0.0071236, 0.0081256, 0.01513,
-0.0052792, -0.017796, 3.7647e-05, -0.0011636, 0.0039913, 0.021583,
-0.010653, -0.0020395, 0.011516, 0.0026764, 0.018921, 0.015807,
-0.00035428, 0.0025714, 0.0074256, -0.0079076, 0.00064029, -0.001052,
-0.0049469, 0.007442, -0.012999, 0.011805, 0.0020448, -9.4241e-05,
-0.0035942, 0.010951, -0.0042067, -0.00011169, -0.0010933, -0.0042723,
-6.3584e-05, -0.027255, 0.088819, 0.0018361, 0.013476, 0.0071269
)

And here for the lower:
c(-0.014512, -0.0058534, 0.0087152, -0.0078163, 0.056314, 0.029747,
-0.052597, -0.012501, -0.0036789, -0.014999, -0.012793, -0.044215,
-0.021863, 0.0087065, -0.011399, -0.019325, 0.013824, 0.0095986,
-0.004078, -0.014264, -0.011927, 0.0011146, -0.0038653, 0.018538,
-0.0041803, -0.0099991, -0.025937, 0.023628, -0.0075893, -0.0151,
-0.0097623, -0.060885, 0.0074398, -0.023108, -0.02431, 0.059038,
-3.2965e-06, 0.017071, 0.043786, -0.010216, -0.0066353, 0.0027318,
-0.019151, 0.0047186, -0.051626, -0.00012959, -0.01279, -0.013684,
0.00094597, 0.014003, 0.01486, -0.037267, -0.014702, -0.01956,
-0.010359, -0.01508, -0.029832, -0.010463, -9.8748e-05, 0.0088553,
-0.0025825, -0.04585, 0.0017103, 0.0010617, -0.014712, -0.058952,
-0.018465, -0.0086677, -0.090302, -0.012687, 0.031989, -0.0010789,
0.0011435, -0.0052397, -0.028672, -0.00047859, 0.0072699, 0.01623,
-0.04801, -0.022326, -0.0015933, -0.038886, -0.025243, -0.0022138,
0.0010459, -0.0057455, -0.019607, 0.0041099, -0.015831, -0.0012497,
-0.14231, 0.0040444, 0.0073692, -0.0049665, 0.0095247, 0.035928,
-0.026798, 0.0020477, 0.0020694, 0.0068247, -0.017784, -0.044672,
-0.054571, -0.0030117, -0.031704, -0.0097623, -0.0066902, -0.075524,
-0.0047395, -0.021042, 0.079442, 0.032306, 0.021644, -0.0014506,
-0.011429, -0.038478, -0.010556, -0.014817, -0.0074413, 0.012451,
-0.02684, 0.0054708, -0.02627, -0.024904, 0.011484, -0.0014307,
-0.0028452, -0.03075, 0.00027497, -0.03346, 0.026292, 0.0030234,
0.0058075, -0.019708, -0.012555, -0.016345, -0.03254, 0.034036,
-0.046767, 0.0074342, -0.00068815, -0.014836, -0.024488, 0.0046096,
-0.042042, -0.0046255, -0.021847, -0.0064215, 0.012622, -0.0026051,
-0.057209, 0.038872, -0.016165, 0.015988, 0.016275, -0.016162,
-0.015021, 0.020844, -0.014098, 0.0031134, 0.00099532, -0.017317,
-0.063793, 0.0018859, 0.01971, -0.032403, -0.0024375, -0.00073467,
-0.0074275, -0.00087284, 0.0083021, 0.014111, -0.018832, -0.00083409,
0.00065538, -0.024792, -0.017424, 0.018622, -0.012342, -0.024214,
-0.00038098, 0.0056994, -0.021689, -0.063995, 0.012623, -0.0038429,
-0.078226, -0.01671, -0.0069796, -0.014817, -0.029802, 0.0042582,
0.001967, 0.0011492, -0.0015149, 0.0071541, -0.014131, -0.042844,
-0.019941, -0.02201, -0.0035923, -0.012501, 0.00031213, -0.0012541,
-0.0075098, -0.047008, -0.026675, -0.021419, -0.010504, 0.0018293,
-0.032401, 0.011153, -0.00094015, -0.031386, -0.031001, 0.0019511,
-0.012967, -0.012911, 0.0074449, 0.0052992, 0.069074, -0.022406,
-0.0028998, -0.0037614, 0.019345, -0.032463, -0.030929, 0.0098452,
-0.01751, -0.018875, -0.015721, -0.003342, -0.01194, -0.005254,
-0.054454, 0.073446, 2.9542e-05, -0.060855, 0.01012, -0.049511,
-0.01284, -0.014399, 0.019037, -0.03636, -0.034068, -0.012705,
-0.03571, -0.018263, -0.0059382, -0.022954, 0.013382, -0.095539,
0.0086911, -0.038144, 0.074835, -0.019483, -0.032716, -0.0025377,
-0.0099221, -0.0057603, 0.018333, 1.3211, 0.020368, 0.041849,
-0.064433, 0.0017635, 0.023663, -0.0012425, -0.13279, 0.017999,
0.031229, 0.058787, -0.037184, -0.016621, 0.011081, 0.011349,
0.0026947, 0.019077, 0.0051954, -0.036936, 0.0045157, -0.023299,
-0.054993, -0.031168, -0.06061, -0.0086002, -0.045094, -0.019699,
-0.0025394, 0.021987, -0.05349, -0.008101, -0.0074635, -0.010358,
-0.068063, 0.013118, 0.013409, -0.018069, 0.0015969, -0.00024499,
0.016927, -0.011481, -0.0053067, 0.0024216, 0.012565, -0.0011296,
0.017863, -0.073312, 0.092955, -0.034487, -0.031434, -0.007217,
-0.038946, -0.0070417, -0.11002, 0.069496, -0.0079777, -0.050645,
-0.0062267, 0.070627, 0.044814, -0.0028551, -0.013993, -0.0094418,
0.037753, -0.0071857, -0.014971, -0.0021806, -0.046116, -0.00089069
)

Answer: [My previous answer had a fatal mistake in it, so I deleted it and made a new one.]
Here's a more basic plot instead of your fancy plot. The black line is the density plot your first dataset, and the red line is of your second. (Note that the first dataset is more compact, so its density goes off the top.)
You see at least 4 discretized points in your first dataset, which density has turned into humps. You see an odd hump in your second dataset near the first dataset's four -- which might be a truncation of similar values -- and then a bump way out on the right and a bump to the left.
Do you know how your data is captured? For example, are you scanning objects with software that places points farther apart in areas of low curvature? (This might be the result if your objects are captured as quadrangles, with adjacent quadrangles that have a low angle between them joined into a single quadrangle? Or it might be that your capture process is driven by changes in reflectivity -- i.e. curvature -- that must exceed a threshold before a data point is recorded?)
My guess as to your original strange graph for your second dataset is that the bump way out on the right caused things to scale oddly, so you got a discretized graph.
Your raw data appears to be a mixture of data generation processes and data capture artifacts (which might include truncation, censoring, discretization, and noise). So the question is: do you want a single distribution for all of your data as captured, or for your data after accounting for artifacts, or something else?
Trying to come up with a single distribution for a mixture of process results is usually a bad idea.
Comment: Thanks a lot for your very helpful answer. While the answer by Glen_b more directly answers the question about the plot, your answer helps with my analysis. And you are right in your assumptions: the curvature data is from a mesh of the objects, consisting of triangles. The mesh algorithm places more vertices in areas with higher curvature, I guess. It is very likely that it contains noise, as the meshes were generated from noisy 3D image data. I am not interested in the noise and would indeed be very interested in filtering it, but am unsure how. I could threshold some, but not all.
Answer: The idea of this bootstrapping is to get a sense of the sampling distribution of the skewness and kurtosis by making use of the bootstrap; the ultimate point, presumably, is to get a sense of which regions of the Pearson diagram the sample is consistent with being an observation from. (However, simulation experiments I've done in the past suggest it's not all that useful a guide even when the sample comes from a Pearson distribution -- the true sampling distribution often tends to look rather different from the boostrapped one. A more sophisticated bootstrap approach would perhaps do better.)
Whether bootstrapping or not, I would urge caution when using such plots for selecting between distributions in general.

In relation to your second plot, you have a single extreme outlier.
As mentioned the orange points are generated by bootstrapping -- resampling the data with replacement.
If you get a resample with that outlier present exactly once you get a point from the cloud that surrounds the large blue dot.
If you get a sample with that outlier present exactly twice you get a point from the next smaller cloud closer to the origin.
If you get a sample with that outlier present exactly three times you get a point from the next smaller cloud still closer to the origin, and so on; each such cloud has fewer points in it (naturally).
If it is sampled zero times you get a point from the tight orange cloud (/blob) at the far top left of the plot (near all the markers for the various distributions there)
The probability of the extreme outlier point showing up $x$ times is essentially $P(X=x)$ for a Poisson(1); with 1000 such points you should normally expect to see 6 or 7 such point clouds (there looks to be 7 here).
This plot is pretty much just telling you "there's one extreme outlier".
That it was caused by an outlier was fairly obvious by looking at the plot (on looking at the plot, my first reaction was 'a big outlier would do that') but if you look at the data you can see it easily. In R if you put the data into y then:
plot(density(y))
rug(y)

will show the outlier up near 1.32.
Comment: Thanks a lot, this answers my question, so I have accepted it.


jQuery changing font - same space occupied

Question: Is there a way that when I change the whole page font, I could keep the same design? I added an option to my website for the user to change the font of the entire website, but there is quite a bit of difference between the aspect of the website.
I have to manually change the elements when changing fonts or there is a simpler way to do that?
Comment: In short, don't try to do this. If it's mostly about big header text take a look at a JavaScript library like http://fittextjs.com/
Answer: You need to change the font to a comparable size (width & height) of the previous font.
For example... Arial (font size of 12px) is roughly the same as Veranda (font size of 11px) in height, but not width. Verdana is naturally a wider font. So those two wouldn't be the most compatible.
Comment: That is a tough question. Impact is narrow and tall, and Comic Sans is wider and taller. You might want to pick out a few elements on your page to have the font change, instead of everything. This provides the different look, but keeps things relatively simple. Second suggestion...rework your HTML/CSS to accommodate for the variation of text size so the site maintains it's look no matter how big/narrow/short/wide the font it.


Mail sending program & exchange server

Question: I have been asked to send about 6500 e-mails to addresses in a member database.
I have written the program, that sends and reports the ones that couldn't send etc.
But my concern is that this program will just call smtpclient.Send(); and I don't know what happens if 6000 mails are in the queue. Server is MS Exchange as I have been told.
Note: I am planning to send them, say 500 by 500. But what if an exception occurs on the Exchange server at 120... then what happens to the other ones..
I will appreciate little insight to the subject.
Thanks in advance.
Answer: Well, here is the deal. Exchange will take your emails and queue them. Depending how good you send, it will come to a grinding halt to swallow the amount of stuff you dump into it (I wrote such a sending tool once, using 64 threads, dumping them in as fast as possible as was the specs, and it stopped the exchagne serve WHILE I was sending).
Then it will start sending them.
At a later stage, you get the NDR (non delivery reports) to the origin email. This will take up to 2 days, as exchange tries to send and send again (admin setting, 2 days is standard and that one makes sense).

that sends and reports the ones that
  couldn't send etc.

How does that work, given that exchagne will accept ANY VALID EMAIL without checking whether it can be delivered at this time?
Comment: uhm, that is only catching the exception in .net, whether e-mail is in a correct format etc. I will also make sure it does not send to the ones that deactivated membership and so. There is no return/response from exchange server. Can I do that??
Comment: Yes, but you need to basically get the NDR (non delivery reports) after some time and priocess those, too. Like emails getting deactivated without people telling you (unsubscribing). Domains falling out ot service etc.
Comment: ok thanks a lot ... so I can't get a real time response from the server and proceed accordingly
Comment: No. Email is a store and forward protocol, so all that the server confirms is that e got an email he accepts at THIS point and will further process.

Mail sending program & exchange server


VSTS CI CD for desktop apps

Question: How can I achieve CD (Continuous Delivery) for winform applications in VSTS (Visual Studio Team Services)? Currently this is what I have in my Visual Studio Solution file
1) A winform project
2) A Windows setup and Deployment project
So every time I build a winform project, I do the following steps (and I need CI / CD for exactly these)
1) Build Setup and Deployment project, which takes Build output of Winform project and creates and EXE / MSI
2) I take this MSI file and use NSIS to embed it inside EXE
3) I run SIGNTOOL from command prompt and digital sign the EXE
4) I upload this signed EXE to my website
Now how can I use CI / CD pipeline to automate the above or is it not possible for my case? I am confused. I can't find any material for winforms, all are for web apps.
Thanks
Answer: You will obviously need some sort of desktop deployment strategy. The easiest is to be using xcopy. Other alternatives include frameworks like ClickOnce, Windows Installer or Squirrel to name a few. I have a number of corporate apps that use Clickonce that I have deployed using vsts.

Now I am unable to understand how will VSTS help me with this?

Use VSTS to build the software first and include additional tasks to package your app. In my case, I use devenv.exe to generate ClickOnce packages, but you can include custom tasks by using powershell. The artifact of the build should now be the "packaged app".
Then use the VSTS deployment to copy the "package" to some kind of hosting server from where your users can download the package. That could be either a web server or a fileserver or any location appropriate for your deployment strategy.
In this context, VSTS is an orchestration tool. It helps to trigger actions for you.
See Deploy an agent on Windows to see how to setup an on-premise agent.
Comment: The build system needs to have NSIS and SIGNTOOL installed. For this reason, I think you should setup an onpremise agent to do the build. VSTS will orchestrate the build, but the build will happen on your build server (this is how I do builds for things like Oracle DB). You should then use powershell tasks in your build sequence to run the custom steps that you need to package your app. I would say that the output artifact should be the signed EXE. Your deploy step will then be a simple copy of the EXE to the webserver.
Comment: Hey Dayneo, thanks for the reply. I just edited my question to make it more clearer. I don't use ClickOnce, I use Windows setup and deployment. Can you go through my edited question and tell me how to proceed?
Thanks.
Comment: Looks like I am getting closer all because of your help.
1) setup an onpremise agent : Does it mean I can use my local machine for this or it has to be on cloud only? Is there any setup for on Premise Agent that I can run on my local machine and VSTS will know about it?
Thanks.
Comment: VSTS Supports having an on-premise agent. That agent will run from any machine you deploy it to. It will need outbound internet access though.
In VSTS you go to the settings and look for "Agent Pools". That will give you a way to download and install an Agent that will run on-premise and will communicate with VSTS in the cloud.
And here is the manual: https://learn.microsoft.com/en-us/vsts/build-release/actions/agents/v2-windows
Answer: To build and deploy the way as you used in VSTS, you can use below steps:

Create a repository (Git or TFVC) and push your solution in the repository.
Add build/release definitions.
With CI build, enable the Continuous Integration in Triggers Tab.  With CD deploy, enable Continuous deployment trigger in Pipeline Tab. The process for CI build and CD deploy, you can refer CI/CD.
Add related tasks in your build/release definition.

Build VS Installer task: build setup project with msi file.
Nsis Build Task: embedded msi file in exe.
Command Line task: to execute the signtool command. Since Hosted agent has not signtool.exe, so you should use private agent which has the signtool.exe on the machine.
Copy files task, Copy Files Over SSH task or Windows Machine File copy task: upload the file exe to your web server.
Comment: Thanks, I installed "Build VS Installer" from the marketplace link provided by you. I also added it to my build task list, see image url

https://1drv.ms/i/s!Ase2Dy0lrWBLl6Mdtbi8r9BDc-4XiA

Now when I run the build it's giving devenv error, I tried changing few things but it's not working for me. I am using VS 2017 . See image url above
Comment: Can you add the Build VS Installer task fully build log (set `system.debug` = `true` in variables Tab) in your question? Since the log in screen shot is not enough.
Comment: I was able to build it by adding a registry entry by following directions from this link http://www.kunal-chowdhury.com/2016/07/visual-studio-error-code-8000000A.html#zwIRz1vFHCAPrCU0.97 . Now I am able to create MSI. I will try next steps as suggested by you for NSIS, etc and let you know. Thanks.

VSTS CI CD for desktop apps


código linguagem C imprimir pares de um à cinquenta

Question: Exercício de programação em C:
Enunciado: "Escreva um programa que imprima todos os pares entre 2 e 50. Para saber se o número é par, basta você ver se o resto da divisão por 2 é igual a 0."
o que eu fiz:
#include <stdio.h>
int main() {
for(int n = 2; n <= 50; n++){
    int rest = n % 2;
    if(rest == 0){
        printf("%d", n);
       }
}
}

O que imprimiu:
2468101214161820222426283032343638404244464850
Comment: Detalhe que vc pode fazer o `for` pulando de 2 em 2: `for(int n = 2; n <= 50; n += 2)` - aí nem precisa testar o resto da divisão, porque todos os números com certeza serão pares (a menos, é claro, que o exercício exija que se faça de um em um e use o operador `%`)
Comment: Muito obrigado mesmo!
A sua resposta e ajudou em um outro exercício!!!
Answer: Sua lógica está correta, e o resultado também, acontece que você não deu espaços ou fez uma quebra de linha entre os resultados, com isso todos os números pares foram impressos um ao lado do outro.

Você pode editar o seu printf para dar um espaço:
printf("%d ", n);

Ou uma quebra de linha:
printf("%d\n", n);

Até mesmo uma tabulação horizontal:
printf("%d\t", n);

Seu código final vai ficar mais ou menos da seguinte forma:
#include <stdio.h>

int main() {
    for(int n = 2; n <= 50; n++){
        int rest = n % 2;

        if(rest == 0) {
            printf("%d\n", n);
        }
    }
}

Veja online: https://repl.it/@Dadinel/ColorfulMinorSequel
Comment: Cara, Muito Obrigado Mano!!!!
Comment: Imagina, se já tinha feito tudo! :D


Laravel get created_at value in model

Question: I'm trying to fetch the created_at attribute in the model so I can put it in my relationship.
E.g. rows in exit_accession_goods created today should look at rows in entry_accession_goods that were made today or before it.
Here's what I've tried:
    <?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class ExitAccessionGood extends Model
{
    protected $fillable = ['exit_accession_id', 'norm_id', 'quantity'];

    public function entry_goods()
    {
        return $this->hasMany('App\EntryAccessionGood', 'norm_id', 'norm_id')
        ->whereDate('created_at', '<=', $this->created);
    }

    public function packagings()
    {
        return $this->hasMany('App\PackagingItem', 'norm_id', 'norm_id');
    }

    public function getCreatedAttribute()
    {
        return "{$this->created_at}";
    }
}

The $this->created returns an empty string.
Comment: Please share more details - there is no `$this->created` in your code. Additionally, have you checked whether the database contains that column?
Answer: Try this
public function getCreatedAttribute(){
    return $this->attributes['created_at'];
}

Laravel get created_at value in model


Continuous time-fixed effect in panel regression?

Question: I am doing regressions on panel data which basically have the following structure:
$$Y_{it} = X'_{it}\beta + P_{t} + e_{it}$$
$P_{t}$ indicates a counter for the period, so it takes the value 1 in period 1, 2 in period 2 etc.
I know that in this case it just captures period specific shocks  etc. over all individuals $i$.
My question now, which is probably very stupid: Can I interpret $P$ (its coefficient) differently when it is coded in a more "meaningful" way? Say I want to capture the effect of earthquakes according to their strength, so that for example $P_1=0, P_2=7, P_3=2, P_4=0$ etc.
Can I interpret the coefficient of P in this case as the effect of earthquakes on $Y$?
Answer: The way you've written down the model you are making the assumption that the time trend is linear. A more flexible way of specifying the period specific shocks without such a strong assumption is to include time dummies:
$$y_{it} = X'_{it}\beta + \sum^T_{t=1}\delta_t d_t + \epsilon_{it}$$
To separate the earthquake shocks from the period specific shocks you could generate a variable $E_{it}$ which measures the strength of an earthquake that affects individual $i$ in period $t$ (or only $E_t$ is all individuals are affected the same way or if you don't know the peoples' location), and interact this variables with the time dummies.
$$y_{it} = X'_{it}\beta + \sum^T_{t=1}\delta_t d_t + \sum^T_{t=1}\gamma_t \left(d_t \cdot E_{t} \right) + \epsilon_{it}$$
The coefficients $\gamma_t$ would then capture the average effect of each earthquake ( if you have 4 earthquakes, then there will be four $\gamma$s) on the outcome $y_{it}$. Just having a linear trend $P_t$ absorbs too much as it picks up the random fluctuation in each year plus the earthquake effects whereas your other suggestion to recode $P_t$ as strength of each earthquake does the reverse, i.e. it picks up the average strength of the earthquakes (making again a linearity assumption which is certainly not true for earthquakes for which strength usually increases exponentially) but without further time controls it will also pick up the period specific effects.


Get taxonomy terms added to nodes

Question: I am trying to get all the taxonomy terms added to a node. How would I get only the taxonomy term values that are added to a code in a mymodule_preprocess_node hook?
Current term list:

value1 (tid=1)
value2 (tid=2)
value3 (tid=3)

Node list:

node1 has field_category = 1
node2 has field_category = 3
node3 has field_category = 1,2,3

Here is what I tried, but cannot find a way to filter and only return the taxonomy term values that are added to a node.
// Returns entire list of values, but we want only ones added to Basic page
$term_tree = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadTree('field_category');

$nodes = \Drupal::entityTypeManager()->getStorage('node');

I am trying to get all the taxonomy term values, but just the entity field values.
Comment: Possible duplicate of [How do I access a field value for an entity (e.g. node) object?](https://drupal.stackexchange.com/questions/144947/how-do-i-access-a-field-value-for-an-entity-e-g-node-object)
Comment: @leymannx thanks for the link, but that one only addresses how to access the field values. My question is how to return all the taxonomy terms when there are more than terms added to a node, which i consider the next step after get the field value.
Comment: Then your question actually is "How do I load a taxonomy term by term ID"?
Answer: Another example:
As with all referenced entities you can load them quickly using the referencedEntities() method.
Also, if you are not using the Devel module and Devel Kint submodule, you should check it out. You can then use ksm() to explore variables and see available methods.
function hook_preprocess_node(&$variables) {

  //make sure you have Devel module installed, then you can use ksm() to explore variables
  //ksm($variables['node']);

  if ($variables['node']->hasField('field_permit_city')) {
    //this will give you the referenced terms on the node as objects
    $term_objects = $variables['node']->get('field_permit_city')->referencedEntities();
    $term_labels = [];
    foreach ($term_objects as $term_object) {
      print $term_object->id(); //the id of the term
      print $term_object->label(); //the term title
      $term_labels[] = $term_object->label(); //build an array of term labels
    }
    //send an array of term titles over to the node twig template
    $variables['my_custom_template_variable'] = $term_labels;
  }
}

Then in your node.html.twig template you can iterate through the labels and do the stuff.
{% for term in my_custom_template_variable %}

{{ term }}

{% endfor %}

Answer:
To get all the taxonomy terms added to a node.

In hook_preprocess_node you can use something like:
add use Drupal\taxonomy\Entity\Term; to the top of your file.
function mymodule_preprocess_node(&$variables) {
  $node = $variables['node'];
  if ($node->bundle() == 'your_content_type_name') {
    //- Array of terms
    $terms = [];
    $categories = $node->field_category->getValue();
    foreach ($categories as $category) {
      $term = Term::load($category['target_id']);
      //- You can get the name of term by.
      /**
       * $term->getName()
       */
      //- You can get the description of term by.
      /**
       * $term->getDescription()
       */
      $terms[] = $term;
    }
  }
}

Get taxonomy terms added to nodes


"First ending" has a notation "2nd time R.H. 8va"

Question: In a simple piano book I'm using (Jumbo Easy Piano Songbook: 200 Songs for All Occasions - Hal Leonard Corp.), one of the songs (The Entertainer - Scott Joplin) that has a first and second ending, also has the notation in the bar for the first ending ("1."):  "2nd time R.H. 8va".
How can there be a second time playing a first ending?
Comment: Could it be referring to the second time playing through the whole repeated strain?
Comment: OK, I get your point -- it doesn't say at the beginning "2nd time R.H. 8va" because the first time they want only certain bars played R.H. 8va.   I'm becoming more and more convinced you nailed it, thanks.
Comment: Thanks, that's a good thought, but two issues:  first, several times throughout the strain there are R.H. 8va notations covering groups of bars.  Second, if your interpretation was intended, why not just say at the beginning of the strain "2nd time R.H. 8va"?   But what you say makes sense and I can't come up with any alternative interpretation.
Comment: Perhaps you're supposed to play the section three times and take the first ending up an octave the second time?
Comment: I would double-check, as Kevin said, that you aren't supposed to play the 1st ending twice and then the 2nd ending third-time as a finale.  But if you could at least post the name of the book and the song in question, we could check it out.
Comment: Although the book you're using may be simplified from what Joplin wrote, listening to a MIDI or recording of the music should make clear which parts should play in what octave.
Answer: Is there a pickup phrase at the end of the first ending? If so, then I would expect that the "2nd time R.H. 8va" notation is placed in the 1st ending to remind you to start playing an octave up at that pickup. Otherwise it would sound odd to play the pickup in the written octave and then suddenly jump an octave up on the downbeat.
Answer: I have just had sight of the actual book. So we can stop guessing!
This repeated section is NOT included in the DS.   The Coda jump occurs before it starts.
So the intention is clearly to play the second strain of 'The Entertainer' at written pitch first time, 8va up the second time. This carries into the 2x bar, hence the need for 'loco'.
The whole arrangement is a confusing mishmash of 8va lines and text instructions.   The instruction under discussion is particularly confusing, as '2nd X' is superfluous, and it's to say the least unhelpful that there's no confirmatory '8va up 2nd x' instruction at the beginning of the repeated section.  The one and only time that 1st x bar is played, the pickup notes are to be played 8va up.
Hal Leonard should be ashamed of themselves.
Here's the page before the one the OP showed us.  So now we're fully informed!


How do I copy a worksheet from one workbook into another new workbook with just that worksheet in (with pastevalues)?

Question: I am trying to create a macro that takes a worksheet from a workbook, and then saves that worksheet as a single workbook but with all cells as values rather than formulas.
The bit I am struggling with is the paste values section.
This is what I have currently:
<code>ThisWorkbook.Sheets("Tickets (1-48)").Copy
With ActiveWorkbook
    For ColNr = 8 To 120
        If Cells(RowNr, ColNr - 1) = "0" Then
            TempValue = Cells(RowNr, ColNr - 1)
            If TempValue = "0" Then
                For i = 0 To 9
                    Cells(RowNr, ColNr - 1).Select
                    Cells(RowNr, ColNr - 1).EntireColumn.Delete
                Next i
            ColNr = ColNr - 1
            Else
            End If
        Else
        End If
    Next ColNr

    .SaveAs strpath & "\" & "Retail " & strFilename & "(1-48)" & ".xls"
    .Close 0
End With
</code>
Ignore the section in the middle.
Thanks.
Answer: I'm not sure what your code is doing but you can adapt it to this. Here is the general code that a recorded macro will show you.
<code>'Selects everything on the current sheet and copies it
Cells.Select
Selection.Copy

'Add a new workbook.
'Adding a new workbook makes it the active workbook so you can paste to it.
Workbooks.Add

'Paste the date using  Paste:=xlPasteValues
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
Range("C8").Select
</code>
Comment: So simple. Thank you!


Modernizr - Which scripts get loaded asynchronously?

Question: I have the following:
Modernizr.load([
{
  load : '//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js',
  complete : function () {
    if ( !window.jQuery ){
      Modernizr.load('/js/jquery-1.6.2.min.js');
    }
  }
},
{
  load : ["/js/someplugin.js", "/js/anotherplugin.js"],
  complete : function()
  {
    // do some stuff
  }
},
{
    load: ('https:' == location.protocol ? '//ssl' : '//www') + '.google-analytics.com/ga.js'
}
]};

I read that Modernizr loads scripts Asyncronously. But in the above example, which ones are loaded async?
Do all of the following get loaded asyncronously?

jquery.min.js
someplugin.js
anotherplugin.js
ga.js

Or is it a combination of async and ordered loading like this:

jquery.min.js is loaded first
Then someplugin.js and anotherplugin.js is loaded async
finally, ga.js is loaded

I'm having a hard time testing which case it is.
Answer: You've selected a fairly complex example to dissect. So lets do it in steps.

The three parameter sets {...},{...},{...} will execute sequentially.
Inside the first parameter set you will load jQuery from google's CDN, then when complete you test if jQuery actually loaded. If not (perhaps you are developing offline and the google CDN is not reachable), you load a local copy of jQuery. So these one is "sequential", but really only one of them will load.
In the second parameter set you load someplugin.js and 'anotherplugin.js` simultaneously and asynchronously. So they will be downloaded in parallel. Its great when you can parallel 2 items at a time as that is the "weakest link" for browsers today (yup only IE, Every other browser will parallel 6-8 files at a time).
In the third parameter set you load the google analytics script.

Remember modernizr is a collection of tools. The included loader is actually just a repackaged yepnope. So you can google for more about yepnope.
The idea with the sequential loads is to be able to ensure that dependencies load in order (example your jQuery plugins must load after jQuery framework). The purpose of the parallel downloads syntax in parameter set two is to speed up performance for multiple files that are not co-dependent (example you could load multiple jQuery plugins in parallel once jQuery is loaded as long as they don't depend on eachother).
So to answer your question, your hypothesis #2 is correct. If you'd like to explore more using firebug, add some console.log statements in each parameter set's complete function. You should see the 3 groups complete sequentially every time. Now switch firebug onto the "Net" tab to watch the file requests go out. The files someplugin.js and 'anotherplugin.js` won't necessarily load in the same order everytime. The requests will go out in order, but there timing bars should overlap (showing them as parallel). Testing this locally will be hard because it'll be so fast. Put your two test files on a slow server somewhere or bias them the opposite of what you are expecting (make the first file 1mb and the second <1kb) so you can see the overlapping downloads in the network monitor tab of firebug (this is just an artificial scenario for testing purposes, you could fill a file with repeated JS comments just to make an artificially slow file for testing).
EDIT: To clarify a little more accurately, I'd like to add a quote from the yepnopejs.com homepage. yepnopejs is the resource loader that is included (and aliased) inside modernizr:

In short, whatever order you put them in, that's the order that we
  execute them in. The 'load' and 'both' sets of files are executed
  after your 'yep' or 'nope' sets, but the order that you specificy
  within those sets is also preserved. This doesn't mean that the files
  always load in this order, but we guarantee that they execute in this
  order. Since this is an asynchronous loader, we load everything all at
  the same time, and we just delay running it (or injecting it) until
  the time is just right.

So yes, you could put jquery, followed by some plugins in the same Modernizr.load statement and they will be downloaded in parallel and injected into the DOM in the same order as specified in the arguments. The only thing you are giving up here is the ability to test if jQuery loaded successfully and perhaps grab a backup non-CDN version of jQuery if necessary. So it's your choice how critical fallback support is for you. (I don't have any sources, but I seem to recall that the google CDN has only gone down once in its entire lifetime)
Comment: Thanks for the thorough explanation. Is it a problem to asynchronously load jQuery + multiple jQuery plugins at the same time? Or does jQuery need to be loaded all by itself first?
Comment: @Jakobud I have added a quote and link to the yepnopejs homepage. Have a read of the homepage if you want to truly familiarize yourself with all the little tricks you can do with yepnope aka `Modernizer.load()`.


Logarithm as an Exponent

Question: I have two practice problems I am working through and I am stuck as to the logic involved in solving them.

$100^{\log(5/2)}$
$100^{\log(5)/2}$

What properties should I be looking at here and if you could detail the steps involved it would be much appreciated. Thanks.
Comment: What are we supposed to do with them?
Comment: We are supposed to get a numerical value. I already know that the answers are 6.25 and 5, I am just unsure as to the steps involved to get there.
Comment: No calculators? Are you given $\log5$ and $\log2$?
Comment: @RyePie The first question can be written as $100 \log 5 - 100 \log 2$, which surely is much more than $6.25$. How did you calculate your answer?
Comment: Sorry, I entered the problem incorrectly. I didn't have the logs set to an exponent in either equation. It is correct now.
Comment: Are those logs, logs to the base 10?
Comment: If they are, then the basic fact you need is $10^{\log x}=x$.
Answer: Assuming that $\log$ is the base-$10$ logarithm and using $10^{\log(x)} = x$ for all $x \in \mathbb{R}_{>0}$, we obtain
$$
\begin{array}{lrcccl}
  & 100^{\log(5/2)} &=& \big( 10 \cdot 10 \big)^{\log(5/2)} = 10^{\log(5/2)} \cdot 10^{\log(5/2)} = \dfrac{5}{2} \cdot \dfrac{5}{2} = \dfrac{25}{4} &=& 6.25 \\
  \text{and} \\
  & 100^{\log(5)/2} &=& \big( 10 \cdot 10 \big)^{\log(5)/2} = \big( 10^{\log(5)} \cdot 10^{\log(5)} \big)^{1/2} = \big( 5 \cdot 5 \big)^{1/2} &=& 5
\end{array}
$$
The last one can also be computed as follows:
$$
\begin{array}{rcccl}
  100^{\log(5)/2} &=& \big( 10^2 \big)^{\log(5)/2} = \big( 10^{2/2} \big)^{\log(5)} = 10^{\log(5)} &=& 5
\end{array}
$$
Comment: Did you mean $10^{\log x} = x$ for all $x \in \mathbb{R}^+$?
Comment: @N.F.Taussig: Yes, thank you. I edi it.
Answer: $1.$ Let $a = 100^{\log(5/2)}$
Taking $\log$ on both sides (base $10$), we finally have
$$2(\log 5 - \log 2) = \log a$$
$$\implies 0.7958 = \log a$$
$$\implies a = 6.5$$(approx.)
 Similarly you can solve the second one by taking $\log$ on both sides, and you finally get the answer i.e. $5$
Answer: Remember, $10^{log(x)}$=x. (the base of log(x) is 10). This is simply because $log(x)$ is saying "What power do we need to raise 10 to in order to get x?" Raising 10 to that very power will obviously get us x.
Right here, you have $100^{log(x)}$. Remember that $100=10^{2}$.
$(10^{2})^{log(x)}$ is simply $10^{2log(x)}$. You should know this from exponent rules and just by conceptualizing what happens.
(To give an example, $(3^{4})^{2}=3^{4} \times 3^{4}$ which, as you know by exponent rules, you add the powers of 4, which just means multiplying by 2.)
Use the fact that $100^{log(x)}$=$(10^{2})^{log(x)}$=$10^{2log(x)}$ to solve the problems easily. You may also take advantage of the fact that $2log(x)=log(x^{2})$ to really see how the complicated-looking exponents reduce down to something simple.
Bottom line: review your log rules, and get some practice using them. Then you will automatically see how to make a problem easier by using log rules.

Logarithm as an Exponent


Delegate specific Group Administration

Question: I would like to delegate an AD user to administer the Group Membership of certain groups. But here is the catch: the user should only be able to to add user accounts to or delete user accounts from this group. The user should not be able add other groups to these groups.
Can someone help me out?
Answer: I don't believe this is possible.  The group object ACL permission allowing to add members will allow both users/ groups to be added.  The only way I can think of to accomplish something like this would be to write a scheduled script that checks the managed groups members and removes any group objects if found.
Comment: Resolved: Don't know why I didn't think of this earlier.By using restricted Groups you can define which objects may be part of an AD Group. So I created a Restricted Group GPO hereby limiting membership for every security group and linked the GPO to the Domain Controller OU. This way whenever a group other than the one specified in the Restricted Group is added to a security group he will be automatically removed by Group Policy. Of course this is only workable in small environments with no more then 100 security groups. For larger environments a more efficient solution is in its place.
Comment: Yes, this will prevent groups from being added to the groups you set up as restricted groups.  However, it will also prevent any users from being added.  This removes the ability of the AD user to administer the membership.

Delegate specific Group Administration


SAS PROC LOGISTIC - why is Goodness of Fit test rejecting model?

Question: I'm modelling a university applicants dataset using PROC LOGISTIC in SAS (9.2). The target variable is 'Enrolled y/n', and i'm modelling against a range of 13 variables (a mixture of indicator, continuous and class) including: Number of applications submitted, number of events attended, Applicant Age, etc.
I'm using 50% of the whole dataset to train the model, which gives me a sample size (for training) of just under 15,000 observations.
When I run PROC LOGISTIC, the output is reporting that the majority of the variables are highly significant at <.0001.
The 'Testing Global Null Hypothesis: BETA=0' statistics also report that the model is good at <.0001, and the Association Statistics table is reporting that a high percentage (90%+) of predicted probabilities are concordant.
All of which seems great, until I get to the deviance statistics for Goodness of Fit. Pearson, Deviance, and Hossmer/Lemeshow tests all also report a Pr>ChiSq value of <.0001. If i'm interpreting this correctly (referencing Paul Allison), this significance level means that the model should be rejected on the grounds of poor fit.
I've tried using STEPWISE to reduce the model, but this only resulted in rejection of a single factor, and the GOF stats were unaffected.
Suspecting multicollinearity, I've tried modelling just single effects against the dependent variable, but i'm still getting similar results - high significance on the parameter estimate p-values, but also the high significance value in the GOF tests...
Is there something fundamentally wrong with my model - or am I misinterpreting the GOF tests under the circumstances? Please can anyone advise what I need to investigate?
The Code I've been running for just a single effect but which is producing the same problematic results as for the model including all the factors:
<code>/*Applicant_Factors_TRAIN: Single Factor*/
proc logistic DATA=Applicant_Factors_TRAIN;
MODEL Applicant_Enrolled(EVENT='1')= Total_campus_visits/ AGGREGATE SCALE = NONE LACKFIT RSQ;
run;
</code>
Output below:
Answer: I've since read that Goodness of Fit tests become inherently problematic when dealing with large datasets, and consequently, based on the literature, have chosen to disregard them in favour of a cross validation approach that considers p-value, test of null hypothesis, ROC AUC c statistics, confidence intervals and Max-rescaled R-Square statistic (Johnson and Wichern 1992) (Shmueli, Lin and Lucas Jr. 2013) (Li 2013)


Z-test with a lot of null values

Question: I have a question concerning the validity of my email tests.
I'm testing different email variations (between 2 and 4 variations usually) with different groups of members (hundreds of thousands members per group) and I'm measuring the revenue per member.
I know the average revenue per member and the standard deviation for each group and use a Z-test to assess if the differences are significant or not.
There are between 1 and 2 % of buyers within the groups which means that 98% of the members have a revenue of 0.
My question is, is the Z-test still valid in this case as there are only few different data points?
Comment: Are you testing the differing proportions between groups or the differing revenue?
Comment: I'm testing the differing revenue.
Answer: First define your question. The mean revenue per member (whatever that means) is not the same as the mean revenue per member contributing positive revenue. Comparing either pair of means could make practical sense.
Either way, if your sample size are thousands, almost any difference will qualify as significant at conventional levels.
The number of distinct values is not really an issue in itself. With only one distinct value, there would be no variation to compare with, but that situation is not yours. There is a worry concerning possibly extreme skewness with your data but t-tests usually behave quite well so long as the samples are not small; nevertheless, watch out.
I'd always use a t-test rather than a z-test. When they give the same practical answer, there is no disadvantage, and when they give a different answer, it's because of small sample size and the t-test is preferred.
Comment: What do you mean by positive revenue? Here the revenue is the amount a customer spend.

The distribution of the revenue within a group is skewed indeed, correct me if I'm wrong but here (as the Z-test relies on the Central Limit theorem) what is supposed to follow a normal distribution is the difference in means (of different groups) not the revenue within the groups right?

I understand the idea to use the t-test in general (so you don't have to worry about the sample size) but in this case, as I have a big sample, what are the advantages to use a t-test?

Thanks for your reply.
Comment: Revenue is zero or positive, is it not? If it's not zero, then it's positive. I just think that using the t-test covers all the bases; that way you never have to make an arbitrary decision about when a z-test is allowed, valid or acceptable. In fact, I don't think I ever see z-tests in any research literature or statistical software manuals; your literature and software evidently varies.
Comment: I got what you mean, I compare here the mean revenue taking all members into account (so not only the ones having a positive revenue).

Z-test with a lot of null values


How to determine if proportions are significantly different

Question: I have a database of purchase events. Each event has a field green (a boolean field that determines whether the item was green) and a field silk that is another boolean parameter.
The proportion of an events that are silk and green is p_A = x
and the proportion of events that are non silk and green is p_B = y
p_B > p_A, p_B / p_A = z
Is it safe to assume that non silk purchased items are more likely to be green than silk purchased items?
How to determine whether the difference is significant? Should I look into some kind of p-value testing?
update
After Glen_b's suggestion I realized that I had subtly confused probabilities and proportions, thus updated my question to be dealing with proportions.
Answer: I believe that your problem is simply the testing of two proportions.
You can first notice that there are two populations in your problem. The silk and non-silk populations. In this setting the question you are asking is if the proportion of green items in the silk population is significantly smaller than the proportion of green items in the non-silk population.
There is a simple answer to this question if you can assume that the observations are independent of one-another. If you are not able to ad-hoc impose the independence condition there are tests for it: https://en.wikipedia.org/wiki/Pearson%27s_chi-squared_test
Let's assume that the silk population is $\{X_1,...,X_n\}$ and that the non-silk population is $\{Y_1,...,Y_m\}$. In this notion I mean that $X_i = 1$ if the i-th observation in the silk population is green and $X_i = 0$ otherwise. The same rule applies to the $Y$'s. In this formulation the $X$'s are independent Bernoulli random variables with mean $p_X$ and the $Y$'s are also independent Bernoulli random variables with mean $p_Y$. The statistical test you want to perform is:
$$H_0: p_Y \leq p_X$$
$$H_1: p_Y > p_X$$
A test for those statistical hypothesis can be performed as follows. The proportion of green and silk items is $\bar X =\frac{\sum_{i = 1}^{n}X_i}{n}$ and the proportion of green and non-silk items is $\bar Y =\frac{\sum_{i = 1}^{m}Y_i}{m}$. Than under fairly simple conditions,
$$T = \frac{\bar Y - \bar X}{\sqrt{p^*(1-p^*)(\frac{1}{n}+\frac{1}{m})}}$$
where $p^* = \frac{\sum_{i-1}^nX_i + \sum_{i-1}^mY_i}{n+m}$, has approximately a normal distribution with mean 0 and variance 1.
You can reject $H_0$ if $T$ is greater than the critical value related to the level of significance of your choice.
This http://www.dummies.com/how-to/content/how-to-compare-two-population-proportions.html might be useful.
Answer: I think I have an answer for you, but first I'd like to restate the problem just to make the notation easier on me.
The Question Restated
We have some set of events $E$ such that the probability of an event to be silk and green is $P(S,G|E)$ and the probability of an event to be non-silk and green is $P(\neg S,G|E)$. We know that $P(\neg S,G|E)>P(S,G|E)$. We wish to know if the probability of purchased, non-silk items being green $P(G|\neg S,E)$ is greater than the probability of purchased, silk items $P(G|S,E)$.
Analytic approach
Let's express what we want in terms of what we have:
$$ P(G|S,E) P(S|E) = P(G,S|E)$$
$$ P(G|\neg S,E) P(\neg S|E) = P(G,\neg S|E)$$
$$ P(G,\neg S|E) >P(G,S|E) \rightarrow P(G|\neg S,E) P(\neg S|E)>P(G|S,E) P(S|E)$$
As you can see we can not make a comparison between the two without having the probability of something being silk or non-silk given an event.
Say you had this information (I assume you do!) you would then be in a position to determine the likelihood this set of observations arose out of chance or not as well as evaluate how much that matters. You probably would want Fisher's exact test or Barnard's Test.
Someone correct if I'm wrong on the tests.
Comment: Can I assume the probability of an item being silk to be equal to `P(S|E) = total_amount_of_silk_items / total_amount_of_sold_items`? after a suggestion I updated my question to talk about proportions and not probabilities but I assume we are still talking about the same concept. In comparison with the other answer I guess this is considered the analytics approach while the answer above is covering the statistics?


django url pattern strips forward slash when running in nginx+uwsgi

Question: For the following url pattern:
re_path(r'proxy/(?P<url>.*)', myview)

When I send proxy/http://www.google.com
myview function receives url as http:/www.google.com (with single /)
It happens with uwsgi+nginx setup , when running with runserver url is http://www.google.com .
Comment: I think you should send this url value as url querystring
Comment: Well, I'm trying to use https://github.com/mjumbewu/django-proxy where it handles other requests parameters .. to forward requests to the specified url... and I think there is a way to handle this , otherwise the library is severely flawed
Comment: I just saw the library docs, it did not show any indication of passing Protocol and host information though url argument.
Comment: url('proxy/(?P.*)', proxy_view), and the view function gives url to requests lib, and requests expect protocol to be there..
Answer: This is because nginx will automatically merge double slashes in URLs into a single one:
http://nginx.org/en/docs/http/ngx_http_core_module.html#merge_slashes

Enables or disables compression of two or more adjacent slashes in a URI into a single slash.
Note that compression is essential for the correct matching of prefix string and regular expression locations. Without it, the "//scripts/one.php" request would not match

You should disable it in your nginx.conf:
merge_slashes off;

Comment: yes!, It fixed it.. you have to put it in `server` context


In what scenario is having separate login pages for users and administrators better?

Question: I am creating my first web app from scratch using PHP. I won't be using a framework.
My proposed file structure looks something like:
<code>index.php
/images
/css
/js
/classes
/includes
/views
/modules (blog, forum, etc.)
</code>
I'm also considering including /admin maybe.
What concrete decisions/considerations do I need to make before taking an approach, i.e. choosing between {mywebapp}.com/login (for both users and admin) or {mywebapp}.com/admin (for just the administrators)? And why?
Comment: Completely up to you! If the admin area is the same as the user area but with more features, I usually give them the same login. If the admin area is it's own separate area, I usually do the /admin bit.
Comment: Mhh why are "session or cookies not very ideal"? I haven' t seen an app/framework which doesn' t make use of at least on of it...
Comment: It would be a bit of a mess in the code but I recommend that you keep the same page since you are new to php and if your app is simple enough. You could separate the pages but you will need to use either php session or cookies which is not very ideal.
Comment: @zaw, How would you propose keeping session information then?  There is certainly nothing wrong with sessions/cookies.
Comment: Well now, I'm pretty stumped as to editing this question such as to not solicit opinions. Somebody please help! I would like to say thanks for all the helpful suggestions, they'll go a long way in helping me with my app.
Answer: <code>/public
   /images
   /css
   /js
   index.php
/classes
/includes
/views
/modules (blog, forum, etc.)
</code>
Your doc_root would by site-path/public.
An admin should be a user with extra privileges. As long as your login process is secure, there is no reason for a separate admin login.
Comment: +1 for moving the code out of the doc root.
Answer: This is a UI(user interface) question. I cant find any clear programmatic advantage for either of them, and have seen frameworks implement both of them.
In my opinion, you should have a special login page for the admin if you have a distinct and  separate 'back office' or a specialized admin panel. If the admin is like any other user, but with extra privileges, using a combined login seems like the way to go.
Comment: That's exactly what I was concerned about - the admin panel becoming so specialized and different that keeping a combined interface would become cumbersome somewhere down the line.


Given any 2 curves, can we prove the existence of a common normal?

Question: One suggestion would be to say the every two curves will have a distance of closest approach, and this distance will be normal to both of them, but this is either:
1)what we are actually trying to prove
2) inherently wrong in the sense, there maybe 2 curves who don't have a common normal so their distance of closest approach wouldn't be normal to them.
Comment: If both can be open you have cases like $y = e^x$ and $y = e^{-x}$ where the two curves do not even have a pair of normals that are parallel.
Comment: @Mohammad has answered the open-closed case, interestingly. I asked the closed-ness question because I suspect that for two smooth closed curves the answer is actually  in the affirmative.
Comment: Is the idea that the curves are closed?
Comment: @CadeReinberger I'm not exactly sure in what cases to divide the problem into. But yes, if it helps we can solve it differently in open-open, closed-closed, and open-closed cases
Comment: @DavidK good insight. Can you name a few more, I'm really interested in their nature.
Comment: @CadeReinberger my intuition says so tio
Comment: @CadeReinberger I think an argument is possible using solid angles
Comment: $y=x^3$ and $y=-x^3$ have slopes of tangents (normals) $y'=3x_0^2 \ (y'_n=-\frac1{3x_0^2})$ and $y'=-3x_1^2 \ (y'_n=\frac1{3x_1^2})$, but $-\frac1{3x_0^2}\ne \frac1{3x_1^2}$. You can generalize this result to any odd power.
Comment: @DavidK any such examples with non intersecting curves? Reason being that I'm working with closest assistance of approach, so that question doesn't arrive in the case of intersecting curves
Comment: You could try the curves $y=e^x$ and $y=-e^x$, which was the example I actually first thought of, not sure why I changed it. Those curves do not intersect but they also have no point of closest approach.
Answer: If $\gamma_1$ and $\gamma_2$ are two closed smooth curves in the plane then they have $\geq1$ common normals.
Proof. The function
$$f(p,q):=\bigl\{|q-p|\bigm| p\in\gamma_1, \ q\in\gamma_2\bigr\}$$
takes a positive maximum at some point $(p_0,q_0)$ of the compact set $\gamma_1\times\gamma_2$. The line $\ell:=p_0\vee q_0$ then is a common normal to both $\gamma_i$, since otherwise there would be points $p'\in\gamma_1$  and $q'\in\gamma_2$ near $p_0$ and $q_0$ with $|q'-p'|>|q_0-p_0|$.
Comment: Could you elaborate a little on how suppose p naught and q naught are not normal then that implies there exists another maximum. I'm having trouble comprehending it goemetrically
Comment: @John_Nash: You have appealed to this principle in your question. If $\ell$ would not be normal to $\gamma_1$ at $p_0=\gamma_1(t_0)$ then the function $f(t):=|\gamma_1(t)-q_0|^2$ would not have a maximum at $t=t_0$, since $f'(t_0)\ne0$.
Answer: If they have parallel tangents at a point, then they have the same normal at that point.
So you only need to differentiate.
Comment: @John_Nash That's a different question, but off the top of my head I can't presently think of a reason why such a system of curves may not exist. Indeed, I can noe say that such a system exists. Think of two curves that have a common normal. But of course I guess you mean an infinite family.
Comment: This provides us with a method of checking. But can we classify beforehand, fir examples will 2 non intersecting curves always have a common normal?
Comment: @John_Nash I don't understand. As for your question, my answer above does not assume that the curves intersect. Indeed, when I said that they should have the same tangent, I actually meant same as in *parallel,* not necessarily coincident. Thus, if your curves have the same derivative at a point, then they necessarily have parallel tangents, and therefore coincident normals, there.
Comment: yes thanks for that this provides a convenient method for checking whether two curves will have a common normal or not. Now, is there a general family of curves(for example maybe closed curves) such that if we take any two curves from that family, they will have a common normal?
Answer: What about orthogonal trajectories?
Each family member is normal to the other family member so they do not have a common normal.
Comment: Every two concentric circles do have a common normal, it is radius of the biggest circle
Comment: @John_Nash I think he means that, say, the unit circle and the positive $x$ axis don't have a common normal
Comment: @CadeReinberger the y axis?
Comment: @John_Nash. Yup. Dunno how I missed it.