Troubleshooting ZFS storage pool

Question: I am looking for advice on how to identify performance issues with a ZFS storage server. The server is a prototype that I have built as a proof of concept for a NAS device that will allow me to offload camera memory cards to shared storage. We are talking around 512GB transfers with checksum verification processed by the client. I have a fair bit of Linux experience, but opted for FreeBSD for this build as its native support for ZFS.
Details:

FreeBSD 12.1
Intel Xeon E3 1225
Intel S1200BTS Motherboard
16GB DDR3 Ram
Dell H310 flashed to IT mode (installed in a 16x slot)
Aquantia aqc107 10gbe network card.
6x 2TB HGST Ultrastar SAS drives. (Configured into one RAID 0 storage    pool)
Network Protocol Samba

Initial Expectations
I was hoping that the server would run at around 900mbps read and write over 10gbe.
Testing and Results
I have found it difficult to measure pool speed over 10gbe as the tools that I usually use have not been able to give me a consistent result. I have tested with AJA speed test and Blackmagic Disk Speed Test and get different results from each.
AJA: 140mbs Write / 80mbs Read
Blackmagic: 450mbs Write / 80mbs Read
Actual use offloading camera memory cards to server using Hedge offloading software 10GB transfer averages around 170mb per second.
I these results were strange and quite low for my expectations. I have tested the transfer speeds with a Ramdisk and got around 1GB per second each way, which rules out the actual connection.
Questions

Why does the benchmarking software report different speeds?
What is the best way of identifying the bottleneck in this
situation?    My initial thoughts that it maybe the Dell H310
Will configuration and caching help in this case? Or is the issue
purely hardware related.

I think I have included everything that will be useful to solve this issue. Please forgive me if anything has been omitted.
H
Comment: This may require more than the format here allows… Try me off-line, as I think I can help with your application.
Comment: I will send you an email
Answer: In general, that not enough RAM or the correct disk setup to accommodate those transfer speeds.
Beyond that, there the matter of tuning:

Network tuning
SMB protocol tuning
Linux system tuning
ZFS filesystem tuning
Disk and ZFS pool layout
Caching
Hardware design

What you're asking for is definitely possible, though.

Troubleshooting ZFS storage pool


Where To Start With Contemporary Theory

Question: I would like to study contemporary music such as 80's pop, 90's rock, video game music (NES, SNES, Genesis) and more. However, my background knowledge of music theory is in tonal harmony.
I have absolutely no idea where to start. I've seen some music books with chord names above the staffs instead of Roman numerals and I'm assuming this is how to analyze contemporary music. Here's an example:

This leads me to ask a lot of questions:
1) How do you know it's a G or a Cmaj7 chord? Couldn't an inversion lead you to conclude the chord is something else?
2) How do passing tones come into play?
3) How do you know what chord goes to what? Is there some kind of guide or are the chords there simply to identify what's being played?
4) In the picture, what is a B7/D# chord?
There's also this YouTube channel which goes into detail about analyzing video game music, but I get lost easily because he goes too fast and he talks about things I haven't been exposed to.
Where do I start? What books can I read to learn about contemporary theory? Does Jazz theory help with contemporary theory?
Comment: Classical theory will help you understand contemporary music because it's almost all based on the same concepts. Jazz theory does relate to contemporary music, but not as widely as classical theory. I find some genres like Hip Hop have much more of a jazz influence than video game music (in general).
Answer: Regarding video game music, a great place to start would be Zach Whalen's article "Play Along - An Approach to Videogame Music" in Game Studies: http://www.gamestudies.org/0401/whalen/
Whalen's article was one of the first to analyse the functions of game music. He explains some of its functions within the game by drawing analogies with film music, but also examining music's role in immersion into the game experience. It's a valuable read for starting off with the basics of what game music does and how it does it.
Getting in deeper, you could check out the Overclocked Remix forum, where there is a subforum for "History & Study of Video Game Music": http://ocremix.org/community/forum/56-history-study-of-video-game-music/
The forum is pretty active, and has people who love video game music, who make video game music, and who study video game music academically (like me). The posts vary between discussion and technical analysis. But if you want to get a feel for how it goes together, musically and functionally, it might be worth a read.
There are links on the forums to academic and technical books on video game music, if that's more your thing. There's also a comprehensive bibliography of literature in video game music studies on the website of the Society for the Study of Sound and Music in Games (can't post a link just now sorry).
Answer: There is a lot to answer, and I'll make a start. Each contemporary chord has a name, it's built on a triad of stacked thirds usually.Take G major - G B D. Look at your Cmaj7 - C E G B (the B is another stacked third). So, while they both have G and B, they can't be mistaken for each other. There are several that can, though. C6 - C E G A has the same notes as Am7 - A C E G. Here, usually, the bass (base) note is the clue to naming.
What's D/F#? The first letter tells which chord, the one after the slash tells which note gets played lowest. Usually the slash note is in the chord, but not always.That's often where the passing tone you ask about comes in. It's the modern way to show inversions - the classical way is to write a couple of numbers to signify the same.
That's enough for now, except to recommend LCM Theory books. Grade 5 is one to aim for but with the questions you ask, maybe look at them all in sequence, to build your knowledge. A fair bit in them is very similar to the 'standard' theory, but they add extra knowledge such as you appear to ask for.

Where To Start With Contemporary Theory


How should I make "exotic" scale enharmonic decisions?

Question: I'm creating a scale visualiser (JavaScript based website) for guitar. I recently updated so it will use "correct" enharmonics e.g. major scales it will default to "Bb" tonic rather than "A#" because there's less accidentals.
But currently it's the same rules for all scales and modes, including harmonic major and harmonic & melodic minor scales and modes... It just calculates the least number of accidentals and ensures there's only one letter for each note.
So question is for example: (excuse my terminology) if A# major scale is "Db", should something like the "altered dominant bb7" scale (7th mode of harmonic minor) also be built in Db? Because if so, technically it then would have more flats that sharps (compared to if I built it from A#)
Because this is a project where i want to do all this programmatically (i.e. there's no fun in me just doing it based on a big table of information) then I'm looking for the "best option that makes logical sense that I can easily code".
My best guess is "check if the third is major or minor, then base it off the same enharmonic as the major or minor key"?
[Edit:] So based on responses I've hopefully settled on a design that satisfies the majority of users, and doesn't completely devastate the music theory experts (oh which I am in awe of, and thanks everyone for your detailed answers and comments).
I think key thing I've learnt (excuse the pun) is both enharmonic options are just as valid in different contexts, i.e. there's no set rule to automatically select one over the other. And obviously 7 note scales should have one of each letter. There seems conjecture over the rule "minimum symbols", but I think for users of my tool, that option will be nice. By extension, if there's no "default" option, then comparing to "default for Major scale" may be non-sensical... but Im keeping that option for now.
For seven note scales I have three options for enharmonics in top dasboard (you'll need to be on a wide enough device to see the buttons):

Manual: you can now drop the note to the left or right side of the same "spot" to set the enharmonic (i.e. just after previous fret = A#, just before next fret = Bb). So "manual" mode just displays scales built from that "drop note"

Auto: this uses whatever has the fewer amount of symbols regardless of where you dropped the note (but that information is retained if you want to switch back to manual mode). The tool doesn't work very well with more than one sharp or flat especially (i.e. not much space on a dot): so this is probably going to be the most comman use

Parallel Major: this uses the same enharmonic that the parallel Major does (assuming that's also based on minimum symbols)
Comment: _A# major scale is "Db"_ You mean "Bb", not "Db", right?
Comment: You need to explain more about what the input/output is. Surely you are not going to map a whole bunch of scales all overlapping on a fretboard image. Does the user choose a string/fret starting point then scale type, or choose a lettered pitch then scale type, or something else? There is no right choosing of A# over Bb. Your program should be able to spell the scale with either tonic. How is the enharmonic choise first encountered in your program?
Comment: Also, I think you should distinguish between "exotic" scales and modes/rotations of major & minor scales, because making the modes/rotations is just a mechanical process applied to the major/minor scales. Exotic scale are more like whole tone, or diminished with less/more than 7 tones, or non-diatonic ones like double harmonic, basically scales that aren't major, minor, or a mode of either.
Comment: Yeah I meant Bb... You can see what I mean at sidawg.github.io/Vuetar/. They drop a scale on a fret, so they don't really choose the enharmonic. It's up to to the user how complicated they want to go, if they want to visualise more than one scale at a time. I get how to decide the names on a single scale, the question is if other scales should base their names on the major scale or if they should just follow the same rule of "minimum accidentals". It's the four seven note scales and their seven modes that I'm wondering about.
Comment: That comment doesn't really add anything
Answer: Naming notes in seven-note scales is fairly mechanical and straight-forward. You take the letter of the scale degree, and adjust it with sharps or flats to reach the pitch you want.
In other words: for each scale degree, you (1) take the accidental-less natural letter name like C, D or E, (2) calculate the pitch of your target scale degree in semitones, (3) compare the target pitch with the corresponding natural note with the same letter, and (4) add as many sharps or flats as are needed to reach the target pitch. If the pitch difference is -1 semitones, you add one flat. If the pitch difference is +2 semitones, you add two sharps. If the pitch difference is 0, you add nothing.
FOR EACH i in [0..6]
    letter(i) = note_names(scale_root_note + i)
    accidentals(i) = pitch difference between scale note (i)
            and natural note (scale_root_note + i)

Then actual Python code for that idea. Should work with Python 3.x and even 2.7. There can be bugs. I checked the example scales below and they seem to be correct.
note_names = ['C','D','E','F','G','A','B']
# scale pitches are in semitones relative to root = 0
scales = {'major': [0, 2, 4, 5, 7, 9, 11],
          'melodic minor': [0, 2, 3, 5, 7, 9, 11],
          'harmonic minor': [0, 2, 3, 5, 7, 8, 11]}

def get_mode(base_scale_pitches, mode_idx):
    pitches = []
    for i in range(7):
        pitches.append(base_scale_pitches[(mode_idx+i)%7] - base_scale_pitches[mode_idx] + ((mode_idx+i)//7)*12)
    return pitches

def get_note_name(natural_note_idx, accidentals):
        natural_name = note_names[natural_note_idx % 7]
        if accidentals > 0:
            return natural_name + '#'*(accidentals)
        else:
            return natural_name + 'b'*(-accidentals)

def get_scale_notes(root_idx, root_accidentals, scale_pitches):
    result = []
    root_pitch = scales['major'][root_idx] + root_accidentals
    for i in range (7):
        natural_pitch = scales['major'][(root_idx + i) % 7] + ((root_idx + i) // 7) * 12
        scale_pitch = root_pitch + scale_pitches[i]
        result.append(get_note_name(
            root_idx + i,
            accidentals = scale_pitch - natural_pitch # how many flats or sharps are needed
        ))
    return result

Then some examples, how to generate scales as modes of other scales and print note names for them:
scales['dorian'] = get_mode(scales['major'], 1)
scales['natural minor'] = get_mode(scales['major'], 5)
scales['aeolian'] = scales['natural minor']
scales['altered'] = get_mode(scales['melodic minor'], 6)
scales['lydian'] = get_mode(scales['major'], 3)

def print_scale(root_idx, root_accidentals, scale_name):
     print(get_note_name(root_idx, root_accidentals), scale_name,
           get_scale_notes(root_idx, root_accidentals, scales[scale_name]))

# Print some example scales
print_scale(0, 0, 'natural minor')
print_scale(0, 0, 'harmonic minor')
print_scale(2, 1, 'altered')
print_scale(3, -1, 'altered')
print_scale(0, 0, 'dorian')
print_scale(3, -1, 'lydian')
print_scale(2, 0, 'lydian')
print_scale(5, 0, 'aeolian')

Running the examples prints the following:
C natural minor ['C', 'D', 'Eb', 'F', 'G', 'Ab', 'Bb']
C harmonic minor ['C', 'D', 'Eb', 'F', 'G', 'Ab', 'B']
E# altered ['E#', 'F#', 'G#', 'A', 'B', 'C#', 'D#']
Fb altered ['Fb', 'Gbb', 'Abb', 'Bbbb', 'Cbb', 'Dbb', 'Ebb']
C dorian ['C', 'D', 'Eb', 'F', 'G', 'A', 'Bb']
Fb lydian ['Fb', 'Gb', 'Ab', 'Bb', 'Cb', 'Db', 'Eb']
E lydian ['E', 'F#', 'G#', 'A#', 'B', 'C#', 'D#']
A aeolian ['A', 'B', 'C', 'D', 'E', 'F', 'G']

In this process, I do not see any need for the concepts of key or key signature. Or any such thing as a "rule of minimal accidentals". You take the letter of the scale degree, and adjust it with sharps or flats to reach the pitch you want.
Answer: I've also created a javascript project, but mine only works for visualising major modes. The most important thing about a major scale is its sequence of intervals. When you represent these on a pie chart you can see it has a very distinctive shape.
Scale Construction Webpage
ScaleConstructionJS project in Github
The rule of thumb I tried to stick to is to try to minimise the number of accidentals in the key signature. Given that the {number of flats} in a key signature is 12-{number of sharps} you can do an enharmonic shift at the right moment.
Key signatures with 8 to 12 sharps or 8 to 12 flats can be written, but they're more of a technical exercise - you wouldn't use such key signatures in actual written music.
You might need to use double sharps or double flats to make your scales technically correct - otherwise you might end up with scales that have say two fifths, rather than a fifth and a sixth.
Comment: Cool I'll check it out! I'm at sidawg.github.io/Vuetar/
Comment: @AriBrodsky - You're absolutely right - what should I have said?
Comment: Sharps and flats in the key signature are not accidentals.
Comment: @Simon Vuetar is an astonishing piece of work. Good job!
Comment: Ah OK thanks Ari I should just call them "symbols" i guess
Comment: @Brian thanks Brian glad SOMEONE likes it haha. I just need to settle on a practical approach to enharmonics
Answer:
7th mode of harmonic minor

I'm afraid there is no simple catch-all solution for this kind of scales. This is because depending on the context, various steps of the scale could be interpreted in many ways.
If you start with C harmonic minor: C D Eb F G Ab B, and rotate it by one step, you get: B C D Eb F G Ab. It's not terrible.
But, does it make sense? E.g. the D is often interpreted as #9, and Eb as 3, then these two notes should be Cx and D#. Then F could be either #4 or b5, and G could be either #5 or b13. Finally, would Ab be really perceived as bb7, or rather as 6?
In practice I see corners being cut in the scores, e.g people write scales with both b3 and 3, or make other choices to minimize the number of accidentals, sacrificing theoretical correctness.
In this SE site you'll find heated discussions about correct spelling. There might be no way for you to please everyone. For the "exotic" scales you may add some commentary about possible different spellings of a scale.
Comment: Thanks yeah for the degrees, if it's a seven note scale I just compare to major to determine if something is a b3, or bb7 etc... And pentatonic I do the same but with "special' indexing. If there's no "correcter" way for the names/spellings I could always have a toggle setting...
Answer:
...So question is for example: (excuse my terminology) if A# major scale is "[B]b"

A# major is not Bb major. They are enharmonically equal, but not the same.
If you really want to do this programmatically, you shouldn't even force the issue of choosing one enharmonic spelling over another. Your program should be able to spell either A# major or Bb major.

... (7th mode of harmonic minor) also be built in [B]b ... (compared to if I built it from A#)

Build it on whatever tonic is given. The question is the method to use. I see basically two ways to do it: rotate a harmonic minor scale or by interval above the tonic. I suppose you could do it something like an alteration of a natural minor scale with lowered ^2, ^4, ^5, ^7, but I don't see an advantage to that. Personally, I like the interval method, and years ago a programmed a scale and chord speller in PHP.
The intervals for 7th mode of harmonic minor are:

^1 - P1 unison
^2 - m2 minor second
^3 - m3 minor third
^4 - d4 diminished fourth
^5 - d5 diminished fifth
^6 - m6 minor sixth
^7 - d7 diminished seventh

So, starting from A# it's...

A# P1 - A#
A# m2 - B
A# m3 - C#
A# d4 - D
A# d5 - E
A# m6 - F#
A# d7 - G

The interesting thing with that is when working with the seventh mode of harmonic minor the "tonic" of that scale is the leading tone of the harmonic minor scale rotated. So, you could ask yourself before making the scale: "of what minor tonic is A# the leading tone?" The answer is: "B". So, we are rotating a B harmonic minor scale, which turns out to be not really that strange, in terms of enharmonic spellings.
If we start from Bb it's...

Bb P1 - Bb
Bb m2 - Cb
Bb m3 - Db
Bb d4 - Ebb
Bb d5 - Fb
Bb m6 - Gb
Bb d7 - Abb

Looking at the leading tone aspect again, we ask: "of what minor tonic is Bb the leading tone?" The answer is: "Cb". So our reference scale would be Cb harmonic minor. That should immediately signal things will probably get a bit messy with double flats and the potential to enharmonically respell things more simply.
I really don't understand the actual problem.
There is no rule of "minimum accidentals". The choice between enharmonically equal tonics or roots is usually related to some key signature or harmonic context, for example going up from F# major to C# major - up a perfect fifth - rather than moving to Db major - up a diminished sixth.
I looked at your example on sidawg.github.io/Vuetar/.
It seems like you already decided on a least sharps/flats decision. So, a user can't label a C# major scale and is forced to have only Db major, etc.
I understand your reason for doing that, but I think it is bad music fundamentals. Avoiding a theoretical key signature is one thing, but completely removing a basic key signature really cannot be justified.
Also, there is something inconsistent with the current application logic if it is supposed to end up with fewest sharps/flats. I tried putting the locian scale with starting pitch on the sixth string, sixth fret, and the it was named Bb rather than A#. Bb ends up spelling the scale with seven flats as compared to A# which would only need five sharps.
Instead of dragging the scale to a string/fret, you can have them select a lettered pitch, then you just map the correctly spelled scale pitches to the fretboard.
If you stick with the drag and drop thing, you might add some kind of enharmonic shift control. The simplest thing would probably be something to "flip" any non-natural starting pitch, for example flip Bb to A#.
Given the interface is so slanted to the fretboard, you could do something like label the fretboard with scale degree numbers 123... by default, then generate a set of buttons for various enharmonic spelling options for the user to choose from. Match the fretboard labeling to input type. Numeric in, numeric out. Letter pitch in, letter pitches out. The actual problem is giving the user a numeric input (fret/string numbers) and then guessing what they meant by that in terms of lettered pitches.
It's hard to recommend anything more specific without knowing how the program works.
Comment: Thanks yeah I have to find the right design balance: can always add more features but my users are probably not theory experts: they wouldn't have a need for the tool. At the same time I don't want to have horrible mistakes that teach beginners wrong information. If you're using phone you'll notice some settings when you rotate to landscape, i.e. you can change labels to degrees. But thanks maybe a way to toggle enharmonic is needed and I stick with the "minimum accidentals" default


Is it true that cyclic subgroups are always normal?

Question: There is a proposition that I'm supposed to "prove", but it doesn't sound true to me. It says that if $H$ is a cyclic subgroup of a group $G$ (notation $H<G$), then every $K <H$ is normal in $G$.
If that were the case, since $H<H$, we'd have a corollary: If $H$ is cyclic, then $H$ is normal in $G$. But is that even true?
Comment: Here you cleaerly need a non-abelian group in order to have a counterexample, and $S_3$ is the smallest non-abelian group. What examples did you consider before asking the question? Did you consider any example at all? You should.
Comment: That is surely false. Consider any cyclic subgroup of order $2$ in $S_3$.
Comment: That was a very easy counterexample!
Comment: I considered the quaternions, first $H = $ and then $H=$, but it was no use because $H$ turned out normal :(
Answer: No, it's not true that if $H$ is a cyclic subgroup of $G$ then it is a normal subgroup of $G$. For a simple counterexample, let $G=S_3$ and let $H$ be the subgroup generated by the transposition $(12)$.
Perhaps the problem should instead read "every $K\leq H$ is normal in $H$".
Comment: I see, that's a clear counterexample. And yes, when one replaces "normal in $G$" with "normal in $H$", it's actually a simple proof!


Quantile regression estimator formula

Question: I have seen two different representations of the quantile regression estimator which are
$$Q(\beta_{q}) = \sum^{n}_{i:y_{i}\geq x'_{i}\beta} q\mid y_i - x'_i \beta_q \mid + \sum^{n}_{i:y_{i}< x'_{i}\beta} (1-q)\mid y_i - x'_i \beta_q \mid$$
and
$$Q(\beta_q) = \sum^{n}_{i=1} \rho_q (y_i - x'_i \beta_q), \hspace{1cm} \rho_q(u) = u_i(q - 1(u_i < 0 ))$$
where $u_i = y_i - x'_i \beta_q$. Can somebody tell me how to show equivalence of these two expressions? Here is what I tried so far, starting from the second expression.
$$
\begin{align}
Q(\beta_q) &= \sum^{n}_{i=1} u_i(q - 1(u_i < 0 )) (y_i - x'_i \beta_q) \newline
&= \sum^{n}_{i=1}(y_i - x'_i \beta_q)(q - 1(y_i - x'_i \beta_q < 0 )) (y_i - x'_i \beta_q) \newline
&=\left[ \sum^{n}_{i:y_{i}\geq x'_{i}\beta}(q(y_i - x'_i\beta_q)) + \sum^{n}_{i:y_{i}< x'_{i}\beta}(q(y_i - x'_i\beta_q)-(y_i - x'_i\beta_q)) \right](y_i - x'_i\beta_q)
\end{align}
$$
But from this point I got stuck on how to proceed. Please not that this is not a homework or assignment question. Many thanks.
Answer: If you remember, OLS minimizes the sum of the squared residuals $\sum_i u_{i}^{2}$ whereas median regression minimizes the sum of absolute residuals $\sum_i \mid u_i \mid$. The median or least absolute deviations (LAD) estimator is a special case of quantile regression in which you have $q = .5$. In quantile regression we minimize a sum of absolute errors that receives asymmetric weights for overprediction $(1-q)$ and $q$ for underprediction. You can start from the LAD representation and extend this as the sum of the fraction of the data which are weighted by $q$ and $(1-q)$ given their value of $u_i$, and work on it as follows:
$$
\begin{align}
\rho_q(u) &= 1(u_i>0) \, q\mid u_i\mid + 1(u_i\leq 0) \, (1-q)\mid u_i \mid \newline
&= 1(y_i - x'_i \beta_q > 0) \, q\mid y_i - x'_i \beta_q \mid + 1(y_i - x'_i\beta_q \leq 0) \, (1-q)\mid y_i - x'_i \beta_q \mid
\end{align}
$$
This just uses the fact that $u_i = y_i - x'_i \beta_q$ and then you can re-write the indicator function as sums of the observations that satisfy the conditions of the indicators. This will give the first expression you wrote down for the quantile regression estimator.
$$
\begin{align}
&= \sum^{n}_{i:y_i>x'_i\beta_q}q\mid y_i - x'_i\beta_q \mid + \sum^{n}_{i:y_i\leq x'_i\beta_q} (1-q) \mid y_i - x'_i\beta_q \mid \newline
&= q \sum^{n}_{i:y_i>x'_i\beta_q} \mid y_i - x'_i\beta_q \mid + (1-q)\sum^{n}_{i:y_i\leq x'_i\beta_q} \mid y_i - x'_i\beta_q \mid \newline
&= q \sum^{n}_{i:y_i>x'_i\beta_q} (y_i - x'_i\beta_q) - (1-q)\sum^{n}_{i:y_i\leq x'_i\beta_q} ( y_i - x'_i\beta_q ) \newline
&= q \sum^{n}_{i:y_i>x'_i\beta_q} (y_i - x'_i\beta_q) - \sum^{n}_{i:y_i\leq x'_i\beta_q}  (y_i - x'_i\beta_q) + q \sum^{n}_{i:y_i\leq x'_i\beta_q} (y_i - x'_i\beta_q) \newline
&= q \sum^{n}_{i=1} (y_i - x'_i \beta_q) - \sum^{n}_{i=1}1(y_i - x'_i\beta_q\leq 0)(y_i - x'_i\beta_q) \newline
&= \sum^{n}_{i=1}(q - 1(u_i \leq 0))u_i
\end{align}
$$
The second line takes out the weights from the summations. The third line gets rid of the absolute values and replaces them by the actual values. By definition $y_i - x'_i\beta_q$ is negative whenever $y_i < x'_i\beta_q$, hence the sign change in this line. The fourth line multiplies out $(1-q)$. You then realize that
$$q\sum^{n}_{i:y_i>x'_i\beta_q}(y_i - x'_i\beta_q) + q\sum^{n}_{i:y_i \leq x'_i\beta_q}(y_i - x'_i\beta_q) = \sum^{n}_{i=1}(y_i - x'_i\beta_q)$$
and replacing the summation of the middle term in the fourth line by the corresponding indicator you arrive at the fifth line. Factorizing and then replacing $y_i - x'_i\beta_q$ with $u_i$ yields the second expression of your estimator.
This shows how the two expressions are equivalent.
Comment: For a computational approach see https://stats.stackexchange.com/questions/384909/formulating-quantile-regression-as-linear-programming-problem/384913#384913

Quantile regression estimator formula


TomcatStarter error with Beans and RabbitTemplate/ RabbitHealth

Question: I am recieving such a problem, which makes my gradle app unable to start:
2018-06-12 14:34:21,995 ERROR org.springframework.boot.web.embedded.tomcat.TomcatStarter [localhost-startStop-1] [] [application] Error starting Tomcat context. Exception: org.springframework.beans.factory.BeanCreationException. Message: Error creating bean with name 'servletEndpointRegistrar' defined in class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/ServletEndpointManagementContextConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.endpoint.web.ServletEndpointRegistrar]: Factory method 'servletEndpointRegistrar' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'healthEndpoint' defined in class path resource [org/springframework/boot/actuate/autoconfigure/health/HealthEndpointConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.health.HealthEndpoint]: Factory method 'healthEndpoint' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.actuate.autoconfigure.amqp.RabbitHealthIndicatorAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'rabbitConfig' defined in file [C:\dev\workspace\domain\application\build\classes\java\main\pl\net\cmp\domain\application\config\RabbitConfig.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name 'domain.application-pl.net.cmp.domain.application.config.applicationProperties': Could not bind properties to 'applicationProperties' : prefix=domain.application, ignoreInvalidFields=false, ignoreUnknownFields=true; nested exception is org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'domain.application' to pl.net.cmp.domain.application.config.applicationProperties

My properties seems to be allright (I have made a config file, which maps yaml to java class) 1-1.
I also have:
@Bean
public RabbitTemplate rabbitTemplate() {
    log.info("Initializing rabbitTemplate");
    return new RabbitTemplate(cachingConnectionFactory());
}

I am using the newest version amqp dependency for gradle:
compile group: 'org.springframework.boot', name: 'spring-boot-starter-amqp', version: '2.0.2.RELEASE'

I completely have no idea, where to start with such a problem. Have you meet with something similiar?
edit: I suppose the code I paste is not connected to problem - but I am not sure... I completely dont have any idea.
Answer: Fixed.
When you have such a communication, you should

Implement spring-rabbit dependency
Change your properties files according to RabbitProperties class to establish connection with RabbitMQ
Create proper java class to initiate Rabbit Queues and others.


Compare group mean to larger group of which it is part

Question: I have thousands of evaluation scores, over several sites, which vary in number of evaluations for each.  I am tasked with comparing the evaluation means for each site to the all-site mean.  The approach previous has been to use a student t-test on each site, with the all-site mean as the test value.  The all-site mean is a simple unweighted mean.
Is this a reasonable method, given that each site is included in the all-sites mean, and that each site contributes differing numbers of evaluations to that mean?
If this is not a useful approach, what would a better one look like?  Would the application of weighting on the all-site mean be an improvement?
Answer:
Is this a reasonable method, given that each site is included in the all-sites mean, and that each site contributes differing numbers of evaluations to that mean?

Note that there are two issues here:
1) treating the "whole data" as a population rather than a sample
2) comparing a subgroup to "everything else + that subgroup"
In respect of (2), the approach itself (properly conducted) will yield the same inference as comparing the subgroup to everything else (but with more effort).
See the comments here about the same issue in a different context.
It's easier to do the standard thing.
In respect of (1), if you don't have the population about which you wish to make inference, you shouldn't treat it as such.


Chrome Extension - show dynamic text on mouse hover over extension icon

Question: I've recently built a popup chrome extension(Popup Notes)
It basically takes notes of whatever you type in popup.
Now I want to show saved notes whenever I hover my mouse over the extension icon.
Right now it shows the static default title on mouse hover.
I know it's possible because this extension Checker Plus for Gmail shows the unread emails content on mouse hover and I'm not able to figure out how.
See Image:

So, How Can I show popup content on hovering mouse over icon in chrome extension?
Let me know if any further details are required.
Answer: For manifest V2 or earlier: chrome.browserAction.setTitle
For Manifest V3: Use chrome.action.setTitle
The tooltip which is shown on hover for your browserAction button is the title.  You can change the title using chrome.browserAction.setTitle().
For example:
chrome.browserAction.setTitle({
    title:'This is the tooltip text upon mouse hover.'
});

browserAction.setTitle() can also take an optional tabId which will change the title only for the specified tab.
Here is a GIF of a browserAction button switching between two different titles:
Comment: how to set it on hover? is there any hover event for this?
Comment: @JerryGoyal, There is no hover event available. You just set the title, then when the mouse hovers the button, the title is displayed (just like a tooltip is displayed without you having to do anything but set it). [Here is a GIF](https://i.stack.imgur.com/BbNW4.gif) which shows a slight change in title. That GIF no longer exactly matches the code shown in [this other answer](http://stackoverflow.com/a/40604386/3773011). The code in that answer is to have buttons with multiple states. While that question is about Firefox WebExtensions, the code is tested in both Chrome and Firefox.
Comment: but the content is changed whenever user enters something but hover shows the content which I initially set. Do i have to call setTitle each and every time?
Comment: @JerryGoyal, You have to call `browserAction.setTitle()` any time you want the title to change. I'm not sure why/how it would be any different than that.


Trying to convert month number to month name in a date set

Question: Im getting NA value when im trying to replace month number with month name with the below code:
total_trips_v2$month <- ordered(total_trips_v2$month, levels=c("Jul","Aug","Sep","Oct", "Nov","Dec","Jan", "Feb", "Mar","Apr","May","Jun"))

Im working with a big data set where the month column was char data type and the months were numbered as '06','07' and so on starting with 06.
Im not quiet sure even the ordered function in the code which i used, what it really does.I saw it somewhere and i used it. I tried to look up codes to replace specific values in rows but it looked very confusing.
Can anyone help me out with this?
Comment: Can you edit the question with the output of `dput(head(total_trips_v2$month, 20))`?
Comment: @ruibarradas can you tell me what exactly that will do? im just seeing "07" printed 20 times.
Comment: That means that the first 20 months are all `"07"`. Anyway, you already have an answer that works, so it's no longer important. See my comment to the answer, please.
Answer: Working with data types can be confusing at times, but it helps you with what you want to achieve. Thus, make sure you understand how to move from type to type!
There are some "helpers" build in to R to work with months and months' names.
Below we have a "character" vector in our data frame, i.e. df$month.
The helper vectors in R are month.name (full month names) and month.abb (abbreviated month names).
You can index a vector by calling the element of the vector at the n-th position.
Thus, month.abb[6] will return "Jun".
We use this to coerce the month to "numeric" and then recode it with the abbreviated names.
# simulating some data
df <- data.frame(month = c("06","06","07","09","01","02"))

# test index month name
month.abb[6]

# check what happens to our column vector - for this we coerce the 06,07, etc. to numbers!
month.abb[as.numeric(df$month)]

# now assign the result
df$month_abb <- month.abb[as.numeric(df$month)]

This yields:
df
  month month_abb
1    06       Jun
2    06       Jun
3    07       Jul
4    09       Sep
5    01       Jan
6    02       Feb

Comment: you can reply to their answer and then close the question :)
Answer: The lubridate package can also help you extract certain components of datetime objects, such as month number or name.
Here, I have made some sample dates:
tibble(
  date = c('2021-01-01', '2021-02-01', '2021-03-01')
) %>%
  {. ->> my_dates}

my_dates

# # A tibble: 3 x 1
# date
# <chr>
# 2021-01-01
# 2021-02-01
# 2021-03-01

First thing we need to do it convert these character-formatted values to date-formatted values. We use lubridate::ymd() to do this:
my_dates %>%
  mutate(
    date = ymd(date)
    ) %>%
  {. ->> my_dates_formatted}

my_dates_formatted

# # A tibble: 3 x 1
# date
# <date>
# 2021-01-01
# 2021-02-01
# 2021-03-01

Note that the format printed under the column name (date) has changed from <chr> to <date>.
Now that the dates are in <date> format, we can pull out different components using lubridate::month(). See ?month for more details.
my_dates_formatted %>%
  mutate(
    month_num = month(date),
    month_name_abb = month(date, label = TRUE),
    month_name_full = month(date, label = TRUE, abbr = FALSE)
  )

# # A tibble: 3 x 4
# date       month_num month_name_abb month_name_full
# <date>         <dbl> <ord>          <ord>
# 2021-01-01         1 Jan            January
# 2021-02-01         2 Feb            February
# 2021-03-01         3 Mar            March

See my answer to your other question here, but when working with dates in R, it is good to leave them in the default YYYY-MM-DD format. This generally makes calculations and manipulations more straightforward. The month names as shown above can be good for making labels, for example when making figures and labelling data points or axes.


Number of zeros of Wronskian

Question: Is there some relation between the number of zeros of a Wronskian and properties of given functions?
Having Wronskian (e.g. $2$ x $2$)
$$W(x)=\left|\begin{array}{c}f_1(x) & f_2(x)\\f'_1(x) & f'_2(x)\end{array}\right|$$
For example, the number of zeros, i.e., $W(x)=0$ is at most the number of zeros of the functions $f_1(x), f_2(x), \dots$, or anything similar.
I am trying to find any bound on number of zeros of any general Wronskian based on the functions. I am not interested in any sharp bound. Is there a result in literature regarding this problem?
Comment: @Amzoti I mean the second case, e.g. for 2x2 case $W(x)=f_1(x)f_2'(x)-f_2(x)f_1'(x)=0$ and I have some information about $f_1(x), f_2(x)$, and possibly about their derivatives (e.g. number of roots). And then I want to learn about the number of roots of $W(x)=0$ based on this information.
Answer: I don't think, you can conclude anything. Let us take a few examples.
Example $1$: Take $f_{1}(x) = x+1$ and $f_{2}(x) = x^{2}+1$
Then Wronskian, $W(x)=\begin{vmatrix} f_{1}(x) & f_{2}(x) \\ f'_{1}(x) & f'_{2}(x) \end{vmatrix} =\begin{vmatrix} x+1 & x^{2}+1 \\ 1 & 2 x \end{vmatrix} =x^{2}+2 x-1$
Now $W(x)=0 \implies x^{2}+2 x-1=0 \implies x= -1 \pm \sqrt{2}$
Clearly, there is no similarity of roots of $W(x)=0$ with $f_{1}(x)=0$ and $f_{2}(x)=0$. Now if you conclude that the number of roots of $W(x)=0$ is lcm (least common multiple) of the number of roots of $f_{1}(x)$ and $f_{2}(x)$, then take a look on the next example.
Example $2$: Take $f_{1}(x) = x+1$ and $f_{2}(x) = x-1$
Then Wronskian, $W(x) =\begin{vmatrix} x+1 & x-1 \\ 1 & 1 \end{vmatrix} = 2 $.
In this case if you make $W(x) =0$, then it a inconsistent and therefore how can you apply your previous finding to conclude this type of problem ?
Example $3$: Take $f_{1}(x) = \sin x$ and $f_{2}(x) = 2 \sin x$
Clearly, these two functions are linearly dependent and so here $W(x) =0$, again you can't apply your previous finding to conclude any thing.

Number of zeros of Wronskian


Criando uma lista com sublistas em c++

Question: Estou tentando criar uma lista com as sublistas (20.0  20.0  0.0) (36.0  150.0 0.0) (200.0 130.0 0.0) (215.0 20.0  0.0) em C++ e gostaria de uma ajuda pois não sei como juntar as 4 para formar uma lista. Eu preciso de algo como append em LISP.
Answer: #include <iostream>
#include <vector>

typedef std::vector<double> reals_list;

int main()
{
    std::vector<reals_list> list_of_lists;

    list_of_lists.push_back({20.0, 20.0, 0.0});
    list_of_lists.push_back({36.0, 150.0, 0.0});
    list_of_lists.push_back({200.0, 130.0, 0.0});
    list_of_lists.push_back({215.0, 20.0, 0.0});

    std::cout << list_of_lists[3][0]
        << ", " << list_of_lists[3][1]
        << ", " << list_of_lists[3][2] << std::endl;
}

Não pude deixar de notar que a lista interna sempre tem 3 elementos. Se for o caso, recomendo criar uma classe ou estrutura de tramanho fixo, que tem uma performance muito melhor que o std::vector, que é um vetor genérico de tamanho arbitrário. Exemplo:
#include <iostream>
#include <vector>

struct Vector3 {
    double x, y, z;
};

int main()
{
    std::vector<Vector3> list_of_lists;

    list_of_lists.push_back({20.0, 20.0, 0.0});
    list_of_lists.push_back({36.0, 150.0, 0.0});
    list_of_lists.push_back({200.0, 130.0, 0.0});
    list_of_lists.push_back({215.0, 20.0, 0.0});

    std::cout << list_of_lists[3].x
        << ", " << list_of_lists[3].y
        << ", " << list_of_lists[3].z << std::endl;
}

Comment: Nem me liguei de falar antes, mas no caso eu estou fazendo esse programa usando a biblioteca FDT para programar em um CAD.
Comment: Não conheço. Não sei como essa informação afetaria minha resposta.

Criando uma lista com sublistas em c++


EditText Multiline com linhas separadas por traços

Question: Tudo bem?
Gostaria que vocês me ajudassem em uma coisa:
Eu gostaria de ter um EditText com Multilines divididas em linhas.
O que eu quero dizer é o seguinte:
Quando criamos um EditText multiline (vamos colocar como exemplo um multiline com 4 linhas), ele deixa aquela traço embaixo para digitar lá em baixo na quarta linha, e todas as outras 3 linhas de cima ficam um espaço em branco.
Eu gostaria de ter 4 desses traços, um para cada linha do meu multiline, como se fossem 4 EditText um embaixo do outro.
Pensei em fazer exatamente como disse acima, usar 4 EditText e depois na hora de enviar os dados fazer: EditText1 + EditText2 + EditText3 + EditText4; porém, não sei como ficaria a questão de chegar no final do EditText1 e já descer para o 2 automaticamente.
Se alguem tiver uma sugestão, solução ou caso tenha ficado alguma dúvida, só mandar mensagem. Obrigado.
Answer: Bom dia tenta criar um componente que extensa de EditText e sobreescreva o onDraw para desenhas as linhas, conforme exemplo abaixo:
<code>public class LinedEditText extends EditText {
    private Rect mRect;
    private Paint mPaint;

    // we need this constructor for LayoutInflater
    public LinedEditText(Context context, AttributeSet attrs) {
        super(context, attrs);

        mRect = new Rect();
        mPaint = new Paint();
        mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
        mPaint.setColor(R.color.edit_note_line); //SET YOUR OWN COLOR HERE
    }

    @Override
    protected void onDraw(Canvas canvas) {
        //int count = getLineCount();

        int height = getHeight();
        int line_height = getLineHeight();

        int count = height / line_height;

        if (getLineCount() > count)
            count = getLineCount();//for long text with scrolling

        Rect r = mRect;
        Paint paint = mPaint;
        int baseline = getLineBounds(0, r);//first line

        for (int i = 0; i < count; i++) {

            canvas.drawLine(r.left, baseline + 1, r.right, baseline + 1, paint);
            baseline += getLineHeight();//next line
        }

        super.onDraw(canvas);
    }
}
</code>
no seu xml ao invés de usar o EditText usa com.exemplo.seupacote.LinedEditText
Esta sugestão foi retirado daqui.
Espero ter ajudado.
Comment: Olá amigo. Primeiramente obrigado pela ajuda. Eu criei essa classe que você disse "LinedEditText", e fui no xml da minha activity e mudei o EditText para "com.exemplo.meupacote.LinedEditText" como vc me sugeriu, porém, aparece alguns erros na pré-visualização: "The following classes could not be found". E a classe já foi criada, vc sabe como resolver isso? Obrigado.
Comment: Amigo, mil desculpas. Estava com erro mais eu  consegui arrumar dando "build" no projeto. Agora está do jeito que eu queria. Ainda não testei, mais já ficou da forma que eu queria. Muito obrigado pela ajuda...vou dar o teste final aqui e deixou o comentário final pra finalizar o tópico. Muito obrigado.
Comment: Funcionou perfeitamente cara. Muito obrigado pela ajuda.
Comment: Beleza, marca a resposta como resposta certa ^^ heheh obrigado


Chords notation question

Question: An article about Aeolian harmony on Wikipedia begins as follows:

Aeolian harmony is harmony or chord progression created from
  chords of the Aeolian mode. Commonly known as the "natural minor"
  scale, it allows for the construction of the following triads (three
  note chords built from major or minor thirds), in popular music
  symbols: i, ♭III, iv, v, ♭VI, and ♭VII

Why are the third, the sixths, and the seventh degrees chords written as flattened?
If I understand it correctly, if it's a minor, then these degrees are already flattened. Why are they written with flats?
Answer: This use of flats removes any and all ambiguity regarding the nature of these "three", "six", and "seven" chords. This is especially important when the Aeolian mode is being borrowed from in an otherwise major-key (or Mixolydian-mode, etc.) piece.
(Naturals can be used instead when these chords otherwise have roots with sharps in them. One example is ♮III of D major, which is a F major chord. Note that iii of D major is a F sharp minor chord.)
Answer: It seems as if the Wiki article is describing things from the point of view of the parallel major scale. Thus with C-major as the key of the section of music being discussed, chords taken from the parallel minor (C-minor, note that terms are different in other languages like German) need accidentals.
From a "common practice period, (c.1600 to c.1900)" any chord may occur in any key; the "functional meaning" of these chords is not necessarily the same as diatonic chords with the same root. I like to think of chords a being "tonic-oriented" or "dominant-oriented" or "subdominant-oriented" or "passing" chords. As long as the key is strongly confirmed (over the whole piece), one can use any number of non-diatonic (sort of like non-native) chords without disturbing the sense of key. Think of the II or II7 chord in a major key; it behaves as a V of V or a dominant of the dominant but doesn't seem to disturb any key feeling. Likewise (returning to the original question) the flat subdominant (iv) chord is quite common. In one of the common idioms in American popular music from the 1930s or so, things like I, I7, iv, II7, V7 patterns were commonplace. The II and iv (and I7) all need accidentals as they contain non-diatonic notes. There are lots of other examples (I, III7, VI7, II7, V7) or (I, IV, bVII, V) or (from a couple of country western pieces) (I, III7, IV, V) and (I, IV, II7, V7). Even the popular dominant 9th needs an accidental in C-Major (or C-minor): G-B-D-F-Ab.
The use of accidentals marks non-diatonic notes, but these need not mean a key change.

Chords notation question


Views show fields is set, but only "Content" options are available to select - why?

Question: Simple question. I thought I knew views, but right now I'm stuck. All I want is a view with the body field of a certain content type.
I have "Fields" selected:

But when I go to add a field, my options are severely limited:

(There is no such thing as a "Content: Body" option to select.)
What happened to the rest of the categories in the Filter dropdown? I'm missing something obvious here...?
Answer: The Content: Body field should be there as long as it exists in the content type.
A couple things you can try in this order:

Ensure all permissions are set properly
Flush all caches
Flush the views cache at /admin/structure/views/settings/advanced
Disable views cache just to see if that's an issue
Update Views

Here's a current issue of the problem
Comment: I had to disable views data caching (just flushing didn't work). I have seen other manifestations of this cache issue around the site (especially since we started working with solr for some reason) but hadn't connected the dots. Good to know about this issue; I had not seen it yet. Thanks.


How to predict values or estimate quantiles beyond the range of a sample?

Question: I am working with a small data set that is clearly non-Gaussian. This data is bound within a fairly narrow range. I have been asked to estimate the quantiles of the population that this data is from. I used the Wikipedia  for my reference (method R-4). This all went well. However, I was then asked to estimate the probability of a value occurring that is larger than any of the data in my sample set. It seems that quantile analysis gives you no information distribution of the population outside of your sample range. Is that correct? Is there another approach?
Comment: Say you have a sample of 10 data points. What is the chance that an 11th data point is greater than the 10 you have collected?
Comment: This is actually a tolerance issue. So I have 10 data samples that are well within the threshold. I am now asked what is the probability of exceeding the threshold value. Intuitively, it seems like I cannot estimate that number without a parametric model. I am just trying to see if I am missing something here.
Comment: The point made by @soakley might be even a little clearer if it is understood that it does not refer to the chance that the 11th point is the greatest one *conditional on the data* (the 10 points). That chance cannot be estimated, because these 10 points could be any subset of the population. But if you contemplate this event *before* data collection and ask for its chance, that can be estimated because all 11 values are random, independent, and identically distributed.  Moreover, if you also assume a continuous distribution, the chance can be computed exactly.
Comment: Do you need the probability that a newly observed point is beyond the already observed range, or you also need to know by how much?
Answer: In a comment to the question, @soakley writes

Say you have a sample of 10 data points. What is the chance that an 11th data point is greater than the 10 you have collected?

That points towards a solution, but there is a subtlety.  The chance in this quotation does not refer to the chance that the 11th point is the greatest one conditional on the data (the 10 points), even though that is how we might like to think of the situation. That chance cannot be estimated, because these 10 points could be any subset of the population. But if before you collect any data you were to contemplate the possibility that the 11th data point is (uniquely) the greatest, you could infer some useful things about the chance of that unconditional event.  The entire point is that the data are exchangeable: each has exactly the same chance of being the largest as any of the others.
If you assume a continuous distribution (so that a tie for largest has zero chance) the chance can be computed exactly.   Consequently each of the 11 values has the same chance of being the largest as any of the others and those 11 chances sum to unity.  The answer in this case therefore is $1/11$.
When ties in the data have nonzero chances, those 11 chances plus the chance of a tie sum to unity.  Therefore the chance of any given value being uniquely the greatest will be less than $1/11$ but the chance that is either greatest or tied for greatest must exceed $1/11$. Without knowing the chances of ties, that's about all that can be deduced, because the chance of being tied for greatest can approach $1$.  Imagine, for instance, a population of just zeros and ones, with many more ones than zeros: the chance that the 11th value equals 1, and therefore is among the greatest in the sample, can be arbitrarily close to $1$.
If we resolve ties randomly and equitably, the distribution of results becomes continuous and the preceding result again applies: the chance of being declared the greatest will be exactly $1/11$.


What is intuition behind the product rule of probability and independent events?

Question: I just bumped into a simple question. Let's say I want to compute the probability of taking both Math and Science courses (i.e., $P(M \cap S)$) given this information:
Total class size is 10;
7 students take Math and 5 students take Science.
Only one student takes neither of them. What is the probability that a student takes both Math and Science?
Then I know
$$
\begin{align}
P(M \cap S) &= P(M)+F(S)-P(M \cup S) \\ &=0.7+0.5-0.9 \\ &=0.3
\end{align}
$$
(easily derived from a Venn Diagram)
but wonder why I can't do $P(M\cap S)=P(M)\times P(S)=0.7\times 0.5=0.35$ in this case, even if $M$ and $S$ seem to be independent events but the result is different). What's the intuition behind the product rule, and why are the answers different?
Comment: You have the union and intersection switched in your formula.
Comment: Do [these Venn diagrams](https://brilliant.org/wiki/probability-rule-of-sum/) clarify it? N.B. You quoted the sum rule, not the product rule.
Comment: @AryaMcCarthy, Yes, Venn diagram clarifies it. It's for sure. But my question is why I can't simply multiply individual probability even if they are independent events.
Comment: @EricPerkerson, I know, but it is equivalent and necessary to compute the intersection.
Comment: @EricPerkerson It's not in the usual format, but it's still correct. Try adding $P(M \cup S)$ to both sides and subtracting $P(M \cap S)$ from both sides.
Comment: @Joe If they're indeed independent, then you _can_ do that. Please edit the question to include an example where the numbers didn't work out.
Comment: Oh, you're right, my mistake.
Comment: @AryaMcCarthy, sure I will do it right away.
Comment: @joe You've updated the post to include numbers; thanks! The events are [not independent](https://online.stat.psu.edu/stat800/lesson/how-do-we-check-independence), which is why you can't simply multiply probabilities.
Comment: @AryaMcCarthy, thanks Arya, my understanding is that taking math and science do not affect or interfere with each other, meaning *independence*. Could you explain why they are not independent?
Comment: They do seem to affect each other, based on the numbers you've shown. ([Independence is _defined_ in terms of the joint and marginal probabilities](https://online.stat.psu.edu/stat800/lesson/how-do-we-check-independence).) If they were independent, $P(M \mid S)$ would equal $P(M \mid \neg S)$ and $P(M)$. It wouldn't matter what value $S$ took when you consider $M$. But looking at the data, $P(M \mid S) = 3/5$, $P(M \mid \neg S) = 4/5$, and $P(M) = 7/10$. So knowing information about $S$ affects your knowledge of $M$, and vice versa.
Comment: @AryaMcCarthy, thanks for super simple and clarifying explanation. It makes a perfect sense:)
Comment: See also: https://stats.stackexchange.com/questions/517297/random-sampling-and-independence-in-a-real-world-problem/517317#517317
Answer: Turning my comments into an answer:
These Venn diagrams are a good starting point for understanding how the probabilities of two events interrelate.
If two events are indeed independent, then you can compute $P(A \cap B) = P(A) \times P(B)$. In fact, independence is defined in terms of these joint and marginal probabilities.
In the example you've shown, they're not independent: $M$ and $S$ affect each other. If they were independent, $P(M \mid S)$  would equal $P(M \mid \neg S)$ and $P(M)$. It wouldn't matter what value $S$ took when you consider $M$. But looking at the data, $P(M \mid S) = 3/5$, $P(M \mid \neg S) = 4/5$, and $P(M) = 7/10$. Knowing information about $S$ affects your knowledge of $M$, and vice versa.


Is TCP RWIN set by application or OS?

Question: I have a situation where an application is listening on a TCP port and every once in a while, as seen in tcp dumps, gets its Receiving Window (RWIN) set to zero. When this happens, its Recv-Q stops moving (because the sender stop sending) and the application thread listening on the connection/port just hangs. In WireShark, I see "ZeroWindow" states being produced, which happens when RWIN is set to 0 (a Window of size 0).
I'm trying to determine whether my application, which uses many open source libraries full of mysterious code, is manually setting it's connection's RWIN = 0, or if this is happening at the OS layer. If its the application, I have access to all the source code and with some hard work can properly debug it.
But if its the OS that says "hey, there is something wrong with this connection, setting RWIN to 0..." then I haven't a clue as to how to go about diagnosing. Any thoughts? Thanks in advance!
Comment: Either.  Here is an example of an application setting it on a per-socket basis:  http://stackoverflow.com/questions/2223825/setting-tcp-receive-window-in-c-and-working-with-tcpdump-in-linux
Answer: The receive window is calculated/set by the OS. Linux can change the memory available for receiving TCP packets with the net.core.rmem_max sysctl setting.
There are many pages for TCP performance tuning, for example this one:
http://fasterdata.es.net/host-tuning/linux/
Alas this will most likely not help you, as it just increases the amount of data that is buffered.
If the buffer is full the window size is set to 0. You have to look at your application for why it doesn't collect the data from the TCP buffer. Logfiles, start it in debug mode, etc. Not much you can do at the OS level for that.
Comment: Ahhh gotchya - so the Recv-Q buffer fills up (because the app isn't reading anything) and Linux automatically steps in and sets RWIN to 0 to prevent very bad things from happening, yes? As always, thanks @Sebastian!
Comment: Yes to the first part. To be correct, it's just signalling the sender that the receiving buffer is full and that it can't accept more data on the connection at the moment. So it's not really "preventing bad thing" more "preventing useless data transmission".
Answer: It really depends. You didn't specify what OS you're talking about but, under Windows (and I suppose, Linux as well), the TCP window size is typically handled by the TCP stack.
However, it is perfectly possible for some non-OS component to affect that as well. For instance:
- An application can influence the behavior of the TCP stack by specifying a non-default buffer size for the socket (SO_RCVBUF).
- An application could be using raw sockets and reimplement TCP in user mode (not sure why you'd want to do that, but it's possible).
Finally, you should know that getting a windows size of 0 is actually a normal condition: it indicates that one of the party already have a full data buffer and that it needs more time to process it.

Is TCP RWIN set by application or OS?


tensorflow_probability subclassing JointDistributionNamed __init__ behaviour

Question: I am trying to create a derived class from JointDistributionNamed in the tensorflow_probability library (tensorflow v2.0.0, tensorflow_probability v0.8.0). However, the super().__init__ function is behaving in a weird way that I don't understand. Maybe I am just using super() wrong, but it seems to work as I expect for other classes. Anyway here is an example:
from tensorflow_probability import distributions as tfd

models = {'normal': tfd.Normal(loc=0, scale=1)}
joint = tfd.JointDistributionNamed(models) # Works perfectly fine
print("joint:",joint)

class Test(tfd.JointDistributionNamed):
    def __init__(self,name,models):
        self.myname = name
        self.models = models
        super().__init__(models) #(1) Works
        #super().__init__(self.models) #(2) Doesn't work

t = Test('hello',models)
print("t:", t)

The behavior when giving models to super().__init__ is not the same whether I just pass models in or I first assign it to self.models. Why? In the latter case I get the following error:
Traceback (most recent call last):
  File "test_jointdistnamed.py", line 18, in <module>
    t = Test('hello',models)
  File "</home/farmer/anaconda3/envs/tensorflow/lib/python3.7/site-packages/decorator.py:decorator-gen-244>", line 2, in __init__
  File "/home/farmer/anaconda3/envs/tensorflow/lib/python3.7/site-packages/tensorflow_probability/python/distributions/distribution.py", line 276, in wrapped_init
    default_init(self_, *args, **kwargs)
  File "test_jointdistnamed.py", line 16, in __init__
    super().__init__(self.models) #doesn't work
  File "</home/farmer/anaconda3/envs/tensorflow/lib/python3.7/site-packages/decorator.py:decorator-gen-138>", line 2, in __init__
  File "/home/farmer/anaconda3/envs/tensorflow/lib/python3.7/site-packages/tensorflow_probability/python/distributions/distribution.py", line 276, in wrapped_init
    default_init(self_, *args, **kwargs)
  File "/home/farmer/anaconda3/envs/tensorflow/lib/python3.7/site-packages/tensorflow_probability/python/distributions/joint_distribution_named.py", line 170, in __init__
    model, validate_args, name or 'JointDistributionNamed')
  File "</home/farmer/anaconda3/envs/tensorflow/lib/python3.7/site-packages/decorator.py:decorator-gen-70>", line 2, in __init__
  File "/home/farmer/anaconda3/envs/tensorflow/lib/python3.7/site-packages/tensorflow_probability/python/distributions/distribution.py", line 276, in wrapped_init
    default_init(self_, *args, **kwargs)
  File "/home/farmer/anaconda3/envs/tensorflow/lib/python3.7/site-packages/tensorflow_probability/python/distributions/joint_distribution_sequential.py", line 211, in __init__
    self._model_unflatten(self._model_flatten(model))
  File "/home/farmer/anaconda3/envs/tensorflow/lib/python3.7/site-packages/tensorflow_probability/python/distributions/joint_distribution_named.py", line 186, in _model_unflatten
    return type(self.model)(**kwargs)
TypeError: __init__() got an unexpected keyword argument 'normal'

It's like it is trying to unpack the models dict somewhere inside the class hierarchy for some reason. But why the heck would that be different depending on whether I first assign to self? Aren't I passing a reference to exactly the same dictionary either way? What is different? Is this a bizarre bug or am I doing something wrong somehow? The exact same thing seems to work just fine if I make up my own simple custom class rather than JointDistributionNamed.
Answer: My hunch would be something to do with tf.Module dependency tracking wrapper objects for fields.
What is type(self.models)? If you change to self._models = self._no_dependency(models) does it work?


Is the following solution correct?

Question: Question: $ \sqrt{x^2 + 1} + \frac{8}{\sqrt{x^2 + 1}} = \sqrt{x^2 + 9}$
My solution: $(x^2 + 1) + 8 = \sqrt{x^2 + 9} \sqrt{x^2 + 1}$
$=> (x^2 + 9) = \sqrt{x^2 + 9} \sqrt{x^2 + 1}$
$=> (x^2 + 9) - \sqrt{x^2 + 9} \sqrt{x^2 + 1} = 0$
$=> \sqrt{x^2 + 9} (\sqrt{x^2 + 9} - \sqrt{x^2 + 1}) = 0$
So, either $\sqrt{x^2 + 9} = 0$ or $(\sqrt{x^2 + 9} - \sqrt{x^2 + 1}) = 0$
From the first expression, I get $x = \pm 3 i$ and from the second expression, I get nothing.
Now, notice how in the 2nd step, I could've divided both the sides by $\sqrt{x^2 + 9}$, but I didn't because I learned here that we must never do that and that we should always factor: Why one should never divide by an expression that contains a variable.
So, my question is: is the solution above correct? Would it have been any harm had I divided both the sides by $\sqrt{x^2 + 9}$?
Comment: If $x\ne\pm3i,$  we need $$x^2+1=x^2+9$$ which does not have a finite root
Comment: @labbhattacharjee So, my way of solving the problem is correct
Comment: "we must never do that": you can do it knowingly, in two steps: 1) hypothetize that the factor is zero and draw conclusions, 2) hypothetize that the factor is nonzero, and you are allowed to divide.
Comment: Your implication arrows claim only the direction that you do not need.
Answer: The equation says$$ \sqrt{x^2 + 1} + \frac{8}{\sqrt{x^2 + 1}}=\frac{x^2 + 9}{\sqrt{x^2 + 1}} = \sqrt{x^2 + 9}.$$
So either $x^2+9=0$ and $x=\pm3i$, or $\sqrt{x^2+9}=\sqrt{x^2+1}$, which is impossible (by squaring).
Answer: It would indeed , because then you wont have $x=\pm 3i$ as the root because that would make the denominator zero , which is the greatest offense one can do in algebra!! or more broadly in Mathematics (:P)
Answer: A suggested simplification. You should always look for simplifications to the algebra if they're easy to find.
Let $y = x^2 + 1$
Then you're solving $\sqrt y + \frac{8}{\sqrt y} = \sqrt{y + 8}$
$\frac{y + 8}{\sqrt y} = \sqrt{y + 8}$
$(y+8)^2 = y(y+8)$
$8(y+8) = 0$
From this, it should be obvious that $y = -8$ is the only root, giving $x^2 + 1 = -8$ or $x = \pm 3i$.
Answer: Try a different method.
Take $\sqrt{x^2 +1}$ on RHS Then rationalise $\sqrt{x^2+9}$ - $\sqrt{x^2 +1}$ by it's conjugate.
So your next step would be :
$\dfrac{8}{\sqrt{x^2+1}}$[$\sqrt{x^2+9}$ + $\sqrt{x^2 +1}$] =  8
So 8 gets cancelled. and next step is as follows:
$\dfrac{\sqrt{x^2+9} + \sqrt{x^2 +1}}{\sqrt{x^2+1}}$ =  1
and so we get $\dfrac{\sqrt{x^2+9}}{\sqrt{x^2+1}}$  + 1 =  1
And finally
 $\dfrac{\sqrt{x^2+9}}{\sqrt{x^2+1}}$ =  0
And only Numerator becomes zero so $\sqrt{x^2+9}=0$ hence $x=\pm3i$.
Answer: Yes it is correct.  It would do harm dividing out $\sqrt{x^2 + 9}.$  Perhaps an easier example of why this is so... Consider
\begin{equation}
x^2 = x.
\end{equation}
Obviously the two roots are 0,1, but do you see what happens when you divide by $x?$ You reduce the order of the polynomial, hence throwing away a root.
Comment: Out of curiosity: why was this answer downvoted?

Is the following solution correct?


Expected declaration specifier error in function

Question: New to the exchange so sorry if my formatting is off.
I am getting an error for "expected declaration specifiers" This is in the is_prime function I have defined at the bottom. Can you shed some light on this error and how to correct it?
#include <stdio.h>
#include <math.h>

main()
{
    int n;
    int k;
    int j;

//gets user input for length of string
    printf("Enter the value of n:");
    scanf("%d", &n);
//stores user input as n

    printf("Printing primes less than or equal to %d: \n", n);

    for(k = 2; k <= n; k++)
    {
        if(is_Prime(k) == 1)
        {
            printf("%d,", k);
        }
    }

   //here is the is_Prime function
{
int is_Prime (int k)

for(j = 2; j < k; j++)
    {
if(k%j != 0)
      {
    return 1;
      }

else if(k%j == 0)
       {
return 0;
break;
       }
    }
}

here are the output errors

main.c: In function 'is_Prime':
main.c:29:1: error: expected declaration specifiers before 'for'
 for(j = 2; j < k; j++)
 ^
main.c:29:12: error: expected declaration specifiers before 'j'
 for(j = 2; j < k; j++)
            ^
main.c:29:19: error: expected declaration specifiers before 'j'
 for(j = 2; j < k; j++)
                   ^
main.c:42:1: error: expected declaration specifiers before '}' token
 }
 ^
main.c:42:1: error: expected '{' at end of input
main.c: In function 'main':
main.c:42:1: error: expected declaration or statement at end of input

Comment: It's no use apologising about the formatting. If you had done so, you would have immediately seen where the missing closing, and opening braces are. Formatting isn't just to make the code "look nice", it's truly essential. Down voted.
Comment: I was apologizing about the formatting of my question not the code. I know most forums have a general way they expect a question to be asked.
Comment: Also, why do you have "else(k%j == 0)"?  Did you intend to have 'else if'?  You need to declare "int j" inside the function.  The break in the else block is superfluous (as is the for loop, as written), since it will always return from either the if or the else.
Comment: i have the break to stop is_prime function from executing further because k is not prime if that condition is met.
Comment: Try indenting your code properly, then the brace mismatch will be more apparent.
Comment: I agree that the question does present issues that could've been prevented by careful coding and the issues could've been discovered through taking time to better understand basic C structure. The typical advice to down-voted items is to edit the post. However, the comments suggest that the post should never have been asked. On the other hand, the comments/answers combined with the original question shed light on yet another cryptic gcc compiler error. If the OP or I were to edit the original posting, the meaning would be lost. What to do? (I guess this is a meta comment...)
Answer: You're missing the opening curly brace { for the is_Prime function.
Answer: You defined is_Prime inside the body of main. This is not possible in C.
Or alternately, you are missing a closing curly brace at the end of main's body.
The other problem was already mentioned in shf301's answer.


Tank Problem with Differential Equations (concentration output starts at a different t than the initial t)

Question: Problem: Consider a tank of $350$lts with $100$lts of pure water at $t=0$. At $t=0$, the tank begins to fill with a saline concentration that has $10$gr per lt, at a rate of $5$ lts$/$min. It continues to fill for $20$ minutes when suddenly a leak opens at the bottom of the tank where $2$ liters of contents per minute leak out. Calculate the salt concentration in the tank at the moment it reaches its maximum capacity.
My Solution: For $0\leq t \leq 20$ it is clear that the differential equation that models the salt concentration is:
$$\frac{dQ}{dt} = \frac{10 \cdot 5}{100+5t}$$
For $t \geq 20$ I proposed the following equation:
$$\frac{dQ}{dt} = \frac{10\cdot 5 - 2Q}{200+3(t-20)}$$
Here the explanation of this equation:
Salt rate in: $10gr/lt \cdot 5lt/min$
Salt rate out: $Q \cdot 2lt/min$
Volume (at $t=20$): $100+5\cdot 20 = 200$
Volume (after $t=20$): $200+(5-2)(t-20)$ because in $t=0$ I want to obtain $200lt$
Since the change of concentration is (rate in - rate out)/V(t), then:
$$\frac{dQ}{dt} = \frac{10\cdot 5 - 2Q}{200+3(t-20)}$$
However, my professor told me that there is a problem with this second differential equation and I don't realize what is the error.
Comment: Sure! let me edit the post.
Comment: Can you explain how you arrived at that second differential equation?
Answer:
Since the change of concentration is (rate in - rate out)/V(t)

I think this is the issue.  If $q(t)$ is the mass of solute (salt in this case), and $V(t)$ is the volume of solution, then
$$
    Q(t) = \frac{q(t)}{V(t)}
$$
If $V(t)$ is constant, then $Q'(t) = q'(t)/V(t)$, and your equation is satisfied.  But if $V(t)$ is not constant, then $Q'(t)$ is a more complicated expression involving $q'(t)$ and $V'(t)$.

It always seems easier for me to work with the mass of the solute instead.  If you need concentration, divide by the volume.  For $t > 20$, there is salt entering and leaving the tank.  The mass of salt going in is $50$ g/min.  Assuming that the solution is well-mixed (and this assumption is usually stated in the problem), the mass of salt going out is the concentration of salt in the solution, times the rate at which solution is leaving the tank.  So
$$
    \frac{dq}{dt} = 50 - \frac{q(t)}{200 + 3(t-20)}(2)
$$
The initial condition is $q(20) = 1000$.  You want to know $Q(t_*) = \frac{q(t_*)}{350}$ at the moment $t_*$ where $V(t_*) = 350$.


Does Godel 1st theorem make sense?

Question: It seems to me that there is 2 family of statements that I call "logically undecidable" (to distinguish with computationally undecidable which is define by turing machines), i.e. of statements for which it doesn't exist any proof that the statement is true nor a proof it is false :

The first family is defined like this : If you take a statement of this family, if you add it to the axioms as an axiom, you get a new consistent theory. And if you add its negation you get an other new consistent theory. A proof of such a statement has been done for the axiom of choice regarding ZF as theory.

The second family is defined like this : If you take a statement of this family, if you add it to the axioms as an axiom, you get an inconsistent theory (you can prove false), and if you add its negation you get an inconsistent theory too. I think any paradoxal statement, like the liar paradox, falls in this family.

A first question is : Does it really make sense to consider the statements of the second family as well defined ?
It seems to me that by accepting such a statement as well defined we are adding some incompleteness in the mathematics. Let's me explain, what arises to Godël 1st theorem if indeed these statements are considered as not well defined.
Let's say Godël is proving his 1st theorem from ZF, actually doesn't matter we could say he is doing the proof from axioms A and do the same reasoning with very acceptable hypothesis on A. Let's consider any problem proved as computationally undecidable, still from ZF, not necessarily the one Godel exhibits in his proof, let's consider the Halting Problem.
Let's show by contradiction that some part of the Halting Problem is actually independent of ZF. Assume that for any TM, there exists a proof that the TM halts or there exists a proof that the TM doesn't halt. But then you could solve the Halting Problem just like this : enumerate the proofs of ZF until you find either a proof that your input machine halts or a proof that your input machine doesn't halt. This is a contradiction since the Halting Problem is proved computationally undecidable. So, there exist a TM, let's call it U, such that the statement S : 'U halts on input x' is "logically undecidable". By the same method, for any computationally undecidable problem, it exists such a logically undecidable statement.
So now I am asking, in which of my 2 categories fall such a statement (any of them actually) ? If you add the statement to ZF, you get a theory $ZFS$ in which you can both prove S trivially and prove that you can't prove S (since the proof of undecidability still apply, you can still "write" it using the axioms of ZF in $ZFS$), so $ZFS$ is inconsistent. Well and if you add the opposite, you get a theory $ZF\overline{S}$ where you can prove both 'not S' and that that you can't prove 'not S', by exactly the same argument, so $ZF\overline{S}$  is inconsistent too. By the same method, all of these logically undecidable statement that come from computationally undecidable problems fall in the second family.
So what happens if we consider all the statement of the second family as not well define (which actually is pretty natural regarding the liar paradox) ? By contraposition, there is no longer something well define on which 1st Godël theorm apply ! Thus there is no longer any undecidable problem which is fully well defined, but you can restrict any problem to the inputs for which it is logically decidable and then the resulting restricted problem is both well defined and computationally decidable (still by enumeration of the proofs).
Even better : if we consider all the statement of the second family as not well define there is no longer anything on which the 2nd theorem of Godël apply and we could have the hope of proving the self-consistency of a well defined theory from this theory.
So my second question is, why, why are we considering such strange paradox like liar paradox as well define ? What does it add to mathematics except incompleteness ? Are you sure we really need that for anything ?
Philosophically, it seems to me that we are unnecessarily authorizing some local inconsistency and, since this inconsistency can not interact with anything, the all mathematics stay consistent, but become incomplete.
Comment: Liar paradox is NOT Gödel's Incompleteness Theorem.
Comment: About the "second family", we have to consider if adding either $S$ or $\lnot S$ to a theory T both resulting theories are inconsistent, this implies that T is already inconsistent.
Comment: Related: [Goodstein's theorem](https://en.wikipedia.org/wiki/Goodstein%27s_theorem): "a statement about the natural numbers, proved by R.Goodstein in 1944, which states that every Goodstein sequence eventually terminates at 0. Kirby and Paris showed that it is unprovable in Peano arithmetic (but it can be proven in stronger systems, such as second-order arithmetic). This was the third example of a true statement that is unprovable in Peano arithmetic, after Gödel's incompleteness theorem and Gerhard Gentzen's 1943 direct proof of the unprovability of $ε_0$-induction in Peano arithmetic."
Comment: Godel himself told in his 1931 article that his result is just a liar paradox, but let's just forget about liar paradox, I am mainly talking about Godël theorem.
Comment: "The first family"; it is exactly the nature of an **undecidable** statement $S$ with respect to a consistent theory T. If we add either $S$ or $\lnot S$ to T, both new theories will be consistent, if T is so.
Comment: If this is true, I am proving that ZF is inconsistent, could please show me where is my error ?
Comment: Gödel (1931) says: "the argument [Gödel's one] is closely related to the "Liar" too. We therefore have before us a proposition that says about itself that it is not provable [in PM]. [footnote: Contrary to appearances, such a proposition involves no faulty circularity."
Comment: I am not saying this circularity is faulty, I am saying it makes the mathematics incomplete and then I do not understand why we consider it.
Comment: First time I heard about Godël theorem, I though the problem came from something more that just all these unecessary, unusable circularities, but now I think no, it's just this. A aim of not considering them as well define could be to prove the self consistency of a theory, may be it's then possible.
Comment: As said, Gödel's sentence is not a "liar-sentence" and it is not circular. It is not paradoxical. The result of G's Th can be established also with other means and amounts to: **some** consistent theories have undecidable statements. In conclusion: YES, G's Th (1st and 2nd) make sense.
Comment: Then where is my error ? Because I am proving that Godel sentence is a liar sentence. I think both your definition of undecidable statement and the theorem saying that I am proving the inconsistency of ZF came actually from Godel theorem and your definition is no longer equivalent to mine if you consider Godel theorem to not apply on anything well defined.
Comment: So I am not proving in any way the inconsistency of ZF, nor the wrongness of Godël, I am just saying it adds incompletness to consider it as well define and I am asking why we add such an incompletness ? And also I am proving than Godel sentences are liar-sentences, but I may have done an error.
Comment: It may appear as different from liar-paradox because it's written as a diagonalisation, as a problem of counting, but actually what I am proving is that if you remove the liar-sentences the count has to be the same and  there is no possible diagonalisation with well defined (which mean not liar-sentences) sentences
Comment: What do you get by restricting everything to its not liar-statement part ? Well you get something with almost the expressive power of classical math, you are just losing Godel and some never used liar-sentences, you have well defined continuous functions, you have well defined reals, you are just exchanging incompletness with completness (and may be self-consistency).  A lot of things fall into "symbolic computation" but  in a way so that there isn't any perceptible loss on any usual theorem.
Comment: Interesting, I don't think my claim about liar statements are wrong, I don't think mathematics are inconsistent, I think there is some not evident liar-paradox, mostly when playing with numbers encoding. The Godel one was not totally easy to see as a liar paradox but some are even harder. We may have to expand sentences as very basic set theory to get an intuition of it.
Comment: Indeed, it might be an "logically undecidable" statement of the first family, for this one we have no proof it comes from a computational undecidability.
Comment: The fact for a statement S independent of a theory (including Peano) T to fall in the first family of in a liar-paradox family depends on your axioms. If your axioms are just T itself, then anything undecidable has the form of a liar paradox and actually you can not well define nor proof any undecidability of a sentence. If your axioms are something more than T, the well define undecidable sentences will be all this additional stuff and it will fall in the first category. So the Godël theorem is not well define for the axioms in which we prove it, that why it is not relevant for anything.
Answer: If the original theory is consistent, your second family is empty. If the original theory is inconsistent, all potential new axioms belong to the second family.
Comment: @François The incompleteness theorems are formulated in theories where you can't create the liar paradox or anything similar.
Comment: @François If $T\land p$ and $T\land\neg p$ both imply a contradiction, so does $T\land(p\lor\neg p)$, which is equivalent to $T$. Contrapositively, if $T$ doesn't imply any contradictions, there's no p for which $T\land p$ and $T\land\neg p$ both do. If $T$ implies a contradiction, so does $T\land p$ for any $p$, and therefore so does $T\land\neg p$.
Comment: @François A conjunction is always well-defined. As for the halting problem example, whether a given problem halts may well be undecidable.
Comment: Please take time to think because I am telling you something which is not very difficult but which is very new, and most of the results that anyone could oppose come actually from things which are not well defined in my theory.

Have you read the proof ? What are your axioms ? If what you say had to be well defined, ZF, or your axioms whatever they are as long as they are countable, are inconsistent.
Comment: Ok sorry then, but can you read the proof and tell me where is the error ? Because then I prove that ZF is inconsistent.
Comment: I think T ^ p could not be well defined either, that's why the all thing stay consistent and your point would not apply.
Comment: Except if p is not well defined.. which is the case for the liar paradox.
What I should have say at the begin, but I didn't realize.
Comment: You can define some fake liar paradox, but the Godel, trully self referent one, can't.
Comment: Then where is the problem in my proof ? The only axioms in which Godël theorem could be well defined are an uncoutable set of axioms.. All this complexity for what ?

Does Godel 1st theorem make sense?


What does it mean for a bass player to play "on the one"?

Question: I do not understand, as a bass player, what it means to "stay on the one", "on the five", etc.
What do musicians mean when they tell the bass player to "stay on the one", or any other number?
Comment: Do you have any links to people saying "the five"?
Comment: It could be many different things. If you're told to stay on the one, and you don't know what it means, why not ask the person what they mean?
Comment: You ask '*stay*' on the one, but the header says '*play*' on the one. Which is it?
Answer: This means the scale step, either of the current key, or more likely, of the current chord. Playing "one" means playing the root; "three" means the third above; "five" means the fifth above. For example on a G-major chord, one=G, three=B, and 5=D (and 7=F), etc.
Comment: @ToddWilcox The expression "on the one" is indeed ambiguous, but the OP mentions "staying on the one" and also "on the five", so that suggests scale steps, not beats.
Comment: @YourUncleBob: Why assume that people know what they're talking about, on a site where people ask questions about things that are unclear to them? That's a silly assumption. :) With approximately 58.2 % probability, the OP only assumed that "on the one" and "on the five" use numbers in the same sense. The "on the five" can be a completely made-up thing that was never actually said, but because he's confused, he took the number five from a different context. Or maybe it was said but it meant something different. Who knows.
Comment: Are you sure it's the scale step? I thought it was the first beat.
Comment: @piiperi Now you sound like House :-)
Comment: @ToddWilcox - if indeed it did mean the first beat, how could a bassist 'stay ' on it? I know some are really slow players, but...
Comment: @ToddWilcox - that's fine. Except OP asks *stay* on the one - which will have different implications (if any). It would obviate use of any anacrusis, for instance. I've questioned 'stay' and 'play', waiting for OP. Isn't Enter Sandman staring on the & of 4? (last 1/8).
Comment: Possible. I've always heard it on the scale step but there may be other (and even more widely spread) traditions.I'll withdraw my comments if beats are more common.
Comment: @piiperi - try not to assume anything! If it was beats, with 5 in the bar, the other emphasised note will be 3 or 4 usually... unless of course the 5 strays into the next bar 9in4/4) to substitute for beat 1 again..!
Comment: I suspect both senses of "the one" are used (i.e., first beat, tonic note), and in this case it is probably the tonic note, although when it's the bass it could easily go either way (as opposed to drums, where I would expect "the one" to be about rhythm and meter). That said, "the five" could confusingly refer to the third beat in 4/4 time that is being counted as 8th notes, or the second beat counted as 16th notes. This is especially possible if the speaker is used to step sequencing beats with 8th or 16th note resolution. The step button marked "5" could be what they mean.
Comment: @Tim "On the one" in my experience has meant either "neither ahead of nor behind the beat" or "not syncopated at the start of the measure". Some styles might call for not playing on the first beat of the measure, unless you're specifically asked to play on the one. E.g., The main riff to "Enter Sandman" by Metallica does not have a note that starts on the first beat of the measures, the riff starts on the 4& of the previous measure.
Comment: @Tim regarding Enter Sandman, that's exactly what I wrote. "4&"
Comment: @YourUncleBob - House is no mean piano player!
Comment: I would definitely say "stay on the root" to say don't play the fifth or third.
Answer: As per user48490's answer, when talking about playing in the rhythm section, the most usual meaning of "The One" is "the first beat of the bar":

James Brown often cued his band with the command "On the one!," changing the percussion emphasis/accent from the one-two-three-four backbeat of traditional soul music to the one-two-three-four downbeat. (
  https://en.wikipedia.org/wiki/Funk)

Legendary bassist Bootsy Collins explains here, in his own terms:

I don't think the expression "The five" is nearly as common - though I have heard people talk about playing "a five" or "the five" meaning a five-string bass guitar!
Could "the one" or "the five" mean a scale degree? Well, maybe - depends on the context. As a shorthand form, people do also say things like "1-3-5" to mean scale degrees; If you talked about a "one-five" bassline, people would know what you mean, and in context, playing "on the one and the five" might mean the same thing. However, I think "root-fifth" is more common if you're talking about scale degrees.
So as with a lot of musical terminology, you need to consider the particular context to work out what's meant.
Comment: This is the right answer.  Thought the OP did mention "on the five" etc.  The phrase relates to the beat.  James Brown.
Answer: In a lot of pop type music, the bass' job is to play one on one. Which means playing the root of the chord on the first beat of the bar.
Root note generally sounds more solid than any other, so on a bar of C, the bass plays note C. Usually on the first beat of the bar - regarded as the most impotant. Therefore playing the most important note on the most important beat. Yes, reggae et al uses different strategies, but this is 'standard' pop.
After the root (1), the next note expected from a bassist is the 5. So in that bar of C, the bassist could well play C then G, above or below. Staying on 1 will mean not playing 5 - or even 3, the other note usually associated with a triad. It certainly won't mean play on beat 5 (which doesn't get played in 4/4), or play on the 5th string of a bass!
If it's 'stay on the one', then it can't be 'stay on the 1st beat of the bar', and can only be 'stay on root', which may be because the chords change (to slash, maybe), and the root needs to stay constant, while the harmonies change.
It's maybe not the best way to describe what happens, as it's a little ambiguous, but a lot of bassists would understand and play what I've described. 'Stay on the root' makes more sense.
Comment: Any links to the "one on one" usage? Not denying it at all, just haven't heard it!
Comment: @topomorto - none! I've used it for years, as it's apposite and easily understandable - even for bass players!
Comment: Go on - explain the dv!
Comment: right now you're *on the one* downvote and *on the five* upvotes...
Comment: @topomorto - very droll! What can I say that won't cause offence?! Always been a distinct lack of humour on this site. Musos need to be serious!
Comment: @Tim -- the downvotes on the answers here seem curious. Maybe a serious musician is responsible, though there seems to be a bit of an inverse relationship between serious musicians and serious personalities....
Comment: @DavidBowling - hmm, well spotted - except the last answer... The asylum did mention a breakout, so it could be serious musos - or even serious personalities...I've now given up caring about 'unqualified' dvs. They mean literally nothing in useful terms, but I've said that (too?) many times. Roll on the revolution!
Answer: In funk music anyway, it refers to the first beat of each measure being accented. Also called the downbeat.You can play ahead or behind the beat elsewhere, but be on beat "on the ones".


Does Views RSS display deals with relationship

Question: I have a content type "Event" which has a relationship with the content type "Category", via the node reference field 'category_ref'.
The "Category" content has a field "Image".
I have figured out how to display the field "Image" in a page view listing the "Events" node, with relationship option on "Image" field.
It works just fine, except that I would like now to create a feed for this view, to export it on Facebook. But then, as there is no field to set up for RSS feed, I don't know how to fetch the image from "Category" and get it in my RSS.
The point where I'm stuck is that the relationship is set on the RSS display tab, but the image does not show.
Is there a way to do fetch datas from another content type than the one of the views via the RSS display of the Views interface?
Answer: It sounds like you want the Views RSS module.  It will add a new plugin that will allow you to map arbitrary fields to RSS elements at the channel and item level.

So, if your view is fielded out with the proper relationships already, you can just add a new display, map the fields, and assign it to a path, all in about 10 min.

The help in the module is also excellent.
Comment: Oh dear,
it is what I need indeed.
I have tried it and get the image displayed in my  tag easily enough.
It does not address the problem that RSS graffiti does not retrieve the image in its preview, though, so I guess I will have to try another to have it in another tag. Thank you anyway for your help, and the screenshots which was very helpful!
Comment: @Mat Double check the field settings.  You may need to adjust to be plain text in a few places, and use absolute URLs for the link and enclosure.
Comment: I have changed the image formatter accordingly to "plain_text_metatags", it has removed the markup around my link. And I've set absolute URL for both field "link" and "image". Finally, I get the URL of my picture wrapped by  tags. But it does not seems to change anything on RSS graffiti. It seems to me it is the proper way format for the enclosure tag. Isn't it?


How to create two nodes at a time?

Question: I have one cck content type and two fields in this content type 1. is First name 2. is Last name i am trying TODO when i fill this these fields and click on save button Automatically create Forum topic with the name of first name text box value.
 how it is possible ? plz help
i am using Drupal 6
Answer: You can do it easy with the Rules module.
Answer: <code>//Load and init the Drupal System
require_once 'includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
require_once 'modules/forum/forum.admin.inc';

function fourm_activities_form_alter(&$form, &$form_state, $form_id)
{
my_debug($form_id);

  if($form_id == 'testing_forum_node_form')
  {
    global $base_url;
//      my_debug($form);
    //add function to complete to at the end of array

    if(arg(2) && arg(2)!= 'edit')
    {
        $form['buttons']['submit']['#submit'][]='fourm_activities_form_id_submit_handler';
    }
  }
}
    function fourm_activities_form_id_submit_handler($form, &$form_state)

    {
        $name   =   $form['nid']['#post']['field_test'][0]['value'];

        $test_nid = $form_state['nid'];

        global $user;

        $newNode            = (object) NULL;
        $newNode->type      = 'forum';
        $newNode->title     = $name;
        $newNode->uid       = $user->uid;
        $newNode->created   = strtotime("now");
        $newNode->changed   = strtotime("now");
        $newNode->status    = 1;
        $newNode->comment   = 0;
        $newNode->promote   = 0;
        $newNode->moderate  = 0;
        $newNode->sticky    = 0;

        node_save($newNode);
        $final_nid =    $newNode->nid;

        $node = node_load($test_nid);
        $node->field_forum_reference[0]['nid'] = $final_nid;
        node_save($node);

        //$form_state['clicked_button']['#post']['field_forum_reference']['nid']['nid'] = $newNode->nid;

}
</code>
Comment: I don't understand what I'm seeing here. Why are you bootstrapping Drupal? Is this a stand-alone php script? In that case, it's not a real module and I don't see how your form_alter implementation could work like this. You may want to read some pages from the [Module Developers Guide](http://drupal.org/developing/modules).

How to create two nodes at a time?