Playing 440 Hz, what are the harmonics for a trumpet? For a flute?

Question: Playing 440 Hz, what are the approximate harmonics for a trumpet?  For a flute?  This to help students understand the differences when those instruments play the same note.
I've been to many website, including University of New South Wales.  I would like spectrum in percentages.  For example: --- Flute => 440 Hz - 100% | 880 Hz - 33%  | 1320 Hz - 8% | 1760 Hz - 13% | 2200 Hz - 12% | 2640 Hz - 2% | 080 Hz - 12% --- Trumpet => 440 Hz - 100% | 880 Hz - 100% | 1320 Hz - 53% | 1760 Hz - 75% | 2200 Hz - 85% | 2640 Hz - 40%  | 3080 Hz - 32% --- Same harmonics - different harmonic amplitudes.
I prefer percentages. Many students have no idea what dB means. Percentages they do understand.
<code>I posted this question a few days ago.  I'm curious if no one has pursued this type of
question.  Trumpets, etc. have been around for decades.
</code>
Comment: What kind of students? High school? University? What prevents them from understanding dB? What class? Physics? Music? Would they understand difference between power and amplitude percentages? What exactly are you trying to teach or demonstrate?
Comment: "*I prefer percentages. Many students have no idea what dB means*". That's understandable, but on the other hand, using a linear scale (%) instead of a logarithmic scale (dB) is misleading, as the difference between 0.1% and 10% is a lot more from an acoustical standpoint than the difference between 10% and 100%. This is the reason for using dB or [phon](https://en.wikipedia.org/wiki/Phon).
Comment: You'll find plenty of waveform pictures of the sustain portion of trumpet and flute notes. Flute tends more to a sine wave, with predominately even-order harmonics. Trumpet is a rather more complex sound with more odd-order harmonics. But you might be surprised at how SIMILAR the sustained part of the two instruments sound, not how DIFFERENT. A lot of the characteristic of an instrument is in the initial attack. This displays as a very complex - even chaotic - waveform, difficult to analyse. I'm afraid  your 'measure the harmonics of the sustain portion' approach may not be terribly useful.
Comment: (continued) This fact was exploited by the 'hybrid synthesis' generation of keyboards, notably the Roland D50 and the Yamaha SY range. Computer memory for samples was still limited and expensive, so they sampled the attack, synthesised the sustain and release. It was remarkably successful! This approach continues in the much-respected Kurzweil keyboards that manage to produce remarkably realistic instrumental sounds from remarkably low amounts of sample memory.
Comment: @LaurencePayne you may be thinking of clarinet, which (thanks to the cylindrical bore and half-open characteristic) has _only odd_ harmonics. But that doesn't really apply to flute, which though also cylindrical is sufficiently open on both ends to support both even and odd harmonics – like trumpet, but with much lower amplitude. I don't think there's any instrument that has predominantly _even_ harmonics, at least there's no simple physics reason why this would happen.
Comment: A quick Google search for "flute vs. trumpet spectrum" not only returned thousands of academic articles about this very topic, but also this: https://physics.stackexchange.com/questions/15385/why-can-i-tell-a-flute-from-a-trumpet
Comment: Yes, the wave forms can be complex.  That complexity can be simplified by viewing the harmonics.  And yes, there are thousands of articles on this topic.  I'm interested in learning if you've found one that answers the question?  Thanks!
Comment: "I'm curious if no one has pursued this type of question"  You've already got a quite detailed answer to your question.  It seems you just don't like the units of dB.  If you understand dB, you can translate it for your students.  But I don't think that would make it more understandable, as the dB scale is very common and pretty intuitive.
Answer: You can find detailed acoustic information on both trumpet and flute (and many others) on the Music Acoustics website for the University of New South Wales. Here are the pages for

Brass instruments
Flute

In particular, the trumpet spectra

and the flute spectra

Similar information is available in The Physics of Music and Musical Instruments, by David Lapp, Chapter 3, "Modes, Overtones, and Harmonics" (pp. 27-39). (This site appears to be directly related to the UNSW site above insofar as it links to it directly for "further information".)
Again the trumpet spectrum

The first graph is a histogram of the power spectrum for that musical instrument. The first bar on the left is the power of the fundamental frequency, followed by the overtones. Be careful when comparing the relative strength of the overtones to the fundamental and to each other. The scale of the vertical axis is logarithmic. The top of
the graph represents 100% of the acoustic power of the instrument and the bottom of the graph represents 80 dB lower than full power (†10-8 less power). The second graph is a superposition of the fundamental wave together with all the overtone waves. Three cycles are shown in each case.

The corresponding flute graphs are not provided, but there are similar graphs for a variety of other instruments.
I did not find graphs corresponding to the two instruments at 440Hz
You may also find another post from SE Music Practice and Theory helpful.

Trumpet Peculiar Frequency spectrum
Comment: @Clyde if a detailed graph of acoustic spectrum of a flute with db on the y axis and all the harmonic peaks clearly marked doesn't answer your question, what would?  What am I missing here?
Comment: I don't see how this answers the question.  Thanks!
Answer: I'm adding this answer to show how using harmonics amplitude to characterize a sound can lead to problems.

The spectrum of a periodic signal can be computed using a Fourier transform, which purpose is to transform a sum of sinusoidal components into a sum of complex exponents of e.
The coefficients of the spectrum are therefore complex numbers. The real part of a coefficient is the frequency relative amplitude and the imaginary part is its phase offset which determines the amplitude of the component at time 0 (more). Most of the time spectrums are shown with only the amplitude information visible and offsets are not mentioned.
If all harmonics started at time 0 at their maximum like a cosine function, offsets would be equal and everything would be simple. That's usually not the case, causing alterations in the waveform. For example, let's create a wave at 440 Hz with overtones this way:

The harmonics parameters are:

Frequencies: 440, 880, 1320, 1760, 2200 (Hz)
Amplitudes: 1.0, 0.8, 0.22, 0.4, 0.55
Phase offsets: 0.0, 0.4, 0.8, 0.7, 0.3 (unit = pi radians)

As visible these waves don't start at their maximum, except the fundamental (the sum doesn't start at its maximum either).
On the right hand side this is the spectrum as usually represented. I actually obtained this spectrum with a Fourier transform (DFT) of the blue wave. The graph shows only the amplitudes of the components, not the phase offsets.
Now, this spectrum corresponds to an infinity of different waves. It's easy to demonstrate this by reconstructing a wave from the amplitudes only and another from both the amplitudes and the phase offsets. To do this I performed an actual inverse DFT of the spectrum, once using only the real part of the coefficients, once using the whole coefficients:

Reconstructing waves from real and complex coefficients of the DFT
The first graph shows both reconstructions, and the resulting waves are indeed different (the blue wave is identical to the original wave)
The other rows show respectively the complex and real spectrums. They are actual spectrums obtained by performing DFTs on each reconstructed wave. They are identical, except the phase offsets.
Note the wave reconstructed without the phase offsets assumes all harmonics have a 0 offset, and therefore the sum has also a 0 offset, and starts at its maximum.
An infinity of different waves can be constructed from the spectrum amplitudes, just by varying the values of the (usually unknown) phase offsets.

Conclusion: If you want to characterize sounds from their spectrums, you need to know the harmonics amplitudes, as you asked for, but also the phase offsets. Getting the offsets might be a bit more difficult than the amplitudes.
Comment: In many situations, though, the relative phase of the harmonics doesn't affect the auditory perception of a sound.  See [here](http://www.silcom.com/~aludwig/Phase_audibility.htm) for a review and discussion of the literature.
Comment: @MichaelSeifert: Honestly I wasn't aware of such aspect, thanks for pointing out.


Forming a negation of a statement (∀x∈A)(∀y∈B)((x=y)⇒(y>2))

Question: I have a statement from which I need to form a negation.
$$(\forall x \in A)(\forall y \in B)((x=y)\to (y>2))$$
Could this solution be correct?
$(\exists x \in A)(\exists y \in B)((x=y)\land(y\leq 2))$
or could it be solved like this
$(\exists x \notin A)(\exists y \notin B)((x=y)\land(y\leq 2))$ or $¬(\exists x \in A)(\exists y \in B)((x=y)\land(y\leq 2))$
as well?
Thank you.
Answer: The sentence is telling:
If any two elements $x$ living in $A$ and $y$ living in $B$ are equal, then $y$ will be greater than $2$.
The negation is:
There are two elements $x$ living in $A$ and $y$ living in $B$ that are equal and $y$ is not greater than $2$.
That's why I think: only your first answer is correct.
We can write $$(\forall x \in A)(\forall y \in B)((x=y)\to (y>2))$$ by the rule of inference as
$$ (\forall x \in A)(\forall y \in B)(\neg(x=y)\lor (y>2))$$
Then the negation changes $$\forall x,\forall y,\neg (x=y) \lor (y>2)$$ to $$\exists x,\exists y,\neg\neg(x=y) \land (y\leq2)$$
and by the double negation elemenation rule $\neg\neg(x=y)\Rightarrow (x=y) $. That's why the negation is:
$$(\exists x \in A)(\exists y \in B)((x=y)\land (y \leq 2))$$
also have a look here
Statement $\rightarrow$    Negation
"A or B" $\rightarrow$ "not A and not B"
"A and B"   $\rightarrow$ "not A or not B"
"if A, then B" $\rightarrow$   "A and not B"
"For all x, A(x)" $\rightarrow$    "There exist x such that not A(x)"
"There exists x such that A(x)" $\rightarrow$  "For every x, not A(x)"
Comment: thank you, so you also assume that the last negation I wrote is incorrect?
Comment: in the last negation $¬(\exists x \in A)(\exists y \in B)((x=y)\land(y\leq 2))$ the first $\neg$ sign is unnecessary


For any number $n \gt 1$ and all of its prime divisor $d_1, d_2, ...$ s.t. $d_i \equiv 1 \pmod 3$ for each $i$, show:

Question: For any number $n \gt 1$  and all of its prime divisors $d_1, d_2, ...$ s.t.
$d_i \equiv 1  \pmod 3$ for each $i$
Show that the euler phi function $\phi(x) = 2n$ has no natural number solution.
Comment: You mean: numbers $n$ such that all prime divisors of $n$ are congruant to $1$ modulo $3$?
Answer: Let $x = \prod_{i=1}^n p_i^{\alpha_i}$ ($p_i$ the distinct prime factors of $x$) be given, we have
\[ \phi(x) = \prod_{i=1}^n p_i^{\alpha_i - 1}(p_i - 1). \]
So in order to have $\phi(x) = 2n$ with $n$ odd (as above) and $p_i - 1$ being even for all primes but 2, we see that $x$ must be of the form $x = 2^\alpha p^\beta$ with $\alpha \in \{0,1\}$. Then
\[ \phi(x) = p^{\beta - 1}(p-1). \]
This equals $2n = 2d_1\ldots d_r$ if (after reordering the $d_i$) $p-1 = 2d_1$ (or $=2$), $p^{\beta - 1} = d_2 \cdots d_r$. So $p = d_2 = \cdots = d_r$, and $2d_1 + 1 = p$. But $d_1 \equiv 1\pmod 3$, so $2d_1 + 1 \equiv 0 \pmod 3$. But $p$ is prime, so we must have $p-1 = 2$, all $d_i$ equval $p$. But then $p = 3$, which contradicts $p = d_1 \equiv 1 \pmod 3$. So $n$ can't have any prime divisors, contradicting $n > 1$.
So there is no such $x$.


Meu botão não funciona quando coloco o f:validateRegex

Question: Sem o f:validateRegex o botão funciona normalmente, mas após colocar o f:validateRegex para validar os dados do input, não funciona mais, alguém pode ajudar?
Segue o código em anexo, não consigo formatar ele aqui...
Comment: Cole o código(e não a imagem), para ficar mais fácil de lhe ajudarmos.
Comment: Tentei colocar o código e não aparece, fica só dois asterisco.
Answer: Seus inputs estão com o id duplicado:
<h:inputSecret id="passwordInput">

Abcs!
Comment: Mas o botão valida o passwordInput, como faço para ele validar os dois inputs?
Comment: cada um tem que tem um id próprio


Solve the inequality for real $\Bbb R$ & also in $\Bbb N$

Question: Solve in Real Number $\Bbb R$  and Natural Number $\Bbb N$,
$\frac x 2 + 1 ≤ 2x - 5 < x $
My attempt:
$\frac x 2 + 1 ≤ 2x - 5 < x $
$\implies \frac x 2 + 1 - 1 ≤ 2x - 5 -1 < x - 1$
$\implies \frac x 2  ≤ 2x - 6 < x - 1$
$\implies 2 \times \left(\frac x 2  ≤ 2x - 6 < x - 1\right)$
$\implies x  ≤ 4x - 12 < 2x - 2$
Removing $x$ from 3 sides,
$\implies 0  ≤ 3x - 12 < x - 2$
This is where I am stuck.
After this I am unable to solve because whatever addition/subtraction for $x$ I do, it transfers to opposite end, hence at the end two $x$'s are there at different sides of inequality sign .
Answer: Solve the parts of the inequality separately.
$$3x-12\geq 0 \implies 3x\geq 12 \implies x\geq 4$$
$$x-2 > 3x-12 \implies 2x < 10 \implies x<5$$
Thus, $$5> x \geq 4$$
For real solutions, $$x \in [4,5)$$
For natural number solutions, $x=4$ as it is the only natural number in this interval.
Comment: I was not sure of solving by parts previously, but now i am clear. Thanks !


Drupal 7 Multilingual Site Search

Question: I have a drupal multilingual site (English and Arabic) . Arabic page site search gives me an extra value "English" in search result. I am using default drupal site search.

What it actually means? How can i remove this?
Comment: I think this question is a case of "not enough data". If you are directed to English version of a node, that's it - indication that a result is in different language than you expect. Are you using built-in search or contrib module? Are nodes independent or marked as translations of another?
Answer: That is because of language switcher enabled.  Go the particular content type page, edit and in publishing options CHECK the check box Hide content translation links.

Drupal 7 Multilingual Site Search


Allow SQL injection

Question: I'm trying to use Drupal for a specific research purpose and it would be helpful if I could intentionally make a text box vulnerable to SQL injection. Specifically, it would be convenient if I can make the search box vulnerable but anything is better than nothing. How can I do this? As a point of clarification, I'm trying to do this from a browser, not the api or terminal. Thanks!
Comment: There should be no possible way to do this without changing code (that's kind of a big part of the database layer's responsibilities). If you somehow find a way, please keep it to yourself and report it to the security team ASAP, or it'll be Drupalgeddon all over again!
Comment: @Clive changing code is alright as long as it's relatively straight forward. Based on nvahalik's answer that seems unlikely though
Answer: So the only way to to do this would be to write a custom module and explicitly write bad code that would normally not pass community inspection.
I'll leave that as an exercise to the asker. ;)
Hint: Your module should also have a dependency on this module.
Comment: Hm, I don't have an issue writing some code but I'm a relative newcomer to Drupal. Is this something a novice can handle? Seems like writing a custom module is somewhat of an involved task
Comment: There is far less of a learning curve with Drupal than there are with other frameworks. Check out [the Drupal examples](https://www.drupal.org/project/examples) project for a ton of examples of how to build modules. You might even be able to modify something there to get what you want.

Allow SQL injection


How to show $f(x) \to 1$?

Question: Let $$f(x) = \frac{e^x-e^{-x}-2x}{e^x+e^{-x}-2}.$$
How do I show that as $x$ gets larger (positively), $f(x) \to 1$? According to WolframAlpha, $f$ is always less than or equal to one. I don't see why it is true.
Comment: for $x$ large positive, $e^x >>x.,$  therefore you basically have $\frac{e^x}{e^x}.$  all this will become much clearer if you will just evaluate the quotient $\frac{e^x-e^{-x}-2x}{e^x+e^{-x}-2}$  for $x = 10$(say).
Answer: Multiply by $1$ in the carefully chosen form $\dfrac{e^{-x}}{e^{-x}}$.
Added: To see that $f(x)\le 1$, start by rewriting it:
$$f(x) = \frac{e^x-e^{-x}-2x}{e^x+e^{-x}-2}=1-\frac{2(e^{-x}-1+x)}{e^x+e^{-x}-2}\;.$$
Next, note that $e^x+e^{-x}-2>0$ for $x\ne 0$: its derivative is $e^x-e^{-x}$, which is negative for $x<0$, $0$ at $x-0$, and positive for $x>0$, so $e^x+e^{-x}-2$ attains its minimum at $x=0$, and that minimum is $0$.
Finally, for $x>0$ we have $e^{-x}>1$, so $e^{-x}-1+x>0$. Thus,
$$\frac{2(e^{-x}-1+x)}{e^x+e^{-x}-2}>0$$
for $x>0$, and therefore $f(x)<1$ for $x>0$.
Comment: Thanks. Do you know any nice of showing $f(x) \leq 1$ when $x > 0$? I tried showing $f'(x)$ is positive but this is hard to see.
Comment: @Upin: I've added a proof that $f(x)<1$ when $x>0$.
Comment: @Upin: You're welcome.

How to show $f(x) \to 1$?


Why did div with no content be influenced by child elements

Question: I tried out to do some css3 animation with compass(sass framework).
I found accidentally that div with no content will be influenced.
The following is my sample code
HTML

Sass
@import "compass/css3"

.box
    width: 600px
    height: 600px
    background-color: pink
    .ball
        width: 40px
        height: 40px
        +border-radius(100%)
        background-color: black
        margin-top: 50px  // How to just margin top the ball div

The result is looking like this. The div.box was following the ball.div margin top 200px, but I want it stay on the top of the page.

But when I add some content into div.box, the result is perform well but with some superfluous content.

0

I curiously why did div with no content be influenced by child elements, and how to deal with it.
Comment: Your research term is _collapsing margins_.
Comment: Unclear what you are asking. You added text content somewhere, and now you wonder that it is shown as text content ... why?
Comment: I want to do the same effect but with no content in the base div
Comment: Please provide a [mcve] somewhere so that we can look at the issue live.
Comment: I have revised my question. Thank you for advising.
Comment: I have resolve it. Thank you
Answer: According to @CBroe's comment.
This is a problem call Collapsing margins.
The problem occurs when:

Inner and outer elements are both display as block.
There are no border, padding, and overflow attributes been set on outer elements.
The position of first/last child of outer elements is not setting as float or absolute and remaining the content is blank.

The first/last child's border will be merged to it's parents.
The following code will solve the problem
.box
    overflow: auto // Set overflow attribute to outer element
    height: 600px
    background-color: pink
    .ball
        width: 40px
        height: 40px
        +border-radius(100%)
        background-color: black
        margin-top: 50px


How to undo "Reset current Branch to Here" in Intellij

Question: Does anyone know how to undo the reset of a branch in Intellij IDEA? In other words: is it possible to restore commits made after the current state of the branch?
It's hard to find the answer on the internet because my question gets confused with reverting the commit, which is not what I mean.
Comment: Take a look at `git reflog` so that you can see what was in the branch before (in case you are dealing with local branches). Once you have the ID of the commit you want, put the branch there.
Comment: Does this answer your question? [How can I undo git reset --hard HEAD~1?](https://stackoverflow.com/questions/5473/how-can-i-undo-git-reset-hard-head1)
Answer: You can right click on a file in the project pane and look at "Local History".
If you are fortunate, you can see a version of the code there that you are looking for.
Comment: This indeed did the trick. Thank you :)


VS2010, VSpackage, adding command for certain filetypes in the context menu?

Question: I'm developing a vspackage for executing *.bat files in my vs2010 solutions.
Therefore I need a button when I right click my files to get a context-menu in solution explorer.
I would like the button only to be visible when right clicking *.bat files. Is that possible?
Answer: You can achieve this quite easily. First, you need to create menu item in solution explorer context menu. You can learn how to add menu items in general on MSDN.
To be more exact, you need set your menu group's parent to:
<Parent guid="guidSHLMainMenu" id="IDM_VS_CTXT_ITEMNODE"/>
Both guid and id are predefined in Visual studio, the latter means that the menu item will be displayed whenever user clicks on standard project item. However, you need it only to appear when the name of the file ends with ".bat". This can be achived in BeforeQueryStatus method - see MSDN link above. To find out selected nodes in solution explorer, use
(UIHierarchy)ideObject.Windows.Item(EnvDTE.Constants.vsWindowKindSolutionExplorer).Object
which has SelectedItems property.


Why is step 2 of file to media migrate giving me missing bundle error?

Question: I am following the instruction on this page : https://www.drupal.org/project/migrate_file_to_media/issues/3118471 , but with media of bundle document, not image.  I have my step 1 yml on this issue How can i debug why files are not being created when using migrate files to media module?
My nodes of type grants and step 1 files are being created as media correctly, however when i do step 2, using the yml below, I get this error :
Missing bundle for entity type node (/var/www/html/docroot/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php:108)
id: migd8_grants_media_step2
label: grants Media Mapping
migration_group: cncs
source:
  key: migrate
  plugin: d7_node
  node_type: grants

destination:
  plugin: entity:node

process:
  nid: nid
  changed: changed

  field_files:
    plugin: file_id_lookup
    source: field_files
    migration: migd8_grants_media_step1
    no_stub: true

migration_dependencies:
  optional:
  - migd8_node_grants
  - migd8_grants_media_step1

I made some changes as an experiment and started getting duplicate grants being created, one with the correct media files attached, and one without , these are the changes i made which caused the duplicates with one having the correct file attached:
id: migd8_grants_media_step2
label: grants Media Mapping
migration_group: cncs
source:
  key: migrate
  plugin: d7_node
  node_type: grants

destination:
  plugin: entity:node

process:
  nid: nid
  changed: changed
  title: title
  type:
    plugin: default_value
    default_value: grants
  field_files:
    plugin: file_id_lookup
    source: field_files
    migration: migd8_grants_media_step1
    no_stub: true

migration_dependencies:
  optional:
  - migd8_node_grants
  - migd8_grants_media_step1

Comment: Does the content type **grants** exist in both, the D7 and the D8 site? Seems like perhaps it doesn't exist on one of the sites.
Comment: Hmmm in D7 & D8 edit the Grants content type and [check that the machine name](https://i.imgur.com/81RLH89.png) is indeed grants for both. Also check that in [D8 the files field has a field type of entity reference](https://i.imgur.com/fJgCWlk.png) (which should be referencing  Media) and its not a field type of file.
Comment: The field names are correct , I made some changes and i started getting duplicate grants, one with the files attached correctly and the other without .  i put the yml that i made that causes those duplicates in the description above, one with the correct media attached.  how can i get that result without the duplicates?
Comment: actually the source in the original migration is a plugin : source:
  plugin: migd8_node_grants  does that make a difference?
Answer: in step2 i had to change it to this
destination:
  plugin: entity:node
  default_bundle: grants


Prove that $x \in \mathbb{R}$ is a limit point of a set $A \subset \mathbb{R}$ if and only if $d(x, A \setminus {x})=0$.

Question:
Prove that $x \in \mathbb{R}$ is a limit point of a set $A \subset \mathbb{R}$ if and only if $d(x, A \setminus {x})=0$.

I think I have it right but I would like to have it checked.
We assume that $x$ is a limit point of the set $A$.
Then we will have every neighbourhood $(x-r,x+r)$ where $r$ is the radius and is arbitrary intersects the set $A$, so we can phrase as $\forall r > 0 a \in A$ and $x \ne a$ such that $d(a,x)< r$.
Now,
$$\inf\{d(a,x) \text{ where } a \in A \text{ and } a \neq x\}=0.
$$
Essentially letting $r$ become very small and close to $0$ to make $d(a,x)$ become $0$.
Therefore, $d(x,A\setminus\{x\})=0$.
Now, we assume that $d(x,A\setminus\{x\})=0$.
Because $d(x,A\setminus\{x\}) = \inf\{d(a,x) \text{ where } a \in A \text{ and } a \ne x\}$, we will have
$$
\inf\{d(a,x) \text{ where } a \in A \text{ and } a \ne x\}
=0.
$$
Now, forall $r>0$ $a \in A$ and $x \ne a$ such that $d(a,x)< r$ which means every neighbourhood of $x$ contains a point of $A$ that is different from $x$. Therefore, $x$ is a limit point of the set $A$.
Comment: Your proof seems generally correct. I think you can make it cleaner by making it a bunch of if and only ifs.
Answer: The metric $d$ is continuous.   See here.
Now use the limit point definition of continuity, and a sequence $(x_n)\in A\setminus \{x\}$ with $x_n\to x$.
I think you have the right idea.   But your wording is very awkward and not quite correct.
Comment: I guess that could work but I wasn't using metric. I suppose that you can have a limit of a set A is some point x. Then that implies there exists a limit of a sequence g of A such that it tends to x. Consequently, d(x, A\{x}) -> 0 as the sequence g -> x. Is this using Cauchy? because if space is not Cauchy, you cannot assume that a sequence which tends to a limit x doesn't have a subsequence that doesn't diverge.
Comment: By definition of limit point, we have a sequence $x_n\to x$.  Then since $d(x,A):X\to\Bbb R$ will be continuous,  we have $0=\lim_{n\to\infty}d(x_n,A)=d(\lim_{n\to\infty}x_n,A)=d(x,A)$.
Comment: No real reason to worry about being Cauchy.  Every convergent sequence is Cauchy;  but here that's really beside the point.
Answer: Improvement suggestion, staying close to the definition of infimum (no "letting $r$ get smaller and smaller" vagueness, but definitions):
If $x \in A'$ then let $s=d(x,A\setminus\{x\}) \ge 0$.
Suppose for a contradiction that $s >0$, and consider $B(x,s)$, which is an open ball around $x$, and as $x$ is a limit point of $A$, we can find $y \neq x$ such that $y \in B(x,s)$, or equivalently $d(x,y) < s$. But then $y \in A\setminus \{x\}$ and so $(s=)d(x, A\setminus\{x\}) \le d(x,y)(<s)$ (a lower bound of a set is $\le$ to each of its elements), but then $s < s$ which is a contradiction, so $s=0$ and indeed $d(x,A\setminus\{x\})=0$ as required.
Now suppose $d(x,A\setminus\{x\})=0$ and let $r>0$ be arbitrary. Then $r$ is not a lower bound of the set $D=\{d(x,y): y \in A\setminus\{x\}\}$, or it would be a strictly larger lower bound for $D$ which has largest lower bound $d(x,A\setminus\{x\})=0$. So some element of $D$ is smaller than $r$, or otherwise put, there is some $y \in A \setminus \{x\}$, so $y \in A, y \neq x$ such that $d(x,y) < r$. But this means this $y \in B(x,r)$ as required, and so $x$ is a limit point of $A$.


Is a "SSS domains" 's function Lipschitzian?

Question: Let $\Omega$ to be an open of $ \mathbb R^d$

We say that $\Omega$ is a strongly star-shaped domain (with respect to the origin $0$) if :

$\Omega  = \{x\in \mathbb R ^n : \left \| x \right \| < g(\frac{x}{\left \| x \right \|})\}\cup\{0\} $ and
 $\partial \Omega  = \{x\in \mathbb R ^n : \left \| x \right \| = g(\frac{x}{\left \| x \right \|})\} $
with $g$ is a continuous, positive function on the unit sphere.
I'm looking for the proof of :

If $\Omega$ is a Lipschitz domain, is a $g$ Lipschtiz function??

I appreciate your answers and your help.
PS: A domain of $\mathbb{R}^d$ with Lipschitz boundary is an open subset $\mathcal D \subset \mathbb{R}^d$, wich is locally the subgraph of a Lipschitz function with respect to some choise of orthogonal coordinates. In other words, for any $x_0\in \partial \mathcal D$, up to an orthogonal change of coordinates, there is an open set $U\subset \mathbb R^d$, and a Lipschitz function $\phi:\mathbb R^{d-1}\rightarrow \mathbb R^{+}$ such that: $$\mathcal D\cap U=\{x=(\underbrace{x_1,...,x_{d-1}}_{x^{'}},x_d)\in U: 0<x_d<\phi(x^{'})\}.$$
Comment: Did $g$ change its name to $h$? (Also, but less importantly, I wonder why the definition specifies $\partial\Omega$ the way it does. I would have thought this follows from the form of $\Omega$, given the stated requirements on $g$ of course.)
Comment: Yeah it's "$g$". The definition is like that , you can find it in the book of Galdi .. I think it's "obvious" that $g$ is Lipschitz, because it modilises $\Omega$ which is Lipschitz, but I don't know how to prove it..
Answer: No, I don't think so. Take a function $g$, such that
$$g( \cos(\phi), \sin(\phi)) = 1 + \operatorname{sign}(\phi) \, \sqrt{|\phi|}$$
for small values of $\phi$.
Then, $g$ is not Lipschitz. However, the singularity of the derivative of $g$ turns into an horizontal tangent for $\partial\Omega$ at $(1,0)$, and $\Omega$ is still Lipschitz (it could be even $C^1$?).
Edit: Here is a picture of $\Omega$.
Comment: Yeah, your $g$ is not Lipschitz, but why $\Omega$ Ω  is still Lipschitz? Can you explain me a little.?
Comment: I have added a picture. I do not see any reason why $\Omega$ is not Lipschitz.
Comment: Can you give me the program's name that you used to draw the graph of $\Omega$?  Thank's a lot
Comment: This picture is just drawn with Matlab.


action_mailer.delivery_method in test.rb not being followed

Question: I've noticed my Cucumber tests started to take a loooong time to run, and eventually I realized it's because it's trying to connect to an smtp server when I use mailers. I already have the following line on my test.rb file:
config.action_mailer.delivery_method = :test
However, that setting doesn't seem to be followed. If I remove the line below from my mailer.rb file, then it all works fine:
ActionMailer::Base.delivery_method = :smtp
Of course if I remove that line, then the production version won't work anymore...
Any ideas?
Answer: You probably have
<code>ActionMailer::Base.delivery_method = :smtp
</code>
Being set somewhere after the test.rb is run.
You should configure your production mailer details inside production.rb
Comment: Yup... I had the settings in a config/initializers/mailer.rb file, instead of production.rb. I guess wherever I learned about mailers a few months ago was just plainly wrong. Thanks!  :)


Call between subroutines

Question: I'm new to Fortran programming and I'm trying to understand the call between subroutines. So I wrote a simple program to test it
Here is my code
program dummy

    real, allocatable, dimension(:)         :: zz,yy

    call test2(zz,yy)

    print *, zz, yy

contains

    subroutine test1(ar1,ar2,arsum)
        real, dimension(:)                  :: ar1,ar2
        real, allocatable, dimension(:)     :: arsum
        allocate(arsum(size(ar1)+size(ar2)))
        arsum(1:size(ar1)) = ar1
        arsum(size(ar1)+1:size(ar1)+size(ar2)) = ar2

    end subroutine test1

    subroutine test2(sg1,sg2)
        real, dimension(3)              :: g1,g3
        real, dimension(4)              :: g2,g4
        real, allocatable,dimension(:) :: sg1,sg2,dum
        g1 = 1.0
        g2 = 2.0
        g3 = 3.0
        g4 = 4.0
        call test1(g1,g3,dum)
        sg1 = 2*dum
        call test1(g2,g4,dum)
        sg2 = 3*dum
    end subroutine test2

end program dummy

However this throws me the following error
forrtl: severe (151): allocatable array is already allocated
Image              PC                Routine            Line        Source
dummy.exe          0000000000409B1C  Unknown               Unknown  Unknown
dummy.exe          0000000000402E70  MAIN__                     26  dummy.f90
dummy.exe          0000000000402A2E  Unknown               Unknown  Unknown
libc-2.23.so       00002B3E716C7830  __libc_start_main     Unknown  Unknown
dummy.exe          0000000000402929  Unknown               Unknown  Unknown

The test1 subroutine simply concatenates any two given arrays. Test2 subroutine defines the arrays to be concatenated and does some algebra on the output and stores them in new arrays. The program dummy simply prints the new arrays.
What is it that I'm doing wrong here?
Answer: Let's look at the flow of the program here.  There's some terminology involved here, but what is used can hopefully be explored through other documentation.
The main program calls the subroutine test2 with a couple of arguments.  For the problem here, those arguments are of no interest.  Instead, look at the local (to the subroutine) variable dum.
dum is an allocatable array.  It starts life at execution of test2 as not allocated.  It's first an (actual) argument to the call of test1 and later as an (actual) argument to another call of test1.  So, what goes wrong?
Intent of the arguments is crucial here.  Really crucial.  One should read up on intents elsewhere before continuing with this answer.
So, we're now familiar with argument intents.
On entering the subroutine test1 the dummy argument arsum has the same allocation status as the actual argument dum.  During test1's execution there is an allocate statement.
An allocate statement may only attempt to allocate a thing not already allocated.  This is fine on the first call: on entry dum/arsum is not allocated.  During execution of the subroutine arsum is allocated, and this affects the allocation status of test2's dum.
On the second call to test1 arsum is now allocated because the actual argument dum is allocated.  The allocate statement fails, with the error message given, because of this.
That's the problem; how to fix?  We need to ensure arsum is not allocated.  There are two obvious ways:

test the allocation status of arsum and respond accordingly (perhaps with a deallocate);
deallocate dum between calls of test1.

But there is a possibly more appropriate way.  Note that dum is useful only as returning to test2 the value of some operation.  Think back to intents: this is what intent(out) signifies.
If we rewrite the subroutine test1 as
subroutine test1(ar1,ar2,arsum)
    real, dimension(:)                           :: ar1,ar2
    real, allocatable, dimension(:), intent(out) :: arsum
    allocate(arsum(size(ar1)+size(ar2)))
    arsum(1:size(ar1)) = ar1
    arsum(size(ar1)+1:size(ar1)+size(ar2)) = ar2
end subroutine test1

then, because of the intent(out), attribute arsum/dum is automatically deallocated if it is allocated on entry.
Finally (and not shown), one could even consider using a function to return arsum or even use automatic arrays rather than allocatable ones.  Or, even Fortran 2003 automatic allocation and an array constructor:
subroutine test1(ar1,ar2,arsum)
    real, dimension(:)              :: ar1,ar2
    real, allocatable, dimension(:) :: arsum   ! Or with `intent(out)`
    arsum = [ar1,ar2]
end subroutine test1

Call between subroutines


Foreign key para tabelas diferentes (MySql)

Question: Na hora de executar a query da erro informando que não é possível criar as foreign keys, procurei na documentação e não entendi direito se esse código é possível ou não.
create table autor(
    cod_autor integer,
    nome varchar(50) NOT NULL,
    nascimento date NOT NULL,
    primary key(cod_autor)
);

create table editora(
    cod_editora int,
    razao text,
    endereco varchar(50),
    cnpj int NOT NULL UNIQUE,
    cidade varchar(40),
    primary key(cod_editora)
);

create table livro(
    titulo varchar (100),
    cd_autor integer NOT NULL,
    cd_editora integer,
    valor float NOT NULL,
    publicacao DATE not null,
    volume INTEGER NOT NULL,
    primary key (titulo,cd_autor),
    foreign key(cd_autor) references autor(cd_autor) ON UPDATE SET NULL  ON DELETE SET NULL,
    foreign key (cd_editora) references autor(cd_autor) ON UPDATE SET NULL ON DELETE SET NULL
);

Erro :

Cannot add foreign key constraint
Answer: Você tem vários erros:

Precisa de um campo PK em livro
Está faltando o tamanho em razao text,
Está fazendo referências erradas das chaves estrangeiras ("foreign key").

Corrigindo
1 - Adicionei mais um campo para ser chave primária:
create table livro(
    livro_id int,

2 - Coluna razao:
razao text(N),

N = Caracteres a serem exibidos na coluna.

3 - Chaves estrangeiras:
foreign key(cd_autor) references autor(cod_autor),
foreign key (cd_editora) references editora(cod_editora) ON UPDATE SET NULL ON DELETE SET NULL

Detalhando
Na criação do campo razao:
Falta por o tamanho. Exemplo: text(30).
Na primeira chave estrangeira:
Em foreign key(cd_autor) você está dizendo que a coluna cd_autor da tabela livro será a chave estrangeira.
E em references autor(cod_autor) você está fazendo referência a tabela autor e a coluna que irá referenciar, será o cod_autor (que a chave primária)
Na segunda declaração:
Em foreign key(cd_editora) você está dizendo que a coluna cd_editora da tabela livro será a chave estrangeira.
E em references autor(cod_editora) você está fazendo referência a tabela editora e a coluna que irá referenciar, será o cod_editora (que a chave primária)
Além disso, você não pode definir ON UPDATE SET NULL  ON DELETE SET NULL se você exige que a coluna cd_autor da tabela livro não seja NULL: cd_autor integer NOT NULL,
Então ou você tira essas condições, ou não define a coluna como NOT NULL.

Importante

A chave estrangeira requer referência a uma chave primária e/ou única (PRIMARY KEY e/ou UNIQUE).

Exemplo

Veja o exemplo do seu script funcionando no SQLFiddle.
Comment: Quanto a referencia, foi uma edição errada minha na pergunta antes de publicar, o erro foi exatamente no `ON UPDATE` e `ON DELETE`. A tabela `livro` possui PK: `primary key (titulo,cd_autor),`
Comment: @pic Também aí. Caso não entender algo na resposta, pode perguntar! ;)
Answer: Estava errada a variável a que fazias referência. Seria 'cod_autor'.
 foreign key(cd_autor) references autor(cod_autor) ON UPDATE SET NULL  ON DELETE SET NULL,
 foreign key (cd_editora) references autor(cod_autor) ON UPDATE SET NULL ON DELETE SET NULL

Quanto à segunda foreign key não será:
foreign key (cd_editora) references editora(cod_editora) ON UPDATE SET NULL ON DELETE SET NULL

Comment: como eu comentei na outra resposta a referencia n era um problema, foi apenas um equivoco na hora de postar a pergunta


Show that $\sum_{i=1}^n D_iF(g)dg_i=0$

Question:
Let $F(x)=\sum_{i=1}^nx_i^4$ on $\mathbb R^n$, and let $\Omega=\{x\in\mathbb R^n:F(x)\leq 1\}$. Consider
  $$
\omega=\sum_{i=1}^n(-1)^{i+1}D_iF\,dx_1\wedge\dots\hat{dx_i}\dots\wedge dx_n.
$$
  a) Show that $\int_{\partial\Omega}\omega>0$.
b) Let $g=(g_1,\dots,g_n)\colon\Omega\to\partial\Omega$ be a map of class $C^\infty$. Show that
  $$
\sum_{i=1}^n D_iF(g)dg_i=0.
$$

I managed to show part a using Stokes' theorem. However, I'm don't know how to solve b.
edit
After some help here and there, I finally found a solution. I've posted it as an answer, as there is really nothing left to ask.
Answer: We know that $d(F\circ g)=g^*(dF)$. The exterior derivative of $F$ is given by
$$
dF=\sum_{i=1}^n D_iF\,dx_i.
$$
So we're going to calculate the pull-back:
$$
g^*(dF)=\sum_{i=1}^ng^*(D_iF\,dx_i)=\sum_{i=1}^n g^*(D_iF)g^*(dx_i)=\sum_{i=1}^nD_iF(g)\,dg_i,
$$
where we used that $g^*dx_i=dg_i$. Now I need to argue that this equals zero. We know that $F(x)\equiv1$ on its boundary, and since $g(\Omega)=\partial\Omega$, we have $F\circ g\equiv 1$. This means that $d(F\circ g)=0$. This concludes the prove.

Show that $\sum_{i=1}^n D_iF(g)dg_i=0$


user ability to hide one column only on view

Question: What is the best way to give the user the ability to see or hide one column (only one) on a drupal 7 view?  I want to give them a toggle box to be able to hide and unhide the column
Answer: Found the answer here http://siripong-computer-tips.blogspot.com/2011/12/hide-table-column-drupal-view-w-jquery.html
View 3 on drupal 7 produces html like this

    Example
    howto
    dynamically
    show/hide

      table column
      Drupal
      Views
      jquery

go to view edit page
Displays -> Page Details -> Page Settings -> Footer
add the following code
Show columns
<form>
<input onclick="toggleVis(this, '.views-field-title')" type="checkbox"> Title
<input onclick="toggleVis(this, '.views-field-body')" type="checkbox"> Body
</form>

using Jquery to toggle hide the column


how can i get path vocabulary based taxonomy term with node title using views?

Question: I have created vocabulary called Category and it contains below hierarchy
term1
  term 1.1
     term 1.1.1
     term 1.1.2
     term 1.1.3
  term 1.2
term2

and i have assigned to this category to content type called Product after that i have displayed those product items based on category using views with panels it's working fine.when i click product title the url goes like this
http://www.example.com/content/prodcut-title
but i want path like this
http://www.example.com/category/term1/term1.1/term1.1.1/product-title
category with term based product title using views.
Please suggest possible ways,
Thanks.
Answer: Try to change alias pattern for products. Install Entity Token + Pathauto, and on Pattern tab in alias settings (admin/config/search/path/patterns) try to use something like:
[node:field-category:parents:join:/]/[node:field-category:name]/[node:title]
Comment: Thanks for quick email@example.com have tried  following pattern from my site available tokens **"[node:field-categories:1:parents:join:/]/[node:field-categories:1:name]/[node:title]"** but no change when i clk product title.also i have separate template files also other then pattern is there any hardcode one "content; ?>"


tangent line, equation

Question: Can you prove which is the tangent equation using derivative.
Why the tangent line $l$ through $(x_{0}, f(x_{0}))$ with slope $f'(x_{0})$ is:
$$l(x)=f(x_{0})+f'(x_{0})(x-x_{0}) \mbox{?}$$
Thank!
Answer: The equation of any line passing through  $(x_{0}, f(x_{0}))$  is $\frac{y-f(x_0)}{x-x_0}=m$  where $m$ is the slope.
Now if the line is a tangent of $y=f(x)$ at $(x_{0}, f(x_{0}))$, the slope of the line = the slope of  $y=f(x)$ at $(x_{0}, f(x_{0}))$ which is  $f'(x_{0})$ .
So, the equation of the line which is  a tangent of  $y=f(x)$  at $(x_{0}, f(x_{0}))$ will be $\frac{y-f(x_0)}{x-x_0}=f'(x_0)$
Comment: Ok :) now, how can I do the transition to the tangent plan.

$\displaystyle z=f(x_{0},y_{0})+[\frac{\partial f}{\partial x}(x_{0},y_{0})](x-x_{0})+[\frac{\partial f}{\partial y}(x_{0},y_{0})](y-y_{0})$
Comment: Let $t = (x,y).$ Then, $z = f(t_0)+\nabla(t_0)(t-t_0)$ which is the $\mathbb{R}^2$ generalization of the $\mathbb{R}$ example first considered.
Answer: Hint :  What is the equation of a line through a point with a given slope?

tangent line, equation


Bringing unit testing to an existing project

Question: I'm working on an existing Java EE project with various maven modules that are developed in Eclipse, bundled together and deployed on JBoss using Java 1.6. I have the opportunity to prepare any framework and document how unit testing should be brought to the project.
Can you offer any advice on...

JUnit is where I expect to start, is this still the defacto choice for the Java dev?
Any mocking frameworks worth setting as standard? JMock?
Any rules that should be set - code coverage, or making sure it's unit rather than integration tests.
Any tools to generate fancy looking outputs for Project Managers to fawn over?

Anything else? Thanks in advance.
Comment: EasyMock is the best known mocking framework(look at google searches :P). the name is not as cool as jMock however it is better. However Mockito allows you to skip one step in creating mocks(you dont need to replay(mock) after setting it up).
Answer: Concerning the unit testing framework, there are mainly two of them : jUnit and TestNG. Both have theuir advantages, and both are equally performant. The main dvantage of jUnit is (to my mind) its default incoproration of an Eclipse plugin allowing easy tests calling.
Concerning the mocking framework, I don't find them to be a required part of your testing approach. Of course they're useful, but they solve a specific purpose : testing a behaviour (as opposite to testing an interface - what jUnit allows. With mocking frameworks, you're able to test how a specific class implements a specific interface. Will you need it ? Obviously. Will you need it first ? I don't know.
Concerning the rules, the only one I've found to be useful is simple (as always) : "always test code that broke at least once.". Consider your bug tracker. Each time a bug is encountered, there must be a unit test ensuring there is no regression. It's, to my mind, the faster way to have quality code.
Concerning the fancy- and efficient - output, I can recommend you enough to install a continous integration server (Hudson, obviously). It will run all your test suite each time code is commited, to ensure there are no side effects. it will generate graphs shoiwing the number of test run, and so on. it also can integrate code coverage tools and graphs. This continuous integration server will really become fast your testing buddy.
Comment: This isn't really the purpose of a mocking framework. The true purpose is to be able to test ClassA which uses InterfaceB, and to mock B to test how A behaves when B does this or that - to fully isolate the test of A from any implementations of B (otherwise you would be testing both at the same time, and then it's not a *unit* test).
Answer: This is a complex question, so just a few notes about our practice at $work:

JUnit is indeed still the standard. Most documentation and literature treats JUnit.
Mockito seems to be the new star in Java mocking, although we still use JMock and think it's fine for our needs.
We use the EclEmma Eclipse plugin for checking our test coverage, and like it.
Answer:
Any tools to generate fancy looking outputs for Project Managers to fawn over?

Be careful.  A fancy tool for displaying metrics on unit test counts, coverage, code quality metrics, line counts, check-in counts and so on can be dangerous in the hands of some project managers.  A project manager (who is not in touch with the realities of software development) can get obsessed with the metrics, and fail to realize that:

they don't give the real picture of the project's health and progress, and

they can give a completely false picture of the performance of individual team members.

You can get silly situations where a manager gives the developers the message that they should (for example) try to achieve maximal unit test coverage for code where this is simply not warranted.  Time is spent on pointless work, the important work doesn't get done, and deadlines are missed.

Any rules that should be set - code coverage, or making sure it's unit rather than integration tests.

Code coverage is more important for parts of the code that are likely to be fragile / buggy.  Acceptable coverage levels should reflect this.

Unit tests versus integration tests depends on the nature and complexity of the system you are building.

Adding lots of unit level tests after the fact is probably a waste of time.  It should only be done for class identified as being problematic / needing maintenance work.

Adding integration level tests after the fact is useful, especially if the projects original developers are no longer around.  A decent integration test suite helps to increase your confidence that some change does not break important system functionality.  But this needs to be done judiciously.  A test suite that tests the N-th degree of a website's look and feel can be a nightmare to maintain ... and impediment to progress.
Answer: If you haven't done so already, read Working Effectively with Legacy Code by Michael Feathers.
Answer: I've been retrofitting unit tests to a C++ project and it is not pleasant.
First thing I did was to identify where most of the 'action' occurs.  Then use that to start putting unit tests on the functions that can be test easily.
Then once you have the easier ones you can start looking at expanding the coverage virally - attack the functions that have fewer dependancies, run through them a few times in a debugger seeing what values are passed in and then write unit tests with those values to make sure you don't break anything.
Don't expect a quick fix - it's taken 3 weeks (6hr days, 5 days a week) to get 20% coverage but the code spends 80% of the time in that code so I think it has been time well spent and has uncovered quite a few bugs.
Answer: Regarding test coverage, I think that when you're bringing in unit testing to an existing project it's too early to start setting coverage expectations. You should start by ensuring that you actually can integrate the test framework and get reports from the coverage tools. Once you've done that you can start monitoring coverage, and then you can consider targets.


How can I display a message when "add another item" on an Inline Entity Form Multiple field is clicked?

Question: In Drupal 8 inline entity form is there a "form_alter" or "submit handler" or some type of ajax callback for when a user clicks "add another item"?
What I would like to do is display a message to the user when they click "add another item" on a Inline Entity Form Multiple field.
Struggling to find the right path.
Answer: You can do this using JS. Add a click event listener on the Add item button. When the button is clicked you set a message.
Something like this should work:
$('.add-item-class').on('click', function () {
  const messages = new Drupal.Message();
  messages.add('You clicked the add item button!');
});

Make sure you have Drupal available in your JS file by adding it as a dependency in your libraries file.
js:
  path/to/js-file.js: {}
  dependencies:
    - core/drupal
    - core/jquery

Please note that the Drupal.Message() was first introduced in Drupal 8.7, so if you use an older version it would not work.
Another possible solution is to create a route that sets the message, using \Drupal::messenger()->addMessage('').
Your controller will do like this:
\Drupal::messenger()->addMessage($this->t('Your added an item!'));
$messages = ['#type' => 'status_messages'];
return new JsonResponse(['message' => Json::encode(\Drupal::service('renderer')->renderRoot($messages))]);

And your JS file like this:
$('.add-item-class').on('click', function () {
  $.get('/path/to/your-route', function (response) {
    $(context).find('.region-highlighted').prepend(JSON.parse(response.message));
    setTimeout(function () {
      $(context).find('.region-highlighted .messages').remove();
    }, 5000);
  });
});

This appends the message to the highlighted region and removes it after 5 seconds. You can place it anywhere you want.
Answer: The IEF Api has a hook for performing alterations before the entity form is included on the IEF widget. You can add your message after checking you're on the right form/entity.
/**
 * Perform alterations before an entity form is included in the IEF widget.
 *
 * @param $entity_form
 *   Nested array of form elements that comprise the entity form.
 * @param $form_state
 *   The form state of the parent form.
 */
function hook_inline_entity_form_entity_form_alter(&$entity_form, &$form_state) {
  if ($entity_form['#entity_type'] == 'commerce_line_item') {
    $entity_form['quantity']['#description'] = t('New quantity description.');
  }
}


Splitting lemma in the case the retraction is a crossed homomorphism

Question: Suppose we have an exact sequence of groups
$$1\rightarrow A\stackrel{i}{\rightarrow} B\stackrel{p}{\rightarrow} C\rightarrow 1$$
with $A$ abelian. Suppose also that we have an action of $C$ on $A$, whence an action of $B$ on $A$ (via $p$). I don't want to assume that this action is given by lifting elements of $C$ to $B$, then conjugating (well defined since $A$ is abelian), though it may well be this action.
Suppose further we have a surjective function
$$A\stackrel{r}{\leftarrow}B$$
with the property that $r\circ i = \text{id}_A$, and that $A\stackrel{r}{\leftarrow}B$ is a crossed homomorphism. This means, that for all $b_1,b_2\in B$, we have:
$$r(b_1b_2) = r(b_1)\cdot \,^{b_1}r(b_2)\qquad\text{for all $b_1,b_2\in B$}$$
(where the left exponent denotes the action of $b_1$ on $r(b_2)$).
Note that $r|_{i(A)}$ is just the inverse of $i$, hence a homomorphism.
I wish to know if given the above, $B$ admits some kind of splitting - e.g., is $B = A\times C$ (or perhaps a semidirect product, or something else?)
In general, the kernel of a crossed homomorphism (the preimage of 1) is a normal subgroup, and certainly $\ker(r)\cap i(A) = 1$.
It seems natural to wonder what one can say about $\ker(r)$. For example, must it surject onto $C$?
Is there a good general reference for algebra with crossed homomorphisms?
Answer: It is not true in general that $\ker r$ is a normal subgroup of $r$, although it is a subgroup.
It is true that $\ker r$ surjects onto $C$. Since the action of $B$ on $A$ is defined using an action of $C$ on $A$ and the map $p$, it follows that $i(A)$ acts trivially on $A$.
So for $c \in C$, there exists $b \in B$ with $p(b)=c$. Let $r(b) = a$. Then
$$r(i(a^{-1})b) = ri(a^{-1})\,\, {}^{i(a^{-1})}r(b) = a^{-1}a=1,$$
and $p(i(a^{-1})b) = c$.
Comment: Ah, you're right it's not a normal subgroup. I made a mistaken in my calculation. I suppose this means it's a semidirect product?


Nested jquery accordion is not working

Question: I want to create a nested jquery accordion but the output isnt correct.
I have created a fiddle. http://jsfiddle.net/p3Dnp/

<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">

<link rel="stylesheet" href="/resources/demos/style.css">

1

11

12

2

21

22

3

31

32

As you see when I add a nested accordion it just eats up the parent accordion headers
Any help is appreciated
Comment: You use `$('div.accordion')` ; But there is no `div` with a accordion class there. And you have given all the `div`s the same `id`. bad html.
Comment: @GaurangTandon I tried using class instead of id still no change
Comment: I didn't say it would work. I said it's bad to give the same id to multiple elements. Change the code to use classes, and then paste the new code here.
Answer: Your HTML has incorrect closing div s and id cant be repeated for the section, we must use class attribute for nested accordion
Your markup should like this,

1

11

12

2

21

22

3

31

32

One accordion call is enough for us
$('div.accordion').accordion({
        autoHeight: false,
        collapsible: true,
        active: false
    });

I updated the FIDDLE . I think this is what u expect.
Answer: Make sure you use unique header attribute selectors for nested accordions, as per the documentation,

Selector for the header element, applied via .find() on the main accordion element. Content panels must be the sibling immediately after their associated headers.

this means that if you do not define a unique selector (the default being h3) it will bind click events to all .find('h3') elements and therefore inner accordions will also trigger the outer ones.
Hence, do something like
$('#accordion').accordion(
  autoHeight: false,
  collapsible: true,
  active: false,
  header: '> h3'
});

this ensures that only the direct h3 children are used as headers.

Nested jquery accordion is not working


How can nested subdirectories and symbolic links be used without conflict with a multi-site Drupal installation?

Question: My question is basically a reflection of the question found here (which unfortunately does not have a clear answer): http://groups.drupal.org/node/20604
Please note that this is not a question about multi-site setup, but it is rather a question about a complicated edge-case; please read through before jumping to suggestions. Also, take a look at the link above if you need more info.
Note also multi-site works generally fine, just not this case.
Some truths:

I am using symbolic links (on RHEL5 to be exact)
I am using Drupal 6.20
I am using Apache
I am using subdirectories (NOT subdomains, switching to subdomains is not an acceptable answer)
My Drupal site directories are nested two levels deep (e.g. /campus/bus, /campus/news)
The Drupal sites all use the same code base in the /campus directory
The Drupal sites all use different (their own) databases

In my case, there are dozens of sites, but the first conflict I noticed was as follows. There are two sites at urls such as the below structure:
drupal.drupalsite.com/campus/bus

drupal.drupalsite.com/campus/news

In the sites/[foldername] the respective folders are:
drupal.drupalsite.com.campus.bus

drupal.drupalsite.com.campus.news

The campus folder in the web root contains the Drupal install, and also the symbolic links, so in /var/www/campus there are e.g., news -> ./, bus -> ./.
On the 'bus' subsite, attempting to go to https://drupalsite.com/campus/bus/news makes Drupal confused. It seems to drop everything in the request after the last directory. e.g., drupalsite.com/campus/bus/news will instead resolve to drupalsite.com/campus/bus and drupalsite.com/campus/bus/news/headlines will return a 404 not found.
For another data point, I put a var_dump on $dir in the conf_path() function to see how many directories were being looked at for each request. For a non-conflicting URL, such as bus/undergraduate-programs I got the following:
drupal.drupalsite.com.campus.bus

However for a conflicting URL such as bus/news/headlines I get
drupal.drupalsite.com.campus.bus.news
drupalsite.com.campus.bus.news
com.campus.bus.news
drupal.drupalsite.com.campus.bus

There is a patch which could allow the multi-site setup to be done via sites.php instead of via the method of using symbolic links, however it would involve hacking core, and thus I am not willing to entertain it, though for reference it is here: http://drupal.org/node/231298#comment-3769752
To note, I also tried most of the suggestions in the original groups.drupal.org. thread as well as numerous hacks in .htaccess and my httpd.conf file, all to no avail.  Please comment if you need further information to answer the question.
Answer: Are you using just one rewrite? I have this exact setup, and I take care of it with a separate rewrite for each sub-directory. If you just use the default index.php rewrite, the path gets rewritten back to the default, like drupal.drupalsite.com/index.php?q=/campus/news which is where the 404 comes from. I also use aliases in the server level config instead of symbolic links. It makes things cleaner. (Alias /campus/bus /var/www/html/whatever)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} /campus/bus/
RewriteRule ^(.)$ /campus/bus/?q=$1  [L,QSA]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} /campus/news/
RewriteRule ^(.)$ /campus/news/?q=$1  [L,QSA]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} /
RewriteRule ^(.*)$ ?q=$1  [L,QSA]

Comment: I add both the aliases and the rewrites in custom .conf files in /etc/httpd/conf.d. If you have control over the server there is no reason to use .htaccess files. I have the aliases in my VirtualHost directive and the rewrites in a Directory directive. (the relevant /var/www/html/whatever)
Comment: Did you remove the symbolic links? If you didn't you'll probably end up in loops. If it is a rewrite loop, you can turn on the rewrite log to see what it is doing.
Comment: This looks promising. Just to be clear are you doing the RewriteCond in the .htaccess and then your server aliases in your httpd.conf (or whichever Apache conf file) ?
Comment: Great, ok, I'll give this a shot tomorrow night and then report back if this works as the correct answer.
Comment: Well, thanks, but no dice. Perhaps with some more info on how you setup your apache conf files I could get this to work, but currently when trying this, the site root still resolves correctly but anything past that ends up at something like /campus/bus/campus/campus/campus/campus/campus...
Answer: I think the setup you have at the moment in sub directories, is a little non standard, and may not be widely supported.
Given that you are already of piste, a small patch to core may be worth trying. Especially as the patch is in D7.
Or you could just switch to D7. No core hackery needed.
Comment: Well, I appreciate the answer, however as stated, switching to D7 and hacking core are both not answers. We have a roadmap to switch to D7 once 90% of the modules we use have stable D7 releases, and then I will personally port the last 10%. With over 20 sites in production, 60 sites in dev, and approximately 3-5 new sites added each week now, all using a set of about 45 modules, we will not be updating right away. Hacking core is a last resort, but unfortunately is not so much an answer as it is a workaround (and one we will have to change a bunch of scripts to support).


"Basis" of non-separable Hilbert space

Question: I know that any non-separable Hilbert space $\mathcal{H}$ does not have a Schauder basis.
However, does a non-separable Hilbert space $\mathcal{H}$ have a "basis" $B$ in the following sense?

$B$ is finite, countable or uncountable (i.e., no restrictions on the size of $B$, unlike for Schauder bases)
$B$ is orthonormal: For all $b,b' \in B$, $\langle b,b' \rangle = 0$ for $b \neq b'$ and $1$ for $b=b'$
$B$ spans $\mathcal{H}$ in the following sense: Any $x \in \mathcal{H}$ can be written as $\sum_{k \in \mathbb{N}} b_k \langle b_k ,x \rangle$ for a countable subset of $B$: $\{ b_k \}_{k \in \mathbb{N}} \subseteq B$ (I assume $b_k \neq b_l$ for $k \neq l$)

If yes, what is the correct name to refer to such a basis? If no, are there additional assumptions on a non-separable $\mathcal{H}$ that allow such a basis?
Answer: This is known as an "orthonormal basis". See any book or https://en.wikipedia.org/wiki/Orthonormal_basis. Each Hilbert space has such an orthonormal basis $B$. Each $x$ can be written as $x = \Sigma_{b \in B} \langle x, b \rangle b$. You can verify that only countably many $\langle x, b \rangle$ are non-zero (otherwise the sum would not be well-defined).
Comment: A Hilbert space need not be separable. If it separable if and only if it has a countable orthonormal basis.
Comment: The Wikipedia article you cite claims that not every Hilbert space has an orthonormal basis, contradicting your own claim. Do you know which is correct?
Comment: @Anonymous It is true. See https://math.stackexchange.com/q/218092. However, it seems that I did not properly read the Wikipedia article stating "that every Hilbert space admits a basis, but not orthonormal base". This is a mistake. What is true is that not every pre-Hilbert space has an orthonormal basis.
Comment: Interesting. What definition of Hilbert space are you using? Do you assume separable?
Comment: Okay, that's the definition I assumed OP was working with (some books seem to assume separable in their definition). That's fascinating that every Hilbert space has an orthonormal basis.

"Basis" of non-separable Hilbert space


Crossplatform background service + GUI

Question: This seems to be typical application:
1. One part of the program should scan for audio files in background and write tags to the database.
2. The other part makes search queries and shows results.
The application should be crossplatform.
So, the main search loop, including adding data to database is not a problem. The questions are:
1. What is the best way to implement this background working service? Boost(asio) or Qt(services framework?)?
2. What is the best approach, to make a native service wrapper using mentioned libraries or emulate it using non gui application?
3. Should I connect gui to the service(how they will communicate using boost or qt?) or directly to the database (could locks be there?)?
4. Will decsision in point 1 consume all CPU usage? And how to avoid that? How to implement scanning for files less cpu consumable?S
Answer: I like to use Poco which has a convenient ServerApplication class, which can be used in an application that can be run as either a normal command-line application, or as a Windows service, or as a *nix daemon without having to touch the code.
If you use a "real" database (MySQL, PostgreSQL, SQL Server), then querying the database from the GUI application is probably fine and easier to do. If you use another type of database that isn't necessarily multi-user friendly, then you should communicate with the service using loopback sockets or pipes.
As far as CPU usage, you could just use a bunch of "sleep" calls within your code that searches files to make sure it doesn't hog the CPU and IO ports. Or use some kind of interval notification to allow it to search in chunks periodically.
Comment: Thanks for the answer. ServerApplication seems to be what i need, but if services framework from Qt provides has the same functionality, it is a bit more preferable (there is a GUI also, one lib in two applications is better). Are you familiar with this technologies? Are they the same?
Comment: 2. It is rather casual app, so i'm planning to use sqlite. Using poco, is it possible to connect service from Qt gui app? Seems, SFW uses Qt's "reflection" to access the service. Using sqlite directly is blocking, as far as i understood. So will you suggest to use smth like mysql? 3. So, main loop in ServerApplication should be done in main() method, using sleeps there would be ok, right? Or sould i spawn additional thread? Or, are there some kind of main loop in poco like qt has?
Comment: I have never really used the Qt services framework, so I can't comment on that. I tend to use Poco for services because I find Qt to be a pretty heavy weight library, so I only use it in applications where I need a heavy GUI. You can definitely interface between Poco and Qt, but interfacing between Qt GUI and Qt services may very well be easier to do.
Comment: And yes, if you're going to use SQlite, then you will probably want to let your service handle all accesses to it, and have your GUI communicate with the service. MySQL may be a bit heavy for what you're doing, but if not then it would be preferable.
Comment: So quick reply! Thanks! I'm looking into ServerApplication and Task - that seems what i need. The only questions left are: how to communicate between service and qt gui (what is _loopback_ sockets)? Any typed interface possible? There is an ORB in poco, would you suggest it? Mysql will not block either of components, right? But gui need only reading from db and service writing, so will sqlite still block components?

Crossplatform background service + GUI


Combinatorics Inclusion-Exclusion

Question: At one school, three computer languages, Basic, FORTRAN, and Pascal are taught.
Suppose that for each language 27% of the students know that language, for each pair of languages
12% of the students know that pair of languages, and 7% of the students know all three languages.
How many of the students do not know any computer language?
I am not sure how to start this but I think I use inclusion-exclusion method?
Comment: This may help: https://math.stackexchange.com/questions/688019/what-is-the-inclusion-exclusion-principle-for-4-sets
Answer: Yup, inclusion/exclusion is at work here. Drawing a Venn diagram will prove particularly fruitful. Be mindful of intersections and what is in what: you should get something like this:

Since the intersection of two circles is $12\%$, we can conclude, since the intersection of all three is $7\%$, that the blue regions (the pairwise intersections excluding the intersection of all) is $12\% - 5\% = 7\%$
Similarly, since each circle has $27\%$ total, we subtract the blue/white regions of each circle to find that the red regions are $10\%$.
What we seek is the gray: those not accounted for by the circles. Sum up all the percentages from each region and subtract from $100\%$ to get the desired answer.
Answer: $n(A \cup B \cup C)=n(A)+n(B)+n(C)-n(A \cap B)-n(B \cap C)-n(C \cap A)-n(A \cap B \cap C)$
Using this formula, number of students not knowing any language can be obtained. Hope it helped you.
Comment: This is close but there are 4 sets in the problem not only 3. See the comment I made up under the question.

Combinatorics Inclusion-Exclusion


Is it feasible to get into amateur sports as an adult?

Question: It seems that even most amateur sports groups are made up of people who played on at least a related Varsity team or multiple years of Junior Varsity in school. Some might not be at peak fitness, but these athletes have had years of sport-specific coaching on technique.
As someone who did not do any sports in school, is it feasible to join an amateur sports team as an adult? How much training would be necessary before one stops being a complete liability to the team (or losing constantly in an individual sport)? Should people who didn't do sports in school stick to running and weight lifting?
I personally have been doing weight lifting with a trainer for a few years and running, if it matters, but a more general answer is appreciated.
Comment: Hello! I did not realize there was a separate sports stack exchange, and someone else migrated this question here. I'm not sure it fits here: it seems this stack exchange is for technical questions and sports teams. Please suggest any additional tags I should add if this is the right place.
Comment: Welcome to Sports SE - while it's true a lot of our questions are about technical/rules issues, we're not exclusively about that; to quote from our [on-topic page](https://sports.stackexchange.com/help/on-topic), "Sports Stack Exchange is for participants, hobbyists, and fans of all sports and forms of competitive physical activity" and this question clearly falls within that. Not sure if there are any particularly relevant tags, but the community may find some!
Comment: @PhilipKendall I'm the migrating mod from fitness, glad to see this is a good fit here. This seemed like a good candidate for a "good subjective" sort of answer.
Comment: It really depends on where you live. I used to live in an area where ice hockey was really popular, and I skated with people with no prior experience (like myself when I started), people who'd played recreationally for 20 years, people with college experience, even one guy who had previously played professionally in Germany.
Comment: I think the assumptions in your first paragraph are not common. Most people playing sport after education are doing it more the enjoyment and social aspect of a sports club than because they couldnt quite make it at an elite level. And they are usually doing it with a complete lack of 'sport-specific coaching on technique'.
Comment: @TheFootsie I'm definitely not suggesting that people who do club sports "couldn't make it". It's more that most people in my circles are expected to do a sport in high school, just like 50+% of middle class families make their kids play an instrument. Some hate sports, some even competed in college or even went pro briefly, but most did sports with a coach at some point.
Comment: Perhaps the tone of my comment was unclear, your question reads as though you are unsure about taking up a new sport as an adult because you are concerned that you wont be good enough. If that is your concern you dont need to worry, almost all clubs are very welcoming of beginners.
Answer:
How much training would be necessary before one stops being a complete liability to the team (or losing constantly in an individual sport)?

In my experience, this depends almost entirely on the individual and their affinity for the sport. I've seen "untrained" adults come into sports clubs and rapidly (1-2 years, sometimes less than that) progress past other people who have been playing the same sport for years. I've also seen adults come in and "bump along at the bottom".

Should people who didn't do sports in school stick to running and weight lifting?

You should do what makes you happy, it's not all about being competitive. Some of those people above who "bumped along at the bottom" have been great long-term members of the club, even if they didn't contribute to the league results.
Comment: What distinguished the people who bumped along at the bottom from those who were able to contribute?


connecting jquery attr to PHP Mysql?

Question: a PHP table populates its data from mysql, When a user clicks .button a drop down table row menu appears where user has ability to add item to cart, the name of the item in cart should be the mysql entry $sound['downloadlink'] located in the table row above .mp3buy, It is adding the actual string "$sound['downloadlink']" instead of what the mysql entry for download link should be.
PHP Table
<?php

while($sound=mysql_fetch_assoc($records)){
    echo "
";
    echo "  Play/	";
    echo ''.$sound['name'].'   '.$sound['date'].'	';
    echo "".$sound['bpm']." B.P.M.	";
    echo "".$sound['length']."	";
    echo "".$sound['keywords']."	";
    echo "	";
    echo "
";
    }
?>

Jquery:
 $('#mytable').on('click', ".button", function () {

    var thisRow = $(this).parents('tr.adder');
    var hasNextRow = thisRow.next('tr.added').length;
    if (hasNextRow) {

        thisRow.next('tr.added').remove();
    } else {

        $(this).parents('tr.adder').after('

');
    }
});
$('#mytable').on('click', ".mp3buy", function () {
    var flag = $(this).data('flag');

    simpleCart.add({
        name     : $(this).attr("data-product-id"),
        price    : .99,
        quantity : (flag ? -1 : 1)
    });
    $(this).attr("src", flag ? "mp31.png" : "mp32.png");
    $(this).data('flag', !flag);
});

Answer: Firstly, your PHP in your jQuery block is not getting parsed as you need to write <?= $sound["downloadlink"] ?> (PHP 5.4 syntax).
However, that's not your solution as you want the correct link for the product, not one fixed value. You could change your button so that it knows the link, as follows:

Then you need to make quite a few jQuery changes:
$('.button').on('click', function () {
    var thisRow = $(this).parents('tr.adder');
    var hasNextRow = thisRow.next('tr.added').length;
    if (hasNextRow) {
        thisRow.next('tr.added').remove();
    } else {
        $(this).parents('tr.adder').after(
            '

'
        );
    }
});

$('#mytable').on('click', ".mp3buy", function () {
    var flag = $(this).data('flag');
    simpleCart.add({
        name     : $(this).data("product-id"),
        price    : .99,
        quantity : (flag ? -1 : 1)
    });
    $(this).attr("src", flag ? "mp31.png" : "mp32.png");
    $(this).data('flag', !flag);
});

That's roughly right but I might have missed something. The idea is that you keep your data in your HTML then use your script to manipulate the data. Don't put your data in your script. Also, it doesn't really make sense to transfer the value of the data-downloadlink attribute over to a data-product-id attribute. It would be better to refer to the original value.

connecting jquery attr to PHP Mysql?


What is the reason for using non-standard harp pedal notation?

Question: According to this page, harp pedals are notated as
D C B E F G A.
In the score for Holst's Planets - 7. Neptune, the order
Cb D# Eb G# Ab B F#
was used. Is there a specific reason for this non-standard notation?
Comment: I'm very interested to hear from someone who knows (I don't, even though my daughter is learning harp!). I wonder, in particular, whether scordatura is involved? It's striking that three pairs of enharmonic equivalents are used, D#/Eb, G#/Ab, and Cb/B (note, you might want to edit your question to show this). The opening notes show why: the harpist alternates between two chords that are enharmonically equivalent, G# B D# and Ab Cb Eb, giving the effect of a rapid tremolo on a single pitch. I wonder whether they have to deviate from the standard tuning to accomplish this? Not sure.
Comment: This may be a age related thing.  Your first link refers to a recently written document but that score is about a hundred years old.  Your first document also insists that the pedal markings are NEVER in the middle of the staves - but look where they are in the score.
Comment: I think it's worth noting that the pedal order is not consistent throughout the piece.
Comment: Only thing I can think of is a different kind of harp might have been used. Or maybe a translation/transcription error?
Comment: I think your question is clear when looking at this specific page http://harpnotation.com/the-harp/pedal-mechanism/pedal-diagrams/
Comment: @JimM Pedal marks go above or below the grand staff in the part, but inside the grand staff (or even omitted entirely) in the full score to be more space efficient.
Comment: @ToddWilcox — the pedal marks are appearing inside the grand staff _even in the part_ for this piece.
Comment: @ElementsinSpace You're right. But what's strange is it's **only** for "Neptune", not for any of the other sections. The one thought is that it's a pocket score. I have a couple small format study scores and even the parts are small. Perhaps they needed to save space in both the full score and the parts. Also, perhaps the order of the pedals wasn't standardized in 1921 the way it is today.
Answer: This is from my Walter Piston Orchestration book...

...the pedal notation can be given as scale degrees, letters grouped by the left/right pedal positions, or graphically as black marks on, above, or below a line.
Looks like Holst opted for the scale ordering.
Comment: How does that account for the F being last?
Comment: I edited my answer to take out the "alphabetical/scale order", that was my wording, not Piston's. The F being last doesn't really matter, the pedaling is clear: set F to sharp. The letter order is odd, but you can still see the settings.
Comment: My read of the question is that it's asking *why* the pedal order is odd. This doesn't seem to be a complete reason why, because it doesn't offer an explanation for why the F is listed last.
Comment: Yeah, I get that. But maybe there isn't a reason. If there isn't a requirement to indicate pedals in the first place, if given, why assume they must be in a particular order?
Comment: Holst found he'd missed the F setting and so put it at the end, and his editor didn't notice?


How do I evaluate $\frac{1}{2 \pi i} \oint_C \frac{e^{zt}}{(z^2 + 1)^2} \,dz$

Question: How do I evaluate this integral when t > 0 and C is the Circle $\mid z \mid$ = 3 using Cauchy's Integral Formula
Comment: The function will have two poles within the circle. You could compute the residues there.
Comment: @Chappers editted, sorry
Comment: your integral is a laplace inversion expression so look into this page http://tutorial.math.lamar.edu/pdf/Laplace_Table.pdf
Comment: @JoseGarcia But im supposed to solve it using Cauchy's, no? I guess im still stuck
Comment: yes you need to exand $ \frac{1}{(z^2+1)^{2}} $ into partial fractions
Comment: @JoseGarcia: it may look like a Laplace inversion - and it may return the same answer as a Laplace inversion in this case - but the integral is NOT an inverse Laplace transform.  https://en.wikipedia.org/wiki/Inverse_Laplace_transform#Mellin.27s_inverse_formula
Comment: @RonGordon Then how should I proceed, if you can help me? Thanks.
Answer: To evaluate the integral $\displaystyle \frac{1}{2 \pi i} \oint_C \frac{e^{zt}}{(z^2 + 1)^2} \,dz$ we see $(z^2+1)^2=(z+i)^2(z-i)^2$. The Cauchy Integral formula says
$$f'(z_0)=\dfrac{1}{2\pi i}\int_{|z-z_0|=\rho}\frac{f(z)}{(z-z_0)^2}\,dz$$
Since $C$ is the circle $|z|=3$ oriented counter-clockwise, we divide it to $C_1: |z-i|=\frac12$ and $C_2: |z+i|=\frac12$ both oriented counter-clockwise. So here $z_0=\pm i$ and
\begin{eqnarray}
\dfrac{1}{2\pi i}\oint_C \frac{e^{zt}}{(z^2 + 1)^2}\,dz
  &=& \dfrac{1}{2\pi i}\oint_{C_1} \frac{\frac{e^{zt}}{(z+i)^2}}{(z-i)^2}\,dz + \dfrac{1}{2\pi i}\oint_{C_2}\frac{\frac{e^{zt}}{(z-i)^2}}{(z+i)^2}\,dz\\
  &=& \left(\frac{e^{zt}}{(z+i)^2}\right)'\Big|_{z=i} + \left(\frac{e^{zt}}{(z-i)^2}\right)'\Big|_{z=-i}\\
  &=& \frac{e^{+it}(2it-2)}{-8i} + \frac{e^{-it}(-2it-2)}{8i}\\
  &=& \color{blue}{\dfrac{\sin t-t\cos t}{2}}
\end{eqnarray}
Comment: I appreciate your answer but the book says the answer is $\frac{1}{2} (sin (t) - t cos(t))$
Any clue why it might difer?
Comment: @Forzzark Sorry! It was my wrong in simplification was edited.


Number of solutions of the two equations

Question: Find the number of integral solutions of the equation:
$a+b+c=m$ with $0\gt a\gt b\gt c$
And the generalized version:
$a_1 + a_2 + \cdots + a_k = m$ with $
0\gt a_1\gt a_2\gt \cdots \gt a_k$
Comment: You are supposed to show us where exactly you got stuck.  Obviously we can't have a website where students just post their HW and others just do it for them.  I'm sure you can see why such a website would not be desirable.
Comment: Search the site for any of the twenty-five billions instances of this question.
Comment: You are asking about how to compute the number of integer partitions of $m$ having $k$ distinct parts.  There are some previous Questions here about how to count these.  I'll update the tags and it should make some related Questions appear in the sidebar.
Answer: This is the number of partitions of a given integer into a sum.  Say,
$$m = 6,$$
and we would like to write it as the sum of 3 positive summands.  To do this, write
$$
6 = 1 + 1 + 1 + 1 + 1 + 1.
$$
A sum is formed by choosing 2 of the 5 pluses in the above expression; e.g,
$$
1 + 1 +' 1 + 1 + 1 +' 1 = 2 + 3 + 1.
$$
The number of ways to choose 2 pluses is "5 choose 2".
Comment: Hey thanks for the reply. I am able to do what you just mentioned above. But the condition has more to it. **0>a>b>c**
Comment: $a, b, c$ are negative??


TClientDataSet Tabela Temporária

Question: Boa noite.
Minha dúvida é a seguinte, estou com uma tabela temporária criada no TClientDataSet.
Porém, eu preciso gravar os dados da tabela temporária em um arquivo XML e depois ler novamente no TClientDataSet, ou seja, deletar os registros e reinserir todos eles.
Porém, no meu ListView, está aparecendo registros duplicados ou registros vazios, e já verifiquei o XML, e está tudo ok.
Alguma dica sobre Tabelas temporárias usando o TClientDataSet?
Comment: O XML você criou na mão ou foi salvo pelo CDS ? Posta seu XML para eu dar uma olhada!
Comment: Foi na mão mesmo, ele não serviria muito pra mim criado pelo CDS, Vou postar a resposta escrita.
Answer: Então, depois de muita pesquisa, soube que o ApplyUpdates(0); não funciona em tabelas temporárias, ou seja, tudo que fiz foi definir os campos que quero no TClientDataSet após isto, botão direito e CreateDataSet, então para concluir, faça suas alterações desta maneira:
Editar:
cds.Edit;
valor := cdscampo.value;
cds.Post;

Adicionar:
cds.Append;
cdscampo.value := valor;
cds.Post;

Deletar:
cds.Delete;

Para simplificar, utilizei o IXMLDocument declarado e criado na própria função de gravação.

TClientDataSet Tabela Temporária


How to search a string for a specific value then if found return value within that string

Question: I have a table that contains a varchar column e.g.
Reference  Value      Comment
GLJ:04302    23883.2  'Jnl: 1535 Job:A10738   S/o:'
1088         8728.8   'Jnl: 3433 Wh:** Receipt        Stk:UPS Traing 7'
1087         5700     'Jnl: 3433 Wh:** Receipt        Stk:Services'
1088         8728.8   'Jnl: 3433 Wh:** Receipt        Stk:UPS TRAINING U8'
GLJ:04547    3700     'Jnl: 1635 Job:A7802    S/o:'
GLJ:04616    3610.7   'Jnl: 1656 Job:A11540   S/o:'
GLJ:04624    3235.02  'Jnl: 1657 Job:A11691   S/o:'

Now i would like to search this comment string and if it finds the value Job: withing that string I want to return the value directly after the : and return from that position 8 chars so it will return e.g. 'A10738   '
Any ideas?
Answer: Assuming all your strings containing "Job:" have that in the same position (ie starting at character 10), then this should work:
SELECT
  comment,
  RTRIM(SUBSTRING ( comment, 14, 8 )) as JobNumber

FROM
  table

WHERE
  comment LIKE '%Job:%'

But if the "Job:" item can start anywhere, you'll need something more robust:
SELECT
  comment,
  RTRIM(SUBSTRING ( comment, CHARINDEX ( "Job:" ,comment) + 4, 8 )) as JobNumber

FROM
  table

WHERE
  comment LIKE '%Job:%'

Another option (that is overkill for your scenario, but mentioning it here for prosperity) would be to use a RegEx.  RegEx is not native to SQL, but can be implemented in .NET via the CLR.  Refer to http://msdn.microsoft.com/en-us/magazine/cc163473.aspx#S3
EDIT: Note that I've included an RTRIM() in there to strip your trailing spaces from the job number (in case it's less than 8 characters). If you need the full 8, remove the RTRIM() from around the SUBSTRING().
Comment: @user1546143 My pleasure, thanks for taking the time to accept. Also note added a comment about the RTRIM function that will give you less than 8 chars if the job number is less than 8 chars.


Any way to create a permissions-like sea of checkboxes?

Question:
Basically I am looking for something like this (square brackets are checkboxes):
<code>  A  B  C  D  E
1 [] [] [] [] []
2 [] [] [] [] []
3 [] [] [] [] []
</code>
Answer: Are you looking for Node Permission Grid module ?
This will give permission grid like
Comment: Not exactly. I am trying to do this in a custom module. Permissions have nothing to do with it, other than being a well-known example of what I wanted.
Comment: Ok.i just got it wrong..any way we can do it using custom module..
Answer: It looks like the only way is to create a FAPI checkboxes array then theme it.


Transfer Odata query to SQL statement java

Question: I've been reading through the Olingo v4 server tutorials and all I have seen is examples with hard coded data. Are there any examples of using the v4 code with some type of sql backend. From what I've read JPA is not an option yet in v4. Is the expectation to parse the query and convert it to a sql statement that I would execute within my implementation? Is there any automation behind this somehow?
Update: I have been looking at a newer library called JINQ This looks promising. Does anyone have an idea of how to plug something like this into Olingo v4?
Answer: For Olingo v2, there is a JPA processor included. For Olingo v4, the decision was made to separate the JPA processor from the main project, the JPA processor becoming more of a component of Olingo v4.
Recently a major contribution was made to Olingo v4 with a first working version of a JPA processor. This JPA processor is still not yet officially approved but they are planning to integrate it and make an alpha version for other people to contribute to. You can find that first working solution here : https://issues.apache.org/jira/browse/OLINGO-1010


Showing $\mathscr{T}$ is a Topology and is Hausdorff.

Question: I need help showing that $\mathscr{T}= \{U \subseteq \mathbb{N} \mid  \mathbb{N} - U \hspace{2mm} \textrm{is finite or} \hspace{2mm}  1 \in (\mathbb{N} - U)   \}$ is a topology. I understand how to show $\mathscr{T}$ is a topology for the cofinite case, but I don't understand how to show it for when $1 \in (\mathbb{N} - U)$.
Closed Under Union:
Let $\mathcal{U} $  be an arbitrary family of sets where $\mathcal{U} \in \mathscr{T}$; we aim to show this family is closed under arbitrary union. For $i \in I$ let $U_i$ denote a set in $\mathcal{U}$. So assume $ U_i = \emptyset \hspace{2mm} \forall i \in I$ then clearly $\displaystyle{ \bigcup_{\substack{i \in I }} U_i = \emptyset \in \mathscr{T}}$. So suppose  $\mathbb{N} - U_i$ is finite for every $i \in I$ . Then the union $\displaystyle{ \mathbb{N} - \bigcup_{i \in I} U_i = \bigcap_{i \in I} (\mathbb{N} - U_i)}$ by De Morgan's Laws and the fact that showing the union is open is the same as showing the complement is closed. Thus in this case an arbitrary union of finite sets is again open and is in $\mathscr{T}$.
So how do I include the case when $1 \in (\mathbb{N} - U)$? Do I have to consider two different cases since it could be finite or infinite? I know this is probably really simple, but I'm not seeing it.
Closed Under Intersection
Let $\mathcal{U}$ be a finite family of sets containing $U_1, U_2, \cdots, U_n$ where $\mathcal{U} \in \mathscr{T}$. We aim to show that the family is closed under finite intersection. If any $U_i = \emptyset$ then clearly $\displaystyle{\bigcap_{i = 1}^{n} U_i = \emptyset}$. So assume that for each $U_i, \mathbb{N} - U_i$ is finite. Then $\displaystyle{\mathbb{N} - \bigg(\bigcap_{i = 1}^{n} U_i \bigg) = \bigcup_{i = 1}^{n} (\mathbb{N} - U_i)}$ again by De Morgan's Laws since showing the intersection is open is the same as showing  its complement is closed. So we have have finite unions of finite sets which are finite; $\displaystyle{\bigcap_{i = 1}^{n} U_i \in \mathscr{T}}$
Similarly here how do I include the case of $1 \in (\mathbb{N} - U)$?
Lastly, can someone get me started on showing $\mathscr{T}$ is Hausdorff?
Answer: Hint: to show $\mathscr{T}$ is a topology, it is easier to think about the closed sets. A set is closed in $\mathscr{T}$ if it is finite or if it contains $1$. We have to show that finite unions and arbitrary intersections of closed sets are closed. For finite unions, $X_1 \cup \ldots \cup X_n$ is finite if all the $X_i$ are finite and contains $1$ if any of the $X_i$ contains $1$. For intersections, $\bigcap_i X_i$ is finite if any of the $X_i$ is finite and contains $1$ if all the $X_i$ contain $1$.
For the Hausdorff property, given $x \neq y$, assume w.l.o.g. that $y \neq 1$, then $\{y\}$ and $\Bbb{N} \setminus \{y\}$ are open sets that separate $x$ and $y$.
Answer: For the Hausdorf property:
Let $m,n \in \mathbb{N}$ such that $m \neq n$ and $m,n>1$
Take $U=\{m\}$ and $V=\{n\}$
$U,V$ belong to the topology.
Now if one of $m,n$ is equal to $1$,suppose $m=1$ then take
$U=\mathbb{N}$ \ $\{n\}$ and $V=\{n\}$.
In each case $U \cap V= \emptyset$


How to deal with fluctuating electric guitar volume (caused by changing pedals and technique)?

Question: Background
I've recently started a band, we are a drummer, and a bassist, and me on electric guitar. I am new to using electric guitar and effects pedals, previously I've mainly used acoustic by myself.
My question
Thoughout our songs I sometimes turn on or off Big Muff distortion, which dramatically increases or decreases the volume. Furthermore, I often change my style mid song -  e.g from strumming chords, to doing solo work, to palm muting picking, and back again.
The volume of my guitar is therefore dramatically changing constantly, sometimes way below or above the other instruments. How should I be dealing with this?
My initial possible answers ...
1) Buy a compressor. But will this always work for each desired section of the song?
2) Fiddle with the guitar volume throughout the song. But won't this be fiddly and hard to work out for each section and each song?
3) Buy more pedals to help with volume, and painstakingly work out for each section what volumes settings on all of my equipment are needed for each bit of the song in relation to the other instruments. Is this a normal thing to do?
4) Something else???
Thanks!
Answer: I suggest setting the volume on your Big Muff so that the percieved loudness is the same regardless of whether it's on or off. However, many players will use a distortion pedal as a boost when they need more volume. In that case, the difference in volume is not a problem but actually desired. Sometimes several distortions are used for different parts of a song that demand diffent loudness, eg 'verse distortion', 'solo distortion' etc, so yes, buying more pedals could help!
A compressor will work well to even out the volume changes that are a result of your different playing techniques, and it is often placed first in the chain (ie, directly after the guitar). Of course, it is certainly possible to adjust one's playing to get the same, or similar, results. Or, as you mention, riding the volume knob on the guitar, which will accomplish the same thing, but sound different. It could also be difficult to find the correct volume setting 'on the spot' while playing.
Answer: Most effects pedals will have a volume control to help with this. Distortion ~(especially analogue ones) pedals are a bit more complex as the output from the pedal will also contribute to distortion in the amp as well as the sound colour/distortion produced by the pedal.
It's also worth bearing in mind that historically in rock/metal a lot of the guitar sound is generated by the amp but with modern lightweight solid state amps combined with effects it may be more pragmatic so tee the amp and speaker more as a fairly clean PA, especially as a beginner when you will want to experiment a lot with your sound and probably can't afford expensive kit. Experimenting with pedals is certainly a lot cheaper than experimenting with valve amplifiers and speaker cabinets.
Similarity many amps will have more than one channel with separate volume (and often also EQ) controls so you can more easily balance clean and distorted sounds, you can usually switch channels with a foot switch.
Most electric guitars have at least two sets of pickups which are switchable and have separate volume controls so you can switch between pickups and preset the volume to the appropriate level.
EQ is also important as the relative frequency balance will determine how loud the guitar part sounds, especially in a 3-piece band where guitar and drums will tend to dominate certain parts of the frequency spectrum.
As mentioned in other answers a volume pedal is a very simple solution and will also allow you to fine tune volume on the fly as well as being able to produce some quite interesting effects in itself.
Another option is to use a line-splitter pedal which will allow you to set up two separate effects chains with different levels.
Ultimately playing an electric instrument through and amplifier involves a lot of interrelated factors so you may very well have to do a lot of experimenting and tweaking to get the exact sounds you want.
Comment: All of these answers seem great. I have uprooted them all, and awarded the green tick to this one for it covers a lot of answers. :) Ultimately I think I need to "do a lot of experimenting and tweaking".
Answer: "Fiddle with the guitar volume" is not going to work at all if you mean the volume control on the guitar and part of your volume changes comes from using distortion.  You need to fix the volume after distortion, like fiddling with the guitar amp volume control.
Using a volume pedal might work here as well.  A compressor (after distortion) will likely not do the full job (partly also because distorted sound cuts through other instruments better than its nominal volume would suggest) but might leave less work for your manual adjustments.
Answer: A volume pedal will work, in line after other pedals. Set the guitar's volume so that there will be some travel on the volume pedal both ways, so you have some leeway. I've found this works well. A compression pedal will mess up your playing if used for this. It's not really designed that way. You could also try a graphic eq., which can be set as a boost or otherwise, with or without affecting the tone. You'll see a lot of pros actually twiddling with the volume pot on their guitar, partially to even out guitar volume, partially to add or subtract overdrive.
Incidentally, Boss has recently brought out a pedalboard that switches pedals. You could use a couple of graphics and programme this board to operate specifics together - but it ain't cheap!
Answer: This is not so easy. In point of distortion volume may be virtually the same but frequency content will appear louder from ear perspective.
I recommend having two drives with different output set. The first one set louder for palm mute and second one set quieter for strumming. Stacking both will give you third tone as bonus.
Compressor can be last in chain to equalize everything but it is rare application (except studio compressors) because may amplify noises. I recommend using compressor to boost clean signal to be comparable with distorted sounds and will not get too loud if you hit strings hard.
Some people use volume pedal in effects loop but I've never tested it.
Answer: I had a similar problem with picking to strumming dynamics and a small problem with volume when putting effect on and off but not as much. Mainly my lead lines were not as loud/clear as rhythm stuff.
My old chain was the following because I read that low gain to high gain works well. I did balance the volume as best I could but it just didn't feel great mixing rhythm and lead:
Digitech Bad Monkey Tube Overdrive
Kramer Distortion
Other Distortion
After reading up on preamps I decided to switch my Bad Monkey to last in the gain chain.
Kramer Distortion
Other Distortion
Digitech Bad Monkey Tube Overdrive
Now my lead lines come in close to same volume as my rhythm stuff. The tone also sounds closer to what I hear in recordings. I think this is related to what @Doktor Mayhem said about using EQ/preamps to counteract tone changes. I think the problem can largely be more about tone balance than volume in some cases.
Note:
I don't have a compressor yet and I run my effects with a Boss ES-8 not that makes that much difference.
Stacking my pedals no longer increases the gain of the drives like the previous effect chain but I like the balance and overall tone much better now.
I leave my Bad Monkey on all the time now on low gain since it livens my clean tone a bit.
Answer: I deliberately use a range of techniques:

Pickup volume control
Guitar volume control
E/Q or preamp
Effects levels
Compression

The first two not only affect volume, but tone and distortion as well, so can be used to tip your overdrive over the edge.
An E/Q and preamp can be used to affect the volume, and to counteract tone changes.
Each effect that has a level control can also be tweaked - I use a multi-effect pedal with various patches to either include volume changes (e.g. For lead lines) or to maintain overall levels.
And compression can be used to even out overall levels - it also impacts tone though, and some detail is always lost with compression.