Find a general solution for $y'=\frac{3x+4y+2}{2x+y+3}$

Question: $$\frac{dy}{dx}=\frac{3x+4y+2}{2x+y+3}$$
I tried to solve this problem as following,
like 'exact form problem',
$$(2x+y+3)dy - (3x+4y+2)dx = 0$$
This equation is not exact yet, so i tried to find integrating factor (which make equation into exact form). However, i can't find any factor.
My Question:

How to solve this?
Is there method using linear transformation ? ( like $3x+4y+2 \rightarrow x$ , $2x+y+3 \rightarrow y$)

Second question is motivated by fact that when we find vloume $(3x+y)^2 + (2x+5) \leq 1$, we can use linear transformation to find vloume by multiplying determinant.
Answer: This has the type of a homogeneous ODE. Set $y-b=(x-a)u$ where $a,b$ solve
$$
3a+4b+2=0,\\
2a+b+3=0.
$$
This gives $a=-2$, $b=1$, and
$$
(x+2)u'+u=y'=\frac{3(x+2)+4(y-1)}{2(x+2)+(y-1)}=\frac{3+4u}{2+u},
$$
which is now separable.

Or introduce another parameter on the solution curves so that the equation separates into a linear system
$$
\pmatrix{\dot x(t)\\\dot y(t)}
=
\pmatrix{2&1\\3&4}
\pmatrix{x(t)\\y(t)}
+
\pmatrix{3\\2}
$$
with characteristic equation $0=λ^2-6λ+5=(λ-5)(λ-1)$. Left eigenvectors are $(1,1)$ and $(3,-1)$, giving the decoupled equations
$$
(\dot x+\dot y)=5(x+y)+5\\
(3\dot x-\dot y)=(3x-y)+7
$$
which are easy to solve. Then eliminate $t$
Comment: Hi, Thank u very much.. i have question on second method. why we can aussume $dx= 2x+ y+ 3 , dy= 3x+4y+2$?? ( i think it used on matrix)
Comment: Because by introducing $t$ we get an additional degree of freedom that can be used to fix $\frac{dx}{dt}$ to be the denominator term and in consequence get also $\frac{dy}{dt}$ as the numerator.
Comment: Wow, got it! , then how to get the last decoupled equation?  I know what it is eigenvalue and vector and elementary linear algebra. However I cant search that context.
Comment: The left eigenvectors give the linear combinations that decouple the system, the right eigenvectors are a factor in the basis solutions. Usually the solution process uses a basis of right eigenvectors to diagonalize the system, which is to be recommended for larger systems. In dimension 2 or 3 one often can find the solution faster using the above approach.
Comment: How to get this $ \pmatrix{1&1}  \pmatrix{x'\\y'} =  5\pmatrix{1&1}  \pmatrix{x\\y} +5$ .It seems like $v \pmatrix{x'\\y'} =\lambda v  \pmatrix{x\\y}  +5$ ,where $v$ is eigen vector and $\lambda$ is eigen value.
Comment: $(1,1)$ is the left eigenvector to the eigenvalue $5$. Thus the addition of both equations is scalar in $(x+y)$.
Comment: Really Really Thank you . I see now completely, thank you!!
Comment: I have a question to your first approach. When you plug in $y=(x-2)u-1$ into $$\frac{3x+4y+2}{2x+y+3}$$ then how do you get $$\frac{3+4u}{2+u} \, ?$$ Am I missing something?
Comment: Yes, there was a sign mismatch in the first approach which is now corrected.
Answer: Let the integrating factor $f$ depend only on $x.$ Then it should satisfy the equation $$2f+2xf'+yf'+3f'=-4f.$$ This simplifies to make $$\frac {f'}{f}=-\frac {6}{2x+y+3},$$ which we may now easily integrate to find a solution $$f=\frac{1}{(3+y+2x)^3}.$$
But this is probably more laborious than the first of the methods suggested by @LutzL above.
Comment: If you assume $f$ depends only $x$, i think the last equation can't be occur.
Comment: Hi Allawonder, could you explain in detail? I think $(y-2x)(2x+y+3)dy - (y-2x)(3x+4y+2)dx$ is not exact.
Comment: @hew I made an error of omission. I've now essentially rewritten my answer.


Rayleigh distribution with unequal variances

Question: Suppose we have two independent, uncorrelated random variables $X\sim N\left(0,a^2\right)$ and $Y\sim N\left(0,b^2\right)$ (i.e. $X$ and $Y$ are Normally distributed with mean 0 and standard deviations $a$ and $b$ respectively.)
How do I find the probability that $\sqrt{X^{2}+Y^{2}}\le r$, where r is a positive real number?
I know that if the two normals had the same standard deviations, then I would use the Rayleigh CDF to answer my question. But when the standard deviations are unequal, I can't seem to find much on how to obtain this probability.
Comment: Very detailed answer [here](https://stats.stackexchange.com/q/629035/34792)
Answer: In this case the random variable $X^2+Y^2$ is a weighted sum of two chi-squared random variables each with one degree-of-freedom.  There is no closed form distribution for the probability of interest in the general case where $a \neq b$.  To facilitate our analysis, let $S \equiv Y^2/b^2 \sim \text{ChiSq}(1)$.  We can then write the probability of interest as:
$$\begin{align}
\mathbb{P}(\sqrt{X^2+Y^2} \leqslant r)
&= \mathbb{P}(X^2+Y^2 \leqslant r^2) \\[16pt]
&= \mathbb{P}(X^2+ b^2 S \leqslant r^2) \\[8pt]
&= \int \limits_0^\infty \mathbb{P}(X^2+b^2 S \leqslant r^2|S=s) \cdot \text{ChiSq}(s|1) \ ds \\[6pt]
&= \int \limits_0^\infty \mathbb{P}(X^2+b^2 s \leqslant r^2) \cdot \text{ChiSq}(s|1) \ ds \\[6pt]
&= \int \limits_0^\infty \mathbb{P} \bigg( \Big( \frac{X}{a} \Big)^2 \leqslant \frac{r^2-b^2 s}{a^2} \bigg) \cdot \text{ChiSq}(s|1) \ ds \\[6pt]
&= \frac{1}{\sqrt{2} \pi} \int \limits_0^{r^2/b^2} \gamma \Big( \frac{1}{2}, \frac{r^2-b^2 s}{2 a^2} \Big) \cdot \frac{1}{\sqrt{s}} \cdot \exp \Big( -\frac{s}{2} \Big) \ ds, \\[6pt]
\end{align}$$
where $\gamma$ is the lower incomplete gamma function.  You can evaluate this integral numerically to obtain the probability of interest, but it has no closed form in general (so far as I'm aware).


Questions related to 'npm install' and 'node_modules'

Question: When executing the 'npm install' command in a node project,
Is there a way to prevent certain directories (packages) in the node_modules directory from being updated?
In other words, is there a way to avoid touching the specific directory (package) itself in node_modules?
(I'm using a package that is not defined in the 'package.json file' content by manually putting it inside the 'node_modules directory'. I hope the package is not deleted when commanding 'npm install'.)
Comment: In short no, in long nope
Comment: If you are manually copying it in, npm doesn't know it exists.  So it won't update the folder, but it won't do anything to protect it either.  There are plenty of ways to do a local install.  And you could just have the module in the source directory and not deal with whatever extra work it takes to put something in node_modules.
Answer: This situation is little complicated but you can try creating your private package.
the below test works, you can give it a try:
I have created a dummy package "foo" with:
<code>"name": "@my-private-namespace/foo",
</code>
I created a folder:
<code>$ npm init -y
...
$ npm install ../foo
...
$ ls node_modules/\@my-private-namespace/
foo
$ npm install n
...
$ ls node_modules/\@my-private-namespace/
foo
</code>
Comment: '@my-private-namespace' <-- this mean the dummy package path??
Comment: Yes, path to the dummy package


Overriding individual websites hosted in NGINX to show a Maintenance Page

Question: We have an architecture whereby we are hosting multiple sites in NGINX. Each NGINX site has its own config.Each of these sites points to a common codebase but points to a different domain name and its associated SSL.
What we want to do is during maintenance is to show a common Maintenance.html page once the request for the page is made. While, we can go into the website.conf file for each website and insert a rewrite rule, it is not a complete solution - its more of a hack which we are trying to avoid.
We would like to implement this in the nginx.conf file at the root level, whereby any request that comes in over (443) is to be intercepted (before its own config file is loaded) and redirected to a common Maintenance.html page.
How can this achieved at the nginx.conf file level?
Thanks
Answer: You can do one time edit of all hosts (and don't forget to edit a template from which these are created) and after that you'll never need to edit them all.
You create an empty file, which you can call, for example, "all_vhosts_override". You add include "all_vhosts_override"; near the top of each vhost definition, above all location and alias entries.
When you need to override something in all vhosts at once, you add statements into that file and reload nginx. All vhosts will receive config from this single file, you wouldn't need to update their individual configs. Just clear override file empty when you done your maintenance and reload again.


Why is music theory built so tightly around the C Major scale?

Question: Lately, I'm trying to study deeper into music theory, learning Intervals, key Signatures, Chords, Progressions etc. I can see that everything is built around the 'normal' notes that belong to the C major scale, and everything in-between is an inconvenient anomaly. I just feel there is a whole lot of unreasonable extra work and trouble coming out of this convention, that feels wrong.

You have the normal/natural notes, and the 'accidental' ones. The staff has no place for them, so you have to draw extra symbols around them, relative to the closest 'natural' note. Practically the staff behaves like it's offended by the accidental's existence. Or like it's punishing you for using them.
Naturally, you have to avoid using the accidentals, as much as you can. So G# is different than Ab, despite being (tonally) the same note, because practically it allows you using fewer accidentals. I understand how that works, but it still feels weird.
And instead of writing the key in the start of the sheet, you'll have to guess it by reading the accidentals right next to the clef, and memorize 30 different key signatures. Note that the signature is defined from the accidentals. Oh yes, there are shortcuts by using the circle of fifths. and a poem with Charlie's Father. I'm starting to understand how this works, but I still don't like the fact I have to memorize something.
Then you have the Intervals, that are initially based on ignoring the accidentals (Generic Intervals), then we re-introduce them by valuing the Specific intervals and defining 'Interval Qualities' (perfect, major, minor, diminished, augmented etc).

Now that I've stated some inconveniences of this system, I'm wondering what are the benefits that make all this memorizing worth the trouble. The only thing I can guess, is that the piano - probably the most important/common/traditional instrument for a classical composer - uses the black keys for the accidental notes. Of course this will not necessarily benefit other instruments.
But leaving the individual instruments and the easiness of reading music sheets, out of the scope of this question, what are the benefits of the the accidentals to the evolution of Music Theory itself?
I made some serious Edits out of the initial question, trying mostly to filter out my ranting :).
Comment: Also try to keep in mind that the whole system of musical notation evolved over time, rather than being a big design up front by experts. If you're asking for the historical facts of that evolution then ask for those facts; as it stands it sounds like you're just complaining.
Comment: Check [here](http://music.stackexchange.com/questions/893/why-is-c-the-base-note-of-standard-notation-and-keys) to get an idea of why C is the basis of music theory. Your question reads as you are asking many theory questions in one post. To get a better more precise answer I would split this question into a few core questions.
Comment: Concerning the memorisation of point 3: here's a handy trick. (Works only for tonal music.) When dealing with flats at the key, the last flat is a fourth up from the key note (I bet this is called differently - I don't talk about musical theory in English very often -, but I mean the note the key is named after). (So if you have two or more flats, the second from the right is the key note.) Sharps: the last sharp is a major seventh above the key note (minor second down, obviously). This saves you from memorising a poem. I need another comment for the circle of fifths.
Comment: Your point #3. Where do we get 30 key sigs from, and what are they all?
Answer: 1. Bias against "unorthodox" notes
Western music tradition (and some others) was, and to a large extent still is, based on heptatonic scales, that is, seven unequal divisions in an octave. So, in a given musical context, all twelve notes are not created equal. For instance, in a musical phrase in C major, natural notes (ones with no accidentals) are the norm, others are there to add color (hence the name chromatic, from the Greek word for color).
So, treating these extra notes as second class citizens makes a lot of sense. For guitar, you position your hand and set your mind to the scale given in the key signature and only break the pattern when you encounter an accidental. The presence of an "alien" accidental makes it obvious that you're breaking the pattern.
2. Avoiding accidentals
You don't avoid accidentals. You use just as many as necessary, neither more, nor less. Even though G# and Ab sound the same in twelve-tone equal temperament, their functions are still different.
For instance in a C major context, G# is a raised fifth and tends to resolve to A, like when modulating to A minor. On the other hand Ab is a lowered sixth and tends to resolve to G, like when using an Italian sixth. They are notated differently to convey this information, not to use fewer accidentals (but see the next part for an exception).
If you look at it the other way, when you use the G#/Ab pitch as a modified version of the fifth degree (G), e.g. as an approach note to A, you notate it as a G#. When you use it as as a modified version of the sixth degree (A), e.g. as an approach note to G, you notate it as an Ab.
It doesn't matter that they sound the same in isolation, they don't sound (feel) the same in context and it's a useful information to convey.
3. Key signatures
At least half of the 30 theoretically possible key signatures are not used in practice. You will rarely encounter the ones with 7 accidentals and the ones with 8 (or more) are practically nonexistent. Enharmonic equivalents with 5 or 4 (or less) accidentals are used instead.
With little practice their distinctive shapes and orderings are actually pretty easy to remember.
4. Interval qualities
If I understand correctly, you imply that a system based on the number of chromatic steps would be more logical.
It's not so. Like I tried to explain in the second part, G# and Ab are not equivalent. In C major, the first is an augmented fifth and the second is a minor sixth. They have very different functions.
5. Interval numbers
Here, I mostly agree with you. But remember that the more mathematical system would have its problems too. Most people are not used to start counting from zero. It would still cause some confusion.
Conclusion
Having said all these, I have to agree that there are some shortcomings of the current musical notation. But it evolved to have its present form throughout centuries with compromises, trying to make some things easier while not making some other things unreasonably difficult. Like most compromises, it's probably not optimal but it works well in practice.
Answer: TL;DR: Backwards compatibility, and the predominance of seven-note scales.
We're going to take a musical walk through history...
Let's say you're inventing music, and you start out with a single string playing a single note. That gets boring after a while, but you realize that you can play more notes by shortening the string length, so with a bit of playing around, you come up with a scale that sounds good to you. That scale has only 7 notes in it, because the eighth one ("octave") sounds like the first, only higher. Now you decide to name these 7 notes based on the letters of the alphabet: A, B, C, D, E, F, G. After that, the pitches start to repeat at the octave, so you give them the same names.
Since the idea of zero being a number doesn't really exist yet, you decide to measure the distance between notes by counting them (in other words, you're using ordinal numbers rather than cardinal numbers). So the note you start on is the first note, the note above that is the second, and the note above that is the third, then the fourth, and so forth. For example, if you count to the third note above your starting note, and then, using that as a new first note, you count to the third note above that, you end up with the note that is the fifth note from your starting note. It's a real shame that zero hasn't been invented yet, because now you have 3 + 3 = 5.
Now fast forward a bit and you've decided that, using the same seven notes, C actually sounds like a better place to start and end the scale. Same notes, just a different convention for where you start. You decide to maintain the original naming convention, though, because that's what everyone is used to, and backwards-compatibility is important.
There's one problem with your scale, though. When you picked out the notes that sounded good, you actually picked an unequally-shaped scale. Some of the notes are closer together, and some of the notes are farther apart. This leads to the scale shape you may have seen before: WWHWWWH. As long as you're just playing a melody, you don't really need to worry about this shape (except that it determines how much shorter to make the string) -- everything just sounds good. The trouble comes when you start to get fancy, and play more than one note at a time.
Let's say that you have a simple melody that goes C-D-E-F. You know that notes "a fourth" apart sound good together, so you decide to harmonize this in fourths. When the melody plays a C, you play an F, and it sounds great. That's followed by a D and an G, great! Then comes E and A, still sounding good. But then the melody goes up one more note to F, so your harmony goes up one more note to B, and YUCK! B is the fourth note above F, so it should sound good... What happened?
The problem is that, because your scale is unequally shaped (because that's what sounded good), the distance between E and F is a smaller distance than the distance between A and B, so your nice perfect fourth got all messed up. In order to fix this, you have to kind of fudge your B a little bit, and make it lower. But don't worry, there's plenty of room between A and B to stick your new modified-B. But what are we to call this new note? We can't just go renaming all the notes of our scale every time we need to throw in a new note. So instead, we name it after the note it replaced. Instead of a "B", we have a "lowered B", aka, B-flat.
As we play around with different scales and harmonies, we find all kinds of places where we have to raise and lower notes in order to maintain the proper scale shape. We always name them based on the original note that they're replacing, plus whether it was raised or lowered. In fact, any of our original 7 notes can be raised or lowered. The staff notation still reflects that we are still basically using the same 7-note scale, but depending on where we start, some of those notes may have to be raised or lowered in order to maintain the same scale shape. It's a clever little hack that allows us to maintain backwards compatibility with previous music notation, while "patching" it to allow new pitches that didn't exist before.
Eventually, to simplify things, you decide that when two notes are closer together (like E and F), the raised version of the lower note (E#) is "close enough" to the higher note (F) to pretend like they're the same (and vice versa with the lowered version of the higher note). OTOH, for notes that are further apart, you decide that the raised version of the lower note is "close enough" to the lowered version of the higher note note. This rounding off prevents you from inventing wacky keyboards with gazillions of keys, or fretboards with a large number of impossibly close frets.
Since there are five of these wider gaps, this adds five new notes to our inventory of notes -- causing 12 notes in total. But we still generally tend to use only 7 note scales. As a result, the 5 new notes don't have any inherent name of their own -- they always replace one of the previous 7. By using these modified notes in place of the original, it allows us to play the same scale shape starting on any possible note (including one of the modified notes). Of course, now you have to specify up front which version of any modified notes you are using.
Comment: I like this explanation a lot. It oversimplifies a few points but it gets the right general idea across. Also, when you learn more about harmony, some of the weird bits start making more sense. They're features, not bugs.
Comment: You might add how the irregular scale arises out of natural harmonics. Another key point to mention, I think, is the role of the organ.
Answer: You are asking quite a few different questions here, and I'm not sure your main question (about C Major) is even the main question you ask in the main body of your question!
All of the questions you ask about accidentals, the relationship between keys, and so on, have information available either here, at music.SE, or elsewhere on the web (have a good look at the right hand side of this page for starters!)
So, sorry to not give you a definitive answer to your question.
However, as a guitarist myself, I can give you a little insight into why keys (and the "hierarchy" of keys) can seem confusing to guitarists. As a guitarist, we tend to think of keys and scales as being patterns which we can move up and down the neck, each being essentially the same, simply shifted by some number of semitones. However, you're right, on an instrument such as piano (but in a purely theoretical sense too) it is the changes of accidentals between keys that allow us to understand the relationships between keys. Unless you have perfect pitch, any one key in isolation may as well be written as C major (as long as you don't want any pitches which are chromatic within that key, and don't want to change key). But, once we want to write and play more complex music, the way accidentals, key signatures and changes to them work, gives us an insight into the relationships between keys, and the theory behind these relationships, which a system of equally spaced semitone pitch names (and some kind of stave that uses them) would not.
If one is only interested in using the stave as a guide for playing the correct notes, then guitarists already have a specific stave for our use, which takes no consideration of key, music theory or key relationships, it's called TAB! But, as I said earlier, this gives no insight into how the music works, with regard to key relationships (or even pitch relationships). As you are now studying theory, I assume you are keen to gain this knowledge. As you say, as you study more, the importance of key relationships, with C major given it's own specific prominence, will become clear.
Answer: One thing I didn't really pick up from anybody else's answers is about key signatures.
A key signature isn't a guess - they're built according to the progression of the circle of fifths, so there aren't that many possible key signatures and you learn to recognise them quite quickly as you gain experience playing different pieces. You said "instead of just writing the key at the start of the music" - well, sometimes it is, but it's actually not very helpful.
The key signature isn't really there to tell you what key it's in - saying it's in F major is all very well, but I want to know what that means for what notes I'm going to play. The key signature for F major tells me that all the notated Bs will, unless otherwise stated, be played as B flats, and all other notes will be naturals. This is useful information for the player, and helps keep the rest of the stave clean for easier reading. If you had to put a flat on every single B in the piece instead of using a key signature you'd be adding a lot of clutter, and it'd only get worse in keys like A major (three sharps) or B major (five sharps).
Now sure, there aren't key signatures for minor keys (they use the signature of their relative major), but there's a reason for that too - minor keys use more notes. You can't represent it accurately in a key signature because minors commonly use both flattened and sharpened sixths and sevenths, which would be difficult to convey clearly in the key signature (and would still need accidentals to tell you which one to use when anyway). So you just set off as if it's in the relative major, and take the accidentals as they come which mutate the music into the minor.
With some practice you soon learn to glance through the music and identify if it's in the major or the relative minor based on the key signature, which is handy because you can't really play it well until you've understood what key you're in - especially if you're playing with other musicians and thus need to accurately tune chords. A lot of instruments let you play notes slightly sharper or slightly flatter, or just make up new notes between the normal ones, so you've got the flexibility to make that distinction between G# and Ab if you need it, or to counteract the problem with an equally-tempered major triad where the major third is horribly sharp.
I got a bit rambly here, but the point really is that theory and notation evolved hand in hand, and the notation not only takes in the need to represent all possible pieces of music, but is also significantly influenced by the needs of musicians to actually use the notation. Written language would be pretty poor if you could never learn to read aloud at a reasonable pace, and music notation is much the same. The simplifications which are in the notation help us sight-read pieces at full speed (depending on our ability level and the difficulty of the music of course), something we might struggle with much more if we had a more 'logical' system of notation which would in turn have to take up space conveying a lot of information we mostly don't need.
Comment: Lots of good points here, explaining some pros of the current notation system, which is actually what I was looking for. Thank you!
Comment: No problem. It's a frustrating thing to learn but it's actually pretty good at representing Western tonal music. I eventually came to appreciate that!
Answer: It's a far reaching question, based on some theoretical knowledge, but some misconceptions.
Initially, everything has to have its datum point, and the music system has Cmajor - which happens to be the white notes on a keyboard, as you state. It could have been called A, or 1, or i or alpha or just about anything you can think of. It was (and still is - convention and usage-) called C.
The accidentals at the beginning of a piece actually aren't. They're the key signature, and, yes, they can be memorised, like most other things.Key signatures numberless than 30. Each one could end up as a major or a minor, and for practical purposes, going up to 6 #s or 6bs will be sufficient. With an open key sig. for C/Am, that makes 13. A far cry from 30 ! They tell the reader which black notes are used instead of specific white notes. I realise on your guitar there are no black ,or white notes, and this makes it all confusing - I know, I play guitar and keys.On a keyboard, to make a white note go up by a semitone, you move to the nearest black to the right.Except, of course, B and E, which move to the next white - C and F respectively. Just another foible of the music system which can, and does, appear non-sensical to a lot of guitarists.  On guitar, you just slide up one fret regardless !
Intervals - start at note one, move up two notes diatonically (as in a scale, maj/min) and you're on the third note. Call this 'a third' and the job's done. Start again at one, move up four and call it a fifth. That means it's the fifth note because it is ! Simple.
There are other points you make, but that'll do for now. Hope it helps !
Answer: Here's another way of looking at it, which has nothing to do with the historical development.
Suppose you had an instrument that was similar to a piano, but had no black keys. (So each of the 12 pitches that make up an octave had its own white key.) It would be more "elegant " mathematically, but (a) it would take up a ridiculous amount of space and (b) you wouldn't be able to tell which note was which (unless you wrote a special symbol on each key).
To address the first of these problems, you could have a piano in which white keys and black keys alternate. Then the piano would take up half as much space, and still be "elegant" mathematically. But you would still face the second problem.
The construction of the piano may seem a bit arbitrary, but at least you can easily tell which note is which. In fact, the very source of the mathematical "ugliness" --- the lack of complete symmetry --- is what makes it easy to identify the notes.
Comment: I'm not really looking for instrument-specific reasons, as you can see in my question, but for music-theory only. Your 2nd point is also not valid for a majority of stringed instruments, that don;t have any markers, sometimes not even frets
Answer: Only answering #3: You don't read the accidentals to figure out the key, you count them.  And yes, it involves the Circle of Fourths and Fifths.  You will learn, if you haven't already, that each note in the scale has an inverse: 4th up = 5th down, 6th down = 3rd up, and so forth.  Each key can be thought of in the abstract as a major or minor key.  Example: A minor and C have the same key signature, as do E minor and G.
Answer: In relation to your source of irritation about everything being in C, when I go shopping for music theory books, I specifically look for those that give examples in other keys.
Yes, many times laying out things in C makes it easier to explain, yet it's not the only key in the world.  I've seen some books that will choose a different key because it makes a given instrument sound better (e.g., guitar.)  Other times I've seen books that will show examples in C for sure and least 2 more keys, 1 with sharps and another with flats.
Answer: You don't actually have to guess the key or memorize all 30. 99 times out of a hundred the key is the last note.  (But that could also pose a problem because A major and A minor both end on an A)
I play flute, keyboard, mandolin and trumpet, and overall my favorite key is E minor (F♯ minor for trumpet because trumpets do not play in concert pitch). I find B minor / D major is easiest for piano because it fits well with the particular size and shape of my hands.
C major is definitely easiest for flute because it simply lifting each finger up.
G major is easiest for mandolin because the 3 most common chords (G, C, and D) are alll easy for mandolin.
I don't have as much experience with the trumpet (because it confuses my ears) but my favourite scale is F major (concert E♭) because it doesn't use the third finger.
I really don't have a preference for keys while singing, since depending on the song, the range is different, but with most songs with male vocalsists since I have a rather large vocal range, G1-B4 for so called "chest voice" I can either sing the lower octave or the actual octave.
But it seems most instruments are based on a C major scale, so I presume the reason a lot of music is in C major is because of this.


Show conditional independance

Question: As part of my excercise i have to show that X and Y are conditionally independent under the condition $(\lfloor X\rfloor,\lfloor Y\rfloor)$
where $X,Y \sim exp(\lambda)$
I previously computed $E[X|\lfloor X\rfloor]$ and I know that I have to show that $f(X,Y|\sim)=f(X|\sim)f(Y|\sim)$ ... but how?
Comment: Conditionally on... what?
Comment: Oh, it was a typo - I fixed it
Answer: This requires $X$ and $Y$ to be independently distributed.
$\begin{align}
\because f_{X,Y}(x,y) & = f_X(x)\;f_Y(y)
\\[3ex]
f_X(x\mid \lfloor X\rfloor)
 &= \frac{
f_X(x)
 \operatorname{\bf 1}_{[\lfloor X\rfloor,\lceil X\rceil)}(x)
}{\displaystyle
\int_{\lfloor X\rfloor}^{\lceil X\rceil} f_X(s)\operatorname d s
}
\\[3ex]
\therefore f_{X,Y}(x,y\mid \lfloor X\rfloor, \lfloor Y\rfloor)
 & = \frac{
f_{X,Y}(x,y)
\operatorname{\bf 1}_{[\lfloor X\rfloor, \lceil X\rceil)}(x)
\operatorname{\bf 1}_{[\lfloor Y\rfloor, \lceil Y\rceil)}(y)
}{\displaystyle
\int_{\lfloor X\rfloor}^{\lceil X\rceil}
\int_{\lfloor Y\rfloor}^{\lceil Y\rceil}
 f_{X,Y}(s,t) \operatorname d t\operatorname d s
}
\\[2ex]
 & = \frac{
f_{X}(x)\;f_{Y}(y)
\operatorname{\bf 1}_{[\lfloor X\rfloor, \lceil X\rceil)}(x)
\operatorname{\bf 1}_{[\lfloor Y\rfloor, \lceil Y\rceil)}(y)
}{\displaystyle
\int_{\lfloor X\rfloor}^{\lceil X\rceil}
 f_{X}(s) \operatorname d s
\int_{\lfloor Y\rfloor}^{\lceil Y\rceil}
 f_{Y}(t) \operatorname d t
}
\\[2ex]
 & = f_X(x\mid \lfloor X\rfloor)
 \;f_Y(y\mid \lfloor Y\rfloor)
\\[1ex]
 & = f_X(x\mid \lfloor X\rfloor, \lfloor Y\rfloor)
\;f_Y(y\mid \lfloor X\rfloor, \lfloor Y\rfloor)
 & \text{(Why?)}
\end{align}$

Show conditional independance


Server File Download

Question: I am running a Ubuntu virtual machine on Azure and on my landing page I wish to allow downloading a file I already uploaded to the server. For this reason I made a hyperlink in my index.html file using href tags, although aside from this I would like to navigate to it as well and as it turns out I am unable to accomplish either method. Specifically I obtain 404 Not Found in my browser after inputing my private IP address xx.xxx.xxx.xx followed by '/' and while trying out different paths to my file (located to /home/username/file.ext). Would anyone be more knowledgeable about whether or not files must be shared through enabling a setting as I do not wish to utilize alternative options such as Azure Files and SharePoint unless I need to.
Answer: For a file to be accessible for download over http/https it must be stored in location on the file system that has been designated as publicly accessible by the server administrator.
Your personal home directory /home/username/ is neither  publicly accessible and should never be made so by an administrator.
Either place your file in (a sub directory of) the default DocumentRoot of the web server (often that will be /var/www/html) or whatever other location your website uses.
When you have many users that you want to allow a personal website and download area, you can for example enable and use Apache's Userdir . By convention that designates every /home/<login>/public_html/ sub directory (although you can adjust to the public_html subdirectory name) as publicly accessible and the content there will become available over http[s]://www.example.com/~login/
When the file has been stored in the correct location on your system and the download still fails, check the web server (error) logs for the cause. Incorrect file system permissions for example could also still block the download.
Comment: Would a symlink work in the place of my file in the DocumentRoot of the web server? Otherwise I would have to use 'cp' to place it there I believe. What system permissions do you allude to, I would like to learn more on this subject.

Server File Download


how to automatically retrieve selected value

Question: is there a way to automatically retrieve selected value from dropdown or radio to form below? example in the image below, if i select radio button "randy", then the value "randy" automatically fill in the form Nama below

$header1 = array('Name'); // Prepare table header
$query = db_select("homo", "r"); // Select table
$query->fields("r", array("nama")); // Select fields
$result = $query->execute(); // Execute query
$rows = array();
while($data = $result->fetchObject()){ // Looping for filling the table rows
$rows[] = array( // Fill the table rows
  $data->nama,
  );
}
$form['table'] = array (
 '#type' => 'tableselect',
 '#header' => $header1,
 '#options' => $rows,
 '#multiple' => FALSE,
);
$form['f1'] = array(
 '#title' => t('Detail Anggota'),
 '#type' => 'fieldset',
);
$form['f1']['namaa'] = array(
 '#title' => t('Nama'),
 '#type' => 'textfield',
 '#required' => TRUE,
);

Answer: You need to use Form API Ajax. There you can see how to use it, Examples for developers include good ajax forms too.
Just remember, to set value to display, use $form_state['input'], not $form_state['values'].


Como pegar uma informação especifica do ToListAsync

Question: Gostaria de criar um sistema que imprimisse na pagina Index cada Postagem igual a da imagem abaixo

E para isso criei um método que busque as últimas 3 postagens, porém, não sei como imprimir na view, porque quando uso foreach ele cria diversas vezes o front end. Como posso Imprimir esse dados de uma maneira que eu consiga acessar uma posição específica do array que ele me retornou no ToListAsync?
Controller:
using Blog.Data;
using Blog.Models;
using Blog.Services;
using Blog.Services.Exceptions;
using Blog.Services.Exceptions.Exceptions;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using System;
using System.Diagnostics;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Identity;
using System.Security.Claims;
using Blog.Areas.Identity.Data;

namespace Blog.Controllers
{
    public class PostagemsController : Controller
    {
        private readonly PostagemService _postagemService;

        private readonly BlogContext _context;

        private UserManager<BlogUser> _userManager;

        public PostagemsController(PostagemService postagemService, BlogContext context, UserManager<BlogUser> userManager)
        {
            _postagemService = postagemService;
            _context = context;
            _userManager = userManager;

        }

        [Authorize]
        public async Task<IActionResult> Index()
        {

            var list = await _postagemService.FindAllAsync();
            return View(list);
        }

        // GET: Postagems

        [Authorize]
        public IActionResult Create()
        {

            ViewData["AssuntoSelect"] = new SelectList(_context.Assunto, "Id", "Nome");
            ViewData["UserSelect"] = new SelectList(_context.BlogUser, "Id", "Email");

            return View();

        }

        [HttpPost]
        [ValidateAntiForgeryToken]
        public async Task<IActionResult> Create(Postagem Postagem)
        {
            var user = await _userManager.GetUserAsync(User);
            var id = user.Id;

            Postagem.Status = "1";
            Postagem.DataPostagem = DateTime.Now;
            Postagem.Likes = 0;
            Postagem.BlogUserId = id;
            Postagem.Visualizacoes = 0;

            if (!ModelState.IsValid)
            {
                return View();
            }

            await _postagemService.InsertAsync(Postagem);
            return RedirectToAction(nameof(Index));
        }

        public async Task<IActionResult> Delete(int? id)
        {
            if (id == null)
            {
                return RedirectToAction(nameof(Error), new { message = "Id not provided" });
            }

            var obj = await _postagemService.FindByIdAsync(id.Value);
            if (obj == null)
            {
                return RedirectToAction(nameof(Error), new { message = "Id not found" });

            }

            return View(obj);
        }
        [HttpPost]
        [AutoValidateAntiforgeryToken]
        public async Task<IActionResult> Delete(int id)
        {
            try
            {
                await _postagemService.RemoveAsync(id);
                return RedirectToAction(nameof(Index));
            }
            catch (IntegrityException e)
            {
                return RedirectToAction(nameof(Error), new { message = e.Message });
            }
        }

        public async Task<IActionResult> Details(int? id)
        {
            if (id == null)
            {
                return RedirectToAction(nameof(Error), new { message = "Id not provided" });
            }

            var obj = await _postagemService.FindByIdAsync(id.Value);
            if (obj == null)
            {
                return RedirectToAction(nameof(Error), new { message = "Id not found" });

            }

            return View(obj);

        }

        public async Task<IActionResult> Edit(int? id)
        {
            if (id == null)
            {
                return RedirectToAction(nameof(Error), new { message = "Id not provided" });
            }

            var obj = await _postagemService.FindByIdAsync(id.Value);
            if (obj == null)
            {
                return RedirectToAction(nameof(Error), new { message = "Id not found" });
            }

            return View();
        }

        [HttpPost]
        [AutoValidateAntiforgeryToken]
        public async Task<IActionResult> Edit(int id, Postagem Postagem)
        {
            if (!ModelState.IsValid)
            {
                return View();
            }
            if (id != Postagem.Id)
            {
                return RedirectToAction(nameof(Error), new { message = "Id mismatch" });
            }
            try
            {
                await _postagemService.UpdateAsync(Postagem);
                return RedirectToAction(nameof(Index));
            }
            catch (NotFoundException e)
            {
                return RedirectToAction(nameof(Error), new { message = e.Message });
            }
            catch (DbConcurrencyException e)
            {
                return RedirectToAction(nameof(Error), new { message = e.Message });
            }
        }

        public IActionResult Error(string message)
        {
            var viewModel = new ErrorViewModel
            {

                RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier
            };
            return View();

        }

        /*
        public IActionResult Create()
        {
            ViewData["PostagemId"] = new SelectList(_context.Postagem, "Id", "Nome");
            ViewData["PostagemId1"] = new SelectList(_context1.BlogUser,"Id","Email");
            return View();
        }
        */

    }
}

Services

using Blog.Data;
using Blog.Models;
using Blog.Services.Exceptions;
using Blog.Services.Exceptions.Exceptions;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Newtonsoft;
using Microsoft.AspNetCore.Identity;
using System.Security.Claims;

namespace Blog.Services
{
    public class PostagemService
    {

        private readonly BlogContext _context;

        public PostagemService(BlogContext context)
        {
            _context = context;

        }

        public async Task<List<Postagem>> FindAllAsync()
        {
            return  await _context.Postagem.Include(obj => obj.Assunto).ToListAsync();
        }

        public async Task InsertAsync(Postagem obj)
        {

            _context.Add(obj);
            await _context.SaveChangesAsync();
        }

        public async Task<Postagem> FindByIdAsync(int id)
        {
            return await _context.Postagem.Include(obj => obj.Assunto).FirstOrDefaultAsync(obj => obj.Id == id);
        }

        public async Task RemoveAsync(int id)
        {
            try
            {
                var obj = await _context.Postagem.FindAsync(id);
                _context.Postagem.Remove(obj);
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException e)
            {
                throw new IntegrityException(e.Message);
            }
        }

        public async Task UpdateAsync(Postagem obj)
        {
            bool hasAny = await _context.Postagem.AnyAsync(x => x.Id == obj.Id);
            if (!hasAny)
            {
                throw new NotFoundException("Id not Found");
            }

            try
            {
                _context.Update(obj);
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException e)
            {
                throw new DbConcurrencyException(e.Message);
            }
        }

        public async Task<List<Postagem>> EncontrarUltimas3()
        {
            var result = _context.Postagem.Include(obj => obj.Assunto).OrderByDescending(obj => obj.DataPostagem).Take(3).ToListAsync();
            return await result;
        }

        //var result = _context.Postagem.Where(p => p.Status == "2").Include(obj => obj.Assunto).ToListAsync();
        //return await result;
        //return  await _context.Postagem.Include(obj => obj.Assunto).Where(p => p.Status == "1").OrderBy(p => p.DataPostagem).Take(4).ToListAsync();

    }
}

Model:
using Blog.Areas.Identity.Data;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Identity;

namespace Blog.Models
{
    public class Postagem
    {

        //Atributos

        public int Id { get; set; }

        [DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}")]
        [DataType(DataType.Date)]
        public DateTime DataPostagem { get; set; }

        [DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}")]
        [DataType(DataType.Date)]
        public DateTime DataAtualizacao { get; set; }

        [Required(ErrorMessage = "{0} required")]
        public string Titulo { get; set; }

        public string Descricao { get; set; }

        [Required(ErrorMessage = "{0} required")]
        [DataType(DataType.Text)]
        public string Texto { get; set; }

        public string Status { get; set; }

        public int Likes { get; set; }
        public int Visualizacoes { get; set; }
        public string ImagemInicial { get; set; }

        //Chaves Estrangeiras
        public Assunto Assunto { get; set; }
        public BlogUser BlogUser { get; set; }
        public int AssuntoId { get; set; }
        public string BlogUserId { get; set; }

        public ICollection<Comentario> Comentarios { get; set; } = new List<Comentario>();

        public Postagem()
        {

        }

        public Postagem(int id, DateTime dataPostagem, DateTime dataAtualizacao, string titulo, string descricao, string texto, string status, Assunto assunto, BlogUser blogUser)
        {

            Id = id;
            DataPostagem = dataPostagem;
            DataAtualizacao = dataAtualizacao;
            Titulo = titulo;
            Descricao = descricao;
            Texto = texto;
            Status = status;
            Assunto = assunto;
            BlogUser = blogUser;

        }

    }
}

Caso tenha alguma outra maneira de fazer, por favor, deixe sua sugestão.
Answer: Consegui resolver.
Para isso eu criei uma ViewModel Para Armazenar cada coleção que eu estava passando, no controller eu criei um objeto para armazenar o resultado de cada consulta e depois na view do referenciei a minha ViewModel. O código de tudo ficou assim:
View Model:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Blog.Models;

namespace Blog.ViewModel
{
    public class ExibirPostagemsViewModel
    {

        public IEnumerable<Postagem> CollectionA { get; set; }
        public IEnumerable<Postagem> CollectionB { get; set; }
        public IEnumerable<Postagem> CollectionC { get; set; }
    }
}

Controller:
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Blog.Models;
using Blog.Services;
using Blog.ViewModel;

namespace Blog.Controllers
{
    public class HomeController : Controller
    {
        private readonly ILogger<HomeController> _logger;

        private readonly PostagemService _postagemService;

        public HomeController(ILogger<HomeController> logger, PostagemService postagemService)
        {
            _postagemService = postagemService;
            _logger = logger;
        }

        public async Task<IActionResult> Index()
        {
            var model = new ExibirPostagemsViewModel()
            {

                CollectionA = await _postagemService.EncontrarPrimeira(),
            CollectionB = await _postagemService.EncontrarSegunda(),
                CollectionC = await _postagemService.EncontrarTerceira(),
            };

            return View(model);

        }

        public IActionResult Privacy()
        {
            return View();
        }

        [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
        public IActionResult Error()
        {
            return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
        }
    }
}

View:
@model Blog.ViewModel.ExibirPostagemsViewModel
@{

    ViewData["Title"] = "Home Page";

}

            @foreach (var item in Model.CollectionA)
            {

                         item.ImagemInicial)" alt="">

                                Lifestyle

Postea senserit id eos, vivendo periculis ei qui

John Doe

20 April 2018

            }

            @foreach (var item in Model.CollectionB)
            {

                     item.ImagemInicial)" alt="">

                            Lifestyle

Sed ut perspiciatis, unde omnis iste natus error sit

John Doe

20 April 2018

            }

            @foreach (var item in Model.CollectionC)
            {

                     item.ImagemInicial)" alt="">

                            Fashion
                            Lifestyle

Mel ut impetus suscipit tincidunt. Cum id ullum laboramus persequeris.

John Doe

20 April 2018

            }

O que consegui concluir é que caso queira passar mais de um valor para a View, seja ele fixo ou um select do banco, a melhor maneira é criar uma ViewModel para isso.


Does a goal kick have to be specifically be from the edge of the goal area or can it just be anywhere inside the area?

Question: Does a goal kick have to be specifically be from the edge of the goal area, or can it just be anywhere inside the area? I've seen goalies taking them from somewhat inside the area, so I wondered if this was actually how it works.
Answer: A goal kick MUST be taken from within the goal area (note that this is the "six yard box", not the "eighteen yard box", formally called the penalty area).
IFAB Law 16 - The Goal Kick, 1. The Procedure

The ball must be stationary and is kicked from any point within the goal area by a player of the defending team
The ball is in play when it leaves the penalty area
Opponents must be outside the penalty area until the ball is in play

There are further details about what can and cannot happen during or after completing a goal kick in IFAB Law 16 - 2. Infringements and Sanctions.

IFAB Law 1 - The Field of Play, 5. The Goal Area dictates the dimensions of the goal area as:

Two lines are drawn at right angles to the goal line, 5.5 m (6 yds) from the inside of each goalpost. These lines extend into the field of play for 5.5m (6yds) and are joined by a line drawn parallel with the goal line. The area bounded by these lines and the goal line is the goal area.


How to model market share or a fraction of anything that sums to 100%?

Question: Suppose we have sales of 3 products A, B and C which market share always sum up to 100%. How to model market share of product A using market shares of B and C? So that we will know that if share of A grows 1 percentage point then A has to steal that growth in some proportion form products B and C.
A means increase of share = A on Tuesday - A on Monday, and so on with B, C.
<code>A = 0*A + b1*B + c1*C
B = a2*A + 0*B + c2*C
C = a3*A + b3*B + 0*C
b1+c1=-1
a2+c2=-1
a3+b3=-1
</code>
How to estimate it?
Is there any other method how to estimate structure which sums to 100% by the parts of the structure? Regression doesn't work here.
Comment: It seems you've made an edit without being logged in, thus it is showed as an anonymous one. Next time, please check it out before sending -- this way it will be applied right away.
Comment: To alternatives I can think of, 1) estimate a model for the sales of A,B,C and calculate the shares afterward. 2) estimate a model for the shares of A and B and then calculate the shares of C by definition.
Answer: You did not really describe what you mean with model share, i.e. what the purpose of the modelling is, but the hts R package and hierarchical time series provide a way to create forecasts of time series which sum up to 100%, etc. Prof. Hyndman has at least two publications on using them: Hierarchical forecasts for Australian domestic tourism and Optimal combination forecasts for hierarchical time series. Besides documentation of the package I don't know other sources about hierarchical time series than the papers and the references therein.
Comment: The purporse of the model is to give answer how much growth of A is gained from B and how much from C.

A(B,C) = ?

If we estimate model A = a*B + b*C without constant then both parameters a and b equal -1. But empiricaly I know that product A grew from 0% share to 30% share. It "stole" 75% of this 30% share growth from product B and 25% from product C. But I have no idea how to estimate it. The purpose of the model is explanation, not prediction.
Answer: Apart from the hierarchical approach already mentioned, an alternative is to model the three series as compositional time series. See the following papers for recent surveys of the literature.

http://ima.udg.edu/~barcelo/index_archivos/ISI2007_Aguilar.pdf

https://doi.org/10.1007/s11135-009-9229-8
Comment: I have access only to abstract. What is the concept of the compositional and hierarchical approach to time series?
Comment: The additive log-ratio transformation! Good to finally put a name to the thing


math puzzle: 4 digit number times 3

Question: A four-digit number $\overline{abcd}$, and a five-digit number $\overline{efghi}$, where $a,b, c, ..., i$ are from 1-9 and are distinct. We have
$\overline{abcd}*3=\overline{efghi}$.
What are $a, b, ..., i$?
What I have tried: I can deduce that $\overline{efghi}$ must be divisible by 9, but then the enumeration does not give the answer? Can this hold at all?
Answer: By exhaustive search there are two solutions:
$$5823\cdot 3 = 17469$$
$$5832\cdot 3 = 17496$$

math puzzle: 4 digit number times 3


Are min$(X_1,\ldots,X_n)$ and min$(X_1Y_1,\ldots,X_nY_n)$ independent for $n$ to infinity?

Question: Assume that we have given two continuous iid random variables $X$ and $Y$ with support $[1,c)$, where $c$ is some constant greater than one.
Now assume I have a given iid sample $X_1, \ldots,X_n$ and $Y_1, \ldots,Y_n$ (so absolutely no dependence here).
Imagine that I know that:
$$(1): \mathbb P \left(\frac{\min(X_1,\ldots,X_n)-a_n}{b_n}\leq x_1\right) \sim F(x_1), \text{ for }n \to \infty$$
$$(2):\mathbb P \left(\frac{\min(X_1Y_1,\ldots,X_nY_n)-\bar a_n}{\bar b_n}\leq x_2\right) \sim G(x_2), \text{ for }n \to \infty,$$
where $F$ and $G$ are just the limit distributions. Is it true that then it also follows that
$$(3):\mathbb P \left(\frac{\min(X_1,\ldots,X_n)-a_n}{b_n}\leq x_1,\frac{\min(X_1Y_1,\ldots,X_nY_n)-\bar a_n}{\bar b_n}\leq x_2\right) \sim F(x_1) G(x_2),$$
for $n$ to infinity?
At first I thought this cannot work since they are obviously dependent - but then I thought that the probability that $\min(X_1,\ldots,X_n)$ and $\min(X_1Y_1,\ldots, X_nY_n)$ will be obtained in the same realization will converge to zero and since the sample is iid, it is actually true?
So am I right?

edit:
Okay, since noone is answering so far I just explain a little bit my idea why I think it could be true; We have for some $i$:
\begin{align*}
&\mathbb P\big(X_i=\min(X_1,\ldots,X_n), X_iY_i=\min(X_1Y_1,\ldots,X_nY_n)\big) \\ \leq &\mathbb P\big(X_i=\min(X_1,\ldots,X_n), Y_i \leq \min(X_1Y_1,\ldots,X_nY_n)\big) \\
= &\mathbb P\big(X_i=\min(X_1,\ldots,X_n)\big) \mathbb P\big(  Y_i \leq \min(X_1Y_1,\ldots,X_nY_n) \vert X_i=\min(X_1,\ldots,X_n) \big) \\
= &1/n \mathbb P\big(  Y_i \leq \min(X_1Y_1,\ldots,X_nY_n) \vert X_i=\min(X_1,\ldots,X_n) \big)
\end{align*}
where the latter probability converges to zero, since $\min(X_1Y_1,\ldots,X_nY_n)$ gets arbitrarily close to 1 for $n \to \infty$. Therefore, the probability, that the minimum is realized in the same observation is something like $n \cdot 1/n \cdot o(1)=o(1)$, so converges to zero...
Now this is obviously not a rigorous proof but are my thoughts correct?

The answer can be found here:
https://math.stackexchange.com/questions/3403441/are-minx-1-ldots-x-n-and-minx-1y-1-ldots-x-ny-n-independent-for-n-to/3405002#3405002
Sangchul Lee gave me a good idea, doing it with the easist case, the uniform distribution and I could extend it the general case of atom-free random variables
Comment: No, it is not; You can see it as the sequences in Extreme Value Theory; In Extreme Value Theory you have something like $\mathbb P (\frac{\max(X_1,\ldots,X_n)-a_n}{b_n}\leq x)$ which converges to some Extreme Value Distribution, given some weak conditions; With Minima you can do the same; I think in this case, $a_n=1$ and $b_n$ goes to zero, as $n$ goes to infinity
Comment: What are $a_n$ and $b_n$? Is it enough to focus on the case $a_n=0$, $b_n=1$?
Answer: Just a quick thought of mine:
The condition that the product $X_i Y_i$ is smaller than $X_2$ removes all possibilities of $X_i$ being larger than $(X2_/b_n)+a_n$.
EDIT:
Yes you understood me correctly! Imagine the conditional probability of both (the product and Xi alone) being small enough: P(Xi|XiYi)! Given the product XiYi is small enough, since Yi must be larger than 1, there is no possibility of of Xi being larger than (x2/bn)+an. This means the conditional probability P(Xi|Xi*Yi) is always 1, if x1 is big enough. Meaning your combined probability equals G(x2), although F(x1) can still be smaller than 1.
Comment: So I think I got your idea; (I am still not sure if this is really what you want to say); If $\frac{\land XY-\bar a_n}{\bar b_n}\leq x_2$, then it holds that $\land XY\leq x_2 \bar b_n+\bar a_n$ and therefore in particular it holds that: $\land X\leq x_2 \bar b_n+\bar a_n$; So if $x_2 \bar b_n+\bar a_n \leq x_1  b_n+a_n$, then $\frac{\land XY-\bar a_n}{\bar b_n}\leq x_2$ already implies $\frac{\land X- a_n}{ b_n}\leq x_1$;
Comment: Also check the same question on math.stackexchange: https://math.stackexchange.com/questions/3403441/are-minx-1-ldots-x-n-and-minx-1y-1-ldots-x-ny-n-independent-for-n-to I added a bunch of explanations :-)
Comment: This, however, would not work if $x_2$ and $x_1$ are fixed, as $a_n=1$ and $b_n$ goes to zero and the same holds for $\bar a_n$ and $\bar b_n$; However, even if $x_1$ is infinity I don't quite think your arguments are working; Because then the probability $\mathbb P(\frac{\land X- a_n}{ b_n}\leq x_1)=1$ and then you still have equality; And even if $a_n$ and $b_n$ are defined differently, it would not work because then $\frac{\land XY-\bar a_n}{\bar b_n}$ respectively $\frac{\land X- a_n}{ b_n}$ just  converge a.s. to some number; But I still gave you a thumbs up, maybe I dont get your point..
Comment: I made an edit. I hope I understood you correctly!
Comment: I still do not understand you; In particular, I have no idea what $P(X_i | vert X_i Y_i)$ supposed to mean; But let's go a step back; I was wondering if (1) and (2) holds, that then also (3) must hold; What I did later was just an intuition why it should be correct; So right now only the equations (1), (2) and (3) matter; As I already said: $\frac{\land XY-\bar a_n}{\bar b_n}\leq x_2$ implies  $\frac{\land X- a_n}{ b_n}\leq x_1$ if $x_2 \bar b_n+ \bar a_n \leq x_1 b_n + a_n$; Do we agree on this? But this is equivalent to $x_1\geq (x_2 \bar b_n + \bar a_n- a_n)/b_n$
Comment: Now let's treat $x_2$ as some arbitrary constant and we want to show that the right term does not go to infinity which you did not prove, unfortunately; If the right term would indeed not go to infinity, you are correct.. BTW: If anyone wants to contribute to the topic, I am extremely thankful for anny remark, comment, counter example, idea for a proof etc.
Comment: Just another thought: Even if your hypothesis of uncoupled indices wasn't right, there is another thought that goes in the same direction: Given n=infinite, both probabilities for (1) and (2) will approach 0% or 100%. This means your answer will always approach truth.
Comment: Just the coupling aspect goes beyond me. I don't think it matters whether the indices of term (2) and term (1) are identical. If it is given that the product XY can be lower than a certain value and you defined certain limits for Y, then you can calculate the limits of the 1 coupled X. Basically with your logic you have to assume Y = 1 and you can directly calculate the value of coupled X. Now, imo it doesn't matter if min(Xn) = coupled X because you can show there are constellations of term (1) variables that force term (1) to be true, given there is the coupled X value. Min(Xn) <=X(coupled)
Comment: So yes, the indices might not be coupled, but the probability of term (1) being true is coupled to the probability of term (2) being true. (at least in some special cases)
Comment: I recommend you read a bit about Extreme Value Theory: If $n \to \infty$, (1) will not just go to 0 or 1 - then it would not make any sense; You probably know the Central limit theorem, right? $\frac{S_n-n\mu}{\sqrt{n}\sigma}$ converges to a normal distribution, where $S_n$ is the sum of iid r.v. with expectation $\mu$ and standard dev. $\sigma$ given some weak condition; In Extreme Value Theory, you have something similar: $\frac{\vee x-a_n}{b_n}$ approaches on of the three Extreme Value Distributions, where $\vee$ is the maximum; For the minimum, you can do something similar;
Comment: Are a, b and small x constant throughout the infinite series? And big X is a random number? This means you have a certain probability per X to result in a true statement. This probability is either 0 or greater 0. In case it's greater 0, this is just a binomial distribution with n draws. And if it's 0, it stays 0.
Comment: I will read though your recommendations! Thanks! Btw: If your variables are not constant, then Xi and Yi would need to be coupled in order for (2) to influence the probability of (1). So your hypothesis is true.
Comment: You can use $\LaTeX$ formatting on this site, I started, please complete. You can have a look at https://math.meta.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference
Comment: Thanks, I wondered how people are doing this. I will study this tutorial, edit this thread and from now on use Latex.


Can model comparison be performed on a single dummy variable of a 3-level categorical predictor?

Question: Let's say I have some observations, Y, that I want to regress using a model containing two predictors, X and W. If I'm interested in whether adding X to the model improves it, according to some criterion, I can simply perform a nested model comparison:
full: Y ~ 1 + X + W
nested: Y ~ 1 + W
In my case, X is a categorical variable with 3 levels. Let's call those levels a, b, and c. This means that underlyingly, X is represented by two 'dummy' variables: X1, X2.
I am specifically interested in whether the difference between a on one hand, and b,c on the other, explains some of the variance in the data. My question is: Does the following make sense?

I use a Helmert coding scheme to recode X, like so: X1(a) = 2/3, X1(b) = X1(c) = -1/3. And X2(a) = 0, X2(b) = 1/2, X2(c) = -1/2. My understanding is that X1 now codes for the contrast between a and b,c.
I compare the following two nested models:

full: Y ~ 1 + X1 + X2 + W
nested: Y ~ 1 + X2 + W
I couldn't really find anything in the literature that directly addresses this question. If the above is not a licit move, what would be a good way of answering the specific question about the contrast between a versus b,c? Is the only answer to do the model comparison using X as a whole, then perform some sort of post-hoc test, provided X's contribution is significant?
Thank you!
Answer: If each observation in your data-set only belongs to one level of the categorical variable X, then to me it doesn't make sense to break it down like you have described. You have a few options. You can fit the model, and then run post-hoc comparisons, or, if you are interested in knowing if a is different from b and/or c, you can make a the reference level. Then a standard regression output will tell you if either (or both) b and c are different from a.
If what you really want to know is if observations in category a are different from those that are not a, you can also re-code it as a binary variable grouping b and c together.
Comment: Thanks for the answer!
I'm interested in knowing whether *a* is different from both *b* and *c*. I thought about coding it as a binary variable, but I wanted a way to test whether the difference along *X* is above and beyond any potential difference between *b* and *c*.
Re: standard regression, this is what I initially tried to do, but because I have other predictors (*W*), I wanted to use model comparison to avoid any issues of credit assignment...


Clearing cache takes "long time"

Question: I am absolutely new in Drupal. I am trying to set up my first "Hello world" module and I am playing with it.
Every time I clear cache using Drupal Console, it takes 15 seconds, which is an eternity for me.
Is this normal, or did I need to change setting?
This is the output of drupal site:status.
 Drupal                         8.3.2
 Access to update.php           Protected
 Configuration files            Protected
 Cron maintenance tasks         Last run 41 minutes 54 seconds ago
 Database system                MySQL, MariaDB, Percona Server, or equivalent
 Database system version        5.5.5-10.1.21-MariaDB
 Database updates               Up to date
 Drupal core update status      Not secure! (version 8.7.0 available)
 Entity/field definitions       Up to date
 File system                    Writable (public download method)
 GD library                     bundled (2.1.0 compatible)
 GD library PNG support         bundled (2.1.0 compatible)
 Image toolkit                  gd

 Module and theme update status Out of date

 Node Access Permissions        Disabled
 PHP                            7.1.1 (more information)
 PHP extensions                 Enabled
 PHP memory limit               128M
 PHP OPcode caching             Enabled
 Random number generation       Successful
 Search index progress          100% (0 remaining)

 Trusted Host Settings          Not enabled
 Unicode library                PHP Mbstring Extension
 Update notifications           Enabled
 Upload progress                Not enabled

Web server
 Hash salt                      6X0M4mm-6Ui1Sgovc-emqgqvm2nJ1Ug-fYQYnJfxPniHHwdYMMcBHRBt1xwRtGMRRg7XbK1G3A
 Drupal Console                 1.8.0

 Database connection
 Driver              mysql
 Host                localhost
 Database connection dru
 Port                3306
 Username            root
 Connection          mysql//root:@localhost:3306/dru

 Themes
 commands.site.status.messages.theme_default bartik
 commands.site.status.messages.theme_admin   seven

 Directories
 Site root directory      C:\xampp\htdocs\dru
 Site temporary directory C:\xampp\tmp
 Default theme directory  /core/themes/bartik
 Admin theme directory    /core/themes/seven

Answer: Yes, WAMP is not a good environment for Drupal 8. Use a different OS in a virtual machine. Either a Linux VM built from scratch or by a tool like Drupal VM, or a docker based tool like DDEV, Docksal, and Lando.
Which one to choose would be opinion based. Consider not only performance, but also that debugging is most effective, when the dev environment is as close to production as possible.
Comment: Thank you for reply. You know, it is very very frustrating, that the basic Drupal site is loading so slowly in local environment, administration is slow and even such simple instruction like clear cache is slow.
I am trying to learn Drupal, so I will debug frequently, doing mistakes on purpose and so on.. That's why any quick tool would be very handy...
Comment: Lando is the best I've tried, well to be honest I haven't tried all the other ones listed here, but I can't imagine any of them beating Lando in terms of setup easiness.

Clearing cache takes "long time"


Narrow Results of search

Question: Started the thread over here have successfully filter but need to narrow down
Line Stream Reader
I have log files that contain the following info
2014/11/03 00:00:00 PID:11484   UUID:231d09e2-56d9-43c1-8170-e45d43b56e4a   Start   E:/I3/IC/Logs/2014-11-03/ip.ininlog
2014/11/03 06:02:11 PID:11484   UUID:231d09e2-56d9-43c1-8170-e45d43b56e4a   End E:/I3/IC/Logs/2014-11-03/ip.ininlog
2014/11/03 06:02:11 PID:11484   UUID:fe49e587-6b40-446c-9b06-d16bae28683e   Start   E:/I3/IC/Logs/2014-11-03/ip_1.ininlog
2014/11/03 06:20:13 PID:11484   UUID:fe49e587-6b40-446c-9b06-d16bae28683e   End E:/I3/IC/Logs/2014-11-03/ip_1.ininlog
2014/11/03 06:20:13 PID:11484   UUID:3ec28198-f79e-4d36-90f9-5004ebe2ab91   Start   E:/I3/IC/Logs/2014-11-03/ip_2.ininlog
2014/11/03 06:35:29 PID:11484   UUID:3ec28198-f79e-4d36-90f9-5004ebe2ab91   End E:/I3/IC/Logs/2014-11-03/ip_2.ininlog
2014/11/03 06:35:29 PID:11484   UUID:ede8160a-d639-450c-8ccf-7f2c2a6c7823   Start   E:/I3/IC/Logs/2014-11-03/ip_3.ininlog
2014/11/03 06:49:41 PID:11484   UUID:ede8160a-d639-450c-8ccf-7f2c2a6c7823   End E:/I3/IC/Logs/2014-11-03/ip_3.ininlog
2014/11/03 06:49:41 PID:11484   UUID:c53a53e1-c81c-4d5b-8256-7d6ba2d886ff   Start   E:/I3/IC/Logs/2014-11-03/ip_4.ininlog
2014/11/03 07:03:20 PID:11484   UUID:c53a53e1-c81c-4d5b-8256-7d6ba2d886ff   End E:/I3/IC/Logs/2014-11-03/ip_4.ininlog
2014/11/03 07:03:20 PID:11484   UUID:be34b82a-a57f-4607-a638-b4f3dfca5617   Start   E:/I3/IC/Logs/2014-11-03/ip_5.ininlog
2014/11/03 07:16:15 PID:11484   UUID:be34b82a-a57f-4607-a638-b4f3dfca5617   End E:/I3/IC/Logs/2014-11-03/ip_5.ininlog
2014/11/03 07:16:15 PID:11484   UUID:7895acc1-29dc-4412-b1b8-34642d4a8752   Start   E:/I3/IC/Logs/2014-11-03/ip_6.ininlog
2014/11/03 07:28:07 PID:11484   UUID:7895acc1-29dc-4412-b1b8-34642d4a8752   End E:/I3/IC/Logs/2014-11-03/ip_6.ininlog
2014/11/03 07:28:07 PID:11484   UUID:72f09dc3-3e6e-44ce-a419-32679566bbb2   Start   E:/I3/IC/Logs/2014-11-03/ip_7.ininlog
2014/11/03 07:40:33 PID:11484   UUID:72f09dc3-3e6e-44ce-a419-32679566bbb2   End E:/I3/IC/Logs/2014-11-03/ip_7.ininlog
2014/11/03 07:40:33 PID:11484   UUID:29c1ec2e-7ab1-4d48-baf4-7b8ff8e2f04a   Start   E:/I3/IC/Logs/2014-11-03/ip_8.ininlog
2014/11/03 07:53:03 PID:11484   UUID:29c1ec2e-7ab1-4d48-baf4-7b8ff8e2f04a   End E:/I3/IC/Logs/2014-11-03/ip_8.ininlog
2014/11/03 07:53:03 PID:11484   UUID:aee440b6-05d5-426f-b7ba-cb17953d1331   Start   E:/I3/IC/Logs/2014-11-03/ip_9.ininlog
2014/11/03 08:04:20 PID:11484   UUID:aee440b6-05d5-426f-b7ba-cb17953d1331   End E:/I3/IC/Logs/2014-11-03/ip_9.ininlog
2014/11/03 08:04:20 PID:11484   UUID:b8bbcd9e-9033-4271-9b2e-e43a3c528772   Start   E:/I3/IC/Logs/2014-11-03/ip_10.ininlog
2014/11/03 08:15:09 PID:11484   UUID:b8bbcd9e-9033-4271-9b2e-e43a3c528772   End E:/I3/IC/Logs/2014-11-03/ip_10.ininlog
2014/11/03 08:15:09 PID:11484   UUID:fb8b70de-1725-47e0-9757-8a6ade8355a1   Start   E:/I3/IC/Logs/2014-11-03/ip_11.ininlog
2014/11/03 08:25:17 PID:11484   UUID:fb8b70de-1725-47e0-9757-8a6ade8355a1   End E:/I3/IC/Logs/2014-11-03/ip_11.ininlog
2014/11/03 08:25:17 PID:11484   UUID:0c5fec25-6b71-4240-8e7c-9333ecce9a3e   Start   E:/I3/IC/Logs/2014-11-03/ip_12.ininlog
2014/11/03 08:35:01 PID:11484   UUID:0c5fec25-6b71-4240-8e7c-9333ecce9a3e   End E:/I3/IC/Logs/2014-11-03/ip_12.ininlog
2014/11/03 08:35:01 PID:11484   UUID:68c1e9c9-1797-4b38-be41-d7675b847e0b   Start   E:/I3/IC/Logs/2014-11-03/ip_13.ininlog
2014/11/03 08:45:37 PID:11484   UUID:68c1e9c9-1797-4b38-be41-d7675b847e0b   End E:/I3/IC/Logs/2014-11-03/ip_13.ininlog
2014/11/03 08:45:37 PID:11484   UUID:883bf2bd-9731-4709-9c39-5b40f518a1d5   Start   E:/I3/IC/Logs/2014-11-03/ip_14.ininlog
2014/11/03 08:54:09 PID:11484   UUID:883bf2bd-9731-4709-9c39-5b40f518a1d5   End E:/I3/IC/Logs/2014-11-03/ip_14.ininlog
2014/11/03 08:54:09 PID:11484   UUID:9b925501-e0c0-469c-9336-59d742e80c6b   Start   E:/I3/IC/Logs/2014-11-03/ip_15.ininlog
2014/11/03 09:04:32 PID:11484   UUID:9b925501-e0c0-469c-9336-59d742e80c6b   End E:/I3/IC/Logs/2014-11-03/ip_15.ininlog
2014/11/03 09:04:32 PID:11484   UUID:a5e850d0-5989-4ad4-bd97-c47cdca444b7   Start   E:/I3/IC/Logs/2014-11-03/ip_16.ininlog
2014/11/03 09:15:00 PID:11484   UUID:a5e850d0-5989-4ad4-bd97-c47cdca444b7   End E:/I3/IC/Logs/2014-11-03/ip_16.ininlog
2014/11/03 09:15:00 PID:11484   UUID:fde960e3-1bda-469a-9c4d-fc1921d0e57e   Start   E:/I3/IC/Logs/2014-11-03/ip_17.ininlog
2014/11/03 09:25:28 PID:11484   UUID:fde960e3-1bda-469a-9c4d-fc1921d0e57e   End E:/I3/IC/Logs/2014-11-03/ip_17.ininlog
2014/11/03 09:25:28 PID:11484   UUID:eba5a083-13fa-42e3-a16b-c01a6ca0287f   Start   E:/I3/IC/Logs/2014-11-03/ip_18.ininlog
2014/11/03 09:35:57 PID:11484   UUID:eba5a083-13fa-42e3-a16b-c01a6ca0287f   End E:/I3/IC/Logs/2014-11-03/ip_18.ininlog
2014/11/03 09:35:57 PID:11484   UUID:51a5b17b-6b23-4087-a3e6-f1b001ae32b9   Start   E:/I3/IC/Logs/2014-11-03/ip_19.ininlog
2014/11/03 09:45:53 PID:11484   UUID:51a5b17b-6b23-4087-a3e6-f1b001ae32b9   End E:/I3/IC/Logs/2014-11-03/ip_19.ininlog
2014/11/03 09:45:53 PID:11484   UUID:6f0f7bd3-7081-4036-8864-905a118db2b9   Start   E:/I3/IC/Logs/2014-11-03/ip_20.ininlog
2014/11/03 09:55:52 PID:11484   UUID:6f0f7bd3-7081-4036-8864-905a118db2b9   End E:/I3/IC/Logs/2014-11-03/ip_20.ininlog
2014/11/03 09:55:52 PID:11484   UUID:83c5ad5f-b3b5-4167-b8e2-3a75b6162baf   Start   E:/I3/IC/Logs/2014-11-03/ip_21.ininlog
2014/11/03 10:04:50 PID:11484   UUID:83c5ad5f-b3b5-4167-b8e2-3a75b6162baf   End E:/I3/IC/Logs/2014-11-03/ip_21.ininlog
2014/11/03 10:04:50 PID:11484   UUID:58abf277-edb1-48ef-a0d1-ce9a2c53daca   Start   E:/I3/IC/Logs/2014-11-03/ip_22.ininlog
2014/11/03 10:13:46 PID:11484   UUID:58abf277-edb1-48ef-a0d1-ce9a2c53daca   End E:/I3/IC/Logs/2014-11-03/ip_22.ininlog
2014/11/03 10:13:46 PID:11484   UUID:6e9c61db-dd62-453b-bfa8-6d0e23fb428a   Start   E:/I3/IC/Logs/2014-11-03/ip_23.ininlog
2014/11/03 10:23:30 PID:11484   UUID:6e9c61db-dd62-453b-bfa8-6d0e23fb428a   End E:/I3/IC/Logs/2014-11-03/ip_23.ininlog
2014/11/03 10:23:30 PID:11484   UUID:16ea52aa-9f78-46b6-913b-308dbfe1ad4f   Start   E:/I3/IC/Logs/2014-11-03/ip_24.ininlog
2014/11/03 10:33:50 PID:11484   UUID:16ea52aa-9f78-46b6-913b-308dbfe1ad4f   End E:/I3/IC/Logs/2014-11-03/ip_24.ininlog
2014/11/03 10:33:50 PID:11484   UUID:8b7b310c-657a-4665-842e-7fcb40dc8df1   Start   E:/I3/IC/Logs/2014-11-03/ip_25.ininlog
2014/11/03 10:43:55 PID:11484   UUID:8b7b310c-657a-4665-842e-7fcb40dc8df1   End E:/I3/IC/Logs/2014-11-03/ip_25.ininlog
2014/11/03 10:43:55 PID:11484   UUID:4e707790-18ff-4ba8-93d5-d198e978f63f   Start   E:/I3/IC/Logs/2014-11-03/ip_26.ininlog
2014/11/03 10:54:10 PID:11484   UUID:4e707790-18ff-4ba8-93d5-d198e978f63f   End E:/I3/IC/Logs/2014-11-03/ip_26.ininlog
2014/11/03 10:54:10 PID:11484   UUID:176c4bca-84fb-4361-9898-f500edc348bb   Start   E:/I3/IC/Logs/2014-11-03/ip_27.ininlog
2014/11/03 11:05:09 PID:11484   UUID:176c4bca-84fb-4361-9898-f500edc348bb   End E:/I3/IC/Logs/2014-11-03/ip_27.ininlog
2014/11/03 11:05:09 PID:11484   UUID:70afef6a-fcd3-4fac-aaf6-6c419b2bfbba   Start   E:/I3/IC/Logs/2014-11-03/ip_28.ininlog
2014/11/03 11:14:38 PID:11484   UUID:70afef6a-fcd3-4fac-aaf6-6c419b2bfbba   End E:/I3/IC/Logs/2014-11-03/ip_28.ininlog
2014/11/03 11:14:38 PID:11484   UUID:09c4b5ec-c88a-4687-a0c5-84b6bbd402cd   Start   E:/I3/IC/Logs/2014-11-03/ip_29.ininlog
2014/11/03 11:24:06 PID:11484   UUID:09c4b5ec-c88a-4687-a0c5-84b6bbd402cd   End E:/I3/IC/Logs/2014-11-03/ip_29.ininlog
2014/11/03 11:24:06 PID:11484   UUID:bca881be-4310-447e-89d1-21af0d1c528a   Start   E:/I3/IC/Logs/2014-11-03/ip_30.ininlog
2014/11/03 11:34:22 PID:11484   UUID:bca881be-4310-447e-89d1-21af0d1c528a   End E:/I3/IC/Logs/2014-11-03/ip_30.ininlog
2014/11/03 11:34:22 PID:11484   UUID:424c6ca2-6ede-468a-868a-4372c4b0556c   Start   E:/I3/IC/Logs/2014-11-03/ip_31.ininlog
2014/11/03 11:45:01 PID:11484   UUID:424c6ca2-6ede-468a-868a-4372c4b0556c   End E:/I3/IC/Logs/2014-11-03/ip_31.ininlog
2014/11/03 11:45:01 PID:11484   UUID:b5458703-74e4-41d9-ab21-2cbc8576389f   Start   E:/I3/IC/Logs/2014-11-03/ip_32.ininlog
2014/11/03 11:56:15 PID:11484   UUID:b5458703-74e4-41d9-ab21-2cbc8576389f   End E:/I3/IC/Logs/2014-11-03/ip_32.ininlog
2014/11/03 11:56:15 PID:11484   UUID:337458a2-85a2-47c7-a101-73ac489ed3bf   Start   E:/I3/IC/Logs/2014-11-03/ip_33.ininlog
2014/11/03 12:06:44 PID:11484   UUID:337458a2-85a2-47c7-a101-73ac489ed3bf   End E:/I3/IC/Logs/2014-11-03/ip_33.ininlog
2014/11/03 12:06:44 PID:11484   UUID:8a1aef00-f1e3-4060-b24c-35ef77e905bf   Start   E:/I3/IC/Logs/2014-11-03/ip_34.ininlog
2014/11/03 12:17:26 PID:11484   UUID:8a1aef00-f1e3-4060-b24c-35ef77e905bf   End E:/I3/IC/Logs/2014-11-03/ip_34.ininlog
2014/11/03 12:17:26 PID:11484   UUID:dde16219-46bb-4d6a-8387-ef05886cb828   Start   E:/I3/IC/Logs/2014-11-03/ip_35.ininlog
2014/11/03 12:28:30 PID:11484   UUID:dde16219-46bb-4d6a-8387-ef05886cb828   End E:/I3/IC/Logs/2014-11-03/ip_35.ininlog
2014/11/03 12:28:30 PID:11484   UUID:82c1e793-a963-4e56-ab00-ccb75b90e68c   Start   E:/I3/IC/Logs/2014-11-03/ip_36.ininlog
2014/11/03 12:39:35 PID:11484   UUID:82c1e793-a963-4e56-ab00-ccb75b90e68c   End E:/I3/IC/Logs/2014-11-03/ip_36.ininlog
2014/11/03 12:39:35 PID:11484   UUID:2adce285-9689-43b1-835a-a7402a4e8f89   Start   E:/I3/IC/Logs/2014-11-03/ip_37.ininlog
2014/11/03 12:51:09 PID:11484   UUID:2adce285-9689-43b1-835a-a7402a4e8f89   End E:/I3/IC/Logs/2014-11-03/ip_37.ininlog
2014/11/03 12:51:09 PID:11484   UUID:7ea39118-a311-44b2-a895-7388dfaeb1fd   Start   E:/I3/IC/Logs/2014-11-03/ip_38.ininlog
2014/11/03 13:03:19 PID:11484   UUID:7ea39118-a311-44b2-a895-7388dfaeb1fd   End E:/I3/IC/Logs/2014-11-03/ip_38.ininlog
2014/11/03 13:03:19 PID:11484   UUID:7be575bb-4322-4416-b1ae-f464938cf6ce   Start   E:/I3/IC/Logs/2014-11-03/ip_39.ininlog
2014/11/03 13:15:30 PID:11484   UUID:7be575bb-4322-4416-b1ae-f464938cf6ce   End E:/I3/IC/Logs/2014-11-03/ip_39.ininlog
2014/11/03 13:15:30 PID:11484   UUID:6799a8a8-de76-4832-8fad-a829354c8a4a   Start   E:/I3/IC/Logs/2014-11-03/ip_40.ininlog
2014/11/03 13:27:41 PID:11484   UUID:6799a8a8-de76-4832-8fad-a829354c8a4a   End E:/I3/IC/Logs/2014-11-03/ip_40.ininlog
2014/11/03 13:27:41 PID:11484   UUID:f0945238-5ed6-4e1f-9990-8f61ad81bc15   Start   E:/I3/IC/Logs/2014-11-03/ip_41.ininlog
2014/11/03 13:39:56 PID:11484   UUID:f0945238-5ed6-4e1f-9990-8f61ad81bc15   End E:/I3/IC/Logs/2014-11-03/ip_41.ininlog
2014/11/03 13:39:56 PID:11484   UUID:02eef369-6d38-4d28-b2e1-666adebea9a3   Start   E:/I3/IC/Logs/2014-11-03/ip_42.ininlog
2014/11/03 13:53:05 PID:11484   UUID:02eef369-6d38-4d28-b2e1-666adebea9a3   End E:/I3/IC/Logs/2014-11-03/ip_42.ininlog
2014/11/03 13:53:05 PID:11484   UUID:3a1df262-d892-4ede-8152-07403c5b1ae1   Start   E:/I3/IC/Logs/2014-11-03/ip_43.ininlog
2014/11/03 14:06:32 PID:11484   UUID:3a1df262-d892-4ede-8152-07403c5b1ae1   End E:/I3/IC/Logs/2014-11-03/ip_43.ininlog
2014/11/03 14:06:32 PID:11484   UUID:59aa8395-d6fd-4210-8b3f-8008a057d2d5   Start   E:/I3/IC/Logs/2014-11-03/ip_44.ininlog
2014/11/03 14:21:19 PID:11484   UUID:59aa8395-d6fd-4210-8b3f-8008a057d2d5   End E:/I3/IC/Logs/2014-11-03/ip_44.ininlog
2014/11/03 14:21:19 PID:11484   UUID:ee0b747a-dfe7-4c6f-825a-93c446da8aab   Start   E:/I3/IC/Logs/2014-11-03/ip_45.ininlog
2014/11/03 14:37:13 PID:11484   UUID:ee0b747a-dfe7-4c6f-825a-93c446da8aab   End E:/I3/IC/Logs/2014-11-03/ip_45.ininlog
2014/11/03 14:37:13 PID:11484   UUID:f834b1c0-a875-49e7-9bef-cae5be12f424   Start   E:/I3/IC/Logs/2014-11-03/ip_46.ininlog
2014/11/03 14:53:46 PID:11484   UUID:f834b1c0-a875-49e7-9bef-cae5be12f424   End E:/I3/IC/Logs/2014-11-03/ip_46.ininlog
2014/11/03 14:53:46 PID:11484   UUID:21ac9763-7d47-48d5-8d1e-4568d2105bc5   Start   E:/I3/IC/Logs/2014-11-03/ip_47.ininlog
2014/11/03 15:10:30 PID:11484   UUID:21ac9763-7d47-48d5-8d1e-4568d2105bc5   End E:/I3/IC/Logs/2014-11-03/ip_47.ininlog
2014/11/03 15:10:30 PID:11484   UUID:77f146b0-fc5a-4b41-9795-4cf733b8f254   Start   E:/I3/IC/Logs/2014-11-03/ip_48.ininlog
2014/11/03 15:30:23 PID:11484   UUID:77f146b0-fc5a-4b41-9795-4cf733b8f254   End E:/I3/IC/Logs/2014-11-03/ip_48.ininlog
2014/11/03 15:30:23 PID:11484   UUID:bf1d62ab-4a66-4b44-bc91-2b27d26cde81   Start   E:/I3/IC/Logs/2014-11-03/ip_49.ininlog
2014/11/03 15:54:12 PID:11484   UUID:bf1d62ab-4a66-4b44-bc91-2b27d26cde81   End E:/I3/IC/Logs/2014-11-03/ip_49.ininlog
2014/11/03 15:54:12 PID:11484   UUID:b0bbf12a-0d5f-43e0-ba3c-f18bcd04c7d7   Start   E:/I3/IC/Logs/2014-11-03/ip_50.ininlog
2014/11/03 16:19:26 PID:11484   UUID:b0bbf12a-0d5f-43e0-ba3c-f18bcd04c7d7   End E:/I3/IC/Logs/2014-11-03/ip_50.ininlog
2014/11/03 16:19:26 PID:11484   UUID:8547bbbc-2c92-4878-a408-f62161e7a273   Start   E:/I3/IC/Logs/2014-11-03/ip_51.ininlog
2014/11/03 16:50:35 PID:11484   UUID:8547bbbc-2c92-4878-a408-f62161e7a273   End E:/I3/IC/Logs/2014-11-03/ip_51.ininlog
2014/11/03 16:50:35 PID:11484   UUID:bba969c0-a2c9-423d-8ec6-a999cb5ca3b2   Start   E:/I3/IC/Logs/2014-11-03/ip_52.ininlog
2014/11/03 17:52:50 PID:11484   UUID:bba969c0-a2c9-423d-8ec6-a999cb5ca3b2   End E:/I3/IC/Logs/2014-11-03/ip_52.ininlog
2014/11/03 17:52:50 PID:11484   UUID:aa5a2037-b42e-42af-aa9e-61e040d408c5   Start   E:/I3/IC/Logs/2014-11-03/ip_53.ininlog
2014/11/04 00:00:00 PID:11484   UUID:aa5a2037-b42e-42af-aa9e-61e040d408c5   End E:/I3/IC/Logs/2014-11-03/ip_53.ininlog

If look for an item that has a time of 23:00:00 it returns all logs up to that point, which is not what I need. I only need the last log that would fall in that time range so if I used 23:00:00 as a time when it hits the ip journal file it should only tell me that I need ip_53 log not all 53 logs.
I am using the following code to accomplish my search so far
static TimeSpan? ExtractTime(string logLine)
{
  var tokens = logLine.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
  if (tokens.Length < 2)
    return null;
  TimeSpan time;
  if (!TimeSpan.TryParse(tokens[1], out time))
    return null;
  return time;
}

static DateTime? ExtractDate(string logLine)
{
  var tokens = logLine.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
  if (tokens.Length < 1)
    return null;
  DateTime date;
  if (!DateTime.TryParse(tokens[0], out date))
    return null;
  return date;
}

static void OutputLogLinesBeforeTime(string LogDir, string LogDate, string LogTime)
{
  try
  {
    var time = TimeSpan.Parse(LogTime);
    var date = DateTime.Parse(LogDate).Date;
    DirectoryInfo d = new DirectoryInfo(LogDir + "\\" + LogDate + "\\");
    foreach (var file in d.GetFiles("*.ininlog_journal"))
    {
      try
      {
        using (Stream stream = new FileStream(file.FullName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
        using (StreamReader sReader = new StreamReader(stream))
        {
          foreach (var line in sReader.EnumerateLines().Where(l => ExtractTime(l) <= time && ExtractDate(l) == date))
            callLogs.Add(line);
         }
       }
       catch (UnauthorizedAccessException ae)
       {
         Console.WriteLine(ae.Message);
       }
       catch (SystemException se)
       {
         Console.WriteLine(se.Message);
       }
       catch (ApplicationException ape)
       {
         Console.WriteLine(ape.Message);
       }
       catch (Exception e)
       {
         Console.WriteLine(e.Message);
       }
     }
     foreach (var e in callLogs)
       Console.WriteLine(e);
   }
   catch (UnauthorizedAccessException ae)
   {
     Console.WriteLine(ae.Message);
   }
   catch (SystemException se)
   {
     Console.WriteLine(se.Message);
   }
   catch (ApplicationException ape)
   {
     Console.WriteLine(ape.Message);
   }
   catch (Exception e)
   {
     Console.WriteLine(e.Message);
   }
 }

Answer: This line:
foreach (var line in sReader.EnumerateLines().Where(l => ExtractTime(l) <= time && ExtractDate(l) == date))
        callLogs.Add(line);

Is iterating each row in the file and storing any row that matches the row you are after. If you are only interested in the last row that matches your criteria you could either access the last item of callLogs using the Linq LastOrDefault method:
Console.WriteLine(callLogs.LastOrDefault());

Or you could grab the last item directly without storing anything inbetween:
string justOneRow = sReader.EnumerateLines().LastOrDefault(l => ExtractTime(l) <= time && ExtractDate(l) == date);
Console.WriteLine(justOneRow);

Note that the Where you were using previously has changed to LastOrDefault.
This assumes that the log files are in date order. If they're not you would have to order the list before taking the last item. In that case I would create an anonymous object so you aren't calling ExtractDate and ExtractTime more than you need to:
string justOneRow = sReader.EnumerateLines().Select(l => new
{
    Date = ExtractDate(l),
    Time = ExtractTime(l),
    RowText = l
}).Where(l => l.Time <= time && l.Date == date)
.OrderBy(l => l.Date).ThenBy(l => l.Time).LastOrDefault().RowText;

Narrow Results of search


Backing up Xen Guests from dom0 with disk image file

Question: I have a Xen server dom0 with a number of guests installed and am struggling to find an easy way to manage backups from the dom0 side.

Guest scripts: Of course I could run backup scripts on each of the guests but wish to avoid that if possible from a management point-of-view. Ideally I would also like to be able to backup disk images themselves which, along with config, could then be restored directly onto another Xen dom0 if required, along with perhaps a file backup of certain directories.
rsync of /var/lib/libvirt/images: I have tried a simple rsync of the image files in /var/lib/libvirt/images/ with the domains shut down but there is a problem - the disk images try and copy at their full available size (the size they are available to grow to). So this means each image tries to copy at 250Gb rather than the actual around 2.5Gb (e.g. the size shown by ls -l not the size [used] shown by du).

There are a number of solutions and scripts online but these all seem quite old and seem to be based on disks being LVM devices and so found in /dev/virtual/NAME-disk, whereupon they can be copied and then mounted, and then backed up using rsync. This does not appear to be how my system is configured.
I see a could of potential solutions if they're possible (as I mentioned ideally I would like to backup an image file and also do a file-level backup of certain directories on the VM as well so perhaps a combination of these).

Shrink Image File: Can I copy the image file and then shrink it to it's actual used space? I could then rsync this and delete the temporary file.
Copy at actual size: Copy the image file somehow at it's actual size and then if needed recreate the size attributes on another dom0?
Mount Image File: Somehow mount the image file directly? I see there are ways to convert it to an LVM image but not sure if this is the only way (and I'm happy with the use of image files for the normal operation of the domain guests).

Thanks in advance and hope it's clear enough.
Answer: To me, backing up disk images makes more sense here. From the backup script perspective, it shouldn't really matter if the VDIs are file- or LVM-based, you should be able to backup them the same way, by only changing paths. Moving to LVM, though, may give you a serious performance gain, especially if you employ raw (not VHD based) VDIs.
To avoid entire sparse files being transferred every time, further modify scripts to pipe data through a packer (gzip being a fine solution). This way, even reading a VDI file in its full size will give you a compact output. This may be hard to achieve with rsync so use other means to transfer the data to backup location (ie. ssh with shell redirection).
To reduce downtime, in case of LVM SR (not sure with image files), you can also enhance your script so it will take a snapshot of the VM prior to backing it up. It can then backup from snapshot storage, so it will provide consistent data without VM being blocked from start. Taking snapshot usually takes as few as few seconds. Snapshot VDIs can also be mounted on dom0 to backup individual files, the only problem being VHD format being used (again, go with LVM and raw VDIs).
Comment: Zip certainly does make a difference (250Gb -> 2Gb) but it is very slow but not a huge problem. I think this will be the image backup solution, but would still ideally like to be able to mount the .img file as well so can just backup critical files also.
Comment: Check the modified answer.
Comment: Thanks - for the moment I'm happy with the VHD format for various other reasons so I think I'll stick with: (a) copying .img file, (b) zipping file, (c) rsync zip files. If I need file-specific backup then I'll run a specific file backup on the guest. Thanks again.


Substitution of variables in Calculus

Question: I believe it is well established that (sin(x))' = cos(x).
If we let x = 2n, then substituting, we have sin(2n)' = cos(2n). However, the chain rule suggests otherwise: sin(2n)' = 2cos(2n).
In fact, graphically, we see that the chain rule is indeed correct, and the substitution of variables yields an incorrect answer.
What is wrong with this substitution that makes it a false statement?
Answer: \begin{eqnarray*}
\frac{d}{dx} \sin (x) =\cos(x)
\end{eqnarray*}
When you substitute $x=2n$ you get
\begin{eqnarray*}
\frac{d}{d(\color{red}{2}n)} \sin (2n) =\cos(2n)
\end{eqnarray*}
Can you spot where the "extra" factor of $2$ comes from ?

Substitution of variables in Calculus


Fixing Low Brass Intonation Outside

Question: I'm a part of a marching band in mid-Michigan, where the weather varies widely from day to day and often hour to hour. The band I'm a part of is currently wrapping up our competition season over the next two weeks. Within our show, I'm a baritone soloist playing on a Yamaha instrument, with which I naturally play flat in the higher register (where most of the solo takes place). Obviously with temperatures in the 50s or lower, this is even more evident.
I'm looking for suggestions to help mitigate this issue. I've currently attempted the following:

Pushing in all tuning slides
Switching to a smaller mouthpiece
Slurring up (mixed results, helps intonation but harms my ability to play with a supported tone)

I've received comments about my intonation for most of this month, and some performances have been better than others. One option I have considered is switching to a trombone for the solo, but this will require some rehearsing and also has the problem that it'll just be sitting out for about two minutes at the very least in the cold.
Answer: I don't play brass, but I found this reddit thread with some suggestions that may be useful if you haven't tried them already:
https://www.reddit.com/r/marchingband/comments/9o6myu/tips_for_playing_brass_instruments_when_its_cold/
The main opinion seems to be just keeping your mouthpiece/instrument as warm as possible with your own breath and body heat, blowing through it whenever possible.
There's also a suggestion for using a plastic mouthpiece for the colder weather.
Here's another thread with similar advice: https://forum.saxontheweb.net/showthread.php?129452-Playing-in-the-COLD!!&s=8f9fe74886417e272cf7b73edbfd015f)
Answer: I do play brass, and I marched both in high school and college, and as a professional have still had to perform occasionally in cold weather (although not as bad as an 8 AM warm-up for a Bowl game). My advice echos the post by user jasnoj. Get a plastic mouthpiece (there are some really good ones) and keep your horn warm. There's no other way around it. The silver lining is that everyone else's horns are equally as cold, so the ensemble will be roughly sharp/flat together. For the sake of devil's advocate (for lack of a better term) I'll add that your intonation may be adversely affected by playing too loudly in efforts to make your solo audible. Don't overplay. I'm sure you're not doing that, though.

Fixing Low Brass Intonation Outside


Reuse a function with setState in several components

Question: I have a function within a react component which needs to be used in another file
class App extends Component{
    changeMessageState(message) {
    this.setState({
      message,
    });
  }
render(){
return(

hello

);
}

now, I want to use changeMessageState in a different file, but I dont know how to export this.
so, how can this be done?
i was thinking of putting changeMessageState in a separate file and call it from both places i.e. within the react component and in the other file from there only.
the problem is that if I put this in a separate file, then what will 'this' refer to? it wont refer to the component anymore, right?
so, how do I accomplish this?
EDITED TO EXPLAIN MORE:
actually, I have a separate file where I am using firebase to login
and when there's an error in the login process, I want to set the error message in there and display it in the App component.
so, I wanted to use the changeMessageState from within App inside the firebase login function and thus error message can be set from there.
that's what I want to achieve.
Answer: You can pass this as argument:
function changeMessageState(component, message) {
  component.setState({
    message,
  });
}

// then in your components
changeMessageState(this, message)

Comment: Nice one @GG. ..!
Comment: okay, but the other place where I want to use this function, the 'this' should still refer to the original App's this, wherever I use it.
it shouldnt point to a different 'this'
Answer: If you wan't to call a function of one component from within the other components that are not directly related to this component then you can declare the function as a static member of the class and use it elsewhere by importing this component like
export default class App extends Component{
    static changeMessageState(message) {
         // logic here
    }
    render(){
       return(

hello

    );
}

and use it like
import App from 'path/to/App'
....
App.changeMessageState(value)
...

However this isn't really available inside a static method and you can't do setState within it.
If you wish to setState of the component which changeMessageState is being called from then I guess you can simply add it in a separate file like
export const changeMessageState = (message) => {
     this.setState({message});
}

and then to use it, import first like
import { changeMessageState } from 'path/to/changeMessageState'

and use it like
changeMessageState.call(this, message);

Or better you need a shared state for all the component, then you should really look into using redux which provides a way for components to keep a shared state.
One other solution is provide a callback from the function that you wish to call changeMessageState from, for instance
export const login = (callback) => {
    //your logic here
    req.then((res) => {
         callback(res)
    }).catch((error) => {
         callback(error)
    })
}

and use it in App component like
login((message) => {
     this.changeMessageState(message)
})

Comment: and I wont need to export the function separately?? if yes, then this is what I am looking for
Comment: No you won't need to export this function separately
Comment: great. let me try it out
Comment: I tried it out and i get this error - Cannot read property 'bind' of undefined
and even the vscode linter says -- changeMessageState should be placed before constructor
Comment: Sorry for the inconvenience, this isn't available inside a static method, can you explain more on what you want to acieve, maybe there is another method
Comment: Do you want `changeMessageState` to change the state of App component only from whereever it is called or setState for the own component
Comment: yes, that's what I want to achieve.
i want to use changeMessageState from within the firebase login process and show the error message in component.
explained a bit more in original question above.
Comment: Why don't you call the firebase login function from inside the App component, any reason
Comment: well, I need to keep things clean. and maintain separation of concerns. so firebase is in it's own file.
Comment: the client wants it like that actually
Comment: I guess, then you might need to make use of redux, or provide a callback/Promise from firebase login function, which you can then use in App to call `changeMessageState`
Comment: I didnt quite get the callback/Promise part. could you explain a bit more on this. this could be helpful
Comment: From you Firebase login function you could return a Promise or else the login function could take a callback which is called then action is complete something like

`login(callback) {
     // You actions here
    .then(res) {
         callback(res);
   }

}
`
and use it like `login((res) => {
    this.changeMessageState(res);
})` in App
Comment: hmm, yeah. that makes sense.