What Sort Of Movement Is This?

Question: I apologize since I have a rather basic understanding of music theory.
But I refer to the what's going in the treble clef with the descending notes. One line is the same while another is descending. I understand that, but how would I think about this in terms of chords and non chord tones? Each measure has a chord like Dm or G, so does that mean every note that is not part of that chord is a non chord tone? If so, then what about what kind of non chord tone it is (Like I see stuff that approaches and resolves with leaps).
Answer: The entire right-hand passage is an extended, descending scale — with some notes octave-displaced — interspersed with pedal tones. All of the non-chord tones are passing tones.
Measures four and six are a bit deceptively labeled. For analytical purposes, these are seventh chords, not triads, in which the seventh is introduced as a suspension (pedal tone) from the previous measure, then resolving normally (down a step) in the next.
Comment: This is perhaps a good example of chord symbols being practical rather than analytical.  That is, they're telling a guitarist (or someone) what to play rather than trying to represent everything that's happening in the staff notation.  The presence of the seventh doesn't necessarily mean that this is a seventh chord, but here it is so prominent that the conclusion is inescapable.  If only the lower pitches of the right hand were present, there would be a better case for the alternative analysis.  I wouldn't call it a pedal tone, though.
Answer: In classical theory we could call the B a (nonchord) Lower Auxiliary Note. The G could be analyzed as a nonchord passing note in Am or as part of an Am7 chord.
Though in this example the main characteristic of the C, B, A, G line is that it's simply a scale.  'Jazz theory' has a rather more liberal attitude to what is considered an 'outside' note. It equates chords with scales, and as all those notes are in the Am scale they can be freely used against an Am chord without requiring any further excuse.
Comment: @t_t yes, though reasonable people might reasonably disagree about which chord prevails at any given time, therefore (equivalently) disagreeing about which tones are non-chord tones.  The most obvious example would be a seventh, which could be a non-chord suspension, passing tone, etc., or could be a chord tone.
Comment: @t_t I think the concept of a "non-chord tone" makes more sense in analyzing some music more than others. Not all music has chords in the first place. In some music, if we hear a note, it becomes part of the chord and so we could say there are no non-chord tones. "Non-chord tones" are most useful for the analysis of tonal music such as was composed in Western Europe between the Middle Ages and the mid 19th century. Outside of that music, the concept may or may not be meaningful or useful. This composer's work might not be best analyzed using these concepts.
Comment: Any note not part of the chord a measure is in is a nonchord tone by definition right?
Comment: While the B being between two Cs does make it seem like a lower auxiliary, I'd go with the second analysis, that the r.h. is logically two parts, of which one is CBAG etc., making the B a passing tone.

What Sort Of Movement Is This?


How many football teams have won the treble?

Question: Winning the "treble" means winning the three main titles of the season:

Continental championship (e.g. Champions League)
National league championship
National cup title

How many teams in the history of football have won the treble?
Comment: Everton did the treble in 1985!
Comment: @user6300 It was not the Champions League Everton won in 1985, it was 'just' the UEFA Cup Winners' Cup.
Comment: @Phab still counts as a treble
Comment: Wikipedia: https://en.wikipedia.org/wiki/Treble_(association_football)
Answer: If instead of "European Championship" you mean the continental championship of the continent where the team is located (since it is not possible for any team outside of Europe to win the European championship) then the answer is:

Santos (Brazil) - 1962
Celtic (Scotland) - 1967
Englebert (DR Congo) - 1967
Cruz Azul (Mexico) - 1969, 1997
Ajax Amsterdam (Netherlands) - 1972
Vita Club (Zaire) - 1973
MC Algiers (Algeria) - 1976
Liverpool (England) - 1984
Defence Force (Trinidad & Tobago) - 1985
PSV Eindhoven (Netherlands) - 1988
Manchester United (England) - 1999
Hearts of Oak (Ghana) - 2000
Al-Ahly (Egypt) - 2006, 2007, 2020
Auckland City (New Zealand) - 2006, 2014, 2015, 2020
Waitakere United (New Zealand) - 2008
Barcelona (Spain) - 2009, 2015
Internazionale (Italy) - 2010
Esperance (Tunisia) - 2011
Bayern Munich (Germany) - 2013, 2020
Hienghène Sport (New Caledonia) - 2019
Al Hilal (Saudi Arabia) - 2020
Manchester City (England) - 2023
Comment: I'm not sure whether Liverpool could be considered to have won the Treble in '84. They only won the League Cup, which isn't considered to be England's primary cup competition.
Comment: +1 for making the answer much more appropriate for the worldwide audience, although it does seem to decrease the standard of the club/team that has accomplished this feat.
Answer: The following teams have won a treble:

Celtic - 1967
Ajax - 1972
PSV - 1988
Manchester United - 1999
FC Barcelona (2) - 2009, 2015
Internazionale - 2010
Bayern München (2) - 2013, 2020
Manchester City - 2023
Comment: I'll add link to a Wikipedia article relevant for this: [Treble (association football)](http://en.wikipedia.org/wiki/Treble_%28association_football%29#Continental_Treble).


NodeJS - How to wait until fs.WriteStream is closed

Question: I have some code that I need to wrap with mine, the original code is creating a WriteStream this way -
function createLog() {
    this.stream = this.fs.createWriteStream(this.logFilePath, {flags: 'a'});
    this.stream.write('log content');
    this.stream.close();
}

function testLog(){
    this.createLog();
    // Here I want to wait until the file is closed
    // something like this.stream.waitToBeClosed();
    let text = fs.readFileSync(this.logFilePath, 'utf-8');
    return text.match(
        `log content`
    );
}

then, in the end of the function the stream is closed using -
this.stream.close()

I need to use that function, and then examine the log file and verify it contain all the required data, but unfortunately sometimes the last lines are missing.
I believe it's because the stream is still not closed when I open the file for reading.
I know that I can use stream.on('finish'... to execute code when the stream is closed, but I am not supposed to touch the createLog code... (As I am writing a test for it) and before the execution of the createLog function I have no access to the stream object.
Is there a way that I can wait until the stream is closed from outside the original function?
Comment: Please show us the whole function that contains this code.  It's unclear from your description why you can just use the `finish` or `close` events.  Perhaps we need to see more context or know more about what you can and can't modify (and why).
Comment: Are you sure it is a close issue? Did you try a fsync? https://nodejs.org/api/fs.html#filehandledatasync
Comment: @jfriend00 added code snippets to the post, is it more clear now ?
Answer: If you really can't modify createLog() to provide the caller a means to know when it's done (which is really the right way to do things), then because the stream is in the instance data, you could modify testLog() like this:
async function testLog() {
    this.createLog();
    // wait for the stream to complete its work
    await new Promise((resolve, reject) => {
        this.stream.on('close', resolve).on('error', reject);
    });
    let text = fs.readFileSync(this.logFilePath, 'utf-8');
    return text.match('log content`);
}

Note, that testLog() is now async and thus will return a promise that resolves with the text.match() results.


Axler Proof of Real vs. Complex Spectral Theorem

Question: In Professor Axler's Linear Algebra Done Right, he separates the proof of the spectral theorem for normal operators on a complex v.s. from the spectral theorem for self-adjoint operators over a real v.s., and I am wondering if each proof also works for the other case.
To my understanding, sketches of the proofs are as follows:

Normal operator $T$ on a complex v.s.:
$T$ has an eigenvalue $\lambda$. Schur's theorem says we can express $T$ as an upper triangular matrix (apply the inductive hypothesis of Schur's theorem to the range of $T - \lambda I$ and complete the basis). Result that $||Tx|| = ||T^*x||$ for normal operators gives the result.

Self-adjoint operator $T$ on a real v.s.:
$T$ has an eigenvalue $\lambda$. Apply the inductive hypothesis of the spectral theorem to the orthogonal complement of the span of an eigenvector (allowed to do this because this is a $T$-invariant subspace) to get result.

It seems to me like the key result is showing the existence of eigenvalues, and each proof would work for the other case (to apply (2) to normal operators, we need to verify that the complement of an eigenspace is $T$-invariant if $T$ is normal). I just want to make sure I'm not missing some subtlety that explains why Professor Axler separated these 2 cases.
Thank you!
Comment: You are correct. In finite dimensional vector space, we want to know what operators can be diagonalised under the standard orthonormal basis.
If the field is $\mathbb{R}$, the operators are self-adjoint. If the field is $\mathbb{C}$, the operators are normal. These proofs are similair.
Answer: Although the proofs of the finite-dimensional complex spectral theorem and the finite-dimensional real spectral theorem can be forced into a unified proof, it seems to me that there are enough distinctive features so that separating the two cases leads to better understanding.
For example, the result that if $T$ in normal then $\|Tx\| = \|T^*x\|$, which is crucially used in the proof of the complex spectral theorem, plays no role in the proof of the real spectral theorem.
As another example, the existence of an eigenvalue for a normal operator on a complex vector space has no connection with the operator being normal, while the existence of a real eigenvalue for a self-adjoint operator on a real vector space is a crucial (and nontrivial) part of many proofs of the real spectral theorem.
For what seem to me to be optimal proofs of the real spectral theorem and the complex spectral theorem, see 7.29 and 7.31 in the new fourth edition of my book Linear Algebra Done Right, which is legally available for free at https://linear.axler.net/.
Comment: Professor Axler, Thank you very much for your explanation and wonderful book! It is so cool to get to hear from you directly :)


Group chats and private chats, seperate table or single table with type attribute?

Question: Currently I have a table users, a table chats, however I want there to be "Group chats" and "Private chats (dm)".
A group chat needs more data than a private chat, such as for example: Group name, picture, ....
What is the best way to approach this?
Do I make 1 table chats, and put a type attribute in there that deteremines if it is private or not and leave some columns blank if it is a private chat. OR Would I make 2 tables one for private chats, and one for group chats?
Answer: This is a similar scenario to the general question "should you split sensitive columns into a new table" and the general answer is the same, it is going to depend largely on your data access code and your security framework.
What about a third option, why not just model a Private Chat as a Group Chat that only has 2 members in the group?. Sometimes splitting the model into these types is a premature optimisation, especially in the context of a chat style application. For instance, couldn't a private chat benefit from having an image in the same way that a group chat does? Could there not be some benefit to users being able to specify a group name to their own private group?
You will find the whole development and management of your application a lot simpler if there is just one type of chat and it is up to the user to decide how many people can join or indeed if other people can join the chat.
If you still want to explore the 2 conceptual types this is this is an answer that might give you some indirect insights: https://stackoverflow.com/a/74398184/1690217 but ultimately we need additional information to justify selecting one structure over the other. Performance, Security and general data governance are some considerations that have implications or impose caveats on implementation.
From a structural point of view, your Group Chats and Private Chats can be both implementations of a common Chat table, conceptually we could say that both forms inherit from Chat.
In relational databases we have 3 general options to model inheritance:

Table Per Hierarchy (TPH)
Use a single table with a discriminator column that determines for each row what the specific type is. Then in your application layer or via views you can query the specific fields that each type and scenario needs.

In TPH the base type is usually an abstract type definition

Table Per Type (TPT)
The base type and each concrete type exists as their own separate tables. The FK from the inheriting tables is the PK and shares the same PK value as the corresponding record in the base table, creating a 1:0-1 relationship. This requires some slightly more complicated data access logic but it makes it harder to accidentally retrieve a Private Chat in a Group Chat context because the data needs to be queried explicitly from the correct table.

In TPT the base type is itself a concrete type and data records do not have to inherit into the extended types at all.

Simple Isolated Tables (No inheritance in the schema)
This is often the simplest approach, if your tables do have inheritance in the application logic then the common properties would be replicated in each table. This can result in a lot of redundant data access logic, but the OO inheritance in the application layer following DRY principal solves most of code redundancy issues.

This answer to How can you represent inheritance in a database? covers DB inheritance from a more academic and researched point of view.

From a performance point of view, there are benefits to isolating workloads if the usage pattern is significantly different. So if Group Chats have a different usage profile, either the frequency or type of queries is significantly different, or the additional fields in Group Chat would benefit from their own index profiles, then splitting the tables will allow your database engine to provide better index management and execution plan optimisations due to more accurate capture of table statistics.
From a security and compliance point of view, a single table implementation (TPH) can reduce the data access logic and therefore the overall attack surface of the code. But a good ORM or code generation strategy usually mitigates any issues that might be raised in this space. Conversely TPH or simple tables make it easier to define database or schema level security policies and constraints.
Ultimately, which solution is best for you will come down to the effort required to implement and maintain the application logic for your choice.
I will sometimes use a mix of TPT and TPH in the same database but often lean towards TPT if I need inheritance within the data schema, this old post explains my reasoning against TPH: Database Design: Discrimator vs Separate Tables with regard to Constraints. My general rule is that if the type needs to be polymorphic, either to be considered of both types or for the type context to somehow change dynamically in the application runtime, then TPT or no inheritance is simpler to implement.
I  use TPH when the differences between the types is minimal and not expected to reasonably diverge too much over the application life time, but also when the usage and implementations are going to be very similar.
TPT provides a way to express inheritance but also maintain a branch of vastly different behaviours or interactions (on top of the base implementation). many TPT implementations look as if they might as well have been separate tables, the desire to constrain the 1:1 link between the records is often a strong decider when choosing this architectural pattern. A good way to think about this model, even if you do not use inheritance at the application logic level, is that you can extend the base record to include the metadata and behaviours of any of the inheriting types. In fact with TPT it is hard to constrain the data records such that you cannot extend into multiple types.

Due to this limitation, TPT can often be modelled from the application layer as not using OO Inheritance at all
TPT complements Composition over Inheritance

TPH is often the default way to model a Domain Model that implements simple inheritance, but this introduces a problem in application logic if you need to change the type or is incompatible with the idea that a single record could be both types. There are simple workarounds for this, but historically this causes issues from a code maintenance point of view, it's a clash of concepts really, TPH aligns with Inheritance more than Composition
In the context of Chat, TPT can work from a Composition point of view. All chats have the same basic features and interactions, but Group Chat records can have extended metadata and behaviours. Unless you envision Private Chat having a lot of its own specific implementation there is not really a reason to extend the base concept of Chat to a Private Chat implementation if there is no difference in that implementation.
For that reason too though, is there a need to differentiate between Private and Group chats at all from a database perspective? Your application runtime shouldn't be using blind SELECT *  style queries to access the data in either case, it should be requesting the specific fields that it needs for the given context, whether you use a Field in the table, or the Name of the table to discrimate between the different concepts is less important than being able to justify the existence of or the difference between those concepts.
Comment: Thankyou for thorough explanation, and for explaining me terms I had never heard about, but now know about :)
Comment: I guess the real answer to your question is that if this is your _"Hello World, I'm a Developer"_ project, then you should try this a number of ways. Really try to fully implement the application, then compare your experience. To see the performance difference will take a very large load of data so you won't easily see that, but for most other aspects the schema for a simple scenario like this is the trivial element. All the strategies discussed here are valid, it is your data access logic that will guide you on choosing a specific implementation.


does a commutative diagram implies pull-back?

Question: Let $\xi=(E,p,B),\xi'=(E',p',B')$ be fibre bundles. Let $f: B\to B'$, $\bar f: E\to E'$ be maps such that the diagram commutes
$\require{AMScd}$
\begin{CD}
    E @>\displaystyle\bar f>> E'\\
    @V \displaystyle p V V\# @VV\displaystyle p' V\\
    B @>>\displaystyle f> B^{\,\prime}
    \end{CD}
Does this alway imply that $\xi$ is isomorphic to the pull-back bundle ( the pull-back bundle, denoted by $\eta$, of $\xi'$ to $B$ through $f$ is: $E(\eta)=\{(b,e')\mid b\in B, e'\in E' \text{ such that } f(b)=p'(e')\}$, $p(\eta)(b,e')=b$, $B(\eta)=B$) of $\xi'$?
Comment: No. The dimensions don't even have to match.
Comment: I'm not fluent enough with bundles to write down a particular example, but the answer should be no; all you should know is that there is a unique map $\varphi$ from $\xi$ to the pull-back bundle such that $\overline{f}$ is $\varphi$ composed with the map from the pull-back to $E'$, and similarly for $p$. This is the universal property of the pull-back; see http://en.wikipedia.org/wiki/Pullback_(category_theory).
Answer: No, that would imply that all fiber bundles are trivial:
Let $p\colon E\rightarrow B$ be a fiber bundle. The unique map from a one point set to a one point set is a fiber bundle too and one gets a commuting diagram of the shape
$$
\begin{array}{ccccccccc}
E & \xrightarrow{} & \{*\} \\
%
\downarrow & & \downarrow \\
%
B & \xrightarrow{} & \{*\}
\end{array}.$$
Since pullback bundles of trivial bundles are trivial, your claim would imply that $E\rightarrow B$ is trivial.
Answer: If you add the hypothesis that $\bar f$ restricts to a homeomorphism on each fiber, then it is true that $\xi$ is isomorphic to the pullback bundle. To see this note that the total space of the pullback bundle is
$$f^*E' = \{(b,e')\in B\times E': p'(e') = f(b)\}.
$$
Define a bundle map $\phi\colon E\to f^*E'$ by
$$
\phi(e) = (p(e),\bar f(e)).
$$
Then the hypotheses guarantee that $\phi$ is a bijective bundle map covering the identity of $B$, and it is continuous because $p$ and $f$ are. You can show that $\phi^{-1}$ is continuous by expressing it locally in terms of local trivializations.
Comment: If I'm not mistaken, this is always the case when both bundles are principal $G$-bundles (for the same $G$).
Comment: @MichaelAlbanese — that's true provided $\bar f$ is $G$-equivariant, but otherwise it might not be.
Comment: Sorry, that's what I meant.
Answer: Propably the most enlightening answer would be the following:
among all such $E$ that you get a commutative diagram as above, the best one (i.e. the universal one) would be the pullback (intuitively speaking). This is in fact the categorical definition of a pullback. You should check the catsters' video on youtube on this topic!
What this implies, is that given your $E$, you will be a unique map to the pullback $f^*E'$ s.t. it commutes with all the relevant maps involved.


I cannot send HTML mail using "{{ node.body.value }}"

Question: I use Drupal 9 and the Rules module to send emails when an Article node is updated.
I installed the Mimemail module and set the formatter to mimemail;  all the field are correctly rendered. Only {{ node.body.value }} displays the HTML markup in the mail directly.
The rule settings are the following.
Hello, {{node.field_unit}} !

New Message Alert!

id:{{ node.field_id }}

mail:{{ node.field_mail }}

type:{{ node.field_type }}

time:{{ node.created }}

subject:{{ node.title }}

content:

{{ node.body.value }}

The received email is rendered like in this screenshot.

These are the value stored in the database.

I'm not sure how to solve this.
Could anyone help me?
Answer: Instead of .value use .processed to get the formatted output:
{{ node.body.processed }}

Comment: In some circumstances you might have to use a filter to prevent Rules from sanitizing the output:  `{{ node.body.processed | format_text("full_html") }}`
Comment: Hello, I try {{ node.body.processed }}, the tags will show in the mail.
And I try {{ node.body.processed | format_text("full_html") }} it will show an error in logs --->Missing text format: "full_html".

Type filter
Date 2022 7 4 - 11:52
User        admin
Location https://192.168.7.173/node/148/edit?destination=%2Ffeedback
Source https://192.168.7.173/node/148/edit?destination=/feedback
Message Missing text format: "full_html".

But I do enable the full_html format
Do you have any idea how may this occur? Thanks!
Comment: Go to /admin/config/content/formats/manage/full_html - this should exist if you have a filter with the machine name "full_html". If it DOES exist then I don't know why you're getting that error. That error will be generated by the core filter module when a filter plugin with the machine name "full_html" can't be found. It wouldn't hurt to clear your cache ...
Comment: yes I do have the format machine name as full_html... I don't know why either. Anyway thanks for your reply. I'm using business rules instead.
Comment: I'm not sure why, but this solution works for me only when I use single quotation marks around `full_html`: `{{ node.body.processed | format_text('full_html') }}`. Just mentioning this in case it will help someone else.


Do altered chords ever imply any notes?

Question: With extended chords...
Cm13 implies that the 7th is present and that the 9th and 11th can also be played.
Now if we write Cmb13 does this also mean that the 7th is present and that the 9th and 11th can also be added OR does it mean that the b13 is an addition and thus the 7th, 9th and 11th are NEVER played? Must the chord be written as Cm11b13 for 7th to be present and the 9th to be optionally implied?
EDIT: I'm leaning towards accepting arcioko's answer as it is the only yes or no answer to what I believe is a simple question.
EDIT2: I'll reword the question to make it simpler. Cm9 always implies that the 7th must be played. Is that also true for Cmb9?
EDIT3: Dekkadeci's comment on arcioko's answer is the answer I was looking for. I can't accept a comment as the answer though.
EDIT4: I have flagged this question as a duplicate of Does an altered 9th/11th/13th imply the full tertian stack? thanks to Dekkadeci's comment. Thank-you all.
Comment: Copied from comments below, seems very relevant to understand the OP question "I'm writing a chord identifier based on notes and need to know if it is possible or not."
Comment: see edit2 for the question simplified. And yes I'm writing a chord identifier. There are problems and/or omissions in every single chord identifier I've looked at. I aim to fix every single one of those issues.
Answer: Cmb13 only implies the b13 note, you are right in that the chord must be written as Cm11b13, this is why chords like C7#9 or C13b9 are notated the way they are, this is because if it was like that there would be no why of knowing if the chord was C Eb G Bb D F Ab or just C Eb G Ab.
Note: A better way of notating it would be Cmaddb6, or Cm(b6)
Edit: Also, nother thing that happens is that you dont know the quality of the seventh, sure you could say that its minor based on the third but it could also be major
Comment: @greatwhitepine My personal rationalization is that the altered symbols shorthand out the word "add" as well as specifying the modification.
Comment: @greatwhitepine - Answers in https://music.stackexchange.com/questions/114974/does-an-altered-9th-11th-13th-imply-the-full-tertian-stack, including https://music.stackexchange.com/a/114977/37354 and https://music.stackexchange.com/a/114991/37354, outright state that chords like G9 and C#11 imply that the 7th must be played.  The topmost of the two indicates that Cmb9 should be interpreted like the others and have an implied 7th, while the bottommost pretty much outright states this.
Comment: I find it extremely odd that extensions imply other notes but alterations above 7 don't seem to. Logic?
Comment: Your answer does seem to fit with my experiences analyzing classical music (where V13 in C Major indeed only implies G-B-D-E), but I bet other users will disagree about your answer and say that G13 implies G-B-F-E.
Comment: @user45266 Have you ever seen anyone think that a Cmb9 implies that the 7th must be played, ever? That's the only thing I need to know. I'm writing a chord identifier based on notes and need to know if it is possible or not. That's it.
Comment: @Dekkadeci That is precisely the answer I was looking for TYVM! Now if only I could accept your comment as being the correct answer I would. Can you add this as an answer to my question so I can accept it?
Comment: @greatwhitepine No, I have not. In my experience, any parenthetical notes are automatically considered "added" and have no other implications. Even with no parentheses, the chord symbol is clear, since the chord nomenclature I subscribe to dictates that *only natural extensions imply lower extensions*. Thus, there is a difference between Cm7b9 and Cmb9. Not all musicians agree, I would guess, but I like this system because it leaves no room for misinterpretation. Pretty much everyone would agree on Cm(addb9), and I would hold that Cmaddb9, Cm(b9), and even Cmb9 are all synonymous.
Comment: I've never seen anyone claim that Cmb9 REQUIRES the seventh, but I would not be surprised to hear the minor seventh included in practice.
Comment: @Dekkadeci That first answer is posing a thought experiment on why altered extensions *would not* imply the seventh: "altered ninth chord will include the 7, example G7♭9. There doesn't seem to be a logical reason [...]". As such, it reaches the conclusion that G9 implies the seventh, but C#11 (sic) would not (assuming root erroneously understood to be on C rather than C#).
Comment: Actually, the distinction arises because of the need to visually separate the root part of the chord from the extensions. By always presenting at least the seventh chord followed by any other notes, this problem is avoided. In any case, the second answer also argues against the claim you make: "C#11 means a chord with C# as a root, flat 7, natural 11. **If you wanted C7 with sharp 11, you should rather write C7#11"**. I don't think either answer supports the claim that Cmb9 implies the seventh. Rather, they seem more in line with the claim that Cm7b9 (with seventh explicit) would be necessary.
Comment: @Dekkadeci I'm not saying you're wrong, I just don't think those answers you linked to give any credibility to your position. At least one answer on this question has gone for the seventh being implied, so I don't doubt some will agree with your interpretation of the symbol.
Comment: @user46266 - That's where my "the bottommost answer pretty much outright states this" comes from - the "C#11 means a chord with C# as a root, flat 7, natural 11" statement. It argues that any odd numerical extension above 7 implies the 7th. I *really* don't think it's a stretch to replace C# with Cm and 11 with b9 and watch the same apply.
Comment: @user45266 - The bottommost answer also states that "For C with major seventh and sharp 11 write Cmaj7#11, CΔ#11 or similar." I *really, really* don't think it's a stretch to replace CΔ with Cm and #11 with b9 here and watch the 7th still be implied.
Comment: @Dekkadeci *"I* really *don't think it's a stretch to replace [...] 11 with b9"* Well, there's our difference in interpretation right there, I think - good to have that sorted out. That second point is convincing, but the triangle symbol could also be interpreted as meaning "maj7" rather than just "maj", so another opinion point arises there. I do see how the links can go for your argument now, though!
Comment: I have flagged this question as a duplicate of https://music.stackexchange.com/questions/114974/does-an-altered-9th-11th-13th-imply-the-full-tertian-stack thanks to Dekkadeci's comment. Thank-you all.
Comment: This answer should address the oddness of a `b13` figure, the way that JohnBelzaguy's answer did. Also, if the concern is about exactly what tones get played the OP should have given specific tones. If `C Eb G Ab` is desired, an `addb6` is just as odd as a `b13`. The reason for the oddness, the reason it isn't normally found is, aurally, it sounds like a `maj7`. `Abmaj7/C` will give those tone without oddness. Someone might voice that with `9` or `6`, but to the extent that is a problem, you're trying to remove interpretation from jazz. Notate on staff if you don't want interpretation.
Answer: You will find many different opinions, some of which are similar and some which conflict on this subject. The bottom line is there is no perfect universal list of rules when it comes to writing chord symbols. Yes there are guidelines but since chord symbols don't specify exactly what notes to play in what order there will be interpretations and liberties taken. For example, many musicians will sometimes add 9's or 13's to chords that don't have them in the symbol or add a b9 or a b13 to a dominant chord resolving to a minor chord. If you give 10 pianists or guitarists a C7 you will likely get at least 7 or 8 different results, and more than a couple will have added or omitted notes.
Regarding your specific example, the thing about Cmb13 is that it is ambiguous. Altered intervals (b9, #9, #11, b13) should carry the 7th or maj7th in chord symbols (should you desire a 7th) for clarity (Cm7b13) if you don't want the 7th you should use "Cm(add b13)". The other thing is it is an unusual chord symbol so most people seeing it will at least do a brief double take. They will ask themselves the same question you asked here but in a split second and then react one way or the other. It is more common to have a raised 5 than both a 5 and a b13 in a minor chord (Cm#5 or Ab/C).
Familiarize yourself with whatever fairly standard chord naming conventions there are and then:

Be as clear and specific as possible
Don't make assumptions about how your chord symbols will be interpreted
Expect that people will take certain liberties with your chord symbols at times
If you want specific notes and voicings, write them out.
Comment: My answer is ambiguous? Really? Natural tensions, 9,11,13 imply a m7, I don't argue that. Altered tensions, b9, #9, #11, b13 are rarely if ever written with some type of 7 preceding them in my experience. As a matter of fact I have never encountered a Cmb9 or a Cmb13 in years of doing gigs and reading charts. I gave you an answer that is not ambiguous but rather explains a way to make sure what you write gets played properly. Also I answered your question based on the original and not the edited version.
Comment: Ok, so my question is can altered chords such as Cmb9 imply that the 7th is played. Cm13 always implies the 7th must be played. There is nothing ambiguous about a Cm13 other than the 9th and 11th which are subjective. Your answer is ambiguous. It seemed like such a simple question.
Comment: Yep, it was. My original question was clear and you didn't answer it so I made the question as simple as possible. You just clarified your answer. Thanks for your input.
Comment: P.S. 9,11,13 don't always imply a m7... could be maj7 or a dim7 too... depends on the quality. Again, thanks for your input.
Comment: No problem, 9 11 and 13 contain a m7 unless you specifically indicate maj7 or otherwise. That's what I meant.
Comment: …also sometimes what appears to be a simple question requires some details in order to answer it in a meaningful way.
Comment: I gave all the details that were required. My question was concise. I found a way to shorten it just for you.
Comment: Your question was clear and concise, I never said otherwise.
Comment: @greatwhitepine, IMO you question wasn't clear or concise, it a jumble. You have `9`, `13`, `b13`, `add` all combined in one question. The answer to your title is a simple "yes." The rest of the details cry out for a tutorial about how jazz symbols are used in practice. And this answer gives a good summary.
Answer:
I'm writing a chord identifier based on notes and need to know if it is possible or not.

I think this is the question really to be answered here...
I assume we're speaking about jazz/popular music chord names (as Dekkadeci pointed out, other naming conventions exist).

Chord symbols are not really meant to indicate the exact notes to be played by the musician. They leave room for interpretation: dropping or adding notes and choosing the actual voicing. A skilled musician may reharmonize the song on the fly. On the contrary, I guess you want the chord finder to output symbols as accurate and unambiguous as possible. It should be noted that these will likely not be the same as chord symbols typically used in practice.

It is very common for musicians to omit notes in chords. Even a simple Cm can be played as two notes, C and Eb. Especially in very small ensembles with one–two musicians, harmony movement might be barely hinted. C7 might easily become E-Bb. Chords might be played melodically rather than harmonically. Guessing the underlying harmony might be an impossible task for a program that only interprets the vertical structures.

Omitting notes is even more common in larger bands. A guitar may play Eb-G-Bb, which one would call Eb, but if bass plays C, it adds up to Cm7.

Chord naming convention (and music notation in general) is based on practice and historical conventions, rather than logic. It is also very much focused on western popular music. What it implies, it's not really feasible to label any given group of notes with a compact chord symbol. Chord symbols are meant for chords that are actually used in western popular music.

In particular, I can't recall seeing a minor chord with flat 9 in jazz standard repertoire. You'd think that it's a diatonic chord built on the third step of a major scale... but somehow it's not used. So I'm following more intuition than experience. I'd say that Cmb9 does contain flat 7. I'm not sure how would I play it as a musician. Normally fifth is the first one to go, but in this case it creates a very interesting dissonance with b9, so maybe I would drop Eb? Also, C-Eb-G-Bb-Db could be interpreted as Eb13... in such ambiguous cases the voicing may matter much for how the chord is interpreted.
Concerning Cmb13, a minor chord with 6 is typically written as Cm6. I guess you could write Cmb6, but again, this is not a typically used chord (at least not in pop/jazz repertoire)... and C-Eb-G-Ab might likely be heard as Abmaj7.

does it mean that the b13 is an addition and thus the 7th, 9th and 11th are NEVER played?

b6 is addition, but it won't stop a musician from adding 9, or b7 if they feel like it... I think Laurence summarized the naming/performance rules well.
Answer: The 'pile of 3rds' is implied - except when it isn't!
C9 and C13 are assumed to be extensions of C7 rather than extensions of C.  However, the 11th is normally omitted.   When the 7th is not present, we use C(add9) and C(add13).  Or C6.  All of this applies equally to Cm9, Cm(♭9) etc.
C11 MIGHT mean the 'pile of 3rds' up to and including the 11th, but it's more likely to label a C7(sus4), C9(sus4) or B♭/C chord.  Functionally equivalent but quite different colours.   So be careful if you're tempted to write C11.
There's no real system to this.  Just various conventions of useage.
Comment: While this is useful it doesn't answer my question. Can Cmb9 imply that the 7th is present? Cm9 does.

Do altered chords ever imply any notes?


Why the imaginary part of $e^{-(a+jw)t}$ can't affect the limit as $t$ goes to infinity?

Question: I am learning the Fourier Transform. For a signal,
$$
x(t) = e^{(-at)} * u(t), \; a>0
$$
we know the FT of it is
$$
X(jw) = \frac{1}{a + jw}
$$
During the computation of the FS, we substitute the $t$ with infinity and $0$ to get the result of the integration:
$$
e^{-(a+jw)t}
$$
How do we know when t goes to infinity the result goes to zero?
I know if $$z = e^{-at}, \; a>0$$ $z = 0$ when $t$ goes to infinity. But the previous one has an imaginary part. Why the imaginary part can't affect the result when t goes to infinity?
Thanks!
Answer: Welcome, Hao Wu!  I assume that by $ j $ you mean the imaginary unit; it might be good to explain that in the question, since in math we usually use $ i $ for this.
Anyway, $ e ^ { - ( a + j w ) t } = e ^ { - a t } \big ( \cos ( w t ) - j \sin ( w t ) \big ) $, right?  As $ t \to \infty $, both $ \cos ( w t ) $ and $ \sin ( w t ) $ remain between $ - 1 $ and $ 1 $.  So we can write $ - e ^ { - a t } \leq e ^ { - a t } \cos ( w t ) \leq e ^ { - a t } $ for the real part and $ - e ^ { - a t } \leq - e ^ { a t } \sin ( w t ) \leq e ^ { - a t } $ for the imaginary part, and since both $ - e ^ { - a t } \to 0 $ and $ e ^ { - a t } \to 0 $ as $ t \to \infty $, it follows that both $ e ^ { - a t } \cos ( w t ) \to 0 $ and $ - e ^ { - a t } \sin ( w t ) \to 0 $ as well.  Since both the real and imaginary parts of $ e ^ { - ( a + j w ) t } \to 0 $, this means that $ e ^ { - ( a + j w ) t } \to 0 $ itself.
Or more briefly:  $$ e ^ { - ( a + j w ) t } = e ^ { - a t } \big ( \cos ( w t ) - j \sin ( w t ) \big ) = e ^ { - a t } \cos ( w t ) - e ^ { - a t } \sin ( w t ) \, j \underset { t \to \infty } \longrightarrow 0 [ - 1 , 1 ] - 0 [ - 1 , 1 ] j = [ 0 , 0 ] - [ 0 , 0 ] j = 0 - 0 j = 0 \text , $$ where $ [ a , b ] $ stands for any and all numbers between $ a $ and $ b $.
Comment: Let me add a side comment on $j$ symbol: FT is a common tool in signal analysis & processing, and signals are often generated & processed by electric & electronic devices. In electric & electronic engineering $i$ is reserved for electric current, hence the need for a different symbol for the imaginary unit.
Comment: Thank you!!! I understand it.
Comment: @HaoWu :  You're welcome!  If you like the answer, then you can upvote it by hitting the up arrow next to it; and you can also hit the checkmark to accept it, which will keep it at the top if more answers come in.  (But you can also move the checkmark to a different answer if a better one comes along.  The checkmark is for your own questions, one answer each; the upvote arrow is for anybody to use on anybody's questions for as many answers as they think are good.)


Access Hive tables and dump the query to txt file

Question: I am trying to access hive table and dump the result back into text file. And when I try to do this, I always get the permission denied? Is there something I am missing?
bash-3.00$ 'select * from ATTRIBUTE_DATA_REALTIME LIMIT 10' > test.txt
bash: test.txt: Permission denied

And what permission I need in this case? Or my query is wrong?
Comment: can you try "INSERT OVERWRITE LOCAL DIRECTORY '/tmp/local_out' select * from ATTRIBUTE_DATA_REALTIME LIMIT 10"? (if it works then maybe you use a user that doesn't have permissions to the HDFS
Answer: Firstly — you're missing a hive -e. With what you have now, Bash will look for a program named select * from ATTRIBUTE_DATA_REALTIME LIMIT 10!
But as for the permissions issue, there are two possibilities:

If test.txt already exists, then you need to run your command as a user that has permission to write to the file. (Use ls -l test.txt to see who owns the file and what the permissions on it are.)
If test.txt doesn't already exist, then you need to run your command as a user that has permission to write to the directory containing the file, i.e., the current directory. (Use ls -ld . to see who owns the directory and what the permissions on it are.)
Comment: text.txt file doesn't exists. So I use the command (ls -ld) you gave me. I got this message- `bash-3.00$ ls -ld
drwxr-xr-x   2 bin      bin          122 Jun  1 19:40 .
`
Comment: @RaihanJamal: Then your command is trying to create a file in a directory owned by `bin` that is *not* group-writeable and *not* world-writeable, and you're running the command as a user who is *not* `bin` and is *not* `root`. You'll need to change one of those things: either run your command as the user who owns the directory, or change who owns the directory, or change the permissions, or run in a different directory, or whatnot. See http://www.dartmouth.edu/~rc/help/faq/permissions.html for a brief tutorial on Unix file-permissions.


Is it common that a 7th chord or 9th chord played missing root note and 3rd note?

Question: Is it common that a 7th chord or 9th chord played with missing root note and 3rd note? If not
for 7th chords, is it the case for 9th chords?
Comment: I think this is done with major 7th chords in [Magic in the Air](https://www.youtube.com/watch?v=5Zp7KkY6OB8) by Badly Drawn Boy. The piano plays the root note C and then a chord of the notes G and B (i.e. just the fifth and major 7th), then in the next bar it's a root note of F followed by a chord of the notes C and E (likewise). To my ears they are clearly major 7th chords, though perhaps this isn't what you have in mind because the root note is played, *before* the chord.
Answer: Particularly for a dominant 7th/9th type chord, omitting the third would be unusual since this loses the tritone between the third and seventh which give the characteristic effect. In general the third is not usually omitted since it defines whether the chord is major or minor.
Omitting the root is common. Omitting an unaltered fifth is probably the most common.
Comment: Not according to the Beatles...
Comment: @Tim Third and seventh are all you need.
Comment: In an ensemble situation, I can concur that someone can leave out the root, as someone else would play it. But a single player? Can't agree. 5th definitely.
Comment: Potato Tomato. You can definitely omit the root of a dominant chord. That happens all the time.  That's what a vii* chord is.  Because it still has the leading tone and the tritone, it retains its dominant function.  Therefore, V7 and vii* are both valid interpretations. If it's not a dominant chord, then this doesn't apply, so its identity would change (eg ii7 w/o the root would just be IV).
Comment: Some times a chord needs to be stated more fully than others.  I'd like to hear the root at a cadence.  In a run of chords, maybe it can be implied?
Answer: If you omit the root and the third, the chord will likely change its identity. So for example:

Cmaj9 would become G
C9 would become Gm
Cminmaj9 would become G
Cm9 would become Gm
C7b9 would become Gdim
Cm7b5b9 (Cø7b9) would become Gb

and so on.
This may work, but it would be more likely perceived as reharmonization, rather than a change of voicing. So it's a bit more substantial change.
However, it might be perfectly fine for a single instrument in a band to play incomplete voicing, especially when the other instruments play the missing notes. This may work very well for the upper structures and altered chord tones. Voicings with less notes often sound better.
Still, as PiedPiper said, this might be not the most common choice.
Answer: In a dom7 type chord, the minimum 'shell' voicing is the root, 3rd and 7th.  If you're playing alone, the root probably needs to be there, in a band the bass player may be taking care of it (and might be quite happy if you left it to them!)  If the 9th, 13th etc. are important, I guess you'd better play them as well (but be aware they might be being covered by a melody instrument).   So, as so often, 'it all depends...'.   Leaving out the 5th is a pretty safe bet though.
Comment: In e.g. a C major duet, a resolution which resolves from F-B to E-C is often more satisfying than one which resolves from G-B to G-C or E-C, or one that resolves from F-G to E-C.
Answer: What would a seventh chord be called if there was no root? And the 3rd is paramount - is it major or minor? So, basically, without the root, it's not called that particular 7th (or 9th), and without the 3rd, it's not a m7 (m9), so it's not the same named chord whatever. So, in essence, the root, 3rd and whatever extensions will define the chord in question. Why wouldn't they?
Comment: I dunno. There are occasional two note voicings that are just 3rd and 7th. If you have the context of the surrounding tonal center then a 3rd and 7th can be all you need. You can get away with a root and 7th only in the same situations for the same reasons. But leaving out both is unlikely to be heard as the intended chord.


Significance of association between categorical variables

Question: I am analyzing survey data collected among plant breeders. I want to know if there is any association between some of the variables we collected, namely their perception of climate change and the region where they work.
I have 200 answers from breeders who belong to one out of 6 regions.
They were asked about 10 climate change parameters (drought, rainfall, temperature, etc.). For each of these, their answers could be "increased", "no change", "decreased".
I want to know if breeders' perception of each climate variable is significantly related to their region of work. I'd like to know this to be able to say, for example, that breeders working in East Asia are observing a greater increase in rainfall than those in Central America.
I am working in R.
I have tried creating contingency tables between breeders' regions and each climate variable using CrossTab from the gmodels package, but I am not sure how to interpret the output (in a table with so many relationships, what does the significance level apply to?). Also, most of my cells (well over 60%) have expected frequencies < 5 which I understand makes the test less reliable.
I have tried fisher test but I get error messages about a too small workspace, which I am not sure how to solve, and in any case I don't know if this is a good test either.
I would appreciate your help in choosing the best statistical method for my objective.
Comment: welcome to stats.stackexchange.com. Indicate part of your output. You are interested in comparisons and perhaps not in association-measure.
Answer: Because your dependent variable is ordinal in nature, you probably want to use an analysis that accounts for this fact. A chi-square test of association knows that "increase" is different than "decrease" but doesn't know that "increase" > "no change" > "decrease".
If you want to analyze each question separately, an appropriate test would be a Cochran-Armitage test expanded to more than two categories, which is available in R with the coin package.  Note that appropriate measures of effect size include Freeman's theta and epsilon-squared.
If you want to include all the questions in a single analysis, you probably want to use ordinal regression, which is available in R with the ordinal package.  You could include an independent variable for Question-number and one for Region.  However, there may be a problem with interpretation here, since an "increase" in "rainfall" is not likely to be commensurate with an "increase" in "drought".  You may want to reverse the scales on some questions so that all the "bad" outcomes are on the same end of the scale.  The ordinal regression will allow you to look at differences among Regions, among Questions, or among the Region x Question interaction.


A Fourier Transform Which Is Cartesian Separable

Question: We say that the Fourier transform of a complex-valued function $f\in L^{1}(\mathbb{R}^{n})$ is separable if there exist single-variable functions $g_{1},\ldots,g_{n}$ such that
$$g_{1}(\xi_{1})\cdots g_{n}(\xi_{n})=\widehat{f}(\xi), \text{   $\forall \xi=(\xi_{1},\ldots,\forall\xi_{n})\in\mathbb{R}^{n}$}$$
If $g_{1}(0)\cdots g_{n}(0)=\int_{\mathbb{R}^{n}}f(y)dy\neq 0$, then it is not hard to verify from Fubini's theorem that
$$g_{j}(\xi_{j})=\widehat{f_{j}}(\xi_{j}), \forall \xi_{j}\in\mathbb{R}$$
where
$$f_{j}(y_{j})=\dfrac{1}{g_{1}(0)\cdots g_{j-1}(0)g_{j+1}(0)\cdots g_{n}(0)}\int_{\mathbb{R}^{n-1}}f(y)dy_{1}\cdots dy_{j-1}dy_{j+1}\cdots dy_{n},$$
for $j=1,\ldots,n$. Whence by the injectivity of the Fourier transform, $f_{1}\cdots f_{n}=f$ a.e.
What happens, though, if we drop the assumption that $\int_{\mathbb{R}^{n}}f\neq 0$? If $\widehat{f}\in L^{1}(\mathbb{R}^{n})$, then it follows from Fubini's theorem that each $g_{j}\in L^{1}(\mathbb{R})$, whence $f=g_{j}^{\vee}\cdots g_{n}^{\vee}$ a.e. (i.e. the product of the inverse Fourier transforms). This seems like an unnecessarily strong assumption.

Question If the Fourier transform of $f\in L^{1}(\mathbb{R}^{n})$ is separable, is $f$ almost everywhere equal to a separable function?

I tried reducing the problem to the case $f\neq 0$ by writing in terms of positive and negative parts ($f=f_{+}-f_{-}$), but I couldn't get anywhere with this approach.
Comment: Since the Fourier transform of a tensor product of tempered distributions is the tensor product of the Fourier transforms, we know that $f=g_{1}^{\vee}\otimes \cdots \otimes g_{n}^{\vee}$; but I don't know what $g_{j}^{\vee}$ is, besides a tempered distribution.
Answer: For convenience, we consider the case $n=2$; the general case is completely analogous. Suppose $f\neq 0\in L^{1}(\mathbb{R}^{2})$. Then $\widehat{f}$ is not identically zero, whence there exists a point $(\xi_{1},\xi_{2})\in\mathbb{R}^{2}$ (an open ball, in fact, by the continuity of $\widehat{f}$) such that $\widehat{f}(\xi_{1},\xi_{2})=g_{1}(\xi_{1})g_{2}(\xi_{2})\neq 0$. We can therefore write
$$g_{1}(\eta_{1})=\dfrac{\widehat{f}(\eta_{1},\xi_{2})}{g_{2}(\xi_{2})}=\dfrac{1}{g_{2}(\xi_{2})}\int_{\mathbb{R}}\left(\int_{\mathbb{R}}f(x_{1},x_{2})e^{-2\pi i\xi_{2}x_{2}}dx_{2}\right)e^{-2\pi i\eta_{1}x_{1}}dx_{1}, \quad \forall \eta_{1}\in\mathbb{R}$$
and
$$g_{2}(\eta_{2})=\dfrac{\widehat{f}(\xi_{1},\eta_{2})}{g_{1}(\xi_{1})}=\dfrac{1}{g_{1}(\xi_{1})}\int_{\mathbb{R}}\left(\int_{\mathbb{R}}f(x_{1},x_{2})e^{-2\pi i\xi_{1}x_{1}}dx_{1}\right)e^{-2\pi i\eta_{2}x_{1}}dx_{2},\quad \forall \eta_{2}\in\mathbb{R}$$
Now define single-variable functions $f_{1},f_{2}$ by
$$f_{1}(x_{1})=\dfrac{1}{g_{2}(\xi_{1})}\int_{\mathbb{R}}f(x_{1},x_{2})e^{-2\pi i\xi_{2}x_{2}}dx_{2}, \quad  f_{2}(x_{2})=\dfrac{1}{g_{1}(\xi_{1})}\int_{\mathbb{R}}f(x_{1},x_{2})e^{-2\pi i \xi_{1}x_{1}}dx_{1}$$
By Fubini-Tonelli, $f_{1}$ and $f_{2}$ are measurable functions on $\mathbb{R}$ which are finite a.e. Moreover, since $f_{1}$ is dominated a.e. by $g_{2}(\xi_{2})^{-1}\int_{\mathbb{R}}\left|f\right|dx_{1}$ and analogously for $f_{2}$, we conclude that $f_{1},f_{2}\in L^{1}(\mathbb{R})$; whence, $f_{1}\cdot f_{2}\in L^{1}(\mathbb{R}^{2})$. By using Fubini's theorem again, it is easy to see that $\widehat{f_{1}}=g_{1}$, $\widehat{f_{2}}=g_{2}$, and $\widehat{f_{1}f_{2}}=g_{1}g_{2}$. From the inejctivity of the Fourier transform, we conclude that $f=f_{1}f_{2}$ a.e.


Div dentro de outra div quebrada

Question: Como inserir uma div dentro de outra div sem que nenhuma delas faça a quebra de linha.
Quero fazer desse jeito pois estou em desenvolvimento de um website de clan e no index tem que ter o botão de login ou registro, eu fiz isso mas quando fui rodar o html ele fez a quebra de linha da 2a div.

Registro

Entrar

  <div id="loggedin" style="display: <?php echo $logged_display; ?>"><?php echo $logged_in_user; ?>

Answer: Você pode inserir uma classe, para manipular no css.
E vc pode definir que elas estejam dipostas inline, conforme o exemplo:

.menu
{
  display: inline;
}

Registro

Entrar

  <div id="loggedin" style="display: <?php echo $logged_display; ?>"><?php echo $logged_in_user; ?>

Answer:

.row {
 display: table;
 width: auto;
 border-spacing: 5px; /*cellspacing:poor IE support for  this*/
 margin: 20px auto 0 auto;
}

.form-group-col {
 float: left; /*fix for  buggy browsers*/
 display: table-column;
 margin: 0;
 width: auto;
 display: table-column-group;

}

    Texto 01

    Texto 02

Answer: Você pode usar o float:left no CSS do div register para evitar isso.

#register { float:left; }

Registro

Entrar

De forma mais elaborada pode fazer como o Mayllon Baumer disse ou até usar um framework CSS para cuidar do Grid.
Answer: Cada elemento no HTML possui uma propriedade display, no caso do
 o display é definido como block por padrão. O block "diz" a cada elemento que o possui para sempre começar em uma nova linha, no caso do
(divisão) a propriedade faz jus ao seu nome.
Existem outros valores que você pode definir para display, um deles é o inline. Veja mais sobre a propriedade display aqui
No seu caso, por se tratar de um menu, faz mas sentido, ao invés de encapsular os links em um
, colocar dentro de uma estrutura de menu, própria para isto. O menu (
) possui seus itens (
). Os
 por padrão, também possuem o valor block, mas se tratando de semântica visual, faz mais sentido dizer que um
 é inline do que um
.
Neste caso, uma vou deixar uma dica/exemplo de como poderia fazer isto:

#menuBarWidget li {
    display: inline;
}

            Registro

            Entrar

    <div id="loggedin" style="display: <?php echo $logged_display; ?>">
        <?php echo $logged_in_user; ?>

Div dentro de outra div quebrada


How do I find the modular inverse of $5^\space mod \space 26$?

Question: I used the following formula to answer the question;
$$\frac{((x∗k)+1)}{n},$$
where $x=(1,2,3...N)$. If the result of the formula is an integer then that result is the inverse to n mod k. In this case n=5 and k=26. So I found that when $x=1$ the result is $5.4$. When $x=2$ the result is $10.6$. When $x=3$ the result is $15.8$. When $x=4$ the result is $21$. 21 is an integer so $5∗21=1 \space mod\space 26.$
Can anyone explain whether $N=26$ in this case, because we are dealing with Mod $26$?
Comment: I think that you need to get a deeper understanding of the topic (which goes far beyond the simple memorisation of facts and formulae). So, I would advise you to read a good book on number theory (please, feel free to ask for some references). Besides, you can find many lecture notes available for free online (again, feel free to ask for references).
Answer: Yes, $N=26$ in your case, and in general $N=k$ in your algorithm.
On a side remark, you could have quickly noticed that $5\times 5 \equiv 25 \equiv -1$ so $5 \times (-5) \equiv 1$ mod $26$.
On the general case I would recommend using the extended Euclidean algorithm rather than the method you described for calculating inverses as it is significantly faster and deep.
Comment: Oh, you're actually right. I didn't really see the purpose of this bruteforce algorithm and was too focused on Euclid algorithm so I didn't try hard enough to understand...
Comment: I thought when you  multiply a number by its inverse you should only get 1. When you do $5×5≡25≡−1 \space mod \space 26$, can you use -1 because we are looking at the magnitude of the number and not the sign of it?
Comment: No, I just state that if $5 \times a \equiv -1$, then $5 \times (-a) \equiv 1$ so the inverse of $5$ is $-a$. It's just a trick using that I immediately saw $26 = 5\times 5 + 1$. Also, there is no magnitude with residues.
Comment: I don't think $N=26$ here. You don't have to go that high. Please see my post.
Answer: No, $N \neq 26$ in your example.
Every number $n$ coprime to the modulus $k$ has exactly one unique inverse $i$ in the range $1 \leq i \leq k-1$.
Imposing those bounds, we get:
$$1 \leq \frac{xk + 1}{n} \leq k-1$$
$$\lceil \frac{n-1}{k}\rceil  \leq x \leq \lfloor\frac{n(k-1)-1}{k}\rfloor$$
So in your case, you only had to test $x = 1, 2, 3, 4$.
To make things slightly simpler, you can just take the lower bound as $1$ and the upper bound as $n$. This will be fine for small values of $n$, where you don't do too much "extra" work.
I would point you toward the Extended Euclidean Algorithm as a much more efficient way of calculating the modular inverse. A nice implementation is the 'magic box' method.
Answer: To find the modular multiplicative inverse x of 5(mod 26), you must solve the equation
x = 5^(-1)(mod 26)
5x = 1(mod 26)
5x = 105(mod 26)
x = 21(mod 26)
The inverse is 21. If you multiply a number by its inverse, you get 1.
21*5 = 105, but 105(mod 26) = 1.


How to reorder array of dates?

Question: i have this array of dates and trying to reorder the array based on the dates but i don't want to use foreach and loop over the array please any help on this
<code>Array
(
    [0] => 15/09/2016 00:00
    [1] => 02/09/2016 00:00
    [2] => 01/09/2016 00:00
    [3] => 29/09/2016 00:00
)
</code>
Comment: @paul Crovella kindly answer this question...
Answer: Look here.  It gives a few different ways to sort arrays

How to reorder array of dates?


How can I edit navigationOptions for each screen in nested tabNavigation?

Question: I am trying to show title in the header and also a right action button in the header.
I have tried to follow https://reactnavigation.org/docs/en/navigation-options-resolution.html#a-tab-navigator-contains-a-stack-and-you-want-to-hide-the-tab-bar-on-specific-screens
But without any progress.
Navigation.js
const FeedStack = createStackNavigator({
    Welcome: {
        screen: WelcomeScreen,
        navigationOptions: {
            headerTitle: 'Welcome',
        },
    },
    Auth: {
        screen: AuthScreen,
        navigationOptions: {
            headerTitle: 'Login',
        },
    },
}, {
    defaultNavigationOptions: {
        headerStyle: {
            backgroundColor: Platform.OS === 'android' ? Colors.headerColor : 'white',
        },
        headerTintColor: Platform.OS === 'android' ? 'white' : Colors.secondaryColor,
    },
});

const TabNavigator = createBottomTabNavigator({
    DailyTask: {
        screen: DailyTaskScreen,
        navigationOptions: {
            headerTitle: 'Daily Task',
        },
    },
    MyTasks: {
        screen: MyTasksScreen,
        navigationOptions: {
            headerTitle: 'My Tasks',
        },
    },
    SelectCategory: {
        screen: SelectCategoryScreen,
        navigationOptions: {
            headerTitle: 'Select Category',
        },
    },
}, {
    defaultNavigationOptions: {
        headerStyle: {
            backgroundColor: Platform.OS === 'android' ? Colors.headerColor : 'white',
        },
        headerTintColor: Platform.OS === 'android' ? 'white' : Colors.secondaryColor,
    },
});

const HomeStack = createStackNavigator({
    Tabs: TabNavigator,
}, {
    defaultNavigationOptions: {
        headerStyle: {
            backgroundColor: Platform.OS === 'android' ? Colors.headerColor : 'white',
        },
        headerTintColor: Platform.OS === 'android' ? 'white' : Colors.secondaryColor,
    },
});

const AppNavigator = createSwitchNavigator({
    Auth: FeedStack,
    Home: HomeStack,
}, {
    defaultNavigationOptions: {
        headerStyle: {
            backgroundColor: Platform.OS === 'android' ? Colors.headerColor : 'white',
        },
        headerTintColor: Platform.OS === 'android' ? 'white' : Colors.secondaryColor,
    },
});

export default createAppContainer(AppNavigator);

Screen.js
DailyTaskScreen.navigationOptions = {
    headerTitle: 'Daily Task',
    headerRight: (
        <HeaderButtons HeaderButtonComponent={HeaderButton}>
            <Item
                title='Category'
                iconName='md-albums'
                onPress={() => {
                    this.props.navigation.navigate('SelectCategory')
                }}
            />
        </HeaderButtons>
    )
};

What do I need to do to get the expected results of being able to edit the navigationOptions?
Answer: For adding an element at right of the header and implementing it's onPress, you can do it like this :
Just add this code below 'export default class' in the js file of the screen where you want to add it.
static navigationOptions = {
    headerLeft: null,
    headerRight: (
        <TouchableOpacity
            onPress={() => alert('This is a button!')}>
            <Text style={{color: '#fff', marginRight:12, fontSize: 14}}>Done</Text>
        </TouchableOpacity>
    )
};


In C# what is the difference between a destructor and a Finalize method in a class?

Question: What is the difference, if there is one, between a destructor and a Finalize method in a class?
I recently discovered that Visual Studio 2008 considers a destructor synonymous with a Finalize method, meaning that Visual Studio won't let you simultaneously define both methods in a class.
For example, the following code fragment:
class TestFinalize
{
    ~TestFinalize()
    {
        Finalize();
    }

    public bool Finalize()
    {
        return true;
    }
}

Gives the following error on the call to Finalize in the destructor:

The call is ambiguous between the following methods or properties:
          'TestFinalize.~TestFinalize()' and 'TestFinalize.Finalize()'

And if the call to Finalize is commented out, it gives the following error:

Type 'ManagementConcepts.Service.TestFinalize' already defines a member called
      'Finalize' with the same parameter types
Answer: A destructor in C# overrides System.Object.Finalize method. You have to use destructor syntax to do so. Manually overriding Finalize will give you an error message.
Basically what you are trying to do with your Finalize method declaration is hiding the method of the base class. It will cause the compiler to issue a warning which can be silenced using the new modifier (if it was going to work). The important thing to note here is that you can't both override and declare a new member with identical name at the same time so having both a destructor and a Finalize method will result in an error (but you can, although not recommended, declare a public new void Finalize() method if you're not declaring a destructor).
Answer: Wikipedia has some good discussion on the difference between a finalizer and a destructor in the finalizer article.
C# really doesn't have a "true" destructor.  The syntax resembles a C++ destructor, but it really is a finalizer.  You wrote it correctly in the first part of your example:
~ClassName() { }

The above is syntactic sugar for a Finalize function.  It ensures that the finalizers in the base are guaranteed to run, but is otherwise identical to overriding the Finalize function.  This means that when you write the destructor syntax, you're really writing the finalizer.
According to Microsoft, the finalizer refers to the function that the garbage collector calls when it collects (Finalize), while the destructor is your bit of code that executes as a result (the syntactic sugar that becomes Finalize). They are so close to being the same thing that Microsoft should have never made the distinction.
Microsoft's use of the C++'s "destructor" term is misleading, because in C++ it is executed on the same thread as soon as the object is deleted or popped off the stack, while in C# it is executed on a separate thread at another time.
Comment: Also note ECMA-334 has explicitly disambiguated "destructor" and "finalizer" formally, long ago. I don't know why MS still insists on the misleading term in their specifications.
Comment: I would argue that such a distinction between the destructor and finalizer is an important one to make. However, only those that care about what's going on under the hood would care about said distinction.
Comment: At least from working with Mono, C# is actually modeled after C++, and most native C# objects are C++ objects.  The way the compiler that compiled Mono works dictates how those C++ objects are destructed, and likewise, how C# object finalization propagates down to C++ and calls those destructors.

The distinction makes sense under the hood, but it still doesn't really apply to C# itself.
Answer: Found here: http://sanjaysainitech.blogspot.com/2007/06/difference-between-destructor-dispose.html

Destructor
They are special methods that contains clean up code for the object.
  You can not call them explicitly in your code as they are called
  implicitly by GC. In C# they have same name as the class name preceded
  by the ~ sign. Like-
Class MyClass
{

~MyClass()
{
.....
}
}

In VB.NET, destructors are implemented by overriding the Finalize
  method of the System.Object class.
Dispose
These are just like any other methods in the class and can be called
  explicitly but they have a special purpose of cleaning up the object.
  In the dispose method we write clean up code for the object. It is
  important that we freed up all the unmanaged recources in the dispose
  method like database connection, files etc. The class implementing
  dispose method should implement IDisposable interface.A Dispose method
  should call the GC.SuppressFinalize method for the object it is
  disposing if the class has desturctor because it has already done the
  work to clean up the object, then it is not necessary for the garbage
  collector to call the object's Finalize method. Reference:
  http://msdn2.microsoft.com/en-us/library/aa720161(VS.71).aspx
Finalize
A Finalize method acts as a safeguard to clean up resources in the
  event that your Dispose method is not called. You should only
  implement a Finalize method to clean up unmanaged resources. You
  should not implement a Finalize method for managed objects, because
  the garbage collector cleans up managed resources automatically.
  Finalize method is called by the GC implicitly therefore you can not
  call it from your code.
Note: In C#, Finalize method can not be override, so you have to
  use destructor whose internal implementation will override the
  Finalize method in MSIL.But in the VB.NET, Finalize method can be
  override because it does support destructor method.

Update: Interesting semi-related thread here.
Comment: `You should only implement a Finalize method to clean up unmanaged resources` : you put it in Finalize. Same with Dispose ?
Comment: @hqt: Cases where one should implement `Dispose` vastly outnumber those where one should implement a finalizer.  Implement `Dispose` if it is likely that an instance of the class or a derived class will be the last thing to either directly own an unmanaged resource, or directly own the last thing to directly own an unmanaged resource, or directly own the last thing to directly own etc.  Only implement `Finalize` for resource cleanup if one's class directly owns an unmanaged resource and almost nothing else--a much narrower scenario.
Comment: @hqt: If one a class would directly own unmanaged resources and also holds references to other objects, the unmanaged resources should generally be split off into their own finalizable class (which should ideally not hold any strong references to anything else), meaning the class which holds references to other objects would only own "things which directly own unmanaged resources", rather than owning the resources themselves, and would thus not need a finalizer.


Backwards stepwise regression, collinearity and regression to the mean

Question: My research paper was recently rejected and some of the feedback I received was in relation to the statistical tests done/not done. I would like help in clarifying what I could do differently as the feedback was not to informative.
I am attempting to see which baseline characteristics (my independent variables) can predict who will improve the most in my dependent variable after an intervention. As it is not published yet I won't give to many details but a similar example would be trying to decide if any baseline characteristics in humans (such as muscle mass, age, gender, alcohol use, pulse rate etc) can predict improvement in 100m foot race times after undergoing a strength exercise program.  I have a cohort of about 100 individuals all undergoing the same intervention.
In order to test this I collected data on all my baseline values and measured participants 100m times before and after undergoing the strength exercise program. I then made a multiple regression model were I included previous known confounders and my baseline characteristics of interest and used backwards stepwise removal of non-significant regressors to end up with a model of 3 independent variables significantly associating with improvement in 100m race times. For the sake of the argument let's make up the following; gender, thigh muscle mass and smoking status (yes/no).
I was asked/critiqued on the following (again examples  are made up);
1; type of sports shoe is a well-known determinant of 100 m race times, were improvement in race times still associated with baseline thigh muscle mass after adjusting for choice of sport shoe?
-type of sport shoe was one of the independent variables included in my multiple regression model, however it was not significant when included with the other independent variables  so it was removed in the backward stepwise removal process. Is any other statistical test more appropriate to run?
2, Could collinearity explain the results as several of the independent variables are likely to be similar
-I ran collinearity diagnostics in SPSS and did not receive any VIF values over 4 (with only one independent variable had a VIF at 4, the rest were under 3)
3; discuss regression to the mean as an explanation to my results
-I concede that it is likely that regression to the mean plays a part in which individuals improved the most/least but I don't see how this impacts on the baseline characteristics in a significant way other than that these individuals are given greater weight in the results since they show the biggest change.  I divided my cohort into tertiles based on improvement in race times and did not find that they differed in baseline values in any of my independent variables of interest.
Any help with any of the above much appreciated!
Comment: Depending on your reviewer, the stepwise may have been THE problem. Briefly, models are (multidimensional) random objects just as some variable are random. From this point of view, dropping out the non-significant variables from your model is very likely to be badly received by the Statisticians community, e.g. see [automatic-model-selection](https://stats.stackexchange.com/questions/20836/algorithms-for-automatic-model-selection), or [insignificant-dummy-levels](https://stats.stackexchange.com/questions/299231/r-automatically-group-the-insignificant-dummy-levels-and-re-fit-the-model/).
Comment: thank you for your input and the links. I see now the problem/critique of the stepwise approach. I selected it as I had 11IVs and felt it was to much for a model. Perhaps a better way is just to pick the most important IVs and run a multiple regression model?
Comment: Oh my.  That is a mirage and only seems to help, but has hidden model uncertainty that will destroy much of the meaning of the smaller model and especially the standard errors of coefficient estimates and the value of $\hat{\sigma}^2$.
Answer: I only address one aspect of your question.. let see if the community agrees with me. At least, let see if I understood her well.
The variable that you include in your model must be driven by your question of research. Not by any sort of automatic significance-driven algorithm of selection. Why ? An oversimplified example:
Let say that you are interested in studying the number of birds in all the parks of the country. Let say that, for the $n$ parks of your sample, you know the number of seeds, $\#^{seeds}$, and the number of dogs, $\#^{dogs}$. Let say that your sampling, unfortunately, only considers the parks in which there are only old dogs...  you know the number of dogs but you don't know how old they are.
Let say that, originally, your question of research is

What are the determinants of the number of birds in all the parks of the country ?

and your equation for $i=1,...,n$

$\#^{birds}_i = \beta_0 + \beta_1\#^{seeds}_i + \beta_2\#^{dogs}_i + \varepsilon_i$

Let say that -- because you do not know that you actually sampled over dogs that are old -- you failed to reject the non-significance of $\widehat{\beta}_2$. Then, let say that you -- step-wising manually -- drop out the number of dogs from the equation. If you do so, don't you think that you changed your question of research ? You do ! Without even knowing it, your question of research actually became

What are the determinants of the number of birds in all the parks of the country that are visited only by old dogs?

So what to do with a non-significant $\#^{dogs}$ ? You keep it in the model, because this non-significance actually is informative (e.g. about your sampling process). If you stewise-drop it out, you are actually biasing your estimation because you concentrate your estimation procedure on the very peculiar case you have, case which is strongly related to your (unaware) bias of selection (of old dogs). Relatively to your question of research your estimated coefficients will be biased.
To enrich my comment, in which I say that models are multidimensional random objects just as some variable are random. The term multidimensional here stands for the fact that each exogenous variable is a dimension of your model, of your question of research. If one of them is outlying, it does not mean that it always do so.
Finally, something else you should wonder is : do you do statistics to strive you programming skills or your statistic skills ? If it is the latter, don't use stepwise.
Comment: Relevant: https://stats.stackexchange.com/questions/338804/hypothesis-testing-on-coefficients-in-two-subsets-of-data-after-stepwise-regress/338807#338807
Comment: Any question @lighthouse ?


What is the name of these tubes, that emit sound when being swung?

Question: The group "Walk off the earth" are performing a video cover of "Hello" using some colourful sound generators, that emit sound when being swung (e.g. in seconds 00:05 to 00:10):

What is the name of these sound generators and how are they played?
It might be they are the "Whippy Tubes" mentioned in the video title. (There are two different kinds of colourful tubes used, from which one type must probably be the "whippy tube")
Is there any trick to playing them, or will they emit the same sound no matter how you swing them?
Comment: What I also would like to know is where I can buy or order tubes like that. Since that's not a good type of question I'm just putting it here in the comments. I'm located in Germany so any german stores or only ordering (worldwide) would be fine. Google didn't help me on that, so hanks for any tips. :-)
Comment: Such a fantastic video!
Answer: It is a whirly tube, corrugaphone, lasso d'amore or bloogle resonator.
To be honest, I was not expecting my search for "whirly music tube" to come straight back like that :o)
If you Google "buy whirly tube" you'll get a fair few hits. I'm not going to link them as I have no idea how good any of the sites are.
In my opinion, "Bloogle Resonator" should be the preferred term. By law. Because how can you not love it?

Is there any trick to playing them, or will they emit the same sound
  no matter how you swing them?

According to Wikipedia:

The faster the toy is swung the higher the pitch of the note it produces.

...which makes sense. However:

It produces discrete notes in the harmonic series like a valveless brass instrument. To be played in concert as a lasso d'amore the length of the toy must be trimmed to tune it.

So presumably if you want notes from different harmonic series (I don't know enough theory to know what that actually means) you'd need a set of different sizes.
The other tubes that are not being whirled are obviously stiffer, and could just be PVC tubing cut to length; however they are likely to be boomwhackers.
Which are basically PVC tubing cut to length :) but pre-tuned, colourful and commonly available from loads of places.
Comment: Hi Whelkaholism, thanks for the term whirly tube. I didn't know that.  :-)
But I don't think the whirly tubes in the wikipedia-article are the same as the ones used in the video. In the first few seconds you can see the guy with the long hair throwing his tube. It looks different. e.g. it is held in the middle and I am not sure if it is ribbed at all.
Any other ideas?
Comment: It's pretty hard to tell from the video; the ribs could have easily been optimised out by the encoding process. They are certainly being playing in an identical way to the description for the bloogle resonator though, so they are definitely a variant.
Comment: Hmm, having watched it and indeed read your question again, they are using two types, will update answer.
Comment: @Kaadzia I think they are boomwhackers, I have updated the answer.
Comment: I guess you might be right. If one holds a whirly tube (sorry "Bloogle Resonator" ;-) ) in the middle and puts something darker there (like seen in the video) it might look like in the video after all.
So **some variation of whirly tubes** in the one hand and boomwackers in the other hand seems to be what they are using. :-) Thanks.
Answer: I'd say those are boomwhackers...
My piano teacher teaches elementary school music (too) and loves those things.
product website here: http://boomwhackers.com/ (that I have no affiliation with you moderators)
Comment: You should mention that you are unaffiliated to that website. Whenever a person links to a website that sells things the warning lights for a spam answer light up.
Comment: Oh gotcha.  Well, I'll leave the answer for posterity.  what the heck.
Comment: @NeilMeyer, I've always heard them referred to as boomwhackers (and I have absolutely no affiliation to the company). It's kind of like Xerox - the name has become generic.
Comment: Thanks Stephen. But I think you're referring to the tubes they bang on the surfboard. I was looking for the name of the tubes they're whirling around with their **other hand**. ;-)


Bouquet of Two Circles and Based covers

Question: I need help with the following: Let $B$ denote the bouquet of two circles labeled by $a,b$. We regard $\pi_{1}(B)\cong \langle a,b | -\rangle $ where the basepoint of $B$ is its vertex, and the two edges determine paths correspoinding to basis elements $a,b$ of the free group. Sketch the based cover $\hat{B}\rightarrow B$ such that $\pi_{1}(\hat{B})$ corresponds to the subgroup

$\langle aaabbb,aaaabbbb\rangle$
$\langle bbbbb, bababab\rangle$

Any hints?
Answer: Hint: find a smallest labeled graph such that $a^3b^3$ and $a^4b^4$ represent nontrivial loops. Expand it to a cover without adding any more loops (try to mimic the way the universal cover of $B$ avoids adding any new loops to the single vertex, no edges graph $\{*\}$). If you don't know what the universal cover of $B$ looks like, find it first.
Comment: The universal cover of the figure eight can be visualized by the Cayley graph of the free group on two generators a and b, but I do not know what to do next?
Comment: @LeonhardLeibniz: did you find the smallest labeled graph such that $a^3b^3,a^4b^4$ are nontrivial loops?

Bouquet of Two Circles and Based covers


'ls' taking a long time to list 20 subdirectories

Question: I have a directory (my_dir) which has 20 sub directories.  Every time I run 'ls' or try to autocomplete a file name in this directory my IO usage goes to 100% and it takes very long time (10 mins) to list 20 sub directories.
Here is some background for it.
Some time ago, I created millions of small files in this directory (By mistake).  Then I deleted those small files (all of them).  But now I am seeing this problem.
How can I fix it ?
Comment: Results fox `fsck /dev/hda..`? (Replace the device with your hard drive.)
Answer: Move everything in the directory in to another directory. Remove the original directory. Recreate the original directory. Move everything back.
You are using a filesystem that can't shrink directories.
There's always e2fsck -D which will optimize all directories on the filesystem.
Comment: +1 - Learn something new every day..


Como fazer um botão com link em AngularJS

Question: Como fazer um botão com link/redirecionamento em AngularJS?
html
<button class="btn btn-success" href="go('/cadastro.html')">Cadastra-se</button>

config
app.config(function($routeProvider, $locationProvider){

    .when('/', {
      templateUrl : 'views/login.html',
      controller     : 'LoginCtrl',
    })

    .when('/cadastro', {
      templateUrl : 'views/cadastro.html',
      controller     : 'CadastroCtrl',
    })

});

Answer: Até onde sei, a tag button não possui o atributo href.
Um outro ponto, se você deseja navegar até a rota /cadastro , você precisa mudar seu location para '/cadastro' , retirando o HTML do caminho. Lembre-se que você está acessando uma rota, e não um caminho físico até seu HTML.
Se você utilizar o código abaixo, deve acessar a rota '/cadastro' conforme configurado em seu módulo.
Cadastra-se

Caso queira utilizar um botão acessando um método de seu controller, deve fazer semelhante ao código abaixo:
<button class="btn btn-success" ng-click="go(/cadastro)">Cadastra-se</button>

E em seu controller:
$scope.go = function(path){
     $location.path(path);
}

O objeto $location deve ser incluído como uma dependência do código acima. Ele tem como objetivo lhe dar uma interface para acessar a URL do browser. Qualquer modificação feita na URL irá refletir no objeto $location, e vice-versa.
Comment: Cara, consegui usando o Cadastra-se, porém o outro, tentei fazer o que você disse e não deu certo. Qual controller você se refere? CadastroCtrl?
Comment: @GustavoSevero no controller ao qual o seu botão pertence. Se seu botão está dentro de uma div [...] então sim, no CadastroCtrl
Answer: ficaria assim:
<button class="btn btn-primary" ui-sref="cadastro" >

    Cadastrar

</button>

Ele irá usar sua routa especificada no seu config para redirecionar.
Answer: Este seu código já está quase pronto. Só falta adicionar a função no controller para trocar de rota:
$scope.go = function ( path ) {
    $location.path( path );
 };

Mas, como aparentemente você está utilizando o bootstrap, acredito seja possível você utilizar a tag  ao invés de button, desta forma:
Cadastra-se

Assim, você não precisa da função no controller.
Answer: Vanilla
Via Javascript
<input type="button"
    onclick="location.href='http://servidor.com.br';"
    value="Visitar servidor.com.br"
/>

Via form action
<form action="http://servidor.com.br">
    <input type="submit" value="Visitar servidor.com.br" />
</form>

Angular
Via diretiva:
.directive( 'goClick', function ( $location ) {
  return function ( scope, element, attrs ) {
    var path;

    attrs.$observe( 'goClick', function (val) {
      path = val;
    });

    element.bind( 'click', function () {
      scope.$apply( function () {
        $location.path( path );
      });
    });
  };
});

Uso:
<button go-click="http://servidor.com.br">Visitar servidor.com.br</button>

(Fonte)


Publish dll - copy to bin folder

Question: MVC project.
On my data access layer I have a libs folder where I store some dlls that the project needs t oaccess data. One of them is set "copy local" to true. The goal is to copy the dll to the bin folder so I can deploy it with the application.
The thing is, when I build the app, it does copy to the bin folder, but to the bin folder on the DAL project only. Since it is a web applicaiton I want to build the web project and have the dll copied to its bin folder so I can just deploy it withou having to manually coping it from the bin on the dal to the bin of the deployed appliation.
What do I need to do to accomplish that?
Comment: Post build event, add a copy of the dll.
Comment: Why can't you just reference it in your Web project?
Comment: reference a data access dll on the web project? doesnt look right...
Answer: Build Action = Content might help; but then it will only come in to your DAL Bin if it is referenced there.
Answer: You can right click on the web project and than click on Deployment project as given below ..this will add all required dll for your project in the path of your poject which you can see in ouput window

Publish dll - copy to bin folder


Excel VBA Auto Resize ListView Columns

Question: I found code in order to resize a ListViews columns based on the the longest string in the items of the column, but I would like to modify it so it also considers the length of the column name as well for resizing. I have several columns where the longest string is the column name itself.
I have been searching all over google to try and figure this out, but I really do not understand the API being used here.
An extension to this question would also be, what is LVM_FIRST doing here, I could not seem to find anything in my searches.
Declaration:
Private Declare Function SendMessage Lib "user32" Alias _
"SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, lParam As Any) As Long

Private Const LVM_FIRST = &H1000

Sub:
Public Sub LV_AutoSizeColumn(LV As ListView, Optional Column _
 As ColumnHeader = Nothing)

 Dim C As ColumnHeader
 If Column Is Nothing Then
  For Each C In LV.ColumnHeaders
   SendMessage LV.hWnd, LVM_FIRST + 30, C.Index - 1, -1
  Next
 Else
  SendMessage LV.hWnd, LVM_FIRST + 30, Column.Index - 1, -1
 End If
 LV.Refresh

End Sub

Answer: LVM_FIRST + 30 is the LVM_SETCOLUMNWIDTH message which sets the width of the given column.
The -1 is LVSCW_AUTOSIZE which tells the control to resize based on content.  If you switched to -2 (LVSCW_AUTOSIZE_USEHEADER) the control would resize to the header text.
Set both in your loop, noting which results in a larger ColumnHeaders width then SendMessage again with the appropriate LVSCW_ argument.
Comment: I was going to paste a demo but it looks like USEHEADER honours longer column vlaues, so try replacing the `SendMessage` you have with `SendMessage LV.hWnd, LVM_FIRST + 30, C.Index - 1, ByVal -2`
Comment: Im still pretty new at this. Could you elaborate on what you mean by set both and note the bigger then sendmessage again. You mean like store the larger value in a variable?

Excel VBA Auto Resize ListView Columns


Show that the function $f(x)=\sum_{n=1}^{\infty} \frac{1}{n(n+x)}$ is defined, continuous and differentiable

Question: Show that the function $f(x)=\sum_{n=1}^{\infty} \frac{1}{n(n+x)}$ is defined, continuous and differentiable on $[0;+\infty)$
I get that $\sum_{n=1}^{\infty} \frac{1}{n(n+x)}=\sum_{n=1}^{\infty} \frac{1}{x}\cdot(\frac{1}{n}-\frac{1}{n+x})=\frac{1}{x}$. Hence we get that $f(x)$ is defined for any $x \neq 0$, but it's not continuous. Can anyone tell me that I did wrong? Thank you so much.
Comment: As a sidenote (not that it's relevant to solving the problem at hand): the series here can be written $\frac{\psi^{(0)}(x+1)+\gamma}{x}$ where $\psi$ is known as the [polygamma function](https://en.wikipedia.org/wiki/Polygamma_function). If $x$ is an integer this reduces to $\frac{1 + \frac{1}{2} +\ldots + \frac{1}{x}}{x} = \frac{H_x}{x}$ where $H_x$ is the [harmonic number](https://en.wikipedia.org/wiki/Harmonic_number).
Comment: What is your domain for $f$?
Comment: The domain of $f$ is $R$, I think. This is a problem from my teacher, but he didn't mention its domain.
Comment: Sorry, its domain is $[0,+\infty)$, I forgot it. Excuse me.
Answer: First, your series is not defined if $x$ is a negative integer. Second, while it is true that $\sum_{n=1}^{\infty} \frac{1}{n(n+x)} = \frac{1}{x} \sum_{n=1}^{\infty} \left( \frac{1}{n} - \frac{1}{n + x} \right)$ (as long as $x$ is not a non-negative integer), your series is not a telescopic series and so there's no reason that it will converge to $\frac{1}{x}$.
Instead, you can argue that on any interval of the form $[-k, k] \setminus \{ -1, \dots, -k \}$ and for $n > k$ you have a bound of the form
$$ \left| \frac{1}{n(n+x)} \right| = \frac{1}{n|n+x|} \leq \frac{1}{n(n - k)}   $$
and since the right-hand side converges, by the Wierstrass $M$-test you get that $f$ is a continuous function on $\mathbb{R} \setminus \{-1, -2, \dots \}$.
If you differentiate $f$ formally, you obtain the series $-\sum_{n=1}^{\infty} \frac{1}{n(n+x)^2}$ which also converges absolutely on $\mathbb{R} \setminus \{ -1, -2, \dots \}$ by the Wierstrass $M$-test and this shows that $f$ is indeed differentiable with derivative given by $f'(x) = -\sum_{n=1}^{\infty} \frac{1}{n(n+x)^2}$.
Comment: I've edited the domain of $f$ in my question. Thank you so much, I see it now. :D


pymongo update multiple fields in a document only if one field value is greater than the current

Question: Using pymongo, I only want to update certain fields of a document if a specific field is greater.
for example, the original document could look something like this for an auction application
{
    "_id": ".....",
    "highestbid": 100,
    "highestbidder": "joe",
    "someotherinfo": "...."
}

suppose now a bidder named john outbid joe at 200. How could I use collection.update() to update both the highestbid field and highestbidder field only if the new bid is higher than highestbid, while leaving someotherinfo alone?
I know I can use $max to insert the higher of the two bid values, but I'm not sure how to update highestbidder depending on the result of highestbid all in a single .update(), if it is even possible.
Answer: You need to use the operator $lt to verify that old bid is less then the new one to update your document, this should solve your problem:
db.collection.update({
    "highestbid": {
        "$lt": 200
    }
}, {
    "$set": {
        "highestbid": 200,
        "highestbidder": "jhon"
    }
}, {
    "multi": false
})

Using pymongo:
db.collection.update_one({
    "highestbid": {
        "$lt": 200
    }
}, {
    "$set": {
        "highestbid": 200,
        "highestbidder": "jhon"
    }
})

Comment: Im getting "upsert must be true or false" but if i add upsert = False, it complains that there are too many arguments
Comment: I also forgot to tag this but im using django


Piano notation for trilling just one note in a chord?

Question: I have a piano chord (specifically a triad), and I want to trill the note at the top.

Is there any way to express this using musical notation? Also, if there is notation for this, how would I do it in MuseScore 2?
NOTE: As an aside, in my handwritten manuscript I've just labelled it as using an asterisk at the top of the chord itself, and writing a footnote at the end. Is that good enough?
Comment: @CarlWitthoft How am I meant to skim through a few scores if I don't even know what I'm looking for, though? I honestly have no idea what I'm looking for here, that's why I'm asking. Just curious: is there any problems with my question?
Comment: It's very unlikely that a keyboard player would imagine you wanted to trill all three notes at the same time, especially considering most keyboard players don't have six fingers on one hand! But if you want to be absolutely clear, write the chord in two voices, with the top note stem up and the other two down. If you wanted the trill on the *middle* note of the chord, the best option would be to write the "tr" to the left of the chord, opposite the relevant note. That's not common for trills, but it does occur for other ornaments, especially in Baroque music.
Comment: @CarlWitthoft in contemporary music, it's quite common to have footnotes explaining special notation. And in educational editions of old music, there are often footnotes showing the editor's recommendation for playing ornaments, etc.
Comment: You simply express it by writing only one trill line. A chordal trill (yes, they exist, look up Beethoven's sonatas) would notate multiple waved lines.
Comment: Of course there is.  Just skim thru a few scores at imslp.   And, no **do not ever** use a footnote.  You think a musician's going to pull his focus away from the written notes?
Comment: If any reader wants to take @KilianFoth's advice to look up Beethoven's sonatas, I recommend starting the search at the end. His last piano sonata's last movement has plenty of trills played together with other stuff in the same hand and notated on the same stave (in one case, indeed a chordal trill). TLDR: if the trilled note's at the top, put it on an upward stem, put ***tr~~~*** above the stem, put other notes on a downward stem.
Answer: I think you should definitely find some way to specify it, just so the performer knows exactly what is expected. Here are a few possible solutions, though I don't claim any of them are 100% factually correct with sources to back me up:

I've seen editorial footnotes in scores of composers before Bach. If you think a footnote is the best bet, I don't personally see any problem with it.
alephzero's solution in the comments is a good one, the only possible problem being if your actual example already includes 800 different voices in a single clef, which I doubt :-) :

Another (perhaps extreme) solution is to clarify what the auxiliary pitch should be:

But as I said, these are just some solutions; perhaps there is a standard notation "rule" for this that someone else can explain.
Comment: 3 is definitely a figuration I've seen before.


Docker service update downtime

Question: I have an AWS EC2 with docker service.
The service has just 1 container, and when I update the container (changing image), I have a downtime (about 1 minute).
This is my docker service create code:
<code>docker service create \
    --name service-$IMAGE_NAME \
    --publish 80:80 \
    --env ENVIRONMENT=$(cat /etc/service_environment) \
    --env-file=/etc/.env \
    --replicas=1 \
    --update-failure-action rollback \
    --update-order start-first \
    $ECR_IMAGE
</code>
Here update code:
<code>#pull image from private ECR repository
docker pull $IMAGE

docker service update \
--force \
--image $IMAGE:latest \
--update-failure-action rollback \
--update-order start-first \
service-$IMAGE_NAME
</code>
Why this happen? What's wrong?
Thank you
Answer: Changing image means you are stopping existing docker instance, and start a new one. That's why it will be down for a while, in your case, 1 minute. It's the time for the docker instance to restart. You can make this seamless using 2 ec2 instance and load balancer. You update 1 instance and repointing the traffic to other instance, and then update the other one after the instance you've update is successful.
Comment: when I run docker service update, it starts one container, and after 1m , it starts a new container again. The first one doesn't works, but the second works... it's strange.
In my case, I'm using --update-order start-first so it should switch to the new container only when it is up.
I think it is doing so, but the first created container doesn't works, and I don't know why :-/
Comment: I've found an error on pipeline. It was deploy twice with different dockerfile

Docker service update downtime


Can you recommend an Amazon AMI for Python?

Question: I want to remove as much complexity as I can from administering Python in on Amazon EC2 following some truly awful experiences with hosting providers who claim support for Python.  I am looking for some guidance on which AMI to choose so that I have a stable and easily managed environment which already included Python and ideally an Apache web server and a database.
I am agnostic to Python version, web server, DB and OS as I am still early enough in my development cycle that I can influence those choices.  Cost is not a consideration (within bounds) so Windows will work fine if it means easy administration.
Anyone have any practical experience or recommendations they can share?
Answer: Try the Ubuntu EC2 images. Python 2.7 is installed by default. The rest you just apt-get install and optionally create an image when the baseline is the way you want it (or just maintain a script that installs all the pieces and run after you create the base Ubuntu instance).
Answer: If you can get by with using the Amazon provided ones, I'd recommend it. I tend to use ami-84db39ed.
Honestly though, if you plan on leaving this running all the time, you would probably save a bit of money by just going with a VPS. Amazon tends to be cheaper if you are turning the service on and off over time.
Comment: I'm open to that, any recommendations for VPS providers?
Comment: I would check out Slicehost and Linode, I've had good experiences with both.  Both offer multiple distro choices.  I am personally using Linode at the moment.