$\operatorname{lcm}(2x, 3y-x, 3y+x)$

Question: Problem
Find $\textrm{lcm} (2x, 3y-x, 3y+x)$, where $y > x > 0$ and $\gcd(x,y) = 1$.
Attempt
I noticed after some numerical calculation that the answer seems to depend on the parity of $x$ and $y$. However, I am basically at a loss of how to approach this. Any help would be appreciated.
Comment: This may be relevant: $gcd(a,b) lcm(a,b) = ab$.
Comment: I am not sure how to extend that into three variables.
Comment: @egreg Aha!!  I see it now.  $(3y+x) \mid L, (3y-x) \mid L \rightarrow ((3y+x)-(3y-x)) \mid L \leftrightarrow 2x \mid L$.  Thanks! Now I need to determine $\operatorname{lcm}(2x, \operatorname{lcm}(3y-x, 3y+x))$?
Comment: Aha, now I do.  You mean for me to find $\operatorname{lcm}(3y+x, 3y-x)$.
Answer: You need to distinguish a few cases.
First note that if $3 \nmid x$, then $\gcd(3y - x, 3y + x)$ is either $1$ or $2$. Indeed, otherwise either a prime $p \neq 3$ or $4$ would divide both $6y$ and $2x$, but $x$ and $y$ are coprime by hypothesis. Furthermore, that $\gcd$ is $2$ if and only if both $x$ and $y$ are odd. Since no prime that divides $x$ can divide $3y-x$ or $3y+x$, again because $\gcd(x,y) = 1$, if $3 \nmid x$ we have
$$
\text{lcm}(2x, 3y-x, 3y+x) =
\begin{cases}
2x(3y-x)(3y+x) & \text{if } 2 \mid xy \\
\frac{1}{2}x(3y-x)(3y+x) & \text{otherwise}
\end{cases}
$$
Now suppose that $x = 3z$ for some $z \in \Bbb{Z}$. Since $\gcd(x,y) = 1$ no prime that divides $z$ can divide $y-z$ or $y+z$. Furthermore, just as above $\gcd(y-z,y+z)$ is $2$ if both $x$ and $y$ are odd, and it is $1$ otherwise. Thus if $3 \mid x$ we have
$$
\text{lcm}(2x, 3y-x, 3y+x) =
\begin{cases}
2x(y-z)(y+z) & \text{if } 2 \mid xy \\
\frac{1}{2}x(y-z)(y+z) & \text{otherwise}
\end{cases}
$$

$\operatorname{lcm}(2x, 3y-x, 3y+x)$


What chords count as "diatonic" in minor?

Question: Do triads from all forms of minor count as "diatonic triads"?
Triads from A Aeolian / Nat Minor
am b˚ C dm em F G
Triads from A Harmonic Minor
am b˚ C+ dm E F g#˚
Triads from A Melodic Minor
am bm C+ D E f#˚ g#˚
It seems like I mostly see this:
am b˚ C dm (E or em) F (G or g#˚)
Answer: Theorists differ on the precise usage of "diatonic" when it comes to minor. There isn't any substantial disagreement on the behavior of minor-key common practice music, just in the best use of terminology. Under the most expansive interpretation of the word, any notes of the minor scale, including both versions of the sixth and seventh scale degrees, are diatonic, and thus, at least technically, any chords using those notes would be diatonic. This is the same as saying that all the chords in the natural, harmonic and melodic minor scales are part of the key—however, I would prefer to step back from the idea that those scales are specific entities in common-practice music. Until the 20th and 21st centuries there was no such thing as a piece in "A harmonic minor" or "A melodic minor"; there was just "A minor" which has variable sixth and seventh scale degrees depending on musical context.
The most restricted use of "diatonic" holds that only the most common progressive (not sequential or passing) harmonies should fall under the term. By far, the most common functional harmonies in a minor are:
amin bdim C dmin E F g#dim

or:
i ii° III iv V VI vii°

That is to say, the chords of the "natural" minor scale except with a raised leading tone for V (E) and vii (G#).
I don't care much about how we use the diatonic term, as long as we're clear that these are the most important harmonies for functional harmony in minor.
The only other harmonies that the most expansive definition of diatonic would add to the list all involve the sixth or seventh scale degrees of course, and their prominence varies substantially. The V and vii without the raised leading tone aren't that uncommon, but they are vastly more significant in sequences (e.g. i – iv – bVII - III …) and in passing harmonies (e.g. i – v6 – VI). The sequence example is the beginning of a minor-key circle-of-fifths sequence with the major VII built on the unraised seventh scale degree, and the passing example is a minor v in first inversion (unraised leading tone) to pass between i and VI. Meanwhile, unlike V and vii, III almost always has the unraised leading tone, and is quite rare as an augmented harmony III+.
All of the standard harmonies that include the sixth scale degree use the unraised version, and the versions with raised 6 are relatively rare. Probably the most common is IV, which is sometimes necessary to create smoother voice leading to V (in other words, to eliminate the augmented second between the lowered sixth scale degree of iv and the raised seventh scale degree of V). It's less common to do this with ii (turning a diminished triad into a minor triad), but not unheard of. Raising the sixth scale degree of a VI chord in minor turns it into a diminished harmony (often written in Roman numerals as #vi°) that is used as a passing chord leading up to vii° or V6. Again, that is used to eliminate what would otherwise be an augmented second in the bass line.
So, yes, I think your final list is a good list of the standard diatonic harmonies in a minor as long as you get rid of e minor and G major. Those two harmonies mostly happen in sequential or voice-leading circumstances. I think it's probably most useful however to acknowledge that the less common versions of all of the sixth- and seventh-scale-degree-having harmonies aren't chromatic (and hence are indeed diatonic), they're just less common and/or used for other contexts.
Comment: @RailroadHill No, the augmented III+ is nowhere near as common as major III in common practice harmony. You're right that it *can* happen, which is why I said it's rare rather than nonexistent in my answer. However, Chopin's use of it is evidence of how much more complex his Romantic-era harmonies are, not proof that it's standard Classical harmony.
Comment: @Tim I'm not familiar with the Spanish sequence, but if it is indeed a sequence, then that's what I meant when I said v and bVII are more common in sequences. If by "in their own right" you mean Emin functioning as a dominant chord just as E does, or G functioning as a dominant chord just like G#° does, all I can say is that, although certainly exceptions can be found, these would be highly unusual in a common-practice context. Of course, toward the end of the 19-century and throughout the 20th and 21st, both become quite common, and, in some genres, surpass E and G#° in prominence.
Comment: I think the "Spanish sequence" is formally known as the Andalusian Candence if anyone is interested.
Comment: There are quite a few pieces in A minor which use Em and/or G for bars in their own right, which I think means they're not being used in a voice-leading manner. The G seems far more common than Em in my experience. Example - Spanish sequence.
Comment: Ah, if that's what we're talking about, then it's definitely a passing function. The major VII chord serves as a connection between the i and the VI. A slightly variation on the minor v6 example I discussed in my answer.
Comment: Well, you are right that in minor keys the mediant is most often major, while the augmented mediant is pretty rare.  I would like to notify you that I am no longer @RailroadHill, but **Maika Sakuranomiya**.  (I have changed my display name)
Answer: Diatonic relates to major and minor keys - as opposed to chromatic. So, yes, any triads made up from notes in all of the scales (and their modes!) you quote are diatonic. Note that a triad needs root, third and fifth, so a sus chord isn't a triad; and a triad can be non-diatonic, as in diminished and augmented, still with R, 3 and 5, but not all diatonic notes.
Those from the natural minor are exactly those from the mother key - the relative major. With the altered notes as in the last two found in melodic and harmonic minors, there are more triads available, all of which can and do feature in minor pieces - and those which have modulated there.
EDIT: Trying to clarify - 'diatonic' in a situation means 'belonging to the set of notes in question', so here we're talking about the standard major and minor which are used extensively in Western music.
Comment: @jjmusicnotes There may be a difference in how this term is used in different countries—that's definitely the case with terms like "12-tone" and "serialism"—but at least in the American tradition I learned, "triad" does indeed mean three-note stacks of major and/or minor 3rds (including, of course, 6/3 and 6/4 inversions too). The term "trichord" is used for the more general case of *any* three-note collection. In that sense, C–E–G is both a triad and a trichord, while C–D#–E is only a trichord and not a triad. Again, though, I think there's a *lot* of variability on this.
Comment: @PatMuchmore Absolutely agreed here. I've always used triad / trichord (for better or worse) interchangeably in non-functional contexts, but I do always use "triads" in functionally-harmonic contexts, or perhaps "traditional" is the better word here? I fully realize successions of triads may be entirely non-functional harmonically speaking. In my travels and career, I've noticed, as you said, *a lot* of variability in how people speak about and notate musical concepts.
Comment: Good note on the sus chord not being a triad. Never thought of that before. Minor is very expansive having 3 different forms.
Comment: No! A triad comprises 3 notes. They do not have to be "root", "third", or "fifth". In music without a tonal center (serialism or set theory), there are no roots, thirds, or fifths (unless manufactured by the composer). Also, to clarify, "diatonic" is neither major nor minor, but describes notes normal to the parent scale / key. If you create a synthetic scale that doesn't fit into any key, the chords you create from that scale, as long as they don't deviate from the scale, are diatonic *to that scale*.
Comment: @jjmusicnotes - according to most of what I've read, triads, in general diatonic Western music, *are* made up from notes in thirds, comprising root 3 and 5. I wasn't addressing any other sort of music. Diatonic, again as I have studied, refers to notes from major and minor scales and keys, and I felt that the OP was only asking about that sort of music, not any synthesised scales, although I take your point. Here we talk about diatonic in the major/minor form. Do you agree that a sus 2, e.g. C F G is *not* a triad?
Comment: @Tim Yes, you're correct in the sense when we explain time signatures to children, it's much easier to say "Yes, all music has 4 beats". It's not even remotely true, but it's easier than trying to explain asymmetric, compound, or irrational time signatures to a 6 year old. The point of my comment was just to educate others (not just the OP) that triads are not specifically beholden to only 1 particular definition; you don't have to explain everything, but it's more accurate to acknowledge that other stuff is out there.
Comment: @Tim C F G is a Sus4, not a Sus2. The type of suspension in this context refers to the voicing. If you re-voiced the chord to be F G C, then *that* would be a Sus2, though F C G would be much more common, with the 2 expressed as a 9th. And no, it would definitely be a triad. It would not be a major or a minor triad. *Major* and *minor* triads consist of roots, thirds, and fifths. A *triad* may comprise any combination of three notes. Major and minor are qualities of triads.


Is there a name for music that is just harmony + melody?

Question: For example, GreenSleeves

Is there a name for this type of composition: chord/harmony + melody? I'm not looking for the genre, which is traditional folk music.
Comment: I have also heard this format referred to as "piano lead sheet" or "piano fake".   I believe this was because the piano arrangement was built off of a lead sheet/fake book version of the melody, expanding the chord letters into piano clef.
Comment: I don't understand this question. The vast majority of music is composed of harmony and melody. Can you add an example of a piece that is **not** "just harmony + melody"?
Comment: @ToddWilcox we have chorale and fugue which doesn't follow the pattern from above example. Greensleeves could be written in fugue and chorale.
Answer: You're asking about what we call texture.
Your example is homophonic (noun: homophony), meaning that one part dominates while the other parts merely provide harmonic support. Some would use the term melody-dominated homophony for something like Greensleeves.
Something like a Bach fugue is polyphonic, meaning there are many independent musical lines.
There is also monophonic music, which is just a single melodic line either played by one instrument or by multiple instruments in parallel motion.
Comment: Nope! Even a piano sonata with the melody in the right hand and an Alberti bass in the left hand would still be considered homophonic.
Comment: Are you sure that monophonic has to be unison or octaves? Pretty sure any parallel lines are monophonic, like fifths.
Comment: hey that is the exact name I'm looking for: melody-dominated homophony
Comment: Would it change if the chords were broken chords?
Comment: Good call; or the parallel perfect fourths of ca. 10th--13th century!
Answer: You may be looking for the word 'homophonic'.   This describes a musical texture that in clearly divided into a melody and an accompaniment.   The opposite is 'polyphonic' which describes music where multiple melodic strands intertwine.
Beyond the most basic singing to a strummed guitar, absolutely pure homophony is rare.  In a SATB hymn tune, we try to give each voice a melodic line rather than just jumping around randomly to 'fill in the chord'.   Even in the simple 'Greensleeves' version you posted, the chords follow a downwards scale rather than jumping all over the place.  This gives a little contrapuntal interest to the music.
Comment: I remember talking about that descending baseline as counterpoint.


flash banner not working in mobile and tablet devices

Question: hi all,
flash banner [.swf file] is working fine in desktop browsers, but where it comes to mobile and tablet devices flash banner not working . please any help appreciated thankyou
this is url http://www.tatweerhousing.net/index-en.html
Answer: To make it quick: Because Android etc. do not support flash.
Answer: Flash is not supported on android devices.
Answer: iOS/android device doesn't support Flash, instead you can use HTML5 video using video tag
look at this


How to convert a number to the IEEE 745 single-precision floating point representation?

Question: How can I convert the number  123.45678 * 10^-22
to the IEEE 745 single-precision floating point representation? Can you show me the steps?
Comment: See http://stackoverflow.com/questions/3448777/how-to-represent-0-1-in-floating-point-arithmetic-and-decimal/3448855#3448855
Answer: Basically you want binary scientific notation. That is, you want your number to be of the form 2α, and you need to split α into its integral and its fractional part, α = k + β, with β < 1 and k ∈ ℤ.
To find α, take logarithms: α = log2123.45678 − 22 log210.
The integral part of the exponent, k, is stored in the exponent field of the IEEE float (after adjusting by the bias), and the fractional part 2β is stored in the mantissa (omitting the leading 1).


phpcs rule or sniff for detecting usage of the "ksm()" or "kint()" function?

Question: Would it be possible for my local PHPCS standard to warn me when I use certain PHP functions like kint() or ksm()? It's not part of the Drupal Standard but I'm running a modified version with some improvements like this.
Comment: Create a custom ruleset and pass the filename to phpcs with `--standard=custom_ruleset.xml`. `

`
Answer: Yes, it is possible by Checking Drupal coding standards. You can configure PHP code sniffer to check for Drupal coding standards by following the instructions from https://www.drupal.org/docs/contributed-modules/code-review-module/installing-coder-sniffer and https://www.drupal.org/node/1587138
Edit: It turns out you can not identify all the debugging functions with standard Drupal Coding standard functions.In my testing drupalcs was able to identify only dpm()and dsm() functions but not ksm() or kint() .
There is an alternative way to identify debugging functions. You can add pre-commit hook to identify the debugging functions.
You can add the below script to git hooks.
#!/bin/sh

#
# Git pre-commit hook that prevents code that is not Drupal coding standard compliant of being committed.
#
# Fork of https://git.io/fNXBi by Dave Hall http://davehall.com.au
#

# Fetch the list of files that have changed.
FILES="$(git diff --staged --name-only HEAD --diff-filter=ACMRUXB)"

echo "Running PHP lint check" >&2
LINT_FAIL=0
for filename in $FILES; do
  if ! php -l $filename; then
    LINT_FAIL=1
  fi
done;

# There is no point in running PHP Code Sniffer on broken files.
if [ $LINT_FAIL -gt 0 ]; then
  echo "Commit aborted. Fix your code. Then 'git add' and 'git commit' again."
  exit 1
fi

echo "Running PHP Code Sniffer Checks" >&2
echo $FILES | xargs phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt --ignore=node_modules,bower_components,vendor,*.md
if [ $? -eq 0 ]; then
 # Exit executing the git commit.
 exit 0
else
  # Ask what to do, not executing the commit. Source: https://unix.stackexchange.com/a/121255/139407
  read -p "Fix the marked Sniff violations automatically [Y/n]?" line </dev/tty
  case "$line" in
    y|Y) echo $FILES | xargs phpcbf --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt --ignore=node_modules,bower_components,vendor,*.md
      ;;
    *) echo "No automatic corrections made."
      ;;
  esac

  echo "Commit aborted. Make remaining manual code fixes if necessary. Then 'git add' and 'git commit' again."
  exit 1
fi

Source : Drupal git pre-commit hook
Comment: Yes? The code sniffer for Drupal coding standards checks for the existence of debugging functions in the code?
Comment: Yes , I will warn you with a message saying usage of dpm/ksm is discouraged.
Comment: Will edit my answer with a screenshot once I am at PC.
Comment: Cool, thank you for clarifying!
Comment: If the Drupal standard can detect dpm(), then we should be able to modify it to also detect ksm(), no? I'm just having trouble finding documentation on how to identify functions. I believe it's a PHP class that needs to extended...
Comment: Thanks for offering a workaround, but the question was to leverage PHPCS, not a git hook.
Comment: @atwixtor – Sounds like a feature request then.
Answer: Found the list of "discouraged functions" here:
vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Functions/DiscouragedFunctionsSniff.php
So this class can simply be extended or modified directly, and PHPCS will warn about any other function you add to this list:
<?
class DiscouragedFunctionsSniff extends ForbiddenFunctionsSniff
{

    /**
     * A list of forbidden functions with their alternatives.
     *
     * The value is NULL if no alternative exists, i.e., the function should
     * just not be used.
     *
     * @var array<string, null>
     */
    public $forbiddenFunctions = [
                                     // Devel module debugging functions.
        'dargs'               => null,
        'dcp'                 => null,
        'dd'                  => null,
        'dfb'                 => null,
        'dfbt'                => null,
        'dpm'                 => null,
        'dpq'                 => null,
        'dpr'                 => null,
        'dprint_r'            => null,
        'drupal_debug'        => null,
        'dsm'                 => null,
        'dvm'                 => null,
        'dvr'                 => null,
        'kdevel_print_object' => null,
        'kpr'                 => null,
        'kprint_r'            => null,
        'sdpm'                => null,
                                  // Functions which are not available on all
                                  // PHP builds.
        'fnmatch'             => null,
                                  // Functions which are a security risk.
        'eval'                => null,
    ];
}

Comment: Definitely not modified directly. But would be interested from where to extend it.
Comment: I believe it can be done by following this guide https://matthewdaly.co.uk/blog/2017/11/06/catching-debug-statements-in-php/  @leymannx


Increase allowed redirects in browser?

Question: I have a script that uses a ton of redirects.  About half way through the process I get an error message in the browser saying:
This webpage has a redirect loop
The webpage at http://localhost/....... has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer.
Here are some suggestions:
Reload this webpage later.
Learn more about this problem.
Error 310 (net::ERR_TOO_MANY_REDIRECTS): There were too many redirects.

Is there a way to increase the allowed redirects in the browser?
Comment: U can't , Try use javascript(document.location="") or meta(refresh) redirects
Comment: I doubt if you should rely on browser-specific setting. Why not send across fewer redirects?
Answer: In Firefox, navigate to about:config in the address bar.  Search for network.http.redirection-limit and increase the value to your desired value.
This setting in Firefox controls how many redirects it will accept before it stops following them.
Comment: True, if that is the case then its not possible.
Comment: No, I'm just looking to change the setting in the browser.  I couldn't find about -> config.  Could be a little more specific in how to find the option?  Thanks
Comment: Sorry edited it, you put the `about:config` in the browser address bar.

Increase allowed redirects in browser?


If $f(5 + x) = f(5 - x) \forall x \in \mathbb R$ and $f(x) = 0$ has four distinct real roots, then what's the sum of roots?

Question: I have been able to find the 2 roots by the following way :-
<code>Let a be one root of f(x). Then
f(a) = 0
=>f(5-5+a) = 0
=>f[5-(5-a)] = 0
=>f[5+(5-a)] = 0
=>f(10-a) = 0 i.e. (10-a) and (a) are 2 roots of f(x).
</code>
How can I find the other 2 roots? Please help...
Answer: You can do the same thing starting with $b$ as the third root and find $10-b$ for the fourth.  Then the problem asks for the sum of the roots.
Comment: even i was thinking of the same way...but what if the number of roots would have been odd number like 5 roots or 7 roots... then how can we find that one..middle positioned root? what should we assume in that case?
Comment: @MdGhausAli if it is odd set $10-a=a$ to get $a=5$ as one roots proceed similarly for the rest even number of roots
Answer: It can help if you think more geometrically about it. The condition that $\color{blue}{f(5+x)=f(5-x)}$ for all real $x$ tells you that the graph of the function is symmetric about the vertical line $x=5$. [Compare this with the definition of even functions: $f(x)=f(-x)$, or equivalently, $f(0+x)=f(0-x)$, whose graphs are symmetric about the $y$-axis, i.e. about the vertical line $x=0$.] This means that, unless $x=5$ is a root, all other roots come in pairs, lying symmetrically around $x=5$.
We're given that there are four roots, so $x=5$ indeed is not a root — otherwise, we would have an odd number of roots, since this one doesn't have a pair. Now, think about any one pair of roots: what is their sum? Since they are symmetric around $x=5$, they lie at the same distance from it, say, $r$ units away. So they are the numbers like $x_1=5+r$ and $x_2=5-r$, and their sum is …
Comment: thank you...this was very well explained....got to see the bigger picture..
Comment: @MdGhausAli: You're very welcome!


Is there a chord containing an augmented and diminished fifth?

Question: What chord is this?

There's a chord progression often used at the beginning of a new phrase (chorus or interlude) leading from  I6 to the ii:
In C-major this would be:
Starting: E-G-(C)
Modulation passing bridge: Eb-F#orGb-G#
Resolving into: D-F-A
The G could be split in G# leading upwards to A and Gb leading down to F.
edit:
as the song is in G-major I redefine my question (transposed to this key) keeping the OP inrespect to the comments below:

the chorus starts with I6 (B-D-G)
the chord in question is Bb-C#-D#-G
leading to am7

my idea is:
wouldn't it make sense to consider this chord as
an inversion of the diminished chord (G-Bb-Db) with the augmented 5th (D#)?
Comment: Since each note in the Eb-Gb-G# chord is one semitone away from the notes in ii (D-F-A), I wouldn't interpret that chord as having both an augmented and diminished fifth. Besides, where's the root if that were the case?
Comment: But have you ever heard that chord *with* a root of C? Your description of it makes me doubt this is the case.
Comment: The root would be C and remain C,   that means the resolved chord would be an inversion of vii7. But in some cases it is I6 without  the root.
Comment: I'll post a picture ;) it is in G here, and with an augmented 4th, but in my opinion it could be aswell a diminished fifth.
Answer: This is not a German 6th, or any other kind of augmented 6th chord. Those are chords that function as dominant harmony, have an augmented 6th in them, and resolve the aug 6 to a unison on the root of the following chord. The only notes in this chord that could be spelled as an aug 6 are the C# and D#, which could be spelled as Eb and C#. If this was functioning as an augmented 6th chord, then the chord would resolve to a D chord, and both of those notes would resolve to the note D. That isn't what's happening here.
Although the sonority is enharmonically the same as a D#7 or Eb7 chord, it's not functioning that way here. This isn't really functional harmony, it's just voices moving chromatically from I to ii7. The reason for the spelling is that (1) they're trying to spell chromatic motion the way you normally spell it, with flats for downward motion and sharps for upward motion, and (2) they don't want to spell the top two voices as Db and D#, because that would be confusing and hard to read (especially for an accompanist on keyboard), so they spell the right hand so it's obvious what it is.

Is there a chord containing an augmented and diminished fifth?

Yes, in jazz you can have "alt" chords, which are basically a way of talking about tritone substitutions, and the scale you would play over that kind of chord would have both a b5 and a #5. I don't think that's what's going on here. That's because of the style of music, because there's no way that G is heard as the root of this chord, and because a tritone sub leading to Am would have a tritone in it consisting of a G# and a D.
Comment: This is a better analysis because it is guided by the voice leading.
Comment: There are some interesting aspects in your answer. I agree that in jazz and also in modern music there are chords with dim. and aug. fifths. Also in Bartoks music I've seen such tensions but those  chords can't be compared with this one here. I'm interested what other users will say  to your opinion: *there's no way that G is heard as the root of this chord*. I even would identify G as the tonic when it would be missing, that's why I explained originally it was a I6 without the root.
Answer: Seems like a badly written D#7 chord to me. That Bb would make more sense as A#, thus 2nd inversion of D#7, a tts leading to Am7. Or, of course, Eb7 with the C# and D# being Eb and Db respectively.
If it was dim 5 and aug 5, it would have to be written Db and D#, which wouldn't be easy.
Comment: @AlbrechtHügli - the moment I played it, it came across as Eb7
Comment: @AlbrechtHügli - isn't tts a function in itself? And if it is indeed a mix of dim and aug 5ths, (which it isn't!) what function might that play? And how could it be written in dots?
Comment: In jazz chord progression I've understood that I-IIIdim7-IIm-V7 is considered as a variation of the 1625 pattern. I could assume that this chord here is a mix between a diminished triad and/with an augmented 5th.
Comment: I know, that's like I use to think too when I play it, but this doesn't explain to me the function and the tension of the leading tones.
Comment: GI agree with you that an  enharmonic new interpretation would be D#7or Eb7 (like Ab7 for the German sixth le,do,me,fi). I would be pleased if one could answer: this **is** the German sixth (2nd. inversion me,fi,le,do) resolving in to ii7. But why Eb and not D#? and how leading to E?
Comment: Is tts an abbreviation for tritone sub? If so, then I don't think that really works as an analysis. The tritone in a chord functioning as dominant of Am would be the notes G# and D, and neither of those notes is present here.
Answer: I would argue that it is indeed tonal, and is an enharmonically-written (for purposes of voice leading) Eb7 in second inversion being used as a tritone substitute for an A7, which then actually resolves to the Am7.
G: I6  subV43/V | ii7  etc...
Something akin to above.


What is $ \sum_{n \,\text{prime}}\cos(2 \pi x \ln(n)) $?

Question: I want to re-evaluate the infinite sum used in this paper (https://www.researchgate.net/publication/265112276_FAVORED_CARDINALITIES_OF_SCALES) over just the primes.
They have (presumably the author just looked this up in a table or book, because it's not really derived, and setting $\sigma$ = 0):
$$ \sum_{n=1}^\infty Cos(2\ \pi\ x\ Log\ n ) = Re\ \zeta(2\ \pi\ i\ x) $$
At any rate, does anyone know what this infinite sum evaluates to if n is restricted over just the primes?:
$$ \sum_{n\ \epsilon\ Primes}^\infty Cos(2\ \pi\ x\ Log\ n ) = \ ?$$
Comment: Probably you can write a "closed form" in terms of the prime zeta function http://mathworld.wolfram.com/PrimeZetaFunction.html
Comment: I see no reason to think there is a closed form for this.  In fact (for real $x$) the term does not go to zero, so you will need to tell us what extended sense of convergence you have in mind.  Maybe "setting $\sigma=0$" is illegal even in the cited paper?  They even say their series converges only for $\sigma > 1$.
Comment: it doesn't converge @MarcoCantarini
Answer: As a start,
note that
$\cos(z)
=\Re e^{iz}
$.
Therefore
$\begin{array}\\
\sum_{n=1}^\infty Cos(2\ \pi\ x\ Log\ n )
&=\sum_{n=1}^\infty \Re e^{2\ \pi\ i\ x\ Log\ n }\\
&=\Re\sum_{n=1}^\infty e^{2\ \pi\ i\ x\ Log\ n }\\
&=\Re\sum_{n=1}^\infty n^{2\ \pi\ i\ x }\\
&= \Re\ \zeta(2\ \pi\ i\ x)\\
\end{array}
$
If you do the same thing for primes,
you get
$\begin{array}\\
\sum_{n\in \mathbb{P}} Cos(2\ \pi\ x\ Log\ n )
&=\sum_{n\in \mathbb{P}} \Re e^{2\ \pi\ i\ x\ Log\ n }\\
&=\Re\sum_{n\in \mathbb{P}} e^{2\ \pi\ i\ x\ Log\ n }\\
&=\Re\sum_{n\in \mathbb{P}} n^{2\ \pi\ i\ x }\\
\end{array}
$
I'm not sure where to go from here.


Views: how to remove ending zeros from decimal field

Question: Suppose, we have a view with a decimal field:

It is output like this:
5 000.000

Is it possible to remove the ending zeros, so it looked like this:
5 000

But if there are meaningful values in the field, it should output all of them. For example:
5.100 -> 5.1
5.010 -> 5.01
5.001 -> 5.001

Comment: Look closer at your image..."The number of digits to the right of the decimal". Does that not have an option for 0?
Comment: Ah, you didn't mention that in that question. In that case I don't think so, you'd probably need to write a custom field handler for that (unless you can find a module that provides one, but it's quite a niche requirement so you might not get lucky)
Comment: @Clive But I want it to output all 3 digits, if there are meaningful values. So, it should output: 4.001. But if the value is 4.030 it should output: "4.03".
Comment: See https://www.drupal.org/node/636382 - similar issue, already with some code.
Answer: I created a file /theme/bartik/templates/views-view-field--open-events--page--field-coefficient.tpl.php:
<?php
print (float) $row->_field_data['id']['entity']->field_coefficient[LANGUAGE_NONE][0]['value'];

And it worked.
Answer: You could write a custom field formatter in a custom module. See drupal-root/modules/field/modules/number/number.module and copy the related stuff for 'number_decimal' and adapt it to "trim_decimal".
number_field_formatter_info()
number_field_formatter_settings_form()
number_field_formatter_settings_summary()
number_field_formatter_view()

In custom_module_field_formatter_view() define your formatter (here named: trim_decimal) like this:
...
case 'trim_decimal':
      foreach ($items as $delta => $item) {
        $output = number_format($item['value'], $settings['scale'], $settings['decimal_separator'], $settings['thousand_separator']);

        // If scale, we want to remove trailing 0 and the decimal separator,
        // if there are no digits after decimal separator.
        if ($settings['scale']) {
          $output = rtrim(rtrim($output, '0'), $settings['decimal_separator']);
        }

        if ($settings['prefix_suffix']) {
          $prefixes = isset($instance['settings']['prefix']) ? array_map('field_filter_xss', explode('|', $instance['settings']['prefix'])) : array('');
          $suffixes = isset($instance['settings']['suffix']) ? array_map('field_filter_xss', explode('|', $instance['settings']['suffix'])) : array('');
          $prefix = (count($prefixes) > 1) ? format_plural($item['value'], $prefixes[0], $prefixes[1]) : $prefixes[0];
          $suffix = (count($suffixes) > 1) ? format_plural($item['value'], $suffixes[0], $suffixes[1]) : $suffixes[0];
          $output = $prefix . $output . $suffix;
        }
        $element[$delta] = array('#markup' => $output);
      }
      break;


AJAX Throbber - Keep throbber image but delete Please wait... message?

Question: This question has been asked a few times in various forms but is there a simple way to keep the animated blue throbbing image but delete the Please wait... text?
I'm trying this in my form_alter hook:
<code>unset($form['my-model']['#ajax']['progress']['message']);
// or
$form['my-model']['#ajax']['progress']['message'] = '';
</code>
But this appears to remove the message AND the animated throbber! I want the throbber to remain. Is it a requirement for message to not be empty for the throbber to even render?
Comment: I'd make sure that `$form['my-model']['#ajax']['progress']['type'] = 'throbber';` and `$form['my-model']['#ajax']['progress']['message'] = NULL;`
Comment: @Jimajamma That's a no go. The throbber.gif still does not appear if the message is set to NULL. The type defaults to 'throbber' by default so I do not need to verify that.
Comment: @Jimajamma Never mind! That did indeed work. After I explicitly set the type to throbber and message to NULL I got exactly what I wanted. Many thanks!
Answer: @Jimajamma answered the question correctly in the first comment.
<code> $form['my-model']['#ajax']['progress']['type'] = 'throbber';
 $form['my-model']['#ajax']['progress']['message'] = NULL;
</code>
Must explicitly be set and configured within the ['#ajax'] form element.


Rewrite header when no dkim header for specific domains

Question: I have been receiving a lot of mails that are "From" my domain. These mails have usually a different return path (spf passes), but have for example my email in the to and the from header. Spam-assassin doesn't catch all of these mails.
Now the plan is to somehow rewrite the headers to warn the users that the mail is not legit so if the from address is from my domain and there is no dkim signature I would like to classify it as spam or write something in the subject, but I am open to other alternatives.
Answer: I have solved it by using a few spam-assassin rules:
1) check if mail is from my domain
2) check if mail is to my domain
3) if both 1) and 2) are true add +5 spam score
4) if 1) and 2) are true and dkim is valid add -6 spam score
Answer: I'd add to that these items:

Setup DMARC with strict policies
Setup an aggressive SPF record (i.e., -ALL to fail).
Setup DKIM

You can really mitigate this problem quickly through effective email authentication.


Can you have a map with no value in go?

Question: I ask since I like that maps do not allow multiple keys. I know you can do something like the below where your values are bools or empty struct, but is there a way to get around specifying any value for your keys? Is there some advantage to having to specify an empty struct?
Related question, but focused on appending only unique values.
type N struct {}

func tengoQueCagar() {
    var map_almost_empty_value1 = map[int]bool{0:true,1:false}
    var map_almost_empty_value2 = map[int]struct{}{0:struct{}{},1:struct{}{}} //long and seems like lame syntax...
    var map_almost_empty_value3 = map[int]N{0:N{},1:N{}} //shorter.. better?

    var map_not_possible_empty_value_2 = map[int]nil{0:nil,1:nil} // better than empty struct syntax... but not possible
    var map_not_possible_empty_value_2 = map[int]{0,1} // ideally possible... but not...

    //do something...
}

Comment: If you find yourself doing `struct{}{}` a lot, you can create a shortcut variable for it. `empty := struct{}{}; map[int]struct{}{0:empty,1:empty}`
Comment: Yeah it just smells in my noob nose. Thanks for the comments!
Comment: A map without values isn't a map--it's a list.
Comment: @Flimzy is this true? Maps guarantee unique keys... that must involve some overhead.
Comment: Of course it's true, by definition. A map is an association of one thing to another. Without "another", it's not a map.
Comment: @Flimzy ok I guess I buy it by definition... I guess I'm asking... are maps and array implementation the same?
Comment: No, maps and arrays (and slices) are not the same.
Comment: And Go doesn't offer any sort of unique slice/array type, so using a map is appropriate. But you still must have the value portion. `struct{}{}` is the idiomatic way to do that. I think you've already got that though :)
Comment: Map has performance benefits, as it is hashed. So would still be faster than a slice or set.
Answer: struct{} requires 0 bytes to store. If you declare a map with struct{} values, you'd only be storing map keys.
There's a nice blog post about it:
https://dave.cheney.net/2014/03/25/the-empty-struct
If you want to use a map like a set, it might help to declare a separate type for it:
type IntSet map[int]struct{}

And you can add some convenience methods to it, such as:
func (i IntSet) Has(v int) bool {
  _, ok := i[v]
  return ok
}

Comment: To add a value to the map use `i[v] = struct{}{}`
Answer: For a direct answer to your question: See below!
This "empty struct{} as map values trick" comes up often and the argument in favor is always of the form "so the values do not need storage space".
The other natural thing to do is use a map[int]bool.
If memory is really a constraint of your application (e.g. because you are storing millions or billions of keys in your map) then yes: use struct{}. For all other, normal cases: Using struct{} makes such map literals awkward and key lookup more complicated as you have to use the comma-ok-variant (if _,ok := m[k]; ok {.
For bool values you can do a simple m[k] which is less to type and is easier to understand.
Personally I think use of struct{} as map value is a unnecessary, premature, overly clever optimisation. If you really need to save these few bytes because your map will contain millions of entries then probably a map is not the right data structure anyway: Depending on the use case bit vectors, sparse data structures or even probabilistic data structures (bloom-, cuckoo-filters), union-find, etc. might be much better suited.
Answer: No. In a map literal you have to specify each and every key. (General rule of thumb: There is no syntactic sugar in Go; there are no clever shortcuts in Go; everything is explicit in Go.)
Comment: One downside of using `map[K]bool` for a set is miss-use where a `false` value is stored into the map. I've seen such maps used as sets where someone adding/editing the code did `m[someKey] = false` instead of `delete(m, someKey)` which of course breaks any code using `if m[someKey]` as a set membership test.
Comment: @DaveC "which of course breaks any code using if m[someKey] as a set membership test." Why? m[somekey] == false in this case.
Comment: D'oh, I got it backwards, the `if m[someKey]` test keeps working but anything doing a `if _, ok := m[someKey]; ok` says it exists but someone doing a `m[someKey] = false` probably intended the key to not exist.
Comment: Yet, using bool value is the recommended way for using map as a set: https://blog.golang.org/maps#TOC_4.

Can you have a map with no value in go?


ARIMA model selection, ACF/PACF interpretation

Question: I am relatively new in this field and have my final thesis on crude oil price forecasting. I am stuck in identifying the optimal ARIMA model for my time series. I am using Stata 13.
The daily five year series of ICE crude oil futures is shown on a line graph below.

As it is obvious this time series needs differencing which I did after doing the augmented DF test. Here come the issues. I understand ACF and PACF graphs are useful for determining which ARIMA to use, but do I have to apply them to the non stationary series or the differenced one?
Of course I applied both to each series and come up with some weird results I am unsure how to interpret. These can be seen below, first for the original times series, then for the differenced one:

I am unsure what to do next and how to interpret these results and which model would be best to apply. If someone could guide me through to my next move I would be very grateful.
Here is the link to the data in Excel
http://www.megafileupload.com/smR4/Brent_Crude_Futures_Daily_5_Years_.xls
Comment: Financial price series cannot be predicted based on price alone itself. This is also evident from the ACF that entries are mostly contained within 0.05, which are not significant. The model that will fit best is white noise, which gives you no predictive power. You should also understand that there is no 5 year futures data. Those prices are made up by artificially combining various future contracts. How they are combined also makes a big difference in interpretation.
Answer: "... do I have to apply them to the non stationary series or the differenced one"
@Topli A non-stationary time series is not suitable for time series analysis. Please check the steps for Box-Jenkins Time Series Methodology.
Changing the subject to look at the big picture, I would reconsider using daily values for your problem because daily values are generally very noisy. Try weekly values and more than five years of data.
Remember that differences for lag=1 removes a deterministic trend line. Differences for lag=12 corrects for a seasonal effect within the year using monthly data. I don't know where you live but in USA history, business cycles average close to six years since the early 1940s and almost two years less for 1850s to 1940s even though the old data is crude [not oil :)]. Thus, almost like a seasonal effect, you need enough data to detect the business cycle effect on your series. Thus, more data (time) is always better for time series analysis. I would shoot to see at least four or five business cycles which means you should try to obtain 30 years of data. Also remember that a time series could be subject to external shocks like the several oil crises over the years. If the shocks are severe, you need to break your analysis into parts to exclude the shock because otherwise you will experience discontinuities that weaken your model.


Powershell Mass Rename files with a excel reference list

Question: I need help with PowerShell.
I will have to start renaming files in a weekly basis which I will be renaming more than 100 a week or more  each with a dynamic name.
The files I want to rename are in a folder name Scans located in the "C: Documents\Scans". And they would be in order, to say time scanned.
I have an excel file located in "C: Documents\Mapping\ New File Name.xlsx.
The workbook has only one sheet and the new names would be in column A with x rows. Like mention above each cell will have different variables.
P Lease make comments on your suggestions so that I may understand what is going on since I'm a new to coding.
Thank you all for your time and help.
Comment: Can you show us (part of) the Excel content so we can see wether or not it contains full path and filenames or just names? What decides the _"dynamic name"_ ?
Comment: It would be the scanning, when scanning it save the files as Scan 1 and so on.
Comment: Just refer to the Scans Folder. The files scanned will be in order with the most recent scanned at the top. Lets say I scanned 100 and the one displaying at the top will be scan 100, scan 99, scan 98 and so on. And in the excel file in column A there will be 100 rows with each cell value containing unique values. I would need PowerShell to override the current file name with the  new name that is reference in excel.
Answer: Although I agree with Ad Kasenally that it would be easier to use CSV files, here's something that may work for you.
<code>$excelFile   = 'C:\Documents\Mapping\New File Name.xlsx'
$scansFolder = 'C:\Documents\Scans'

########################################################
# step 1: get the new filenames from the first column in
# the Excel spreadsheet into an array '$newNames'
########################################################
$excel = New-Object -ComObject Excel.Application
$excel.Visible = $false
$workbook  = $excel.Workbooks.Open($excelFile)
$worksheet = $workbook.Worksheets.Item(1)

$newNames = @()
$i = 1
while ($worksheet.Cells.Item($i, 1).Value() -ne $null) {
    $newNames += $worksheet.Cells.Item($i, 1).Value()
    $i++
}

$excel.Quit
# IMPORTANT: clean-up used Com objects
[System.Runtime.Interopservices.Marshal]::ReleaseComObject($worksheet) | Out-Null
[System.Runtime.Interopservices.Marshal]::ReleaseComObject($workbook) | Out-Null
[System.Runtime.Interopservices.Marshal]::ReleaseComObject($excel) | Out-Null
[System.GC]::Collect()
[System.GC]::WaitForPendingFinalizers()

########################################################
# step 2: rename the 'scan' files
########################################################
$maxItems = $newNames.Count
if ($maxItems) {
    $i = 0
    Get-ChildItem -Path $scansFolder -File -Filter 'scan*' |      # get a list of FileInfo objects in the folder
        Sort-Object { [int]($_.BaseName -replace '\D+', '') } |   # sort by the numeric part of the filename
        Select-Object -First ($maxItems) |                        # select no more that there are items in the $newNames array
        ForEach-Object {
            try {
                Rename-Item -Path $_.FullName -NewName $newNames[$i] -ErrorAction Stop
                Write-Host "File '$($_.Name)' renamed to '$($newNames[$i])'"
                $i++
            }
            catch {
                throw
            }
        }
}
else {
    Write-Warning "Could not get any new filenames from the $excelFile file.."
}
</code>
Comment: Thank you the code works perfectly sorry for the lag.
Answer: You may want to have 2 columns in the excel file:

original file name
target file name

From there you can save the file as a csv.
Use Import-Csv to pull the data into Powershell and a ForEach loop to cycle through each row with a command like move $item.original $item.target.
There are abundant threads describing using import-csv with forEach.
Good luck.


To show there exists a unique function $u \in C^{1}(\mathbb{C^n})$ that satisfies $(\bar{\partial u})=f$

Question: Assume $n \gt 1$. Let $f$ be a $(0,1)$ form in $\mathbb{C^n}$, with $C^1$-coefficients and compact support $K$, such that $\bar{\partial} f=0$. Let $\Omega_{0}$ be the unbounded component of $\mathbb{C^n}-K$. I need to show there exists a unique function $u \in C^{1}(\mathbb{C^n})$ that satisfies $(\bar{\partial u})=f$ as well as $u(z)=0$ for every $z \in \Omega_{0}$
Let $f=\sum f_j(z) d\bar{z_j} $. Let's define for $z \in \mathbb{C^n}$ $$u(z)=\frac{1}{2\pi i}\int_{\mathbb{C}}f_{1}(\lambda,z_2,..,z_n) \frac{d\lambda \wedge d\bar{\lambda}}{\lambda-z_1}$$
$$=\frac{1}{2\pi i}\int_{\mathbb{C}}f_{1}(\lambda+z_1,z_2,..,z_n) \frac{d\lambda \wedge d\bar{\lambda}}{\lambda}$$
I am trying to evoke the following proposition here:

Let $\Omega \subset \mathbb{C}$ be a bounded open set. Suppose $f \in C^{1
}(\Omega)$, $f$ is bounded and $$u(z)=\frac{1}{2\pi i} \int_{\Omega} \frac{f(\lambda)}{\lambda-z} d\lambda \wedge d\bar{\lambda}, (z \in \Omega).$$ Then $u \in C^{1}(\Omega)$ and $\bar{D}u=f$.

From the above mentioned Proposition, $\bar{D_1}u=f_1$. I also think that $u \in C^1(\mathbb{C})$ follows from here but I am not sure about it. Now since we have $(\bar{\partial f})=0$, for $2 \le j \le n$, $\bar{D_j}f_1=\bar{D_1}f_j$, so that $$(\bar{D_j})u(z)=\frac{1}{2\pi i}\int_{\mathbb{C}}(\bar{D_j}f_{1})(\lambda,z_2,..,z_n) \frac{d\lambda \wedge d\bar{\lambda}}{\lambda-z_1}$$(why can I take the differential inside: because the function is bounded ??)
$$=(\bar{D_j})u(z)=\frac{1}{2\pi i}\int_{\mathbb{C}}(\bar{D_1}f_{j})(\lambda,z_2,..,z_n) \frac{d\lambda \wedge d\bar{\lambda}}{\lambda-z_1}$$
It should follow from here that the last statement is equal to $f_j(z)$. I am thinking of this proposition (but not able to find out why)

$$\text{Let $\Omega$ be a bounded region in $\mathbb{C}$, with smooth oriented boundary $\partial\Omega$. If $u \in C^1(\bar{\Omega})$, then we have $u(a)=\dfrac{1}{2\pi i}\int_{\partial \Omega}\dfrac{u(\lambda)d\lambda}{\lambda-a}-\dfrac{1}{2\pi i}\int_{\Omega}\dfrac{\bar{D}u(\lambda)d\bar{\lambda}\wedge d\lambda}{\lambda-a} $}$$

Suppose $\bar{D_j}u=f_j$ for $1 \le j \le n$, then we are done with the first part. This also shows that $u$ is holomorphic in $\Omega_0$(as the derivatives vanish there). I have no idea how to show that $u(z)=0$ in $\Omega_0$( take $|z_1|$ large in the first equation??)
Also why this theorem fails when $n=1$??
Thanks for the help
Answer:
From the above mentioned Proposition, $\overline{D}_1u=f_1$. I also think that $u \in C^1(\mathbb{C})$ follows from here but I am not sure about it.

Yes, the assertion follows from the proposition, but we need to add a few arguments, since the situation we have here is slightly different. In the proposition, we have a bounded $\Omega \subset \mathbb{C}$ while here we look at the entire space. But since $f_1$ has compact support, we can restrict the integral to a bounded $\Omega$ without changing $u$, as long as $\Omega$ contains the support of $f_1$. Additionally, in the proposition the integrand is a function of a single variable, while here $f_1$ depends on several variables. The theorems about parameter-dependent integrals yield the desired conclusion. However, in my opinion it is nicest to use the alternative form
$$u(z) = \frac{1}{2\pi i} \int_{\mathbb{C}} f_1(\lambda + z_1,z_2,\dotsc,z_n)\cdot \frac{d\lambda\wedge d\overline{\lambda}}{\lambda}$$
of the integral to deduce that $u \in C^1(\mathbb{C}^n)$. Since $f_1 \in C^1(\mathbb{C}^n)$ and $f_1$ has compact support, the theorems about differentiation under the integral - whether for Riemann integrals or Lebesgue integrals - immediately show that $u \in C^1(\mathbb{C}^n)$ and
$$\frac{\partial u}{\partial w}(z) = \frac{1}{2\pi i} \int_{\mathbb{C}} \frac{\partial f_1}{\partial w}(\lambda + z_1,z_2,\dotsc,z_n)\cdot \frac{d\lambda\wedge d\overline{\lambda}}{\lambda},$$
where $\frac{\partial}{\partial w}$ can be any of the real partial derivatives $\frac{\partial}{\partial x_k},\,\frac{\partial}{\partial y_k}$ or the Wirtinger derivatives $\frac{\partial}{\partial z_k},\, \frac{\partial}{\partial \overline{z}_k}$.
We then invoke the proposition only to see that - for fixed $z_2,\dotsc,z_n$ - we have $\frac{\partial u}{\partial \overline{z}_1} = f_1$.

I am thinking of this proposition (but not able to find out why)

We use that proposition (the inhomogeneous Cauchy integral formula/Cauchy-Pompeiu formula) for the function $g\colon z_1 \mapsto f_j(z_1,z_2,\dotsc,z_n)$ with $z_2,\dotsc,z_n$ fixed, and $\Omega$ a large disk containing the support of $g$. [Since $f_j$ has compact support, its slice $g$ also has compact support, for arbitrary fixed $z_2,\dotsc,z_n$. Instead of a disk, we could take any other domain with smooth boundary containing the support of $g$, naturally.] By the inhomogeneous Cauchy integral formula, we have
\begin{align}
f_j(z_1,z_2,\dotsc,z_n) &= g(z_1)\\
&= \frac{1}{2\pi i} \int_{\partial \Omega} \frac{g(\lambda)}{\lambda - z_1}\,d\lambda - \frac{1}{2\pi i} \int_{\Omega} \frac{\partial g}{\partial \overline{z}_1}(\lambda)\frac{d\overline{\lambda}\wedge d\lambda}{\lambda - z_1}\\
&= - \frac{1}{2\pi i} \int_{\Omega} \frac{\partial g}{\partial \overline{z}_1}(\lambda)\frac{d\overline{\lambda}\wedge d\lambda}{\lambda - z_1} \tag{$\operatorname{supp g} \subset \Omega$}\\
&= \frac{1}{2\pi i} \int_{\Omega} \frac{\partial g}{\partial \overline{z}_1}(\lambda)\frac{d\lambda\wedge d\overline{\lambda}}{\lambda - z_1}\\
&= \frac{1}{2\pi i} \int_{\mathbb{C}} \frac{\partial g}{\partial \overline{z}_1}(\lambda)\frac{d\lambda\wedge d\overline{\lambda}}{\lambda - z_1} \tag{$\operatorname{supp g} \subset \Omega$}\\
&= \frac{1}{2\pi i} \int_{\mathbb{C}} \frac{\partial f_j}{\partial \overline{z}_1} (\lambda,z_2,\dotsc,z_n)\frac{d\lambda\wedge d\overline{\lambda}}{\lambda - z_1}\\
&= \frac{1}{2\pi i} \int_{\mathbb{C}} \frac{\partial f_1}{\partial \overline{z}_j} (\lambda,z_2,\dotsc,z_n)\frac{d\lambda\wedge d\overline{\lambda}}{\lambda - z_1} \tag{$\frac{\partial f_i}{\partial \overline{z}_j} = \frac{\partial f_j}{\partial \overline{z}_i}$}\\
&= \frac{\partial u}{\partial \overline{z}_j}(z)
\end{align}
for any such $\Omega$.

I have no idea how to show that $u(z)=0$ in $\Omega_0$( take $\lvert z_1\rvert$ large in the first equation?)

Not quite. We integrate over the first variable, so that one is inconvenient to play with (and, as we see below, playing with $z_1$ wouldn't lead to the conclusion). The other variables are just parameters for the integral, so we can more easily play with them. Since $f_1$ has compact support, there is an $M \in (0,+\infty)$ such that $f_1(z) = 0$ for all $z$ with $\lvert z_2\rvert > M$. Hence we have $u(z) = 0$ for $\lvert z_2\rvert > M$, since the integrand in
$$u(z) = \frac{1}{2\pi i}\int_{\mathbb{C}} \frac{f_1(\lambda,z_2,\dotsc,z_n)}{\lambda - z_1}\,d\lambda \wedge d\overline{\lambda}$$
vanishes identically for such $z$. By definition of $\Omega_0$, the set $\{ z \in \Omega_0 : \lvert z_2\rvert > M\}$ is a nonempty open subset of $\Omega_0$, and $\Omega_0$ is connected, hence by the identity theorem the holomorphic function $u\lvert_{\Omega_0}$ is identically $0$.

Also why this theorem fails when $n=1$?

Only one part of the theorem fails for $n = 1$. We generally don't have $u(z) = 0$ for $z \in \Omega_0$ then. For $f \in C^1(\mathbb{C})$ with compact support, the function
$$u(z) = \frac{1}{2\pi i}\int_{\mathbb{C}} \frac{f(\lambda)}{\lambda - z}\,d\lambda\wedge d\overline{\lambda}$$
is a continuously differentiable function with $\frac{\partial u}{\partial \overline{z}} = f$ also for $n = 1$. It just generally doesn't have compact support.
We could say the reason is because for $n = 1$ we have no parameter we can manipulate to make the integral vanish for an open subset of "large" $z$.
A more theory-oriented reason is that Hartogs' Kugelsatz doesn't hold for $n = 1$:
Suppose we have a holomorphic function $g$ defined on $G = \{ z \in \mathbb{C}^n : \lVert z\rVert > M\}$ for some $M \in (0,+\infty)$. Let $\varphi \in C^{\infty}_c(\mathbb{C}^n)$ be a cut-off function such that $\varphi(z) = 1$ for $\lVert z\rVert \leqslant M+1$ and $\operatorname{supp} \varphi \subset \{ z : \lVert z\rVert \leqslant M+2\}$. Then $(1-\varphi(z))\cdot g(z)$ is a smooth function on $\mathbb{C}^n$ if we define it to be $0$ on $\mathbb{C}^n\setminus G$, since $1-\varphi$ vanishes identically on a neighbourhood of $\mathbb{C}^n\setminus G$. Now define
$$f_j(z) = \frac{\partial}{\partial \overline{z}_j} \bigl((1-\varphi)\cdot g\bigr)(z).$$
Since $(1-\varphi)\cdot g$ is holomorphic for $\lVert z\rVert < M+1$ and $\lVert z\rVert > M+2$, $\omega := \sum_j f_j(z)\,d\overline{z}_j$ is a compactly supported smooth $\overline{\partial}$-closed $(0,1)$-form. If we have $\omega = \overline{\partial} u$ for a compactly supported $u$, then
$$h(z) = (1-\varphi(z))\cdot g(z) - u(z)$$
is an entire holomorphic function, and since $u$ has compact support, we have $h(z) = g(z)$ for all large enough $\lVert z\rVert$. By the identity theorem, since $G$ is connected, it follows that $h\lvert_G \equiv g$, so $h$ is an extension of $g$ to an entire function.
Since for $n = 1$ holomorphic functions can have non-removable isolated singularities (and worse), it follows that for $n = 1$ not all compactly supported smooth $(0,1)$-forms [$\overline{\partial}$-closed is automatic for $n = 1$] can be of the form $\overline{\partial} u$ for compactly supported $u$.


Disease Control Rate for a Clinical Trial problem

Question: Recently, I have come across a 2-armed clinical trial problem which attempts to find a "Disease Control Rate" (DCR) for patients in the treatement and placebo arms.
On the Internet I found DCR to be defined as follows:
"Disease Control Rate is defined as the percentage of patients with advanced or metastatic cancer who have achieved complete response, partial response and stable disease to a therapeutic intervention in clinical trials of anticancer agents".
Although, I am completely fine with the definition, I am having problems on how to interpret the DCR mathematically.
Say, I have two groups of cancer patients, one receiving treatement and one placebo. Say, intially during treatment, they have abnormal CA-125 levels.
So, should my DCR be the percentage of patients who experienced stable CA-125?
Is there any time limit which I should be considering for acquring this complete or partial response ?
Any article or book which describes the calculation of real time DCR will be very helpful.
Please help me with this.
Answer: This is less a question of statistics than it is about outcomes in cancer trials.
A Bit of Background
Outcomes in cancer have evolved over time. In the 1960's the definition of a "response" was a decrease in tumour mass, no increase in an individual tumour's size and no appearance of new lesions (see, for example, [1]). In 1979, the WHO established the bidimensional measurements of tumours as a standard [2] with partial response (PR) arbitrarily defined as decrease of at least 50% in tumour size while tumour progression was defined an increase of at least 25% in size or new lesions. Then, in 1992, the Southwest Oncology Group expanded this idea from an area criterion to a volumetric one [3]. In 2000, tumour response was standardised through Response Evaluation Criteria in Solid Tumors (RECIST), which recommended unidimensional tumour measurement by its longest diameter as a reproducible standard. The definition of PR was a 30% or greater decrease in the sum of the measurable lesions and "progressive disease" was defined a 20% or greater increase or appearance of new lesions [4].
These ways of measuring tumour response all depend on size, which is not ideal is certain circumstances. Thus, the idea of the "disease control rate" was introduced by the Southwest Oncology Group in 2008 [5]. The DCR is a composite measure that incorporates the ideas of a complete response (CR) and PR. Thus, the DCR is a measure of tumour non-progression.
Since its introduction, the idea has been adopted in many areas of cancer, each employing criteria that define this concept of non-progression. The standard inclusion still applies, though. DCR = CR + PR + some measure of stable disease.
Your Questions

So, should my DCR be the percentage of patients who acquired stable CA-125?

If you have evidence to suggest that CA-125 is a marker of disease progression, then, yes, patients who show stable CA-125 will meet the definition of having achieved DCR. However, this is only partially complete, since DCR also includes patients who experienced complete remission and those who experienced partial remission. You cannot only include those with stable CA-125.

Is there any time limit which I should be considering for acquring this complete or partial response?

The answer to this question is specific to the type of cancer you are studying, including important considerations such as its clinical stage. There is no one single answer for all cancers.

Any article or book which describes the calculation of real time DCR will be very helpful.

DCR is not calcualted in "real time". Nevertheless, the calculation is quite simple. Let's take this recent article by Ding and colleagues as an example [6]. First, they defined the components of DCR.

Complete response (CR) - complete endometrial withdrawal, stromal decidualization, and no endometrial hyperplasia or carcinoma
Partial response (PR) - reduced grades of endometrial lesions with residual cancer foci accompanied by gland degeneration and atrophy
Stable disease (SD) - no changes in endometrium with residual cancer foci and no endometrial degeneration and atrophy
Progressive disease (PD) - the presence of clear muscular infiltration or extrauterine lesions).

Then, the DCR is simply CR + PR + SD or N (the total study population) - PD.
This kind of operationalisation is common.
Good luck.
References

Zubrod CG, Schneiderman M, Frei E III, et al. Appraisal of methods for the study of chemotherapy of cancer in man: Comparative therapeutic trial of nitrogen mustard and triethylene thiophosphoramide. J Chronic Dis 1960;11:7-33.
Miller AB, Hoogstraten B, Staquet M, et al. Reporting results of cancer treatment. Cancer 1981;47:207-214.
Green S, Weiss GR. Southwest Oncology Group standard response criteria, endpoint definitions, and toxicity criteria. Invest New Drugs 1992;10:239-253,
Therasse P, Arbuck SG, Eisenhauer EA, et al. New guidelines to evaluate the response to treatment in solid tumors. J Natl Cancer Inst 2000;92:205-216.
Lara PN, Redman MW, Kelly K,  et al. Disease control rate at 8 Weeks predicts clinical benefit in advanced non–small-cell lung cancer: Results from Southwest Oncology Group randomized trials. J Clin Oncol 2008;26:463-467.
Ding L, Li HY, Wang YP. Application of jianpi xiaoai recipe combined with cisplatin and adriamycin in the treatment of endometrial cancer and its effect on disease control rate. Evid Based Complement Alternat Med 2021;2021:2258183.
Comment: Welcome to Cross Validated! Nice overview of the evolving definitions of outcomes in cancer studies, well documented. I look forward to your future contributions to the site. (+1)
Comment: @Toffee-nosed Hypothesis Such an ellaborate and insightful explaination! Thank you so much. Was of great help, clearing my doubts..


Show $I=p\mathbb{Z}$ for prime $p$.

Question: Let $I\subset\mathbb{Z}$ be an ideal such that $I\neq \mathbb{Z}$ and if $I\subset J\subset\mathbb{Z}$ then $I=J$ or $J=\mathbb{Z}$. Show that $I=p\mathbb{Z}$ for some prime $p$.
Attempt: We know that $\mathbb{Z}/I$ is a field $\Rightarrow$ $\mathbb{Z}/I$ is an integral domain. So, $\forall x,y\in \mathbb{Z}/I$ such that $xy=0$, $x=0$ or $y=0$. I am confused where to go next.
Answer: There's a nice theorem for this.
Theorem: $\mathbb{Z}/n\mathbb{Z}$ is a field iff $n$ is prime.
Proof:
Let $n$ be prime. Let $a \in \mathbb{Z}/n\mathbb{Z}$. We have the formula $$ab + kn = 1$$ and so $a^{-1} = b$ must exist by the extended euclidean algorithm.
Now let $n$ be composite. In this case $\mathbb{Z}/n\mathbb{Z}$ is not a field because it isn't even an integral domain. $\square$
I'm sure you can fill in the rest.
Comment: Oh, that's useful. Many thanks!
Comment: Sure thing, dude!

Show $I=p\mathbb{Z}$ for prime $p$.


Sending build log as content of the email from a Jenkins Job

Question: I am using Jenking DSL Plugin/Groovy to send email once the job ran successful.
   static void sendEmail(Job job, String jobName) {
    job.with {
        publishers {
            extendedEmail {
                recipientList('firstname.lastname@example.com')
                defaultSubject("Jenkins Job started : ${jobName}")
                defaultContent("See the latest build in the jenkins job here https://jenkins.xyz.com/job/${jobName}/")
                contentType('text/html')
                triggers {
                    failure {
                        content("See the latest build in the jenkins job here https://jenkins.xyz.com/job/${jobName}/")
                        contentType('text/html')
                        recipientList('email@example.com')
                        subject("Build Failed in Jenkins: ${jobName}")
                    }
                    success {
                        content('See the latest build in the jenkins job here https://jenkins.xyz.com/job/${jobName}/
 ${BUILD_LOG, maxLines=30, escapeHtml=false}
')
                        contentType('text/html')
                        recipientList('email@example.com')
                        subject("Build Success in Jenkins: ${jobName}")
                    }
                }
            }
        }
    }
}

In the content section
content('See the latest build in the jenkins job here https://jenkins.xyz.com/job/${jobName}/
 ${BUILD_LOG, maxLines=30, escapeHtml=false}
')

if i use singe quotation then i am able to print log as the content of the email but nor the job name and if i use double quotation then i able to print the job name but not the build log.
How can i print both the job name and build log in the email ?
Comment: What happens if you split the string apart and concatenate it - this way, you can use `''` and `""` as required. BTW working with these expressions seems to be problematic at best (see e.g. [here](https://stackoverflow.com/questions/32697156/jenkins-build-log-maxlines-escapehtml-not-working)).
Answer: String interpolation only works with double quoted strings, so change the quotes to double quotes.
When you say that BUILD_LOG expansion doesn't work afterwards than the var is not expanded by Groovy but by Jenkins itself. So try the following:
content("See the latest build in the jenkins job here https://jenkins.xyz.com/job/${jobName}/ " + '
 ${BUILD_LOG, maxLines=30, escapeHtml=false}
')

or you escape the $:
content("See the latest build in the jenkins job here https://jenkins.xyz.com/job/${jobName}/
 \${BUILD_LOG, maxLines=30, escapeHtml=false}
")


Can we deduce from the equality that $\max \{n-q,q-1\} \in \left[ \frac{n}{2},n \right)$?

Question: Suppose that we have a uniform distributed random variable in $[0,n]$.
We have the following:
$$\max \{n-q,q-1\}=\left\{\begin{matrix}
q-1, q > \lfloor \frac{n}{2}\rfloor & \to q-1> \lceil\frac{n}{2} \rceil \\
 n-q, q \leq \lceil \frac{n}{2} \rceil& \to n-q \geq n- \lceil \frac{n}{2}\rceil=\lfloor \frac{n}{2}\rfloor
\end{matrix}\right.$$
Can we deduce from the above that $\max \{n-q,q-1\} \in \left[ \frac{n}{2},n \right)$ ? Or how else do we get this result?
Answer: Consider if $q=\frac {n+1}2$. Then,
$$\max\{n-q,q-1\}=\max\left\{\frac {n-1}2, \frac {n-1}2\right\}=\frac {n-1}2\not\in \left[\frac n2, n\right)$$
Also consider if $q=0$. Then $\max\{n-q,q-1\}=n\not\in[\frac n2,n)$.
Here is how you can find the correct interval. $n-q$ decreases and $q-1$ increases as $q$ increases. If there is a $q$ such that they are equal, that will be the $q$ for which $\max\{n-q,q-1\}$ achieves its minimum. So, let's see when that occurs.
$$\begin{align}&n-q= q-1\\
\implies&n+1= 2q\\
\implies&q=\frac{n+1}2
\end{align}$$
The minimum is achieved at $q=\frac {n+1}2$. Then $\max\{n-q,q-1\}=\frac{n-1}2$ and we get that $\max\{n-q,q-1\}\in[\frac {n-1}2,n]$.


Minimal set and $\epsilon$-dense

Question: Let $f:X\to X$ be a homeomorphism  on compact metric space $(X, d)$ and $K$ be a minimal set, i.e. a compact  $f$-invariant set that for all $x\in K$, the orbit $O(x)$ is dense in $K$.
In a paper, author claim that for every $\epsilon>0$ there is $n\geq 0$ such that for all $x\in X$, the set $O_n(x)=\{f^{i}(x)\}_{i=-n}^n$ is $\epsilon$-dense i.e. for all $y\in K$ there is $j\in \{-n, -n+1, \ldots, n\}$  such that $d(y, f^j(x))<\epsilon$.
Proof of it, is not clear for me. Please help me to know it.
Answer: Since $\{f^i(x)\}_{i= -\infty}^{\infty}$ is dense, the set of all balls $B_{\epsilon}(f^i(x))$ centred at $f^i(x)$ and of radius $\epsilon$ is an open covering of $K$. Since $K$ is compact, there must exist a finite subcovering. Therefore, we can choose $i_1 \ldots i_l$ such that $\{f^{i_k}(x)\}_{k=1}^{l}$ is $\epsilon$-dense. Now $i_1 \ldots i_l$ must be a subset of $[-n,n] \cap \mathbb{Z}$ for some $n$.
Comment: In that case the theorem is not true. You might take $X = \mathbb{C}$, $K = \{|z|=1\}$, and $f(z) = e^i \cdot z$ as a counterexample.
Comment: Thanks.  In my question, $x\notin K$, hence we can not say $\{f^i(x)\}$ is dense in $K$.
Comment: In my question, $X$ is a compact metric space.
Comment: Ok, take $X$ to be the set $\{z \in \mathbb{C}| |z| \leq 10\}$. Still disproves the theorem
Comment: Thanks for your example. What do you mean by $f(z)=e^i.z$. Would you please give me some more details on your example.
Comment: Just taking any complex number and turning it one radian in the positive direction

Minimal set and $\epsilon$-dense


Network Reachability is not working iOS 7.0.3

Question: I am new to stackoverflow. we are using DDG(Donoho Design Group) Reachability API http://blog.ddg.com/?p=24.
Till iOS6, iOS7 GM seed, iOS7.0.1, 7.0.2 it is working fine, but with iOS7.0.3 it was delayed by more than 3 mins. Our App is suffering with this behaviour.
Has anybody facing this issue in 7.0.3? It would great help if anybody found the solution
Thanks,
Purushotham Jinka
Comment: DDG Reachability API is nearly 3 years old now. It was built to improve on Reachability 2.0 from Apple. I would recommend using Apple Reachability as it is now in version 3.0 which was released back in August
Comment: I have tried to use new version 3.0, i am still facing the problem.

My scenario is iPad device is connected to wifi router, when app is in foreground state disconnect the WAN cable for router, now reachability is not detecting internet status change. Same problem with while connecting the WAN cable also. It is almost taking 5 min to get new status. I have observed this problem even with Safari, Appstore apps also. I think this is iOS issue.
Answer: Try using AFNetworking Reachability. It worked for me. Even I was facing the same problem.
Apple's Reachability is not working.
Answer: You should try like this:
In your declaration:
<code>@property (nonatomic) Reachability *reachability;
</code>
Implementation:
<code>- (void)viewDidLoad {

    [super viewDidLoad];

    self.reachability = [Reachability reachabilityForInternetConnection];
    [self.reachability startNotifier];

    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(handleNetworkChange:)
                                                 name:kReachabilityChangedNotification
                                              object:nil];
}

- (void)handleNetworkChange:(NSNotification *)notice {

   NetworkStatus remoteHostStatus = [self.reachability currentReachabilityStatus];

    if(remoteHostStatus == NotReachable)
    {

    }
    else if (remoteHostStatus == ReachableViaWiFi)
    {

    }
    else if (remoteHostStatus == ReachableViaWWAN)
    {

    }
}
</code>


Possible conflict with multiple jquery plugins

Question: I have a custom module that uses the jCarousel jquery plugin (not the Drupal module). The module code up to this point works correctly, and looks like this (only the main function included for brevity.)
function speaker_carousel_block_view($delta = '') {
 switch($delta){
    case 'speaker_carousel':
      drupal_add_js('sites/all/libraries/jcarousel/lib/jquery.jcarousel.min.js');
      drupal_add_css('sites/all/libraries/jcarousel/skins/speakers/jcarousel-speakers.css');

     drupal_add_js(
       'jQuery.noConflict();
            (function($) {
              $(document).ready(function() {
                 jQuery("#mycarousel").jcarousel({wrap: "circular"});
                });
            })(jQuery);',
       'inline'

     );

        $block_content = "";
        //Use our custom function to retrieve data.
        $result = speaker_carousel_get_data();

        //parse into html
        $block_content .= '
';
        $block_content .= speaker_carousel_create_html($result);
        $block_content .= '
';

        $block['content'] = $block_content;
  }
  return $block;
}

I'm now trying to incorporate a second plugin ([jquery tools tooltip])2 to handle a mouseover popup of some text. This is what the function looks like after additions:
function speaker_carousel_block_view($delta = '') {
 switch($delta){
    case 'speaker_carousel':
      drupal_add_js('sites/all/libraries/jcarousel/lib/jquery.jcarousel.min.js');
      drupal_add_css('sites/all/libraries/jcarousel/skins/speakers/jcarousel-speakers.css');
      drupal_add_js('http://cdn.jquerytools.org/1.2.7/full/jquery.tools.min.js', 'external');

     drupal_add_js(
       'jQuery.noConflict();
            (function($) {
              $(document).ready(function() {
                 jQuery("#mycarousel").jcarousel({wrap: "circular"});
                 jQuery("#mycarousel img").tooltip();
                });
            })(jQuery);',
       'inline'

     );
        $block_content = "";
        //Use our custom function to retrieve data.
        $result = speaker_carousel_get_data();

        //parse into html
        $block_content .= '
';
        $block_content .= speaker_carousel_create_html($result);
        $block_content .= '
';

        $block['content'] = $block_content;

  }
  return $block;
}

As soon as I add the second drupal_add_js() call in (to the cdn.jquerytools.org site), everything blows up. The carousel no longer displays correctly; it just shows a single item instead of the horizontally scrolling strip of images that was there before. Any idea how I can get the two to play nicely together?

I found the JQuery Multi module, which I really thought would help. I installed and configured, and now the carousel no longer blows up, but I get an error in Firebug console:

jQuery("#mycarousel a.speaker_trigger").tooltip is not a function
  jQuery("#mycarousel a.speaker_trigger").tooltip();

I know it's not an issue with the two plugins working together, because I copied the rendered source into a static HTML file and put it here. It works fine, but it's only using a single version of jquery.
Do you have any idea?
Answer: You can run two separate versions of jQuery, which is what your situation seems to require.
This module offers hope to an easy resolution . https://drupal.org/project/jqmulti
Otherwise this document offers more clarity: https://drupal.org/node/1058168
Generally speaking, you only need a single instance of jQuery installed on the server, which might be called from many different scripts scattered all over the place. However sometimes you'll have a requirement for jQuery more recent than your current stock-Drupal installation. This is when you want to run multiple jQuery versions (because you don't want to simply upgrade your single instance, which would break standard Drupal jQuery stuff like the admin-menu).
(function($){
    // your code here, using jQuery 1.7.1 setup w/ jqmulti module
    alert("jQuery version = " + $().jquery); //proves jquery version being used
})(jq171)

Comment: I am not seeing that you have wrapped your Drupal jQuery code in a targetting closure, so that the jQuery module can have effect. Here's a snippet from the module's readme.txt that target's jQuery 1.7.1 having been made available via the jqmulti module:

`(function($){
// your code here, using jQuery 1.7.1
})(jq171)`
Comment: Thanks, but as the original post indicates, I've already tried the Jquery Multi module.
Comment: The idea is to let Drupal run at the stock, older version without breakage (which max's to version 1.3.2 only when you have the jquery update module installed), but when you need it, you want to load a targetted jquery version (like 1.7.1) for any given node-type which contains your javascript gizmo; but only then. jqmulti is just a sort of drupal module gui for non-coders.
Comment: Yes, I'm aware of that. I did try that after the original posting. It still doesn't work. I've posted on the module board at drupal.org and am talking with the developer.
Answer: jquerytools includes jquery so you are calling jquery 2 times (if i'm not wrong you are calling the full jquerytools file).
You should download a version without jquery and link that one.
Beware: Drupal jquery is version 1.4.4 (1.5.2 with jquery update).
I remember jquerytools depending on jquery 1.6.x (not sure) so check for jquerytools requirements.
Comment: Not sure I understand. You're saying that if jquerytools requires something higher than 1.4.4 I can't use it because Drupal is stuck on an old version?


How to make my Drupal custome Service return data on GET?

Question: I have defined few Drupal custom Services and they are working fine
via POST requests. But one of them needs to be available via GET.
This one:
function rooms_services_services_resources() {
    return array(
        'api' => array(
            'actions' => array(
                'hotel_inventory' => array(
                    'help' => 'Inventory of all Hotels',
                    'callback' => 'rooms_services_hotel_inventory',
                    'access callback' => 'rooms_services_access_callback',
                    'access arguments append' => false,
                    'args' => array(
                        array(
                            'name' => 'params',
                            'optional' => true,
                            'source' => 'param',
                            'type' => 'struct',
                            'description' => 'all passed URL parameters'
                        ),
                    ),
                ),
            ),
        ),
    );
}

It's working fine when I am making a request via POST with headers:
`Content-Type: application/x-www-form-urlencoded`

or
`Content-Type: application/json`

as those I have enabled in my REST Server...
How do I make it work via simple GET request ?
Answer: The short answer is you can't, unfortunately (AFAIK). For all non action resources, the Services module assumes that they are part of the entity C.R.U.D. spectrum, and then decides what to do based on the HTTP method. For example:
POST = Create
GET = Retrieve
PUT = Update
DELETE = Delete

So unless you're building an entity C.R.U.D. layer, you'll have to use POST on the actions array. Alternatively you could use hook_menu() to make your own custom page_callback that outputs JSON, then it could be accessed over GET. Another alternative is to use something like Views Datasource and compose a Views JSON to output your data (also available via GET).
Answer: hook_menu() would work well for this. And it sounds like you have already worked out some of the functions, so given that, something like this might work:
function rooms_services_menu(){
  $items['api/hotel-inventory'] = array(
    'title' => 'All Hotel Inventory',
    'page callback' => 'rooms_services_hotel_inventory',
    'access callback' => 'rooms_services_access_callback',
  );
}

function rooms_services_hotel_inventory(){
  ...
  return $inventory; //or whatever you want the GET request to return
}

I imagine you could put this in the same module as your REST hooks.
Answer: rather than use an action , you could use the approach that is used in the documentation here: https://www.drupal.org/node/783460.
Essentially just like you have the CRUD operations,  create an 'index' operation.
Have a look at the node service too - that impliments an index service
call /endpoint/node - and it lists all nodes, it has parameters for fields, page size.
'index' => array(
      'help' => 'List all nodes',
      'callback' => 'rooms_services_hotel_inventory',
      'args' => array(

It seems the perfect fit for your inventory list.


translating certain to the logic

Question: In the question it says every meal  is cooked by a certain chef . I wonder what the certain means in this sentence should i think it is equal meaning with exactly or some
Comment: Good question... The sentence is ambiguous; for sure: "for every meal there is at least one chef that cooks it" is true.  We may have more than one chef to cook a meal ? Maybe.
Answer: There is no certain answer to this question . However if You leave out the word "certain" from your sentence it would almost always deny that their must be one chef . So putting the word "certain" in your sentence would tend to mean that there was only one chef . Hope that helps .
Comment: That would be my interpretation and reasoning for it as well!

translating certain to the logic


Finding length of list without using the 'len' function in python

Question: In my High school assignment part of it is to make a function that will find the average number in a list of floating points. We can't use len and such so something like sum(numList)/float(len(numList)) isn't an option for me. I've spent an hour researching and racking my brain for a way to find the list length without using the len function, and I've got nothing so I was hoping to be either shown how to do it or to be pointed in the right direction. Help me stack overflow, your my only hope. :)
Comment: You could find the length of the list by calling `numList.__len__` >:)
Comment: Start with a counter and a total of 0, then increment them by 1 and the value respectively... after you've looped the list, do the final calc?
Comment: @OozeMeister did you even read the question?
Answer: Use a loop to add up the values from the list, and count them at the same time:
def average(numList):
    total = 0
    count = 0
    for num in numList:
        total += num
        count += 1

    return total / count

If you might be passed an empty list, you might want to check for that first and either return a predetermined value (e.g. 0), or raise a more helpful exception than the ZeroDivisionError you'll get if you don't do any checking.
If you're using Python 2 and the list might be all integers, you should either put from __future__ import division at the top of the file, or convert one of total or count to a float before doing the division (initializing one of them to 0.0 would also work).
Comment: Thankyou so much, i just finished up a 10 hours shift after like no sleep and today is pretty much the only time i have to work on this before it's due. Thankyou so much for your help :)
Answer: Might as well show how to do it with a while loop since it's another opportunity to learn.
Normally, you won't need counter variable(s) inside of a for loop. However, there are certain cases where it's helpful to keep a count as well as retrieve the item from the list and this is where enumerate() comes in handy.
Basically, the below solution is what @Blckknght's solution is doing internally.
def average(items):
    """
        Takes in a list of numbers and finds the average.
    """
    if not items:
        return 0
    # iter() creates an iterator.
    # an iterator has gives you the .next()
    # method which will return the next item
    # in the sequence of items.
    it = iter(items)
    count = 0
    total = 0
    while True:
        try:
            # when there are no more
            # items in the list
            total += next(it)
        # a stop iteration is raised
        except StopIteration:
            # this gives us an opportunity
            # to break out of the infinite loop
            break
        # since the StopIteration will be raised
        # before a value is returned, we don't want
        # to increment the counter until after
        # a valid value is retrieved
        count += 1
    # perform the normal average calculation
    return total / float(count)

Answer: def length_of_list(my_list):
      if not my_list:
           return 0
      return 1+length_of_list(my_list[1:])


Finding tangent's equation that touchs parabola at $(4, 4)$

Question: $y^2 = 4x$ is equation of a parabola. What is the equation of the tangent which touchs parabola at $(4,4)$ ? I don't know how to solve it, please help.
(Excuse my bad grammer. Hope you understand what I mean)
Comment: Implicit derivation give us $\frac{dy}{dx}=\frac{2}{y}$ near of $(4,4)$, then the slope of the tangent line you are looking for is $m_{\text{tangent}}=\frac{2}{4}=\frac{1}{2}$.
Answer: If you don't know about derivatives, you can find the slope solving the system
$$\left\{\begin{array}{l}y^2=4x\\y-4=m(x-4)\end{array}\right.$$
If you solve it for $x$, the discriminant will be an expression on $m$, which should be $0$, since the line and the parabola have only one common point.


Custom UIToolBar using xib [Swift 3]

Question: Can I create a custom UIToolBar in a Xib file?
I am wanting to make a toolbar with a done button on the far left and a last/next button set on the left side. But I want to make sure that the constraints are such that it will scale correctly for each phone size. Is there an example?
Comment: Just wanted to add this link, I messed up a couple times and had to do this to get everything running right. http://stackoverflow.com/questions/29923881/could-not-insert-new-outlet-connection-could-not-find-any-information-for-the-c
Answer: Yes you can. First choose a xib as a template. Name the template "toolbar".
Then delete the default view it gives you. Go to the objects library in the bottom right hand corner and drag out a Toolbar.
You will get a default Bar Button Item on the far left. Rename this to "Done" then drag out another bar button item and rename it "Next" or "Last".
Now, create a new file. Choose Cococa Touch Class and make it a subclass of UIToolBar.
Go back to your tool bar xib and make its class the Cocoa Touch class you just created. In my example, I named mine ToolBarExample.
Now go to your ViewController class. In the ViewDidLoad add the following.
   override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.

    let toolBar = UINib(nibName: "toolbar", bundle: nil).instantiate(withOwner: nil, options: nil)[0] as! ToolBarExample

    toolBar.frame = CGRect(x: 0, y: self.view.frame.size.height - 46, width: self.view.frame.size.width, height: 46)

    toolBar.sizeToFit()

    view.addSubview(toolBar)

}

You can change change the scale, size and position of the toolbar by adjusting its frame. You can also adjust the toolbar xib and its bar button items from the Atrributes and Size Inspector. The final product of this example should be as follows in the Simulator.
Comment: Exactly what I was looking for! Thanks!

Custom UIToolBar using xib [Swift 3]


finding the minimum or maximum value subject to two constraints

Question: This is from my textbook

I have two questions:

it says that "since C lies on both constraint surfaces, $∇g(x_0, y_0,z_0)$ and
$∇h(x_0, y_0,z_0)$ are both orthogonal to $C$ at $(x_0, y_0,z_0)$". From my understanding, $∇g(x_0, y_0,z_0)$ and $∇h(x_0, y_0,z_0)$ are both orthogonal to its level surface, because they are orthogonal to its level surface, so they are also orthogonal to the curve that is in the level surface at $(x_0, y_0,z_0)$, is my understanding correct?
According to the picture,$∇g$ and $∇h$ are not even orthogonal to their level surfaces? And I don't understand why a curve can have two different orthogonal vector at one point?
Answer:
Your understanding seems correct.
The picture is misleading. You are correct in that the gradient of a level surface should be orthogonal to the tangent plane of the surface at the point where we are calculating the gradient.
As for your second concern, Suppose your curve $C$ has direction vector $(3,4,5)$ at a point $p$ on it, any vector $(x,y,z)$ satisfying $3x+4y+5z=0$ is an orthogonal vector to $C$ at $p$. So there is a while plane's worth of orthogonal vectors. A good rule of thumb is that if you are an $k$ dimensional object in $n$ dimensional space, you will generically have an $n-k$ dimensional subspace of orthogonal vectors. In our case, a curve has dimension $1$ and it lives in say $\mathbb R^3$, so there is a $2$ dimensional space (aka plane) worth of orthogonal vectors at most points on the curve.


c1841 unable to recognize HWIC-1T (smart serial) card. any idea?

Question: I have this problem where c1841 router unable to verify HWIC-1T card (with smart serial connector), you have to know that i have other routers with IOS
c1841-ipbasek9-mz.151-4.M5 and c1841-ipbasek9-mz.124-24.T5 on its flash and with ROM ver "Version 12.4(13r)T5, RELEASE SOFTWARE (fc1)" and those routers can recgonize the card succesfully so i just take the flash off from one of those routers and replace it with the flash of the router with the problem. i did some efforts as follows:
1.I have upgraded  ROM to "Version 12.4(13r)T5, RELEASE SOFTWARE (fc1)"
Green#show rom
ReadOnly ROMMON version:

System Bootstrap, Version 12.4(13r)T, RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 2006 by cisco Systems, Inc.

Upgrade ROMMON version:

System Bootstrap, Version 12.4(13r)T5, RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 2007 by cisco Systems, Inc.

Currently running ROMMON from Upgrade region
ROMMON from Upgrade region is selected for next boot

2.I have upgraded IOS to c1841-ipbasek9-mz.151-4.M5.bin and c1841-ipbasek9-mz.124-24.T5.bin and still have the same problem.
3.I have entered the command show diag and i got the following:
Green#show diag

Slot 0:

    C1841 2FE 2SLOT Mainboard Port adapter, 2 ports
        Port adapter is analyzed
        Port adapter insertion time 02:49:58 ago
        EEPROM contents at hardware discovery:
        Chassis MAC Address      : 001b.d506.c8c8
        MAC Address block size   : 34
        PCB Serial Number        : FOC111909DY
        Hardware Revision        : 7.0
        Part Number              : 73-8191-08
        Board Revision           : A0
        Top Assy. Part Number    : 800-23434-06
        Deviation Number         : 0
        Fab Version              : 04
        CLEI Code                : IPM7W00CRA
        RMA Test History         : 00
        RMA Number               : 0-0-0-0
        RMA History              : 00
        Product (FRU) Number     : CISCO1841
        Version Identifier       : V05
        Processor type           : 86
        Chassis Serial Number    : FHK11191972
        EEPROM format version 4
        EEPROM contents (hex):
          0x00: 04 FF C3 06 00 1B D5 06 C8 C8 43 00 22 C1 8B 46
          0x10: 4F 43 31 31 31 39 30 39 44 59 40 04 1B 41 07 00
          0x20: 82 49 1F FF 08 42 41 30 C0 46 03 20 00 5B 8A 06
          0x30: 88 00 00 00 00 02 04 C6 8A 49 50 4D 37 57 30 30
          0x40: 43 52 41 03 00 81 00 00 00 00 04 00 CB 89 43 49
          0x50: 53 43 4F 31 38 34 31 89 56 30 35 20 D9 02 C1 40
          0x60: 09 86 C2 8B 46 48 4B 31 31 31 39 31 39 37 32 FF
          0x70: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0x80: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0x90: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0xA0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0xB0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0xC0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0xD0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0xE0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0xF0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0x100: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0x110: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0x120: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0x130: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0x140: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0x150: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0x160: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0x170: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0x180: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0x190: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0x1A0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0x1B0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0x1C0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0x1D0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0x1E0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0x1F0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF

        WIC/HWIC Slot 0:
        Unknown WAN daughter card
        Unknown EEPROM ver 255
        EEPROM format version 255
        EEPROM contents (hex):
          0x20: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
          0x30: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF

3.these are show flash: outputs
Green#show flash:
-#- --length-- -----date/time------ path
1     27577580 Jan 02 2006 12:27:28 c1841-ipbasek9-mz.124-24.T5.bin
2         1038 Oct 11 2011 23:28:36 home.shtml
3         2746 Oct 11 2011 23:28:54 sdmconfig-18xx.cfg
4         5864 Feb 03 2013 22:16:54 PATCH9A45NVM.S37
5     34793740 Apr 03 2013 14:51:40 c1841-ipbasek9-mz.151-4.M5.bin

2736128 bytes available (62390272 bytes used)

4.these are show version outputs:
Green#show ver
Cisco IOS Software, 1841 Software (C1841-IPBASEK9-M), Version 12.4(24)T5, RELEAS
E SOFTWARE (fc3)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2011 by Cisco Systems, Inc.
Compiled Fri 04-Mar-11 02:48 by prod_rel_team

ROM: System Bootstrap, Version 12.4(13r)T5, RELEASE SOFTWARE (fc1)

Green uptime is 2 hours, 58 minutes
System returned to ROM by reload at 16:50:09 UTC Fri Apr 7 1972
System image file is "flash:c1841-ipbasek9-mz.124-24.T5.bin"

This product contains cryptographic features and is subject to United
States and local country laws governing import, export, transfer and
use. Delivery of Cisco cryptographic products does not imply
third-party authority to import, export, distribute or use encryption.
Importers, exporters, distributors and users are responsible for
compliance with U.S. and local country laws. By using this product you
agree to comply with applicable laws and regulations. If you are unable
to comply with U.S. and local laws, return this product immediately.

A summary of U.S. laws governing Cisco cryptographic products may be found at:
http://www.cisco.com/wwl/export/crypto/tool/stqrg.html

If you require further assistance please contact us by sending email to
email@example.com.

Cisco 1841 (revision 7.0) with 117760K/13312K bytes of memory.
Processor board ID FHK11191972
2 FastEthernet interfaces
DRAM configuration is 64 bits wide with parity disabled.
191K bytes of NVRAM.
63808K bytes of ATA CompactFlash (Read/Write)

Configuration register is 0x2102

5.startup-config file attached.
6.I have entered boot system flash:c1841-ipbasek9-mz.151-4.M5.bin command for testing IOS c1841-ipbasek9-mz.151-4.M5.bin but you will not find it on configration file attached.
Any suggestion? thanks in advance.
Answer: I would contact the place you bought the card from and request an RMA.
WIC/HWIC Slot 0:
    Unknown WAN daughter card
    Unknown EEPROM ver 255
    EEPROM format version 255
    EEPROM contents (hex):
      0x20: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
      0x30: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF

All 1's in the EEPROM looks unrecoverably bad, and from Cisco's website you're using code that should recognize that card.
Comment: If the problem 1841 is still under warranty or a support contract you should be able to return it for a replacement.  RMA means Return Merchandise Authorization, which refers to the fact you have to get the company to agree to replace/fix the broken device.
Comment: well the card is working on newer router c1841, so what you think?
Comment: What is newer about the router it's working in(IOS/ROM/hw version)?  And what does the 'show diag' report for the card in the new router?  I guess you could try reseating it in the original router and make sure it's making good contact.
Comment: IOS & ROM versions are the same on both routers but the old one still have the problem and i did test the same card on both of them it does work on the new router but it does not work on the old one.
Comment: Does the HWIC work in the other slot on the 'problem' 1841?  If that works you could shine a light inside the broken slot and check for bent pins, or just skip that and RMA the whole thing.  It is a weird `show diag` output you posted, never seen one like that before.
Comment: In the other slot the router can't see anything at all.
What you mean by RMA?
Answer: If this is the exact same model card in the exact same model router with the exact same IOS as you have working other places, you could have a hardware issue.
Steal a module from another router that is known working.  Does it work okay in the new router?  If it does, probably an HWIC issue.
If other HWICs don't work either, do you have any other models that you could try in the new router to see if the slot is possibly bad?
Comment: I have tested the HWIC in other router and its work just fine. i will try another HWIC on the router and see what i can get, thank you.
Comment: I have tried another HWIC and i got the same problem i think the router have hardware problems. Thank you.
Answer: I don't have any HWIC cards working in any 1841's (I've got many!) on IOS Version 12. You need to upgrade to 15.
EDIT: Actually, I read your question wrong. I have this problem with HWIC-ADSL2 cards, not tried any 1T cards. Eitherway, I still stand by my post; upgrading to IOS 15 solves this for me every time.
Comment: As i said i replaced the flash of the older router with flash that comes with new routers and this flash contains IOS Version 15.1 and still have the same problem, so what you think?
Comment: I have had a look and one of them is running c1841-entbasek9-mz.150-1.M9.bin another is running c1841-broadband-mz.150-1.M8.bin. What IOS 15 did you try?
Comment: i tried c1841-ipbasek9-mz.151-4.M5.bin it does work on newer router but not on the old one.